@byomakase/omakase-react-components 1.0.3 → 1.0.4
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.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +457 -455
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -80,22 +80,22 @@ function Kn(t, e, n, r) {
|
|
|
80
80
|
return new (n || (n = Promise))(function(o, s) {
|
|
81
81
|
function a(l) {
|
|
82
82
|
try {
|
|
83
|
-
|
|
83
|
+
c(r.next(l));
|
|
84
84
|
} catch (d) {
|
|
85
85
|
s(d);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function u(l) {
|
|
89
89
|
try {
|
|
90
|
-
|
|
90
|
+
c(r.throw(l));
|
|
91
91
|
} catch (d) {
|
|
92
92
|
s(d);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
l.done ? o(l.value) : i(l.value).then(a,
|
|
95
|
+
function c(l) {
|
|
96
|
+
l.done ? o(l.value) : i(l.value).then(a, u);
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
c((r = r.apply(t, e || [])).next());
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
function Qt(t, e) {
|
|
@@ -106,56 +106,56 @@ function Qt(t, e) {
|
|
|
106
106
|
return s.next = a(0), s.throw = a(1), s.return = a(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
107
107
|
return this;
|
|
108
108
|
}), s;
|
|
109
|
-
function a(
|
|
109
|
+
function a(c) {
|
|
110
110
|
return function(l) {
|
|
111
|
-
return
|
|
111
|
+
return u([c, l]);
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function c
|
|
114
|
+
function u(c) {
|
|
115
115
|
if (r) throw new TypeError("Generator is already executing.");
|
|
116
|
-
for (; s && (s = 0,
|
|
117
|
-
if (r = 1, i && (o =
|
|
118
|
-
switch (i = 0, o && (
|
|
116
|
+
for (; s && (s = 0, c[0] && (n = 0)), n; ) try {
|
|
117
|
+
if (r = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done) return o;
|
|
118
|
+
switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
|
|
119
119
|
case 0:
|
|
120
120
|
case 1:
|
|
121
|
-
o =
|
|
121
|
+
o = c;
|
|
122
122
|
break;
|
|
123
123
|
case 4:
|
|
124
|
-
return n.label++, { value:
|
|
124
|
+
return n.label++, { value: c[1], done: !1 };
|
|
125
125
|
case 5:
|
|
126
|
-
n.label++, i =
|
|
126
|
+
n.label++, i = c[1], c = [0];
|
|
127
127
|
continue;
|
|
128
128
|
case 7:
|
|
129
|
-
|
|
129
|
+
c = n.ops.pop(), n.trys.pop();
|
|
130
130
|
continue;
|
|
131
131
|
default:
|
|
132
|
-
if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (
|
|
132
|
+
if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
133
133
|
n = 0;
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
136
|
-
if (
|
|
137
|
-
n.label =
|
|
136
|
+
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
|
|
137
|
+
n.label = c[1];
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
141
|
-
n.label = o[1], o =
|
|
140
|
+
if (c[0] === 6 && n.label < o[1]) {
|
|
141
|
+
n.label = o[1], o = c;
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
if (o && n.label < o[2]) {
|
|
145
|
-
n.label = o[2], n.ops.push(
|
|
145
|
+
n.label = o[2], n.ops.push(c);
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
o[2] && n.ops.pop(), n.trys.pop();
|
|
149
149
|
continue;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
c = e.call(t, n);
|
|
152
152
|
} catch (l) {
|
|
153
|
-
|
|
153
|
+
c = [6, l], i = 0;
|
|
154
154
|
} finally {
|
|
155
155
|
r = o = 0;
|
|
156
156
|
}
|
|
157
|
-
if (
|
|
158
|
-
return { value:
|
|
157
|
+
if (c[0] & 5) throw c[1];
|
|
158
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
function Ce(t) {
|
|
@@ -206,29 +206,29 @@ function Hn(t, e, n) {
|
|
|
206
206
|
}
|
|
207
207
|
function a(h, v) {
|
|
208
208
|
r[h] && (i[h] = function(g) {
|
|
209
|
-
return new Promise(function(
|
|
210
|
-
o.push([h, g,
|
|
209
|
+
return new Promise(function(y, C) {
|
|
210
|
+
o.push([h, g, y, C]) > 1 || u(h, g);
|
|
211
211
|
});
|
|
212
212
|
}, v && (i[h] = v(i[h])));
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function u(h, v) {
|
|
215
215
|
try {
|
|
216
|
-
|
|
216
|
+
c(r[h](v));
|
|
217
217
|
} catch (g) {
|
|
218
218
|
f(o[0][3], g);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function c(h) {
|
|
222
222
|
h.value instanceof ye ? Promise.resolve(h.value.v).then(l, d) : f(o[0][2], h);
|
|
223
223
|
}
|
|
224
224
|
function l(h) {
|
|
225
|
-
|
|
225
|
+
u("next", h);
|
|
226
226
|
}
|
|
227
227
|
function d(h) {
|
|
228
|
-
|
|
228
|
+
u("throw", h);
|
|
229
229
|
}
|
|
230
230
|
function f(h, v) {
|
|
231
|
-
h(v), o.shift(), o.length &&
|
|
231
|
+
h(v), o.shift(), o.length && u(o[0][0], o[0][1]);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
function Pn(t) {
|
|
@@ -239,14 +239,14 @@ function Pn(t) {
|
|
|
239
239
|
}, n);
|
|
240
240
|
function r(o) {
|
|
241
241
|
n[o] = t[o] && function(s) {
|
|
242
|
-
return new Promise(function(a,
|
|
243
|
-
s = t[o](s), i(a,
|
|
242
|
+
return new Promise(function(a, u) {
|
|
243
|
+
s = t[o](s), i(a, u, s.done, s.value);
|
|
244
244
|
});
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
function i(o, s, a,
|
|
248
|
-
Promise.resolve(
|
|
249
|
-
o({ value:
|
|
247
|
+
function i(o, s, a, u) {
|
|
248
|
+
Promise.resolve(u).then(function(c) {
|
|
249
|
+
o({ value: c, done: a });
|
|
250
250
|
}, s);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -286,15 +286,15 @@ var We = function() {
|
|
|
286
286
|
if (s)
|
|
287
287
|
if (this._parentage = null, Array.isArray(s))
|
|
288
288
|
try {
|
|
289
|
-
for (var a = Ce(s),
|
|
290
|
-
var
|
|
291
|
-
|
|
289
|
+
for (var a = Ce(s), u = a.next(); !u.done; u = a.next()) {
|
|
290
|
+
var c = u.value;
|
|
291
|
+
c.remove(this);
|
|
292
292
|
}
|
|
293
293
|
} catch (g) {
|
|
294
294
|
e = { error: g };
|
|
295
295
|
} finally {
|
|
296
296
|
try {
|
|
297
|
-
|
|
297
|
+
u && !u.done && (n = a.return) && n.call(a);
|
|
298
298
|
} finally {
|
|
299
299
|
if (e) throw e.error;
|
|
300
300
|
}
|
|
@@ -315,7 +315,7 @@ var We = function() {
|
|
|
315
315
|
for (var f = Ce(d), h = f.next(); !h.done; h = f.next()) {
|
|
316
316
|
var v = h.value;
|
|
317
317
|
try {
|
|
318
|
-
|
|
318
|
+
At(v);
|
|
319
319
|
} catch (g) {
|
|
320
320
|
o = o ?? [], g instanceof nt ? o = Ue(Ue([], Pe(o)), Pe(g.errors)) : o.push(g);
|
|
321
321
|
}
|
|
@@ -337,7 +337,7 @@ var We = function() {
|
|
|
337
337
|
var n;
|
|
338
338
|
if (e && e !== this)
|
|
339
339
|
if (this.closed)
|
|
340
|
-
|
|
340
|
+
At(e);
|
|
341
341
|
else {
|
|
342
342
|
if (e instanceof t) {
|
|
343
343
|
if (e.closed || e._hasParent(this))
|
|
@@ -366,7 +366,7 @@ var We = function() {
|
|
|
366
366
|
function en(t) {
|
|
367
367
|
return t instanceof We || t && "closed" in t && B(t.remove) && B(t.add) && B(t.unsubscribe);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function At(t) {
|
|
370
370
|
B(t) ? t() : t.unsubscribe();
|
|
371
371
|
}
|
|
372
372
|
var Un = {
|
|
@@ -500,8 +500,8 @@ var j = function() {
|
|
|
500
500
|
}, t.prototype.subscribe = function(e, n, r) {
|
|
501
501
|
var i = this, o = jn(e) ? e : new st(e, n, r);
|
|
502
502
|
return Be(function() {
|
|
503
|
-
var s = i, a = s.operator,
|
|
504
|
-
o.add(a ? a.call(o,
|
|
503
|
+
var s = i, a = s.operator, u = s.source;
|
|
504
|
+
o.add(a ? a.call(o, u) : u ? i._subscribe(o) : i._trySubscribe(o));
|
|
505
505
|
}), o;
|
|
506
506
|
}, t.prototype._trySubscribe = function(e) {
|
|
507
507
|
try {
|
|
@@ -516,8 +516,8 @@ var j = function() {
|
|
|
516
516
|
next: function(a) {
|
|
517
517
|
try {
|
|
518
518
|
e(a);
|
|
519
|
-
} catch (
|
|
520
|
-
o(
|
|
519
|
+
} catch (u) {
|
|
520
|
+
o(u), s.unsubscribe();
|
|
521
521
|
}
|
|
522
522
|
},
|
|
523
523
|
error: o,
|
|
@@ -582,30 +582,30 @@ function fe(t, e, n, r, i) {
|
|
|
582
582
|
var Yn = function(t) {
|
|
583
583
|
Ie(e, t);
|
|
584
584
|
function e(n, r, i, o, s, a) {
|
|
585
|
-
var
|
|
586
|
-
return
|
|
585
|
+
var u = t.call(this, n) || this;
|
|
586
|
+
return u.onFinalize = s, u.shouldUnsubscribe = a, u._next = r ? function(c) {
|
|
587
587
|
try {
|
|
588
|
-
r(
|
|
588
|
+
r(c);
|
|
589
589
|
} catch (l) {
|
|
590
590
|
n.error(l);
|
|
591
591
|
}
|
|
592
|
-
} : t.prototype._next,
|
|
592
|
+
} : t.prototype._next, u._error = o ? function(c) {
|
|
593
593
|
try {
|
|
594
|
-
o(
|
|
594
|
+
o(c);
|
|
595
595
|
} catch (l) {
|
|
596
596
|
n.error(l);
|
|
597
597
|
} finally {
|
|
598
598
|
this.unsubscribe();
|
|
599
599
|
}
|
|
600
|
-
} : t.prototype._error,
|
|
600
|
+
} : t.prototype._error, u._complete = i ? function() {
|
|
601
601
|
try {
|
|
602
602
|
i();
|
|
603
|
-
} catch (
|
|
604
|
-
n.error(
|
|
603
|
+
} catch (c) {
|
|
604
|
+
n.error(c);
|
|
605
605
|
} finally {
|
|
606
606
|
this.unsubscribe();
|
|
607
607
|
}
|
|
608
|
-
} : t.prototype._complete,
|
|
608
|
+
} : t.prototype._complete, u;
|
|
609
609
|
}
|
|
610
610
|
return e.prototype.unsubscribe = function() {
|
|
611
611
|
var n;
|
|
@@ -638,11 +638,11 @@ var Yn = function(t) {
|
|
|
638
638
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
639
639
|
try {
|
|
640
640
|
for (var s = Ce(r.currentObservers), a = s.next(); !a.done; a = s.next()) {
|
|
641
|
-
var
|
|
642
|
-
|
|
641
|
+
var u = a.value;
|
|
642
|
+
u.next(n);
|
|
643
643
|
}
|
|
644
|
-
} catch (
|
|
645
|
-
i = { error:
|
|
644
|
+
} catch (c) {
|
|
645
|
+
i = { error: c };
|
|
646
646
|
} finally {
|
|
647
647
|
try {
|
|
648
648
|
a && !a.done && (o = s.return) && o.call(s);
|
|
@@ -865,27 +865,27 @@ function cr(t, e) {
|
|
|
865
865
|
var n, r, i, o;
|
|
866
866
|
return Kn(this, void 0, void 0, function() {
|
|
867
867
|
var s, a;
|
|
868
|
-
return Qt(this, function(
|
|
869
|
-
switch (
|
|
868
|
+
return Qt(this, function(u) {
|
|
869
|
+
switch (u.label) {
|
|
870
870
|
case 0:
|
|
871
|
-
|
|
871
|
+
u.trys.push([0, 5, 6, 11]), n = Pn(t), u.label = 1;
|
|
872
872
|
case 1:
|
|
873
873
|
return [4, n.next()];
|
|
874
874
|
case 2:
|
|
875
|
-
if (r =
|
|
875
|
+
if (r = u.sent(), !!r.done) return [3, 4];
|
|
876
876
|
if (s = r.value, e.next(s), e.closed)
|
|
877
877
|
return [2];
|
|
878
|
-
|
|
878
|
+
u.label = 3;
|
|
879
879
|
case 3:
|
|
880
880
|
return [3, 1];
|
|
881
881
|
case 4:
|
|
882
882
|
return [3, 11];
|
|
883
883
|
case 5:
|
|
884
|
-
return a =
|
|
884
|
+
return a = u.sent(), i = { error: a }, [3, 11];
|
|
885
885
|
case 6:
|
|
886
|
-
return
|
|
886
|
+
return u.trys.push([6, , 9, 10]), r && !r.done && (o = n.return) ? [4, o.call(n)] : [3, 8];
|
|
887
887
|
case 7:
|
|
888
|
-
|
|
888
|
+
u.sent(), u.label = 8;
|
|
889
889
|
case 8:
|
|
890
890
|
return [3, 10];
|
|
891
891
|
case 9:
|
|
@@ -1044,26 +1044,26 @@ function Cr(t) {
|
|
|
1044
1044
|
function Lr(t) {
|
|
1045
1045
|
return t && typeof t == "object" && Er(t) === Tr;
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function xr(t, e) {
|
|
1048
1048
|
return t.reduce(function(n, r, i) {
|
|
1049
1049
|
return n[r] = e[i], n;
|
|
1050
1050
|
}, {});
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function Ar() {
|
|
1053
1053
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
1054
1054
|
t[e] = arguments[e];
|
|
1055
1055
|
var n = nr(t), r = tr(t), i = Cr(t), o = i.args, s = i.keys;
|
|
1056
1056
|
if (o.length === 0)
|
|
1057
1057
|
return vn([], n);
|
|
1058
|
-
var a = new j(Mr(o, n, s ? function(
|
|
1059
|
-
return
|
|
1058
|
+
var a = new j(Mr(o, n, s ? function(u) {
|
|
1059
|
+
return xr(s, u);
|
|
1060
1060
|
} : Xe));
|
|
1061
1061
|
return r ? a.pipe(wr(r)) : a;
|
|
1062
1062
|
}
|
|
1063
1063
|
function Mr(t, e, n) {
|
|
1064
1064
|
return n === void 0 && (n = Xe), function(r) {
|
|
1065
1065
|
_t(e, function() {
|
|
1066
|
-
for (var i = t.length, o = new Array(i), s = i, a = i,
|
|
1066
|
+
for (var i = t.length, o = new Array(i), s = i, a = i, u = function(l) {
|
|
1067
1067
|
_t(e, function() {
|
|
1068
1068
|
var d = vn(t[l], e), f = !1;
|
|
1069
1069
|
d.subscribe(fe(r, function(h) {
|
|
@@ -1072,8 +1072,8 @@ function Mr(t, e, n) {
|
|
|
1072
1072
|
--s || r.complete();
|
|
1073
1073
|
}));
|
|
1074
1074
|
}, r);
|
|
1075
|
-
},
|
|
1076
|
-
c
|
|
1075
|
+
}, c = 0; c < i; c++)
|
|
1076
|
+
u(c);
|
|
1077
1077
|
}, r);
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
@@ -1191,7 +1191,7 @@ const no = w.memo(
|
|
|
1191
1191
|
}) => (Y(() => {
|
|
1192
1192
|
if (n.timelineHTMLElementId === void 0 && (n.timelineHTMLElementId = "omakase-timeline"), t.createTimeline(n).subscribe({
|
|
1193
1193
|
next: (i) => {
|
|
1194
|
-
|
|
1194
|
+
Ar([
|
|
1195
1195
|
t.timeline.onReady$,
|
|
1196
1196
|
t.video.onVideoLoaded$.pipe(Ir((o) => !!o))
|
|
1197
1197
|
]).subscribe({
|
|
@@ -1214,11 +1214,11 @@ const no = w.memo(
|
|
|
1214
1214
|
return (a = t.timeline) == null ? void 0 : a.zoomOutEased();
|
|
1215
1215
|
};
|
|
1216
1216
|
const o = (a) => {
|
|
1217
|
-
const
|
|
1218
|
-
(f) => f.id === (
|
|
1217
|
+
const u = t.audio.getAudioTracks(), c = t.audio.getActiveAudioTrack(), d = u.findIndex(
|
|
1218
|
+
(f) => f.id === (c == null ? void 0 : c.id)
|
|
1219
1219
|
) + (a ? -1 : 1);
|
|
1220
|
-
d >= 0 && d <
|
|
1221
|
-
|
|
1220
|
+
d >= 0 && d < u.length && t.audio.setActiveAudioTrack(
|
|
1221
|
+
u.at(d).id
|
|
1222
1222
|
);
|
|
1223
1223
|
};
|
|
1224
1224
|
i.actionTogglePreviousAudioTrack = () => o(!0), i.actionToggleNextAudioTrack = () => o(!1);
|
|
@@ -1263,7 +1263,7 @@ class wn {
|
|
|
1263
1263
|
this.window.open(e, n);
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
|
-
const
|
|
1266
|
+
const Ae = [0.25, 0.5, 0.75, 1, 2, 4, 8];
|
|
1267
1267
|
class Ot {
|
|
1268
1268
|
static getKeyboardShortcutsHelpMenuGroup() {
|
|
1269
1269
|
let e = (...o) => o.join(" + "), n = "shift".toUpperCase(), r = "ctrl".toUpperCase();
|
|
@@ -1343,18 +1343,18 @@ class Ot {
|
|
|
1343
1343
|
if (e.code === "KeyS" && !e.shiftKey && !e.ctrlKey && !e.metaKey)
|
|
1344
1344
|
return n.video.toggleMuteUnmute(), !0;
|
|
1345
1345
|
if (e.code === "Backslash") {
|
|
1346
|
-
let s = 10, a = e.shiftKey ? 1 : -1,
|
|
1347
|
-
|
|
1346
|
+
let s = 10, a = e.shiftKey ? 1 : -1, u = n.video.getVolume() * 100 + s * a;
|
|
1347
|
+
u >= 100 ? u = 100 : u <= 0 && (u = 0), n.video.setVolume(u / 100);
|
|
1348
1348
|
}
|
|
1349
1349
|
if (e.code === "KeyD" && !(e.ctrlKey && e.shiftKey && e.metaKey))
|
|
1350
1350
|
return n.subtitles.toggleShowHideActiveTrack(), !0;
|
|
1351
1351
|
if (e.code === "KeyK" && !e.ctrlKey && !e.shiftKey && !e.metaKey && (n.video.setPlaybackRate(1), n.video.pause()), e.code === "KeyL" && !e.ctrlKey && !e.metaKey) {
|
|
1352
1352
|
let s = e.shiftKey ? 1 : -1;
|
|
1353
|
-
const a =
|
|
1353
|
+
const a = Ae.indexOf(
|
|
1354
1354
|
n.video.getPlaybackRate()
|
|
1355
1355
|
) + s;
|
|
1356
|
-
let
|
|
1357
|
-
return a < 0 ?
|
|
1356
|
+
let u;
|
|
1357
|
+
return a < 0 ? u = Ae.at(0) : a >= Ae.length ? u = Ae.at(-1) : u = Ae.at(a), n.video.setPlaybackRate(u), n.video.isPaused() && n.video.play(), !0;
|
|
1358
1358
|
}
|
|
1359
1359
|
if (n.video.isVideoLoaded()) {
|
|
1360
1360
|
if (["ArrowLeft", "ArrowRight"].includes(e.key) && !e.metaKey && !e.altKey) {
|
|
@@ -1380,7 +1380,7 @@ const Dr = w.memo(function({
|
|
|
1380
1380
|
enableHotkeys: o
|
|
1381
1381
|
}) {
|
|
1382
1382
|
return n && (n == null ? void 0 : n.playerHTMLElementId) === void 0 && (n.playerHTMLElementId = "omakase-player"), Y(() => {
|
|
1383
|
-
var
|
|
1383
|
+
var u, c;
|
|
1384
1384
|
let s = new Fn(n);
|
|
1385
1385
|
const a = (l) => {
|
|
1386
1386
|
Ot.handleKeyboardEvent(
|
|
@@ -1388,7 +1388,7 @@ const Dr = w.memo(function({
|
|
|
1388
1388
|
s
|
|
1389
1389
|
) && (l.stopPropagation(), l.preventDefault());
|
|
1390
1390
|
};
|
|
1391
|
-
return (o === void 0 || o) && ((
|
|
1391
|
+
return (o === void 0 || o) && ((u = document.querySelector("media-controller")) == null || u.setAttribute("nohotkeys", ""), (c = document.querySelector("media-controller")) == null || c.setAttribute("tabindex", "-1"), window.addEventListener("keydown", a), s.video.appendHelpMenuGroup(
|
|
1392
1392
|
Ot.getKeyboardShortcutsHelpMenuGroup()
|
|
1393
1393
|
)), s.loadVideo(e, r).subscribe({
|
|
1394
1394
|
next: (l) => {
|
|
@@ -1745,9 +1745,9 @@ const ke = (t, e, n) => t.getMarkers().reduce((r, i) => {
|
|
|
1745
1745
|
if (e.id === i.id)
|
|
1746
1746
|
return r;
|
|
1747
1747
|
if (i instanceof H && i.timeObservation.start != null && i.timeObservation.end != null) {
|
|
1748
|
-
const o = e.timeObservation, s = i.timeObservation.start, a = i.timeObservation.end,
|
|
1749
|
-
if (
|
|
1750
|
-
return r ||
|
|
1748
|
+
const o = e.timeObservation, s = i.timeObservation.start, a = i.timeObservation.end, u = o.start, c = n ?? o.end;
|
|
1749
|
+
if (u != null && c != null)
|
|
1750
|
+
return r || u <= a && c >= s;
|
|
1751
1751
|
}
|
|
1752
1752
|
return r;
|
|
1753
1753
|
}, !1);
|
|
@@ -1772,19 +1772,19 @@ const ro = ({
|
|
|
1772
1772
|
setSegmentationLanes: o,
|
|
1773
1773
|
setSelectedMarker: s,
|
|
1774
1774
|
onMarkerClickCallback: a,
|
|
1775
|
-
setSource:
|
|
1776
|
-
source:
|
|
1775
|
+
setSource: u,
|
|
1776
|
+
source: c,
|
|
1777
1777
|
constants: l
|
|
1778
1778
|
}) => {
|
|
1779
|
-
const d = tt(void 0), f = tt(void 0), h = new ge(), v = tt(!1), g = (p, b,
|
|
1779
|
+
const d = tt(void 0), f = tt(void 0), h = new ge(), v = tt(!1), g = (p, b, L) => {
|
|
1780
1780
|
const O = b ?? e.video.getCurrentTime();
|
|
1781
|
-
return p.getMarkers().reduce((I, W) => W instanceof H && W.timeObservation.start !== void 0 && W.timeObservation.end !== void 0 && W.id !== (
|
|
1782
|
-
},
|
|
1781
|
+
return p.getMarkers().reduce((I, W) => W instanceof H && W.timeObservation.start !== void 0 && W.timeObservation.end !== void 0 && W.id !== (L == null ? void 0 : L.id) ? I || O >= W.timeObservation.start && O <= W.timeObservation.end : I, !1);
|
|
1782
|
+
}, y = (p) => {
|
|
1783
1783
|
if (M === void 0)
|
|
1784
1784
|
return !0;
|
|
1785
|
-
const b = M.timeObservation.start,
|
|
1786
|
-
return !!(b == null || b >=
|
|
1787
|
-
},
|
|
1785
|
+
const b = M.timeObservation.start, L = p ?? e.video.getCurrentTime();
|
|
1786
|
+
return !!(b == null || b >= L || ke(c, M, L));
|
|
1787
|
+
}, C = (p) => M !== void 0 || c === void 0 ? !0 : g(c, p, M), [D, A] = pe(void 0), [k, P] = pe(
|
|
1788
1788
|
Re(
|
|
1789
1789
|
t,
|
|
1790
1790
|
e.video.getCurrentTime(),
|
|
@@ -1793,30 +1793,30 @@ const ro = ({
|
|
|
1793
1793
|
), [M, te] = pe(
|
|
1794
1794
|
void 0
|
|
1795
1795
|
), [me, G] = pe(
|
|
1796
|
-
|
|
1796
|
+
y()
|
|
1797
1797
|
), [we, K] = pe(
|
|
1798
|
-
|
|
1798
|
+
C()
|
|
1799
1799
|
), ie = (p) => {
|
|
1800
|
-
if (p === void 0 ||
|
|
1800
|
+
if (p === void 0 || c === void 0 || !(p instanceof H))
|
|
1801
1801
|
return !0;
|
|
1802
1802
|
const b = ke(
|
|
1803
|
-
|
|
1803
|
+
c,
|
|
1804
1804
|
p,
|
|
1805
1805
|
e.video.getCurrentTime()
|
|
1806
1806
|
);
|
|
1807
1807
|
if (b)
|
|
1808
1808
|
return b;
|
|
1809
1809
|
if (p instanceof H) {
|
|
1810
|
-
const
|
|
1811
|
-
if (
|
|
1810
|
+
const L = p.timeObservation.end;
|
|
1811
|
+
if (L != null && e.video.getCurrentTime() >= L)
|
|
1812
1812
|
return !0;
|
|
1813
1813
|
}
|
|
1814
1814
|
return !1;
|
|
1815
1815
|
}, oe = (p) => {
|
|
1816
|
-
if (p === void 0 ||
|
|
1816
|
+
if (p === void 0 || c === void 0 || !(p instanceof H))
|
|
1817
1817
|
return !0;
|
|
1818
1818
|
const b = ke(
|
|
1819
|
-
|
|
1819
|
+
c,
|
|
1820
1820
|
p,
|
|
1821
1821
|
e.video.getCurrentTime()
|
|
1822
1822
|
);
|
|
@@ -1825,14 +1825,14 @@ const ro = ({
|
|
|
1825
1825
|
if (p instanceof H) {
|
|
1826
1826
|
if (p.timeObservation.end == null)
|
|
1827
1827
|
return !0;
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1828
|
+
const L = p.timeObservation.start;
|
|
1829
|
+
if (L != null && e.video.getCurrentTime() <= L)
|
|
1830
1830
|
return !0;
|
|
1831
1831
|
}
|
|
1832
1832
|
return !1;
|
|
1833
1833
|
}, [Se, V] = pe(ie(t)), [_, Qe] = pe(oe(t));
|
|
1834
1834
|
Y(() => {
|
|
1835
|
-
if (G(() =>
|
|
1835
|
+
if (G(() => y()), K(() => C()), M && M !== t) {
|
|
1836
1836
|
const p = i.find(
|
|
1837
1837
|
(b) => b.getMarker(M.id)
|
|
1838
1838
|
);
|
|
@@ -1851,11 +1851,11 @@ const ro = ({
|
|
|
1851
1851
|
);
|
|
1852
1852
|
P(p);
|
|
1853
1853
|
const b = e.video.onVideoTimeChange$.pipe(Z(h)).subscribe({
|
|
1854
|
-
next: (
|
|
1854
|
+
next: (L) => {
|
|
1855
1855
|
P(
|
|
1856
1856
|
(O) => Re(
|
|
1857
1857
|
t,
|
|
1858
|
-
|
|
1858
|
+
L.currentTime,
|
|
1859
1859
|
e
|
|
1860
1860
|
)
|
|
1861
1861
|
), V(
|
|
@@ -1871,22 +1871,22 @@ const ro = ({
|
|
|
1871
1871
|
e.video.onSeeking$.pipe(Z(h)).subscribe({
|
|
1872
1872
|
next: (b) => {
|
|
1873
1873
|
G(
|
|
1874
|
-
() =>
|
|
1874
|
+
() => y(b.toTime)
|
|
1875
1875
|
), K(
|
|
1876
|
-
() =>
|
|
1876
|
+
() => C(b.toTime)
|
|
1877
1877
|
);
|
|
1878
1878
|
}
|
|
1879
1879
|
});
|
|
1880
1880
|
const p = e.video.onVideoTimeChange$.pipe(Z(h)).subscribe({
|
|
1881
1881
|
next: (b) => {
|
|
1882
|
-
G(() =>
|
|
1882
|
+
G(() => y()), K(() => C());
|
|
1883
1883
|
}
|
|
1884
1884
|
});
|
|
1885
1885
|
return () => p.unsubscribe();
|
|
1886
|
-
}, [M,
|
|
1886
|
+
}, [M, c]), Y(() => {
|
|
1887
1887
|
const p = i.map((b) => b.onMarkerUpdate$.pipe(Z(h)).subscribe({
|
|
1888
|
-
next: (
|
|
1889
|
-
(t == null ? void 0 : t.id) ===
|
|
1888
|
+
next: (L) => {
|
|
1889
|
+
(t == null ? void 0 : t.id) === L.marker.id && (P(
|
|
1890
1890
|
(O) => Re(
|
|
1891
1891
|
t,
|
|
1892
1892
|
e.video.getCurrentTime(),
|
|
@@ -1906,14 +1906,14 @@ const ro = ({
|
|
|
1906
1906
|
color: D.color
|
|
1907
1907
|
}, D.marker.timeObservation = {
|
|
1908
1908
|
...D.marker.timeObservation
|
|
1909
|
-
},
|
|
1909
|
+
}, A(void 0));
|
|
1910
1910
|
}, [t]), Y(() => {
|
|
1911
|
-
if (
|
|
1912
|
-
G(() =>
|
|
1913
|
-
const p =
|
|
1914
|
-
next: (
|
|
1915
|
-
const O =
|
|
1916
|
-
|
|
1911
|
+
if (c) {
|
|
1912
|
+
G(() => y()), K(() => C());
|
|
1913
|
+
const p = c.onMarkerDelete$.pipe(Z(h)).subscribe({
|
|
1914
|
+
next: (L) => {
|
|
1915
|
+
const O = L.marker;
|
|
1916
|
+
A((I) => {
|
|
1917
1917
|
if ((I == null ? void 0 : I.marker.id) !== O.id)
|
|
1918
1918
|
return I;
|
|
1919
1919
|
}), s((I) => {
|
|
@@ -1922,28 +1922,28 @@ const ro = ({
|
|
|
1922
1922
|
}), te((I) => {
|
|
1923
1923
|
if ((I == null ? void 0 : I.id) !== O.id)
|
|
1924
1924
|
return I;
|
|
1925
|
-
}), G(() =>
|
|
1925
|
+
}), G(() => y()), K(() => C());
|
|
1926
1926
|
}
|
|
1927
|
-
}), b =
|
|
1927
|
+
}), b = c.onMarkerUpdate$.pipe(Z(h)).subscribe({
|
|
1928
1928
|
next: () => {
|
|
1929
|
-
G(() =>
|
|
1929
|
+
G(() => y()), K(() => C());
|
|
1930
1930
|
}
|
|
1931
1931
|
});
|
|
1932
1932
|
return () => {
|
|
1933
1933
|
p.unsubscribe(), b.unsubscribe();
|
|
1934
1934
|
};
|
|
1935
1935
|
}
|
|
1936
|
-
}, [
|
|
1936
|
+
}, [c]);
|
|
1937
1937
|
const gt = (p, b) => {
|
|
1938
1938
|
if (b === void 0)
|
|
1939
1939
|
return;
|
|
1940
|
-
const
|
|
1941
|
-
p.video.seekToTime(
|
|
1940
|
+
const L = b.timeObservation;
|
|
1941
|
+
p.video.seekToTime(L.start);
|
|
1942
1942
|
}, vt = (p, b) => {
|
|
1943
1943
|
if (b === void 0)
|
|
1944
1944
|
return;
|
|
1945
|
-
const
|
|
1946
|
-
p.video.seekToTime(
|
|
1945
|
+
const L = b.timeObservation;
|
|
1946
|
+
p.video.seekToTime(L.end);
|
|
1947
1947
|
}, bt = (p, b) => {
|
|
1948
1948
|
b instanceof H && b.timeObservation.start !== void 0 && (b.timeObservation = {
|
|
1949
1949
|
...b.timeObservation,
|
|
@@ -1956,37 +1956,37 @@ const ro = ({
|
|
|
1956
1956
|
});
|
|
1957
1957
|
}, St = (p, b) => {
|
|
1958
1958
|
d.current && Q(d.current), d.current = new ge(), p.video.pause();
|
|
1959
|
-
const
|
|
1959
|
+
const L = p.video.getCurrentFrame(), O = p.video.getFrameRate(), I = L - b * O, W = I >= 0 ? I : 0;
|
|
1960
1960
|
p.video.seekToFrame(W).pipe(Ee()).subscribe(() => {
|
|
1961
1961
|
}), p.video.play(), p.video.onVideoTimeChange$.pipe(Z(d.current), Z(h)).subscribe((Oe) => {
|
|
1962
|
-
Oe.frame >=
|
|
1963
|
-
p.video.seekToFrame(
|
|
1962
|
+
Oe.frame >= L - 1 && (p.video.pause().subscribe(() => {
|
|
1963
|
+
p.video.seekToFrame(L).pipe(Ee()).subscribe(() => {
|
|
1964
1964
|
});
|
|
1965
1965
|
}), Q(d.current));
|
|
1966
1966
|
});
|
|
1967
1967
|
}, Et = (p, b) => {
|
|
1968
1968
|
d.current && Q(d.current), d.current = new ge(), f.current && Q(f.current), f.current = new ge();
|
|
1969
|
-
const
|
|
1969
|
+
const L = p.video.getCurrentFrame(), O = p.video.getFrameRate(), I = L + b * O;
|
|
1970
1970
|
p.video.play(), p.video.onVideoTimeChange$.pipe(Z(d.current), Z(h)).subscribe((W) => {
|
|
1971
1971
|
W.frame >= I - 1 && (p.video.pause().subscribe(() => {
|
|
1972
|
-
p.video.seekToFrame(
|
|
1972
|
+
p.video.seekToFrame(L).pipe(Ee()).subscribe(() => {
|
|
1973
1973
|
});
|
|
1974
1974
|
}), Q(d.current));
|
|
1975
1975
|
}), p.video.onEnded$.pipe(Z(f.current), Z(h)).subscribe((W) => {
|
|
1976
1976
|
setTimeout(() => {
|
|
1977
|
-
p.video.seekToFrame(
|
|
1977
|
+
p.video.seekToFrame(L).pipe(Ee()).subscribe(() => {
|
|
1978
1978
|
});
|
|
1979
1979
|
}, 1), Q(f.current);
|
|
1980
1980
|
});
|
|
1981
1981
|
}, Je = (p) => {
|
|
1982
|
-
|
|
1982
|
+
c.removeMarker(p.id), (M == null ? void 0 : M.id) === p.id && te(void 0);
|
|
1983
1983
|
}, Tt = (p, b) => {
|
|
1984
1984
|
if (!(b instanceof H))
|
|
1985
1985
|
return;
|
|
1986
|
-
const
|
|
1987
|
-
if (
|
|
1986
|
+
const L = b.timeObservation.start, O = b.timeObservation.end, I = p.video.getCurrentTime();
|
|
1987
|
+
if (L == null || O == null)
|
|
1988
1988
|
return;
|
|
1989
|
-
const W =
|
|
1989
|
+
const W = L, Oe = I, Nn = Oe + 1 / p.video.getFrameRate(), kn = O;
|
|
1990
1990
|
Je(b);
|
|
1991
1991
|
const et = new H({
|
|
1992
1992
|
style: l.PERIOD_MARKER_STYLE,
|
|
@@ -1999,7 +1999,7 @@ const ro = ({
|
|
|
1999
1999
|
et.onClick$.subscribe({
|
|
2000
2000
|
next: () => a(et)
|
|
2001
2001
|
});
|
|
2002
|
-
const
|
|
2002
|
+
const xe = new H({
|
|
2003
2003
|
style: l.HIGHLIGHTED_PERIOD_MARKER_STYLE,
|
|
2004
2004
|
timeObservation: {
|
|
2005
2005
|
start: Nn,
|
|
@@ -2007,11 +2007,11 @@ const ro = ({
|
|
|
2007
2007
|
},
|
|
2008
2008
|
editable: !0
|
|
2009
2009
|
});
|
|
2010
|
-
|
|
2011
|
-
next: () => a(
|
|
2012
|
-
}),
|
|
2013
|
-
|
|
2014
|
-
marker:
|
|
2010
|
+
xe.onClick$.subscribe({
|
|
2011
|
+
next: () => a(xe)
|
|
2012
|
+
}), c.addMarker(et), c.addMarker(xe), a(xe), setTimeout(() => {
|
|
2013
|
+
A({
|
|
2014
|
+
marker: xe,
|
|
2015
2015
|
color: l.PERIOD_MARKER_STYLE.color
|
|
2016
2016
|
});
|
|
2017
2017
|
}, 0);
|
|
@@ -2025,7 +2025,7 @@ const ro = ({
|
|
|
2025
2025
|
});
|
|
2026
2026
|
b.onClick$.subscribe({
|
|
2027
2027
|
next: () => a(b)
|
|
2028
|
-
}),
|
|
2028
|
+
}), c.addMarker(b), te(b), G(y()), a(b);
|
|
2029
2029
|
}, Ct = () => {
|
|
2030
2030
|
const p = e.video.getCurrentTime();
|
|
2031
2031
|
M.timeObservation = {
|
|
@@ -2036,11 +2036,11 @@ const ro = ({
|
|
|
2036
2036
|
d.current && Q(d.current), d.current = new ge(), f.current && Q(f.current), f.current = new ge();
|
|
2037
2037
|
const b = e.video.calculateTimeToFrame(
|
|
2038
2038
|
p.timeObservation.start
|
|
2039
|
-
),
|
|
2039
|
+
), L = e.video.calculateTimeToFrame(
|
|
2040
2040
|
p.timeObservation.end
|
|
2041
2041
|
);
|
|
2042
2042
|
e.video.pause(), e.video.seekToFrame(b), e.video.play(), e.video.onVideoTimeChange$.pipe(Z(d.current), Z(h)).subscribe((O) => {
|
|
2043
|
-
O.frame >=
|
|
2043
|
+
O.frame >= L - 1 && (e.video.pause().subscribe(() => {
|
|
2044
2044
|
e.video.seekToFrame(b).pipe(Ee()).subscribe(() => {
|
|
2045
2045
|
});
|
|
2046
2046
|
}), Q(d.current));
|
|
@@ -2051,25 +2051,25 @@ const ro = ({
|
|
|
2051
2051
|
}, 1), Q(f.current);
|
|
2052
2052
|
});
|
|
2053
2053
|
}, On = () => {
|
|
2054
|
-
const p = i.length, b = `Segmentation ${i.length + 1}`,
|
|
2054
|
+
const p = i.length, b = `Segmentation ${i.length + 1}`, L = new Yt({
|
|
2055
2055
|
style: l.TIMELINE_LANE_STYLE,
|
|
2056
2056
|
description: b
|
|
2057
2057
|
});
|
|
2058
|
-
|
|
2058
|
+
L.onMarkerUpdate$.subscribe({
|
|
2059
2059
|
next: (O) => {
|
|
2060
2060
|
ke(
|
|
2061
|
-
|
|
2061
|
+
L,
|
|
2062
2062
|
O.marker
|
|
2063
2063
|
) && (O.marker.timeObservation = O.oldValue.timeObservation);
|
|
2064
2064
|
}
|
|
2065
2065
|
}), e.timeline.addTimelineLaneAtIndex(
|
|
2066
|
-
|
|
2066
|
+
L,
|
|
2067
2067
|
p + 1
|
|
2068
|
-
), o([...i,
|
|
2069
|
-
},
|
|
2070
|
-
if (!
|
|
2068
|
+
), o([...i, L]), a(void 0), u(L);
|
|
2069
|
+
}, xt = (p) => {
|
|
2070
|
+
if (!c)
|
|
2071
2071
|
return;
|
|
2072
|
-
const b =
|
|
2072
|
+
const b = c.getMarkers().filter((I) => I instanceof H).sort((I, W) => I.timeObservation.start ?? 0 - (W.timeObservation.start ?? 0));
|
|
2073
2073
|
if (t === void 0) {
|
|
2074
2074
|
a(b.at(0));
|
|
2075
2075
|
return;
|
|
@@ -2085,9 +2085,9 @@ const ro = ({
|
|
|
2085
2085
|
const p = new Gr();
|
|
2086
2086
|
p.actionLoopActiveMarker = () => t instanceof H && De(t) && Lt(t), p.actionSetPlayheadToMarkerStart = () => t && gt(e, t), p.actionSetPlayheadToMarkerEnd = () => t && t instanceof H && De(t) && vt(e, t), p.actionSetMarkerStartToPlayhead = () => !Se && bt(e, t), p.actionSetMarkerEndToPlayhead = () => !_ && wt(e, t), p.actionMarkerSplit = () => !k && Tt(e, t), p.actionMarkerDelete = () => t && Je(t), p.actionMarkerInOut = () => {
|
|
2087
2087
|
M === void 0 ? !we && yt() : !me && Ct();
|
|
2088
|
-
}, p.actionPlay3SecondsAndRewindToCurrent = () => Et(e, 3), p.actionRewind3SecondsAndPlayToCurrent = () => St(e, 3), p.actionNextMarkerToggle = () =>
|
|
2089
|
-
const b = (
|
|
2090
|
-
p.handleKeyboardEvent(
|
|
2088
|
+
}, p.actionPlay3SecondsAndRewindToCurrent = () => Et(e, 3), p.actionRewind3SecondsAndPlayToCurrent = () => St(e, 3), p.actionNextMarkerToggle = () => xt(!1), p.actionPreviousMarkerToggle = () => xt(!0);
|
|
2089
|
+
const b = (L) => {
|
|
2090
|
+
p.handleKeyboardEvent(L, e) && (L.stopPropagation(), L.preventDefault());
|
|
2091
2091
|
};
|
|
2092
2092
|
return window.addEventListener("keydown", b), v.current || (e.video.appendHelpMenuGroup(
|
|
2093
2093
|
p.getKeyboardShortcutsHelpMenuGroup()
|
|
@@ -2266,7 +2266,7 @@ var Te = 9e15, he = 1e9, at = "0123456789abcdef", $e = "2.3025850929940456840179
|
|
|
2266
2266
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
2267
2267
|
crypto: !1
|
|
2268
2268
|
// true/false
|
|
2269
|
-
}, Sn, se,
|
|
2269
|
+
}, Sn, se, x = !0, je = "[DecimalError] ", le = je + "Invalid argument: ", En = je + "Precision limit exceeded", Tn = je + "crypto unavailable", yn = "[object Decimal]", q = Math.floor, F = Math.pow, jr = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, zr = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Yr = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Cn = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ee = 1e7, T = 7, Qr = 9007199254740991, Jr = $e.length - 1, ct = Ze.length - 1, m = { toStringTag: yn };
|
|
2270
2270
|
m.absoluteValue = m.abs = function() {
|
|
2271
2271
|
var t = new this.constructor(this);
|
|
2272
2272
|
return t.s < 0 && (t.s = 1), E(t);
|
|
@@ -2281,25 +2281,25 @@ m.clampedTo = m.clamp = function(t, e) {
|
|
|
2281
2281
|
return n = r.cmp(t), n < 0 ? t : r.cmp(e) > 0 ? e : new i(r);
|
|
2282
2282
|
};
|
|
2283
2283
|
m.comparedTo = m.cmp = function(t) {
|
|
2284
|
-
var e, n, r, i, o = this, s = o.d, a = (t = new o.constructor(t)).d,
|
|
2284
|
+
var e, n, r, i, o = this, s = o.d, a = (t = new o.constructor(t)).d, u = o.s, c = t.s;
|
|
2285
2285
|
if (!s || !a)
|
|
2286
|
-
return !
|
|
2287
|
-
if (!s[0] || !a[0]) return s[0] ?
|
|
2288
|
-
if (
|
|
2289
|
-
if (o.e !== t.e) return o.e > t.e ^
|
|
2286
|
+
return !u || !c ? NaN : u !== c ? u : s === a ? 0 : !s ^ u < 0 ? 1 : -1;
|
|
2287
|
+
if (!s[0] || !a[0]) return s[0] ? u : a[0] ? -c : 0;
|
|
2288
|
+
if (u !== c) return u;
|
|
2289
|
+
if (o.e !== t.e) return o.e > t.e ^ u < 0 ? 1 : -1;
|
|
2290
2290
|
for (r = s.length, i = a.length, e = 0, n = r < i ? r : i; e < n; ++e)
|
|
2291
|
-
if (s[e] !== a[e]) return s[e] > a[e] ^
|
|
2292
|
-
return r === i ? 0 : r > i ^
|
|
2291
|
+
if (s[e] !== a[e]) return s[e] > a[e] ^ u < 0 ? 1 : -1;
|
|
2292
|
+
return r === i ? 0 : r > i ^ u < 0 ? 1 : -1;
|
|
2293
2293
|
};
|
|
2294
2294
|
m.cosine = m.cos = function() {
|
|
2295
2295
|
var t, e, n = this, r = n.constructor;
|
|
2296
2296
|
return n.d ? n.d[0] ? (t = r.precision, e = r.rounding, r.precision = t + Math.max(n.e, n.sd()) + T, r.rounding = 1, n = ei(r, In(r, n)), r.precision = t, r.rounding = e, E(se == 2 || se == 3 ? n.neg() : n, t, e, !0)) : new r(1) : new r(NaN);
|
|
2297
2297
|
};
|
|
2298
2298
|
m.cubeRoot = m.cbrt = function() {
|
|
2299
|
-
var t, e, n, r, i, o, s, a,
|
|
2299
|
+
var t, e, n, r, i, o, s, a, u, c, l = this, d = l.constructor;
|
|
2300
2300
|
if (!l.isFinite() || l.isZero()) return new d(l);
|
|
2301
|
-
for (
|
|
2302
|
-
if (a = r,
|
|
2301
|
+
for (x = !1, o = l.s * F(l.s * l, 1 / 3), !o || Math.abs(o) == 1 / 0 ? (n = $(l.d), t = l.e, (o = (t - n.length + 1) % 3) && (n += o == 1 || o == -2 ? "0" : "00"), o = F(n, 1 / 3), t = q((t + 1) / 3) - (t % 3 == (t < 0 ? -1 : 2)), o == 1 / 0 ? n = "5e" + t : (n = o.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + t), r = new d(n), r.s = l.s) : r = new d(o.toString()), s = (t = d.precision) + 3; ; )
|
|
2302
|
+
if (a = r, u = a.times(a).times(a), c = u.plus(l), r = N(c.plus(l).times(a), c.plus(u), s + 2, 1), $(a.d).slice(0, s) === (n = $(r.d)).slice(0, s))
|
|
2303
2303
|
if (n = n.slice(s - 3, s + 1), n == "9999" || !i && n == "4999") {
|
|
2304
2304
|
if (!i && (E(a, t + 1, 0), a.times(a).times(a).eq(l))) {
|
|
2305
2305
|
r = a;
|
|
@@ -2310,7 +2310,7 @@ m.cubeRoot = m.cbrt = function() {
|
|
|
2310
2310
|
(!+n || !+n.slice(1) && n.charAt(0) == "5") && (E(r, t + 1, 1), e = !r.times(r).times(r).eq(l));
|
|
2311
2311
|
break;
|
|
2312
2312
|
}
|
|
2313
|
-
return
|
|
2313
|
+
return x = !0, E(r, t, d.rounding, e);
|
|
2314
2314
|
};
|
|
2315
2315
|
m.decimalPlaces = m.dp = function() {
|
|
2316
2316
|
var t, e = this.d, n = NaN;
|
|
@@ -2345,8 +2345,8 @@ m.hyperbolicCosine = m.cosh = function() {
|
|
|
2345
2345
|
if (!o.isFinite()) return new s(o.s ? 1 / 0 : NaN);
|
|
2346
2346
|
if (o.isZero()) return a;
|
|
2347
2347
|
n = s.precision, r = s.rounding, s.precision = n + Math.max(o.e, o.sd()) + 4, s.rounding = 1, i = o.d.length, i < 32 ? (t = Math.ceil(i / 3), e = (1 / Ye(4, t)).toString()) : (t = 16, e = "2.3283064365386962890625e-10"), o = Le(s, 1, o.times(e), new s(1), !0);
|
|
2348
|
-
for (var
|
|
2349
|
-
|
|
2348
|
+
for (var u, c = t, l = new s(8); c--; )
|
|
2349
|
+
u = o.times(o), o = a.minus(u.times(l.minus(u.times(l))));
|
|
2350
2350
|
return E(o, s.precision = n, s.rounding = r, !0);
|
|
2351
2351
|
};
|
|
2352
2352
|
m.hyperbolicSine = m.sinh = function() {
|
|
@@ -2356,8 +2356,8 @@ m.hyperbolicSine = m.sinh = function() {
|
|
|
2356
2356
|
i = Le(o, 2, i, i, !0);
|
|
2357
2357
|
else {
|
|
2358
2358
|
t = 1.4 * Math.sqrt(r), t = t > 16 ? 16 : t | 0, i = i.times(1 / Ye(5, t)), i = Le(o, 2, i, i, !0);
|
|
2359
|
-
for (var s, a = new o(5),
|
|
2360
|
-
s = i.times(i), i = i.times(a.plus(s.times(
|
|
2359
|
+
for (var s, a = new o(5), u = new o(16), c = new o(20); t--; )
|
|
2360
|
+
s = i.times(i), i = i.times(a.plus(s.times(u.times(s).plus(c))));
|
|
2361
2361
|
}
|
|
2362
2362
|
return o.precision = e, o.rounding = n, E(i, e, n, !0);
|
|
2363
2363
|
};
|
|
@@ -2371,11 +2371,11 @@ m.inverseCosine = m.acos = function() {
|
|
|
2371
2371
|
};
|
|
2372
2372
|
m.inverseHyperbolicCosine = m.acosh = function() {
|
|
2373
2373
|
var t, e, n = this, r = n.constructor;
|
|
2374
|
-
return n.lte(1) ? new r(n.eq(1) ? 0 : NaN) : n.isFinite() ? (t = r.precision, e = r.rounding, r.precision = t + Math.max(Math.abs(n.e), n.sd()) + 4, r.rounding = 1,
|
|
2374
|
+
return n.lte(1) ? new r(n.eq(1) ? 0 : NaN) : n.isFinite() ? (t = r.precision, e = r.rounding, r.precision = t + Math.max(Math.abs(n.e), n.sd()) + 4, r.rounding = 1, x = !1, n = n.times(n).minus(1).sqrt().plus(n), x = !0, r.precision = t, r.rounding = e, n.ln()) : new r(n);
|
|
2375
2375
|
};
|
|
2376
2376
|
m.inverseHyperbolicSine = m.asinh = function() {
|
|
2377
2377
|
var t, e, n = this, r = n.constructor;
|
|
2378
|
-
return !n.isFinite() || n.isZero() ? new r(n) : (t = r.precision, e = r.rounding, r.precision = t + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, r.rounding = 1,
|
|
2378
|
+
return !n.isFinite() || n.isZero() ? new r(n) : (t = r.precision, e = r.rounding, r.precision = t + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, r.rounding = 1, x = !1, n = n.times(n).plus(1).sqrt().plus(n), x = !0, r.precision = t, r.rounding = e, n.ln());
|
|
2379
2379
|
};
|
|
2380
2380
|
m.inverseHyperbolicTangent = m.atanh = function() {
|
|
2381
2381
|
var t, e, n, r, i = this, o = i.constructor;
|
|
@@ -2386,21 +2386,21 @@ m.inverseSine = m.asin = function() {
|
|
|
2386
2386
|
return i.isZero() ? new o(i) : (e = i.abs().cmp(1), n = o.precision, r = o.rounding, e !== -1 ? e === 0 ? (t = ne(o, n + 4, r).times(0.5), t.s = i.s, t) : new o(NaN) : (o.precision = n + 6, o.rounding = 1, i = i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(), o.precision = n, o.rounding = r, i.times(2)));
|
|
2387
2387
|
};
|
|
2388
2388
|
m.inverseTangent = m.atan = function() {
|
|
2389
|
-
var t, e, n, r, i, o, s, a,
|
|
2390
|
-
if (
|
|
2391
|
-
if (
|
|
2392
|
-
return new l(
|
|
2393
|
-
if (
|
|
2394
|
-
return s = ne(l, d + 4, f).times(0.25), s.s =
|
|
2389
|
+
var t, e, n, r, i, o, s, a, u, c = this, l = c.constructor, d = l.precision, f = l.rounding;
|
|
2390
|
+
if (c.isFinite()) {
|
|
2391
|
+
if (c.isZero())
|
|
2392
|
+
return new l(c);
|
|
2393
|
+
if (c.abs().eq(1) && d + 4 <= ct)
|
|
2394
|
+
return s = ne(l, d + 4, f).times(0.25), s.s = c.s, s;
|
|
2395
2395
|
} else {
|
|
2396
|
-
if (!
|
|
2396
|
+
if (!c.s) return new l(NaN);
|
|
2397
2397
|
if (d + 4 <= ct)
|
|
2398
|
-
return s = ne(l, d + 4, f).times(0.5), s.s =
|
|
2398
|
+
return s = ne(l, d + 4, f).times(0.5), s.s = c.s, s;
|
|
2399
2399
|
}
|
|
2400
|
-
for (l.precision = a = d + 10, l.rounding = 1, n = Math.min(28, a / T + 2 | 0), t = n; t; --t)
|
|
2401
|
-
for (
|
|
2402
|
-
if (i = i.times(
|
|
2403
|
-
return n && (s = s.times(2 << n - 1)),
|
|
2400
|
+
for (l.precision = a = d + 10, l.rounding = 1, n = Math.min(28, a / T + 2 | 0), t = n; t; --t) c = c.div(c.times(c).plus(1).sqrt().plus(1));
|
|
2401
|
+
for (x = !1, e = Math.ceil(a / T), r = 1, u = c.times(c), s = new l(c), i = c; t !== -1; )
|
|
2402
|
+
if (i = i.times(u), o = s.minus(i.div(r += 2)), i = i.times(u), s = o.plus(i.div(r += 2)), s.d[e] !== void 0) for (t = e; s.d[t] === o.d[t] && t--; ) ;
|
|
2403
|
+
return n && (s = s.times(2 << n - 1)), x = !0, E(s, l.precision = d, l.rounding = f, !0);
|
|
2404
2404
|
};
|
|
2405
2405
|
m.isFinite = function() {
|
|
2406
2406
|
return !!this.d;
|
|
@@ -2427,15 +2427,15 @@ m.lessThanOrEqualTo = m.lte = function(t) {
|
|
|
2427
2427
|
return this.cmp(t) < 1;
|
|
2428
2428
|
};
|
|
2429
2429
|
m.logarithm = m.log = function(t) {
|
|
2430
|
-
var e, n, r, i, o, s, a,
|
|
2430
|
+
var e, n, r, i, o, s, a, u, c = this, l = c.constructor, d = l.precision, f = l.rounding, h = 5;
|
|
2431
2431
|
if (t == null)
|
|
2432
2432
|
t = new l(10), e = !0;
|
|
2433
2433
|
else {
|
|
2434
2434
|
if (t = new l(t), n = t.d, t.s < 0 || !n || !n[0] || t.eq(1)) return new l(NaN);
|
|
2435
2435
|
e = t.eq(10);
|
|
2436
2436
|
}
|
|
2437
|
-
if (n =
|
|
2438
|
-
return new l(n && !n[0] ? -1 / 0 :
|
|
2437
|
+
if (n = c.d, c.s < 0 || !n || !n[0] || c.eq(1))
|
|
2438
|
+
return new l(n && !n[0] ? -1 / 0 : c.s != 1 ? NaN : n ? 0 : 1 / 0);
|
|
2439
2439
|
if (e)
|
|
2440
2440
|
if (n.length > 1)
|
|
2441
2441
|
o = !0;
|
|
@@ -2443,53 +2443,53 @@ m.logarithm = m.log = function(t) {
|
|
|
2443
2443
|
for (i = n[0]; i % 10 === 0; ) i /= 10;
|
|
2444
2444
|
o = i !== 1;
|
|
2445
2445
|
}
|
|
2446
|
-
if (
|
|
2446
|
+
if (x = !1, a = d + h, s = ue(c, a), r = e ? qe(l, a + 10) : ue(t, a), u = N(s, r, a, 1), Me(u.d, i = d, f))
|
|
2447
2447
|
do
|
|
2448
|
-
if (a += 10, s = ue(
|
|
2449
|
-
+$(
|
|
2448
|
+
if (a += 10, s = ue(c, a), r = e ? qe(l, a + 10) : ue(t, a), u = N(s, r, a, 1), !o) {
|
|
2449
|
+
+$(u.d).slice(i + 1, i + 15) + 1 == 1e14 && (u = E(u, d + 1, 0));
|
|
2450
2450
|
break;
|
|
2451
2451
|
}
|
|
2452
|
-
while (Me(
|
|
2453
|
-
return
|
|
2452
|
+
while (Me(u.d, i += 10, f));
|
|
2453
|
+
return x = !0, E(u, d, f);
|
|
2454
2454
|
};
|
|
2455
2455
|
m.minus = m.sub = function(t) {
|
|
2456
|
-
var e, n, r, i, o, s, a,
|
|
2456
|
+
var e, n, r, i, o, s, a, u, c, l, d, f, h = this, v = h.constructor;
|
|
2457
2457
|
if (t = new v(t), !h.d || !t.d)
|
|
2458
2458
|
return !h.s || !t.s ? t = new v(NaN) : h.d ? t.s = -t.s : t = new v(t.d || h.s !== t.s ? h : NaN), t;
|
|
2459
2459
|
if (h.s != t.s)
|
|
2460
2460
|
return t.s = -t.s, h.plus(t);
|
|
2461
|
-
if (
|
|
2461
|
+
if (c = h.d, f = t.d, a = v.precision, u = v.rounding, !c[0] || !f[0]) {
|
|
2462
2462
|
if (f[0]) t.s = -t.s;
|
|
2463
|
-
else if (
|
|
2464
|
-
else return new v(
|
|
2465
|
-
return
|
|
2463
|
+
else if (c[0]) t = new v(h);
|
|
2464
|
+
else return new v(u === 3 ? -0 : 0);
|
|
2465
|
+
return x ? E(t, a, u) : t;
|
|
2466
2466
|
}
|
|
2467
|
-
if (n = q(t.e / T), l = q(h.e / T),
|
|
2468
|
-
for (d = o < 0, d ? (e =
|
|
2467
|
+
if (n = q(t.e / T), l = q(h.e / T), c = c.slice(), o = l - n, o) {
|
|
2468
|
+
for (d = o < 0, d ? (e = c, o = -o, s = f.length) : (e = f, n = l, s = c.length), r = Math.max(Math.ceil(a / T), s) + 2, o > r && (o = r, e.length = 1), e.reverse(), r = o; r--; ) e.push(0);
|
|
2469
2469
|
e.reverse();
|
|
2470
2470
|
} else {
|
|
2471
|
-
for (r =
|
|
2472
|
-
if (
|
|
2473
|
-
d =
|
|
2471
|
+
for (r = c.length, s = f.length, d = r < s, d && (s = r), r = 0; r < s; r++)
|
|
2472
|
+
if (c[r] != f[r]) {
|
|
2473
|
+
d = c[r] < f[r];
|
|
2474
2474
|
break;
|
|
2475
2475
|
}
|
|
2476
2476
|
o = 0;
|
|
2477
2477
|
}
|
|
2478
|
-
for (d && (e =
|
|
2478
|
+
for (d && (e = c, c = f, f = e, t.s = -t.s), s = c.length, r = f.length - s; r > 0; --r) c[s++] = 0;
|
|
2479
2479
|
for (r = f.length; r > o; ) {
|
|
2480
|
-
if (
|
|
2481
|
-
for (i = r; i &&
|
|
2482
|
-
--
|
|
2480
|
+
if (c[--r] < f[r]) {
|
|
2481
|
+
for (i = r; i && c[--i] === 0; ) c[i] = ee - 1;
|
|
2482
|
+
--c[i], c[r] += ee;
|
|
2483
2483
|
}
|
|
2484
|
-
|
|
2484
|
+
c[r] -= f[r];
|
|
2485
2485
|
}
|
|
2486
|
-
for (;
|
|
2487
|
-
for (;
|
|
2488
|
-
return
|
|
2486
|
+
for (; c[--s] === 0; ) c.pop();
|
|
2487
|
+
for (; c[0] === 0; c.shift()) --n;
|
|
2488
|
+
return c[0] ? (t.d = c, t.e = ze(c, n), x ? E(t, a, u) : t) : new v(u === 3 ? -0 : 0);
|
|
2489
2489
|
};
|
|
2490
2490
|
m.modulo = m.mod = function(t) {
|
|
2491
2491
|
var e, n = this, r = n.constructor;
|
|
2492
|
-
return t = new r(t), !n.d || !t.s || t.d && !t.d[0] ? new r(NaN) : !t.d || n.d && !n.d[0] ? E(new r(n), r.precision, r.rounding) : (
|
|
2492
|
+
return t = new r(t), !n.d || !t.s || t.d && !t.d[0] ? new r(NaN) : !t.d || n.d && !n.d[0] ? E(new r(n), r.precision, r.rounding) : (x = !1, r.modulo == 9 ? (e = N(n, t.abs(), 0, 3, 1), e.s *= t.s) : e = N(n, t, 0, r.modulo, 1), e = e.times(t), x = !0, n.minus(e));
|
|
2493
2493
|
};
|
|
2494
2494
|
m.naturalExponential = m.exp = function() {
|
|
2495
2495
|
return lt(this);
|
|
@@ -2502,21 +2502,21 @@ m.negated = m.neg = function() {
|
|
|
2502
2502
|
return t.s = -t.s, E(t);
|
|
2503
2503
|
};
|
|
2504
2504
|
m.plus = m.add = function(t) {
|
|
2505
|
-
var e, n, r, i, o, s, a,
|
|
2505
|
+
var e, n, r, i, o, s, a, u, c, l, d = this, f = d.constructor;
|
|
2506
2506
|
if (t = new f(t), !d.d || !t.d)
|
|
2507
2507
|
return !d.s || !t.s ? t = new f(NaN) : d.d || (t = new f(t.d || d.s === t.s ? d : NaN)), t;
|
|
2508
2508
|
if (d.s != t.s)
|
|
2509
2509
|
return t.s = -t.s, d.minus(t);
|
|
2510
|
-
if (
|
|
2511
|
-
return l[0] || (t = new f(d)),
|
|
2512
|
-
if (o = q(d.e / T), r = q(t.e / T),
|
|
2513
|
-
for (i < 0 ? (n =
|
|
2510
|
+
if (c = d.d, l = t.d, a = f.precision, u = f.rounding, !c[0] || !l[0])
|
|
2511
|
+
return l[0] || (t = new f(d)), x ? E(t, a, u) : t;
|
|
2512
|
+
if (o = q(d.e / T), r = q(t.e / T), c = c.slice(), i = o - r, i) {
|
|
2513
|
+
for (i < 0 ? (n = c, i = -i, s = l.length) : (n = l, r = o, s = c.length), o = Math.ceil(a / T), s = o > s ? o + 1 : s + 1, i > s && (i = s, n.length = 1), n.reverse(); i--; ) n.push(0);
|
|
2514
2514
|
n.reverse();
|
|
2515
2515
|
}
|
|
2516
|
-
for (s =
|
|
2517
|
-
e = (
|
|
2518
|
-
for (e && (
|
|
2519
|
-
return t.d =
|
|
2516
|
+
for (s = c.length, i = l.length, s - i < 0 && (i = s, n = l, l = c, c = n), e = 0; i; )
|
|
2517
|
+
e = (c[--i] = c[i] + l[i] + e) / ee | 0, c[i] %= ee;
|
|
2518
|
+
for (e && (c.unshift(e), ++r), s = c.length; c[--s] == 0; ) c.pop();
|
|
2519
|
+
return t.d = c, t.e = ze(c, r), x ? E(t, a, u) : t;
|
|
2520
2520
|
};
|
|
2521
2521
|
m.precision = m.sd = function(t) {
|
|
2522
2522
|
var e, n = this;
|
|
@@ -2532,39 +2532,39 @@ m.sine = m.sin = function() {
|
|
|
2532
2532
|
return n.isFinite() ? n.isZero() ? new r(n) : (t = r.precision, e = r.rounding, r.precision = t + Math.max(n.e, n.sd()) + T, r.rounding = 1, n = ni(r, In(r, n)), r.precision = t, r.rounding = e, E(se > 2 ? n.neg() : n, t, e, !0)) : new r(NaN);
|
|
2533
2533
|
};
|
|
2534
2534
|
m.squareRoot = m.sqrt = function() {
|
|
2535
|
-
var t, e, n, r, i, o, s = this, a = s.d,
|
|
2536
|
-
if (
|
|
2537
|
-
return new l(!
|
|
2538
|
-
for (
|
|
2535
|
+
var t, e, n, r, i, o, s = this, a = s.d, u = s.e, c = s.s, l = s.constructor;
|
|
2536
|
+
if (c !== 1 || !a || !a[0])
|
|
2537
|
+
return new l(!c || c < 0 && (!a || a[0]) ? NaN : a ? s : 1 / 0);
|
|
2538
|
+
for (x = !1, c = Math.sqrt(+s), c == 0 || c == 1 / 0 ? (e = $(a), (e.length + u) % 2 == 0 && (e += "0"), c = Math.sqrt(e), u = q((u + 1) / 2) - (u < 0 || u % 2), c == 1 / 0 ? e = "5e" + u : (e = c.toExponential(), e = e.slice(0, e.indexOf("e") + 1) + u), r = new l(e)) : r = new l(c.toString()), n = (u = l.precision) + 3; ; )
|
|
2539
2539
|
if (o = r, r = o.plus(N(s, o, n + 2, 1)).times(0.5), $(o.d).slice(0, n) === (e = $(r.d)).slice(0, n))
|
|
2540
2540
|
if (e = e.slice(n - 3, n + 1), e == "9999" || !i && e == "4999") {
|
|
2541
|
-
if (!i && (E(o,
|
|
2541
|
+
if (!i && (E(o, u + 1, 0), o.times(o).eq(s))) {
|
|
2542
2542
|
r = o;
|
|
2543
2543
|
break;
|
|
2544
2544
|
}
|
|
2545
2545
|
n += 4, i = 1;
|
|
2546
2546
|
} else {
|
|
2547
|
-
(!+e || !+e.slice(1) && e.charAt(0) == "5") && (E(r,
|
|
2547
|
+
(!+e || !+e.slice(1) && e.charAt(0) == "5") && (E(r, u + 1, 1), t = !r.times(r).eq(s));
|
|
2548
2548
|
break;
|
|
2549
2549
|
}
|
|
2550
|
-
return
|
|
2550
|
+
return x = !0, E(r, u, l.rounding, t);
|
|
2551
2551
|
};
|
|
2552
2552
|
m.tangent = m.tan = function() {
|
|
2553
2553
|
var t, e, n = this, r = n.constructor;
|
|
2554
2554
|
return n.isFinite() ? n.isZero() ? new r(n) : (t = r.precision, e = r.rounding, r.precision = t + 10, r.rounding = 1, n = n.sin(), n.s = 1, n = N(n, new r(1).minus(n.times(n)).sqrt(), t + 10, 0), r.precision = t, r.rounding = e, E(se == 2 || se == 4 ? n.neg() : n, t, e, !0)) : new r(NaN);
|
|
2555
2555
|
};
|
|
2556
2556
|
m.times = m.mul = function(t) {
|
|
2557
|
-
var e, n, r, i, o, s, a,
|
|
2557
|
+
var e, n, r, i, o, s, a, u, c, l = this, d = l.constructor, f = l.d, h = (t = new d(t)).d;
|
|
2558
2558
|
if (t.s *= l.s, !f || !f[0] || !h || !h[0])
|
|
2559
2559
|
return new d(!t.s || f && !f[0] && !h || h && !h[0] && !f ? NaN : !f || !h ? t.s / 0 : t.s * 0);
|
|
2560
|
-
for (n = q(l.e / T) + q(t.e / T),
|
|
2561
|
-
for (r =
|
|
2562
|
-
for (e = 0, i =
|
|
2560
|
+
for (n = q(l.e / T) + q(t.e / T), u = f.length, c = h.length, u < c && (o = f, f = h, h = o, s = u, u = c, c = s), o = [], s = u + c, r = s; r--; ) o.push(0);
|
|
2561
|
+
for (r = c; --r >= 0; ) {
|
|
2562
|
+
for (e = 0, i = u + r; i > r; )
|
|
2563
2563
|
a = o[i] + h[r] * f[i - r - 1] + e, o[i--] = a % ee | 0, e = a / ee | 0;
|
|
2564
2564
|
o[i] = (o[i] + e) % ee | 0;
|
|
2565
2565
|
}
|
|
2566
2566
|
for (; !o[--s]; ) o.pop();
|
|
2567
|
-
return e ? ++n : o.shift(), t.d = o, t.e = ze(o, n),
|
|
2567
|
+
return e ? ++n : o.shift(), t.d = o, t.e = ze(o, n), x ? E(t, d.precision, d.rounding) : t;
|
|
2568
2568
|
};
|
|
2569
2569
|
m.toBinary = function(t, e) {
|
|
2570
2570
|
return pt(this, 2, t, e);
|
|
@@ -2582,17 +2582,17 @@ m.toFixed = function(t, e) {
|
|
|
2582
2582
|
return t === void 0 ? n = re(i) : (X(t, 0, he), e === void 0 ? e = o.rounding : X(e, 0, 8), r = E(new o(i), t + i.e + 1, e), n = re(r, !1, t + r.e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
|
|
2583
2583
|
};
|
|
2584
2584
|
m.toFraction = function(t) {
|
|
2585
|
-
var e, n, r, i, o, s, a,
|
|
2585
|
+
var e, n, r, i, o, s, a, u, c, l, d, f, h = this, v = h.d, g = h.constructor;
|
|
2586
2586
|
if (!v) return new g(h);
|
|
2587
|
-
if (
|
|
2588
|
-
t = o > 0 ? e :
|
|
2587
|
+
if (c = n = new g(1), r = u = new g(0), e = new g(r), o = e.e = Ln(v) - h.e - 1, s = o % T, e.d[0] = F(10, s < 0 ? T + s : s), t == null)
|
|
2588
|
+
t = o > 0 ? e : c;
|
|
2589
2589
|
else {
|
|
2590
|
-
if (a = new g(t), !a.isInt() || a.lt(
|
|
2591
|
-
t = a.gt(e) ? o > 0 ? e :
|
|
2590
|
+
if (a = new g(t), !a.isInt() || a.lt(c)) throw Error(le + a);
|
|
2591
|
+
t = a.gt(e) ? o > 0 ? e : c : a;
|
|
2592
2592
|
}
|
|
2593
|
-
for (
|
|
2594
|
-
n = r, r = i, i =
|
|
2595
|
-
return i = N(t.minus(n), r, 0, 1, 1),
|
|
2593
|
+
for (x = !1, a = new g($(v)), l = g.precision, g.precision = o = v.length * T * 2; d = N(a, e, 0, 1, 1), i = n.plus(d.times(r)), i.cmp(t) != 1; )
|
|
2594
|
+
n = r, r = i, i = c, c = u.plus(d.times(i)), u = i, i = e, e = a.minus(d.times(i)), a = i;
|
|
2595
|
+
return i = N(t.minus(n), r, 0, 1, 1), u = u.plus(i.times(c)), n = n.plus(i.times(r)), u.s = c.s = h.s, f = N(c, r, o, 1).minus(h).abs().cmp(N(u, n, o, 1).minus(h).abs()) < 1 ? [c, r] : [u, n], g.precision = l, x = !0, f;
|
|
2596
2596
|
};
|
|
2597
2597
|
m.toHexadecimal = m.toHex = function(t, e) {
|
|
2598
2598
|
return pt(this, 16, t, e);
|
|
@@ -2607,7 +2607,7 @@ m.toNearest = function(t, e) {
|
|
|
2607
2607
|
if (!t.d)
|
|
2608
2608
|
return t.s && (t.s = n.s), t;
|
|
2609
2609
|
}
|
|
2610
|
-
return t.d[0] ? (
|
|
2610
|
+
return t.d[0] ? (x = !1, n = N(n, t, 0, e, 1).times(t), x = !0, E(n)) : (t.s = n.s, n = t), n;
|
|
2611
2611
|
};
|
|
2612
2612
|
m.toNumber = function() {
|
|
2613
2613
|
return +this;
|
|
@@ -2616,18 +2616,18 @@ m.toOctal = function(t, e) {
|
|
|
2616
2616
|
return pt(this, 8, t, e);
|
|
2617
2617
|
};
|
|
2618
2618
|
m.toPower = m.pow = function(t) {
|
|
2619
|
-
var e, n, r, i, o, s, a = this,
|
|
2620
|
-
if (!a.d || !t.d || !a.d[0] || !t.d[0]) return new
|
|
2621
|
-
if (a = new
|
|
2622
|
-
if (r =
|
|
2623
|
-
if (e = q(t.e / T), e >= t.d.length - 1 && (n =
|
|
2624
|
-
return i =
|
|
2619
|
+
var e, n, r, i, o, s, a = this, u = a.constructor, c = +(t = new u(t));
|
|
2620
|
+
if (!a.d || !t.d || !a.d[0] || !t.d[0]) return new u(F(+a, c));
|
|
2621
|
+
if (a = new u(a), a.eq(1)) return a;
|
|
2622
|
+
if (r = u.precision, o = u.rounding, t.eq(1)) return E(a, r, o);
|
|
2623
|
+
if (e = q(t.e / T), e >= t.d.length - 1 && (n = c < 0 ? -c : c) <= Qr)
|
|
2624
|
+
return i = xn(u, a, n, r), t.s < 0 ? new u(1).div(i) : E(i, r, o);
|
|
2625
2625
|
if (s = a.s, s < 0) {
|
|
2626
|
-
if (e < t.d.length - 1) return new
|
|
2626
|
+
if (e < t.d.length - 1) return new u(NaN);
|
|
2627
2627
|
if ((t.d[e] & 1) == 0 && (s = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
2628
2628
|
return a.s = s, a;
|
|
2629
2629
|
}
|
|
2630
|
-
return n = F(+a,
|
|
2630
|
+
return n = F(+a, c), e = n == 0 || !isFinite(n) ? q(c * (Math.log("0." + $(a.d)) / Math.LN10 + a.e + 1)) : new u(n + "").e, e > u.maxE + 1 || e < u.minE - 1 ? new u(e > 0 ? s / 0 : 0) : (x = !1, u.rounding = a.s = 1, n = Math.min(12, (e + "").length), i = lt(t.times(ue(a, r + n)), r), i.d && (i = E(i, r + 5, 1), Me(i.d, r, o) && (e = r + 10, i = E(lt(t.times(ue(a, e + n)), e), e + 5, 1), +$(i.d).slice(r + 1, r + 15) + 1 == 1e14 && (i = E(i, r + 1, 0)))), i.s = s, x = !0, u.rounding = o, E(i, r, o));
|
|
2631
2631
|
};
|
|
2632
2632
|
m.toPrecision = function(t, e) {
|
|
2633
2633
|
var n, r = this, i = r.constructor;
|
|
@@ -2688,30 +2688,30 @@ function ei(t, e) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
var N = /* @__PURE__ */ function() {
|
|
2690
2690
|
function t(r, i, o) {
|
|
2691
|
-
var s, a = 0,
|
|
2692
|
-
for (r = r.slice();
|
|
2693
|
-
s = r[
|
|
2691
|
+
var s, a = 0, u = r.length;
|
|
2692
|
+
for (r = r.slice(); u--; )
|
|
2693
|
+
s = r[u] * i + a, r[u] = s % o | 0, a = s / o | 0;
|
|
2694
2694
|
return a && r.unshift(a), r;
|
|
2695
2695
|
}
|
|
2696
2696
|
function e(r, i, o, s) {
|
|
2697
|
-
var a,
|
|
2697
|
+
var a, u;
|
|
2698
2698
|
if (o != s)
|
|
2699
|
-
|
|
2699
|
+
u = o > s ? 1 : -1;
|
|
2700
2700
|
else
|
|
2701
|
-
for (a =
|
|
2701
|
+
for (a = u = 0; a < o; a++)
|
|
2702
2702
|
if (r[a] != i[a]) {
|
|
2703
|
-
|
|
2703
|
+
u = r[a] > i[a] ? 1 : -1;
|
|
2704
2704
|
break;
|
|
2705
2705
|
}
|
|
2706
|
-
return
|
|
2706
|
+
return u;
|
|
2707
2707
|
}
|
|
2708
2708
|
function n(r, i, o, s) {
|
|
2709
2709
|
for (var a = 0; o--; )
|
|
2710
2710
|
r[o] -= a, a = r[o] < i[o] ? 1 : 0, r[o] = a * s + r[o] - i[o];
|
|
2711
2711
|
for (; !r[0] && r.length > 1; ) r.shift();
|
|
2712
2712
|
}
|
|
2713
|
-
return function(r, i, o, s, a,
|
|
2714
|
-
var
|
|
2713
|
+
return function(r, i, o, s, a, u) {
|
|
2714
|
+
var c, l, d, f, h, v, g, y, C, D, A, k, P, M, te, me, G, we, K, ie, oe = r.constructor, Se = r.s == i.s ? 1 : -1, V = r.d, _ = i.d;
|
|
2715
2715
|
if (!V || !V[0] || !_ || !_[0])
|
|
2716
2716
|
return new oe(
|
|
2717
2717
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
@@ -2720,54 +2720,54 @@ var N = /* @__PURE__ */ function() {
|
|
|
2720
2720
|
V && V[0] == 0 || !_ ? Se * 0 : Se / 0
|
|
2721
2721
|
)
|
|
2722
2722
|
);
|
|
2723
|
-
for (
|
|
2723
|
+
for (u ? (h = 1, l = r.e - i.e) : (u = ee, h = T, l = q(r.e / h) - q(i.e / h)), K = _.length, G = V.length, C = new oe(Se), D = C.d = [], d = 0; _[d] == (V[d] || 0); d++) ;
|
|
2724
2724
|
if (_[d] > (V[d] || 0) && l--, o == null ? (M = o = oe.precision, s = oe.rounding) : a ? M = o + (r.e - i.e) + 1 : M = o, M < 0)
|
|
2725
2725
|
D.push(1), v = !0;
|
|
2726
2726
|
else {
|
|
2727
2727
|
if (M = M / h + 2 | 0, d = 0, K == 1) {
|
|
2728
2728
|
for (f = 0, _ = _[0], M++; (d < G || f) && M--; d++)
|
|
2729
|
-
te = f *
|
|
2729
|
+
te = f * u + (V[d] || 0), D[d] = te / _ | 0, f = te % _ | 0;
|
|
2730
2730
|
v = f || d < G;
|
|
2731
2731
|
} else {
|
|
2732
|
-
for (f =
|
|
2733
|
-
ie = _.slice(), ie.unshift(0), we = _[0], _[1] >=
|
|
2732
|
+
for (f = u / (_[0] + 1) | 0, f > 1 && (_ = t(_, f, u), V = t(V, f, u), K = _.length, G = V.length), me = K, A = V.slice(0, K), k = A.length; k < K; ) A[k++] = 0;
|
|
2733
|
+
ie = _.slice(), ie.unshift(0), we = _[0], _[1] >= u / 2 && ++we;
|
|
2734
2734
|
do
|
|
2735
|
-
f = 0,
|
|
2736
|
-
while ((me++ < G ||
|
|
2737
|
-
v =
|
|
2735
|
+
f = 0, c = e(_, A, K, k), c < 0 ? (P = A[0], K != k && (P = P * u + (A[1] || 0)), f = P / we | 0, f > 1 ? (f >= u && (f = u - 1), g = t(_, f, u), y = g.length, k = A.length, c = e(g, A, y, k), c == 1 && (f--, n(g, K < y ? ie : _, y, u))) : (f == 0 && (c = f = 1), g = _.slice()), y = g.length, y < k && g.unshift(0), n(A, g, k, u), c == -1 && (k = A.length, c = e(_, A, K, k), c < 1 && (f++, n(A, K < k ? ie : _, k, u))), k = A.length) : c === 0 && (f++, A = [0]), D[d++] = f, c && A[0] ? A[k++] = V[me] || 0 : (A = [V[me]], k = 1);
|
|
2736
|
+
while ((me++ < G || A[0] !== void 0) && M--);
|
|
2737
|
+
v = A[0] !== void 0;
|
|
2738
2738
|
}
|
|
2739
2739
|
D[0] || D.shift();
|
|
2740
2740
|
}
|
|
2741
2741
|
if (h == 1)
|
|
2742
|
-
|
|
2742
|
+
C.e = l, Sn = v;
|
|
2743
2743
|
else {
|
|
2744
2744
|
for (d = 1, f = D[0]; f >= 10; f /= 10) d++;
|
|
2745
|
-
|
|
2745
|
+
C.e = d + l * h - 1, E(C, a ? o + C.e + 1 : o, s, v);
|
|
2746
2746
|
}
|
|
2747
|
-
return
|
|
2747
|
+
return C;
|
|
2748
2748
|
};
|
|
2749
2749
|
}();
|
|
2750
2750
|
function E(t, e, n, r) {
|
|
2751
|
-
var i, o, s, a,
|
|
2751
|
+
var i, o, s, a, u, c, l, d, f, h = t.constructor;
|
|
2752
2752
|
e: if (e != null) {
|
|
2753
2753
|
if (d = t.d, !d) return t;
|
|
2754
2754
|
for (i = 1, a = d[0]; a >= 10; a /= 10) i++;
|
|
2755
2755
|
if (o = e - i, o < 0)
|
|
2756
|
-
o += T, s = e, l = d[f = 0],
|
|
2756
|
+
o += T, s = e, l = d[f = 0], u = l / F(10, i - s - 1) % 10 | 0;
|
|
2757
2757
|
else if (f = Math.ceil((o + 1) / T), a = d.length, f >= a)
|
|
2758
2758
|
if (r) {
|
|
2759
2759
|
for (; a++ <= f; ) d.push(0);
|
|
2760
|
-
l =
|
|
2760
|
+
l = u = 0, i = 1, o %= T, s = o - T + 1;
|
|
2761
2761
|
} else
|
|
2762
2762
|
break e;
|
|
2763
2763
|
else {
|
|
2764
2764
|
for (l = a = d[f], i = 1; a >= 10; a /= 10) i++;
|
|
2765
|
-
o %= T, s = o - T + i,
|
|
2765
|
+
o %= T, s = o - T + i, u = s < 0 ? 0 : l / F(10, i - s - 1) % 10 | 0;
|
|
2766
2766
|
}
|
|
2767
|
-
if (r = r || e < 0 || d[f + 1] !== void 0 || (s < 0 ? l : l % F(10, i - s - 1)),
|
|
2767
|
+
if (r = r || e < 0 || d[f + 1] !== void 0 || (s < 0 ? l : l % F(10, i - s - 1)), c = n < 4 ? (u || r) && (n == 0 || n == (t.s < 0 ? 3 : 2)) : u > 5 || u == 5 && (n == 4 || r || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
2768
2768
|
(o > 0 ? s > 0 ? l / F(10, i - s) : 0 : d[f - 1]) % 10 & 1 || n == (t.s < 0 ? 8 : 7)), e < 1 || !d[0])
|
|
2769
|
-
return d.length = 0,
|
|
2770
|
-
if (o == 0 ? (d.length = f, a = 1, f--) : (d.length = f + 1, a = F(10, T - o), d[f] = s > 0 ? (l / F(10, i - s) % F(10, s) | 0) * a : 0),
|
|
2769
|
+
return d.length = 0, c ? (e -= t.e + 1, d[0] = F(10, (T - e % T) % T), t.e = -e || 0) : d[0] = t.e = 0, t;
|
|
2770
|
+
if (o == 0 ? (d.length = f, a = 1, f--) : (d.length = f + 1, a = F(10, T - o), d[f] = s > 0 ? (l / F(10, i - s) % F(10, s) | 0) * a : 0), c)
|
|
2771
2771
|
for (; ; )
|
|
2772
2772
|
if (f == 0) {
|
|
2773
2773
|
for (o = 1, s = d[0]; s >= 10; s /= 10) o++;
|
|
@@ -2780,7 +2780,7 @@ function E(t, e, n, r) {
|
|
|
2780
2780
|
}
|
|
2781
2781
|
for (o = d.length; d[--o] === 0; ) d.pop();
|
|
2782
2782
|
}
|
|
2783
|
-
return
|
|
2783
|
+
return x && (t.e > h.maxE ? (t.d = null, t.e = NaN) : t.e < h.minE && (t.e = 0, t.d = [0])), t;
|
|
2784
2784
|
}
|
|
2785
2785
|
function re(t, e, n) {
|
|
2786
2786
|
if (!t.isFinite()) return Mn(t);
|
|
@@ -2794,7 +2794,7 @@ function ze(t, e) {
|
|
|
2794
2794
|
}
|
|
2795
2795
|
function qe(t, e, n) {
|
|
2796
2796
|
if (e > Jr)
|
|
2797
|
-
throw
|
|
2797
|
+
throw x = !0, n && (t.precision = n), Error(En);
|
|
2798
2798
|
return E(new t($e), e, 1, !0);
|
|
2799
2799
|
}
|
|
2800
2800
|
function ne(t, e, n) {
|
|
@@ -2813,21 +2813,21 @@ function ae(t) {
|
|
|
2813
2813
|
for (var e = ""; t--; ) e += "0";
|
|
2814
2814
|
return e;
|
|
2815
2815
|
}
|
|
2816
|
-
function
|
|
2816
|
+
function xn(t, e, n, r) {
|
|
2817
2817
|
var i, o = new t(1), s = Math.ceil(r / T + 4);
|
|
2818
|
-
for (
|
|
2818
|
+
for (x = !1; ; ) {
|
|
2819
2819
|
if (n % 2 && (o = o.times(e), kt(o.d, s) && (i = !0)), n = q(n / 2), n === 0) {
|
|
2820
2820
|
n = o.d.length - 1, i && o.d[n] === 0 && ++o.d[n];
|
|
2821
2821
|
break;
|
|
2822
2822
|
}
|
|
2823
2823
|
e = e.times(e), kt(e.d, s);
|
|
2824
2824
|
}
|
|
2825
|
-
return
|
|
2825
|
+
return x = !0, o;
|
|
2826
2826
|
}
|
|
2827
2827
|
function Nt(t) {
|
|
2828
2828
|
return t.d[t.d.length - 1] & 1;
|
|
2829
2829
|
}
|
|
2830
|
-
function
|
|
2830
|
+
function An(t, e, n) {
|
|
2831
2831
|
for (var r, i, o = new t(e[0]), s = 0; ++s < e.length; ) {
|
|
2832
2832
|
if (i = new t(e[s]), !i.s) {
|
|
2833
2833
|
o = i;
|
|
@@ -2838,19 +2838,19 @@ function xn(t, e, n) {
|
|
|
2838
2838
|
return o;
|
|
2839
2839
|
}
|
|
2840
2840
|
function lt(t, e) {
|
|
2841
|
-
var n, r, i, o, s, a,
|
|
2841
|
+
var n, r, i, o, s, a, u, c = 0, l = 0, d = 0, f = t.constructor, h = f.rounding, v = f.precision;
|
|
2842
2842
|
if (!t.d || !t.d[0] || t.e > 17)
|
|
2843
2843
|
return new f(t.d ? t.d[0] ? t.s < 0 ? 0 : 1 / 0 : 1 : t.s ? t.s < 0 ? 0 : t : NaN);
|
|
2844
|
-
for (e == null ? (
|
|
2844
|
+
for (e == null ? (x = !1, u = v) : u = e, a = new f(0.03125); t.e > -2; )
|
|
2845
2845
|
t = t.times(a), d += 5;
|
|
2846
|
-
for (r = Math.log(F(2, d)) / Math.LN10 * 2 + 5 | 0,
|
|
2847
|
-
if (o = E(o.times(t),
|
|
2848
|
-
for (i = d; i--; ) s = E(s.times(s),
|
|
2846
|
+
for (r = Math.log(F(2, d)) / Math.LN10 * 2 + 5 | 0, u += r, n = o = s = new f(1), f.precision = u; ; ) {
|
|
2847
|
+
if (o = E(o.times(t), u, 1), n = n.times(++l), a = s.plus(N(o, n, u, 1)), $(a.d).slice(0, u) === $(s.d).slice(0, u)) {
|
|
2848
|
+
for (i = d; i--; ) s = E(s.times(s), u, 1);
|
|
2849
2849
|
if (e == null)
|
|
2850
|
-
if (
|
|
2851
|
-
f.precision =
|
|
2850
|
+
if (c < 3 && Me(s.d, u - r, h, c))
|
|
2851
|
+
f.precision = u += 10, n = o = a = new f(1), l = 0, c++;
|
|
2852
2852
|
else
|
|
2853
|
-
return E(s, f.precision = v, h,
|
|
2853
|
+
return E(s, f.precision = v, h, x = !0);
|
|
2854
2854
|
else
|
|
2855
2855
|
return f.precision = v, s;
|
|
2856
2856
|
}
|
|
@@ -2858,25 +2858,25 @@ function lt(t, e) {
|
|
|
2858
2858
|
}
|
|
2859
2859
|
}
|
|
2860
2860
|
function ue(t, e) {
|
|
2861
|
-
var n, r, i, o, s, a,
|
|
2862
|
-
if (g.s < 0 || !
|
|
2863
|
-
return new
|
|
2864
|
-
if (e == null ? (
|
|
2861
|
+
var n, r, i, o, s, a, u, c, l, d, f, h = 1, v = 10, g = t, y = g.d, C = g.constructor, D = C.rounding, A = C.precision;
|
|
2862
|
+
if (g.s < 0 || !y || !y[0] || !g.e && y[0] == 1 && y.length == 1)
|
|
2863
|
+
return new C(y && !y[0] ? -1 / 0 : g.s != 1 ? NaN : y ? 0 : g);
|
|
2864
|
+
if (e == null ? (x = !1, l = A) : l = e, C.precision = l += v, n = $(y), r = n.charAt(0), Math.abs(o = g.e) < 15e14) {
|
|
2865
2865
|
for (; r < 7 && r != 1 || r == 1 && n.charAt(1) > 3; )
|
|
2866
2866
|
g = g.times(t), n = $(g.d), r = n.charAt(0), h++;
|
|
2867
|
-
o = g.e, r > 1 ? (g = new
|
|
2867
|
+
o = g.e, r > 1 ? (g = new C("0." + n), o++) : g = new C(r + "." + n.slice(1));
|
|
2868
2868
|
} else
|
|
2869
|
-
return
|
|
2870
|
-
for (d = g,
|
|
2871
|
-
if (s = E(s.times(f), l, 1),
|
|
2872
|
-
if (
|
|
2873
|
-
if (Me(
|
|
2874
|
-
|
|
2869
|
+
return c = qe(C, l + 2, A).times(o + ""), g = ue(new C(r + "." + n.slice(1)), l - v).plus(c), C.precision = A, e == null ? E(g, A, D, x = !0) : g;
|
|
2870
|
+
for (d = g, u = s = g = N(g.minus(1), g.plus(1), l, 1), f = E(g.times(g), l, 1), i = 3; ; ) {
|
|
2871
|
+
if (s = E(s.times(f), l, 1), c = u.plus(N(s, new C(i), l, 1)), $(c.d).slice(0, l) === $(u.d).slice(0, l))
|
|
2872
|
+
if (u = u.times(2), o !== 0 && (u = u.plus(qe(C, l + 2, A).times(o + ""))), u = N(u, new C(h), l, 1), e == null)
|
|
2873
|
+
if (Me(u.d, l - v, D, a))
|
|
2874
|
+
C.precision = l += v, c = s = g = N(d.minus(1), d.plus(1), l, 1), f = E(g.times(g), l, 1), i = a = 1;
|
|
2875
2875
|
else
|
|
2876
|
-
return E(
|
|
2876
|
+
return E(u, C.precision = A, D, x = !0);
|
|
2877
2877
|
else
|
|
2878
|
-
return
|
|
2879
|
-
|
|
2878
|
+
return C.precision = A, u;
|
|
2879
|
+
u = c, i += 2;
|
|
2880
2880
|
}
|
|
2881
2881
|
}
|
|
2882
2882
|
function Mn(t) {
|
|
@@ -2893,13 +2893,13 @@ function He(t, e) {
|
|
|
2893
2893
|
} else
|
|
2894
2894
|
r -= i;
|
|
2895
2895
|
for (; r--; ) e += "0";
|
|
2896
|
-
t.d.push(+e),
|
|
2896
|
+
t.d.push(+e), x && (t.e > t.constructor.maxE ? (t.d = null, t.e = NaN) : t.e < t.constructor.minE && (t.e = 0, t.d = [0]));
|
|
2897
2897
|
} else
|
|
2898
2898
|
t.e = 0, t.d = [0];
|
|
2899
2899
|
return t;
|
|
2900
2900
|
}
|
|
2901
2901
|
function ti(t, e) {
|
|
2902
|
-
var n, r, i, o, s, a,
|
|
2902
|
+
var n, r, i, o, s, a, u, c, l;
|
|
2903
2903
|
if (e.indexOf("_") > -1) {
|
|
2904
2904
|
if (e = e.replace(/(\d)_(?=\d)/g, "$1"), Cn.test(e)) return He(t, e);
|
|
2905
2905
|
} else if (e === "Infinity" || e === "NaN")
|
|
@@ -2912,8 +2912,8 @@ function ti(t, e) {
|
|
|
2912
2912
|
n = 8;
|
|
2913
2913
|
else
|
|
2914
2914
|
throw Error(le + e);
|
|
2915
|
-
for (o = e.search(/p/i), o > 0 ? (
|
|
2916
|
-
return o < 0 ? new r(t.s * 0) : (t.e = ze(
|
|
2915
|
+
for (o = e.search(/p/i), o > 0 ? (u = +e.slice(o + 1), e = e.substring(2, o)) : e = e.slice(2), o = e.indexOf("."), s = o >= 0, r = t.constructor, s && (e = e.replace(".", ""), a = e.length, o = a - o, i = xn(r, new r(n), o, o * 2)), c = Ke(e, n, ee), l = c.length - 1, o = l; c[o] === 0; --o) c.pop();
|
|
2916
|
+
return o < 0 ? new r(t.s * 0) : (t.e = ze(c, l), t.d = c, x = !1, s && (t = N(t, i, a * 4)), u && (t = t.times(Math.abs(u) < 54 ? F(2, u) : _e.pow(2, u))), x = !0, t);
|
|
2917
2917
|
}
|
|
2918
2918
|
function ni(t, e) {
|
|
2919
2919
|
var n, r = e.d.length;
|
|
@@ -2925,15 +2925,15 @@ function ni(t, e) {
|
|
|
2925
2925
|
return e;
|
|
2926
2926
|
}
|
|
2927
2927
|
function Le(t, e, n, r, i) {
|
|
2928
|
-
var o, s, a,
|
|
2929
|
-
for (
|
|
2930
|
-
if (s = N(a.times(
|
|
2928
|
+
var o, s, a, u, c = t.precision, l = Math.ceil(c / T);
|
|
2929
|
+
for (x = !1, u = n.times(n), a = new t(r); ; ) {
|
|
2930
|
+
if (s = N(a.times(u), new t(e++ * e++), c, 1), a = i ? r.plus(s) : r.minus(s), r = N(s.times(u), new t(e++ * e++), c, 1), s = a.plus(r), s.d[l] !== void 0) {
|
|
2931
2931
|
for (o = l; s.d[o] === a.d[o] && o--; ) ;
|
|
2932
2932
|
if (o == -1) break;
|
|
2933
2933
|
}
|
|
2934
2934
|
o = a, a = r, r = s, s = o;
|
|
2935
2935
|
}
|
|
2936
|
-
return
|
|
2936
|
+
return x = !0, s.d.length = l + 1, s;
|
|
2937
2937
|
}
|
|
2938
2938
|
function Ye(t, e) {
|
|
2939
2939
|
for (var n = t; --e; ) n *= t;
|
|
@@ -2953,33 +2953,33 @@ function In(t, e) {
|
|
|
2953
2953
|
return e.minus(i).abs();
|
|
2954
2954
|
}
|
|
2955
2955
|
function pt(t, e, n, r) {
|
|
2956
|
-
var i, o, s, a,
|
|
2956
|
+
var i, o, s, a, u, c, l, d, f, h = t.constructor, v = n !== void 0;
|
|
2957
2957
|
if (v ? (X(n, 1, he), r === void 0 ? r = h.rounding : X(r, 0, 8)) : (n = h.precision, r = h.rounding), !t.isFinite())
|
|
2958
2958
|
l = Mn(t);
|
|
2959
2959
|
else {
|
|
2960
|
-
for (l = re(t), s = l.indexOf("."), v ? (i = 2, e == 16 ? n = n * 4 - 3 : e == 8 && (n = n * 3 - 2)) : i = e, s >= 0 && (l = l.replace(".", ""), f = new h(1), f.e = l.length - s, f.d = Ke(re(f), 10, i), f.e = f.d.length), d = Ke(l, 10, i), o =
|
|
2960
|
+
for (l = re(t), s = l.indexOf("."), v ? (i = 2, e == 16 ? n = n * 4 - 3 : e == 8 && (n = n * 3 - 2)) : i = e, s >= 0 && (l = l.replace(".", ""), f = new h(1), f.e = l.length - s, f.d = Ke(re(f), 10, i), f.e = f.d.length), d = Ke(l, 10, i), o = u = d.length; d[--u] == 0; ) d.pop();
|
|
2961
2961
|
if (!d[0])
|
|
2962
2962
|
l = v ? "0p+0" : "0";
|
|
2963
2963
|
else {
|
|
2964
|
-
if (s < 0 ? o-- : (t = new h(t), t.d = d, t.e = o, t = N(t, f, n, r, 0, i), d = t.d, o = t.e,
|
|
2964
|
+
if (s < 0 ? o-- : (t = new h(t), t.d = d, t.e = o, t = N(t, f, n, r, 0, i), d = t.d, o = t.e, c = Sn), s = d[n], a = i / 2, c = c || d[n + 1] !== void 0, c = r < 4 ? (s !== void 0 || c) && (r === 0 || r === (t.s < 0 ? 3 : 2)) : s > a || s === a && (r === 4 || c || r === 6 && d[n - 1] & 1 || r === (t.s < 0 ? 8 : 7)), d.length = n, c)
|
|
2965
2965
|
for (; ++d[--n] > i - 1; )
|
|
2966
2966
|
d[n] = 0, n || (++o, d.unshift(1));
|
|
2967
|
-
for (
|
|
2968
|
-
for (s = 0, l = ""; s <
|
|
2967
|
+
for (u = d.length; !d[u - 1]; --u) ;
|
|
2968
|
+
for (s = 0, l = ""; s < u; s++) l += at.charAt(d[s]);
|
|
2969
2969
|
if (v) {
|
|
2970
|
-
if (
|
|
2970
|
+
if (u > 1)
|
|
2971
2971
|
if (e == 16 || e == 8) {
|
|
2972
|
-
for (s = e == 16 ? 4 : 3, --
|
|
2973
|
-
for (d = Ke(l, i, e),
|
|
2974
|
-
for (s = 1, l = "1."; s <
|
|
2972
|
+
for (s = e == 16 ? 4 : 3, --u; u % s; u++) l += "0";
|
|
2973
|
+
for (d = Ke(l, i, e), u = d.length; !d[u - 1]; --u) ;
|
|
2974
|
+
for (s = 1, l = "1."; s < u; s++) l += at.charAt(d[s]);
|
|
2975
2975
|
} else
|
|
2976
2976
|
l = l.charAt(0) + "." + l.slice(1);
|
|
2977
2977
|
l = l + (o < 0 ? "p" : "p+") + o;
|
|
2978
2978
|
} else if (o < 0) {
|
|
2979
2979
|
for (; ++o; ) l = "0" + l;
|
|
2980
2980
|
l = "0." + l;
|
|
2981
|
-
} else if (++o >
|
|
2982
|
-
else o <
|
|
2981
|
+
} else if (++o > u) for (o -= u; o--; ) l += "0";
|
|
2982
|
+
else o < u && (l = l.slice(0, o) + "." + l.slice(o));
|
|
2983
2983
|
}
|
|
2984
2984
|
l = (e == 16 ? "0x" : e == 2 ? "0b" : e == 8 ? "0o" : "") + l;
|
|
2985
2985
|
}
|
|
@@ -3078,35 +3078,35 @@ function vi(t) {
|
|
|
3078
3078
|
function _n(t) {
|
|
3079
3079
|
var e, n, r;
|
|
3080
3080
|
function i(o) {
|
|
3081
|
-
var s, a,
|
|
3082
|
-
if (!(
|
|
3083
|
-
if (
|
|
3084
|
-
|
|
3081
|
+
var s, a, u, c = this;
|
|
3082
|
+
if (!(c instanceof i)) return new i(o);
|
|
3083
|
+
if (c.constructor = i, Rt(o)) {
|
|
3084
|
+
c.s = o.s, x ? !o.d || o.e > i.maxE ? (c.e = NaN, c.d = null) : o.e < i.minE ? (c.e = 0, c.d = [0]) : (c.e = o.e, c.d = o.d.slice()) : (c.e = o.e, c.d = o.d ? o.d.slice() : o.d);
|
|
3085
3085
|
return;
|
|
3086
3086
|
}
|
|
3087
|
-
if (
|
|
3087
|
+
if (u = typeof o, u === "number") {
|
|
3088
3088
|
if (o === 0) {
|
|
3089
|
-
|
|
3089
|
+
c.s = 1 / o < 0 ? -1 : 1, c.e = 0, c.d = [0];
|
|
3090
3090
|
return;
|
|
3091
3091
|
}
|
|
3092
|
-
if (o < 0 ? (o = -o,
|
|
3092
|
+
if (o < 0 ? (o = -o, c.s = -1) : c.s = 1, o === ~~o && o < 1e7) {
|
|
3093
3093
|
for (s = 0, a = o; a >= 10; a /= 10) s++;
|
|
3094
|
-
|
|
3094
|
+
x ? s > i.maxE ? (c.e = NaN, c.d = null) : s < i.minE ? (c.e = 0, c.d = [0]) : (c.e = s, c.d = [o]) : (c.e = s, c.d = [o]);
|
|
3095
3095
|
return;
|
|
3096
3096
|
}
|
|
3097
3097
|
if (o * 0 !== 0) {
|
|
3098
|
-
o || (
|
|
3098
|
+
o || (c.s = NaN), c.e = NaN, c.d = null;
|
|
3099
3099
|
return;
|
|
3100
3100
|
}
|
|
3101
|
-
return He(
|
|
3101
|
+
return He(c, o.toString());
|
|
3102
3102
|
}
|
|
3103
|
-
if (
|
|
3104
|
-
return (a = o.charCodeAt(0)) === 45 ? (o = o.slice(1),
|
|
3105
|
-
if (
|
|
3106
|
-
return o < 0 ? (o = -o,
|
|
3103
|
+
if (u === "string")
|
|
3104
|
+
return (a = o.charCodeAt(0)) === 45 ? (o = o.slice(1), c.s = -1) : (a === 43 && (o = o.slice(1)), c.s = 1), Cn.test(o) ? He(c, o) : ti(c, o);
|
|
3105
|
+
if (u === "bigint")
|
|
3106
|
+
return o < 0 ? (o = -o, c.s = -1) : c.s = 1, He(c, o.toString());
|
|
3107
3107
|
throw Error(le + o);
|
|
3108
3108
|
}
|
|
3109
|
-
if (i.prototype = m, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = pi, i.clone = _n, i.isDecimal = Rt, i.abs = ri, i.acos = ii, i.acosh = oi, i.add = si, i.asin = ai, i.asinh = ui, i.atan = ci, i.atanh = li, i.atan2 = di, i.cbrt = fi, i.ceil = hi, i.clamp = mi, i.cos = gi, i.cosh = vi, i.div = bi, i.exp = wi, i.floor = Si, i.hypot = Ei, i.ln = Ti, i.log = yi, i.log10 = Li, i.log2 = Ci, i.max =
|
|
3109
|
+
if (i.prototype = m, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = pi, i.clone = _n, i.isDecimal = Rt, i.abs = ri, i.acos = ii, i.acosh = oi, i.add = si, i.asin = ai, i.asinh = ui, i.atan = ci, i.atanh = li, i.atan2 = di, i.cbrt = fi, i.ceil = hi, i.clamp = mi, i.cos = gi, i.cosh = vi, i.div = bi, i.exp = wi, i.floor = Si, i.hypot = Ei, i.ln = Ti, i.log = yi, i.log10 = Li, i.log2 = Ci, i.max = xi, i.min = Ai, i.mod = Mi, i.mul = Ii, i.pow = _i, i.random = Oi, i.round = Ni, i.sign = ki, i.sin = Ri, i.sinh = Di, i.sqrt = Vi, i.sub = Fi, i.sum = Bi, i.tan = Ki, i.tanh = Hi, i.trunc = Pi, t === void 0 && (t = {}), t && t.defaults !== !0)
|
|
3110
3110
|
for (r = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], e = 0; e < r.length; ) t.hasOwnProperty(n = r[e++]) || (t[n] = this[n]);
|
|
3111
3111
|
return i.config(t), i;
|
|
3112
3112
|
}
|
|
@@ -3121,15 +3121,15 @@ function Si(t) {
|
|
|
3121
3121
|
}
|
|
3122
3122
|
function Ei() {
|
|
3123
3123
|
var t, e, n = new this(0);
|
|
3124
|
-
for (
|
|
3124
|
+
for (x = !1, t = 0; t < arguments.length; )
|
|
3125
3125
|
if (e = new this(arguments[t++]), e.d)
|
|
3126
3126
|
n.d && (n = n.plus(e.times(e)));
|
|
3127
3127
|
else {
|
|
3128
3128
|
if (e.s)
|
|
3129
|
-
return
|
|
3129
|
+
return x = !0, new this(1 / 0);
|
|
3130
3130
|
n = e;
|
|
3131
3131
|
}
|
|
3132
|
-
return
|
|
3132
|
+
return x = !0, n.sqrt();
|
|
3133
3133
|
}
|
|
3134
3134
|
function Rt(t) {
|
|
3135
3135
|
return t instanceof _e || t && t.toStringTag === yn || !1;
|
|
@@ -3146,11 +3146,11 @@ function Ci(t) {
|
|
|
3146
3146
|
function Li(t) {
|
|
3147
3147
|
return new this(t).log(10);
|
|
3148
3148
|
}
|
|
3149
|
-
function Ai() {
|
|
3150
|
-
return xn(this, arguments, -1);
|
|
3151
|
-
}
|
|
3152
3149
|
function xi() {
|
|
3153
|
-
return
|
|
3150
|
+
return An(this, arguments, -1);
|
|
3151
|
+
}
|
|
3152
|
+
function Ai() {
|
|
3153
|
+
return An(this, arguments, 1);
|
|
3154
3154
|
}
|
|
3155
3155
|
function Mi(t, e) {
|
|
3156
3156
|
return new this(t).mod(e);
|
|
@@ -3204,8 +3204,8 @@ function Fi(t, e) {
|
|
|
3204
3204
|
}
|
|
3205
3205
|
function Bi() {
|
|
3206
3206
|
var t = 0, e = arguments, n = new this(e[t]);
|
|
3207
|
-
for (
|
|
3208
|
-
return
|
|
3207
|
+
for (x = !1; n.s && ++t < e.length; ) n = n.plus(e[t]);
|
|
3208
|
+
return x = !0, E(n, this.precision, this.rounding);
|
|
3209
3209
|
}
|
|
3210
3210
|
function Ki(t) {
|
|
3211
3211
|
return new this(t).tan();
|
|
@@ -3225,8 +3225,8 @@ class be {
|
|
|
3225
3225
|
static formatToTimecode(e, n, r = !1) {
|
|
3226
3226
|
let i = new _e(n), o, s = i.round();
|
|
3227
3227
|
o = i.mul(e).floor();
|
|
3228
|
-
let a,
|
|
3229
|
-
return l = f.divToInt(h), f = f.minus(l.mul(h)),
|
|
3228
|
+
let a, u, c, l, d = s.mul(86400), f = o.mod(d), h = s.mul(3600), v = s.mul(60);
|
|
3229
|
+
return l = f.divToInt(h), f = f.minus(l.mul(h)), c = f.divToInt(v), f = f.minus(c.mul(v)), u = f.divToInt(s), a = f.minus(u.mul(s)), be.formatTimecodeText(l.toNumber(), c.toNumber(), u.toNumber(), a.toNumber(), r);
|
|
3230
3230
|
}
|
|
3231
3231
|
static formatTimecodeText(e, n, r, i, o = !1) {
|
|
3232
3232
|
let s = o ? "." : ":";
|
|
@@ -3515,11 +3515,11 @@ function Wi(t, e) {
|
|
|
3515
3515
|
...d.map((P) => P.duration),
|
|
3516
3516
|
1
|
|
3517
3517
|
));
|
|
3518
|
-
const
|
|
3519
|
-
f.programDateTime &&
|
|
3520
|
-
(P) =>
|
|
3521
|
-
),
|
|
3522
|
-
const
|
|
3518
|
+
const y = new Dt().setVersion(f.version ?? 3).setIndependentSegments(f.independentSegments ?? !0).setTargetDuration(Math.ceil(g));
|
|
3519
|
+
f.programDateTime && y.setProgramDateTime(f.programDateTime), f.playlistType && y.setPlaylistType(f.playlistType), d.forEach(
|
|
3520
|
+
(P) => y.addSegment(P, P.uri === "http://byomakase.org/non-playable-gap")
|
|
3521
|
+
), y.setEndList();
|
|
3522
|
+
const C = y.build(), D = Vt.write(C), A = new Blob([D], { type: "application/vnd.apple.mpegurl" }), k = URL.createObjectURL(A);
|
|
3523
3523
|
if (h && !v) {
|
|
3524
3524
|
const P = new dt(
|
|
3525
3525
|
h.bandwidth,
|
|
@@ -3551,10 +3551,10 @@ function Wi(t, e) {
|
|
|
3551
3551
|
}
|
|
3552
3552
|
}
|
|
3553
3553
|
}
|
|
3554
|
-
const s = r.build(), a = Vt.write(s),
|
|
3554
|
+
const s = r.build(), a = Vt.write(s), u = new Blob([a], {
|
|
3555
3555
|
type: "application/vnd.apple.mpegurl"
|
|
3556
3556
|
});
|
|
3557
|
-
return URL.createObjectURL(
|
|
3557
|
+
return URL.createObjectURL(u);
|
|
3558
3558
|
}
|
|
3559
3559
|
function Xi(t) {
|
|
3560
3560
|
return t === void 0 ? t : t.flatMap((e, n) => {
|
|
@@ -3588,62 +3588,64 @@ function Xi(t) {
|
|
|
3588
3588
|
});
|
|
3589
3589
|
}
|
|
3590
3590
|
function Gi(t, e, n) {
|
|
3591
|
-
const r = [], i = (
|
|
3592
|
-
|
|
3593
|
-
|
|
3591
|
+
const r = [], i = Math.max(
|
|
3592
|
+
...[t, ...e ?? []].filter((u) => u.format === "urn:x-nmos:format:audio").map((u) => u.essence_parameters.channels)
|
|
3593
|
+
), o = [t, ...e ?? []].filter((u) => u.format === "urn:x-nmos:format:audio").find((u) => u.essence_parameters.channels === i), s = (u, c) => {
|
|
3594
|
+
var h;
|
|
3595
|
+
if (u.format !== "urn:x-nmos:format:video" && u.format !== "urn:x-nmos:format:audio")
|
|
3594
3596
|
return;
|
|
3595
|
-
const
|
|
3596
|
-
var
|
|
3597
|
-
const
|
|
3597
|
+
const l = ((h = Xi(c)) == null ? void 0 : h.map((v) => {
|
|
3598
|
+
var y, C;
|
|
3599
|
+
const g = U.timerangeExprDuration(v.timerange);
|
|
3598
3600
|
return new qi(
|
|
3599
|
-
|
|
3600
|
-
((
|
|
3601
|
+
g,
|
|
3602
|
+
((C = (y = v.get_urls) == null ? void 0 : y.at(-1)) == null ? void 0 : C.url) ?? "http://byomakase.org/non-playable-gap"
|
|
3601
3603
|
);
|
|
3602
|
-
})) ?? [],
|
|
3603
|
-
...
|
|
3604
|
+
})) ?? [], d = Math.max(
|
|
3605
|
+
...l.map((v) => v.duration),
|
|
3604
3606
|
1
|
|
3605
|
-
),
|
|
3607
|
+
), f = {
|
|
3606
3608
|
playlistType: "VOD",
|
|
3607
|
-
targetDuration: Math.ceil(
|
|
3609
|
+
targetDuration: Math.ceil(d),
|
|
3608
3610
|
version: 3,
|
|
3609
3611
|
independentSegments: !0
|
|
3610
3612
|
};
|
|
3611
|
-
if (
|
|
3612
|
-
const
|
|
3613
|
-
width:
|
|
3614
|
-
height:
|
|
3615
|
-
},
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3613
|
+
if (u.format === "urn:x-nmos:format:video") {
|
|
3614
|
+
const g = u.essence_parameters, y = {
|
|
3615
|
+
width: g.frame_width,
|
|
3616
|
+
height: g.frame_height
|
|
3617
|
+
}, C = g.frame_rate ? g.frame_rate.denominator ? g.frame_rate.numerator / g.frame_rate.denominator : g.frame_rate.numerator : null, D = new dt(
|
|
3618
|
+
u.avg_bit_rate ?? 0,
|
|
3619
|
+
u.avg_bit_rate ?? 0,
|
|
3620
|
+
y,
|
|
3621
|
+
C,
|
|
3620
3622
|
""
|
|
3621
3623
|
// dummy, will be replaced by URI in exportSegmentsToManifest
|
|
3622
3624
|
);
|
|
3623
|
-
r.push({ segments:
|
|
3624
|
-
} else if (
|
|
3625
|
-
const
|
|
3625
|
+
r.push({ segments: l, metadata: f, streamInfo: D });
|
|
3626
|
+
} else if (u.format === "urn:x-nmos:format:audio") {
|
|
3627
|
+
const g = u.essence_parameters, y = {
|
|
3626
3628
|
type: "AUDIO",
|
|
3627
3629
|
groupId: "audio",
|
|
3628
|
-
name: ve.isNullUndefinedOrWhitespace(
|
|
3629
|
-
isDefault:
|
|
3630
|
+
name: ve.isNullUndefinedOrWhitespace(u.description) ? "" : u.description,
|
|
3631
|
+
isDefault: (o == null ? void 0 : o.id) === u.id,
|
|
3630
3632
|
autoSelect: !0,
|
|
3631
|
-
channels:
|
|
3632
|
-
},
|
|
3633
|
-
bandwidth:
|
|
3634
|
-
averageBandwidth:
|
|
3633
|
+
channels: g.channels.toString()
|
|
3634
|
+
}, C = {
|
|
3635
|
+
bandwidth: u.avg_bit_rate ?? 0,
|
|
3636
|
+
averageBandwidth: u.avg_bit_rate ?? 0,
|
|
3635
3637
|
resolution: null,
|
|
3636
3638
|
frameRate: null,
|
|
3637
3639
|
uri: ""
|
|
3638
3640
|
// dummy
|
|
3639
3641
|
};
|
|
3640
|
-
r.push({ segments:
|
|
3642
|
+
r.push({ segments: l, metadata: f, mediaInfo: y, streamInfo: C });
|
|
3641
3643
|
}
|
|
3642
3644
|
};
|
|
3643
|
-
return t.format === "urn:x-nmos:format:multi" ? e == null || e.forEach((
|
|
3644
|
-
const
|
|
3645
|
-
|
|
3646
|
-
}) :
|
|
3645
|
+
return t.format === "urn:x-nmos:format:multi" ? e == null || e.forEach((u) => {
|
|
3646
|
+
const c = n == null ? void 0 : n.get(u.id);
|
|
3647
|
+
c != null && c.length && s(u, c);
|
|
3648
|
+
}) : s(t, n == null ? void 0 : n.get(t.id)), Wi(r, {
|
|
3647
3649
|
independentSegments: !0
|
|
3648
3650
|
});
|
|
3649
3651
|
}
|
|
@@ -3656,17 +3658,17 @@ const io = w.memo(
|
|
|
3656
3658
|
onVideoLoadedCallback: o,
|
|
3657
3659
|
config: s,
|
|
3658
3660
|
timerange: a,
|
|
3659
|
-
enableHotkey:
|
|
3661
|
+
enableHotkey: u
|
|
3660
3662
|
}) {
|
|
3661
|
-
const
|
|
3663
|
+
const c = Bn(() => Gi(e, n, r), [e, r, n, a]);
|
|
3662
3664
|
return /* @__PURE__ */ w.createElement(
|
|
3663
3665
|
Dr,
|
|
3664
3666
|
{
|
|
3665
|
-
videoUrl:
|
|
3667
|
+
videoUrl: c,
|
|
3666
3668
|
videoLoadOptions: i,
|
|
3667
3669
|
onVideoLoadedCallback: o,
|
|
3668
3670
|
config: s,
|
|
3669
|
-
enableHotkeys:
|
|
3671
|
+
enableHotkeys: u
|
|
3670
3672
|
}
|
|
3671
3673
|
);
|
|
3672
3674
|
}
|
|
@@ -3930,18 +3932,18 @@ class Ft extends HTMLElement {
|
|
|
3930
3932
|
S(this, "getSliderValues", () => {
|
|
3931
3933
|
const { wrapperWidth: n, selectorLeft: r, selectorWidth: i } = this.getBounds(), o = this._labels.at(this.firstLabelIndex), s = this._labels.at(this.lastLabelIndex), a = Math.round(
|
|
3932
3934
|
o + r / n * (s - o)
|
|
3933
|
-
),
|
|
3935
|
+
), u = Math.round(
|
|
3934
3936
|
o + (r + i) / n * (s - o)
|
|
3935
3937
|
);
|
|
3936
|
-
return { start: a, end:
|
|
3938
|
+
return { start: a, end: u };
|
|
3937
3939
|
});
|
|
3938
3940
|
S(this, "getSelectorBounds", (n, r) => {
|
|
3939
3941
|
const { wrapperWidth: i } = this.getBounds(), o = this._labels.at(this.firstLabelIndex), s = this._labels.at(this.lastLabelIndex), a = Math.round(
|
|
3940
3942
|
(n - o) / (s - o) * i
|
|
3941
|
-
),
|
|
3943
|
+
), u = Math.round(
|
|
3942
3944
|
(r - n) / (s - o) * i
|
|
3943
3945
|
);
|
|
3944
|
-
return { selectorLeft: a, selectorWidth:
|
|
3946
|
+
return { selectorLeft: a, selectorWidth: u };
|
|
3945
3947
|
});
|
|
3946
3948
|
S(this, "initSlider", (n, r) => {
|
|
3947
3949
|
const i = this.getSelectorBounds(n, r);
|
|
@@ -3973,46 +3975,46 @@ class Ft extends HTMLElement {
|
|
|
3973
3975
|
S(this, "onMouseDownRight", (n) => {
|
|
3974
3976
|
n.preventDefault();
|
|
3975
3977
|
const r = n.clientX, { selectorWidth: i, wrapperWidth: o, selectorLeft: s } = this.getBounds();
|
|
3976
|
-
let a = null,
|
|
3977
|
-
const
|
|
3978
|
+
let a = null, u = null;
|
|
3979
|
+
const c = (d) => {
|
|
3978
3980
|
let f = d.clientX - r, h = Math.max(this.minWidth, i + f);
|
|
3979
3981
|
const v = Math.min(
|
|
3980
3982
|
o * this.maxWidthPercent,
|
|
3981
3983
|
o - s
|
|
3982
|
-
), g = h > v,
|
|
3983
|
-
g ? a === null && (a =
|
|
3984
|
-
this.outOfBoundsCallback(!0),
|
|
3984
|
+
), g = h > v, y = performance.now();
|
|
3985
|
+
g ? a === null && (a = y, u = window.setTimeout(() => {
|
|
3986
|
+
this.outOfBoundsCallback(!0), u = window.setInterval(
|
|
3985
3987
|
() => this.outOfBoundsCallback(!0),
|
|
3986
3988
|
400
|
|
3987
3989
|
);
|
|
3988
|
-
}, 500)) : (
|
|
3990
|
+
}, 500)) : (u !== null && (clearTimeout(u), clearInterval(u), u = null), a = null), h = Math.min(h, v), this._rangeSelector.style.width = `${h}px`, this.updateDuration();
|
|
3989
3991
|
}, l = () => {
|
|
3990
|
-
this.showButtons(), document.removeEventListener("mousemove",
|
|
3992
|
+
this.showButtons(), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", l), u !== null && (clearTimeout(u), clearInterval(u), u = null), a = null;
|
|
3991
3993
|
};
|
|
3992
|
-
document.addEventListener("mousemove",
|
|
3994
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", l);
|
|
3993
3995
|
});
|
|
3994
3996
|
S(this, "onMouseDownLeft", (n) => {
|
|
3995
3997
|
n.preventDefault();
|
|
3996
3998
|
const r = n.clientX, { selectorLeft: i, selectorWidth: o, wrapperWidth: s } = this.getBounds();
|
|
3997
|
-
let a = null,
|
|
3998
|
-
const
|
|
3999
|
+
let a = null, u = null;
|
|
4000
|
+
const c = (d) => {
|
|
3999
4001
|
let f = d.clientX - r, h = i + f;
|
|
4000
4002
|
const v = h < 0, g = performance.now();
|
|
4001
|
-
v ? a === null && (a = g,
|
|
4002
|
-
this.outOfBoundsCallback(!1),
|
|
4003
|
+
v ? a === null && (a = g, u = window.setTimeout(() => {
|
|
4004
|
+
this.outOfBoundsCallback(!1), u = window.setInterval(
|
|
4003
4005
|
() => this.outOfBoundsCallback(!1),
|
|
4004
4006
|
400
|
|
4005
4007
|
);
|
|
4006
|
-
}, 500)) : (
|
|
4007
|
-
let
|
|
4008
|
+
}, 500)) : (u !== null && (clearTimeout(u), clearInterval(u), u = null), a = null), h < 0 && (f = -i, h = 0);
|
|
4009
|
+
let y = Math.min(
|
|
4008
4010
|
Math.max(this.minWidth, o - f),
|
|
4009
4011
|
s
|
|
4010
4012
|
);
|
|
4011
|
-
h +
|
|
4013
|
+
h + y > s && (h = s - y), y > this.minWidth && y < s * this.maxWidthPercent && (this._rangeSelector.style.left = `${h}px`, this._rangeSelector.style.width = `${y}px`), this.updateDuration();
|
|
4012
4014
|
}, l = () => {
|
|
4013
|
-
this.showButtons(), document.removeEventListener("mousemove",
|
|
4015
|
+
this.showButtons(), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", l), u !== null && (clearTimeout(u), clearInterval(u), u = null), a = null;
|
|
4014
4016
|
};
|
|
4015
|
-
document.addEventListener("mousemove",
|
|
4017
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", l);
|
|
4016
4018
|
});
|
|
4017
4019
|
S(this, "outOfBoundsCallback", (n) => {
|
|
4018
4020
|
n ? this.firstLabelIndex += 1 : this.firstLabelIndex -= 1, this.resetSegments();
|
|
@@ -4022,27 +4024,27 @@ class Ft extends HTMLElement {
|
|
|
4022
4024
|
return;
|
|
4023
4025
|
n.preventDefault();
|
|
4024
4026
|
const r = n.clientX, { selectorLeft: i, selectorWidth: o, wrapperWidth: s } = this.getBounds();
|
|
4025
|
-
let a = null,
|
|
4026
|
-
const
|
|
4027
|
+
let a = null, u = null;
|
|
4028
|
+
const c = (d) => {
|
|
4027
4029
|
let f = d.clientX - r, h = i + f;
|
|
4028
|
-
const v = s - o, g = h < 0 || h > v,
|
|
4030
|
+
const v = s - o, g = h < 0 || h > v, y = performance.now();
|
|
4029
4031
|
if (g) {
|
|
4030
4032
|
if (a === null) {
|
|
4031
|
-
const
|
|
4032
|
-
a =
|
|
4033
|
-
this.outOfBoundsCallback(
|
|
4034
|
-
() => this.outOfBoundsCallback(
|
|
4033
|
+
const C = h > v;
|
|
4034
|
+
a = y, u = window.setTimeout(() => {
|
|
4035
|
+
this.outOfBoundsCallback(C), u = window.setInterval(
|
|
4036
|
+
() => this.outOfBoundsCallback(C),
|
|
4035
4037
|
400
|
|
4036
4038
|
);
|
|
4037
4039
|
}, 500);
|
|
4038
4040
|
}
|
|
4039
4041
|
} else
|
|
4040
|
-
|
|
4042
|
+
u !== null && (clearTimeout(u), clearInterval(u), u = null), a = null;
|
|
4041
4043
|
h = Math.max(0, Math.min(h, v)), this._rangeSelector.style.left = `${h}px`, this.updateDuration();
|
|
4042
4044
|
}, l = () => {
|
|
4043
|
-
this.showButtons(), document.removeEventListener("mousemove",
|
|
4045
|
+
this.showButtons(), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", l), u !== null && (clearTimeout(u), clearInterval(u));
|
|
4044
4046
|
};
|
|
4045
|
-
document.addEventListener("mousemove",
|
|
4047
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", l);
|
|
4046
4048
|
});
|
|
4047
4049
|
}
|
|
4048
4050
|
set numberOfSegments(n) {
|
|
@@ -4126,18 +4128,18 @@ class Ft extends HTMLElement {
|
|
|
4126
4128
|
"mousedown",
|
|
4127
4129
|
this.onMouseDownRight
|
|
4128
4130
|
), this._rangeSelector.addEventListener("mousedown", this.onMouseDownDrag), this.append(this._container), this.initSlider(r, i);
|
|
4129
|
-
const { start:
|
|
4130
|
-
this.currentStart =
|
|
4131
|
+
const { start: u, end: c } = this.getSliderValues();
|
|
4132
|
+
this.currentStart = u, this.currentEnd = c, this.updateDuration();
|
|
4131
4133
|
}
|
|
4132
4134
|
resolveInitialSegment(n, r) {
|
|
4133
|
-
const i = this._numberOfSegments * this.segmentSize, o = r - n, s = this.maxValue - this.minValue, a = n - this.minValue,
|
|
4134
|
-
let
|
|
4135
|
-
a / s *
|
|
4135
|
+
const i = this._numberOfSegments * this.segmentSize, o = r - n, s = this.maxValue - this.minValue, a = n - this.minValue, u = Math.ceil(s / this.segmentSize);
|
|
4136
|
+
let c = Math.floor(
|
|
4137
|
+
a / s * u
|
|
4136
4138
|
);
|
|
4137
|
-
|
|
4139
|
+
c += Math.floor(
|
|
4138
4140
|
(i - o) / this.segmentSize
|
|
4139
4141
|
);
|
|
4140
|
-
const d =
|
|
4142
|
+
const d = c + Math.ceil(o / this.segmentSize) - this._numberOfSegments;
|
|
4141
4143
|
this.firstLabelIndex = d, this._initialFirstLabelIndex = d;
|
|
4142
4144
|
}
|
|
4143
4145
|
createButtonSvg(n) {
|
|
@@ -4153,7 +4155,7 @@ class Ft extends HTMLElement {
|
|
|
4153
4155
|
}
|
|
4154
4156
|
buildSegments(n) {
|
|
4155
4157
|
const r = document.createElement("div");
|
|
4156
|
-
n.slice(0, -2).forEach((
|
|
4158
|
+
n.slice(0, -2).forEach((c) => {
|
|
4157
4159
|
const l = document.createElement("div");
|
|
4158
4160
|
l.classList.add(R.segment);
|
|
4159
4161
|
const d = document.createElement("div");
|
|
@@ -4161,7 +4163,7 @@ class Ft extends HTMLElement {
|
|
|
4161
4163
|
const f = document.createElement("div");
|
|
4162
4164
|
f.classList.add(R.segmentTick);
|
|
4163
4165
|
const h = document.createElement("div");
|
|
4164
|
-
h.classList.add(R.segmentLabel), h.innerHTML = Ve(
|
|
4166
|
+
h.classList.add(R.segmentLabel), h.innerHTML = Ve(c), l.append(d, f, h), r.append(l);
|
|
4165
4167
|
});
|
|
4166
4168
|
const i = document.createElement("div");
|
|
4167
4169
|
i.classList.add(R.segment);
|
|
@@ -4174,15 +4176,15 @@ class Ft extends HTMLElement {
|
|
|
4174
4176
|
R.segmentLabel,
|
|
4175
4177
|
R.firstSegmentLabel
|
|
4176
4178
|
), a.innerHTML = Ve(n.at(-2));
|
|
4177
|
-
const
|
|
4178
|
-
return
|
|
4179
|
+
const u = document.createElement("div");
|
|
4180
|
+
return u.classList.add(
|
|
4179
4181
|
R.segmentLabel,
|
|
4180
4182
|
R.secondSegmentLabel
|
|
4181
|
-
),
|
|
4183
|
+
), u.innerHTML = Ve(n.at(-1)), i.append(
|
|
4182
4184
|
o,
|
|
4183
4185
|
s,
|
|
4184
4186
|
a,
|
|
4185
|
-
|
|
4187
|
+
u
|
|
4186
4188
|
), r.append(i), r;
|
|
4187
4189
|
}
|
|
4188
4190
|
}
|
|
@@ -4200,10 +4202,10 @@ const Bt = "omakase-time-range-selector-react-div", oo = ({
|
|
|
4200
4202
|
var h;
|
|
4201
4203
|
const s = U.parseTimeRange(e), a = U.timeMomentToSeconds(
|
|
4202
4204
|
s.start
|
|
4203
|
-
),
|
|
4204
|
-
|
|
4205
|
-
), d = U.timeMomentToSeconds(
|
|
4206
|
-
f.setAttribute("minValue", a.toString()), f.setAttribute("maxValue",
|
|
4205
|
+
), u = U.timeMomentToSeconds(s.end), c = U.parseTimeRange(t), l = U.timeMomentToSeconds(
|
|
4206
|
+
c.start
|
|
4207
|
+
), d = U.timeMomentToSeconds(c.end), f = new Ft();
|
|
4208
|
+
f.setAttribute("minValue", a.toString()), f.setAttribute("maxValue", u.toString()), f.setAttribute("maxRange", i.toString()), f.setAttribute("segmentSize", r.toString()), f.setAttribute(
|
|
4207
4209
|
"numberOfSegments",
|
|
4208
4210
|
n.toString()
|
|
4209
4211
|
), f.setAttribute("sliderStart", l.toString()), f.setAttribute("sliderEnd", d.toString()), f.onCheckmarkClickCallback = o, (h = document.getElementById(Bt)) == null || h.append(f);
|