@endge/utils 0.23.0 → 0.24.1
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 +151 -1
- package/dist/utils.js +840 -433
- package/package.json +12 -10
package/dist/utils.js
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
import { parse as
|
|
6
|
-
import { destr as
|
|
7
|
-
import { plainToInstance as
|
|
8
|
-
import { IsOptional as
|
|
2
|
+
var k = (r, t, e) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var a = (r, t, e) => k(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ref as y, watch as O, triggerRef as A, onScopeDispose as P, reactive as z } from "vue";
|
|
5
|
+
import { parse as R, serialize as I } from "cookie-es";
|
|
6
|
+
import { destr as H } from "destr";
|
|
7
|
+
import { plainToInstance as b, instanceToPlain as S, Transform as u, TransformationType as d, Expose as U } from "class-transformer";
|
|
8
|
+
import { IsOptional as j } from "class-validator";
|
|
9
9
|
import "reflect-metadata";
|
|
10
|
-
import
|
|
11
|
-
import { v4 as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
10
|
+
import v from "lodash/debounce.js";
|
|
11
|
+
import { v4 as B } from "uuid";
|
|
12
|
+
import { DateTime as J } from "ts-luxon";
|
|
13
|
+
import { differenceInSeconds as C, format as T, differenceInCalendarDays as K, isAfter as w, isEqual as V, isBefore as F, startOfDay as p, endOfDay as Z } from "date-fns";
|
|
14
|
+
import { utcToZonedTime as G, getTimezoneOffset as _ } from "date-fns-tz";
|
|
15
|
+
import { fetchEventSource as W, EventStreamContentType as Y } from "@microsoft/fetch-event-source";
|
|
16
|
+
import { defineStore as q } from "pinia";
|
|
17
|
+
const Q = {
|
|
16
18
|
path: "/",
|
|
17
19
|
watch: !0,
|
|
18
|
-
decode: (
|
|
19
|
-
encode: (
|
|
20
|
-
},
|
|
21
|
-
var
|
|
22
|
-
const e = { ...
|
|
23
|
-
return
|
|
24
|
-
document.cookie =
|
|
25
|
-
}),
|
|
20
|
+
decode: (r) => H(decodeURIComponent(r)),
|
|
21
|
+
encode: (r) => encodeURIComponent(typeof r == "string" ? r : JSON.stringify(r))
|
|
22
|
+
}, xt = (r, t) => {
|
|
23
|
+
var s;
|
|
24
|
+
const e = { ...Q, ...t || {} }, n = R(document.cookie, e), i = y(n[r] ?? ((s = e.default) == null ? void 0 : s.call(e)));
|
|
25
|
+
return O(i, () => {
|
|
26
|
+
document.cookie = X(r, i.value, e);
|
|
27
|
+
}), i;
|
|
26
28
|
};
|
|
27
|
-
function
|
|
28
|
-
return t == null ? I(
|
|
29
|
+
function X(r, t, e = {}) {
|
|
30
|
+
return t == null ? I(r, t, { ...e, maxAge: -1 }) : I(r, t, e);
|
|
29
31
|
}
|
|
30
|
-
var
|
|
31
|
-
class
|
|
32
|
+
var m = /* @__PURE__ */ ((r) => (r.Add = "add", r.Remove = "remove", r.Update = "update", r.IndexCreate = "indexCreate", r))(m || {});
|
|
33
|
+
class M {
|
|
32
34
|
/**
|
|
33
35
|
* Создает экземпляр EventBus и подготавливает базовое состояние.
|
|
34
36
|
*/
|
|
35
|
-
constructor(t) {
|
|
36
|
-
|
|
37
|
+
constructor(t = []) {
|
|
38
|
+
a(this, "listeners", /* @__PURE__ */ new Map());
|
|
37
39
|
t.forEach((e) => {
|
|
38
40
|
this.listeners.set(e, /* @__PURE__ */ new Set());
|
|
39
41
|
});
|
|
@@ -100,38 +102,38 @@ class O {
|
|
|
100
102
|
* Обрабатывает входящее событие EventBus.
|
|
101
103
|
*/
|
|
102
104
|
_on(t, e) {
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
105
|
-
this.listeners.has(
|
|
105
|
+
const n = Array.isArray(t) ? t : [t];
|
|
106
|
+
for (const i of n)
|
|
107
|
+
this.listeners.has(i) || this.listeners.set(i, /* @__PURE__ */ new Set()), this.listeners.get(i).add(e);
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* Обрабатывает входящее событие EventBus.
|
|
109
111
|
*/
|
|
110
112
|
_once(t, e) {
|
|
111
|
-
const
|
|
112
|
-
for (const
|
|
113
|
-
this.off(
|
|
114
|
-
e(
|
|
113
|
+
const n = Array.isArray(t) ? t : [t], i = (s) => {
|
|
114
|
+
for (const o of n)
|
|
115
|
+
this.off(o, i);
|
|
116
|
+
e(s);
|
|
115
117
|
};
|
|
116
|
-
this._on(
|
|
118
|
+
this._on(n, i);
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
121
|
* Выполняет внутренний шаг _off для EventBus.
|
|
120
122
|
*/
|
|
121
123
|
_off(t, e) {
|
|
122
|
-
var
|
|
123
|
-
const
|
|
124
|
-
for (const
|
|
125
|
-
(
|
|
124
|
+
var i;
|
|
125
|
+
const n = Array.isArray(t) ? t : [t];
|
|
126
|
+
for (const s of n)
|
|
127
|
+
(i = this.listeners.get(s)) == null || i.delete(e);
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
130
|
* Публикует событие во внутренний event bus EventBus.
|
|
129
131
|
*/
|
|
130
132
|
_emit(t, e) {
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
for (const
|
|
134
|
-
|
|
133
|
+
const n = this.listeners.get(t);
|
|
134
|
+
if (n)
|
|
135
|
+
for (const i of n)
|
|
136
|
+
i(e);
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* Выполняет действие hasListeners в рамках ответственности EventBus.
|
|
@@ -154,10 +156,10 @@ class O {
|
|
|
154
156
|
t ? (e = this.listeners.get(t)) == null || e.clear() : this.listeners.clear();
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
|
-
const
|
|
158
|
-
class
|
|
159
|
+
const It = new M(Object.keys({}));
|
|
160
|
+
class $ {
|
|
159
161
|
constructor() {
|
|
160
|
-
|
|
162
|
+
a(this, "subscribers", /* @__PURE__ */ new Set());
|
|
161
163
|
}
|
|
162
164
|
/**
|
|
163
165
|
* Подписывается на обновления.
|
|
@@ -176,61 +178,66 @@ class E {
|
|
|
176
178
|
this.subscribers.forEach((t) => t());
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
|
-
const
|
|
180
|
-
const t =
|
|
181
|
-
|
|
181
|
+
const Dt = (r) => {
|
|
182
|
+
const t = y(r), e = r.subscribe(() => {
|
|
183
|
+
A(t);
|
|
182
184
|
});
|
|
183
185
|
return { refObj: t, unsubscribe: e };
|
|
186
|
+
}, Et = (r) => {
|
|
187
|
+
const t = y(r), e = r.subscribe(() => A(t));
|
|
188
|
+
return P(() => {
|
|
189
|
+
e();
|
|
190
|
+
}), t;
|
|
184
191
|
};
|
|
185
|
-
class
|
|
192
|
+
class Ot extends $ {
|
|
186
193
|
/**
|
|
187
194
|
* Создает экземпляр Collection и подготавливает базовое состояние.
|
|
188
195
|
*/
|
|
189
196
|
constructor(e = []) {
|
|
190
197
|
super();
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.bus = new
|
|
198
|
+
a(this, "items", []);
|
|
199
|
+
a(this, "indices", /* @__PURE__ */ new Map());
|
|
200
|
+
a(this, "rootIds", /* @__PURE__ */ new Set());
|
|
201
|
+
a(this, "bus");
|
|
202
|
+
this.bus = new M(Object.values(m)), e.length && this.add(e), this.createIndex("id");
|
|
196
203
|
}
|
|
197
204
|
/**
|
|
198
205
|
* Выполняет действие add в рамках ответственности Collection.
|
|
199
206
|
*/
|
|
200
207
|
add(e) {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
this.items.push(
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
}),
|
|
208
|
+
const n = Array.isArray(e) ? e : [e];
|
|
209
|
+
n.forEach((i) => {
|
|
210
|
+
this.items.push(i), this.indices.forEach((s, o) => {
|
|
211
|
+
s.set(i[o], i);
|
|
212
|
+
}), i.parentId || this.rootIds.add(i.id);
|
|
213
|
+
}), n != null && n.length && (this.bus.emit(m.Add, n), this.notify());
|
|
207
214
|
}
|
|
208
215
|
/**
|
|
209
216
|
* Удаляет сущность из runtime-коллекции Collection.
|
|
210
217
|
*/
|
|
211
218
|
remove(e) {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
const [
|
|
217
|
-
this.indices.forEach((
|
|
218
|
-
|
|
219
|
-
}),
|
|
219
|
+
const n = Array.isArray(e) ? e : [e], i = [];
|
|
220
|
+
n.forEach((s) => {
|
|
221
|
+
const o = typeof s == "string" ? s : s.id, l = this.items.findIndex((c) => c.id === o);
|
|
222
|
+
if (l !== -1) {
|
|
223
|
+
const [c] = this.items.splice(l, 1);
|
|
224
|
+
this.indices.forEach((f, g) => {
|
|
225
|
+
f.delete(c[g]);
|
|
226
|
+
}), c.parentId || this.rootIds.delete(c.id), i.push(c);
|
|
220
227
|
}
|
|
221
|
-
}),
|
|
228
|
+
}), i.length && (this.bus.emit(m.Remove, i), this.notify());
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* Обновляет runtime-состояние Collection.
|
|
225
232
|
*/
|
|
226
233
|
update(e) {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
const n = Array.isArray(e) ? e : [e];
|
|
235
|
+
n.forEach((i) => {
|
|
236
|
+
const s = this.get(i.id);
|
|
237
|
+
s && (Object.assign(s, i), this.indices.forEach((o, l) => {
|
|
238
|
+
o.set(i[l], s);
|
|
232
239
|
}));
|
|
233
|
-
}),
|
|
240
|
+
}), n != null && n.length && (this.bus.emit(m.Update, n), this.notify());
|
|
234
241
|
}
|
|
235
242
|
/**
|
|
236
243
|
* Возвращает значение состояния Collection.
|
|
@@ -239,8 +246,8 @@ class ht extends E {
|
|
|
239
246
|
if (typeof e == "string")
|
|
240
247
|
return this.indices.get("id").get(e);
|
|
241
248
|
{
|
|
242
|
-
const [
|
|
243
|
-
return this.indices.has(
|
|
249
|
+
const [n, i] = Object.entries(e)[0];
|
|
250
|
+
return this.indices.has(n) || this.createIndex(n), this.indices.get(n).get(i);
|
|
244
251
|
}
|
|
245
252
|
}
|
|
246
253
|
/**
|
|
@@ -248,10 +255,10 @@ class ht extends E {
|
|
|
248
255
|
*/
|
|
249
256
|
createIndex(e) {
|
|
250
257
|
if (this.indices.has(e)) return;
|
|
251
|
-
const
|
|
252
|
-
this.items.forEach((
|
|
253
|
-
|
|
254
|
-
}), this.indices.set(e,
|
|
258
|
+
const n = /* @__PURE__ */ new Map();
|
|
259
|
+
this.items.forEach((i) => {
|
|
260
|
+
n.set(i[e], i);
|
|
261
|
+
}), this.indices.set(e, n), this.bus.emit(m.IndexCreate, e);
|
|
255
262
|
}
|
|
256
263
|
/**
|
|
257
264
|
* Возвращает реактивный массив всех элементов.
|
|
@@ -269,31 +276,31 @@ class ht extends E {
|
|
|
269
276
|
/**
|
|
270
277
|
* Обрабатывает входящее событие Collection.
|
|
271
278
|
*/
|
|
272
|
-
on(e,
|
|
273
|
-
this.bus.on(e,
|
|
279
|
+
on(e, n) {
|
|
280
|
+
this.bus.on(e, n);
|
|
274
281
|
}
|
|
275
282
|
/**
|
|
276
283
|
* Выполняет действие off в рамках ответственности Collection.
|
|
277
284
|
*/
|
|
278
|
-
off(e,
|
|
279
|
-
this.bus.off(e,
|
|
285
|
+
off(e, n) {
|
|
286
|
+
this.bus.off(e, n);
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
|
-
class
|
|
289
|
+
class At {
|
|
283
290
|
/**
|
|
284
291
|
* Создает экземпляр IndexedCollection и подготавливает базовое состояние.
|
|
285
292
|
*/
|
|
286
293
|
constructor(t = null) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
a(this, "list", []);
|
|
295
|
+
a(this, "filteredList", []);
|
|
296
|
+
a(this, "map", /* @__PURE__ */ new Map());
|
|
297
|
+
a(this, "indexById", /* @__PURE__ */ new Map());
|
|
298
|
+
a(this, "dirtySort", !1);
|
|
299
|
+
a(this, "dirtyFilter", !1);
|
|
300
|
+
a(this, "sortFn");
|
|
301
|
+
a(this, "filterFn");
|
|
302
|
+
a(this, "indexEnabled", !1);
|
|
303
|
+
a(this, "filterIndexEnabled", !1);
|
|
297
304
|
t && this.options(t);
|
|
298
305
|
}
|
|
299
306
|
/**
|
|
@@ -340,10 +347,10 @@ class dt {
|
|
|
340
347
|
*/
|
|
341
348
|
add(t) {
|
|
342
349
|
const e = Array.isArray(t) ? t : [t];
|
|
343
|
-
for (const
|
|
344
|
-
if (this.map.has(
|
|
345
|
-
const
|
|
346
|
-
this.list.push(
|
|
350
|
+
for (const n of e) {
|
|
351
|
+
if (this.map.has(n.id)) continue;
|
|
352
|
+
const i = this.list.length;
|
|
353
|
+
this.list.push(n), this.map.set(n.id, n), this.indexById.set(n.id, i), this.indexEnabled && (n.index = i), this.filterIndexEnabled && (n.filteredIndex = -1), this.addToFilteredIfPasses(n);
|
|
347
354
|
}
|
|
348
355
|
this.sortFn && (this.dirtySort = !0);
|
|
349
356
|
}
|
|
@@ -352,9 +359,9 @@ class dt {
|
|
|
352
359
|
*/
|
|
353
360
|
remove(t) {
|
|
354
361
|
const e = Array.isArray(t) ? t : [t];
|
|
355
|
-
for (const
|
|
356
|
-
const
|
|
357
|
-
|
|
362
|
+
for (const n of e) {
|
|
363
|
+
const i = this.map.get(n);
|
|
364
|
+
i && (this.removeFromFilteredO1(i), this.removeFromListO1(n), this.map.delete(n), this.indexEnabled && (i.index = -1), this.filterIndexEnabled && (i.filteredIndex = -1));
|
|
358
365
|
}
|
|
359
366
|
this.sortFn && (this.dirtySort = !0);
|
|
360
367
|
}
|
|
@@ -364,8 +371,8 @@ class dt {
|
|
|
364
371
|
* mayAffectSort если изменились поля сортировки
|
|
365
372
|
*/
|
|
366
373
|
touch(t, e = {}) {
|
|
367
|
-
const
|
|
368
|
-
|
|
374
|
+
const n = this.map.get(t);
|
|
375
|
+
n && (e.mayAffectFilter !== !1 && (this.refilterOneO1(n), !this.filterIndexEnabled && this.filterFn && (this.dirtyFilter = !0)), e.mayAffectSort !== !1 && this.sortFn && (this.dirtySort = !0));
|
|
369
376
|
}
|
|
370
377
|
/**
|
|
371
378
|
* Выполняет действие forEach в рамках ответственности IndexedCollection.
|
|
@@ -373,8 +380,8 @@ class dt {
|
|
|
373
380
|
forEach(t) {
|
|
374
381
|
this.ensure();
|
|
375
382
|
const e = this.filterFn ? this.filteredList : this.list;
|
|
376
|
-
for (let
|
|
377
|
-
t(e[
|
|
383
|
+
for (let n = 0; n < e.length; n++)
|
|
384
|
+
t(e[n], n);
|
|
378
385
|
}
|
|
379
386
|
/**
|
|
380
387
|
* Отсортированный и/или отфильтрованный список (в зависимости от включенных функций).
|
|
@@ -478,8 +485,8 @@ class dt {
|
|
|
478
485
|
*/
|
|
479
486
|
refilterOneO1(t) {
|
|
480
487
|
if (!this.filterFn || !this.filterIndexEnabled) return !1;
|
|
481
|
-
const e = this.filterFn(t),
|
|
482
|
-
return e ?
|
|
488
|
+
const e = this.filterFn(t), i = (t.filteredIndex ?? -1) >= 0;
|
|
489
|
+
return e ? i ? !1 : (this.appendToFiltered(t), !0) : i ? (this.removeFromFilteredO1(t), !0) : !1;
|
|
483
490
|
}
|
|
484
491
|
/**
|
|
485
492
|
* Удаляет сущность из runtime-коллекции IndexedCollection.
|
|
@@ -488,10 +495,10 @@ class dt {
|
|
|
488
495
|
if (!this.filterIndexEnabled) return;
|
|
489
496
|
const e = t.filteredIndex ?? -1;
|
|
490
497
|
if (e < 0) return;
|
|
491
|
-
const
|
|
492
|
-
if (e !==
|
|
493
|
-
const
|
|
494
|
-
this.filteredList[e] =
|
|
498
|
+
const n = this.filteredList.length - 1;
|
|
499
|
+
if (e !== n) {
|
|
500
|
+
const i = this.filteredList[n];
|
|
501
|
+
this.filteredList[e] = i, i.filteredIndex = e;
|
|
495
502
|
}
|
|
496
503
|
this.filteredList.pop(), t.filteredIndex = -1;
|
|
497
504
|
}
|
|
@@ -501,34 +508,137 @@ class dt {
|
|
|
501
508
|
removeFromListO1(t) {
|
|
502
509
|
const e = this.indexById.get(t);
|
|
503
510
|
if (e === void 0) return;
|
|
504
|
-
const
|
|
505
|
-
if (e !==
|
|
506
|
-
const
|
|
507
|
-
this.list[e] =
|
|
511
|
+
const n = this.list.length - 1;
|
|
512
|
+
if (e !== n) {
|
|
513
|
+
const i = this.list[n];
|
|
514
|
+
this.list[e] = i, this.indexById.set(i.id, e), this.indexEnabled && (i.index = e);
|
|
508
515
|
}
|
|
509
516
|
this.list.pop(), this.indexById.delete(t);
|
|
510
517
|
}
|
|
511
518
|
}
|
|
512
|
-
class
|
|
519
|
+
class Ct {
|
|
520
|
+
constructor(t) {
|
|
521
|
+
a(this, "_cap");
|
|
522
|
+
a(this, "_buf");
|
|
523
|
+
a(this, "_head", 0);
|
|
524
|
+
a(this, "_len", 0);
|
|
525
|
+
this._cap = Math.max(0, t | 0), this._buf = new Array(this._cap);
|
|
526
|
+
}
|
|
527
|
+
get capacity() {
|
|
528
|
+
return this._cap;
|
|
529
|
+
}
|
|
530
|
+
get length() {
|
|
531
|
+
return this._len;
|
|
532
|
+
}
|
|
533
|
+
push(t) {
|
|
534
|
+
this._cap <= 0 || (this._buf[this._head] = t, this._head = (this._head + 1) % this._cap, this._len < this._cap && (this._len += 1));
|
|
535
|
+
}
|
|
536
|
+
clear() {
|
|
537
|
+
this._cap <= 0 || (this._head = 0, this._len = 0);
|
|
538
|
+
}
|
|
539
|
+
toArray() {
|
|
540
|
+
if (this._len === 0 || this._cap <= 0)
|
|
541
|
+
return [];
|
|
542
|
+
const t = new Array(this._len), e = (this._head - this._len + this._cap) % this._cap;
|
|
543
|
+
for (let n = 0; n < this._len; n += 1) {
|
|
544
|
+
const i = (e + n) % this._cap;
|
|
545
|
+
t[n] = this._buf[i];
|
|
546
|
+
}
|
|
547
|
+
return t;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
class Ft {
|
|
551
|
+
constructor(t) {
|
|
552
|
+
a(this, "baseUrl");
|
|
553
|
+
this.baseUrl = t.baseUrl.replace(/\/+$/, "");
|
|
554
|
+
}
|
|
555
|
+
buildUrl(t, e) {
|
|
556
|
+
const n = new URL(
|
|
557
|
+
t.replace(/^\//, ""),
|
|
558
|
+
this.baseUrl.endsWith("/") ? this.baseUrl : `${this.baseUrl}/`
|
|
559
|
+
);
|
|
560
|
+
if (e)
|
|
561
|
+
for (const [i, s] of Object.entries(e))
|
|
562
|
+
s != null && n.searchParams.set(i, String(s));
|
|
563
|
+
return n.toString();
|
|
564
|
+
}
|
|
565
|
+
buildHeaders(t) {
|
|
566
|
+
return {
|
|
567
|
+
"Content-Type": "application/json",
|
|
568
|
+
...t || {}
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
async get(t, e, n) {
|
|
572
|
+
const i = await fetch(this.buildUrl(t, e), {
|
|
573
|
+
method: "GET",
|
|
574
|
+
headers: this.buildHeaders(n),
|
|
575
|
+
credentials: "include"
|
|
576
|
+
});
|
|
577
|
+
if (!i.ok) {
|
|
578
|
+
const s = await i.text().catch(() => "");
|
|
579
|
+
throw new Error(`Payload GET ${t} failed: ${i.status} ${i.statusText} ${s}`);
|
|
580
|
+
}
|
|
581
|
+
return await i.json();
|
|
582
|
+
}
|
|
583
|
+
async post(t, e, n) {
|
|
584
|
+
const i = await fetch(this.buildUrl(t), {
|
|
585
|
+
method: "POST",
|
|
586
|
+
headers: this.buildHeaders(n),
|
|
587
|
+
credentials: "include",
|
|
588
|
+
body: e !== void 0 ? JSON.stringify(e) : void 0
|
|
589
|
+
});
|
|
590
|
+
if (!i.ok) {
|
|
591
|
+
const s = await i.text().catch(() => "");
|
|
592
|
+
throw new Error(`Payload POST ${t} failed: ${i.status} ${i.statusText} ${s}`);
|
|
593
|
+
}
|
|
594
|
+
return await i.json();
|
|
595
|
+
}
|
|
596
|
+
async patch(t, e, n) {
|
|
597
|
+
const i = await fetch(this.buildUrl(t), {
|
|
598
|
+
method: "PATCH",
|
|
599
|
+
headers: this.buildHeaders(n),
|
|
600
|
+
credentials: "include",
|
|
601
|
+
body: e !== void 0 ? JSON.stringify(e) : void 0
|
|
602
|
+
});
|
|
603
|
+
if (!i.ok) {
|
|
604
|
+
const s = await i.text().catch(() => "");
|
|
605
|
+
throw new Error(`Payload PATCH ${t} failed: ${i.status} ${i.statusText} ${s}`);
|
|
606
|
+
}
|
|
607
|
+
return await i.json();
|
|
608
|
+
}
|
|
609
|
+
async delete(t, e) {
|
|
610
|
+
const n = await fetch(this.buildUrl(t), {
|
|
611
|
+
method: "DELETE",
|
|
612
|
+
headers: this.buildHeaders(e),
|
|
613
|
+
credentials: "include"
|
|
614
|
+
});
|
|
615
|
+
if (!n.ok) {
|
|
616
|
+
const i = await n.text().catch(() => "");
|
|
617
|
+
throw new Error(`Payload DELETE ${t} failed: ${n.status} ${n.statusText} ${i}`);
|
|
618
|
+
}
|
|
619
|
+
return await n.json().catch(() => ({}));
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
class Mt {
|
|
513
623
|
/**
|
|
514
624
|
* Создает экземпляр DelayedExecutor и подготавливает базовое состояние.
|
|
515
625
|
*/
|
|
516
626
|
constructor(t, e = !1) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
627
|
+
a(this, "delayTimer", null);
|
|
628
|
+
a(this, "maxTimer", null);
|
|
629
|
+
a(this, "hasExecutedOnce", !1);
|
|
630
|
+
a(this, "lastArgs", null);
|
|
521
631
|
this.fn = t, this.firstExecuteImmediately = e;
|
|
522
632
|
}
|
|
523
633
|
/**
|
|
524
634
|
* Выполняет действие run в рамках ответственности DelayedExecutor.
|
|
525
635
|
*/
|
|
526
|
-
run(t, e = 500,
|
|
636
|
+
run(t, e = 500, n = 2e3) {
|
|
527
637
|
if (this.lastArgs = t, this.firstExecuteImmediately && !this.hasExecutedOnce) {
|
|
528
638
|
this.hasExecutedOnce = !0, this.flush();
|
|
529
639
|
return;
|
|
530
640
|
}
|
|
531
|
-
this.delayTimer && clearTimeout(this.delayTimer), this.delayTimer = setTimeout(() => this.flush(), e), this.maxTimer || (this.maxTimer = setTimeout(() => this.flush(),
|
|
641
|
+
this.delayTimer && clearTimeout(this.delayTimer), this.delayTimer = setTimeout(() => this.flush(), e), this.maxTimer || (this.maxTimer = setTimeout(() => this.flush(), n));
|
|
532
642
|
}
|
|
533
643
|
/**
|
|
534
644
|
* Принудительно завершает накопленные изменения DelayedExecutor.
|
|
@@ -549,34 +659,34 @@ class mt {
|
|
|
549
659
|
this.delayTimer && clearTimeout(this.delayTimer), this.maxTimer && clearTimeout(this.maxTimer), this.delayTimer = null, this.maxTimer = null;
|
|
550
660
|
}
|
|
551
661
|
}
|
|
552
|
-
class
|
|
662
|
+
class $t {
|
|
553
663
|
/**
|
|
554
664
|
* Создает экземпляр NamedExecutor и подготавливает базовое состояние.
|
|
555
665
|
*/
|
|
556
666
|
constructor(t) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
667
|
+
a(this, "delayTimers", /* @__PURE__ */ new Map());
|
|
668
|
+
a(this, "maxTimers", /* @__PURE__ */ new Map());
|
|
669
|
+
a(this, "callbacks", /* @__PURE__ */ new Map());
|
|
670
|
+
a(this, "firstCallTime", /* @__PURE__ */ new Map());
|
|
561
671
|
this.config = t;
|
|
562
672
|
}
|
|
563
673
|
/**
|
|
564
674
|
* Выполняет действие run в рамках ответственности NamedExecutor.
|
|
565
675
|
*/
|
|
566
676
|
run(t, e) {
|
|
567
|
-
const
|
|
677
|
+
const n = Date.now();
|
|
568
678
|
if (!this.firstCallTime.has(t)) {
|
|
569
|
-
this.firstCallTime.set(t,
|
|
570
|
-
const
|
|
679
|
+
this.firstCallTime.set(t, n);
|
|
680
|
+
const s = setTimeout(() => {
|
|
571
681
|
this.flush(t);
|
|
572
682
|
}, this.config.maxMs);
|
|
573
|
-
this.maxTimers.set(t,
|
|
683
|
+
this.maxTimers.set(t, s);
|
|
574
684
|
}
|
|
575
685
|
this.callbacks.set(t, e), clearTimeout(this.delayTimers.get(t));
|
|
576
|
-
const
|
|
686
|
+
const i = setTimeout(() => {
|
|
577
687
|
this.flush(t);
|
|
578
688
|
}, this.config.delayMs);
|
|
579
|
-
this.delayTimers.set(t,
|
|
689
|
+
this.delayTimers.set(t, i);
|
|
580
690
|
}
|
|
581
691
|
/**
|
|
582
692
|
* Принудительно завершает накопленные изменения NamedExecutor.
|
|
@@ -610,73 +720,73 @@ class pt {
|
|
|
610
720
|
clearTimeout(this.delayTimers.get(t)), clearTimeout(this.maxTimers.get(t)), this.delayTimers.delete(t), this.maxTimers.delete(t), this.callbacks.delete(t), this.firstCallTime.delete(t);
|
|
611
721
|
}
|
|
612
722
|
}
|
|
613
|
-
function
|
|
614
|
-
return
|
|
723
|
+
function Nt(r, t) {
|
|
724
|
+
return b(r, t, {
|
|
615
725
|
exposeDefaultValues: !0,
|
|
616
726
|
excludeExtraneousValues: !0
|
|
617
727
|
});
|
|
618
728
|
}
|
|
619
|
-
function
|
|
620
|
-
return
|
|
729
|
+
function Lt(r) {
|
|
730
|
+
return S(r, {
|
|
621
731
|
exposeUnsetFields: !1
|
|
622
732
|
});
|
|
623
733
|
}
|
|
624
|
-
function
|
|
734
|
+
function kt(r) {
|
|
625
735
|
return function(t, e) {
|
|
626
|
-
|
|
736
|
+
U(r)(t, e), Reflect.defineMetadata("genericExpose", r.name, t, e);
|
|
627
737
|
};
|
|
628
738
|
}
|
|
629
|
-
const
|
|
630
|
-
function
|
|
631
|
-
return function(
|
|
632
|
-
Reflect.defineMetadata(
|
|
739
|
+
const tt = Symbol("beforeSerialize");
|
|
740
|
+
function Pt() {
|
|
741
|
+
return function(r, t, e) {
|
|
742
|
+
Reflect.defineMetadata(tt, t, r);
|
|
633
743
|
};
|
|
634
744
|
}
|
|
635
|
-
function
|
|
636
|
-
|
|
745
|
+
function zt(r, t, e) {
|
|
746
|
+
r.__afterDeserializeMethods__ || (r.__afterDeserializeMethods__ = []), r.__afterDeserializeMethods__.push(t);
|
|
637
747
|
}
|
|
638
|
-
function
|
|
748
|
+
function Rt(r) {
|
|
639
749
|
return function(t, e) {
|
|
640
|
-
|
|
750
|
+
u(({ value: n }) => n === null ? void 0 : n, { toPlainOnly: !0 })(t, e), j(r)(t, e);
|
|
641
751
|
};
|
|
642
752
|
}
|
|
643
|
-
function
|
|
644
|
-
return
|
|
753
|
+
function Ht() {
|
|
754
|
+
return u(({ value: r, type: t }) => t === d.PLAIN_TO_CLASS ? r == null ? void 0 : r.id : r);
|
|
645
755
|
}
|
|
646
|
-
function
|
|
647
|
-
return
|
|
756
|
+
function Ut(r) {
|
|
757
|
+
return u(({ value: t, type: e }) => e === d.PLAIN_TO_CLASS ? t == null ? void 0 : t.map((n) => n == null ? void 0 : n[r]) : t);
|
|
648
758
|
}
|
|
649
|
-
function
|
|
650
|
-
return
|
|
759
|
+
function jt() {
|
|
760
|
+
return u(({ value: r, type: t }) => t === d.CLASS_TO_PLAIN && (r == null ? void 0 : r.id) || r);
|
|
651
761
|
}
|
|
652
|
-
function
|
|
653
|
-
return
|
|
762
|
+
function vt() {
|
|
763
|
+
return u(({ value: r, type: t }) => t === d.CLASS_TO_PLAIN ? r.map((e) => e.id) : r);
|
|
654
764
|
}
|
|
655
|
-
function
|
|
656
|
-
return
|
|
765
|
+
function Bt() {
|
|
766
|
+
return u(({ value: r, type: t }) => t === "classToPlain" ? void 0 : r, { toPlainOnly: !0 });
|
|
657
767
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
768
|
+
function Jt(r) {
|
|
769
|
+
return r == null;
|
|
660
770
|
}
|
|
661
|
-
const
|
|
662
|
-
function
|
|
663
|
-
return function(
|
|
664
|
-
Reflect.defineMetadata(
|
|
771
|
+
const N = Symbol("onDeserialized");
|
|
772
|
+
function Kt() {
|
|
773
|
+
return function(r, t) {
|
|
774
|
+
Reflect.defineMetadata(N, t, r);
|
|
665
775
|
};
|
|
666
776
|
}
|
|
667
|
-
function
|
|
777
|
+
function et(r) {
|
|
668
778
|
const t = Reflect.getMetadata(
|
|
669
|
-
|
|
670
|
-
|
|
779
|
+
N,
|
|
780
|
+
r
|
|
671
781
|
);
|
|
672
|
-
return t ?
|
|
782
|
+
return t ? r[t].bind(r) : null;
|
|
673
783
|
}
|
|
674
|
-
class
|
|
784
|
+
class Vt {
|
|
675
785
|
/**
|
|
676
786
|
* Выполняет действие toPlain в рамках ответственности Serialize.
|
|
677
787
|
*/
|
|
678
788
|
static toPlain(t) {
|
|
679
|
-
return
|
|
789
|
+
return S(t, {
|
|
680
790
|
exposeDefaultValues: !0,
|
|
681
791
|
excludeExtraneousValues: !0
|
|
682
792
|
});
|
|
@@ -685,16 +795,16 @@ class Lt {
|
|
|
685
795
|
* Выполняет действие fromJSON в рамках ответственности Serialize.
|
|
686
796
|
*/
|
|
687
797
|
static fromJSON(t, e) {
|
|
688
|
-
const
|
|
798
|
+
const n = b(t, e, {
|
|
689
799
|
exposeDefaultValues: !0,
|
|
690
800
|
excludeExtraneousValues: !0
|
|
691
|
-
}),
|
|
692
|
-
return
|
|
801
|
+
}), i = et(n);
|
|
802
|
+
return i && i(), n;
|
|
693
803
|
}
|
|
694
804
|
}
|
|
695
|
-
function
|
|
696
|
-
return function(
|
|
697
|
-
|
|
805
|
+
function Zt() {
|
|
806
|
+
return function(r, t) {
|
|
807
|
+
u(
|
|
698
808
|
({ value: e }) => {
|
|
699
809
|
if (typeof e == "string")
|
|
700
810
|
try {
|
|
@@ -705,7 +815,7 @@ function Ct() {
|
|
|
705
815
|
return e;
|
|
706
816
|
},
|
|
707
817
|
{ toClassOnly: !0 }
|
|
708
|
-
)(
|
|
818
|
+
)(r, t), u(
|
|
709
819
|
({ value: e }) => {
|
|
710
820
|
try {
|
|
711
821
|
return JSON.stringify(e);
|
|
@@ -714,106 +824,137 @@ function Ct() {
|
|
|
714
824
|
}
|
|
715
825
|
},
|
|
716
826
|
{ toPlainOnly: !0 }
|
|
717
|
-
)(
|
|
827
|
+
)(r, t);
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function Gt() {
|
|
831
|
+
return function(r, t) {
|
|
832
|
+
u(
|
|
833
|
+
({ value: e }) => {
|
|
834
|
+
if (e == null)
|
|
835
|
+
return "{}";
|
|
836
|
+
if (typeof e == "object")
|
|
837
|
+
try {
|
|
838
|
+
return JSON.stringify(e, null, 2);
|
|
839
|
+
} catch {
|
|
840
|
+
return "{}";
|
|
841
|
+
}
|
|
842
|
+
return e;
|
|
843
|
+
},
|
|
844
|
+
{ toClassOnly: !0 }
|
|
845
|
+
)(r, t), u(
|
|
846
|
+
({ value: e }) => {
|
|
847
|
+
if (!e)
|
|
848
|
+
return {};
|
|
849
|
+
if (typeof e == "string")
|
|
850
|
+
try {
|
|
851
|
+
return JSON.parse(e);
|
|
852
|
+
} catch {
|
|
853
|
+
return {};
|
|
854
|
+
}
|
|
855
|
+
return e;
|
|
856
|
+
},
|
|
857
|
+
{ toPlainOnly: !0 }
|
|
858
|
+
)(r, t);
|
|
718
859
|
};
|
|
719
860
|
}
|
|
720
|
-
function
|
|
721
|
-
return function(
|
|
722
|
-
|
|
861
|
+
function Wt() {
|
|
862
|
+
return function(r, t) {
|
|
863
|
+
u(
|
|
723
864
|
({ value: e }) => typeof e == "string" ? e.trim() : String(e ?? ""),
|
|
724
865
|
{ toClassOnly: !0 }
|
|
725
|
-
)(
|
|
866
|
+
)(r, t), u(
|
|
726
867
|
({ value: e }) => typeof e == "string" ? e : String(e ?? ""),
|
|
727
868
|
{ toPlainOnly: !0 }
|
|
728
|
-
)(
|
|
869
|
+
)(r, t);
|
|
729
870
|
};
|
|
730
871
|
}
|
|
731
|
-
function
|
|
732
|
-
return
|
|
733
|
-
e.map((
|
|
734
|
-
const
|
|
735
|
-
return [
|
|
872
|
+
function Yt(r, t) {
|
|
873
|
+
return u(({ value: e, type: n }) => e ? n === d.PLAIN_TO_CLASS ? Array.isArray(e) ? t ? new Map(
|
|
874
|
+
e.map((i) => {
|
|
875
|
+
const s = b(r, i);
|
|
876
|
+
return [s[t], s];
|
|
736
877
|
})
|
|
737
878
|
) : (console.warn(
|
|
738
879
|
"[TypeMap] Key field is required for array transformation!"
|
|
739
880
|
), /* @__PURE__ */ new Map()) : typeof e == "object" ? new Map(
|
|
740
|
-
Object.entries(e).map(([
|
|
741
|
-
const
|
|
742
|
-
return Object.assign(
|
|
881
|
+
Object.entries(e).map(([i, s]) => {
|
|
882
|
+
const o = new r();
|
|
883
|
+
return Object.assign(o, s), [i, o];
|
|
743
884
|
})
|
|
744
|
-
) : (console.warn("[TypeMap] Expected object or array, got:", e), /* @__PURE__ */ new Map()) :
|
|
885
|
+
) : (console.warn("[TypeMap] Expected object or array, got:", e), /* @__PURE__ */ new Map()) : n === d.CLASS_TO_PLAIN ? e instanceof Map ? Array.from(e.values()).map((i) => S(i)) : (console.warn("[TypeMap] Expected Map, got:", e), t ? [] : {}) : (console.warn("[TypeMap] Unexpected transformation type:", n), e) : /* @__PURE__ */ new Map());
|
|
745
886
|
}
|
|
746
|
-
function
|
|
747
|
-
return
|
|
887
|
+
function qt(r) {
|
|
888
|
+
return u(({ value: t, type: e }) => {
|
|
748
889
|
if (!t || typeof t != "object") return {};
|
|
749
|
-
if (e ===
|
|
750
|
-
const
|
|
751
|
-
for (const
|
|
752
|
-
|
|
753
|
-
return
|
|
890
|
+
if (e === d.PLAIN_TO_CLASS) {
|
|
891
|
+
const n = {};
|
|
892
|
+
for (const i of Object.keys(t))
|
|
893
|
+
n[i] = b(r, t[i]);
|
|
894
|
+
return n;
|
|
754
895
|
}
|
|
755
|
-
if (e ===
|
|
756
|
-
const
|
|
757
|
-
for (const
|
|
758
|
-
|
|
759
|
-
return
|
|
896
|
+
if (e === d.CLASS_TO_PLAIN) {
|
|
897
|
+
const n = {};
|
|
898
|
+
for (const i of Object.keys(t))
|
|
899
|
+
n[i] = S(t[i]);
|
|
900
|
+
return n;
|
|
760
901
|
}
|
|
761
902
|
return t;
|
|
762
903
|
});
|
|
763
904
|
}
|
|
764
|
-
function
|
|
765
|
-
let
|
|
766
|
-
const
|
|
767
|
-
if (
|
|
905
|
+
function Qt(r, t, e = (s) => s, n = (s) => s, i = 300) {
|
|
906
|
+
let s = t;
|
|
907
|
+
const o = localStorage.getItem(r);
|
|
908
|
+
if (o)
|
|
768
909
|
try {
|
|
769
|
-
const
|
|
770
|
-
|
|
910
|
+
const f = JSON.parse(o);
|
|
911
|
+
s = e(f);
|
|
771
912
|
} catch {
|
|
772
|
-
console.error("Failed to parse from localStorage",
|
|
913
|
+
console.error("Failed to parse from localStorage", r, o);
|
|
773
914
|
}
|
|
774
|
-
const
|
|
915
|
+
const l = y(s), c = v(() => {
|
|
775
916
|
try {
|
|
776
|
-
const
|
|
777
|
-
localStorage.setItem(
|
|
917
|
+
const f = JSON.stringify(n(l.value));
|
|
918
|
+
localStorage.setItem(r, f);
|
|
778
919
|
} catch {
|
|
779
|
-
console.error("Failed to save to localStorage",
|
|
920
|
+
console.error("Failed to save to localStorage", r, l.value);
|
|
780
921
|
}
|
|
781
|
-
},
|
|
782
|
-
return
|
|
783
|
-
() =>
|
|
922
|
+
}, i);
|
|
923
|
+
return O(
|
|
924
|
+
() => l.value,
|
|
784
925
|
() => {
|
|
785
|
-
|
|
926
|
+
c();
|
|
786
927
|
},
|
|
787
928
|
{ deep: !0 }
|
|
788
|
-
),
|
|
929
|
+
), l;
|
|
789
930
|
}
|
|
790
|
-
function
|
|
791
|
-
return
|
|
931
|
+
function Xt(r, t) {
|
|
932
|
+
return r < t ? -1 : r > t ? 1 : 0;
|
|
792
933
|
}
|
|
793
|
-
const
|
|
794
|
-
function
|
|
795
|
-
if (!
|
|
796
|
-
console.groupCollapsed(`⏳ ${
|
|
797
|
-
const e = performance.now(),
|
|
798
|
-
return console.log(`${
|
|
934
|
+
const rt = process.env.NODE_ENV !== "production";
|
|
935
|
+
function te(r, t) {
|
|
936
|
+
if (!rt) return t();
|
|
937
|
+
console.groupCollapsed(`⏳ ${r}`);
|
|
938
|
+
const e = performance.now(), n = t(), i = performance.now();
|
|
939
|
+
return console.log(`${r}: ${Math.round(i - e)} ms`), console.groupEnd(), n;
|
|
799
940
|
}
|
|
800
|
-
const
|
|
801
|
-
function
|
|
941
|
+
const ee = () => B(), D = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
942
|
+
function re(r) {
|
|
802
943
|
let t = "";
|
|
803
|
-
for (let e = 0; e <
|
|
804
|
-
t +=
|
|
944
|
+
for (let e = 0; e < r; ++e)
|
|
945
|
+
t += D[Math.floor(D.length * Math.random())];
|
|
805
946
|
return t;
|
|
806
947
|
}
|
|
807
|
-
class
|
|
948
|
+
class ne {
|
|
808
949
|
/**
|
|
809
950
|
* Создает экземпляр HotkeyManager и подготавливает базовое состояние.
|
|
810
951
|
*/
|
|
811
952
|
constructor(t = {}) {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
953
|
+
a(this, "bindings", /* @__PURE__ */ new Map());
|
|
954
|
+
a(this, "enabled", !0);
|
|
955
|
+
a(this, "target");
|
|
956
|
+
a(this, "ignoreInput");
|
|
957
|
+
a(this, "handleBound");
|
|
817
958
|
this.target = t.target || window, this.ignoreInput = t.ignoreInput ?? !1, this.handleBound = this.handle.bind(this), this.target.addEventListener("keydown", this.handleBound);
|
|
818
959
|
}
|
|
819
960
|
/**
|
|
@@ -834,30 +975,30 @@ class Bt {
|
|
|
834
975
|
*/
|
|
835
976
|
handle(t) {
|
|
836
977
|
if (!this.enabled || this.isIgnoredTarget(t.target)) return;
|
|
837
|
-
const e = this.normalizeKey(t),
|
|
838
|
-
if (
|
|
839
|
-
for (const
|
|
840
|
-
|
|
978
|
+
const e = this.normalizeKey(t), n = this.bindings.get(e);
|
|
979
|
+
if (n)
|
|
980
|
+
for (const i of n)
|
|
981
|
+
i(t);
|
|
841
982
|
}
|
|
842
983
|
/**
|
|
843
984
|
* Обрабатывает входящее событие HotkeyManager.
|
|
844
985
|
*/
|
|
845
986
|
on(t, e) {
|
|
846
|
-
const
|
|
847
|
-
for (const
|
|
848
|
-
const
|
|
849
|
-
this.bindings.has(
|
|
987
|
+
const n = Array.isArray(t) ? t : [t];
|
|
988
|
+
for (const i of n) {
|
|
989
|
+
const s = i.toLowerCase();
|
|
990
|
+
this.bindings.has(s) || this.bindings.set(s, /* @__PURE__ */ new Set()), this.bindings.get(s).add(e);
|
|
850
991
|
}
|
|
851
992
|
}
|
|
852
993
|
/**
|
|
853
994
|
* Выполняет действие off в рамках ответственности HotkeyManager.
|
|
854
995
|
*/
|
|
855
996
|
off(t, e) {
|
|
856
|
-
var
|
|
857
|
-
const
|
|
858
|
-
for (const
|
|
859
|
-
const
|
|
860
|
-
(
|
|
997
|
+
var i;
|
|
998
|
+
const n = Array.isArray(t) ? t : [t];
|
|
999
|
+
for (const s of n) {
|
|
1000
|
+
const o = s.toLowerCase();
|
|
1001
|
+
(i = this.bindings.get(o)) == null || i.delete(e);
|
|
861
1002
|
}
|
|
862
1003
|
}
|
|
863
1004
|
/**
|
|
@@ -885,21 +1026,21 @@ class Bt {
|
|
|
885
1026
|
this.clear(), this.target.removeEventListener("keydown", this.handleBound);
|
|
886
1027
|
}
|
|
887
1028
|
}
|
|
888
|
-
function
|
|
889
|
-
return t != null && t.key ?
|
|
890
|
-
var
|
|
891
|
-
const
|
|
892
|
-
return
|
|
1029
|
+
function ie(r, t) {
|
|
1030
|
+
return t != null && t.key ? r.some((e) => {
|
|
1031
|
+
var c, f;
|
|
1032
|
+
const n = e.ctrl === void 0 || t.ctrlKey === e.ctrl, i = e.alt === void 0 || t.altKey === e.alt, s = e.shift === void 0 || t.shiftKey === e.shift, o = e.meta === void 0 || t.metaKey === e.meta, l = t.key && e.key && ((c = t.key) == null ? void 0 : c.toLowerCase()) === ((f = e.key) == null ? void 0 : f.toLowerCase());
|
|
1033
|
+
return n && i && s && o && l;
|
|
893
1034
|
}) : !1;
|
|
894
1035
|
}
|
|
895
|
-
class
|
|
1036
|
+
class se extends $ {
|
|
896
1037
|
constructor() {
|
|
897
1038
|
super(...arguments);
|
|
898
1039
|
/** Массив всех логов */
|
|
899
|
-
|
|
1040
|
+
a(this, "logs", []);
|
|
900
1041
|
/** Текущий контекст (иерархия) */
|
|
901
|
-
|
|
902
|
-
|
|
1042
|
+
a(this, "currentContext", []);
|
|
1043
|
+
a(this, "currentActions", []);
|
|
903
1044
|
}
|
|
904
1045
|
/**
|
|
905
1046
|
* Устанавливает текущий контекст.
|
|
@@ -934,10 +1075,10 @@ class $t extends E {
|
|
|
934
1075
|
* @example
|
|
935
1076
|
* logger.end('info', 'Компиляция завершена', [...])
|
|
936
1077
|
*/
|
|
937
|
-
end(e,
|
|
938
|
-
if (
|
|
939
|
-
const
|
|
940
|
-
this.log(e ?? "info",
|
|
1078
|
+
end(e, n, i) {
|
|
1079
|
+
if (n) {
|
|
1080
|
+
const s = i ?? this.currentActions.length ? this.currentActions : void 0;
|
|
1081
|
+
this.log(e ?? "info", n, s);
|
|
941
1082
|
}
|
|
942
1083
|
return this.currentContext.pop(), this.currentActions = [], this;
|
|
943
1084
|
}
|
|
@@ -949,8 +1090,8 @@ class $t extends E {
|
|
|
949
1090
|
* @example
|
|
950
1091
|
* logger.action('ti ti-check', 'Все успешно', () => console.logFrame('Успешно!'))
|
|
951
1092
|
*/
|
|
952
|
-
action(e,
|
|
953
|
-
return this.currentActions.push({ icon: e, tooltip:
|
|
1093
|
+
action(e, n, i) {
|
|
1094
|
+
return this.currentActions.push({ icon: e, tooltip: n, handler: i }), this;
|
|
954
1095
|
}
|
|
955
1096
|
/**
|
|
956
1097
|
* Внутренний метод для создания лога.
|
|
@@ -959,15 +1100,15 @@ class $t extends E {
|
|
|
959
1100
|
* @param message Сообщение
|
|
960
1101
|
* @param actions Дополнительные действия (иконки с обработчиками)
|
|
961
1102
|
*/
|
|
962
|
-
log(e,
|
|
963
|
-
const
|
|
1103
|
+
log(e, n, i) {
|
|
1104
|
+
const s = {
|
|
964
1105
|
timestamp: Date.now(),
|
|
965
1106
|
level: e,
|
|
966
|
-
message:
|
|
1107
|
+
message: n,
|
|
967
1108
|
context: [...this.currentContext],
|
|
968
|
-
actions:
|
|
1109
|
+
actions: i
|
|
969
1110
|
};
|
|
970
|
-
this.logs.push(
|
|
1111
|
+
this.logs.push(s), this.notify();
|
|
971
1112
|
}
|
|
972
1113
|
/**
|
|
973
1114
|
* Лог уровня _debug.
|
|
@@ -977,8 +1118,8 @@ class $t extends E {
|
|
|
977
1118
|
* @example
|
|
978
1119
|
* logger._debug('Загрузка данных')
|
|
979
1120
|
*/
|
|
980
|
-
debug(e,
|
|
981
|
-
this.log("debug", e,
|
|
1121
|
+
debug(e, n) {
|
|
1122
|
+
this.log("debug", e, n);
|
|
982
1123
|
}
|
|
983
1124
|
/**
|
|
984
1125
|
* Лог уровня info.
|
|
@@ -988,8 +1129,8 @@ class $t extends E {
|
|
|
988
1129
|
* @example
|
|
989
1130
|
* logger.info('Загрузка завершена')
|
|
990
1131
|
*/
|
|
991
|
-
info(e,
|
|
992
|
-
this.log("info", e,
|
|
1132
|
+
info(e, n) {
|
|
1133
|
+
this.log("info", e, n);
|
|
993
1134
|
}
|
|
994
1135
|
/**
|
|
995
1136
|
* Лог уровня warn.
|
|
@@ -999,8 +1140,8 @@ class $t extends E {
|
|
|
999
1140
|
* @example
|
|
1000
1141
|
* logger.warn('Низкий заряд батареи')
|
|
1001
1142
|
*/
|
|
1002
|
-
warn(e,
|
|
1003
|
-
this.log("warn", e,
|
|
1143
|
+
warn(e, n) {
|
|
1144
|
+
this.log("warn", e, n);
|
|
1004
1145
|
}
|
|
1005
1146
|
/**
|
|
1006
1147
|
* Лог уровня error.
|
|
@@ -1012,8 +1153,8 @@ class $t extends E {
|
|
|
1012
1153
|
* { icon: 'ti ti-refresh', tooltip: 'Повторить', handler: () => retry() },
|
|
1013
1154
|
* ])
|
|
1014
1155
|
*/
|
|
1015
|
-
error(e,
|
|
1016
|
-
this.log("error", e,
|
|
1156
|
+
error(e, n) {
|
|
1157
|
+
this.log("error", e, n);
|
|
1017
1158
|
}
|
|
1018
1159
|
/**
|
|
1019
1160
|
* Лог уровня success.
|
|
@@ -1025,8 +1166,8 @@ class $t extends E {
|
|
|
1025
1166
|
* { icon: 'ti ti-refresh', tooltip: 'Повторить', handler: () => retry() },
|
|
1026
1167
|
* ])
|
|
1027
1168
|
*/
|
|
1028
|
-
success(e,
|
|
1029
|
-
this.log("success", e,
|
|
1169
|
+
success(e, n) {
|
|
1170
|
+
this.log("success", e, n);
|
|
1030
1171
|
}
|
|
1031
1172
|
/**
|
|
1032
1173
|
* Получить все логи.
|
|
@@ -1043,21 +1184,21 @@ class $t extends E {
|
|
|
1043
1184
|
this.logs = [], this.notify();
|
|
1044
1185
|
}
|
|
1045
1186
|
}
|
|
1046
|
-
function
|
|
1187
|
+
function nt(r) {
|
|
1047
1188
|
try {
|
|
1048
|
-
return new new Proxy(
|
|
1189
|
+
return new new Proxy(r, { construct: () => ({}) })(), !0;
|
|
1049
1190
|
} catch {
|
|
1050
1191
|
return !1;
|
|
1051
1192
|
}
|
|
1052
1193
|
}
|
|
1053
|
-
function
|
|
1054
|
-
if (
|
|
1055
|
-
const e =
|
|
1194
|
+
function oe(r, ...t) {
|
|
1195
|
+
if (nt(r)) {
|
|
1196
|
+
const e = r;
|
|
1056
1197
|
return new e(...t);
|
|
1057
1198
|
} else
|
|
1058
|
-
return
|
|
1199
|
+
return r(...t);
|
|
1059
1200
|
}
|
|
1060
|
-
class
|
|
1201
|
+
class ae {
|
|
1061
1202
|
/**
|
|
1062
1203
|
* Создает экземпляр ScriptRunner и подготавливает базовое состояние.
|
|
1063
1204
|
*/
|
|
@@ -1069,36 +1210,36 @@ class Ht {
|
|
|
1069
1210
|
* добавляют экспортируемые имена которые парсятся из JSX
|
|
1070
1211
|
*/
|
|
1071
1212
|
async runAsync(t, e = /* @__PURE__ */ new Set()) {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
),
|
|
1213
|
+
const n = Object.keys(t), i = Object.fromEntries(
|
|
1214
|
+
n.map((f) => [f, this.wrapIfAsync(t[f])])
|
|
1215
|
+
), s = Array.from(e), o = s.length > 0 ? `
|
|
1075
1216
|
|
|
1076
|
-
expose({ ${
|
|
1077
|
-
` : "",
|
|
1217
|
+
expose({ ${s.join(", ")} });
|
|
1218
|
+
` : "", l = `${this.script}${o}`;
|
|
1078
1219
|
return await new Function(
|
|
1079
|
-
...
|
|
1080
|
-
`"use strict"; return (async () => { ${
|
|
1081
|
-
)(...Object.values(
|
|
1220
|
+
...n,
|
|
1221
|
+
`"use strict"; return (async () => { ${l} })();`
|
|
1222
|
+
)(...Object.values(i));
|
|
1082
1223
|
}
|
|
1083
1224
|
/**
|
|
1084
1225
|
* Синхронно вычисляет выражение в контексте.
|
|
1085
1226
|
* Используется для интерполяций, :bind, v-if и т.п.
|
|
1086
1227
|
*/
|
|
1087
1228
|
runSync(t, e = /* @__PURE__ */ new Set()) {
|
|
1088
|
-
const
|
|
1229
|
+
const n = Object.keys(t), i = Object.values(t), s = Array.from(e), o = s.length > 0 ? `
|
|
1089
1230
|
|
|
1090
|
-
expose({ ${
|
|
1231
|
+
expose({ ${s.join(", ")} });
|
|
1091
1232
|
` : "";
|
|
1092
1233
|
try {
|
|
1093
1234
|
new Function(
|
|
1094
|
-
...
|
|
1095
|
-
`"use strict"; ${this.script}${
|
|
1096
|
-
)(...
|
|
1097
|
-
} catch (
|
|
1235
|
+
...n,
|
|
1236
|
+
`"use strict"; ${this.script}${o};`
|
|
1237
|
+
)(...i);
|
|
1238
|
+
} catch (l) {
|
|
1098
1239
|
console.warn(
|
|
1099
1240
|
"(ScriptRunner.runSync): Ошибка в выражении:",
|
|
1100
1241
|
this.script,
|
|
1101
|
-
|
|
1242
|
+
l
|
|
1102
1243
|
);
|
|
1103
1244
|
}
|
|
1104
1245
|
}
|
|
@@ -1107,18 +1248,18 @@ expose({ ${n.join(", ")} });
|
|
|
1107
1248
|
* Используется для интерполяций, :bind, v-if и т.п.
|
|
1108
1249
|
*/
|
|
1109
1250
|
evaluate(t) {
|
|
1110
|
-
const e = Object.keys(t),
|
|
1251
|
+
const e = Object.keys(t), n = Object.values(t);
|
|
1111
1252
|
console.log(t);
|
|
1112
1253
|
try {
|
|
1113
1254
|
return new Function(
|
|
1114
1255
|
...e,
|
|
1115
1256
|
`"use strict"; return (${this.script});`
|
|
1116
|
-
)(...
|
|
1117
|
-
} catch (
|
|
1257
|
+
)(...n);
|
|
1258
|
+
} catch (i) {
|
|
1118
1259
|
console.warn(
|
|
1119
1260
|
"(ScriptRunner.runSync): Ошибка в выражении:",
|
|
1120
1261
|
this.script,
|
|
1121
|
-
|
|
1262
|
+
i
|
|
1122
1263
|
);
|
|
1123
1264
|
return;
|
|
1124
1265
|
}
|
|
@@ -1129,171 +1270,437 @@ expose({ ${n.join(", ")} });
|
|
|
1129
1270
|
wrapIfAsync(t) {
|
|
1130
1271
|
if (typeof t != "object" || t === null) return t;
|
|
1131
1272
|
const e = {};
|
|
1132
|
-
for (const [
|
|
1133
|
-
typeof
|
|
1134
|
-
const
|
|
1135
|
-
return
|
|
1136
|
-
} : e[
|
|
1273
|
+
for (const [n, i] of Object.entries(t))
|
|
1274
|
+
typeof i == "function" ? e[n] = (...s) => {
|
|
1275
|
+
const o = i(...s);
|
|
1276
|
+
return o instanceof Promise, o;
|
|
1277
|
+
} : e[n] = i;
|
|
1137
1278
|
return e;
|
|
1138
1279
|
}
|
|
1139
1280
|
}
|
|
1140
|
-
const
|
|
1141
|
-
function
|
|
1281
|
+
const it = /* @__PURE__ */ new WeakMap();
|
|
1282
|
+
function ce(r) {
|
|
1142
1283
|
let t;
|
|
1143
|
-
return () => (t || (t =
|
|
1284
|
+
return () => (t || (t = r(), it.set(r, t)), t);
|
|
1144
1285
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1286
|
+
const st = {
|
|
1287
|
+
DateTime: J,
|
|
1288
|
+
toDateTime(r) {
|
|
1289
|
+
return this.DateTime.fromJSDate(r);
|
|
1290
|
+
},
|
|
1291
|
+
fromFormat(r, t, e) {
|
|
1292
|
+
return this.DateTime.fromFormat(r, t, e);
|
|
1293
|
+
},
|
|
1294
|
+
fromISO(r, t = {}) {
|
|
1295
|
+
return r ? this.DateTime.fromISO(r, { zone: "utc", ...t }) : null;
|
|
1296
|
+
},
|
|
1297
|
+
getNow() {
|
|
1298
|
+
return this.DateTime.now();
|
|
1299
|
+
},
|
|
1300
|
+
getNowUTC() {
|
|
1301
|
+
return this.DateTime.now().toUTC();
|
|
1302
|
+
},
|
|
1303
|
+
getToday() {
|
|
1304
|
+
return this.DateTime.now().startOf("day").toLocal();
|
|
1305
|
+
},
|
|
1306
|
+
getTime(r = "HH:mm:ss") {
|
|
1307
|
+
return this.DateTime.now().toFormat(r);
|
|
1308
|
+
},
|
|
1309
|
+
getUTCTime(r = "HH:mm:ss") {
|
|
1310
|
+
return this.DateTime.utc().toFormat(r);
|
|
1311
|
+
},
|
|
1312
|
+
getZone() {
|
|
1313
|
+
return this.DateTime.now().zone;
|
|
1314
|
+
}
|
|
1315
|
+
}, le = (r) => st.toDateTime(r);
|
|
1316
|
+
function ue(r) {
|
|
1317
|
+
return String(r).charAt(0).toUpperCase() + String(r).slice(1);
|
|
1147
1318
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1319
|
+
function fe(r, t) {
|
|
1320
|
+
return w(r, t) || V(r, t);
|
|
1150
1321
|
}
|
|
1151
|
-
function
|
|
1152
|
-
const
|
|
1153
|
-
return !
|
|
1322
|
+
function he(r, t, e, n) {
|
|
1323
|
+
const i = p(r), s = p(t), o = p(e), l = p(n);
|
|
1324
|
+
return !F(s, o) && !w(i, l);
|
|
1154
1325
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return !
|
|
1326
|
+
function de(r, t, e) {
|
|
1327
|
+
return !F(r, p(t)) && !w(r, Z(e));
|
|
1157
1328
|
}
|
|
1158
|
-
const
|
|
1159
|
-
function
|
|
1160
|
-
return
|
|
1329
|
+
const me = (r) => r && new Date(r);
|
|
1330
|
+
function pe(r, t = "HH:mm dd.MM.yyyy", e = {}) {
|
|
1331
|
+
return r && T(r, t, e);
|
|
1161
1332
|
}
|
|
1162
|
-
function
|
|
1163
|
-
if (!
|
|
1333
|
+
function ot(r, t = "HH:mm dd.MM.yyyy", e = {}, n = !0) {
|
|
1334
|
+
if (!r || !r || r === "")
|
|
1164
1335
|
return "";
|
|
1165
|
-
if (typeof
|
|
1166
|
-
|
|
1167
|
-
else if (
|
|
1168
|
-
if (isNaN(
|
|
1336
|
+
if (typeof r == "string")
|
|
1337
|
+
r = new Date(r);
|
|
1338
|
+
else if (r instanceof Date) {
|
|
1339
|
+
if (isNaN(r))
|
|
1169
1340
|
return "";
|
|
1170
1341
|
} else
|
|
1171
|
-
|
|
1172
|
-
return
|
|
1342
|
+
r = new Date(r.toString());
|
|
1343
|
+
return n ? T(r, t, e) : T(G(r, "utc"), t, e);
|
|
1173
1344
|
}
|
|
1174
|
-
function
|
|
1175
|
-
const t = { weekday: "short" }, e = new Intl.DateTimeFormat("ru-RU", t).format(
|
|
1345
|
+
function ye(r) {
|
|
1346
|
+
const t = { weekday: "short" }, e = new Intl.DateTimeFormat("ru-RU", t).format(r);
|
|
1176
1347
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1177
1348
|
}
|
|
1178
|
-
function
|
|
1179
|
-
const t = new Date(
|
|
1180
|
-
return `${
|
|
1349
|
+
function ge(r) {
|
|
1350
|
+
const t = new Date(r), e = t.getTime() + t.getTimezoneOffset() * 6e3, n = new Date(e + 180 * 6e3), i = String(n.getDate()).padStart(2, "0"), s = String(n.getMonth() + 1).padStart(2, "0"), o = n.getFullYear();
|
|
1351
|
+
return `${i}.${s}.${o}`;
|
|
1181
1352
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return
|
|
1353
|
+
function Te(r, t = !0) {
|
|
1354
|
+
return ot(r, "HH:mm", {}, t);
|
|
1184
1355
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const t = Array.from(
|
|
1356
|
+
function be(r) {
|
|
1357
|
+
const t = Array.from(r), e = Math.min(...t.map((i) => i.getTime())), n = Math.max(...t.map((i) => i.getTime()));
|
|
1187
1358
|
return {
|
|
1188
1359
|
minDate: new Date(e),
|
|
1189
|
-
maxDate: new Date(
|
|
1360
|
+
maxDate: new Date(n)
|
|
1190
1361
|
};
|
|
1191
1362
|
}
|
|
1192
|
-
function
|
|
1363
|
+
function Se(r, t) {
|
|
1364
|
+
const e = C(r, t), { hours: n, minutes: i } = x(e);
|
|
1365
|
+
return n || i ? `${e > 0 ? "-" : "+"}${h(n)}:${h(i)}` : "";
|
|
1366
|
+
}
|
|
1367
|
+
function _e(r, t) {
|
|
1368
|
+
const e = C(r, t), { hours: n, minutes: i } = x(e);
|
|
1369
|
+
return n || i ? `${e > 0 ? "-" : ""}${h(n)}:${h(i)}` : "";
|
|
1370
|
+
}
|
|
1371
|
+
function E(r = /* @__PURE__ */ new Date()) {
|
|
1372
|
+
return new Date(r.getFullYear(), r.getMonth(), r.getDate());
|
|
1373
|
+
}
|
|
1374
|
+
function we(r, t) {
|
|
1375
|
+
const e = K(E(r), E(t));
|
|
1376
|
+
return e ? e > 7 ? {
|
|
1377
|
+
variant: "red",
|
|
1378
|
+
value: ">7"
|
|
1379
|
+
} : e < -7 ? {
|
|
1380
|
+
variant: "blue",
|
|
1381
|
+
value: ">7"
|
|
1382
|
+
} : e > 0 ? {
|
|
1383
|
+
variant: "red",
|
|
1384
|
+
value: `+${e}`
|
|
1385
|
+
} : {
|
|
1386
|
+
variant: "blue",
|
|
1387
|
+
value: `${e}`
|
|
1388
|
+
} : null;
|
|
1389
|
+
}
|
|
1390
|
+
function xe(r) {
|
|
1391
|
+
const e = String(r ?? "").trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
1392
|
+
if (!e)
|
|
1393
|
+
return null;
|
|
1394
|
+
const n = Number(e[1]), i = Number(e[2]) - 1, s = Number(e[3]), o = new Date(Date.UTC(n, i, s, 0, 0, 0, 0));
|
|
1395
|
+
return Number.isNaN(o.getTime()) ? null : o.toISOString();
|
|
1396
|
+
}
|
|
1397
|
+
function Ie(r) {
|
|
1398
|
+
const t = String(r ?? "").trim();
|
|
1399
|
+
if (!t)
|
|
1400
|
+
return null;
|
|
1401
|
+
const e = t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/);
|
|
1402
|
+
if (e) {
|
|
1403
|
+
const i = Number(e[1]), s = Number(e[2]) - 1, o = Number(e[3]), l = Number(e[4]), c = Number(e[5]), f = e[6] != null ? Number(e[6]) : 0, g = new Date(i, s, o, l, c, f, 0);
|
|
1404
|
+
return Number.isNaN(g.getTime()) ? null : g.toISOString();
|
|
1405
|
+
}
|
|
1406
|
+
const n = new Date(t);
|
|
1407
|
+
return Number.isNaN(n.getTime()) ? null : n.toISOString();
|
|
1408
|
+
}
|
|
1409
|
+
function De(r) {
|
|
1410
|
+
const t = String(r ?? "").trim();
|
|
1411
|
+
return t ? t.slice(0, 10) : "";
|
|
1412
|
+
}
|
|
1413
|
+
function Ee(r) {
|
|
1414
|
+
const t = String(r ?? "").trim();
|
|
1415
|
+
if (!t)
|
|
1416
|
+
return "";
|
|
1417
|
+
const e = new Date(t);
|
|
1418
|
+
if (Number.isNaN(e.getTime()))
|
|
1419
|
+
return t.slice(0, 16);
|
|
1420
|
+
const n = e.getFullYear(), i = h(e.getMonth() + 1), s = h(e.getDate()), o = h(e.getHours()), l = h(e.getMinutes());
|
|
1421
|
+
return `${n}-${i}-${s}T${o}:${l}`;
|
|
1422
|
+
}
|
|
1423
|
+
function Oe(r) {
|
|
1424
|
+
if (r == null)
|
|
1425
|
+
return "";
|
|
1426
|
+
const t = String(r).trim();
|
|
1427
|
+
if (!t)
|
|
1428
|
+
return "";
|
|
1429
|
+
const e = t.match(/^(\d{2}):(\d{2}):(\d{2})$/);
|
|
1430
|
+
if (e)
|
|
1431
|
+
return `${e[1]}:${e[2]}`;
|
|
1432
|
+
const n = t.match(/^(\d{2}):(\d{2})$/);
|
|
1433
|
+
return n ? `${n[1]}:${n[2]}` : "";
|
|
1434
|
+
}
|
|
1435
|
+
function Ae(r) {
|
|
1436
|
+
if (r == null)
|
|
1437
|
+
return null;
|
|
1438
|
+
const t = String(r).trim();
|
|
1439
|
+
if (!t)
|
|
1440
|
+
return null;
|
|
1441
|
+
const e = t.match(/^(\d{2}):(\d{2}):(\d{2})$/);
|
|
1442
|
+
if (e)
|
|
1443
|
+
return `${e[1]}:${e[2]}:${e[3]}`;
|
|
1444
|
+
const n = t.match(/^(\d{2}):(\d{2})$/);
|
|
1445
|
+
return n ? `${n[1]}:${n[2]}:00` : null;
|
|
1446
|
+
}
|
|
1447
|
+
function Ce(r) {
|
|
1448
|
+
const t = ct(r), e = Math.sign(t) >= 0 ? "" : "-", { hours: n, minutes: i } = x(t);
|
|
1449
|
+
return `${e}${h(n)}:${h(i)}`;
|
|
1450
|
+
}
|
|
1451
|
+
function Fe(r = null, t = "dd", e = {}) {
|
|
1452
|
+
const n = at(r);
|
|
1453
|
+
if (!n)
|
|
1454
|
+
return "";
|
|
1455
|
+
const i = /* @__PURE__ */ new Date(), s = new Date(n);
|
|
1456
|
+
return i.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), s.toDateString() === i.toDateString() ? "" : `/${T(n, t, e)}`;
|
|
1457
|
+
}
|
|
1458
|
+
function at(r) {
|
|
1459
|
+
if (!r || r === "")
|
|
1460
|
+
return null;
|
|
1461
|
+
const t = typeof r == "string" ? new Date(r) : r instanceof Date ? r : new Date(r.toString());
|
|
1462
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
1463
|
+
}
|
|
1464
|
+
function x(r) {
|
|
1465
|
+
const t = Math.abs(r);
|
|
1466
|
+
return {
|
|
1467
|
+
hours: Math.floor(t / 3600) % 24,
|
|
1468
|
+
minutes: Math.floor(t / 60) % 60
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
function ct(r) {
|
|
1472
|
+
const t = String(r ?? "").trim();
|
|
1473
|
+
if (!t)
|
|
1474
|
+
return 0;
|
|
1475
|
+
const e = t.match(/^(-)?(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
|
|
1476
|
+
if (e)
|
|
1477
|
+
return (e[1] ? -1 : 1) * (Number(e[2]) * 3600 + Number(e[3]) * 60 + Number(e[4] ?? 0));
|
|
1478
|
+
const n = t.match(/^(-)?P(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/i);
|
|
1479
|
+
if (n) {
|
|
1480
|
+
const i = n[1] ? -1 : 1, s = Number(n[2] ?? 0), o = Number(n[3] ?? 0), l = Number(n[4] ?? 0), c = Number(n[5] ?? 0);
|
|
1481
|
+
return i * (s * 86400 + o * 3600 + l * 60 + c);
|
|
1482
|
+
}
|
|
1483
|
+
return 0;
|
|
1484
|
+
}
|
|
1485
|
+
function h(r) {
|
|
1486
|
+
return String(r).padStart(2, "0");
|
|
1487
|
+
}
|
|
1488
|
+
function Me(r) {
|
|
1193
1489
|
const t = /* @__PURE__ */ new Date();
|
|
1194
1490
|
try {
|
|
1195
|
-
const e =
|
|
1196
|
-
for (const
|
|
1197
|
-
if (
|
|
1198
|
-
return
|
|
1491
|
+
const e = _(r, t), n = Intl.supportedValuesOf("timeZone");
|
|
1492
|
+
for (const i of n)
|
|
1493
|
+
if (_(i, t) === e)
|
|
1494
|
+
return i;
|
|
1199
1495
|
} catch {
|
|
1200
1496
|
return null;
|
|
1201
1497
|
}
|
|
1202
1498
|
return null;
|
|
1203
1499
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return
|
|
1500
|
+
function $e(r) {
|
|
1501
|
+
return _(r, /* @__PURE__ */ new Date());
|
|
1502
|
+
}
|
|
1503
|
+
class Ne {
|
|
1504
|
+
constructor(t) {
|
|
1505
|
+
a(this, "_url");
|
|
1506
|
+
a(this, "_retryInterval");
|
|
1507
|
+
a(this, "_abortController", null);
|
|
1508
|
+
a(this, "_isConnected", !1);
|
|
1509
|
+
a(this, "_reconnectTimeout", null);
|
|
1510
|
+
a(this, "_options");
|
|
1511
|
+
this._url = t.url, this._retryInterval = t.retryInterval ?? 3e3, this._options = t;
|
|
1512
|
+
}
|
|
1513
|
+
start() {
|
|
1514
|
+
this._abortController = new AbortController(), this._connect();
|
|
1515
|
+
}
|
|
1516
|
+
stop() {
|
|
1517
|
+
var t;
|
|
1518
|
+
this._clearReconnect(), this._isConnected = !1, (t = this._abortController) == null || t.abort(), this._abortController = null;
|
|
1519
|
+
}
|
|
1520
|
+
_scheduleReconnect() {
|
|
1521
|
+
this._clearReconnect(), this._reconnectTimeout = setTimeout(() => this.start(), this._retryInterval);
|
|
1522
|
+
}
|
|
1523
|
+
_clearReconnect() {
|
|
1524
|
+
this._reconnectTimeout && (clearTimeout(this._reconnectTimeout), this._reconnectTimeout = null);
|
|
1525
|
+
}
|
|
1526
|
+
_buildHeaders() {
|
|
1527
|
+
var n, i;
|
|
1528
|
+
const t = { ...this._options.headers }, e = (i = (n = this._options).getToken) == null ? void 0 : i.call(n);
|
|
1529
|
+
return e && (t.Authorization = `Bearer ${e}`), t;
|
|
1530
|
+
}
|
|
1531
|
+
async _connect() {
|
|
1532
|
+
var t, e, n;
|
|
1533
|
+
try {
|
|
1534
|
+
await W(this._url, {
|
|
1535
|
+
method: "GET",
|
|
1536
|
+
headers: this._buildHeaders(),
|
|
1537
|
+
signal: (t = this._abortController) == null ? void 0 : t.signal,
|
|
1538
|
+
openWhenHidden: !0,
|
|
1539
|
+
onopen: (i) => {
|
|
1540
|
+
var o, l;
|
|
1541
|
+
if (i.ok && i.headers.get("content-type") === Y) {
|
|
1542
|
+
this._isConnected = !0, (l = (o = this._options).onOpen) == null || l.call(o);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
throw new Error(`Unexpected response: ${i.status}`);
|
|
1546
|
+
},
|
|
1547
|
+
onmessage: (i) => {
|
|
1548
|
+
try {
|
|
1549
|
+
this._options.onEvent(JSON.parse(i.data));
|
|
1550
|
+
} catch (s) {
|
|
1551
|
+
console.warn("[SSEManager] Failed to parse message", s);
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
onclose: () => {
|
|
1555
|
+
var i, s;
|
|
1556
|
+
this._isConnected = !1, (s = (i = this._options).onClose) == null || s.call(i), this._scheduleReconnect();
|
|
1557
|
+
},
|
|
1558
|
+
onerror: (i) => {
|
|
1559
|
+
var s, o;
|
|
1560
|
+
this._isConnected = !1, (o = (s = this._options).onError) == null || o.call(s, i instanceof Error ? i : new Error(String(i))), this._scheduleReconnect();
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
} catch (i) {
|
|
1564
|
+
console.error("[SSEManager] Fatal error", i), this._isConnected = !1, (n = (e = this._options).onError) == null || n.call(e, i instanceof Error ? i : new Error(String(i))), this._scheduleReconnect();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
get isConnected() {
|
|
1568
|
+
return this._isConnected;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
class Le {
|
|
1572
|
+
constructor() {
|
|
1573
|
+
a(this, "_currentCount", 0);
|
|
1574
|
+
a(this, "_lastResetTime", Date.now());
|
|
1575
|
+
a(this, "_lastEventsPerSecond", 0);
|
|
1576
|
+
}
|
|
1577
|
+
count() {
|
|
1578
|
+
const t = Date.now();
|
|
1579
|
+
this._currentCount += 1, t - this._lastResetTime >= 1e3 && (this._lastEventsPerSecond = this._currentCount, this._currentCount = 0, this._lastResetTime = t);
|
|
1580
|
+
}
|
|
1581
|
+
get rate() {
|
|
1582
|
+
return this._lastEventsPerSecond;
|
|
1583
|
+
}
|
|
1584
|
+
reset() {
|
|
1585
|
+
this._currentCount = 0, this._lastEventsPerSecond = 0, this._lastResetTime = Date.now();
|
|
1586
|
+
}
|
|
1206
1587
|
}
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1209
|
-
function e(
|
|
1210
|
-
|
|
1211
|
-
...
|
|
1588
|
+
const ke = q("tooltip", () => {
|
|
1589
|
+
const r = z({}), t = y(null);
|
|
1590
|
+
function e(c) {
|
|
1591
|
+
r[c.id] = {
|
|
1592
|
+
...c,
|
|
1212
1593
|
visible: !1
|
|
1213
1594
|
};
|
|
1214
1595
|
}
|
|
1215
|
-
function
|
|
1216
|
-
delete
|
|
1596
|
+
function n(c) {
|
|
1597
|
+
delete r[c];
|
|
1217
1598
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1599
|
+
function i(c) {
|
|
1600
|
+
r[c] && (t.value = c, r[c].active = !0);
|
|
1220
1601
|
}
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1602
|
+
function s(c) {
|
|
1603
|
+
r[c] && (r[c].active = !1, t.value === c && (t.value = null));
|
|
1223
1604
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1605
|
+
function o(c) {
|
|
1606
|
+
i(c);
|
|
1226
1607
|
}
|
|
1227
|
-
function
|
|
1228
|
-
t.value &&
|
|
1608
|
+
function l() {
|
|
1609
|
+
t.value && s(t.value);
|
|
1229
1610
|
}
|
|
1230
1611
|
return {
|
|
1231
|
-
tooltips:
|
|
1612
|
+
tooltips: r,
|
|
1232
1613
|
activeId: t,
|
|
1233
1614
|
registerTooltip: e,
|
|
1234
|
-
unregisterTooltip:
|
|
1235
|
-
showTooltip:
|
|
1236
|
-
hideTooltip:
|
|
1237
|
-
setActiveTooltipId:
|
|
1238
|
-
clearActiveTooltipId:
|
|
1615
|
+
unregisterTooltip: n,
|
|
1616
|
+
showTooltip: i,
|
|
1617
|
+
hideTooltip: s,
|
|
1618
|
+
setActiveTooltipId: o,
|
|
1619
|
+
clearActiveTooltipId: l
|
|
1239
1620
|
};
|
|
1240
|
-
})
|
|
1621
|
+
});
|
|
1622
|
+
function Pe(r, t) {
|
|
1623
|
+
var e;
|
|
1624
|
+
return r("div", {}, (e = t.slots) != null && e.default ? t.slots.default() : []);
|
|
1625
|
+
}
|
|
1626
|
+
const ze = "x-collection-tooltip-id";
|
|
1241
1627
|
export {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1628
|
+
zt as AfterDeserialize,
|
|
1629
|
+
It as AppBus,
|
|
1630
|
+
Pt as BeforeSerialize,
|
|
1631
|
+
Ot as Collection,
|
|
1632
|
+
Mt as DelayedExecutor,
|
|
1633
|
+
Ut as DeserializeArrayField,
|
|
1634
|
+
Ht as DeserializeId,
|
|
1635
|
+
M as EventBus,
|
|
1636
|
+
m as Events,
|
|
1637
|
+
kt as GenericExpose,
|
|
1638
|
+
ne as HotkeyManager,
|
|
1639
|
+
rt as IS_DEBUG,
|
|
1640
|
+
Bt as IgnoreToPlain,
|
|
1641
|
+
At as IndexedCollection,
|
|
1642
|
+
Rt as IsOptionalTransformed,
|
|
1643
|
+
Zt as Json,
|
|
1644
|
+
Gt as JsonString,
|
|
1645
|
+
$t as NamedExecutor,
|
|
1646
|
+
Ft as PayloadHttpClient,
|
|
1647
|
+
Ct as RingBuffer,
|
|
1648
|
+
Ne as SSEManager,
|
|
1649
|
+
Wt as Script,
|
|
1650
|
+
ae as ScriptRunner,
|
|
1651
|
+
Vt as Serialize,
|
|
1652
|
+
jt as SerializeId,
|
|
1653
|
+
vt as SerializeIds,
|
|
1654
|
+
se as StructuredLogger,
|
|
1655
|
+
$ as Subscribable,
|
|
1656
|
+
st as SystemClock,
|
|
1657
|
+
ze as TooltipAttribute,
|
|
1658
|
+
Pe as TooltipRegistrator,
|
|
1659
|
+
Yt as TypeMap,
|
|
1660
|
+
qt as TypeRecord,
|
|
1661
|
+
Le as UPSMeter_Service,
|
|
1662
|
+
ue as capitalize,
|
|
1663
|
+
Xt as compareNumber,
|
|
1664
|
+
oe as createInstance,
|
|
1665
|
+
Se as diffDuration,
|
|
1666
|
+
_e as diffDurationTable,
|
|
1667
|
+
le as dt,
|
|
1668
|
+
Te as extractTime,
|
|
1669
|
+
be as findMinMaxDates,
|
|
1670
|
+
ge as formatDateToMSK,
|
|
1671
|
+
pe as formatDatetime,
|
|
1672
|
+
ot as formatDatetimeTZ,
|
|
1673
|
+
Fe as formatDatetimeTZSpecial,
|
|
1674
|
+
ee as generateUUID,
|
|
1675
|
+
we as getDateOnlyDiffFactor,
|
|
1676
|
+
ye as getDayOfWeek,
|
|
1677
|
+
et as getOnDeserializedMethod,
|
|
1678
|
+
$e as getTimezoneOffsetMs,
|
|
1679
|
+
ce as globalState,
|
|
1680
|
+
fe as isAfterOrEqual,
|
|
1681
|
+
ie as isAnyKeyComboActive,
|
|
1682
|
+
nt as isConstructor,
|
|
1683
|
+
de as isDateInRange,
|
|
1684
|
+
he as isDateRangeOverlap,
|
|
1685
|
+
Jt as isNullOrUndefined,
|
|
1686
|
+
De as isoToDateInput,
|
|
1687
|
+
Ee as isoToDateTimeLocalInput,
|
|
1688
|
+
Kt as onDeserialized,
|
|
1689
|
+
me as parseDate,
|
|
1690
|
+
Ce as parseDuration,
|
|
1691
|
+
Me as parseOffsetToTimezone,
|
|
1692
|
+
te as profile,
|
|
1693
|
+
re as randomString,
|
|
1694
|
+
E as removeTime,
|
|
1695
|
+
Oe as timeToTimeInput,
|
|
1696
|
+
Nt as toInstance,
|
|
1697
|
+
xe as toIsoZDate,
|
|
1698
|
+
Ie as toIsoZDateTime,
|
|
1699
|
+
Lt as toPlain,
|
|
1700
|
+
Ae as toTimeHHMMSS,
|
|
1701
|
+
xt as useCookie,
|
|
1702
|
+
Qt as useStorageDebounced,
|
|
1703
|
+
Dt as useSubscribableRef,
|
|
1704
|
+
Et as useSubscribableRefAuto,
|
|
1705
|
+
ke as useTooltipStore
|
|
1299
1706
|
};
|