vendor: 6,089 bytes, lines 1-15
1"use strict"; 2 3function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 4function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 5function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 6function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 7function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 8function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 9function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 10function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); } 11function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); } 12function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } 13function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } 14function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } 15function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {};
15 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 16function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } 17function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 18function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 19(() => { 20 var $e = `<div id="play" class="button !opacity-100" onclick="app.voyoVideo.playClick()"> 21 <svg class="icon icon_play" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg><svg class="icon icon_pause" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg> 22</div> 23`; 24 var Ge = `<div id="play" class="button button-transparent player__overlay-pp" onclick="app.voyoVideo.playClick()"> 25 <svg class="icon icon_pause" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg><svg class="icon icon_play" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg> 26</div> 27`; 28 var k = class extends HTMLElement { 29 constructor() { 30 super(...arguments); 31 this.template = $e; 32 this.canRegisterEvents = !0; 33 this.player = null; 34 this.onKeyDown = t => { 35 t.code !== "Space" || t.repeat || (t.preventDefault(), t.stopPropagation(), app.voyoVideo.showVideoControls(), app.voyoVideo.playClick()); 36 }; 37 } 38 connectedCallback() { 39 var _this$player; 40 this.innerHTML = this.template, this.canRegisterEvents && (this.player = this.closest(".player"), this.player && (this.player.tabIndex = 0), (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.addEventListener("keydown", this.onKeyDown)); 41 } 42 disconnectedCallback() { 43 var _this$player2; 44 (_this$player2 = this.player) !== null && _this$player2 !== void 0 && _this$player2.removeEventListener("keydown", this.onKeyDown), this.player = null; 45 } 46 }, 47 E = class extends k { 48 constructor() { 49 super(...arguments); 50 this.template = Ge; 51 this.canRegisterEvents = !1; 52 } 53 }; 54 var Oe = `<div id="rev" class="button"><svg class="icon" width="44" height="44" id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24"> <path d="M22.1,12.3c0,2.4-.9,4.6-2.6,6.3-1.7,1.7-3.9,2.6-6.3,2.7h-.1c-2.3,0-4.5-.9-6.2-2.5,0,0-.1-.1-.2-.2,0,0,0-.2,0-.3,0,0,0-.2,0-.3,0,0,0-.2.2-.2,0,0,.1-.1.2-.2,0,0,.2,0,.3,0,0,0,.2,0,.3,0,0,0,.2,0,.2.2,1.1,1,2.4,1.7,3.9,1.9,1.5.3,2.9,0,4.3-.5,1.3-.6,2.5-1.6,3.3-2.8.8-1.2,1.2-2.7,1.2-4.2,0-1.5-.5-2.9-1.3-4.1-.8-1.2-2-2.2-3.4-2.7-1.4-.6-2.9-.7-4.3-.4-1.4.3-2.8,1-3.8,2,0,0,0,0,0,0l-2.5,2.3h2.6c.2,0,.4,0,.5.2.1.1.2.3.2.5s0,.4-.2.5c-.1.1-.3.2-.5.2H3.3c-.2,0-.4,0-.5-.2-.1-.1-.2-.3-.2-.5v-4.5c0-.2,0-.4.2-.5.1-.1.3-.2.5-.2s.4,0,.5.2c.1.1.2.3.2.5v2.8l2.6-2.4c1.3-1.3,2.9-2.1,4.6-2.5,1.7-.3,3.6-.2,5.2.5,1.6.7,3,1.8,4,3.3,1,1.5,1.5,3.2,1.5,5Z"/> <path d="M16.2,12.1v.8c0,.4,0,.7-.1,1,0,.3-.2.5-.3.7-.1.2-.3.3-.5.4-.2,0-.4.1-.7.1s-.4,0-.6,0c-.2,0-.3-.1-.5-.2-.1-.1-.3-.2-.3-.4,0-.2-.2-.4-.2-.6,0-.2,0-.5,0-.8v-.8c0-.4,0-.7.1-1,0-.3.2-.5.3-.7.1-.2.3-.3.5-.4.2,0,.4-.1.7-.1s.4,0,.6,0c.2,0,.3.1.5.2.1.1.3.2.3.4,0,.2.2.4.2.6,0,.2,0,.5,0,.8ZM15.3,13.1v-1.1c0-.2,0-.4,0-.5,0-.1,0-.3,0-.4,0-.1,0-.2-.2-.2,0,0-.1-.1-.2-.1,0,0-.2,0-.3,0s-.2,0-.3,0c0,0-.2.1-.2.2,0,.1-.1.2-.1.4,0,.2,0,.4,0,.6v1.1c0,.2,0,.4,0,.5,0,.1,0,.3,0,.4,0,.1,0,.2.2.3,0,0,.1.1.2.1,0,0,.2,0,.3,0s.2,0,.3,0c0,0,.2-.1.2-.2,0-.1.1-.2.1-.4,0-.2,0-.4,0-.6Z"/>
54 <path d="M12.1,10.1v5h-.9v-3.9l-1.2.4v-.7l2-.7h.1Z"/> </svg></div> 55`; 56 var q = class extends HTMLElement { 57 constructor() { 58 super(...arguments); 59 this.player = null; 60 this.repeatCount = 0; 61 this.onKeyDown = t => { 62 var _this$throttledSeek; 63 t.key === this.key && (t.stopPropagation(), t.preventDefault(), t.repeat ? (_this$throttledSeek = this.throttledSeek) === null || _this$throttledSeek === void 0 ? void 0 : _this$throttledSeek.call(this) : (this.repeatCount = 0, this.seekFromKeyboard())); 64 }; 65 this.onKeyUp = t => { 66 t.key === this.key && (this.repeatCount = 0); 67 }; 68 this.seekFromKeyboard = () => { 69 var t = Math.min(60, 10 + Math.floor(this.repeatCount / 5) * 10); 70 this.repeatCount++, this.seek(t); 71 }; 72 } 73 connectedCallback() { 74 var _this$querySelector; 75 this.innerHTML = this.template, (_this$querySelector = this.querySelector(".button")) !== null && _this$querySelector !== void 0 && _this$querySelector.addEventListener("click", () => this.seek(10)), this.player = this.closest(".player"), this.player && (this.player.tabIndex = 0, this.throttledSeek || (this.throttledSeek = app.rateLimiter.throttle(this.seekFromKeyboard, 100)), this.player.addEventListener("keydown", this.onKeyDown), this.player.addEventListener("keyup", this.onKeyUp)); 76 } 77 disconnectedCallback() { 78 var _this$player3, _this$player4; 79 (_this$player3 = this.player) !== null && _this$player3 !== void 0 && _this$player3.removeEventListener("keydown", this.onKeyDown), (_this$player4 = this.player) !== null && _this$player4 !== void 0 && _this$player4.removeEventListener("keyup", this.onKeyUp), this.player = null; 80 } 81 }, 82 T = q; 83 var H = class extends T { 84 constructor() { 85 super(...arguments); 86 this.key = "ArrowLeft"; 87 this.template = Oe; 88 this.seekHandler = t => app.voyoVideo.revClick(t); 89 } 90 registerSeekHandler(t) { 91 this.seekHandler = t; 92 } 93 seek(t) { 94 this.seekHandler(t); 95 } 96 }, 97 Fe = H; 98 var Re = `<div id="ff" class="button"><svg class="icon" width="44" height="44" id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24"> <path d="M2.6,12.3c0,2.4.9,4.6,2.6,6.3,1.7,1.7,3.9,2.6,6.3,2.7h.1c2.3,0,4.5-.9,6.2-2.5,0,0,.1-.1.2-.2,0,0,0-.2,0-.3,0,0,0-.2,0-.3,0,0,0-.2-.2-.2,0,0-.1-.1-.2-.2,0,0-.2,0-.3,0,0,0-.2,0-.3,0,0,0-.2,0-.2.2-1.1,1-2.4,1.7-3.9,1.9-1.5.3-2.9,0-4.3-.5-1.3-.6-2.5-1.6-3.3-2.8-.8-1.2-1.2-2.7-1.2-4.2,0-1.5.5-2.9,1.3-4.1.8-1.2,2-2.2,3.4-2.7,1.4-.6,2.9-.7,4.3-.4,1.4.3,2.8,1,3.8,2,0,0,0,0,0,0l2.5,2.3h-2.6c-.2,0-.4,0-.5.2-.1.1-.2.3-.2.5s0,.4.2.5c.1.1.3.2.5.2h4.5c.2,0,.4,0,.5-.2.1-.1.2-.3.2-.5v-4.5c0-.2,0-.4-.2-.5-.1-.1-.3-.2-.5-.2s-.4,0-.5.2c-.1.1-.2.3-.2.5v2.8l-2.6-2.4c-1.3-1.3-2.9-2.1-4.6-2.5-1.7-.3-3.6-.2-5.2.5-1.6.7-3,1.8-4,3.3-1,1.5-1.5,3.2-1.5,5Z"/> <path d="M14.2,12.1v.8c0,.4,0,.7-.1,1,0,.3-.2.5-.3.7-.1.2-.3.3-.5.4-.2,0-.4.1-.7.1s-.4,0-.6,0c-.2,0-.3-.1-.5-.2-.1-.1-.3-.2-.3-.4,0-.2-.2-.4-.2-.6,0-.2,0-.5,0-.8v-.8c0-.4,0-.7.1-1,0-.3.2-.5.3-.7.1-.2.3-.3.5-.4.2,0,.4-.1.7-.1s.4,0,.6,0c.2,0,.3.1.5.2.1.1.3.2.3.4,0,.2.2.4.2.6,0,.2,0,.5,0,.8ZM13.3,13.1v-1.1c0-.2,0-.4,0-.5,0-.1,0-.3,0-.4,0-.1,0-.2-.2-.2,0,0-.1-.1-.2-.1,0,0-.2,0-.3,0s-.2,0-.3,0c0,0-.2.1-.2.2,0,.1-.1.2-.1.4,0,.2,0,.4,0,.6v1.1c0,.2,0,.4,0,.5,0,.1,0,.3,0,.4,0,.1,0,.2.2.3,0,0,.1.1.2.1,0,0,.2,0,.3,0s.2,0,.3,0c0,0,.2-.1.2-.2,0-.1.1-.2.1-.4,0-.2,0-.4,0-.6Z"/> <path d="M10.1,10.1v5h-.9v-3.9l-1.2.4v-.7l2-.7h.1Z"/> </svg></div> 99`; 100 var D = class extends T { 101 constructor() { 102 super(...arguments); 103 this.key = "ArrowRight"; 104 this.template = Re; 105 this.seekHandler = t => app.voyoVideo.ffClick(t); 106 } 107 registerSeekHandler(t) { 108 this.seekHandler = t; 109 } 110 seek(t) { 111 this.seekHandler(t); 112 } 113 }, 114 je = D; 115 var Qe = `<div class="volume__control button"> 116 <button class="volume__button"> 117 <svg class="volume__icon" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M163.51,24.81a8,8,0,0,0-8.42.88L85.25,80H40A16,16,0,0,0,24,96v64a16,16,0,0,0,16,16H85.25l69.84,54.31A8,8,0,0,0,168,224V32A8,8,0,0,0,163.51,24.81ZM152,207.64,92.91,161.69A7.94,7.94,0,0,0,88,160H40V96H88a7.94,7.94,0,0,0,4.91-1.69L152,48.36ZM208,104v48a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm32-16v80a8,8,0,0,1-16,0V88a8,8,0,0,1,16,0Z"/></svg> 118 <svg class="volume__icon-muted hidden" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M192,152V104a8,8,0,0,1,16,0v48a8,8,0,0,1-16,0Zm40-72a8,8,0,0,0-8,8v80a8,8,0,0,0,16,0V88A8,8,0,0,0,232,80ZM221.92,210.62a8,8,0,1,1-11.84,10.76L168,175.09V224a8,8,0,0,1-12.91,6.31L85.25,176H40a16,16,0,0,1-16-16V96A16,16,0,0,1,40,80H81.55L50.08,45.38A8,8,0,0,1,61.92,34.62ZM152,157.49,96.1,96H40v64H88a7.94,7.94,0,0,1,4.91,1.69L152,207.64ZM125.06,69.31l26.94-21v58.47a8,8,0,0,0,16,0V32a8,8,0,0,0-12.91-6.31l
118-39.85,31a8,8,0,0,0,9.82,12.63Z"/></svg> 119 </button> 120 121 <div class="volume__bar"> 122 <input class="volume__slider" type="range" min="0" max="1" step="0.01" value="0.75" /> 123 </div> 124</div> 125`; 126 var V = class extends HTMLElement { 127 constructor() { 128 super(...arguments); 129 this.button = null; 130 this.slider = null; 131 this.onMuteClick = t => { 132 t.preventDefault(); 133 var i = !config.videoMuted, 134 s = i ? 0 : config.videoVolume; 135 this.setVolume(s, i), this.saveVolume(s, i); 136 }; 137 this.onSliderInput = t => { 138 var i = t.target.value; 139 this.setVolume(+i); 140 }; 141 this.onSliderChange = t => { 142 var i = t.target.value; 143 this.saveVolume(+i); 144 }; 145 } 146 connectedCallback() { 147 var _this$button, _this$slider, _this$slider2; 148 this.innerHTML = Qe, this.button = this.querySelector(".volume__button"), this.slider = this.querySelector(".volume__slider"), (_this$button = this.button) !== null && _this$button !== void 0 && _this$button.addEventListener("click", this.onMuteClick), (_this$slider = this.slider) !== null && _this$slider !== void 0 && _this$slider.addEventListener("input", this.onSliderInput), (_this$slider2 = this.slider) === null || _this$slider2 === void 0 ? void 0 : _this$slider2.addEventListener("change", this.onSliderChange); 149 } 150 disconnectedCallback() { 151 var _this$button2, _this$slider3, _this$slider4; 152 (_this$button2 = this.button) !== null && _this$button2 !== void 0 && _this$button2.removeEventListener("click", this.onMuteClick), (_this$slider3 = this.slider) !== null && _this$slider3 !== void 0 && _this$slider3.removeEventListener("input", this.onSliderInput), (_this$slider4 = this.slider) === null || _this$slider4 === void 0 ? void 0 : _this$slider4.removeEventListener("change", this.onSliderChange); 153 } 154 setVolume(t) { 155 var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; 156 var s = Math.max(0, Math.min(1, t)), 157 r = i || s === 0; 158 app.voyoVideo.setVideoVolume(s, r), this.render(r ? 0 : s); 159 } 160 saveVolume(t) { 161 var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; 162 var s = Math.max(0, Math.min(1, t)), 163 r = i || s === 0; 164 config.videoMuted = r, r || (config.videoVolume = s), app.saveUserOptions(); 165 } 166 render(t) { 167 this.slider && (this.slider.value = t.toFixed(2), this.slider.style.setProperty("--volume-percent", `${t * 100}%`), t > 0 ? (app.html.show(".volume__icon"), app.html.hide(".volume__icon-muted")) : (app.html.hide(".volume__icon"), app.html.show(".volume__icon-muted"))); 168 } 169 }, 170 Ne = V; 171 var We = `<div class="flex items-center mb-32"> 172 <div class="progressbar"> 173 <input 174 class="timeline_progress" 175 type="range" 176 min="0" 177 max="1" 178 step="1" 179 value="0" 180 /> 181 <span class="catchup-ad-debug hidden" aria-hidden="true"></span> 182 <div id="timeline_preview" class="timeline_preview hidden"></div> 183 </div> 184 <div class="progressbar__time"> 185 <span class="time_now">00:00</span> / <span class="duration">00:00</span> 186 </div> 187</div> 188`; 189 var _ = class extends HTMLElement { 190 constructor() { 191 super(...arguments); 192 this.disabled = !1; 193 this._startTime = 0; 194 this._endTime = 0; 195 this._currentTime = 0; 196 this.progressBarElement = null; 197 this.currentTimeElement = null; 198 this.durationElement = null; 199 this.showDuration = !0; 200 this.thumbnailListenersRegistered = !1; 201 this.seekHandler = t => app.voyoVideo.setVideoPlayback(t); 202 this.seekFromInput = () => { 203 if (this.disabled || !this.progressBarElement) return; 204 var t = Number(this.progressBarElement.value); 205 this.seekHandler(t); 206 }; 207 this.updateProgressFromInput = () => { 208 if (this.disabled || !this.progressBarElement || !this.currentTimeElement) return; 209 var t = Number(this.progressBarElement.value), 210 i = this._endTime - this._startTime, 211 s = i > 0 ? (t - this._startTime) / i : 0; 212 this.progressBarElement.style.setProperty("--timeline-percent", s * 100 + "%"), this.currentTimeElement.textContent = this.formatTime(t); 213 }; 214 this.showThumbnailFromPointer = t => { 215 if (!this.progressBarElement) return; 216 var i = this.progressBarElement.getBoundingClientRect(), 217 s = getComputedStyle(this.progressBarElement), 218 r = Number.parseFloat(s.getPropertyValue("--timeline-thumb-width")) || 16, 219 n = i.left + r / 2, 220 a = i.width - r, 221 l = Math.max(0, Math.min((t.clientX - n) / a, 1)), 222 d = this._startTime + (this._endTime - this._startTime) * l, 223 m = Math.min(Math.max(t.clientX - i.left, 0), i.width) / i.width; 224 app.voyoVideo.showThumbnailPreview(Math.round(d), m); 225 }; 226 this.hideThumbnail = () => { 227 app.voyoVideo.hideThumbnailPreview(); 228 }; 229 } 230 connectedCallback() { 231 var _this$progressBarElem, _this$progressBarElem2; 232 this.innerHTML = We, this.progressBarElement = this.querySelector(".timeline_progress"), this.progressBarElement && (this.progressBarElement.disabled = this.disabled), this.currentTimeElement = this.querySelector(".time_now"), this.durationElement = this.querySelector(".duration"), this.debouncedSeek || (this.debouncedSeek = app.rateLimiter.debounce(this.seekFromInput, 100)), (_this$progressBarElem = this.progressBarElement) !== null && _this$progressBarElem !== void 0 && _this$progressBarElem.addEventListener("input", this.debouncedSeek), (_this$progressBarElem2 = this.progressBarElement) === null || _this$progressBarElem2 === void 0 ? void 0 : _this$progressBarElem2.addEventListener("input", this.updateProgressFromInput); 233 } 234 disconnectedCallback() { 235 var _this$progressBarElem3, _this$progressBarElem4, _this$progressBarElem5, _this$progressBarElem6; 236 this.debouncedSeek && (_this$progressBarElem3 = this.progressBarElement) !== null && _this$progressBarElem3 !== void 0 && _this$progressBarElem3.removeEventListener("input", this.debouncedSeek), (_this$progressBarElem4 = this.progressBarElement) !== null && _this$progressBarElem4 !== void 0 && _this$progressBarElem4.removeEventListener("input", this.updateProgressFromInput), this.thumbnailListenersRegistered && ((_this$progressBarElem5 = this.progressBarElement) !== null && _this$progressBarElem5 !== void 0 && _this$progressBarElem5.removeEventListener("mousemove", this.showThumbnailFromPointer), (_this$progressBarElem6 = this.progressBarElement) === null || _this$progressBarElem6 === void 0 ? void 0 : _this$progressBarElem6.removeEventListener("mouseleave", this.hideThumbnail)); 237 } 238 getProgressBarElement() { 239 return this.progressBarElement; 240 } 241 setDisabled(t) { 242 this.progressBarElement && (this.progressBarElement.disabled = t), this.disabled = t; 243 } 244 setDurationDisplay(t) { 245 this.durationElement && (this.showDuration = t, this.durationElement.textContent = t ? this.formatTime(this._endTime) : "--:--"); 246 } 247 registerThumbnailPreview() { 248 var _this$progressBarElem7, _this$progressBarElem8; 249 (_this$progressBarElem7 = this.progressBarElement) !== null && _this$progressBarElem7 !== void 0 && _this$progressBarElem7.addEventListener("mousemove", this.showThumbnailFromPointer), (_this$progressBarElem8 = this.progressBarElement) !== null && _this$progressBarElem8 !== void 0 && _this$progressBarElem8.addEventListener("mouseleave", this.hideThumbnail), this.thumbnailListenersRegistered = !0; 250 } 251 registerSeekHandler(t) { 252 this.seekHandler = t; 253 } 254 setRange(t, i, s) { 255 this._startTime = this.normaliseTime(t), this._endTime = Math.max(this._startTime, this.normaliseTime(s)), this._currentTime = Math.max(this._startTime, Math.min(this.normaliseTime(i), this._endTime)), this.render(); 256 } 257 render() { 258 if (!this.progressBarElement || !this.currentTimeElement || !this.durationElement) return; 259 var t = this._endTime - this._startTime, 260 i = t > 0 ? (this._currentTime - this._startTime) / t : 0; 261 this.progressBarElement.min = String(this._startTime), this.progressBarElement.max = String(this._endTime), this.progressBarElement.value =
261String(this._currentTime), this.progressBarElement.style.setProperty("--timeline-percent", `${i * 100}%`), this.currentTimeElement.textContent = this.formatTime(this._currentTime), this.showDuration && (this.durationElement.textContent = this.formatTime(this._endTime)); 262 } 263 normaliseTime(t) { 264 return Math.max(0, t) || 0; 265 } 266 formatTime(t) { 267 var i = Math.floor(t), 268 s = Math.floor(i / 3600), 269 r = Math.floor(i % 3600 / 60), 270 n = i % 60; 271 return s > 0 ? s + ":" + this.pad2(r) + ":" + this.pad2(n) : this.pad2(r) + ":" + this.pad2(n); 272 } 273 pad2(t) { 274 return ("0" + t).slice(-2); 275 } 276 }, 277 ze = _; 278 var Je = `<div class="relative group"> 279 <!-- ikona podnapisov --> 280 <button class="button"> 281 <svg class="icon" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192ZM48,136a8,8,0,0,1,8-8H72a8,8,0,0,1,0,16H56A8,8,0,0,1,48,136Zm160,0a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16h96A8,8,0,0,1,208,136Zm-48,32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h96A8,8,0,0,1,160,168Zm48,0a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16h16A8,8,0,0,1,208,168Z"/></svg> 282 </button> 283 284 <!-- dropdown seznam podnapisov; the list is injected from the element's children --> 285 <div class="popup_wrapper bottom-0 right-[4rem] xl:right-[7rem] top-[unset]"> 286 <div class="popup"> 287 <slot></slot> 288 </div> 289 </div> 290</div> 291`; 292 var x = class extends HTMLElement { 293 connectedCallback() { 294 this.innerHTML = Je.replace("<slot></slot>", () => this.innerHTML), this.querySelectorAll(".subtitles__list").forEach(e => e.addEventListener("click", () => this.toggleSubtitle(e.id))); 295 } 296 toggleSubtitle(e) { 297 config.showSubtitles = app.voyoVideo.toggleVideoSubtitle(e), app.saveUserOptions(); 298 } 299 }, 300 Ke = x; 301 var Xe = `<button class="button"> 302 <svg class="icon" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="168 48 208 48 208 88" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><polyline points="88 208 48 208 48 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><polyline points="208 168 208 208 168 208" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><polyline points="48 88 48 48 88 48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg> 303</button> 304`; 305 var U = class extends HTMLElement { 306 connectedCallback() { 307 var _this$querySelector2; 308 this.innerHTML = Xe; 309 var e = this.getAttribute("target") || void 0; 310 (_this$querySelector2 = this.querySelector("button")) === null || _this$querySelector2 === void 0 || _this$querySelector2.addEventListener("click", t => app.voyoVideo.toggleFullscreen(t, e)); 311 } 312 }, 313 Ye = U; 314 var Ze = `<span class="player__close"> 315 <a class="button button-transparent p-0 w-42 h-42" href="#"><svg class="icon" width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg></a> 316</span> 317`; 318 var B = class extends HTMLElement { 319 connectedCallback() { 320 var _this$querySelector3, _this$querySelector4; 321 this.innerHTML = Ze, (_this$querySelector3 = this.querySelector("a")) !== null && _this$querySelector3 !== void 0 && _this$querySelector3.setAttribute("href", this.getAttribute("href") || "#"), this.className && ((_this$querySelector4 = this.querySelector("span")) === null || _this$querySelector4 === void 0 ? void 0 : _this$querySelector4.classList.add(...Array.from(this.classList))); 322 } 323 }, 324 et = B; 325 var $ = class extends HTMLElement { 326 constructor() { 327 super(...arguments); 328 this.form = null; 329 this.length = 4; 330 this.inputs = []; 331 this.required = null; 332 this.allowedCharacters = /^[0-9A-Za-z]+$/; 333 } 334 connectedCallback() { 335 this.form = this.closest("form"), this.length = +(this.getAttribute("length") || 4), this.required = this.getAttribute("data-required"), this.render(); 336 } 337 get value() { 338 return this.inputs.map(t => t.value).join(""); 339 } 340 set value(t) { 341 var i = t.slice(0, this.length).toUpperCase();
342 this.inputs.forEach((s, r) => { 343 s.value = i[r] || ""; 344 }); 345 } 346 focus() { 347 var _this$inputs$; 348 (_this$inputs$ = this.inputs[0]) === null || _this$inputs$ === void 0 || _this$inputs$.focus(); 349 } 350 render() { 351 this.innerHTML = "", this.hiddenInput = document.createElement("input"), this.hiddenInput.type = "hidden", this.hiddenInput.name = this.getAttribute("name") || "code", this.appendChild(this.hiddenInput), this.inputs = Array.from({ 352 length: this.length 353 }, (t, i) => { 354 var s = document.createElement("input"); 355 return s.type = "text", s.maxLength = 1, this.required !== null && s.setAttribute("data-required", this.required), s.addEventListener("keydown", r => this.onKeydown(r, i)), s.addEventListener("input", () => this.onInput(s, i)), s.addEventListener("paste", r => this.onPaste(r)), this.appendChild(s), s; 356 }); 357 } 358 onKeydown(t, i) { 359 var s = t.target; 360 if (t.key === "Backspace" || t.key === "Delete") { 361 if (t.preventDefault(), s.value === "") { 362 var r = this.inputs[i - 1]; 363 r && (r.value = "", r.focus()); 364 } else s.value = ""; 365 this.updateHiddenInput(), this.dispatchInput(); 366 return; 367 } 368 if (t.key === "ArrowLeft") { 369 var _this$inputs; 370 t.preventDefault(), (_this$inputs = this.inputs[i - 1]) === null || _this$inputs === void 0 ? void 0 : _this$inputs.focus(); 371 return; 372 } 373 if (t.key === "ArrowRight") { 374 var _this$inputs2; 375 t.preventDefault(), (_this$inputs2 = this.inputs[i + 1]) === null || _this$inputs2 === void 0 ? void 0 : _this$inputs2.focus(); 376 return; 377 } 378 if (t.key === "Enter") { 379 t.preventDefault(), this.checkAndSubmit(); 380 return; 381 } 382 if (t.key.length === 1 && this.allowedCharacters.test(t.key) && !t.ctrlKey && !t.metaKey && !t.altKey) { 383 var _this$inputs3; 384 t.preventDefault(), s.value = t.key.toUpperCase(), (_this$inputs3 = this.inputs[i + 1]) !== null && _this$inputs3 !== void 0 && _this$inputs3.focus(), this.updateHiddenInput(), this.dispatchInput(), this.checkAndSubmit(); 385 return; 386 } 387 } 388 onInput(t, i) { 389 var _this$inputs4; 390 if (!this.allowedCharacters.test(t.value)) { 391 t.value = ""; 392 return; 393 } 394 t.value = t.value.toUpperCase(), (_this$inputs4 = this.inputs[i + 1]) !== null && _this$inputs4 !== void 0 && _this$inputs4.focus(), this.updateHiddenInput(), this.dispatchInput(), this.checkAndSubmit(); 395 } 396 onPaste(t) { 397 var _t$clipboardData, _this$inputs5; 398 t.preventDefault(); 399 var i = ((_t$clipboardData = t.clipboardData) === null || _t$clipboardData === void 0 ? void 0 : _t$clipboardData.getData("text").trim()) || ""; 400 !this.allowedCharacters.test(i) || i.length !== this.length || (this.value = i, (_this$inputs5 = this.inputs[this.length - 1]) !== null && _this$inputs5 !== void 0 && _this$inputs5.focus(), this.updateHiddenInput(), this.dispatchInput(), this.checkAndSubmit()); 401 } 402 updateHiddenInput() { 403 this.hiddenInput.value = this.value; 404 } 405 dispatchInput() { 406 this.dispatchEvent(new Event("input", { 407 bubbles: !0 408 })); 409 } 410 checkAndSubmit() { 411 var _this$form; 412 this.value.length === this.length && ((_this$form = this.form) === null || _this$form === void 0 ? void 0 : _this$form.requestSubmit()); 413 } 414 }, 415 tt = $; 416 var it = `<label class="flex gap-16 items-center mt-16 cursor-pointer"> 417 <input type="checkbox" class="mailing-unsubscribe__checkbox"> 418 <span class="text-14 !font-normal leading-[1.4]">ÐÑкам да Ñе оÑпиÑа Ð¾Ñ Ð¿Ð¾Ð»ÑÑаванеÑо на бÑлеÑина на VOYO.</span> 419</label> 420`; 421 var P = class extends HTMLElement { 422 connectedCallback() { 423 var _app$html$q; 424 app.html.writeHTML(this, it), (_app$html$q = app.html.q("input", this)) !== null && _app$html$q !== void 0 && _app$html$q.addEventListener("change", t => this.onChange(t)), this.syncDisabledAttribute(); 425 } 426 attributeChangedCallback() { 427 this.syncDisabledAttribute(); 428 } 429 syncDisabledAttribute() { 430 var e = app.html.q("input", this); 431 e && (this.hasAttribute("disabled") ? app.html.buttonDisable(e) : app.html.buttonEnable(e)); 432 } 433 onChange(e) { 434 var i = app.html.isChecked(e.target) ? Math.floor(new Date().getTime() / 1e3) : 0; 435 app.gql.userMeta("noMailingSubscribe", i.toString()); 436 } 437 }; 438 P.observedAttributes = ["disabled"]; 439 var st = P; 440 var rt = `<button type="submit"><span></span></button> 441`; 442 var S = class extends HTMLElement { 443 constructor() { 444 super(...arguments); 445 this.content = ""; 446 } 447 connectedCallback() { 448 this.content = this.innerHTML.trim(), app.html.writeHTML(this, rt), this.button = app.html.q("button", this), this.button.className = this.className, this.className = "", this.id && (this.button.id = this.id, this.removeAttribute("id")), this.syncText(), this.syncDisabled(); 449 } 450 attributeChangedCallback() { 451 this.button && (this.syncText(), this.syncDisabled()); 452 } 453 get disabled() { 454 return this.hasAttribute("disabled"); 455 } 456 set disabled(t) { 457 t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"); 458 } 459 syncText() { 460 var t = app.html.q("span", this.button); 461 if (t) { 462 if (this.content) { 463 t.innerHTML = this.content; 464 return; 465 } 466 t.textContent = this.getAttribute("text") || ""; 467 } 468 } 469 syncDisabled() { 470 this.button.disabled = this.hasAttribute("disabled") || this.hasAttribute("loading"); 471 } 472 }; 473 S.observedAttributes = ["text", "disabled", "loading"]; 474 var ot = S; 475 var nt = `<div class="button button-text button-text__right [.epg__player:not(.live)_&]:hidden"><?xml version="1.0" encoding="UTF-8"?> <svg class="icon mr-12" width="44" height="44" id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 256 256"> <!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) --> <defs> <style> .st0 { fill: none; } </style> </defs> <rect class="st0" y="0" width="256" height="256"/> <path d="M39.9,200c-4.2,0-8.1-1.6-11.1-4.6-3-3-4.7-7-4.8-11.2v-112.4s0,0,0,0c0-3,.9-5.9,2.5-8.5,4.7-7.4,14.6-9.5,22-4.8l88.2,56.1c1.9,1.2,3.6,2.9,4.9,4.9,4.7,7.4,2.5,17.1-4.9,21.8l-88.2,56.1c-2.5,1.6-5.4,2.5-8.4,2.5h-.1ZM40,72.1v111.8l87.8-55.9-87.8-55.9Z"/> <path d="M143.9,200c-4.2,0-8.1-1.6-11.1-4.6-3-3-4.7-7-4.8-11.2v-112.4s0,0,0,0c0-3,.9-5.9,2.5-8.5,2.3-3.6,5.8-6,10-7,4.2-.9,8.4-.1,12,2.2l88.2,56.1c1.9,1.2,3.6,2.9,4.9,4.9,4.7,7.4,2.5,17.1-4.9,21.8l-88.2,56.1c-2.5,1.6-5.4,2.5-8.4,2.5h-.1ZM144,72.1v111.8l87.8-55.9-87.8-55.9Z"/> <path d="M240,113.7v81.4c0,3.4,3.6,6.1,8,6.1s8-2.7,8-6.1V60.9c0-3.4-3.6-6.1-8-6.1s-8,2.7-8,6.1v52.8"/> </svg><span><div class="label label-live">Ðа живо</div></span></div> 476`; 477 var G = class extends HTMLElement { 478 connectedCallback() { 479 var _this$querySelector5; 480 this.innerHTML = nt, (_this$querySelector5 = this.querySelector(".button")) === null || _this$querySelector5 === void 0 ? void 0 : _this$querySelector5.addEventListener("click", () => app.voyoVideo.setVideoPlayback("end")); 481 } 482 }, 483 at = G; 484 function ks() { 485 var o = document.location.pathname; 486 customElements.define("submit-button", ot), (o.includes(config.routes.content) || o.startsWith(config.routes.catch_up) || o.startsWith(config.routes.profile_5ka)) && (customElements.define("voyo-play", k), customElements.define("voyo-play-overlay", E), customElements.define("voyo-rev", Fe), customElements.define("voyo-ff", je), customElements.define("voyo-live", at), customElements.define("voyo-volume", Ne), customElements.define("voyo-timeline", ze), customElements.define("voyo-subtitles", Ke), customElements.define("voyo-fullscreen", Ye), customElements.define("voyo-close", et)), (o.startsWith(config.routes.login) || o.startsWith(config.routes.registration)) && customElements.define("code-input", tt), (o.startsWith(config.routes.activation_credit_card) || o.startsWith(config.routes.activation_step3) || o.startsWith(config.routes.activation_provider) || o.startsWith(config.routes.activation_code) || o.startsWith(config.routes.settings)) && customElements.define("voyo-mailing-unsubscribe", st); 487 } 488 var lt = ks; 489 var O = class { 490 constructor(e) { 491 this.id = e.id || 0, this.email = e.email || "", this.avatar = e.avatar || "", this.nickname = e.nickname || "", this.deviceId = e.deviceId || 0, this.profileId = e.profileId || 0, this.profileType = e.profileType || "", this.isSubscribed = e.isSubscribed || !1, this.token = e.token || "", this.status = e.status || 0; 492 } 493 get hash() { 494 return this.id ? "#" + this.id + "#" + this.profileId + "#" + this.profileType + "#" : ""; 495 } 496 }, 497 u = O; 498 var F = class { 499 constructor(e) { 500 this.ip = (e === null || e === void 0 ? void 0 : e.ip) || "", this.countryCode = (e === null || e === void 0 ? void 0 : e.countryCode) || "", this.countryName = (e === null || e === void 0 ? void 0 : e.countryName) || ""; 501 } 502 }, 503 dt = F; 504 var R = class { 505 constructor(e) { 506 this.url = e.url || "", this.info = e.info || "", this.infoCode = +(e.infoCode || 0), this.license = e.license || ""; 507 } 508 }, 509 mt = R; 510 var y = class { 511 constructor(e) { 512 var _e$groups; 513 this.groups = e === null || e === void 0 || (_e$groups = e.groups) === null || _e$groups === void 0 ? void 0 : _e$groups.map(t => new j(t)); 514 } 515 groupItems(e) { 516 var _this$groups; 517 var t = (_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.find(i => i.id === e); 518 return t ? t.items : []; 519 } 520 remove(e, t) { 521 var _this$groups2; 522 var i = (_this$groups2 = this.groups) === null || _this$groups2 === void 0 ? void 0 : _this$groups2.find(s => s.id === e); 523 i && (i.items = i.items.filter(s => s.entityId.toString() !== t.toString())); 524 } 525 add(e, t) { 526 var _this$groups3; 527 var i = (_this$groups3 = this.groups) === null || _this$groups3 === void 0 ? void 0 : _this$groups3.find(s => s.id === e); 528 i && i.append(t); 529 } 530 }, 531 j = class { 532 constructor(e) { 533 this.id = e.id, this.items = e.items.map(t => new p(t)); 534 } 535 append(e) { 536 var t = this.items.findIndex(i => i.entityId === e.entityId); 537 if (t === -1 && e.voyokey && (t = this.items.findIndex(i => i.voyokey === e.voyokey)), t !== -1) { 538 this.items[t] = e; 539 return; 540 } 541 this.items.push(e); 542 } 543 }, 544 p = class { 545 constructor(e) { 546 var _e$data, _e$data2; 547 this.voyokey = (e === null || e === void 0 ? void 0 : e.categoryId) || (e === null || e === void 0 ? void 0 : e.voyokey) || "", this.entity
547Id = (e === null || e === void 0 ? void 0 : e.entityId) || null, this.percent = (e === null || e === void 0 || (_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.percent) || (e === null || e === void 0 ? void 0 : e.percent) || 0, this.duration = (e === null || e === void 0 || (_e$data2 = e.data) === null || _e$data2 === void 0 ? void 0 : _e$data2.duration) || (e === null || e === void 0 ? void 0 : e.duration) || 0, (e === null || e === void 0 ? void 0 : e.nextEntityId) !== void 0 && (this.nextEntityId = e.nextEntityId), !this.voyokey && this.entityId && (this.voyokey = this.entityId.toString()), !this.entityId && this.voyokey && (this.entityId = +this.voyokey.replace("CAT_", "")); 548 } 549 get percent10() { 550 return Math.ceil(this.percent / 10) * 10; 551 } 552 }, 553 M = y; 554 var Q = class { 555 constructor(e) { 556 this.profileId = (e === null || e === void 0 ? void 0 : e.profileId) || 0, this.visitorId = (e === null || e === void 0 ? void 0 : e.visitorId) || 0, this.name = (e === null || e === void 0 ? void 0 : e.name) || "", this.type = (e === null || e === void 0 ? void 0 : e.type) || "", this.avatar = (e === null || e === void 0 ? void 0 : e.avatar) || "", this.url = (e === null || e === void 0 ? void 0 : e.url) || ""; 557 } 558 }, 559 g = Q; 560 var N = class o extends Error { 561 constructor(t) { 562 var _t$; 563 var i = ((_t$ = t[0]) === null || _t$ === void 0 || (_t$ = _t$.extensions) === null || _t$ === void 0 ? void 0 : _t$.message) || t[0] || {}; 564 super(i.tMessage || i.message || "GraphQL Error"); 565 this.tMessage = ""; 566 this.code = ""; 567 this.status = 0; 568 this.name = "GqlError", this.errors = t, this.code = i.code || "", this.status = i.status || 0, Object.setPrototypeOf(this, o.prototype); 569 } 570 }, 571 W = N; 572 var z = class { 573 constructor(e) { 574 this.code = (e === null || e === void 0 ? void 0 : e.code) || "", this.canSkipDummyVisitorScreen = (e === null || e === void 0 ? void 0 : e.canSkipDummyVisitorScreen) || 0; 575 } 576 }, 577 ht = z; 578 var ct = (o, e) => "?query=onl_all_full_loginInfo(siteId:" + e + ")&rnd=" + o.substring(o.length - 12), 579 ut = (o, e) => ({ 580 query: `query loginInfo($token: String! $siteId: Int!) 581 { 582 loginInfo(token: $token, siteId: $siteId) 583 { 584 id token email avatar nickname 585 deviceId profileId status subscriptionUntil 586 profileType isSubscribed 587 } 588 }`, 589 variables: { 590 token: o, 591 siteId: e 592 } 593 }), 594 pt = (o, e, t) => ({ 595 query: `query loginUser($email: String! $siteId: Int! $password: String!) 596 { 597 login(email: $email, siteId: $siteId, password: $password) 598 { 599 id token email avatar nickname 600 deviceId profileId status subscriptionUntil 601 profileType isSubscribed 602 } 603 }`, 604 variables: { 605 email: o, 606 siteId: t, 607 password: e 608 } 609 }), 610 gt = (o, e, t) => ({ 611 query: `query LoginDevice($deviceName: String!, $deviceFamily: String!, $siteId: Int) 612 { 613 loginDevice(deviceName: $deviceName, deviceFamily: $deviceFamily, siteId: $siteId) 614 { 615 id token email avatar nickname 616 deviceId profileId status subscriptionUntil 617 profileType isSubscribed 618 } 619 }`, 620 variables: { 621 deviceName: o, 622 deviceFamily: e, 623 siteId: t 624 } 625 }), 626 vt = () => ({ 627 query: `query logoutJwt 628 { 629 logoutJwt 630 { 631 status 632 } 633 }`, 634 variables: {} 635 }), 636 ft = o => ({ 637 query: `query loginProfile($profileId: Int!) 638 { 639 loginProfile(profileId: $profileId) 640 { 641 id token email avatar nickname 642 deviceId profileId status subscriptionUntil 643 profileType isSubscribed 644 } 645 }`, 646 variables: { 647 profileId: o 648 } 649 }), 650 yt = (o, e, t, i, s, r, n, a, l, d, m) => ({ 651 query: `mutation register($email: String! $password: String! $nickname: String! $gender: String! $siteId: Int! $withLogin: Boolean $company_name: String $company_vat: String $tel: String $telTermsAgreed: Boolean! $profilingTermsAgreed: Boolean!) 652 { 653 register( 654 email: $email 655 password: $password 656 nickname: $nickname 657 gender: $gender 658 withLogin: $withLogin 659 siteId: $siteId 660 company_name: $company_name 661 company_vat: $company_vat 662 tel: $tel 663 telTermsAgreed: $telTermsAgreed 664 profilingTermsAgreed: $profilingTermsAgreed 665 ) { 666 id token email avatar nickname 667 deviceId profileId status subscriptionUntil 668 profileType isSubscribed 669 } 670 }`, 671 variables: { 672 email: o, 673 password: e, 674 nickname: t, 675 gender: i, 676 siteId: s, 677 withLogin: r, 678 company_name: n, 679 company_vat: a, 680 tel: l, 681 telTermsAgreed: d, 682 profilingTermsAgreed: m 683 } 684 }), 685 bt = (o, e, t, i) => ({ 686 query: `mutation registerEmailOnly($email: String! $siteId: Int! $mailingId: Int! $sendUnsubscribeEmail: Boolean!) 687 { 688 registerEmailOnly(email: $email, siteId: $siteId, mailingId: $mailingId, sendUnsubscribeEmail: $sendUnsubscribeEmail) 689 { 690 email 691 } 692 }`, 693 variables: { 694 email: o, 695 siteId: e, 696 mailingId: t, 697 sendUnsubscribeEmail: i 698 } 699 }), 700 kt = (o, e, t) => ({ 701 query: `query LinkDeviceToUser($deviceFamily: String! $deviceName: String! $deviceModel: String!) 702 { 703 linkDeviceToUser( 704 deviceFamily: $deviceFamily 705 deviceName: $deviceName 706 deviceModel: $deviceModel 707 ) { 708 id token email avatar nickname 709 deviceId profileId status subscriptionUntil 710 profileType isSubscribed 711 } 712 }`, 713 variables: { 714 deviceFamily: o, 715 deviceName: e, 716 deviceModel: t 717 } 718 }), 719 wt = (o, e) => ({ 720 query: `mutation newPassword($password: String!, $token: String!) 721 { 722 newPassword(password: $password, token: $token) { 723 token email avatar nickname 724 deviceId profileId status subscriptionUntil 725 profileType isSubscribed 726 } 727 }`, 728 variables: { 729 password: o, 730 token: e 731 } 732 }), 733 Et = (o, e) => ({ 734 query: `mutation sendVoyoLoginToken($email: String! $emailDesign: String!) 735 { 736 sendVoyoLoginToken(email: $email, emailDesign: $emailDesign) 737 { 738 status 739 } 740 }`, 741 variables: { 742 email: o, 743 emailDesign: e 744 } 745 }), 746 Tt = (o, e) => ({ 747 query: `mutation userMeta($key: String! $value: String!) 748 { 749 userMeta(key: $key value: $value) { 750 id 751 } 752 }`, 753 variables: { 754 key: o, 755 value: e 756 } 757 }); 758 var Pt = (o, e, t) => ({ 759 query: `query VideoUrlV2($id: Int!, $siteId: Int ${t ? ", $isSafari: Boolean" : ""}) 760 { 761 videoUrlV2 ( 762 id: $id 763 siteId: $siteId 764 ${t ? "isSafari: $isSafari" : ""} 765 ) { 766 url info infoCode license 767 } 768 }`, 769 variables: _objectSpread({ 770 id: o, 771 siteId: e 772 }, t && { 773 isSafari: t 774 }) 775 }), 776 Lt = (o, e, t) => ({ 777 query: `query EpgHlsUrl($channel: String! $chunkStart: Int! $chunkEnd: Int!) 778 { 779 epgHlsUrl ( 780 channel: $channel 781 chunkStart: $chunkStart 782 chunkEnd: $chunkEnd 783 ) { 784 url breaks { from to } 785 } 786 }`, 787 variables: { 788 channel: o, 789 chunkStart: e, 790 chunkEnd: t 791 } 792 }), 793 St = (o, e, t, i) => ({ 794 query: `query EpgHlsUrlV2($channel: String! $chunkStart: Int! $chunkEnd: Int! ${i ? ", $isSafari: Boolean" : ""}) 795 { 796 epgHlsUrlV2 ( 797 channel: $channel 798 chunkStart: $chunkStart 799 chunkEnd: $chunkEnd 800 ${i ? "isSafari: $isSafari" : ""} 801 ) { 802 url breaks { from to } license 803 } 804 }`, 805 variables: _objectSpread({ 806 channel: o, 807 chunkStart: e, 808 chunkEnd: t 809 }, i && {
810 isSafari: i 811 }) 812 }); 813 var Mt = (o, e) => ({ 814 query: `mutation commentVote($articleId: Int! $commentId: String!) 815 { 816 commentVote(itemType: ARTICLE itemId: $articleId commentId: $commentId direction: UP) { 817 id 818 } 819 }`, 820 variables: { 821 articleId: o, 822 commentId: e 823 } 824 }), 825 Ct = (o, e) => ({ 826 query: `mutation commentVote($articleId: Int! $commentId: String!) 827 { 828 commentVote(itemType: ARTICLE itemId: $articleId commentId: $commentId direction: DOWN) { 829 id 830 } 831 }`, 832 variables: { 833 articleId: o, 834 commentId: e 835 } 836 }), 837 It = (o, e, t) => ({ 838 query: `mutation commentAdd($articleId: Int! $replyTo: String $body: String!) 839 { 840 commentAdd(itemType: ARTICLE itemId: $articleId replyTo: $replyTo body: $body) { 841 id 842 } 843 }`, 844 variables: { 845 articleId: o, 846 replyTo: t, 847 body: e 848 } 849 }); 850 var At = o => ({ 851 query: `mutation jokeVote($id: Int!) 852 { 853 jokeVote(id: $id direction: UP) { 854 id count:upCount 855 } 856 }`, 857 variables: { 858 id: o 859 } 860 }), 861 qt = o => ({ 862 query: `mutation jokeVote($id: Int!) 863 { 864 jokeVote(id: $id direction: DOWN) { 865 id count:downCount 866 } 867 }`, 868 variables: { 869 id: o 870 } 871 }); 872 var Ht = (o, e, t) => ({ 873 query: `mutation pollVote($pollId: Int! $answerId: Int! $gender: String) 874 { 875 pollVote(pollId: $pollId answerId: $answerId gender: $gender) { 876 id 877 } 878 }`, 879 variables: { 880 pollId: o, 881 answerId: e, 882 gender: t 883 } 884 }); 885 var Dt = (o, e) => ({ 886 query: `mutation recipeBookmarkDelete($groupId: String! $itemId: String!) 887 { 888 recipeBookmarkDelete(groupId: $groupId, itemId: $itemId) { 889 __typename 890 } 891 }`, 892 variables: { 893 groupId: o, 894 itemId: e 895 } 896 }), 897 Vt = o => ({ 898 query: `mutation recipeBookmarkGroupDelete($groupId: String!) 899 { 900 recipeBookmarkGroupDelete(groupId: $groupId) { 901 __typename 902 } 903 }`, 904 variables: { 905 groupId: o 906 } 907 }), 908 _t = (o, e) => ({ 909 query: `mutation recipeBookmarkGroupAdd($groupId: String! $name: String!) 910 { 911 recipeBookmarkGroupAdd(groupId: $groupId, name: $name) { 912 __typename 913 } 914 }`, 915 variables: { 916 groupId: o, 917 name: e 918 } 919 }), 920 xt = (o, e) => ({ 921 query: `mutation recipeBookmarkGroupAdd($groupId: String! $itemId: String!) 922 { 923 recipeBookmarkGroupAdd(groupId: $groupId, itemId: $itemId) { 924 __typename 925 } 926 }`, 927 variables: { 928 groupId: o, 929 itemId: e 930 } 931 }), 932 Ut = () => ({ 933 query: `query voyoBookmarks 934 { 935 voyoBookmark { 936 groups { 937 id name 938 items { 939 entityId categoryId 940 data { percent duration } 941 } 942 } 943 } 944 }`, 945 variables: {} 946 }), 947 Bt = (o, e) => ({
948 query: `mutation voyoBookmarkDelete($groupId: String! $itemId: String!) 949 { 950 voyoBookmarkDelete(groupId: $groupId, itemId: $itemId) { 951 __typename 952 } 953 }`, 954 variables: { 955 groupId: o, 956 itemId: e 957 } 958 }), 959 $t = function $t(o, e) { 960 var t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; 961 var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; 962 return { 963 query: `mutation voyoBookmarkAdd($groupId: String! $itemId: String! $percent: Int, $duration: Int) 964 { 965 voyoBookmarkAdd(groupId: $groupId, itemId: $itemId, returnAllBookmarks: false, percent: $percent, duration: $duration) { 966 __typename 967 } 968 }`, 969 variables: { 970 groupId: o, 971 itemId: e, 972 percent: t, 973 duration: i 974 } 975 }; 976 }; 977 var Gt = o => ({ 978 query: `query voyoCategory($id: Int!) 979 { 980 voyoCategory (id: $id) { 981 id title url 982 meta {rootCategoryId} 983 } 984 }`, 985 variables: { 986 id: o 987 } 988 }); 989 var Ot = o => ({ 990 query: `query video($id: Int!) 991 { 992 video (id: $id) { 993 id title url 994 meta {rootCategoryId categoryId} 995 } 996 }`, 997 variables: { 998 id: o 999 } 1000 }); 1001 var Ft = o => ({ 1002 query: `query liveStream($id: Int!) 1003 { 1004 liveStream (id: $id) { 1005 id title url 1006 } 1007 }`, 1008 variables: { 1009 id: o 1010 } 1011 }), 1012 Rt = o => ({ 1013 query: `mutation streamReminder($id: Int!) 1014 { 1015 streamReminder (id: $id) { 1016 message 1017 } 1018 }`, 1019 variables: { 1020 id: o 1021 } 1022 }); 1023 var jt = () => ({ 1024 query: `query userProfiles 1025 { 1026 userProfiles { 1027 profiles { 1028 profileId visitorId type name avatar url 1029 } 1030 } 1031 }`, 1032 variables: {} 1033 }), 1034 Qt = (o, e, t) => ({ 1035 query: `mutation userProfileAdd($name: String! $type: String! $avatar: String!) 1036 { 1037 userProfileAdd(name: $name, type: $type, avatar: $avatar) { 1038 profiles { 1039 profileId visitorId type name avatar url 1040 } 1041 } 1042 }`, 1043 variables: { 1044 name: o, 1045 type: e, 1046 avatar: t 1047 } 1048 }), 1049 Nt = (o, e, t) => ({ 1050 query: `mutation userProfileUpdate($profileId: Int! $name: String! $avatar: String!) 1051 { 1052 userProfileUpdate(profileId: $profileId, name: $name, avatar: $avatar) { 1053 profiles { 1054 profileId visitorId type name avatar url 1055 } 1056 } 1057 }`, 1058 variables: { 1059 profileId: o, 1060 name: e, 1061 avatar: t 1062 } 1063 }), 1064 Wt = o => ({ 1065 query: `mutation userProfileDelete($profileId: Int!) 1066 { 1067 userProfileDelete(profileId: $profileId) { 1068 profiles { 1069 profileId visitorId type name avatar url 1070 } 1071 } 1072 }`, 1073 variables: { 1074 profileId: o 1075 } 1076 }); 1077 var zt = (o, e) => ({ 1078 query: `mutation tvGetCode($deviceName: String!, $deviceFamily: String!) 1079 { 1080 tvGetCode(deviceName: $deviceName, deviceFamily: $deviceFamily, codeLength: 5) { 1081 code canSkipDummyVisitorScreen 1082 } 1083 }`, 1084 variables: { 1085 deviceName: o, 1086 deviceFamily: e 1087 } 1088 }); 1089 function b(o) { 1090 var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0; 1091 return new Promise((t, i) => { 1092 var s = setTimeout(() => { 1093 var _window$Sentry; 1094 (_window$Sentry = window.Sentry) !== null && _window$Sentry !== void 0 && _window$Sentry.setContext("fetchData", { 1095 url: o, 1096 options: e 1097 }), i(new Error("Fetch request timed out: " + o)); 1098 }, (e === null || e === void 0 ? void 0 : e.timeout) || 4e3); 1099 fetch(o, e).then(r => { 1100 if (!r.ok) throw new Error(`HTTP error! status: ${r.status}`); 1101 clearTimeout(s), t(r); 1102 }).catch(r => { 1103 clearTimeout(s), console.error("Fetch error:", r), i(r); 1104 }); 1105 }); 1106 } 1107 var J = class { 1108 constructor(e) { 1109 this.timer = null; 1110 this.from = e.from || 0, this.to = e.to || 0, this.seen = e.seen || !1; 1111 } 1112 setSeen() { 1113 this.timer || (this.timer = setTimeout(() => { 1114 this.seen = !0; 1115 }, 1e3)); 1116 } 1117 }, 1118 Jt = J; 1119 var K = class { 1120 constructor(e) { 1121 this.url = (e === null || e === void 0 ? void 0 : e.url) || "", this.breaks = ((e === null || e === void 0 ? void 0 : e.breaks) || []).map(t => new Jt(t)), this.license = (e === null || e === void 0 ? void 0 : e.license) || ""; 1122 } 1123 }, 1124 X = K; 1125 var Y = class { 1126 constructor(e) { 1127 Object.assign(this, e); 1128 } 1129 }, 1130 Kt = Y;
1131 var Z = class { 1132 constructor(e) { 1133 Object.assign(this, e); 1134 } 1135 }, 1136 Xt = Z; 1137 var ee = class { 1138 constructor(e) { 1139 Object.assign(this, e); 1140 } 1141 }, 1142 Yt = ee; 1143 var te = class { 1144 constructor(e) { 1145 Object.assign(this, e), this.payload = e !== null && e !== void 0 && e.payload ? new u(e.payload) : null; 1146 } 1147 }, 1148 Zt = te; 1149 var ei = o => ({ 1150 query: `query IspLoginCheck ($jobHash: String!) { 1151 ispLoginCheck(jobHash: $jobHash) { 1152 status 1153 payload { 1154 token 1155 nickname 1156 email 1157 avatar 1158 isSubscribed 1159 subscriptionUntil 1160 status 1161 } 1162 } 1163 }`, 1164 variables: { 1165 jobHash: o 1166 } 1167 }), 1168 ti = (o, e) => ({ 1169 query: `query IspLogin ($provider: String! $a1Token: String) { 1170 ispLogin(provider: $provider a1Token: $a1Token) { 1171 jobHash maxRetries retryDelay 1172 } 1173 }`, 1174 variables: { 1175 provider: o, 1176 a1Token: e 1177 } 1178 }), 1179 ii = (o, e, t) => ({ 1180 query: `query IspLogin ($username: String! $password: String! $provider: String!) { 1181 ispLogin(username: $username password: $password provider: $provider) { 1182 jobHash maxRetries retryDelay 1183 } 1184 }`, 1185 variables: { 1186 username: o, 1187 password: e, 1188 provider: t 1189 } 1190 }); 1191 function w(_x) { 1192 return _w.apply(this, arguments); 1193 } 1194 function _w() { 1195 _w = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee76(o) { 1196 var _t14; 1197 return _regenerator().w(function (_context76) { 1198 while (1) switch (_context76.p = _context76.n) { 1199 case 0: 1200 _context76.p = 0; 1201 _context76.n = 1; 1202 return o(); 1203 case 1: 1204 return _context76.a(2, _context76.v); 1205 case 2: 1206 _context76.p = 2; 1207 _t14 = _context76.v; 1208 console.log("First attempt failed, retrying once in 1 second...", _t14); 1209 _context76.n = 3; 1210 return new Promise(t => setTimeout(t, 1e3)); 1211 case 3: 1212 _context76.n = 4; 1213 return o(); 1214 case 4: 1215 return _context76.a(2, _context76.v); 1216 } 1217 }, _callee76, null, [[0, 2]]); 1218 })); 1219 return _w.apply(this, arguments); 1220 } 1221 var ie = class { 1222 constructor(e) { 1223 Object.assign(this, e); 1224 } 1225 }, 1226 se = ie; 1227 var si = function si(o) { 1228 var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "mail"; 1229 return { 1230 query: `query mailingSubscriptions($siteId: Int! $subscriptionsType: String!) 1231 { 1232 mailingSubscriptions(siteId: $siteId, subscriptionsType: $subscriptionsType) 1233 { 1234 subscriptions { 1235 id 1236 subscribed 1237 checkAgainAfter 1238 allowMailingPopup 1239 } 1240 } 1241 }`, 1242 variables: { 1243 siteId: o, 1244 subscriptionsType: e 1245 } 1246 }; 1247 }, 1248 ri = function ri(o, e, t) { 1249 var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0; 1250 return { 1251 query: `mutation settingsSubscription($siteId: Int! $mailingId: Int! $subscribed: Boolean! $sendUnsubscribeEmail: Boolean!) 1252 { 1253 settingsSubscription(siteId: $siteId, mailingId: $mailingId, subscribed: $subscribed, sendUnsubscribeEmail: $sendUnsubscribeEmail) 1254 { 1255 subscriptions { 1256 id 1257 subscribed 1258 } 1259 } 1260 }`, 1261 variables: { 1262 siteId: o, 1263 mailingId: e, 1264 subscribed: t, 1265 sendUnsubscribeEmail: i 1266 } 1267 }; 1268 }, 1269 oi = (o, e) => ({ 1270 query: `mutation settingsAccount($email: String!, $password: String!) 1271 { 1272 settingsAccount(email: $email, password: $password) { 1273 token 1274 account { 1275 email 1276 } 1277 } 1278 }`, 1279 variables: { 1280 email: o, 1281 password: e 1282 } 1283 }), 1284 ni = (o, e) => ({ 1285 query: `mutation settingsAccount($password: String!, $newPassword: String!) 1286 { 1287 settingsAccount(password: $password, newPassword: $newPassword) { 1288 token 1289 } 1290 }`, 1291 variables: { 1292 password: o, 1293 newPassword: e 1294 } 1295 }), 1296 ai = (o, e, t) => ({ 1297 query: `mutation settingsAccount($email: String!, $newPassword: String!, $password: String!) 1298 { 1299 settingsAccount(email: $email, newPassword: $newPassword, password: $password) { 1300 token 1301 account { 1302 email 1303 emailConfirmed 1304 } 1305 } 1306 }`, 1307 variables: { 1308 email: o, 1309 newPassword: e, 1310 password: t 1311 } 1312 }), 1313 li = (o, e) => ({ 1314 query: `mutation settingsCompany($name: String!, $vat: String!) 1315 { 1316 settingsCompany(name: $name, vat: $vat) { 1317 token 1318 company { 1319 name 1320 vat 1321 } 1322 } 1323 }`, 1324 variables: { 1325 name: o, 1326 vat: e 1327 } 1328 }), 1329 di = (o, e) => ({ 1330 query: `mutation settingsAccountTerms($telTermsAgreed: Boolean!, $profilingTermsAgreed: Boolean!) 1331 { 1332 settingsAccountTerms(telTermsAgreed: $telTermsAgreed, profilingTermsAgreed: $profilingTermsAgreed) { 1333 token 1334 } 1335 }`, 1336 variables: { 1337 telTermsAgreed: o, 1338 profilingTermsAgreed: e 1339 } 1340 }), 1341 mi = o => ({ 1342 query: `query unlinkDevice($id: Int!) 1343 { 1344 unlinkDevice(id: $id) { 1345 token 1346 } 1347 }`, 1348 variables: { 1349 id: o 1350 } 1351 }), 1352 hi = o => ({ 1353 query: `mutation tv($code: String!) 1354 { 1355 tv(code: $code) { 1356 message 1357 } 1358 }`, 1359 variables: { 1360 code: o 1361 } 1362 }), 1363 ci = () => ({ 1364 query: `mutation settingsSupervisionSendPin { 1365 settingsSupervisionSendPin { 1366 status 1367 } 1368 }`, 1369 variables: {} 1370 }), 1371 ui = (o, e) => ({ 1372 query: `mutation settingsSupervision($restriction: String!, $pin: String!) { 1373 settingsSupervision(restriction: $restriction, pin: $pin) { 1374 token 1375 supervision { 1376 restriction 1377 userHasPin 1378 parentalCtr { 1379 age 1380 description 1381 image 1382 enable 1383 } 1384 } 1385 } 1386 }`, 1387 variables: { 1388 restriction: o, 1389 pin: e 1390 } 1391 }), 1392 pi = (o, e) => ({ 1393 query: `mutation voyoPaymentPeriod($subscriptionId: Int!, $period: String!) { 1394 voyoPaymentPeriod(subscriptionId: $subscriptionId, period: $period) { 1395 processed 1396 } 1397 }`, 1398 variables: { 1399 subscriptionId: o, 1400 period: e 1401 } 1402 }), 1403 gi = o => ({ 1404 query: `mutation settingsStopVoyoSubscription($subscriptionId: Int!) { 1405 settingsStopVoyoSubscription(id: $subscriptionId) {
1406 voyoSubscriptions { 1407 id 1408 type 1409 timeStart 1410 timeEnd 1411 productId 1412 canResume 1413 paymentPeriod 1414 payments { 1415 next 1416 prev 1417 } 1418 creditCardInfo { 1419 cardType 1420 expiryDate 1421 summary 1422 holderName 1423 } 1424 } 1425 voyoPendingSubscriptions { 1426 id 1427 type 1428 timeStart 1429 timeEnd 1430 productId 1431 canResume 1432 paymentPeriod 1433 payments { 1434 next 1435 prev 1436 canUserTriggerPayment 1437 attempts 1438 lastPaymentError 1439 } 1440 creditCardInfo { 1441 cardType 1442 expiryDate 1443 summary 1444 holderName 1445 } 1446 } 1447 token 1448 } 1449 }`, 1450 variables: { 1451 subscriptionId: o 1452 } 1453 }), 1454 vi = o => ({ 1455 query: `mutation settingsResumeVoyoSubscription($subscriptionId: Int!) { 1456 settingsResumeVoyoSubscription(id: $subscriptionId) { 1457 voyoSubscriptions { 1458 id 1459 timeEnd 1460 canResume 1461 paymentPeriod 1462 payments { 1463 next 1464 prev 1465 } 1466 } 1467 token 1468 } 1469 }`, 1470 variables: { 1471 subscriptionId: o 1472 } 1473 }), 1474 fi = o => ({ 1475 query: `mutation sendConfirmationEmail($siteId: Int!) { 1476 sendConfirmationEmail(siteId: $siteId) { 1477 status 1478 } 1479 }`, 1480 variables: { 1481 siteId: o 1482 } 1483 }), 1484 yi = (o, e) => ({ 1485 query: `query forgottenPassword($email: String!, $siteId: Int!) 1486 { 1487 forgottenPassword(email: $email, siteId: $siteId) { 1488 status 1489 } 1490 }`, 1491 variables: { 1492 email: o, 1493 siteId: e 1494 } 1495 }); 1496 function v() { 1497 return /apple/i.test(navigator.vendor); 1498 } 1499 function bi(o) { 1500 var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 1501 t = "", 1502 i, 1503 s, 1504 r, 1505 n, 1506 a, 1507 l, 1508 d, 1509 m = 0; 1510 for (; m < o.length;) i = o[m++], s = m < o.length ? o[m++] : Number.NaN, r = m < o.length ? o[m++] : Number.NaN, n = i >> 2, a = (i & 3) << 4 | s >> 4, l = (s & 15) << 2 | r >> 6, d = r & 63, isNaN(s) ? l = d = 64 : isNaN(r) && (d = 64), t += e.charAt(n) + e.charAt(a) + e.charAt(l) + e.charAt(d); 1511 return t; 1512 } 1513 var ki = () => ({ 1514 query: ` 1515 { 1516 geo { 1517 ip 1518 countryCode 1519 countryName 1520 } 1521 }`, 1522 variables: {} 1523 }); 1524 var wi = o => ({ 1525 query: `query billingCode${o ? "($giftCode: String)" : ""} { 1526 billingCode${o ? "(giftCode: $giftCode)" : ""} { 1527 code activatedBy 1528 } 1529 }`, 1530 variables: o ? { 1531 giftCode: o 1532 } : {} 1533 }), 1534 Ei = o => ({ 1535 query: `mutation code($code: String!) 1536 { 1537 code(code: $code) { 1538 message code activatedBy 1539 paymentInfo { 1540 itemId itemName category price 1541 discount quantity coupon 1542 } 1543 } 1544 }`, 1545 variables: { 1546 code: o 1547 } 1548 }), 1549 Ti = o => ({ 1550 query: `query billingCodeInfo($code: String!) { 1551 billingCodeInfo(code: $code) { 1552 exists isRecurring description reason 1553 code activatedBy status terms imageSrc 1554 } 1555 }`, 1556 variables: { 1557 code: o 1558 } 1559 }), 1560 Pi = (o, e, t, i) => ({ 1561 query: `query adyenStart($accessCode: String!, $paymentType: String!, $promotionId: Int, $flags: String) { 1562 adyenStart(accessCode: $accessCode, paymentType: $paymentType, promotionId: $promotionId, flags: $flags) { 1563 id sessionData clientKey checkoutId amount 1564 paymentInfo { 1565 itemName category price discount quantity coupon 1566 } 1567 } 1568 }`, 1569 variables: { 1570 accessCode: o, 1571 paymentType: e, 1572 promotionId: t, 1573 flags: i 1574 } 1575 }), 1576 Li = (o, e) => ({ 1577 query: `query adyenCheck(${o ? "$id: Int," : ""} ${e ? "$subscriptionId: Int" : ""}) { 1578 adyenCheck(${o ? "id: $id," : ""} ${e ? "subscriptionId: $subscriptionId" : ""}) { 1579 status 1580 accessCode 1581 error {
1582 code original description 1583 } 1584 } 1585 }`, 1586 variables: { 1587 id: o, 1588 subscriptionId: e 1589 } 1590 }), 1591 Si = (o, e) => ({ 1592 query: `query adyenDirectPayment(${o ? "$id: Int," : ""} ${e ? "$subscriptionId: Int" : ""}) { 1593 adyenDirectPayment(${o ? "id: $id," : ""} ${e ? "subscriptionId: $subscriptionId" : ""}) { 1594 status 1595 error { 1596 code 1597 original 1598 description 1599 } 1600 } 1601 }`, 1602 variables: { 1603 id: o, 1604 subscriptionId: e 1605 } 1606 }), 1607 Mi = o => ({ 1608 query: `query paypal($id: String!) { 1609 paypal(id: $id) { 1610 status 1611 } 1612 }`, 1613 variables: { 1614 id: o 1615 } 1616 }); 1617 var re = class { 1618 constructor(e) { 1619 Object.assign(this, e); 1620 } 1621 }, 1622 Ci = re; 1623 var oe = class { 1624 constructor(e) { 1625 var _this = this; 1626 this.options = e; 1627 this.authToken = ""; 1628 this.deviceId = ""; 1629 this.loginInfo = /*#__PURE__*/function () { 1630 var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e, t) { 1631 var i, 1632 r, 1633 s, 1634 _args = arguments; 1635 return _regenerator().w(function (_context) { 1636 while (1) switch (_context.n) { 1637 case 0: 1638 i = _args.length > 2 && _args[2] !== undefined ? _args[2] : !0; 1639 if (!i) { 1640 _context.n = 1; 1641 break; 1642 } 1643 r = ct(e, t); 1644 return _context.a(2, w(() => _this.fetchGQL(null, { 1645 method: "GET", 1646 url: r, 1647 headers: { 1648 Authorization: e 1649 } 1650 })).then(n => new u(n))); 1651 case 1: 1652 s = ut(e, t); 1653 return _context.a(2, _this.fetchGQL(s).then(r => new u(r))); 1654 } 1655 }, _callee); 1656 })); 1657 return function (_x2, _x3) { 1658 return _ref.apply(this, arguments); 1659 }; 1660 }(); 1661 this.loginUser = /*#__PURE__*/function () { 1662 var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e, t, i) { 1663 var s; 1664 return _regenerator().w(function (_context2) { 1665 while (1) switch (_context2.n) { 1666 case 0: 1667 s = pt(e, t, i); 1668 return _context2.a(2, _this.fetchGQL(s).then(r => new u(r))); 1669 } 1670 }, _callee2); 1671 })); 1672 return function (_x4, _x5, _x6) { 1673 return _ref2.apply(this, arguments); 1674 }; 1675 }(); 1676 this.loginWithDevice = /*#__PURE__*/function () { 1677 var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(e, t, i) { 1678 var s; 1679 return _regenerator().w(function (_context3) { 1680 while (1) switch (_context3.n) { 1681 case 0: 1682 s = gt(e, t, i); 1683 return _context3.a(2, _this.fetchGQL(s).then(r => new u(r))); 1684 } 1685 }, _callee3); 1686 })); 1687 return function (_x7, _x8, _x9) { 1688 return _ref3.apply(this, arguments); 1689 }; 1690 }(); 1691 this.logoutUser = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() { 1692 var e; 1693 return _regenerator().w(function (_context4) { 1694 while (1) switch (_context4.n) { 1695 case 0: 1696 e = vt(); 1697 return _context4.a(2, _this.fetchGQL(e).then(t => !!t)); 1698 } 1699 }, _callee4); 1700 })); 1701 this.loginProfile = /*#__PURE__*/function () { 1702 var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(e) { 1703 var t; 1704 return _regenerator().w(function (_context5) { 1705 while (1) switch (_context5.n) { 1706 case 0: 1707 t = ft(e); 1708 return _context5.a(2, _this.fetchGQL(t).then(i => new u(i))); 1709 } 1710 }, _callee5); 1711 })); 1712 return function (_x0) { 1713 return _ref5.apply(this, arguments); 1714 }; 1715 }(); 1716 this.geo = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() { 1717 var e; 1718 return _regenerator().w(function (_context6) { 1719 while (1) switch (_context6.n) { 1720 case 0: 1721 e = ki(); 1722 return _context6.a(2, _this.fetchGQL(e).then(t => new dt(t))); 1723 } 1724 }, _callee6); 1725 })); 1726 this.newProfile = /*#__PURE__*/function () { 1727 var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(e, t, i) { 1728 var s; 1729 return _regenerator().w(function (_context7) { 1730 while (1) switch (_context7.n) { 1731 case 0: 1732 s = Qt(e, t, i); 1733 return _context7.a(2, _this.fetchGQL(s).then(r => r ? r.profiles.map(n => new g(n)) : [])); 1734 } 1735 }, _callee7); 1736 })); 1737 return function (_x1, _x10, _x11) { 1738 return _ref7.apply(this, arguments); 1739 }; 1740 }(); 1741 this.updateProfile = /*#__PURE__*/function () { 1742 var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(e, t, i) { 1743 var s; 1744 return _regenerator().w(function (_context8) { 1745 while (1) switch (_context8.n) { 1746 case 0: 1747 s = Nt(e, t, i); 1748 return _context8.a(2, _this.fetchGQL(s).then(r => r ? r.profiles.map(n => new g(n)) : [])); 1749 } 1750 }, _callee8); 1751 })); 1752 return function (_x12, _x13, _x14) { 1753 return _ref8.apply(this, arguments); 1754 }; 1755 }(); 1756 this.deleteProfile = /*#__PURE__*/function () { 1757 var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(e) { 1758 var t; 1759 return _regenerator().w(function (_context9) { 1760 while (1) switch (_context9.n) { 1761 case 0: 1762 t = Wt(e); 1763 return _context9.a(2, _this.fetchGQL(t).then(i => i ? i.profiles.map(s => new g(s)) : [])); 1764 } 1765 }, _callee9); 1766 })); 1767 return function (_x15) { 1768 return _ref9.apply(this, arguments); 1769 }; 1770 }(); 1771 this.registerUser = /*#__PURE__*/function () { 1772 var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(e, t, i, s, r, n, a, l, d, m, h) { 1773 var c; 1774 return _regenerator().w(function (_context0) { 1775 while (1) switch (_context0.n) { 1776 case 0: 1777 c = yt(e, t, i, s, r, n, a, l, d, m, h); 1778 return _context0.a(2, _this.fetchGQL(c).then(f => new u(f))); 1779 } 1780 }, _callee0); 1781 })); 1782 return function (_x16, _x17, _x18, _x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26) { 1783 return _ref0.apply(this, arguments); 1784 }; 1785 }(); 1786 this.newPassword = /*#__PURE__*/function () { 1787 var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(e, t) { 1788 var i; 1789 return _regenerator().w(function (_context1) { 1790 while (1) switch (_context1.n) { 1791 case 0: 1792 i = wt(e, t); 1793 return _context1.a(2, _this.fetchGQL(i).then(s => new u(s))); 1794 } 1795 }, _callee1); 1796 })); 1797 return function (_x27, _x28) { 1798 return _ref1.apply(this, arguments); 1799 }; 1800 }(); 1801 this.registerEmailOnly = /*#__PURE__*/function () { 1802 var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(e, t, i, s) { 1803 var r; 1804 return _regenerator().w(function (_context10) { 1805 while (1) switch (_context10.n) { 1806 case 0: 1807 r = bt(e, t, i, s); 1808 return _context10.a(2, _this.fetchGQL(r)); 1809 } 1810 }, _callee10); 1811 })); 1812 return function (_x29, _x30, _x31, _x32) { 1813 return _ref10.apply(this, arguments); 1814 }; 1815 }(); 1816 this.mailingSubscriptions = /*#__PURE__*/function () { 1817 var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(e) { 1818 var t, 1819 i, 1820 _args11 = arguments; 1821 return _regenerator().w(function (_context11) { 1822 while (1) switch (_context11.n) { 1823 case 0: 1824 t = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "mail"; 1825 i = si(e, t); 1826 return _context11.a(2, _this.fetchGQL(i)); 1827 } 1828 }, _callee11); 1829 })); 1830 return function (_x33) { 1831 return _ref11.apply(this, arguments); 1832 }; 1833 }(); 1834 this.sendVoyoLoginToken = /*#__PURE__*/function () { 1835 var _ref12 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(e, t) { 1836 var i; 1837 return _regenerator().w(function (_context12) { 1838 while (1) switch (_context12.n) { 1839 case 0: 1840 i = Et(e, t); 1841 return _context12.a(2, _this.fetchGQL(i)); 1842 } 1843 }, _callee12); 1844 })); 1845 return function (_x34, _x35) { 1846 return _ref12.apply(this, arguments); 1847 }; 1848 }(); 1849 this.settingsUpdateSubscription = /*#__PURE__*/function () { 1850 var _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(e, t, i) { 1851 var s, 1852 r, 1853 _args13 = arguments; 1854 return _regenerator().w(function (_context13) { 1855 while (1) switch (_context13.n) { 1856 case 0: 1857 s = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0; 1858 r = ri(e, t, i, s); 1859 return _context13.a(2, _this.fetchGQL(r)); 1860 } 1861 }, _callee13); 1862 })); 1863 return function (_x36, _x37, _x38) { 1864 return _ref13.apply(this, arguments); 1865 }; 1866 }(); 1867 this.saveAccountEmail = /*#__PURE__*/function () { 1868 var _ref14 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(e, t) { 1869 var i; 1870 return _regenerator().w(function (_context14) { 1871 while (1) switch (_context14.n) { 1872 case 0: 1873 i = oi(e, t); 1874 return _context14.a(2, _this.fetchGQL(i)); 1875 } 1876 }, _callee14); 1877 })); 1878 return function (_x39, _x40) { 1879 return _ref14.apply(this, arguments); 1880 }; 1881 }(); 1882 this.saveAccountPassword = /*#__PURE__*/function () { 1883 var _ref15 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(e, t) { 1884 var i; 1885 return _regenerator().w(function (_context15) { 1886 while (1) switch (_context15.n) { 1887 case 0: 1888 i = ni(e, t); 1889 return _context15.a(2, _this.fetchGQL(i)); 1890 } 1891 }, _callee15); 1892 })); 1893 return function (_x41, _x42) { 1894 return _ref15.apply(this, arguments); 1895 }; 1896 }(); 1897 this.saveAccountCredentials = /*#__PURE__*/function () { 1898 var _ref16 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(e, t) { 1899 var i, 1900 s, 1901 _args16 = arguments; 1902 return _regenerator().w(function (_context16) { 1903 while (1) switch (_context16.n) { 1904 case 0: 1905 i = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : ""; 1906 s = ai(e, t, i); 1907 return _context16.a(2, _this.fetchGQL(s)); 1908 } 1909 }, _callee16); 1910 })); 1911 return function (_x43, _x44) { 1912 return _ref16.apply(this, arguments); 1913 }; 1914 }(); 1915 this.saveCompany = /*#__PURE__*/function () { 1916 var _ref17 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(e, t) { 1917 var i; 1918 return _regenerator().w(function (_context17) { 1919 while (1) switch (_context17.n) { 1920 case 0: 1921 i = li(e, t); 1922 return _context17.a(2, _this.fetchGQL(i)); 1923 } 1924 }, _callee17); 1925 })); 1926 return function (_x45, _x46) { 1927 return _ref17.apply(this, arguments); 1928 }; 1929 }(); 1930 this.saveAccountTerms = /*#__PURE__*/function () { 1931 var _ref18 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(e, t) { 1932 var i; 1933 return _regenerator().w(function (_context18) { 1934 while (1) switch (_context18.n) { 1935 case 0: 1936 i = di(e, t); 1937 return _context18.a(2, _this.fetchGQL(i)); 1938 } 1939 }, _callee18); 1940 })); 1941 return function (_x47, _x48) { 1942 return _ref18.apply(this, arguments); 1943 }; 1944 }(); 1945 this.unlinkDevice = /*#__PURE__*/function () { 1946 var _ref19 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(e) { 1947 var t; 1948 return _regenerator().w(function (_context19) { 1949 while (1) switch (_context19.n) { 1950 case 0: 1951 t = mi(e); 1952 return _context19.a(2, _this.fetchGQL(t)); 1953 } 1954 }, _callee19); 1955 })); 1956 return function (_x49) { 1957 return _ref19.apply(this, arguments); 1958 }; 1959 }(); 1960 this.connectTV = /*#__PURE__*/function () { 1961 var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(e) { 1962 var t; 1963 return _regenerator().w(function (_context20) { 1964 while (1) switch (_context20.n) { 1965 case 0: 1966 t = hi(e); 1967 return _context20.a(2, _this.fetchGQL(t)); 1968 } 1969 }, _callee20); 1970 })); 1971 return function (_x50) { 1972 return _ref20.apply(this, arguments); 1973 }; 1974 }(); 1975 this.requestSupervisionPinCode = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() { 1976 var e; 1977 return _regenerator().w(function (_context21) { 1978 while (1) switch (_context21.n) { 1979 case 0: 1980 e = ci(); 1981 return _context21.a(2, _this.fetchGQL(e)); 1982 } 1983 }, _callee21); 1984 })); 1985 this.saveSupervisionSettings = /*#__PURE__*/function () { 1986 var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(e, t) { 1987 var i; 1988 return _regenerator().w(function (_context22) { 1989 while (1) switch (_context22.n) { 1990 case 0: 1991 i = ui(e, t); 1992 return _context22.a(2, _this.fetchGQL(i)); 1993 } 1994 }, _callee22); 1995 })); 1996 return function (_x51, _x52) { 1997 return _ref22.apply(this, arguments); 1998 }; 1999 }(); 2000 this.voyoPaymentPeriod = /*#__PURE__*/function () { 2001 var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(e, t) { 2002 var i; 2003 return _regenerator().w(function (_context23) { 2004 while (1) switch (_context23.n) { 2005 case 0: 2006 i = pi(e, t); 2007 return _context23.a(2, _this.fetchGQL(i)); 2008 } 2009 }, _callee23); 2010 })); 2011 return function (_x53, _x54) { 2012 return _ref23.apply(this, arguments); 2013 }; 2014 }(); 2015 this.stopVoyoSubscription = /*#__PURE__*/function () { 2016 var _ref24 = _asyncT
2016oGenerator(/*#__PURE__*/_regenerator().m(function _callee24(e) { 2017 var t; 2018 return _regenerator().w(function (_context24) { 2019 while (1) switch (_context24.n) { 2020 case 0: 2021 t = gi(e); 2022 return _context24.a(2, _this.fetchGQL(t)); 2023 } 2024 }, _callee24); 2025 })); 2026 return function (_x55) { 2027 return _ref24.apply(this, arguments); 2028 }; 2029 }(); 2030 this.resumeVoyoSubscription = /*#__PURE__*/function () { 2031 var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(e) { 2032 var t; 2033 return _regenerator().w(function (_context25) { 2034 while (1) switch (_context25.n) { 2035 case 0: 2036 t = vi(e); 2037 return _context25.a(2, _this.fetchGQL(t)); 2038 } 2039 }, _callee25); 2040 })); 2041 return function (_x56) { 2042 return _ref25.apply(this, arguments); 2043 }; 2044 }(); 2045 this.sendConfirmationEmail = /*#__PURE__*/function () { 2046 var _ref26 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(e) { 2047 var t; 2048 return _regenerator().w(function (_context26) { 2049 while (1) switch (_context26.n) { 2050 case 0: 2051 t = fi(e); 2052 return _context26.a(2, _this.fetchGQL(t)); 2053 } 2054 }, _callee26); 2055 })); 2056 return function (_x57) { 2057 return _ref26.apply(this, arguments); 2058 }; 2059 }(); 2060 this.forgottenPassword = /*#__PURE__*/function () { 2061 var _ref27 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(e, t) { 2062 var i; 2063 return _regenerator().w(function (_context27) { 2064 while (1) switch (_context27.n) { 2065 case 0: 2066 i = yi(e, t); 2067 return _context27.a(2, _this.fetchGQL(i)); 2068 } 2069 }, _callee27); 2070 })); 2071 return function (_x58, _x59) { 2072 return _ref27.apply(this, arguments); 2073 }; 2074 }(); 2075 this.billingCode = /*#__PURE__*/function () { 2076 var _ref28 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(e) { 2077 var t; 2078 return _regenerator().w(function (_context28) { 2079 while (1) switch (_context28.n) { 2080 case 0: 2081 t = wi(e); 2082 return _context28.a(2, _this.fetchGQL(t)); 2083 } 2084 }, _callee28); 2085 })); 2086 return function (_x60) { 2087 return _ref28.apply(this, arguments); 2088 }; 2089 }(); 2090 this.accessCode = /*#__PURE__*/function () { 2091 var _ref29 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(e) { 2092 var t; 2093 return _regenerator().w(function (_context29) { 2094 while (1) switch (_context29.n) { 2095 case 0: 2096 t = Ei(e); 2097 return _context29.a(2, _this.fetchGQL(t)); 2098 } 2099 }, _callee29); 2100 })); 2101 return function (_x61) { 2102 return _ref29.apply(this, arguments); 2103 }; 2104 }(); 2105 this.billingCodeExists = /*#__PURE__*/function () { 2106 var _ref30 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(e) { 2107 var t; 2108 return _regenerator().w(function (_context30) { 2109 while (1) switch (_context30.n) { 2110 case 0: 2111 t = Ti(e); 2112 return _context30.a(2, _this.fetchGQL(t)); 2113 } 2114 }, _callee30); 2115 })); 2116 return function (_x62) { 2117 return _ref30.apply(this, arguments); 2118 }; 2119 }(); 2120 this.adyenStart = /*#__PURE__*/function () { 2121 var _ref31 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(e, t, i, s) { 2122 var r; 2123 return _regenerator().w(function (_context31) { 2124 while (1) switch (_context31.n) { 2125 case 0: 2126 r = Pi(e, t, i, s); 2127 return _context31.a(2, _this.fetchGQL(r).then(n => new Ci(n))); 2128 } 2129 }, _callee31); 2130 })); 2131 return function (_x63, _x64, _x65, _x66) {
2132 return _ref31.apply(this, arguments); 2133 }; 2134 }(); 2135 this.adyenCheck = /*#__PURE__*/function () { 2136 var _ref32 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(e, t) { 2137 var i; 2138 return _regenerator().w(function (_context32) { 2139 while (1) switch (_context32.n) { 2140 case 0: 2141 i = Li(e, t); 2142 return _context32.a(2, _this.fetchGQL(i)); 2143 } 2144 }, _callee32); 2145 })); 2146 return function (_x67, _x68) { 2147 return _ref32.apply(this, arguments); 2148 }; 2149 }(); 2150 this.adyenDirectPayment = /*#__PURE__*/function () { 2151 var _ref33 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(e, t) { 2152 var i; 2153 return _regenerator().w(function (_context33) { 2154 while (1) switch (_context33.n) { 2155 case 0: 2156 i = Si(e, t); 2157 return _context33.a(2, _this.fetchGQL(i)); 2158 } 2159 }, _callee33); 2160 })); 2161 return function (_x69, _x70) { 2162 return _ref33.apply(this, arguments); 2163 }; 2164 }(); 2165 this.paypal = /*#__PURE__*/function () { 2166 var _ref34 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(e) { 2167 var t; 2168 return _regenerator().w(function (_context34) { 2169 while (1) switch (_context34.n) { 2170 case 0: 2171 t = Mi(e); 2172 return _context34.a(2, _this.fetchGQL(t)); 2173 } 2174 }, _callee34); 2175 })); 2176 return function (_x71) { 2177 return _ref34.apply(this, arguments); 2178 }; 2179 }(); 2180 this.voyoBookmarks = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() { 2181 var e; 2182 return _regenerator().w(function (_context35) { 2183 while (1) switch (_context35.n) { 2184 case 0: 2185 e = Ut(); 2186 return _context35.a(2, _this.fetchGQL(e).then(t => new M(t))); 2187 } 2188 }, _callee35); 2189 })); 2190 this.voyoBookmarkRemove = /*#__PURE__*/function () { 2191 var _ref36 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(e, t) { 2192 var i; 2193 return _regenerator().w(function (_context36) { 2194 while (1) switch (_context36.n) { 2195 case 0: 2196 i = Bt(e, t); 2197 return _context36.a(2, _this.fetchGQL(i).then(s => !!s).catch(() => !1)); 2198 } 2199 }, _callee36); 2200 })); 2201 return function (_x72, _x73) { 2202 return _ref36.apply(this, arguments); 2203 }; 2204 }(); 2205 this.voyoBookmarkAdd = /*#__PURE__*/function () { 2206 var _ref37 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(e, t) { 2207 var i; 2208 return _regenerator().w(function (_context37) { 2209 while (1) switch (_context37.n) { 2210 case 0: 2211 i = $t(e, t.entityId.toString(), t.percent, t.duration); 2212 return _context37.a(2, _this.fetchGQL(i, { 2213 timeout: 4e3 2214 }).then(s => !!s).catch(() => !1)); 2215 } 2216 }, _callee37); 2217 })); 2218 return function (_x74, _x75) { 2219 return _ref37.apply(this, arguments); 2220 }; 2221 }(); 2222 this.voyoProfiles = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() { 2223 var e; 2224 return _regenerator().w(function (_context38) { 2225 while (1) switch (_context38.n) { 2226 case 0: 2227 e = jt(); 2228 return _context38.a(2, _this.fetchGQL(e).then(t => t ? t.profiles.map(i => new g(i)) : [])); 2229 } 2230 }, _callee38); 2231 })); 2232 this.tvGetCode = /*#__PURE__*/function () { 2233 var _ref39 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(e, t) { 2234 var i; 2235 return _regenerator().w(function (_context39) { 2236 while (1) switch (_context39.n) { 2237 case 0: 2238 i = zt(e, t); 2239 return _context39.a(2, _this.fetchGQL(i).then(s => new ht(s))); 2240 } 2241 }, _callee39); 2242 })); 2243 return function (_x76, _x77) { 2244 return _ref39.apply(this, arguments); 2245 }; 2246 }(); 2247 this.ispLoginCheck = /*#__PURE__*/function () { 2248 var _ref40 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(e) { 2249 var t; 2250 return _regenerator().w(function (_context40) { 2251 while (1) switch (_context40.n) { 2252 case 0: 2253 t = ei(e); 2254 return _context40.a(2, _this.fetchGQL(t).then(i => new Zt(i))); 2255 } 2256 }, _callee40); 2257 })); 2258 return function (_x78) { 2259 return _ref40.apply(this, arguments); 2260 }; 2261 }(); 2262 this.ispLoginJob = /*#__PURE__*/function () { 2263 var _ref41 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(e, t) { 2264 var i; 2265 return _regenerator().w(function (_context41) { 2266 while (1) switch (_context41.n) { 2267 case 0: 2268 i = ti(e, t); 2269 return _context41.a(2, _this.fetchGQL(i).then(s => new se(s))); 2270 } 2271 }, _callee41); 2272 })); 2273 return function (_x79, _x80) { 2274 return _ref41.apply(this, arguments); 2275 }; 2276 }(); 2277 this.ispLogin = /*#__PURE__*/function () { 2278 var _ref42 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(e, t, i) { 2279 var s; 2280 return _regenerator().w(function (_context42) { 2281 while (1) switch (_context42.n) { 2282 case 0: 2283 s = ii(e, t, i); 2284 return _context42.a(2, _this.fetchGQL(s).then(r => new se(r))); 2285 } 2286 }, _callee42); 2287 })); 2288 return function (_x81, _x82, _x83) { 2289 return _ref42.apply(this, arguments); 2290 }; 2291 }(); 2292 this.videoUrlV2 = /*#__PURE__*/function () { 2293 var _ref43 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(e) { 2294 var t; 2295 return _regenerator().w(function (_context43) { 2296 while (1) switch (_context43.n) { 2297 case 0: 2298 t = Pt(e, _this.options.siteId, v()); 2299 return _context43.a(2, _this.fetchGQL(t).then(i => new mt(i))); 2300 } 2301 }, _callee43); 2302 })); 2303 return function (_x84) { 2304 return _ref43.apply(this, arguments); 2305 }; 2306 }(); 2307 this.linkDeviceToUser = /*#__PURE__*/function () { 2308 var _ref44 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44(e, t, i) { 2309 var s; 2310 return _regenerator().w(function (_context44) { 2311 while (1) switch (_context44.n) { 2312 case 0: 2313 s = kt(e, t, i); 2314 return _context44.a(2, _this.fetchGQL(s).catch(r => { 2315 if (r instanceof W && r.code === "404.300") throw new Error("too_many_devices"); 2316 }).then(r => new u(r))); 2317 } 2318 }, _callee44); 2319 })); 2320 return function (_x85, _x86, _x87) { 2321 return _ref44.apply(this, arguments); 2322 }; 2323 }(); 2324 this.epgHlsUrl = /*#__PURE__*/function () { 2325 var _ref45 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(e, t, i) { 2326 var s; 2327 return _regenerator().w(function (_context45) { 2328 while (1) switch (_context45.n) { 2329 case 0: 2330 s = Lt(e, t, i); 2331 return _context45.a(2, _this.fetchGQL(s).then(r => new X(r))); 2332 } 2333 }, _callee45); 2334 })); 2335 return function (_x88, _x89, _x90) { 2336 return _ref45.apply(this, arguments); 2337 }; 2338 }(); 2339 this.epgHlsUrlV2 = /*#__PURE__*/function () { 2340 var _ref46 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(e, t, i) { 2341 var s; 2342 return _regenerator().w(function (_context46) { 2343 while (1) switch (_context46.n) { 2344 case 0: 2345 s = St(e, t, i, v()); 2346 return _context46.a(2, _this.fetchGQL(s).then(r => new X(r))); 2347 } 2348 }, _callee46); 2349 })); 2350 return function (_x91, _x92, _x93) { 2351 return _ref46.apply(this, arguments); 2352 }; 2353 }(); 2354 this.commentVoteUp = /*#__PURE__*/function () { 2355 var _ref47 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(e, t) { 2356 var i; 2357 return _regenerator().w(function (_context47) { 2358 while (1) switch (_context47.n) { 2359 case 0: 2360 i = Mt(e, t); 2361 return _context47.a(2, _this.fetchGQL(i)); 2362 } 2363 }, _callee47); 2364 })); 2365 return function (_x94, _x95) { 2366 return _ref47.apply(this, arguments); 2367 }; 2368 }(); 2369 this.commentVoteDown = /*#__PURE__*/function () { 2370 var _ref48 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(e, t) { 2371 var i; 2372 return _regenerator().w(function (_context48) { 2373 while (1) switch (_context48.n) { 2374 case 0: 2375 i = Ct(e, t); 2376 return _context48.a(2, _this.fetchGQL(i)); 2377 } 2378 }, _callee48); 2379 })); 2380 return function (_x96, _x97) { 2381 return _ref48.apply(this, arguments); 2382 }; 2383 }(); 2384 this.commentAdd = /*#__PURE__*/function () { 2385 var _ref49 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49(e, t, i) { 2386 var s; 2387 return _regenerator().w(function (_context49) { 2388 while (1) switch (_context49.n) { 2389 case 0: 2390 s = It(e, t, i); 2391 return _context49.a(2, _this.fetchGQL(s)); 2392 } 2393 }, _callee49); 2394 })); 2395 return function (_x98, _x99, _x100) { 2396 return _ref49.apply(this, arguments); 2397 }; 2398 }(); 2399 this.jokeVoteUp = /*#__PURE__*/function () { 2400 var _ref50 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(e) { 2401 var t; 2402 return _regenerator().w(function (_context50) { 2403 while (1) switch (_context50.n) { 2404 case 0: 2405 t = At(e); 2406 return _context50.a(2, _this.fetchGQL(t)); 2407 } 2408 }, _callee50); 2409 })); 2410 return function (_x101) { 2411 return _ref50.apply(this, arguments); 2412 }; 2413 }(); 2414 this.jokeVoteDown = /*#__PURE__*/function () { 2415 var _ref51 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(e) { 2416 var t; 2417 return _regenerator().w(function (_context51) { 2418 while (1) switch (_context51.n) { 2419 case 0: 2420 t = qt(e); 2421 return _context51.a(2, _this.fetchGQL(t)); 2422 } 2423 }, _callee51); 2424 })); 2425 return function (_x102) { 2426 return _ref51.apply(this, arguments); 2427 }; 2428 }(); 2429 this.pollVote = /*#__PURE__*/function () { 2430 var _ref52 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(e, t, i) { 2431 var s; 2432 return _regenerator().w(function (_context52) { 2433 while (1) switch (_context52.n) { 2434 case 0: 2435 s = Ht(e, t, i); 2436 return _context52.a(2, _this.fetchGQL(s)); 2437 } 2438 }, _callee52); 2439 })); 2440 return function (_x103, _x104, _x105) { 2441 return _ref52.apply(this, arguments); 2442 }; 2443 }(); 2444 this.recipeBookmarkDelete = /*#__PURE__*/function () { 2445 var _ref53 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(e, t) { 2446 var i; 2447 return _regenerator().w(function (_context53) { 2448 while (1) switch (_context53.n) { 2449 case 0: 2450 i = Dt(e, t); 2451 return _context53.a(2, _this.fetchGQL(i)); 2452 } 2453 }, _callee53); 2454 }));
2455 return function (_x106, _x107) { 2456 return _ref53.apply(this, arguments); 2457 }; 2458 }(); 2459 this.recipeBookmarkGroupDelete = /*#__PURE__*/function () { 2460 var _ref54 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54(e) { 2461 var t; 2462 return _regenerator().w(function (_context54) { 2463 while (1) switch (_context54.n) { 2464 case 0: 2465 t = Vt(e); 2466 return _context54.a(2, _this.fetchGQL(t)); 2467 } 2468 }, _callee54); 2469 })); 2470 return function (_x108) { 2471 return _ref54.apply(this, arguments); 2472 }; 2473 }(); 2474 this.recipeBookmarkGroupAddRename = /*#__PURE__*/function () { 2475 var _ref55 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55(e, t) { 2476 var i; 2477 return _regenerator().w(function (_context55) { 2478 while (1) switch (_context55.n) { 2479 case 0: 2480 i = _t(e, t); 2481 return _context55.a(2, _this.fetchGQL(i)); 2482 } 2483 }, _callee55); 2484 })); 2485 return function (_x109, _x110) { 2486 return _ref55.apply(this, arguments); 2487 }; 2488 }(); 2489 this.recipeBookmarkAddToGroup = /*#__PURE__*/function () { 2490 var _ref56 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56(e, t) { 2491 var i; 2492 return _regenerator().w(function (_context56) { 2493 while (1) switch (_context56.n) { 2494 case 0: 2495 i = xt(e, t); 2496 return _context56.a(2, _this.fetchGQL(i)); 2497 } 2498 }, _callee56); 2499 })); 2500 return function (_x111, _x112) { 2501 return _ref56.apply(this, arguments); 2502 }; 2503 }(); 2504 this.voyoCategory = /*#__PURE__*/function () { 2505 var _ref57 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee57(e) { 2506 var t; 2507 return _regenerator().w(function (_context57) { 2508 while (1) switch (_context57.n) { 2509 case 0: 2510 t = Gt(e); 2511 return _context57.a(2, _this.fetchGQL(t).then(i => new Kt(i))); 2512 } 2513 }, _callee57); 2514 })); 2515 return function (_x113) { 2516 return _ref57.apply(this, arguments); 2517 }; 2518 }(); 2519 this.video = /*#__PURE__*/function () { 2520 var _ref58 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee58(e) { 2521 var t; 2522 return _regenerator().w(function (_context58) { 2523 while (1) switch (_context58.n) { 2524 case 0: 2525 t = Ot(e); 2526 return _context58.a(2, _this.fetchGQL(t).then(i => new Xt(i))); 2527 } 2528 }, _callee58); 2529 })); 2530 return function (_x114) { 2531 return _ref58.apply(this, arguments); 2532 }; 2533 }(); 2534 this.liveStream = /*#__PURE__*/function () { 2535 var _ref59 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee59(e) { 2536 var t; 2537 return _regenerator().w(function (_context59) { 2538 while (1) switch (_context59.n) { 2539 case 0: 2540 t = Ft(e); 2541 return _context59.a(2, _this.fetchGQL(t).then(i => new Yt(i))); 2542 } 2543 }, _callee59); 2544 })); 2545 return function (_x115) { 2546 return _ref59.apply(this, arguments); 2547 }; 2548 }(); 2549 this.liveStreamReminder = /*#__PURE__*/function () { 2550 var _ref60 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee60(e) { 2551 var t; 2552 return _regenerator().w(function (_context60) { 2553 while (1) switch (_context60.n) { 2554 case 0: 2555 t = Rt(e); 2556 return _context60.a(2, _this.fetchGQL(t).catch(() => {})); 2557 } 2558 }, _callee60); 2559 })); 2560 return function (_x116) { 2561 return _ref60.apply(this, arguments); 2562 }; 2563 }(); 2564 this.userMeta = /*#__PURE__*/function () { 2565 var _ref61 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee61(e, t) { 2566 var i; 2567 return _regenerator().w(function (_context61) { 2568 while (1) switch (_context61.n) { 2569 case 0: 2570 i = Tt(e, t); 2571 return _context61.a(2, _this.fetchGQL(i)); 2572 } 2573 }, _callee61); 2574 })); 2575 return function (_x117, _x118) { 2576 return _ref61.apply(this, arguments); 2577 }; 2578 }(); 2579 this.pageHit = /*#__PURE__*/function () { 2580 var _ref62 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee62(e) { 2581 var t; 2582 return _regenerator().w(function (_context62) { 2583 while (1) switch (_context62.n) { 2584 case 0: 2585 t = _this.options.eventsUrl + "/pagehitandevent"; 2586 return _context62.a(2, _this.fetchGQL(e, { 2587 url: t, 2588 skipCleanup: !0 2589 })); 2590 } 2591 }, _callee62); 2592 })); 2593 return function (_x119) { 2594 return _ref62.apply(this, arguments); 2595 }; 2596 }(); 2597 } 2598 fetchGQL(e) { 2599 var _t$headers; 2600 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2601 var i = t.method || "POST", 2602 s = { 2603 "Content-Type": "application/json", 2604 Authorization: this.authToken || ((_t$headers = t.headers) === null || _t$headers === void 0 ? void 0 : _t$headers.Authorization) || "", 2605 "Device-Id": this.deviceId, 2606 "Onl-Location": document.location.href 2607 }, 2608 r = Object.assign(s), 2609 n = i === "POST" ? JSON.stringify(e) : null, 2610 a = t.keepalive || !1, 2611 l = i === "POST" ? this.options.graphQL : this.options.graphQLCDN, 2612 d = t.url || l; 2613 d.startsWith("http") || (d = l + d); 2614 var m = t.timeout || 2e3; 2615 return b(d, { 2616 method: i, 2617 headers: r, 2618 body: n, 2619 timeout: m, 2620 keepalive: a 2621 }).then(/*#__PURE__*/function () { 2622 var _ref63 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee63(h) { 2623 var c; 2624 return _regenerator().w(function (_context63) { 2625 while (1) switch (_context63.n) { 2626 case 0: 2627 if (h.ok) { 2628 _context63.n = 2; 2629 break; 2630 } 2631 _context63.n = 1; 2632 return h.text(); 2633 case 1: 2634 c = _context63.v;
2635 throw new Error("GQL:" + c); 2636 case 2: 2637 return _context63.a(2, h.json()); 2638 } 2639 }, _callee63); 2640 })); 2641 return function (_x120) { 2642 return _ref63.apply(this, arguments); 2643 }; 2644 }()).then(h => { 2645 var _window$Sentry2; 2646 if (t.skipCleanup) return h; 2647 var c = Object.keys(h.data || {}).map(A => h.data[A]), 2648 f = c.length ? c[0] : null; 2649 if (!f && h.errors) throw (_window$Sentry2 = window.Sentry) !== null && _window$Sentry2 !== void 0 && _window$Sentry2.setContext("gqlError", { 2650 url: d, 2651 method: i, 2652 headers: r, 2653 body: n, 2654 timeout: m, 2655 keepalive: a 2656 }), new W(h.errors); 2657 return f; 2658 }).catch(h => { 2659 throw console.warn("Fetch error:", h), h; 2660 }); 2661 } 2662 }, 2663 Ii = oe; 2664 var ne = class { 2665 constructor(e) { 2666 this.html = e; 2667 } 2668 sendEvent(e, t) { 2669 var i = new CustomEvent(e, { 2670 detail: t, 2671 bubbles: !0, 2672 cancelable: !0, 2673 composed: !1 2674 }); 2675 document.dispatchEvent(i); 2676 } 2677 on(e, t) { 2678 document.addEventListener(e, i => t(i)); 2679 } 2680 onWindow(e, t) { 2681 window.addEventListener(e, i => t(i)); 2682 } 2683 startEvents() { 2684 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body; 2685 var t = ["onclick", "onsubmit", "onmouseleave", "onmouseenter", "onmouseup", "onmousedown"]; 2686 t.forEach(i => { 2687 this.startEvent(i, this.html.q(e)); 2688 }); 2689 } 2690 startEvent(e, t) { 2691 this.html.qAll(`[data-${e}]`, t).forEach(i => { 2692 var s = this.html.getData(i, e), 2693 r = e.substring(2); 2694 i.addEventListener(r, n => { 2695 if (!window[s]) { 2696 console.log("Missing handler", s); 2697 return; 2698 } 2699 this.sendEvent("user_activity", { 2700 eventName: e, 2701 handler: s 2702 }), window[s](n); 2703 }); 2704 }); 2705 } 2706 }, 2707 Ai = ne; 2708 var ae = class { 2709 constructor() { 2710 this.scriptsLoaded = []; 2711 this.stylesLoaded = []; 2712 } 2713 q(e) { 2714 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2715 return typeof e != "string" ? e : (t || document).querySelector(e); 2716 } 2717 qAll(e) { 2718 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2719 if (e instanceof HTMLElement) return [e]; 2720 if (typeof e != "string") return e; 2721 var i = t || document; 2722 return Array.from(i.querySelectorAll(e)); 2723 } 2724 inject(e, t) { 2725 if (t) { 2726 if (typeof e == "string") { 2727 var i = this.qAll(e); 2728 if (!i || !i.length) return; 2729 e = i; 2730 } else Array.isArray(e) || (e = [e]); 2731 e.forEach(i => { 2732 this.qAll("[data-field]", i).forEach(s => this.injectFieldData(s, t)); 2733 }); 2734 } 2735 } 2736 writeHTML(e, t) { 2737 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2738 this.qAll(e, i).forEach(r => r.innerHTML = t); 2739 } 2740 appendHTML(e, t) { 2741 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2742 var s = this.q(e, i); 2743 s && s.insertAdjacentHTML("beforeend", t); 2744 } 2745 prependHTML(e, t) { 2746 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2747 var s = this.q(e, i); 2748 s && s.insertAdjacentHTML("afterbegin", t); 2749 } 2750 extractHTML(e, t) { 2751 var _DOMParser$parseFromS; 2752 return ((_DOMParser$parseFromS = new DOMParser().parseFromString(e, "text/html").querySelector(t)) === null || _DOMParser$parseFromS === void 0 ? void 0 : _DOMParser$parseFromS.innerHTML) || ""; 2753 } 2754 extractData(e, t, i) { 2755 var n = new DOMParser().parseFromString(e, "text/html").querySelector(t); 2756 if (!n) return ""; 2757 var a = n.dataset[i]; 2758 return a !== null && a !== void 0 ? a : ""; 2759 } 2760 extractElements(e, t) { 2761 var s = new DOMParser().parseFromString(e, "text/html"); 2762 return t.map(r => s.querySelector(r)); 2763 } 2764 show(e) { 2765 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "block"; 2766 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2767 this.qAll(e, i).forEach(s => s.style.display = t || "block"); 2768 } 2769 isShown(e) { 2770 var t = this.q(e); 2771 return t ? t.style.display !== "none" && t.style.display !== "" : !1; 2772 } 2773 hide(e) { 2774 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2775 this.qAll(e, t).forEach(i => i.style.display = "none"); 2776 } 2777 toggle(e) { 2778 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; 2779 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2780 this.qAll(e, i).forEach(s => { 2781 s.style.display === "none" ? this.show(s, t, i) : this.hide(s, i); 2782 }); 2783 } 2784 clear(e) { 2785 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2786 this.qAll(e, t).forEach(i => i.innerHTML = ""); 2787 } 2788 addClass(e, t) { 2789 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2790 var s = this.qAll(e, i); 2791 !(s !== null && s !== void 0 && s.length) || !t || s.forEac
2791h(r => { 2792 t.split(" ").filter(a => a).forEach(a => r.classList.add(a)); 2793 }); 2794 } 2795 removeClass(e, t) { 2796 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2797 var s = this.qAll(e, i); 2798 !(s !== null && s !== void 0 && s.length) || !t || s.forEach(r => { 2799 t.split(" ").filter(a => a).forEach(a => r.classList.remove(a)); 2800 }); 2801 } 2802 toggleClasses(e, t, i) { 2803 var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 2804 var r = this.qAll(e, s); 2805 if (!r.length || !t) return; 2806 var a = t.split(" ")[0]; 2807 r.forEach(l => { 2808 this.hasClass(l, a) ? (this.removeClass(l, t), this.addClass(l, i)) : (this.removeClass(l, i), this.addClass(l, t)); 2809 }); 2810 } 2811 toggleClass(e, t) { 2812 var i = this.qAll(e); 2813 i.length && t && i.forEach(s => this.hasClass(s, t) ? this.removeClass(s, t) : this.addClass(s, t)); 2814 } 2815 toggleClassIf(e, t, i) { 2816 var s = this.qAll(e); 2817 s.length && i && s.forEach(r => t ? this.addClass(r, i) : this.removeClass(r, i)); 2818 } 2819 hasClass(e, t) { 2820 var _this$q; 2821 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 2822 return !!((_this$q = this.q(e, i)) !== null && _this$q !== void 0 && _this$q.classList.contains(t)); 2823 } 2824 setStyle(e, t, i) { 2825 var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 2826 var r = this.qAll(e, s); 2827 r.length && r.forEach(n => n.style[t] = i); 2828 } 2829 setFocus(e) { 2830 var t = this.q(e); 2831 t && t.focus(); 2832 } 2833 getData(e, t) { 2834 var _this$q2; 2835 return ((_this$q2 = this.q(e)) === null || _this$q2 === void 0 ? void 0 : _this$q2.dataset[t]) || ""; 2836 } 2837 setData(e, t, i) { 2838 var s = this.q(e); 2839 s && (s.dataset[t] = i.toString()); 2840 } 2841 hasData(e, t) { 2842 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1; 2843 var s = this.q(e); 2844 return i ? !!(s !== null && s !== void 0 && s.dataset[t]) : (s === null || s === void 0 ? void 0 : s.dataset[t]) !== void 0; 2845 } 2846 setChecked(e, t) { 2847 var i = this.q(e); 2848 i && (i.checked = t); 2849 } 2850 isChecked(e) { 2851 var t = this.q(e); 2852 return t ? t.checked : !1; 2853 } 2854 closest(e, t) { 2855 var i = this.q(t); 2856 return i ? i.closest(e) : null; 2857 } 2858 buttonDisable(e) { 2859 this.q(e).disabled = !0; 2860 } 2861 buttonEnable(e) { 2862 this.q(e).disabled = !1; 2863 } 2864 closeFullscreen() { 2865 this.removeClass("body", "showing-fullscreen"); 2866 } 2867 openFullscreen() { 2868 this.addClass("body", "showing-fullscreen"); 2869 } 2870 fetchText(e) { 2871 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0; 2872 return t !== null && t !== void 0 && t.user && (t.headers = Object.assign(t.headers || {}, { 2873 Authorization: t.user.token, 2874 "Device-Id": t.user.deviceId, 2875 "Onl-Location": document.location.href 2876 })), w(() => b(e, t)).then(i => i === null || i === void 0 ? void 0 : i.text()); 2877 } 2878 execHtmlScript(e) { 2879 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; 2880 var i = this.q(e); 2881 if (!i || !i.innerHTML.includes("<script>") || !i.innerHTML.includes("<\/script>")) return; 2882 var s = i.innerHTML, 2883 r = s.indexOf("<script>") + 8, 2884 n = s.lastIndexOf("<\/script>"); 2885 if (t) { 2886 var a = s.indexOf("document.addEventListener", r); 2887 r = s.indexOf("{", a + 20) + 1, n = s.lastIndexOf("})", n); 2888 } 2889 s = s.substring(r, n), this.loadScript("", e, s); 2890 } 2891 loadVideoElements(e) { 2892 return this.loadScript("/assets/videojs/video_8.9.0.min.js").then(t => this.loadScript("https://imasdk.googleapis.com/js/sdkloader/ima3.js")).catch(t => {}).then(t => this.loadStyle("/assets/videojs/video-js_8.9.0.min.css")).then(t => Promise.all([this.loadScript("https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-vtt-thumbnails.min.js"), this.loadScript("https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-ads.min.js").cat
2892ch(i => {}), this.loadScript("https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs.ima.min.js").catch(i => {}), e ? this.loadScript("/assets/videojs/videojs-contrib-eme_5.5.2.min.js").catch(i => {}) : Promise.resolve()])).then(t => !0); 2893 } 2894 loadVideoBannerElements() { 2895 return this.loadScript("https://imasdk.googleapis.com/js/sdkloader/ima3.js").then(e => !0); 2896 } 2897 loadStyle(e) { 2898 return new Promise((t, i) => { 2899 if (this.styleExists(e)) { 2900 t(!0); 2901 return; 2902 } 2903 var s = document.createElement("link"); 2904 s.rel = "stylesheet", s.type = "text/css", s.media = "screen", s.href = e, s.onload = () => { 2905 this.stylesLoaded.push(e), t(!0); 2906 }, document.getElementsByTagName("head")[0].appendChild(s); 2907 }); 2908 } 2909 loadScript() { 2910 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; 2911 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; 2912 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ""; 2913 return !t && !e && Promise.resolve(!1), t = t || e, new Promise((s, r) => { 2914 if (this.scriptExists(t)) { 2915 s(!0); 2916 return; 2917 } 2918 var n = document.createElement("script"); 2919 n.type = "text/javascript", n.async = !0, e && (n.src = e), i && (n.text = i), n.onload = () => { 2920 s(!0), this.scriptsLoaded.push(t); 2921 }, n.onerror = a => { 2922 console.log("Load script error:", a), r(!1); 2923 }, document.getElementsByTagName("body")[0].appendChild(n); 2924 }); 2925 } 2926 formatShortDate(e) { 2927 var t = ("0" + e.getDate()).slice(-2), 2928 i = ("0" + (e.getMonth() + 1)).slice(-2), 2929 s = e.getFullYear(); 2930 return t + ". " + i + ". " + s; 2931 } 2932 safeJsonParse(e) { 2933 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2934 if (!e) return t; 2935 try { 2936 return JSON.parse(e); 2937 } catch (i) { 2938 return console.log("Safe Parse Error", e, i), t; 2939 } 2940 } 2941 scriptExists(e) { 2942 return this.scriptsLoaded.includes(e); 2943 } 2944 styleExists(e) { 2945 return this.stylesLoaded.includes(e); 2946 } 2947 injectFieldData(e, t) { 2948 var i = this.getData(e, "field"); 2949 i && (e instanceof HTMLImageElement ? i === "avatar" && (e.src = t[i]) : e instanceof HTMLElement && (e.innerHTML = t[i])); 2950 } 2951 }, 2952 qi = ae; 2953 var le = class { 2954 constructor(e, t, i, s) { 2955 this.html = e; 2956 this.events = t; 2957 this.cookies = i; 2958 this.options = s; 2959 } 2960 splideInit() { 2961 this.html.qAll(".splide").length && this.html.loadStyle("/assets/splidejs/splide.min.css?v=" + this.options.version).then(() => this.html.loadScript("/assets/splidejs/splide.min.js?v=" + this.options.version)).then(() => this.events.sendEvent("splide-loaded", "")); 2962 } 2963 animalParts(e, t, i, s, r) { 2964 var n = ".onl-" + e, 2965 a = this.html.q(n + " .img-animal-parts"), 2966 l = a.src; 2967 a.src = l.substring(0, l.lastIndexOf("/") + 1) + e + "-" + t + ".png", this.html.removeClass(n + " BUTTON", "tag--animal-active"), this.html.addClass(n + " .btn-" + t, "tag--animal-active"), this.html.writeHTML(n + " .onl-recipe-title", i), this.html.fetchText(`/animal-part-recipe/${s}/${r}`).then(d => this.html.writeHTML(n + " .onl-recipe-placeholder", d)); 2968 } 2969 bodyParts(e, t, i) { 2970 var s = "/telo?gender=" + encodeURIComponent(e); 2971 t && t !== i && (s += "&body_part=" + encodeURIComponent(t)), location.href = s; 2972 } 2973 fillRefridgeratorSelect(e) { 2974 e.options.length > 1 || this.html.fetchText("/recipes/main-ingredients").then(t => { 2975 var i = JSON.parse(t).map(s => '<option value="' + s.ItemId + "_" + s.Name.replace('"', "") + '">' + s.Name + "</option>").join(""); 2976 e.innerHTML += i; 2977 }); 2978 } 2979 itm(e) { 2980 var t = this.html.q("#itm_height").value, 2981 i = this.html.q("#itm_weight").value, 2982 s = parseInt(t.replace(",", "."), 10), 2983 r = parseInt(i.replace(",", "."), 10); 2984 if (!(isNaN(s) || isNaN(r) || !s || !r)) { 2985 if (e === "calculate") { 2986 var n = Math.floor(r * 1e4 / (s * s)); 2987 this.html.writeHTML("#itm_value", n.toString()), this.html.show("#itm_result"); 2988 } 2989 e === "enableBtn" && this.html.removeClass(".itm > button", "button-disabled"); 2990 } 2991 } 2992 bmr() { 2993 var e = this.html.q("#bmr_age").value, 2994 t = this.html.q("#bmr_height").value, 2995 i = this.html.q("#bmr_weight").value, 2996 s = this.html.q("#bmr_gender_m").checked ? "M" : "F", 2997 r = parseInt(e.replace(",", "."), 10), 2998 n = parseInt(t.replace(",", "."), 10), 2999 a = parseInt(i.replace(",", "."), 10); 3000 if (isNaN(r) || isNaN(n) || isNaN(a) || !r || !n || !a) { 3001 this.html.hide("#bmr_results"); 3002 return; 3003 } 3004 var l = 0; 3005 s === "F" ? l = Math.round(655 + 9.6 * a + 1.8 * n - 4.7 * r) : l = Math.round(66 + 13.7 * a + 5 * n - 6.8 * r), this.html.writeHTML("#bmr_value", "" + l), this.html.show("#bmr_results"); 3006 } 3007 instagram() { 3008 if (this.html.show("#instagram"), (typeof Splide === "undefined" ? "undefined" : _typeof(Splide)) > "u") { 3009 this.events.on("splide-loaded", () => this.instagram()); 3010 return; 3011 } 3012 new Splide("#instagram", { 3013 perPage: 5, 3014 gap: 10, 3015 type: "loop", 3016 lazyLoad: "nearby", 3017 arrows: "true", 3018 autoplay: "true", 3019 breakpoints: { 3020 640: { 3021 perPage: 2 3022 } 3023 } 3024 }).mount(); 3025 } 3026 roadMapInit() { 3027 this.map = L.map("map", { 3028 zoomControl: !1 3029 }
3029).setView([45.988551, 14.810986], 8), L.tileLayer("https://maps.api.24ur.si/osm_tiles/{z}/{x}/{y}.png", { 3030 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', 3031 maxZoom: 12, 3032 minZoom: 8 3033 }).addTo(this.map); 3034 } 3035 roadMapMarkers(e) { 3036 this.map.eachLayer(r => { 3037 r instanceof L.Marker && this.map.removeLayer(r); 3038 }); 3039 var t = [], 3040 i = [{ 3041 check: "#road_accidents", 3042 data: e.Accidents 3043 }, { 3044 check: "#road_traffic", 3045 data: e.Traffic 3046 }, { 3047 check: "#road_works", 3048 data: e.Works 3049 }, { 3050 check: "#road_events", 3051 data: e.Events 3052 }], 3053 s = i.filter(r => this.html.isChecked(r.check)); 3054 t = (s.length > 0 ? s : i).reduce((r, n) => r.concat(n.data), []), t.forEach(r => { 3055 var n = L.icon({ 3056 iconUrl: "/assets/img/roads/map/" + (r.Priority > 3 ? "3" : r.Priority.toString()) + "/" + r.Sign + ".png", 3057 iconSize: [20, 20] 3058 }); 3059 L.marker([r.Lat, r.Lng], { 3060 icon: n 3061 }).addTo(this.map).bindPopup("<b>" + r.RoadFull + "</b><br>" + r.Info); 3062 }); 3063 } 3064 startMailingPopup(e) { 3065 if (!this.cookies.cookies.isImportantAllowed()) return; 3066 var t = 1e3 * 60 * 60 * 24 * 30, 3067 i = parseInt(this.cookies.get("popup") || "0", 10), 3068 s = new Date().getTime(); 3069 (!i || s - i > t) && setTimeout(() => { 3070 this.html.show("#mailing_popup", "flex"), this.cookies.set("popup", "" + s); 3071 }, e.Delay); 3072 } 3073 copyToClipboard(e, t) { 3074 navigator.clipboard.writeText(t), this.html.addClass(e, "text-copied"), setTimeout(() => { 3075 this.html.removeClass(e, "text-copied"); 3076 }, 2e3); 3077 } 3078 runTicker(e) { 3079 requestAnimationFrame(() => { 3080 setTimeout(() => { 3081 this.moveTicker(e); 3082 }, 4e3); 3083 }); 3084 } 3085 initChat(e) { 3086 var t = e === null || e === void 0 ? void 0 : e.getCurrentUserStatus(); 3087 if (["hr", "rs", "ba"].includes(this.options.country) && t !== null && t !== void 0 && t.vendors["synverso-rpHFAEwq"]) { 3088 var i = t.vendors["synverso-rpHFAEwq"]; 3089 i && i.enabled && this.html.loadScript("/assets/chat/chat_" + this.options.country + ".js"); 3090 } 3091 if (["si"].includes(this.options.country) && t !== null && t !== void 0 && t.vendors["nexios-QazcaFyb"]) { 3092 var _i2 = t.vendors["nexios-QazcaFyb"]; 3093 _i2 && _i2.enabled && this.html.loadScript("/assets/chat/chat_" + this.options.country + ".js"); 3094 } 3095 } 3096 initExponea(e) { 3097 var t = e === null || e === void 0 ? void 0 : e.getCurrentUserStatus(); 3098 ["ba", "hr", "rs"].includes(this.options.country) && t !== null && t !== void 0 && t.vendors["bloomreach-9PPPkYrG"] && this.html.loadScript("/assets/exponea/exponea_" + this.options.country + ".js"), ["si", "bg"].includes(this.options.country) && (t === null || t === void 0 ? void 0 : t.vendors["bloomreach-zR9Zmbfe"]) && this.html.loadScript("/assets/exponea/exponea_" + this.options.country + ".js"); 3099 } 3100 exponeaIdentifyUser(e) { 3101 var t = window.exponea; 3102 !t || !e || t.identify({ 3103 user_id: e.id 3104 }); 3105 } 3106 moveTicker(e) { 3107 var t = this.html.qAll(e + " .ticker_item"), 3108 i = this.html.q(e + " .ticker_active"), 3109 s = this.html.q(e + " .ticker_item"); 3110 if (!s || !t || !i) return; 3111 this.html.removeClass(i, "ticker_active"); 3112 var r = t.indexOf(i) + 1; 3113 r >= t.length ? this.html.addClass(s, "ticker_active") : this.html.addClass(t[r], "ticker_active"), this.runTicker(e); 3114 } 3115 }, 3116 Hi = le; 3117 function Di() { 3118 return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, o => (o ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> o / 4).toString(16)); 3119 } 3120 var de = class { 3121 constructor(e, t, i, s, r) { 3122 this.events = e; 3123 this.cookies = t; 3124 this.gql = i; 3125 this.html = s; 3126 this.options = r; 3127 this.user = null; 3128 this.deviceId = null; 3129 } 3130 handleDeviceId() { 3131 this.deviceId = this.cookies.get("device-id"), this.deviceId || (this.deviceId = Di(), this.cookies.set("device-id", this.deviceId || "")), this.gql.deviceId = this.deviceId || ""; 3132 } 3133 get hasDeviceId() { 3134 return !!this.cookies.get("device-id"); 3135 } 3136 get cacheBuster() { 3137 var _this$user; 3138 return (_this$user = this.user) !== null && _this$user !== void 0 && _this$user.token ? "v=" + this.user.token.substring(this.user.token.length - 8) + "_" + Math.random().toString() + "&t=" + new Date().getTime() : "v=" + Math.random().toString() + "&t=" + new Date().getTime(); 3139 } 3140 loadUserInfo() { 3141 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0; 3142 var t = this.cookies.get("sso_jwt"); 3143 return t ? (this.gql.authToken = t, this.gql.loginInfo(t, this.options.siteId, e).then(i => !i && window.isPageUnloading ? Promise.reject("page_unloading") : i).then(i => this.userLoaded(i)).catch(i => i === "page_unloading" ? Promise.reject(i) : (this.userLoaded(null), Promise.reject(null)))) : (this.userLoaded(null), Promise.resolve(null)); 3144 }
3145 tryCrossLogin() { 3146 var e = this.html.getData("#sso_iframe", "src"), 3147 t = this.html.q("#sso_iframe"); 3148 !t || !e || (this.events.onWindow("message", i => { 3149 i.origin === this.options.loginUrl && (this.processCrossLoginMessage(i.data), i.data && i.data.jwt && this.loadUserInfo()); 3150 }), t.src = e); 3151 } 3152 processCrossLoginMessage(e) { 3153 e.deviceId && this.deviceId !== e.deviceId && (this.deviceId = e.deviceId || "", this.cookies.set("device-id", this.deviceId), this.gql.deviceId = this.deviceId), e.jwt && this.cookies.set("sso_jwt", e.jwt); 3154 } 3155 userLoaded(e) { 3156 return this.user = e, this.html.removeClass("body", "user-unknown user-loggedin"), e ? (this.cookies.set("sso_jwt", e.token), this.gql.authToken = e.token, this.html.addClass("body", "user-loggedin"), this.events.sendEvent("user", this.user)) : (this.cookies.delete("sso_jwt"), this.gql.authToken = ""), e; 3157 } 3158 logout() { 3159 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/odjava"; 3160 var t = this.cookies.get("sso_jwt") || ""; 3161 this.userLoaded(null), this.goLogin(e, t); 3162 } 3163 goLogin() { 3164 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/prijava"; 3165 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; 3166 var i = this.cookies.get("device-id") || "", 3167 s = this.options.loginUrl + e; 3168 s += "?c=" + new Date().getTime() + "_" + Math.random(), s += "&from=" + encodeURIComponent(location.toString()), s += "&device_id=" + encodeURIComponent(i), t && (s += "&jwt=" + encodeURIComponent(t)), window.location.href = s; 3169 } 3170 submitMailing(e, t, i) { 3171 var s = this.html.q('input[type="email"]', e); 3172 s && this.gql.registerEmailOnly(s.value, this.options.siteId, t, i).then(r => this.afterRegisterEmailOnly(r, e)).catch(() => { 3173 this.html.show("#mailing_error", "block", e); 3174 }); 3175 } 3176 colorScheme(e) { 3177 var _this$html$q, _this$html$q2; 3178 if ((_this$html$q = this.html.q("html")) !== null && _this$html$q !== void 0 && _this$html$q.classList.remove("dark", "light"), (_this$html$q2 = this.html.q("html")) !== null && _this$html$q2 !== void 0 && _this$html$q2.classList.add(e), this.events.sendEvent("colorSchemeChange", e), e === this.options.colorScheme) { 3179 localStorage.removeItem("color_scheme"); 3180 return; 3181 } 3182 localStorage.setItem("color_scheme", e); 3183 } 3184 afterRegisterEmailOnly(e, t) { 3185 this.html.show("#mailing_success", "flex", t.parentElement), this.html.hide(t), t.reset(); 3186 } 3187 }, 3188 Vi = de; 3189 var me = class extends Vi { 3190 constructor(t, i, s, r, n, a, l) { 3191 super(t, i, s, r, l); 3192 this.events = t; 3193 this.cookies = i; 3194 this.gql = s; 3195 this.html = r; 3196 this.profiles = n; 3197 this.localStorage = a; 3198 this.options = l; 3199 } 3200 loginUser(t, i) { 3201 return !t || !i ? Promise.reject(null) : this.gql.loginUser(t, i, this.options.siteId).then(s => this.userLoaded(s)); 3202 } 3203 loginWithDevice(t, i) { 3204 return t ? this.gql.loginWithDevice(t, i, this.options.siteId).then(s => this.userLoaded(s)) : Promise.resolve(null); 3205 } 3206 registerUser(t, i, s, r, n, a, l) { 3207 var d = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : !1; 3208 return this.gql.registerUser(t, i, "", "U", this.options.siteId, d, s, r, n, a, l).then(m => this.userLoaded(m)); 3209 } 3210 newPassword(t, i) { 3211 return !t || !i ? Promise.reject() : this.gql.newPassword(t, i).then(s => this.userLoaded(s)); 3212 } 3213 userLoaded(t) { 3214 return super.userLoaded(t), t || this.deleteCookiesAndStorage(), t; 3215 } 3216 logoutUser() { 3217 var t = this.gql.logoutUser(); 3218 return this.deleteCookiesAndStorage(), t; 3219 } 3220 deleteCookiesAndStorage() { 3221 this.cookies.delete("sso_jwt"), this.localStorage.remove("voyoBookmarks"), this.localStorage.remove("voyoProfiles"); 3222 } 3223 loginToProfile(t) { 3224 return t ? this.gql.loginProfile(t).then(i => this.userLoaded(i)).then(i => { 3225 if (!i) throw new Error("no user"); 3226 return this.profiles.voyoProfiles(!1).then(() => i); 3227 }).catch(i => { 3228 throw this.profiles.profilesToCache([]), i; 3229 }) : Promise.reject(null); 3230 } 3231 saveProfile(t, i, s, r) { 3232 return !i || !r ? Promise.resolve(null) : t ? this.gql.updateProfile(t, i, r) : this.gql.newProfile(i, s, r); 3233 } 3234 deleteProfile(t, i) { 3235 return t ? this.gql.deleteProfile(t).then(s => { 3236 this.profiles.profilesToCache(s); 3237 var r = this.profiles.profileOfType(i); 3238 return this.loginToProfile((r === null || r === void 0 ? void 0 : r.profileId) || 0); 3239 }) : Promise.reject(null); 3240 } 3241 linkDeviceToUser(t) { 3242 var _this$user2; 3243 return t ? (_this$user2 = this.user) !== null && _this$user2 !== void 0 && _this$user2.deviceId ? Promise.resolve(this.user) : this.gql.linkDeviceToUser(this.options.device.family, this.options.device.name, this.options.device.model).then(i => this.userLoaded(i)) : Promise.resolve(this.user); 3244 } 3245 loginGuard(t) { 3246 return this.user ? !0 : (t && (t.preventDefault(), t.stopPropagation()), document.location.href = this.options.routes.login, !1); 3247 } 3248 subscriptionGuard(t) { 3249 var _this$user3; 3250 return this.loginGuard(t) ? (_this$user3 = this.user) !== null && _this$user3 !== void 0 && _this$user3.isSubscribed ? !0 : (t && (t.preventDefault(), t.stopPropagation()), document.location.href = this.options.routes.activation, !1) : !1; 3251 } 3252 }, 3253 _i = me; 3254 var he = class { 3255 constructor(e, t, i, s, r, n, a, l, d) { 3256 this.html = e; 3257 this.events = t; 3258 this.user = i; 3259 this.voyoVideo = s; 3260 this.gql = r; 3261 this.profiles = n; 3262 this.bookmarks = a; 3263 this.localStorage = l; 3264 this.options = d; 3265 } 3266 playTrailer(e) { 3267 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 3268 var i = this.html.q(".trailer", this.html.q(e)); 3269 if (i) { 3270 if (_typeof(t.muted) > "u") { 3271 var s = this.html.hasClass("body", "trailer_muted"); 3272 t.muted = s; 3273 } 3274 this.voyoVideo.initForTrailer(i, t); 3275 } 3276 } 3277 toggleBookmark(e) { 3278 this.bookmarks.isBookmarked("GRP_DEFAULT", e) ? (this.bookmarks.voyoBookmarkRemove("GRP_DEFAULT", e), this.html.addClass("#content", "myVoyo-removed-check"), setTimeout(() => { 3279 this.html.removeClass("#content", "myVoyo"), this.html.removeClass("#content", "myVoyo-removed-check"); 3280 }, 2e3)) : (this.bookmarks.voyoBookmarkAdd("GRP_DEFAULT", new p({ 3281 entityId: e 3282 })), this.html.addClass("#content", "myVoyo myVoyo-check"), setTimeout(() => { 3283 this.html.removeClass("#content", "myVoyo-check"); 3284 }, 2e3)); 3285 } 3286 toggleSlideBookmark(e, t) { 3287 var i = this.bookmarks.isBookmarked("GRP_DEFAULT", t), 3288 s; 3289 i ? s = this.bookmarks.voyoBookmarkRemove("GRP_DEFAULT", t).then(() => { 3290 this.html.addClass(e.closest(".splide__slide"), "myVoyo-removed-check"), setTimeout(() => { 3291 var r = this.html.qAll('.splide__slide[data-uniq="' + t + '"]'); 3292 this.html.removeClass(r, "myVoyo"), this.html.removeClass(r, "myVoyo-removed-check"); 3293 }, 2e3); 3294 }) : s = this.bookmarks.voyoBookmarkAdd("GRP_DEFAULT", new p({ 3295 entityId: t 3296 })).then(() => { 3297 var r = this.html.qAll('.splide__slide[data-uniq="' + t + '"]'); 3298 this.html.addClass(r, "myVoyo myVoyo-check"), setTimeout(() => { 3299 this.html.removeClass(r, "myVoyo-check"); 3300 }, 2e3); 3301 }), s.then(() => this.reloadMyVoyoBookmarkSlides()); 3302 } 3303 tagMyVoyoBookmarks() { 3304 var _this$bookmarks$get; 3305 var e = (_this$bookmarks$get = this.bookmarks.get()) === null || _this$bookmarks$get === void 0 ? void 0 : _this$bookmarks$get.groupItems("GRP_DEFAULT"); 3306 if (!(e !== null && e !== void 0 && e.length)) return; 3307 var t = new Set(e.map(s => String(s.voyokey))), 3308 i = this.html.qAll("[data-uniq]").filter(s => t.has(this.html.getData(s, "uniq"))); 3309 this.html.addClass(i, "myVoyo"); 3310 } 3311 hasBookmarksBox() { 3312 return !!this.html.q(".voyobox.bookmarks") || !!this.html.q(".voyobox.continue_watching"); 3313 } 3314 loadBookmarkSlides() { 3315 var _this$user$user; 3316 if (!((_this$user$user = this.user.user) !== null && _this$user$user !== void 0 && _this$user$user.token)) return Promise.resolve(null); 3317 var t = this.html.getData("body", "urlPrefix") + "/bookmark/voyobox_slides?" + this.user.cacheBuster; 3318 return this.html.fetchText(t, { 3319 timeout: 4e3, 3320 user: this.user.user 3321 }).then(i => { 3322 var _this$html$q3, _this$html$q4; 3323 var _this$html$extractEle = this.html.extractElements(i, ["#stayedat", "#myvoyo", "#bookmarks-data"]), 3324 _this$html$extractEle2 = _slicedToArray(_this$html$extractEle, 3), 3325 s = _this$html$extractEle2[0], 3326 r = _this$html$extractEle2[1], 3327 n = _this$html$extractEle2[2], 3328 a = (s === null || s === void 0 ? void 0 : s.innerHTML) || "", 3329 l = (r === null || r === void 0 ? void 0 : r.innerHTML) || ""; 3330 return a.trim().length > 100 ? this.html.writeHTML(".voyobox.continue_watching .slider", a) : (_this$html$q3 = this.html.q(".voyobox.continue_watching")) === null || _this$html$q3 === void 0 ? void 0 : _this$html$q3.remove(), l.trim().length > 100 ? this.html.writeHTML(".voyobox.bookmarks .slider", l) : (_this$html$q4 = this.html.q(".voyobox.bookmarks")) === null || _this$html$q4 === void 0 ? void 0 : _this$html$q4.remove(), this.events.sendEvent("bookmarks-sli
3330des-fetched", {}), this.parseBookmarksData((n === null || n === void 0 ? void 0 : n.dataset.bookmarks) || ""); 3331 }).catch(() => { 3332 var _this$html$q5, _this$html$q6; 3333 return (_this$html$q5 = this.html.q(".voyobox.continue_watching")) !== null && _this$html$q5 !== void 0 && _this$html$q5.remove(), (_this$html$q6 = this.html.q(".voyobox.bookmarks")) !== null && _this$html$q6 !== void 0 && _this$html$q6.remove(), null; 3334 }); 3335 } 3336 parseBookmarksData(e) { 3337 if (!e) return null; 3338 try { 3339 return new M(JSON.parse(e)); 3340 } catch (t) { 3341 return app.error("Error parsing bookmarks data:", t, e), null; 3342 } 3343 } 3344 reloadMyVoyoBookmarkSlides() { 3345 var _this$user$user2; 3346 if (!((_this$user$user2 = this.user.user) !== null && _this$user$user2 !== void 0 && _this$user$user2.token)) return Promise.reject(!1); 3347 var t = this.html.getData("body", "urlPrefix") + "/bookmark/voyobox_slides?" + this.user.cacheBuster; 3348 return this.html.fetchText(t, { 3349 timeout: 4e3, 3350 user: this.user.user 3351 }).then(i => { 3352 var _this$html$q7; 3353 var s = this.html.extractHTML(i, "#myvoyo"); 3354 s.trim().length > 100 ? (this.html.writeHTML(".voyobox.bookmarks .slider", s), this.events.sendEvent("myVoyo-slide-reloaded", {})) : (_this$html$q7 = this.html.q(".voyobox.bookmarks")) === null || _this$html$q7 === void 0 ? void 0 : _this$html$q7.remove(); 3355 }).catch(() => { 3356 var _this$html$q8; 3357 (_this$html$q8 = this.html.q(".voyobox.bookmarks")) === null || _this$html$q8 === void 0 || _this$html$q8.remove(); 3358 }); 3359 } 3360 loadRecommendedSlides() { 3361 var _this$user$user3; 3362 if (!((_this$user$user3 = this.user.user) !== null && _this$user$user3 !== void 0 && _this$user$user3.token)) return Promise.resolve(!1); 3363 var e = "/recommended/voyobox_slides?" + this.user.cacheBuster; 3364 return this.html.fetchText(e, { 3365 timeout: 4e3, 3366 user: this.user.user 3367 }).then(t => { 3368 var _this$html$q9; 3369 if (t.trim().length < 100) return !1; 3370 var _this$html$extractEle3 = this.html.extractElements(t, ["#main_slides", "#main_slides_view_tracker", "#other_boxes"]), 3371 _this$html$extractEle4 = _slicedToArray(_this$html$extractEle3, 3), 3372 i = _this$html$extractEle4[0], 3373 s = _this$html$extractEle4[1], 3374 r = _this$html$extractEle4[2], 3375 n = (i === null || i === void 0 ? void 0 : i.innerHTML) || "", 3376 a = (s === null || s === void 0 ? void 0 : s.innerHTML) || "", 3377 l = (r === null || r === void 0 ? void 0 : r.innerHTML) || ""; 3378 this.html.appendHTML(".recommended_main .slider", n), this.html.writeHTML(".recommended_main .view_tracker", a), l.length > 100 && ((_this$html$q9 = this.html.q(".recommended_main")) === null || _this$html$q9 === void 0 ? void 0 : _this$html$q9.insertAdjacentHTML("afterend", l)); 3379 }).catch(t => (app.log("Error loading recommended slides", t), !1)); 3380 } 3381 loadSeasonEpisodes(e, t, i, s) { 3382 var r = this.html.getData(s, "current"), 3383 a = this.html.getData("body", "urlPrefix") + "/info/" + e + "/seasons/" + encodeURIComponent(t) + "/episodes/" + i; 3384 return t === r ? Promise.resolve(!1) : this.html.fetchText(a).then(l => { 3385 var d = this.html.extractHTML(l, "#season_episodes"); 3386 this.html.writeHTML(s, d), this.html.setData(s, "current", t); 3387 }); 3388 } 3389 refreshStreams() { 3390 return this.html.fetchText("/streams").then(e => { 3391 var _this$html$extractEle5 = this.html.extractElements(e, ["#voyobox_streams .track"]), 3392 _this$html$extractEle6 = _slicedToArray(_this$html$extractEle5, 1), 3393 t = _this$html$extractEle6[0], 3394 i = this.html.getData("#voyobox_streams .track", "hash"), 3395 s = (t === null || t === void 0 ? void 0 : t.dataset.hash) || ""; 3396 if (i === s) return [!1, ""]; 3397 var r = (t === null || t === void 0 ? void 0 : t.innerHTML) || ""; 3398 return [!!r, r]; 3399 }).catch(e => (app.error("Error refreshing streams:", e), [!1, ""])); 3400 } 3401 showStaticContentDetails(e) { 3402 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ".details_placeholder"; 3403 var i = this.html.q("#" + e); 3404 i && (this.voyoVideo.stopVideoPlayers(), this.html.writeHTML(t, i.innerHTML), this.html.removeClass(t, "hidden")); 3405 } 3406 hideContentDetails() { 3407 this.html.writeHTML(".details_placeholder", ""), this.html.addClass(".details_placeholder", "hidden"); 3408 } 3409 streamReminder(e) { 3410 this.gql.liveStreamReminder(e).then(() => { 3411 this.html.removeClass("#content .stream_reminder_toast", "hidden"), this.html.buttonDisable("#content .stream_reminder_button"), setTimeout(() => { 3412 this.html.addClass("#content .stream_reminder_toast", "hidden"), this.html.buttonEnable("#content .stream_reminder_button"); 3413 }, 2e3); 3414 }); 3415 } 3416 }, 3417 xi = he; 3418 var ce = class { 3419 constructor(e, t, i, s, r, n, a, l, d) { 3420 this.html = e; 3421 this.user = t; 3422 this.bookmarks = i; 3423 this.gql = s; 3424 this.events = r; 3425 this.muxStats = n; 3426 this.shaka = a; 3427 this.rateLimiter = l; 3428 this.options = d; 3429 this.timelinePreview = null; 3430 this.timelineOrigin = null; 3431 this.timelineEl = null; 3432 this.btnEndCredits = null; 3433 this.btnEpisodeRecap = null; 3434 this.btnStartCredits = null; 3435 this.volumeEl = null; 3436 this.freezeControls = !1; 3437 this.currentVideoId = 0; 3438 this.lastTimeUpdateAt = 0; 3439 this.lastEpgUrl = ""; 3440 document.addEventListener("fullscreenchange", () => this.onFullscreenChange()), this.throttledShowVideoControls = this.rateLimiter.throttle(this.showVideoControls.bind(this), 400); 3441 } 3442 lookupElements() { 3443 this.controlsEl = this.html.q("#controls"), this.timelinePreview = this.html.q("#timeline_preview", this.controlsEl), this.timelineEl = this.html.q("voyo-timeline", this.controlsEl), this.btnEpisodeRecap = this.html.q("#episode_recap"), this.btnStartCredits = this.html.q("#start_credits"), this.btnEndCredits = this.html.q("#next_episode"), this.volumeEl = this.html.q("voyo-volume", this.controlsEl); 3444 } 3445 initForPlay(e, t, i) { 3446 var _this$volumeEl; 3447 if (this.video = this.html.q(e), !this.video) throw new Error("What video element: " + e + "?"); 3448 if (!t) throw new Error("What video id: " + t + "?"); 3449 this.currentVideoId = t, clearTimeout(this.trailerTimer); 3450 var s = this.html.getData(this.video, "playbackOptions"); 3451 return this.videoOptions = Object.assign({}, this.html.safeJsonParse(s), i), this.videoOptions.type !== "live_stream" && !this.videoOptions.isTrailer && (this.videoOptions.allowSaveToStayedAt = !0), this.videoOptions.drmProtected = !this.videoOptions.isTrailer, this.videoOptions.type = this.videoOptions.type || "video", this.thumbnails = [], this.lookupElements(), this.setEvents(this.video, this.videoOptions), (_this$volumeEl = this.volumeEl) !== null && _this$volumeEl !== void 0 && _this$volumeEl.setVolume(this.options.videoVolume, this.options.videoMuted), this.loadUrl(this.video, t, this.videoOptions).then(() => this.parseVtt(this.video, this.videoOptions)).catch(r => { 3452 var n = (r === null || r === void 0 ? void 0 : r.message) || "";
3453 n === "no_access" ? document.location.href = "/" : n === "too_many_devices" ? document.location.href = this.options.routes.too_many_devices : app.log("Video playback error", r); 3454 }); 3455 } 3456 initForCatchUp(e, t) { 3457 var _this$volumeEl2; 3458 if (this.video = this.html.q(e), !this.video) throw new Error("What epg element: " + e + "?"); 3459 var i = this.html.getData(this.video, "playbackOptions"); 3460 return this.videoOptions = Object.assign({}, this.html.safeJsonParse(i), t), this.videoOptions.drmProtected = !0, this.videoOptions.type = "epg", this.thumbnails = [], this.lookupElements(), this.setEvents(this.video, this.videoOptions), (_this$volumeEl2 = this.volumeEl) !== null && _this$volumeEl2 !== void 0 && _this$volumeEl2.setVolume(this.options.videoVolume, this.options.videoMuted), this.loadEpgUrl(this.video, this.videoOptions).catch(s => { 3461 var r = (s === null || s === void 0 ? void 0 : s.message) || ""; 3462 r === "no_access" ? document.location.href = "/" : r === "too_many_devices" ? document.location.href = this.options.routes.too_many_devices : app.log("Epg playback error", s); 3463 }); 3464 } 3465 initForTrailer(e) { 3466 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 3467 if (this.video = this.html.q(e), !this.video) throw new Error("What video element: " + e + "?"); 3468 clearTimeout(this.trailerTimer); 3469 var i = +this.html.getData(e, "trailer"); 3470 if (!i) return; 3471 this.currentVideoId = i; 3472 var s = this.html.getData(this.video, "playbackOptions"); 3473 t = Object.assign({}, this.html.safeJsonParse(s), t), this.lookupElements(), t.drmProtected = !1, t.isTrailer = !0, t.type = "video", t.paused = !this.options.playTrailers, this.video.onended = n => this.onTrailerEnded(t, n); 3474 var r = this.video.closest(".splide") || this.html.q("body"); 3475 this.html.removeClass(r, "trailer_playing trailer_replay"), this.html.addClass(r, "trailer_init"), this.video.volume = this.options.videoVolume, this.video.muted = t.muted || !1, this.trailerTimer = setTimeout(() => { 3476 this.loadUrl(this.video, i, t).then(() => { 3477 this.html.removeClass(r, "trailer_init"), t.paused ? this.html.hide(this.video) : (this.html.show(this.video), this.html.addClass(r, "trailer_playing")); 3478 }).catch(n => app.log("Trailer playback error", n)); 3479 }, 2500); 3480 } 3481 playPauseTrailer() { 3482 if (!this.video) return; 3483 this.html.show(this.video); 3484 var e = this.video.closest(".splide") || this.html.q("body"); 3485 this.video.paused ? (this.video.play(), this.html.addClass(e, "trailer_playing")) : (this.video.pause(), this.html.removeClass(e, "trailer_playing")); 3486 } 3487 replayTrailer() { 3488 if (!this.video) return; 3489 var e = this.video.closest(".splide") || this.html.q("body"); 3490 this.html.addClass(e, "trailer_playing"), this.html.removeClass(e, "trailer_replay"), this.html.show(this.video), this.video.currentTime = 0, this.video.play(); 3491 } 3492 onTrailerEnded(e, t) { 3493 this.html.hide(t.target); 3494 var i = this.html.q(".trailer_playing"); 3495 i && (this.html.removeClass(i, "trailer_playing"), this.html.addClass(i, "trailer_replay")); 3496 } 3497 stopVideoPlayers() { 3498 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1; 3499 this.currentVideoId = 0, this.shaka.destroy(), this.html.qAll("video").forEach(t => { 3500 var _i$parentNode; 3501 var i = t; 3502 for (i.pause(); i.firstChild;) i.removeChild(i.firstChild); 3503 i.removeAttribute("src"), i.load(), this.html.hide(t), e && ((_i$parentNode = i.parentNode) === null || _i$parentNode === void 0 ? void 0 : _i$parentNode.removeChild(i)); 3504 }), clearTimeout(this.trailerTimer), this.html.removeClass(".trailer_playing", "trailer_playing"), this.html.removeClass(".trailer_replay", "trailer_replay"), this.setControlsFrozen(!1); 3505 } 3506 stopEndCredits() { 3507 this.btnEndCredits && this.html.addClass(this.btnEndCredits, "hidden"), this.html.setData(this.video, "endcredits", "stop"); 3508 } 3509 stopEpisodeRecap() { 3510 this.btnEpisodeRecap && this.html.addClass(this.btnEpisodeRecap, "hidden"), this.html.setData(this.video, "episoderecap", "stop"); 3511 } 3512 stopStartCredits() { 3513 this.btnStartCredits && this.html.addClass(this.btnStartCredits, "hidden"), this.html.setData(this.video, "startcredits", "stop"); 3514 } 3515 parseVtt(e, t) { 3516 return t.vtt ? this.html.fetchText(t.vtt).then(i => { 3517 var _this$timelineEl; 3518 var r = i.split(` 3519 3520`).filter(n => n.includes("thumbs.jpg#xywh=")).map((n, a) => { 3521 var l = n.match(/(\d+):(\d+):(\d+\.\d+)/), 3522 d = n.match(/thumbs\.jpg#xywh=(\d+),(\d+),(\d+),(\d+)/); 3523 if (l && d) { 3524 var m = parseInt(l[1]) * 3600 + parseInt(l[2]) * 60 + parseFloat(l[3]), 3525 _d$map = d.map(Number), 3526 _d$map2 = _slicedToArray(_d$map, 5), 3527 h = _d$map2[0], 3528 c = _d$map2[1], 3529 f = _d$map2[2], 3530 A = _d$map2[3], 3531 as = _d$map2[4]; 3532 return { 3533 time: m, 3534 x: c, 3535 y: f, 3536 width: A, 3537 height: as, 3538 index: a 3539 }; 3540 } 3541 return null; 3542 }
3542).filter(Boolean); 3543 this.thumbnails = r, (_this$timelineEl = this.timelineEl) === null || _this$timelineEl === void 0 ? void 0 : _this$timelineEl.registerThumbnailPreview(); 3544 }) : Promise.resolve(null); 3545 } 3546 setEvents(e, t) { 3547 e.onended = i => this.onended(t, i), e.ontimeupdate = i => this.ontimeupdate(t, i), e.onplay = i => this.onplay(t, i), e.onpause = i => this.onpause(t, i); 3548 } 3549 isControlsDivVisible() { 3550 return this.controlsEl.style.opacity === "1"; 3551 } 3552 stopVideoPlay(e) { 3553 this.html.q(e).pause(); 3554 } 3555 startVideoPlay(e) { 3556 var t = this.html.q(e); 3557 setTimeout(() => { 3558 this.hideVideoControls(); 3559 }, 400), t.play(); 3560 } 3561 setVideoPlayback(e) { 3562 this.freezeControls || (e === "start" ? e = 0 : e === "end" && (e = 1 / 0), this.updateVideoCurrentTime(e), this.updateTimeline(this.video)); 3563 } 3564 moveVideoPlayback(e) { 3565 if (this.freezeControls) return; 3566 var t = this.video.currentTime + e; 3567 this.updateVideoCurrentTime(t), this.updateTimeline(this.video); 3568 } 3569 updateVideoCurrentTime(e) { 3570 if (this.timelineOrigin !== null && this.video.seekable.length > 0) { 3571 var _this$shaka$liveSeekE; 3572 e += this.timelineOrigin; 3573 var t = this.video.seekable.start(0), 3574 i = (_this$shaka$liveSeekE = this.shaka.liveSeekEnd()) !== null && _this$shaka$liveSeekE !== void 0 ? _this$shaka$liveSeekE : this.video.seekable.end(this.video.seekable.length - 1); 3575 e = Math.max(t, Math.min(e, i)); 3576 } else { 3577 var _t2 = Number.isFinite(this.video.duration) ? this.video.duration : this.videoOptions.length || 0; 3578 e = Math.max(0, Math.min(e, _t2)); 3579 } 3580 this.video.currentTime = e; 3581 } 3582 playClick() { 3583 this.video.paused ? this.startVideoPlay(this.video) : this.stopVideoPlay(this.video); 3584 } 3585 ffClick() { 3586 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10; 3587 this.throttledShowVideoControls(), this.moveVideoPlayback(e); 3588 } 3589 revClick() { 3590 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10; 3591 this.throttledShowVideoControls(), this.moveVideoPlayback(-e); 3592 } 3593 isLiveEpgPlayback(e) { 3594 return this.videoOptions.type === "epg" && !Number.isFinite(e.duration); 3595 } 3596 ensureTimelineOrigin(e) { 3597 return this.timelineOrigin === null && this.isLiveEpgPlayback(e) && e.seekable.length > 0 && (this.timelineOrigin = e.seekable.start(0)), this.timelineOrigin; 3598 } 3599 updateTimeline(e) { 3600 if (!this.timelineEl) return; 3601 var t = this.ensureTimelineOrigin(e); 3602 if (t !== null) { 3603 var _this$shaka$liveSeekE2; 3604 if (e.seekable.length === 0) return; 3605 var s = e.seekable.start(0), 3606 r = (_this$shaka$liveSeekE2 = this.shaka.liveSeekEnd()) !== null && _this$shaka$liveSeekE2 !== void 0 ? _this$shaka$liveSeekE2 : e.seekable.end(e.seekable.length - 1); 3607 this.timelineEl.setRange(s - t, e.currentTime - t, r - t); 3608 return; 3609 } 3610 var i = Number.isFinite(e.duration) ? e.duration : this.videoOptions.length || 0; 3611 this.timelineEl.setRange(0, e.currentTime, i); 3612 } 3613 loadEpisode(e, t) { 3614 var _this$video; 3615 return (_this$video = this.video) !== null && _this$video !== void 0 && _this$video.pause(), this.html.fetchText(e).then(i => { 3616 var s = this.html.extractHTML(i, t); 3617 this.stopVideoPlayers(!0), this.html.writeHTML(t, s); 3618 }); 3619 } 3620 loadCatchUp(e, t) { 3621 return this.lastEpgUrl = e, this.html.fetchText(e).then(i => { 3622 if (e !== this.lastEpgUrl) throw new Error("This url: " + e + " is not last epg url: " + this.lastEpgUrl); 3623 this.stopVideoPlayers(!0); 3624 var s = this.html.extractHTML(i, t); 3625 this.html.writeHTML(t, s); 3626 }); 3627 } 3628 getCurrentTime() { 3629 return this.timelineOrigin !== null ? this.video ? this.video.currentTime - this.timelineOrigin : -1 : this.video ? this.video.currentTime : -1; 3630 } 3631 getPlaybackOptions() { 3632 return this.videoOptions || {}; 3633 } 3634 setControlsFrozen(e) { 3635 var _this$timelineEl2; 3636 this.freezeControls = e, (_this$timelineEl2 = this.timelineEl) !== null && _this$timelineEl2 !== void 0 && _this$timelineEl2.setDisabled(e), e ? this.html.addClass("body", "frozen_controls") : this.html.removeClass("body", "frozen_controls"); 3637 } 3638 timeHHMMSS(e) { 3639 e = Math.max(0, Math.floor(e)); 3640 var t = Math.floor(e / 3600), 3641 i = Math.floor(e % 3600 / 60), 3642 s = e % 60; 3643 return t > 0 ? t + ":" + this.pad2(i) + ":" + this.pad2(s) : this.pad2(i) + ":" + this.pad2(s); 3644 } 3645 pad2(e) { 3646 return ("0" + e).slice(-2); 3647 } 3648 startVideoControlsTimer() { 3649 clearTimeout(this.hideVideoControlsTimer), this.hideVideoControlsTimer = setTimeout(() => { 3650 this.hideVideoControls(); 3651 }, 3e3); 3652 } 3653 showVideoControls() { 3654 !this.controlsEl || !this.video || (this.startVideoControlsTimer(), !this.isControlsDivVisible() && (this.html.show("#buttons", "block", this.controlsEl), this.html.removeClass("#buttons", "hidden", this.controlsEl), this.html.setStyle(this.controlsEl, "opacity", "1"))); 3655 } 3656 hideVideoControls() { 3657 clearTimeout(this.hideVideoControlsTimer), this.controlsEl && this.html.setStyle(this.controlsEl, "opacity", "0"); 3658 } 3659 loadUrl(e, t, i) { 3660 return this.user.linkDeviceToUser(i.drmProtected).then(() => Promise.all([this.gql.videoUrlV2(t), this.shaka.load()])).then(_ref64 => { 3661 var _ref65 = _slicedToArray(_ref64, 1), 3662 s = _ref65[0]; 3663 if (!s || !s.url) throw new Error("no_video_data"); 3664 if (s.infoCode === 507 || s.infoCode === 503) throw new Error("no_access"); 3665 return i.isErrorVideo = s.infoCode !== 0, app.log("Will play video", i, s), new Promise((r, n) => { 3666 e.onloadedmetadata = () => { 3667 var _this$timelineEl3; 3668 if ((_this$timelineEl3 = this.timelineEl) !== null && _this$timelineEl3 !== void 0 && _this$timelineEl3.setDurationDisplay(isFinite(e.duration)), this.html.setData(e, "options", JSON.stringify(i)), this.html.show(e), this.removeVideoSubtitles(e), this.addVideoSubtitles(e, i), this.muxStats.monitor(e, i), this.currentVideoId !== t) { 3669 n("canceled_play"); 3670 return; 3671 } 3672 i.paused || e.play(), r(!0); 3673 }, e.onerror = () => { 3674 n(new Error("video_load_error")); 3675 }, this.shaka.initPlayer(e, s, i.startAt || void 0).catch(a => { 3676 n(new Error("video_load_error")); 3677 }); 3678 }); 3679 }); 3680 } 3681 removeVideoSubtitles(e) { 3682 var _e$parentElement; 3683 this.html.qAll("track", e).forEach(i => i.remove()), (_e$parentElement = e.parentElement) === null || _e$parentElement === void 0 || (_e$parentElement = _e$parentElement.querySelector(".trailer__subtitles")) === null || _e$parentElement === void 0 ? void 0 : _e$parentElement.replaceChildren(); 3684 } 3685 addVideoSubtitles(e, t) { 3686 var _t$subtitles$; 3687 if (!e || !(t !== null && t !== void 0 && t.subtitles) || !Array.isArray(t.subtitles)
3687) return; 3688 var i = ((_t$subtitles$ = t.subtitles[0]) === null || _t$subtitles$ === void 0 ? void 0 : _t$subtitles$.id) || 0; 3689 if (t.subtitles.forEach(s => { 3690 var r = document.createElement("track"); 3691 r.id = "subtitle_" + s.id, r.label = s.name, r.kind = "subtitles", r.srclang = s.name, r.src = s.url, e.appendChild(r), s.isDefault && (i = s.id); 3692 }), this.options.showSubtitles && i !== 0) { 3693 var _e$parentElement2; 3694 var s = (_e$parentElement2 = e.parentElement) === null || _e$parentElement2 === void 0 ? void 0 : _e$parentElement2.querySelector(".trailer__subtitles"); 3695 s ? this.showCuesIn(e, "subtitle_" + i, s) : this.toggleVideoSubtitle("subtitle_" + i); 3696 } 3697 } 3698 showCuesIn(e, t, i) { 3699 var s = this.html.q("#" + t, e); 3700 s && (s.track.mode = "hidden", s.track.oncuechange = () => i.replaceChildren(...Array.from(s.track.activeCues || []).map(r => r.getCueAsHTML()))); 3701 } 3702 toggleVideoSubtitle(e) { 3703 var t = this.html.qAll("track", this.video), 3704 i = this.html.qAll(".button.subtitles"), 3705 s = !1; 3706 return t.forEach((r, n) => { 3707 r.id == e && r.track.mode !== "showing" ? (this.html.addClass(i[n], "active"), r.track.mode = "showing", s = !0) : (this.html.removeClass(i[n], "active"), r.track.mode = "hidden"); 3708 }), s; 3709 } 3710 loadEpgUrl(e) { 3711 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 3712 return !t || !t.channel ? (app.log("No channel for epg playback"), Promise.resolve(!1)) : this.user.linkDeviceToUser(t.drmProtected).catch(i => { 3713 if (i.message === "too_many_devices") { 3714 window.location.href = this.options.routes.too_many_devices; 3715 return; 3716 } 3717 }).then(() => Promise.all([this.gql.epgHlsUrlV2(t.channel || "", (t === null || t === void 0 ? void 0 : t.chunkStart) || 0, (t === null || t === void 0 ? void 0 : t.chunkEnd) || 0), this.shaka.load()])).then(_ref66 => { 3718 var _ref67 = _slicedToArray(_ref66, 1), 3719 i = _ref67[0]; 3720 if (!i || !i.url) { 3721 app.log("No url for epg playback", i); 3722 return; 3723 } 3724 return t.breaks = i.breaks || [], app.log("Will play epg", t, i.url), new Promise((s, r) => { 3725 e.onloadedmetadata = () => { 3726 var _this$timelineEl4; 3727 this.timelineOrigin = null, (_this$timelineEl4 = this.timelineEl) !== null && _this$timelineEl4 !== void 0 && _this$timelineEl4.setDurationDisplay(isFinite(e.duration)), this.html.setData(e, "options", JSON.stringify(t)), this.html.show(e), this.muxStats.monitor(e, t), t.paused ? e.pause() : e.play(), s(!0); 3728 }, e.onerror = () => { 3729 r(new Error("video_load_error")); 3730 }, this.shaka.initPlayer(e, i, t.startAt || void 0).catch(n => { 3731 r(new Error("video_load_error")); 3732 }); 3733 }); 3734 }); 3735 } 3736 onended(e, t) { 3737 if (app.log("ON ENDED", t), e.isTrailer || e.isErrorVideo) return; 3738 this.hideVideoControls(), this.html.addClass(this.video, "hidden"), this.bookmarks.voyoBookmarkConsumeCurrent(); 3739 var i = this.html.q("#play_similar"), 3740 s = this.btnEndCredits ? !this.html.hasClass(this.btnEndCredits, "hidden") : !1; 3741 i && !s && this.html.removeClass(i, "hidden"); 3742 } 3743 ontimeupdate(e, t) { 3744 var i = t.target, 3745 s = Math.ceil(i.currentTime); 3746 this.lastTimeUpdateAt !== s && (this.lastTimeUpdateAt = s, this.saveStayedAtData(i, e), this.showEndCreditsButton(i, e), this.showEpisodeRecapButton(i, e), this.showStartCreditsButton(i, e), this.updateTimeline(i)); 3747 } 3748 showEndCreditsButton(e, t) { 3749 if (t.isErrorVideo || !t.endCreditsAt || !t.nextEpisodeUrl || !this.btnEndCredits) return; 3750 var i = Math.ceil(e.currentTime || 0); 3751 if (i < t.endCreditsAt) { 3752 this.html.addClass(this.btnEndCredits, "hidden"); 3753 return; 3754 } 3755 if (this.html.getData(this.video, "endcredits") === "stop") return; 3756 var r = 10 - (i - t.endCreditsAt); 3757 if (r === 0) { 3758 var _this$html$q0; 3759 this.html.setData(this.video, "endcredits", "stop"), (_this$html$q0 = this.html.q("#go_next")) === null || _this$html$q0 === void 0 ? void 0 : _this$html$q0.click(); 3760 return; 3761 } 3762 if (r < 0) { 3763 this.html.addClass(this.btnEndCredits, "hidden"); 3764 return; 3765 } 3766 this.html.writeHTML("#countdown", r.toString(), this.btnEndCredits), this.html.removeClass(this.btnEndCredits, "hidden"); 3767 } 3768 showEpisodeRecapButton(e, t) { 3769 if (t.isErrorVideo || !t.epiRecapTo || !this.btnEpisodeRecap) return; 3770 var i = Math.floor(e.currentTime || 0); 3771 if (i < (t.epiRecapAt || 0) + 2 || i >= t.epiRecapTo) { 3772 this.html.hasClass(this.btnEpisodeRecap, "hidden") || this.html.addClass(this.btnEpisodeRecap, "hidden"); 3773 return; 3774 } 3775 this.html.getData(this.video, "episoderecap") === "stop" || this.isControlsDivVisible() || this.html.hasClass(this.btnEpisodeRecap, "hidden") && this.html.removeClass(this.btnEpisodeRecap, "hidden"); 3776 } 3777 showStartCreditsButton(e, t) { 3778 if (t.isErrorVideo || !t.startCreditsAt || !t.startCreditsTo || !this.btnStartCredits) return; 3779 var i = Math.floor(e.currentTime || 0); 3780 if (i < t.startCreditsAt + 2 || i >= t.startCreditsTo) { 3781 this.html.hasClass(this.btnStartCredits, "hidden") || this.html.addClass(this.btnStartCredits, "hidden"); 3782 return; 3783 } 3784 this.html.getData(this.video, "startcredits") === "stop" || this.isControlsDivVisible() || this.html.hasClass(this.btnStartCredits, "hidden") && this.html.removeClass(this.btnStartCredits, "hidden"); 3785 } 3786 onplay(e, t) { 3787 this.html.removeClass("body", "paused"), this.html.addClass("body", "playing"), e.startedPlayingAt = new Date().getTime(); 3788 } 3789 onpause(e, t) { 3790 this.html.removeClass("body", "playing"), this.html.addClass("body", "paused"), window.isPageUnloading || this.bookmarks.voyoBookmarkConsume
3790Current(); 3791 } 3792 saveStayedAtData(e, t) { 3793 if (!t.allowSaveToStayedAt || !t.startedPlayingAt || !t.mediaId || !t.length) return; 3794 var i = Math.ceil(e.currentTime), 3795 s = Math.ceil(i / t.length * 100), 3796 r = new Date().getTime() - t.startedPlayingAt, 3797 n = Math.ceil(r / 1e3); 3798 if (s < 5 || n < 5) return; 3799 var a = new p({ 3800 voyokey: t.voyokey, 3801 percent: s, 3802 duration: i, 3803 entityId: t.mediaId, 3804 nextEntityId: t.nextEpisodeId 3805 }); 3806 this.bookmarks.voyoBookmarkSaveCurrent(a); 3807 } 3808 showThumbnailPreview(e, t) { 3809 if (!this.timelineEl || !this.timelinePreview || !this.thumbnails.length) return; 3810 var i = this.timelineEl.getProgressBarElement(); 3811 if (!i) return; 3812 var s = this.getThumbnailForTime(e); 3813 if (!s) return; 3814 var r = 200, 3815 n = Math.max(r / 2, Math.min(i.clientWidth - r / 2, i.clientWidth * t)), 3816 a = String(s.time); 3817 if (this.timelinePreview.style.left = n + "px", this.timelinePreview.dataset.time !== a) { 3818 this.timelinePreview.innerHTML = ""; 3819 var l = document.createElement("div"); 3820 this.renderThumbnail(l, s, !0), this.timelinePreview.appendChild(l), this.timelinePreview.dataset.time = a; 3821 } 3822 this.html.removeClass(this.timelinePreview, "hidden"); 3823 } 3824 hideThumbnailPreview() { 3825 this.timelinePreview && (this.timelinePreview.innerHTML = "", this.timelinePreview.dataset.time = "", this.html.addClass(this.timelinePreview, "hidden")); 3826 } 3827 getThumbnailForTime(e) { 3828 if (!this.thumbnails.length) return null; 3829 var t = this.thumbnails.findIndex(i => i.time >= e); 3830 return t === -1 ? null : this.thumbnails[t]; 3831 } 3832 renderThumbnail(e, t, i) { 3833 if (e.dataset.time = t.time, e.dataset.time_badge = this.timeHHMMSS(t.time), t.timebased) e.innerHTML = this.timeHHMMSS(t.time), e.className = "thumbnail time_thumbnail";else { 3834 e.className = "thumbnail image_thumbnail"; 3835 var s = this.html.q("img", e); 3836 s || (s = document.createElement("img"), s.src = this.videoOptions.vttImage || "", e.appendChild(s)), s.style.top = `-${t.y}px`, s.style.left = `-${t.x}px`; 3837 var r = this.html.q("div", e); 3838 r || (r = document.createElement("div"), this.html.addClass(r, "time"), r.innerHTML = this.timeHHMMSS(t.time), e.appendChild(r)); 3839 } 3840 i ? e.classList.add("current") : e.classList.remove("current"); 3841 } 3842 openFullscreen(e) { 3843 var t = (typeof e == "string" ? app.html.q(e) : e) || document.documentElement; 3844 t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen && t.msRequestFullscreen(); 3845 } 3846 closeFullscreen() { 3847 document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); 3848 } 3849 toggleFullscreen(e, t) { 3850 e.preventDefault(), !!document.fullscreenElement ? this.closeFullscreen() : this.openFullscreen(t); 3851 } 3852 onFullscreenChange() { 3853 var e = !!document.fullscreenElement; 3854 e ? app.html.addClass("body", "fullscreen") : app.html.removeClass("body", "fullscreen"), this.events.sendEvent("fullscreen", { 3855 isFullscreen: e 3856 }); 3857 } 3858 setVideoVolume(e) { 3859 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; 3860 this.video && (this.video.volume = e, this.video.muted = t); 3861 } 3862 muteUnmuteTrailerVolume(e) { 3863 return e.preventDefault(), this.video ? (this.video.muted ? (this.video.muted = !1, this.video.volume < .1 && (this.video.volume = .75), this.html.removeClass("body", "trailer_muted")) : (this.video.muted = !0, this.html.addClass("body", "trailer_muted")), this.video.muted) : null; 3864 } 3865 }, 3866 Ui = ce; 3867 var ue = class { 3868 constructor(e, t, i, s) { 3869 this.gql = e; 3870 this.html = t; 3871 this.localStorage = i; 3872 this.options = s; 3873 this.profiles = []; 3874 } 3875 init() { 3876 return this.voyoProfiles(); 3877 } 3878 voyoProfiles() { 3879 var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0; 3880 if (e) { 3881 var _this$profiles; 3882 if ((_this$profiles = this.profiles) !== null && _this$profiles !== void 0 && _this$profiles.length) return Promise.resolve(this.profiles); 3883 var t = this.loadFromLocalStorage(); 3884 if (t !== null && t !== void 0 && t.length) return this.profiles = t, Promise.resolve(t); 3885 } 3886 return this.gql.voyoProfiles().then(t => this.profilesToCache(t)); 3887 } 3888 profilesToCache(e) { 3889 return this.profiles = e, this.saveToLocalStorage(), e; 3890 } 3891 redirectToProfileUrl(e) { 3892 var t = this.profiles.find(i => i.profileId === e); 3893 t && (document.location.href = t.url); 3894 } 3895 profileOfType(e) { 3896 return this.profiles.find(t => t.type === e); 3897 } 3898 rootCategoryToProfileType(e) { 3899 switch (e) { 3900 case 1091: 3901 return "5ka"; 3902 case 5: 3903 return "kids"; 3904 default: 3905 return "normal"; 3906 } 3907 } 3908 profileTypeUrl(e) { 3909 switch (e) { 3910 case "5ka": 3911 return this.options.routes.profile_5ka; 3912 case "kids": 3913 return this.options.routes.profile_kids; 3914 default: 3915 return ""; 3916 } 3917 } 3918 isInCorrectProfile(e, t) { 3919 if (!t) return !0; 3920 var i = this.profiles.find(s => s.profileId === e); 3921 return i ? t === i.type : !1; 3922 } 3923 saveToLocalStorage() { 3924 this.localStorage.set("voyoProfiles", this.profiles, 60); 3925 } 3926 loadFromLocalStorage() { 3927 var e = this.localStorage.get("voyoProfiles"); 3928 return e ? e.map(t => new g(t)) : null; 3929 } 3930 }, 3931 Bi = ue; 3932 var pe = class { 3933 constructor(e, t, i) { 3934 this.gql = e; 3935 this.localStorage = t; 3936 this.options = i; 3937 this.bookmarks = null; 3938 } 3939 loadBookmarks(e) { 3940 var _this2 = this; 3941 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee64() { 3942 var t, _t3, _t4, _t5; 3943 return _regenerator().w(function (_context64) { 3944 while (1) switch (_context64.n) { 3945 case 0: 3946 t = _this2.loadFromLocalStorage(); 3947 _t4 = t; 3948 if (_t4) { 3949 _context64.n = 2; 3950 break; 3951 } 3952 _context64.n = 1; 3953 return e; 3954 case 1: 3955 t = _context64.v; 3956 _t4 = t; 3957 case 2: 3958 _t3 = _t4; 3959 if (_t3) { 3960 _context64.n = 4; 3961 break; 3962 } 3963 _context64.n = 3; 3964 return _this2.fetch().catch(() => null); 3965 case 3: 3966 t = _context64.v; 3967 _t3 = t; 3968 case 4: 3969 if (!_t3) { 3970 _context64.n = 5; 3971 break; 3972 } 3973 _t5 = t; 3974 _context64.n = 6; 3975 break; 3976 case 5: 3977 _t5 = new y({ 3978 groups: [{ 3979 id: "GRP_DEFAULT", 3980 items: [] 3981 }, { 3982 id: "stayedAt", 3983 items: [] 3984 }] 3985 }); 3986 case 6: 3987 return _context64.a(2, _t5); 3988 } 3989 }, _callee64); 3990 }))(); 3991 } 3992 set(e) { 3993 this.bookmarks = e, this.saveToLocalStorage(); 3994 } 3995 get() { 3996 return this.bookmarks; 3997 } 3998 fetch() { 3999 return this.gql.voyoBookmarks(); 4000 } 4001 clear() { 4002 this.bookmarks = null, this.saveToLocalStorage(); 4003 } 4004 isBookmarked(e, t) { 4005 return this.bookmarks && this.bookmarks.groupItems(e).find(i => i.entityId.toString() === t.toString()) || !1; 4006 } 4007 voyoBookmarkRemove(e, t) { 4008 var _this$bookmarks; 4009 return (_this$bookmarks = this.bookmarks) !== null && _this$bookmarks !== void 0 && _this$bookmarks.remove(e, t.toString()), this.saveToLocalStorage(), this.gql.voyoBookmarkRemove(e, t.toString()); 4010 } 4011 voyoBookmarkAdd(e, t) { 4012 var _this$bookmarks2; 4013 return (_this$bookmarks2 = this.bookmarks) !== null && _this$bookmarks2 !== void 0 && _this$bookmarks2.add(e, t), this.saveToLocalStorage(), this.gql.voyoBookmarkAdd(e, t); 4014 } 4015 voyoCategoryStartWith(e) { 4016 var t = this.get(); 4017 if (!t) return Promise.resolve({ 4018 startingEpisodeId: 0, 4019 percent: 0 4020 }); 4021 var i = t.groupItems("stayedAt").find(s => s.voyokey === e); 4022 return i ? i.percent >= 90 && i.nextEntityId !== void 0 ? Promise.resolve({ 4023 startingEpisodeId: +i.nextEntityId, 4024 percent: 0 4025 }) : Promise.resolve({
4026 startingEpisodeId: +i.entityId, 4027 percent: i.percent 4028 }) : Promise.resolve({ 4029 startingEpisodeId: 0, 4030 percent: 0 4031 }); 4032 } 4033 voyoBookmarkSaveCurrent(e) { 4034 this.saveCurrentToSessionStorage(e); 4035 } 4036 voyoBookmarkConsumeCurrent() { 4037 var e = this.consumeCurrentFromSessionStorage(); 4038 return e ? this.voyoBookmarkAdd("stayedAt", e) : Promise.resolve(null); 4039 } 4040 saveToLocalStorage() { 4041 this.localStorage.set("voyoBookmarks", this.bookmarks, 60); 4042 } 4043 loadFromLocalStorage() { 4044 var e = this.localStorage.get("voyoBookmarks"); 4045 return e ? new y(e) : null; 4046 } 4047 saveCurrentToSessionStorage(e) { 4048 sessionStorage.setItem("voyoBookmark", JSON.stringify(e)); 4049 } 4050 consumeCurrentFromSessionStorage() { 4051 var e = sessionStorage.getItem("voyoBookmark"); 4052 if (sessionStorage.removeItem("voyoBookmark"), !e) return null; 4053 try { 4054 return JSON.parse(e); 4055 } catch (_unused) { 4056 return app.log("Bad data in session storage", "voyoBookmark", e), null; 4057 } 4058 } 4059 get hasStayedAt() { 4060 return !!this.bookmarks && this.bookmarks.groupItems("stayedAt").length > 0; 4061 } 4062 get hasMyVoyo() { 4063 return !!this.bookmarks && this.bookmarks.groupItems("GRP_DEFAULT").length > 0; 4064 } 4065 }, 4066 $i = pe; 4067 var ge = class { 4068 constructor(e) { 4069 this.options = e; 4070 } 4071 get(e) { 4072 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4073 var i = localStorage.getItem(e); 4074 if (!i) return t; 4075 var s; 4076 try { 4077 s = JSON.parse(i); 4078 } catch (_unused2) { 4079 return app.log("Bad data in local storage", e, i), t; 4080 } 4081 return s.expiresAt < 0 || s.expiresAt > Date.now() ? s.payload : (localStorage.removeItem(e), t); 4082 } 4083 set(e, t) { 4084 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1; 4085 var s = i > 0 ? Date.now() + i * 60 * 1e3 : -1, 4086 r = { 4087 payload: t, 4088 expiresAt: s 4089 }; 4090 localStorage.setItem(e, JSON.stringify(r)); 4091 } 4092 remove(e) { 4093 localStorage.removeItem(e); 4094 } 4095 }, 4096 Gi = ge; 4097 var ve = class { 4098 constructor(e, t, i, s) { 4099 this.html = e; 4100 this.user = t; 4101 this.cookies = i; 4102 this.options = s; 4103 this.websocket = null; 4104 } 4105 init() { 4106 var _this$user$user4, _this$user$user5; 4107 if (!this.options.websocketUrl || (typeof WebSocket === "undefined" ? "undefined" : _typeof(WebSocket)) > "u") return; 4108 var e = this.options.websocketUrl + "/go-sites/" + this.options.siteId + "/devices/" + this.user.deviceId; 4109 (_this$user$user4 = this.user.user) !== null && _this$user$user4 !== void 0 && _this$user$user4.id && (e += "?v=" + ((_this$user$user5 = this.user.user) === null || _this$user$user5 === void 0 ? void 0 : _this$user$user5.id)), this.websocket = new WebSocket(e), this.websocket.onmessage = t => { 4110 var i = this.parse(t.data); 4111 i && this.process(i); 4112 }, this.websocket.onclose = t => { 4113 t.wasClean ? console.log("[ws] Connection closed cleanly, code", t.code, "reason", t.reason) : console.log("[ws] Connection died", t); 4114 }, this.websocket.onerror = t => { 4115 console.log("[ws] error", t); 4116 }; 4117 } 4118 parse(e) { 4119 try { 4120 return JSON.parse(e); 4121 } catch (_unused3) { 4122 return console.log("[ws] cannot parse payload:", e), null; 4123 } 4124 } 4125 process(e) { 4126 switch (e.type) { 4127 case "welcome": 4128 this.processWelcome(e); 4129 break; 4130 case "article": 4131 this.processArticle(e); 4132 break; 4133 case "front": 4134 this.processBreakingNews(e); 4135 break; 4136 default: 4137 console.log("[ws] uknown type", e.type); 4138 } 4139 } 4140 processWelcome(e) { 4141 console.log("[ws] Got welcome msg!", e.time); 4142 } 4143 processBreakingNews(e) { 4144 console.log("[ws] Got breaking news msg!", e.time); 4145 var t = e.payload.html, 4146 i = e.payload.deleted, 4147 s = e.payload.articleId, 4148 r = this.html.q("#breaking_news_placeholder"); 4149 r && (i ? this.html.hide(r) : (this.html.writeHTML(r, t), this.showBreakingNewsIfNotClosed(s.toString()))); 4150 } 4151 processArticle(e) { 4152 console.log("[ws] Got article msg!", e.time, e.payload); 4153 var t = e.payload.articleId, 4154 i = e.payload.deleted, 4155 s = e.payload.html, 4156 r = "#feed_" + e.payload.time; 4157 if (t !== this.options.articleId) return; 4158 if (i) { 4159 this.html.hide(r); 4160 return; 4161 } 4162 var n = this.html.q(r); 4163 n ? this.html.writeHTML(n, s) : this.html.prependHTML(".feed_list", s), this.html.execHtmlScript(r, !0), (s.includes("twitter.com") || s.includes(".x.com")) && setTimeout(() => { 4164 var _twttr; 4165 this.cookies.updateCookieClasses(), (_twttr = twttr) === null || _twttr === void 0 || (_twttr = _twttr.widgets) === null || _twttr === void 0 ? void 0 : _twttr.load(); 4166 }, 200); 4167 } 4168 closeBreakingNews(e) { 4169 this.cookies.set("closeBreakingNews", e), this.html.hide(".breaking_news"); 4170 } 4171 showBreakingNewsIfNotClosed(e) { 4172 var t = this.cookies.get("closeBreakingNews"); 4173 if (!t || t !== e) { 4174 this.html.show(".breaking_news"); 4175 return; 4176 } 4177 } 4178 }, 4179 Oi = ve; 4180 var fe = class extends Oi { 4181 constructor(t, i, s, r) { 4182 super(t, i, s, r); 4183 this.html = t; 4184 this.user = i; 4185 this.cookies = s; 4186 this.options = r; 4187 } 4188 process(t) { 4189 t.type === "device" ? this.processDevice(t) : super.process(t); 4190 } 4191 processDevice(t) { 4192 switch (console.log("[ws] Got device msg!", t), t.payload.message) { 4193 case "connected": 4194 this.processConnected(t); 4195 break; 4196 case "logout": 4197 this.processLogout(t); 4198 break; 4199 case "subscription_updated": 4200 this.processSubscriptionUpdated(t); 4201 break; 4202 } 4203 } 4204 processSubscriptionUpdated(t) { 4205 console.log("[ws] Got update subs msg!", t), this.user.loadUserInfo().then(() => { 4206 console.log("User info refreshed"); 4207 }).catch(i => { 4208 console.log("User info refresh error", i); 4209 }); 4210 } 4211 processLogout(t) { 4212 this.user.logoutUser().then(() => { 4213 window.location.href = "/"; 4214 }); 4215 } 4216 processConnected(t) { 4217 console.log("[ws] Got connected msg!", t); 4218 var i = this.options.device.name, 4219 s = this.options.device.family; 4220 this.user.loginWithDevice(i, s).then(r => { 4221 r && setTimeout(() => { 4222 window.location.href = this.options.routes.profiles; 4223 }, 250); 4224 }); 4225 } 4226 }, 4227 Fi = fe; 4228 var ye = class { 4229 constructor(e, t) { 4230 this.html = e; 4231 this.options = t; 4232 } 4233 performSearch(e, t) { 4234 var i = window.location.href.split("?")[0]; 4235 return this.html.fetchText(i + "?q=" + encodeURIComponent(e) + "&tag=" + encodeURIComponent(t)).then(s => { 4236 var r = new URL(window.location.href); 4237 e ? r.searchParams.set("q", e) : r.searchParams.delete("q"), t ? r.searchParams.set("tag", t) : r.searchParams.delete("tag"), history.replaceState({}, "", r.toString()); 4238 var _this$html$extractEle7 = this.html.extractElements(s, ["#searchResultsLibrary", "#searchResultsTimeshift", "#searchTypesLibrary .results-count", "#searchTypesTimeshift .results-count"]), 4239 _this$html$extractEle8 = _slicedToArray(_this$html$extractEle7, 4), 4240 n = _this$html$extractEle8[0], 4241 a = _this$html$extractEle8[1], 4242 l = _this$html$extractEle8[2], 4243 d = _this$html$extractEle8[3]; 4244 this.html.writeHTML("#searchResultsLibrary", (n === null || n === void 0 ? void 0 : n.innerHTML) || ""), this.html.writeHTML("#searchResultsTimeshift", (a === null || a === void 0 ? void 0 : a.innerHTML) || ""), this.html.setData("#searchTypesLibrary .results-count", "total", (l === null || l === void 0 ? void 0 : l.dataset.total) || ""); 4245 var m = this.html.q("#searchTypesTimeshift .results-count"); 4246 m && this.html.setData(m, "total", (d === null || d === void 0 ? void 0 : d.dataset.total) || ""); 4247 }).catch(s => { 4248 throw app.error("Search failed:", s), s; 4249 }); 4250 } 4251 }, 4252 Ri = ye; 4253 var be = class { 4254 constructor(e, t) { 4255 this.user = e; 4256 this.options = t; 4257 this.config = null; 4258 } 4259 monitor(e, t) { 4260 t.isTrailer || !window.mux || !this.options.playbackStatsUrl || this.isEnabled().then(i => { 4261 i && this.startMonitoring(e, t); 4262 }); 4263 } 4264 isEnabled() { 4265 return this.config ? this.config : (this.config = this.fetchConfig().c
4265atch(e => (this.config = null, app.log("Err while getting mux config.", e), !1)), this.config); 4266 } 4267 fetchConfig() { 4268 var _this$user4; 4269 var e = `${this.options.playbackStatsUrl}/config/web`, 4270 t = { 4271 timeout: 2500, 4272 headers: { 4273 "Device-Id": ((_this$user4 = this.user) === null || _this$user4 === void 0 ? void 0 : _this$user4.deviceId) || "", 4274 "Onl-Location": document.location.href 4275 } 4276 }; 4277 return b(e, t).then(i => i === null || i === void 0 ? void 0 : i.json()).then(i => { 4278 var s = i && !!i.enabled || !1; 4279 return app.log("Mux is:", s ? "enabled" : "disabled"), s; 4280 }); 4281 } 4282 startMonitoring(e, t) { 4283 var _this$user$user6, _this$options$playbac; 4284 var i = {}; 4285 switch (t.type) { 4286 case "live_stream": 4287 i = this.liveStreamPayload(e, t); 4288 break; 4289 case "epg": 4290 i = this.epgPayload(e, t); 4291 break; 4292 default: 4293 i = this.videoPayload(e, t); 4294 break; 4295 } 4296 var s = Object.assign(this.devicePayload(), i), 4297 r = ((_this$user$user6 = this.user.user) === null || _this$user$user6 === void 0 ? void 0 : _this$user$user6.id) === 19; 4298 window.mux.monitor("video", { 4299 debug: r, 4300 beaconCollectionDomain: (_this$options$playbac = this.options.playbackStatsUrl) === null || _this$options$playbac === void 0 ? void 0 : _this$options$playbac.replace("https://", ""), 4301 data: s, 4302 minimumRebufferDuration: 1e3, 4303 sustainedRebufferThreshold: 2500 4304 }); 4305 } 4306 devicePayload() { 4307 var _this$user$user7, _this$user$user8; 4308 return { 4309 env_key: this.options.playbackStatsKey, 4310 viewer_user_id: (_this$user$user7 = this.user.user) === null || _this$user$user7 === void 0 ? void 0 : _this$user$user7.id, 4311 viewer_auth: ((_this$user$user8 = this.user.user) === null || _this$user$user8 === void 0 ? void 0 : _this$user$user8.token) || "", 4312 player_name: "WEB", 4313 app_version: this.options.version, 4314 device_family: this.options.device.family, 4315 device_model: this.options.device.model 4316 }; 4317 } 4318 liveStreamPayload(e, t) { 4319 return { 4320 video_id: t.mediaId, 4321 video_title: t.title, 4322 video_stream_type: "LIVE_STREAM", 4323 video_timeline: 0, 4324 video_mime: 0 4325 }; 4326 } 4327 epgPayload(e, t) { 4328 return { 4329 video_id: 0, 4330 video_title: t.title, 4331 video_stream_type: "EPG", 4332 video_channel: t.channel || "", 4333 video_timeline: t.chunkStart || 0, 4334 video_mime: 0 4335 }; 4336 } 4337 videoPayload(e, t) { 4338 return { 4339 video_id: t.mediaId, 4340 video_title: t.title, 4341 video_duration: t.length ? t.length * 1e3 : 0, 4342 video_stream_type: "VOD", 4343 video_channel: "", 4344 video_timeline: 0, 4345 video_mime: 0 4346 }; 4347 } 4348 }, 4349 ji = be; 4350 var ke = class { 4351 constructor(e, t) { 4352 this.html = e; 4353 this.options = t; 4354 this.fpLicenseServerUrl = ""; 4355 this.fpCertificateUrl = ""; 4356 this.wvLicenseServerUrl = ""; 4357 this.fairplayAssetId = ""; 4358 this.fpCertificate = null; 4359 this.player = null; 4360 this.loading = null; 4361 var i = this.options.fpLicenseServerUrl; 4362 this.fpLicenseServerUrl = i ? i + "/fps/rest/getLicense" : "", this.fpCertificateUrl = i ? i + "/fps-pub.der" : "", this.wvLicenseServerUrl = this.options.wvLicenseServerUrl || ""; 4363 } 4364 load() { 4365 return this.loading ? this.loading : (this.loading = this.html.loadScript("/assets/shaka/shaka-player.compiled.js").then(() => { 4366 if ((typeof shaka === "undefined" ? "undefined" : _typeof(shaka)) > "u") throw new Error("Shaka is undefined."); 4367 shaka.polyfill.installAll(), shaka.Player.isBrowserSupported() || app.error("Shaka player is not supported by this browser"); 4368 }).catch(e => { 4369 throw this.loading = null, e; 4370 }), this.loading); 4371 } 4372 liveSeekEnd() { 4373 if (!this.player) return null; 4374 var e = this.player.seekRange(); 4375 return !e || !isFinite(e.end) || e.end <= e.start ? null : e.end; 4376 } 4377 initPlayer(e, t, i) { 4378 var _this3 = this; 4379 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee65() { 4380 var _t6, _t7; 4381 return _regenerator().w(function (_context65) { 4382 while (1) switch (_context65.p = _context65.n) { 4383 case 0: 4384 _context65.n = 1; 4385 return _this3.destroy(); 4386 case 1: 4387 _this3.player = new shaka.Player(); 4388 _context65.n = 2; 4389 return _this3.player.attach(e); 4390 case 2: 4391 _this3.player.addEventListener("error", s => _this3.onError(s.detail)); 4392 _t6 = _this3.isDrm(t); 4393 if (!_t6) { 4394 _context65.n = 5; 4395 break; 4396 } 4397 if (!v()) { 4398 _context65.n = 4; 4399 break; 4400 } 4401 _context65.n = 3; 4402 return _this3.configureFairplay(t); 4403 case 3: 4404 _context65.n = 5; 4405 break; 4406 case 4: 4407 _this3.configureWidevine(t); 4408 case 5: 4409 _this3.player.configure("manifest.hls.sequenceMode", !0); 4410 _context65.p = 6; 4411 _context65.n = 7; 4412 return _this3.player.load(t.url, i); 4413 case 7: 4414 _context65.n = 10; 4415 break; 4416 case 8: 4417 _context65.p = 8; 4418 _t7 = _context65.v; 4419 _context65.n = 9; 4420 return _this3.destroy(); 4421 case 9: 4422 throw _t7; 4423 case 10: 4424 return _context65.a(2, _this3.player); 4425 } 4426 }, _callee65, null, [[6, 8]]); 4427 }))(); 4428 } 4429 destroy() { 4430 var _this4 = this; 4431 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee66() { 4432 var e; 4433 return _regenerator().w(function (_context66) { 4434 while (1) switch (_context66.n) { 4435 case 0: 4436 if (!_this4.player) { 4437 _context66.n = 1; 4438 break; 4439 } 4440 e = _this4.player; 4441 _this4.player = null; 4442 _context66.n = 1; 4443 return e.destroy(); 4444 case 1: 4445 return _context66.a(2); 4446 } 4447 }, _callee66); 4448 }))(); 4449 } 4450 isDrm(e) { 4451 return !!e.license; 4452 } 4453 isLicense(e) { 4454 return e === shaka.net.NetworkingEngine.RequestType.LICENSE; 4455 } 4456 configureWidevine(e) { 4457 this.player.configure({ 4458 drm: { 4459 servers: { 4460 "com.widevine.alpha": this.wvLicenseServerUrl 4461 }, 4462 advanced: { 4463 "com.widevine.alpha": { 4464 headers: { 4465 "X-Drm-Message": e.url 4466 } 4467 } 4468 } 4469 } 4470 }); 4471 } 4472 loadFpCertificate() { 4473 var _this5 = this; 4474 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee67() { 4475 var e, _t8, _t9, _t0; 4476 return _regenerator().w(function (_context67) { 4477 while (1) switch (_context67.p = _context67.n) { 4478 case 0: 4479 if (!_this5.fpCertificate) { 4480 _context67.n = 1; 4481 break; 4482 } 4483 return _context67.a(2, _this5.fpCertificate); 4484 case 1: 4485 _context67.p = 1; 4486 _context67.n = 2; 4487 return fetch(_this5.fpCertificateUrl); 4488 case 2: 4489 e = _context67.v; 4490 if (e.ok) { 4491 _context67.n = 3; 4492 break; 4493 } 4494 throw new Error("HTTP " + e.status); 4495 case 3: 4496 _t8 = Uint8Array; 4497 _context67.n = 4; 4498 return e.arrayBuffer(); 4499 case 4: 4500 _t9 = _context67.v; 4501 _this5.fpCertificate = new _t8(_t9); 4502 return _context67.a(2, _this5.fpCertificate); 4503 case 5: 4504 _context67.p = 5; 4505 _t0 = _context67.v; 4506 return _context67.a(2, (console.warn("FairPlay certificate load failed", _t0), null)); 4507 } 4508 }, _callee67, null, [[1, 5]]); 4509 }))(); 4510 } 4511 configureFairplay(e) { 4512 var _this6 = this; 4513 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee68() { 4514 var t, i; 4515 return _regenerator().w(function (_context68) { 4516 while (1) switch (_context68.n) { 4517 case 0: 4518 _context68.n = 1; 4519 return _this6.loadFpCertificate(); 4520 case 1: 4521 t = _context68.v; 4522 _this6.player.configure({ 4523 drm: { 4524 servers: { 4525 "com.apple.fps": _this6.fpLicenseServerUrl, 4526 "com.apple.fps.1_0": _this6.fpLicenseServerUrl 4527 }, 4528 advanced: { 4529 "com.apple.fps": { 4530 serverCertificate: t || void 0, 4531 serverCertificateUri: _this6.fpCertificateUrl 4532 }, 4533 "com.apple.fps.1_0": { 4534 serverCertificate: t || void 0, 4535 serverCertificateUri: _this6.fpCertificateUrl 4536 } 4537 }, 4538 initDataTransform: _this6.fairplayInitDataTransform.bind(_this6) 4539 } 4540 }); 4541 i = _this6.player.getNetworkingEngine(); 4542 i.registerRequestFilter((s, r) => _this6.fairplayRequestFilter(s, r, e)), i.registerResponseFilter((s, r) => _this6.fairplayResponseFilter(s, r)); 4543 case 2: 4544 return _context68.a(2); 4545 } 4546 }, _callee68); 4547 }))(); 4548 } 4549 fairplayRequestFilter(e, t, i) { 4550 if (!this.isLicense(e)) return; 4551 var s = shaka.util.Uint8ArrayUtils.toStandardBase64(new Uint8Array(t.body)), 4552 r = encodeURIComponent(this.resolveFairplayAssetId(t));
4553 t.headers["Content-Type"] = "application/json", t.headers.Authorization = i.license, t.body = shaka.util.StringUtils.toUTF8(JSON.stringify({ 4554 spc: s, 4555 assetId: r 4556 })); 4557 } 4558 fairplayResponseFilter(e, t) { 4559 if (!this.isLicense(e)) return; 4560 var i = shaka.util.StringUtils.fromUTF8(t.data).trim(); 4561 if (i.slice(0, 5) === "<ckc>" && i.slice(-6) === "</ckc>") i = i.slice(5, -6);else if (i.startsWith("{")) try { 4562 var s = JSON.parse(i); 4563 i = s.ckc || s.Ckc || s.license || i; 4564 } catch (_unused4) {} 4565 t.data = shaka.util.Uint8ArrayUtils.fromBase64(i).buffer; 4566 } 4567 fairplayInitDataTransform(e, t, i) { 4568 if (t !== "skd") return e; 4569 try { 4570 this.fairplayAssetId = shaka.drm.FairPlay.defaultGetContentId(e) || this.fairplayAssetId; 4571 } catch (_unused5) {} 4572 if (!(window.shakaMediaKeysPolyfill === "apple")) return e; 4573 var r = i && i.serverCertificate; 4574 if (!r || !r.byteLength) throw new Error("FairPlay server certificate required before initDataTransform"); 4575 return shaka.drm.FairPlay.initDataTransform(e, this.fairplayAssetId, r); 4576 } 4577 resolveFairplayAssetId(e) { 4578 try { 4579 if (e.initData && e.initData.byteLength) { 4580 var t = shaka.drm.FairPlay.defaultGetContentId(e.initData); 4581 if (t) return t; 4582 } 4583 } catch (_unused6) {} 4584 return this.fairplayAssetId; 4585 } 4586 onError(e) { 4587 e instanceof Error || e.severity === shaka.util.Error.Severity.CRITICAL && app.error(`Player error - ${e.category} - ${e.code}`); 4588 } 4589 }, 4590 Qi = ke; 4591 var we = class { 4592 constructor(e, t, i, s, r) { 4593 this.html = e; 4594 this.user = t; 4595 this.options = i; 4596 this.gql = s; 4597 this.localStorage = r; 4598 this.nextPopupAttemptAfter = 0; 4599 this.nextPopupAttemptAfter = this.getNextMailingPopupAttemptAfter(); 4600 } 4601 getMailingSubscription() { 4602 return this.gql.mailingSubscriptions(this.options.siteId, "mail").then(e => { 4603 var _e$subscriptions; 4604 var t = (_e$subscriptions = e.subscriptions) === null || _e$subscriptions === void 0 ? void 0 : _e$subscriptions[0]; 4605 return t || Promise.reject("Subscription not found"); 4606 }); 4607 } 4608 updateMailingSubscription(e, t) { 4609 return this.gql.settingsUpdateSubscription(this.options.siteId, e, t); 4610 } 4611 getNextMailingPopupAttemptAfter() { 4612 var e = this.localStorage.get("mailingNextPopupAttemptAfter") || 0; 4613 if (!e) { 4614 var t = this.localStorage.get("mailingLastPopupAttemptAt") || 0; 4615 t && (e = t + 14 * 86400 * 1e3, this.localStorage.remove("mailingLastPopupAttemptAt"), this.localStorage.set("mailingNextPopupAttemptAfter", e)); 4616 } 4617 return e; 4618 } 4619 setNextMailingPopupAttemptAfter(e) { 4620 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4621 t === null && (t = Date.now()); 4622 var i = t + e * 1e3; 4623 this.localStorage.set("mailingNextPopupAttemptAfter", i); 4624 } 4625 canShowPopup() { 4626 return !(this.nextPopupAttemptAfter && Date.now() < this.nextPopupAttemptAfter); 4627 } 4628 }, 4629 Ni = we; 4630 var Ee = class { 4631 constructor(e) { 4632 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 4633 this.cookiesAccept = e, this.vendors = t; 4634 } 4635 isVendorAllowed(e) { 4636 return this.vendors.includes(e); 4637 } 4638 isImportantAllowed() { 4639 return this.cookiesAccept.includes("important"); 4640 } 4641 isThirdAllowed() { 4642 return this.cookiesAccept.includes("third"); 4643 } 4644 }, 4645 C = Ee; 4646 var Te = class { 4647 constructor(e, t, i) { 4648 this.html = e; 4649 this.events = t; 4650 this.options = i; 4651 } 4652 init() { 4653 var e = this.get("cookies_accept") || ""; 4654 e === "all" && (e = "local,important,third"), this.cookies = new C(e), this.events.sendEvent("cookies", this.cookies), this.updateCookieClasses(); 4655 } 4656 set(e, t) { 4657 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 31536e3; 4658 var s = new Date(), 4659 r = t, 4660 n = this.getDomain(), 4661 a = this.canUseSecure(n) ? "SameSite=None; Secure;" : "SameSite=Lax;"; 4662 s.setTime(s.getTime() + i * 1e3), document.cookie = e + "=" + r + "; expires=" + s.toUTCString() + "; path=/; " + a + " domain=" + n; 4663 } 4664 canUseSecure(e) { 4665 var _this$options$site; 4666 return !((_this$options$site = this.options.site) !== null && _this$options$site !== void 0 && _this$options$site.includes("voyotvapp") || this.isLocalDev(e)); 4667 } 4668 isLocalDev(e) { 4669 return e.startsWith("192.") || e.startsWith("172.") || e === "localhost"; 4670 } 4671 getDomain() { 4672 var e = document.location.hostname; 4673 return this.isLocalDev(e) || e.split(".").length > 2 && (e = "." + e.split(".").slice(-2).join(".")), e; 4674 } 4675 setIfImportantAllowed(e, t) { 4676 var _this$cookies; 4677 ((_this$cookies = this.cookies) === null || _this$cookies === void 0 ? void 0 : _this$cookies.isImportantAllowed()) && this.set(e, t); 4678 } 4679 get(e) { 4680 var _s$pop; 4681 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4682 var s = ("; " + document.cookie).split("; " + e + "="); 4683 return s.length >= 2 && ((_s$pop = s.pop()) === null || _s$pop === void 0 ? void 0 : _s$pop.split(";").shift()) || t; 4684 } 4685 getFloat(e) { 4686 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4687 var i = this.get(e); 4688 return i ? parseFloat(i) : t; 4689 } 4690 delete(e) { 4691 var t = new Date(); 4692 t.setTime(t.getTime() + -1440 * 60 * 1e3), document.cookie = e + "=; expires=" + t.toUTCString() + "; path=/"; 4693 var i = document.location.hostname; 4694 document.cookie = e + "=; expires=" + t.toUTCString() + "; path=/; domain=" + i, i = this.getDomain(), document.cookie = e + "=; expires=" + t.toUTCString() + "; path=/; domain=" + i; 4695 } 4696 updateCookieClasses() { 4697 this.cookies.isThirdAllowed() ? (this.html.show(".if-cookies-third"), this.html.hide(".if-cookies-no-third")) : (this.html.hide(".if-cookies-third"), this.html.show(".if-cookies-no-third")), this.cookies.isImportantAllowed() ? (this.html.show(".if-cookies-important"), this.html.hide(".if-cookies-no-important")) : (this.html.hide(".if-cookies-important"), this.html.show(".if-cookies-no-important")); 4698 } 4699 }, 4700 Wi = Te; 4701 var Pe = class extends Wi { 4702 init() { 4703 var _window$didomiOnReady, _window$didomiEventLi; 4704 (_window$didomiOnReady = window.didomiOnReady) !== null && _window$didomiOnReady !== void 0 && _window$didomiOnReady.push(e => { 4705 this.parseDidomiUserStatus(e.getUserStatus()); 4706 }), (_window$didomiEventLi = window.didomiEventListeners) === null || _window$didomiEventLi === void 0 ? void 0 : _window$didomiEventLi.push({ 4707 event: "consent.changed", 4708 listener: () => this.parseDidomiUserStatus(window.Didomi.getUserStatus()) 4709 }); 4710 } 4711 parseDidomiUserStatus(e) { 4712 var t = e.purposes.essential, 4713 i = e.purposes.consent.enabled, 4714 s = e.vendors.global.enabled.map(String), 4715 r = t.concat(i).filter(n => n === "local" || n === "cookies" || n === "third").map(n => n.replace("cookies", "important")); 4716 this.cookies = new C(r.join(","), s), this.events.sendEvent("cookies", this.cookies), this.updateCookieClasses(); 4717 } 4718 }, 4719 zi = Pe; 4720 var Le = class { 4721 constructor(e, t) { 4722 this.html = e; 4723 this.options = t; 4724 } 4725 renderGallery(e) { 4726 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; 4727 var i = new Splide("#gallery_" + e + "_thumbnails", { 4728 fixedWidth: 100, 4729 gap: 10, 4730 rewind: !0, 4731 pagination: !1, 4732 isNavigation: !0, 4733 arrows: !1, 4734 breakpoints: { 4735 800: { 4736 fixedWidth: 60 4737 } 4738 } 4739 }), 4740 s = new Splide("#gallery_" + e, { 4741 type: "fade", 4742 rewind: !0, 4743 pagination: !1, 4744 arrows: !0 4745 }); 4746 s.sync(i), s.mount(), i.mount(), s.on("click", r => {
4747 this.showFullscreenGallery(e, r.index, t); 4748 }), s.on("active", r => { 4749 var n = this.html.getData(r.slide, "title"); 4750 this.html.writeHTML("#gallery_" + e + "_caption", n), this.html.writeHTML("#gallery_" + e + "_index", r.index + 1); 4751 }), s.on("move", () => { 4752 var _window$dm; 4753 this.options.siteId === 30012 && ((_window$dm = window.dm) === null || _window$dm === void 0 ? void 0 : _window$dm.AjaxEvent("pageview")); 4754 }); 4755 } 4756 renderFullscreenGallery(e, t) { 4757 var i = this.html.q("#fullscreen_gallery_" + e + "_thumbnails"), 4758 s = this.html.q("#fullscreen_gallery_" + e); 4759 if (!i || !s) return; 4760 this.html.openFullscreen(); 4761 var r = new Splide(i, { 4762 fixedWidth: 100, 4763 gap: 10, 4764 rewind: !0, 4765 pagination: !1, 4766 isNavigation: !0, 4767 arrows: !1, 4768 breakpoints: { 4769 800: { 4770 fixedWidth: 60 4771 } 4772 }, 4773 start: t 4774 }), 4775 n = new Splide(s, { 4776 type: "fade", 4777 rewind: !0, 4778 pagination: !1, 4779 arrows: !0, 4780 start: t 4781 }); 4782 n.on("active", a => { 4783 var l = this.html.getData(a.slide, "title"); 4784 this.html.writeHTML("#fullscreen_gallery_caption", l), this.html.writeHTML("#fullscreen_gallery_index", a.index + 1); 4785 }), n.sync(r), n.mount(), r.mount(), n.on("move", () => { 4786 var _window$dm2; 4787 this.options.siteId === 30012 && ((_window$dm2 = window.dm) === null || _window$dm2 === void 0 ? void 0 : _window$dm2.AjaxEvent("pageview")); 4788 }); 4789 } 4790 showFullscreenArticleImage(e, t, i) { 4791 t ? window.open(t) : this.showFullscreenImage("/articles/" + this.options.articleId + "/images/" + e, i); 4792 } 4793 showFullscreenRecipeImage(e, t, i) { 4794 t ? window.open(t) : this.showFullscreenImage("/recipes/" + this.options.recipeId + "/images/" + e, i); 4795 } 4796 showFullscreenImage(e, t) { 4797 this.html.writeHTML("#fullscreen_content", ""), t !== null && t !== void 0 && t.stopPropagation(), this.html.fetchText(e).then(i => { 4798 i && (this.html.openFullscreen(), this.html.writeHTML("#fullscreen_content", i)); 4799 }); 4800 } 4801 showFullscreenGallery(e, t, i) { 4802 var s = i ? "/recipes/" + this.options.recipeId + "/gallery/index/" + t : "/articles/" + this.options.articleId + "/galleries/" + e + "/index/" + t; 4803 this.html.fetchText(s).then(r => this.html.writeHTML("#fullscreen_content", r)).then(() => this.renderFullscreenGallery(e, t)); 4804 } 4805 }, 4806 Ji = Le; 4807 var Se = class { 4808 constructor(e, t, i) { 4809 this.html = e; 4810 this.gql = t; 4811 this.cookies = i; 4812 } 4813 vote(e, t) { 4814 var i = this.html.q("#poll_" + e + " input:checked"); 4815 i && this.gql.pollVote(e, +i.id, t).then(s => this.afterVote(e)).catch(s => this.onVoteError(s, e)); 4816 } 4817 checkIfVoted(e) { 4818 (this.cookies.get("votedPolls") || "").split(",").includes(e.toString()) && this.afterVote(e); 4819 } 4820 showResults(e, t) { 4821 this.html.hide("#poll_" + e + " .poll-answers"), this.html.removeClass("#poll_" + e + " .poll-answers-btn-all", "active"), this.html.removeClass("#poll_" + e + " .poll-answers-btn-male", "active"), this.html.removeClass("#poll_" + e + " .poll-answers-btn-female", "active"), this.html.show("#poll_" + e + " .poll-answers-" + t), this.html.addClass("#poll_" + e + " .poll-answers-btn-" + t, "active"); 4822 } 4823 afterVote(e) { 4824 var i = (this.cookies.get("votedPolls") || "").split(","); 4825 i.includes(e.toString()) || (i.push(e.toString()), this.cookies.setIfImportantAllowed("votedPolls", i.join(","))), this.html.hide("#poll_" + e + " .poll-questions"), this.html.show("#poll_" + e + " .poll-answers-container"); 4826 } 4827 onVoteError(e, t) { 4828 var i = "#poll_" + t + " .poll-error", 4829 s = i + " .error-message"; 4830 this.html.writeHTML(s, e.message), this.html.show(i, "flex"), setTimeout(() => { 4831 this.html.writeHTML(s, ""), this.html.hide(i); 4832 }, 4e3); 4833 } 4834 }, 4835 Ki = Se; 4836 var Me = class { 4837 constructor(e, t) { 4838 this.html = e; 4839 this.options = t; 4840 this.items = []; 4841 this.observer = new IntersectionObserver(this.callback.bind(this), { 4842 threshold: 0 4843 }); 4844 } 4845 init(e) { 4846 var _this$observer; 4847 e && ((_this$observer = this.observer) !== null && _this$observer !== void 0 && _this$observer.disconnect(), this.observer = new IntersectionObserver(this.callback.bind(this), e)); 4848 var t = this.html.qAll("[inview]"); 4849 t.length && t.forEach(i => this.observe(i)); 4850 } 4851 observe(e) { 4852 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4853 var i = this.html.q(e); 4854 if (!(!i || !this.observer)) { 4855 if (!t) { 4856 var _i$attributes$getName; 4857 var s = ((_i$attributes$getName = i.attributes.getNamedItem("inview")) === null || _i$attributes$getName === void 0 ? void 0 : _i$attributes$getName.value) || "?", 4858 r = s.includes("|") ? s.substring(s.indexOf("|") + 1) : "{}"; 4859 t = { 4860 task: s.includes("|") ? s.substring(0, s.indexOf("|")) : s, 4861 params: JSON.parse(r) 4862 }; 4863 } 4864 this.items.push({ 4865 element: i, 4866 task: t.task, 4867 params: t.params, 4868 isVisible: null 4869 }), this.observer.observe(i); 4870 } 4871 } 4872 callback(e, t) { 4873 e.forEach(i => { 4874 var _s$params, _s$params2, _s$params3, _s$params4; 4875 var s = this.items.find(n => n.element === i.target); 4876 if (!s || !s.task) { 4877 this.stopObserving({ 4878 element: i.target 4879 }); 4880 return; 4881 } 4882 if (((_s$params = s.params) === null || _s$params === void 0 ? void 0 : _s$params.tracking) !== "both" && !i.isIntersecting || ((_s$params2 = s.params) === null || _s$params2 === void 0 ? void 0 : _s$params2.tracking) === "both" && s.isVisible === null && !i.isIntersecting) return; 4883 switch (s.isVisible = i.isIntersecting, s.task) { 4884 case "playVideo": 4885 var n = s.params.video || null, 4886 a = s.params.options || {},
4887 l = s.element.id || "video_" + n.Id; 4888 window.app.video.play("#" + l, n, a); 4889 break; 4890 case "instagram": 4891 window.app.gadgets.instagram(); 4892 break; 4893 case "loadComments": 4894 window.app.comments.loadMore(); 4895 break; 4896 case "mountSplide": 4897 s.params.splide.mount(); 4898 break; 4899 case "randomPrArticles": 4900 var d = ((_s$params3 = s.params) === null || _s$params3 === void 0 ? void 0 : _s$params3.nb) || 6; 4901 window.app.banners.showRandomPrArticles(s.element, d); 4902 break; 4903 case "pip": 4904 i.isIntersecting ? (window.app.html.addClass(s.params.selector || "", s.params.ifVisible || ""), window.app.html.removeClass(s.params.selector || "", s.params.ifHidden || "")) : (window.app.html.addClass(s.params.selector || "", s.params.ifHidden || ""), window.app.html.removeClass(s.params.selector || "", s.params.ifVisible || "")); 4905 break; 4906 case "animalBodyParts": 4907 window.app.html.q(".onl-svinjina AREA").click(), window.app.html.q(".onl-govedina AREA").click(); 4908 break; 4909 default: 4910 var c = window[s.task]; 4911 typeof c == "function" ? c(s) : console.log("Observer: unknown task: ", s.task); 4912 } 4913 ((_s$params4 = s.params) === null || _s$params4 === void 0 ? void 0 : _s$params4.tracking) === "both" || this.stopObserving(s); 4914 }); 4915 } 4916 isVisible(e) { 4917 var t = this.html.q(e); 4918 if (!t) return !1; 4919 var i = this.items.find(s => s.element === t); 4920 return i && i.isVisible || !1; 4921 } 4922 stopObserving(e) { 4923 this.observer.unobserve(e.element), this.items = this.items.filter(t => e); 4924 } 4925 }, 4926 Xi = Me; 4927 var Ce = class { 4928 constructor(e, t, i, s) { 4929 this.cookies = e; 4930 this.html = t; 4931 this.observer = i; 4932 this.options = s; 4933 this.commentsActiveSlots = { 4934 "/23086084073/D_in_comments": null, 4935 "/23086084073/D_in_comments_1": null, 4936 "/23086084073/M_in_comments": null, 4937 "/23086084073/M_in_comments_1": null 4938 }; 4939 this.commentsSlotPrefixMap = [{ 4940 prefix: "div-gpt-ad-1750238051488-", 4941 slotName: "/23086084073/D_in_comments", 4942 dims: [[1, 1], [728, 90]], 4943 isMobile: !1 4944 }, { 4945 prefix: "div-gpt-ad-1750928140596-", 4946 slotName: "/23086084073/D_in_comments_1", 4947 dims: [[1, 1], [728, 90]], 4948 isMobile: !1 4949 }, { 4950 prefix: "div-gpt-ad-1750238123145-", 4951 slotName: "/23086084073/M_in_comments", 4952 dims: [[1, 1], [300, 250]], 4953 isMobile: !0 4954 }, { 4955 prefix: "div-gpt-ad-1750928212141-", 4956 slotName: "/23086084073/M_in_comments_1", 4957 dims: [[1, 1], [300, 250]], 4958 isMobile: !0 4959 }]; 4960 } 4961 init() {} 4962 comments() { 4963 this.commentsObserver && this.commentsObserver.disconnect(), this.commentsObserver = new IntersectionObserver(t => { 4964 t.forEach(i => { 4965 if (!i.isIntersecting) return; 4966 var s = i.target.querySelector('[id^="div-gpt-ad-"]'); 4967 if (!s) return; 4968 var r = s.id, 4969 n = this.commentsSlotPrefixMap.find(d => r.startsWith(d.prefix) && d.isMobile === this.options.isMobile); 4970 if (!n) return; 4971 var a = n.slotName, 4972 l = this.commentsActiveSlots[a]; 4973 l && l.slotId === r || window.googletag.cmd.push(() => { 4974 l && l.slot && window.googletag.destroySlots([l.slot]); 4975 var d = window.googletag.pubads().getSlots().find(h => h.getSlotElementId() === r); 4976 if (d) { 4977 this.commentsActiveSlots[a] = { 4978 slot: d, 4979 slotId: r 4980 }, window.googletag.pubads().refresh([d]); 4981 return; 4982 } 4983 var m = window.googletag.defineSlot(a, n.dims, r).addService(window.googletag.pubads()); 4984 this.commentsActiveSlots[a] = { 4985 slot: m, 4986 slotId: r 4987 }, window.pbjs.que.push(() => { 4988 window.pbjs.rp.requestBids({ 4989 callback: () => { 4990 window.googletag.cmd.push(() => { 4991 window.googletag.display(r), window.googletag.pubads().refresh([m]); 4992 }); 4993 }, 4994 gptSlotObjects: [m] 4995 }); 4996 }); 4997 }); 4998 }); 4999 }, { 5000 root: null, 5001 threshold: .1, 5002 rootMargin: "300px 0px" 5003 }), this.html.qAll(".banner.comment-ad").forEach(t => this.commentsObserver.observe(t)); 5004 } 5005 showRandomPrArticles(e, t) { 5006 var _this$html$q1; 5007 var i = ((_this$html$q1 = this.html.q(e)) === null || _this$html$q1 === void 0 ? void 0 : _this$html$q1.childNodes) || [], 5008 s = i.length, 5009 r = []; 5010 for (; r.length < t && r.length < s;) { 5011 var n = Math.floor(Math.random() * s); 5012 r.includes(n) || r.push(n); 5013 }
5014 i.forEach((n, a) => { 5015 r.includes(a) && this.html.removeClass(n, "hidden"); 5016 }); 5017 } 5018 getPreOrPostRoll(e) { 5019 var _this7 = this; 5020 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee69() { 5021 var _this7$options$ads, _this7$options$ads2, _this7$options$ads3, _this7$options$ads4, _this7$options$ads5, _window, _s$purposes$select_pe; 5022 var t, i, s; 5023 return _regenerator().w(function (_context69) { 5024 while (1) switch (_context69.n) { 5025 case 0: 5026 t = ""; 5027 e === "postroll" ? t = (_this7.options.isMobile ? (_this7$options$ads = _this7.options.ads) === null || _this7$options$ads === void 0 ? void 0 : _this7$options$ads.mobilePostrollUrl : (_this7$options$ads2 = _this7.options.ads) === null || _this7$options$ads2 === void 0 ? void 0 : _this7$options$ads2.postrollUrl) || "" : e === "preroll" ? t = (_this7.options.isMobile ? (_this7$options$ads3 = _this7.options.ads) === null || _this7$options$ads3 === void 0 ? void 0 : _this7$options$ads3.mobilePrerollUrl : (_this7$options$ads4 = _this7.options.ads) === null || _this7$options$ads4 === void 0 ? void 0 : _this7$options$ads4.prerollUrl) || "" : e === "verticalPreroll" && (t = ((_this7$options$ads5 = _this7.options.ads) === null || _this7$options$ads5 === void 0 ? void 0 : _this7$options$ads5.verticalPrerollUrl) || ""); 5028 i = !0, s = (_window = window) === null || _window === void 0 || (_window = _window.Didomi) === null || _window === void 0 ? void 0 : _window.getCurrentUserStatus(); 5029 return _context69.a(2, (s && s.purposes && (i = !((_s$purposes$select_pe = s.purposes.select_personalized_ads) !== null && _s$purposes$select_pe !== void 0 && _s$purposes$select_pe.enabled)), t + (i ? "&npa=1" : "&npa=0"))); 5030 } 5031 }, _callee69); 5032 }))(); 5033 } 5034 }, 5035 Yi = Ce; 5036 var Ie = class { 5037 constructor(e) { 5038 this.src = e.src || "", this.type = e.type || "application/x-mpegURL", this.keySystems = e.keySystems || {}; 5039 } 5040 }, 5041 I = Ie; 5042 var Ae = class { 5043 constructor(e, t, i, s, r, n) { 5044 this.html = e; 5045 this.gql = t; 5046 this.cookies = i; 5047 this.banners = s; 5048 this.reload = r; 5049 this.options = n; 5050 this.bgVideoTimer = null; 5051 this.imaOptions = { 5052 id: "", 5053 locale: "", 5054 debug: !1, 5055 autoPlayAdBreaks: !0, 5056 disableAdControls: !1, 5057 requestMode: "onPlay", 5058 showCountdown: !1, 5059 adsManagerLoadedCallback: e => {}, 5060 disableCustomPlaybackForIOS10Plus: !0 5061 }; 5062 this.imaOptions.debug = this.options.env == "dev"; 5063 } 5064 play(e, t, i) { 5065 var _this8 = this; 5066 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee70() { 5067 var s, _t1, _t10; 5068 return _regenerator().w(function (_context70) { 5069 while (1) switch (_context70.n) { 5070 case 0: 5071 if (!(!t || !t.Id)) { 5072 _context70.n = 1; 5073 break; 5074 } 5075 return _context70.a(2, Promise.reject(new Error("No video data"))); 5076 case 1: 5077 i.showPoster === void 0 && (i.showPoster = !0); 5078 i.disableDblClick === void 0 && (i.disableDblClick = !1); 5079 _t1 = i.inBackground; 5080 if (_t1) { 5081 _context70.n = 3; 5082 break; 5083 } 5084 _context70.n = 2; 5085 return _this8.hasAdblocker(); 5086 case 2: 5087 _t10 = _context70.v; 5088 if (!_t10) { 5089 _context70.n = 3; 5090 break; 5091 } 5092 t.Id = _this8.options.adblockerVideoId, t.Subtype = "trailer"; 5093 case 3: 5094 i.clickedButton && (_this8.html.removeClass(".video__list-active", "video__list-active"), _this8.html.addClass(i.clickedButton, "video__list-active")); 5095 i.selector = e; 5096 s = (t.Mime & 16) === 16; 5097 return _context70.a(2, _this8.html.loadVideoElements(s).then(() => _this8.gql.videoUrlV2(parseInt(t.Id, 10))).then(r => !r || !r.url ? Promise.reject("No video url") : (_this8.initLanguage(), _this8.setVideoData(e, t), _this8.showVideoElement(e), _this8.options.siteId == 1 && _this8.setVideoData("#videoteca-video-info", t), i.setUrl && _this8.setVideoUrl(t), i.replaceUrl && _this8.replaceVideoUrl(t, i.customUrl), r !== null && r !== void 0 && r.infoCode && (t.Subtype = "trailer"), _this8.playUrl(e, r, t, i, s && r.license !== ""))).then(r => r)); 5098 } 5099 }, _callee70); 5100 }))(); 5101 }
5102 playBackground(e, t, i) { 5103 this.bgVideoTimer && clearTimeout(this.bgVideoTimer), this.bgVideoTimer = setTimeout(() => { 5104 var s = this.html.getData(e + " video", "video"); 5105 typeof s == "string" && s.length > 0 && (s = JSON.parse(s)), s && (this.html.show(e), this.play(e, s, { 5106 inBackground: !0, 5107 autoplay: i.autoplay, 5108 mute: !0 5109 })); 5110 }, t); 5111 } 5112 videotecaLoadMore(e, t, i) { 5113 var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "/video"; 5114 var r = this.html.getData(e, "pageNb"), 5115 n = parseInt(r, 10) + 1; 5116 this.html.setData(e, "pageNb", n), s += "?p=" + n, t && (s += "&s=" + t), this.html.fetchText(s).then(a => { 5117 (!a || a.length < 100) && this.html.hide(i), this.html.appendHTML(e, a); 5118 }); 5119 } 5120 getPlayerInsideDiv(e) { 5121 var t = this.html.q(e + " video"); 5122 if (!(!t || !window.videojs)) return videojs.getPlayer(t); 5123 } 5124 toggleMute(e) { 5125 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 5126 var i = this.getPlayerInsideDiv(e); 5127 i && (t === null ? i.muted(!i.muted()) : i.muted(t), !i.muted() && i.volume() < .1 && i.volume(.5), i.muted() ? (this.html.hide(e + " .icon.sound"), this.html.show(e + " .icon.mute")) : (this.html.hide(e + " .icon.mute"), this.html.show(e + " .icon.sound"))); 5128 } 5129 closePip() { 5130 this.html.removeClass(".pip", "pip"); 5131 } 5132 destroyPlayers() { 5133 if (!window.videojs || !videojs.players) return; 5134 Object.keys(videojs.players).map(t => videojs.players[t]).filter(t => t).forEach(t => { 5135 this.destroyPlayer(t); 5136 }); 5137 } 5138 destroyPlayer(e) { 5139 if (e.ima && e.ima.getAdsManager) try { 5140 var t = e.ima.getAdsManager(); 5141 t && t.destroy(); 5142 } catch (t) { 5143 console.warn("Error destroying ads manager:", t); 5144 } 5145 for (e.pause(); e.firstChild;) e.removeChild(e.firstChild); 5146 e.removeAttribute("src"), e.load(), e.dispose(); 5147 } 5148 setVideoData(e, t) { 5149 var _t$Section; 5150 this.html.writeHTML(e + " #video_title", t.Title), this.html.writeHTML(e + " #video_section", (_t$Section = t.Section) === null || _t$Section === void 0 ? void 0 : _t$Section.Title); 5151 } 5152 showVideoElement(e) { 5153 this.html.hide(e + " .videoteca-thumb"), this.html.show(e + " video"); 5154 } 5155 findButton(e, t) { 5156 return e.controlBar.children().find(s => { 5157 var _s$options; 5158 return ((_s$options = s.options()) === null || _s$options === void 0 ? void 0 : _s$options.type) === t; 5159 }); 5160 } 5161 setSharingButton(e, t, i) { 5162 var _s, _s2; 5163 var s = this.findButton(e, "share-button"); 5164 s && e.controlBar.removeChild(s), s = e.controlBar.addChild("button", { 5165 type: "share-button", 5166 className: "vjs-icon-share" 5167 }, 12), (_s = s) !== null && _s !== void 0 && _s.on("click", () => { 5168 this.toggleShareHtml(e, t.Id, i); 5169 }), (_s2 = s) !== null && _s2 !== void 0 && _s2.on("touchend", () => { 5170 this.toggleShareHtml(e, t.Id, i); 5171 }), e.on("userinactive", () => { 5172 this.hideShareHtml(i); 5173 }); 5174 } 5175 hideShareHtml(e) { 5176 var _this$html$q10; 5177 (_this$html$q10 = this.html.q(e + " .video-shares")) === null || _this$html$q10 === void 0 || _this$html$q10.remove(); 5178 } 5179 toggleShareHtml(e, t, i) { 5180 if (this.html.q(i + " .video-shares")) { 5181 this.hideShareHtml(i); 5182 return; 5183 } 5184 this.html.fetchText("/video/" + t + "/share-html").then(s => { 5185 this.html.appendHTML(i, s); 5186 }); 5187 } 5188 setVideoUrl(e) { 5189 var t = document.location.pathname; 5190 t.includes(".html") && (t = t.slice(0, t.lastIndexOf("/"))), t += e.Url + document.location.search, t = t.replace("//", "/"), history.pushState(null, "video: " + e.Id, t); 5191 } 5192 replaceVideoUrl(e, t) { 5193 if (t) { 5194 history.replaceState(null, "cu: " + e.Id, t); 5195 return; 5196 } 5197 var i = document.location.pathname; 5198 i.includes(".html") && (i = i.slice(0, i.lastIndexOf("/"))), i += e.Url + document.location.search, i = i.replace("//", "/"), history.replaceState(null, "video: " + e.Id, i); 5199 } 5200 showBanners(e, t) { 5201 return this.options.showAds ? t.isVerticalVideo ? !!t.showVerticalVideoAd : !(e.Subtype === "trailer" || !e.Postroll && !e.Preroll) : !1; 5202 } 5203 playUrl(e, t, i, s, r) { 5204 if (!t || !window.videojs) return Promise.reject(); 5205 var n = this.html.q(e), 5206 a = videojs(e + " video", { 5207 language: this.options.country, 5208 restoreEl: !0, 5209 userActions: { 5210 click: !0 5211 } 5212 });
5213 s.inBackground || (s.showPoster && a.poster(i.Image.Src.replace("PLACEHOLDER", "1100x619")), a.titleBar.update({ 5214 title: i.Title 5215 })), this.setSharingButton(a, i, e + " .video-js"); 5216 var l = this.getPlayerVolume(); 5217 s.mute && (l = 0, a.muted(!0)), s.loop && a.loop(!0), this.html.setData(e, "contentid", i.Id), a.hotkeysEnabled = !0, r && typeof a.eme == "function" && a.eme(); 5218 var d = this.prepareVideoSource(t, r); 5219 return this.showBanners(i, s) ? (this.initIMA(a, s, l), (s.showVerticalVideoAd ? this.initVerticalVideoBanners() : this.initVideoBanners()).then(h => { 5220 a.ima.initializeAdDisplayContainer(), a.ima.setContentWithAdsResponse(d, h); 5221 })) : a.src(d), new Promise((m, h) => { 5222 a.on("error", () => { 5223 h({ 5224 err: a.error(), 5225 player: a 5226 }); 5227 }), a.ready(() => { 5228 i.Vtt && this.setVttThumbnails(i.Vtt, a), this.html.setData(a.el(), "options", JSON.stringify(s)), this.initPlayerEvents(a, i, s), this.setPlayerVolume(a, l), a.on("keydown", c => { 5229 a.hotkeysEnabled && this.handleHotkey(a, c), c.stopPropagation(), c.preventDefault(); 5230 }), s.focus && a.tech({ 5231 IWillNotUseThisInPlugins: !0 5232 }).el().focus(), s.autoplay ? a.play().then(() => { 5233 m(a); 5234 }).catch(c => { 5235 h({ 5236 err: c, 5237 player: a 5238 }); 5239 }) : m(a); 5240 }); 5241 }); 5242 } 5243 registerBigPauseButton() { 5244 if (!window.videojs || videojs.getComponent("bigPauseButton")) return; 5245 var e = videojs.getComponent("Button"), 5246 t = class extends e { 5247 constructor(i) { 5248 var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 5249 super(i, s), this.addClass("vjs-big-pause-button"), this.controlText("Pause"), this.el().innerHTML = '<span class="vjs-icon-pause"></span>'; 5250 } 5251 handleClick() { 5252 this.player().pause(); 5253 } 5254 }; 5255 videojs.registerComponent("bigPauseButton", t); 5256 } 5257 addBigPauseButton(e) { 5258 return this.registerBigPauseButton(), e.bigPauseButton || (e.bigPauseButton = e.addChild("bigPauseButton"), e.bigPauseButton.hide()), e.bigPauseButton; 5259 } 5260 handleHotkey(e, t) { 5261 switch (t.code) { 5262 case "Space": 5263 e.paused() ? e.play() : e.pause(); 5264 break; 5265 case "ArrowRight": 5266 e.currentTime(e.currentTime() + 5); 5267 break; 5268 case "ArrowLeft": 5269 e.currentTime(e.currentTime() - 5); 5270 break; 5271 case "KeyM": 5272 e.muted(!e.muted()); 5273 } 5274 } 5275 stopPlayerPlayback(e) { 5276 if (e.pause(), e.ima && e.ima.getAdsManager) { 5277 var t = e.ima.getAdsManager(); 5278 t && t.pause(); 5279 } 5280 } 5281 stopOtherPlaybacks(e) { 5282 if (!window.videojs || !videojs.players) return; 5283 Object.keys(videojs.players).map(i => videojs.players[i]).filter(i => i && i !== e).forEach(i => { 5284 this.stopPlayerPlayback(i); 5285 }), this.closePip(); 5286 } 5287 initVideoBanners() { 5288 var _this9 = this; 5289 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee71() { 5290 var e, t, i; 5291 return _regenerator().w(function (_context71) { 5292 while (1) switch (_context71.n) { 5293 case 0: 5294 _context71.n = 1; 5295 return _this9.banners.getPreOrPostRoll("preroll"); 5296 case 1: 5297 e = _context71.v; 5298 _context71.n = 2; 5299 return _this9.banners.getPreOrPostRoll("postroll"); 5300 case 2: 5301 t = _context71.v; 5302 i = '<?xml version="1.0" encoding="UTF-8"?><vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">'; 5303 return _context71.a(2, (e && (i += '<vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll"><vmap:AdSource id="preroll-ad-1" allowMultipleAds="false" followRedirects="true"><vmap:AdTagURI templateType="vast3"><![CDATA[' + e + "]]></vmap:AdTagURI></vmap:AdSource></vmap:AdBreak>"), t && (i += '<vmap:AdBreak timeOffset="end" breakType="linear" breakId="postroll"><vmap:AdSource id="postroll-ad-1" allowMultipleAds="false" followRedirects="true"><vmap:AdTagURI templateType="vast3"><![CDATA[' + t + "]]></vmap:AdTagURI></vmap:AdSource></vmap:AdBreak>"), i += "</vmap:VMAP>", Promise.resolve(i))); 5304 } 5305 }, _callee71); 5306 }))(); 5307 } 5308 initVerticalVideoBanners() { 5309 var _this0 = this; 5310 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee72() { 5311 var e, t; 5312 return _regenerator().w(function (_context72) { 5313 while (1) switch (_context72.n) { 5314 case 0: 5315 _context72.n = 1; 5316 return _this0.banners.getPreOrPostRoll("verticalPreroll"); 5317 case 1: 5318 e = _context72.v; 5319 t = '<?xml version="1.0" encoding="UTF-8"?><vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">'; 5320 return _context72.a(2, (e && (t += '<vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll"><vmap:AdSource id="preroll-ad-1" allowMultipleAds="false" followRedirects="true"><vmap:AdTagURI templateType="vast3"><![CDATA[' + e + "]]></vmap:AdTagURI></vmap:AdSource></vmap:AdBreak>"), t += "</vmap:VMAP>", Promise.resolve(t))); 5321 } 5322 }, _callee72); 5323 }))(); 5324 } 5325 initIMA(e, t, i) { 5326 if (typeof e.ima != "function") return; 5327 var s = this.imaOptions; 5328 s.id = e.id(), s.locale = this.options.country === "si" ? "sl" : this.options.country, s.adsManagerLoadedCallback = r => { 5329 this.setAdPlayerVolume(e, e.ima.getAdsManager(), i), e.ima.addEventListener("volumeChange", n => this.onPlayerVolumeChange(e, t, n)), e.ima.addEventListener(google.ima.AdEvent.Type.STARTED, () => { 5330 var _t$onAdStarted; 5331 e.hotkeysEnabled = !1, e.el().classList.add("is-playing"), (_t$onAdStarted = t.onAdStarted) === null || _t$onAdStarted === void 0 ? void 0 : _t$onAdStarted.call(t); 5332 }), e.ima.addEventListener(google.ima.AdEvent.Type.COMPLETE, () => { 5333 var _t$onAdCompleted; 5334 e.hotkeysEnabled = !0, (_t$onAdCompleted = t.onAdCompleted) === null || _t$onAdCompleted === void 0 ? void 0 : _t$onAdCompleted.call(t); 5335 }), e.ima.addEventListener(google.ima.AdEvent.Type.SKIPPED, () => { 5336 var _t$onAdCompleted2; 5337 e.hotkeysEnabled = !0, (_t$onAdCompleted2 = t.onAdCompleted) === null || _t$onAdCompleted2 === void 0 ? void 0 : _t$onAdCompleted2.call(t); 5338 }); 5339 }, e.ima(s); 5340 } 5341 setVttThumbnails(e, t) { 5342 typeof t.vttThumbnails == "function" ? t.vttThumbnails({ 5343 src: e 5344 }) : t.vttThumbnails && t.vttThumbnails.src(e); 5345 } 5346 initLanguage() { 5347 videojs.addLanguage("si", { 5348 "Play Video": "Predvajaj", 5349 Play: "Predvajaj", 5350 Pause: "Pavza", 5351 LIVE: "V \u017DIVO", 5352 Mute: "Tiho", 5353 Unmute: "Glasno", 5354 Fullscreen: "Celozaslonski na\u010Din", 5355 "Picture-in-Picture": "Slika v sliki", 5356 "Exit Picture-in-Picture": "Izhod slika v sliki", 5357 "Non-Fullscreen": "Izhod celozaslonski na\u010Din" 5358 }), videojs.addLanguage("hr", { 5359 "Play Video": "Gledaj", 5360 Play: "Gledaj", 5361 Pause: "Pauza", 5362 LIVE: "U\u017Eivo", 5363 Mute: "Ugasi zvuk", 5364 Unmute: "Upali zvuk", 5365 Fullscreen: "Cijeli zaslon", 5366 "Picture-in-Picture": "Slika u slici", 5367 "Exit Picture-in-Picture": "Izlaz iz prikaza slike u slici", 5368 "Non-Fullscreen": "Izlaz iz cijelog zaslona" 5369 }); 5370 } 5371 initPlayerEvents(e, t, i) { 5372 var s = this.addBigPauseButton(e); 5373 e.bigPlayButton.on("touchend", r => { 5374 this.onPlayerTouchEnd(e, r); 5375 }), e.on("click", r => { 5376 this.onPlayerClick(e, r); 5377 }), e.on("dblclick", r => { 5378 this.onPlayerDblClick(e, i, r); 5379 }), e.on("start", r => { 5380 this.onPlayerStart(e, r); 5381 }), e.on("ended", r => { 5382 this.onPlayerEnded(e, i, r); 5383 }), e.on("timeupdate", r => { 5384 this.onPlayerTimeupdate(e, r); 5385 }), e.on("pause", r => { 5386 this.onPlayerPause(e, s, r); 5387 }), e.on("play", r => { 5388 this.onPlayerPlay(e, r); 5389 }), e.on("loadedmetadata", r => { 5390 this.onPlayerLoadMetadata(e, t, r); 5391 }), e.on("adstart", r => { 5392 this.onPlayerAdStart(e, r); 5393 }), e.on("adend", r => { 5394 this.onPlayerAdEnd(e, r); 5395 }), e.on("fullscreenchange", r => { 5396 this.onPlayerFullscreenChange(e, r); 5397 }), e.on("volumechange", r => { 5398 this.onPlayerVolumeChange(e, i, r); 5399 }), e.on("playing", r => { 5400 this.onPlayerPlaying(e, r); 5401 }), e.on("touchstart", r => { 5402 this.onPlayerTouchStart(e, r); 5403 }), e.on("useractive", r => { 5404 this.onPlayerUserActive(e, s, r); 5405 }), e.on("userinactive", r => { 5406 this.onPlayerUserInActive(e, s, r); 5407 }); 5408 } 5409 prepareVideoSource(e, t) { 5410 return t ? v() ? this.prepareDrmSafariVideoSource(e) : this.prepareDrmVideoSource(e) : new I({ 5411 src: e.url 5412 }); 5413 } 5414 prepareDrmVideoSource(e) { 5415 var t = { 5416 "com.widevine.alpha": { 5417 url: this.options.wvLicenseServerUrl, 5418 licenseHeaders: { 5419 "X-DRM-Message": e.url 5420 } 5421 } 5422 }; 5423 return new I({ 5424 src: e.url,
5425 type: "application/dash+xml", 5426 keySystems: t 5427 }); 5428 } 5429 prepareDrmSafariVideoSource(e) { 5430 var t = { 5431 "com.apple.fps": { 5432 certificateUri: this.options.fpLicenseServerUrl + "/fps-pub.der", 5433 getContentId: (i, s) => { 5434 try { 5435 return typeof s != "string" ? "" : s.split("skd://")[1] || ""; 5436 } catch (_unused7) { 5437 return ""; 5438 } 5439 }, 5440 getLicense: (i, s, r, n) => { 5441 var a = { 5442 spc: bi(r), 5443 assetId: encodeURIComponent(s) 5444 }; 5445 videojs.xhr({ 5446 uri: this.options.fpLicenseServerUrl + "/fps/rest/getLicense", 5447 method: "POST", 5448 responseType: "text", 5449 body: JSON.stringify(a), 5450 headers: { 5451 "Content-Type": "application/json", 5452 Authorization: e.license 5453 } 5454 }, (l, d, m) => { 5455 if (l) { 5456 n(l); 5457 return; 5458 } 5459 var h = m.trim(); 5460 h.slice(0, 5) === "<ckc>" && h.slice(-6) === "</ckc>" && (h = h.slice(5, -6)), n(null, Uint8Array.from(atob(h), c => c.charCodeAt(0))); 5461 }); 5462 } 5463 } 5464 }; 5465 return new I({ 5466 src: e.url, 5467 keySystems: t 5468 }); 5469 } 5470 onPlayerPlaying(e, t) { 5471 e.el().classList.add("is-playing"); 5472 } 5473 onPlayerDblClick(e, t, i) { 5474 t.disableDblClick || (e.isFullscreen() ? e.exitFullscreen() : e.requestFullscreen()); 5475 } 5476 onPlayerFullscreenChange(e, t) { 5477 var _e$nativeElement; 5478 (_e$nativeElement = e.nativeElement) === null || _e$nativeElement === void 0 || (_e$nativeElement = _e$nativeElement.firstChild) === null || _e$nativeElement === void 0 || _e$nativeElement.focus(); 5479 } 5480 onPlayerVolumeChange(e, t, i) { 5481 var s = e.muted() ? 0 : e.volume(); 5482 t.inBackground || this.cookies.setIfImportantAllowed("playerVol", s); 5483 } 5484 onPlayerStart(e, t) { 5485 e.controlBar.el().style.visibility = "visible"; 5486 } 5487 onPlayerAdEnd(e, t) {} 5488 onPlayerAdStart(e, t) {} 5489 onPlayerTouchEnd(e, t) {} 5490 onPlayerClick(e, t) {} 5491 onPlayerPlay(e, t) { 5492 var _this$reload; 5493 (_this$reload = this.reload) !== null && _this$reload !== void 0 && _this$reload.stop(), this.stopOtherPlaybacks(e); 5494 } 5495 onPlayerLoadMetadata(e, t, i) { 5496 if (e) { 5497 var s = e.seekable(); 5498 if (s && s.length > 0 && t.ObjectType === "stream") { 5499 var r = s.end(0) - s.start(0); 5500 r > 300 && (e.options_.liveui = !0, e.controlBar.addClass("vjs-liveui"), e.currentTime(e.seekable().end(0))); 5501 } 5502 } 5503 } 5504 onPlayerPause(e, t, i) { 5505 t === null || t === void 0 || t.hide(); 5506 } 5507 onPlayerTimeupdate(e, t) {} 5508 onPlayerEnded(e, t, i) { 5509 t.inBackground && t.selector && this.html.hide(t.selector); 5510 } 5511 onPlayerTouchStart(e, t) { 5512 var _e$ads, _e$ads$isInAdMode; 5513 if (!e || !e.hasStarted() || (_e$ads = e.ads) !== null && _e$ads !== void 0 && (_e$ads$isInAdMode = _e$ads.isInAdMode) !== null && _e$ads$isInAdMode !== void 0 && _e$ads$isInAdMode.call(_e$ads) || !e.userActive()) return; 5514 var i = t.target; 5515 i instanceof HTMLElement && (i.closest(".vjs-control-bar") || (e.paused() ? e.play() : e.pause())); 5516 } 5517 onPlayerUserActive(e, t, i) { 5518 e.hasStarted() && !e.paused() && (t === null || t === void 0 ? void 0 : t.show()); 5519 } 5520 onPlayerUserInActive(e, t, i) { 5521 t === null || t === void 0 || t.hide(); 5522 } 5523 getPlayerVolume() { 5524 var e = this.cookies.getFloat("playerVol", .5); 5525 return e === null ? .5 : e; 5526 } 5527 setPlayerVolume(e, t) { 5528 e.volume(t); 5529 var i = "#" + e.id() + " .vjs-volume-level"; 5530 this.html.setStyle(i, "width", t * 100 + "%"); 5531 } 5532 setAdPlayerVolume(e, t, i) { 5533 if (!t) return; 5534 t.setVolume(i); 5535 var s = "#" + e.id() + " .ima-slider-level-div"; 5536 this.html.setStyle(s, "width", i * 100 + "%"); 5537 } 5538 hasAdblocker() { 5539 return new Promise((e, t) => { 5540 var i = this.html.q("#adblock"); 5541 i || e(!1), i.onload = s => { 5542 e(!1); 5543 }, i.onerror = s => { 5544 e(!0); 5545 }, i.data = "https://ads.api.24ur.si/adserver/adblock.xseki.dej.nehi"; 5546 }); 5547 } 5548 }, 5549 Zi = Ae; 5550 var qe = class { 5551 constructor(e, t, i) { 5552 this.options = e; 5553 this.html = t; 5554 this.rateLimiter = i; 5555 this.debounceTime = 100; 5556 this.debouncedOnInput = this.rateLimiter.debounce(s => { 5557 var r = s.target.form; 5558 if (!r) return; 5559 var n = this.validateRequiredFields(r), 5560 a = this.html.q("button:not([type]), submit-button", r); 5561 a && (a.disabled = !n), this.resetErrors(r); 5562 }, this.debounceTime); 5563 }
5564 oninput(e) { 5565 this.debouncedOnInput(e); 5566 } 5567 submit(e, t, i) { 5568 var _this1 = this; 5569 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee73() { 5570 var _this1$html$q; 5571 var s; 5572 return _regenerator().w(function (_context73) { 5573 while (1) switch (_context73.n) { 5574 case 0: 5575 _this1.resetErrors(e), _this1.html.addClass(e, "loading"), (_this1$html$q = _this1.html.q("submit-button", e)) === null || _this1$html$q === void 0 ? void 0 : _this1$html$q.setAttribute("loading", ""); 5576 s = _this1.extractFormData(e); 5577 return _context73.a(2, t(s).then(() => { 5578 var _this1$html$q2; 5579 var r = _this1.html.getData(e, "successMsg"); 5580 r && _this1.showFormCallout(e, r, "success"), _this1.html.removeClass(e, "loading"), (_this1$html$q2 = _this1.html.q("submit-button", e)) === null || _this1$html$q2 === void 0 ? void 0 : _this1$html$q2.removeAttribute("loading"); 5581 }).catch(r => { 5582 var _this1$html$q3; 5583 i ? i(r) : _this1.defaultErrorHandler(e, r), _this1.html.removeClass(e, "loading"), (_this1$html$q3 = _this1.html.q("submit-button", e)) === null || _this1$html$q3 === void 0 ? void 0 : _this1$html$q3.removeAttribute("loading"); 5584 })); 5585 } 5586 }, _callee73); 5587 }))(); 5588 } 5589 submitWithUpdate(e, t, i) { 5590 var _this10 = this; 5591 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee74() { 5592 return _regenerator().w(function (_context74) { 5593 while (1) switch (_context74.n) { 5594 case 0: 5595 return _context74.a(2, _this10.submit(e, t, i).then(() => { 5596 _this10.updateDefaultValues(e); 5597 })); 5598 } 5599 }, _callee74); 5600 }))(); 5601 } 5602 onreset(e) { 5603 var t = e.target; 5604 t && this.resetErrors(t); 5605 } 5606 reset(e) { 5607 e.reset(), this.resetErrors(e); 5608 } 5609 updateDefaultValues(e) { 5610 this.html.qAll("input", e).forEach(i => { 5611 var s = i; 5612 s.type === "password" || s.type === "hidden" || (s.type === "checkbox" ? s.defaultChecked = s.checked : s.defaultValue = s.value); 5613 }); 5614 } 5615 extractFormData(e) { 5616 var t = new FormData(e), 5617 i = {}; 5618 return t.forEach((s, r) => { 5619 var _e$elements$namedItem; 5620 ((_e$elements$namedItem = e.elements.namedItem(r)) === null || _e$elements$namedItem === void 0 ? void 0 : _e$elements$namedItem.type) === "checkbox" ? i[r] = s.toString() : i[r] = s.toString().trim(); 5621 }), i; 5622 } 5623 defaultErrorHandler(e, t) { 5624 var i = (t === null || t === void 0 ? void 0 : t.code) || "", 5625 s = (t === null || t === void 0 ? void 0 : t.message) || 'ÐÑзникна гÑеÑка', 5626 r = !1; 5627 i && (r = this.showFieldErrorByCode(e, i, s)), r || ((s.includes("Fetch request timed out") || s.includes("HTTP error!")) && (s = 'ÐÑеÑка пÑи вÑÑзка ÑÑÑ ÑÑÑвÑÑа'), this.showFormCallout(e, s, "error")); 5628 } 5629 resetErrors(e) { 5630 this.html.hide(".login-error", e), this.html.writeHTML(".login-error", "", e), this.html.hide(".callout", e), this.html.writeHTML(".callout span", "", e), this.html.removeClass(".callout", "callout--success callout--error callout--warning", e); 5631 } 5632 showFieldErrorByCode(e, t, i) { 5633 var s = this.html.qAll(`.login-error[data-errors*="${t}"]`, e); 5634 return s.forEach(r => { 5635 this.showFieldError(r, i); 5636 }), s.length > 0; 5637 } 5638 showFieldError(e, t) { 5639 this.html.writeHTML(e, t), this.html.show(e); 5640 } 5641 showFormCallout(e, t) { 5642 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "error"; 5643 var s = this.html.q(".callout", e); 5644 s && this.showCallout(s, t, i); 5645 } 5646 showCallout(e, t) { 5647 var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "error"; 5648 this.html.addClass(e, `callout--${i}`), e instanceof HTMLElement ? this.html.writeHTML("span", t, e) : this.html.writeHTML(`${e} span`, t), this.html.show(e, "flex"); 5649 } 5650 clearCallout(e) { 5651 this.html.hide(e), this.html.writeHTML(`${e} span`, ""), this.html.removeClass(e, "callout--success callout--error callout--warning"); 5652 } 5653 toggleShowPassword(e) { 5654 var t = this.html.q(e); 5655 if (!t) return; 5656 var i = t.getAttribute("type") === "password" ? "text" : "password"; 5657 t.setAttribute("type", i); 5658 } 5659 validateRequiredFields(e) { 5660 var t = this.html.qAll("input[data-required]", e), 5661 i = !0; 5662 return t.forEach(s => { 5663 var r = this.html.getData(s, "required"), 5664 n = this.validateRequiredField(s, r); 5665 i = i && n; 5666 }), i; 5667 } 5668 validateRequiredField(e, t) { 5669 if (e.type === "checkbox") return e.checked; 5670 if (e.type === "radio") { 5671 var s = e.name; 5672 return this.html.q(`input[type="radio"][name="${s}"]:checked`, e.form) !== null; 5673 } 5674 if (t === "") return e.value.trim() !== ""; 5675 var i; 5676 try { 5677 i = JSON.parse(t); 5678 } catch (s) { 5679 return app.error("Invalid JSON in data-required attribute for field", e.name, s), !1; 5680 } 5681 return i.length ? e.value.trim().length === i.length : i.notDefault ? e.value.trim() !== e.defaultValue.trim() : !1; 5682 } 5683 }, 5684 es = qe; 5685 var He = class { 5686 constructor(e, t, i) { 5687 var _i$routes, _i$ads; 5688 this.html = e; 5689 this.video = t; 5690 this.p = 0; 5691 this.isEnd = !1; 5692 this.isFetching = !1; 5693 this.videoPlayCount = 0; 5694 this.route = ((_i$routes = i.routes) === null || _i$routes === void 0 ? void 0 : _i$routes.vertical_videos) || "/kratek-video", this.hasVerticalPreroll = !!((_i$ads = i.ads) !== null && _i$ads !== void 0 && _i$ads.verticalPrerollUrl); 5695 } 5696 playSlide(e) { 5697 var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5698 var i = this.html.q("[data-video]", e); 5699 if (!i) return; 5700 var s = JSON.parse(this.html.getData(i, "video")), 5701 r = `#video-vertical-player-${s.Id}`; 5702 this.setAdUi(e, !1); 5703 var n = { 5704 mute: !!t.mute, 5705 autoplay: !0, 5706 focus: !1, 5707 loop: !0, 5708 replaceUrl: !0, 5709 showPoster: !1, 5710 showVerticalVideoAd: this.shouldPlayPreroll(), 5711 isVerticalVideo: !0, 5712 onAdStarted: () => this.setAdUi(e, !0), 5713 onAdCompleted: () => this.setAdUi(e, !1) 5714 }; 5715 this.video.destroyPlayers(), this.video.play(r, s, n).catch(a => this.handlePlaybackInterruption(a)).catch(a => { 5716 var _a$player; 5717 return console.log("Vertical videos", a === null || a === void 0 ? void 0 : a.err), a !== null && a !== void 0 && (_a$player = a.player) !== null && _a$player !== void 0 && _a$player.dispose(), n.mute = !0, this.video.play(r, s, n).catch(l => this.handlePlaybackInterruption(l)); 5718 }).catch(a => { 5719 this.showPlayerPoster(a === null || a === void 0 ? void 0 : a.player, s); 5720 }); 5721 } 5722 handlePlaybackInterruption(e) { 5723 var _e$player; 5724 if (!(e !== null && e !== void 0 && (_e$player = e.player) !== null && _e$player !== void 0 && _e$player.isDisposed())) { 5725 var _e$err, _e$player2, _e$player2$isInAdMode; 5726 if ((e === null || e === void 0 || (_e$err = e.err) === null || _e$err === void 0 ? void 0 : _e$err.name) === "AbortError" && e !== null && e !== void 0 && (_e$player2 = e.player) !== null && _e$player2 !== void 0 && (_e$player2 = _e$player2.ads) !== null && _e$player2 !== void 0 && (_e$player2$isInAdMode = _e$player2.isInAdMode) !== null && _e$player2$isInAdMode !== void 0 && _e$player2$isInAdMode.call(_e$player2)) return e.player; 5727 throw e; 5728 } 5729 } 5730 setAdUi(e, t) { 5731 this.html.toggleClassIf(this.html.qAll(".video-ad-label", e), !t, "hidden"); 5732 } 5733 shouldPlayPreroll() { 5734 return this.videoPlayCount += 1, this.hasVerticalPreroll && this.videoPlayCount >= 3 && (this.videoPlayCount - 3) % 5 === 0; 5735 } 5736 showPlayerPoster(e, t) { 5737 if (!e || !e.poster || !t || !t.Image) return; 5738 e.poster(t.Image.Src.replace("PLACEHOLDER", "1100xX")); 5739 var i = this.html.q(".video-js"); 5740 i && i.style.setProperty("opacity", "1", "important"), e.load(); 5741 } 5742 handleArrows(e, t) { 5743 e > 0 ? this.html.removeClass(".scroll-up-arrow", "button-disabled") : this.html.addClass(".scroll-up-arrow", "button-disabled"), e < t - 1 ? this.html.removeClass(".scroll-down-arrow", "button-disabled") : this.html.addClass(".scroll-down-arrow", "button-disabled"); 5744 } 5745 loadMoreSlides(e) { 5746 if (this.isEnd || this.isFetching) return Promise.resolve(null); 5747 this.p += 1, this.isFetching = !0; 5748 var t = this.route + "/?p=" + this.p + "&excludeIds=" + e.join(","); 5749 return this.html.fetchText(t).then(i => { 5750 var n = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".splide__slide"); 5751 return n.length < 10 && (this.isEnd = !0), this.isFetching = !1, Array.from(n); 5752 }).catch(i => (console.log("Error loading data from server", i), this.isFetching = !1, null)); 5753 } 5754 }, 5755 ts = He; 5756 var De = class { 5757 constructor(e) { 5758 this.html = e; 5759 this.timer = 0; 5760 } 5761 handleMouseEnter(e) { 5762 var t = this.html.q("video", e); 5763 t && (this.timer = window.setTimeout(() => { 5764 var i = JSON.parse(this.html.getData(e, "video")); 5765 i && i.TeaserFileUrl && (t.src = i.TeaserFileUrl, this.playVideo(t)); 5766 }, 500)); 5767 } 5768 handleMouseLeave(e) { 5769 window.clearTimeout(this.timer); 5770 var t = this.html.q("video", e); 5771 t && (t.pause(), t.removeAttribute("src"), t.load(), t.classList.remove("!opacity-100")); 5772 } 5773 playVideo(e) { 5774 e.play().catch(t => {}), this.html.addClass(e, "!opacity-100"); 5775 } 5776 }, 5777 is = De; 5778 var Ve = class { 5779 constructor(e, t) { 5780 this.html = e; 5781 this.options = t; 5782 } 5783 restrictAppPlayback() { 5784 return this.options.device.os === "android" || this.options.device.os === "ios" ? (window.location.replace(this.options.routes.play_mobile_restriction), !0) : !1; 5785 } 5786 }, 5787 ss = Ve; 5788 var _e = class { 5789 throttle(e, t) { 5790 var i = Date.now(); 5791 return function () { 5792 i + t - Date.now() < 0 && (e(...arguments), i = Date.now()); 5793 }; 5794 } 5795 debounce(e, t) { 5796 var i; 5797 return function () { 5798 for (var _len = arguments.length, s = new Array(_len), _key = 0; _key < _len; _key++) { 5799 s[_key] = arguments[_key]; 5800 } 5801 clearTimeout(i), i = setTimeout(() => e.apply(this, s), t); 5802 }; 5803 } 5804 }, 5805 rs = _e; 5806 var xe = class { 5807 constructor(e, t) { 5808 this.html = e; 5809 this.rateLimiter = t; 5810 } 5811 init() { 5812 var e = 0, 5813 t = this.rateLimiter.throttle(() => { 5814 var i = window.pageYOffset || document.documentElement.scrollTop; 5815 e && (i > 80 ? this.setBodyClass(i - e) : this.setBodyClass(-1)), this.setArrowUpClass(i), e = i; 5816 }, 100); 5817 document.addEventListener("scroll", t); 5818 } 5819 setBodyClass(e) { 5820 e > 0 ? this.html.hasClass("body", "scroll-down") || (this.html.removeClass("body", "scroll-up"), this.html.addClass("body", "scroll-down")) : this.html.hasClass("body", "scroll-up") || (this.html.removeClass("body", "scroll-down"), this.html.addClass("body", "scroll-up")); 5821 } 5822 setArrowUpClass(e) { 5823 if (e > 100) { 5824 var t = this.html.q(".arrow-up"); 5825 t && !this.html.hasClass(t, "arrow-up--active") && this.html.addClass(t, "arrow-up--active"); 5826 } else { 5827 var _t11 = this.html.q(".arrow-up--active"); 5828 _t11 && this.html.removeClass(_t11, "arrow-up--active"); 5829 } 5830 } 5831 }, 5832 os = xe; 5833 function Ue(_x121) { 5834 return _Ue.apply(this, arguments); 5835 } 5836 function _Ue() { 5837 _Ue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee77(o) { 5838 var _t15, _t16; 5839 return _regenerator().w(function (_context77) { 5840 while (1) switch (_context77.p = _context77.n) { 5841 case 0: 5842 _context77.p = 0; 5843 _context77.n = 1; 5844 return o.geo(); 5845 case 1: 5846 _t15 = _context77.v.countryCode; 5847 if (!(_t15 === "BG")) { 5848 _context77.n = 2; 5849 break; 5850 } 5851 return _context77.a(2, !0); 5852 case 2: 5853 _context77.n = 4; 5854 break; 5855 case 3: 5856 _context77.p = 3; 5857 _t16 = _context77.v; 5858 case 4: 5859 return _context77.a(2, (window.location.replace("/geo-lock"), !1)); 5860 } 5861 }, _callee77, null, [[0, 3]]); 5862 })); 5863 return _Ue.apply(this, arguments); 5864 } 5865 var Be = class { 5866 constructor(e) { 5867 this.options = e; 5868 this.html = new qi(), this.rateLimiter = new rs(), this.scroll = new os(this.html, this.rateLimiter), this.playRestriction = new ss(this.html, this.options), this.shaka = new Qi(this.html, this.options), this.events = new Ai(this.html), this.localStorage = new Gi(this.options), this.gql = new Ii(this.options), this.cookies = new zi(this.html, this.events, this.options), this.profiles = new Bi(this.gql, this.html, this.localStorage, this.options), this.bookmarks = new $i(this.gql, this.localStorage, this.options), this.user = new _i(this.events, this.cookies, this.gql, this.html, this.profiles, this.localStorage, this.options), this.muxStatistics = new ji(this.user, this.options), this.voyoVideo = new Ui(this.html, this.user, this.bookmarks, this.gql, this.events, this.muxStatistics, this.shaka, this.rateLimiter, this.options), this.voyo = new xi(this.html, this.events, this.user, this.voyoVideo, this.gql, this.profiles, this.bookmarks, this.localStorage, this.options), this.onlWebsocket = new Fi(this.html, this.user, this.cookies, this.options), this.search = new Ri(this.html, this.options), this.gadgets = new Hi(this.html, this.events, this.cookies, this.options), this.mailing = new
5868Ni(this.html, this.user, this.options, this.gql, this.localStorage), this.voyoForms = new es(this.options, this.html, this.rateLimiter), this.observer = new Xi(this.html, this.options), this.banners = new Yi(this.cookies, this.html, this.observer, this.options), this.video = new Zi(this.html, this.gql, this.cookies, this.banners, null, this.options), this.image = new Ji(this.html, this.options), this.poll = new Ki(this.html, this.gql, this.cookies), this.verticalVideo = new ts(this.html, this.video, this.options), this.verticalVideoPreview = new is(this.html), document.addEventListener("started", () => this.onAppStarted()), document.addEventListener("started-user", () => this.onStartedUser()), document.addEventListener("started-guest", () => this.onStartedGuest()), document.addEventListener("started-bookmarks", () => this.onStartedBookmarks()); 5869 } 5870 run() { 5871 var _this11 = this; 5872 return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee75() { 5873 var _window$Sentry3, _window$Sentry4; 5874 var _t12, _t13; 5875 return _regenerator().w(function (_context75) { 5876 while (1) switch (_context75.n) { 5877 case 0: 5878 _this11.debug("Starting app ..."); 5879 lt(); 5880 _this11.user.handleDeviceId(); 5881 _t12 = _this11.options.country === "bg" && window.location.pathname.startsWith(_this11.options.routes.activation); 5882 if (!_t12) { 5883 _context75.n = 2; 5884 break; 5885 } 5886 _context75.n = 1; 5887 return Ue(_this11.gql); 5888 case 1: 5889 _t12 = !_context75.v; 5890 case 2: 5891 _t13 = !_t12; 5892 if (!_t13) { 5893 _context75.n = 3; 5894 break; 5895 } 5896 _this11.options.device = _this11.discoverDevice(), _this11.options = _this11.loadUserOptions(_this11.options), _this11.options.isMobile = _this11.getIsMobile(), _this11.setBodyCssClasses(), _this11.cookies.init(), _this11.observer.init(), _this11.options.isMobile && _this11.scroll.init(), (_window$Sentry3 = window.Sentry) !== null && _window$Sentry3 !== void 0 && _window$Sentry3.setContext("options", _this11.options), (_window$Sentry4 = window.Sentry) !== null && _window$Sentry4 !== void 0 && _window$Sentry4.setTag("deviceId", _this11.user.deviceId), _this11.debug("Options", _this11.options), _this11.events.sendEvent("started", _this11.options); 5897 case 3: 5898 return _context75.a(2); 5899 } 5900 }, _callee75); 5901 }))(); 5902 } 5903 onAppStarted() { 5904 this.debug("App is running ..."); 5905 var e = new URL(window.location.href); 5906 e.searchParams.get("loginWithCodeSuccess") === "1" && (window.dataLayer = window.dataLayer || [], window.dataLayer.push({ 5907 event: "login" 5908 }), e.searchParams.delete("loginWithCodeSuccess"), window.history.replaceState({}, "", e.pathname + e.search + e.hash)), this.mustLoadUserData() && this.loadUserData().then(() => this.initProfiles()).catch(() => this.user.user).then(t => { 5909 t ? this.events.sendEvent("started-user", this.user.user) : this.events.sendEvent("started-guest", null); 5910 }), this.registerServiceWorker(), window.didomiOnReady.push(t => { 5911 this.gadgets.initChat(t), this.gadgets.initExponea(t); 5912 }); 5913 } 5914 onStartedUser() { 5915 this.debug("User is loaded ..."), app.html.removeClass(".if-user-loggedin", "hidden"), app.html.addClass(".if-user-loggedout", "hidden"), this.initBookmarks(), this.onlWebsocket.init(), setTimeout(() => { 5916 this.gadgets.exponeaIdentifyUser(this.user.user); 5917 }, 1e3); 5918 } 5919 onStartedGuest() { 5920 app.html.addClass(".if-user-loggedin", "hidden"), app.html.removeClass(".if-user-loggedout", "hidden"), this.onlWebsocket.init(); 5921 } 5922 onStartedBookmarks() { 5923 this.debug("Bookmarks are loaded ..."), this.bookmarks.voyoBookmarkConsumeCurrent(); 5924 } 5925 setBodyCssClasses() { 5926 var e = this.getDeviceCssClass() + " trailer_muted"; 5927 this.html.addClass("body", e); 5928 } 5929 mustLoadUserData() { 5930 if (window.skipUserLoad) return !1; 5931 var e = [this.options.routes.login, this.options.routes.registration, this.options.routes.profiles], 5932 t = document.location.pathname; 5933 return !e.find(s => t.startsWith(s)); 5934 } 5935 reloadUserInfo() { 5936 return this.loadUserData(); 5937 } 5938 loadUserData() { 5939 return this.user.loadUserInfo().catch(e => (e !== "page_unloading" && this.user.userLoaded(null), null)).then(e => { 5940 var _window$Sentry5; 5941 return this.debug("User", e), e ? ((_window$Sentry5 = window.Sentry) !== null && _window$Sentry5 !== void 0 && _window$Sentry5.setUser(e), this.html.addClass("body", "profile_" + e.profileType), this.html.addClass("body", "subscribed_" + e.isSubscribed), this.user.user) : (this.html.addClass("body", "logged-out"), null); 5942 }); 5943 } 5944 initProfiles() { 5945 var e = this.user.user; 5946 if (!e) return Promise.resolve(null); 5947 var t = e.profileId || 0, 5948 i = this.html.getData("body", "requiredProfile"); 5949 return this.profiles.init().then(() => { 5950 if (this.profiles.isInCorrectProfile(t, i)) return e; 5951 var r = this.profiles.profileOfType(i); 5952 return r ? this.user.loginToProfile(r.profileId) : Promise.reject(null); 5953 }); 5954 } 5955 initBookmarks() { 5956 var e = Promise.resolve(null); 5957 this.voyo.hasBookmarksBox() && (e = this.voyo.loadBookmarkSlides()), this.bookmarks.loadBookmarks(e).then(t => { 5958 this.bookmarks.set(t), this.events.sendEvent("started-bookmarks", t); 5959 }); 5960 } 5961 discoverDevice() { 5962 var e = { 5963 family: "Browser", 5964 name: "Unknown", 5965 model: "Unknown", 5966 os: "", 5967 version: "" 5968 }, 5969 t = navigator.userAgent.toLowerCase(); 5970 t.includes("android") ? e.os = "android" : t.includes("iphone") || t.includes("ipad") || t.includes("ipod") ? e.os = "ios" : t.includes("windows") || t.includes("win32") ? e.os = "windows" : t.includes("linux") ? e.os = "linux" : t.includes("mac os x") || t.includes("macintosh") ? e.os = "macos" : t.includes("cros") && (e.os
5970= "chromeos"); 5971 var i = [{ 5972 model: "edge", 5973 regex: /edg\/([0-9.]+)/ 5974 }, { 5975 model: "opera", 5976 regex: /opr\/([0-9.]+)/ 5977 }, { 5978 model: "chrome", 5979 regex: /chrome\/([0-9.]+)/ 5980 }, { 5981 model: "firefox", 5982 regex: /firefox\/([0-9.]+)/ 5983 }, { 5984 model: "safari", 5985 regex: /version\/([0-9.]+).*safari/ 5986 }, { 5987 model: "ie", 5988 regex: /trident\/([0-9.]+)/ 5989 }]; 5990 for (var _i4 = 0, _i3 = i; _i4 < _i3.length; _i4++) { 5991 var s = _i3[_i4]; 5992 var r = t.match(s.regex); 5993 if (r) { 5994 e.model = s.model, e.version = r[1] || ""; 5995 break; 5996 } 5997 } 5998 return e; 5999 } 6000 getDeviceCssClass() { 6001 var e = "model-" + this.options.device.model.toLowerCase(); 6002 return this.options.device.os && (e += " device-" + this.options.device.os.toLowerCase()), e; 6003 } 6004 get log() { 6005 return this.options.devMode ? console.log.bind(console) : () => {}; 6006 } 6007 get debug() { 6008 return this.options.devMode ? console.debug.bind(console) : () => {}; 6009 } 6010 get error() { 6011 return this.options.devMode ? console.error.bind(console) : () => {}; 6012 } 6013 saveUserOptions() { 6014 this.localStorage.set("opt_playTrailers", this.options.playTrailers), this.localStorage.set("opt_devMode", this.options.devMode), this.localStorage.set("opt_showSubtitles", this.options.showSubtitles), this.localStorage.set("opt_videoVolume", this.options.videoVolume), this.localStorage.set("opt_videoMuted", this.options.videoMuted); 6015 } 6016 exit() {} 6017 loadUserOptions(e) { 6018 var t = null, 6019 i = null, 6020 s = null, 6021 r = null, 6022 n = null; 6023 try { 6024 t = this.localStorage.get("opt_playTrailers"), i = this.localStorage.get("opt_devMode"), s = this.localStorage.get("opt_showSubtitles"), r = this.localStorage.get("opt_videoVolume"), n = this.localStorage.get("opt_videoMuted"); 6025 } catch (l) { 6026 this.log("Error in options", l); 6027 } 6028 var a = [t, i, s, r, n].includes(null); 6029 return t === null && (t = !0), i === null && (i = !1), s === null && (s = !0), r === null && (r = .75), n === null && (n = !1), e.playTrailers = t, e.devMode = i, e.showSubtitles = s, e.videoVolume = r, e.videoMuted = n, a && this.saveUserOptions(), e; 6030 } 6031 getIsMobile() { 6032 return window.matchMedia("(max-width: 1199px)").matches; 6033 } 6034 registerServiceWorker() { 6035 "serviceWorker" in navigator && navigator.serviceWorker.register("/sw.js"); 6036 } 6037 }, 6038 ns = Be; 6039 document.addEventListener("DOMContentLoaded", () => { 6040 var o = new ns(window.config); 6041 window.app = o, o.run(); 6042 }); 6043})(); 6044//# sourceMappingURL=main-7UTFD265.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.