@uwrl/qc-utils 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1471 -1273
- package/dist/index.umd.cjs +14 -14
- package/dist/models/dataSource.d.ts +173 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/payload.d.ts +24 -0
- package/dist/models/settings.d.ts +65 -0
- package/dist/models/timestamp.d.ts +150 -0
- package/dist/services/__tests__/createPatchObject.spec.d.ts +1 -0
- package/dist/services/__tests__/requestInterceptor.spec.d.ts +1 -0
- package/dist/services/__tests__/responseInterceptor.spec.d.ts +1 -0
- package/dist/services/api.d.ts +147 -0
- package/dist/services/apiMethods.d.ts +8 -0
- package/dist/services/createPatchObject.d.ts +17 -0
- package/dist/services/getCSRFToken.d.ts +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/requestInterceptor.d.ts +12 -0
- package/dist/services/responseInterceptor.d.ts +2 -0
- package/dist/types/index.d.ts +406 -0
- package/dist/utils/__tests__/ellapsed-time.spec.d.ts +1 -0
- package/dist/utils/__tests__/format.spec.d.ts +1 -0
- package/dist/utils/__tests__/notifications.spec.d.ts +1 -0
- package/dist/utils/__tests__/observations.spec.d.ts +1 -0
- package/dist/utils/ellapsed-time.d.ts +4 -0
- package/dist/utils/format.d.ts +4 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/notifications.d.ts +46 -0
- package/dist/utils/observations.d.ts +5 -0
- package/dist/utils/plotting/__tests__/calibration.spec.d.ts +16 -0
- package/dist/utils/plotting/__tests__/mock.d.ts +4 -0
- package/dist/utils/plotting/__tests__/observation-record-paths.spec.d.ts +21 -0
- package/dist/utils/plotting/__tests__/observation-record.spec.d.ts +1 -0
- package/dist/utils/plotting/__tests__/operation-cores.spec.d.ts +12 -0
- package/dist/utils/plotting/__tests__/script.spec.d.ts +1 -0
- package/dist/utils/plotting/__tests__/workerMocks.d.ts +119 -0
- package/dist/utils/plotting/__tests__/workers.spec.d.ts +18 -0
- package/dist/utils/plotting/add-data.worker.d.ts +1 -0
- package/dist/utils/plotting/calibration.d.ts +99 -0
- package/dist/utils/plotting/change-values.worker.d.ts +1 -0
- package/dist/utils/plotting/change.worker.d.ts +1 -0
- package/dist/utils/plotting/delete-data.worker.d.ts +1 -0
- package/dist/utils/plotting/drift-correction.worker.d.ts +1 -0
- package/dist/utils/plotting/fill-gaps.worker.d.ts +1 -0
- package/dist/utils/plotting/find-gaps.worker.d.ts +1 -0
- package/dist/utils/plotting/interpolate.worker.d.ts +1 -0
- package/dist/utils/plotting/observation-record.d.ts +363 -0
- package/dist/utils/plotting/operation-cores.d.ts +139 -0
- package/dist/utils/plotting/persistence.worker.d.ts +1 -0
- package/dist/utils/plotting/rate-of-change.worker.d.ts +1 -0
- package/dist/utils/plotting/script.d.ts +67 -0
- package/dist/utils/plotting/shift-datetimes.worker.d.ts +1 -0
- package/dist/utils/plotting/value-threshold.worker.d.ts +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
class
|
|
1
|
+
var x = /* @__PURE__ */ ((e) => (e.SECOND = "s", e.MINUTE = "m", e.HOUR = "h", e.DAY = "D", e.WEEK = "W", e.MONTH = "M", e.YEAR = "Y", e))(x || {}), E = /* @__PURE__ */ ((e) => (e.ADD_POINTS = "ADD_POINTS", e.CHANGE_VALUES = "CHANGE_VALUES", e.ASSIGN_VALUES_BULK = "ASSIGN_VALUES_BULK", e.DELETE_POINTS = "DELETE_POINTS", e.DRIFT_CORRECTION = "DRIFT_CORRECTION", e.INTERPOLATE = "INTERPOLATE", e.SHIFT_DATETIMES = "SHIFT_DATETIMES", e.ASSIGN_DATETIMES_BULK = "ASSIGN_DATETIMES_BULK", e.FILL_GAPS = "FILL_GAPS", e))(E || {}), A = /* @__PURE__ */ ((e) => (e.FIND_GAPS = "FIND_GAPS", e.PERSISTENCE = "PERSISTENCE", e.CHANGE = "CHANGE", e.RATE_OF_CHANGE = "RATE_OF_CHANGE", e.VALUE_THRESHOLD = "VALUE_THRESHOLD", e.DATETIME_RANGE = "DATETIME_RANGE", e.SELECTION = "SELECTION", e))(A || {}), K = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(K || {}), jt = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.SUB = "SUB", e.MULT = "MULT", e.DIV = "DIV", e.ASSIGN = "ASSIGN", e))(jt || {}), Wt = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(Wt || {});
|
|
2
|
+
class Yt {
|
|
3
3
|
id;
|
|
4
4
|
thingId;
|
|
5
5
|
link;
|
|
@@ -11,7 +11,7 @@ class Nt {
|
|
|
11
11
|
this.id = "", this.thingId = "", this.link = "", this.frequency = null, this.path = "HydroShare", this.datastreamIds = [], this.publicResource = !1;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class Kr extends Yt {
|
|
15
15
|
resourceTitle;
|
|
16
16
|
resourceAbstract;
|
|
17
17
|
resourceKeywords;
|
|
@@ -19,7 +19,7 @@ class Hr extends Nt {
|
|
|
19
19
|
super(), this.resourceTitle = void 0, this.resourceAbstract = void 0, this.resourceKeywords = void 0;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class Gt {
|
|
23
23
|
latitude;
|
|
24
24
|
longitude;
|
|
25
25
|
elevation_m;
|
|
@@ -31,11 +31,11 @@ class jt {
|
|
|
31
31
|
this.elevationDatum = "WGS84", this.state = "", this.county = "", this.country = "";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class Zr {
|
|
35
35
|
id;
|
|
36
36
|
workspaceId;
|
|
37
37
|
name;
|
|
38
|
-
location = new
|
|
38
|
+
location = new Gt();
|
|
39
39
|
tags;
|
|
40
40
|
hydroShareArchive;
|
|
41
41
|
siteType;
|
|
@@ -48,7 +48,7 @@ class zr {
|
|
|
48
48
|
this.id = "", this.workspaceId = "", this.name = "", this.tags = [], this.siteType = "", this.samplingFeatureCode = "", this.isPrivate = !1, this.description = "", this.samplingFeatureType = "Site", this.dataDisclaimer = "";
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class es {
|
|
52
52
|
id;
|
|
53
53
|
workspaceId;
|
|
54
54
|
name;
|
|
@@ -78,7 +78,7 @@ class Xr {
|
|
|
78
78
|
this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.thingId = t || "", this.observationType = "OM_Measurement", this.resultType = "Time Series Coverage", this.sampledMedium = "", this.noDataValue = -9999, this.aggregationStatistic = "", this.unitId = "", this.observedPropertyId = "", this.sensorId = "", this.processingLevelId = "", this.timeAggregationInterval = null, this.timeAggregationIntervalUnit = "seconds", this.isPrivate = !0, this.isVisible = !0, this.valueCount = 0;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
class
|
|
81
|
+
class ts {
|
|
82
82
|
id;
|
|
83
83
|
workspaceId;
|
|
84
84
|
name;
|
|
@@ -89,7 +89,7 @@ class Vr {
|
|
|
89
89
|
this.id = "", this.workspaceId = "", this.name = "", this.symbol = "", this.definition = "", this.type = "";
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
class
|
|
92
|
+
class rs {
|
|
93
93
|
id;
|
|
94
94
|
workspaceId;
|
|
95
95
|
name;
|
|
@@ -105,7 +105,7 @@ class qr {
|
|
|
105
105
|
this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.manufacturer = "", this.model = "", this.methodType = "Instrument Deployment", this.methodCode = "", this.methodLink = "", this.encodingType = "application/json", this.modelLink = "";
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
class
|
|
108
|
+
class ss {
|
|
109
109
|
id;
|
|
110
110
|
workspaceId;
|
|
111
111
|
name;
|
|
@@ -117,7 +117,7 @@ class Jr {
|
|
|
117
117
|
this.id = "", this.workspaceId = "", this.name = "", this.definition = "", this.description = "", this.type = "Hydrology", this.code = "";
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
class
|
|
120
|
+
class ns {
|
|
121
121
|
id;
|
|
122
122
|
workspaceId;
|
|
123
123
|
code;
|
|
@@ -127,7 +127,7 @@ class Kr {
|
|
|
127
127
|
this.id = "", this.workspaceId = "", this.code = "", this.definition = "", this.explanation = "";
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
class
|
|
130
|
+
class os {
|
|
131
131
|
id;
|
|
132
132
|
workspaceId;
|
|
133
133
|
code;
|
|
@@ -136,7 +136,7 @@ class Qr {
|
|
|
136
136
|
this.id = "", this.workspaceId = "", this.code = "", this.description = "";
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class
|
|
139
|
+
class as {
|
|
140
140
|
name;
|
|
141
141
|
code;
|
|
142
142
|
type;
|
|
@@ -145,7 +145,7 @@ class Zr {
|
|
|
145
145
|
constructor() {
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
class
|
|
148
|
+
class is {
|
|
149
149
|
id;
|
|
150
150
|
email;
|
|
151
151
|
password;
|
|
@@ -163,7 +163,7 @@ class en {
|
|
|
163
163
|
this.id = "", this.email = "", this.password = "", this.firstName = "", this.middleName = "", this.lastName = "", this.phone = "", this.address = "", this.type = "", this.link = "", this.accountType = "standard", this.hydroShareConnected = !1;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
class
|
|
166
|
+
class cs {
|
|
167
167
|
id;
|
|
168
168
|
name;
|
|
169
169
|
iconLink;
|
|
@@ -173,8 +173,8 @@ class tn {
|
|
|
173
173
|
this.id = "", this.name = "", this.iconLink = "", this.signupEnabled = !0, this.connectEnabled = !0;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
var
|
|
177
|
-
class
|
|
176
|
+
var Ht = /* @__PURE__ */ ((e) => (e.Global = "*", e.View = "view", e.Create = "create", e.Edit = "edit", e.Delete = "delete", e))(Ht || {}), zt = /* @__PURE__ */ ((e) => (e.Global = "*", e.Workspace = "Workspace", e.Collaborator = "Collaborator", e.Thing = "Thing", e.Datastream = "Datastream", e.Sensor = "Sensor", e.Unit = "Unit", e.ObservedProperty = "ObservedProperty", e.ProcessingLevel = "ProcessingLevel", e.Observation = "Observation", e))(zt || {});
|
|
177
|
+
class ls {
|
|
178
178
|
id = "";
|
|
179
179
|
key = "";
|
|
180
180
|
name = "";
|
|
@@ -189,7 +189,7 @@ class rn {
|
|
|
189
189
|
Object.assign(this, t);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
class
|
|
192
|
+
class us {
|
|
193
193
|
id;
|
|
194
194
|
name;
|
|
195
195
|
isPrivate;
|
|
@@ -200,7 +200,7 @@ class nn {
|
|
|
200
200
|
this.id = "", this.name = "", this.isPrivate = !1, this.owner = null, this.collaboratorRole = null, this.pendingTransferTo = null;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
class
|
|
203
|
+
class hs {
|
|
204
204
|
user;
|
|
205
205
|
role;
|
|
206
206
|
constructor() {
|
|
@@ -223,25 +223,25 @@ class sn {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ft() {
|
|
227
227
|
const e = "csrftoken=", r = decodeURIComponent(document.cookie).split(";");
|
|
228
|
-
for (const
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
return
|
|
228
|
+
for (const s of r) {
|
|
229
|
+
const n = s.trim();
|
|
230
|
+
if (n.startsWith(e))
|
|
231
|
+
return n.substring(e.length);
|
|
232
232
|
}
|
|
233
233
|
return null;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function dt(e) {
|
|
236
236
|
let t = e.headers ? { ...e.headers } : {}, r;
|
|
237
|
-
return e.body !== void 0 && (r = typeof e.body == "string" || e.body instanceof FormData ? e.body : JSON.stringify(e.body)), t["X-CSRFToken"] =
|
|
237
|
+
return e.body !== void 0 && (r = typeof e.body == "string" || e.body instanceof FormData ? e.body : JSON.stringify(e.body)), t["X-CSRFToken"] = ft() || "", {
|
|
238
238
|
...e,
|
|
239
239
|
headers: t,
|
|
240
240
|
body: r,
|
|
241
241
|
credentials: "omit"
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Xt(e) {
|
|
245
245
|
if (Array.isArray(e?.errors) && e.errors.length && (e = e.errors[0]), typeof e != "object" || e === null)
|
|
246
246
|
return "An unknown error occurred.";
|
|
247
247
|
const t = ["message", "detail", "error"];
|
|
@@ -249,7 +249,7 @@ function Yt(e) {
|
|
|
249
249
|
if (e[r]) return e[r];
|
|
250
250
|
return "An unknown error occurred.";
|
|
251
251
|
}
|
|
252
|
-
async function
|
|
252
|
+
async function pt(e) {
|
|
253
253
|
if (e.headers.get("Content-Length") === "0" || e.statusText === "No Content")
|
|
254
254
|
return null;
|
|
255
255
|
const t = e.headers.get("content-type") || "";
|
|
@@ -257,112 +257,112 @@ async function ht(e) {
|
|
|
257
257
|
if (t.includes("application/json"))
|
|
258
258
|
try {
|
|
259
259
|
r = await e.json();
|
|
260
|
-
} catch (
|
|
261
|
-
console.error("Failed to parse error JSON:",
|
|
260
|
+
} catch (n) {
|
|
261
|
+
console.error("Failed to parse error JSON:", n);
|
|
262
262
|
}
|
|
263
263
|
else if (t.includes("text/csv"))
|
|
264
264
|
try {
|
|
265
265
|
r = await e.blob();
|
|
266
|
-
} catch (
|
|
267
|
-
console.error("Failed to parse error JSON:",
|
|
266
|
+
} catch (n) {
|
|
267
|
+
console.error("Failed to parse error JSON:", n);
|
|
268
268
|
}
|
|
269
269
|
if (e.ok || e.status === 401) return r;
|
|
270
|
-
const
|
|
270
|
+
const s = {
|
|
271
271
|
status: e.status,
|
|
272
|
-
message:
|
|
272
|
+
message: Xt(r)
|
|
273
273
|
};
|
|
274
|
-
throw console.error("API response not OK:",
|
|
275
|
-
}
|
|
276
|
-
var
|
|
277
|
-
return
|
|
278
|
-
r.__proto__ =
|
|
279
|
-
} || function(r,
|
|
280
|
-
for (var
|
|
281
|
-
},
|
|
274
|
+
throw console.error("API response not OK:", s.message), s;
|
|
275
|
+
}
|
|
276
|
+
var _e = function(e, t) {
|
|
277
|
+
return _e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
|
|
278
|
+
r.__proto__ = s;
|
|
279
|
+
} || function(r, s) {
|
|
280
|
+
for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (r[n] = s[n]);
|
|
281
|
+
}, _e(e, t);
|
|
282
282
|
};
|
|
283
|
-
function
|
|
283
|
+
function fe(e, t) {
|
|
284
284
|
if (typeof t != "function" && t !== null)
|
|
285
285
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
286
|
-
|
|
286
|
+
_e(e, t);
|
|
287
287
|
function r() {
|
|
288
288
|
this.constructor = e;
|
|
289
289
|
}
|
|
290
290
|
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t],
|
|
292
|
+
function Ae(e) {
|
|
293
|
+
var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], s = 0;
|
|
294
294
|
if (r) return r.call(e);
|
|
295
295
|
if (e && typeof e.length == "number") return {
|
|
296
296
|
next: function() {
|
|
297
|
-
return e &&
|
|
297
|
+
return e && s >= e.length && (e = void 0), { value: e && e[s++], done: !e };
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Te(e, t) {
|
|
303
303
|
var r = typeof Symbol == "function" && e[Symbol.iterator];
|
|
304
304
|
if (!r) return e;
|
|
305
|
-
var
|
|
305
|
+
var s = r.call(e), n, o = [], a;
|
|
306
306
|
try {
|
|
307
|
-
for (; (t === void 0 || t-- > 0) && !(
|
|
307
|
+
for (; (t === void 0 || t-- > 0) && !(n = s.next()).done; ) o.push(n.value);
|
|
308
308
|
} catch (i) {
|
|
309
|
-
|
|
309
|
+
a = { error: i };
|
|
310
310
|
} finally {
|
|
311
311
|
try {
|
|
312
|
-
|
|
312
|
+
n && !n.done && (r = s.return) && r.call(s);
|
|
313
313
|
} finally {
|
|
314
|
-
if (
|
|
314
|
+
if (a) throw a.error;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
return
|
|
317
|
+
return o;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
if (r || arguments.length === 2) for (var
|
|
321
|
-
(
|
|
322
|
-
return e.concat(
|
|
319
|
+
function Le(e, t, r) {
|
|
320
|
+
if (r || arguments.length === 2) for (var s = 0, n = t.length, o; s < n; s++)
|
|
321
|
+
(o || !(s in t)) && (o || (o = Array.prototype.slice.call(t, 0, s)), o[s] = t[s]);
|
|
322
|
+
return e.concat(o || Array.prototype.slice.call(t));
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function B(e) {
|
|
325
325
|
return typeof e == "function";
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
var t = function(
|
|
329
|
-
Error.call(
|
|
327
|
+
function yt(e) {
|
|
328
|
+
var t = function(s) {
|
|
329
|
+
Error.call(s), s.stack = new Error().stack;
|
|
330
330
|
}, r = e(t);
|
|
331
331
|
return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
|
|
332
332
|
}
|
|
333
|
-
var
|
|
333
|
+
var ge = yt(function(e) {
|
|
334
334
|
return function(r) {
|
|
335
335
|
e(this), this.message = r ? r.length + ` errors occurred during unsubscription:
|
|
336
|
-
` + r.map(function(
|
|
337
|
-
return
|
|
336
|
+
` + r.map(function(s, n) {
|
|
337
|
+
return n + 1 + ") " + s.toString();
|
|
338
338
|
}).join(`
|
|
339
339
|
`) : "", this.name = "UnsubscriptionError", this.errors = r;
|
|
340
340
|
};
|
|
341
341
|
});
|
|
342
|
-
function
|
|
342
|
+
function $e(e, t) {
|
|
343
343
|
if (e) {
|
|
344
344
|
var r = e.indexOf(t);
|
|
345
345
|
0 <= r && e.splice(r, 1);
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
var
|
|
348
|
+
var de = (function() {
|
|
349
349
|
function e(t) {
|
|
350
350
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
351
351
|
}
|
|
352
352
|
return e.prototype.unsubscribe = function() {
|
|
353
|
-
var t, r,
|
|
353
|
+
var t, r, s, n, o;
|
|
354
354
|
if (!this.closed) {
|
|
355
355
|
this.closed = !0;
|
|
356
|
-
var
|
|
357
|
-
if (
|
|
358
|
-
if (this._parentage = null, Array.isArray(
|
|
356
|
+
var a = this._parentage;
|
|
357
|
+
if (a)
|
|
358
|
+
if (this._parentage = null, Array.isArray(a))
|
|
359
359
|
try {
|
|
360
|
-
for (var i =
|
|
360
|
+
for (var i = Ae(a), l = i.next(); !l.done; l = i.next()) {
|
|
361
361
|
var f = l.value;
|
|
362
362
|
f.remove(this);
|
|
363
363
|
}
|
|
364
|
-
} catch (
|
|
365
|
-
t = { error:
|
|
364
|
+
} catch (u) {
|
|
365
|
+
t = { error: u };
|
|
366
366
|
} finally {
|
|
367
367
|
try {
|
|
368
368
|
l && !l.done && (r = i.return) && r.call(i);
|
|
@@ -371,44 +371,44 @@ var ue = (function() {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
else
|
|
374
|
-
|
|
375
|
-
var
|
|
376
|
-
if (
|
|
374
|
+
a.remove(this);
|
|
375
|
+
var h = this.initialTeardown;
|
|
376
|
+
if (B(h))
|
|
377
377
|
try {
|
|
378
|
-
|
|
379
|
-
} catch (
|
|
380
|
-
|
|
378
|
+
h();
|
|
379
|
+
} catch (u) {
|
|
380
|
+
o = u instanceof ge ? u.errors : [u];
|
|
381
381
|
}
|
|
382
|
-
var
|
|
383
|
-
if (
|
|
382
|
+
var y = this._finalizers;
|
|
383
|
+
if (y) {
|
|
384
384
|
this._finalizers = null;
|
|
385
385
|
try {
|
|
386
|
-
for (var
|
|
387
|
-
var d =
|
|
386
|
+
for (var p = Ae(y), g = p.next(); !g.done; g = p.next()) {
|
|
387
|
+
var d = g.value;
|
|
388
388
|
try {
|
|
389
|
-
|
|
390
|
-
} catch (
|
|
391
|
-
|
|
389
|
+
Be(d);
|
|
390
|
+
} catch (u) {
|
|
391
|
+
o = o ?? [], u instanceof ge ? o = Le(Le([], Te(o)), Te(u.errors)) : o.push(u);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
} catch (
|
|
395
|
-
|
|
394
|
+
} catch (u) {
|
|
395
|
+
s = { error: u };
|
|
396
396
|
} finally {
|
|
397
397
|
try {
|
|
398
|
-
|
|
398
|
+
g && !g.done && (n = p.return) && n.call(p);
|
|
399
399
|
} finally {
|
|
400
|
-
if (
|
|
400
|
+
if (s) throw s.error;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
if (
|
|
405
|
-
throw new
|
|
404
|
+
if (o)
|
|
405
|
+
throw new ge(o);
|
|
406
406
|
}
|
|
407
407
|
}, e.prototype.add = function(t) {
|
|
408
408
|
var r;
|
|
409
409
|
if (t && t !== this)
|
|
410
410
|
if (this.closed)
|
|
411
|
-
|
|
411
|
+
Be(t);
|
|
412
412
|
else {
|
|
413
413
|
if (t instanceof e) {
|
|
414
414
|
if (t.closed || t._hasParent(this))
|
|
@@ -425,52 +425,52 @@ var ue = (function() {
|
|
|
425
425
|
this._parentage = Array.isArray(r) ? (r.push(t), r) : r ? [r, t] : t;
|
|
426
426
|
}, e.prototype._removeParent = function(t) {
|
|
427
427
|
var r = this._parentage;
|
|
428
|
-
r === t ? this._parentage = null : Array.isArray(r) &&
|
|
428
|
+
r === t ? this._parentage = null : Array.isArray(r) && $e(r, t);
|
|
429
429
|
}, e.prototype.remove = function(t) {
|
|
430
430
|
var r = this._finalizers;
|
|
431
|
-
r &&
|
|
431
|
+
r && $e(r, t), t instanceof e && t._removeParent(this);
|
|
432
432
|
}, e.EMPTY = (function() {
|
|
433
433
|
var t = new e();
|
|
434
434
|
return t.closed = !0, t;
|
|
435
435
|
})(), e;
|
|
436
|
-
})(),
|
|
437
|
-
function
|
|
438
|
-
return e instanceof
|
|
436
|
+
})(), gt = de.EMPTY;
|
|
437
|
+
function mt(e) {
|
|
438
|
+
return e instanceof de || e && "closed" in e && B(e.remove) && B(e.add) && B(e.unsubscribe);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
|
|
440
|
+
function Be(e) {
|
|
441
|
+
B(e) ? e() : e.unsubscribe();
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var Vt = {
|
|
444
444
|
Promise: void 0
|
|
445
|
-
},
|
|
445
|
+
}, qt = {
|
|
446
446
|
setTimeout: function(e, t) {
|
|
447
|
-
for (var r = [],
|
|
448
|
-
r[
|
|
449
|
-
return setTimeout.apply(void 0,
|
|
447
|
+
for (var r = [], s = 2; s < arguments.length; s++)
|
|
448
|
+
r[s - 2] = arguments[s];
|
|
449
|
+
return setTimeout.apply(void 0, Le([e, t], Te(r)));
|
|
450
450
|
},
|
|
451
451
|
clearTimeout: function(e) {
|
|
452
452
|
return clearTimeout(e);
|
|
453
453
|
},
|
|
454
454
|
delegate: void 0
|
|
455
455
|
};
|
|
456
|
-
function
|
|
457
|
-
|
|
456
|
+
function Jt(e) {
|
|
457
|
+
qt.setTimeout(function() {
|
|
458
458
|
throw e;
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function je() {
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function ie(e) {
|
|
464
464
|
e();
|
|
465
465
|
}
|
|
466
|
-
var
|
|
467
|
-
|
|
466
|
+
var wt = (function(e) {
|
|
467
|
+
fe(t, e);
|
|
468
468
|
function t(r) {
|
|
469
|
-
var
|
|
470
|
-
return
|
|
469
|
+
var s = e.call(this) || this;
|
|
470
|
+
return s.isStopped = !1, r ? (s.destination = r, mt(r) && r.add(s)) : s.destination = Zt, s;
|
|
471
471
|
}
|
|
472
|
-
return t.create = function(r,
|
|
473
|
-
return new
|
|
472
|
+
return t.create = function(r, s, n) {
|
|
473
|
+
return new Re(r, s, n);
|
|
474
474
|
}, t.prototype.next = function(r) {
|
|
475
475
|
this.isStopped || this._next(r);
|
|
476
476
|
}, t.prototype.error = function(r) {
|
|
@@ -494,7 +494,7 @@ var yt = (function(e) {
|
|
|
494
494
|
this.unsubscribe();
|
|
495
495
|
}
|
|
496
496
|
}, t;
|
|
497
|
-
})(
|
|
497
|
+
})(de), Qt = (function() {
|
|
498
498
|
function e(t) {
|
|
499
499
|
this.partialObserver = t;
|
|
500
500
|
}
|
|
@@ -503,77 +503,77 @@ var yt = (function(e) {
|
|
|
503
503
|
if (r.next)
|
|
504
504
|
try {
|
|
505
505
|
r.next(t);
|
|
506
|
-
} catch (
|
|
507
|
-
|
|
506
|
+
} catch (s) {
|
|
507
|
+
se(s);
|
|
508
508
|
}
|
|
509
509
|
}, e.prototype.error = function(t) {
|
|
510
510
|
var r = this.partialObserver;
|
|
511
511
|
if (r.error)
|
|
512
512
|
try {
|
|
513
513
|
r.error(t);
|
|
514
|
-
} catch (
|
|
515
|
-
|
|
514
|
+
} catch (s) {
|
|
515
|
+
se(s);
|
|
516
516
|
}
|
|
517
517
|
else
|
|
518
|
-
|
|
518
|
+
se(t);
|
|
519
519
|
}, e.prototype.complete = function() {
|
|
520
520
|
var t = this.partialObserver;
|
|
521
521
|
if (t.complete)
|
|
522
522
|
try {
|
|
523
523
|
t.complete();
|
|
524
524
|
} catch (r) {
|
|
525
|
-
|
|
525
|
+
se(r);
|
|
526
526
|
}
|
|
527
527
|
}, e;
|
|
528
|
-
})(),
|
|
529
|
-
|
|
530
|
-
function t(r,
|
|
531
|
-
var
|
|
532
|
-
return
|
|
528
|
+
})(), Re = (function(e) {
|
|
529
|
+
fe(t, e);
|
|
530
|
+
function t(r, s, n) {
|
|
531
|
+
var o = e.call(this) || this, a;
|
|
532
|
+
return B(r) || !r ? a = {
|
|
533
533
|
next: r ?? void 0,
|
|
534
|
-
error:
|
|
535
|
-
complete:
|
|
536
|
-
} :
|
|
534
|
+
error: s ?? void 0,
|
|
535
|
+
complete: n ?? void 0
|
|
536
|
+
} : a = r, o.destination = new Qt(a), o;
|
|
537
537
|
}
|
|
538
538
|
return t;
|
|
539
|
-
})(
|
|
540
|
-
function
|
|
541
|
-
|
|
539
|
+
})(wt);
|
|
540
|
+
function se(e) {
|
|
541
|
+
Jt(e);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Kt(e) {
|
|
544
544
|
throw e;
|
|
545
545
|
}
|
|
546
|
-
var
|
|
546
|
+
var Zt = {
|
|
547
547
|
closed: !0,
|
|
548
|
-
next:
|
|
549
|
-
error:
|
|
550
|
-
complete:
|
|
551
|
-
},
|
|
548
|
+
next: je,
|
|
549
|
+
error: Kt,
|
|
550
|
+
complete: je
|
|
551
|
+
}, er = (function() {
|
|
552
552
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
553
553
|
})();
|
|
554
|
-
function
|
|
554
|
+
function tr(e) {
|
|
555
555
|
return e;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
return e.length === 0 ?
|
|
559
|
-
return e.reduce(function(
|
|
560
|
-
return s
|
|
557
|
+
function rr(e) {
|
|
558
|
+
return e.length === 0 ? tr : e.length === 1 ? e[0] : function(r) {
|
|
559
|
+
return e.reduce(function(s, n) {
|
|
560
|
+
return n(s);
|
|
561
561
|
}, r);
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
var
|
|
564
|
+
var We = (function() {
|
|
565
565
|
function e(t) {
|
|
566
566
|
t && (this._subscribe = t);
|
|
567
567
|
}
|
|
568
568
|
return e.prototype.lift = function(t) {
|
|
569
569
|
var r = new e();
|
|
570
570
|
return r.source = this, r.operator = t, r;
|
|
571
|
-
}, e.prototype.subscribe = function(t, r,
|
|
572
|
-
var
|
|
573
|
-
return
|
|
574
|
-
var
|
|
575
|
-
|
|
576
|
-
}),
|
|
571
|
+
}, e.prototype.subscribe = function(t, r, s) {
|
|
572
|
+
var n = this, o = nr(t) ? t : new Re(t, r, s);
|
|
573
|
+
return ie(function() {
|
|
574
|
+
var a = n, i = a.operator, l = a.source;
|
|
575
|
+
o.add(i ? i.call(o, l) : l ? n._subscribe(o) : n._trySubscribe(o));
|
|
576
|
+
}), o;
|
|
577
577
|
}, e.prototype._trySubscribe = function(t) {
|
|
578
578
|
try {
|
|
579
579
|
return this._subscribe(t);
|
|
@@ -581,110 +581,110 @@ var Ne = (function() {
|
|
|
581
581
|
t.error(r);
|
|
582
582
|
}
|
|
583
583
|
}, e.prototype.forEach = function(t, r) {
|
|
584
|
-
var
|
|
585
|
-
return r =
|
|
586
|
-
var
|
|
584
|
+
var s = this;
|
|
585
|
+
return r = Ye(r), new r(function(n, o) {
|
|
586
|
+
var a = new Re({
|
|
587
587
|
next: function(i) {
|
|
588
588
|
try {
|
|
589
589
|
t(i);
|
|
590
590
|
} catch (l) {
|
|
591
|
-
|
|
591
|
+
o(l), a.unsubscribe();
|
|
592
592
|
}
|
|
593
593
|
},
|
|
594
|
-
error:
|
|
595
|
-
complete:
|
|
594
|
+
error: o,
|
|
595
|
+
complete: n
|
|
596
596
|
});
|
|
597
|
-
|
|
597
|
+
s.subscribe(a);
|
|
598
598
|
});
|
|
599
599
|
}, e.prototype._subscribe = function(t) {
|
|
600
600
|
var r;
|
|
601
601
|
return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t);
|
|
602
|
-
}, e.prototype[
|
|
602
|
+
}, e.prototype[er] = function() {
|
|
603
603
|
return this;
|
|
604
604
|
}, e.prototype.pipe = function() {
|
|
605
605
|
for (var t = [], r = 0; r < arguments.length; r++)
|
|
606
606
|
t[r] = arguments[r];
|
|
607
|
-
return
|
|
607
|
+
return rr(t)(this);
|
|
608
608
|
}, e.prototype.toPromise = function(t) {
|
|
609
609
|
var r = this;
|
|
610
|
-
return t =
|
|
611
|
-
var
|
|
612
|
-
r.subscribe(function(
|
|
613
|
-
return
|
|
614
|
-
}, function(
|
|
615
|
-
return s(o);
|
|
616
|
-
}, function() {
|
|
610
|
+
return t = Ye(t), new t(function(s, n) {
|
|
611
|
+
var o;
|
|
612
|
+
r.subscribe(function(a) {
|
|
613
|
+
return o = a;
|
|
614
|
+
}, function(a) {
|
|
617
615
|
return n(a);
|
|
616
|
+
}, function() {
|
|
617
|
+
return s(o);
|
|
618
618
|
});
|
|
619
619
|
});
|
|
620
620
|
}, e.create = function(t) {
|
|
621
621
|
return new e(t);
|
|
622
622
|
}, e;
|
|
623
623
|
})();
|
|
624
|
-
function
|
|
624
|
+
function Ye(e) {
|
|
625
625
|
var t;
|
|
626
|
-
return (t = e ??
|
|
626
|
+
return (t = e ?? Vt.Promise) !== null && t !== void 0 ? t : Promise;
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
return e &&
|
|
628
|
+
function sr(e) {
|
|
629
|
+
return e && B(e.next) && B(e.error) && B(e.complete);
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
return e && e instanceof
|
|
631
|
+
function nr(e) {
|
|
632
|
+
return e && e instanceof wt || sr(e) && mt(e);
|
|
633
633
|
}
|
|
634
|
-
var
|
|
634
|
+
var or = yt(function(e) {
|
|
635
635
|
return function() {
|
|
636
636
|
e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
637
637
|
};
|
|
638
|
-
}),
|
|
639
|
-
|
|
638
|
+
}), bt = (function(e) {
|
|
639
|
+
fe(t, e);
|
|
640
640
|
function t() {
|
|
641
641
|
var r = e.call(this) || this;
|
|
642
642
|
return r.closed = !1, r.currentObservers = null, r.observers = [], r.isStopped = !1, r.hasError = !1, r.thrownError = null, r;
|
|
643
643
|
}
|
|
644
644
|
return t.prototype.lift = function(r) {
|
|
645
|
-
var
|
|
646
|
-
return
|
|
645
|
+
var s = new Ge(this, this);
|
|
646
|
+
return s.operator = r, s;
|
|
647
647
|
}, t.prototype._throwIfClosed = function() {
|
|
648
648
|
if (this.closed)
|
|
649
|
-
throw new
|
|
649
|
+
throw new or();
|
|
650
650
|
}, t.prototype.next = function(r) {
|
|
651
|
-
var
|
|
652
|
-
|
|
653
|
-
var
|
|
654
|
-
if (
|
|
655
|
-
|
|
651
|
+
var s = this;
|
|
652
|
+
ie(function() {
|
|
653
|
+
var n, o;
|
|
654
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
655
|
+
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
656
656
|
try {
|
|
657
|
-
for (var
|
|
657
|
+
for (var a = Ae(s.currentObservers), i = a.next(); !i.done; i = a.next()) {
|
|
658
658
|
var l = i.value;
|
|
659
659
|
l.next(r);
|
|
660
660
|
}
|
|
661
661
|
} catch (f) {
|
|
662
|
-
|
|
662
|
+
n = { error: f };
|
|
663
663
|
} finally {
|
|
664
664
|
try {
|
|
665
|
-
i && !i.done && (
|
|
665
|
+
i && !i.done && (o = a.return) && o.call(a);
|
|
666
666
|
} finally {
|
|
667
|
-
if (
|
|
667
|
+
if (n) throw n.error;
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
});
|
|
672
672
|
}, t.prototype.error = function(r) {
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
if (
|
|
676
|
-
|
|
677
|
-
for (var
|
|
678
|
-
|
|
673
|
+
var s = this;
|
|
674
|
+
ie(function() {
|
|
675
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
676
|
+
s.hasError = s.isStopped = !0, s.thrownError = r;
|
|
677
|
+
for (var n = s.observers; n.length; )
|
|
678
|
+
n.shift().error(r);
|
|
679
679
|
}
|
|
680
680
|
});
|
|
681
681
|
}, t.prototype.complete = function() {
|
|
682
682
|
var r = this;
|
|
683
|
-
|
|
683
|
+
ie(function() {
|
|
684
684
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
685
685
|
r.isStopped = !0;
|
|
686
|
-
for (var
|
|
687
|
-
|
|
686
|
+
for (var s = r.observers; s.length; )
|
|
687
|
+
s.shift().complete();
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
690
|
}, t.prototype.unsubscribe = function() {
|
|
@@ -701,59 +701,59 @@ var rr = ft(function(e) {
|
|
|
701
701
|
}, t.prototype._subscribe = function(r) {
|
|
702
702
|
return this._throwIfClosed(), this._checkFinalizedStatuses(r), this._innerSubscribe(r);
|
|
703
703
|
}, t.prototype._innerSubscribe = function(r) {
|
|
704
|
-
var
|
|
705
|
-
return
|
|
706
|
-
|
|
704
|
+
var s = this, n = this, o = n.hasError, a = n.isStopped, i = n.observers;
|
|
705
|
+
return o || a ? gt : (this.currentObservers = null, i.push(r), new de(function() {
|
|
706
|
+
s.currentObservers = null, $e(i, r);
|
|
707
707
|
}));
|
|
708
708
|
}, t.prototype._checkFinalizedStatuses = function(r) {
|
|
709
|
-
var
|
|
710
|
-
|
|
709
|
+
var s = this, n = s.hasError, o = s.thrownError, a = s.isStopped;
|
|
710
|
+
n ? r.error(o) : a && r.complete();
|
|
711
711
|
}, t.prototype.asObservable = function() {
|
|
712
|
-
var r = new
|
|
712
|
+
var r = new We();
|
|
713
713
|
return r.source = this, r;
|
|
714
|
-
}, t.create = function(r,
|
|
715
|
-
return new
|
|
714
|
+
}, t.create = function(r, s) {
|
|
715
|
+
return new Ge(r, s);
|
|
716
716
|
}, t;
|
|
717
|
-
})(
|
|
718
|
-
|
|
719
|
-
function t(r,
|
|
720
|
-
var
|
|
721
|
-
return
|
|
717
|
+
})(We), Ge = (function(e) {
|
|
718
|
+
fe(t, e);
|
|
719
|
+
function t(r, s) {
|
|
720
|
+
var n = e.call(this) || this;
|
|
721
|
+
return n.destination = r, n.source = s, n;
|
|
722
722
|
}
|
|
723
723
|
return t.prototype.next = function(r) {
|
|
724
|
-
var
|
|
725
|
-
(
|
|
724
|
+
var s, n;
|
|
725
|
+
(n = (s = this.destination) === null || s === void 0 ? void 0 : s.next) === null || n === void 0 || n.call(s, r);
|
|
726
726
|
}, t.prototype.error = function(r) {
|
|
727
|
-
var
|
|
728
|
-
(
|
|
727
|
+
var s, n;
|
|
728
|
+
(n = (s = this.destination) === null || s === void 0 ? void 0 : s.error) === null || n === void 0 || n.call(s, r);
|
|
729
729
|
}, t.prototype.complete = function() {
|
|
730
|
-
var r,
|
|
731
|
-
(
|
|
730
|
+
var r, s;
|
|
731
|
+
(s = (r = this.destination) === null || r === void 0 ? void 0 : r.complete) === null || s === void 0 || s.call(r);
|
|
732
732
|
}, t.prototype._subscribe = function(r) {
|
|
733
|
-
var
|
|
734
|
-
return (
|
|
733
|
+
var s, n;
|
|
734
|
+
return (n = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(r)) !== null && n !== void 0 ? n : gt;
|
|
735
735
|
}, t;
|
|
736
|
-
})(
|
|
737
|
-
const
|
|
738
|
-
var
|
|
739
|
-
class
|
|
740
|
-
constructor(t = "", r = "info",
|
|
741
|
-
this.message = t, this.color = r, this.icon =
|
|
736
|
+
})(bt);
|
|
737
|
+
const St = 3e3;
|
|
738
|
+
var Et = /* @__PURE__ */ ((e) => (e.Warning = "warning", e.Success = "success", e.Error = "error", e.Info = "info", e))(Et || {}), vt = /* @__PURE__ */ ((e) => (e.Success = "mdi-checkbox-marked-circle", e.Warning = "mdi-alert", e.Error = "mdi-alert-circle", e.Info = "mdi-information", e.None = "none", e))(vt || {}), kt = /* @__PURE__ */ ((e) => (e.Warning = "Warning", e.Success = "Success", e.Error = "Error", e.Info = "Info", e))(kt || {}), ar = /* @__PURE__ */ ((e) => (e.Center = "center", e.Left = "left", e.Right = "right", e.Bottom = "bottom", e.Top = "top", e))(ar || {});
|
|
739
|
+
class ir {
|
|
740
|
+
constructor(t = "", r = "info", s = "none", n = "Info", o = St, a = "center", i = !1) {
|
|
741
|
+
this.message = t, this.color = r, this.icon = s, this.title = n, this.timeout = o, this.position = a, this.visible = i;
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
-
class
|
|
745
|
-
static subject = new
|
|
744
|
+
class cr {
|
|
745
|
+
static subject = new bt();
|
|
746
746
|
static get snack$() {
|
|
747
747
|
return this.subject.asObservable();
|
|
748
748
|
}
|
|
749
749
|
static createSnackbar(t, r) {
|
|
750
750
|
this.subject.next(
|
|
751
|
-
new
|
|
751
|
+
new ir(
|
|
752
752
|
t,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
Et[r],
|
|
754
|
+
vt[r],
|
|
755
|
+
kt[r],
|
|
756
|
+
St,
|
|
757
757
|
"bottom",
|
|
758
758
|
!0
|
|
759
759
|
)
|
|
@@ -788,29 +788,29 @@ class or {
|
|
|
788
788
|
);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function _t(e, t) {
|
|
792
792
|
const r = {};
|
|
793
|
-
for (let
|
|
794
|
-
if (Array.isArray(t[
|
|
795
|
-
JSON.stringify(e[
|
|
796
|
-
else if (e[
|
|
797
|
-
const
|
|
798
|
-
Object.keys(
|
|
799
|
-
} else JSON.stringify(e[
|
|
793
|
+
for (let s in t)
|
|
794
|
+
if (Array.isArray(t[s]))
|
|
795
|
+
JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
|
|
796
|
+
else if (e[s] && typeof e[s] == "object" && t[s] && typeof t[s] == "object") {
|
|
797
|
+
const n = _t(e[s], t[s]);
|
|
798
|
+
Object.keys(n).length > 0 && (r[s] = n);
|
|
799
|
+
} else JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
|
|
800
800
|
return r;
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function lr(e) {
|
|
803
803
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
804
804
|
}
|
|
805
|
-
var
|
|
806
|
-
function
|
|
807
|
-
if (
|
|
808
|
-
|
|
805
|
+
var me, He;
|
|
806
|
+
function ur() {
|
|
807
|
+
if (He) return me;
|
|
808
|
+
He = 1;
|
|
809
809
|
class e {
|
|
810
810
|
/// value;
|
|
811
811
|
/// next;
|
|
812
|
-
constructor(
|
|
813
|
-
this.value =
|
|
812
|
+
constructor(s) {
|
|
813
|
+
this.value = s, this.next = void 0;
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
class t {
|
|
@@ -821,14 +821,14 @@ function ir() {
|
|
|
821
821
|
constructor() {
|
|
822
822
|
this.clear();
|
|
823
823
|
}
|
|
824
|
-
enqueue(
|
|
825
|
-
const
|
|
826
|
-
this._head ? (this._tail.next =
|
|
824
|
+
enqueue(s) {
|
|
825
|
+
const n = new e(s);
|
|
826
|
+
this._head ? (this._tail.next = n, this._tail = n) : (this._head = n, this._tail = n), this._size++;
|
|
827
827
|
}
|
|
828
828
|
dequeue() {
|
|
829
|
-
const
|
|
830
|
-
if (
|
|
831
|
-
return this._head = this._head.next, this._size--,
|
|
829
|
+
const s = this._head;
|
|
830
|
+
if (s)
|
|
831
|
+
return this._head = this._head.next, this._size--, s.value;
|
|
832
832
|
}
|
|
833
833
|
clear() {
|
|
834
834
|
this._head = void 0, this._tail = void 0, this._size = 0;
|
|
@@ -837,91 +837,91 @@ function ir() {
|
|
|
837
837
|
return this._size;
|
|
838
838
|
}
|
|
839
839
|
*[Symbol.iterator]() {
|
|
840
|
-
let
|
|
841
|
-
for (;
|
|
842
|
-
yield
|
|
840
|
+
let s = this._head;
|
|
841
|
+
for (; s; )
|
|
842
|
+
yield s.value, s = s.next;
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
return
|
|
845
|
+
return me = t, me;
|
|
846
846
|
}
|
|
847
|
-
var
|
|
848
|
-
function
|
|
849
|
-
if (
|
|
850
|
-
|
|
851
|
-
const e =
|
|
852
|
-
return
|
|
847
|
+
var we, ze;
|
|
848
|
+
function hr() {
|
|
849
|
+
if (ze) return we;
|
|
850
|
+
ze = 1;
|
|
851
|
+
const e = ur();
|
|
852
|
+
return we = (r) => {
|
|
853
853
|
if (!((Number.isInteger(r) || r === 1 / 0) && r > 0))
|
|
854
854
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
855
|
-
const
|
|
856
|
-
let
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
},
|
|
860
|
-
|
|
861
|
-
const
|
|
862
|
-
|
|
855
|
+
const s = new e();
|
|
856
|
+
let n = 0;
|
|
857
|
+
const o = () => {
|
|
858
|
+
n--, s.size > 0 && s.dequeue()();
|
|
859
|
+
}, a = async (f, h, ...y) => {
|
|
860
|
+
n++;
|
|
861
|
+
const p = (async () => f(...y))();
|
|
862
|
+
h(p);
|
|
863
863
|
try {
|
|
864
|
-
await
|
|
864
|
+
await p;
|
|
865
865
|
} catch {
|
|
866
866
|
}
|
|
867
|
-
|
|
868
|
-
}, i = (f,
|
|
869
|
-
|
|
870
|
-
}, l = (f, ...
|
|
871
|
-
i(f,
|
|
867
|
+
o();
|
|
868
|
+
}, i = (f, h, ...y) => {
|
|
869
|
+
s.enqueue(a.bind(null, f, h, ...y)), (async () => (await Promise.resolve(), n < r && s.size > 0 && s.dequeue()()))();
|
|
870
|
+
}, l = (f, ...h) => new Promise((y) => {
|
|
871
|
+
i(f, y, ...h);
|
|
872
872
|
});
|
|
873
873
|
return Object.defineProperties(l, {
|
|
874
874
|
activeCount: {
|
|
875
|
-
get: () =>
|
|
875
|
+
get: () => n
|
|
876
876
|
},
|
|
877
877
|
pendingCount: {
|
|
878
|
-
get: () =>
|
|
878
|
+
get: () => s.size
|
|
879
879
|
},
|
|
880
880
|
clearQueue: {
|
|
881
881
|
value: () => {
|
|
882
|
-
|
|
882
|
+
s.clear();
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
885
|
}), l;
|
|
886
|
-
},
|
|
886
|
+
}, we;
|
|
887
887
|
}
|
|
888
|
-
var
|
|
889
|
-
const
|
|
890
|
-
async function
|
|
891
|
-
const r =
|
|
888
|
+
var fr = hr();
|
|
889
|
+
const dr = /* @__PURE__ */ lr(fr), G = dr(10), pr = 1e3;
|
|
890
|
+
async function V(e, t) {
|
|
891
|
+
const r = dt(t);
|
|
892
892
|
try {
|
|
893
|
-
const
|
|
894
|
-
return await
|
|
895
|
-
} catch (
|
|
896
|
-
throw
|
|
893
|
+
const s = await fetch(e, r);
|
|
894
|
+
return await pt(s);
|
|
895
|
+
} catch (s) {
|
|
896
|
+
throw s instanceof TypeError && cr.error("Network error. Please check your connection."), s;
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
899
|
const c = {
|
|
900
900
|
async fetch(e, t = {}) {
|
|
901
|
-
return t.method = "GET", await G(() =>
|
|
901
|
+
return t.method = "GET", await G(() => V(e, t));
|
|
902
902
|
},
|
|
903
|
-
async patch(e, t, r = null,
|
|
904
|
-
if (
|
|
905
|
-
return await G(() =>
|
|
903
|
+
async patch(e, t, r = null, s = {}) {
|
|
904
|
+
if (s.method = "PATCH", s.body = r ? _t(r, t) : t, Object.keys(s.body).length !== 0)
|
|
905
|
+
return await G(() => V(e, s));
|
|
906
906
|
},
|
|
907
907
|
async post(e, t = void 0, r = {}) {
|
|
908
|
-
return r.method = "POST", r.body = t, await G(() =>
|
|
908
|
+
return r.method = "POST", r.body = t, await G(() => V(e, r));
|
|
909
909
|
},
|
|
910
910
|
async put(e, t = void 0, r = {}) {
|
|
911
|
-
return r.method = "PUT", r.body = t, await G(() =>
|
|
911
|
+
return r.method = "PUT", r.body = t, await G(() => V(e, r));
|
|
912
912
|
},
|
|
913
913
|
async delete(e, t = void 0, r = {}) {
|
|
914
|
-
return r.method = "DELETE", r.body = t, await G(() =>
|
|
914
|
+
return r.method = "DELETE", r.body = t, await G(() => V(e, r));
|
|
915
915
|
},
|
|
916
916
|
async paginatedFetch(e, t) {
|
|
917
|
-
const r = t ??
|
|
918
|
-
for (let
|
|
919
|
-
const
|
|
920
|
-
f.push(...
|
|
917
|
+
const r = t ?? pr, s = e.includes("?") ? "&" : "?", n = `${e}${s}page_size=${r}&page=1`, o = dt({ method: "GET" }), a = await G(() => fetch(n, o)), i = Number(a.headers.get("x-total-pages")) || 1, f = [...await pt(a)];
|
|
918
|
+
for (let h = 2; h <= i; h++) {
|
|
919
|
+
const y = `${e}${s}page_size=${r}&page=${h}`, p = await G(() => V(y, { method: "GET" }));
|
|
920
|
+
f.push(...p);
|
|
921
921
|
}
|
|
922
922
|
return f;
|
|
923
923
|
}
|
|
924
|
-
},
|
|
924
|
+
}, Xe = {
|
|
925
925
|
HTTP: {
|
|
926
926
|
type: "HTTP",
|
|
927
927
|
sourceUri: "",
|
|
@@ -932,7 +932,7 @@ const c = {
|
|
|
932
932
|
sourceUri: "",
|
|
933
933
|
placeholderVariables: []
|
|
934
934
|
}
|
|
935
|
-
},
|
|
935
|
+
}, Ve = {
|
|
936
936
|
JSON: {
|
|
937
937
|
type: "JSON",
|
|
938
938
|
timestamp: {
|
|
@@ -955,18 +955,18 @@ const c = {
|
|
|
955
955
|
identifierType: "name"
|
|
956
956
|
/* Name */
|
|
957
957
|
}
|
|
958
|
-
},
|
|
958
|
+
}, qe = {
|
|
959
959
|
HydroServer: {
|
|
960
960
|
type: "HydroServer"
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
|
-
class
|
|
963
|
+
class fs {
|
|
964
964
|
name = "";
|
|
965
965
|
settings = {
|
|
966
966
|
type: "SDL",
|
|
967
|
-
extractor: JSON.parse(JSON.stringify(
|
|
968
|
-
transformer: JSON.parse(JSON.stringify(
|
|
969
|
-
loader: JSON.parse(JSON.stringify(
|
|
967
|
+
extractor: JSON.parse(JSON.stringify(Xe.local)),
|
|
968
|
+
transformer: JSON.parse(JSON.stringify(Ve.CSV)),
|
|
969
|
+
loader: JSON.parse(JSON.stringify(qe.HydroServer)),
|
|
970
970
|
payloads: []
|
|
971
971
|
};
|
|
972
972
|
id = "";
|
|
@@ -988,19 +988,19 @@ class on {
|
|
|
988
988
|
}
|
|
989
989
|
switchExtractor(t) {
|
|
990
990
|
this.settings.extractor = JSON.parse(
|
|
991
|
-
JSON.stringify(
|
|
991
|
+
JSON.stringify(Xe[t])
|
|
992
992
|
);
|
|
993
993
|
}
|
|
994
994
|
switchTransformer(t) {
|
|
995
995
|
this.settings.transformer = JSON.parse(
|
|
996
|
-
JSON.stringify(
|
|
996
|
+
JSON.stringify(Ve[t])
|
|
997
997
|
);
|
|
998
998
|
}
|
|
999
999
|
switchLoader(t) {
|
|
1000
|
-
this.settings.loader = JSON.parse(JSON.stringify(
|
|
1000
|
+
this.settings.loader = JSON.parse(JSON.stringify(qe[t]));
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function Je(e) {
|
|
1004
1004
|
return {
|
|
1005
1005
|
name: e.name,
|
|
1006
1006
|
settings: e.settings,
|
|
@@ -1010,40 +1010,40 @@ function Ve(e) {
|
|
|
1010
1010
|
status: e.status
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
const
|
|
1014
|
-
let
|
|
1015
|
-
return
|
|
1016
|
-
},
|
|
1017
|
-
const
|
|
1013
|
+
const F = "https://lro.hydroserver.org/api", Ue = `${F}/auth`, C = `${Ue}/browser/account`, be = `${Ue}/browser/session`, ce = `${Ue}/browser/provider`, $ = `${F}/data/workspaces`, Se = `${F}/data/roles`, I = `${F}/data/datastreams`, W = `${F}/data/sensors`, _ = `${F}/data/things`, Qe = `${_}/tags`, q = `${F}/data/orchestration-systems`, N = `${F}/data/data-sources`, H = `${F}/data/observed-properties`, J = `${F}/data/processing-levels`, Z = `${F}/data/result-qualifiers`, z = `${F}/data/units`, ds = (e, t, r, s, n) => {
|
|
1014
|
+
let o = `${I}/${e}/observations?format=column`;
|
|
1015
|
+
return o += `&order_by=phenomenonTime&page_size=${t}`, o += `&phenomenon_time_min=${encodeURIComponent(r)}`, s && (o += `&phenomenon_time_max=${encodeURIComponent(s)}`), n && (o += `&page=${n}`), o;
|
|
1016
|
+
}, yr = (e, t, r) => {
|
|
1017
|
+
const s = {
|
|
1018
1018
|
provider: e,
|
|
1019
1019
|
callback_url: t,
|
|
1020
1020
|
process: r
|
|
1021
|
-
},
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1021
|
+
}, n = ft(), o = document.createElement("form");
|
|
1022
|
+
if (o.method = "POST", o.action = `${ce}/redirect`, n) {
|
|
1023
|
+
const a = document.createElement("input");
|
|
1024
|
+
a.type = "hidden", a.name = "csrfmiddlewaretoken", a.value = n, o.appendChild(a);
|
|
1025
1025
|
}
|
|
1026
|
-
for (const
|
|
1026
|
+
for (const a in s) {
|
|
1027
1027
|
const i = document.createElement("input");
|
|
1028
|
-
i.type = "hidden", i.name =
|
|
1029
|
-
}
|
|
1030
|
-
document.body.appendChild(
|
|
1031
|
-
},
|
|
1032
|
-
fetchSession: async () => c.fetch(`${
|
|
1033
|
-
login: async (e, t) => c.post(`${
|
|
1034
|
-
logout: async () => c.delete(`${
|
|
1035
|
-
fetchUser: async () => c.fetch(`${
|
|
1036
|
-
signup: async (e) => c.post(`${
|
|
1037
|
-
updateUser: async (e, t) => c.patch(`${
|
|
1038
|
-
deleteUser: async () => c.delete(`${
|
|
1039
|
-
sendVerificationEmail: async (e) => c.put(`${
|
|
1028
|
+
i.type = "hidden", i.name = a, i.value = s[a] || "", o.appendChild(i);
|
|
1029
|
+
}
|
|
1030
|
+
document.body.appendChild(o), o.submit();
|
|
1031
|
+
}, ps = {
|
|
1032
|
+
fetchSession: async () => c.fetch(`${be}`),
|
|
1033
|
+
login: async (e, t) => c.post(`${be}`, { email: e, password: t }),
|
|
1034
|
+
logout: async () => c.delete(`${be}`),
|
|
1035
|
+
fetchUser: async () => c.fetch(`${C}`),
|
|
1036
|
+
signup: async (e) => c.post(`${C}`, e),
|
|
1037
|
+
updateUser: async (e, t) => c.patch(`${C}`, e, t),
|
|
1038
|
+
deleteUser: async () => c.delete(`${C}`),
|
|
1039
|
+
sendVerificationEmail: async (e) => c.put(`${C}/email/verify`, {
|
|
1040
1040
|
email: e
|
|
1041
1041
|
}),
|
|
1042
|
-
verifyEmailWithCode: async (e) => c.post(`${
|
|
1043
|
-
requestPasswordReset: async (e) => c.post(`${
|
|
1042
|
+
verifyEmailWithCode: async (e) => c.post(`${C}/email/verify`, { key: e }),
|
|
1043
|
+
requestPasswordReset: async (e) => c.post(`${C}/password/request`, {
|
|
1044
1044
|
email: e
|
|
1045
1045
|
}),
|
|
1046
|
-
resetPassword: async (e, t) => c.post(`${
|
|
1046
|
+
resetPassword: async (e, t) => c.post(`${C}/password/reset`, {
|
|
1047
1047
|
key: e,
|
|
1048
1048
|
password: t
|
|
1049
1049
|
}),
|
|
@@ -1060,9 +1060,9 @@ const O = "https://lro.hydroserver.org/api", Me = `${O}/auth`, x = `${Me}/browse
|
|
|
1060
1060
|
transferWorkspace: async (e, t) => c.post(`${$}/${e}/transfer`, { newOwner: t }),
|
|
1061
1061
|
acceptWorkspaceTransfer: async (e) => c.put(`${$}/${e}/transfer`),
|
|
1062
1062
|
rejectWorkspaceTransfer: async (e) => c.delete(`${$}/${e}/transfer`),
|
|
1063
|
-
getCollaboratorRoles: async (e) => c.paginatedFetch(`${
|
|
1064
|
-
getAPIKeyRoles: async (e) => c.paginatedFetch(`${
|
|
1065
|
-
getRole: async (e) => c.fetch(`${
|
|
1063
|
+
getCollaboratorRoles: async (e) => c.paginatedFetch(`${Se}?is_user_role=true`),
|
|
1064
|
+
getAPIKeyRoles: async (e) => c.paginatedFetch(`${Se}?is_apikey_role=true`),
|
|
1065
|
+
getRole: async (e) => c.fetch(`${Se}/${e}`),
|
|
1066
1066
|
getCollaborators: async (e) => c.paginatedFetch(`${$}/${e}/collaborators`),
|
|
1067
1067
|
addCollaborator: async (e, t, r) => c.post(`${$}/${e}/collaborators`, {
|
|
1068
1068
|
email: t,
|
|
@@ -1107,19 +1107,19 @@ const O = "https://lro.hydroserver.org/api", Me = `${O}/auth`, x = `${Me}/browse
|
|
|
1107
1107
|
`${$}/${e}/api-keys/${t}/regenerate?expand_related=true`
|
|
1108
1108
|
),
|
|
1109
1109
|
deleteApiKey: async (e, t) => c.delete(`${$}/${e}/api-keys/${t}`),
|
|
1110
|
-
fetchConnectedProviders: async () => c.fetch(`${
|
|
1111
|
-
providerRedirect:
|
|
1112
|
-
providerSignup: async (e) => c.post(`${
|
|
1113
|
-
deleteProvider: async (e, t) => c.delete(`${
|
|
1110
|
+
fetchConnectedProviders: async () => c.fetch(`${ce}/connections`),
|
|
1111
|
+
providerRedirect: yr,
|
|
1112
|
+
providerSignup: async (e) => c.post(`${ce}/signup`, e),
|
|
1113
|
+
deleteProvider: async (e, t) => c.delete(`${ce}/connections`, {
|
|
1114
1114
|
provider: e,
|
|
1115
1115
|
account: t
|
|
1116
1116
|
}),
|
|
1117
|
-
createUnit: async (e) => c.post(
|
|
1118
|
-
fetchUnits: async () => c.paginatedFetch(`${
|
|
1119
|
-
fetchWorkspaceUnits: async (e) => c.paginatedFetch(`${
|
|
1120
|
-
updateUnit: async (e, t = null) => c.patch(`${
|
|
1121
|
-
deleteUnit: async (e) => c.delete(`${
|
|
1122
|
-
getUnit: async (e) => c.fetch(`${
|
|
1117
|
+
createUnit: async (e) => c.post(z, e),
|
|
1118
|
+
fetchUnits: async () => c.paginatedFetch(`${z}`),
|
|
1119
|
+
fetchWorkspaceUnits: async (e) => c.paginatedFetch(`${z}?workspace_id=${e}`),
|
|
1120
|
+
updateUnit: async (e, t = null) => c.patch(`${z}/${e.id}`, e, t),
|
|
1121
|
+
deleteUnit: async (e) => c.delete(`${z}/${e}`),
|
|
1122
|
+
getUnit: async (e) => c.fetch(`${z}/${e}`),
|
|
1123
1123
|
removeThingOwner: async (e, t) => c.patch(`${_}/${e}/ownership`, {
|
|
1124
1124
|
email: t,
|
|
1125
1125
|
removeOwner: !0
|
|
@@ -1150,9 +1150,9 @@ const O = "https://lro.hydroserver.org/api", Me = `${O}/auth`, x = `${Me}/browse
|
|
|
1150
1150
|
createSiteTag: async (e, t) => c.post(`${_}/${e}/tags`, t),
|
|
1151
1151
|
editSiteTag: async (e, t) => c.put(`${_}/${e}/tags`, t),
|
|
1152
1152
|
fetchSiteTags: async (e) => c.fetch(`${_}/${e}/tags`),
|
|
1153
|
-
fetchUsersSiteTags: async () => c.fetch(`${
|
|
1153
|
+
fetchUsersSiteTags: async () => c.fetch(`${Qe}`),
|
|
1154
1154
|
deleteSiteTag: async (e, t) => c.delete(`${_}/${e}/tags`, t),
|
|
1155
|
-
fetchWorkspaceTags: async (e) => c.fetch(`${
|
|
1155
|
+
fetchWorkspaceTags: async (e) => c.fetch(`${Qe}/keys?workspace_id=${e}`),
|
|
1156
1156
|
createHydroShareArchive: async (e) => c.post(`${_}/${e.thingId}/archive`, e),
|
|
1157
1157
|
updateHydroShareArchive: async (e, t) => c.patch(
|
|
1158
1158
|
`${_}/${e.thingId}/archive`,
|
|
@@ -1162,101 +1162,101 @@ const O = "https://lro.hydroserver.org/api", Me = `${O}/auth`, x = `${Me}/browse
|
|
|
1162
1162
|
fetchHydroShareArchive: async (e) => c.fetch(`${_}/${e}/archive`),
|
|
1163
1163
|
deleteHydroShareArchive: async (e) => c.delete(`${_}/${e}/archive`),
|
|
1164
1164
|
archiveToHydroShare: async (e) => c.post(`${_}/${e}/archive/trigger`),
|
|
1165
|
-
createDatastream: async (e) => c.post(
|
|
1165
|
+
createDatastream: async (e) => c.post(I, e),
|
|
1166
1166
|
fetchDatastreams: async (e) => {
|
|
1167
1167
|
const t = [];
|
|
1168
1168
|
if (e)
|
|
1169
|
-
for (const [
|
|
1170
|
-
t.push(`${encodeURIComponent(
|
|
1169
|
+
for (const [s, n] of Object.entries(e))
|
|
1170
|
+
t.push(`${encodeURIComponent(s)}=${encodeURIComponent(n)}`);
|
|
1171
1171
|
const r = t.length ? `?${t.join("&")}` : "";
|
|
1172
|
-
return c.paginatedFetch(`${
|
|
1172
|
+
return c.paginatedFetch(`${I}${r}`);
|
|
1173
1173
|
},
|
|
1174
|
-
fetchDatastreamsForThing: async (e) => c.paginatedFetch(`${
|
|
1174
|
+
fetchDatastreamsForThing: async (e) => c.paginatedFetch(`${I}?thing_id=${e}`),
|
|
1175
1175
|
fetchExpandedDatastreamsForThing: async (e) => c.paginatedFetch(
|
|
1176
|
-
`${
|
|
1176
|
+
`${I}?thing_id=${e}&expand_related=true`
|
|
1177
1177
|
),
|
|
1178
|
-
fetchDatastreamsForDataSource: async (e) => c.paginatedFetch(`${
|
|
1179
|
-
fetchDatastream: async (e) => c.fetch(`${
|
|
1180
|
-
fetchDatastreamExpanded: async (e) => c.fetch(`${
|
|
1181
|
-
fetchUsersDatastreams: async () => c.paginatedFetch(`${
|
|
1182
|
-
updateDatastream: async (e, t = null) => c.patch(`${
|
|
1183
|
-
deleteDatastream: async (e) => c.delete(`${
|
|
1184
|
-
downloadDatastreamCSV: async (e) => c.fetch(`${
|
|
1185
|
-
createObservedProperty: async (e) => c.post(
|
|
1186
|
-
fetchObservedProperty: async (e) => c.fetch(`${
|
|
1187
|
-
fetchObservedProperties: async () => c.paginatedFetch(`${
|
|
1188
|
-
fetchWorkspaceObservedProperties: async (e) => c.paginatedFetch(`${
|
|
1189
|
-
updateObservedProperty: async (e, t = null) => c.patch(`${
|
|
1190
|
-
deleteObservedProperty: async (e) => c.delete(`${
|
|
1191
|
-
createProcessingLevel: async (e) => c.post(
|
|
1192
|
-
fetchProcessingLevels: async () => c.paginatedFetch(`${
|
|
1193
|
-
fetchProcessingLevel: async (e) => c.fetch(`${
|
|
1194
|
-
fetchWorkspaceProcessingLevels: async (e) => c.paginatedFetch(`${
|
|
1195
|
-
updateProcessingLevel: async (e, t = null) => c.patch(`${
|
|
1196
|
-
deleteProcessingLevel: async (e) => c.delete(`${
|
|
1197
|
-
createSensor: async (e) => c.post(
|
|
1198
|
-
fetchSensors: async () => c.paginatedFetch(`${
|
|
1199
|
-
fetchSensor: async (e) => c.fetch(`${
|
|
1200
|
-
fetchWorkspaceSensors: async (e) => c.paginatedFetch(`${
|
|
1201
|
-
updateSensor: async (e, t = null) => c.patch(`${
|
|
1202
|
-
deleteSensor: async (e) => c.delete(`${
|
|
1203
|
-
createResultQualifier: async (e) => c.post(
|
|
1204
|
-
fetchResultQualifiers: async () => c.paginatedFetch(`${
|
|
1205
|
-
fetchWorkspaceResultQualifiers: async (e) => c.paginatedFetch(`${
|
|
1178
|
+
fetchDatastreamsForDataSource: async (e) => c.paginatedFetch(`${I}?data_source_id=${e}`),
|
|
1179
|
+
fetchDatastream: async (e) => c.fetch(`${I}/${e}`),
|
|
1180
|
+
fetchDatastreamExpanded: async (e) => c.fetch(`${I}/${e}?expand_related=true`),
|
|
1181
|
+
fetchUsersDatastreams: async () => c.paginatedFetch(`${I}?exclude_unowned=true`),
|
|
1182
|
+
updateDatastream: async (e, t = null) => c.patch(`${I}/${e.id}`, e, t),
|
|
1183
|
+
deleteDatastream: async (e) => c.delete(`${I}/${e}`),
|
|
1184
|
+
downloadDatastreamCSV: async (e) => c.fetch(`${I}/${e}/csv`),
|
|
1185
|
+
createObservedProperty: async (e) => c.post(H, e),
|
|
1186
|
+
fetchObservedProperty: async (e) => c.fetch(`${H}/${e}`),
|
|
1187
|
+
fetchObservedProperties: async () => c.paginatedFetch(`${H}`),
|
|
1188
|
+
fetchWorkspaceObservedProperties: async (e) => c.paginatedFetch(`${H}?workspace_id=${e}`),
|
|
1189
|
+
updateObservedProperty: async (e, t = null) => c.patch(`${H}/${e.id}`, e, t),
|
|
1190
|
+
deleteObservedProperty: async (e) => c.delete(`${H}/${e}`),
|
|
1191
|
+
createProcessingLevel: async (e) => c.post(J, e),
|
|
1192
|
+
fetchProcessingLevels: async () => c.paginatedFetch(`${J}`),
|
|
1193
|
+
fetchProcessingLevel: async (e) => c.fetch(`${J}/${e}`),
|
|
1194
|
+
fetchWorkspaceProcessingLevels: async (e) => c.paginatedFetch(`${J}?workspace_id=${e}`),
|
|
1195
|
+
updateProcessingLevel: async (e, t = null) => c.patch(`${J}/${e.id}`, e, t),
|
|
1196
|
+
deleteProcessingLevel: async (e) => c.delete(`${J}/${e}`),
|
|
1197
|
+
createSensor: async (e) => c.post(W, e),
|
|
1198
|
+
fetchSensors: async () => c.paginatedFetch(`${W}`),
|
|
1199
|
+
fetchSensor: async (e) => c.fetch(`${W}/${e}`),
|
|
1200
|
+
fetchWorkspaceSensors: async (e) => c.paginatedFetch(`${W}?workspace_id=${e}`),
|
|
1201
|
+
updateSensor: async (e, t = null) => c.patch(`${W}/${e.id}`, e, t),
|
|
1202
|
+
deleteSensor: async (e) => c.delete(`${W}/${e}`),
|
|
1203
|
+
createResultQualifier: async (e) => c.post(Z, e),
|
|
1204
|
+
fetchResultQualifiers: async () => c.paginatedFetch(`${Z}`),
|
|
1205
|
+
fetchWorkspaceResultQualifiers: async (e) => c.paginatedFetch(`${Z}?workspace_id=${e}`),
|
|
1206
1206
|
updateResultQualifier: async (e, t = null) => c.patch(
|
|
1207
|
-
`${
|
|
1207
|
+
`${Z}/${e.id}`,
|
|
1208
1208
|
e,
|
|
1209
1209
|
t
|
|
1210
1210
|
),
|
|
1211
|
-
deleteResultQualifier: async (e) => c.delete(`${
|
|
1212
|
-
createOrchestrationSystem: async (e) => c.post(
|
|
1213
|
-
fetchOrchestrationSystems: async () => c.paginatedFetch(
|
|
1214
|
-
fetchWorkspaceOrchestrationSystems: async (e) => c.paginatedFetch(`${
|
|
1215
|
-
fetchOrchestrationSystem: async (e) => c.fetch(`${
|
|
1216
|
-
updateOrchestrationSystem: async (e, t) => c.patch(`${
|
|
1217
|
-
deleteOrchestrationSystem: async (e) => c.delete(`${
|
|
1211
|
+
deleteResultQualifier: async (e) => c.delete(`${Z}/${e}`),
|
|
1212
|
+
createOrchestrationSystem: async (e) => c.post(q, e),
|
|
1213
|
+
fetchOrchestrationSystems: async () => c.paginatedFetch(q),
|
|
1214
|
+
fetchWorkspaceOrchestrationSystems: async (e) => c.paginatedFetch(`${q}?workspace_id=${e}`),
|
|
1215
|
+
fetchOrchestrationSystem: async (e) => c.fetch(`${q}/${e}`),
|
|
1216
|
+
updateOrchestrationSystem: async (e, t) => c.patch(`${q}/${e}`, t),
|
|
1217
|
+
deleteOrchestrationSystem: async (e) => c.delete(`${q}/${e}`),
|
|
1218
1218
|
createDataSource: async (e) => c.post(
|
|
1219
|
-
`${
|
|
1220
|
-
|
|
1219
|
+
`${N}?expand_related=true`,
|
|
1220
|
+
Je(e)
|
|
1221
1221
|
),
|
|
1222
|
-
fetchDataSources: async () => c.paginatedFetch(`${
|
|
1222
|
+
fetchDataSources: async () => c.paginatedFetch(`${N}?expand_related=true`),
|
|
1223
1223
|
fetchWorkspaceDataSources: async (e) => c.paginatedFetch(
|
|
1224
|
-
`${
|
|
1224
|
+
`${N}?workspace_id=${e}&expand_related=true`
|
|
1225
1225
|
),
|
|
1226
|
-
fetchDataSource: async (e) => c.fetch(`${
|
|
1226
|
+
fetchDataSource: async (e) => c.fetch(`${N}/${e}?expand_related=true`),
|
|
1227
1227
|
updateDataSource: async (e) => c.patch(
|
|
1228
|
-
`${
|
|
1229
|
-
|
|
1228
|
+
`${N}/${e.id}?expand_related=true`,
|
|
1229
|
+
Je(e)
|
|
1230
1230
|
),
|
|
1231
1231
|
updateDataSourcePartial: async (e) => c.patch(
|
|
1232
|
-
`${
|
|
1232
|
+
`${N}/${e.id}?expand_related=true`,
|
|
1233
1233
|
e
|
|
1234
1234
|
),
|
|
1235
|
-
deleteDataSource: async (e) => c.delete(`${
|
|
1235
|
+
deleteDataSource: async (e) => c.delete(`${N}/${e}`),
|
|
1236
1236
|
linkDatastreamToDataSource: async (e, t) => c.post(
|
|
1237
|
-
`${
|
|
1237
|
+
`${N}/${e}/datastreams/${t}`
|
|
1238
1238
|
),
|
|
1239
1239
|
unlinkDatastreamFromDataSource: async (e, t) => c.delete(
|
|
1240
|
-
`${
|
|
1240
|
+
`${N}/${e}/datastreams/${t}`
|
|
1241
1241
|
),
|
|
1242
1242
|
fetchObservations: async (e) => c.fetch(e),
|
|
1243
|
-
deleteObservationsForDatastream: async (e) => c.post(`${
|
|
1243
|
+
deleteObservationsForDatastream: async (e) => c.post(`${I}/${e}/observations/bulk-delete`, {
|
|
1244
1244
|
phenomenonTimeStart: null,
|
|
1245
1245
|
phenomenonTimeEnd: null
|
|
1246
1246
|
}),
|
|
1247
|
-
fetchUserTypes: async () => c.fetch(`${
|
|
1248
|
-
fetchOrganizationTypes: async () => c.fetch(`${
|
|
1247
|
+
fetchUserTypes: async () => c.fetch(`${C}/user-types`),
|
|
1248
|
+
fetchOrganizationTypes: async () => c.fetch(`${C}/organization-types`),
|
|
1249
1249
|
fetchSiteTypes: async () => c.fetch(`${_}/site-types`),
|
|
1250
1250
|
fetchSamplingFeatureTypes: async () => c.paginatedFetch(`${_}/sampling-feature-types`),
|
|
1251
|
-
fetchSensorEncodingTypes: async () => c.paginatedFetch(`${
|
|
1252
|
-
fetchMethodTypes: async () => c.paginatedFetch(`${
|
|
1253
|
-
fetchVariableTypes: async () => c.paginatedFetch(`${
|
|
1254
|
-
fetchUnitTypes: async () => c.paginatedFetch(`${
|
|
1255
|
-
fetchDatastreamStatuses: async () => c.paginatedFetch(`${
|
|
1256
|
-
fetchDatastreamAggregations: async () => c.paginatedFetch(`${
|
|
1257
|
-
fetchSampledMediums: async () => c.paginatedFetch(`${
|
|
1251
|
+
fetchSensorEncodingTypes: async () => c.paginatedFetch(`${W}/encoding-types`),
|
|
1252
|
+
fetchMethodTypes: async () => c.paginatedFetch(`${W}/method-types`),
|
|
1253
|
+
fetchVariableTypes: async () => c.paginatedFetch(`${H}/variable-types`),
|
|
1254
|
+
fetchUnitTypes: async () => c.paginatedFetch(`${z}/types`),
|
|
1255
|
+
fetchDatastreamStatuses: async () => c.paginatedFetch(`${I}/statuses`),
|
|
1256
|
+
fetchDatastreamAggregations: async () => c.paginatedFetch(`${I}/aggregation-statistics`),
|
|
1257
|
+
fetchSampledMediums: async () => c.paginatedFetch(`${I}/sampled-mediums`)
|
|
1258
1258
|
};
|
|
1259
|
-
class
|
|
1259
|
+
class ys {
|
|
1260
1260
|
name = "";
|
|
1261
1261
|
mappings = [];
|
|
1262
1262
|
extractorVariables = {};
|
|
@@ -1264,15 +1264,15 @@ class ln {
|
|
|
1264
1264
|
Object.assign(this, t);
|
|
1265
1265
|
}
|
|
1266
1266
|
}
|
|
1267
|
-
const
|
|
1268
|
-
[
|
|
1269
|
-
[
|
|
1270
|
-
[
|
|
1271
|
-
[
|
|
1272
|
-
[
|
|
1273
|
-
[
|
|
1274
|
-
[
|
|
1275
|
-
},
|
|
1267
|
+
const At = 1, ue = At * 60, De = ue * 60, Fe = De * 24, gr = Fe * 7, mr = De * 30, wr = Fe * 365, ne = {
|
|
1268
|
+
[x.SECOND]: At,
|
|
1269
|
+
[x.MINUTE]: ue,
|
|
1270
|
+
[x.HOUR]: De,
|
|
1271
|
+
[x.DAY]: Fe,
|
|
1272
|
+
[x.WEEK]: gr,
|
|
1273
|
+
[x.MONTH]: mr,
|
|
1274
|
+
[x.YEAR]: wr
|
|
1275
|
+
}, gs = (e) => e.toLocaleString(void 0, {
|
|
1276
1276
|
year: "numeric",
|
|
1277
1277
|
month: "short",
|
|
1278
1278
|
day: "2-digit",
|
|
@@ -1280,42 +1280,40 @@ const kt = 1, ie = kt * 60, Ue = ie * 60, Oe = Ue * 24, dr = Oe * 7, pr = Ue * 3
|
|
|
1280
1280
|
hour12: !1,
|
|
1281
1281
|
minute: "2-digit",
|
|
1282
1282
|
second: "2-digit"
|
|
1283
|
-
}),
|
|
1283
|
+
}), ms = (e) => {
|
|
1284
1284
|
let t, r;
|
|
1285
|
-
e >=
|
|
1286
|
-
let
|
|
1287
|
-
return r === "ms" ?
|
|
1288
|
-
},
|
|
1285
|
+
e >= ue * 1e3 ? (t = e / (ue * 1e3), r = "m") : e >= 1e3 ? (t = e / 1e3, r = "s") : (t = e, r = "ms");
|
|
1286
|
+
let s;
|
|
1287
|
+
return r === "ms" ? s = Math.round(t).toString() : s = t.toFixed(2), `${s} ${r}`;
|
|
1288
|
+
}, Ee = async (e, t) => {
|
|
1289
1289
|
t && console.info(t);
|
|
1290
|
-
const r = performance.now(),
|
|
1291
|
-
|
|
1292
|
-
const a = +(s - r);
|
|
1293
|
-
return { response: n, duration: a };
|
|
1290
|
+
const r = performance.now(), s = await e(), o = +(performance.now() - r);
|
|
1291
|
+
return { response: s, duration: o };
|
|
1294
1292
|
};
|
|
1295
|
-
function
|
|
1293
|
+
function ws(e, t) {
|
|
1296
1294
|
const r = new Date(e);
|
|
1297
1295
|
return r.setHours(r.getHours() - t), r.toISOString();
|
|
1298
1296
|
}
|
|
1299
|
-
const
|
|
1300
|
-
let r = 0,
|
|
1301
|
-
for (; r <
|
|
1302
|
-
const
|
|
1303
|
-
e[
|
|
1297
|
+
const X = (e, t) => {
|
|
1298
|
+
let r = 0, s = e.length;
|
|
1299
|
+
for (; r < s; ) {
|
|
1300
|
+
const n = r + s >> 1;
|
|
1301
|
+
e[n] < t ? r = n + 1 : s = n;
|
|
1304
1302
|
}
|
|
1305
1303
|
return r;
|
|
1306
|
-
},
|
|
1307
|
-
let r = 0,
|
|
1308
|
-
for (; r <
|
|
1309
|
-
const
|
|
1310
|
-
e[
|
|
1304
|
+
}, Q = (e, t) => {
|
|
1305
|
+
let r = 0, s = e.length;
|
|
1306
|
+
for (; r < s; ) {
|
|
1307
|
+
const n = r + s >> 1;
|
|
1308
|
+
e[n] > t ? s = n : r = n + 1;
|
|
1311
1309
|
}
|
|
1312
1310
|
return r - 1;
|
|
1313
|
-
},
|
|
1314
|
-
`,
|
|
1315
|
-
function
|
|
1311
|
+
}, Tt = `(function(){"use strict";function c(n,s,a,u,f,l,y,o){let r=0,e=o;for(let t=l;t<=y;t++)r<a.length&&t===a[r]?r++:(u[e]=n[t],f[e]=s[t],e++);return e-o}self.onmessage=n=>{const{bufferX:s,bufferY:a,outputBufferX:u,outputBufferY:f,start:l,end:y,deleteSegment:o,startTarget:r}=n.data,e=new Float64Array(s),t=new Float32Array(a),A=new Float64Array(u),g=new Float32Array(f);c(e,t,o,A,g,l,y,r),self.postMessage("Done")}})();
|
|
1312
|
+
`, Ke = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Tt], { type: "text/javascript;charset=utf-8" });
|
|
1313
|
+
function br(e) {
|
|
1316
1314
|
let t;
|
|
1317
1315
|
try {
|
|
1318
|
-
if (t =
|
|
1316
|
+
if (t = Ke && (self.URL || self.webkitURL).createObjectURL(Ke), !t) throw "";
|
|
1319
1317
|
const r = new Worker(t, {
|
|
1320
1318
|
name: e?.name
|
|
1321
1319
|
});
|
|
@@ -1324,19 +1322,19 @@ function gr(e) {
|
|
|
1324
1322
|
}), r;
|
|
1325
1323
|
} catch {
|
|
1326
1324
|
return new Worker(
|
|
1327
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1325
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Tt),
|
|
1328
1326
|
{
|
|
1329
1327
|
name: e?.name
|
|
1330
1328
|
}
|
|
1331
1329
|
);
|
|
1332
1330
|
}
|
|
1333
1331
|
}
|
|
1334
|
-
const
|
|
1335
|
-
`,
|
|
1336
|
-
function
|
|
1332
|
+
const Lt = `(function(){"use strict";function F(n,l,a,o,s,y,g,f,i,w,A){let e=0,t=f;for(let r=y;r<=g;r++)if(o[t]=n[r],s[t]=l[r],t++,e<a.length&&r===a[e][0]){const u=a[e][0],c=a[e][1],d=n[u],h=n[c],m=l[u],D=l[c],x=h-d,P=D-m;let p=d+i;for(;p<h;)o[t]=p,s[t]=w?m+(p-d)*P/x:A,t++,p+=i;e++}return t-f}self.onmessage=n=>{const{bufferX:l,bufferY:a,outputBufferX:o,outputBufferY:s,start:y,end:g,gapsSegment:f,startTarget:i,fillDelta:w,interpolate:A,fillValue:e}=n.data,t=new Float64Array(l),r=new Float32Array(a),u=new Float64Array(o),c=new Float32Array(s);F(t,r,f,u,c,y,g,i,w,A,e),self.postMessage("Done")}})();
|
|
1333
|
+
`, Ze = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Lt], { type: "text/javascript;charset=utf-8" });
|
|
1334
|
+
function Sr(e) {
|
|
1337
1335
|
let t;
|
|
1338
1336
|
try {
|
|
1339
|
-
if (t =
|
|
1337
|
+
if (t = Ze && (self.URL || self.webkitURL).createObjectURL(Ze), !t) throw "";
|
|
1340
1338
|
const r = new Worker(t, {
|
|
1341
1339
|
name: e?.name
|
|
1342
1340
|
});
|
|
@@ -1345,19 +1343,19 @@ function mr(e) {
|
|
|
1345
1343
|
}), r;
|
|
1346
1344
|
} catch {
|
|
1347
1345
|
return new Worker(
|
|
1348
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1346
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Lt),
|
|
1349
1347
|
{
|
|
1350
1348
|
name: e?.name
|
|
1351
1349
|
}
|
|
1352
1350
|
);
|
|
1353
1351
|
}
|
|
1354
1352
|
}
|
|
1355
|
-
const
|
|
1356
|
-
`,
|
|
1357
|
-
function
|
|
1353
|
+
const $t = `(function(){"use strict";function g(o,n,c){for(let s=0;s<c.length;s++){const{indexes:t,lowerIdx:l,upperIdx:r}=c[s],i=o[l],f=n[l],a=o[r],d=n[r],p=a-i,w=d-f;if(p===0){for(let e=0;e<t.length;e++)n[t[e]]=f;continue}for(let e=0;e<t.length;e++){const u=t[e];n[u]=f+(o[u]-i)*w/p}}}self.onmessage=o=>{const{bufferX:n,bufferY:c,groups:s}=o.data,t=new Float64Array(n),l=new Float32Array(c);g(t,l,s),self.postMessage("Done")}})();
|
|
1354
|
+
`, et = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", $t], { type: "text/javascript;charset=utf-8" });
|
|
1355
|
+
function Er(e) {
|
|
1358
1356
|
let t;
|
|
1359
1357
|
try {
|
|
1360
|
-
if (t =
|
|
1358
|
+
if (t = et && (self.URL || self.webkitURL).createObjectURL(et), !t) throw "";
|
|
1361
1359
|
const r = new Worker(t, {
|
|
1362
1360
|
name: e?.name
|
|
1363
1361
|
});
|
|
@@ -1366,19 +1364,19 @@ function wr(e) {
|
|
|
1366
1364
|
}), r;
|
|
1367
1365
|
} catch {
|
|
1368
1366
|
return new Worker(
|
|
1369
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1367
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent($t),
|
|
1370
1368
|
{
|
|
1371
1369
|
name: e?.name
|
|
1372
1370
|
}
|
|
1373
1371
|
);
|
|
1374
1372
|
}
|
|
1375
1373
|
}
|
|
1376
|
-
const
|
|
1377
|
-
`,
|
|
1378
|
-
function
|
|
1374
|
+
const Rt = `(function(){"use strict";self.onmessage=r=>{const{bufferX:s,bufferY:o,jobs:a}=r.data,f=new Float64Array(s),n=new Float32Array(o);for(let e=0;e<a.length;e++){const{chunkStart:c,chunkEnd:l,startDatetime:u,value:i,extent:y}=a[e];for(let t=c;t<l;t++)n[t]=n[t]+i*((f[t]-u)/y)}self.postMessage("Done")}})();
|
|
1375
|
+
`, tt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Rt], { type: "text/javascript;charset=utf-8" });
|
|
1376
|
+
function vr(e) {
|
|
1379
1377
|
let t;
|
|
1380
1378
|
try {
|
|
1381
|
-
if (t =
|
|
1379
|
+
if (t = tt && (self.URL || self.webkitURL).createObjectURL(tt), !t) throw "";
|
|
1382
1380
|
const r = new Worker(t, {
|
|
1383
1381
|
name: e?.name
|
|
1384
1382
|
});
|
|
@@ -1387,19 +1385,19 @@ function br(e) {
|
|
|
1387
1385
|
}), r;
|
|
1388
1386
|
} catch {
|
|
1389
1387
|
return new Worker(
|
|
1390
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1388
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Rt),
|
|
1391
1389
|
{
|
|
1392
1390
|
name: e?.name
|
|
1393
1391
|
}
|
|
1394
1392
|
);
|
|
1395
1393
|
}
|
|
1396
1394
|
}
|
|
1397
|
-
const
|
|
1398
|
-
`,
|
|
1399
|
-
function
|
|
1395
|
+
const It = `(function(){"use strict";function u(f,o,a,n,l,c,s,i){let r=c,e=0,t=i;const w=a.length;for(;r<s&&e<w;){const y=a[e][0];f[r]<=y?(n[t]=f[r],l[t]=o[r],r++):(n[t]=y,l[t]=a[e][1],e++),t++}for(;r<s;)n[t]=f[r],l[t]=o[r],r++,t++;for(;e<w;)n[t]=a[e][0],l[t]=a[e][1],e++,t++;return t-i}self.onmessage=f=>{const{bufferX:o,bufferY:a,outputBufferX:n,outputBufferY:l,origStart:c,origEnd:s,insertions:i,outStart:r}=f.data,e=new Float64Array(o),t=new Float32Array(a),w=new Float64Array(n),y=new Float32Array(l);u(e,t,i,w,y,c,s,r),self.postMessage("Done")}})();
|
|
1396
|
+
`, rt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", It], { type: "text/javascript;charset=utf-8" });
|
|
1397
|
+
function kr(e) {
|
|
1400
1398
|
let t;
|
|
1401
1399
|
try {
|
|
1402
|
-
if (t =
|
|
1400
|
+
if (t = rt && (self.URL || self.webkitURL).createObjectURL(rt), !t) throw "";
|
|
1403
1401
|
const r = new Worker(t, {
|
|
1404
1402
|
name: e?.name
|
|
1405
1403
|
});
|
|
@@ -1408,19 +1406,19 @@ function Sr(e) {
|
|
|
1408
1406
|
}), r;
|
|
1409
1407
|
} catch {
|
|
1410
1408
|
return new Worker(
|
|
1411
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1409
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(It),
|
|
1412
1410
|
{
|
|
1413
1411
|
name: e?.name
|
|
1414
1412
|
}
|
|
1415
1413
|
);
|
|
1416
1414
|
}
|
|
1417
1415
|
}
|
|
1418
|
-
const
|
|
1419
|
-
`,
|
|
1420
|
-
function
|
|
1416
|
+
const Ot = `(function(){"use strict";self.onmessage=i=>{const{bufferX:c,bufferY:g,outputBufferX:d,outputBufferY:y,indexes:n,outStart:r,amount:f,isMonth:Y,isYear:h,deltaMs:w}=i.data,s=new Float64Array(c),a=new Float32Array(g),l=new Float64Array(d),u=new Float32Array(y);if(Y)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setMonth(o.getMonth()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else if(h)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setFullYear(o.getFullYear()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else for(let t=0;t<n.length;t++){const e=n[t];l[r+t]=s[e]+w,u[r+t]=a[e]}self.postMessage("Done")}})();
|
|
1417
|
+
`, st = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ot], { type: "text/javascript;charset=utf-8" });
|
|
1418
|
+
function _r(e) {
|
|
1421
1419
|
let t;
|
|
1422
1420
|
try {
|
|
1423
|
-
if (t =
|
|
1421
|
+
if (t = st && (self.URL || self.webkitURL).createObjectURL(st), !t) throw "";
|
|
1424
1422
|
const r = new Worker(t, {
|
|
1425
1423
|
name: e?.name
|
|
1426
1424
|
});
|
|
@@ -1429,19 +1427,19 @@ function Er(e) {
|
|
|
1429
1427
|
}), r;
|
|
1430
1428
|
} catch {
|
|
1431
1429
|
return new Worker(
|
|
1432
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1430
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ot),
|
|
1433
1431
|
{
|
|
1434
1432
|
name: e?.name
|
|
1435
1433
|
}
|
|
1436
1434
|
);
|
|
1437
1435
|
}
|
|
1438
1436
|
}
|
|
1439
|
-
const
|
|
1440
|
-
`,
|
|
1441
|
-
function
|
|
1437
|
+
const Mt = `(function(){"use strict";function a(e,t,o,c){const n=[];let r=e[t];for(let s=t+1;s<=o;s++){const f=e[s];f-r>c&&n.push(s-1,s),r=f}return n}self.onmessage=e=>{const{bufferX:t,start:o,endInclusive:c,threshold:n}=e.data,r=new Float64Array(t);self.postMessage(a(r,o,c,n))}})();
|
|
1438
|
+
`, nt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Mt], { type: "text/javascript;charset=utf-8" });
|
|
1439
|
+
function Ar(e) {
|
|
1442
1440
|
let t;
|
|
1443
1441
|
try {
|
|
1444
|
-
if (t =
|
|
1442
|
+
if (t = nt && (self.URL || self.webkitURL).createObjectURL(nt), !t) throw "";
|
|
1445
1443
|
const r = new Worker(t, {
|
|
1446
1444
|
name: e?.name
|
|
1447
1445
|
});
|
|
@@ -1450,19 +1448,19 @@ function kr(e) {
|
|
|
1450
1448
|
}), r;
|
|
1451
1449
|
} catch {
|
|
1452
1450
|
return new Worker(
|
|
1453
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1451
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Mt),
|
|
1454
1452
|
{
|
|
1455
1453
|
name: e?.name
|
|
1456
1454
|
}
|
|
1457
1455
|
);
|
|
1458
1456
|
}
|
|
1459
1457
|
}
|
|
1460
|
-
const
|
|
1461
|
-
`,
|
|
1462
|
-
function
|
|
1458
|
+
const Ut = `(function(){"use strict";function c(u,s,t){const n=[];if(s>=t)return n;let e=s,o=u[s];for(let r=s+1;r<t;r++){const f=u[r];f!==o&&(n.push(e,r-e,o),e=r,o=f)}return n.push(e,t-e,o),n}self.onmessage=u=>{const{bufferY:s,start:t,end:n}=u.data,e=new Float32Array(s);self.postMessage(c(e,t,n))}})();
|
|
1459
|
+
`, ot = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ut], { type: "text/javascript;charset=utf-8" });
|
|
1460
|
+
function Tr(e) {
|
|
1463
1461
|
let t;
|
|
1464
1462
|
try {
|
|
1465
|
-
if (t =
|
|
1463
|
+
if (t = ot && (self.URL || self.webkitURL).createObjectURL(ot), !t) throw "";
|
|
1466
1464
|
const r = new Worker(t, {
|
|
1467
1465
|
name: e?.name
|
|
1468
1466
|
});
|
|
@@ -1471,19 +1469,19 @@ function vr(e) {
|
|
|
1471
1469
|
}), r;
|
|
1472
1470
|
} catch {
|
|
1473
1471
|
return new Worker(
|
|
1474
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1472
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ut),
|
|
1475
1473
|
{
|
|
1476
1474
|
name: e?.name
|
|
1477
1475
|
}
|
|
1478
1476
|
);
|
|
1479
1477
|
}
|
|
1480
1478
|
}
|
|
1481
|
-
const
|
|
1482
|
-
`,
|
|
1483
|
-
function
|
|
1479
|
+
const Dt = `(function(){"use strict";function o(s,i,t,n,l){const f=[];if(n==="Less than")for(let e=i;e<t;e++)s[e]-s[e-1]<l&&f.push(e);else if(n==="Less than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]<=l&&f.push(e);else if(n==="Greater than")for(let e=i;e<t;e++)s[e]-s[e-1]>l&&f.push(e);else if(n==="Greater than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]>=l&&f.push(e);else if(n==="Equal")for(let e=i;e<t;e++)s[e]-s[e-1]==l&&f.push(e);return f}self.onmessage=s=>{const{bufferY:i,start:t,end:n,comparator:l,value:f}=s.data,e=new Float32Array(i);self.postMessage(o(e,t,n,l,f))}})();
|
|
1480
|
+
`, at = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Dt], { type: "text/javascript;charset=utf-8" });
|
|
1481
|
+
function Lr(e) {
|
|
1484
1482
|
let t;
|
|
1485
1483
|
try {
|
|
1486
|
-
if (t =
|
|
1484
|
+
if (t = at && (self.URL || self.webkitURL).createObjectURL(at), !t) throw "";
|
|
1487
1485
|
const r = new Worker(t, {
|
|
1488
1486
|
name: e?.name
|
|
1489
1487
|
});
|
|
@@ -1492,19 +1490,19 @@ function _r(e) {
|
|
|
1492
1490
|
}), r;
|
|
1493
1491
|
} catch {
|
|
1494
1492
|
return new Worker(
|
|
1495
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1493
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Dt),
|
|
1496
1494
|
{
|
|
1497
1495
|
name: e?.name
|
|
1498
1496
|
}
|
|
1499
1497
|
);
|
|
1500
1498
|
}
|
|
1501
1499
|
}
|
|
1502
|
-
const
|
|
1503
|
-
`,
|
|
1504
|
-
function
|
|
1500
|
+
const Ft = `(function(){"use strict";function l(t,i,n,o,h){const f=[];if(o==="Less than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<h&&f.push(e)}else if(o==="Less than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<=h&&f.push(e)}else if(o==="Greater than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>h&&f.push(e)}else if(o==="Greater than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>=h&&f.push(e)}else if(o==="Equal")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)==h&&f.push(e)}return f}self.onmessage=t=>{const{bufferY:i,start:n,end:o,comparator:h,value:f}=t.data,e=new Float32Array(i);self.postMessage(l(e,n,o,h,f))}})();
|
|
1501
|
+
`, it = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ft], { type: "text/javascript;charset=utf-8" });
|
|
1502
|
+
function $r(e) {
|
|
1505
1503
|
let t;
|
|
1506
1504
|
try {
|
|
1507
|
-
if (t =
|
|
1505
|
+
if (t = it && (self.URL || self.webkitURL).createObjectURL(it), !t) throw "";
|
|
1508
1506
|
const r = new Worker(t, {
|
|
1509
1507
|
name: e?.name
|
|
1510
1508
|
});
|
|
@@ -1513,19 +1511,19 @@ function Ar(e) {
|
|
|
1513
1511
|
}), r;
|
|
1514
1512
|
} catch {
|
|
1515
1513
|
return new Worker(
|
|
1516
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1514
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ft),
|
|
1517
1515
|
{
|
|
1518
1516
|
name: e?.name
|
|
1519
1517
|
}
|
|
1520
1518
|
);
|
|
1521
1519
|
}
|
|
1522
1520
|
}
|
|
1523
|
-
const
|
|
1524
|
-
`,
|
|
1525
|
-
function
|
|
1521
|
+
const Ct = `(function(){"use strict";function k(i,l,u,r,c){const f=[],b=r.length;for(let a=l;a<u;a++){const t=i[a];let e=!1;for(let n=0;n<b;n++){const o=r[n],s=c[n];if(o===0){if(t<s){e=!0;break}}else if(o===1){if(t<=s){e=!0;break}}else if(o===2){if(t>s){e=!0;break}}else if(o===3){if(t>=s){e=!0;break}}else if(t==s){e=!0;break}}e&&f.push(a)}return f}self.onmessage=i=>{const{bufferY:l,start:u,end:r,ops:c,values:f}=i.data,b=new Float32Array(l);self.postMessage(k(b,u,r,c,f))}})();
|
|
1522
|
+
`, ct = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ct], { type: "text/javascript;charset=utf-8" });
|
|
1523
|
+
function Ie(e) {
|
|
1526
1524
|
let t;
|
|
1527
1525
|
try {
|
|
1528
|
-
if (t =
|
|
1526
|
+
if (t = ct && (self.URL || self.webkitURL).createObjectURL(ct), !t) throw "";
|
|
1529
1527
|
const r = new Worker(t, {
|
|
1530
1528
|
name: e?.name
|
|
1531
1529
|
});
|
|
@@ -1534,7 +1532,7 @@ function $e(e) {
|
|
|
1534
1532
|
}), r;
|
|
1535
1533
|
} catch {
|
|
1536
1534
|
return new Worker(
|
|
1537
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1535
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ct),
|
|
1538
1536
|
{
|
|
1539
1537
|
name: e?.name
|
|
1540
1538
|
}
|
|
@@ -1542,11 +1540,11 @@ function $e(e) {
|
|
|
1542
1540
|
}
|
|
1543
1541
|
}
|
|
1544
1542
|
const xt = `(function(){"use strict";function e(l,t,o,s){const c=t.length;if(o==="ADD")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]+s;else if(o==="SUB")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]-s;else if(o==="MULT")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]*s;else if(o==="DIV")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]/s;else if(o==="ASSIGN")for(let f=0;f<c;f++)l[t[f]]=s}self.onmessage=l=>{const{bufferY:t,indexes:o,operator:s,value:c}=l.data,f=new Float32Array(t);e(f,o,s,c),self.postMessage("Done")}})();
|
|
1545
|
-
`,
|
|
1546
|
-
function
|
|
1543
|
+
`, lt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", xt], { type: "text/javascript;charset=utf-8" });
|
|
1544
|
+
function Rr(e) {
|
|
1547
1545
|
let t;
|
|
1548
1546
|
try {
|
|
1549
|
-
if (t =
|
|
1547
|
+
if (t = lt && (self.URL || self.webkitURL).createObjectURL(lt), !t) throw "";
|
|
1550
1548
|
const r = new Worker(t, {
|
|
1551
1549
|
name: e?.name
|
|
1552
1550
|
});
|
|
@@ -1562,196 +1560,196 @@ function Lr(e) {
|
|
|
1562
1560
|
);
|
|
1563
1561
|
}
|
|
1564
1562
|
}
|
|
1565
|
-
function
|
|
1566
|
-
const
|
|
1563
|
+
function Pt(e, t, r, s, n) {
|
|
1564
|
+
const o = [], a = s.length;
|
|
1567
1565
|
for (let i = t; i < r; i++) {
|
|
1568
1566
|
const l = e[i];
|
|
1569
1567
|
let f = !1;
|
|
1570
|
-
for (let
|
|
1571
|
-
const
|
|
1572
|
-
if (
|
|
1573
|
-
if (l <
|
|
1568
|
+
for (let h = 0; h < a; h++) {
|
|
1569
|
+
const y = s[h], p = n[h];
|
|
1570
|
+
if (y === 0) {
|
|
1571
|
+
if (l < p) {
|
|
1574
1572
|
f = !0;
|
|
1575
1573
|
break;
|
|
1576
1574
|
}
|
|
1577
|
-
} else if (
|
|
1578
|
-
if (l <=
|
|
1575
|
+
} else if (y === 1) {
|
|
1576
|
+
if (l <= p) {
|
|
1579
1577
|
f = !0;
|
|
1580
1578
|
break;
|
|
1581
1579
|
}
|
|
1582
|
-
} else if (
|
|
1583
|
-
if (l >
|
|
1580
|
+
} else if (y === 2) {
|
|
1581
|
+
if (l > p) {
|
|
1584
1582
|
f = !0;
|
|
1585
1583
|
break;
|
|
1586
1584
|
}
|
|
1587
|
-
} else if (
|
|
1588
|
-
if (l >=
|
|
1585
|
+
} else if (y === 3) {
|
|
1586
|
+
if (l >= p) {
|
|
1589
1587
|
f = !0;
|
|
1590
1588
|
break;
|
|
1591
1589
|
}
|
|
1592
|
-
} else if (l ==
|
|
1590
|
+
} else if (l == p) {
|
|
1593
1591
|
f = !0;
|
|
1594
1592
|
break;
|
|
1595
1593
|
}
|
|
1596
1594
|
}
|
|
1597
|
-
f &&
|
|
1598
|
-
}
|
|
1599
|
-
return
|
|
1600
|
-
}
|
|
1601
|
-
function
|
|
1602
|
-
const
|
|
1603
|
-
if (
|
|
1604
|
-
for (let
|
|
1605
|
-
e[
|
|
1606
|
-
else if (
|
|
1607
|
-
for (let
|
|
1608
|
-
e[
|
|
1609
|
-
else if (
|
|
1610
|
-
for (let
|
|
1611
|
-
e[
|
|
1612
|
-
else if (
|
|
1613
|
-
for (let
|
|
1614
|
-
e[
|
|
1615
|
-
else if (
|
|
1616
|
-
for (let
|
|
1617
|
-
e[
|
|
1618
|
-
return
|
|
1619
|
-
}
|
|
1620
|
-
function
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1623
|
-
for (let
|
|
1624
|
-
const i = e[
|
|
1625
|
-
(e[
|
|
1626
|
-
}
|
|
1627
|
-
else if (
|
|
1628
|
-
for (let
|
|
1629
|
-
const i = e[
|
|
1630
|
-
(e[
|
|
1631
|
-
}
|
|
1632
|
-
else if (
|
|
1633
|
-
for (let
|
|
1634
|
-
const i = e[
|
|
1635
|
-
(e[
|
|
1636
|
-
}
|
|
1637
|
-
else if (
|
|
1638
|
-
for (let
|
|
1639
|
-
const i = e[
|
|
1640
|
-
(e[
|
|
1641
|
-
}
|
|
1642
|
-
else if (
|
|
1643
|
-
for (let
|
|
1644
|
-
const i = e[
|
|
1645
|
-
(e[
|
|
1646
|
-
}
|
|
1647
|
-
return
|
|
1648
|
-
}
|
|
1649
|
-
function
|
|
1650
|
-
const
|
|
1651
|
-
let
|
|
1652
|
-
for (let
|
|
1653
|
-
const i = e[
|
|
1654
|
-
i -
|
|
1595
|
+
f && o.push(i);
|
|
1596
|
+
}
|
|
1597
|
+
return o;
|
|
1598
|
+
}
|
|
1599
|
+
function Ir(e, t, r, s, n) {
|
|
1600
|
+
const o = [];
|
|
1601
|
+
if (s === "Less than")
|
|
1602
|
+
for (let a = t; a < r; a++)
|
|
1603
|
+
e[a] - e[a - 1] < n && o.push(a);
|
|
1604
|
+
else if (s === "Less than or equal to")
|
|
1605
|
+
for (let a = t; a < r; a++)
|
|
1606
|
+
e[a] - e[a - 1] <= n && o.push(a);
|
|
1607
|
+
else if (s === "Greater than")
|
|
1608
|
+
for (let a = t; a < r; a++)
|
|
1609
|
+
e[a] - e[a - 1] > n && o.push(a);
|
|
1610
|
+
else if (s === "Greater than or equal to")
|
|
1611
|
+
for (let a = t; a < r; a++)
|
|
1612
|
+
e[a] - e[a - 1] >= n && o.push(a);
|
|
1613
|
+
else if (s === "Equal")
|
|
1614
|
+
for (let a = t; a < r; a++)
|
|
1615
|
+
e[a] - e[a - 1] == n && o.push(a);
|
|
1616
|
+
return o;
|
|
1617
|
+
}
|
|
1618
|
+
function Or(e, t, r, s, n) {
|
|
1619
|
+
const o = [];
|
|
1620
|
+
if (s === "Less than")
|
|
1621
|
+
for (let a = t; a < r; a++) {
|
|
1622
|
+
const i = e[a - 1];
|
|
1623
|
+
(e[a] - i) / Math.abs(i) < n && o.push(a);
|
|
1624
|
+
}
|
|
1625
|
+
else if (s === "Less than or equal to")
|
|
1626
|
+
for (let a = t; a < r; a++) {
|
|
1627
|
+
const i = e[a - 1];
|
|
1628
|
+
(e[a] - i) / Math.abs(i) <= n && o.push(a);
|
|
1629
|
+
}
|
|
1630
|
+
else if (s === "Greater than")
|
|
1631
|
+
for (let a = t; a < r; a++) {
|
|
1632
|
+
const i = e[a - 1];
|
|
1633
|
+
(e[a] - i) / Math.abs(i) > n && o.push(a);
|
|
1634
|
+
}
|
|
1635
|
+
else if (s === "Greater than or equal to")
|
|
1636
|
+
for (let a = t; a < r; a++) {
|
|
1637
|
+
const i = e[a - 1];
|
|
1638
|
+
(e[a] - i) / Math.abs(i) >= n && o.push(a);
|
|
1639
|
+
}
|
|
1640
|
+
else if (s === "Equal")
|
|
1641
|
+
for (let a = t; a < r; a++) {
|
|
1642
|
+
const i = e[a - 1];
|
|
1643
|
+
(e[a] - i) / Math.abs(i) == n && o.push(a);
|
|
1644
|
+
}
|
|
1645
|
+
return o;
|
|
1646
|
+
}
|
|
1647
|
+
function Mr(e, t, r, s) {
|
|
1648
|
+
const n = [];
|
|
1649
|
+
let o = e[t];
|
|
1650
|
+
for (let a = t + 1; a <= r; a++) {
|
|
1651
|
+
const i = e[a];
|
|
1652
|
+
i - o > s && n.push(a - 1, a), o = i;
|
|
1655
1653
|
}
|
|
1656
|
-
return
|
|
1654
|
+
return n;
|
|
1657
1655
|
}
|
|
1658
|
-
function
|
|
1659
|
-
const
|
|
1660
|
-
if (t >= r) return
|
|
1661
|
-
let
|
|
1662
|
-
for (let
|
|
1663
|
-
const i = e[
|
|
1664
|
-
i !==
|
|
1665
|
-
}
|
|
1666
|
-
return
|
|
1667
|
-
}
|
|
1668
|
-
function
|
|
1669
|
-
let
|
|
1670
|
-
for (let
|
|
1671
|
-
if (
|
|
1672
|
-
const d = r[
|
|
1673
|
-
let
|
|
1674
|
-
for (;
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
}
|
|
1678
|
-
return
|
|
1679
|
-
}
|
|
1680
|
-
function
|
|
1681
|
-
let l =
|
|
1682
|
-
const
|
|
1683
|
-
for (; l <
|
|
1684
|
-
const
|
|
1685
|
-
e[l] <=
|
|
1686
|
-
}
|
|
1687
|
-
for (; l <
|
|
1688
|
-
|
|
1689
|
-
for (; f <
|
|
1690
|
-
|
|
1691
|
-
return
|
|
1692
|
-
}
|
|
1693
|
-
function
|
|
1656
|
+
function Ur(e, t, r) {
|
|
1657
|
+
const s = [];
|
|
1658
|
+
if (t >= r) return s;
|
|
1659
|
+
let n = t, o = e[t];
|
|
1660
|
+
for (let a = t + 1; a < r; a++) {
|
|
1661
|
+
const i = e[a];
|
|
1662
|
+
i !== o && (s.push(n, a - n, o), n = a, o = i);
|
|
1663
|
+
}
|
|
1664
|
+
return s.push(n, r - n, o), s;
|
|
1665
|
+
}
|
|
1666
|
+
function Dr(e, t, r, s, n, o, a, i, l, f, h) {
|
|
1667
|
+
let y = 0, p = i;
|
|
1668
|
+
for (let g = o; g <= a; g++)
|
|
1669
|
+
if (s[p] = e[g], n[p] = t[g], p++, y < r.length && g === r[y][0]) {
|
|
1670
|
+
const d = r[y][0], u = r[y][1], w = e[d], b = e[u], m = t[d], S = t[u], v = b - w, T = S - m;
|
|
1671
|
+
let L = w + l;
|
|
1672
|
+
for (; L < b; )
|
|
1673
|
+
s[p] = L, n[p] = f ? m + (L - w) * T / v : h, p++, L += l;
|
|
1674
|
+
y++;
|
|
1675
|
+
}
|
|
1676
|
+
return p - i;
|
|
1677
|
+
}
|
|
1678
|
+
function Fr(e, t, r, s, n, o, a, i) {
|
|
1679
|
+
let l = o, f = 0, h = i;
|
|
1680
|
+
const y = r.length;
|
|
1681
|
+
for (; l < a && f < y; ) {
|
|
1682
|
+
const p = r[f][0];
|
|
1683
|
+
e[l] <= p ? (s[h] = e[l], n[h] = t[l], l++) : (s[h] = p, n[h] = r[f][1], f++), h++;
|
|
1684
|
+
}
|
|
1685
|
+
for (; l < a; )
|
|
1686
|
+
s[h] = e[l], n[h] = t[l], l++, h++;
|
|
1687
|
+
for (; f < y; )
|
|
1688
|
+
s[h] = r[f][0], n[h] = r[f][1], f++, h++;
|
|
1689
|
+
return h - i;
|
|
1690
|
+
}
|
|
1691
|
+
function Cr(e, t, r, s, n, o, a, i) {
|
|
1694
1692
|
let l = 0, f = i;
|
|
1695
|
-
for (let
|
|
1696
|
-
l < r.length &&
|
|
1693
|
+
for (let h = o; h <= a; h++)
|
|
1694
|
+
l < r.length && h === r[l] ? l++ : (s[f] = e[h], n[f] = t[h], f++);
|
|
1697
1695
|
return f - i;
|
|
1698
1696
|
}
|
|
1699
|
-
function xr(e, t, r,
|
|
1700
|
-
const
|
|
1701
|
-
if (
|
|
1702
|
-
for (let
|
|
1703
|
-
const i = r[
|
|
1704
|
-
l.setMonth(l.getMonth() +
|
|
1697
|
+
function xr(e, t, r, s) {
|
|
1698
|
+
const n = r.length, o = new Array(n);
|
|
1699
|
+
if (s.isMonth)
|
|
1700
|
+
for (let a = 0; a < n; a++) {
|
|
1701
|
+
const i = r[a], l = new Date(e[i]);
|
|
1702
|
+
l.setMonth(l.getMonth() + s.amount), o[a] = [l.getTime(), t[i]];
|
|
1705
1703
|
}
|
|
1706
|
-
else if (
|
|
1707
|
-
for (let
|
|
1708
|
-
const i = r[
|
|
1709
|
-
l.setFullYear(l.getFullYear() +
|
|
1704
|
+
else if (s.isYear)
|
|
1705
|
+
for (let a = 0; a < n; a++) {
|
|
1706
|
+
const i = r[a], l = new Date(e[i]);
|
|
1707
|
+
l.setFullYear(l.getFullYear() + s.amount), o[a] = [l.getTime(), t[i]];
|
|
1710
1708
|
}
|
|
1711
1709
|
else
|
|
1712
|
-
for (let
|
|
1713
|
-
const i = r[
|
|
1714
|
-
a
|
|
1710
|
+
for (let a = 0; a < n; a++) {
|
|
1711
|
+
const i = r[a];
|
|
1712
|
+
o[a] = [e[i] + s.deltaMs, t[i]];
|
|
1715
1713
|
}
|
|
1716
|
-
return
|
|
1714
|
+
return o;
|
|
1717
1715
|
}
|
|
1718
|
-
function
|
|
1719
|
-
for (let
|
|
1720
|
-
const { indexes:
|
|
1721
|
-
if (
|
|
1722
|
-
for (let
|
|
1716
|
+
function Pr(e, t, r) {
|
|
1717
|
+
for (let s = 0; s < r.length; s++) {
|
|
1718
|
+
const { indexes: n, lowerIdx: o, upperIdx: a } = r[s], i = e[o], l = t[o], f = e[a], h = t[a], y = f - i, p = h - l;
|
|
1719
|
+
if (y === 0) {
|
|
1720
|
+
for (let g = 0; g < n.length; g++) t[n[g]] = l;
|
|
1723
1721
|
continue;
|
|
1724
1722
|
}
|
|
1725
|
-
for (let
|
|
1726
|
-
const d =
|
|
1727
|
-
t[d] = l + (e[d] - i) *
|
|
1723
|
+
for (let g = 0; g < n.length; g++) {
|
|
1724
|
+
const d = n[g];
|
|
1725
|
+
t[d] = l + (e[d] - i) * p / y;
|
|
1728
1726
|
}
|
|
1729
1727
|
}
|
|
1730
1728
|
}
|
|
1731
|
-
function
|
|
1732
|
-
for (let
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
const i = e[
|
|
1729
|
+
function Nr(e, t, r) {
|
|
1730
|
+
for (let s = 0; s < r.length; s++) {
|
|
1731
|
+
const n = r[s][0], o = r[s][1], a = r[s][2];
|
|
1732
|
+
if (o <= n) continue;
|
|
1733
|
+
const i = e[n], l = e[o] - i;
|
|
1736
1734
|
if (l !== 0)
|
|
1737
|
-
for (let f =
|
|
1738
|
-
t[f] = t[f] +
|
|
1735
|
+
for (let f = n; f < o; f++)
|
|
1736
|
+
t[f] = t[f] + a * ((e[f] - i) / l);
|
|
1739
1737
|
}
|
|
1740
1738
|
}
|
|
1741
|
-
function
|
|
1742
|
-
const
|
|
1739
|
+
function ut(e, t, r, s) {
|
|
1740
|
+
const n = t.length;
|
|
1743
1741
|
if (r === "ADD")
|
|
1744
|
-
for (let
|
|
1742
|
+
for (let o = 0; o < n; o++) e[t[o]] = e[t[o]] + s;
|
|
1745
1743
|
else if (r === "SUB")
|
|
1746
|
-
for (let
|
|
1744
|
+
for (let o = 0; o < n; o++) e[t[o]] = e[t[o]] - s;
|
|
1747
1745
|
else if (r === "MULT")
|
|
1748
|
-
for (let
|
|
1746
|
+
for (let o = 0; o < n; o++) e[t[o]] = e[t[o]] * s;
|
|
1749
1747
|
else if (r === "DIV")
|
|
1750
|
-
for (let
|
|
1748
|
+
for (let o = 0; o < n; o++) e[t[o]] = e[t[o]] / s;
|
|
1751
1749
|
else if (r === "ASSIGN")
|
|
1752
|
-
for (let
|
|
1750
|
+
for (let o = 0; o < n; o++) e[t[o]] = s;
|
|
1753
1751
|
}
|
|
1754
|
-
const
|
|
1752
|
+
const Br = 1, Ce = `qc-utils:calibration:v${Br}`, jr = 720 * 60 * 60 * 1e3, oe = 5e4, ae = 2e5, he = {
|
|
1755
1753
|
spawnOverheadMs: 50,
|
|
1756
1754
|
// worst-case Windows
|
|
1757
1755
|
inlineThroughput: 5e4,
|
|
@@ -1762,40 +1760,40 @@ const Fr = 1, xe = `qc-utils:calibration:v${Fr}`, Pr = 720 * 60 * 60 * 1e3, ne =
|
|
|
1762
1760
|
measuredAt: 0,
|
|
1763
1761
|
userAgent: "default"
|
|
1764
1762
|
};
|
|
1765
|
-
let
|
|
1766
|
-
const
|
|
1763
|
+
let O = Gr() ?? he, xe = null, ee = null;
|
|
1764
|
+
const Oe = /* @__PURE__ */ new Set(), Me = {
|
|
1767
1765
|
// Filter ops — read-only scans, cheap kernels
|
|
1768
|
-
[
|
|
1766
|
+
[A.VALUE_THRESHOLD]: {
|
|
1769
1767
|
mode: "calibrated",
|
|
1770
1768
|
weight: 1,
|
|
1771
1769
|
rationale: "O(n) single-pass scan; baseline reference"
|
|
1772
1770
|
},
|
|
1773
|
-
[
|
|
1771
|
+
[A.CHANGE]: {
|
|
1774
1772
|
mode: "calibrated",
|
|
1775
1773
|
weight: 1.1,
|
|
1776
1774
|
rationale: "O(n) with one subtraction per step"
|
|
1777
1775
|
},
|
|
1778
|
-
[
|
|
1776
|
+
[A.RATE_OF_CHANGE]: {
|
|
1779
1777
|
mode: "calibrated",
|
|
1780
1778
|
weight: 1.4,
|
|
1781
1779
|
rationale: "O(n) with division + abs per step"
|
|
1782
1780
|
},
|
|
1783
|
-
[
|
|
1781
|
+
[A.FIND_GAPS]: {
|
|
1784
1782
|
mode: "calibrated",
|
|
1785
1783
|
weight: 0.9,
|
|
1786
1784
|
rationale: "O(n) on X only, mostly empty output"
|
|
1787
1785
|
},
|
|
1788
|
-
[
|
|
1786
|
+
[A.PERSISTENCE]: {
|
|
1789
1787
|
mode: "calibrated",
|
|
1790
1788
|
weight: 1.3,
|
|
1791
1789
|
rationale: "O(n) + chunk-boundary stitch"
|
|
1792
1790
|
},
|
|
1793
|
-
[
|
|
1791
|
+
[A.DATETIME_RANGE]: {
|
|
1794
1792
|
mode: "always-inline",
|
|
1795
1793
|
weight: 0,
|
|
1796
1794
|
rationale: "O(log n) binary search; never worth the worker hop"
|
|
1797
1795
|
},
|
|
1798
|
-
[
|
|
1796
|
+
[A.SELECTION]: {
|
|
1799
1797
|
mode: "always-inline",
|
|
1800
1798
|
weight: 0,
|
|
1801
1799
|
rationale: "Pure history bookkeeping"
|
|
@@ -1847,8 +1845,8 @@ const Re = /* @__PURE__ */ new Set(), Ie = {
|
|
|
1847
1845
|
rationale: "Single copy-with-fills pass; fresh SAB sized to newLength"
|
|
1848
1846
|
}
|
|
1849
1847
|
};
|
|
1850
|
-
function
|
|
1851
|
-
const r =
|
|
1848
|
+
function D(e, t) {
|
|
1849
|
+
const r = Me[e];
|
|
1852
1850
|
if (!r)
|
|
1853
1851
|
return {
|
|
1854
1852
|
useWorker: !0,
|
|
@@ -1877,29 +1875,29 @@ function U(e, t) {
|
|
|
1877
1875
|
predictedWorkerMs: 0,
|
|
1878
1876
|
reason: r.rationale
|
|
1879
1877
|
};
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1878
|
+
const s = Wr(e, t);
|
|
1879
|
+
if (s <= 0)
|
|
1882
1880
|
return {
|
|
1883
1881
|
useWorker: !1,
|
|
1884
1882
|
predictedInlineMs: 0,
|
|
1885
|
-
predictedWorkerMs:
|
|
1883
|
+
predictedWorkerMs: O.spawnOverheadMs,
|
|
1886
1884
|
reason: "zero work units"
|
|
1887
1885
|
};
|
|
1888
|
-
const
|
|
1886
|
+
const n = Math.max(
|
|
1889
1887
|
1,
|
|
1890
1888
|
Math.min(
|
|
1891
|
-
t.parallelism ??
|
|
1892
|
-
|
|
1889
|
+
t.parallelism ?? O.hwConcurrency,
|
|
1890
|
+
O.hwConcurrency
|
|
1893
1891
|
)
|
|
1894
|
-
),
|
|
1892
|
+
), o = r.weight * s / O.inlineThroughput, a = O.spawnOverheadMs + r.weight * s / (O.workerThroughput * n), i = o > a;
|
|
1895
1893
|
return {
|
|
1896
1894
|
useWorker: i,
|
|
1897
|
-
predictedInlineMs:
|
|
1898
|
-
predictedWorkerMs:
|
|
1899
|
-
reason: i ? `worker faster (${
|
|
1895
|
+
predictedInlineMs: o,
|
|
1896
|
+
predictedWorkerMs: a,
|
|
1897
|
+
reason: i ? `worker faster (${a.toFixed(1)} vs ${o.toFixed(1)} ms)` : `inline faster (${o.toFixed(1)} vs ${a.toFixed(1)} ms)`
|
|
1900
1898
|
};
|
|
1901
1899
|
}
|
|
1902
|
-
function
|
|
1900
|
+
function Wr(e, t) {
|
|
1903
1901
|
switch (e) {
|
|
1904
1902
|
case E.CHANGE_VALUES:
|
|
1905
1903
|
case E.INTERPOLATE:
|
|
@@ -1916,116 +1914,116 @@ function Br(e, t) {
|
|
|
1916
1914
|
return t.datasetSize;
|
|
1917
1915
|
}
|
|
1918
1916
|
}
|
|
1919
|
-
function
|
|
1920
|
-
return
|
|
1917
|
+
function bs(e) {
|
|
1918
|
+
return Oe.add(e), () => Oe.delete(e);
|
|
1921
1919
|
}
|
|
1922
|
-
function
|
|
1923
|
-
return
|
|
1920
|
+
function Ss() {
|
|
1921
|
+
return O;
|
|
1924
1922
|
}
|
|
1925
|
-
function
|
|
1926
|
-
return
|
|
1923
|
+
function Es() {
|
|
1924
|
+
return xe;
|
|
1927
1925
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return Object.keys(
|
|
1926
|
+
function vs() {
|
|
1927
|
+
return Object.keys(Me).map((e) => ({ op: e, ...Me[e] }));
|
|
1930
1928
|
}
|
|
1931
|
-
function
|
|
1932
|
-
|
|
1929
|
+
function ks() {
|
|
1930
|
+
O = he, xe = null;
|
|
1933
1931
|
try {
|
|
1934
|
-
localStorage.removeItem(
|
|
1932
|
+
localStorage.removeItem(Ce);
|
|
1935
1933
|
} catch {
|
|
1936
1934
|
}
|
|
1937
1935
|
}
|
|
1938
|
-
async function
|
|
1939
|
-
if (typeof window > "u" || !(e.force ||
|
|
1940
|
-
if (
|
|
1936
|
+
async function _s(e = {}) {
|
|
1937
|
+
if (typeof window > "u" || !(e.force || O.measuredAt === 0 || Date.now() - O.measuredAt > jr)) return O;
|
|
1938
|
+
if (ee) await ee;
|
|
1941
1939
|
else {
|
|
1942
|
-
|
|
1943
|
-
|
|
1940
|
+
ee = Yr().finally(() => {
|
|
1941
|
+
ee = null;
|
|
1944
1942
|
});
|
|
1945
|
-
const r = await
|
|
1946
|
-
|
|
1947
|
-
for (const
|
|
1943
|
+
const r = await ee;
|
|
1944
|
+
O = r, Hr(r), xe = r;
|
|
1945
|
+
for (const s of Oe) s(O);
|
|
1948
1946
|
}
|
|
1949
|
-
return
|
|
1947
|
+
return O;
|
|
1950
1948
|
}
|
|
1951
|
-
async function
|
|
1949
|
+
async function Yr() {
|
|
1952
1950
|
if (!(typeof SharedArrayBuffer < "u"))
|
|
1953
1951
|
return {
|
|
1954
|
-
...
|
|
1952
|
+
...he,
|
|
1955
1953
|
measuredAt: Date.now(),
|
|
1956
1954
|
userAgent: navigator.userAgent,
|
|
1957
|
-
hwConcurrency: navigator.hardwareConcurrency ||
|
|
1955
|
+
hwConcurrency: navigator.hardwareConcurrency || he.hwConcurrency,
|
|
1958
1956
|
sharedArrayBufferAvailable: !1,
|
|
1959
1957
|
samples: { spawnRoundtripMs: [], inlineScanMs: [], workerScanMs: [] }
|
|
1960
1958
|
};
|
|
1961
|
-
const t = navigator.hardwareConcurrency || 4, r = new Float32Array(
|
|
1962
|
-
for (let
|
|
1963
|
-
const
|
|
1964
|
-
const
|
|
1965
|
-
return
|
|
1966
|
-
}),
|
|
1967
|
-
const
|
|
1968
|
-
return await new Promise((
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
},
|
|
1973
|
-
bufferY:
|
|
1959
|
+
const t = navigator.hardwareConcurrency || 4, r = new Float32Array(oe);
|
|
1960
|
+
for (let u = 0; u < oe; u++) r[u] = Math.sin(u);
|
|
1961
|
+
const s = await ve(3, () => {
|
|
1962
|
+
const u = performance.now();
|
|
1963
|
+
return Pt(r, 0, oe, [2], [0.5]), performance.now() - u;
|
|
1964
|
+
}), n = ke(s), o = oe / Math.max(n, 1e-3), a = new SharedArrayBuffer(256 * Float32Array.BYTES_PER_ELEMENT), i = await ve(3, async () => {
|
|
1965
|
+
const u = performance.now();
|
|
1966
|
+
return await new Promise((w) => {
|
|
1967
|
+
const b = new Ie();
|
|
1968
|
+
b.onmessage = () => {
|
|
1969
|
+
b.terminate(), w();
|
|
1970
|
+
}, b.postMessage({
|
|
1971
|
+
bufferY: a,
|
|
1974
1972
|
start: 0,
|
|
1975
1973
|
end: 256,
|
|
1976
1974
|
ops: [2],
|
|
1977
1975
|
values: [0.5]
|
|
1978
1976
|
});
|
|
1979
|
-
}), performance.now() -
|
|
1980
|
-
}), l =
|
|
1981
|
-
|
|
1982
|
-
),
|
|
1983
|
-
for (let
|
|
1984
|
-
const
|
|
1985
|
-
const
|
|
1986
|
-
return await new Promise((
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
},
|
|
1977
|
+
}), performance.now() - u;
|
|
1978
|
+
}), l = ke(i), f = new SharedArrayBuffer(
|
|
1979
|
+
ae * Float32Array.BYTES_PER_ELEMENT
|
|
1980
|
+
), h = new Float32Array(f);
|
|
1981
|
+
for (let u = 0; u < ae; u++) h[u] = Math.sin(u);
|
|
1982
|
+
const y = await ve(3, async () => {
|
|
1983
|
+
const u = performance.now();
|
|
1984
|
+
return await new Promise((w) => {
|
|
1985
|
+
const b = new Ie();
|
|
1986
|
+
b.onmessage = () => {
|
|
1987
|
+
b.terminate(), w();
|
|
1988
|
+
}, b.postMessage({
|
|
1991
1989
|
bufferY: f,
|
|
1992
1990
|
start: 0,
|
|
1993
|
-
end:
|
|
1991
|
+
end: ae,
|
|
1994
1992
|
ops: [2],
|
|
1995
1993
|
values: [0.5]
|
|
1996
1994
|
});
|
|
1997
|
-
}), performance.now() -
|
|
1998
|
-
}),
|
|
1995
|
+
}), performance.now() - u;
|
|
1996
|
+
}), p = Math.max(ke(y) - l, 0.1), g = ae / p;
|
|
1999
1997
|
return {
|
|
2000
1998
|
spawnOverheadMs: l,
|
|
2001
|
-
inlineThroughput:
|
|
2002
|
-
workerThroughput:
|
|
1999
|
+
inlineThroughput: o,
|
|
2000
|
+
workerThroughput: g,
|
|
2003
2001
|
hwConcurrency: t,
|
|
2004
2002
|
measuredAt: Date.now(),
|
|
2005
2003
|
userAgent: navigator.userAgent,
|
|
2006
2004
|
sharedArrayBufferAvailable: !0,
|
|
2007
2005
|
samples: {
|
|
2008
2006
|
spawnRoundtripMs: i,
|
|
2009
|
-
inlineScanMs:
|
|
2010
|
-
workerScanMs:
|
|
2007
|
+
inlineScanMs: s,
|
|
2008
|
+
workerScanMs: y
|
|
2011
2009
|
}
|
|
2012
2010
|
};
|
|
2013
2011
|
}
|
|
2014
|
-
async function
|
|
2012
|
+
async function ve(e, t) {
|
|
2015
2013
|
const r = [];
|
|
2016
|
-
for (let
|
|
2017
|
-
await new Promise((
|
|
2014
|
+
for (let s = 0; s < e; s++)
|
|
2015
|
+
await new Promise((n) => setTimeout(n, 0)), r.push(await t());
|
|
2018
2016
|
return r;
|
|
2019
2017
|
}
|
|
2020
|
-
function
|
|
2018
|
+
function ke(e) {
|
|
2021
2019
|
if (!e.length) return 0;
|
|
2022
|
-
const t = [...e].sort((
|
|
2020
|
+
const t = [...e].sort((s, n) => s - n), r = Math.floor(t.length / 2);
|
|
2023
2021
|
return t.length % 2 ? t[r] : (t[r - 1] + t[r]) / 2;
|
|
2024
2022
|
}
|
|
2025
|
-
function
|
|
2023
|
+
function Gr() {
|
|
2026
2024
|
if (typeof localStorage > "u") return null;
|
|
2027
2025
|
try {
|
|
2028
|
-
const e = localStorage.getItem(
|
|
2026
|
+
const e = localStorage.getItem(Ce);
|
|
2029
2027
|
if (!e) return null;
|
|
2030
2028
|
const t = JSON.parse(e);
|
|
2031
2029
|
return !t || typeof t.spawnOverheadMs != "number" ? null : t;
|
|
@@ -2033,7 +2031,7 @@ function jr() {
|
|
|
2033
2031
|
return null;
|
|
2034
2032
|
}
|
|
2035
2033
|
}
|
|
2036
|
-
function
|
|
2034
|
+
function Hr(e) {
|
|
2037
2035
|
if (!(typeof localStorage > "u"))
|
|
2038
2036
|
try {
|
|
2039
2037
|
const t = {
|
|
@@ -2044,32 +2042,48 @@ function Wr(e) {
|
|
|
2044
2042
|
measuredAt: e.measuredAt,
|
|
2045
2043
|
userAgent: e.userAgent
|
|
2046
2044
|
};
|
|
2047
|
-
localStorage.setItem(
|
|
2045
|
+
localStorage.setItem(Ce, JSON.stringify(t));
|
|
2048
2046
|
} catch {
|
|
2049
2047
|
}
|
|
2050
2048
|
}
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2049
|
+
const te = 20 * 1e3, zr = 1024, Xr = ["date", "value", "qualifier"], Vr = typeof SharedArrayBuffer < "u";
|
|
2050
|
+
function M(e, t) {
|
|
2051
|
+
return Vr ? t !== void 0 ? new SharedArrayBuffer(e, { maxByteLength: t }) : new SharedArrayBuffer(e) : t !== void 0 ? new ArrayBuffer(e, { maxByteLength: t }) : new ArrayBuffer(e);
|
|
2052
|
+
}
|
|
2053
|
+
function ht(e, t) {
|
|
2054
|
+
const r = e;
|
|
2055
|
+
typeof r.grow == "function" ? r.grow(t) : typeof r.resize == "function" && r.resize(t);
|
|
2056
|
+
}
|
|
2057
|
+
function qr(e, t) {
|
|
2058
|
+
if (e.length !== t.length) return !1;
|
|
2059
|
+
for (let r = 0; r < e.length; r++)
|
|
2060
|
+
if (e[r] !== t[r]) return !1;
|
|
2061
|
+
return !0;
|
|
2062
|
+
}
|
|
2063
|
+
function Jr(e, t) {
|
|
2064
|
+
switch (e) {
|
|
2065
|
+
case E.ADD_POINTS:
|
|
2066
|
+
case E.FILL_GAPS:
|
|
2067
|
+
return !1;
|
|
2068
|
+
default:
|
|
2069
|
+
return !0;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
class As {
|
|
2053
2073
|
/** The generated dataset to be used for plotting */
|
|
2054
2074
|
dataset = {
|
|
2055
|
-
dimensions:
|
|
2075
|
+
dimensions: Xr,
|
|
2056
2076
|
source: {
|
|
2057
2077
|
x: new Float64Array(
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
maxByteLength: Q * Float64Array.BYTES_PER_ELEMENT
|
|
2062
|
-
// Max size the array can reach
|
|
2063
|
-
}
|
|
2078
|
+
M(
|
|
2079
|
+
te * Float64Array.BYTES_PER_ELEMENT,
|
|
2080
|
+
te * Float64Array.BYTES_PER_ELEMENT
|
|
2064
2081
|
)
|
|
2065
2082
|
),
|
|
2066
2083
|
y: new Float32Array(
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
maxByteLength: Q * Float32Array.BYTES_PER_ELEMENT
|
|
2071
|
-
// Max size the array can reach
|
|
2072
|
-
}
|
|
2084
|
+
M(
|
|
2085
|
+
te * Float32Array.BYTES_PER_ELEMENT,
|
|
2086
|
+
te * Float32Array.BYTES_PER_ELEMENT
|
|
2073
2087
|
)
|
|
2074
2088
|
)
|
|
2075
2089
|
}
|
|
@@ -2109,7 +2123,7 @@ class bn {
|
|
|
2109
2123
|
if (!t)
|
|
2110
2124
|
return;
|
|
2111
2125
|
this.isLoading = !0;
|
|
2112
|
-
const r = await
|
|
2126
|
+
const r = await Ee(() => {
|
|
2113
2127
|
this._growBuffer(t.datetimes.length), this._resizeTo(t.datetimes.length), this.dataX.set(t.datetimes), this.dataY.set(t.dataValues);
|
|
2114
2128
|
});
|
|
2115
2129
|
this.loadingTime = r.duration, this.history.length = 0, this.isLoading = !1;
|
|
@@ -2138,24 +2152,20 @@ class bn {
|
|
|
2138
2152
|
*/
|
|
2139
2153
|
_growBuffer(t) {
|
|
2140
2154
|
const r = t * Float64Array.BYTES_PER_ELEMENT;
|
|
2141
|
-
let
|
|
2142
|
-
for (; r >
|
|
2143
|
-
|
|
2144
|
-
if (
|
|
2145
|
-
const
|
|
2155
|
+
let s = this.dataX.buffer.byteLength;
|
|
2156
|
+
for (; r > s; )
|
|
2157
|
+
s += te * Float64Array.BYTES_PER_ELEMENT;
|
|
2158
|
+
if (s * Float64Array.BYTES_PER_ELEMENT > this.dataX.buffer.maxByteLength) {
|
|
2159
|
+
const n = M(
|
|
2146
2160
|
this.dataX.buffer.byteLength,
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
}
|
|
2150
|
-
), a = new SharedArrayBuffer(
|
|
2161
|
+
s * Float64Array.BYTES_PER_ELEMENT
|
|
2162
|
+
), o = M(
|
|
2151
2163
|
this.dataY.buffer.byteLength,
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
), o = new Float64Array(s), i = new Float32Array(a);
|
|
2156
|
-
o.set(this.dataX), i.set(this.dataY), this.dataset.source.x = o, this.dataset.source.y = i;
|
|
2164
|
+
s * Float32Array.BYTES_PER_ELEMENT
|
|
2165
|
+
), a = new Float64Array(n), i = new Float32Array(o);
|
|
2166
|
+
a.set(this.dataX), i.set(this.dataY), this.dataset.source.x = a, this.dataset.source.y = i;
|
|
2157
2167
|
}
|
|
2158
|
-
this.dataX.buffer.byteLength < t * Float64Array.BYTES_PER_ELEMENT && (this.dataX.buffer
|
|
2168
|
+
this.dataX.buffer.byteLength < t * Float64Array.BYTES_PER_ELEMENT && (ht(this.dataX.buffer, t * Float64Array.BYTES_PER_ELEMENT), ht(this.dataY.buffer, t * Float32Array.BYTES_PER_ELEMENT));
|
|
2159
2169
|
}
|
|
2160
2170
|
/**
|
|
2161
2171
|
* Reloads the dataset with the raw data
|
|
@@ -2169,7 +2179,7 @@ class bn {
|
|
|
2169
2179
|
*/
|
|
2170
2180
|
async reloadHistory(t) {
|
|
2171
2181
|
const r = this.history.slice(0, t + 1);
|
|
2172
|
-
return this.redoStack.length = 0, await this.reload(), await this.dispatch(r.map((
|
|
2182
|
+
return this.redoStack.length = 0, await this.reload(), await this.dispatch(r.map((s) => [s.method, ...s.args || []]));
|
|
2173
2183
|
}
|
|
2174
2184
|
/**
|
|
2175
2185
|
* Remove a history item
|
|
@@ -2177,7 +2187,7 @@ class bn {
|
|
|
2177
2187
|
*/
|
|
2178
2188
|
async removeHistoryItem(t) {
|
|
2179
2189
|
const r = [...this.history];
|
|
2180
|
-
return r.splice(t, 1), this.redoStack.length = 0, await this.reload(), await this.dispatch(r.map((
|
|
2190
|
+
return r.splice(t, 1), this.redoStack.length = 0, await this.reload(), await this.dispatch(r.map((s) => [s.method, ...s.args || []]));
|
|
2181
2191
|
}
|
|
2182
2192
|
/**
|
|
2183
2193
|
* Undo the most recent history entry. Pushes it onto `redoStack` so a
|
|
@@ -2189,7 +2199,7 @@ class bn {
|
|
|
2189
2199
|
const t = this.history[this.history.length - 1], r = this.history.slice(0, -1);
|
|
2190
2200
|
await this.reload(), this.redoStack.push(t), this._isReplaying = !0;
|
|
2191
2201
|
try {
|
|
2192
|
-
return await this.dispatch(r.map((
|
|
2202
|
+
return await this.dispatch(r.map((s) => [s.method, ...s.args || []]));
|
|
2193
2203
|
} finally {
|
|
2194
2204
|
this._isReplaying = !1;
|
|
2195
2205
|
}
|
|
@@ -2216,106 +2226,101 @@ class bn {
|
|
|
2216
2226
|
get endTime() {
|
|
2217
2227
|
return this.dataset.source.x.length ? new Date(this.dataset.source.x[this.dataset.source.x.length - 1]) : null;
|
|
2218
2228
|
}
|
|
2219
|
-
/**
|
|
2229
|
+
/**
|
|
2230
|
+
* Dispatch an operation and log its signature in history.
|
|
2231
|
+
*
|
|
2232
|
+
* The selection-consuming entries below (DELETE_POINTS, INTERPOLATE,
|
|
2233
|
+
* SHIFT_DATETIMES, DRIFT_CORRECTION) route to thin
|
|
2234
|
+
* `*FromSelection` wrappers that read the target indices off
|
|
2235
|
+
* `history[length - 2].selected` at dispatch time, mirroring the
|
|
2236
|
+
* pattern CHANGE_VALUES already uses. The internal handlers
|
|
2237
|
+
* (`_deleteDataPoints`, `_shift`, etc.) keep their explicit-
|
|
2238
|
+
* indices signatures so other internal callers (e.g.
|
|
2239
|
+
* `_assignDatetimesBulk` → `_deleteDataPoints` + `_addDataPoints`)
|
|
2240
|
+
* can pass locally-computed indices without going through history.
|
|
2241
|
+
*/
|
|
2220
2242
|
async dispatchAction(t, ...r) {
|
|
2221
|
-
const
|
|
2243
|
+
const s = {
|
|
2222
2244
|
[E.ADD_POINTS]: this._addDataPoints,
|
|
2223
2245
|
[E.CHANGE_VALUES]: this._changeValues,
|
|
2224
2246
|
[E.ASSIGN_VALUES_BULK]: this._assignValuesBulk,
|
|
2225
|
-
[E.DELETE_POINTS]: this.
|
|
2226
|
-
[E.DRIFT_CORRECTION]: this.
|
|
2227
|
-
[E.INTERPOLATE]: this.
|
|
2228
|
-
[E.SHIFT_DATETIMES]: this.
|
|
2247
|
+
[E.DELETE_POINTS]: this._deleteDataPointsFromSelection,
|
|
2248
|
+
[E.DRIFT_CORRECTION]: this._driftCorrectionFromSelection,
|
|
2249
|
+
[E.INTERPOLATE]: this._interpolateFromSelection,
|
|
2250
|
+
[E.SHIFT_DATETIMES]: this._shiftFromSelection,
|
|
2229
2251
|
[E.ASSIGN_DATETIMES_BULK]: this._assignDatetimesBulk,
|
|
2230
2252
|
[E.FILL_GAPS]: this._fillGaps
|
|
2231
|
-
}, s = {
|
|
2232
|
-
[E.ADD_POINTS]: "mdi-plus",
|
|
2233
|
-
[E.CHANGE_VALUES]: "mdi-pencil",
|
|
2234
|
-
[E.ASSIGN_VALUES_BULK]: "mdi-pencil",
|
|
2235
|
-
[E.DELETE_POINTS]: "mdi-trash-can",
|
|
2236
|
-
[E.DRIFT_CORRECTION]: "mdi-chart-sankey",
|
|
2237
|
-
[E.INTERPOLATE]: "mdi-transit-connection-horizontal",
|
|
2238
|
-
[E.SHIFT_DATETIMES]: "mdi-calendar",
|
|
2239
|
-
[E.ASSIGN_DATETIMES_BULK]: "mdi-calendar",
|
|
2240
|
-
[E.FILL_GAPS]: "mdi-keyboard-space"
|
|
2241
2253
|
};
|
|
2242
|
-
let
|
|
2254
|
+
let n = [], o = null;
|
|
2243
2255
|
try {
|
|
2244
|
-
this._isReplaying || (this.redoStack.length = 0)
|
|
2245
|
-
const o = {
|
|
2256
|
+
this._isReplaying || (this.redoStack.length = 0), o = {
|
|
2246
2257
|
method: t,
|
|
2247
2258
|
args: r,
|
|
2248
|
-
icon: s[t],
|
|
2249
2259
|
isLoading: !0
|
|
2250
|
-
};
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
this.
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
f && (f.duration = l.duration, f.executionMode = this._pendingExecutionMode, f.isLoading = !1);
|
|
2258
|
-
} catch (o) {
|
|
2259
|
-
console.log(
|
|
2260
|
+
}, this.history.push(o), Jr(t, r) || this.history[this.history.length - 2]?.method === A.SELECTION && this.history.splice(this.history.length - 2, 1), this._pendingExecutionMode = "inline";
|
|
2261
|
+
const a = await Ee(async () => await s[t].apply(this, r));
|
|
2262
|
+
n = a.response;
|
|
2263
|
+
const i = this.history.indexOf(o), l = i >= 0 ? this.history[i] : void 0;
|
|
2264
|
+
l && (l.duration = a.duration, l.executionMode = this._pendingExecutionMode, l.status = "success", l.isLoading = !1);
|
|
2265
|
+
} catch (a) {
|
|
2266
|
+
if (console.log(
|
|
2260
2267
|
`Failed to execute operation: ${t} with arguments: `,
|
|
2261
2268
|
r
|
|
2262
|
-
), console.log(o)
|
|
2269
|
+
), console.log(a), o) {
|
|
2270
|
+
const i = this.history.indexOf(o), l = i >= 0 ? this.history[i] : void 0;
|
|
2271
|
+
l && (l.status = "failed", l.isLoading = !1);
|
|
2272
|
+
}
|
|
2263
2273
|
}
|
|
2264
|
-
return
|
|
2274
|
+
return n;
|
|
2265
2275
|
}
|
|
2266
2276
|
async dispatch(t, ...r) {
|
|
2267
|
-
const
|
|
2277
|
+
const s = async (n, o) => A[n] ? await this.dispatchFilter(n, ...o) : await this.dispatchAction(n, ...o);
|
|
2268
2278
|
if (Array.isArray(t)) {
|
|
2269
|
-
let
|
|
2270
|
-
for (let
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2279
|
+
let n = [];
|
|
2280
|
+
for (let o = 0; o < t.length; o++) {
|
|
2281
|
+
const a = t[o][0], i = t[o].slice(1, t[o].length);
|
|
2282
|
+
n = await s(a, i);
|
|
2273
2283
|
}
|
|
2274
|
-
return
|
|
2284
|
+
return n;
|
|
2275
2285
|
} else
|
|
2276
|
-
return await
|
|
2286
|
+
return await s(t, r);
|
|
2277
2287
|
}
|
|
2278
2288
|
/** Filter operations do not transform the data and return a selection */
|
|
2279
2289
|
async dispatchFilter(t, ...r) {
|
|
2280
|
-
const
|
|
2281
|
-
[
|
|
2282
|
-
[
|
|
2283
|
-
[
|
|
2284
|
-
[
|
|
2285
|
-
[
|
|
2286
|
-
[
|
|
2287
|
-
[
|
|
2288
|
-
}, s = {
|
|
2289
|
-
[v.FIND_GAPS]: "mdi-plus",
|
|
2290
|
-
[v.PERSISTENCE]: "mdi-plus",
|
|
2291
|
-
[v.CHANGE]: "mdi-plus",
|
|
2292
|
-
[v.RATE_OF_CHANGE]: "mdi-plus",
|
|
2293
|
-
[v.VALUE_THRESHOLD]: "mdi-plus",
|
|
2294
|
-
[v.DATETIME_RANGE]: "mdi-plus",
|
|
2295
|
-
[v.SELECTION]: "mdi-plus"
|
|
2290
|
+
const s = {
|
|
2291
|
+
[A.FIND_GAPS]: this._findGaps,
|
|
2292
|
+
[A.VALUE_THRESHOLD]: this._valueThreshold,
|
|
2293
|
+
[A.DATETIME_RANGE]: this._datetimeRange,
|
|
2294
|
+
[A.PERSISTENCE]: this._persistence,
|
|
2295
|
+
[A.CHANGE]: this._change,
|
|
2296
|
+
[A.RATE_OF_CHANGE]: this._rateOfChange,
|
|
2297
|
+
[A.SELECTION]: this._selection
|
|
2296
2298
|
};
|
|
2297
|
-
let
|
|
2299
|
+
let n = [], o = null;
|
|
2298
2300
|
try {
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
+
const a = t === A.SELECTION, i = a && (!r[0] || Array.isArray(r[0]) && r[0].length === 0);
|
|
2302
|
+
!this._isReplaying && !i && (this.redoStack.length = 0), o = {
|
|
2301
2303
|
method: t,
|
|
2302
2304
|
args: r,
|
|
2303
|
-
icon: s[t],
|
|
2304
2305
|
isLoading: !0
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2306
|
+
};
|
|
2307
|
+
const l = this.history[this.history.length - 1], f = !!A[l?.method], h = l?.method === t || f && !a;
|
|
2308
|
+
let y;
|
|
2309
|
+
h ? (y = this.history.length - 1, this.history[y] = o) : (this.history.push(o), y = this.history.length - 1), this._pendingExecutionMode = "inline";
|
|
2310
|
+
const p = await Ee(async () => await s[t].apply(this, r));
|
|
2311
|
+
n = p.response;
|
|
2312
|
+
const g = this.history.indexOf(o), d = g >= 0 ? this.history[g] : void 0;
|
|
2313
|
+
d && (d.duration = p.duration, d.executionMode = this._pendingExecutionMode, d.selected = p.response, d.status = "success", d.isLoading = !1);
|
|
2314
|
+
} catch (a) {
|
|
2315
|
+
if (console.log(
|
|
2314
2316
|
`Failed to execute filter operation: ${t} with arguments: `,
|
|
2315
2317
|
r
|
|
2316
|
-
), console.log(o)
|
|
2318
|
+
), console.log(a), o) {
|
|
2319
|
+
const i = this.history.indexOf(o), l = i >= 0 ? this.history[i] : void 0;
|
|
2320
|
+
l && (l.status = "failed", l.isLoading = !1);
|
|
2321
|
+
}
|
|
2317
2322
|
}
|
|
2318
|
-
return
|
|
2323
|
+
return n;
|
|
2319
2324
|
}
|
|
2320
2325
|
/**
|
|
2321
2326
|
* @param index An array containing the list of index of values to perform the operations on.
|
|
@@ -2330,35 +2335,35 @@ class bn {
|
|
|
2330
2335
|
* 3. Writes are conflict-free because the selection carries distinct indexes.
|
|
2331
2336
|
*/
|
|
2332
2337
|
async _changeValues(t, r) {
|
|
2333
|
-
const
|
|
2334
|
-
if (!
|
|
2335
|
-
const
|
|
2336
|
-
if (!
|
|
2338
|
+
const s = this.history[this.history.length - 2]?.selected;
|
|
2339
|
+
if (!s || s.length === 0) return [];
|
|
2340
|
+
const n = s.length;
|
|
2341
|
+
if (!D(E.CHANGE_VALUES, {
|
|
2337
2342
|
datasetSize: this.dataset.source.y.length,
|
|
2338
|
-
selectionSize:
|
|
2339
|
-
}).useWorker ||
|
|
2340
|
-
return
|
|
2343
|
+
selectionSize: n
|
|
2344
|
+
}).useWorker || n < zr)
|
|
2345
|
+
return ut(this.dataY, s, t, r), [];
|
|
2341
2346
|
this._pendingExecutionMode = "worker";
|
|
2342
|
-
const
|
|
2343
|
-
for (let
|
|
2344
|
-
const
|
|
2345
|
-
if (
|
|
2346
|
-
const
|
|
2347
|
+
const a = Math.min(navigator.hardwareConcurrency || 1, n), i = Math.ceil(n / a), l = [], f = [];
|
|
2348
|
+
for (let h = 0; h < a; h++) {
|
|
2349
|
+
const y = h * i, p = Math.min((h + 1) * i, n);
|
|
2350
|
+
if (y >= p) break;
|
|
2351
|
+
const g = s.slice(y, p);
|
|
2347
2352
|
f.push(
|
|
2348
2353
|
new Promise((d) => {
|
|
2349
|
-
const
|
|
2350
|
-
l.push(
|
|
2354
|
+
const u = new Rr();
|
|
2355
|
+
l.push(u), u.postMessage({
|
|
2351
2356
|
bufferY: this.dataY.buffer,
|
|
2352
|
-
indexes:
|
|
2357
|
+
indexes: g,
|
|
2353
2358
|
operator: t,
|
|
2354
2359
|
value: r
|
|
2355
|
-
}),
|
|
2356
|
-
d(
|
|
2360
|
+
}), u.onmessage = (w) => {
|
|
2361
|
+
d(w.data);
|
|
2357
2362
|
};
|
|
2358
2363
|
})
|
|
2359
2364
|
);
|
|
2360
2365
|
}
|
|
2361
|
-
return await Promise.all(f), l.forEach((
|
|
2366
|
+
return await Promise.all(f), l.forEach((h) => h.terminate()), [];
|
|
2362
2367
|
}
|
|
2363
2368
|
/**
|
|
2364
2369
|
* Apply an arithmetic operator to Y in-place on the main thread. Thin
|
|
@@ -2366,8 +2371,8 @@ class bn {
|
|
|
2366
2371
|
* and callers outside this module can use the same routine the
|
|
2367
2372
|
* CHANGE_VALUES fast path does.
|
|
2368
2373
|
*/
|
|
2369
|
-
_applyOperatorInPlace(t, r,
|
|
2370
|
-
|
|
2374
|
+
_applyOperatorInPlace(t, r, s) {
|
|
2375
|
+
ut(this.dataY, t, r, s);
|
|
2371
2376
|
}
|
|
2372
2377
|
/**
|
|
2373
2378
|
* One-shot assignment of distinct Y-values at the indices logged by the
|
|
@@ -2384,8 +2389,8 @@ class bn {
|
|
|
2384
2389
|
async _assignValuesBulk(t) {
|
|
2385
2390
|
const r = this.history[this.history.length - 2]?.selected;
|
|
2386
2391
|
if (!r || !r.length || !t?.length) return [];
|
|
2387
|
-
const
|
|
2388
|
-
for (let
|
|
2392
|
+
const s = Math.min(r.length, t.length), n = this.dataY;
|
|
2393
|
+
for (let o = 0; o < s; o++) n[r[o]] = t[o];
|
|
2389
2394
|
return [];
|
|
2390
2395
|
}
|
|
2391
2396
|
/**
|
|
@@ -2400,10 +2405,22 @@ class bn {
|
|
|
2400
2405
|
async _assignDatetimesBulk(t) {
|
|
2401
2406
|
const r = this.history[this.history.length - 2]?.selected;
|
|
2402
2407
|
if (!r || !r.length || !t?.length) return [];
|
|
2403
|
-
const
|
|
2404
|
-
for (let
|
|
2405
|
-
|
|
2406
|
-
return
|
|
2408
|
+
const s = Math.min(r.length, t.length), n = new Array(s), o = new Array(s);
|
|
2409
|
+
for (let a = 0; a < s; a++)
|
|
2410
|
+
n[a] = [t[a], this.dataY[r[a]]], o[a] = r[a];
|
|
2411
|
+
return o.sort((a, i) => a - i), await this._deleteDataPoints(o), await this._addDataPoints(n), [];
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Dispatch wrapper around `_interpolate` — reads target indices
|
|
2415
|
+
* from `history[length - 2].selected` (the SELECTION the caller
|
|
2416
|
+
* dispatched immediately before this op). External callers go
|
|
2417
|
+
* through here; internal callers can keep using `_interpolate`
|
|
2418
|
+
* directly with explicit indices.
|
|
2419
|
+
*/
|
|
2420
|
+
async _interpolateFromSelection() {
|
|
2421
|
+
const t = this.history[this.history.length - 2]?.selected;
|
|
2422
|
+
if (!(!t || t.length === 0))
|
|
2423
|
+
return this._interpolate(t);
|
|
2407
2424
|
}
|
|
2408
2425
|
/**
|
|
2409
2426
|
* Multi-threaded linear interpolation over the selected indexes.
|
|
@@ -2414,43 +2431,43 @@ class bn {
|
|
|
2414
2431
|
async _interpolate(t) {
|
|
2415
2432
|
const r = this._getConsecutiveGroups(t);
|
|
2416
2433
|
if (r.length === 0 || r[0].length === 0) return;
|
|
2417
|
-
const
|
|
2418
|
-
indexes:
|
|
2419
|
-
lowerIdx: Math.max(0,
|
|
2420
|
-
upperIdx: Math.min(
|
|
2434
|
+
const s = this.dataset.source.y.length, n = r.map((h) => ({
|
|
2435
|
+
indexes: h,
|
|
2436
|
+
lowerIdx: Math.max(0, h[0] - 1),
|
|
2437
|
+
upperIdx: Math.min(s - 1, h[h.length - 1] + 1)
|
|
2421
2438
|
}));
|
|
2422
|
-
if (!
|
|
2423
|
-
datasetSize:
|
|
2439
|
+
if (!D(E.INTERPOLATE, {
|
|
2440
|
+
datasetSize: s,
|
|
2424
2441
|
selectionSize: t.length
|
|
2425
2442
|
}).useWorker) {
|
|
2426
|
-
|
|
2443
|
+
Pr(this.dataX, this.dataY, n);
|
|
2427
2444
|
return;
|
|
2428
2445
|
}
|
|
2429
2446
|
this._pendingExecutionMode = "worker";
|
|
2430
|
-
const
|
|
2447
|
+
const a = Math.min(
|
|
2431
2448
|
navigator.hardwareConcurrency || 1,
|
|
2432
|
-
|
|
2433
|
-
), i = Math.ceil(
|
|
2434
|
-
for (let
|
|
2435
|
-
const
|
|
2436
|
-
|
|
2437
|
-
(
|
|
2449
|
+
n.length
|
|
2450
|
+
), i = Math.ceil(n.length / a), l = [], f = [];
|
|
2451
|
+
for (let h = 0; h < a; h++) {
|
|
2452
|
+
const y = n.slice(
|
|
2453
|
+
h * i,
|
|
2454
|
+
(h + 1) * i
|
|
2438
2455
|
);
|
|
2439
|
-
if (
|
|
2456
|
+
if (y.length === 0) break;
|
|
2440
2457
|
f.push(
|
|
2441
|
-
new Promise((
|
|
2442
|
-
const
|
|
2443
|
-
l.push(
|
|
2458
|
+
new Promise((p) => {
|
|
2459
|
+
const g = new Er();
|
|
2460
|
+
l.push(g), g.postMessage({
|
|
2444
2461
|
bufferX: this.dataX.buffer,
|
|
2445
2462
|
bufferY: this.dataY.buffer,
|
|
2446
|
-
groups:
|
|
2447
|
-
}),
|
|
2448
|
-
|
|
2463
|
+
groups: y
|
|
2464
|
+
}), g.onmessage = (d) => {
|
|
2465
|
+
p(d.data);
|
|
2449
2466
|
};
|
|
2450
2467
|
})
|
|
2451
2468
|
);
|
|
2452
2469
|
}
|
|
2453
|
-
await Promise.all(f), l.forEach((
|
|
2470
|
+
await Promise.all(f), l.forEach((h) => h.terminate());
|
|
2454
2471
|
}
|
|
2455
2472
|
/** Interpolate existing values in the data source */
|
|
2456
2473
|
// private _interpolateLinear(
|
|
@@ -2466,6 +2483,16 @@ class bn {
|
|
|
2466
2483
|
// (upperDatetime - lowerDatetime);
|
|
2467
2484
|
// return interpolatedValue;
|
|
2468
2485
|
// }
|
|
2486
|
+
/**
|
|
2487
|
+
* Dispatch wrapper around `_shift` — reads target indices from
|
|
2488
|
+
* `history[length - 2].selected`. The `amount` and `unit` args
|
|
2489
|
+
* stay parametric on the public dispatch signature.
|
|
2490
|
+
*/
|
|
2491
|
+
async _shiftFromSelection(t, r) {
|
|
2492
|
+
const s = this.history[this.history.length - 2]?.selected;
|
|
2493
|
+
if (!(!s || s.length === 0))
|
|
2494
|
+
return this._shift(s, t, r);
|
|
2495
|
+
}
|
|
2469
2496
|
/**
|
|
2470
2497
|
* Shifts the selected indexes by specified amount of units. Elements are reinserted according to their datetime.
|
|
2471
2498
|
* @param index The index of the elements to shift
|
|
@@ -2473,10 +2500,10 @@ class bn {
|
|
|
2473
2500
|
* @param unit {@link TimeUnit}
|
|
2474
2501
|
* @returns
|
|
2475
2502
|
*/
|
|
2476
|
-
async _shift(t, r,
|
|
2503
|
+
async _shift(t, r, s) {
|
|
2477
2504
|
if (t.length === 0) return;
|
|
2478
|
-
const
|
|
2479
|
-
if (!
|
|
2505
|
+
const n = s === x.MONTH, o = s === x.YEAR, a = !n && !o ? r * ne[s] * 1e3 : 0, i = t.length;
|
|
2506
|
+
if (!D(E.SHIFT_DATETIMES, {
|
|
2480
2507
|
datasetSize: this.dataset.source.x.length,
|
|
2481
2508
|
selectionSize: i
|
|
2482
2509
|
}).useWorker) {
|
|
@@ -2484,46 +2511,42 @@ class bn {
|
|
|
2484
2511
|
this.dataX,
|
|
2485
2512
|
this.dataY,
|
|
2486
2513
|
t,
|
|
2487
|
-
{ amount: r, isMonth:
|
|
2514
|
+
{ amount: r, isMonth: n, isYear: o, deltaMs: a }
|
|
2488
2515
|
);
|
|
2489
2516
|
await this._deleteDataPoints(t), await this._addDataPoints(m);
|
|
2490
2517
|
return;
|
|
2491
2518
|
}
|
|
2492
2519
|
this._pendingExecutionMode = "worker";
|
|
2493
|
-
const f =
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
for (let m = 0; m < p; m++) {
|
|
2499
|
-
const S = m * g, A = Math.min((m + 1) * g, i);
|
|
2500
|
-
if (S >= A) break;
|
|
2501
|
-
const L = t.slice(S, A);
|
|
2520
|
+
const f = M(i * Float64Array.BYTES_PER_ELEMENT), h = M(i * Float32Array.BYTES_PER_ELEMENT), y = Math.min(navigator.hardwareConcurrency || 1, i), p = Math.ceil(i / y), g = [], d = [];
|
|
2521
|
+
for (let m = 0; m < y; m++) {
|
|
2522
|
+
const S = m * p, v = Math.min((m + 1) * p, i);
|
|
2523
|
+
if (S >= v) break;
|
|
2524
|
+
const T = t.slice(S, v);
|
|
2502
2525
|
d.push(
|
|
2503
|
-
new Promise((
|
|
2504
|
-
const
|
|
2505
|
-
|
|
2526
|
+
new Promise((L) => {
|
|
2527
|
+
const R = new _r();
|
|
2528
|
+
g.push(R), R.postMessage({
|
|
2506
2529
|
bufferX: this.dataX.buffer,
|
|
2507
2530
|
bufferY: this.dataY.buffer,
|
|
2508
2531
|
outputBufferX: f,
|
|
2509
|
-
outputBufferY:
|
|
2510
|
-
indexes:
|
|
2532
|
+
outputBufferY: h,
|
|
2533
|
+
indexes: T,
|
|
2511
2534
|
outStart: S,
|
|
2512
2535
|
amount: r,
|
|
2513
|
-
isMonth:
|
|
2514
|
-
isYear:
|
|
2515
|
-
deltaMs:
|
|
2516
|
-
}),
|
|
2517
|
-
|
|
2536
|
+
isMonth: n,
|
|
2537
|
+
isYear: o,
|
|
2538
|
+
deltaMs: a
|
|
2539
|
+
}), R.onmessage = (U) => {
|
|
2540
|
+
L(U.data);
|
|
2518
2541
|
};
|
|
2519
2542
|
})
|
|
2520
2543
|
);
|
|
2521
2544
|
}
|
|
2522
|
-
await Promise.all(d),
|
|
2523
|
-
const
|
|
2545
|
+
await Promise.all(d), g.forEach((m) => m.terminate());
|
|
2546
|
+
const u = new Float64Array(f), w = new Float32Array(h), b = new Array(i);
|
|
2524
2547
|
for (let m = 0; m < i; m++)
|
|
2525
|
-
|
|
2526
|
-
await this._deleteDataPoints(t), await this._addDataPoints(
|
|
2548
|
+
b[m] = [u[m], w[m]];
|
|
2549
|
+
await this._deleteDataPoints(t), await this._addDataPoints(b);
|
|
2527
2550
|
}
|
|
2528
2551
|
/**
|
|
2529
2552
|
* Multi-threaded version of {@link _fillGaps}.
|
|
@@ -2532,82 +2555,103 @@ class bn {
|
|
|
2532
2555
|
* 3. Cumulative fill counts before each segment give each worker's output startTarget, ensuring no overlap.
|
|
2533
2556
|
* 4. Each worker copies its segment to the output buffer and inserts its gap fills inline.
|
|
2534
2557
|
*/
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2558
|
+
/**
|
|
2559
|
+
* @param range Optional `[startTs, endTs]` window in epoch
|
|
2560
|
+
* milliseconds. Both bounds inclusive; snapped to the nearest
|
|
2561
|
+
* enclosed point via binary search. Datetime-addressed (not
|
|
2562
|
+
* index-addressed) so the same call survives data growth and is
|
|
2563
|
+
* portable across datasets for QC script replay.
|
|
2564
|
+
*/
|
|
2565
|
+
async _fillGaps(t, r, s, n, o) {
|
|
2566
|
+
const a = this.dataX.length;
|
|
2567
|
+
if (a === 0) return;
|
|
2568
|
+
const i = t[0] * ne[t[1]] * 1e3, l = r[0] * ne[r[1]] * 1e3, f = this.dataX, h = o?.[0] != null && Number.isFinite(o[0]) ? X(f, o[0]) : 0, y = o?.[1] != null && Number.isFinite(o[1]) ? Q(f, o[1]) : a - 1, p = [], g = [];
|
|
2539
2569
|
let d = 0;
|
|
2540
|
-
for (let k =
|
|
2541
|
-
if (
|
|
2542
|
-
let
|
|
2543
|
-
for (;
|
|
2544
|
-
|
|
2545
|
-
|
|
2570
|
+
for (let k = h + 1; k <= y; k++)
|
|
2571
|
+
if (f[k] - f[k - 1] > i) {
|
|
2572
|
+
let P = 0, Y = f[k - 1] + l;
|
|
2573
|
+
for (; Y < f[k]; )
|
|
2574
|
+
P++, Y += l;
|
|
2575
|
+
P > 0 && (p.push([k - 1, k]), g.push(P), d += P);
|
|
2546
2576
|
}
|
|
2547
2577
|
if (d === 0) return;
|
|
2548
|
-
const
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2578
|
+
const u = a + d, w = u * Float64Array.BYTES_PER_ELEMENT, b = u * Float32Array.BYTES_PER_ELEMENT, m = M(
|
|
2579
|
+
w,
|
|
2580
|
+
Math.max(this.dataX.buffer.maxByteLength, w)
|
|
2581
|
+
), S = M(
|
|
2582
|
+
b,
|
|
2583
|
+
Math.max(this.dataY.buffer.maxByteLength, b)
|
|
2584
|
+
);
|
|
2585
|
+
if (!D(E.FILL_GAPS, {
|
|
2586
|
+
datasetSize: a,
|
|
2555
2587
|
selectionSize: d
|
|
2556
2588
|
}).useWorker) {
|
|
2557
|
-
const k = new Float64Array(m),
|
|
2558
|
-
|
|
2589
|
+
const k = new Float64Array(m), j = new Float32Array(S);
|
|
2590
|
+
Dr(
|
|
2559
2591
|
this.dataX,
|
|
2560
2592
|
this.dataY,
|
|
2561
|
-
|
|
2593
|
+
p,
|
|
2562
2594
|
k,
|
|
2563
|
-
|
|
2595
|
+
j,
|
|
2564
2596
|
0,
|
|
2565
|
-
|
|
2597
|
+
a - 1,
|
|
2566
2598
|
0,
|
|
2567
2599
|
l,
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
), this.dataset.source.x = k, this.dataset.source.y =
|
|
2600
|
+
s,
|
|
2601
|
+
n
|
|
2602
|
+
), this.dataset.source.x = k, this.dataset.source.y = j, this._resizeTo(u);
|
|
2571
2603
|
return;
|
|
2572
2604
|
}
|
|
2573
2605
|
this._pendingExecutionMode = "worker";
|
|
2574
|
-
const
|
|
2575
|
-
let
|
|
2576
|
-
for (let k = 0; k <
|
|
2577
|
-
const
|
|
2578
|
-
let
|
|
2579
|
-
for (;
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
}
|
|
2583
|
-
const
|
|
2584
|
-
for (let k = 1; k <
|
|
2585
|
-
|
|
2586
|
-
const
|
|
2587
|
-
for (let k = 0; k <
|
|
2588
|
-
const { start:
|
|
2589
|
-
|
|
2590
|
-
new Promise((
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2606
|
+
const T = navigator.hardwareConcurrency || 1, L = Math.ceil(a / T), R = [];
|
|
2607
|
+
let U = 0;
|
|
2608
|
+
for (let k = 0; k < T; k++) {
|
|
2609
|
+
const j = k * L, P = Math.min((k + 1) * L - 1, a - 1), Y = [];
|
|
2610
|
+
let re = 0;
|
|
2611
|
+
for (; U < p.length && p[U][0] <= P; )
|
|
2612
|
+
Y.push(p[U]), re += g[U], U++;
|
|
2613
|
+
R.push({ start: j, end: P, gapsSegment: Y, fillsInSegment: re });
|
|
2614
|
+
}
|
|
2615
|
+
const pe = new Array(T).fill(0);
|
|
2616
|
+
for (let k = 1; k < T; k++)
|
|
2617
|
+
pe[k] = pe[k - 1] + R[k - 1].fillsInSegment;
|
|
2618
|
+
const Pe = [], Ne = [];
|
|
2619
|
+
for (let k = 0; k < T; k++) {
|
|
2620
|
+
const { start: j, end: P, gapsSegment: Y } = R[k], re = j + pe[k];
|
|
2621
|
+
Ne.push(
|
|
2622
|
+
new Promise((Nt) => {
|
|
2623
|
+
const ye = new Sr();
|
|
2624
|
+
Pe.push(ye), ye.postMessage({
|
|
2593
2625
|
bufferX: this.dataX.buffer,
|
|
2594
2626
|
bufferY: this.dataY.buffer,
|
|
2595
2627
|
outputBufferX: m,
|
|
2596
2628
|
outputBufferY: S,
|
|
2597
|
-
start:
|
|
2598
|
-
end:
|
|
2599
|
-
gapsSegment:
|
|
2600
|
-
startTarget:
|
|
2629
|
+
start: j,
|
|
2630
|
+
end: P,
|
|
2631
|
+
gapsSegment: Y,
|
|
2632
|
+
startTarget: re,
|
|
2601
2633
|
fillDelta: l,
|
|
2602
|
-
interpolate:
|
|
2603
|
-
fillValue:
|
|
2604
|
-
}),
|
|
2605
|
-
|
|
2634
|
+
interpolate: s,
|
|
2635
|
+
fillValue: n
|
|
2636
|
+
}), ye.onmessage = (Bt) => {
|
|
2637
|
+
Nt(Bt.data);
|
|
2606
2638
|
};
|
|
2607
2639
|
})
|
|
2608
2640
|
);
|
|
2609
2641
|
}
|
|
2610
|
-
await Promise.all(
|
|
2642
|
+
await Promise.all(Ne), Pe.forEach((k) => k.terminate()), this.dataset.source.x = new Float64Array(m), this.dataset.source.y = new Float32Array(S), this._resizeTo(u);
|
|
2643
|
+
}
|
|
2644
|
+
/**
|
|
2645
|
+
* Dispatch wrapper around `_deleteDataPoints` — reads target
|
|
2646
|
+
* indices from `history[length - 2].selected`. Internal callers
|
|
2647
|
+
* (`_shift`, `_assignDatetimesBulk`'s delete + add chain) keep
|
|
2648
|
+
* using `_deleteDataPoints` directly with locally-computed
|
|
2649
|
+
* indices; only the external dispatch path goes through here.
|
|
2650
|
+
*/
|
|
2651
|
+
async _deleteDataPointsFromSelection() {
|
|
2652
|
+
const t = this.history[this.history.length - 2]?.selected;
|
|
2653
|
+
if (!(!t || t.length === 0))
|
|
2654
|
+
return this._deleteDataPoints(t);
|
|
2611
2655
|
}
|
|
2612
2656
|
/**
|
|
2613
2657
|
Deletes data points from a large array using worker threads.
|
|
@@ -2615,66 +2659,88 @@ class bn {
|
|
|
2615
2659
|
2. For each segment, binary search locates the indexes to delete (deleteSegment), ensuring efficient lookups.
|
|
2616
2660
|
3. The cumulative deletions before each segment help compute the starting index (startTarget) for each worker's output, ensuring no overlap.
|
|
2617
2661
|
4. Each worker processes its segment linearly, skipping deletions and copying kept elements to their computed positions.
|
|
2618
|
-
* @param deleteIndices
|
|
2662
|
+
* @param deleteIndices
|
|
2619
2663
|
*/
|
|
2620
2664
|
async _deleteDataPoints(t) {
|
|
2621
|
-
const r = this.dataX.length,
|
|
2622
|
-
if (!
|
|
2665
|
+
const r = this.dataX.length, s = r - t.length;
|
|
2666
|
+
if (!D(E.DELETE_POINTS, {
|
|
2623
2667
|
datasetSize: r,
|
|
2624
2668
|
selectionSize: t.length
|
|
2625
2669
|
}).useWorker) {
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2670
|
+
const g = M(
|
|
2671
|
+
this.dataX.buffer.byteLength,
|
|
2672
|
+
this.dataX.buffer.maxByteLength
|
|
2673
|
+
), d = M(
|
|
2674
|
+
this.dataY.buffer.byteLength,
|
|
2675
|
+
this.dataY.buffer.maxByteLength
|
|
2676
|
+
), u = new Float64Array(g), w = new Float32Array(d);
|
|
2677
|
+
Cr(
|
|
2632
2678
|
this.dataX,
|
|
2633
2679
|
this.dataY,
|
|
2634
2680
|
t,
|
|
2635
|
-
|
|
2636
|
-
|
|
2681
|
+
u,
|
|
2682
|
+
w,
|
|
2637
2683
|
0,
|
|
2638
2684
|
r - 1,
|
|
2639
2685
|
0
|
|
2640
|
-
), this.dataset.source.x =
|
|
2686
|
+
), this.dataset.source.x = u, this.dataset.source.y = w, this._resizeTo(s);
|
|
2641
2687
|
return;
|
|
2642
2688
|
}
|
|
2643
2689
|
this._pendingExecutionMode = "worker";
|
|
2644
|
-
const
|
|
2645
|
-
for (let
|
|
2646
|
-
const d =
|
|
2647
|
-
l.push({ start: d, end:
|
|
2648
|
-
}
|
|
2649
|
-
const f = new Array(
|
|
2650
|
-
for (let
|
|
2651
|
-
f[
|
|
2652
|
-
const
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2690
|
+
const o = navigator.hardwareConcurrency || 1, a = Math.ceil(this.dataX.length / o), i = [], l = [];
|
|
2691
|
+
for (let g = 0; g < o; g++) {
|
|
2692
|
+
const d = g * a, u = Math.min((g + 1) * a - 1, this.dataX.length - 1), w = X(t, d), b = Q(t, u), m = t.slice(w, b + 1);
|
|
2693
|
+
l.push({ start: d, end: u, deleteSegment: m });
|
|
2694
|
+
}
|
|
2695
|
+
const f = new Array(o).fill(0);
|
|
2696
|
+
for (let g = 1; g < o; g++)
|
|
2697
|
+
f[g] = f[g - 1] + l[g - 1].deleteSegment.length;
|
|
2698
|
+
const h = [], y = M(
|
|
2699
|
+
this.dataX.buffer.byteLength,
|
|
2700
|
+
this.dataX.buffer.maxByteLength
|
|
2701
|
+
), p = M(
|
|
2702
|
+
this.dataY.buffer.byteLength,
|
|
2703
|
+
this.dataY.buffer.maxByteLength
|
|
2704
|
+
);
|
|
2705
|
+
for (let g = 0; g < o; g++) {
|
|
2706
|
+
const { start: d, end: u, deleteSegment: w } = l[g], b = d - f[g];
|
|
2707
|
+
h.push(
|
|
2660
2708
|
new Promise((m) => {
|
|
2661
|
-
const S = new
|
|
2709
|
+
const S = new br();
|
|
2662
2710
|
i.push(S), S.postMessage({
|
|
2663
2711
|
bufferX: this.dataX.buffer,
|
|
2664
2712
|
bufferY: this.dataY.buffer,
|
|
2665
|
-
outputBufferX:
|
|
2666
|
-
outputBufferY:
|
|
2713
|
+
outputBufferX: y,
|
|
2714
|
+
outputBufferY: p,
|
|
2667
2715
|
start: d,
|
|
2668
|
-
end:
|
|
2669
|
-
deleteSegment:
|
|
2670
|
-
startTarget:
|
|
2671
|
-
}), S.onmessage = (
|
|
2672
|
-
m(
|
|
2716
|
+
end: u,
|
|
2717
|
+
deleteSegment: w,
|
|
2718
|
+
startTarget: b
|
|
2719
|
+
}), S.onmessage = (v) => {
|
|
2720
|
+
m(v.data);
|
|
2673
2721
|
};
|
|
2674
2722
|
})
|
|
2675
2723
|
);
|
|
2676
2724
|
}
|
|
2677
|
-
await Promise.all(
|
|
2725
|
+
await Promise.all(h), i.forEach((g) => g.terminate()), this.dataset.source.x = new Float64Array(y), this.dataset.source.y = new Float32Array(p), this._resizeTo(s);
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* Dispatch wrapper around `_driftCorrection` — reads target
|
|
2729
|
+
* indices from `history[length - 2].selected`, partitions them
|
|
2730
|
+
* into consecutive groups, and applies the same `value` drift to
|
|
2731
|
+
* each group as one logged operation. The internal
|
|
2732
|
+
* `_driftCorrection` retains its per-range `[start, end, value]`
|
|
2733
|
+
* signature so future callers that need distinct per-range values
|
|
2734
|
+
* can still use it directly.
|
|
2735
|
+
*/
|
|
2736
|
+
async _driftCorrectionFromSelection(t) {
|
|
2737
|
+
const r = this.history[this.history.length - 2]?.selected;
|
|
2738
|
+
if (!r || r.length === 0) return;
|
|
2739
|
+
const s = this._getConsecutiveGroups(r), n = [];
|
|
2740
|
+
for (const o of s)
|
|
2741
|
+
o.length !== 0 && n.push([o[0], o[o.length - 1], t]);
|
|
2742
|
+
if (n.length !== 0)
|
|
2743
|
+
return this._driftCorrection(n);
|
|
2678
2744
|
}
|
|
2679
2745
|
/**
|
|
2680
2746
|
*
|
|
@@ -2691,54 +2757,54 @@ class bn {
|
|
|
2691
2757
|
*/
|
|
2692
2758
|
async _driftCorrection(t) {
|
|
2693
2759
|
if (!t || t.length === 0) return;
|
|
2694
|
-
const r = this.dataset.source.x,
|
|
2695
|
-
let
|
|
2696
|
-
for (const [
|
|
2697
|
-
|
|
2698
|
-
if (!
|
|
2760
|
+
const r = this.dataset.source.x, s = navigator.hardwareConcurrency || 1;
|
|
2761
|
+
let n = 0;
|
|
2762
|
+
for (const [y, p] of t)
|
|
2763
|
+
p > y && (n += p - y);
|
|
2764
|
+
if (!D(E.DRIFT_CORRECTION, {
|
|
2699
2765
|
datasetSize: r.length,
|
|
2700
|
-
selectionSize:
|
|
2766
|
+
selectionSize: n
|
|
2701
2767
|
}).useWorker) {
|
|
2702
|
-
|
|
2768
|
+
Nr(r, this.dataY, t);
|
|
2703
2769
|
return;
|
|
2704
2770
|
}
|
|
2705
2771
|
this._pendingExecutionMode = "worker";
|
|
2706
|
-
const
|
|
2707
|
-
for (const [p, g
|
|
2708
|
-
if (
|
|
2709
|
-
const d = r[
|
|
2710
|
-
if (
|
|
2711
|
-
const
|
|
2712
|
-
for (let m =
|
|
2713
|
-
|
|
2772
|
+
const a = [];
|
|
2773
|
+
for (const [y, p, g] of t) {
|
|
2774
|
+
if (p <= y) continue;
|
|
2775
|
+
const d = r[y], u = r[p] - d;
|
|
2776
|
+
if (u === 0) continue;
|
|
2777
|
+
const w = p - y, b = Math.max(1, Math.ceil(w / s));
|
|
2778
|
+
for (let m = y; m < p; m += b)
|
|
2779
|
+
a.push({
|
|
2714
2780
|
chunkStart: m,
|
|
2715
|
-
chunkEnd: Math.min(m +
|
|
2781
|
+
chunkEnd: Math.min(m + b, p),
|
|
2716
2782
|
startDatetime: d,
|
|
2717
|
-
value:
|
|
2718
|
-
extent:
|
|
2783
|
+
value: g,
|
|
2784
|
+
extent: u
|
|
2719
2785
|
});
|
|
2720
2786
|
}
|
|
2721
|
-
if (
|
|
2722
|
-
const i = Math.min(
|
|
2787
|
+
if (a.length === 0) return;
|
|
2788
|
+
const i = Math.min(s, a.length), l = Array.from(
|
|
2723
2789
|
{ length: i },
|
|
2724
2790
|
() => []
|
|
2725
2791
|
);
|
|
2726
|
-
|
|
2727
|
-
const f = [],
|
|
2728
|
-
for (const
|
|
2729
|
-
|
|
2730
|
-
new Promise((
|
|
2731
|
-
const
|
|
2732
|
-
f.push(
|
|
2792
|
+
a.forEach((y, p) => l[p % i].push(y));
|
|
2793
|
+
const f = [], h = [];
|
|
2794
|
+
for (const y of l)
|
|
2795
|
+
y.length !== 0 && h.push(
|
|
2796
|
+
new Promise((p) => {
|
|
2797
|
+
const g = new vr();
|
|
2798
|
+
f.push(g), g.postMessage({
|
|
2733
2799
|
bufferX: this.dataX.buffer,
|
|
2734
2800
|
bufferY: this.dataY.buffer,
|
|
2735
|
-
jobs:
|
|
2736
|
-
}),
|
|
2737
|
-
|
|
2801
|
+
jobs: y
|
|
2802
|
+
}), g.onmessage = (d) => {
|
|
2803
|
+
p(d.data);
|
|
2738
2804
|
};
|
|
2739
2805
|
})
|
|
2740
2806
|
);
|
|
2741
|
-
await Promise.all(
|
|
2807
|
+
await Promise.all(h), f.forEach((y) => y.terminate());
|
|
2742
2808
|
}
|
|
2743
2809
|
/** Traverses the index array and returns groups of consecutive values.
|
|
2744
2810
|
* i.e.: `[0, 1, 3, 4, 6] => [[0, 1], [3, 4], [6]]`
|
|
@@ -2747,9 +2813,9 @@ class bn {
|
|
|
2747
2813
|
*/
|
|
2748
2814
|
_getConsecutiveGroups(t) {
|
|
2749
2815
|
const r = [[]];
|
|
2750
|
-
return t.reduce((
|
|
2751
|
-
const
|
|
2752
|
-
return !
|
|
2816
|
+
return t.reduce((s, n) => {
|
|
2817
|
+
const o = s[s.length - 1];
|
|
2818
|
+
return !o.length || n == o[o.length - 1] + 1 ? o.push(n) : s.push([n]), s;
|
|
2753
2819
|
}, r), r;
|
|
2754
2820
|
}
|
|
2755
2821
|
/**
|
|
@@ -2761,58 +2827,60 @@ class bn {
|
|
|
2761
2827
|
*/
|
|
2762
2828
|
async _addDataPoints(t) {
|
|
2763
2829
|
if (t.length === 0) return;
|
|
2764
|
-
const r = this.dataX.length,
|
|
2765
|
-
t.sort((d,
|
|
2766
|
-
const
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2830
|
+
const r = this.dataX.length, s = r + t.length;
|
|
2831
|
+
t.sort((d, u) => d[0] - u[0]);
|
|
2832
|
+
const n = s * Float64Array.BYTES_PER_ELEMENT, o = s * Float32Array.BYTES_PER_ELEMENT, a = M(
|
|
2833
|
+
n,
|
|
2834
|
+
Math.max(this.dataX.buffer.maxByteLength, n)
|
|
2835
|
+
), i = M(
|
|
2836
|
+
o,
|
|
2837
|
+
Math.max(this.dataY.buffer.maxByteLength, o)
|
|
2838
|
+
);
|
|
2839
|
+
if (!D(E.ADD_POINTS, {
|
|
2772
2840
|
datasetSize: r,
|
|
2773
2841
|
selectionSize: t.length
|
|
2774
2842
|
}).useWorker) {
|
|
2775
|
-
const d = new Float64Array(
|
|
2776
|
-
|
|
2843
|
+
const d = new Float64Array(a), u = new Float32Array(i);
|
|
2844
|
+
Fr(
|
|
2777
2845
|
this.dataX,
|
|
2778
2846
|
this.dataY,
|
|
2779
2847
|
t,
|
|
2780
2848
|
d,
|
|
2781
|
-
|
|
2849
|
+
u,
|
|
2782
2850
|
0,
|
|
2783
2851
|
r,
|
|
2784
2852
|
0
|
|
2785
|
-
), this.dataset.source.x = d, this.dataset.source.y =
|
|
2853
|
+
), this.dataset.source.x = d, this.dataset.source.y = u, this._resizeTo(s);
|
|
2786
2854
|
return;
|
|
2787
2855
|
}
|
|
2788
2856
|
this._pendingExecutionMode = "worker";
|
|
2789
2857
|
const f = t.map(
|
|
2790
|
-
(d) =>
|
|
2791
|
-
),
|
|
2858
|
+
(d) => Q(this.dataX, d[0]) + 1
|
|
2859
|
+
), h = Math.max(
|
|
2792
2860
|
1,
|
|
2793
2861
|
Math.min(navigator.hardwareConcurrency || 1, Math.max(r, 1))
|
|
2794
|
-
),
|
|
2795
|
-
for (let d = 0; d <
|
|
2796
|
-
const
|
|
2797
|
-
|
|
2798
|
-
new Promise((
|
|
2799
|
-
const
|
|
2800
|
-
|
|
2862
|
+
), y = Math.ceil(Math.max(r, 1) / h), p = [], g = [];
|
|
2863
|
+
for (let d = 0; d < h; d++) {
|
|
2864
|
+
const u = d * y, w = Math.min((d + 1) * y, r), b = X(f, u), m = d === h - 1 ? t.length : X(f, w), S = t.slice(b, m), v = u + b;
|
|
2865
|
+
u >= w && S.length === 0 || g.push(
|
|
2866
|
+
new Promise((T) => {
|
|
2867
|
+
const L = new kr();
|
|
2868
|
+
p.push(L), L.postMessage({
|
|
2801
2869
|
bufferX: this.dataX.buffer,
|
|
2802
2870
|
bufferY: this.dataY.buffer,
|
|
2803
|
-
outputBufferX:
|
|
2871
|
+
outputBufferX: a,
|
|
2804
2872
|
outputBufferY: i,
|
|
2805
|
-
origStart:
|
|
2806
|
-
origEnd:
|
|
2873
|
+
origStart: u,
|
|
2874
|
+
origEnd: w,
|
|
2807
2875
|
insertions: S,
|
|
2808
|
-
outStart:
|
|
2809
|
-
}),
|
|
2810
|
-
|
|
2876
|
+
outStart: v
|
|
2877
|
+
}), L.onmessage = (R) => {
|
|
2878
|
+
T(R.data);
|
|
2811
2879
|
};
|
|
2812
2880
|
})
|
|
2813
2881
|
);
|
|
2814
2882
|
}
|
|
2815
|
-
await Promise.all(
|
|
2883
|
+
await Promise.all(g), p.forEach((d) => d.terminate()), this.dataset.source.x = new Float64Array(a), this.dataset.source.y = new Float32Array(i), this._resizeTo(s);
|
|
2816
2884
|
}
|
|
2817
2885
|
// =======================
|
|
2818
2886
|
// FILTER OPERATIONS
|
|
@@ -2833,44 +2901,44 @@ class bn {
|
|
|
2833
2901
|
async _valueThreshold(t) {
|
|
2834
2902
|
const r = Object.keys(t);
|
|
2835
2903
|
if (r.length === 0) return [];
|
|
2836
|
-
const
|
|
2837
|
-
[
|
|
2838
|
-
[
|
|
2839
|
-
[
|
|
2840
|
-
[
|
|
2841
|
-
[
|
|
2842
|
-
},
|
|
2904
|
+
const s = {
|
|
2905
|
+
[K.LT]: 0,
|
|
2906
|
+
[K.LTE]: 1,
|
|
2907
|
+
[K.GT]: 2,
|
|
2908
|
+
[K.GTE]: 3,
|
|
2909
|
+
[K.E]: 4
|
|
2910
|
+
}, n = r.map((u) => s[u] ?? 4), o = r.map((u) => t[u]), a = this.dataset.source.y, i = a.length;
|
|
2843
2911
|
if (i === 0) return [];
|
|
2844
|
-
if (!
|
|
2912
|
+
if (!D(A.VALUE_THRESHOLD, {
|
|
2845
2913
|
datasetSize: i
|
|
2846
2914
|
}).useWorker)
|
|
2847
|
-
return
|
|
2915
|
+
return Pt(a, 0, i, n, o);
|
|
2848
2916
|
this._pendingExecutionMode = "worker";
|
|
2849
|
-
const f = Math.min(navigator.hardwareConcurrency || 1, i),
|
|
2850
|
-
for (let
|
|
2851
|
-
const
|
|
2852
|
-
if (
|
|
2853
|
-
|
|
2917
|
+
const f = Math.min(navigator.hardwareConcurrency || 1, i), h = Math.ceil(i / f), y = [], p = [];
|
|
2918
|
+
for (let u = 0; u < f; u++) {
|
|
2919
|
+
const w = u * h, b = Math.min((u + 1) * h, i);
|
|
2920
|
+
if (w >= b) break;
|
|
2921
|
+
p.push(
|
|
2854
2922
|
new Promise((m) => {
|
|
2855
|
-
const S = new
|
|
2856
|
-
|
|
2923
|
+
const S = new Ie();
|
|
2924
|
+
y.push(S), S.postMessage({
|
|
2857
2925
|
bufferY: this.dataY.buffer,
|
|
2858
|
-
start:
|
|
2859
|
-
end:
|
|
2860
|
-
ops:
|
|
2861
|
-
values:
|
|
2862
|
-
}), S.onmessage = (
|
|
2863
|
-
m(
|
|
2926
|
+
start: w,
|
|
2927
|
+
end: b,
|
|
2928
|
+
ops: n,
|
|
2929
|
+
values: o
|
|
2930
|
+
}), S.onmessage = (v) => {
|
|
2931
|
+
m(v.data);
|
|
2864
2932
|
};
|
|
2865
2933
|
})
|
|
2866
2934
|
);
|
|
2867
2935
|
}
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2936
|
+
const g = await Promise.all(p);
|
|
2937
|
+
y.forEach((u) => u.terminate());
|
|
2870
2938
|
const d = [];
|
|
2871
|
-
for (let
|
|
2872
|
-
const
|
|
2873
|
-
for (let
|
|
2939
|
+
for (let u = 0; u < g.length; u++) {
|
|
2940
|
+
const w = g[u];
|
|
2941
|
+
for (let b = 0; b < w.length; b++) d.push(w[b]);
|
|
2874
2942
|
}
|
|
2875
2943
|
return d;
|
|
2876
2944
|
}
|
|
@@ -2887,41 +2955,41 @@ class bn {
|
|
|
2887
2955
|
* 3. Main thread concatenates results in chunk order, preserving ascending order.
|
|
2888
2956
|
*/
|
|
2889
2957
|
async _rateOfChange(t, r) {
|
|
2890
|
-
const
|
|
2891
|
-
if (
|
|
2892
|
-
const
|
|
2893
|
-
if (!
|
|
2894
|
-
datasetSize:
|
|
2958
|
+
const s = this.dataset.source.y;
|
|
2959
|
+
if (s.length < 2) return [];
|
|
2960
|
+
const n = 1, o = s.length, a = o - n;
|
|
2961
|
+
if (!D(A.RATE_OF_CHANGE, {
|
|
2962
|
+
datasetSize: s.length
|
|
2895
2963
|
}).useWorker)
|
|
2896
|
-
return
|
|
2964
|
+
return Or(s, n, o, t, r);
|
|
2897
2965
|
this._pendingExecutionMode = "worker";
|
|
2898
|
-
const l = Math.min(navigator.hardwareConcurrency || 1,
|
|
2966
|
+
const l = Math.min(navigator.hardwareConcurrency || 1, a), f = Math.ceil(a / l), h = [], y = [];
|
|
2899
2967
|
for (let d = 0; d < l; d++) {
|
|
2900
|
-
const
|
|
2901
|
-
if (
|
|
2902
|
-
|
|
2903
|
-
new Promise((
|
|
2904
|
-
const m = new
|
|
2905
|
-
|
|
2968
|
+
const u = n + d * f, w = Math.min(n + (d + 1) * f, o);
|
|
2969
|
+
if (u >= w) break;
|
|
2970
|
+
y.push(
|
|
2971
|
+
new Promise((b) => {
|
|
2972
|
+
const m = new $r();
|
|
2973
|
+
h.push(m), m.postMessage({
|
|
2906
2974
|
bufferY: this.dataY.buffer,
|
|
2907
|
-
start:
|
|
2908
|
-
end:
|
|
2975
|
+
start: u,
|
|
2976
|
+
end: w,
|
|
2909
2977
|
comparator: t,
|
|
2910
2978
|
value: r
|
|
2911
2979
|
}), m.onmessage = (S) => {
|
|
2912
|
-
|
|
2980
|
+
b(S.data);
|
|
2913
2981
|
};
|
|
2914
2982
|
})
|
|
2915
2983
|
);
|
|
2916
2984
|
}
|
|
2917
|
-
const
|
|
2918
|
-
|
|
2919
|
-
const
|
|
2920
|
-
for (let d = 0; d <
|
|
2921
|
-
const
|
|
2922
|
-
for (let
|
|
2985
|
+
const p = await Promise.all(y);
|
|
2986
|
+
h.forEach((d) => d.terminate());
|
|
2987
|
+
const g = [];
|
|
2988
|
+
for (let d = 0; d < p.length; d++) {
|
|
2989
|
+
const u = p[d];
|
|
2990
|
+
for (let w = 0; w < u.length; w++) g.push(u[w]);
|
|
2923
2991
|
}
|
|
2924
|
-
return
|
|
2992
|
+
return g;
|
|
2925
2993
|
}
|
|
2926
2994
|
/**
|
|
2927
2995
|
* Select all points whose datetime falls inside `[from, to]` (inclusive).
|
|
@@ -2930,20 +2998,42 @@ class bn {
|
|
|
2930
2998
|
* leave that side unconstrained; omitting both selects the full series.
|
|
2931
2999
|
*/
|
|
2932
3000
|
async _datetimeRange(t, r) {
|
|
2933
|
-
const
|
|
2934
|
-
if (
|
|
2935
|
-
const
|
|
2936
|
-
if (
|
|
2937
|
-
const i = new Array(
|
|
2938
|
-
for (let l =
|
|
3001
|
+
const s = this.dataset.source.x, n = s.length;
|
|
3002
|
+
if (n === 0) return [];
|
|
3003
|
+
const o = t == null ? 0 : X(s, t), a = r == null ? n - 1 : Q(s, r);
|
|
3004
|
+
if (o > a) return [];
|
|
3005
|
+
const i = new Array(a - o + 1);
|
|
3006
|
+
for (let l = o; l <= a; l++) i[l - o] = l;
|
|
2939
3007
|
return i;
|
|
2940
3008
|
}
|
|
2941
3009
|
/**
|
|
2942
|
-
*
|
|
2943
|
-
*
|
|
3010
|
+
* SELECTION filter handler — also acts as the cleanup site for the
|
|
3011
|
+
* SELECTION-vs-preceding-filter interaction. `dispatchFilter` always
|
|
3012
|
+
* pushes (never replaces) a SELECTION when the previous entry is a
|
|
3013
|
+
* non-SELECTION filter; this method then decides what to keep based
|
|
3014
|
+
* on what the SELECTION's indices look like relative to the filter:
|
|
3015
|
+
*
|
|
3016
|
+
* | incoming SELECTION | preceding non-SEL filter | result |
|
|
3017
|
+
* | -------------------------- | -------------------------- | ------------------------------------- |
|
|
3018
|
+
* | empty | had non-empty `selected` | pop both — user cleared the filter |
|
|
3019
|
+
* | empty | had empty `selected` | pop SELECTION — no-op echo on a |
|
|
3020
|
+
* | | | zero-result filter, keep filter |
|
|
3021
|
+
* | empty | none / non-filter prev | pop SELECTION (clear) |
|
|
3022
|
+
* | non-empty matches prev | (any filter) | pop SELECTION — Plotly relayout echo |
|
|
3023
|
+
* | | | of the filter's `selected` |
|
|
3024
|
+
* | non-empty differs from prev| (any filter) | splice prev — user override takes |
|
|
3025
|
+
* | | | ownership; SELECTION stands alone |
|
|
3026
|
+
* | non-empty (other cases) | n/a | keep as-is (already pushed) |
|
|
3027
|
+
*
|
|
3028
|
+
* The "Plotly echo" case exists because consumers commonly chain
|
|
3029
|
+
* `dispatchFilter(SOMETHING)` with `dispatchSelection(result)` for
|
|
3030
|
+
* visual highlighting; Plotly's debounced relayout listener then
|
|
3031
|
+
* fires a SELECTION carrying the same indices. Without this dedup
|
|
3032
|
+
* the script would grow a phantom SELECTION after every real filter.
|
|
2944
3033
|
*/
|
|
2945
3034
|
async _selection(t) {
|
|
2946
|
-
|
|
3035
|
+
const r = this.history[this.history.length - 2], s = !!r && r.method !== A.SELECTION && !!A[r.method], n = s && Array.isArray(r.selected) ? r.selected : void 0;
|
|
3036
|
+
return !t || !t.length ? (this.history.pop(), n && n.length > 0 && this.history.pop(), t) : (n && qr(n, t) ? this.history.pop() : s && this.history.splice(this.history.length - 2, 1), t);
|
|
2947
3037
|
}
|
|
2948
3038
|
/**
|
|
2949
3039
|
*
|
|
@@ -2958,41 +3048,41 @@ class bn {
|
|
|
2958
3048
|
* 3. Main thread concatenates results in chunk order, preserving ascending order.
|
|
2959
3049
|
*/
|
|
2960
3050
|
async _change(t, r) {
|
|
2961
|
-
const
|
|
2962
|
-
if (
|
|
2963
|
-
const
|
|
2964
|
-
if (!
|
|
2965
|
-
datasetSize:
|
|
3051
|
+
const s = this.dataset.source.y;
|
|
3052
|
+
if (s.length < 2) return [];
|
|
3053
|
+
const n = 1, o = s.length, a = o - n;
|
|
3054
|
+
if (!D(A.CHANGE, {
|
|
3055
|
+
datasetSize: s.length
|
|
2966
3056
|
}).useWorker)
|
|
2967
|
-
return
|
|
3057
|
+
return Ir(s, n, o, t, r);
|
|
2968
3058
|
this._pendingExecutionMode = "worker";
|
|
2969
|
-
const l = Math.min(navigator.hardwareConcurrency || 1,
|
|
3059
|
+
const l = Math.min(navigator.hardwareConcurrency || 1, a), f = Math.ceil(a / l), h = [], y = [];
|
|
2970
3060
|
for (let d = 0; d < l; d++) {
|
|
2971
|
-
const
|
|
2972
|
-
if (
|
|
2973
|
-
|
|
2974
|
-
new Promise((
|
|
2975
|
-
const m = new
|
|
2976
|
-
|
|
3061
|
+
const u = n + d * f, w = Math.min(n + (d + 1) * f, o);
|
|
3062
|
+
if (u >= w) break;
|
|
3063
|
+
y.push(
|
|
3064
|
+
new Promise((b) => {
|
|
3065
|
+
const m = new Lr();
|
|
3066
|
+
h.push(m), m.postMessage({
|
|
2977
3067
|
bufferY: this.dataY.buffer,
|
|
2978
|
-
start:
|
|
2979
|
-
end:
|
|
3068
|
+
start: u,
|
|
3069
|
+
end: w,
|
|
2980
3070
|
comparator: t,
|
|
2981
3071
|
value: r
|
|
2982
3072
|
}), m.onmessage = (S) => {
|
|
2983
|
-
|
|
3073
|
+
b(S.data);
|
|
2984
3074
|
};
|
|
2985
3075
|
})
|
|
2986
3076
|
);
|
|
2987
3077
|
}
|
|
2988
|
-
const
|
|
2989
|
-
|
|
2990
|
-
const
|
|
2991
|
-
for (let d = 0; d <
|
|
2992
|
-
const
|
|
2993
|
-
for (let
|
|
3078
|
+
const p = await Promise.all(y);
|
|
3079
|
+
h.forEach((d) => d.terminate());
|
|
3080
|
+
const g = [];
|
|
3081
|
+
for (let d = 0; d < p.length; d++) {
|
|
3082
|
+
const u = p[d];
|
|
3083
|
+
for (let w = 0; w < u.length; w++) g.push(u[w]);
|
|
2994
3084
|
}
|
|
2995
|
-
return
|
|
3085
|
+
return g;
|
|
2996
3086
|
}
|
|
2997
3087
|
/**
|
|
2998
3088
|
* Find gaps in the data using worker threads.
|
|
@@ -3001,47 +3091,56 @@ class bn {
|
|
|
3001
3091
|
* 3. Main thread collects all pairs and dedups via Set — identical return shape to the original implementation.
|
|
3002
3092
|
* @param value The time value
|
|
3003
3093
|
* @param unit The time unit (TimeUnit)
|
|
3004
|
-
* @param range If specified,
|
|
3094
|
+
* @param range If specified, gap detection is restricted to this
|
|
3095
|
+
* `[startTs, endTs]` window in epoch milliseconds. Both bounds
|
|
3096
|
+
* are inclusive and snapped to the nearest enclosed point via
|
|
3097
|
+
* binary search. Datetime-addressed (not index-addressed) so the
|
|
3098
|
+
* same call survives data growth and is portable across datasets
|
|
3099
|
+
* for QC script replay.
|
|
3005
3100
|
*/
|
|
3006
|
-
async _findGaps(t, r,
|
|
3007
|
-
const
|
|
3008
|
-
let
|
|
3009
|
-
if (
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3101
|
+
async _findGaps(t, r, s) {
|
|
3102
|
+
const n = this.dataset.source.x;
|
|
3103
|
+
let o = 0, a = n.length;
|
|
3104
|
+
if (s != null) {
|
|
3105
|
+
const [w, b] = s;
|
|
3106
|
+
w != null && Number.isFinite(w) && (o = X(n, w)), b != null && Number.isFinite(b) && (a = Q(n, b) + 1);
|
|
3107
|
+
}
|
|
3108
|
+
if (a <= o) return [];
|
|
3109
|
+
const i = t * ne[r] * 1e3;
|
|
3110
|
+
if (!D(A.FIND_GAPS, {
|
|
3111
|
+
datasetSize: a - o
|
|
3013
3112
|
}).useWorker) {
|
|
3014
|
-
const
|
|
3015
|
-
for (let m = 0; m <
|
|
3016
|
-
return [...
|
|
3113
|
+
const w = Mr(n, o, a - 1, i), b = /* @__PURE__ */ new Set();
|
|
3114
|
+
for (let m = 0; m < w.length; m++) b.add(w[m]);
|
|
3115
|
+
return [...b];
|
|
3017
3116
|
}
|
|
3018
3117
|
this._pendingExecutionMode = "worker";
|
|
3019
|
-
const f =
|
|
3020
|
-
for (let
|
|
3021
|
-
const
|
|
3022
|
-
if (
|
|
3023
|
-
|
|
3118
|
+
const f = a - o, h = Math.min(navigator.hardwareConcurrency || 1, f), y = Math.ceil(f / h), p = [], g = [];
|
|
3119
|
+
for (let w = 0; w < h; w++) {
|
|
3120
|
+
const b = o + w * y, m = Math.min(o + (w + 1) * y, a);
|
|
3121
|
+
if (b >= m) break;
|
|
3122
|
+
g.push(
|
|
3024
3123
|
new Promise((S) => {
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3124
|
+
const v = new Ar();
|
|
3125
|
+
p.push(v), v.postMessage({
|
|
3027
3126
|
bufferX: this.dataX.buffer,
|
|
3028
|
-
start:
|
|
3127
|
+
start: b,
|
|
3029
3128
|
endInclusive: m,
|
|
3030
3129
|
threshold: i
|
|
3031
|
-
}),
|
|
3032
|
-
S(
|
|
3130
|
+
}), v.onmessage = (T) => {
|
|
3131
|
+
S(T.data);
|
|
3033
3132
|
};
|
|
3034
3133
|
})
|
|
3035
3134
|
);
|
|
3036
3135
|
}
|
|
3037
|
-
const d = await Promise.all(
|
|
3038
|
-
|
|
3039
|
-
const
|
|
3040
|
-
for (let
|
|
3041
|
-
const
|
|
3042
|
-
for (let m = 0; m <
|
|
3136
|
+
const d = await Promise.all(g);
|
|
3137
|
+
p.forEach((w) => w.terminate());
|
|
3138
|
+
const u = /* @__PURE__ */ new Set();
|
|
3139
|
+
for (let w = 0; w < d.length; w++) {
|
|
3140
|
+
const b = d[w];
|
|
3141
|
+
for (let m = 0; m < b.length; m++) u.add(b[m]);
|
|
3043
3142
|
}
|
|
3044
|
-
return [...
|
|
3143
|
+
return [...u];
|
|
3045
3144
|
}
|
|
3046
3145
|
/**
|
|
3047
3146
|
* Find points where the values are the same at least `times` in a row, using worker threads.
|
|
@@ -3051,127 +3150,226 @@ class bn {
|
|
|
3051
3150
|
*
|
|
3052
3151
|
* Matches the Python reference implementation in `edit_service.py::persistence` — every member of a qualifying run is selected (including the run's first index).
|
|
3053
3152
|
* @param times The minimum run length to qualify
|
|
3054
|
-
* @param range If specified,
|
|
3153
|
+
* @param range If specified, persistence detection is restricted
|
|
3154
|
+
* to this `[startTs, endTs]` window in epoch milliseconds. Both
|
|
3155
|
+
* bounds are inclusive and snapped to the nearest enclosed point
|
|
3156
|
+
* via binary search on `dataX`. Datetime-addressed (not index-
|
|
3157
|
+
* addressed) so the same call survives data growth and is
|
|
3158
|
+
* portable across datasets for QC script replay.
|
|
3055
3159
|
*/
|
|
3056
3160
|
async _persistence(t, r) {
|
|
3057
|
-
const n = this.dataset.source.y;
|
|
3058
|
-
let
|
|
3059
|
-
if (r
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3161
|
+
const s = this.dataset.source.x, n = this.dataset.source.y;
|
|
3162
|
+
let o = 0, a = n.length;
|
|
3163
|
+
if (r != null) {
|
|
3164
|
+
const [m, S] = r;
|
|
3165
|
+
m != null && Number.isFinite(m) && (o = X(s, m)), S != null && Number.isFinite(S) && (a = Q(s, S) + 1);
|
|
3166
|
+
}
|
|
3167
|
+
if (a <= o) return [];
|
|
3168
|
+
const i = a - o;
|
|
3169
|
+
if (!D(A.PERSISTENCE, {
|
|
3170
|
+
datasetSize: i
|
|
3063
3171
|
}).useWorker) {
|
|
3064
|
-
const
|
|
3065
|
-
for (let
|
|
3066
|
-
const
|
|
3172
|
+
const m = Ur(n, o, a), S = [];
|
|
3173
|
+
for (let v = 0; v < m.length; v += 3) {
|
|
3174
|
+
const T = m[v], L = m[v + 1];
|
|
3067
3175
|
if (L >= t)
|
|
3068
|
-
for (let
|
|
3176
|
+
for (let R = 0; R < L; R++) S.push(T + R);
|
|
3069
3177
|
}
|
|
3070
|
-
return
|
|
3178
|
+
return S;
|
|
3071
3179
|
}
|
|
3072
3180
|
this._pendingExecutionMode = "worker";
|
|
3073
|
-
const
|
|
3074
|
-
for (let
|
|
3075
|
-
const
|
|
3076
|
-
if (
|
|
3181
|
+
const f = Math.min(navigator.hardwareConcurrency || 1, i), h = Math.ceil(i / f), y = [], p = [];
|
|
3182
|
+
for (let m = 0; m < f; m++) {
|
|
3183
|
+
const S = o + m * h, v = Math.min(o + (m + 1) * h, a);
|
|
3184
|
+
if (S >= v) break;
|
|
3077
3185
|
p.push(
|
|
3078
|
-
new Promise((
|
|
3079
|
-
const L = new
|
|
3080
|
-
|
|
3186
|
+
new Promise((T) => {
|
|
3187
|
+
const L = new Tr();
|
|
3188
|
+
y.push(L), L.postMessage({
|
|
3081
3189
|
bufferY: this.dataY.buffer,
|
|
3082
|
-
start:
|
|
3083
|
-
end:
|
|
3084
|
-
}), L.onmessage = (
|
|
3085
|
-
|
|
3190
|
+
start: S,
|
|
3191
|
+
end: v
|
|
3192
|
+
}), L.onmessage = (R) => {
|
|
3193
|
+
T(R.data);
|
|
3086
3194
|
};
|
|
3087
3195
|
})
|
|
3088
3196
|
);
|
|
3089
3197
|
}
|
|
3090
3198
|
const g = await Promise.all(p);
|
|
3091
|
-
|
|
3092
|
-
const
|
|
3093
|
-
for (let
|
|
3094
|
-
const
|
|
3095
|
-
for (let
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3199
|
+
y.forEach((m) => m.terminate());
|
|
3200
|
+
const d = [], u = [], w = [];
|
|
3201
|
+
for (let m = 0; m < g.length; m++) {
|
|
3202
|
+
const S = g[m];
|
|
3203
|
+
for (let v = 0; v < S.length; v += 3) {
|
|
3204
|
+
const T = S[v], L = S[v + 1], R = S[v + 2], U = d.length - 1;
|
|
3205
|
+
U >= 0 && w[U] === R && d[U] + u[U] === T ? u[U] += L : (d.push(T), u.push(L), w.push(R));
|
|
3098
3206
|
}
|
|
3099
3207
|
}
|
|
3100
3208
|
const b = [];
|
|
3101
|
-
for (let
|
|
3102
|
-
const
|
|
3103
|
-
if (
|
|
3104
|
-
const
|
|
3105
|
-
for (let
|
|
3209
|
+
for (let m = 0; m < d.length; m++) {
|
|
3210
|
+
const S = u[m];
|
|
3211
|
+
if (S >= t) {
|
|
3212
|
+
const v = d[m];
|
|
3213
|
+
for (let T = 0; T < S; T++) b.push(v + T);
|
|
3106
3214
|
}
|
|
3107
3215
|
}
|
|
3108
3216
|
return b;
|
|
3109
3217
|
}
|
|
3110
3218
|
}
|
|
3219
|
+
const le = "1", Qr = /* @__PURE__ */ new Set([
|
|
3220
|
+
...Object.values(E),
|
|
3221
|
+
...Object.values(A)
|
|
3222
|
+
]);
|
|
3223
|
+
function Ts(e, t) {
|
|
3224
|
+
const r = e.history.map((s) => {
|
|
3225
|
+
const n = {
|
|
3226
|
+
method: s.method,
|
|
3227
|
+
args: s.args ? [...s.args] : []
|
|
3228
|
+
};
|
|
3229
|
+
return s.status === "failed" && (n.status = "failed"), n;
|
|
3230
|
+
});
|
|
3231
|
+
return {
|
|
3232
|
+
version: le,
|
|
3233
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3234
|
+
window: {
|
|
3235
|
+
startDate: t.startDate,
|
|
3236
|
+
endDate: t.endDate
|
|
3237
|
+
},
|
|
3238
|
+
operations: r
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
function Ls(e) {
|
|
3242
|
+
if (!e || typeof e != "object")
|
|
3243
|
+
throw new Error("QC script must be a JSON object.");
|
|
3244
|
+
const t = e;
|
|
3245
|
+
if (t.version !== le)
|
|
3246
|
+
throw new Error(
|
|
3247
|
+
`Unsupported QC script version: ${String(t.version)}. This loader understands version "${le}".`
|
|
3248
|
+
);
|
|
3249
|
+
if (typeof t.createdAt != "string")
|
|
3250
|
+
throw new Error("QC script is missing `createdAt` (ISO-8601 string).");
|
|
3251
|
+
const r = t.window;
|
|
3252
|
+
if (!r || typeof r != "object")
|
|
3253
|
+
throw new Error("QC script is missing `window`.");
|
|
3254
|
+
if (typeof r.startDate != "string" || typeof r.endDate != "string")
|
|
3255
|
+
throw new Error("`window.startDate` and `window.endDate` must be ISO-8601 strings.");
|
|
3256
|
+
if (!Array.isArray(t.operations))
|
|
3257
|
+
throw new Error("QC script `operations` must be an array.");
|
|
3258
|
+
const s = t.operations.map((n, o) => {
|
|
3259
|
+
if (!n || typeof n != "object")
|
|
3260
|
+
throw new Error(`Operation ${o} must be an object.`);
|
|
3261
|
+
const a = n;
|
|
3262
|
+
if (typeof a.method != "string")
|
|
3263
|
+
throw new Error(`Operation ${o} missing string \`method\`.`);
|
|
3264
|
+
if (!Qr.has(a.method))
|
|
3265
|
+
throw new Error(`Operation ${o} has unknown method: "${a.method}".`);
|
|
3266
|
+
if (!Array.isArray(a.args))
|
|
3267
|
+
throw new Error(`Operation ${o} \`args\` must be an array.`);
|
|
3268
|
+
const i = {
|
|
3269
|
+
method: a.method,
|
|
3270
|
+
args: [...a.args]
|
|
3271
|
+
};
|
|
3272
|
+
return a.status === "failed" && (i.status = "failed"), i;
|
|
3273
|
+
});
|
|
3274
|
+
return {
|
|
3275
|
+
version: le,
|
|
3276
|
+
createdAt: t.createdAt,
|
|
3277
|
+
window: {
|
|
3278
|
+
startDate: r.startDate,
|
|
3279
|
+
endDate: r.endDate
|
|
3280
|
+
},
|
|
3281
|
+
operations: s
|
|
3282
|
+
};
|
|
3283
|
+
}
|
|
3284
|
+
async function $s(e, t) {
|
|
3285
|
+
e.history.length = 0, e.redoStack.length = 0, await e.reload();
|
|
3286
|
+
const r = { applied: 0, failed: [] };
|
|
3287
|
+
for (let s = 0; s < t.operations.length; s++) {
|
|
3288
|
+
const n = t.operations[s];
|
|
3289
|
+
try {
|
|
3290
|
+
await e.dispatch(n.method, ...n.args), e.history[e.history.length - 1]?.status === "failed" ? r.failed.push({
|
|
3291
|
+
index: s,
|
|
3292
|
+
method: n.method,
|
|
3293
|
+
error: "Operation handler reported failure (see console)."
|
|
3294
|
+
}) : r.applied++;
|
|
3295
|
+
} catch (o) {
|
|
3296
|
+
r.failed.push({
|
|
3297
|
+
index: s,
|
|
3298
|
+
method: n.method,
|
|
3299
|
+
error: o instanceof Error ? o.message : String(o)
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
return r;
|
|
3304
|
+
}
|
|
3111
3305
|
export {
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3306
|
+
C as ACCOUNT_BASE,
|
|
3307
|
+
Ue as AUTH_BASE,
|
|
3308
|
+
ls as ApiKey,
|
|
3309
|
+
F as BASE_URL,
|
|
3310
|
+
hs as Collaborator,
|
|
3311
|
+
St as DEFAULT_SNACK_DURATION,
|
|
3312
|
+
fs as DataSource,
|
|
3313
|
+
es as Datastream,
|
|
3120
3314
|
E as EnumEditOperations,
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3315
|
+
A as EnumFilterOperations,
|
|
3316
|
+
K as FilterOperation,
|
|
3317
|
+
Yt as HydroShareArchive,
|
|
3318
|
+
te as INCREASE_AMOUNT,
|
|
3319
|
+
Gt as Location,
|
|
3320
|
+
Wt as LogicalOperation,
|
|
3321
|
+
cs as OAuthProvider,
|
|
3322
|
+
As as ObservationRecord,
|
|
3323
|
+
ss as ObservedProperty,
|
|
3324
|
+
jt as Operator,
|
|
3325
|
+
as as Organization,
|
|
3326
|
+
ce as PROVIDER_BASE,
|
|
3327
|
+
ys as Payload,
|
|
3328
|
+
Ht as PermissionAction,
|
|
3329
|
+
zt as PermissionResource,
|
|
3330
|
+
ar as Position,
|
|
3331
|
+
Kr as PostHydroShareArchive,
|
|
3332
|
+
ns as ProcessingLevel,
|
|
3333
|
+
le as QC_SCRIPT_VERSION,
|
|
3334
|
+
os as ResultQualifier,
|
|
3335
|
+
be as SESSION_BASE,
|
|
3336
|
+
rs as Sensor,
|
|
3337
|
+
ir as Snack,
|
|
3338
|
+
Et as SnackColor,
|
|
3339
|
+
vt as SnackIcon,
|
|
3340
|
+
kt as SnackTitle,
|
|
3341
|
+
cr as Snackbar,
|
|
3342
|
+
Qe as TAG_BASE,
|
|
3148
3343
|
_ as THINGS_BASE,
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3344
|
+
Zr as Thing,
|
|
3345
|
+
x as TimeUnit,
|
|
3346
|
+
ts as Unit,
|
|
3347
|
+
is as User,
|
|
3348
|
+
us as Workspace,
|
|
3349
|
+
ps as api,
|
|
3155
3350
|
c as apiMethods,
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3351
|
+
$s as applyScript,
|
|
3352
|
+
ks as clearCalibration,
|
|
3353
|
+
_t as createPatchObject,
|
|
3354
|
+
_s as ensureCalibration,
|
|
3355
|
+
Xt as extractErrorMessage,
|
|
3356
|
+
X as findFirstGreaterOrEqual,
|
|
3357
|
+
Q as findLastLessOrEqual,
|
|
3358
|
+
gs as formatDate,
|
|
3359
|
+
ms as formatDuration,
|
|
3360
|
+
ft as getCSRFToken,
|
|
3361
|
+
Ss as getCalibration,
|
|
3362
|
+
Es as getLastBenchmarkDetail,
|
|
3363
|
+
ds as getObservationsEndpoint,
|
|
3364
|
+
vs as getOperationTable,
|
|
3365
|
+
Ee as measureEllapsedTime,
|
|
3366
|
+
bs as onCalibrationChange,
|
|
3367
|
+
Ls as parseScript,
|
|
3368
|
+
dt as requestInterceptor,
|
|
3369
|
+
pt as responseInterceptor,
|
|
3370
|
+
Yr as runBenchmarks,
|
|
3371
|
+
Ts as serializeHistory,
|
|
3372
|
+
D as shouldUseWorker,
|
|
3373
|
+
ws as subtractHours,
|
|
3374
|
+
ne as timeUnitMultipliers
|
|
3177
3375
|
};
|