/* Minification failed. Returning unminified contents.
(627,25-28): run-time error JS1009: Expected '}': ...
(627,25-28): run-time error JS1006: Expected ')': ...
(621,38): run-time error JS1004: Expected ';'
(628,22-23): run-time error JS1195: Expected expression: )
(641,15-19): run-time error JS1009: Expected '}': else
(641,15-19): run-time error JS1009: Expected '}': else
(34,24): run-time error JS1004: Expected ';'
(641,15-19): run-time error JS1034: Unmatched 'else'; no 'if' defined: else
(660,33-36): run-time error JS1009: Expected '}': ...
(660,33-36): run-time error JS1194: Expected ',' or ']': ...
(660,33-36): run-time error JS1009: Expected '}': ...
(660,33-36): run-time error JS1009: Expected '}': ...
(660,33-36): run-time error JS1009: Expected '}': ...
(660,33-36): run-time error JS1006: Expected ')': ...
(650,33): run-time error JS1004: Expected ';'
(661,30-31): run-time error JS1195: Expected expression: ]
(662,25-26): run-time error JS1002: Syntax error: }
(663,21-22): run-time error JS1002: Syntax error: }
(664,17-18): run-time error JS1002: Syntax error: }
(664,18-19): run-time error JS1195: Expected expression: )
(665,13-14): run-time error JS1002: Syntax error: }
(667,9-10): run-time error JS1002: Syntax error: }
(667,10-11): run-time error JS1195: Expected expression: ,
(668,27-28): run-time error JS1010: Expected identifier: (
(680,5-6): run-time error JS1002: Syntax error: }
(680,6-7): run-time error JS1195: Expected expression: ,
(682,24-25): run-time error JS1010: Expected identifier: (
(703,25-28): run-time error JS1009: Expected '}': ...
(703,25-28): run-time error JS1006: Expected ')': ...
(697,38): run-time error JS1004: Expected ';'
(704,22-23): run-time error JS1195: Expected expression: )
(716,15-19): run-time error JS1034: Unmatched 'else'; no 'if' defined: else
(734,33-36): run-time error JS1009: Expected '}': ...
(734,33-36): run-time error JS1194: Expected ',' or ']': ...
(734,33-36): run-time error JS1009: Expected '}': ...
(734,33-36): run-time error JS1009: Expected '}': ...
(734,33-36): run-time error JS1009: Expected '}': ...
(734,33-36): run-time error JS1006: Expected ')': ...
(723,33): run-time error JS1004: Expected ';'
(735,30-31): run-time error JS1195: Expected expression: ]
(737,21-22): run-time error JS1002: Syntax error: }
(738,17-18): run-time error JS1002: Syntax error: }
(738,18-19): run-time error JS1195: Expected expression: )
(739,13-14): run-time error JS1002: Syntax error: }
(740,9-10): run-time error JS1002: Syntax error: }
(740,10-11): run-time error JS1195: Expected expression: ,
(741,27-28): run-time error JS1010: Expected identifier: (
(751,5-6): run-time error JS1002: Syntax error: }
(751,6-7): run-time error JS1195: Expected expression: ,
(752,27-28): run-time error JS1010: Expected identifier: (
(765,6-7): run-time error JS1195: Expected expression: ,
(766,26-27): run-time error JS1010: Expected identifier: (
(779,6-7): run-time error JS1195: Expected expression: ,
(780,33-34): run-time error JS1010: Expected identifier: (
(793,6-7): run-time error JS1195: Expected expression: ,
(794,24-25): run-time error JS1010: Expected identifier: (
(807,6-7): run-time error JS1195: Expected expression: ,
(808,25-26): run-time error JS1010: Expected identifier: (
(813,1-2): run-time error JS1002: Syntax error: }
(718,70-76): run-time error JS1018: 'return' statement outside of function: return
(643,106-112): run-time error JS1018: 'return' statement outside of function: return
 */
// find polyfill
if (!Array.prototype.find) {
    Array.prototype.find = Array.prototype.find || function (callback) {
        if (typeof callback !== "function") {
            throw new TypeError("callback must be a function");
        }
        var list = Object(this);
        var length = list.length >>> 0;
        var thisArg = arguments[1];
        for (var i = 0; i < length; i++) {
            var element = list[i];
            if (callback.call(thisArg, element, i, list)) {
                return element;
            }
        }
    };
}
// Includes polyfill
if (!String.prototype.includes) {
    String.prototype.includes = function (search, start) {
        'use strict';
        if (typeof start !== 'number') {
            start = 0;
        }

        if (start + search.length > this.length) {
            return false;
        } else {
            return this.indexOf(search, start) !== -1;
        }
    };
}

var analyticsEvents = {
    init: function () {
        window.dmpLayer = {};
        dmpLayer.url = window.location.href;
        window.biskoLayer = {};

        if (analyticsModel.pageType === "video" || analyticsModel.pageType === "videoLive") {
            dmpLayer.name = analyticsModel.videoName;
            dmpLayer.live = analyticsModel.live;
            dmpLayer.showSeries = analyticsModel.showSeries;
            dmpLayer.showName = analyticsModel.showName;

            biskoLayer.name = analyticsModel.videoName;
            biskoLayer.live = analyticsModel.live;
            biskoLayer.showSeries = analyticsModel.showSeries;
            biskoLayer.showName = analyticsModel.showName;

            dataLayer.push(
                { 'video': { 'id': analyticsModel.id } },
                { 'videoName': analyticsModel.videoName },
                { 'live': analyticsModel.live },
                { 'videoType': analyticsModel.videoType },
                { 'showSeries': analyticsModel.showSeries },
                { 'showName': analyticsModel.showName }
            );
            if (analyticsModel.premiumContentEnabled) {
                dataLayer.push({
                    'event': 'video_loaded',
                    'videoName': analyticsModel.videoName,
                    'videoId': analyticsModel.id,
                    'videoCategory': analyticsModel.contentTopic,
                    'videoPublished': analyticsModel.videoPublished,
                    'videoLock': analyticsModel.videoLock,
                    'videoPriceTvod': analyticsModel.videoPriceTvod,
                    'videoPriceSvod': analyticsModel.videoPriceSvod,
                    'videoCurrency': analyticsModel.videoCurrency,
                    'videoPremium': analyticsModel.videoPremium,
                    'videoTag': analyticsModel.videoTag
                })
            }
        } else if (analyticsModel.pageType === 'show') {
            dmpLayer.name = analyticsModel.showName;
            biskoLayer.name = analyticsModel.showName;

            dataLayer.push({ 'showName': analyticsModel.showName });
        }

        if (analyticsModel.pageType === "video" || analyticsModel.pageType === "show") {
            dmpLayer.hostName = analyticsModel.hostName;
            biskoLayer.hostName = analyticsModel.hostName;

            dmpLayer.category = analyticsModel.contentTopic;
            biskoLayer.category = [analyticsModel.contentTopic];

            dataLayer.push(
                { 'hostName': analyticsModel.hostName },
                { 'contentTopic': analyticsModel.contentTopic }
            );
        }

        if (analyticsModel.pageType === "channel") {
            dmpLayer.hostName = analyticsModel.hostName;
            biskoLayer.hostName = analyticsModel.hostName;

            dataLayer.push({ 'hostName': analyticsModel.hostName });
        }

        if (dmpLayer.name === undefined) {
            dmpLayer.name = analyticsModel.pageType;
            biskoLayer.name = analyticsModel.pageType;
        }

        dmpLayer.id = analyticsModel.id;
        dmpLayer.type = analyticsModel.pageType;
        dmpLayer.loggedin = analyticsModel.loggedin;

        biskoLayer.id = analyticsModel.id;
        biskoLayer.type = analyticsModel.pageType;
        biskoLayer.loggedin = analyticsModel.loggedin;

        if (analyticsModel.loggedin) {
            dmpLayer.userId = analyticsModel.userId;
            if (typeof biskota != "undefined") {
                biskota.identify(analyticsModel.userId.toString());
            }

            dataLayer.push(
                { 'user': { 'id': analyticsModel.userId } }
            );
        }
        dataLayer.push(
            { 'pageType': analyticsModel.pageType },

            { 'webLocation': webLocation }
        );
        if (analyticsModel.premiumContentEnabled) {
            dataLayer.push({
                'loggedin': analyticsModel.loggedin,
                'userid': analyticsModel.userId,
                'userPremium': analyticsModel.userPremium,
                'userExpiration': analyticsModel.userExpiration
            });
        }
        else {
            dataLayer.push({ 'loggedin': analyticsModel.loggedin })
        }

        for (var i = 0; i < localStorage.length; i++) {
            if (localStorage.key(i) !== null && localStorage.key(i).startsWith("metric1_")) {
                var metric1Value = parseInt(localStorage.getItem(localStorage.key(i)));
                var videoId = localStorage.key(i).replace("metric1_", "");
                localStorage.removeItem("metric1_" + videoId);
                localStorage.removeItem("metric1Time_" + videoId);
                i = i - 2;
                if (metric1Value !== 0) {
                    dmpLayer.metric1 = metric1Value;
                    gjdmp.tr("WatchedTime", { id: videoId, value: metric1Value, type: "video", url: window.location.href });
                    bsk('event', "watchedtime", { id: videoId, value: metric1Value, type: "video" });
                    dataLayer.push({ 'metric1': metric1Value });
                }
            }
        }

        gjdmp.tr("PageView", dmpLayer);
        bsk('event', 'pageview', biskoLayer);
    },
    videoShare: function (socialMediaPlatform) {
        if (!socialMediaPlatform)
            socialMediaPlatform = "-";
        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "Video", 'eAct': "Share", 'eLab': socialMediaPlatform, 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoComment: function (message) {
        console.log(message);
        gjdmp.tr("comment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: message,
            type: "comment",
            category: "video",
            url: window.location.href
        });

        bsk("event", "comment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: message,
            type: "comment",
            category: ["video"]
        });

        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "Video", 'eAct': "Comment", 'eLab': "-", 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoMoreComments: function () {
        gjdmp.tr("morecomments", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            type: "comment",
            category: "video",
            url: window.location.href
        });

        bsk("event", "morecomments", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            type: "comment",
            category: ["video"]
        });
    },
    videoDeleteComment: function (id) {
        gjdmp.tr("deletecomment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "comment_" + id,
            type: "comment",
            category: "video",
            url: window.location.href
        });

        bsk("event", "deletecomment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "comment_" + id,
            type: "comment",
            category: ["video"]
        });
    },
    videoMoreReplies: function (id) {
        gjdmp.tr("morereplies", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "comment_" + id,
            type: "comment",
            category: "video",
            url: window.location.href
        });

        bsk("event", "morereplies", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "comment_" + id,
            type: "comment",
            category: ["video"]
        });
    },
    videoReplyComment: function (message) {
        gjdmp.tr("replycomment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: message,
            type: "comment",
            category: "video",
            url: window.location.href
        });

        bsk("event", "replycomment", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: message,
            type: "comment",
            category: ["video"]
        });
    },
    videoDeleteReply: function (id, block) {
        gjdmp.tr("deletereply", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "reply_" + id + "_block_" + block,
            type: "video",
            category: "video",
            url: window.location.href
        });

        bsk("event", "deletereply", {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "reply_" + id + "_block_" + block,
            type: "video",
            category: ["video"]
        });
    },
    videoReact: function (action, id) {
        gjdmp.tr(action.toLowerCase(), {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: "video",
            url: window.location.href
        });

        bsk('event', action.toLowerCase(), {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: ["video"]
        });

        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "Video", 'eAct': "Rate", 'eLab': action, 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoRemoveReact: function (action, id) {
        gjdmp.tr(action.toLowerCase(), {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: "video",
            url: window.location.href
        });

        bsk('event', action.toLowerCase(), {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: ["video"]
        });
    },
    videoRate: function (action, id, value) {
        gjdmp.tr(action, {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id + "_value_" + value,
            type: "video",
            category: "video",
            url: window.location.href
        });

        bsk('event', action, {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id + "_value_" + value,
            type: "video",
            category: ["video"]
        });
    },
    subscribe: function (action) {
        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "User", 'eAct': "ShowSubscription", 'eLab': action, 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    registration: function () {
        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "User", 'eAct': "Registration", 'eLab': "-", 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    login: function () {
        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "User", 'eAct': "Login", 'eLab': "-", 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    watchLater: function (action, dmpAction, id) {
        gjdmp.tr(dmpAction, {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: "video",
            url: window.location.href
        });

        bsk('event', dmpAction, {
            id: analyticsModel.id,
            name: analyticsModel.videoName,
            value: "entity_" + id,
            type: "entity",
            category: ["video"]
        });

        dataLayer.push({
            'event': "gaEvent",
            'gaEventData': { 'eCat': "Video", 'eAct': action, 'eLab': "-", 'eVal': 1 },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoView: function () {
        gjdmp.tr("ViewContent", dmpLayer);
        bsk('event', 'viewcontent', biskoLayer);
    },
    relatedClick: function (id, videoName, position) {
        gjdmp.tr('relatedclick', {
            id: id,
            name: videoName,
            value: position,
            type: 'entity',
            category: 'video',
        });

        bsk('event', 'relatedclick', {
            id: id,
            name: videoName,
            value: position,
            type: 'entity',
            category: ['video']
        });
    },
    playlistClick: function (id, videoName, position) {
        gjdmp.tr('playlistClick', {
            id: id,
            name: videoName,
            value: position,
            type: 'entity',
            category: 'video',
        });

        bsk('event', 'playlistClick', {
            id: id,
            name: videoName,
            value: position,
            type: 'entity',
            category: ['video']
        });
    },
    playTime: {
        triggers: [],
        triggered: function (time) {
            return this.triggers.length > 0 && this.triggers.find(function (trigger) {
                if (trigger.time === time) {
                    return trigger.triggered;
                }
                return false;
            });
        },
        push: function (time) {
            if (!this.triggered(time)) {
                analyticsEvents.playTime.triggers.push({
                    time: time,
                    triggered: true
                });
                gjdmp.tr(time, { id: analyticsModel.id, name: analyticsModel.videoName, type: analyticsModel.pageType, url: window.location.href });
                bsk('event', time, { id: analyticsModel.id, name: analyticsModel.videoName, type: analyticsModel.pageType });

                dataLayer.push({
                    'event': "gaEvent",
                    'gaEventData': { 'eCat': "Video", 'eAct': "Playtime", 'eLab': time, 'eVal': 1 },
                    'eventCallback': function () {
                        dataLayer.push({ 'gaEventData': undefined });
                    }
                });
            }
        }
    },
    getProduct: function (id) {
        if (window.productsModel === null) return null;
        return window.productsModel.find(function (model) {
            if (model.Id && model.Id == id) {
                return model;
            }
            return null;
        });
    },
    productImpression: {
        ids: [],
        push: function (id, type) {
            var product;
            var listType = analyticsEvents.productImpression.getType(type);
            var impressions = [];
            var url = "";
            var impression = {};
            if (typeof id === "object") {
                var productsSkipped = 0;
                for (var i = 0; i < id.length; i++) {
                    product = analyticsEvents.getProduct(id[i]);
                    if ((product === null || product !== 'undefined') || (typeof (product.Id) !== 'undefined' && product.Id && this.ids.includes(product.Id))) {
                        productsSkipped++;
                        continue;
                    }
                    this.ids.push(product.Id);
                    url = new URL(product.Link ? product.Link : product.ButtonRedirectUrl);
                    product.position = this.ids.length;
                    impression = {
                        name: product.Title,
                        id: product.Id,
                        brand: url.hostname,
                        category: analyticsModel.contentTopic,
                        list: listType,
                        dimension5: url.hostname,
                        position: product.position
                    };
                    if (product.Price !== undefined) {
                        if (typeof product.Price === "string") {
                            impression.price = product.Price.replace(/\D+/g, "");
                        } else {
                            impression.price = product.Price;
                        }
                    }
                    impressions.push(impression);
                    product.ListType = listType;
                }
                if (productsSkipped !== id.length) {
                    dataLayer.push({
                        'event': "gaEeImpressions",
                        'ecommerce': {
                            'impressions': impressions
                        }
                    });
                }
            } else if (typeof id === "string" || typeof id === "number") {
                product = analyticsEvents.getProduct(id);
                if (product === null || product === undefined || this.ids.includes(id)) return;
                this.ids.push(product.Id);
                url = new URL(product.Link ? product.Link : product.ButtonRedirectUrl);
                product.position = this.ids.length;
                impression = {
                    name: product.Title,
                    id: product.Id,
                    brand: url.hostname,
                    category: analyticsModel.contentTopic,
                    list: listType,
                    dimension5: url.hostname,
                    position: product.position
                };
                if (product.Price !== undefined) {
                    impression.price = product.Price.replace(/\D+/g, "");
                }
                impressions.push(impression);
                product.ListType = listType;
                dataLayer.push({
                    'event': "gaEeImpressions",
                    'ecommerce': {
                        'impressions': impressions
                    }
                });
            }
        },
        getType: function (type) {
            switch (type) {
                case 1:
                    return "In video - fixed";
                case 2:
                    return "Under video - button";
                case 3:
                    return "Under video - about video link";
                default:
                    return "";
            }
        }
    },
    isProductClicked: true,
    productClick: function (id) {
        var product = analyticsEvents.getProduct(id);
        if (product === null || product === undefined) return;

        vpPlayer.player.video.pause();
        adHoverPause = false;

        var url = new URL(product.Link ? product.Link : product.ButtonRedirectUrl);
        url.insertParameter("utm_source", analyticsModel.platformDomain);
        url.insertParameter("utm_medium", "video");
        url.insertParameter("utm_campaign", product.ListType);
        url.insertParameter("utm_content", analyticsModel.showName + " - " + analyticsModel.videoName);
        url.insertParameter("utm_term", product.Id);
        var mallProduct = {
            name: product.Title,
            id: product.Id,
            brand: url.hostname,
            category: analyticsModel.contentTopic,
            list: product.ListType,
            dimension5: url.hostname,
            position: analyticsEvents.productImpression.ids.length
        };
        if (product.Price !== undefined) {
            mallProduct.price = product.Price.replace(/\D+/g, "");
        }
        dataLayer.push({
            'event': "gaEeClick",
            'ecommerce': {
                'click': {
                    'actionField': {
                        'list': product.ListType
                    },
                    'products': [mallProduct]
                }
            }
        });
        var win = window.open(url, "_blank");
        win.focus();
    },
    promoView: {
        ids: [],
        push: function (id, dimension) {
            var promoModel;
            if (typeof id === "object") {
                var productsSkipped = 0;
                var promotions = [];
                for (var i = 0; i < id.length; i++) {
                    promoModel = analyticsEvents.getProduct(id[i]);
                    if (promoModel === null || promoModel === undefined || this.ids.includes(promoModel.Id)) {
                        productsSkipped++;
                        continue;
                    }
                    this.ids.push(promoModel.Id);
                    promoModel.Name = analyticsEvents.promoView.getName(promoModel, dimension);
                    if (!promoModel.Position)
                        promoModel.Position = this.ids.length;
                    promotions.push({
                        'id': promoModel.Id,
                        'name': promoModel.Name,
                        'creative': promoModel.Title,
                        'position': promoModel.Position,
                        'dimension8': dimension,
                        ...promoModel
                    });
                }
                if (productsSkipped !== id.length) {

                    dataLayer.push({
                        'event': "gaEePromoView",
                        'ecommerce': {
                            'promoView': {
                                'promotions': promotions
                            }
                        }
                    });
                }
            } else if (typeof id === "string" || typeof id === "number") {
                promoModel = analyticsEvents.getProduct(id);
                if (promoModel === null || promoModel === undefined || this.ids.includes(promoModel.Id)) return;
                this.ids.push(promoModel.Id);
                promoModel.Position = this.ids.length;
                if (promoModel.Name === undefined)
                    promoModel.Name = analyticsEvents.promoView.getName(promoModel, dimension);


                dataLayer.push({
                    'event': "gaEePromoView",
                    'ecommerce': {
                        'promoView': {
                            'promotions': [{
                                'id': promoModel.Id,
                                'name': promoModel.Name,
                                'creative': promoModel.Title,
                                'position': this.ids.length,
                                'dimension8': dimension,
                                ...promoModel
                            }]
                        }
                    }
                });
            }

        },
        getName: function (promoModel, dimension) {
            switch (dimension) {
                case "Ad - video":
                    return promoModel.Name + ", SkipTime: 5"; //promoModel.SkipTime
                case "Show":
                    return promoModel.Name;
                case "Video":
                    return promoModel.Name;
                default:
                    return promoModel.Name;
            }
        }
    },
    promoClick: {
        push: function (id, dimension) {
            var promoModel;
            if (typeof id === "object") {
                var productsSkipped = 0;
                var promotions = [];
                for (var i = 0; i < id.length; i++) {
                    promoModel = analyticsEvents.getProduct(id[i]);
                    if (promoModel === null || promoModel === undefined) {
                        productsSkipped++;
                        continue;
                    }
                    this.ids.push(promoModel.Id);
                    if (!promoModel.Position)
                        promoModel.Position = this.ids.length;
                    promoModel.Name = analyticsEvents.promoView.getName(promoModel, dimension);
                    promotions.push({
                        'id': promoModel.Id,
                        'name': promoModel.Name,
                        'creative': promoModel.Title,
                        'position': this.ids.length,
                        'dimension8': dimension,
                        ...promoModel
                    });
                }
                if (productsSkipped !== id.length) {
                    dataLayer.push({
                        'event': "gaEePromoClick",
                        'ecommerce': {
                            'promoClick': {
                                'promotions': promotions
                            }
                        }
                    });
                }
            } else if (typeof id === "string" || typeof id === "number") {
                promoModel = analyticsEvents.getProduct(id);
                if (promoModel === null || promoModel === undefined) return;
                if (!promoModel.Position)
                    promoModel.Position = this.ids.length;
                if (promoModel.Name === undefined)
                    promoModel.Name = analyticsEvents.promoView.getName(promoModel, dimension);
                dataLayer.push({
                    'event': "gaEePromoClick",
                    'adClickType': undefined,
                    'ecommerce': {
                        'promoClick': {
                            'promotions': [{
                                'id': promoModel.Id,
                                'name': promoModel.Name,
                                'creative': promoModel.Title,
                                'position': promoModel.Position,
                                'dimension8': dimension,
                                ...promoModel
                            }]
                        }
                    }
                });
            }
        },
        getType: function (type) {
            switch (type) {
                case 1:
                    return "ad";
                case 2:
                    return "skip";
                default:
                    return undefined;
            }
        }
    },
    premiumLock: function (eventType) {
        dataLayer.push({
            'event': 'gaEvent',
            'gaEventData': {
                'eCat': 'Video',
                'eAct': 'Premium lock',
                'eLab': eventType, // view or click
                'eVal': 1
            },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoLimit: function (limitType) {
        dataLayer.push({
            'event': 'gaEvent',
            'gaEventData': {
                'eCat': 'Video',
                'eAct': 'Limit',
                'eLab': limitType,
                'eVal': 1
            },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    videoSubscription: function (subscriptionAction, subscriptionType, subcriptionCategory, value) {
        dataLayer.push({
            'event': 'gaEvent',
            'gaEventData': {
                'eCat': subcriptionCategory || 'Subscription',
                'eAct': subscriptionAction,
                'eLab': subscriptionType,
                'eVal': value || 1,
            },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    ctaClick: function (textofCta) {
        dataLayer.push({
            'event': 'gaEvent',
            'gaEventData': {
                'eCat': 'CTA',
                'eAct': 'Click',
                'eLab': textofCta,
                'eVal': 1
            },
            'eventCallback': function () {
                dataLayer.push({ 'gaEventData': undefined });
            }
        });
    },
    getCookie: function (cookieName) {
        var value = `; ${document.cookie}`;
        var parts = value.split(`; ${cookieName}=`);
        if (parts.length === 2) return parts.pop().split(';').shift();
    }
}

analyticsEvents.init();
;

window.gemiusEvents = {
    player: null,
    videoId: 0,
    adId: 0,

    init: function (videoId) {
        if (!window.GemiusPlayer)
            return;
        this.player = new window.GemiusPlayer('vp-player', '0ss1XacLuWrrxBaTbp0L5.U5DtadnedcFu6mDanzt.T.a7');
        this.player.setVideoObject(document.getElementById("vp-player").querySelector("video"));
        this.videoId = videoId;
    },
    program: function (videoName, videoDuration, showName, isLive) {
        if (!window.GemiusPlayer || !player)
            return;
        this.player.newProgram(this.videoId,
            {
                programName: videoName,
                programDuration: videoDuration,
                programType: 'video',
                transmissionType: isLive ? 2 : 1,
                series: showName
            });
        console.info("Gemius - New program: " + this.videoId);
    },
    playerEvent: function (eventType) {
        if (!window.GemiusPlayer || !player)
            return;
        var currentTime = parseInt(vpPlayer.player.video.currentTime);
        var currentVolume = vpPlayer.player.video.volume * 100;
        this.player.programEvent(this.videoId,
            currentTime,
            eventType,
            {
                volume: currentVolume
            });
        console.info("Gemius - PlayerEvent: " + eventType);
    },
    newAd: function (adId) {
        if (!window.GemiusPlayer || !player)
            return;
        this.adId = adId;
        this.player.newAd(adId);
        console.info("Gemius - New ad: " + adId);
    },
    adEvent: function (eventType, adCount) {
        if (!window.GemiusPlayer || !player)
            return;
        var currentTime = parseInt(vpPlayer.player.video.currentTime);
        var currentVolume = vpPlayer.player.video.volume * 100;
        this.player.adEvent(this.videoId, this.adId, currentTime, eventType,
            {
                breakSize: adCount,
                volume: currentVolume
            });
        console.info("Gemius - AdEvent: " + eventType);

    }
}
;
