@byomakase/omakase-react-components 0.0.1-SNAPSHOT.1743070950

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +3 -0
  3. package/dist/index.cjs.js +213 -0
  4. package/dist/index.cjs.js.map +1 -0
  5. package/dist/index.es.d.ts +2 -0
  6. package/dist/index.es.js +3959 -0
  7. package/dist/index.es.js.map +1 -0
  8. package/dist/index.umd.js +213 -0
  9. package/dist/index.umd.js.map +1 -0
  10. package/dist/omakase-react-components.css +1 -0
  11. package/dist/react/omakase-components/src/components/OmakaseMarkerListComponent/OmakaseMarkerListComponent.d.ts +10 -0
  12. package/dist/react/omakase-components/src/components/OmakaseMarkerListComponent/index.d.ts +1 -0
  13. package/dist/react/omakase-components/src/components/OmakasePlayerComponent/OmakasePlayerComponent.d.ts +12 -0
  14. package/dist/react/omakase-components/src/components/OmakasePlayerComponent/OmakasePlayerHotKeyHandler.d.ts +5 -0
  15. package/dist/react/omakase-components/src/components/OmakasePlayerComponent/index.d.ts +1 -0
  16. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineComponent/OmakasePlayerTimelineComponent.d.ts +9 -0
  17. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineComponent/OmaksePlayerTimelineBuilder.d.ts +21 -0
  18. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineComponent/index.d.ts +2 -0
  19. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineControlsToolbar/OmakaseButton.d.ts +12 -0
  20. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineControlsToolbar/OmakasePlayerTimelineControlsToolbar.d.ts +25 -0
  21. package/dist/react/omakase-components/src/components/OmakasePlayerTimelineControlsToolbar/index.d.ts +1 -0
  22. package/dist/react/omakase-components/src/components/OmakaseTamsPlayerComponent/OmakaseTamsPlayerComponent.d.ts +17 -0
  23. package/dist/react/omakase-components/src/components/OmakaseTamsPlayerComponent/index.d.ts +1 -0
  24. package/dist/react/omakase-components/src/components/OmakaseTamsPlayerComponent/virtual-manifest/m3u8-exporter.d.ts +2 -0
  25. package/dist/react/omakase-components/src/components/OmakaseTamsPlayerComponent/virtual-manifest/m3u8.d.ts +79 -0
  26. package/dist/react/omakase-components/src/components/OmakaseTamsPlayerComponent/virtual-manifest/m3u8.model.d.ts +127 -0
  27. package/dist/react/omakase-components/src/components/OmakaseTimeRangePicker/OmakaseTimeRangePicker.d.ts +11 -0
  28. package/dist/react/omakase-components/src/components/OmakaseTimeRangePicker/index.d.ts +1 -0
  29. package/dist/react/omakase-components/src/components/index.d.ts +7 -0
  30. package/dist/react/omakase-components/src/icons/Back3Icon.d.ts +3 -0
  31. package/dist/react/omakase-components/src/icons/DeleteMarkerIcon.d.ts +3 -0
  32. package/dist/react/omakase-components/src/icons/Forward3Icon.d.ts +3 -0
  33. package/dist/react/omakase-components/src/icons/LeftBracketIcon.d.ts +3 -0
  34. package/dist/react/omakase-components/src/icons/LeftDoubleBracketIcon.d.ts +3 -0
  35. package/dist/react/omakase-components/src/icons/LeftMarkerIcon.d.ts +3 -0
  36. package/dist/react/omakase-components/src/icons/PlusIcon.d.ts +3 -0
  37. package/dist/react/omakase-components/src/icons/RefreshIcon.d.ts +3 -0
  38. package/dist/react/omakase-components/src/icons/RightBracketIcon.d.ts +3 -0
  39. package/dist/react/omakase-components/src/icons/RightDoubleBracketIcon.d.ts +3 -0
  40. package/dist/react/omakase-components/src/icons/RightMarkerIcon.d.ts +3 -0
  41. package/dist/react/omakase-components/src/icons/SplitMarkerIcon.d.ts +3 -0
  42. package/dist/react/omakase-components/src/icons/index.d.ts +1 -0
  43. package/dist/react/omakase-components/src/index.d.ts +3 -0
  44. package/dist/react/omakase-components/src/types/tams/index.d.ts +1 -0
  45. package/dist/react/omakase-components/src/types/tams/model/audio-codec-parameters.d.ts +19 -0
  46. package/dist/react/omakase-components/src/types/tams/model/audio-flow-essence-parameters.d.ts +21 -0
  47. package/dist/react/omakase-components/src/types/tams/model/audio-flow.d.ts +104 -0
  48. package/dist/react/omakase-components/src/types/tams/model/avc-codec-parameters.d.ts +23 -0
  49. package/dist/react/omakase-components/src/types/tams/model/collection-item.d.ts +15 -0
  50. package/dist/react/omakase-components/src/types/tams/model/container-mapping-audio-track.d.ts +22 -0
  51. package/dist/react/omakase-components/src/types/tams/model/container-mapping-isobmff-container.d.ts +18 -0
  52. package/dist/react/omakase-components/src/types/tams/model/container-mapping-mp2ts-container.d.ts +18 -0
  53. package/dist/react/omakase-components/src/types/tams/model/container-mapping-mxf-container.d.ts +22 -0
  54. package/dist/react/omakase-components/src/types/tams/model/container-mapping.d.ts +21 -0
  55. package/dist/react/omakase-components/src/types/tams/model/container-mapping1.d.ts +21 -0
  56. package/dist/react/omakase-components/src/types/tams/model/contentformat.d.ts +19 -0
  57. package/dist/react/omakase-components/src/types/tams/model/data-flow-essence-parameters.d.ts +18 -0
  58. package/dist/react/omakase-components/src/types/tams/model/data-flow.d.ts +104 -0
  59. package/dist/react/omakase-components/src/types/tams/model/deletion-request-error.d.ts +30 -0
  60. package/dist/react/omakase-components/src/types/tams/model/deletion-request.d.ts +56 -0
  61. package/dist/react/omakase-components/src/types/tams/model/event-stream-mechanism.d.ts +26 -0
  62. package/dist/react/omakase-components/src/types/tams/model/flow-core-segment-duration.d.ts +22 -0
  63. package/dist/react/omakase-components/src/types/tams/model/flow-segment-get-urls-inner.d.ts +19 -0
  64. package/dist/react/omakase-components/src/types/tams/model/flow-segment.d.ts +38 -0
  65. package/dist/react/omakase-components/src/types/tams/model/flow-segment1.d.ts +38 -0
  66. package/dist/react/omakase-components/src/types/tams/model/flow-storage-post.d.ts +18 -0
  67. package/dist/react/omakase-components/src/types/tams/model/flow.d.ts +14 -0
  68. package/dist/react/omakase-components/src/types/tams/model/http-request.d.ts +32 -0
  69. package/dist/react/omakase-components/src/types/tams/model/image-flow-essence-parameters.d.ts +19 -0
  70. package/dist/react/omakase-components/src/types/tams/model/image-flow.d.ts +104 -0
  71. package/dist/react/omakase-components/src/types/tams/model/media-bucket-object-store-media-objects-inner.d.ts +12 -0
  72. package/dist/react/omakase-components/src/types/tams/model/media-bucket-object-store-pre-inner.d.ts +19 -0
  73. package/dist/react/omakase-components/src/types/tams/model/media-bucket-object-store.d.ts +16 -0
  74. package/dist/react/omakase-components/src/types/tams/model/models.d.ts +41 -0
  75. package/dist/react/omakase-components/src/types/tams/model/multi-essence-flow.d.ts +102 -0
  76. package/dist/react/omakase-components/src/types/tams/model/register-webhook.d.ts +50 -0
  77. package/dist/react/omakase-components/src/types/tams/model/register-webhook1.d.ts +50 -0
  78. package/dist/react/omakase-components/src/types/tams/model/service-media-store.d.ts +24 -0
  79. package/dist/react/omakase-components/src/types/tams/model/service.d.ts +32 -0
  80. package/dist/react/omakase-components/src/types/tams/model/source.d.ts +61 -0
  81. package/dist/react/omakase-components/src/types/tams/model/uncompressed-audio-parameters.d.ts +23 -0
  82. package/dist/react/omakase-components/src/types/tams/model/uncompressed-video-parameters.d.ts +36 -0
  83. package/dist/react/omakase-components/src/types/tams/model/update-service-info.d.ts +22 -0
  84. package/dist/react/omakase-components/src/types/tams/model/video-flow-essence-parameters-aspect-ratio.d.ts +22 -0
  85. package/dist/react/omakase-components/src/types/tams/model/video-flow-essence-parameters-frame-rate.d.ts +22 -0
  86. package/dist/react/omakase-components/src/types/tams/model/video-flow-essence-parameters-pixel-aspect-ratio.d.ts +22 -0
  87. package/dist/react/omakase-components/src/types/tams/model/video-flow-essence-parameters.d.ts +78 -0
  88. package/dist/react/omakase-components/src/types/tams/model/video-flow.d.ts +104 -0
  89. package/dist/react/omakase-components/src/types/user-agent.d.ts +2 -0
  90. package/dist/react/omakase-components/src/util/array-util.d.ts +3 -0
  91. package/dist/react/omakase-components/src/util/blob-util.d.ts +7 -0
  92. package/dist/react/omakase-components/src/util/color-util.d.ts +21 -0
  93. package/dist/react/omakase-components/src/util/crypto-util.d.ts +3 -0
  94. package/dist/react/omakase-components/src/util/frame-rate-util.d.ts +3 -0
  95. package/dist/react/omakase-components/src/util/object-util.d.ts +1 -0
  96. package/dist/react/omakase-components/src/util/player-util.d.ts +3 -0
  97. package/dist/react/omakase-components/src/util/rxjs-util.d.ts +2 -0
  98. package/dist/react/omakase-components/src/util/string-util.d.ts +9 -0
  99. package/dist/react/omakase-components/src/util/time-range-util.d.ts +38 -0
  100. package/dist/react/omakase-components/src/util/timecode-util.d.ts +10 -0
  101. package/dist/react/omakase-components/src/util/window-util.d.ts +6 -0
  102. package/dist/react/omakase-components/vite.config.d.ts +2 -0
  103. package/package.json +32 -0
@@ -0,0 +1,3959 @@
1
+ var sn = Object.defineProperty;
2
+ var an = (e, t, n) => t in e ? sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var v = (e, t, n) => an(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { MarkerLane as Tt, ThumbnailLane as un, OmakasePlayer as ln, PeriodMarker as Q } from "@byomakase/omakase-player";
5
+ import g, { useEffect as j, useRef as ht, useState as Ae, useMemo as cn } from "react";
6
+ class _i {
7
+ constructor(t) {
8
+ v(this, "_lanes", []);
9
+ v(this, "_markersLaneMap", /* @__PURE__ */ new Map());
10
+ v(this, "_laneNodenMap", /* @__PURE__ */ new Map());
11
+ this.omakasePlayer = t;
12
+ }
13
+ addMarkerLane(t) {
14
+ const n = {
15
+ config: t,
16
+ type: "marker"
17
+ };
18
+ this._lanes.push(n);
19
+ }
20
+ addMarkers(t, n) {
21
+ this._markersLaneMap.get(t) === void 0 && this._markersLaneMap.set(t, []), this._markersLaneMap.get(t).push(...n);
22
+ }
23
+ addTimelineNode(t, n) {
24
+ this._laneNodenMap.get(t) || this._laneNodenMap.set(t, []), this._laneNodenMap.get(t).push(n);
25
+ }
26
+ addThumbnailLane(t) {
27
+ const n = {
28
+ config: t,
29
+ type: "thumbnail"
30
+ };
31
+ this._lanes.push(n);
32
+ }
33
+ buildAndAttachTimeline(t) {
34
+ this.omakasePlayer.createTimeline(t).subscribe({
35
+ next: (n) => {
36
+ this.buildAttachedTimeline(n);
37
+ }
38
+ });
39
+ }
40
+ buildAttachedTimeline(t) {
41
+ this._lanes.forEach(
42
+ (n) => this._createAndAttachLane(t, n)
43
+ );
44
+ }
45
+ _createAndAttachLane(t, n) {
46
+ let r;
47
+ if (n.type === "marker") {
48
+ r = new Tt(n.config), t.addTimelineLane(r);
49
+ const o = this._markersLaneMap.get(r.id);
50
+ o == null || o.forEach((s) => r.addMarker(s));
51
+ } else n.type === "thumbnail" && (r = new un(n.config), t.addTimelineLane(r));
52
+ const i = this._laneNodenMap.get(r.id);
53
+ i == null || i.forEach((o) => {
54
+ r.addTimelineNode(o.config);
55
+ });
56
+ }
57
+ }
58
+ var et = function(e, t) {
59
+ return et = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
60
+ n.__proto__ = r;
61
+ } || function(n, r) {
62
+ for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
63
+ }, et(e, t);
64
+ };
65
+ function Oe(e, t) {
66
+ if (typeof t != "function" && t !== null)
67
+ throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
68
+ et(e, t);
69
+ function n() {
70
+ this.constructor = e;
71
+ }
72
+ e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
73
+ }
74
+ function fn(e, t, n, r) {
75
+ function i(o) {
76
+ return o instanceof n ? o : new n(function(s) {
77
+ s(o);
78
+ });
79
+ }
80
+ return new (n || (n = Promise))(function(o, s) {
81
+ function a(c) {
82
+ try {
83
+ u(r.next(c));
84
+ } catch (d) {
85
+ s(d);
86
+ }
87
+ }
88
+ function l(c) {
89
+ try {
90
+ u(r.throw(c));
91
+ } catch (d) {
92
+ s(d);
93
+ }
94
+ }
95
+ function u(c) {
96
+ c.done ? o(c.value) : i(c.value).then(a, l);
97
+ }
98
+ u((r = r.apply(e, t || [])).next());
99
+ });
100
+ }
101
+ function _t(e, t) {
102
+ var n = { label: 0, sent: function() {
103
+ if (o[0] & 1) throw o[1];
104
+ return o[1];
105
+ }, trys: [], ops: [] }, r, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
106
+ return s.next = a(0), s.throw = a(1), s.return = a(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
107
+ return this;
108
+ }), s;
109
+ function a(u) {
110
+ return function(c) {
111
+ return l([u, c]);
112
+ };
113
+ }
114
+ function l(u) {
115
+ if (r) throw new TypeError("Generator is already executing.");
116
+ for (; s && (s = 0, u[0] && (n = 0)), n; ) try {
117
+ if (r = 1, i && (o = u[0] & 2 ? i.return : u[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, u[1])).done) return o;
118
+ switch (i = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
119
+ case 0:
120
+ case 1:
121
+ o = u;
122
+ break;
123
+ case 4:
124
+ return n.label++, { value: u[1], done: !1 };
125
+ case 5:
126
+ n.label++, i = u[1], u = [0];
127
+ continue;
128
+ case 7:
129
+ u = n.ops.pop(), n.trys.pop();
130
+ continue;
131
+ default:
132
+ if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
133
+ n = 0;
134
+ continue;
135
+ }
136
+ if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
137
+ n.label = u[1];
138
+ break;
139
+ }
140
+ if (u[0] === 6 && n.label < o[1]) {
141
+ n.label = o[1], o = u;
142
+ break;
143
+ }
144
+ if (o && n.label < o[2]) {
145
+ n.label = o[2], n.ops.push(u);
146
+ break;
147
+ }
148
+ o[2] && n.ops.pop(), n.trys.pop();
149
+ continue;
150
+ }
151
+ u = t.call(e, n);
152
+ } catch (c) {
153
+ u = [6, c], i = 0;
154
+ } finally {
155
+ r = o = 0;
156
+ }
157
+ if (u[0] & 5) throw u[1];
158
+ return { value: u[0] ? u[1] : void 0, done: !0 };
159
+ }
160
+ }
161
+ function we(e) {
162
+ var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
163
+ if (n) return n.call(e);
164
+ if (e && typeof e.length == "number") return {
165
+ next: function() {
166
+ return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
167
+ }
168
+ };
169
+ throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
170
+ }
171
+ function He(e, t) {
172
+ var n = typeof Symbol == "function" && e[Symbol.iterator];
173
+ if (!n) return e;
174
+ var r = n.call(e), i, o = [], s;
175
+ try {
176
+ for (; (t === void 0 || t-- > 0) && !(i = r.next()).done; ) o.push(i.value);
177
+ } catch (a) {
178
+ s = { error: a };
179
+ } finally {
180
+ try {
181
+ i && !i.done && (n = r.return) && n.call(r);
182
+ } finally {
183
+ if (s) throw s.error;
184
+ }
185
+ }
186
+ return o;
187
+ }
188
+ function $e(e, t, n) {
189
+ if (n || arguments.length === 2) for (var r = 0, i = t.length, o; r < i; r++)
190
+ (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
191
+ return e.concat(o || Array.prototype.slice.call(t));
192
+ }
193
+ function be(e) {
194
+ return this instanceof be ? (this.v = e, this) : new be(e);
195
+ }
196
+ function dn(e, t, n) {
197
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
198
+ var r = n.apply(e, t || []), i, o = [];
199
+ return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", s), i[Symbol.asyncIterator] = function() {
200
+ return this;
201
+ }, i;
202
+ function s(h) {
203
+ return function(b) {
204
+ return Promise.resolve(b).then(h, d);
205
+ };
206
+ }
207
+ function a(h, b) {
208
+ r[h] && (i[h] = function(p) {
209
+ return new Promise(function(_, T) {
210
+ o.push([h, p, _, T]) > 1 || l(h, p);
211
+ });
212
+ }, b && (i[h] = b(i[h])));
213
+ }
214
+ function l(h, b) {
215
+ try {
216
+ u(r[h](b));
217
+ } catch (p) {
218
+ f(o[0][3], p);
219
+ }
220
+ }
221
+ function u(h) {
222
+ h.value instanceof be ? Promise.resolve(h.value.v).then(c, d) : f(o[0][2], h);
223
+ }
224
+ function c(h) {
225
+ l("next", h);
226
+ }
227
+ function d(h) {
228
+ l("throw", h);
229
+ }
230
+ function f(h, b) {
231
+ h(b), o.shift(), o.length && l(o[0][0], o[0][1]);
232
+ }
233
+ }
234
+ function hn(e) {
235
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
236
+ var t = e[Symbol.asyncIterator], n;
237
+ return t ? t.call(e) : (e = typeof we == "function" ? we(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
238
+ return this;
239
+ }, n);
240
+ function r(o) {
241
+ n[o] = e[o] && function(s) {
242
+ return new Promise(function(a, l) {
243
+ s = e[o](s), i(a, l, s.done, s.value);
244
+ });
245
+ };
246
+ }
247
+ function i(o, s, a, l) {
248
+ Promise.resolve(l).then(function(u) {
249
+ o({ value: u, done: a });
250
+ }, s);
251
+ }
252
+ }
253
+ function R(e) {
254
+ return typeof e == "function";
255
+ }
256
+ function lt(e) {
257
+ var t = function(r) {
258
+ Error.call(r), r.stack = new Error().stack;
259
+ }, n = e(t);
260
+ return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
261
+ }
262
+ var Ye = lt(function(e) {
263
+ return function(n) {
264
+ e(this), this.message = n ? n.length + ` errors occurred during unsubscription:
265
+ ` + n.map(function(r, i) {
266
+ return i + 1 + ") " + r.toString();
267
+ }).join(`
268
+ `) : "", this.name = "UnsubscriptionError", this.errors = n;
269
+ };
270
+ });
271
+ function tt(e, t) {
272
+ if (e) {
273
+ var n = e.indexOf(t);
274
+ 0 <= n && e.splice(n, 1);
275
+ }
276
+ }
277
+ var Pe = function() {
278
+ function e(t) {
279
+ this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
280
+ }
281
+ return e.prototype.unsubscribe = function() {
282
+ var t, n, r, i, o;
283
+ if (!this.closed) {
284
+ this.closed = !0;
285
+ var s = this._parentage;
286
+ if (s)
287
+ if (this._parentage = null, Array.isArray(s))
288
+ try {
289
+ for (var a = we(s), l = a.next(); !l.done; l = a.next()) {
290
+ var u = l.value;
291
+ u.remove(this);
292
+ }
293
+ } catch (p) {
294
+ t = { error: p };
295
+ } finally {
296
+ try {
297
+ l && !l.done && (n = a.return) && n.call(a);
298
+ } finally {
299
+ if (t) throw t.error;
300
+ }
301
+ }
302
+ else
303
+ s.remove(this);
304
+ var c = this.initialTeardown;
305
+ if (R(c))
306
+ try {
307
+ c();
308
+ } catch (p) {
309
+ o = p instanceof Ye ? p.errors : [p];
310
+ }
311
+ var d = this._finalizers;
312
+ if (d) {
313
+ this._finalizers = null;
314
+ try {
315
+ for (var f = we(d), h = f.next(); !h.done; h = f.next()) {
316
+ var b = h.value;
317
+ try {
318
+ mt(b);
319
+ } catch (p) {
320
+ o = o ?? [], p instanceof Ye ? o = $e($e([], He(o)), He(p.errors)) : o.push(p);
321
+ }
322
+ }
323
+ } catch (p) {
324
+ r = { error: p };
325
+ } finally {
326
+ try {
327
+ h && !h.done && (i = f.return) && i.call(f);
328
+ } finally {
329
+ if (r) throw r.error;
330
+ }
331
+ }
332
+ }
333
+ if (o)
334
+ throw new Ye(o);
335
+ }
336
+ }, e.prototype.add = function(t) {
337
+ var n;
338
+ if (t && t !== this)
339
+ if (this.closed)
340
+ mt(t);
341
+ else {
342
+ if (t instanceof e) {
343
+ if (t.closed || t._hasParent(this))
344
+ return;
345
+ t._addParent(this);
346
+ }
347
+ (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(t);
348
+ }
349
+ }, e.prototype._hasParent = function(t) {
350
+ var n = this._parentage;
351
+ return n === t || Array.isArray(n) && n.includes(t);
352
+ }, e.prototype._addParent = function(t) {
353
+ var n = this._parentage;
354
+ this._parentage = Array.isArray(n) ? (n.push(t), n) : n ? [n, t] : t;
355
+ }, e.prototype._removeParent = function(t) {
356
+ var n = this._parentage;
357
+ n === t ? this._parentage = null : Array.isArray(n) && tt(n, t);
358
+ }, e.prototype.remove = function(t) {
359
+ var n = this._finalizers;
360
+ n && tt(n, t), t instanceof e && t._removeParent(this);
361
+ }, e.EMPTY = function() {
362
+ var t = new e();
363
+ return t.closed = !0, t;
364
+ }(), e;
365
+ }(), yt = Pe.EMPTY;
366
+ function xt(e) {
367
+ return e instanceof Pe || e && "closed" in e && R(e.remove) && R(e.add) && R(e.unsubscribe);
368
+ }
369
+ function mt(e) {
370
+ R(e) ? e() : e.unsubscribe();
371
+ }
372
+ var mn = {
373
+ Promise: void 0
374
+ }, pn = {
375
+ setTimeout: function(e, t) {
376
+ for (var n = [], r = 2; r < arguments.length; r++)
377
+ n[r - 2] = arguments[r];
378
+ return setTimeout.apply(void 0, $e([e, t], He(n)));
379
+ },
380
+ clearTimeout: function(e) {
381
+ return clearTimeout(e);
382
+ },
383
+ delegate: void 0
384
+ };
385
+ function Ot(e) {
386
+ pn.setTimeout(function() {
387
+ throw e;
388
+ });
389
+ }
390
+ function nt() {
391
+ }
392
+ function Ve(e) {
393
+ e();
394
+ }
395
+ var ct = function(e) {
396
+ Oe(t, e);
397
+ function t(n) {
398
+ var r = e.call(this) || this;
399
+ return r.isStopped = !1, n ? (r.destination = n, xt(n) && n.add(r)) : r.destination = bn, r;
400
+ }
401
+ return t.create = function(n, r, i) {
402
+ return new rt(n, r, i);
403
+ }, t.prototype.next = function(n) {
404
+ this.isStopped || this._next(n);
405
+ }, t.prototype.error = function(n) {
406
+ this.isStopped || (this.isStopped = !0, this._error(n));
407
+ }, t.prototype.complete = function() {
408
+ this.isStopped || (this.isStopped = !0, this._complete());
409
+ }, t.prototype.unsubscribe = function() {
410
+ this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
411
+ }, t.prototype._next = function(n) {
412
+ this.destination.next(n);
413
+ }, t.prototype._error = function(n) {
414
+ try {
415
+ this.destination.error(n);
416
+ } finally {
417
+ this.unsubscribe();
418
+ }
419
+ }, t.prototype._complete = function() {
420
+ try {
421
+ this.destination.complete();
422
+ } finally {
423
+ this.unsubscribe();
424
+ }
425
+ }, t;
426
+ }(Pe), gn = function() {
427
+ function e(t) {
428
+ this.partialObserver = t;
429
+ }
430
+ return e.prototype.next = function(t) {
431
+ var n = this.partialObserver;
432
+ if (n.next)
433
+ try {
434
+ n.next(t);
435
+ } catch (r) {
436
+ Me(r);
437
+ }
438
+ }, e.prototype.error = function(t) {
439
+ var n = this.partialObserver;
440
+ if (n.error)
441
+ try {
442
+ n.error(t);
443
+ } catch (r) {
444
+ Me(r);
445
+ }
446
+ else
447
+ Me(t);
448
+ }, e.prototype.complete = function() {
449
+ var t = this.partialObserver;
450
+ if (t.complete)
451
+ try {
452
+ t.complete();
453
+ } catch (n) {
454
+ Me(n);
455
+ }
456
+ }, e;
457
+ }(), rt = function(e) {
458
+ Oe(t, e);
459
+ function t(n, r, i) {
460
+ var o = e.call(this) || this, s;
461
+ return R(n) || !n ? s = {
462
+ next: n ?? void 0,
463
+ error: r ?? void 0,
464
+ complete: i ?? void 0
465
+ } : s = n, o.destination = new gn(s), o;
466
+ }
467
+ return t;
468
+ }(ct);
469
+ function Me(e) {
470
+ Ot(e);
471
+ }
472
+ function vn(e) {
473
+ throw e;
474
+ }
475
+ var bn = {
476
+ closed: !0,
477
+ next: nt,
478
+ error: vn,
479
+ complete: nt
480
+ }, ft = function() {
481
+ return typeof Symbol == "function" && Symbol.observable || "@@observable";
482
+ }();
483
+ function We(e) {
484
+ return e;
485
+ }
486
+ function wn(e) {
487
+ return e.length === 0 ? We : e.length === 1 ? e[0] : function(n) {
488
+ return e.reduce(function(r, i) {
489
+ return i(r);
490
+ }, n);
491
+ };
492
+ }
493
+ var Z = function() {
494
+ function e(t) {
495
+ t && (this._subscribe = t);
496
+ }
497
+ return e.prototype.lift = function(t) {
498
+ var n = new e();
499
+ return n.source = this, n.operator = t, n;
500
+ }, e.prototype.subscribe = function(t, n, r) {
501
+ var i = this, o = Sn(t) ? t : new rt(t, n, r);
502
+ return Ve(function() {
503
+ var s = i, a = s.operator, l = s.source;
504
+ o.add(a ? a.call(o, l) : l ? i._subscribe(o) : i._trySubscribe(o));
505
+ }), o;
506
+ }, e.prototype._trySubscribe = function(t) {
507
+ try {
508
+ return this._subscribe(t);
509
+ } catch (n) {
510
+ t.error(n);
511
+ }
512
+ }, e.prototype.forEach = function(t, n) {
513
+ var r = this;
514
+ return n = pt(n), new n(function(i, o) {
515
+ var s = new rt({
516
+ next: function(a) {
517
+ try {
518
+ t(a);
519
+ } catch (l) {
520
+ o(l), s.unsubscribe();
521
+ }
522
+ },
523
+ error: o,
524
+ complete: i
525
+ });
526
+ r.subscribe(s);
527
+ });
528
+ }, e.prototype._subscribe = function(t) {
529
+ var n;
530
+ return (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t);
531
+ }, e.prototype[ft] = function() {
532
+ return this;
533
+ }, e.prototype.pipe = function() {
534
+ for (var t = [], n = 0; n < arguments.length; n++)
535
+ t[n] = arguments[n];
536
+ return wn(t)(this);
537
+ }, e.prototype.toPromise = function(t) {
538
+ var n = this;
539
+ return t = pt(t), new t(function(r, i) {
540
+ var o;
541
+ n.subscribe(function(s) {
542
+ return o = s;
543
+ }, function(s) {
544
+ return i(s);
545
+ }, function() {
546
+ return r(o);
547
+ });
548
+ });
549
+ }, e.create = function(t) {
550
+ return new e(t);
551
+ }, e;
552
+ }();
553
+ function pt(e) {
554
+ var t;
555
+ return (t = e ?? mn.Promise) !== null && t !== void 0 ? t : Promise;
556
+ }
557
+ function En(e) {
558
+ return e && R(e.next) && R(e.error) && R(e.complete);
559
+ }
560
+ function Sn(e) {
561
+ return e && e instanceof ct || En(e) && xt(e);
562
+ }
563
+ function Cn(e) {
564
+ return R(e == null ? void 0 : e.lift);
565
+ }
566
+ function ie(e) {
567
+ return function(t) {
568
+ if (Cn(t))
569
+ return t.lift(function(n) {
570
+ try {
571
+ return e(n, this);
572
+ } catch (r) {
573
+ this.error(r);
574
+ }
575
+ });
576
+ throw new TypeError("Unable to lift unknown Observable type");
577
+ };
578
+ }
579
+ function oe(e, t, n, r, i) {
580
+ return new Ln(e, t, n, r, i);
581
+ }
582
+ var Ln = function(e) {
583
+ Oe(t, e);
584
+ function t(n, r, i, o, s, a) {
585
+ var l = e.call(this, n) || this;
586
+ return l.onFinalize = s, l.shouldUnsubscribe = a, l._next = r ? function(u) {
587
+ try {
588
+ r(u);
589
+ } catch (c) {
590
+ n.error(c);
591
+ }
592
+ } : e.prototype._next, l._error = o ? function(u) {
593
+ try {
594
+ o(u);
595
+ } catch (c) {
596
+ n.error(c);
597
+ } finally {
598
+ this.unsubscribe();
599
+ }
600
+ } : e.prototype._error, l._complete = i ? function() {
601
+ try {
602
+ i();
603
+ } catch (u) {
604
+ n.error(u);
605
+ } finally {
606
+ this.unsubscribe();
607
+ }
608
+ } : e.prototype._complete, l;
609
+ }
610
+ return t.prototype.unsubscribe = function() {
611
+ var n;
612
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
613
+ var r = this.closed;
614
+ e.prototype.unsubscribe.call(this), !r && ((n = this.onFinalize) === null || n === void 0 || n.call(this));
615
+ }
616
+ }, t;
617
+ }(ct), Tn = lt(function(e) {
618
+ return function() {
619
+ e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
620
+ };
621
+ }), ue = function(e) {
622
+ Oe(t, e);
623
+ function t() {
624
+ var n = e.call(this) || this;
625
+ return n.closed = !1, n.currentObservers = null, n.observers = [], n.isStopped = !1, n.hasError = !1, n.thrownError = null, n;
626
+ }
627
+ return t.prototype.lift = function(n) {
628
+ var r = new gt(this, this);
629
+ return r.operator = n, r;
630
+ }, t.prototype._throwIfClosed = function() {
631
+ if (this.closed)
632
+ throw new Tn();
633
+ }, t.prototype.next = function(n) {
634
+ var r = this;
635
+ Ve(function() {
636
+ var i, o;
637
+ if (r._throwIfClosed(), !r.isStopped) {
638
+ r.currentObservers || (r.currentObservers = Array.from(r.observers));
639
+ try {
640
+ for (var s = we(r.currentObservers), a = s.next(); !a.done; a = s.next()) {
641
+ var l = a.value;
642
+ l.next(n);
643
+ }
644
+ } catch (u) {
645
+ i = { error: u };
646
+ } finally {
647
+ try {
648
+ a && !a.done && (o = s.return) && o.call(s);
649
+ } finally {
650
+ if (i) throw i.error;
651
+ }
652
+ }
653
+ }
654
+ });
655
+ }, t.prototype.error = function(n) {
656
+ var r = this;
657
+ Ve(function() {
658
+ if (r._throwIfClosed(), !r.isStopped) {
659
+ r.hasError = r.isStopped = !0, r.thrownError = n;
660
+ for (var i = r.observers; i.length; )
661
+ i.shift().error(n);
662
+ }
663
+ });
664
+ }, t.prototype.complete = function() {
665
+ var n = this;
666
+ Ve(function() {
667
+ if (n._throwIfClosed(), !n.isStopped) {
668
+ n.isStopped = !0;
669
+ for (var r = n.observers; r.length; )
670
+ r.shift().complete();
671
+ }
672
+ });
673
+ }, t.prototype.unsubscribe = function() {
674
+ this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
675
+ }, Object.defineProperty(t.prototype, "observed", {
676
+ get: function() {
677
+ var n;
678
+ return ((n = this.observers) === null || n === void 0 ? void 0 : n.length) > 0;
679
+ },
680
+ enumerable: !1,
681
+ configurable: !0
682
+ }), t.prototype._trySubscribe = function(n) {
683
+ return this._throwIfClosed(), e.prototype._trySubscribe.call(this, n);
684
+ }, t.prototype._subscribe = function(n) {
685
+ return this._throwIfClosed(), this._checkFinalizedStatuses(n), this._innerSubscribe(n);
686
+ }, t.prototype._innerSubscribe = function(n) {
687
+ var r = this, i = this, o = i.hasError, s = i.isStopped, a = i.observers;
688
+ return o || s ? yt : (this.currentObservers = null, a.push(n), new Pe(function() {
689
+ r.currentObservers = null, tt(a, n);
690
+ }));
691
+ }, t.prototype._checkFinalizedStatuses = function(n) {
692
+ var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
693
+ i ? n.error(o) : s && n.complete();
694
+ }, t.prototype.asObservable = function() {
695
+ var n = new Z();
696
+ return n.source = this, n;
697
+ }, t.create = function(n, r) {
698
+ return new gt(n, r);
699
+ }, t;
700
+ }(Z), gt = function(e) {
701
+ Oe(t, e);
702
+ function t(n, r) {
703
+ var i = e.call(this) || this;
704
+ return i.destination = n, i.source = r, i;
705
+ }
706
+ return t.prototype.next = function(n) {
707
+ var r, i;
708
+ (i = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || i === void 0 || i.call(r, n);
709
+ }, t.prototype.error = function(n) {
710
+ var r, i;
711
+ (i = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || i === void 0 || i.call(r, n);
712
+ }, t.prototype.complete = function() {
713
+ var n, r;
714
+ (r = (n = this.destination) === null || n === void 0 ? void 0 : n.complete) === null || r === void 0 || r.call(n);
715
+ }, t.prototype._subscribe = function(n) {
716
+ var r, i;
717
+ return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(n)) !== null && i !== void 0 ? i : yt;
718
+ }, t;
719
+ }(ue), _n = new Z(function(e) {
720
+ return e.complete();
721
+ });
722
+ function yn(e) {
723
+ return e && R(e.schedule);
724
+ }
725
+ function It(e) {
726
+ return e[e.length - 1];
727
+ }
728
+ function xn(e) {
729
+ return R(It(e)) ? e.pop() : void 0;
730
+ }
731
+ function On(e) {
732
+ return yn(It(e)) ? e.pop() : void 0;
733
+ }
734
+ var Nt = function(e) {
735
+ return e && typeof e.length == "number" && typeof e != "function";
736
+ };
737
+ function At(e) {
738
+ return R(e == null ? void 0 : e.then);
739
+ }
740
+ function Mt(e) {
741
+ return R(e[ft]);
742
+ }
743
+ function kt(e) {
744
+ return Symbol.asyncIterator && R(e == null ? void 0 : e[Symbol.asyncIterator]);
745
+ }
746
+ function Rt(e) {
747
+ return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
748
+ }
749
+ function In() {
750
+ return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
751
+ }
752
+ var Dt = In();
753
+ function Vt(e) {
754
+ return R(e == null ? void 0 : e[Dt]);
755
+ }
756
+ function Ft(e) {
757
+ return dn(this, arguments, function() {
758
+ var n, r, i, o;
759
+ return _t(this, function(s) {
760
+ switch (s.label) {
761
+ case 0:
762
+ n = e.getReader(), s.label = 1;
763
+ case 1:
764
+ s.trys.push([1, , 9, 10]), s.label = 2;
765
+ case 2:
766
+ return [4, be(n.read())];
767
+ case 3:
768
+ return r = s.sent(), i = r.value, o = r.done, o ? [4, be(void 0)] : [3, 5];
769
+ case 4:
770
+ return [2, s.sent()];
771
+ case 5:
772
+ return [4, be(i)];
773
+ case 6:
774
+ return [4, s.sent()];
775
+ case 7:
776
+ return s.sent(), [3, 2];
777
+ case 8:
778
+ return [3, 10];
779
+ case 9:
780
+ return n.releaseLock(), [7];
781
+ case 10:
782
+ return [2];
783
+ }
784
+ });
785
+ });
786
+ }
787
+ function Bt(e) {
788
+ return R(e == null ? void 0 : e.getReader);
789
+ }
790
+ function Xe(e) {
791
+ if (e instanceof Z)
792
+ return e;
793
+ if (e != null) {
794
+ if (Mt(e))
795
+ return Nn(e);
796
+ if (Nt(e))
797
+ return An(e);
798
+ if (At(e))
799
+ return Mn(e);
800
+ if (kt(e))
801
+ return Ht(e);
802
+ if (Vt(e))
803
+ return kn(e);
804
+ if (Bt(e))
805
+ return Rn(e);
806
+ }
807
+ throw Rt(e);
808
+ }
809
+ function Nn(e) {
810
+ return new Z(function(t) {
811
+ var n = e[ft]();
812
+ if (R(n.subscribe))
813
+ return n.subscribe(t);
814
+ throw new TypeError("Provided object does not correctly implement Symbol.observable");
815
+ });
816
+ }
817
+ function An(e) {
818
+ return new Z(function(t) {
819
+ for (var n = 0; n < e.length && !t.closed; n++)
820
+ t.next(e[n]);
821
+ t.complete();
822
+ });
823
+ }
824
+ function Mn(e) {
825
+ return new Z(function(t) {
826
+ e.then(function(n) {
827
+ t.closed || (t.next(n), t.complete());
828
+ }, function(n) {
829
+ return t.error(n);
830
+ }).then(null, Ot);
831
+ });
832
+ }
833
+ function kn(e) {
834
+ return new Z(function(t) {
835
+ var n, r;
836
+ try {
837
+ for (var i = we(e), o = i.next(); !o.done; o = i.next()) {
838
+ var s = o.value;
839
+ if (t.next(s), t.closed)
840
+ return;
841
+ }
842
+ } catch (a) {
843
+ n = { error: a };
844
+ } finally {
845
+ try {
846
+ o && !o.done && (r = i.return) && r.call(i);
847
+ } finally {
848
+ if (n) throw n.error;
849
+ }
850
+ }
851
+ t.complete();
852
+ });
853
+ }
854
+ function Ht(e) {
855
+ return new Z(function(t) {
856
+ Dn(e, t).catch(function(n) {
857
+ return t.error(n);
858
+ });
859
+ });
860
+ }
861
+ function Rn(e) {
862
+ return Ht(Ft(e));
863
+ }
864
+ function Dn(e, t) {
865
+ var n, r, i, o;
866
+ return fn(this, void 0, void 0, function() {
867
+ var s, a;
868
+ return _t(this, function(l) {
869
+ switch (l.label) {
870
+ case 0:
871
+ l.trys.push([0, 5, 6, 11]), n = hn(e), l.label = 1;
872
+ case 1:
873
+ return [4, n.next()];
874
+ case 2:
875
+ if (r = l.sent(), !!r.done) return [3, 4];
876
+ if (s = r.value, t.next(s), t.closed)
877
+ return [2];
878
+ l.label = 3;
879
+ case 3:
880
+ return [3, 1];
881
+ case 4:
882
+ return [3, 11];
883
+ case 5:
884
+ return a = l.sent(), i = { error: a }, [3, 11];
885
+ case 6:
886
+ return l.trys.push([6, , 9, 10]), r && !r.done && (o = n.return) ? [4, o.call(n)] : [3, 8];
887
+ case 7:
888
+ l.sent(), l.label = 8;
889
+ case 8:
890
+ return [3, 10];
891
+ case 9:
892
+ if (i) throw i.error;
893
+ return [7];
894
+ case 10:
895
+ return [7];
896
+ case 11:
897
+ return t.complete(), [2];
898
+ }
899
+ });
900
+ });
901
+ }
902
+ function ne(e, t, n, r, i) {
903
+ r === void 0 && (r = 0), i === void 0 && (i = !1);
904
+ var o = t.schedule(function() {
905
+ n(), i ? e.add(this.schedule(null, r)) : this.unsubscribe();
906
+ }, r);
907
+ if (e.add(o), !i)
908
+ return o;
909
+ }
910
+ function $t(e, t) {
911
+ return t === void 0 && (t = 0), ie(function(n, r) {
912
+ n.subscribe(oe(r, function(i) {
913
+ return ne(r, e, function() {
914
+ return r.next(i);
915
+ }, t);
916
+ }, function() {
917
+ return ne(r, e, function() {
918
+ return r.complete();
919
+ }, t);
920
+ }, function(i) {
921
+ return ne(r, e, function() {
922
+ return r.error(i);
923
+ }, t);
924
+ }));
925
+ });
926
+ }
927
+ function Ut(e, t) {
928
+ return t === void 0 && (t = 0), ie(function(n, r) {
929
+ r.add(e.schedule(function() {
930
+ return n.subscribe(r);
931
+ }, t));
932
+ });
933
+ }
934
+ function Vn(e, t) {
935
+ return Xe(e).pipe(Ut(t), $t(t));
936
+ }
937
+ function Fn(e, t) {
938
+ return Xe(e).pipe(Ut(t), $t(t));
939
+ }
940
+ function Bn(e, t) {
941
+ return new Z(function(n) {
942
+ var r = 0;
943
+ return t.schedule(function() {
944
+ r === e.length ? n.complete() : (n.next(e[r++]), n.closed || this.schedule());
945
+ });
946
+ });
947
+ }
948
+ function Hn(e, t) {
949
+ return new Z(function(n) {
950
+ var r;
951
+ return ne(n, t, function() {
952
+ r = e[Dt](), ne(n, t, function() {
953
+ var i, o, s;
954
+ try {
955
+ i = r.next(), o = i.value, s = i.done;
956
+ } catch (a) {
957
+ n.error(a);
958
+ return;
959
+ }
960
+ s ? n.complete() : n.next(o);
961
+ }, 0, !0);
962
+ }), function() {
963
+ return R(r == null ? void 0 : r.return) && r.return();
964
+ };
965
+ });
966
+ }
967
+ function Zt(e, t) {
968
+ if (!e)
969
+ throw new Error("Iterable cannot be null");
970
+ return new Z(function(n) {
971
+ ne(n, t, function() {
972
+ var r = e[Symbol.asyncIterator]();
973
+ ne(n, t, function() {
974
+ r.next().then(function(i) {
975
+ i.done ? n.complete() : n.next(i.value);
976
+ });
977
+ }, 0, !0);
978
+ });
979
+ });
980
+ }
981
+ function $n(e, t) {
982
+ return Zt(Ft(e), t);
983
+ }
984
+ function Un(e, t) {
985
+ if (e != null) {
986
+ if (Mt(e))
987
+ return Vn(e, t);
988
+ if (Nt(e))
989
+ return Bn(e, t);
990
+ if (At(e))
991
+ return Fn(e, t);
992
+ if (kt(e))
993
+ return Zt(e, t);
994
+ if (Vt(e))
995
+ return Hn(e, t);
996
+ if (Bt(e))
997
+ return $n(e, t);
998
+ }
999
+ throw Rt(e);
1000
+ }
1001
+ function qt(e, t) {
1002
+ return t ? Un(e, t) : Xe(e);
1003
+ }
1004
+ var Pt = lt(function(e) {
1005
+ return function() {
1006
+ e(this), this.name = "EmptyError", this.message = "no elements in sequence";
1007
+ };
1008
+ });
1009
+ function Zn(e, t) {
1010
+ return ie(function(n, r) {
1011
+ var i = 0;
1012
+ n.subscribe(oe(r, function(o) {
1013
+ r.next(e.call(t, o, i++));
1014
+ }));
1015
+ });
1016
+ }
1017
+ var qn = Array.isArray;
1018
+ function Pn(e, t) {
1019
+ return qn(t) ? e.apply(void 0, $e([], He(t))) : e(t);
1020
+ }
1021
+ function Wn(e) {
1022
+ return Zn(function(t) {
1023
+ return Pn(e, t);
1024
+ });
1025
+ }
1026
+ var Xn = Array.isArray, jn = Object.getPrototypeOf, Kn = Object.prototype, zn = Object.keys;
1027
+ function Gn(e) {
1028
+ if (e.length === 1) {
1029
+ var t = e[0];
1030
+ if (Xn(t))
1031
+ return { args: t, keys: null };
1032
+ if (Yn(t)) {
1033
+ var n = zn(t);
1034
+ return {
1035
+ args: n.map(function(r) {
1036
+ return t[r];
1037
+ }),
1038
+ keys: n
1039
+ };
1040
+ }
1041
+ }
1042
+ return { args: e, keys: null };
1043
+ }
1044
+ function Yn(e) {
1045
+ return e && typeof e == "object" && jn(e) === Kn;
1046
+ }
1047
+ function Jn(e, t) {
1048
+ return e.reduce(function(n, r, i) {
1049
+ return n[r] = t[i], n;
1050
+ }, {});
1051
+ }
1052
+ function Qn() {
1053
+ for (var e = [], t = 0; t < arguments.length; t++)
1054
+ e[t] = arguments[t];
1055
+ var n = On(e), r = xn(e), i = Gn(e), o = i.args, s = i.keys;
1056
+ if (o.length === 0)
1057
+ return qt([], n);
1058
+ var a = new Z(er(o, n, s ? function(l) {
1059
+ return Jn(s, l);
1060
+ } : We));
1061
+ return r ? a.pipe(Wn(r)) : a;
1062
+ }
1063
+ function er(e, t, n) {
1064
+ return n === void 0 && (n = We), function(r) {
1065
+ vt(t, function() {
1066
+ for (var i = e.length, o = new Array(i), s = i, a = i, l = function(c) {
1067
+ vt(t, function() {
1068
+ var d = qt(e[c], t), f = !1;
1069
+ d.subscribe(oe(r, function(h) {
1070
+ o[c] = h, f || (f = !0, a--), a || r.next(n(o.slice()));
1071
+ }, function() {
1072
+ --s || r.complete();
1073
+ }));
1074
+ }, r);
1075
+ }, u = 0; u < i; u++)
1076
+ l(u);
1077
+ }, r);
1078
+ };
1079
+ }
1080
+ function vt(e, t, n) {
1081
+ e ? ne(n, e, t) : t();
1082
+ }
1083
+ function tr(e, t) {
1084
+ return ie(function(n, r) {
1085
+ var i = 0;
1086
+ n.subscribe(oe(r, function(o) {
1087
+ return e.call(t, o, i++) && r.next(o);
1088
+ }));
1089
+ });
1090
+ }
1091
+ function nr(e) {
1092
+ return ie(function(t, n) {
1093
+ var r = !1;
1094
+ t.subscribe(oe(n, function(i) {
1095
+ r = !0, n.next(i);
1096
+ }, function() {
1097
+ r || n.next(e), n.complete();
1098
+ }));
1099
+ });
1100
+ }
1101
+ function rr(e) {
1102
+ return e <= 0 ? function() {
1103
+ return _n;
1104
+ } : ie(function(t, n) {
1105
+ var r = 0;
1106
+ t.subscribe(oe(n, function(i) {
1107
+ ++r <= e && (n.next(i), e <= r && n.complete());
1108
+ }));
1109
+ });
1110
+ }
1111
+ function ir(e) {
1112
+ return e === void 0 && (e = or), ie(function(t, n) {
1113
+ var r = !1;
1114
+ t.subscribe(oe(n, function(i) {
1115
+ r = !0, n.next(i);
1116
+ }, function() {
1117
+ return r ? n.complete() : n.error(e());
1118
+ }));
1119
+ });
1120
+ }
1121
+ function or() {
1122
+ return new Pt();
1123
+ }
1124
+ function ve(e, t) {
1125
+ var n = arguments.length >= 2;
1126
+ return function(r) {
1127
+ return r.pipe(We, rr(1), n ? nr(t) : ir(function() {
1128
+ return new Pt();
1129
+ }));
1130
+ };
1131
+ }
1132
+ function $(e) {
1133
+ return ie(function(t, n) {
1134
+ Xe(e).subscribe(oe(n, function() {
1135
+ return n.complete();
1136
+ }, nt)), !n.closed && t.subscribe(n);
1137
+ });
1138
+ }
1139
+ const yi = g.memo(
1140
+ ({
1141
+ omakasePlayer: e,
1142
+ timelinePopulateFn: t,
1143
+ timelineConfig: n
1144
+ }) => (j(() => {
1145
+ n.timelineHTMLElementId === void 0 && (n.timelineHTMLElementId = "omakase-timeline"), e.createTimeline(n).subscribe({
1146
+ next: (r) => {
1147
+ Qn([
1148
+ e.timeline.onReady$,
1149
+ e.video.onVideoLoaded$.pipe(tr((i) => !!i))
1150
+ ]).subscribe({
1151
+ next: () => t(r)
1152
+ });
1153
+ }
1154
+ });
1155
+ }, [e]), /* @__PURE__ */ g.createElement("div", { id: n.timelineHTMLElementId }))
1156
+ ), _e = [0.25, 0.5, 0.75, 1, 2, 4, 8];
1157
+ class sr {
1158
+ static handleKeyboardEvent(t, n, r) {
1159
+ var s;
1160
+ const i = t.target;
1161
+ if (["INPUT", "TEXTAREA", "OMAKASE-MARKER-LIST"].includes(i.tagName.toUpperCase()))
1162
+ return !1;
1163
+ if (n && n.video) {
1164
+ if (t.code === "Space" && (r !== "safari" || !n.video.isFullscreen()))
1165
+ return n.video.togglePlayPause(), !0;
1166
+ if (t.code === "KeyS" && !t.shiftKey && !t.ctrlKey)
1167
+ return n.video.toggleMuteUnmute(), !0;
1168
+ if (t.code === "Backslash") {
1169
+ let a = 10, l = t.shiftKey ? 1 : -1, u = n.video.getVolume() * 100 + a * l;
1170
+ u >= 100 ? u = 100 : u <= 0 && (u = 0), n.video.setVolume(u / 100);
1171
+ }
1172
+ if (t.key === "'" && ((s = n.timeline) == null || s.toggleTimecodeEdit()), t.code === "KeyD" && !(t.ctrlKey && t.shiftKey))
1173
+ return n.subtitles.toggleShowHideActiveTrack(), !0;
1174
+ if (t.code === "KeyK" && (n.video.setPlaybackRate(1), n.video.pause()), t.code === "KeyL") {
1175
+ let a = t.shiftKey ? 1 : -1;
1176
+ const l = _e.indexOf(
1177
+ n.video.getPlaybackRate()
1178
+ ) + a;
1179
+ let u;
1180
+ return l < 0 ? u = _e.at(0) : l >= _e.length ? u = _e.at(-1) : u = _e.at(l), n.video.setPlaybackRate(u), n.video.isPaused() && n.video.play(), !0;
1181
+ }
1182
+ if (n.video.isVideoLoaded()) {
1183
+ if (["ArrowLeft", "ArrowRight"].includes(t.key) && !t.metaKey && !t.altKey) {
1184
+ let a = t.key === "ArrowRight" ? 1 : -1, l = t.shiftKey ? 10 : 1;
1185
+ return n.video.isPlaying() && n.video.pause(), n.video.seekFromCurrentFrame(l * a), !0;
1186
+ }
1187
+ if (t.code === "Digit1" && !t.ctrlKey && !t.metaKey && !t.shiftKey && !t.altKey || t.code === "Home")
1188
+ return n.video.pause().subscribe(() => n.video.seekToFrame(0)), !0;
1189
+ if (t.code === "Digit1" && t.ctrlKey || t.code === "End")
1190
+ return n.video.isPlaying() ? n.video.pause().subscribe(() => n.video.seekToEnd()) : n.video.seekToEnd(), !0;
1191
+ }
1192
+ if (t.code === "KeyF")
1193
+ return n.video.toggleFullscreen(), !0;
1194
+ if (t.code === "Digit0")
1195
+ return n.timeline.zoomToEased(100), !0;
1196
+ if (t.key === "=")
1197
+ return n.timeline.zoomInEased(), !0;
1198
+ if (t.key === "-")
1199
+ return n.timeline.zoomOutEased(), !0;
1200
+ }
1201
+ return !1;
1202
+ }
1203
+ }
1204
+ const ar = g.memo(function({
1205
+ videoUrl: t,
1206
+ fps: n,
1207
+ config: r,
1208
+ videoLoadOptions: i,
1209
+ setOmakasePlayer: o,
1210
+ enableHotkeys: s
1211
+ }) {
1212
+ return j(() => {
1213
+ var c, d;
1214
+ const a = {
1215
+ ...r,
1216
+ playerHTMLElementId: "omakase-player"
1217
+ };
1218
+ let l = new ln(a);
1219
+ o && o((f) => f ?? l), s && ((c = document.querySelector("media-controller")) == null || c.setAttribute("nohotkeys", ""), (d = document.querySelector("media-controller")) == null || d.setAttribute("tabindex", "-1"), window.onkeydown = (f) => {
1220
+ sr.handleKeyboardEvent(
1221
+ f,
1222
+ l
1223
+ ) && (f.stopPropagation(), f.preventDefault());
1224
+ });
1225
+ const u = {
1226
+ ...i,
1227
+ protocol: "hls"
1228
+ };
1229
+ return l.loadVideo(t, n, u), () => {
1230
+ s && (window.onkeydown = null);
1231
+ };
1232
+ }, [t, n]), /* @__PURE__ */ g.createElement("div", { id: "omakase-player" });
1233
+ }), ur = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1234
+ "svg",
1235
+ {
1236
+ width: e ?? 24,
1237
+ height: t ?? 24,
1238
+ viewBox: "0 0 24 24",
1239
+ fill: "none",
1240
+ xmlns: "http://www.w3.org/2000/svg"
1241
+ },
1242
+ /* @__PURE__ */ g.createElement(
1243
+ "path",
1244
+ {
1245
+ d: "M10.5675 21C10.2375 21 9.9675 20.73 9.9675 20.4V16.7925L5.6325 12.3675L9.9675 8.235V3.6C9.9675 3.27 10.2375 3 10.5675 3C10.8975 3 11.1675 3.27 11.1675 3.6V8.7525L7.3425 12.3975L11.1675 16.305V20.4C11.1675 20.73 10.8975 21 10.5675 21Z",
1246
+ fill: "#CACFEA"
1247
+ }
1248
+ ),
1249
+ /* @__PURE__ */ g.createElement(
1250
+ "path",
1251
+ {
1252
+ d: "M17.7675 17.145C17.61 17.145 17.46 17.085 17.34 16.965L12.8325 12.3675L17.355 8.0625C17.595 7.8375 17.9775 7.845 18.2025 8.085C18.4275 8.325 18.42 8.7075 18.18 8.9325L14.5425 12.3975L18.195 16.125C18.4275 16.365 18.42 16.74 18.1875 16.9725C18.075 17.085 17.9175 17.145 17.7675 17.145Z",
1253
+ fill: "#CACFEA"
1254
+ }
1255
+ )
1256
+ ), lr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1257
+ "svg",
1258
+ {
1259
+ width: e ?? 24,
1260
+ height: t ?? 24,
1261
+ viewBox: "0 0 24 24",
1262
+ fill: "none",
1263
+ xmlns: "http://www.w3.org/2000/svg"
1264
+ },
1265
+ /* @__PURE__ */ g.createElement(
1266
+ "path",
1267
+ {
1268
+ d: "M13.4325 21C13.7625 21 14.0325 20.73 14.0325 20.4V16.7925L18.3675 12.3675L14.0325 8.235V3.6C14.0325 3.27 13.7625 3 13.4325 3C13.1025 3 12.8325 3.27 12.8325 3.6V8.7525L16.6575 12.3975L12.8325 16.305V20.4C12.8325 20.73 13.1025 21 13.4325 21Z",
1269
+ fill: "#CACFEA"
1270
+ }
1271
+ ),
1272
+ /* @__PURE__ */ g.createElement(
1273
+ "path",
1274
+ {
1275
+ d: "M6.2325 17.145C6.39 17.145 6.54 17.085 6.66 16.965L11.1675 12.3675L6.645 8.0625C6.405 7.8375 6.0225 7.845 5.7975 8.085C5.5725 8.325 5.58 8.7075 5.82 8.9325L9.4575 12.3975L5.805 16.125C5.5725 16.365 5.58 16.74 5.8125 16.9725C5.925 17.085 6.0825 17.145 6.2325 17.145Z",
1276
+ fill: "#CACFEA"
1277
+ }
1278
+ )
1279
+ ), cr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1280
+ "svg",
1281
+ {
1282
+ width: e ?? 24,
1283
+ height: t ?? 24,
1284
+ viewBox: "0 0 24 24",
1285
+ fill: "none",
1286
+ xmlns: "http://www.w3.org/2000/svg"
1287
+ },
1288
+ /* @__PURE__ */ g.createElement(
1289
+ "path",
1290
+ {
1291
+ d: "M14.1675 21C13.8375 21 13.5675 20.73 13.5675 20.4V16.7925L9.2325 12.3675L13.5675 8.235V3.6C13.5675 3.27 13.8375 3 14.1675 3C14.4975 3 14.7675 3.27 14.7675 3.6V8.7525L10.9425 12.3975L14.7675 16.305V20.4C14.7675 20.73 14.4975 21 14.1675 21Z",
1292
+ fill: "#CACFEA"
1293
+ }
1294
+ )
1295
+ ), fr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1296
+ "svg",
1297
+ {
1298
+ width: e ?? 24,
1299
+ height: t ?? 24,
1300
+ viewBox: "0 0 24 24",
1301
+ fill: "none",
1302
+ xmlns: "http://www.w3.org/2000/svg"
1303
+ },
1304
+ /* @__PURE__ */ g.createElement(
1305
+ "path",
1306
+ {
1307
+ d: "M9.8325 21C10.1625 21 10.4325 20.73 10.4325 20.4V16.7925L14.7675 12.3675L10.4325 8.235V3.6C10.4325 3.27 10.1625 3 9.8325 3C9.5025 3 9.2325 3.27 9.2325 3.6V8.7525L13.0575 12.3975L9.2325 16.305V20.4C9.2325 20.73 9.5025 21 9.8325 21Z",
1308
+ fill: "#CACFEA"
1309
+ }
1310
+ )
1311
+ ), dr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1312
+ "svg",
1313
+ {
1314
+ width: e ?? 24,
1315
+ height: t ?? 24,
1316
+ viewBox: "0 0 24 24",
1317
+ fill: "none",
1318
+ xmlns: "http://www.w3.org/2000/svg"
1319
+ },
1320
+ /* @__PURE__ */ g.createElement("path", { d: "M11.3475 3H5.775V21L11.3475 17.0475V3Z", fill: "#CACFEA" }),
1321
+ /* @__PURE__ */ g.createElement(
1322
+ "path",
1323
+ {
1324
+ d: "M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",
1325
+ fill: "#CACFEA"
1326
+ }
1327
+ )
1328
+ ), hr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1329
+ "svg",
1330
+ {
1331
+ width: e ?? 24,
1332
+ height: t ?? 24,
1333
+ viewBox: "0 0 24 24",
1334
+ fill: "none",
1335
+ xmlns: "http://www.w3.org/2000/svg"
1336
+ },
1337
+ /* @__PURE__ */ g.createElement(
1338
+ "path",
1339
+ {
1340
+ d: "M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",
1341
+ fill: "#CACFEA"
1342
+ }
1343
+ ),
1344
+ /* @__PURE__ */ g.createElement(
1345
+ "path",
1346
+ {
1347
+ d: "M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",
1348
+ fill: "#CACFEA"
1349
+ }
1350
+ )
1351
+ ), mr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1352
+ "svg",
1353
+ {
1354
+ width: e ?? 24,
1355
+ height: t ?? 24,
1356
+ viewBox: "0 0 24 24",
1357
+ fill: "none",
1358
+ xmlns: "http://www.w3.org/2000/svg"
1359
+ },
1360
+ /* @__PURE__ */ g.createElement(
1361
+ "path",
1362
+ {
1363
+ d: "M6.39001 3V21L12 17.0175L17.61 21V3H6.38251H6.39001ZM16.44 3.84L7.23001 18.7125V3.84H16.44ZM12 15.9975L8.25751 18.6525L16.77 4.89V19.3725L12 15.9825V15.9975Z",
1364
+ fill: "#CACFEA"
1365
+ }
1366
+ )
1367
+ ), pr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1368
+ "svg",
1369
+ {
1370
+ width: e ?? 24,
1371
+ height: t ?? 24,
1372
+ viewBox: "0 0 24 24",
1373
+ fill: "none",
1374
+ xmlns: "http://www.w3.org/2000/svg"
1375
+ },
1376
+ /* @__PURE__ */ g.createElement(
1377
+ "path",
1378
+ {
1379
+ d: "M12.3075 8.0175L14.4525 5.8725C14.6175 5.7075 14.6175 5.43 14.4525 5.265L12.3 3.12C12.135 2.955 11.8575 2.955 11.6925 3.12C11.5275 3.285 11.5275 3.5625 11.6925 3.7275L13.1025 5.1375H6.64499C5.22749 5.1375 4.07249 6.2925 4.07249 7.71V16.2825C4.07249 17.7 5.22749 18.855 6.64499 18.855C6.87749 18.855 7.07249 18.66 7.07249 18.4275C7.07249 18.195 6.87749 18 6.64499 18C5.69249 18 4.93499 17.2275 4.93499 16.29V7.7175C4.93499 6.765 5.70749 6.0075 6.64499 6.0075H13.11L11.7 7.4175C11.535 7.5825 11.535 7.86 11.7 8.025C11.865 8.19 12.1425 8.19 12.3075 8.025V8.0175Z",
1380
+ fill: "#CACFEA"
1381
+ }
1382
+ ),
1383
+ /* @__PURE__ */ g.createElement(
1384
+ "path",
1385
+ {
1386
+ d: "M17.355 18.8625C18.7725 18.8625 19.9275 17.7075 19.9275 16.29V7.7175C19.9275 6.3 18.7725 5.145 17.355 5.145C17.1225 5.145 16.9275 5.34 16.9275 5.5725C16.9275 5.805 17.1225 6 17.355 6C18.3075 6 19.065 6.7725 19.065 7.71V16.2825C19.065 17.235 18.2925 17.9925 17.355 17.9925H10.89L12.3075 16.5825C12.3825 16.5075 12.435 16.395 12.435 16.2825C12.435 16.17 12.3975 16.0575 12.3075 15.9825C12.15 15.8175 11.8575 15.825 11.7 15.9825L9.52501 18.1575V18.18C9.45751 18.255 9.42751 18.345 9.42751 18.435C9.42751 18.555 9.46501 18.66 9.55501 18.735L11.7 20.88C11.8575 21.045 12.15 21.045 12.3075 20.88C12.4725 20.715 12.4725 20.4375 12.3075 20.2725L10.89 18.8625H17.355Z",
1387
+ fill: "#CACFEA"
1388
+ }
1389
+ )
1390
+ ), gr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1391
+ "svg",
1392
+ {
1393
+ width: e ?? 24,
1394
+ height: t ?? 24,
1395
+ viewBox: "0 0 24 24",
1396
+ fill: "none",
1397
+ xmlns: "http://www.w3.org/2000/svg"
1398
+ },
1399
+ /* @__PURE__ */ g.createElement("g", { clipPath: "url(#clip0_3377_237)" }, /* @__PURE__ */ g.createElement(
1400
+ "path",
1401
+ {
1402
+ d: "M13.02 19.95C17.42 19.95 21 16.37 21 11.97C21 7.57 17.42 4 13.02 4C8.88 4 5.39 7.24 5.08 11.37L5.02 12.14L3.56 10.68C3.49 10.61 3.41 10.58 3.33 10.58C3.25 10.58 3.17 10.61 3.1 10.68C3.03 10.75 3 10.83 3 10.92C3 11 3.03 11.08 3.1 11.15L5.22 13.27C5.35 13.4 5.55 13.43 5.65 13.3L7.8 11.15C7.87 11.08 7.9 11 7.9 10.92C7.9 10.84 7.86 10.76 7.8 10.69C7.73 10.62 7.65 10.59 7.57 10.59C7.49 10.59 7.41 10.62 7.34 10.69L5.9 12.13L6.03 11.11C6.45 7.57 9.46 4.91 13.02 4.91C16.91 4.91 20.08 8.08 20.08 11.97C20.08 15.86 16.91 19.03 13.02 19.03C12.77 19.03 12.56 19.24 12.56 19.49C12.56 19.74 12.77 19.95 13.02 19.95Z",
1403
+ fill: "#CACFEA"
1404
+ }
1405
+ ), /* @__PURE__ */ g.createElement(
1406
+ "path",
1407
+ {
1408
+ d: "M14.95 13.19C14.95 13.72 14.75 14.14 14.36 14.45C13.97 14.76 13.43 14.91 12.75 14.91C12.16 14.91 11.69 14.81 11.32 14.62V13.53C11.7 13.81 12.14 13.95 12.65 13.95C12.98 13.95 13.23 13.88 13.41 13.74C13.59 13.6 13.67 13.41 13.67 13.17C13.67 12.93 13.56 12.72 13.34 12.58C13.12 12.44 12.82 12.37 12.43 12.37H11.92V11.41H12.39C13.13 11.41 13.5 11.16 13.5 10.67C13.5 10.21 13.22 9.98 12.65 9.98C12.26 9.98 11.89 10.1 11.54 10.35V9.33C11.93 9.13 12.4 9.03 12.94 9.03C13.48 9.03 13.94 9.16 14.28 9.41C14.62 9.66 14.79 10.01 14.79 10.44C14.79 11.19 14.41 11.65 13.66 11.84V11.86C14.06 11.91 14.37 12.05 14.61 12.29C14.85 12.53 14.96 12.83 14.96 13.19H14.95Z",
1409
+ fill: "#CACFEA"
1410
+ }
1411
+ )),
1412
+ /* @__PURE__ */ g.createElement("defs", null, /* @__PURE__ */ g.createElement("clipPath", { id: "clip0_3377_237" }, /* @__PURE__ */ g.createElement(
1413
+ "rect",
1414
+ {
1415
+ width: "18",
1416
+ height: "15.95",
1417
+ fill: "white",
1418
+ transform: "translate(3 4)"
1419
+ }
1420
+ )))
1421
+ ), vr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1422
+ "svg",
1423
+ {
1424
+ width: e ?? 24,
1425
+ height: t ?? 24,
1426
+ viewBox: "0 0 24 24",
1427
+ fill: "none",
1428
+ xmlns: "http://www.w3.org/2000/svg"
1429
+ },
1430
+ /* @__PURE__ */ g.createElement("g", { clipPath: "url(#clip0_3377_260)" }, /* @__PURE__ */ g.createElement(
1431
+ "path",
1432
+ {
1433
+ d: "M10.98 19.95C6.58 19.95 3 16.37 3 11.98C3 7.58 6.58 4 10.98 4C15.12 4 18.61 7.24 18.93 11.37L18.99 12.14L20.45 10.68C20.52 10.61 20.6 10.58 20.68 10.58C20.76 10.58 20.84 10.61 20.91 10.68C20.98 10.75 21.01 10.83 21.01 10.91C21.01 10.99 20.98 11.07 20.91 11.14L18.79 13.26C18.66 13.39 18.46 13.42 18.36 13.29L16.21 11.14C16.14 11.07 16.11 10.99 16.11 10.91C16.11 10.83 16.15 10.75 16.21 10.68C16.28 10.61 16.36 10.58 16.44 10.58C16.52 10.58 16.6 10.61 16.67 10.68L18.11 12.12L17.98 11.1C17.55 7.57 14.54 4.91 10.98 4.91C7.09 4.91 3.92 8.08 3.92 11.97C3.92 15.86 7.09 19.03 10.98 19.03C11.23 19.03 11.44 19.24 11.44 19.49C11.44 19.74 11.23 19.95 10.98 19.95Z",
1434
+ fill: "#CACFEA"
1435
+ }
1436
+ ), /* @__PURE__ */ g.createElement(
1437
+ "path",
1438
+ {
1439
+ d: "M12.91 13.19C12.91 13.72 12.71 14.14 12.32 14.45C11.93 14.76 11.39 14.91 10.71 14.91C10.12 14.91 9.65 14.81 9.28 14.62V13.53C9.66 13.81 10.1 13.95 10.61 13.95C10.94 13.95 11.19 13.88 11.37 13.74C11.55 13.6 11.63 13.41 11.63 13.17C11.63 12.93 11.52 12.72 11.3 12.58C11.08 12.44 10.78 12.37 10.39 12.37H9.88V11.41H10.35C11.09 11.41 11.46 11.16 11.46 10.67C11.46 10.21 11.18 9.98 10.61 9.98C10.22 9.98 9.85 10.1 9.5 10.35V9.33C9.89 9.13 10.36 9.03 10.9 9.03C11.44 9.03 11.9 9.16 12.24 9.41C12.58 9.66 12.75 10.01 12.75 10.44C12.75 11.19 12.37 11.65 11.62 11.84V11.86C12.02 11.91 12.33 12.05 12.57 12.29C12.81 12.53 12.92 12.83 12.92 13.19H12.91Z",
1440
+ fill: "#CACFEA"
1441
+ }
1442
+ )),
1443
+ /* @__PURE__ */ g.createElement("defs", null, /* @__PURE__ */ g.createElement("clipPath", { id: "clip0_3377_260" }, /* @__PURE__ */ g.createElement(
1444
+ "rect",
1445
+ {
1446
+ width: "18",
1447
+ height: "15.95",
1448
+ fill: "white",
1449
+ transform: "translate(3 4)"
1450
+ }
1451
+ )))
1452
+ ), q = ({
1453
+ Icon: e,
1454
+ onClick: t,
1455
+ width: n,
1456
+ height: r,
1457
+ text: i,
1458
+ disabled: o
1459
+ }) => /* @__PURE__ */ g.createElement("button", { disabled: o, onClick: t }, /* @__PURE__ */ g.createElement(e, { width: n, height: r }), " ", i), br = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1460
+ "svg",
1461
+ {
1462
+ width: e ?? 24,
1463
+ height: t ?? 24,
1464
+ viewBox: "0 0 24 24",
1465
+ fill: "none",
1466
+ xmlns: "http://www.w3.org/2000/svg"
1467
+ },
1468
+ /* @__PURE__ */ g.createElement("path", { d: "M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z", fill: "#CACFEA" }),
1469
+ /* @__PURE__ */ g.createElement(
1470
+ "path",
1471
+ {
1472
+ d: "M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",
1473
+ fill: "#CACFEA"
1474
+ }
1475
+ )
1476
+ ), wr = ({ width: e, height: t }) => /* @__PURE__ */ g.createElement(
1477
+ "svg",
1478
+ {
1479
+ width: "14",
1480
+ height: "14",
1481
+ viewBox: "0 0 14 14",
1482
+ fill: "none",
1483
+ xmlns: "http://www.w3.org/2000/svg"
1484
+ },
1485
+ /* @__PURE__ */ g.createElement("rect", { x: "0.5", y: "0.5", width: "13", height: "13", rx: "2.5", stroke: "#CACFEA" }),
1486
+ /* @__PURE__ */ g.createElement(
1487
+ "path",
1488
+ {
1489
+ d: "M7.16667 6.33333V6.83333H7.66667H10.3333C10.4257 6.83333 10.5 6.90769 10.5 7C10.5 7.09231 10.4257 7.16667 10.3333 7.16667H7.66667H7.16667V7.66667V10.3333C7.16667 10.4257 7.09231 10.5 7 10.5C6.90769 10.5 6.83333 10.4257 6.83333 10.3333V7.66667V7.16667H6.33333H3.66667C3.57468 7.16667 3.5 7.09199 3.5 7C3.5 6.90801 3.57468 6.83333 3.66667 6.83333H6.33333H6.83333V6.33333V3.66667C6.83333 3.57468 6.90801 3.5 7 3.5C7.09199 3.5 7.16667 3.57468 7.16667 3.66667V6.33333Z",
1490
+ fill: "#CACFEA",
1491
+ stroke: "#CACFEA"
1492
+ }
1493
+ )
1494
+ );
1495
+ function W(e) {
1496
+ e.next(), e.complete();
1497
+ }
1498
+ function ke(e, t, n) {
1499
+ if (!e || !(e instanceof Q))
1500
+ return !0;
1501
+ const r = e.timeObservation.start, i = e.timeObservation.end;
1502
+ if (r == null || i == null)
1503
+ return !0;
1504
+ const o = n.video.calculateTimeToFrame(i), s = n.video.getCurrentFrame();
1505
+ return t < r || o - s < 2;
1506
+ }
1507
+ function Je(e, t) {
1508
+ if (e === void 0)
1509
+ return !0;
1510
+ const n = e.timeObservation.start;
1511
+ return n == null || n > t;
1512
+ }
1513
+ function Er(e) {
1514
+ return !(e.timeObservation.start == null || e.timeObservation.end == null);
1515
+ }
1516
+ const xi = ({
1517
+ selectedMarker: e,
1518
+ omakasePlayer: t,
1519
+ markerListApi: n,
1520
+ segmentationLanes: r,
1521
+ setSegmentationLanes: i,
1522
+ setSelectedMarker: o,
1523
+ onMarkerClickCallback: s,
1524
+ setSource: a,
1525
+ source: l,
1526
+ constants: u
1527
+ }) => {
1528
+ const c = ht(void 0), d = ht(void 0), f = new ue(), [h, b] = Ae(void 0), [p, _] = Ae(
1529
+ ke(
1530
+ e,
1531
+ t.video.getCurrentTime(),
1532
+ t
1533
+ )
1534
+ ), [T, D] = Ae(
1535
+ void 0
1536
+ ), [y, M] = Ae(
1537
+ Je(T, t.video.getCurrentTime())
1538
+ );
1539
+ j(() => {
1540
+ if (T && T !== e) {
1541
+ const E = r.find(
1542
+ (C) => C.getMarker(T.id)
1543
+ );
1544
+ E == null || E.removeMarker(T.id), D(void 0);
1545
+ }
1546
+ }, [e, T, r, D]), j(() => () => W(f), []), j(() => {
1547
+ if (e) {
1548
+ const E = ke(
1549
+ e,
1550
+ t.video.getCurrentTime(),
1551
+ t
1552
+ );
1553
+ _(E);
1554
+ const C = t.video.onVideoTimeChange$.pipe($(f)).subscribe({
1555
+ next: (x) => {
1556
+ _(
1557
+ (I) => ke(
1558
+ e,
1559
+ x.currentTime,
1560
+ t
1561
+ )
1562
+ );
1563
+ }
1564
+ });
1565
+ return () => C.unsubscribe();
1566
+ }
1567
+ }, [e]), j(() => {
1568
+ if (T === void 0)
1569
+ return;
1570
+ const E = t.video.onVideoTimeChange$.pipe($(f)).subscribe({
1571
+ next: (C) => {
1572
+ M(
1573
+ Je(
1574
+ T,
1575
+ C.currentTime
1576
+ )
1577
+ );
1578
+ }
1579
+ });
1580
+ return () => E.unsubscribe();
1581
+ }, [T]), j(() => {
1582
+ const E = r.map((C) => C.onMarkerUpdate$.pipe($(f)).subscribe({
1583
+ next: (x) => {
1584
+ (e == null ? void 0 : e.id) === x.marker.id && _(
1585
+ (I) => ke(
1586
+ e,
1587
+ t.video.getCurrentTime(),
1588
+ t
1589
+ )
1590
+ );
1591
+ }
1592
+ }));
1593
+ return () => E.forEach((C) => C.unsubscribe());
1594
+ }, [r, e]), j(() => {
1595
+ h && (h.marker.style = {
1596
+ ...h.marker.style,
1597
+ color: h.color
1598
+ }, h.marker.timeObservation = {
1599
+ ...h.marker.timeObservation
1600
+ }, b(void 0));
1601
+ }, [e]), j(() => {
1602
+ if (l) {
1603
+ const E = l.onMarkerDelete$.pipe($(f)).subscribe({
1604
+ next: (C) => {
1605
+ const x = C.marker;
1606
+ b((I) => {
1607
+ if ((I == null ? void 0 : I.marker.id) !== x.id)
1608
+ return I;
1609
+ }), o((I) => {
1610
+ if ((I == null ? void 0 : I.id) !== x.id)
1611
+ return I;
1612
+ }), D((I) => {
1613
+ if ((I == null ? void 0 : I.id) !== x.id)
1614
+ return I;
1615
+ });
1616
+ }
1617
+ });
1618
+ return () => E.unsubscribe();
1619
+ }
1620
+ }, [l]);
1621
+ const fe = (E, C) => {
1622
+ if (C === void 0)
1623
+ return;
1624
+ const x = C.timeObservation;
1625
+ E.video.seekToTime(x.start);
1626
+ }, P = (E, C) => {
1627
+ if (C === void 0)
1628
+ return;
1629
+ const x = C.timeObservation;
1630
+ E.video.seekToTime(x.end);
1631
+ }, Se = (E, C) => {
1632
+ C instanceof Q && C.timeObservation.start !== void 0 && (C.timeObservation = {
1633
+ ...C.timeObservation,
1634
+ start: E.video.getCurrentTime()
1635
+ });
1636
+ }, de = (E, C) => {
1637
+ C instanceof Q && C.timeObservation.end !== void 0 && (C.timeObservation = {
1638
+ ...C.timeObservation,
1639
+ end: E.video.getCurrentTime()
1640
+ });
1641
+ }, ae = (E, C) => {
1642
+ c.current && W(c.current), c.current = new ue(), E.video.pause();
1643
+ const x = E.video.getCurrentFrame(), I = E.video.getFrameRate(), pe = x - C * I, ge = pe >= 0 ? pe : 0;
1644
+ E.video.seekToFrame(ge).pipe(ve()).subscribe(() => {
1645
+ }), E.video.play(), E.video.onVideoTimeChange$.pipe($(c.current), $(f)).subscribe((Ne) => {
1646
+ Ne.frame >= x - 1 && (E.video.pause().subscribe(() => {
1647
+ E.video.seekToFrame(x).pipe(ve()).subscribe(() => {
1648
+ });
1649
+ }), W(c.current));
1650
+ });
1651
+ }, Ce = (E, C) => {
1652
+ c.current && W(c.current), c.current = new ue(), d.current && W(d.current), d.current = new ue();
1653
+ const x = E.video.getCurrentFrame(), I = E.video.getFrameRate(), pe = x + C * I;
1654
+ E.video.play(), E.video.onVideoTimeChange$.pipe($(c.current), $(f)).subscribe((ge) => {
1655
+ ge.frame >= pe - 1 && (E.video.pause().subscribe(() => {
1656
+ E.video.seekToFrame(x).pipe(ve()).subscribe(() => {
1657
+ });
1658
+ }), W(c.current));
1659
+ }), E.video.onEnded$.pipe($(d.current), $(f)).subscribe((ge) => {
1660
+ setTimeout(() => {
1661
+ E.video.seekToFrame(x).pipe(ve()).subscribe(() => {
1662
+ });
1663
+ }, 1), W(d.current);
1664
+ });
1665
+ }, H = (E) => {
1666
+ l.removeMarker(E.id), (T == null ? void 0 : T.id) === E.id && D(void 0);
1667
+ }, he = (E, C) => {
1668
+ if (!(C instanceof Q))
1669
+ return;
1670
+ const x = C.timeObservation.start, I = C.timeObservation.end, pe = E.video.getCurrentTime();
1671
+ if (x == null || I == null)
1672
+ return;
1673
+ E.video.calculateTimeToFrame(x), E.video.calculateTimeToFrame(I);
1674
+ const ge = x, Ne = pe, rn = Ne + 1 / E.video.getFrameRate(), on = I;
1675
+ H(C);
1676
+ const Ge = new Q({
1677
+ style: u.PERIOD_MARKER_STYLE,
1678
+ timeObservation: {
1679
+ start: ge,
1680
+ end: Ne
1681
+ },
1682
+ editable: !0
1683
+ });
1684
+ Ge.onClick$.subscribe({
1685
+ next: () => s(Ge)
1686
+ });
1687
+ const Te = new Q({
1688
+ style: u.SELECTED_PERIOD_MARKER_STYLE,
1689
+ timeObservation: {
1690
+ start: rn,
1691
+ end: on
1692
+ },
1693
+ editable: !0
1694
+ });
1695
+ Te.onClick$.subscribe({
1696
+ next: () => s(Te)
1697
+ }), l.addMarker(Ge), l.addMarker(Te), s(Te), setTimeout(() => {
1698
+ b({
1699
+ marker: Te,
1700
+ color: u.PERIOD_MARKER_STYLE.color
1701
+ });
1702
+ }, 0);
1703
+ }, me = () => {
1704
+ const E = t.video.getCurrentTime(), C = new Q({
1705
+ timeObservation: {
1706
+ start: E
1707
+ },
1708
+ style: u.PERIOD_MARKER_STYLE,
1709
+ editable: !0
1710
+ });
1711
+ C.onClick$.subscribe({
1712
+ next: () => s(C)
1713
+ }), l.addMarker(C), D(C), M(
1714
+ Je(
1715
+ C,
1716
+ t.video.getCurrentTime()
1717
+ )
1718
+ ), s(C);
1719
+ }, Le = () => {
1720
+ const E = t.video.getCurrentTime();
1721
+ T.timeObservation = {
1722
+ ...T.timeObservation,
1723
+ end: E
1724
+ }, D(void 0);
1725
+ }, V = (E) => {
1726
+ c.current && W(c.current), c.current = new ue(), d.current && W(d.current), d.current = new ue();
1727
+ const C = t.video.calculateTimeToFrame(
1728
+ E.timeObservation.start
1729
+ ), x = t.video.calculateTimeToFrame(
1730
+ E.timeObservation.end
1731
+ );
1732
+ t.video.pause(), t.video.seekToFrame(C), t.video.play(), t.video.onVideoTimeChange$.pipe($(c.current), $(f)).subscribe((I) => {
1733
+ I.frame >= x - 1 && (t.video.pause().subscribe(() => {
1734
+ t.video.seekToFrame(C).pipe(ve()).subscribe(() => {
1735
+ });
1736
+ }), W(c.current));
1737
+ }), t.video.onEnded$.pipe($(d.current), $(f)).subscribe((I) => {
1738
+ setTimeout(() => {
1739
+ t.video.seekToFrame(C).pipe(ve()).subscribe(() => {
1740
+ });
1741
+ }, 1), W(d.current);
1742
+ });
1743
+ }, O = () => {
1744
+ const E = r.length, C = `Segmentation ${r.length + 1}`, x = new Tt({
1745
+ description: C,
1746
+ style: u.TIMELINE_LANE_STYLE
1747
+ });
1748
+ t.timeline.addTimelineLaneAtIndex(
1749
+ x,
1750
+ E + 1
1751
+ ), i([...r, x]), s(void 0), a(x);
1752
+ };
1753
+ return /* @__PURE__ */ g.createElement("div", { className: "control-panel-wrapper" }, /* @__PURE__ */ g.createElement("div", { className: "control-panel" }, /* @__PURE__ */ g.createElement(
1754
+ q,
1755
+ {
1756
+ Icon: ur,
1757
+ onClick: () => fe(t, e),
1758
+ disabled: e === void 0
1759
+ }
1760
+ ), /* @__PURE__ */ g.createElement(
1761
+ q,
1762
+ {
1763
+ Icon: lr,
1764
+ onClick: () => P(t, e),
1765
+ disabled: e === void 0
1766
+ }
1767
+ ), /* @__PURE__ */ g.createElement(
1768
+ q,
1769
+ {
1770
+ Icon: cr,
1771
+ onClick: () => Se(t, e),
1772
+ disabled: e === void 0
1773
+ }
1774
+ ), /* @__PURE__ */ g.createElement(
1775
+ q,
1776
+ {
1777
+ Icon: fr,
1778
+ onClick: () => de(t, e),
1779
+ disabled: e === void 0
1780
+ }
1781
+ ), T === void 0 ? /* @__PURE__ */ g.createElement(
1782
+ q,
1783
+ {
1784
+ Icon: dr,
1785
+ onClick: me
1786
+ }
1787
+ ) : /* @__PURE__ */ g.createElement(
1788
+ q,
1789
+ {
1790
+ Icon: br,
1791
+ onClick: Le,
1792
+ disabled: y
1793
+ }
1794
+ ), /* @__PURE__ */ g.createElement(
1795
+ q,
1796
+ {
1797
+ Icon: mr,
1798
+ onClick: () => H(e),
1799
+ disabled: e === void 0
1800
+ }
1801
+ ), /* @__PURE__ */ g.createElement(
1802
+ q,
1803
+ {
1804
+ Icon: hr,
1805
+ onClick: () => he(t, e),
1806
+ disabled: p || e === void 0
1807
+ }
1808
+ ), /* @__PURE__ */ g.createElement(
1809
+ q,
1810
+ {
1811
+ Icon: pr,
1812
+ onClick: () => V(e),
1813
+ disabled: !(e instanceof Q && Er(e))
1814
+ }
1815
+ ), /* @__PURE__ */ g.createElement(
1816
+ q,
1817
+ {
1818
+ Icon: gr,
1819
+ onClick: () => ae(t, 3)
1820
+ }
1821
+ ), /* @__PURE__ */ g.createElement(
1822
+ q,
1823
+ {
1824
+ Icon: vr,
1825
+ onClick: () => Ce(t, 3)
1826
+ }
1827
+ )), /* @__PURE__ */ g.createElement("div", { className: "control-panel" }, /* @__PURE__ */ g.createElement("div", { className: "segmentation-button-wrapper" }, /* @__PURE__ */ g.createElement(
1828
+ q,
1829
+ {
1830
+ Icon: wr,
1831
+ text: "NEW SEGMENTATION",
1832
+ onClick: () => O(),
1833
+ disabled: r.length >= 3
1834
+ }
1835
+ ))));
1836
+ };
1837
+ class ye {
1838
+ static createBlob(t, n) {
1839
+ return new Blob(t, n);
1840
+ }
1841
+ static createObjectURL(t) {
1842
+ const n = URL.createObjectURL(t);
1843
+ return this._blobs.add(n), n;
1844
+ }
1845
+ static revokeObjectURL(t) {
1846
+ return this._blobs.delete(t), URL.revokeObjectURL(t);
1847
+ }
1848
+ static revokeAll() {
1849
+ this._blobs.forEach((t) => this.revokeObjectURL(t));
1850
+ }
1851
+ }
1852
+ v(ye, "_blobs", /* @__PURE__ */ new Set());
1853
+ class le {
1854
+ static isNullUndefinedOrWhitespace(t) {
1855
+ return typeof t === void 0 || t == null ? !0 : `${t}`.replace(/\s/g, "").length < 1;
1856
+ }
1857
+ static isNonEmpty(t) {
1858
+ return !le.isNullUndefinedOrWhitespace(t);
1859
+ }
1860
+ static endsWith(t, n) {
1861
+ return !le.isNullUndefinedOrWhitespace(t) && !le.isNullUndefinedOrWhitespace(n) ? t.indexOf(n, t.length - n.length) !== -1 : !1;
1862
+ }
1863
+ static toMixedCase(t) {
1864
+ let n = { NBCU: "NBCU", REDBEE: "Red Bee", CMORE: "C More", TV2: "TV2", BBC: "BBC" };
1865
+ return t.replace(/_/g, " ").split(" ").map((r) => r in n ? n[r] : `${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()}`).join(" ");
1866
+ }
1867
+ static replaceWhitespace(t, n) {
1868
+ return t && t.trim().replace(/([\n ]*,[\n ]*|[\n ]+)/g, n).replace(new RegExp(`${n}$`), "");
1869
+ }
1870
+ static whitespacesToCommas(t) {
1871
+ return le.replaceWhitespace(t, ",");
1872
+ }
1873
+ static tokenizeWhitespaceSeparated(t) {
1874
+ return t ? le.replaceWhitespace(t, " ").split(" ") : void 0;
1875
+ }
1876
+ }
1877
+ /*!
1878
+ * decimal.js v10.5.0
1879
+ * An arbitrary-precision Decimal type for JavaScript.
1880
+ * https://github.com/MikeMcl/decimal.js
1881
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
1882
+ * MIT Licence
1883
+ */
1884
+ var it = 9e15, se = 1e9, ot = "0123456789abcdef", Ue = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Ze = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", st = {
1885
+ // These values must be integers within the stated ranges (inclusive).
1886
+ // Most of these values can be changed at run-time using the `Decimal.config` method.
1887
+ // The maximum number of significant digits of the result of a calculation or base conversion.
1888
+ // E.g. `Decimal.config({ precision: 20 });`
1889
+ precision: 20,
1890
+ // 1 to MAX_DIGITS
1891
+ // The rounding mode used when rounding to `precision`.
1892
+ //
1893
+ // ROUND_UP 0 Away from zero.
1894
+ // ROUND_DOWN 1 Towards zero.
1895
+ // ROUND_CEIL 2 Towards +Infinity.
1896
+ // ROUND_FLOOR 3 Towards -Infinity.
1897
+ // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
1898
+ // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
1899
+ // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
1900
+ // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
1901
+ // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
1902
+ //
1903
+ // E.g.
1904
+ // `Decimal.rounding = 4;`
1905
+ // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
1906
+ rounding: 4,
1907
+ // 0 to 8
1908
+ // The modulo mode used when calculating the modulus: a mod n.
1909
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
1910
+ // The remainder (r) is calculated as: r = a - n * q.
1911
+ //
1912
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
1913
+ // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
1914
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
1915
+ // HALF_EVEN 6 The IEEE 754 remainder function.
1916
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
1917
+ //
1918
+ // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
1919
+ // division (9) are commonly used for the modulus operation. The other rounding modes can also
1920
+ // be used, but they may not give useful results.
1921
+ modulo: 1,
1922
+ // 0 to 9
1923
+ // The exponent value at and beneath which `toString` returns exponential notation.
1924
+ // JavaScript numbers: -7
1925
+ toExpNeg: -7,
1926
+ // 0 to -EXP_LIMIT
1927
+ // The exponent value at and above which `toString` returns exponential notation.
1928
+ // JavaScript numbers: 21
1929
+ toExpPos: 21,
1930
+ // 0 to EXP_LIMIT
1931
+ // The minimum exponent value, beneath which underflow to zero occurs.
1932
+ // JavaScript numbers: -324 (5e-324)
1933
+ minE: -9e15,
1934
+ // -1 to -EXP_LIMIT
1935
+ // The maximum exponent value, above which overflow to Infinity occurs.
1936
+ // JavaScript numbers: 308 (1.7976931348623157e+308)
1937
+ maxE: it,
1938
+ // 1 to EXP_LIMIT
1939
+ // Whether to use cryptographically-secure random number generation, if available.
1940
+ crypto: !1
1941
+ // true/false
1942
+ }, Wt, J, L = !0, je = "[DecimalError] ", re = je + "Invalid argument: ", Xt = je + "Precision limit exceeded", jt = je + "crypto unavailable", Kt = "[object Decimal]", B = Math.floor, k = Math.pow, Sr = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Cr = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Lr = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, zt = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, K = 1e7, S = 7, Tr = 9007199254740991, _r = Ue.length - 1, at = Ze.length - 1, m = { toStringTag: Kt };
1943
+ m.absoluteValue = m.abs = function() {
1944
+ var e = new this.constructor(this);
1945
+ return e.s < 0 && (e.s = 1), w(e);
1946
+ };
1947
+ m.ceil = function() {
1948
+ return w(new this.constructor(this), this.e + 1, 2);
1949
+ };
1950
+ m.clampedTo = m.clamp = function(e, t) {
1951
+ var n, r = this, i = r.constructor;
1952
+ if (e = new i(e), t = new i(t), !e.s || !t.s) return new i(NaN);
1953
+ if (e.gt(t)) throw Error(re + t);
1954
+ return n = r.cmp(e), n < 0 ? e : r.cmp(t) > 0 ? t : new i(r);
1955
+ };
1956
+ m.comparedTo = m.cmp = function(e) {
1957
+ var t, n, r, i, o = this, s = o.d, a = (e = new o.constructor(e)).d, l = o.s, u = e.s;
1958
+ if (!s || !a)
1959
+ return !l || !u ? NaN : l !== u ? l : s === a ? 0 : !s ^ l < 0 ? 1 : -1;
1960
+ if (!s[0] || !a[0]) return s[0] ? l : a[0] ? -u : 0;
1961
+ if (l !== u) return l;
1962
+ if (o.e !== e.e) return o.e > e.e ^ l < 0 ? 1 : -1;
1963
+ for (r = s.length, i = a.length, t = 0, n = r < i ? r : i; t < n; ++t)
1964
+ if (s[t] !== a[t]) return s[t] > a[t] ^ l < 0 ? 1 : -1;
1965
+ return r === i ? 0 : r > i ^ l < 0 ? 1 : -1;
1966
+ };
1967
+ m.cosine = m.cos = function() {
1968
+ var e, t, n = this, r = n.constructor;
1969
+ return n.d ? n.d[0] ? (e = r.precision, t = r.rounding, r.precision = e + Math.max(n.e, n.sd()) + S, r.rounding = 1, n = yr(r, en(r, n)), r.precision = e, r.rounding = t, w(J == 2 || J == 3 ? n.neg() : n, e, t, !0)) : new r(1) : new r(NaN);
1970
+ };
1971
+ m.cubeRoot = m.cbrt = function() {
1972
+ var e, t, n, r, i, o, s, a, l, u, c = this, d = c.constructor;
1973
+ if (!c.isFinite() || c.isZero()) return new d(c);
1974
+ for (L = !1, o = c.s * k(c.s * c, 1 / 3), !o || Math.abs(o) == 1 / 0 ? (n = F(c.d), e = c.e, (o = (e - n.length + 1) % 3) && (n += o == 1 || o == -2 ? "0" : "00"), o = k(n, 1 / 3), e = B((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), o == 1 / 0 ? n = "5e" + e : (n = o.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), r = new d(n), r.s = c.s) : r = new d(o.toString()), s = (e = d.precision) + 3; ; )
1975
+ if (a = r, l = a.times(a).times(a), u = l.plus(c), r = N(u.plus(c).times(a), u.plus(l), s + 2, 1), F(a.d).slice(0, s) === (n = F(r.d)).slice(0, s))
1976
+ if (n = n.slice(s - 3, s + 1), n == "9999" || !i && n == "4999") {
1977
+ if (!i && (w(a, e + 1, 0), a.times(a).times(a).eq(c))) {
1978
+ r = a;
1979
+ break;
1980
+ }
1981
+ s += 4, i = 1;
1982
+ } else {
1983
+ (!+n || !+n.slice(1) && n.charAt(0) == "5") && (w(r, e + 1, 1), t = !r.times(r).times(r).eq(c));
1984
+ break;
1985
+ }
1986
+ return L = !0, w(r, e, d.rounding, t);
1987
+ };
1988
+ m.decimalPlaces = m.dp = function() {
1989
+ var e, t = this.d, n = NaN;
1990
+ if (t) {
1991
+ if (e = t.length - 1, n = (e - B(this.e / S)) * S, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
1992
+ n < 0 && (n = 0);
1993
+ }
1994
+ return n;
1995
+ };
1996
+ m.dividedBy = m.div = function(e) {
1997
+ return N(this, new this.constructor(e));
1998
+ };
1999
+ m.dividedToIntegerBy = m.divToInt = function(e) {
2000
+ var t = this, n = t.constructor;
2001
+ return w(N(t, new n(e), 0, 1, 1), n.precision, n.rounding);
2002
+ };
2003
+ m.equals = m.eq = function(e) {
2004
+ return this.cmp(e) === 0;
2005
+ };
2006
+ m.floor = function() {
2007
+ return w(new this.constructor(this), this.e + 1, 3);
2008
+ };
2009
+ m.greaterThan = m.gt = function(e) {
2010
+ return this.cmp(e) > 0;
2011
+ };
2012
+ m.greaterThanOrEqualTo = m.gte = function(e) {
2013
+ var t = this.cmp(e);
2014
+ return t == 1 || t === 0;
2015
+ };
2016
+ m.hyperbolicCosine = m.cosh = function() {
2017
+ var e, t, n, r, i, o = this, s = o.constructor, a = new s(1);
2018
+ if (!o.isFinite()) return new s(o.s ? 1 / 0 : NaN);
2019
+ if (o.isZero()) return a;
2020
+ 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 ? (e = Math.ceil(i / 3), t = (1 / ze(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), o = Ee(s, 1, o.times(t), new s(1), !0);
2021
+ for (var l, u = e, c = new s(8); u--; )
2022
+ l = o.times(o), o = a.minus(l.times(c.minus(l.times(c))));
2023
+ return w(o, s.precision = n, s.rounding = r, !0);
2024
+ };
2025
+ m.hyperbolicSine = m.sinh = function() {
2026
+ var e, t, n, r, i = this, o = i.constructor;
2027
+ if (!i.isFinite() || i.isZero()) return new o(i);
2028
+ if (t = o.precision, n = o.rounding, o.precision = t + Math.max(i.e, i.sd()) + 4, o.rounding = 1, r = i.d.length, r < 3)
2029
+ i = Ee(o, 2, i, i, !0);
2030
+ else {
2031
+ e = 1.4 * Math.sqrt(r), e = e > 16 ? 16 : e | 0, i = i.times(1 / ze(5, e)), i = Ee(o, 2, i, i, !0);
2032
+ for (var s, a = new o(5), l = new o(16), u = new o(20); e--; )
2033
+ s = i.times(i), i = i.times(a.plus(s.times(l.times(s).plus(u))));
2034
+ }
2035
+ return o.precision = t, o.rounding = n, w(i, t, n, !0);
2036
+ };
2037
+ m.hyperbolicTangent = m.tanh = function() {
2038
+ var e, t, n = this, r = n.constructor;
2039
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, t = r.rounding, r.precision = e + 7, r.rounding = 1, N(n.sinh(), n.cosh(), r.precision = e, r.rounding = t)) : new r(n.s);
2040
+ };
2041
+ m.inverseCosine = m.acos = function() {
2042
+ var e = this, t = e.constructor, n = e.abs().cmp(1), r = t.precision, i = t.rounding;
2043
+ return n !== -1 ? n === 0 ? e.isNeg() ? z(t, r, i) : new t(0) : new t(NaN) : e.isZero() ? z(t, r + 4, i).times(0.5) : (t.precision = r + 6, t.rounding = 1, e = new t(1).minus(e).div(e.plus(1)).sqrt().atan(), t.precision = r, t.rounding = i, e.times(2));
2044
+ };
2045
+ m.inverseHyperbolicCosine = m.acosh = function() {
2046
+ var e, t, n = this, r = n.constructor;
2047
+ return n.lte(1) ? new r(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = r.precision, t = r.rounding, r.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, r.rounding = 1, L = !1, n = n.times(n).minus(1).sqrt().plus(n), L = !0, r.precision = e, r.rounding = t, n.ln()) : new r(n);
2048
+ };
2049
+ m.inverseHyperbolicSine = m.asinh = function() {
2050
+ var e, t, n = this, r = n.constructor;
2051
+ return !n.isFinite() || n.isZero() ? new r(n) : (e = r.precision, t = r.rounding, r.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, r.rounding = 1, L = !1, n = n.times(n).plus(1).sqrt().plus(n), L = !0, r.precision = e, r.rounding = t, n.ln());
2052
+ };
2053
+ m.inverseHyperbolicTangent = m.atanh = function() {
2054
+ var e, t, n, r, i = this, o = i.constructor;
2055
+ return i.isFinite() ? i.e >= 0 ? new o(i.abs().eq(1) ? i.s / 0 : i.isZero() ? i : NaN) : (e = o.precision, t = o.rounding, r = i.sd(), Math.max(r, e) < 2 * -i.e - 1 ? w(new o(i), e, t, !0) : (o.precision = n = r - i.e, i = N(i.plus(1), new o(1).minus(i), n + e, 1), o.precision = e + 4, o.rounding = 1, i = i.ln(), o.precision = e, o.rounding = t, i.times(0.5))) : new o(NaN);
2056
+ };
2057
+ m.inverseSine = m.asin = function() {
2058
+ var e, t, n, r, i = this, o = i.constructor;
2059
+ return i.isZero() ? new o(i) : (t = i.abs().cmp(1), n = o.precision, r = o.rounding, t !== -1 ? t === 0 ? (e = z(o, n + 4, r).times(0.5), e.s = i.s, e) : 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)));
2060
+ };
2061
+ m.inverseTangent = m.atan = function() {
2062
+ var e, t, n, r, i, o, s, a, l, u = this, c = u.constructor, d = c.precision, f = c.rounding;
2063
+ if (u.isFinite()) {
2064
+ if (u.isZero())
2065
+ return new c(u);
2066
+ if (u.abs().eq(1) && d + 4 <= at)
2067
+ return s = z(c, d + 4, f).times(0.25), s.s = u.s, s;
2068
+ } else {
2069
+ if (!u.s) return new c(NaN);
2070
+ if (d + 4 <= at)
2071
+ return s = z(c, d + 4, f).times(0.5), s.s = u.s, s;
2072
+ }
2073
+ for (c.precision = a = d + 10, c.rounding = 1, n = Math.min(28, a / S + 2 | 0), e = n; e; --e) u = u.div(u.times(u).plus(1).sqrt().plus(1));
2074
+ for (L = !1, t = Math.ceil(a / S), r = 1, l = u.times(u), s = new c(u), i = u; e !== -1; )
2075
+ if (i = i.times(l), o = s.minus(i.div(r += 2)), i = i.times(l), s = o.plus(i.div(r += 2)), s.d[t] !== void 0) for (e = t; s.d[e] === o.d[e] && e--; ) ;
2076
+ return n && (s = s.times(2 << n - 1)), L = !0, w(s, c.precision = d, c.rounding = f, !0);
2077
+ };
2078
+ m.isFinite = function() {
2079
+ return !!this.d;
2080
+ };
2081
+ m.isInteger = m.isInt = function() {
2082
+ return !!this.d && B(this.e / S) > this.d.length - 2;
2083
+ };
2084
+ m.isNaN = function() {
2085
+ return !this.s;
2086
+ };
2087
+ m.isNegative = m.isNeg = function() {
2088
+ return this.s < 0;
2089
+ };
2090
+ m.isPositive = m.isPos = function() {
2091
+ return this.s > 0;
2092
+ };
2093
+ m.isZero = function() {
2094
+ return !!this.d && this.d[0] === 0;
2095
+ };
2096
+ m.lessThan = m.lt = function(e) {
2097
+ return this.cmp(e) < 0;
2098
+ };
2099
+ m.lessThanOrEqualTo = m.lte = function(e) {
2100
+ return this.cmp(e) < 1;
2101
+ };
2102
+ m.logarithm = m.log = function(e) {
2103
+ var t, n, r, i, o, s, a, l, u = this, c = u.constructor, d = c.precision, f = c.rounding, h = 5;
2104
+ if (e == null)
2105
+ e = new c(10), t = !0;
2106
+ else {
2107
+ if (e = new c(e), n = e.d, e.s < 0 || !n || !n[0] || e.eq(1)) return new c(NaN);
2108
+ t = e.eq(10);
2109
+ }
2110
+ if (n = u.d, u.s < 0 || !n || !n[0] || u.eq(1))
2111
+ return new c(n && !n[0] ? -1 / 0 : u.s != 1 ? NaN : n ? 0 : 1 / 0);
2112
+ if (t)
2113
+ if (n.length > 1)
2114
+ o = !0;
2115
+ else {
2116
+ for (i = n[0]; i % 10 === 0; ) i /= 10;
2117
+ o = i !== 1;
2118
+ }
2119
+ if (L = !1, a = d + h, s = te(u, a), r = t ? qe(c, a + 10) : te(e, a), l = N(s, r, a, 1), xe(l.d, i = d, f))
2120
+ do
2121
+ if (a += 10, s = te(u, a), r = t ? qe(c, a + 10) : te(e, a), l = N(s, r, a, 1), !o) {
2122
+ +F(l.d).slice(i + 1, i + 15) + 1 == 1e14 && (l = w(l, d + 1, 0));
2123
+ break;
2124
+ }
2125
+ while (xe(l.d, i += 10, f));
2126
+ return L = !0, w(l, d, f);
2127
+ };
2128
+ m.minus = m.sub = function(e) {
2129
+ var t, n, r, i, o, s, a, l, u, c, d, f, h = this, b = h.constructor;
2130
+ if (e = new b(e), !h.d || !e.d)
2131
+ return !h.s || !e.s ? e = new b(NaN) : h.d ? e.s = -e.s : e = new b(e.d || h.s !== e.s ? h : NaN), e;
2132
+ if (h.s != e.s)
2133
+ return e.s = -e.s, h.plus(e);
2134
+ if (u = h.d, f = e.d, a = b.precision, l = b.rounding, !u[0] || !f[0]) {
2135
+ if (f[0]) e.s = -e.s;
2136
+ else if (u[0]) e = new b(h);
2137
+ else return new b(l === 3 ? -0 : 0);
2138
+ return L ? w(e, a, l) : e;
2139
+ }
2140
+ if (n = B(e.e / S), c = B(h.e / S), u = u.slice(), o = c - n, o) {
2141
+ for (d = o < 0, d ? (t = u, o = -o, s = f.length) : (t = f, n = c, s = u.length), r = Math.max(Math.ceil(a / S), s) + 2, o > r && (o = r, t.length = 1), t.reverse(), r = o; r--; ) t.push(0);
2142
+ t.reverse();
2143
+ } else {
2144
+ for (r = u.length, s = f.length, d = r < s, d && (s = r), r = 0; r < s; r++)
2145
+ if (u[r] != f[r]) {
2146
+ d = u[r] < f[r];
2147
+ break;
2148
+ }
2149
+ o = 0;
2150
+ }
2151
+ for (d && (t = u, u = f, f = t, e.s = -e.s), s = u.length, r = f.length - s; r > 0; --r) u[s++] = 0;
2152
+ for (r = f.length; r > o; ) {
2153
+ if (u[--r] < f[r]) {
2154
+ for (i = r; i && u[--i] === 0; ) u[i] = K - 1;
2155
+ --u[i], u[r] += K;
2156
+ }
2157
+ u[r] -= f[r];
2158
+ }
2159
+ for (; u[--s] === 0; ) u.pop();
2160
+ for (; u[0] === 0; u.shift()) --n;
2161
+ return u[0] ? (e.d = u, e.e = Ke(u, n), L ? w(e, a, l) : e) : new b(l === 3 ? -0 : 0);
2162
+ };
2163
+ m.modulo = m.mod = function(e) {
2164
+ var t, n = this, r = n.constructor;
2165
+ return e = new r(e), !n.d || !e.s || e.d && !e.d[0] ? new r(NaN) : !e.d || n.d && !n.d[0] ? w(new r(n), r.precision, r.rounding) : (L = !1, r.modulo == 9 ? (t = N(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = N(n, e, 0, r.modulo, 1), t = t.times(e), L = !0, n.minus(t));
2166
+ };
2167
+ m.naturalExponential = m.exp = function() {
2168
+ return ut(this);
2169
+ };
2170
+ m.naturalLogarithm = m.ln = function() {
2171
+ return te(this);
2172
+ };
2173
+ m.negated = m.neg = function() {
2174
+ var e = new this.constructor(this);
2175
+ return e.s = -e.s, w(e);
2176
+ };
2177
+ m.plus = m.add = function(e) {
2178
+ var t, n, r, i, o, s, a, l, u, c, d = this, f = d.constructor;
2179
+ if (e = new f(e), !d.d || !e.d)
2180
+ return !d.s || !e.s ? e = new f(NaN) : d.d || (e = new f(e.d || d.s === e.s ? d : NaN)), e;
2181
+ if (d.s != e.s)
2182
+ return e.s = -e.s, d.minus(e);
2183
+ if (u = d.d, c = e.d, a = f.precision, l = f.rounding, !u[0] || !c[0])
2184
+ return c[0] || (e = new f(d)), L ? w(e, a, l) : e;
2185
+ if (o = B(d.e / S), r = B(e.e / S), u = u.slice(), i = o - r, i) {
2186
+ for (i < 0 ? (n = u, i = -i, s = c.length) : (n = c, r = o, s = u.length), o = Math.ceil(a / S), s = o > s ? o + 1 : s + 1, i > s && (i = s, n.length = 1), n.reverse(); i--; ) n.push(0);
2187
+ n.reverse();
2188
+ }
2189
+ for (s = u.length, i = c.length, s - i < 0 && (i = s, n = c, c = u, u = n), t = 0; i; )
2190
+ t = (u[--i] = u[i] + c[i] + t) / K | 0, u[i] %= K;
2191
+ for (t && (u.unshift(t), ++r), s = u.length; u[--s] == 0; ) u.pop();
2192
+ return e.d = u, e.e = Ke(u, r), L ? w(e, a, l) : e;
2193
+ };
2194
+ m.precision = m.sd = function(e) {
2195
+ var t, n = this;
2196
+ if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(re + e);
2197
+ return n.d ? (t = Gt(n.d), e && n.e + 1 > t && (t = n.e + 1)) : t = NaN, t;
2198
+ };
2199
+ m.round = function() {
2200
+ var e = this, t = e.constructor;
2201
+ return w(new t(e), e.e + 1, t.rounding);
2202
+ };
2203
+ m.sine = m.sin = function() {
2204
+ var e, t, n = this, r = n.constructor;
2205
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, t = r.rounding, r.precision = e + Math.max(n.e, n.sd()) + S, r.rounding = 1, n = Or(r, en(r, n)), r.precision = e, r.rounding = t, w(J > 2 ? n.neg() : n, e, t, !0)) : new r(NaN);
2206
+ };
2207
+ m.squareRoot = m.sqrt = function() {
2208
+ var e, t, n, r, i, o, s = this, a = s.d, l = s.e, u = s.s, c = s.constructor;
2209
+ if (u !== 1 || !a || !a[0])
2210
+ return new c(!u || u < 0 && (!a || a[0]) ? NaN : a ? s : 1 / 0);
2211
+ for (L = !1, u = Math.sqrt(+s), u == 0 || u == 1 / 0 ? (t = F(a), (t.length + l) % 2 == 0 && (t += "0"), u = Math.sqrt(t), l = B((l + 1) / 2) - (l < 0 || l % 2), u == 1 / 0 ? t = "5e" + l : (t = u.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + l), r = new c(t)) : r = new c(u.toString()), n = (l = c.precision) + 3; ; )
2212
+ if (o = r, r = o.plus(N(s, o, n + 2, 1)).times(0.5), F(o.d).slice(0, n) === (t = F(r.d)).slice(0, n))
2213
+ if (t = t.slice(n - 3, n + 1), t == "9999" || !i && t == "4999") {
2214
+ if (!i && (w(o, l + 1, 0), o.times(o).eq(s))) {
2215
+ r = o;
2216
+ break;
2217
+ }
2218
+ n += 4, i = 1;
2219
+ } else {
2220
+ (!+t || !+t.slice(1) && t.charAt(0) == "5") && (w(r, l + 1, 1), e = !r.times(r).eq(s));
2221
+ break;
2222
+ }
2223
+ return L = !0, w(r, l, c.rounding, e);
2224
+ };
2225
+ m.tangent = m.tan = function() {
2226
+ var e, t, n = this, r = n.constructor;
2227
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, t = r.rounding, r.precision = e + 10, r.rounding = 1, n = n.sin(), n.s = 1, n = N(n, new r(1).minus(n.times(n)).sqrt(), e + 10, 0), r.precision = e, r.rounding = t, w(J == 2 || J == 4 ? n.neg() : n, e, t, !0)) : new r(NaN);
2228
+ };
2229
+ m.times = m.mul = function(e) {
2230
+ var t, n, r, i, o, s, a, l, u, c = this, d = c.constructor, f = c.d, h = (e = new d(e)).d;
2231
+ if (e.s *= c.s, !f || !f[0] || !h || !h[0])
2232
+ return new d(!e.s || f && !f[0] && !h || h && !h[0] && !f ? NaN : !f || !h ? e.s / 0 : e.s * 0);
2233
+ for (n = B(c.e / S) + B(e.e / S), l = f.length, u = h.length, l < u && (o = f, f = h, h = o, s = l, l = u, u = s), o = [], s = l + u, r = s; r--; ) o.push(0);
2234
+ for (r = u; --r >= 0; ) {
2235
+ for (t = 0, i = l + r; i > r; )
2236
+ a = o[i] + h[r] * f[i - r - 1] + t, o[i--] = a % K | 0, t = a / K | 0;
2237
+ o[i] = (o[i] + t) % K | 0;
2238
+ }
2239
+ for (; !o[--s]; ) o.pop();
2240
+ return t ? ++n : o.shift(), e.d = o, e.e = Ke(o, n), L ? w(e, d.precision, d.rounding) : e;
2241
+ };
2242
+ m.toBinary = function(e, t) {
2243
+ return dt(this, 2, e, t);
2244
+ };
2245
+ m.toDecimalPlaces = m.toDP = function(e, t) {
2246
+ var n = this, r = n.constructor;
2247
+ return n = new r(n), e === void 0 ? n : (U(e, 0, se), t === void 0 ? t = r.rounding : U(t, 0, 8), w(n, e + n.e + 1, t));
2248
+ };
2249
+ m.toExponential = function(e, t) {
2250
+ var n, r = this, i = r.constructor;
2251
+ return e === void 0 ? n = G(r, !0) : (U(e, 0, se), t === void 0 ? t = i.rounding : U(t, 0, 8), r = w(new i(r), e + 1, t), n = G(r, !0, e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
2252
+ };
2253
+ m.toFixed = function(e, t) {
2254
+ var n, r, i = this, o = i.constructor;
2255
+ return e === void 0 ? n = G(i) : (U(e, 0, se), t === void 0 ? t = o.rounding : U(t, 0, 8), r = w(new o(i), e + i.e + 1, t), n = G(r, !1, e + r.e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
2256
+ };
2257
+ m.toFraction = function(e) {
2258
+ var t, n, r, i, o, s, a, l, u, c, d, f, h = this, b = h.d, p = h.constructor;
2259
+ if (!b) return new p(h);
2260
+ if (u = n = new p(1), r = l = new p(0), t = new p(r), o = t.e = Gt(b) - h.e - 1, s = o % S, t.d[0] = k(10, s < 0 ? S + s : s), e == null)
2261
+ e = o > 0 ? t : u;
2262
+ else {
2263
+ if (a = new p(e), !a.isInt() || a.lt(u)) throw Error(re + a);
2264
+ e = a.gt(t) ? o > 0 ? t : u : a;
2265
+ }
2266
+ for (L = !1, a = new p(F(b)), c = p.precision, p.precision = o = b.length * S * 2; d = N(a, t, 0, 1, 1), i = n.plus(d.times(r)), i.cmp(e) != 1; )
2267
+ n = r, r = i, i = u, u = l.plus(d.times(i)), l = i, i = t, t = a.minus(d.times(i)), a = i;
2268
+ return i = N(e.minus(n), r, 0, 1, 1), l = l.plus(i.times(u)), n = n.plus(i.times(r)), l.s = u.s = h.s, f = N(u, r, o, 1).minus(h).abs().cmp(N(l, n, o, 1).minus(h).abs()) < 1 ? [u, r] : [l, n], p.precision = c, L = !0, f;
2269
+ };
2270
+ m.toHexadecimal = m.toHex = function(e, t) {
2271
+ return dt(this, 16, e, t);
2272
+ };
2273
+ m.toNearest = function(e, t) {
2274
+ var n = this, r = n.constructor;
2275
+ if (n = new r(n), e == null) {
2276
+ if (!n.d) return n;
2277
+ e = new r(1), t = r.rounding;
2278
+ } else {
2279
+ if (e = new r(e), t === void 0 ? t = r.rounding : U(t, 0, 8), !n.d) return e.s ? n : e;
2280
+ if (!e.d)
2281
+ return e.s && (e.s = n.s), e;
2282
+ }
2283
+ return e.d[0] ? (L = !1, n = N(n, e, 0, t, 1).times(e), L = !0, w(n)) : (e.s = n.s, n = e), n;
2284
+ };
2285
+ m.toNumber = function() {
2286
+ return +this;
2287
+ };
2288
+ m.toOctal = function(e, t) {
2289
+ return dt(this, 8, e, t);
2290
+ };
2291
+ m.toPower = m.pow = function(e) {
2292
+ var t, n, r, i, o, s, a = this, l = a.constructor, u = +(e = new l(e));
2293
+ if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new l(k(+a, u));
2294
+ if (a = new l(a), a.eq(1)) return a;
2295
+ if (r = l.precision, o = l.rounding, e.eq(1)) return w(a, r, o);
2296
+ if (t = B(e.e / S), t >= e.d.length - 1 && (n = u < 0 ? -u : u) <= Tr)
2297
+ return i = Yt(l, a, n, r), e.s < 0 ? new l(1).div(i) : w(i, r, o);
2298
+ if (s = a.s, s < 0) {
2299
+ if (t < e.d.length - 1) return new l(NaN);
2300
+ if ((e.d[t] & 1) == 0 && (s = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
2301
+ return a.s = s, a;
2302
+ }
2303
+ return n = k(+a, u), t = n == 0 || !isFinite(n) ? B(u * (Math.log("0." + F(a.d)) / Math.LN10 + a.e + 1)) : new l(n + "").e, t > l.maxE + 1 || t < l.minE - 1 ? new l(t > 0 ? s / 0 : 0) : (L = !1, l.rounding = a.s = 1, n = Math.min(12, (t + "").length), i = ut(e.times(te(a, r + n)), r), i.d && (i = w(i, r + 5, 1), xe(i.d, r, o) && (t = r + 10, i = w(ut(e.times(te(a, t + n)), t), t + 5, 1), +F(i.d).slice(r + 1, r + 15) + 1 == 1e14 && (i = w(i, r + 1, 0)))), i.s = s, L = !0, l.rounding = o, w(i, r, o));
2304
+ };
2305
+ m.toPrecision = function(e, t) {
2306
+ var n, r = this, i = r.constructor;
2307
+ return e === void 0 ? n = G(r, r.e <= i.toExpNeg || r.e >= i.toExpPos) : (U(e, 1, se), t === void 0 ? t = i.rounding : U(t, 0, 8), r = w(new i(r), e, t), n = G(r, e <= r.e || r.e <= i.toExpNeg, e)), r.isNeg() && !r.isZero() ? "-" + n : n;
2308
+ };
2309
+ m.toSignificantDigits = m.toSD = function(e, t) {
2310
+ var n = this, r = n.constructor;
2311
+ return e === void 0 ? (e = r.precision, t = r.rounding) : (U(e, 1, se), t === void 0 ? t = r.rounding : U(t, 0, 8)), w(new r(n), e, t);
2312
+ };
2313
+ m.toString = function() {
2314
+ var e = this, t = e.constructor, n = G(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
2315
+ return e.isNeg() && !e.isZero() ? "-" + n : n;
2316
+ };
2317
+ m.truncated = m.trunc = function() {
2318
+ return w(new this.constructor(this), this.e + 1, 1);
2319
+ };
2320
+ m.valueOf = m.toJSON = function() {
2321
+ var e = this, t = e.constructor, n = G(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
2322
+ return e.isNeg() ? "-" + n : n;
2323
+ };
2324
+ function F(e) {
2325
+ var t, n, r, i = e.length - 1, o = "", s = e[0];
2326
+ if (i > 0) {
2327
+ for (o += s, t = 1; t < i; t++)
2328
+ r = e[t] + "", n = S - r.length, n && (o += ee(n)), o += r;
2329
+ s = e[t], r = s + "", n = S - r.length, n && (o += ee(n));
2330
+ } else if (s === 0)
2331
+ return "0";
2332
+ for (; s % 10 === 0; ) s /= 10;
2333
+ return o + s;
2334
+ }
2335
+ function U(e, t, n) {
2336
+ if (e !== ~~e || e < t || e > n)
2337
+ throw Error(re + e);
2338
+ }
2339
+ function xe(e, t, n, r) {
2340
+ var i, o, s, a;
2341
+ for (o = e[0]; o >= 10; o /= 10) --t;
2342
+ return --t < 0 ? (t += S, i = 0) : (i = Math.ceil((t + 1) / S), t %= S), o = k(10, S - t), a = e[i] % o | 0, r == null ? t < 3 ? (t == 0 ? a = a / 100 | 0 : t == 1 && (a = a / 10 | 0), s = n < 4 && a == 99999 || n > 3 && a == 49999 || a == 5e4 || a == 0) : s = (n < 4 && a + 1 == o || n > 3 && a + 1 == o / 2) && (e[i + 1] / o / 100 | 0) == k(10, t - 2) - 1 || (a == o / 2 || a == 0) && (e[i + 1] / o / 100 | 0) == 0 : t < 4 ? (t == 0 ? a = a / 1e3 | 0 : t == 1 ? a = a / 100 | 0 : t == 2 && (a = a / 10 | 0), s = (r || n < 4) && a == 9999 || !r && n > 3 && a == 4999) : s = ((r || n < 4) && a + 1 == o || !r && n > 3 && a + 1 == o / 2) && (e[i + 1] / o / 1e3 | 0) == k(10, t - 3) - 1, s;
2343
+ }
2344
+ function Fe(e, t, n) {
2345
+ for (var r, i = [0], o, s = 0, a = e.length; s < a; ) {
2346
+ for (o = i.length; o--; ) i[o] *= t;
2347
+ for (i[0] += ot.indexOf(e.charAt(s++)), r = 0; r < i.length; r++)
2348
+ i[r] > n - 1 && (i[r + 1] === void 0 && (i[r + 1] = 0), i[r + 1] += i[r] / n | 0, i[r] %= n);
2349
+ }
2350
+ return i.reverse();
2351
+ }
2352
+ function yr(e, t) {
2353
+ var n, r, i;
2354
+ if (t.isZero()) return t;
2355
+ r = t.d.length, r < 32 ? (n = Math.ceil(r / 3), i = (1 / ze(4, n)).toString()) : (n = 16, i = "2.3283064365386962890625e-10"), e.precision += n, t = Ee(e, 1, t.times(i), new e(1));
2356
+ for (var o = n; o--; ) {
2357
+ var s = t.times(t);
2358
+ t = s.times(s).minus(s).times(8).plus(1);
2359
+ }
2360
+ return e.precision -= n, t;
2361
+ }
2362
+ var N = /* @__PURE__ */ function() {
2363
+ function e(r, i, o) {
2364
+ var s, a = 0, l = r.length;
2365
+ for (r = r.slice(); l--; )
2366
+ s = r[l] * i + a, r[l] = s % o | 0, a = s / o | 0;
2367
+ return a && r.unshift(a), r;
2368
+ }
2369
+ function t(r, i, o, s) {
2370
+ var a, l;
2371
+ if (o != s)
2372
+ l = o > s ? 1 : -1;
2373
+ else
2374
+ for (a = l = 0; a < o; a++)
2375
+ if (r[a] != i[a]) {
2376
+ l = r[a] > i[a] ? 1 : -1;
2377
+ break;
2378
+ }
2379
+ return l;
2380
+ }
2381
+ function n(r, i, o, s) {
2382
+ for (var a = 0; o--; )
2383
+ r[o] -= a, a = r[o] < i[o] ? 1 : 0, r[o] = a * s + r[o] - i[o];
2384
+ for (; !r[0] && r.length > 1; ) r.shift();
2385
+ }
2386
+ return function(r, i, o, s, a, l) {
2387
+ var u, c, d, f, h, b, p, _, T, D, y, M, fe, P, Se, de, ae, Ce, H, he, me = r.constructor, Le = r.s == i.s ? 1 : -1, V = r.d, O = i.d;
2388
+ if (!V || !V[0] || !O || !O[0])
2389
+ return new me(
2390
+ // Return NaN if either NaN, or both Infinity or 0.
2391
+ !r.s || !i.s || (V ? O && V[0] == O[0] : !O) ? NaN : (
2392
+ // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
2393
+ V && V[0] == 0 || !O ? Le * 0 : Le / 0
2394
+ )
2395
+ );
2396
+ for (l ? (h = 1, c = r.e - i.e) : (l = K, h = S, c = B(r.e / h) - B(i.e / h)), H = O.length, ae = V.length, T = new me(Le), D = T.d = [], d = 0; O[d] == (V[d] || 0); d++) ;
2397
+ if (O[d] > (V[d] || 0) && c--, o == null ? (P = o = me.precision, s = me.rounding) : a ? P = o + (r.e - i.e) + 1 : P = o, P < 0)
2398
+ D.push(1), b = !0;
2399
+ else {
2400
+ if (P = P / h + 2 | 0, d = 0, H == 1) {
2401
+ for (f = 0, O = O[0], P++; (d < ae || f) && P--; d++)
2402
+ Se = f * l + (V[d] || 0), D[d] = Se / O | 0, f = Se % O | 0;
2403
+ b = f || d < ae;
2404
+ } else {
2405
+ for (f = l / (O[0] + 1) | 0, f > 1 && (O = e(O, f, l), V = e(V, f, l), H = O.length, ae = V.length), de = H, y = V.slice(0, H), M = y.length; M < H; ) y[M++] = 0;
2406
+ he = O.slice(), he.unshift(0), Ce = O[0], O[1] >= l / 2 && ++Ce;
2407
+ do
2408
+ f = 0, u = t(O, y, H, M), u < 0 ? (fe = y[0], H != M && (fe = fe * l + (y[1] || 0)), f = fe / Ce | 0, f > 1 ? (f >= l && (f = l - 1), p = e(O, f, l), _ = p.length, M = y.length, u = t(p, y, _, M), u == 1 && (f--, n(p, H < _ ? he : O, _, l))) : (f == 0 && (u = f = 1), p = O.slice()), _ = p.length, _ < M && p.unshift(0), n(y, p, M, l), u == -1 && (M = y.length, u = t(O, y, H, M), u < 1 && (f++, n(y, H < M ? he : O, M, l))), M = y.length) : u === 0 && (f++, y = [0]), D[d++] = f, u && y[0] ? y[M++] = V[de] || 0 : (y = [V[de]], M = 1);
2409
+ while ((de++ < ae || y[0] !== void 0) && P--);
2410
+ b = y[0] !== void 0;
2411
+ }
2412
+ D[0] || D.shift();
2413
+ }
2414
+ if (h == 1)
2415
+ T.e = c, Wt = b;
2416
+ else {
2417
+ for (d = 1, f = D[0]; f >= 10; f /= 10) d++;
2418
+ T.e = d + c * h - 1, w(T, a ? o + T.e + 1 : o, s, b);
2419
+ }
2420
+ return T;
2421
+ };
2422
+ }();
2423
+ function w(e, t, n, r) {
2424
+ var i, o, s, a, l, u, c, d, f, h = e.constructor;
2425
+ e: if (t != null) {
2426
+ if (d = e.d, !d) return e;
2427
+ for (i = 1, a = d[0]; a >= 10; a /= 10) i++;
2428
+ if (o = t - i, o < 0)
2429
+ o += S, s = t, c = d[f = 0], l = c / k(10, i - s - 1) % 10 | 0;
2430
+ else if (f = Math.ceil((o + 1) / S), a = d.length, f >= a)
2431
+ if (r) {
2432
+ for (; a++ <= f; ) d.push(0);
2433
+ c = l = 0, i = 1, o %= S, s = o - S + 1;
2434
+ } else
2435
+ break e;
2436
+ else {
2437
+ for (c = a = d[f], i = 1; a >= 10; a /= 10) i++;
2438
+ o %= S, s = o - S + i, l = s < 0 ? 0 : c / k(10, i - s - 1) % 10 | 0;
2439
+ }
2440
+ if (r = r || t < 0 || d[f + 1] !== void 0 || (s < 0 ? c : c % k(10, i - s - 1)), u = n < 4 ? (l || r) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : l > 5 || l == 5 && (n == 4 || r || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
2441
+ (o > 0 ? s > 0 ? c / k(10, i - s) : 0 : d[f - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !d[0])
2442
+ return d.length = 0, u ? (t -= e.e + 1, d[0] = k(10, (S - t % S) % S), e.e = -t || 0) : d[0] = e.e = 0, e;
2443
+ if (o == 0 ? (d.length = f, a = 1, f--) : (d.length = f + 1, a = k(10, S - o), d[f] = s > 0 ? (c / k(10, i - s) % k(10, s) | 0) * a : 0), u)
2444
+ for (; ; )
2445
+ if (f == 0) {
2446
+ for (o = 1, s = d[0]; s >= 10; s /= 10) o++;
2447
+ for (s = d[0] += a, a = 1; s >= 10; s /= 10) a++;
2448
+ o != a && (e.e++, d[0] == K && (d[0] = 1));
2449
+ break;
2450
+ } else {
2451
+ if (d[f] += a, d[f] != K) break;
2452
+ d[f--] = 0, a = 1;
2453
+ }
2454
+ for (o = d.length; d[--o] === 0; ) d.pop();
2455
+ }
2456
+ return L && (e.e > h.maxE ? (e.d = null, e.e = NaN) : e.e < h.minE && (e.e = 0, e.d = [0])), e;
2457
+ }
2458
+ function G(e, t, n) {
2459
+ if (!e.isFinite()) return Qt(e);
2460
+ var r, i = e.e, o = F(e.d), s = o.length;
2461
+ return t ? (n && (r = n - s) > 0 ? o = o.charAt(0) + "." + o.slice(1) + ee(r) : s > 1 && (o = o.charAt(0) + "." + o.slice(1)), o = o + (e.e < 0 ? "e" : "e+") + e.e) : i < 0 ? (o = "0." + ee(-i - 1) + o, n && (r = n - s) > 0 && (o += ee(r))) : i >= s ? (o += ee(i + 1 - s), n && (r = n - i - 1) > 0 && (o = o + "." + ee(r))) : ((r = i + 1) < s && (o = o.slice(0, r) + "." + o.slice(r)), n && (r = n - s) > 0 && (i + 1 === s && (o += "."), o += ee(r))), o;
2462
+ }
2463
+ function Ke(e, t) {
2464
+ var n = e[0];
2465
+ for (t *= S; n >= 10; n /= 10) t++;
2466
+ return t;
2467
+ }
2468
+ function qe(e, t, n) {
2469
+ if (t > _r)
2470
+ throw L = !0, n && (e.precision = n), Error(Xt);
2471
+ return w(new e(Ue), t, 1, !0);
2472
+ }
2473
+ function z(e, t, n) {
2474
+ if (t > at) throw Error(Xt);
2475
+ return w(new e(Ze), t, n, !0);
2476
+ }
2477
+ function Gt(e) {
2478
+ var t = e.length - 1, n = t * S + 1;
2479
+ if (t = e[t], t) {
2480
+ for (; t % 10 == 0; t /= 10) n--;
2481
+ for (t = e[0]; t >= 10; t /= 10) n++;
2482
+ }
2483
+ return n;
2484
+ }
2485
+ function ee(e) {
2486
+ for (var t = ""; e--; ) t += "0";
2487
+ return t;
2488
+ }
2489
+ function Yt(e, t, n, r) {
2490
+ var i, o = new e(1), s = Math.ceil(r / S + 4);
2491
+ for (L = !1; ; ) {
2492
+ if (n % 2 && (o = o.times(t), wt(o.d, s) && (i = !0)), n = B(n / 2), n === 0) {
2493
+ n = o.d.length - 1, i && o.d[n] === 0 && ++o.d[n];
2494
+ break;
2495
+ }
2496
+ t = t.times(t), wt(t.d, s);
2497
+ }
2498
+ return L = !0, o;
2499
+ }
2500
+ function bt(e) {
2501
+ return e.d[e.d.length - 1] & 1;
2502
+ }
2503
+ function Jt(e, t, n) {
2504
+ for (var r, i, o = new e(t[0]), s = 0; ++s < t.length; ) {
2505
+ if (i = new e(t[s]), !i.s) {
2506
+ o = i;
2507
+ break;
2508
+ }
2509
+ r = o.cmp(i), (r === n || r === 0 && o.s === n) && (o = i);
2510
+ }
2511
+ return o;
2512
+ }
2513
+ function ut(e, t) {
2514
+ var n, r, i, o, s, a, l, u = 0, c = 0, d = 0, f = e.constructor, h = f.rounding, b = f.precision;
2515
+ if (!e.d || !e.d[0] || e.e > 17)
2516
+ return new f(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
2517
+ for (t == null ? (L = !1, l = b) : l = t, a = new f(0.03125); e.e > -2; )
2518
+ e = e.times(a), d += 5;
2519
+ for (r = Math.log(k(2, d)) / Math.LN10 * 2 + 5 | 0, l += r, n = o = s = new f(1), f.precision = l; ; ) {
2520
+ if (o = w(o.times(e), l, 1), n = n.times(++c), a = s.plus(N(o, n, l, 1)), F(a.d).slice(0, l) === F(s.d).slice(0, l)) {
2521
+ for (i = d; i--; ) s = w(s.times(s), l, 1);
2522
+ if (t == null)
2523
+ if (u < 3 && xe(s.d, l - r, h, u))
2524
+ f.precision = l += 10, n = o = a = new f(1), c = 0, u++;
2525
+ else
2526
+ return w(s, f.precision = b, h, L = !0);
2527
+ else
2528
+ return f.precision = b, s;
2529
+ }
2530
+ s = a;
2531
+ }
2532
+ }
2533
+ function te(e, t) {
2534
+ var n, r, i, o, s, a, l, u, c, d, f, h = 1, b = 10, p = e, _ = p.d, T = p.constructor, D = T.rounding, y = T.precision;
2535
+ if (p.s < 0 || !_ || !_[0] || !p.e && _[0] == 1 && _.length == 1)
2536
+ return new T(_ && !_[0] ? -1 / 0 : p.s != 1 ? NaN : _ ? 0 : p);
2537
+ if (t == null ? (L = !1, c = y) : c = t, T.precision = c += b, n = F(_), r = n.charAt(0), Math.abs(o = p.e) < 15e14) {
2538
+ for (; r < 7 && r != 1 || r == 1 && n.charAt(1) > 3; )
2539
+ p = p.times(e), n = F(p.d), r = n.charAt(0), h++;
2540
+ o = p.e, r > 1 ? (p = new T("0." + n), o++) : p = new T(r + "." + n.slice(1));
2541
+ } else
2542
+ return u = qe(T, c + 2, y).times(o + ""), p = te(new T(r + "." + n.slice(1)), c - b).plus(u), T.precision = y, t == null ? w(p, y, D, L = !0) : p;
2543
+ for (d = p, l = s = p = N(p.minus(1), p.plus(1), c, 1), f = w(p.times(p), c, 1), i = 3; ; ) {
2544
+ if (s = w(s.times(f), c, 1), u = l.plus(N(s, new T(i), c, 1)), F(u.d).slice(0, c) === F(l.d).slice(0, c))
2545
+ if (l = l.times(2), o !== 0 && (l = l.plus(qe(T, c + 2, y).times(o + ""))), l = N(l, new T(h), c, 1), t == null)
2546
+ if (xe(l.d, c - b, D, a))
2547
+ T.precision = c += b, u = s = p = N(d.minus(1), d.plus(1), c, 1), f = w(p.times(p), c, 1), i = a = 1;
2548
+ else
2549
+ return w(l, T.precision = y, D, L = !0);
2550
+ else
2551
+ return T.precision = y, l;
2552
+ l = u, i += 2;
2553
+ }
2554
+ }
2555
+ function Qt(e) {
2556
+ return String(e.s * e.s / 0);
2557
+ }
2558
+ function Be(e, t) {
2559
+ var n, r, i;
2560
+ for ((n = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (r = t.search(/e/i)) > 0 ? (n < 0 && (n = r), n += +t.slice(r + 1), t = t.substring(0, r)) : n < 0 && (n = t.length), r = 0; t.charCodeAt(r) === 48; r++) ;
2561
+ for (i = t.length; t.charCodeAt(i - 1) === 48; --i) ;
2562
+ if (t = t.slice(r, i), t) {
2563
+ if (i -= r, e.e = n = n - r - 1, e.d = [], r = (n + 1) % S, n < 0 && (r += S), r < i) {
2564
+ for (r && e.d.push(+t.slice(0, r)), i -= S; r < i; ) e.d.push(+t.slice(r, r += S));
2565
+ t = t.slice(r), r = S - t.length;
2566
+ } else
2567
+ r -= i;
2568
+ for (; r--; ) t += "0";
2569
+ e.d.push(+t), L && (e.e > e.constructor.maxE ? (e.d = null, e.e = NaN) : e.e < e.constructor.minE && (e.e = 0, e.d = [0]));
2570
+ } else
2571
+ e.e = 0, e.d = [0];
2572
+ return e;
2573
+ }
2574
+ function xr(e, t) {
2575
+ var n, r, i, o, s, a, l, u, c;
2576
+ if (t.indexOf("_") > -1) {
2577
+ if (t = t.replace(/(\d)_(?=\d)/g, "$1"), zt.test(t)) return Be(e, t);
2578
+ } else if (t === "Infinity" || t === "NaN")
2579
+ return +t || (e.s = NaN), e.e = NaN, e.d = null, e;
2580
+ if (Cr.test(t))
2581
+ n = 16, t = t.toLowerCase();
2582
+ else if (Sr.test(t))
2583
+ n = 2;
2584
+ else if (Lr.test(t))
2585
+ n = 8;
2586
+ else
2587
+ throw Error(re + t);
2588
+ for (o = t.search(/p/i), o > 0 ? (l = +t.slice(o + 1), t = t.substring(2, o)) : t = t.slice(2), o = t.indexOf("."), s = o >= 0, r = e.constructor, s && (t = t.replace(".", ""), a = t.length, o = a - o, i = Yt(r, new r(n), o, o * 2)), u = Fe(t, n, K), c = u.length - 1, o = c; u[o] === 0; --o) u.pop();
2589
+ return o < 0 ? new r(e.s * 0) : (e.e = Ke(u, c), e.d = u, L = !1, s && (e = N(e, i, a * 4)), l && (e = e.times(Math.abs(l) < 54 ? k(2, l) : Ie.pow(2, l))), L = !0, e);
2590
+ }
2591
+ function Or(e, t) {
2592
+ var n, r = t.d.length;
2593
+ if (r < 3)
2594
+ return t.isZero() ? t : Ee(e, 2, t, t);
2595
+ n = 1.4 * Math.sqrt(r), n = n > 16 ? 16 : n | 0, t = t.times(1 / ze(5, n)), t = Ee(e, 2, t, t);
2596
+ for (var i, o = new e(5), s = new e(16), a = new e(20); n--; )
2597
+ i = t.times(t), t = t.times(o.plus(i.times(s.times(i).minus(a))));
2598
+ return t;
2599
+ }
2600
+ function Ee(e, t, n, r, i) {
2601
+ var o, s, a, l, u = e.precision, c = Math.ceil(u / S);
2602
+ for (L = !1, l = n.times(n), a = new e(r); ; ) {
2603
+ if (s = N(a.times(l), new e(t++ * t++), u, 1), a = i ? r.plus(s) : r.minus(s), r = N(s.times(l), new e(t++ * t++), u, 1), s = a.plus(r), s.d[c] !== void 0) {
2604
+ for (o = c; s.d[o] === a.d[o] && o--; ) ;
2605
+ if (o == -1) break;
2606
+ }
2607
+ o = a, a = r, r = s, s = o;
2608
+ }
2609
+ return L = !0, s.d.length = c + 1, s;
2610
+ }
2611
+ function ze(e, t) {
2612
+ for (var n = e; --t; ) n *= e;
2613
+ return n;
2614
+ }
2615
+ function en(e, t) {
2616
+ var n, r = t.s < 0, i = z(e, e.precision, 1), o = i.times(0.5);
2617
+ if (t = t.abs(), t.lte(o))
2618
+ return J = r ? 4 : 1, t;
2619
+ if (n = t.divToInt(i), n.isZero())
2620
+ J = r ? 3 : 2;
2621
+ else {
2622
+ if (t = t.minus(n.times(i)), t.lte(o))
2623
+ return J = bt(n) ? r ? 2 : 3 : r ? 4 : 1, t;
2624
+ J = bt(n) ? r ? 1 : 4 : r ? 3 : 2;
2625
+ }
2626
+ return t.minus(i).abs();
2627
+ }
2628
+ function dt(e, t, n, r) {
2629
+ var i, o, s, a, l, u, c, d, f, h = e.constructor, b = n !== void 0;
2630
+ if (b ? (U(n, 1, se), r === void 0 ? r = h.rounding : U(r, 0, 8)) : (n = h.precision, r = h.rounding), !e.isFinite())
2631
+ c = Qt(e);
2632
+ else {
2633
+ for (c = G(e), s = c.indexOf("."), b ? (i = 2, t == 16 ? n = n * 4 - 3 : t == 8 && (n = n * 3 - 2)) : i = t, s >= 0 && (c = c.replace(".", ""), f = new h(1), f.e = c.length - s, f.d = Fe(G(f), 10, i), f.e = f.d.length), d = Fe(c, 10, i), o = l = d.length; d[--l] == 0; ) d.pop();
2634
+ if (!d[0])
2635
+ c = b ? "0p+0" : "0";
2636
+ else {
2637
+ if (s < 0 ? o-- : (e = new h(e), e.d = d, e.e = o, e = N(e, f, n, r, 0, i), d = e.d, o = e.e, u = Wt), s = d[n], a = i / 2, u = u || d[n + 1] !== void 0, u = r < 4 ? (s !== void 0 || u) && (r === 0 || r === (e.s < 0 ? 3 : 2)) : s > a || s === a && (r === 4 || u || r === 6 && d[n - 1] & 1 || r === (e.s < 0 ? 8 : 7)), d.length = n, u)
2638
+ for (; ++d[--n] > i - 1; )
2639
+ d[n] = 0, n || (++o, d.unshift(1));
2640
+ for (l = d.length; !d[l - 1]; --l) ;
2641
+ for (s = 0, c = ""; s < l; s++) c += ot.charAt(d[s]);
2642
+ if (b) {
2643
+ if (l > 1)
2644
+ if (t == 16 || t == 8) {
2645
+ for (s = t == 16 ? 4 : 3, --l; l % s; l++) c += "0";
2646
+ for (d = Fe(c, i, t), l = d.length; !d[l - 1]; --l) ;
2647
+ for (s = 1, c = "1."; s < l; s++) c += ot.charAt(d[s]);
2648
+ } else
2649
+ c = c.charAt(0) + "." + c.slice(1);
2650
+ c = c + (o < 0 ? "p" : "p+") + o;
2651
+ } else if (o < 0) {
2652
+ for (; ++o; ) c = "0" + c;
2653
+ c = "0." + c;
2654
+ } else if (++o > l) for (o -= l; o--; ) c += "0";
2655
+ else o < l && (c = c.slice(0, o) + "." + c.slice(o));
2656
+ }
2657
+ c = (t == 16 ? "0x" : t == 2 ? "0b" : t == 8 ? "0o" : "") + c;
2658
+ }
2659
+ return e.s < 0 ? "-" + c : c;
2660
+ }
2661
+ function wt(e, t) {
2662
+ if (e.length > t)
2663
+ return e.length = t, !0;
2664
+ }
2665
+ function Ir(e) {
2666
+ return new this(e).abs();
2667
+ }
2668
+ function Nr(e) {
2669
+ return new this(e).acos();
2670
+ }
2671
+ function Ar(e) {
2672
+ return new this(e).acosh();
2673
+ }
2674
+ function Mr(e, t) {
2675
+ return new this(e).plus(t);
2676
+ }
2677
+ function kr(e) {
2678
+ return new this(e).asin();
2679
+ }
2680
+ function Rr(e) {
2681
+ return new this(e).asinh();
2682
+ }
2683
+ function Dr(e) {
2684
+ return new this(e).atan();
2685
+ }
2686
+ function Vr(e) {
2687
+ return new this(e).atanh();
2688
+ }
2689
+ function Fr(e, t) {
2690
+ e = new this(e), t = new this(t);
2691
+ var n, r = this.precision, i = this.rounding, o = r + 4;
2692
+ return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n = z(this, o, 1).times(t.s > 0 ? 0.25 : 0.75), n.s = e.s) : !t.d || e.isZero() ? (n = t.s < 0 ? z(this, r, i) : new this(0), n.s = e.s) : !e.d || t.isZero() ? (n = z(this, o, 1).times(0.5), n.s = e.s) : t.s < 0 ? (this.precision = o, this.rounding = 1, n = this.atan(N(e, t, o, 1)), t = z(this, o, 1), this.precision = r, this.rounding = i, n = e.s < 0 ? n.minus(t) : n.plus(t)) : n = this.atan(N(e, t, o, 1)), n;
2693
+ }
2694
+ function Br(e) {
2695
+ return new this(e).cbrt();
2696
+ }
2697
+ function Hr(e) {
2698
+ return w(e = new this(e), e.e + 1, 2);
2699
+ }
2700
+ function $r(e, t, n) {
2701
+ return new this(e).clamp(t, n);
2702
+ }
2703
+ function Ur(e) {
2704
+ if (!e || typeof e != "object") throw Error(je + "Object expected");
2705
+ var t, n, r, i = e.defaults === !0, o = [
2706
+ "precision",
2707
+ 1,
2708
+ se,
2709
+ "rounding",
2710
+ 0,
2711
+ 8,
2712
+ "toExpNeg",
2713
+ -9e15,
2714
+ 0,
2715
+ "toExpPos",
2716
+ 0,
2717
+ it,
2718
+ "maxE",
2719
+ 0,
2720
+ it,
2721
+ "minE",
2722
+ -9e15,
2723
+ 0,
2724
+ "modulo",
2725
+ 0,
2726
+ 9
2727
+ ];
2728
+ for (t = 0; t < o.length; t += 3)
2729
+ if (n = o[t], i && (this[n] = st[n]), (r = e[n]) !== void 0)
2730
+ if (B(r) === r && r >= o[t + 1] && r <= o[t + 2]) this[n] = r;
2731
+ else throw Error(re + n + ": " + r);
2732
+ if (n = "crypto", i && (this[n] = st[n]), (r = e[n]) !== void 0)
2733
+ if (r === !0 || r === !1 || r === 0 || r === 1)
2734
+ if (r)
2735
+ if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
2736
+ this[n] = !0;
2737
+ else
2738
+ throw Error(jt);
2739
+ else
2740
+ this[n] = !1;
2741
+ else
2742
+ throw Error(re + n + ": " + r);
2743
+ return this;
2744
+ }
2745
+ function Zr(e) {
2746
+ return new this(e).cos();
2747
+ }
2748
+ function qr(e) {
2749
+ return new this(e).cosh();
2750
+ }
2751
+ function tn(e) {
2752
+ var t, n, r;
2753
+ function i(o) {
2754
+ var s, a, l, u = this;
2755
+ if (!(u instanceof i)) return new i(o);
2756
+ if (u.constructor = i, Et(o)) {
2757
+ u.s = o.s, L ? !o.d || o.e > i.maxE ? (u.e = NaN, u.d = null) : o.e < i.minE ? (u.e = 0, u.d = [0]) : (u.e = o.e, u.d = o.d.slice()) : (u.e = o.e, u.d = o.d ? o.d.slice() : o.d);
2758
+ return;
2759
+ }
2760
+ if (l = typeof o, l === "number") {
2761
+ if (o === 0) {
2762
+ u.s = 1 / o < 0 ? -1 : 1, u.e = 0, u.d = [0];
2763
+ return;
2764
+ }
2765
+ if (o < 0 ? (o = -o, u.s = -1) : u.s = 1, o === ~~o && o < 1e7) {
2766
+ for (s = 0, a = o; a >= 10; a /= 10) s++;
2767
+ L ? s > i.maxE ? (u.e = NaN, u.d = null) : s < i.minE ? (u.e = 0, u.d = [0]) : (u.e = s, u.d = [o]) : (u.e = s, u.d = [o]);
2768
+ return;
2769
+ }
2770
+ if (o * 0 !== 0) {
2771
+ o || (u.s = NaN), u.e = NaN, u.d = null;
2772
+ return;
2773
+ }
2774
+ return Be(u, o.toString());
2775
+ }
2776
+ if (l === "string")
2777
+ return (a = o.charCodeAt(0)) === 45 ? (o = o.slice(1), u.s = -1) : (a === 43 && (o = o.slice(1)), u.s = 1), zt.test(o) ? Be(u, o) : xr(u, o);
2778
+ if (l === "bigint")
2779
+ return o < 0 ? (o = -o, u.s = -1) : u.s = 1, Be(u, o.toString());
2780
+ throw Error(re + o);
2781
+ }
2782
+ 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 = Ur, i.clone = tn, i.isDecimal = Et, i.abs = Ir, i.acos = Nr, i.acosh = Ar, i.add = Mr, i.asin = kr, i.asinh = Rr, i.atan = Dr, i.atanh = Vr, i.atan2 = Fr, i.cbrt = Br, i.ceil = Hr, i.clamp = $r, i.cos = Zr, i.cosh = qr, i.div = Pr, i.exp = Wr, i.floor = Xr, i.hypot = jr, i.ln = Kr, i.log = zr, i.log10 = Yr, i.log2 = Gr, i.max = Jr, i.min = Qr, i.mod = ei, i.mul = ti, i.pow = ni, i.random = ri, i.round = ii, i.sign = oi, i.sin = si, i.sinh = ai, i.sqrt = ui, i.sub = li, i.sum = ci, i.tan = fi, i.tanh = di, i.trunc = hi, e === void 0 && (e = {}), e && e.defaults !== !0)
2783
+ for (r = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], t = 0; t < r.length; ) e.hasOwnProperty(n = r[t++]) || (e[n] = this[n]);
2784
+ return i.config(e), i;
2785
+ }
2786
+ function Pr(e, t) {
2787
+ return new this(e).div(t);
2788
+ }
2789
+ function Wr(e) {
2790
+ return new this(e).exp();
2791
+ }
2792
+ function Xr(e) {
2793
+ return w(e = new this(e), e.e + 1, 3);
2794
+ }
2795
+ function jr() {
2796
+ var e, t, n = new this(0);
2797
+ for (L = !1, e = 0; e < arguments.length; )
2798
+ if (t = new this(arguments[e++]), t.d)
2799
+ n.d && (n = n.plus(t.times(t)));
2800
+ else {
2801
+ if (t.s)
2802
+ return L = !0, new this(1 / 0);
2803
+ n = t;
2804
+ }
2805
+ return L = !0, n.sqrt();
2806
+ }
2807
+ function Et(e) {
2808
+ return e instanceof Ie || e && e.toStringTag === Kt || !1;
2809
+ }
2810
+ function Kr(e) {
2811
+ return new this(e).ln();
2812
+ }
2813
+ function zr(e, t) {
2814
+ return new this(e).log(t);
2815
+ }
2816
+ function Gr(e) {
2817
+ return new this(e).log(2);
2818
+ }
2819
+ function Yr(e) {
2820
+ return new this(e).log(10);
2821
+ }
2822
+ function Jr() {
2823
+ return Jt(this, arguments, -1);
2824
+ }
2825
+ function Qr() {
2826
+ return Jt(this, arguments, 1);
2827
+ }
2828
+ function ei(e, t) {
2829
+ return new this(e).mod(t);
2830
+ }
2831
+ function ti(e, t) {
2832
+ return new this(e).mul(t);
2833
+ }
2834
+ function ni(e, t) {
2835
+ return new this(e).pow(t);
2836
+ }
2837
+ function ri(e) {
2838
+ var t, n, r, i, o = 0, s = new this(1), a = [];
2839
+ if (e === void 0 ? e = this.precision : U(e, 1, se), r = Math.ceil(e / S), this.crypto)
2840
+ if (crypto.getRandomValues)
2841
+ for (t = crypto.getRandomValues(new Uint32Array(r)); o < r; )
2842
+ i = t[o], i >= 429e7 ? t[o] = crypto.getRandomValues(new Uint32Array(1))[0] : a[o++] = i % 1e7;
2843
+ else if (crypto.randomBytes) {
2844
+ for (t = crypto.randomBytes(r *= 4); o < r; )
2845
+ i = t[o] + (t[o + 1] << 8) + (t[o + 2] << 16) + ((t[o + 3] & 127) << 24), i >= 214e7 ? crypto.randomBytes(4).copy(t, o) : (a.push(i % 1e7), o += 4);
2846
+ o = r / 4;
2847
+ } else
2848
+ throw Error(jt);
2849
+ else for (; o < r; ) a[o++] = Math.random() * 1e7 | 0;
2850
+ for (r = a[--o], e %= S, r && e && (i = k(10, S - e), a[o] = (r / i | 0) * i); a[o] === 0; o--) a.pop();
2851
+ if (o < 0)
2852
+ n = 0, a = [0];
2853
+ else {
2854
+ for (n = -1; a[0] === 0; n -= S) a.shift();
2855
+ for (r = 1, i = a[0]; i >= 10; i /= 10) r++;
2856
+ r < S && (n -= S - r);
2857
+ }
2858
+ return s.e = n, s.d = a, s;
2859
+ }
2860
+ function ii(e) {
2861
+ return w(e = new this(e), e.e + 1, this.rounding);
2862
+ }
2863
+ function oi(e) {
2864
+ return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN;
2865
+ }
2866
+ function si(e) {
2867
+ return new this(e).sin();
2868
+ }
2869
+ function ai(e) {
2870
+ return new this(e).sinh();
2871
+ }
2872
+ function ui(e) {
2873
+ return new this(e).sqrt();
2874
+ }
2875
+ function li(e, t) {
2876
+ return new this(e).sub(t);
2877
+ }
2878
+ function ci() {
2879
+ var e = 0, t = arguments, n = new this(t[e]);
2880
+ for (L = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
2881
+ return L = !0, w(n, this.precision, this.rounding);
2882
+ }
2883
+ function fi(e) {
2884
+ return new this(e).tan();
2885
+ }
2886
+ function di(e) {
2887
+ return new this(e).tanh();
2888
+ }
2889
+ function hi(e) {
2890
+ return w(e = new this(e), e.e + 1, 1);
2891
+ }
2892
+ m[Symbol.for("nodejs.util.inspect.custom")] = m.toString;
2893
+ m[Symbol.toStringTag] = "Decimal";
2894
+ var Ie = m.constructor = tn(st);
2895
+ Ue = new Ie(Ue);
2896
+ Ze = new Ie(Ze);
2897
+ class ce {
2898
+ static formatToTimecode(t, n, r = !1) {
2899
+ let i = new Ie(n), o, s = i.round();
2900
+ o = i.mul(t).floor();
2901
+ let a, l, u, c, d = s.mul(86400), f = o.mod(d), h = s.mul(3600), b = s.mul(60);
2902
+ return c = f.divToInt(h), f = f.minus(c.mul(h)), u = f.divToInt(b), f = f.minus(u.mul(b)), l = f.divToInt(s), a = f.minus(l.mul(s)), ce.formatTimecodeText(c.toNumber(), u.toNumber(), l.toNumber(), a.toNumber(), r);
2903
+ }
2904
+ static formatTimecodeText(t, n, r, i, o = !1) {
2905
+ let s = o ? "." : ":";
2906
+ return `${ce.padZero(t)}:${ce.padZero(n)}:${ce.padZero(r)}${s}${ce.padZero(i)}`;
2907
+ }
2908
+ /**
2909
+ * Fast padding
2910
+ * @param num
2911
+ * @private
2912
+ */
2913
+ static padZero(t) {
2914
+ return t < 10 ? `0${t}` : `${t}`;
2915
+ }
2916
+ }
2917
+ class mi {
2918
+ static resolveFrameRateValueFromFraction(t) {
2919
+ return 30;
2920
+ }
2921
+ }
2922
+ const X = class X {
2923
+ static parseTimeMoment(t) {
2924
+ const [n, r] = t.split(":").map(Number);
2925
+ return [n, r];
2926
+ }
2927
+ static parseTimeRange(t) {
2928
+ const n = t.match(this.timeRangePattern);
2929
+ if (!n)
2930
+ throw new Error("Not valid timerange: " + t);
2931
+ const r = n[1] === "[", i = n[5] === "]", o = n[2] ? this.parseTimeMoment(n[2]) : void 0, s = n[4] ? this.parseTimeMoment(n[4]) : void 0;
2932
+ return {
2933
+ start: o,
2934
+ end: s,
2935
+ isStartInclusive: r,
2936
+ isEndInclusive: i
2937
+ };
2938
+ }
2939
+ static timeMomentToSeconds(t) {
2940
+ return X.timeMomentToMilliseconds(t) / 1e3;
2941
+ }
2942
+ static timeMomentToMilliseconds(t) {
2943
+ return t[0] * 1e3 + t[1] / 1e6;
2944
+ }
2945
+ static timeMomentToDate(t) {
2946
+ const r = t[0] * 1e3 + t[1] / 1e6;
2947
+ return new Date(r);
2948
+ }
2949
+ static formatTimeMomentToTimecodeText(t, n, r = !1) {
2950
+ let i = mi.resolveFrameRateValueFromFraction(n);
2951
+ return ce.formatToTimecode(
2952
+ X.timeMomentToSeconds(t),
2953
+ i,
2954
+ r
2955
+ );
2956
+ }
2957
+ static formatTimerangeToTimecodeText(t, n, r = !1) {
2958
+ let i = X.parseTimeRange(t), o = i.start ? X.formatTimeMomentToTimecodeText(
2959
+ i.start,
2960
+ n,
2961
+ r
2962
+ ) : "?", s = i.end ? X.formatTimeMomentToTimecodeText(
2963
+ i.end,
2964
+ n,
2965
+ r
2966
+ ) : "?";
2967
+ return `${o} - ${s}`;
2968
+ }
2969
+ static nanosecondsToSeconds(t) {
2970
+ return t / 1e9;
2971
+ }
2972
+ static nanosecondsToTimeMoment(t) {
2973
+ const n = Math.floor(t / 1e9), r = Math.ceil(t % 1e9);
2974
+ return [n, r];
2975
+ }
2976
+ static secondsToTimeMoment(t) {
2977
+ return this.nanosecondsToTimeMoment(t * 1e9);
2978
+ }
2979
+ static timerangeExprDuration(t) {
2980
+ return this.timeRangeDuration(this.parseTimeRange(t));
2981
+ }
2982
+ static timeRangeDuration(t) {
2983
+ const { start: n, end: r } = t;
2984
+ if (n === void 0 || r === void 0)
2985
+ return 0;
2986
+ {
2987
+ const i = r[0] - n[0], o = r[1] - n[1], s = i + o / 1e9;
2988
+ return parseFloat(s.toFixed(3));
2989
+ }
2990
+ }
2991
+ static formatTimeMomentExpr(t) {
2992
+ return `${t[0]}:${t[1]}`;
2993
+ }
2994
+ static formatNanosecondsToTimeMomentExpr(t) {
2995
+ return this.formatTimeMomentExpr(this.nanosecondsToTimeMoment(t));
2996
+ }
2997
+ static toTimeRange(t, n, r = !0, i = !0) {
2998
+ return {
2999
+ start: t,
3000
+ end: n,
3001
+ isStartInclusive: r,
3002
+ isEndInclusive: i
3003
+ };
3004
+ }
3005
+ static formatTimeRangeExpr(t) {
3006
+ const n = t.isStartInclusive ? "[" : "(", r = t.isEndInclusive ? "]" : ")", i = t.start ? `${t.start[0]}:${t.start[1]}` : "", o = t.end ? `${t.end[0]}:${t.end[1]}` : "";
3007
+ return `${n}${i}_${o}${r}`;
3008
+ }
3009
+ static timerangeDuration(t) {
3010
+ let n = X.parseTimeRange(t);
3011
+ if (n.start === void 0 || n.end === void 0)
3012
+ return 1 / 0;
3013
+ {
3014
+ let r = X.timeMomentToSeconds(n.start);
3015
+ return X.timeMomentToSeconds(n.end) - r;
3016
+ }
3017
+ }
3018
+ static padZero(t) {
3019
+ return t < 10 ? `0${t}` : `${t}`;
3020
+ }
3021
+ };
3022
+ v(X, "timeRangePattern", /^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/);
3023
+ let Y = X;
3024
+ class pi {
3025
+ // New property for EXT-X-START offset
3026
+ constructor(t = 3, n = !1) {
3027
+ /**
3028
+ * The version of the HLS protocol (e.g., 3).
3029
+ */
3030
+ v(this, "version");
3031
+ /**
3032
+ * Whether the playlist has independent segments.
3033
+ */
3034
+ v(this, "independentSegments");
3035
+ /**
3036
+ * The maximum duration of any segment in the playlist (in seconds).
3037
+ */
3038
+ v(this, "targetDuration", null);
3039
+ /**
3040
+ * The sequence number of the first segment in the playlist.
3041
+ */
3042
+ v(this, "mediaSequence", null);
3043
+ /**
3044
+ * Program date-time in ISO 8601 format.
3045
+ */
3046
+ v(this, "programDateTime", null);
3047
+ /**
3048
+ * Playlist type, which can be 'VOD' (Video on Demand) or 'EVENT'.
3049
+ */
3050
+ v(this, "playlistType", null);
3051
+ /**
3052
+ * List of stream information (video/audio variants).
3053
+ */
3054
+ v(this, "streams", []);
3055
+ /**
3056
+ * List of media options (AUDIO, VIDEO, SUBTITLES, CLOSED-CAPTIONS).
3057
+ */
3058
+ v(this, "media", []);
3059
+ /**
3060
+ * List of individual segments in the playlist.
3061
+ */
3062
+ v(this, "segments", []);
3063
+ /**
3064
+ * Whether to mark the end of the playlist (EXT-X-ENDLIST).
3065
+ */
3066
+ v(this, "endList", !1);
3067
+ v(this, "startOffset");
3068
+ this.version = t, this.independentSegments = n;
3069
+ }
3070
+ }
3071
+ class Qe {
3072
+ constructor(t, n, r, i, o) {
3073
+ /**
3074
+ * Maximum bandwidth for the stream in bits per second.
3075
+ */
3076
+ v(this, "bandwidth");
3077
+ /**
3078
+ * Average bandwidth for the stream in bits per second.
3079
+ */
3080
+ v(this, "averageBandwidth");
3081
+ /**
3082
+ * Resolution of the stream as width and height. Null if not specified.
3083
+ */
3084
+ v(this, "resolution");
3085
+ /**
3086
+ * Frame rate of the stream. Null if not specified.
3087
+ */
3088
+ v(this, "frameRate");
3089
+ /**
3090
+ * URI pointing to the specific stream playlist.
3091
+ */
3092
+ v(this, "uri");
3093
+ this.bandwidth = t, this.averageBandwidth = n, this.resolution = r, this.frameRate = i, this.uri = o;
3094
+ }
3095
+ }
3096
+ class gi {
3097
+ constructor(t, n, r, i, o, s, a) {
3098
+ /**
3099
+ * Type of media (e.g., AUDIO, VIDEO, SUBTITLES, CLOSED-CAPTIONS).
3100
+ */
3101
+ v(this, "type");
3102
+ /**
3103
+ * Group identifier to link this media with a stream.
3104
+ */
3105
+ v(this, "groupId");
3106
+ /**
3107
+ * Descriptive name for the media track.
3108
+ */
3109
+ v(this, "name");
3110
+ /**
3111
+ * Indicates if this is the default media track.
3112
+ */
3113
+ v(this, "isDefault");
3114
+ /**
3115
+ * Indicates if the media track should auto-select if not explicitly selected.
3116
+ */
3117
+ v(this, "autoSelect");
3118
+ /**
3119
+ * Number of audio channels (e.g., "2" for stereo). Null if not applicable.
3120
+ */
3121
+ v(this, "channels");
3122
+ /**
3123
+ * URI pointing to the specific media playlist.
3124
+ */
3125
+ v(this, "uri");
3126
+ this.type = t, this.groupId = n, this.name = r, this.isDefault = i, this.autoSelect = o, this.channels = s, this.uri = a;
3127
+ }
3128
+ }
3129
+ class vi {
3130
+ constructor(t, n) {
3131
+ /**
3132
+ * Duration of the segment in seconds.
3133
+ */
3134
+ v(this, "duration");
3135
+ /**
3136
+ * URI pointing to the segment file.
3137
+ */
3138
+ v(this, "uri");
3139
+ this.duration = t, this.uri = n;
3140
+ }
3141
+ }
3142
+ class bi {
3143
+ constructor() {
3144
+ v(this, "playlist");
3145
+ this.playlist = new pi();
3146
+ }
3147
+ /**
3148
+ * Sets the HLS version for the playlist.
3149
+ * @param version The version number (e.g., 3).
3150
+ */
3151
+ setVersion(t) {
3152
+ return this.playlist.version = t, this;
3153
+ }
3154
+ /**
3155
+ * Sets the independent segments flag.
3156
+ * @param independentSegments Whether the segments are independent.
3157
+ */
3158
+ setIndependentSegments(t) {
3159
+ return this.playlist.independentSegments = t, this;
3160
+ }
3161
+ /**
3162
+ * Sets the target duration for the playlist.
3163
+ * This is the maximum duration (in seconds) of any segment in the playlist.
3164
+ * @param targetDuration The target duration in seconds.
3165
+ */
3166
+ setTargetDuration(t) {
3167
+ return this.playlist.targetDuration = t, this;
3168
+ }
3169
+ /**
3170
+ * Sets the media sequence number for the playlist.
3171
+ * This is the sequence number of the first segment in the playlist.
3172
+ * @param mediaSequence The starting media sequence number.
3173
+ */
3174
+ setMediaSequence(t) {
3175
+ return this.playlist.mediaSequence = t, this;
3176
+ }
3177
+ /**
3178
+ * Sets the program date-time for the playlist in ISO 8601 format.
3179
+ * @param programDateTime The program date-time as a string.
3180
+ */
3181
+ setProgramDateTime(t) {
3182
+ return this.playlist.programDateTime = t, this;
3183
+ }
3184
+ /**
3185
+ * Sets the playlist type, which can be 'VOD' or 'EVENT'.
3186
+ * @param playlistType The type of the playlist.
3187
+ */
3188
+ setPlaylistType(t) {
3189
+ return this.playlist.playlistType = t, this;
3190
+ }
3191
+ /**
3192
+ * Adds a stream variant (e.g., a specific video resolution and bandwidth).
3193
+ * @param stream The stream information to add.
3194
+ */
3195
+ addStreamInfo(t) {
3196
+ return this.playlist.streams.push(t), this;
3197
+ }
3198
+ /**
3199
+ * Adds a media option (e.g., audio or subtitle track).
3200
+ * @param media The media option to add.
3201
+ */
3202
+ addMedia(t) {
3203
+ return this.playlist.media.push(t), this;
3204
+ }
3205
+ /**
3206
+ * Adds an individual segment to the playlist.
3207
+ * @param segment The segment to add.
3208
+ */
3209
+ addSegment(t) {
3210
+ return this.playlist.segments.push(t), this;
3211
+ }
3212
+ /**
3213
+ * Marks the playlist as ending with EXT-X-ENDLIST.
3214
+ */
3215
+ setEndList() {
3216
+ return this.playlist.endList = !0, this;
3217
+ }
3218
+ /**
3219
+ * Sets the EXT-X-START offset for the playlist.
3220
+ * @param offset The start offset in seconds.
3221
+ */
3222
+ setStartOffset(t) {
3223
+ return this.playlist.startOffset = t, this;
3224
+ }
3225
+ /**
3226
+ * Builds and returns the M3U8Playlist instance.
3227
+ */
3228
+ build() {
3229
+ return this.playlist;
3230
+ }
3231
+ }
3232
+ class St {
3233
+ /**
3234
+ * Converts an M3U8Playlist instance into a formatted M3U8 string.
3235
+ * @param playlist The M3U8Playlist to convert.
3236
+ * @returns The generated M3U8 playlist string.
3237
+ */
3238
+ static write(t) {
3239
+ let n = `#EXTM3U
3240
+ `;
3241
+ return n += `#EXT-X-VERSION:${t.version}
3242
+ `, t.independentSegments && (n += `#EXT-X-INDEPENDENT-SEGMENTS
3243
+ `), t.targetDuration !== null && (n += `#EXT-X-TARGETDURATION:${t.targetDuration}
3244
+ `), t.mediaSequence !== null && (n += `#EXT-X-MEDIA-SEQUENCE:${t.mediaSequence}
3245
+ `), t.programDateTime && (n += `#EXT-X-PROGRAM-DATE-TIME:${t.programDateTime}
3246
+ `), t.playlistType && (n += `#EXT-X-PLAYLIST-TYPE:${t.playlistType}
3247
+ `), t.startOffset !== void 0 && (n += `#EXT-X-START:TIME-OFFSET=${t.startOffset}
3248
+ `), t.streams.forEach((r) => {
3249
+ n += `#EXT-X-STREAM-INF:BANDWIDTH=${r.bandwidth},AVERAGE-BANDWIDTH=${r.averageBandwidth}`, r.resolution && (n += `,RESOLUTION=${r.resolution.width}x${r.resolution.height}`), r.frameRate && (n += `,FRAME-RATE=${r.frameRate}`), r.uri && (n += `
3250
+ ${r.uri}`), n += `
3251
+ `;
3252
+ }), t.media.forEach((r) => {
3253
+ n += `#EXT-X-MEDIA:TYPE=${r.type},GROUP-ID="${r.groupId}",NAME="${r.name}",DEFAULT=${r.isDefault ? "YES" : "NO"},AUTOSELECT=${r.autoSelect ? "YES" : "NO"}`, r.channels && (n += `,CHANNELS="${r.channels}"`), n += `,URI="${r.uri}"
3254
+ `;
3255
+ }), t.segments.forEach((r) => {
3256
+ n += `#EXTINF:${r.duration},
3257
+ ${r.uri}
3258
+ `;
3259
+ }), t.endList && (n += `#EXT-X-ENDLIST
3260
+ `), n;
3261
+ }
3262
+ }
3263
+ function nn(e, t, n, r) {
3264
+ const i = new bi().setVersion(3);
3265
+ if (e.format === "urn:x-nmos:format:multi") {
3266
+ if (i.setIndependentSegments(!0), !n || n.length < 1 || !r || r.size < 1)
3267
+ return "undefined";
3268
+ let a = n.map((u) => ({
3269
+ flow: u,
3270
+ manifestUrl: nn(
3271
+ u,
3272
+ r.get(u.id)
3273
+ )
3274
+ }));
3275
+ a.filter((u) => u.flow.format === "urn:x-nmos:format:video").forEach((u) => {
3276
+ let c = u.flow, d = u.manifestUrl, f = c.essence_parameters, h = null, b = {
3277
+ width: f.frame_width,
3278
+ height: f.frame_height
3279
+ };
3280
+ f.frame_rate && (h = f.frame_rate.denominator ? f.frame_rate.numerator / f.frame_rate.denominator : f.frame_rate.numerator), i.addStreamInfo(
3281
+ new Qe(
3282
+ c.avg_bit_rate ? c.avg_bit_rate : 0,
3283
+ // Bandwidth in bps
3284
+ c.avg_bit_rate ? c.avg_bit_rate : 0,
3285
+ // Average bandwidth in bps
3286
+ b,
3287
+ // Resolution
3288
+ h,
3289
+ // Frame rate
3290
+ d
3291
+ )
3292
+ );
3293
+ }), a.filter((u) => u.flow.format === "urn:x-nmos:format:audio").forEach((u, c) => {
3294
+ let d = u.flow, f = u.manifestUrl, h = d.essence_parameters;
3295
+ i.addMedia(
3296
+ new gi(
3297
+ "AUDIO",
3298
+ // Media type
3299
+ "audio",
3300
+ // Group ID for this media
3301
+ le.isNullUndefinedOrWhitespace(d.description) ? "" : d.description,
3302
+ // Name of the audio track
3303
+ c === 0,
3304
+ // Is default
3305
+ !0,
3306
+ // Auto-select
3307
+ `${h.channels}`,
3308
+ // Channels
3309
+ f
3310
+ // URI for the audio stream
3311
+ )
3312
+ );
3313
+ });
3314
+ let l = St.write(i.build());
3315
+ ye.createObjectURL(
3316
+ ye.createBlob([l], {
3317
+ type: "application/vnd.apple.mpegurl"
3318
+ })
3319
+ );
3320
+ } else if (e.format === "urn:x-nmos:format:video" || e.format === "urn:x-nmos:format:audio") {
3321
+ if (i.setPlaylistType("VOD").setEndList(), e.format === "urn:x-nmos:format:video") {
3322
+ let a = e.essence_parameters, l = null, u = {
3323
+ width: a.frame_width,
3324
+ height: a.frame_height
3325
+ };
3326
+ a.frame_rate && (l = a.frame_rate.denominator ? a.frame_rate.numerator / a.frame_rate.denominator : a.frame_rate.numerator), i.addStreamInfo(
3327
+ new Qe(
3328
+ e.avg_bit_rate ? e.avg_bit_rate : 0,
3329
+ // Bandwidth in bps
3330
+ e.avg_bit_rate ? e.avg_bit_rate : 0,
3331
+ // Average bandwidth in bps
3332
+ u,
3333
+ // Resolution
3334
+ l,
3335
+ // Frame rate
3336
+ null
3337
+ // URI
3338
+ )
3339
+ );
3340
+ } else e.format === "urn:x-nmos:format:audio" && i.addStreamInfo(
3341
+ new Qe(
3342
+ e.avg_bit_rate ? e.avg_bit_rate : 0,
3343
+ // Bandwidth in bps
3344
+ e.avg_bit_rate ? e.avg_bit_rate : 0,
3345
+ // Average bandwidth in bps
3346
+ null,
3347
+ // Resolution
3348
+ null,
3349
+ // Frame rate
3350
+ null
3351
+ // URI
3352
+ )
3353
+ );
3354
+ t && t.length > 0 && t.forEach((a, l) => {
3355
+ let u = Y.timerangeExprDuration(
3356
+ a.timerange
3357
+ );
3358
+ e.format, i.addSegment(
3359
+ new vi(u, a.get_urls.at(-1).url)
3360
+ ), l === 0 && i.setTargetDuration(u);
3361
+ });
3362
+ }
3363
+ let o = St.write(i.build());
3364
+ return ye.createObjectURL(
3365
+ ye.createBlob([o], {
3366
+ type: "application/x-mpegurl"
3367
+ })
3368
+ );
3369
+ }
3370
+ const Oi = g.memo(
3371
+ function({
3372
+ flow: t,
3373
+ childFlows: n,
3374
+ flowSegments: r,
3375
+ childFlowsSegments: i,
3376
+ fps: o,
3377
+ videoLoadOptions: s,
3378
+ setOmakasePlayer: a,
3379
+ config: l,
3380
+ timerange: u,
3381
+ enableHotkey: c
3382
+ }) {
3383
+ const d = cn(() => nn(
3384
+ t,
3385
+ r,
3386
+ n,
3387
+ i
3388
+ ), [t, r, n, i, u]);
3389
+ return /* @__PURE__ */ g.createElement(
3390
+ ar,
3391
+ {
3392
+ videoUrl: d,
3393
+ fps: o,
3394
+ videoLoadOptions: s,
3395
+ setOmakasePlayer: a,
3396
+ config: l,
3397
+ enableHotkeys: c
3398
+ }
3399
+ );
3400
+ }
3401
+ );
3402
+ function Re(e) {
3403
+ const t = new Date(e * 1e3), n = t.getUTCHours(), r = t.getUTCMinutes();
3404
+ return `${n}h ${r}min`;
3405
+ }
3406
+ const wi = `
3407
+ .omakase-time-range-selector-segments {
3408
+ display: flex;
3409
+ width: 700px;
3410
+ position: relative;
3411
+ font-size: 13px;
3412
+ }
3413
+
3414
+ .omakase-time-range-selector-container {
3415
+ max-width: 700px;
3416
+ position: relative;
3417
+ }
3418
+
3419
+ .omakase-time-range-selector-segment {
3420
+ flex-grow: 1;
3421
+ position: relative;
3422
+ display: flex;
3423
+ flex-direction: column;
3424
+ align-items: center;
3425
+ }
3426
+
3427
+ .omakase-time-range-selector-segment-marker {
3428
+ background-color: #2E313D;
3429
+ border: 1px solid #655372;
3430
+ width: 100%;
3431
+ height: 20px;
3432
+ }
3433
+
3434
+ .omakase-time-range-selector-segment-tick {
3435
+ width: 100%;
3436
+ height: 10px;
3437
+ border-left: 1px solid #655372;
3438
+ position: relative;
3439
+ }
3440
+
3441
+ .omakase-time-range-selector-segment:last-child .omakase-time-range-selector-segment-tick {
3442
+ border-right: 1px solid #655372;
3443
+ }
3444
+
3445
+ .omakase-time-range-selector-segment-label {
3446
+ font-size: 13px;
3447
+ margin-top: 5px;
3448
+ white-space: nowrap;
3449
+ }
3450
+
3451
+ .omakase-time-range-selector-segment:first-child .omakase-time-range-selector-segment-label {
3452
+ position: absolute;
3453
+ top: 25px;
3454
+ left: 0;
3455
+ }
3456
+
3457
+ .omakase-time-range-selector-segment:not(:first-child) .omakase-time-range-selector-segment-label {
3458
+ position: absolute;
3459
+ top: 25px;
3460
+ left: 0;
3461
+ transform: translateX(-50%);
3462
+ }
3463
+
3464
+ .omakase-time-range-selector-segment:last-child {
3465
+ position: relative;
3466
+ direction: rtl;
3467
+ }
3468
+
3469
+ .omakase-time-range-selector-segment:last-child .omakase-time-range-selector-segment-first-label {
3470
+ position: absolute;
3471
+ top: 25px;
3472
+ left: 0;
3473
+ transform: translateX(-50%);
3474
+ }
3475
+
3476
+ .omakase-time-range-selector-segment:last-child .omakase-time-range-selector-segment-second-label {
3477
+ position: absolute;
3478
+ top: 25px;
3479
+ right: -100%;
3480
+ }
3481
+
3482
+ .omakase-time-range-selector-range-selector {
3483
+ height: 20px;
3484
+ background-color: #662D91;
3485
+ position: absolute;
3486
+ cursor: grab;
3487
+ width: 300px;
3488
+ z-index: 2;
3489
+ display: flex;
3490
+ justify-content: space-between;
3491
+ }
3492
+
3493
+ .omakase-time-range-selector-range-selector-handle {
3494
+ height: 32px;
3495
+ min-width: 4px;
3496
+ background-color: #662D91;
3497
+ cursor: pointer;
3498
+ z-index: 2;
3499
+ }
3500
+
3501
+ .omakase-time-range-selector-range-selector-duration {
3502
+ display: flex;
3503
+ align-items: center;
3504
+ font-size: 13px;
3505
+ min-width: 0;
3506
+ overflow: hidden;
3507
+ text-wrap: nowrap;
3508
+ text-overflow: clip;
3509
+ color: #ffffff;
3510
+ z-index: 3;
3511
+ }
3512
+
3513
+ .omakase-time-range-selector-range-selector-duration:hover {
3514
+ font-size: 13px;
3515
+ overflow: visible;
3516
+ color: #ffffff;
3517
+ }
3518
+
3519
+ .omakase-time-range-selector-button-container {
3520
+ z-index: 3;
3521
+ position: absolute;
3522
+ right: 0px;
3523
+ top: 10px;
3524
+ display: flex;
3525
+ }
3526
+
3527
+ .omakase-time-range-selector-button-container svg {
3528
+ cursor: pointer;
3529
+ }
3530
+
3531
+ .omakase-time-range-selector-invisible {
3532
+ display: none;
3533
+ }
3534
+
3535
+ .omakase-time-range-selector-button-container button,
3536
+ .omakase-time-range-selector-button-container input[type="submit"],
3537
+ .omakase-time-range-selector-button-container input[type="reset"] {
3538
+ background: none;
3539
+ color: inherit;
3540
+ border: none;
3541
+ padding: 0;
3542
+ font: inherit;
3543
+ cursor: pointer;
3544
+ outline: inherit;
3545
+ }
3546
+ `, Ei = `
3547
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
3548
+ <g filter="url(#filter0_d_5782_463)">
3549
+ <circle cx="16" cy="12" r="12" fill="#424850"/>
3550
+ <g clip-path="url(#clip0_5782_463)">
3551
+ <path d="M21.8411 8.37562C21.5993 8.1332 21.2772 8 20.9346 8C20.5921 8 20.2703 8.13348 20.0278 8.37562L14.4994 13.904L12.1886 11.5932C11.6886 11.0932 10.8751 11.0932 10.3751 11.5932C9.87506 12.0932 9.87506 12.9068 10.3751 13.4068L13.5927 16.6244C13.8348 16.8665 14.1569 17 14.4994 17C14.842 17 15.1644 16.8665 15.4062 16.6244L21.8411 10.1892C22.0836 9.94705 22.2168 9.62493 22.2168 9.2824C22.2168 8.93988 22.0836 8.61804 21.8414 8.37562H21.8411Z" fill="#00E9A3"/>
3552
+ </g>
3553
+ </g>
3554
+ <defs>
3555
+ <filter id="filter0_d_5782_463" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3556
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3557
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
3558
+ <feOffset dy="4"/>
3559
+ <feGaussianBlur stdDeviation="2"/>
3560
+ <feComposite in2="hardAlpha" operator="out"/>
3561
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
3562
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5782_463"/>
3563
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_5782_463" result="shape"/>
3564
+ </filter>
3565
+ <clipPath id="clip0_5782_463">
3566
+ <rect width="12.2168" height="9" fill="white" transform="translate(10 8)"/>
3567
+ </clipPath>
3568
+ </defs>
3569
+ </svg>
3570
+ `, Si = `
3571
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
3572
+ <g filter="url(#filter0_d_5782_462)">
3573
+ <circle cx="16" cy="12" r="12" fill="#424850"/>
3574
+ <g clip-path="url(#clip0_5782_462)">
3575
+ <path d="M20.6618 8.96972L17.6319 12L20.6618 15.0301C21.1125 15.4809 21.1125 16.2113 20.6618 16.6621C20.4366 16.8873 20.1414 17 19.8463 17C19.5507 17 19.2555 16.8875 19.0305 16.6621L15.9999 13.6317L12.9696 16.6621C12.7444 16.8873 12.4492 17 12.1538 17C11.8586 17 11.5635 16.8875 11.3382 16.6621C10.8875 16.2114 10.8875 15.4811 11.3382 15.03L14.368 11.9999L11.338 8.96972C10.8873 8.51903 10.8873 7.78852 11.338 7.33783C11.7886 6.88749 12.5187 6.88749 12.9694 7.33783L15.9999 10.3681L19.0301 7.33783C19.481 6.88749 20.2111 6.88749 20.6616 7.33783C21.1125 7.78852 21.1125 8.51903 20.6618 8.96972Z" fill="#F03838"/>
3576
+ </g>
3577
+ </g>
3578
+ <defs>
3579
+ <filter id="filter0_d_5782_462" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3580
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3581
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
3582
+ <feOffset dy="4"/>
3583
+ <feGaussianBlur stdDeviation="2"/>
3584
+ <feComposite in2="hardAlpha" operator="out"/>
3585
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
3586
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5782_462"/>
3587
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_5782_462" result="shape"/>
3588
+ </filter>
3589
+ <clipPath id="clip0_5782_462">
3590
+ <rect width="9.99982" height="10" fill="white" transform="translate(11 7)"/>
3591
+ </clipPath>
3592
+ </defs>
3593
+ </svg>
3594
+
3595
+ `, A = {
3596
+ container: "omakase-time-range-selector-container",
3597
+ segments: "omakase-time-range-selector-segments",
3598
+ segment: "omakase-time-range-selector-segment",
3599
+ segmentMarker: "omakase-time-range-selector-segment-marker",
3600
+ segmentTick: "omakase-time-range-selector-segment-tick",
3601
+ segmentLabel: "omakase-time-range-selector-segment-label",
3602
+ firstSegmentLabel: "omakase-time-range-selector-segment-first-label",
3603
+ secondSegmentLabel: "omakase-time-range-selector-segment-second-label",
3604
+ rangeSelector: "omakase-time-range-selector-range-selector",
3605
+ rangeSelectorHandle: "omakase-time-range-selector-range-selector-handle",
3606
+ rangeSelectorDuration: "omakase-time-range-selector-range-selector-duration",
3607
+ buttonContainer: "omakase-time-range-selector-button-container",
3608
+ invisible: "omakase-time-range-selector-invisible"
3609
+ }, De = {
3610
+ leftHandle: "omakase-time-range-selector-range-selector-left-handle",
3611
+ rightHandle: "omakase-time-range-selector-range-selector-right-handle",
3612
+ rangeDuration: "omakase-time-range-selector-range-selector-range-duration",
3613
+ segments: "omakase-time-range-selector-segments"
3614
+ };
3615
+ class Ct extends HTMLElement {
3616
+ constructor() {
3617
+ super();
3618
+ v(this, "_container");
3619
+ v(this, "_rangeSelector");
3620
+ v(this, "_rangeSelectorLeftHandle");
3621
+ v(this, "_rangeSelectorRightHandle");
3622
+ v(this, "_rangeSelectorRangeDisplay");
3623
+ v(this, "_buttonContainer");
3624
+ v(this, "_segments");
3625
+ v(this, "_numberOfSegments", 5);
3626
+ v(this, "_firstLabelIndex", 0);
3627
+ v(this, "_initialFirstLabelIndex", 0);
3628
+ v(this, "_labels", []);
3629
+ v(this, "minWidth", 10);
3630
+ v(this, "minValue");
3631
+ v(this, "maxValue");
3632
+ v(this, "maxRange");
3633
+ v(this, "segmentSize");
3634
+ v(this, "sliderStart");
3635
+ v(this, "sliderEnd");
3636
+ v(this, "onCheckmarkClickCallback");
3637
+ v(this, "currentStart", 0);
3638
+ v(this, "currentEnd", 100);
3639
+ v(this, "resetSegments", () => {
3640
+ this._container.removeChild(this._segments), this._segments = this.buildSegments(
3641
+ this._labels.slice(this.firstLabelIndex, this.lastLabelIndex + 1)
3642
+ ), this._segments.classList.add(A.segments), this._container.append(this._segments);
3643
+ });
3644
+ v(this, "getBounds", () => ({
3645
+ wrapperLeft: this._container.offsetLeft,
3646
+ wrapperRight: this._container.offsetLeft + this._container.offsetWidth,
3647
+ wrapperWidth: this._container.offsetWidth,
3648
+ selectorLeft: this._rangeSelector.offsetLeft,
3649
+ selectorWidth: this._rangeSelector.offsetWidth
3650
+ }));
3651
+ v(this, "getSliderValues", () => {
3652
+ const { wrapperWidth: n, selectorLeft: r, selectorWidth: i } = this.getBounds(), o = this._labels.at(this.firstLabelIndex), s = this._labels.at(this.lastLabelIndex), a = Math.round(
3653
+ o + r / n * (s - o)
3654
+ ), l = Math.round(
3655
+ o + (r + i) / n * (s - o)
3656
+ );
3657
+ return { start: a, end: l };
3658
+ });
3659
+ v(this, "getSelectorBounds", (n, r) => {
3660
+ const { wrapperWidth: i } = this.getBounds(), o = this._labels.at(this.firstLabelIndex), s = this._labels.at(this.lastLabelIndex), a = Math.round(
3661
+ (n - o) / (s - o) * i
3662
+ ), l = Math.round(
3663
+ (r - n) / (s - o) * i
3664
+ );
3665
+ return { selectorLeft: a, selectorWidth: l };
3666
+ });
3667
+ v(this, "initSlider", (n, r) => {
3668
+ const i = this.getSelectorBounds(n, r);
3669
+ this._rangeSelector.style.left = i.selectorLeft.toString() + "px", this._rangeSelector.style.width = i.selectorWidth.toString() + "px", this.updateDuration();
3670
+ });
3671
+ v(this, "showButtons", () => {
3672
+ const { start: n, end: r } = this.getSliderValues();
3673
+ n === this.currentStart && r === this.currentEnd || this._buttonContainer.classList.remove(A.invisible);
3674
+ });
3675
+ v(this, "hideButtons", () => {
3676
+ this._buttonContainer.classList.add(A.invisible);
3677
+ });
3678
+ v(this, "updateDuration", () => {
3679
+ const { start: n, end: r } = this.getSliderValues(), i = r - n;
3680
+ this._rangeSelectorRangeDisplay.textContent = Re(i);
3681
+ });
3682
+ v(this, "onXclick", () => {
3683
+ this.firstLabelIndex = this._initialFirstLabelIndex, this.resetSegments();
3684
+ const n = this.getSelectorBounds(
3685
+ this.currentStart,
3686
+ this.currentEnd
3687
+ );
3688
+ this._rangeSelector.style.left = n.selectorLeft.toString() + "px", this._rangeSelector.style.width = n.selectorWidth.toString() + "px", this.updateDuration(), this.hideButtons();
3689
+ });
3690
+ v(this, "onCheckmarkClick", () => {
3691
+ const { start: n, end: r } = this.getSliderValues();
3692
+ this.currentStart = n, this.currentEnd = r, this._initialFirstLabelIndex = this.firstLabelIndex, this.updateDuration(), this.hideButtons(), this.onCheckmarkClickCallback !== void 0 && this.onCheckmarkClickCallback(n, r);
3693
+ });
3694
+ v(this, "onMouseDownRight", (n) => {
3695
+ n.preventDefault();
3696
+ const r = n.clientX, { selectorWidth: i, wrapperWidth: o, selectorLeft: s } = this.getBounds();
3697
+ let a = null, l = null;
3698
+ const u = (d) => {
3699
+ let f = d.clientX - r, h = Math.max(this.minWidth, i + f);
3700
+ const b = Math.min(
3701
+ o,
3702
+ o - s
3703
+ ), p = h > b, _ = performance.now();
3704
+ p ? a === null && (a = _, l = window.setTimeout(() => {
3705
+ this.outOfBoundsCallback(!0), l = window.setInterval(
3706
+ () => this.outOfBoundsCallback(!0),
3707
+ 400
3708
+ );
3709
+ }, 500)) : (l !== null && (clearTimeout(l), clearInterval(l), l = null), a = null), h = Math.min(h, b), this._rangeSelector.style.width = `${h}px`, this.updateDuration();
3710
+ }, c = () => {
3711
+ this.showButtons(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", c), l !== null && (clearTimeout(l), clearInterval(l), l = null), a = null;
3712
+ };
3713
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", c);
3714
+ });
3715
+ v(this, "onMouseDownLeft", (n) => {
3716
+ n.preventDefault();
3717
+ const r = n.clientX, { selectorLeft: i, selectorWidth: o, wrapperWidth: s } = this.getBounds();
3718
+ let a = null, l = null;
3719
+ const u = (d) => {
3720
+ let f = d.clientX - r, h = i + f;
3721
+ const b = h < 0, p = performance.now();
3722
+ b ? a === null && (a = p, l = window.setTimeout(() => {
3723
+ this.outOfBoundsCallback(!1), l = window.setInterval(
3724
+ () => this.outOfBoundsCallback(!1),
3725
+ 400
3726
+ );
3727
+ }, 500)) : (l !== null && (clearTimeout(l), clearInterval(l), l = null), a = null), h < 0 && (f = -i, h = 0);
3728
+ let _ = Math.min(
3729
+ Math.max(this.minWidth, o - f),
3730
+ s
3731
+ );
3732
+ h + _ > s && (h = s - _), _ > this.minWidth && (this._rangeSelector.style.left = `${h}px`, this._rangeSelector.style.width = `${_}px`), this.updateDuration();
3733
+ }, c = () => {
3734
+ this.showButtons(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", c), l !== null && (clearTimeout(l), clearInterval(l), l = null), a = null;
3735
+ };
3736
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", c);
3737
+ });
3738
+ v(this, "outOfBoundsCallback", (n) => {
3739
+ n ? this.firstLabelIndex += 1 : this.firstLabelIndex -= 1, this.resetSegments();
3740
+ });
3741
+ v(this, "onMouseDownDrag", (n) => {
3742
+ if (n.target instanceof HTMLElement && n.target.classList.contains(A.rangeSelectorHandle))
3743
+ return;
3744
+ n.preventDefault();
3745
+ const r = n.clientX, { selectorLeft: i, selectorWidth: o, wrapperWidth: s } = this.getBounds();
3746
+ let a = null, l = null;
3747
+ const u = (d) => {
3748
+ let f = d.clientX - r, h = i + f;
3749
+ const b = s - o, p = h < 0 || h > b, _ = performance.now();
3750
+ if (p) {
3751
+ if (a === null) {
3752
+ const T = h > b;
3753
+ a = _, l = window.setTimeout(() => {
3754
+ this.outOfBoundsCallback(T), l = window.setInterval(
3755
+ () => this.outOfBoundsCallback(T),
3756
+ 400
3757
+ );
3758
+ }, 500);
3759
+ }
3760
+ } else
3761
+ l !== null && (clearTimeout(l), clearInterval(l), l = null), a = null;
3762
+ h = Math.max(0, Math.min(h, b)), this._rangeSelector.style.left = `${h}px`, this.updateDuration();
3763
+ }, c = () => {
3764
+ this.showButtons(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", c), l !== null && (clearTimeout(l), clearInterval(l));
3765
+ };
3766
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", c);
3767
+ });
3768
+ }
3769
+ set numberOfSegments(n) {
3770
+ n > 2 && (this._numberOfSegments = n);
3771
+ }
3772
+ get numberOfSegments() {
3773
+ return this._numberOfSegments;
3774
+ }
3775
+ static get observedAttributes() {
3776
+ return [
3777
+ "minValue",
3778
+ "maxValue",
3779
+ "maxRange",
3780
+ "segmentSize",
3781
+ "sliderStart",
3782
+ "sliderEnd",
3783
+ "numberOfSegments"
3784
+ ];
3785
+ }
3786
+ get firstLabelIndex() {
3787
+ return this._firstLabelIndex;
3788
+ }
3789
+ set firstLabelIndex(n) {
3790
+ if (n + this._numberOfSegments + 1 >= this._labels.length) {
3791
+ this._firstLabelIndex = this._labels.length - 1 - this.numberOfSegments;
3792
+ return;
3793
+ }
3794
+ if (n < 0) {
3795
+ this._firstLabelIndex = 0;
3796
+ return;
3797
+ }
3798
+ this._firstLabelIndex = n;
3799
+ }
3800
+ get lastLabelIndex() {
3801
+ return this._firstLabelIndex + this._numberOfSegments;
3802
+ }
3803
+ connectedCallback() {
3804
+ if (this.minValue = Number.parseInt(this.getAttribute("minValue") ?? "NaN"), this.maxValue = Number.parseInt(this.getAttribute("maxValue") ?? "NaN"), this.maxRange = Number.parseInt(this.getAttribute("maxRange") ?? "NaN"), this.segmentSize = Number.parseInt(
3805
+ this.getAttribute("segmentSize") ?? "NaN"
3806
+ ), this.getAttribute("numberOfSegments")) {
3807
+ const c = Number.parseInt(
3808
+ this.getAttribute("numberOfSegments")
3809
+ );
3810
+ if (Number.isNaN(c))
3811
+ throw new Error("Invalid atribute value");
3812
+ this._numberOfSegments = c;
3813
+ }
3814
+ if (Number.isNaN(this.minValue) || Number.isNaN(this.maxValue) || Number.isNaN(this.maxRange) || Number.isNaN(this.segmentSize))
3815
+ throw new Error("Invalid attribute values.");
3816
+ const n = this.maxValue - this.minValue;
3817
+ if (n < this.numberOfSegments * this.segmentSize && (this.segmentSize = n / this.numberOfSegments), this._labels = this.calculateLabels(), this.maxValue < this.minValue)
3818
+ throw new Error("Max value is lesser than min value");
3819
+ let r, i;
3820
+ if (this.getAttribute("sliderStart") && this.getAttribute("sliderEnd")) {
3821
+ if (r = Number.parseFloat(this.getAttribute("sliderStart")), i = Number.parseFloat(this.getAttribute("sliderEnd")), r > i)
3822
+ throw new Error("Slider start is bigger than slider end");
3823
+ if (r < this.minValue)
3824
+ throw new Error("Slider start is smaller than minimal value");
3825
+ i > this.maxValue && (i = this.maxValue), this.currentStart = r, this.currentEnd = i;
3826
+ } else
3827
+ r = this.minValue, i = this.segmentSize;
3828
+ this.resolveInitialSegment(r, i), this._container = document.createElement("div"), this._container.classList.add(A.container);
3829
+ const o = document.createElement("style");
3830
+ o.textContent = wi, this._container.append(o), this._buttonContainer = document.createElement("div"), this._buttonContainer.classList.add(
3831
+ A.buttonContainer,
3832
+ A.invisible
3833
+ );
3834
+ const s = this.createButtonSvg(Ei), a = this.createButtonSvg(Si);
3835
+ s.onclick = this.onCheckmarkClick, a.onclick = this.onXclick, this._buttonContainer.append(s, a), this._container.append(this._buttonContainer), this._rangeSelector = document.createElement("div"), this._rangeSelector.classList.add(A.rangeSelector), this._rangeSelectorLeftHandle = document.createElement("div"), this._rangeSelectorLeftHandle.classList.add(A.rangeSelectorHandle), this._rangeSelectorLeftHandle.id = De.leftHandle, this._rangeSelectorRightHandle = document.createElement("div"), this._rangeSelectorRightHandle.classList.add(A.rangeSelectorHandle), this._rangeSelectorRightHandle.id = De.rightHandle, this._rangeSelectorRangeDisplay = document.createElement("div"), this._rangeSelectorRangeDisplay.classList.add(
3836
+ A.rangeSelectorDuration
3837
+ ), this._rangeSelectorRangeDisplay.id = De.rangeDuration, this._rangeSelector.append(
3838
+ this._rangeSelectorLeftHandle,
3839
+ this._rangeSelectorRangeDisplay,
3840
+ this._rangeSelectorRightHandle
3841
+ ), this._container.append(this._rangeSelector), this._segments = this.buildSegments(
3842
+ this._labels.slice(this.firstLabelIndex, this.lastLabelIndex + 1)
3843
+ ), this._segments.id = De.segments, this._segments.classList.add(A.segments), this._container.append(this._segments), this._rangeSelectorLeftHandle.addEventListener(
3844
+ "mousedown",
3845
+ this.onMouseDownLeft
3846
+ ), this._rangeSelectorRightHandle.addEventListener(
3847
+ "mousedown",
3848
+ this.onMouseDownRight
3849
+ ), this._rangeSelector.addEventListener("mousedown", this.onMouseDownDrag), this.append(this._container), this.initSlider(r, i);
3850
+ const { start: l, end: u } = this.getSliderValues();
3851
+ this.currentStart = l, this.currentEnd = u, this.updateDuration();
3852
+ }
3853
+ resolveInitialSegment(n, r) {
3854
+ debugger;
3855
+ const i = this._numberOfSegments * this.segmentSize, o = r - n, s = this.maxValue - this.minValue, a = n - this.minValue, l = Math.ceil(s / this.segmentSize);
3856
+ let u = Math.floor(
3857
+ a / s * l
3858
+ );
3859
+ u += Math.floor(
3860
+ (i - o) / this.segmentSize
3861
+ );
3862
+ const d = u + Math.ceil(o / this.segmentSize) - this._numberOfSegments - 1;
3863
+ this.firstLabelIndex = d, this._initialFirstLabelIndex = d;
3864
+ }
3865
+ createButtonSvg(n) {
3866
+ const r = document.createElement("button");
3867
+ return r.innerHTML = n, r;
3868
+ }
3869
+ calculateLabels() {
3870
+ const n = this.minValue, r = this.maxValue, i = Math.floor((this.maxValue - this.minValue) / this.segmentSize) - 1, o = [n];
3871
+ let s = this.minValue;
3872
+ for (let a = 0; a < i; a++)
3873
+ s += this.segmentSize, o.push(s);
3874
+ return o.push(r), o;
3875
+ }
3876
+ buildSegments(n) {
3877
+ const r = document.createElement("div");
3878
+ n.slice(0, -2).forEach((u) => {
3879
+ const c = document.createElement("div");
3880
+ c.classList.add(A.segment);
3881
+ const d = document.createElement("div");
3882
+ d.classList.add(A.segmentMarker);
3883
+ const f = document.createElement("div");
3884
+ f.classList.add(A.segmentTick);
3885
+ const h = document.createElement("div");
3886
+ h.classList.add(A.segmentLabel), h.innerHTML = Re(u), c.append(d, f, h), r.append(c);
3887
+ });
3888
+ const i = document.createElement("div");
3889
+ i.classList.add(A.segment);
3890
+ const o = document.createElement("div");
3891
+ o.classList.add(A.segmentMarker);
3892
+ const s = document.createElement("div");
3893
+ s.classList.add(A.segmentTick);
3894
+ const a = document.createElement("div");
3895
+ a.classList.add(
3896
+ A.segmentLabel,
3897
+ A.firstSegmentLabel
3898
+ ), a.innerHTML = Re(n.at(-2));
3899
+ const l = document.createElement("div");
3900
+ return l.classList.add(
3901
+ A.segmentLabel,
3902
+ A.secondSegmentLabel
3903
+ ), l.innerHTML = Re(n.at(-1)), i.append(
3904
+ o,
3905
+ s,
3906
+ a,
3907
+ l
3908
+ ), r.append(i), r;
3909
+ }
3910
+ }
3911
+ const Lt = "omakase-time-range-selector-react-div", Ii = ({
3912
+ timeRange: e,
3913
+ maxTimeRange: t,
3914
+ numberOfSegments: n,
3915
+ segmentSize: r,
3916
+ maxSliderRange: i,
3917
+ onCheckmarkClickCallback: o
3918
+ }) => (customElements.get("omakase-time-range-selector") || customElements.define(
3919
+ "omakase-time-range-selector",
3920
+ Ct
3921
+ ), j(() => {
3922
+ var h;
3923
+ const s = Y.parseTimeRange(t), a = Y.timeMomentToSeconds(
3924
+ s.start
3925
+ ), l = Y.timeMomentToSeconds(s.end), u = Y.parseTimeRange(e), c = Y.timeMomentToSeconds(
3926
+ u.start
3927
+ ), d = Y.timeMomentToSeconds(u.end), f = new Ct();
3928
+ f.setAttribute("minValue", a.toString()), f.setAttribute("maxValue", l.toString()), f.setAttribute("maxRange", i.toString()), f.setAttribute("segmentSize", r.toString()), f.setAttribute(
3929
+ "numberOfSegments",
3930
+ n.toString()
3931
+ ), f.setAttribute("sliderStart", c.toString()), f.setAttribute("sliderEnd", d.toString()), f.onCheckmarkClickCallback = o, (h = document.getElementById(Lt)) == null || h.append(f);
3932
+ }, []), /* @__PURE__ */ g.createElement("div", { id: Lt })), Ni = g.memo(
3933
+ ({
3934
+ omakasePlayer: e,
3935
+ config: t,
3936
+ onCreateMarkerListCallback: n
3937
+ }) => (j(() => {
3938
+ const r = e.createMarkerList(t).subscribe({
3939
+ next: (i) => {
3940
+ n == null || n(i);
3941
+ }
3942
+ });
3943
+ return () => {
3944
+ r.unsubscribe();
3945
+ };
3946
+ }, [t.source]), /* @__PURE__ */ g.createElement("div", { id: t.markerListHTMLElementId }))
3947
+ );
3948
+ export {
3949
+ Ni as OmakaseMarkerListComponent,
3950
+ ar as OmakasePlayerComponent,
3951
+ _i as OmakasePlayerTimelineBuilder,
3952
+ yi as OmakasePlayerTimelineComponent,
3953
+ xi as OmakasePlayerTimelineControlsToolbar,
3954
+ Oi as OmakaseTamsPlayerComponent,
3955
+ Ii as OmakaseTimeRangePicker,
3956
+ Y as TimeRangeUtil,
3957
+ ce as TimecodeUtil
3958
+ };
3959
+ //# sourceMappingURL=index.es.js.map