@pennsieve-viz/tsviewer 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{BFLibraryButton-zWDUe3E8.cjs → BFLibraryButton-ClRfrYOf.cjs} +1 -1
  2. package/dist/{BFLibraryButton-DEY9t1Is.js → BFLibraryButton-DzzWe3Ya.js} +1 -1
  3. package/dist/{IconSelection-IJR6hdts.js → IconSelection-Bnm4c-Az.js} +1 -1
  4. package/dist/{IconSelection-DsOecTVD.cjs → IconSelection-CYX2jlGW.cjs} +1 -1
  5. package/dist/TSAnnotationCanvas-BCu7PmSh.cjs +1 -0
  6. package/dist/TSAnnotationCanvas-Cua-lW6X.js +704 -0
  7. package/dist/{TSAnnotationModal-DpLHrHfV.js → TSAnnotationModal-7GxnJomu.js} +3 -3
  8. package/dist/{TSAnnotationModal-DkLaOB7u.cjs → TSAnnotationModal-BVDkiUQ1.cjs} +1 -1
  9. package/dist/{TSFilterModal-C1-o1zyF.js → TSFilterModal-1E2UWL8T.js} +3 -3
  10. package/dist/{TSFilterModal-DsVcUoIk.cjs → TSFilterModal-BVfwi0tb.cjs} +1 -1
  11. package/dist/TSScrubber-CBKcwuMb.js +374 -0
  12. package/dist/TSScrubber-DBWjIhSE.cjs +1 -0
  13. package/dist/{TSViewerCanvas-A6HgBZ4E.js → TSViewerCanvas-D_RaJ4Mj.js} +1865 -1931
  14. package/dist/TSViewerCanvas-gjfcQXDY.cjs +11 -0
  15. package/dist/{TSViewerLayerWindow-Dnij6c3F.js → TSViewerLayerWindow-COWXfHNB.js} +2 -2
  16. package/dist/{TSViewerLayerWindow-Cu8yQKRU.cjs → TSViewerLayerWindow-D5j3_B1E.cjs} +1 -1
  17. package/dist/{TSViewerToolbar-CO68rvXF.js → TSViewerToolbar-Cb2W7W6J.js} +1 -1
  18. package/dist/{TSViewerToolbar-_NqUlS08.cjs → TSViewerToolbar-ep_lZr6h.cjs} +1 -1
  19. package/dist/{TsAnnotationDeleteDialog-D9eQGzqE.js → TsAnnotationDeleteDialog-B9pQMYZo.js} +3 -3
  20. package/dist/{TsAnnotationDeleteDialog-fM5Y7SRB.cjs → TsAnnotationDeleteDialog-BRIgCXxU.cjs} +1 -1
  21. package/dist/index-BU6e_1Ww.js +1414 -0
  22. package/dist/index-C-i9Taq7.cjs +1 -0
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/{pathOr-DKv8SMY9.cjs → pathOr-BQgOyNsu.cjs} +1 -1
  26. package/dist/{pathOr-kR7j_Y-C.js → pathOr-Dr8GvKXg.js} +1 -1
  27. package/dist/style.css +1 -1
  28. package/package.json +1 -1
  29. package/dist/TSAnnotationCanvas-B0b_EheO.js +0 -730
  30. package/dist/TSAnnotationCanvas-Bfxc75PD.cjs +0 -1
  31. package/dist/TSScrubber-9ABMW6b2.js +0 -377
  32. package/dist/TSScrubber-BlHHGh3F.cjs +0 -1
  33. package/dist/TSViewerCanvas-DBpG0Erk.cjs +0 -11
  34. package/dist/index-CMJlEiLT.cjs +0 -1
  35. package/dist/index-CgKUmS0K.js +0 -1459
@@ -0,0 +1,1414 @@
1
+ import { reactive as Rt, ref as w, computed as H, inject as jt, defineAsyncComponent as re, provide as $e, watch as Oe, nextTick as de, onMounted as Mt, onBeforeUnmount as Ut, createElementBlock as Ve, openBlock as ge, normalizeClass as Le, createVNode as fe, createElementVNode as he, createBlock as Wt, createCommentVNode as xt, unref as ae, Fragment as Ft, renderList as $t, toDisplayString as qe, readonly as oe } from "vue";
2
+ import { defineStore as qt, storeToRefs as Pe } from "pinia";
3
+ import { fetchAuthSession as Bt } from "aws-amplify/auth";
4
+ function b(t) {
5
+ return t != null && typeof t == "object" && t["@@functional/placeholder"] === !0;
6
+ }
7
+ function P(t) {
8
+ return function e(n) {
9
+ return arguments.length === 0 || b(n) ? e : t.apply(this, arguments);
10
+ };
11
+ }
12
+ function j(t) {
13
+ return function e(n, r) {
14
+ switch (arguments.length) {
15
+ case 0:
16
+ return e;
17
+ case 1:
18
+ return b(n) ? e : P(function(s) {
19
+ return t(n, s);
20
+ });
21
+ default:
22
+ return b(n) && b(r) ? e : b(n) ? P(function(s) {
23
+ return t(s, r);
24
+ }) : b(r) ? P(function(s) {
25
+ return t(n, s);
26
+ }) : t(n, r);
27
+ }
28
+ };
29
+ }
30
+ function Xt(t, e) {
31
+ t = t || [], e = e || [];
32
+ var n, r = t.length, s = e.length, l = [];
33
+ for (n = 0; n < r; )
34
+ l[l.length] = t[n], n += 1;
35
+ for (n = 0; n < s; )
36
+ l[l.length] = e[n], n += 1;
37
+ return l;
38
+ }
39
+ function Ne(t, e) {
40
+ switch (t) {
41
+ case 0:
42
+ return function() {
43
+ return e.apply(this, arguments);
44
+ };
45
+ case 1:
46
+ return function(n) {
47
+ return e.apply(this, arguments);
48
+ };
49
+ case 2:
50
+ return function(n, r) {
51
+ return e.apply(this, arguments);
52
+ };
53
+ case 3:
54
+ return function(n, r, s) {
55
+ return e.apply(this, arguments);
56
+ };
57
+ case 4:
58
+ return function(n, r, s, l) {
59
+ return e.apply(this, arguments);
60
+ };
61
+ case 5:
62
+ return function(n, r, s, l, h) {
63
+ return e.apply(this, arguments);
64
+ };
65
+ case 6:
66
+ return function(n, r, s, l, h, m) {
67
+ return e.apply(this, arguments);
68
+ };
69
+ case 7:
70
+ return function(n, r, s, l, h, m, I) {
71
+ return e.apply(this, arguments);
72
+ };
73
+ case 8:
74
+ return function(n, r, s, l, h, m, I, v) {
75
+ return e.apply(this, arguments);
76
+ };
77
+ case 9:
78
+ return function(n, r, s, l, h, m, I, v, i) {
79
+ return e.apply(this, arguments);
80
+ };
81
+ case 10:
82
+ return function(n, r, s, l, h, m, I, v, i, y) {
83
+ return e.apply(this, arguments);
84
+ };
85
+ default:
86
+ throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
87
+ }
88
+ }
89
+ function Se(t) {
90
+ return function e(n, r, s) {
91
+ switch (arguments.length) {
92
+ case 0:
93
+ return e;
94
+ case 1:
95
+ return b(n) ? e : j(function(l, h) {
96
+ return t(n, l, h);
97
+ });
98
+ case 2:
99
+ return b(n) && b(r) ? e : b(n) ? j(function(l, h) {
100
+ return t(l, r, h);
101
+ }) : b(r) ? j(function(l, h) {
102
+ return t(n, l, h);
103
+ }) : P(function(l) {
104
+ return t(n, r, l);
105
+ });
106
+ default:
107
+ return b(n) && b(r) && b(s) ? e : b(n) && b(r) ? j(function(l, h) {
108
+ return t(l, h, s);
109
+ }) : b(n) && b(s) ? j(function(l, h) {
110
+ return t(l, r, h);
111
+ }) : b(r) && b(s) ? j(function(l, h) {
112
+ return t(n, l, h);
113
+ }) : b(n) ? P(function(l) {
114
+ return t(l, r, s);
115
+ }) : b(r) ? P(function(l) {
116
+ return t(n, l, s);
117
+ }) : b(s) ? P(function(l) {
118
+ return t(n, r, l);
119
+ }) : t(n, r, s);
120
+ }
121
+ };
122
+ }
123
+ const be = Array.isArray || function(e) {
124
+ return e != null && e.length >= 0 && Object.prototype.toString.call(e) === "[object Array]";
125
+ };
126
+ function zt(t) {
127
+ return t != null && typeof t["@@transducer/step"] == "function";
128
+ }
129
+ function Gt(t, e, n) {
130
+ return function() {
131
+ if (arguments.length === 0)
132
+ return n();
133
+ var r = arguments[arguments.length - 1];
134
+ if (!be(r)) {
135
+ for (var s = 0; s < t.length; ) {
136
+ if (typeof r[t[s]] == "function")
137
+ return r[t[s]].apply(r, Array.prototype.slice.call(arguments, 0, -1));
138
+ s += 1;
139
+ }
140
+ if (zt(r)) {
141
+ var l = e.apply(null, Array.prototype.slice.call(arguments, 0, -1));
142
+ return l(r);
143
+ }
144
+ }
145
+ return n.apply(this, arguments);
146
+ };
147
+ }
148
+ function Ht(t) {
149
+ return t && t["@@transducer/reduced"] ? t : {
150
+ "@@transducer/value": t,
151
+ "@@transducer/reduced": !0
152
+ };
153
+ }
154
+ const Zt = {
155
+ init: function() {
156
+ return this.xf["@@transducer/init"]();
157
+ },
158
+ result: function(t) {
159
+ return this.xf["@@transducer/result"](t);
160
+ }
161
+ };
162
+ function Ie(t) {
163
+ return Object.prototype.toString.call(t) === "[object String]";
164
+ }
165
+ var Jt = /* @__PURE__ */ P(function(e) {
166
+ return be(e) ? !0 : !e || typeof e != "object" || Ie(e) ? !1 : e.length === 0 ? !0 : e.length > 0 ? e.hasOwnProperty(0) && e.hasOwnProperty(e.length - 1) : !1;
167
+ }), Yt = /* @__PURE__ */ (function() {
168
+ function t(e) {
169
+ this.f = e;
170
+ }
171
+ return t.prototype["@@transducer/init"] = function() {
172
+ throw new Error("init not implemented on XWrap");
173
+ }, t.prototype["@@transducer/result"] = function(e) {
174
+ return e;
175
+ }, t.prototype["@@transducer/step"] = function(e, n) {
176
+ return this.f(e, n);
177
+ }, t;
178
+ })();
179
+ function Kt(t) {
180
+ return new Yt(t);
181
+ }
182
+ var Qt = /* @__PURE__ */ j(function(e, n) {
183
+ return Ne(e.length, function() {
184
+ return e.apply(n, arguments);
185
+ });
186
+ });
187
+ function en(t, e, n) {
188
+ for (var r = 0, s = n.length; r < s; ) {
189
+ if (e = t["@@transducer/step"](e, n[r]), e && e["@@transducer/reduced"]) {
190
+ e = e["@@transducer/value"];
191
+ break;
192
+ }
193
+ r += 1;
194
+ }
195
+ return t["@@transducer/result"](e);
196
+ }
197
+ function Be(t, e, n) {
198
+ for (var r = n.next(); !r.done; ) {
199
+ if (e = t["@@transducer/step"](e, r.value), e && e["@@transducer/reduced"]) {
200
+ e = e["@@transducer/value"];
201
+ break;
202
+ }
203
+ r = n.next();
204
+ }
205
+ return t["@@transducer/result"](e);
206
+ }
207
+ function Xe(t, e, n, r) {
208
+ return t["@@transducer/result"](n[r](Qt(t["@@transducer/step"], t), e));
209
+ }
210
+ var ze = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
211
+ function tn(t, e, n) {
212
+ if (typeof t == "function" && (t = Kt(t)), Jt(n))
213
+ return en(t, e, n);
214
+ if (typeof n["fantasy-land/reduce"] == "function")
215
+ return Xe(t, e, n, "fantasy-land/reduce");
216
+ if (n[ze] != null)
217
+ return Be(t, e, n[ze]());
218
+ if (typeof n.next == "function")
219
+ return Be(t, e, n);
220
+ if (typeof n.reduce == "function")
221
+ return Xe(t, e, n, "reduce");
222
+ throw new TypeError("reduce: list must be array or iterable");
223
+ }
224
+ function me(t, e) {
225
+ return Object.prototype.hasOwnProperty.call(e, t);
226
+ }
227
+ var Ge = Object.prototype.toString, at = /* @__PURE__ */ (function() {
228
+ return Ge.call(arguments) === "[object Arguments]" ? function(e) {
229
+ return Ge.call(e) === "[object Arguments]";
230
+ } : function(e) {
231
+ return me("callee", e);
232
+ };
233
+ })(), nn = !/* @__PURE__ */ {
234
+ toString: null
235
+ }.propertyIsEnumerable("toString"), He = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], Ze = /* @__PURE__ */ (function() {
236
+ return arguments.propertyIsEnumerable("length");
237
+ })(), rn = function(e, n) {
238
+ for (var r = 0; r < e.length; ) {
239
+ if (e[r] === n)
240
+ return !0;
241
+ r += 1;
242
+ }
243
+ return !1;
244
+ }, Je = /* @__PURE__ */ P(typeof Object.keys == "function" && !Ze ? function(e) {
245
+ return Object(e) !== e ? [] : Object.keys(e);
246
+ } : function(e) {
247
+ if (Object(e) !== e)
248
+ return [];
249
+ var n, r, s = [], l = Ze && at(e);
250
+ for (n in e)
251
+ me(n, e) && (!l || n !== "length") && (s[s.length] = n);
252
+ if (nn)
253
+ for (r = He.length - 1; r >= 0; )
254
+ n = He[r], me(n, e) && !rn(s, n) && (s[s.length] = n), r -= 1;
255
+ return s;
256
+ });
257
+ const an = Number.isInteger || function(e) {
258
+ return e << 0 === e;
259
+ };
260
+ var on = /* @__PURE__ */ j(function(e, n) {
261
+ var r = e < 0 ? n.length + e : e;
262
+ return Ie(n) ? n.charAt(r) : n[r];
263
+ }), ie = /* @__PURE__ */ j(function(e, n) {
264
+ if (n != null)
265
+ return an(e) ? on(e, n) : n[e];
266
+ }), sn = /* @__PURE__ */ Se(tn), Ye = /* @__PURE__ */ P(function(e) {
267
+ return e === null ? "Null" : e === void 0 ? "Undefined" : Object.prototype.toString.call(e).slice(8, -1);
268
+ });
269
+ function ln(t, e) {
270
+ return function() {
271
+ return e.call(this, t.apply(this, arguments));
272
+ };
273
+ }
274
+ function ot(t, e) {
275
+ return function() {
276
+ var n = arguments.length;
277
+ if (n === 0)
278
+ return e();
279
+ var r = arguments[n - 1];
280
+ return be(r) || typeof r[t] != "function" ? e.apply(this, arguments) : r[t].apply(r, Array.prototype.slice.call(arguments, 0, n - 1));
281
+ };
282
+ }
283
+ var un = /* @__PURE__ */ Se(
284
+ /* @__PURE__ */ ot("slice", function(e, n, r) {
285
+ return Array.prototype.slice.call(r, e, n);
286
+ })
287
+ ), cn = /* @__PURE__ */ P(
288
+ /* @__PURE__ */ ot(
289
+ "tail",
290
+ /* @__PURE__ */ un(1, 1 / 0)
291
+ )
292
+ );
293
+ function dn() {
294
+ if (arguments.length === 0)
295
+ throw new Error("pipe requires at least one argument");
296
+ return Ne(arguments[0].length, sn(ln, arguments[0], cn(arguments)));
297
+ }
298
+ var fn = /* @__PURE__ */ P(function(e) {
299
+ return Ie(e) ? e.split("").reverse().join("") : Array.prototype.slice.call(e, 0).reverse();
300
+ });
301
+ function Ke() {
302
+ if (arguments.length === 0)
303
+ throw new Error("compose requires at least one argument");
304
+ return dn.apply(this, fn(arguments));
305
+ }
306
+ function Qe(t) {
307
+ for (var e = [], n; !(n = t.next()).done; )
308
+ e.push(n.value);
309
+ return e;
310
+ }
311
+ function et(t, e, n) {
312
+ for (var r = 0, s = n.length; r < s; ) {
313
+ if (t(e, n[r]))
314
+ return !0;
315
+ r += 1;
316
+ }
317
+ return !1;
318
+ }
319
+ function vn(t) {
320
+ var e = String(t).match(/^function (\w*)/);
321
+ return e == null ? "" : e[1];
322
+ }
323
+ function pn(t, e) {
324
+ return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
325
+ }
326
+ const ke = typeof Object.is == "function" ? Object.is : pn;
327
+ function tt(t, e, n, r) {
328
+ var s = Qe(t), l = Qe(e);
329
+ function h(m, I) {
330
+ return Re(m, I, n.slice(), r.slice());
331
+ }
332
+ return !et(function(m, I) {
333
+ return !et(h, I, m);
334
+ }, l, s);
335
+ }
336
+ function Re(t, e, n, r) {
337
+ if (ke(t, e))
338
+ return !0;
339
+ var s = Ye(t);
340
+ if (s !== Ye(e))
341
+ return !1;
342
+ if (typeof t["fantasy-land/equals"] == "function" || typeof e["fantasy-land/equals"] == "function")
343
+ return typeof t["fantasy-land/equals"] == "function" && t["fantasy-land/equals"](e) && typeof e["fantasy-land/equals"] == "function" && e["fantasy-land/equals"](t);
344
+ if (typeof t.equals == "function" || typeof e.equals == "function")
345
+ return typeof t.equals == "function" && t.equals(e) && typeof e.equals == "function" && e.equals(t);
346
+ switch (s) {
347
+ case "Arguments":
348
+ case "Array":
349
+ case "Object":
350
+ if (typeof t.constructor == "function" && vn(t.constructor) === "Promise")
351
+ return t === e;
352
+ break;
353
+ case "Boolean":
354
+ case "Number":
355
+ case "String":
356
+ if (!(typeof t == typeof e && ke(t.valueOf(), e.valueOf())))
357
+ return !1;
358
+ break;
359
+ case "Date":
360
+ if (!ke(t.valueOf(), e.valueOf()))
361
+ return !1;
362
+ break;
363
+ case "Error":
364
+ return t.name === e.name && t.message === e.message;
365
+ case "RegExp":
366
+ if (!(t.source === e.source && t.global === e.global && t.ignoreCase === e.ignoreCase && t.multiline === e.multiline && t.sticky === e.sticky && t.unicode === e.unicode))
367
+ return !1;
368
+ break;
369
+ }
370
+ for (var l = n.length - 1; l >= 0; ) {
371
+ if (n[l] === t)
372
+ return r[l] === e;
373
+ l -= 1;
374
+ }
375
+ switch (s) {
376
+ case "Map":
377
+ return t.size !== e.size ? !1 : tt(t.entries(), e.entries(), n.concat([t]), r.concat([e]));
378
+ case "Set":
379
+ return t.size !== e.size ? !1 : tt(t.values(), e.values(), n.concat([t]), r.concat([e]));
380
+ case "Arguments":
381
+ case "Array":
382
+ case "Object":
383
+ case "Boolean":
384
+ case "Number":
385
+ case "String":
386
+ case "Date":
387
+ case "Error":
388
+ case "RegExp":
389
+ case "Int8Array":
390
+ case "Uint8Array":
391
+ case "Uint8ClampedArray":
392
+ case "Int16Array":
393
+ case "Uint16Array":
394
+ case "Int32Array":
395
+ case "Uint32Array":
396
+ case "Float32Array":
397
+ case "Float64Array":
398
+ case "ArrayBuffer":
399
+ break;
400
+ default:
401
+ return !1;
402
+ }
403
+ var h = Je(t);
404
+ if (h.length !== Je(e).length)
405
+ return !1;
406
+ var m = n.concat([t]), I = r.concat([e]);
407
+ for (l = h.length - 1; l >= 0; ) {
408
+ var v = h[l];
409
+ if (!(me(v, e) && Re(e[v], t[v], m, I)))
410
+ return !1;
411
+ l -= 1;
412
+ }
413
+ return !0;
414
+ }
415
+ var it = /* @__PURE__ */ j(function(e, n) {
416
+ return Re(e, n, [], []);
417
+ });
418
+ function hn(t) {
419
+ return Object.prototype.toString.call(t) === "[object Object]";
420
+ }
421
+ var Ae = /* @__PURE__ */ j(function(e, n) {
422
+ return n == null || n !== n ? e : n;
423
+ });
424
+ function yn(t) {
425
+ var e = Object.prototype.toString.call(t);
426
+ return e === "[object Uint8ClampedArray]" || e === "[object Int8Array]" || e === "[object Uint8Array]" || e === "[object Int16Array]" || e === "[object Uint16Array]" || e === "[object Int32Array]" || e === "[object Uint32Array]" || e === "[object Float32Array]" || e === "[object Float64Array]" || e === "[object BigInt64Array]" || e === "[object BigUint64Array]";
427
+ }
428
+ var gn = /* @__PURE__ */ P(function(e) {
429
+ return e != null && typeof e["fantasy-land/empty"] == "function" ? e["fantasy-land/empty"]() : e != null && e.constructor != null && typeof e.constructor["fantasy-land/empty"] == "function" ? e.constructor["fantasy-land/empty"]() : e != null && typeof e.empty == "function" ? e.empty() : e != null && e.constructor != null && typeof e.constructor.empty == "function" ? e.constructor.empty() : be(e) ? [] : Ie(e) ? "" : hn(e) ? {} : at(e) ? /* @__PURE__ */ (function() {
430
+ return arguments;
431
+ })() : yn(e) ? e.constructor.from("") : void 0;
432
+ }), wn = /* @__PURE__ */ (function() {
433
+ function t(e, n) {
434
+ this.xf = n, this.f = e, this.idx = -1, this.found = !1;
435
+ }
436
+ return t.prototype["@@transducer/init"] = Zt.init, t.prototype["@@transducer/result"] = function(e) {
437
+ return this.found || (e = this.xf["@@transducer/step"](e, -1)), this.xf["@@transducer/result"](e);
438
+ }, t.prototype["@@transducer/step"] = function(e, n) {
439
+ return this.idx += 1, this.f(n) && (this.found = !0, e = Ht(this.xf["@@transducer/step"](e, this.idx))), e;
440
+ }, t;
441
+ })(), mn = /* @__PURE__ */ j(function(e, n) {
442
+ return new wn(e, n);
443
+ }), z = /* @__PURE__ */ j(
444
+ /* @__PURE__ */ Gt([], mn, function(e, n) {
445
+ for (var r = 0, s = n.length; r < s; ) {
446
+ if (e(n[r]))
447
+ return r;
448
+ r += 1;
449
+ }
450
+ return -1;
451
+ })
452
+ ), An = /* @__PURE__ */ P(function(e) {
453
+ return e != null && it(e, gn(e));
454
+ }), G = /* @__PURE__ */ Se(function(e, n, r) {
455
+ return it(n, ie(e, r));
456
+ }), Ce = /* @__PURE__ */ Se(function(e, n, r) {
457
+ return Ae(e, ie(n, r));
458
+ }), Cn = /* @__PURE__ */ j(function(e, n) {
459
+ return Ne(e.length, function() {
460
+ try {
461
+ return e.apply(this, arguments);
462
+ } catch (r) {
463
+ return n.apply(this, Xt([r], arguments));
464
+ }
465
+ });
466
+ });
467
+ async function we() {
468
+ try {
469
+ return Bt().then(
470
+ (t) => {
471
+ var e;
472
+ return (e = t == null ? void 0 : t.tokens) == null ? void 0 : e.accessToken.toString();
473
+ }
474
+ );
475
+ } catch (t) {
476
+ console.error(t);
477
+ }
478
+ }
479
+ const Sn = () => ({
480
+ openConnection: async (e, n, r) => await new Promise((h, m) => {
481
+ const I = e + "?session=" + r + "&package=" + n;
482
+ let v = null;
483
+ const i = new WebSocket(I);
484
+ i.onopen = () => {
485
+ const y = { montage: "NOT_MONTAGED", packageId: n };
486
+ i.send(JSON.stringify(y));
487
+ }, i.onclose = () => {
488
+ v && v.channelDetails ? h({ res: v.channelDetails, status: "websocket closed" }) : h({ res: null, status: "websocket closed without data" });
489
+ }, i.onmessage = (y) => {
490
+ v = JSON.parse(y.data), i.close();
491
+ }, i.onerror = (y) => {
492
+ console.error("WebSocket error:", y), m(y);
493
+ };
494
+ })
495
+ }), K = /* @__PURE__ */ new Map();
496
+ let nt = !1, rt = !1;
497
+ function Te(t = "default") {
498
+ if (t === "default" && !nt && (nt = !0, console.warn(
499
+ '[TSViewer] Using default store instance. For multi-instance support, pass a unique instanceId prop to TSViewer. Example: <TSViewer instance-id="viewer-1" />'
500
+ )), K.has(t))
501
+ return K.get(t)();
502
+ const e = qt(`tsviewer-${t}`, () => {
503
+ const n = Rt({}), r = w([]), s = w("NOT_MONTAGED"), l = w({}), h = w([]), m = w(null), I = w(null), v = w({}), i = w([]), y = w({}), A = w({}), T = w("POINTER"), { openConnection: M } = Sn(), U = H(() => (a) => h.value.find((u) => u.name === a)), _ = H(() => r.value.filter((a) => a.selected)), L = H(() => () => {
504
+ const a = i.value.find((u) => u.selected);
505
+ return a || (console.warn("No active layer found, available layers:", i.value), i.value.length > 0 ? i.value[0] : null);
506
+ }), E = () => {
507
+ let a = !1;
508
+ return i.value.forEach((u, p) => {
509
+ !u.id && u.id !== 0 && (console.error(`Layer at index ${p} missing ID:`, u), a = !0), u.annotations || (console.warn(`Layer at index ${p} missing annotations array:`, u), u.annotations = []);
510
+ }), a && console.error("Annotation layer validation failed. Layers:", i.value), !a;
511
+ }, $ = H(() => (a) => i.value.flatMap((p) => p.annotations || []).find((p) => p.id === a)), f = (a) => {
512
+ v.value = a;
513
+ }, V = (a) => {
514
+ r.value = a;
515
+ }, O = (a) => {
516
+ s.value = a;
517
+ }, k = (a) => {
518
+ l.value = a;
519
+ }, N = (a) => {
520
+ h.value = a;
521
+ }, D = (a) => {
522
+ m.value = a;
523
+ }, J = (a) => {
524
+ I.value = a;
525
+ }, W = (a) => {
526
+ Object.assign(n, a);
527
+ }, x = async (a) => {
528
+ const u = a.packageId, p = await we();
529
+ let R = n.timeseriesDiscoverApi, ue = null;
530
+ ue = await M(R, u, p), f({ channels: ue.res, content: { id: u } });
531
+ }, Y = () => (a) => {
532
+ var p;
533
+ return ((p = a == null ? void 0 : a.content) == null ? void 0 : p.state) === "READY";
534
+ }, Q = (a) => {
535
+ const u = a.map((p) => (!p.id && p.id !== 0 && (console.warn("Annotation layer missing ID:", p), p.id = Math.random().toString(36).substr(2, 9)), p.annotations || (p.annotations = []), p.name || (p.name = `Layer ${p.id}`), p));
536
+ i.value = u;
537
+ }, se = (a) => {
538
+ if (!a && a !== 0) {
539
+ console.error("setActiveAnnotationLayer called with invalid layerId:", a);
540
+ return;
541
+ }
542
+ y.value = a, i.value.forEach((p) => p.selected = !1);
543
+ const u = z(G("id", a), i.value);
544
+ u >= 0 ? i.value[u].selected = !0 : console.error("Layer with ID not found:", a, "Available layers:", i.value);
545
+ }, q = (a) => {
546
+ if (i.value.forEach(
547
+ (u) => {
548
+ var p;
549
+ return (p = u.annotations) == null ? void 0 : p.forEach((R) => R.selected = !1);
550
+ }
551
+ ), a.id) {
552
+ const u = z(G("id", a.layer_id), i.value);
553
+ if (u >= 0) {
554
+ const p = z(G("id", a.id), i.value[u].annotations);
555
+ p >= 0 && (i.value[u].annotations[p].selected = !0);
556
+ }
557
+ }
558
+ A.value = a;
559
+ }, ee = (a) => {
560
+ T.value = a;
561
+ }, B = (a) => {
562
+ if (!a.id && a.id !== 0) {
563
+ console.error("Cannot create layer without ID:", a);
564
+ return;
565
+ }
566
+ const u = {
567
+ id: a.id,
568
+ name: a.name || `Layer ${a.id}`,
569
+ description: a.description || "",
570
+ visible: a.visible !== void 0 ? a.visible : !0,
571
+ selected: a.selected || !1,
572
+ annotations: a.annotations || [],
573
+ color: a.color,
574
+ hexColor: a.hexColor,
575
+ bkColor: a.bkColor,
576
+ selColor: a.selColor,
577
+ userId: a.userId,
578
+ ...a
579
+ // Spread any additional properties
580
+ };
581
+ i.value.push(u);
582
+ }, le = (a) => {
583
+ const u = z(G("id", a.id), i.value);
584
+ if (u >= 0) {
585
+ const p = Object.assign(i.value[u], a);
586
+ i.value[u] = p;
587
+ }
588
+ }, ve = (a) => {
589
+ const u = z(G("id", a.id), i.value);
590
+ u >= 0 && i.value.splice(u, 1);
591
+ }, te = (a) => {
592
+ const u = z(G("id", a.layer_id), i.value);
593
+ u >= 0 && (i.value[u].annotations || (i.value[u].annotations = []), i.value[u].annotations.push(a), q(a));
594
+ }, ne = (a) => {
595
+ const u = z(G("id", a.layer_id), i.value);
596
+ if (u >= 0) {
597
+ const p = i.value[u].annotations, R = z(G("id", a.id), p);
598
+ R >= 0 && (p[R] = a);
599
+ }
600
+ }, g = (a) => {
601
+ const u = z(G("id", a.layer_id), i.value);
602
+ if (u >= 0) {
603
+ const p = i.value[u].annotations, R = z(G("id", a.id), p);
604
+ R >= 0 && p.splice(R, 1);
605
+ }
606
+ }, C = (a, u, p) => {
607
+ const R = r.value.find((ue) => ue.id === a);
608
+ R && (R[u] = p);
609
+ };
610
+ return {
611
+ // State
612
+ viewerChannels: r,
613
+ viewerMontageScheme: s,
614
+ customMontageMap: l,
615
+ workspaceMontages: h,
616
+ viewerErrors: m,
617
+ needsRerender: I,
618
+ viewerAnnotations: i,
619
+ activeAnnotationLayer: y,
620
+ activeAnnotation: A,
621
+ activeViewer: v,
622
+ viewerActiveTool: T,
623
+ config: n,
624
+ // Getters
625
+ getMontageMessageByName: U,
626
+ viewerSelectedChannels: _,
627
+ getViewerActiveLayer: L,
628
+ getAnnotationById: $,
629
+ // Actions
630
+ setChannels: V,
631
+ setViewerMontageScheme: O,
632
+ setCustomMontageMap: k,
633
+ setWorkspaceMontages: N,
634
+ setViewerErrors: D,
635
+ setAnnotations: Q,
636
+ setActiveAnnotationLayer: se,
637
+ setActiveAnnotation: q,
638
+ setActiveTool: ee,
639
+ createLayer: B,
640
+ updateLayer: le,
641
+ deleteLayer: ve,
642
+ createAnnotation: te,
643
+ updateAnnotation: ne,
644
+ deleteAnnotation: g,
645
+ updateChannelProperty: C,
646
+ updateChannelVisibility: (a, u) => {
647
+ C(a, "visible", u);
648
+ },
649
+ updateChannelSelection: (a, u) => {
650
+ C(a, "selected", u);
651
+ },
652
+ updateChannelFilter: (a, u) => {
653
+ C(a, "filter", u);
654
+ },
655
+ validateAnnotationLayers: E,
656
+ resetViewer: () => {
657
+ r.value = [], s.value = "NOT_MONTAGED", l.value = {}, h.value = [], m.value = null, i.value = [], y.value = {}, A.value = {}, T.value = "POINTER", v.value = {}, Object.keys(n).forEach((a) => {
658
+ delete n[a];
659
+ });
660
+ },
661
+ triggerRerender: (a) => {
662
+ J({
663
+ timestamp: Date.now(),
664
+ cause: a
665
+ });
666
+ },
667
+ resetRerenderTrigger: () => {
668
+ I.value = null;
669
+ },
670
+ isTSFileProcessed: Y,
671
+ fetchAndSetActiveViewer: x,
672
+ setActiveViewer: f,
673
+ setViewerConfig: W
674
+ };
675
+ });
676
+ return K.set(t, e), e();
677
+ }
678
+ function bn(t) {
679
+ K.has(t) && (K.get(t)().resetViewer(), K.delete(t));
680
+ }
681
+ function Un() {
682
+ K.forEach((t, e) => {
683
+ t().resetViewer();
684
+ }), K.clear();
685
+ }
686
+ function Wn() {
687
+ return rt || (rt = !0, console.warn(
688
+ "[TSViewer] useViewerStore() is deprecated. Use createViewerStore(instanceId) for multi-instance support."
689
+ )), Te("default");
690
+ }
691
+ function In(t) {
692
+ if (useRoute().name === "docs-login")
693
+ return;
694
+ Ae(!1, ie("shouldShowToast", t));
695
+ const n = Ae(!1, ie("shouldRedirect", t));
696
+ this.clearState(), n && this.$route.fullPath;
697
+ }
698
+ const Tn = (t) => Object.prototype.toString.call(t) === "[object String]", _n = (t) => {
699
+ Object.keys(t).forEach((e) => {
700
+ Tn(t[e]) && (t[e] = t[e].trim());
701
+ });
702
+ };
703
+ function xn(t, e) {
704
+ if (!t)
705
+ return Promise.reject({ status: 400, message: "Url is missing!" });
706
+ const n = Ce("GET", "method", e), r = Ce({}, "header", e), s = Object.assign({}, { "Content-type": "application/json" }, r), l = ie("body", e);
707
+ let h = { headers: s, method: n };
708
+ if (l) {
709
+ typeof l == "object" && _n(l);
710
+ const m = JSON.stringify(l);
711
+ h = Object.assign({}, h, { body: m });
712
+ }
713
+ return fetch(t, h).then((m) => m.status >= 400 ? Promise.reject(m) : m.json().catch(() => m));
714
+ }
715
+ function De(t) {
716
+ const e = ie("status", t);
717
+ let n;
718
+ if (e !== void 0) {
719
+ if (n = t.status, n === 400 && t.body)
720
+ t.body.getReader().read().then(({ done: r, value: s }) => {
721
+ const l = s instanceof Uint8Array ? String.fromCharCode.apply(null, s) : s;
722
+ Ke(Ae(l), Cn(Ke(ie("message"), JSON.parse), (h, m) => m))(l);
723
+ });
724
+ else if (n === 401)
725
+ return In();
726
+ }
727
+ }
728
+ function En(t = null) {
729
+ const e = t || jt("viewerStore", null) || Te("default"), { viewerChannels: n, viewerAnnotations: r } = Pe(e), s = (v) => v.id || "", l = (v) => {
730
+ v.sort(function(y, A) {
731
+ return y.start < A.start ? -1 : y.start > A.start ? 1 : 0;
732
+ });
733
+ };
734
+ return {
735
+ // Computed properties
736
+ viewerChannels: n,
737
+ // Now from Pinia
738
+ viewerAnnotations: r,
739
+ // Now from Pinia
740
+ // Methods
741
+ addAnnotation: async (v = null) => {
742
+ const i = v || activeAnnotation.value;
743
+ if (!i || !i.layer_id)
744
+ throw new TypeError("Missing annotation data or layer_id", i);
745
+ if (i.id)
746
+ throw new TypeError("Trying to create an annotation that already exists", i.id);
747
+ let y = i.start, A = i.duration || i.end - i.start;
748
+ const T = i.label, M = i.description, U = i.layer_id;
749
+ if (!T)
750
+ throw new Error("Annotation label is required");
751
+ if (y == null)
752
+ throw new Error("Annotation start time is required");
753
+ A < 0 && (A = -A, y = y - A);
754
+ let _ = [];
755
+ if (i.allChannels) {
756
+ const f = e.activeViewer.value.channels;
757
+ for (let V = 0; V < f.length; V++) {
758
+ const k = f[V].content.id;
759
+ _.push(k);
760
+ }
761
+ } else if (i.channelIds && Array.isArray(i.channelIds) && i.channelIds.length > 0)
762
+ _ = i.channelIds;
763
+ else
764
+ for (let f = 0; f < n.value.length; f++) {
765
+ const V = n.value[f];
766
+ if (V.selected && V.visible) {
767
+ const O = s(V);
768
+ _.push(O);
769
+ }
770
+ }
771
+ const L = {
772
+ label: T,
773
+ name: T,
774
+ description: M || "",
775
+ start: Math.floor(y),
776
+ end: Math.floor(y + A),
777
+ channelIds: _
778
+ }, E = e.activeViewer.value.content.id, $ = `${e.config.apiUrl}/timeseries/${E}/layers/${U}/annotations`;
779
+ try {
780
+ const f = await we(), V = await fetch(`${$}?api_key=${f}`, {
781
+ method: "POST",
782
+ headers: {
783
+ "Content-Type": "application/json",
784
+ Accept: "application/json"
785
+ },
786
+ body: JSON.stringify(L)
787
+ });
788
+ if (!V.ok) {
789
+ const D = await V.text();
790
+ throw new Error(`HTTP ${V.status}: ${D}`);
791
+ }
792
+ const O = await V.json(), k = {
793
+ name: "",
794
+ id: O.id,
795
+ label: O.label,
796
+ description: O.description,
797
+ start: O.start,
798
+ duration: O.end - O.start,
799
+ end: O.end,
800
+ cStart: null,
801
+ cEnd: null,
802
+ selected: !0,
803
+ channelIds: O.channelIds || _,
804
+ allChannels: _.length === 0 || _.length >= n.value.length,
805
+ // Use Pinia
806
+ layer_id: U,
807
+ userId: O.userId
808
+ };
809
+ O.linkedPackage && (k.linkedPackage = O.linkedPackage);
810
+ let N = 0;
811
+ for (let D = 0; D < r.value.length; D++)
812
+ if (r.value[D].id === U) {
813
+ N = D;
814
+ break;
815
+ }
816
+ return e.createAnnotation(k), r.value[N] && r.value[N].annotations && l(r.value[N].annotations), k;
817
+ } catch (f) {
818
+ throw console.error("🔧 useTsAnnotation: Error creating annotation:", f), De(f), f;
819
+ }
820
+ },
821
+ updateAnnotation: async (v = null) => {
822
+ const i = v || activeAnnotation.value;
823
+ if (!i.id)
824
+ throw new TypeError("Trying to update an annotation that doesn't exist on server", i.id);
825
+ if (!i.layer_id)
826
+ throw new TypeError("Missing layer_id for annotation update", i);
827
+ let y = i.start, A = i.duration || i.end - i.start;
828
+ A < 0 && (A = -A, y = y - A);
829
+ const T = {
830
+ label: i.label,
831
+ description: i.description || "",
832
+ start: Math.floor(y),
833
+ end: Math.floor(y + A),
834
+ channelIds: i.channelIds || []
835
+ }, M = e.activeViewer.value.content.id, U = `${e.config.apiUrl}/timeseries/${M}/layers/${i.layer_id}/annotations/${i.id}`;
836
+ try {
837
+ const _ = await we(), L = await fetch(`${U}?api_key=${_}`, {
838
+ method: "PUT",
839
+ headers: {
840
+ "Content-Type": "application/json",
841
+ Accept: "application/json"
842
+ },
843
+ body: JSON.stringify(T)
844
+ });
845
+ if (!L.ok) {
846
+ const f = await L.text();
847
+ throw new Error(`HTTP ${L.status}: ${f}`);
848
+ }
849
+ const E = await L.json(), $ = {
850
+ ...i,
851
+ ...E,
852
+ duration: E.end - E.start
853
+ };
854
+ return e.updateAnnotation($), E;
855
+ } catch (_) {
856
+ throw console.error("🔧 useTsAnnotation: Error updating annotation:", _), De(_), _;
857
+ }
858
+ },
859
+ removeAnnotation: async (v) => {
860
+ if (!v || !v.id)
861
+ throw new TypeError("Invalid annotation for deletion", v);
862
+ let i = "";
863
+ if (v.layer ? i = v.layer.id : i = v.layer_id, !i)
864
+ throw new TypeError("Missing layer_id for annotation deletion", v);
865
+ const y = e.activeViewer.value.content.id, A = `${e.config.apiUrl}/timeseries/${y}/layers/${i}/annotations/${v.id}`;
866
+ try {
867
+ const T = await we(), M = await fetch(`${A}?api_key=${T}`, {
868
+ method: "DELETE",
869
+ headers: {
870
+ Accept: "application/json"
871
+ }
872
+ });
873
+ if (!M.ok) {
874
+ const U = await M.text();
875
+ throw new Error(`HTTP ${M.status}: ${U}`);
876
+ }
877
+ return e.deleteAnnotation(v), !0;
878
+ } catch (T) {
879
+ throw console.error("🔧 useTsAnnotation: Error deleting annotation:", T), De(T), T;
880
+ }
881
+ },
882
+ sortAnns: l,
883
+ getChannelId: s
884
+ };
885
+ }
886
+ const On = (t, e) => {
887
+ const n = t.__vccOpts || t;
888
+ for (const [r, s] of e)
889
+ n[r] = s;
890
+ return n;
891
+ }, Vn = { id: "channelCanvas" }, Ln = ["data-id"], kn = ["hidden"], Dn = ["hidden"], Pn = {
892
+ __name: "TSViewer",
893
+ props: {
894
+ pkg: {
895
+ type: Object,
896
+ default: () => {
897
+ }
898
+ },
899
+ isPreview: {
900
+ type: Boolean,
901
+ default: !1
902
+ },
903
+ sidePanelOpen: {
904
+ type: Boolean,
905
+ default: !1
906
+ },
907
+ /**
908
+ * Unique identifier for this viewer instance.
909
+ * Required when running multiple TSViewer components on the same page.
910
+ * Each instance should have a unique ID to ensure isolated state.
911
+ */
912
+ instanceId: {
913
+ type: String,
914
+ default: "default"
915
+ }
916
+ },
917
+ setup(t, { expose: e }) {
918
+ const n = re(() => import("./TSScrubber-CBKcwuMb.js")), r = re(() => import("./TSViewerCanvas-D_RaJ4Mj.js").then((o) => o.T)), s = re(() => import("./TSViewerToolbar-Cb2W7W6J.js")), l = re(() => import("./TSFilterModal-1E2UWL8T.js")), h = re(() => import("./TSAnnotationModal-7GxnJomu.js")), m = re(() => import("./TsAnnotationDeleteDialog-B9pQMYZo.js")), I = re(() => import("./TSViewerLayerWindow-COWXfHNB.js")), v = {
919
+ TIMEUNIT: "microSeconds",
920
+ // Basis for time
921
+ XOFFSET: 0,
922
+ // X-offset of graph in canvas
923
+ XGRIDSPACING: 1e6,
924
+ // Time in microseconds between vertical lines
925
+ NRPXPERLABEL: 150,
926
+ // Number of pixels per label on x-axis
927
+ USEREALTIME: !0,
928
+ // If true than interpret timepoints as UTC microseconds.
929
+ DEFAULTDPI: 96,
930
+ // Default pixels per inch
931
+ ANNOTATIONLABELHEIGHT: 20,
932
+ // Height of annotation label
933
+ ROUNDDATAPIXELS: !1,
934
+ // If true, canvas point will be rounded to integer pixels for faster render (faster)
935
+ MINMAXPOLYGON: !0,
936
+ // If true, then polygon is rendered thru minMax values, otherwise vertical lines (faster)
937
+ PAGESIZEDIVIDER: 0.5,
938
+ // Number of pages that span the current canvas.
939
+ PREFETCHPAGES: 5,
940
+ // Number of pages to read ahead of view.
941
+ LIMITANNFETCH: 500,
942
+ // Maximum number of annotations that are fetched per request
943
+ USEMEDIAN: !1,
944
+ // Use Median instead of mean for centering channels
945
+ CURSOROFFSET: 5,
946
+ // Offset of cursor canvas
947
+ SEGMENTSPAN: 12096e8,
948
+ // One week of gap-data is returned per request.
949
+ MAXRECURSION: 20,
950
+ // Maximum recursion depth of gap-data requests (max 2 years)
951
+ MAXDURATION: 6e8,
952
+ // Maximum duration window (5min)
953
+ INITDURATION: 15e6
954
+ // Initial duration window (15sec)
955
+ }, i = t, y = Te(i.instanceId), { viewerChannels: A, needsRerender: T } = Pe(y);
956
+ $e("viewerStore", y), $e("viewerInstanceId", i.instanceId);
957
+ const {
958
+ addAnnotation: M,
959
+ updateAnnotation: U,
960
+ removeAnnotation: _
961
+ } = En(y), L = w(null), E = w(null), $ = w(null), f = w(null), V = w(null), O = w(null), k = w(null), N = w(null), D = w(0), J = w(0), W = w(0), x = w(0), Y = w(0), Q = w(0), se = w(0), q = w(1), ee = w(1 / 10), B = w(!1), le = w(!1), ve = w(null), te = w(!1), ne = w(!1), g = H(() => y.activeViewer), C = H(() => A.value.map((o) => ({
962
+ ...o,
963
+ selected: !!o.selected
964
+ }))), X = H(() => C.value.filter((o) => o.visible)), Z = H(() => {
965
+ let o = !1;
966
+ return Q.value / _e.value < 30 && (o = !0), o;
967
+ }), _e = H(() => X.value.length), pe = async () => {
968
+ if (!L.value)
969
+ return;
970
+ const o = document.getElementById("ts_viewer");
971
+ if (!o)
972
+ return;
973
+ const d = window.getComputedStyle(o, null), c = parseInt(d.getPropertyValue("height")), S = i.isPreview ? 0 : 100;
974
+ D.value = c - S, await de(), J.value = L.value.offsetWidth;
975
+ const F = $.value;
976
+ F && (se.value = F.clientWidth, Y.value = J.value - F.clientWidth - 16, Q.value = D.value - 40);
977
+ };
978
+ Oe(() => g.value, async (o, d) => {
979
+ var c, S, F;
980
+ (c = E.value) != null && c.resetComponentState && E.value.resetComponentState(), o && o.channels && o.channels.length > 0 && xe(), Fe(), await de(), (S = E.value) != null && S.initSegmentSpans && E.value.initSegmentSpans(), (F = E.value) != null && F.getAnnotations && E.value.getAnnotations();
981
+ }, { immediate: !1, deep: !0 }), Oe(_e, (o, d) => {
982
+ d !== void 0 && o !== d && setTimeout(() => {
983
+ var c;
984
+ pe(), (c = f.value) != null && c.renderAll && f.value.renderAll();
985
+ }, 20);
986
+ });
987
+ const Ee = (o) => {
988
+ store.dispatch("viewerModule/setActiveAnnotation", o).then(() => {
989
+ f.value.renderAnnotationCanvas(), B.value = !0;
990
+ });
991
+ };
992
+ Oe(T, (o) => {
993
+ o && (de(() => {
994
+ var d;
995
+ o.cause === "channel-visibility" ? setTimeout(() => {
996
+ var c;
997
+ pe(), (c = f.value) != null && c.renderAll && f.value.renderAll();
998
+ }, 10) : (d = f.value) != null && d.renderAll && f.value.renderAll();
999
+ }), y.resetRerenderTrigger(null));
1000
+ }, { deep: !0 });
1001
+ const je = (o) => {
1002
+ Ee(o);
1003
+ }, a = async (o) => {
1004
+ if (!o || Object.keys(o).length === 0) {
1005
+ console.error("TSViewer: Received empty annotation!");
1006
+ return;
1007
+ }
1008
+ if (!o.layer_id) {
1009
+ console.error("TSViewer: annotation.layer_id is missing!", o);
1010
+ return;
1011
+ }
1012
+ B.value = !1;
1013
+ try {
1014
+ o.id ? (await U(o), u()) : (await M(o), lt());
1015
+ } catch (d) {
1016
+ console.error("TSViewer: Error creating/updating annotation:", d), B.value = !0;
1017
+ }
1018
+ }, u = () => {
1019
+ f.value.renderAnnotationCanvas();
1020
+ }, p = (o) => {
1021
+ ve.value = o, te.value = !0;
1022
+ }, R = async (o) => {
1023
+ te.value = !1;
1024
+ try {
1025
+ await _(o), ue();
1026
+ } catch (d) {
1027
+ console.error("TSViewer: Error deleting annotation:", d);
1028
+ }
1029
+ }, ue = () => {
1030
+ f.value.renderAnnotationCanvas();
1031
+ }, st = (o, d, c, S, F, ye) => {
1032
+ if (!ye || !ye.id) {
1033
+ console.error("Invalid layer provided to onAddAnnotation:", ye);
1034
+ return;
1035
+ }
1036
+ const kt = y.viewerSelectedChannels || [], Dt = c ? [] : kt.map((Nt) => Nt.id), Pt = {
1037
+ id: null,
1038
+ label: S || "Event",
1039
+ description: F || "",
1040
+ start: Math.floor(o),
1041
+ end: Math.floor(o + d),
1042
+ duration: Math.floor(d),
1043
+ channelIds: Dt,
1044
+ allChannels: c,
1045
+ layer_id: ye.id,
1046
+ selected: !0,
1047
+ userId: null
1048
+ };
1049
+ y.setActiveAnnotation(Pt), B.value = !0;
1050
+ }, lt = () => {
1051
+ f.value.renderAnnotationCanvas();
1052
+ }, ut = (o) => {
1053
+ f.value.createAnnotationLayer(o);
1054
+ }, Me = () => {
1055
+ le.value = !1;
1056
+ }, ct = () => {
1057
+ f.value.resetFocusedAnnotation(), f.value.renderAnnotationCanvas(), B.value = !1;
1058
+ }, dt = () => {
1059
+ ne.value = !1;
1060
+ }, ft = (o) => {
1061
+ o.stopPropagation(), o.preventDefault();
1062
+ const d = o.detail.sourceEvent.metaKey;
1063
+ Ue({ channelId: o.currentTarget.dataset.id, append: d }), f.value.renderAll();
1064
+ }, vt = () => {
1065
+ W.value = f.value.getNextAnnotation();
1066
+ }, pt = () => {
1067
+ W.value = f.value.getPreviousAnnotation();
1068
+ }, ht = (o) => {
1069
+ We(o * 1e6);
1070
+ }, yt = () => {
1071
+ q.value = q.value * 1.25;
1072
+ }, gt = () => {
1073
+ q.value = q.value * 0.8;
1074
+ }, wt = () => {
1075
+ E.value.getAnnotations();
1076
+ }, mt = () => {
1077
+ }, At = () => {
1078
+ const o = Math.max(
1079
+ W.value - 0.75 * x.value,
1080
+ k.value
1081
+ );
1082
+ ce(o), de(() => {
1083
+ var d;
1084
+ (d = f.value) == null || d.renderAll();
1085
+ });
1086
+ }, Ct = () => {
1087
+ const o = Math.min(
1088
+ W.value + 0.75 * x.value,
1089
+ N.value - x.value
1090
+ );
1091
+ ce(o), de(() => {
1092
+ var d, c;
1093
+ (d = f.value) != null && d.invalidate && f.value.invalidate(), (c = f.value) != null && c.renderAll && f.value.renderAll();
1094
+ });
1095
+ }, St = (o) => {
1096
+ let d = f.value.rsPeriod;
1097
+ ce(o.annotation.start - (ee.value * Y.value - v.CURSOROFFSET) * d), de(() => {
1098
+ var c;
1099
+ (c = f.value) == null || c.renderAll();
1100
+ });
1101
+ }, Ue = (o) => {
1102
+ const d = A.value.map((c) => {
1103
+ const S = c.selected;
1104
+ return o.append === !1 && (c.selected = !1), o.channelId === c.id && (c.selected = !S), c;
1105
+ });
1106
+ y.setChannels(d);
1107
+ }, bt = (o, d) => {
1108
+ const c = A.value.map((S) => (d === !1 && (S.selected = !1), S.id in o && (S.selected = !0), S));
1109
+ y.setChannels(c);
1110
+ }, ce = (o) => {
1111
+ W.value = o;
1112
+ }, It = (o) => {
1113
+ ee.value = o;
1114
+ }, Tt = (o) => {
1115
+ q.value = o;
1116
+ }, We = (o) => {
1117
+ o > v.MAXDURATION ? x.value = v.MAXDURATION : x.value = o;
1118
+ }, _t = (o, d, c) => (v.DEFAULTDPI * window.devicePixelRatio / (d * c) / 25.4).toFixed(1) + " " + o.unit + "/mm", xe = () => {
1119
+ var d;
1120
+ const o = (d = g.value) == null ? void 0 : d.channels;
1121
+ if (o && o.length > 0) {
1122
+ k.value = o[0].start, N.value = o[0].end;
1123
+ for (let c = 1; c < o.length; c++)
1124
+ o[c].start < k.value && (k.value = o[c].start), o[c].end > N.value && (N.value = o[c].end);
1125
+ W.value = k.value;
1126
+ }
1127
+ }, Et = () => {
1128
+ xe();
1129
+ }, Ot = (o) => {
1130
+ le.value = !0;
1131
+ }, Vt = (o) => {
1132
+ const d = Ce([], "channels", o), c = Ce("", "filter", o), S = V.value;
1133
+ S.onChannels = d, An(c) ? (S.input0 = NaN, S.input1 = NaN, S.selectedFilter = null, S.selectedNotch = null) : (S.input0 = c.input0, S.input1 = c.input1), ne.value = !0;
1134
+ }, Lt = (o) => {
1135
+ f.value.setFilters(o);
1136
+ }, Fe = () => {
1137
+ var o, d;
1138
+ (o = f.value) == null || o.initViewerCanvas(), (d = f.value) == null || d.renderAll();
1139
+ };
1140
+ return Mt(() => {
1141
+ Et();
1142
+ const o = document.getElementById("ts_viewer");
1143
+ if (!o) {
1144
+ console.warn("ts_viewer element not found");
1145
+ return;
1146
+ }
1147
+ var d = window.getComputedStyle(o, null);
1148
+ const c = parseInt(d.getPropertyValue("height")), S = i.isPreview ? 0 : 100;
1149
+ D.value = c - S, L.value && (J.value = L.value.offsetWidth), window.addEventListener("resize", pe);
1150
+ const F = $.value;
1151
+ F && (se.value = F.clientWidth, Y.value = J.value - F.clientWidth - 5 - 10, Q.value = D.value - 88), x.value = v.INITDURATION, Fe();
1152
+ }), Ut(() => {
1153
+ window.removeEventListener("resize", pe), bn(i.instanceId);
1154
+ }), e({
1155
+ openEditAnnotationDialog: Ee,
1156
+ confirmDeleteAnnotation: p,
1157
+ selectAnnotation: St,
1158
+ selectChannel: Ue,
1159
+ selectChannels: bt,
1160
+ openLayerWindow: Ot,
1161
+ openFilterWindow: Vt,
1162
+ setTimeseriesFilters: Lt
1163
+ }), (o, d) => (ge(), Ve("div", {
1164
+ id: "ts_viewer",
1165
+ ref_key: "ts_viewer",
1166
+ ref: L,
1167
+ class: Le([t.isPreview ? "timeseries-viewer preview" : "timeseries-viewer"])
1168
+ }, [
1169
+ fe(ae(n), {
1170
+ ref_key: "scrubber",
1171
+ ref: E,
1172
+ ts_start: k.value,
1173
+ ts_end: N.value,
1174
+ "c-width": Y.value,
1175
+ "label-width": se.value,
1176
+ "cursor-loc": ee.value,
1177
+ start: W.value,
1178
+ duration: x.value,
1179
+ constants: v,
1180
+ "active-viewer": g.value,
1181
+ onSetStart: ce
1182
+ }, null, 8, ["ts_start", "ts_end", "c-width", "label-width", "cursor-loc", "start", "duration", "active-viewer"]),
1183
+ he("div", Vn, [
1184
+ he("div", {
1185
+ id: "channelLabels",
1186
+ ref_key: "channelLabels",
1187
+ ref: $
1188
+ }, [
1189
+ (ge(!0), Ve(Ft, null, $t(X.value, (c) => (ge(), Ve("div", {
1190
+ key: c.displayName,
1191
+ class: "chLabelWrap",
1192
+ "data-id": c.id,
1193
+ onTap: ft
1194
+ }, [
1195
+ he("div", {
1196
+ class: Le([c.selected ? "labelDiv selected" : "labelDiv"])
1197
+ }, qe(c.displayName), 3),
1198
+ he("div", {
1199
+ class: Le(["chLabelIndWrap", [c.selected ? "selected" : ""]]),
1200
+ hidden: Z.value
1201
+ }, [
1202
+ he("div", {
1203
+ class: "chLabelInd",
1204
+ hidden: Z.value
1205
+ }, qe(_t(c, q.value, c.rowScale)), 9, Dn)
1206
+ ], 10, kn)
1207
+ ], 40, Ln))), 128))
1208
+ ], 512),
1209
+ fe(ae(r), {
1210
+ ref_key: "viewerCanvas",
1211
+ ref: f,
1212
+ window_height: D.value,
1213
+ window_width: J.value,
1214
+ duration: x.value,
1215
+ start: W.value,
1216
+ "c-width": Y.value,
1217
+ "c-height": Q.value,
1218
+ constants: v,
1219
+ "ts-start": k.value,
1220
+ "ts-end": N.value,
1221
+ "cursor-loc": ee.value,
1222
+ "global-zoom-mult": q.value,
1223
+ "active-viewer": g.value,
1224
+ onSetStart: ce,
1225
+ onSetCursor: It,
1226
+ onSetGlobalZoom: Tt,
1227
+ onSetDuration: We,
1228
+ onChannelsInitialized: mt,
1229
+ onAnnLayersInitialized: wt,
1230
+ onCloseAnnotationLayerWindow: Me,
1231
+ onAddAnnotation: st,
1232
+ onUpdateAnnotation: je
1233
+ }, null, 8, ["window_height", "window_width", "duration", "start", "c-width", "c-height", "ts-start", "ts-end", "cursor-loc", "global-zoom-mult", "active-viewer"])
1234
+ ]),
1235
+ t.isPreview ? xt("", !0) : (ge(), Wt(ae(s), {
1236
+ key: 0,
1237
+ constants: v,
1238
+ duration: x.value,
1239
+ start: W.value,
1240
+ onPageBack: At,
1241
+ onPageForward: Ct,
1242
+ onIncrementZoom: yt,
1243
+ onDecrementZoom: gt,
1244
+ onUpdateDuration: ht,
1245
+ onNextAnnotation: vt,
1246
+ onPreviousAnnotation: pt,
1247
+ onSetStart: ce
1248
+ }, null, 8, ["duration", "start"])),
1249
+ fe(ae(l), {
1250
+ ref_key: "filterWindow",
1251
+ ref: V,
1252
+ visible: ne.value,
1253
+ "onUpdate:visible": d[0] || (d[0] = (c) => ne.value = c),
1254
+ onCloseWindow: dt
1255
+ }, null, 8, ["visible"]),
1256
+ fe(ae(h), {
1257
+ ref_key: "annotationModal",
1258
+ ref: O,
1259
+ visible: B.value,
1260
+ "onUpdate:visible": d[1] || (d[1] = (c) => B.value = c),
1261
+ onCloseWindow: ct,
1262
+ onCreateUpdateAnnotation: a
1263
+ }, null, 8, ["visible"]),
1264
+ fe(ae(m), {
1265
+ visible: te.value,
1266
+ "delete-annotation": ve.value,
1267
+ "onUpdate:visible": d[2] || (d[2] = (c) => te.value = c),
1268
+ onDelete: R
1269
+ }, null, 8, ["visible", "delete-annotation"]),
1270
+ fe(ae(I), {
1271
+ visible: le.value,
1272
+ onCloseWindow: Me,
1273
+ onCreateLayer: ut
1274
+ }, null, 8, ["visible"])
1275
+ ], 2));
1276
+ }
1277
+ }, Nn = /* @__PURE__ */ On(Pn, [["__scopeId", "data-v-b1697a76"]]);
1278
+ function Fn(t = "default") {
1279
+ const e = Te(t), {
1280
+ viewerChannels: n,
1281
+ viewerAnnotations: r,
1282
+ viewerActiveTool: s,
1283
+ viewerSelectedChannels: l,
1284
+ activeAnnotation: h,
1285
+ activeAnnotationLayer: m,
1286
+ viewerMontageScheme: I,
1287
+ viewerErrors: v,
1288
+ config: i,
1289
+ activeViewer: y
1290
+ } = Pe(e), A = oe(n), T = H(() => l.value), M = oe(r), U = oe(s), _ = oe(I), L = oe(v), E = oe(i), $ = oe(y);
1291
+ return {
1292
+ // Readonly state
1293
+ channels: A,
1294
+ selectedChannels: T,
1295
+ annotations: M,
1296
+ activeTool: U,
1297
+ montageScheme: _,
1298
+ errors: L,
1299
+ viewerConfig: E,
1300
+ viewer: $,
1301
+ // State queries
1302
+ getChannel: (g) => n.value.find((C) => C.id === g),
1303
+ getAnnotation: (g) => e.getAnnotationById(g),
1304
+ getActiveLayer: () => e.getViewerActiveLayer(),
1305
+ getVisibleChannels: () => n.value.filter((g) => g.visible),
1306
+ getState: () => ({
1307
+ channels: n.value,
1308
+ selectedChannels: l.value,
1309
+ annotations: r.value,
1310
+ activeLayer: e.getViewerActiveLayer(),
1311
+ activeTool: s.value,
1312
+ montageScheme: I.value,
1313
+ errors: v.value
1314
+ }),
1315
+ // Channel controls
1316
+ selectChannels: (g, C = !1) => {
1317
+ const X = n.value.map((Z) => ({
1318
+ ...Z,
1319
+ selected: C ? Z.selected : !1
1320
+ }));
1321
+ X.forEach((Z) => {
1322
+ g.includes(Z.id) && (Z.selected = !0);
1323
+ }), e.setChannels(X);
1324
+ },
1325
+ clearChannelSelection: () => {
1326
+ const g = n.value.map((C) => ({
1327
+ ...C,
1328
+ selected: !1
1329
+ }));
1330
+ e.setChannels(g);
1331
+ },
1332
+ toggleChannelVisibility: (g) => {
1333
+ const C = n.value.find((X) => X.id === g);
1334
+ C && (e.updateChannelVisibility(g, !C.visible), e.triggerRerender("channel-visibility"));
1335
+ },
1336
+ setChannelVisibility: (g, C) => {
1337
+ e.updateChannelVisibility(g, C), e.triggerRerender("channel-visibility");
1338
+ },
1339
+ showAllChannels: () => {
1340
+ n.value.forEach((g) => {
1341
+ e.updateChannelVisibility(g.id, !0);
1342
+ }), e.triggerRerender("channel-visibility");
1343
+ },
1344
+ hideAllChannels: () => {
1345
+ n.value.forEach((g) => {
1346
+ e.updateChannelVisibility(g.id, !1);
1347
+ }), e.triggerRerender("channel-visibility");
1348
+ },
1349
+ // Annotation controls
1350
+ selectAnnotation: (g) => {
1351
+ const C = e.getAnnotationById(g);
1352
+ C && e.setActiveAnnotation(C);
1353
+ },
1354
+ setActiveLayer: (g) => {
1355
+ e.setActiveAnnotationLayer(g);
1356
+ },
1357
+ toggleLayerVisibility: (g) => {
1358
+ const C = r.value.find((X) => X.id === g);
1359
+ C && (C.visible = !C.visible, e.updateLayer(C), e.triggerRerender("layer-visibility"));
1360
+ },
1361
+ // Tool controls
1362
+ setActiveTool: (g) => {
1363
+ e.setActiveTool(g);
1364
+ },
1365
+ // Viewer controls
1366
+ setConfig: (g) => {
1367
+ e.setViewerConfig(g);
1368
+ },
1369
+ setActiveViewer: (g) => {
1370
+ e.setActiveViewer(g);
1371
+ },
1372
+ triggerRerender: (g = "external") => {
1373
+ e.triggerRerender(g);
1374
+ },
1375
+ reset: () => {
1376
+ e.resetViewer();
1377
+ },
1378
+ // Direct store access (for advanced use cases)
1379
+ store: e
1380
+ };
1381
+ }
1382
+ const $n = {
1383
+ install(t) {
1384
+ t.component("TSViewer", Nn);
1385
+ }
1386
+ };
1387
+ export {
1388
+ Nn as T,
1389
+ b as _,
1390
+ Ne as a,
1391
+ j as b,
1392
+ P as c,
1393
+ Zt as d,
1394
+ Gt as e,
1395
+ tn as f,
1396
+ On as g,
1397
+ Te as h,
1398
+ xn as i,
1399
+ De as j,
1400
+ Je as k,
1401
+ Ht as l,
1402
+ G as m,
1403
+ on as n,
1404
+ Ae as o,
1405
+ Ce as p,
1406
+ an as q,
1407
+ Se as r,
1408
+ bn as s,
1409
+ Un as t,
1410
+ we as u,
1411
+ Fn as v,
1412
+ Wn as w,
1413
+ $n as x
1414
+ };