onelineplayer 1.0.0

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.
@@ -0,0 +1,732 @@
1
+ const R = `<div class="oneline-wrap">
2
+ <video style="display: none" class="oneline oneline-video" playsinline></video>
3
+ <div class="oneline-embed"></div>
4
+ <div class="oneline-error-box"><div class="oneline-error-message"></div></div>
5
+ <div class="oneline-poster" style="display: none"></div>
6
+ <div class="oneline-overlay" style="display: none"></div>
7
+ <div class="oneline-play-pause" style="display: none">
8
+ <button aria-label="Play" type="button">
9
+ <svg class="oneline-play-button" width="29px" height="29px" viewBox="-3 0 26 29" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
10
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.9">
11
+ <g class="oneline-icon" transform="translate(-308.000000, -226.000000)" fill="#EFEFEF" fill-rule="nonzero">
12
+ <g>
13
+ <path d="M308,252.742128 L308,228.216201 C308,227.111631 308.895431,226.216201 310,226.216201 C310.395737,226.216201 310.782578,226.333602 311.111565,226.553545 L329.506011,238.85112 C330.42427,239.46502 330.671002,240.707081 330.057101,241.62534 C329.910345,241.844855 329.721572,242.033137 329.501676,242.179321 L311.10723,254.407674 C310.187374,255.01918 308.945961,254.769213 308.334454,253.849358 C308.116351,253.521277 308,253.13609 308,252.742128 Z"></path>
14
+ </g>
15
+ </g>
16
+ </g>
17
+ </svg>
18
+ <svg class="oneline-pause-button" width="20px" height="20px" viewBox="-1 0 19 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
19
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.9">
20
+ <g class="oneline-icon" transform="translate(-1034.000000, -1137.000000)" fill="#EFEFEF">
21
+ <g transform="translate(920.000000, 331.000000)">
22
+ <g transform="translate(0.000000, 656.000000)">
23
+ <g transform="translate(87.000000, 60.000000)">
24
+ <path d="M29,90 L30.3333333,90 C31.4379028,90 32.3333333,90.8954305 32.3333333,92 L32.3333333,108 C32.3333333,109.104569 31.4379028,110 30.3333333,110 L29,110 C27.8954305,110 27,109.104569 27,108 L27,92 C27,90.8954305 27.8954305,90 29,90 Z M40.3333333,90 L41.6666667,90 C42.7712362,90 43.6666667,90.8954305 43.6666667,92 L43.6666667,108 C43.6666667,109.104569 42.7712362,110 41.6666667,110 L40.3333333,110 C39.2287638,110 38.3333333,109.104569 38.3333333,108 L38.3333333,92 C38.3333333,90.8954305 39.2287638,90 40.3333333,90 Z"></path>
25
+ </g>
26
+ </g>
27
+ </g>
28
+ </g>
29
+ </g>
30
+ </svg>
31
+ </button>
32
+ </div>
33
+ <div class="oneline-loader-container">
34
+ <div class="la-ball-pulse">
35
+ <div></div>
36
+ <div></div>
37
+ <div></div>
38
+ </div>
39
+ </div>
40
+ <div class="oneline-controls">
41
+ <div class="oneline-time" style="display: none"></div>
42
+ <div class="oneline-progress" style="display: none" tabindex="0" role="slider" aria-orientation="horizontal">
43
+ <div class="oneline-progress-fill-bg">
44
+ <div class="oneline-progress-fill"></div>
45
+ </div>
46
+ <div class="oneline-progress-seek-fill"></div>
47
+ <svg
48
+ class="ring"
49
+ width="120"
50
+ height="120">
51
+ <circle
52
+ class="ring-circle ring-bg"
53
+ stroke="white"
54
+ stroke-width="4"
55
+ fill="transparent"
56
+ r="52"
57
+ cx="60"
58
+ cy="60"/>
59
+ <circle
60
+ class="ring-circle ring-fill"
61
+ stroke="red"
62
+ stroke-width="4"
63
+ fill="transparent"
64
+ r="52"
65
+ cx="60"
66
+ cy="60"/>
67
+ <circle
68
+ class="ring-circle ring-seek"
69
+ stroke="blue"
70
+ stroke-width="4"
71
+ fill="transparent"
72
+ r="52"
73
+ cx="60"
74
+ cy="60"/>
75
+ </svg>
76
+ </div>
77
+ <div class="oneline-control-buttons">
78
+ <button class="oneline-mute-button" style="display: none" type="button">
79
+ <svg class="mute" width="16px" height="20px" viewBox="0 0 16 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
80
+ <title>Mute</title>
81
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
82
+ <g transform="translate(-1392.000000, -1231.000000)" fill="#FFFFFF" fill-rule="nonzero">
83
+ <g transform="translate(802.000000, 794.000000)">
84
+ <path d="M602.985222,437 L602.985222,456.123535 L600.787842,456.123535 L592.44458,450.014526 L590,450.014526 L590,442.986084 L592.44458,442.986084 L600.787842,437 L602.985222,437 Z M606,444 L606,449 L604,449 L604,444 L606,444 Z"></path>
85
+ </g>
86
+ </g>
87
+ </g>
88
+ </svg>
89
+ <svg class="unmute" width="16px" height="20px" viewBox="0 0 16 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
90
+ <title>Unmute</title>
91
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
92
+ <g transform="translate(-1392.000000, -1197.000000)" fill="#FFFFFF" fill-rule="nonzero">
93
+ <g transform="translate(802.000000, 794.000000)">
94
+ <path d="M602.985,411.757 L602.985222,422.123535 L600.787842,422.123535 L596.072,418.67 L602.985,411.757 Z M606.424621,403.368272 L607.838835,404.782486 L592.282486,420.338835 L590.868272,418.924621 L606.424621,403.368272 Z M602.985222,403 L602.985,404.687 L591.658,416.014 L590,416.014526 L590,408.986084 L592.44458,408.986084 L600.787842,403 L602.985222,403 Z M606,410 L606,415 L604,415 L604,410.742 L604.743,409.999 L606,410 Z"></path>
95
+ </g>
96
+ </g>
97
+ </g>
98
+ </svg>
99
+ </button>
100
+ <button class="oneline-fullscreen-button" style="display: none" type="button">
101
+ <svg width="19px" class="fullscreen-icon-on" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
102
+ <title>Fullscreen</title>
103
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
104
+ <g transform="translate(-1351.000000, -1231.000000)" fill="#FFFFFF">
105
+ <g transform="translate(802.000000, 794.000000)">
106
+ <path d="M554.971733,448.344364 C555.432291,447.885212 556.177464,447.885212 556.638022,448.344364 L556.638022,448.344364 L556.654581,448.36091 C557.11514,448.821096 557.11514,449.566701 556.654581,450.025853 L556.654581,450.025853 L554.013357,452.664943 C553.750477,452.928645 553.750477,453.354705 554.013357,453.618407 L554.013357,453.618407 L555.245998,454.850052 C555.671367,455.274043 555.370193,456 554.769915,456 L554.769915,456 L549,456 L549,450.234747 C549,449.634953 549.726544,449.334023 550.150878,449.759049 L550.150878,449.759049 L551.377308,450.983454 C551.640189,451.247156 552.067628,451.247156 552.330509,450.983454 L552.330509,450.983454 Z M568,437 L568,442.764694 C568,443.36443 567.273456,443.665331 566.849122,443.240346 L566.849122,443.240346 L565.622692,442.01606 C565.359811,441.753417 564.932372,441.753417 564.669491,442.01606 L564.669491,442.01606 L562.028267,444.654894 C561.567709,445.115035 560.822536,445.115035 560.361978,444.654894 L560.361978,444.654894 L560.345419,444.638349 C559.88486,444.178208 559.88486,443.433709 560.345419,442.973568 L560.345419,442.973568 L562.986643,440.334734 C563.249523,440.071057 563.249523,439.645038 562.986643,439.381362 L562.986643,439.381362 L561.752967,438.149837 C561.328633,437.725886 561.629807,437 562.230085,437 L562.230085,437 L568,437 Z"></path>
107
+ </g>
108
+ </g>
109
+ </g>
110
+ </svg>
111
+ <svg class="fullscreen-icon-off" width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
112
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
113
+ <g transform="translate(-1351.000000, -1197.000000)" fill="#FFFFFF">
114
+ <g transform="translate(802.000000, 794.000000)">
115
+ <path d="M557,414 L557,419.764694 C557,420.36443 556.273456,420.665331 555.849122,420.240346 L555.849122,420.240346 L554.622692,419.01606 C554.359811,418.753417 553.932372,418.753417 553.669491,419.01606 L553.669491,419.01606 L551.028267,421.654894 C550.567709,422.115035 549.822536,422.115035 549.361978,421.654894 L549.361978,421.654894 L549.345419,421.638349 C548.88486,421.178208 548.88486,420.433709 549.345419,419.973568 L549.345419,419.973568 L551.986643,417.334734 C552.249523,417.071057 552.249523,416.645038 551.986643,416.381362 L551.986643,416.381362 L550.752967,415.149837 C550.328633,414.725886 550.629807,414 551.230085,414 L551.230085,414 L557,414 Z M565.971733,403.344364 C566.432291,402.885212 567.177464,402.885212 567.638022,403.344364 L567.638022,403.344364 L567.654581,403.36091 C568.11514,403.821096 568.11514,404.566701 567.654581,405.025853 L567.654581,405.025853 L565.013357,407.664943 C564.750477,407.928645 564.750477,408.354705 565.013357,408.618407 L565.013357,408.618407 L566.245998,409.850052 C566.671367,410.274043 566.370193,411 565.769915,411 L565.769915,411 L560,411 L560,405.234747 C560,404.634953 560.726544,404.334023 561.150878,404.759049 L561.150878,404.759049 L562.377308,405.983454 C562.640189,406.247156 563.067628,406.247156 563.330509,405.983454 L563.330509,405.983454 Z"></path>
116
+ </g>
117
+ </g>
118
+ </g>
119
+ </svg>
120
+ </button>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ `;
125
+ function L(s) {
126
+ return !!(s && s.match(/vimeo\.com\/(\d+)/i));
127
+ }
128
+ function _(s) {
129
+ const n = [
130
+ "assets-1.entertainvideo.com/assets/video/30df75d701c29181572c47389a031c60.mp4"
131
+ ];
132
+ for (let l = 0; l < n.length; l++)
133
+ if (s && s.indexOf(n[l]) !== -1)
134
+ return !0;
135
+ return !1;
136
+ }
137
+ function V(s) {
138
+ s = Math.floor(s);
139
+ let n = Math.floor(s / 3600), l = Math.floor((s - n * 3600) / 60), e = s - n * 3600 - l * 60;
140
+ l = l < 10 ? "0" + l : l, e = e < 10 ? "0" + e : e;
141
+ let i = l + ":" + e;
142
+ return n > 0 && (i = n + ":" + i), i;
143
+ }
144
+ function D(s) {
145
+ if (!s)
146
+ throw new Error("onelineplayer.mount: target is required");
147
+ if (typeof s == "string") {
148
+ const n = document.querySelector(s);
149
+ if (!n)
150
+ throw new Error("onelineplayer.mount: element not found: " + s);
151
+ return n;
152
+ }
153
+ if (s.nodeType === 1)
154
+ return s;
155
+ throw new Error("onelineplayer.mount: target must be a selector or Element");
156
+ }
157
+ function N(s) {
158
+ const n = s || {};
159
+ return {
160
+ url: n.url || "",
161
+ poster: n.poster || "",
162
+ autoplay: !!n.autoplay,
163
+ loop: !!n.loop,
164
+ autopause: !!n.autopause,
165
+ muted: !!n.muted,
166
+ clickable: n.clickable !== !1,
167
+ time: !!n.time,
168
+ progressBar: !!n.progressBar,
169
+ playButton: n.playButton !== void 0 ? !!n.playButton : !0,
170
+ overlay: n.overlay !== void 0 ? !!n.overlay : !0,
171
+ muteButton: !!n.muteButton,
172
+ fullscreenButton: !!n.fullscreenButton,
173
+ style: n.style || "light",
174
+ buttonColor: n.buttonColor || null,
175
+ buttonSize: n.buttonSize || null,
176
+ overlayColor: n.overlayColor || null,
177
+ overlayOpacity: n.overlayOpacity != null ? n.overlayOpacity : null,
178
+ quality: n.quality || "auto"
179
+ };
180
+ }
181
+ function W(s, n, l) {
182
+ const e = s.video, i = s.wrap;
183
+ return e.style.display = "block", e.muted = !!n.muted, n.autoplay && e.setAttribute("autoplay", ""), n.loop && e.setAttribute("loop", ""), _(n.url) ? e.src = "restricted" : e.src = n.url, e.addEventListener("error", function() {
184
+ const o = i.querySelector(".oneline-error-message");
185
+ if (e.error === null)
186
+ return;
187
+ let t = "Video error";
188
+ switch (e.error.code) {
189
+ case 1:
190
+ t = "Video aborted";
191
+ break;
192
+ case 2:
193
+ t = "Video expired, reload the page";
194
+ break;
195
+ case 3:
196
+ t = "Network error";
197
+ break;
198
+ case 4:
199
+ t = "Video not found or not supported";
200
+ break;
201
+ }
202
+ o && (o.innerText = t), i.classList.add("oneline-error"), i.classList.remove("oneline-load");
203
+ }), e.addEventListener(
204
+ "waiting",
205
+ function() {
206
+ l && console.log("waiting"), i.classList.add("oneline-load");
207
+ },
208
+ !1
209
+ ), e.addEventListener(
210
+ "canplaythrough",
211
+ function() {
212
+ l && console.log("canplay"), i.classList.remove("oneline-load");
213
+ },
214
+ !1
215
+ ), {
216
+ type: "html",
217
+ load: function(o) {
218
+ e.src = o.url, o.autoplay && e.setAttribute("autoplay", "");
219
+ },
220
+ node: function() {
221
+ return e;
222
+ },
223
+ play: function() {
224
+ return e.play();
225
+ },
226
+ pause: function() {
227
+ e.pause();
228
+ },
229
+ mute: function() {
230
+ e.muted = !0;
231
+ },
232
+ unmute: function() {
233
+ e.muted = !1;
234
+ },
235
+ getPaused: function(o) {
236
+ o(e.paused);
237
+ },
238
+ getWidth: function(o) {
239
+ o(e.videoWidth);
240
+ },
241
+ getHeight: function(o) {
242
+ o(e.videoHeight);
243
+ },
244
+ getTime: function(o) {
245
+ o(e.currentTime);
246
+ },
247
+ setTime: function(o) {
248
+ e.currentTime = o;
249
+ },
250
+ setLoop: function(o) {
251
+ o ? e.setAttribute("loop", "") : e.removeAttribute("loop");
252
+ },
253
+ getDuration: function(o) {
254
+ o(e.duration);
255
+ },
256
+ getMuted: function(o) {
257
+ o(e.muted);
258
+ },
259
+ onLoadstart: function(o) {
260
+ e.addEventListener("loadstart", o, !1);
261
+ },
262
+ onLoadend: function(o) {
263
+ e.addEventListener("loadended", o, !1);
264
+ },
265
+ onReady: function(o) {
266
+ e.addEventListener("loadedmetadata", o, !1);
267
+ },
268
+ onPlay: function(o) {
269
+ e.addEventListener("play", o, !1);
270
+ },
271
+ onPause: function(o) {
272
+ e.addEventListener("pause", o, !1);
273
+ },
274
+ onTimeupdate: function(o) {
275
+ e.addEventListener("timeupdate", o, !1);
276
+ },
277
+ onVolumechange: function(o) {
278
+ e.addEventListener("volumechange", o, !1);
279
+ },
280
+ onEnded: function(o) {
281
+ e.addEventListener("ended", o, !1);
282
+ },
283
+ onSeeked: function(o) {
284
+ e.addEventListener("seeked", o, !1);
285
+ },
286
+ destroy: function() {
287
+ e.removeAttribute("src"), e.load();
288
+ }
289
+ };
290
+ }
291
+ const K = "https://player.vimeo.com/api/player.js";
292
+ let g = null;
293
+ function U() {
294
+ return typeof window < "u" && window.Vimeo && window.Vimeo.Player ? Promise.resolve(window.Vimeo) : g || (g = new Promise(function(s, n) {
295
+ const l = document.querySelector("script[data-onelineplayer-vimeo]");
296
+ if (l) {
297
+ l.addEventListener("load", function() {
298
+ s(window.Vimeo);
299
+ }), l.addEventListener("error", n);
300
+ return;
301
+ }
302
+ const e = document.createElement("script");
303
+ e.src = K, e.async = !0, e.dataset.onelineplayerVimeo = "1", e.onload = function() {
304
+ s(window.Vimeo);
305
+ }, e.onerror = n, document.head.appendChild(e);
306
+ }), g);
307
+ }
308
+ function A(s) {
309
+ return {
310
+ url: s.url,
311
+ controls: !1,
312
+ muted: s.muted,
313
+ autoplay: s.autoplay,
314
+ loop: s.loop,
315
+ quality: s.quality,
316
+ responsive: !0
317
+ };
318
+ }
319
+ async function j(s, n) {
320
+ s.embed.style.display = "block";
321
+ const l = await U(), e = new l.Player(s.embed, A(n));
322
+ return n.muted || e.setVolume(1), {
323
+ type: "vimeo",
324
+ load: function(i) {
325
+ e.loadVideo(A(i));
326
+ },
327
+ node: function() {
328
+ return e.element;
329
+ },
330
+ play: function() {
331
+ return e.play();
332
+ },
333
+ pause: function() {
334
+ return e.pause();
335
+ },
336
+ mute: function() {
337
+ e.setVolume(0);
338
+ },
339
+ unmute: function() {
340
+ e.setVolume(1);
341
+ },
342
+ getPaused: function(i) {
343
+ e.getPaused().then(i);
344
+ },
345
+ getWidth: function(i) {
346
+ e.getVideoWidth().then(i);
347
+ },
348
+ getHeight: function(i) {
349
+ e.getVideoHeight().then(i);
350
+ },
351
+ getTime: function(i) {
352
+ e.getCurrentTime().then(i);
353
+ },
354
+ setTime: function(i) {
355
+ e.setCurrentTime(i);
356
+ },
357
+ setLoop: function(i) {
358
+ e.setLoop(i);
359
+ },
360
+ getDuration: function(i) {
361
+ e.getDuration().then(i);
362
+ },
363
+ getMuted: function(i) {
364
+ e.getVolume().then(function(o) {
365
+ i(o === 0);
366
+ });
367
+ },
368
+ onLoadstart: function(i) {
369
+ e.on("bufferstart", i);
370
+ },
371
+ onLoadend: function(i) {
372
+ e.on("bufferend", i);
373
+ },
374
+ onReady: function(i) {
375
+ e.on("loaded", i);
376
+ },
377
+ onPlay: function(i) {
378
+ e.on("play", i);
379
+ },
380
+ onPause: function(i) {
381
+ e.on("pause", i);
382
+ },
383
+ onTimeupdate: function(i) {
384
+ e.on("timeupdate", i);
385
+ },
386
+ onVolumechange: function(i) {
387
+ e.on("volumechange", i);
388
+ },
389
+ onEnded: function(i) {
390
+ e.on("ended", i);
391
+ },
392
+ onSeeked: function(i) {
393
+ e.on("seeked", i);
394
+ },
395
+ destroy: function() {
396
+ return e.destroy();
397
+ }
398
+ };
399
+ }
400
+ function I(s) {
401
+ const { video: n, options: l, els: e, components: i, state: o } = s, t = e.play, r = e.wrap;
402
+ l && l.buttonSize ? (t.style.width = l.buttonSize + "px", t.style.marginTop = -(l.buttonSize / 2) + "px", t.style.marginLeft = -(l.buttonSize / 2) + "px") : (t.style.width = null, t.style.marginTop = null, t.style.marginLeft = null);
403
+ const a = l && l.buttonColor ? l.buttonColor : null, d = t.querySelectorAll(".oneline-icon");
404
+ for (let u = 0; u < d.length; u++)
405
+ d[u].style.fill = a;
406
+ if (i.playButton)
407
+ return i.playButton;
408
+ const p = o.userCanTouch ? "touchend" : "click";
409
+ return t.addEventListener(p, function() {
410
+ r.classList.add("oneline-started"), n.getPaused(function(u) {
411
+ u ? n.play() : n.pause();
412
+ });
413
+ }, !1), t.style.display = "block", i.playButton = t, i.playButton;
414
+ }
415
+ function Y(s) {
416
+ const { video: n, els: l, components: e, state: i } = s;
417
+ if (e.muteButton)
418
+ return e.muteButton;
419
+ const o = l.muteButton;
420
+ n.getMuted(function(r) {
421
+ r && o.classList.add("muted");
422
+ });
423
+ const t = i.userCanTouch ? "touchend" : "click";
424
+ return o.addEventListener(t, function() {
425
+ n.getMuted(function(r) {
426
+ r ? n.unmute() : n.mute();
427
+ });
428
+ }), n.onVolumechange(function() {
429
+ n.getMuted(function(r) {
430
+ r ? o.classList.add("muted") : o.classList.remove("muted");
431
+ });
432
+ }), o.style.display = "block", e.muteButton = o, e.muteButton;
433
+ }
434
+ function X(s) {
435
+ const { video: n, els: l, components: e, cleanup: i } = s, o = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, t = l.fullscreenButton;
436
+ if (o && n.type === "vimeo")
437
+ return t.style.display = "none", null;
438
+ if (e.fullscreenButton)
439
+ return e.fullscreenButton;
440
+ function r() {
441
+ const u = l.wrap;
442
+ d() ? (u.classList.remove("oneline-fullscreen"), n.node().dispatchEvent(new CustomEvent("fullscreenExit"))) : (u.classList.add("oneline-fullscreen"), n.node().dispatchEvent(new CustomEvent("fullscreenEnter")));
443
+ }
444
+ function a() {
445
+ const u = l.root;
446
+ d() ? u.requestFullscreen ? u.requestFullscreen() : u.msRequestFullscreen ? u.msRequestFullscreen() : u.mozRequestFullScreen ? u.mozRequestFullScreen() : u.webkitRequestFullscreen ? u.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : o && n.type === "html" && n.node().webkitEnterFullscreen() : document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
447
+ }
448
+ function d() {
449
+ return !document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement;
450
+ }
451
+ const p = function() {
452
+ a(), t.blur();
453
+ };
454
+ return t.addEventListener("click", p), document.addEventListener("webkitfullscreenchange", r), document.addEventListener("fullscreenchange", r), document.addEventListener("mozfullscreenchange", r), document.addEventListener("MSFullscreenChange", r), i.push(function() {
455
+ t.removeEventListener("click", p), document.removeEventListener("webkitfullscreenchange", r), document.removeEventListener("fullscreenchange", r), document.removeEventListener("mozfullscreenchange", r), document.removeEventListener("MSFullscreenChange", r);
456
+ }), t.style.display = "block", e.fullscreenButton = t, e.fullscreenButton;
457
+ }
458
+ function G(s) {
459
+ const { video: n, options: l, els: e, components: i, cleanup: o } = s;
460
+ if (i.progressBar)
461
+ return i.progressBar;
462
+ let t = !1, r = null;
463
+ const a = e.progress, d = e.progressFill, p = e.progressSeekFill, u = e.wrap;
464
+ n.onPlay(function() {
465
+ O();
466
+ }), n.onPause(function() {
467
+ S();
468
+ }), n.onEnded(function() {
469
+ d.style.width = a.offsetWidth + "px";
470
+ });
471
+ function m(c) {
472
+ z(c), t = !0;
473
+ }
474
+ function w() {
475
+ t = !1;
476
+ }
477
+ function k(c) {
478
+ B(c, !1);
479
+ }
480
+ function x(c) {
481
+ t = !0, c.returnValue = !1;
482
+ }
483
+ function E(c) {
484
+ B(c, !0);
485
+ }
486
+ function C() {
487
+ t = !1;
488
+ }
489
+ function F(c) {
490
+ c.keyCode === 39 && T(5), c.keyCode === 37 && T(-5);
491
+ }
492
+ return a.addEventListener("mousedown", m, !1), a.addEventListener("mouseup", w, !1), a.addEventListener("mousemove", k, !1), a.addEventListener("touchstart", x, !1), a.addEventListener("touchmove", E, !1), a.addEventListener("touchend", C, !1), document.addEventListener("keydown", F, !1), o.push(function() {
493
+ S(), a.removeEventListener("mousedown", m, !1), a.removeEventListener("mouseup", w, !1), a.removeEventListener("mousemove", k, !1), a.removeEventListener("touchstart", x, !1), a.removeEventListener("touchmove", E, !1), a.removeEventListener("touchend", C, !1), document.removeEventListener("keydown", F, !1);
494
+ }), a.style.display = "block", i.progressBar = a, a;
495
+ function T(c) {
496
+ n.getTime(function(f) {
497
+ n.setTime(f + c);
498
+ });
499
+ }
500
+ function B(c, f) {
501
+ f && (c.returnValue = !1);
502
+ const y = P(c);
503
+ H(y), t && z(c);
504
+ }
505
+ function z(c) {
506
+ const f = P(c);
507
+ L(l.url) || u.classList.add("oneline-load"), n.getDuration(function(y) {
508
+ n.setTime(f / 100 * y), M();
509
+ });
510
+ }
511
+ function O() {
512
+ (function c() {
513
+ M(), r = setTimeout(c, 50);
514
+ })();
515
+ }
516
+ function S() {
517
+ clearTimeout(r);
518
+ }
519
+ function M() {
520
+ n.getTime(function(c) {
521
+ n.getDuration(function(f) {
522
+ Z(c * 100 / f);
523
+ });
524
+ });
525
+ }
526
+ function Z(c) {
527
+ d.style.width = c + "%";
528
+ }
529
+ function H(c) {
530
+ p.style.width = c + "%";
531
+ }
532
+ function P(c) {
533
+ const f = c.changedTouches, y = a.getBoundingClientRect().left, h = (f ? c.pageX : c.clientX) - y, q = a.offsetWidth;
534
+ return h > 0 && h < q ? h * 100 / q : 0;
535
+ }
536
+ }
537
+ function J(s) {
538
+ const { video: n, els: l, components: e } = s, i = l.time;
539
+ if (n.getTime(function(t) {
540
+ i.innerHTML = V(t);
541
+ }), i.style.display = "block", e.time)
542
+ return e.time;
543
+ return o(), n.onTimeupdate(function() {
544
+ o();
545
+ }), e.time = i, i;
546
+ function o() {
547
+ n.getTime(function(t) {
548
+ i.innerHTML = V(t);
549
+ });
550
+ }
551
+ }
552
+ function Q(s) {
553
+ const { video: n, options: l, els: e, components: i } = s, o = e.poster, t = l.poster;
554
+ return !t || t === "null" ? (o.style.display = "none", null) : (o.style.backgroundColor = "#000", o.style.backgroundImage = "url(" + t + ")", i.poster ? i.poster : (o.style.display = "block", n.onPlay(function() {
555
+ o.style.display = "none";
556
+ }), i.poster = o, o));
557
+ }
558
+ function $(s) {
559
+ const { video: n, options: l, els: e, components: i, state: o } = s, t = e.overlay, r = e.wrap;
560
+ if (l && l.overlayColor ? t.style.backgroundColor = l.overlayColor : t.style.backgroundColor = null, l && l.overlayOpacity != null ? (t.dataset.opacity = l.overlayOpacity, n.getPaused(function(d) {
561
+ d && (t.style.opacity = t.dataset.opacity);
562
+ })) : (delete t.dataset.opacity, t.style.opacity = null), i.overlay)
563
+ return i.overlay;
564
+ t.classList.add("oneline-clickable");
565
+ const a = o.userCanTouch ? "touchend" : "click";
566
+ return t.addEventListener(a, function() {
567
+ r.classList.add("oneline-started"), n.getPaused(function(d) {
568
+ d ? n.play() : n.pause();
569
+ });
570
+ }, !1), n.onPlay(function() {
571
+ typeof t.dataset.opacity < "u" && (t.style.opacity = 0);
572
+ }), n.onPause(function() {
573
+ typeof t.dataset.opacity < "u" && (t.style.opacity = t.dataset.opacity);
574
+ }), t.addEventListener("mouseleave", function() {
575
+ r.classList.remove("oneline-hide-controls"), r.classList.remove("oneline-hide-all");
576
+ }), t.addEventListener("mouseenter", function() {
577
+ o.userCanTouch || (r.classList.remove("oneline-hide-controls"), r.classList.remove("oneline-hide-all"), o.hideTimeout && clearTimeout(o.hideTimeout));
578
+ }), t.style.display = "block", i.overlay = t, i.overlay;
579
+ }
580
+ const v = /* @__PURE__ */ new Set();
581
+ function ee(s) {
582
+ const n = s.querySelector(".oneline-wrap");
583
+ return {
584
+ root: s,
585
+ wrap: n,
586
+ video: n.querySelector(".oneline-video"),
587
+ embed: n.querySelector(".oneline-embed"),
588
+ poster: n.querySelector(".oneline-poster"),
589
+ overlay: n.querySelector(".oneline-overlay"),
590
+ play: n.querySelector(".oneline-play-pause"),
591
+ time: n.querySelector(".oneline-time"),
592
+ progress: n.querySelector(".oneline-progress"),
593
+ progressFill: n.querySelector(".oneline-progress-fill"),
594
+ progressSeekFill: n.querySelector(".oneline-progress-seek-fill"),
595
+ muteButton: n.querySelector(".oneline-mute-button"),
596
+ fullscreenButton: n.querySelector(".oneline-fullscreen-button")
597
+ };
598
+ }
599
+ function ne(s) {
600
+ const n = document.createElement("template");
601
+ return n.innerHTML = R.trim(), s.classList.add("oneline-player"), s.replaceChildren(n.content.cloneNode(!0)), ee(s);
602
+ }
603
+ class te {
604
+ constructor(n, l) {
605
+ this.root = n, this.options = l, this.components = {}, this.cleanup = [], this.state = {
606
+ userCanTouch: !1,
607
+ hideTimeout: null,
608
+ debug: !1
609
+ }, this.video = null, this.els = null, this._ready = !1, this._destroyed = !1;
610
+ }
611
+ async init() {
612
+ this.els = ne(this.root);
613
+ const n = this.els, l = this.options, e = this.state, i = function() {
614
+ e.userCanTouch = !0;
615
+ };
616
+ n.root.addEventListener("touchstart", i, !0), this.cleanup.push(function() {
617
+ n.root.removeEventListener("touchstart", i, !0);
618
+ }), L(l.url) ? this.video = await j(n, l) : (this.video = W(n, l, e.debug), n.wrap.classList.add("oneline-load"));
619
+ const o = this.video, t = n.wrap;
620
+ if (l.style === "dark" && t.classList.add("oneline-dark"), l.poster && Q({ video: o, options: l, els: n, components: this.components }), l.overlay && $({ video: o, options: l, els: n, components: this.components, state: e }), l.autopause) {
621
+ const p = this;
622
+ o.onPlay(function() {
623
+ v.forEach(function(u) {
624
+ u !== p && !u._destroyed && u.pause();
625
+ });
626
+ });
627
+ }
628
+ o.onLoadstart(function() {
629
+ e.debug && console.log("loadstart"), L(l.url) || t.classList.add("oneline-load"), t.classList.remove("oneline-error");
630
+ }), o.onLoadend(function() {
631
+ e.debug && console.log("loadend"), t.classList.remove("oneline-load");
632
+ }), o.onPlay(function() {
633
+ e.debug && console.log("play"), t.classList.add("oneline-hide-controls"), t.classList.add("oneline-playing"), t.classList.remove("oneline-paused"), e.hideTimeout = setTimeout(function() {
634
+ t.classList.add("oneline-hide-all");
635
+ }, 3e3);
636
+ }), o.onPause(function() {
637
+ e.debug && console.log("pause"), t.classList.add("oneline-paused"), t.classList.remove("oneline-load"), t.classList.remove("oneline-playing"), t.classList.remove("oneline-hide-all"), clearTimeout(e.hideTimeout);
638
+ }), o.onSeeked(function() {
639
+ t.classList.remove("oneline-load");
640
+ });
641
+ const r = function() {
642
+ t.classList.remove("oneline-hide-controls"), t.classList.remove("oneline-hide-all"), t.classList.remove("active");
643
+ }, a = function() {
644
+ t.classList.remove("oneline-hide-controls"), t.classList.remove("oneline-hide-all"), clearTimeout(e.hideTimeout);
645
+ };
646
+ t.addEventListener("mouseleave", r), t.addEventListener("mouseenter", a), this.cleanup.push(function() {
647
+ t.removeEventListener("mouseleave", r), t.removeEventListener("mouseenter", a);
648
+ });
649
+ const d = this;
650
+ return o.onReady(function() {
651
+ if (d._destroyed) return;
652
+ e.debug && console.log("loadedmetadata"), t.classList.add("oneline-ready"), t.classList.remove("oneline-load"), l.autoplay || t.classList.add("oneline-paused");
653
+ const p = {
654
+ video: o,
655
+ options: l,
656
+ els: n,
657
+ components: d.components,
658
+ state: e,
659
+ cleanup: d.cleanup
660
+ };
661
+ l.time && J(p), l.progressBar && G(p), l.playButton && I(p), l.muteButton && Y(p), l.fullscreenButton && X(p), d._bindKeyboardFocus(p), d._ready = !0;
662
+ }), v.add(this), this;
663
+ }
664
+ _bindKeyboardFocus(n) {
665
+ const { video: l, els: e, components: i, cleanup: o } = n, t = e.wrap, r = ["playButton", "progressBar", "muteButton", "fullscreenButton"];
666
+ function a(p) {
667
+ p.keyCode === 9 && t.classList.add("keyboard-control");
668
+ }
669
+ function d(p) {
670
+ const u = document.activeElement && document.activeElement.tagName === "BUTTON";
671
+ p.keyCode === 32 && !u && l.getPaused(function(m) {
672
+ m ? l.play() : l.pause();
673
+ });
674
+ }
675
+ document.addEventListener("keyup", a), document.addEventListener("keydown", d), o.push(function() {
676
+ document.removeEventListener("keyup", a), document.removeEventListener("keydown", d);
677
+ }), r.forEach(function(p) {
678
+ const u = i[p];
679
+ u && (u.addEventListener("click", function(m) {
680
+ (m.clientX || m.clientY) && t.classList.remove("keyboard-control");
681
+ }), u.addEventListener("focus", function() {
682
+ t.classList.add("active");
683
+ }), u.addEventListener("blur", function() {
684
+ t.classList.remove("active");
685
+ }));
686
+ });
687
+ }
688
+ play() {
689
+ this.video && this.video.play();
690
+ }
691
+ pause() {
692
+ this.video && this.video.pause();
693
+ }
694
+ destroy() {
695
+ this._destroyed || (this._destroyed = !0, clearTimeout(this.state.hideTimeout), this.cleanup.forEach(function(n) {
696
+ try {
697
+ n();
698
+ } catch {
699
+ }
700
+ }), this.cleanup = [], this.video && this.video.destroy && this.video.destroy(), v.delete(this), this.root.classList.remove("oneline-player"), this.root.replaceChildren());
701
+ }
702
+ }
703
+ const oe = ".oneline-player{font-family:Helvetica,sans-serif;margin:0;background:transparent;display:flex;align-items:center;width:100%}.oneline-responsive video{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;overflow:hidden}.oneline{width:100%;height:100%;display:block}.oneline-ready .oneline{height:auto}.oneline-clickable{cursor:pointer}.oneline-wrap{width:100%;position:relative;z-index:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.oneline-responsive .oneline-wrap{position:unset}.oneline-error-box{position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:110;background:#efefef;color:#000;display:none}.oneline-error-message{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.oneline-error .oneline-error-box{display:block}.oneline-overlay{position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:2;transition:opacity .8s cubic-bezier(.1,.79,0,.87);opacity:0}.oneline-overlay{opacity:.2}.oneline-playing .oneline-overlay{opacity:0}.oneline-load .oneline-overlay,.oneline-playing:hover .oneline-overlay{opacity:.2!important}.oneline-hide-controls.oneline-playing:hover .oneline-overlay{opacity:0!important}.oneline-controls{position:absolute;z-index:10;display:flex;align-items:center;flex-direction:row;justify-content:space-between;bottom:20px;left:0;width:100%;opacity:0;transform:translateY(8px);transition:all 1s cubic-bezier(.23,1,.32,1)}.oneline-started:hover .oneline-controls,.oneline-wrap.active .oneline-controls{opacity:1;transform:translateY(0)}.oneline-wrap.oneline-hide-all .oneline-controls{opacity:0;transform:translateY(8px)}.oneline-control-buttons{display:flex;justify-content:space-between;flex-direction:row;margin-left:auto}.oneline-time{padding-bottom:0;font-size:15px;letter-spacing:1px;padding-left:30px;font-family:Helvetica,sans-serif!important;-webkit-font-smoothing:auto}.oneline-progress{position:relative;margin:0 30px;padding:12px 0;flex-grow:1;cursor:pointer;display:block;border-radius:2px}.oneline-progress-fill{width:0;height:4px;border-radius:2px}.oneline-progress-fill-bg{width:100%;height:4px;border-radius:2px}.oneline-progress-seek{position:absolute;z-index:11;top:8px;left:0;width:10px;height:10px;border-radius:5px;transition:opacity .2s linear}.oneline-progress-seek-fill{position:absolute;z-index:12;top:12px;width:0;height:4px;border-radius:2px}.oneline-progress:hover .oneline-progress-fill{opacity:0}.oneline-progress:hover .oneline-progress-seek{opacity:1;-webkit-animation:in .2s ease-out;-webkit-animation-iteration-count:1}.oneline-progress:not(:hover) .oneline-progress-seek{opacity:0;-webkit-animation:out .2s ease-out;-webkit-animation-iteration-count:1}.oneline-progress:hover .oneline-progress-seek-fill{opacity:1}.oneline-progress:not(:hover) .oneline-progress-seek-fill{opacity:0}@-webkit-keyframes in{0%{-webkit-transform:scale(.1,.1)}to{-webkit-transform:scale(1,1)}}@-webkit-keyframes out{0%{-webkit-transform:scale(1,1)}to{-webkit-transform:scale(0,0)}}.oneline-loader-container{width:80px;position:absolute;top:50%;left:50%;margin-top:-15px;margin-left:-40px;height:30px;z-index:3;display:none}.oneline-load .oneline-loader-container{display:block}.oneline-play-pause{width:30px;height:30px;position:absolute;z-index:100;top:50%;left:50%;margin-top:-15px;margin-left:-15px;transition:transform 1s cubic-bezier(.075,.82,.165,1)}.oneline-play-pause:active,.oneline-wrap:active .oneline-play-pause{transform:scale(.9)!important}.oneline-play-pause button{cursor:pointer;display:block;position:relative;width:100%;padding:50%;background:transparent;border:none}.oneline-load .oneline-play-pause{opacity:0}.oneline-wrap:not(.oneline-started):hover .oneline-play-pause{transform:scale(1.2)}.oneline-play-button,.oneline-pause-button{top:0;left:0;position:absolute;transition:all .7s cubic-bezier(.1,.79,0,.87)}@media (max-width: 400px){.oneline-play-pause{width:10%;margin-top:-5%;margin-left:-5%}}.oneline-play-pause svg,.oneline-play-pause img{width:100%;height:auto}.oneline-playing .oneline-play-button{opacity:0}.oneline-paused .oneline-play-button{opacity:1}.oneline-pause-button{opacity:0}.oneline-playing:hover .oneline-pause-button{opacity:1}@media (hover: none){.oneline-playing:hover .oneline-pause-button{opacity:0}}.oneline-hide-controls.oneline-playing:hover .oneline-pause-button,.oneline-paused .oneline-pause-button{opacity:0}.oneline-mute-button svg{display:block}.oneline-mute-button.muted .mute,.oneline-mute-button .unmute{display:none}.oneline-mute-button.muted .unmute{display:block}.oneline-fullscreen-button svg{display:block}.oneline-fullscreen .oneline-fullscreen-button .fullscreen-icon-on,.oneline-fullscreen-button .fullscreen-icon-off{display:none}.oneline-fullscreen .oneline-fullscreen-button .fullscreen-icon-off{display:block}.oneline-mute-button,.oneline-fullscreen-button{width:100%;background:transparent;border:none;margin-right:30px;cursor:pointer;padding:0}button,div{outline-width:0}.keyboard-control button,.keyboard-control div{outline-width:2px!important}.keyboard-control.oneline-playing .oneline-play-pause button{outline-width:0!important}.oneline-logo{position:absolute;top:23px;left:30px;display:block;width:31px;height:20px;z-index:10;opacity:0;transition:opacity .1s linear;text-decoration:none;font-weight:500;font-size:18px}.oneline-wrap:hover .oneline-logo{opacity:.5}.oneline-wrap:hover .oneline-logo:hover{opacity:1}.oneline-poster{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;-moz-background-size:100% 100%;-o-background-size:100% 100%;-webkit-background-size:100% 100%;background-size:100% 100%}.oneline-play-button .oneline-icon,.oneline-pause-button .oneline-icon,.oneline-mute-button .oneline-icon,.oneline-fullscreen-button .oneline-icon{fill:#fff}.oneline-progress-fill{background-color:#fff}.oneline-progress-fill-bg{background-color:#fff3}.oneline-progress-seek,.oneline-progress-seek-fill{background-color:#fff}.oneline-overlay{background-color:#000}.oneline-loader{background-color:#fff}.oneline-logo,.oneline-time{color:#fff}.oneline-dark .oneline-play-button .oneline-icon,.oneline-dark .oneline-pause-button .oneline-icon,.oneline-dark .oneline-mute-button .oneline-icon,.oneline-dark .oneline-fullscreen-button .oneline-icon{fill:#333}.oneline-dark .oneline-progress-fill{background-color:#333}.oneline-dark .oneline-progress-fill-bg{background-color:#666}.oneline-dark .oneline-progress-seek,.oneline-dark .oneline-progress-seek-fill{background-color:#333}.oneline-dark .oneline-overlay{background-color:#000}.oneline-dark .oneline-loader{background-color:#333}.oneline-dark .la-ball-pulse,.oneline-dark .oneline-logo,.oneline-dark .oneline-time{color:#333}.theme-modern .oneline-controls{bottom:50%;height:100px;margin-bottom:-50px;align-items:center;justify-content:center}.theme-modern .oneline-progress-fill-bg,.theme-modern .oneline-progress-seek,.theme-modern .oneline-progress-seek-fill,.oneline-progress .ring{display:none}.theme-modern .oneline-progress .ring{display:block}.theme-modern .oneline-progress{flex-grow:0}.theme-modern .oneline-progress .ring-circle{transform:rotate(-90deg);transform-origin:50% 50%}.theme-modern .ring-seek{display:none}.theme-modern .oneline-control-buttons{margin-left:0}.la-ball-pulse,.la-ball-pulse>div{position:relative;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.la-ball-pulse{margin:0 auto;display:block;font-size:0;color:#fff}.la-ball-pulse>div{display:inline-block;float:none;background-color:currentColor;border:0 solid currentColor}.la-ball-pulse{width:54px;height:18px}.la-ball-pulse>div:nth-child(1){-webkit-animation-delay:-.2s;-moz-animation-delay:-.2s;-o-animation-delay:-.2s;animation-delay:-.2s}.la-ball-pulse>div:nth-child(2){-webkit-animation-delay:-.1s;-moz-animation-delay:-.1s;-o-animation-delay:-.1s;animation-delay:-.1s}.la-ball-pulse>div:nth-child(3){-webkit-animation-delay:0ms;-moz-animation-delay:0ms;-o-animation-delay:0ms;animation-delay:0ms}.la-ball-pulse>div{width:10px;height:10px;margin:4px;border-radius:100%;-webkit-animation:ball-pulse 1s ease infinite;-moz-animation:ball-pulse 1s ease infinite;-o-animation:ball-pulse 1s ease infinite;animation:ball-pulse 1s ease infinite}.la-ball-pulse.la-sm{width:26px;height:8px}.la-ball-pulse.la-sm>div{width:4px;height:4px;margin:2px}.la-ball-pulse.la-2x{width:108px;height:36px}.la-ball-pulse.la-2x>div{width:20px;height:20px;margin:8px}.la-ball-pulse.la-3x{width:162px;height:54px}.la-ball-pulse.la-3x>div{width:30px;height:30px;margin:12px}@-webkit-keyframes ball-pulse{0%,60%,to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}30%{opacity:.1;-webkit-transform:scale(.01);transform:scale(.01)}}@-moz-keyframes ball-pulse{0%,60%,to{opacity:1;-moz-transform:scale(1);transform:scale(1)}30%{opacity:.1;-moz-transform:scale(.01);transform:scale(.01)}}@-o-keyframes ball-pulse{0%,60%,to{opacity:1;-o-transform:scale(1);transform:scale(1)}30%{opacity:.1;-o-transform:scale(.01);transform:scale(.01)}}@keyframes ball-pulse{0%,60%,to{opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);transform:scale(1)}30%{opacity:.1;-webkit-transform:scale(.01);-moz-transform:scale(.01);-o-transform:scale(.01);transform:scale(.01)}}";
704
+ let b = !1;
705
+ function ie() {
706
+ if (b || typeof document > "u")
707
+ return;
708
+ if (document.querySelector("style[data-onelineplayer]")) {
709
+ b = !0;
710
+ return;
711
+ }
712
+ const s = document.createElement("style");
713
+ s.setAttribute("data-onelineplayer", "1"), s.textContent = oe, document.head.appendChild(s), b = !0;
714
+ }
715
+ function le(s, n) {
716
+ ie();
717
+ const l = D(s), e = N(n);
718
+ return new te(l, e).init();
719
+ }
720
+ function se(s) {
721
+ s && typeof s.destroy == "function" && s.destroy();
722
+ }
723
+ const ae = {
724
+ mount: le,
725
+ destroy: se
726
+ };
727
+ export {
728
+ ae as default,
729
+ se as destroy,
730
+ le as mount
731
+ };
732
+ //# sourceMappingURL=onelineplayer.mjs.map