/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ADD_TO_CART_CLASS: () => (/* binding */ ADD_TO_CART_CLASS),
/* harmony export */   BASE_Z_INDEX: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.BASE_Z_INDEX),
/* harmony export */   BASE_Z_INDEX_MODAL: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.BASE_Z_INDEX_MODAL),
/* harmony export */   BUY_BUTTON_TYPE: () => (/* binding */ BUY_BUTTON_TYPE),
/* harmony export */   CLASS_PREFIX: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.CLASS_PREFIX),
/* harmony export */   COMMERCIAL_TYPE: () => (/* binding */ COMMERCIAL_TYPE),
/* harmony export */   CUSTOM_EVENTS: () => (/* reexport safe */ _events__WEBPACK_IMPORTED_MODULE_1__.CUSTOM_EVENTS),
/* harmony export */   CallbackFunctionType: () => (/* binding */ CallbackFunctionType),
/* harmony export */   DISPLAY_CONTAINER: () => (/* binding */ DISPLAY_CONTAINER),
/* harmony export */   HEARTBEAT_RATE: () => (/* binding */ HEARTBEAT_RATE),
/* harmony export */   HEARTBEAT_TIMEOUT_MS: () => (/* binding */ HEARTBEAT_TIMEOUT_MS),
/* harmony export */   HIDE_WIDGET_COOKIE: () => (/* binding */ HIDE_WIDGET_COOKIE),
/* harmony export */   ICON_PLAY_SIZE: () => (/* binding */ ICON_PLAY_SIZE),
/* harmony export */   ICON_PLAY_TYPE: () => (/* binding */ ICON_PLAY_TYPE),
/* harmony export */   INLINE_WIDGET_TYPE: () => (/* binding */ INLINE_WIDGET_TYPE),
/* harmony export */   INVENTORY_SETTINGS: () => (/* binding */ INVENTORY_SETTINGS),
/* harmony export */   MQ: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.MQ),
/* harmony export */   PLAYER_LAYOUT: () => (/* binding */ PLAYER_LAYOUT),
/* harmony export */   PLAYER_TYPE: () => (/* binding */ PLAYER_TYPE),
/* harmony export */   SPECIFICITY_SELECTOR: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.SPECIFICITY_SELECTOR),
/* harmony export */   SPECIFICITY_SELECTOR_MODAL: () => (/* reexport safe */ _styles__WEBPACK_IMPORTED_MODULE_0__.SPECIFICITY_SELECTOR_MODAL),
/* harmony export */   SUBSCRIPTION_TYPE: () => (/* binding */ SUBSCRIPTION_TYPE),
/* harmony export */   THUMB_TYPE: () => (/* binding */ THUMB_TYPE),
/* harmony export */   TrackEventType: () => (/* binding */ TrackEventType),
/* harmony export */   VIDEO_IMAGE_TYPE: () => (/* binding */ VIDEO_IMAGE_TYPE),
/* harmony export */   WATCH_VIDEO_MIN_LIMIT_SEC: () => (/* binding */ WATCH_VIDEO_MIN_LIMIT_SEC),
/* harmony export */   WEBSITE: () => (/* binding */ WEBSITE),
/* harmony export */   WIDGET_DISPLAY_CONTEXT: () => (/* binding */ WIDGET_DISPLAY_CONTEXT),
/* harmony export */   WIDGET_FLOATING_POSTION: () => (/* binding */ WIDGET_FLOATING_POSTION),
/* harmony export */   WIDGET_LOGO_TYPE: () => (/* binding */ WIDGET_LOGO_TYPE),
/* harmony export */   WIDGET_PLAY_BUTON_TYPE: () => (/* binding */ WIDGET_PLAY_BUTON_TYPE),
/* harmony export */   WidgetDeviceType: () => (/* binding */ WidgetDeviceType),
/* harmony export */   WidgetDisplayType: () => (/* binding */ WidgetDisplayType),
/* harmony export */   WidgetType: () => (/* binding */ WidgetType)
/* harmony export */ });
/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);



const WEBSITE = 'https://videowise.com';
const COOKIE_PREFIX = 'reeview';
const HIDE_WIDGET_COOKIE = `${COOKIE_PREFIX}_hide_widget`;
const WIDGET_DISPLAY_CONTEXT = `${COOKIE_PREFIX}_widget_context`;
const ADD_TO_CART_CLASS = 'reeview_addtocart-btn';
const WATCH_VIDEO_MIN_LIMIT_SEC = 3 * 1000;

const HEARTBEAT_RATE = 20000;
const HEARTBEAT_TIMEOUT_MS = 1 * 60 * 60 * 1000;

const WidgetDisplayType = {
  Inline: 'Inline',
  Floating: 'Floating',
  Story: 'Story',
  Background: 'Background',
  Product: 'Product',
  Image: 'Image',
  Testimonial: 'Testimonial',
  TestimonialCarousel: 'TestimonialCarousel',
};

const WidgetType = {
  Product: 'Product',
  Independent: 'Independent',
};

const TrackEventType = {
  Interest: 'interest',
  Cart: 'cart',
  View: 'view',
  Video: 'video',
  Click: 'click',
  Close: 'close',
  Order: 'order',
  EngagementTime: 'engagementtime',
  VideoWatch: 'videowatch',
  Swipe: 'swipe',
  Interaction: 'interaction',
  Search: 'search',
  Tag: 'tag',
  ProductClick: 'product-click',
  CampaignLanding: 'campaignLanding',
  DirectPDP: 'directpdp',
};

const CallbackFunctionType = {
  AddToCart: 'addToCart',
};

const DISPLAY_CONTAINER = {
  xsSmall: 375,
  smSmall: 576,
  ExtraSmall: 767,
  Small: 991,
  Medium: 1024,
  Large: 1280,
  ExtraLarge: 1440,
};

const PLAYER_TYPE = {
  YOUTUBE: 'youtube_video',
  INSTAGRAM: 'instagram_video',
  CUSTOM: 'custom',
};

const PLAYER_LAYOUT = {
  PORTRAIT: 'portrait',
  LANDSCAPE: 'landscape',
};

const ICON_PLAY_TYPE = {
  STANDARD: 'Standard',
  OUTLINE: 'Outline',
  MINIMAL: 'Minimal',
  RECTANGLE: 'Rectangle',
};

const ICON_PLAY_SIZE = {
  LARGE: 'large',
  MEDIUM: 'medium',
  SMALL: 'small',
};

const THUMB_TYPE = {
  LANDSCAPE: 'landscape',
  PORTRAIT: 'portrait',
  SQUARE: 'square',
};

const INLINE_WIDGET_TYPE = {
  SINGLE: 'single',
  GALLERY: 'gallery',
  CAROUSEL: 'carousel',
  PORTRAIT_CAROUSEL: 'portraitcarousel',
  LANDSCAPE_CAROUSEL: 'landscapecarousel',
  CENTER_PIECE_CAROUSEL: 'carouselcenterpiece',
  SHOPPABLE_CAROUSEL: 'carouselshoppable',
  TESTIMONIAL_CAROUSEL: 'TestimonialCarousel',
};

const WidgetDeviceType = {
  DESKTOP: 'DESKTOP',
  MOBILE: 'MOBILE',
};

const WIDGET_FLOATING_POSTION = {
  BOTTOM_LEFT: 'BOTTOM_LEFT',
  BOTTOM_RIGHT: 'BOTTOM_RIGHT',
};

const WIDGET_PLAY_BUTON_TYPE = {
  icon: 'ICON_BUTTON',
  text: 'TEXT_BUTTON',
};

const COMMERCIAL_TYPE = {
  PRODUCT: 'PRODUCT',
  LINK: 'LINK',
};

const WIDGET_LOGO_TYPE = {
  STORE_LOGO: 'STORE_LOGO',
  NO_LOGO: 'NO_LOGO',
  VIDEOWISE_LOGO: 'VIDEOWISE_LOGO',
};

const BUY_BUTTON_TYPE = {
  DIRECT_TO_CHECKOUT: 'DIRECT_TO_CHECKOUT',
  DIRECT_TO_CART: 'DIRECT_TO_CART',
  ADD_TO_CART: 'ADD_TO_CART',
  DIRECT_TO_CART_CUSTOM: 'DIRECT_TO_CART_CUSTOM',
  DIRECT_TO_CART_REDIRECT: 'DIRECT_TO_CART_REDIRECT',
  CUSTOM_URL: 'CUSTOM_URL',
  GO_TO_PRODUCT_PAGE: 'GO_TO_PRODUCT_PAGE',
};

const INVENTORY_SETTINGS = {
  USE_INVENTORY: 'USE_INVENTORY',
  IGNORE_INVENTORY: 'IGNORE_INVENTORY',
};

const VIDEO_IMAGE_TYPE = {
  PREVIEW: 'PREVIEW',
  BG: 'BG',
};

const SUBSCRIPTION_TYPE = {
  ONE_TIME: 'onetime',
  SUBSCRIBE: 'subscribe',
};


/***/ }),
/* 2 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BASE_Z_INDEX: () => (/* binding */ BASE_Z_INDEX),
/* harmony export */   BASE_Z_INDEX_MODAL: () => (/* binding */ BASE_Z_INDEX_MODAL),
/* harmony export */   CLASS_PREFIX: () => (/* binding */ CLASS_PREFIX),
/* harmony export */   MQ: () => (/* binding */ MQ),
/* harmony export */   SPECIFICITY_SELECTOR: () => (/* binding */ SPECIFICITY_SELECTOR),
/* harmony export */   SPECIFICITY_SELECTOR_MODAL: () => (/* binding */ SPECIFICITY_SELECTOR_MODAL)
/* harmony export */ });
const MOBILE_WIDTH_SM = 375;
const MOBILE_WIDTH = 415;
const MOBILE_WIDTH_MD = 567;
const MOBILE_WIDTH_LG = 767;
const TABLET_WIDTH = 768;
const TABLET_LARGE_WIDTH = 1024;
const DESKTOP_WIDTH_SM = 1198;
const DESKTOP_WIDTH = 1280;
const DESKTOP_LARGE_WIDTH = 1440;

const MQ = {
  mobileXs: `@media (max-width: ${MOBILE_WIDTH_SM}px)`,
  mobileSm: `@media (min-width: ${MOBILE_WIDTH_SM}px)`,
  mobileXl: `@media (min-width: ${MOBILE_WIDTH_MD}px)`,
  mobile: `@media (max-width: ${MOBILE_WIDTH}px)`,
  mobileXxl: `@media (min-width: ${MOBILE_WIDTH}px)`,
  mobileMd: `@media (max-width: ${MOBILE_WIDTH_MD}px)`,
  mobileLg: `@media (max-width: ${MOBILE_WIDTH_LG}px)`,
  mobileOnly: `@media (max-width: ${TABLET_WIDTH}px)`,
  tablet: `@media (min-width: ${TABLET_WIDTH}px)`,
  tabletLarge: `@media (min-width: ${TABLET_LARGE_WIDTH}px)`,
  tabletOnly: `@media (max-width: ${TABLET_LARGE_WIDTH - 1}px)`,
  tabletXl: `@media (max-width: ${DESKTOP_WIDTH_SM}px)`,
  desktopSm: `@media (min-width: ${DESKTOP_WIDTH_SM + 1}px)`,
  desktop: `@media (min-width: ${MOBILE_WIDTH + 1}px)`,
  desktopLarge: `@media (min-width: ${DESKTOP_WIDTH + 1}px)`,
  desktopExtraLarge: `@media (min-width: ${DESKTOP_LARGE_WIDTH + 1}px)`,
};

const BASE_Z_INDEX = 1;
const BASE_Z_INDEX_MODAL = 10000;
const SPECIFICITY_SELECTOR = '#vw-root &&';
const SPECIFICITY_SELECTOR_MODAL = '#vw-modal-root &&';
const CLASS_PREFIX = 'vw';


/***/ }),
/* 3 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CUSTOM_EVENTS: () => (/* binding */ CUSTOM_EVENTS)
/* harmony export */ });
/**
 * Constants defining custom events for Videowise.
 * These events are used for tracking various interactions and actions within the video player.
 */

const CUSTOM_EVENTS = {
  ADD_TO_CART: 'videowiseProductAddToCart',
  BUY_NOW: 'videowiseProductBuyNow',
  VIDEO_PRODUCT_CLICK: 'videowiseProductClick',
  VIDEO_CLICK: 'videowiseVideoClick',
  VIDEO_START: 'videowiseVideoStart',
  VIDEO_IS_PLAYING: 'videowiseVideoIsPlaying',
  VIDEO_FULL: 'videowiseVideoFull',
  VIDEO_SWIPE: 'videowiseVideoSwipe',
  VIDEO_CLOSE: 'videowisePlayerClose',
  VIDEO_SOUND_ON: 'videowiseVideoSoundOn',
  VIDEO_SOUND_OFF: 'videowiseVideoSoundOff',
  VIDEO_BOUNCE: 'videowiseVideoBounce',
  VIDEO_DATA_READY: 'videowiseDataReady',
  VIDEO_CAMPAIGN_READY: 'videowiseCampaignReady',
  VIDEO_CAMPAIGN_CHECKOUT: 'videowiseCampaignCheckout',
  VIDEO_BACKGROUND_V2_RENDERED: 'videowiseBackgroundV2Rendered',
  CTA_CLICK: 'videowiseCtaClick',
};


/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);


const widgets = document.getElementsByClassName('videowise-background');
let shop = '';
if (typeof window.Shopify !== 'undefined') {
  shop = window.Shopify.shop;
} else if (typeof window.videowiseSFCC !== 'undefined') {
  shop = window.videowiseSFCC.host;
}
const widgetIds = [];
let widgetId;

for (let k = 0; k < widgets.length; k++) {
  widgetId = widgets[k].getAttribute('data-widget-id');
  widgetIds.push(widgetId);

  if (widgets[k] !== null) {
    const video = widgets[k].querySelector('video');
    const videoSource = video.querySelector('source');
    /* IOAN ROBCIUC
    const apiUrl =
      `${process.env.API_BASE_URL}/widget/bulk?shop=` + shop + '&widgets=' + widgetIds.toString();
    */
    // START TEMPORARY
    const apiUrl = `${"https://api-cdn.videowise.com"}/widget/bulk.json?widget=${widgetId}&shop=${shop}`;
    // END TEMPORARY

    function resetNewBg() {
      widgets[k].removeAttribute('data-widget-id');
      widgets[k].setAttribute('id', `reeview-app-widget_${widgetId}`);
      video.remove();
    }

    function addMetaTag(name, content) {
      const meta = document.createElement('meta');
      meta.content = content;
      meta.setAttribute('itemProp', name);
      if (video) {
        video.parentNode.insertBefore(meta, video);
      }
    }

    function addPropsToParentDiv(div) {
      div.setAttribute('itemprop', 'video');
      div.setAttribute('itemscope', 'true');
      div.setAttribute('itemtype', 'https://schema.org/VideoObject');
    }

    fetch(apiUrl)
      .then((response) => {
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.json();
      })
      .then((data) => {
        for (let i = 0; i < data?.widgets?.length; i++) {
          if (widgetId.includes(data.widgets[i].id)) {
            let videoData = data.widgets[i].videos.find((v) => v.skinType === 'DESKTOP');

            if (
              window.matchMedia('(max-width: 768px)').matches &&
              data.widgets[i].videos.find((v) => v.skinType === 'MOBILE')
            ) {
              videoData = data.widgets[i].videos.find((v) => v.skinType === 'MOBILE');
            }

            if (!videoData) {
              resetNewBg();
              return;
            }

            addPropsToParentDiv(widgets[k]);

            addMetaTag('contentUrl', videoData.url);
            addMetaTag('uploadDate', videoData.createdAt);
            addMetaTag('thumbnailUrl', videoData.thumbnail.url);
            addMetaTag('name', videoData.title);
            if (videoData.description) {
              addMetaTag('description', videoData.description);
            }

            let containerIconsClassName = 'vw-bottom-left';

            setTimeout(() => {
              try {
                window.dispatchEvent(
                  new CustomEvent(_constants__WEBPACK_IMPORTED_MODULE_0__.CUSTOM_EVENTS.VIDEO_BACKGROUND_V2_RENDERED, {
                    detail: {
                      campaignId: null,
                      event_source: 'SHOP',
                      organisationId: data.organisationId,
                      siteId: data.widgets[i].siteId,
                      trackingId: null, // De actualizat in v4
                      videoType: data.widgets[i].videoType,
                      widgetId: data.widgets[i].id,
                      widgetType: data.widgets[i].type,
                    },
                  }),
                );
              } catch (error) {
                console.error('Error dispatching VIDEO_BACKGROUND_V2_RENDERED event:', error);
              }
            }, 5000);
            let url =
              data.widgets[i].videos[0].meta?.convertedH264?.videoUrl ||
              data.widgets[i].videos[0].url ||
              [];
            var mediaQuery = window.matchMedia('(max-width: 768px)');

            var btnsSize = '16px';
            if (mediaQuery.matches) {
              btnsSize = `${data.widgets[i].skins[1].iconSize}px`;
              const widgetFormat = data.widgets[i].skins[1].video.format;
              const btnsPosition = data.widgets[i].skins[1].iconPosition;
              if (widgetFormat === 'FULL_SCREEN') {
                widgets[k].classList.add('vw--background-widget-cover');
              } else {
                widgets[k].classList.add('vw--background-widget-contain');
              }
              if (btnsPosition === 'BOTTOM_LEFT') {
                containerIconsClassName = 'vw-bottom-left';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'BOTTOM_RIGHT') {
                containerIconsClassName = 'vw-bottom-right';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'TOP_LEFT') {
                containerIconsClassName = 'vw-top-left';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'TOP_RIGHT') {
                containerIconsClassName = 'vw-top-right';
                widgets[k].classList.add(containerIconsClassName);
              }

              if (data.widgets[i].videos.length == 1) {
                let hasMux = data.widgets[i].videos[0].muxAssetId || false;
                if (hasMux == false) {
                  url =
                    data.widgets[i].videos[0].meta?.convertedH264?.mobileVideoUrl ||
                    data.widgets[i].videos[0].url ||
                    [];
                  if (url && url.length > 0) {
                    if (videoSource.src != url) {
                      video.src = url;
                    }
                  } else {
                    resetNewBg();
                    return;
                  }
                } else {
                  resetNewBg();
                  return;
                }
              } else {
                for (let j = 0; j < data.widgets[i].videos.length; j++) {
                  if (data.widgets[i].videos[j].skinType == 'MOBILE') {
                    let hasMux = data.widgets[i].videos[j].muxAssetId || false;
                    if (hasMux == false) {
                      url =
                        data.widgets[i].videos[j].meta?.convertedH264?.videoUrl ||
                        data.widgets[i].videos[0].url ||
                        [];
                      if (url && url.length > 0) {
                        if (videoSource.src != url) {
                          video.src = url;
                        }
                      } else {
                        resetNewBg();
                        return;
                      }
                    } else {
                      resetNewBg();
                      return;
                    }
                  }
                }
              }
            } else {
              btnsSize = `${data.widgets[i].skins[0].iconSize}px`;
              const widgetFormat = data.widgets[i].skins[0].video.format;
              if (widgetFormat === 'FULL_SCREEN') {
                widgets[k].classList.add('vw--background-widget-cover');
              } else {
                widgets[k].classList.add('vw--background-widget-contain');
              }

              const btnsPosition = data.widgets[i].skins[0].iconPosition;
              if (btnsPosition === 'BOTTOM_LEFT') {
                containerIconsClassName = 'vw-bottom-left';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'BOTTOM_RIGHT') {
                containerIconsClassName = 'vw-bottom-right';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'TOP_LEFT') {
                containerIconsClassName = 'vw-top-left';
                widgets[k].classList.add(containerIconsClassName);
              }
              if (btnsPosition === 'TOP_RIGHT') {
                containerIconsClassName = 'vw-top-right';
                widgets[k].classList.add(containerIconsClassName);
              }

              for (let j = 0; j < data.widgets[i].videos.length; j++) {
                if (data.widgets[i].videos[j].skinType == 'DESKTOP') {
                  let hasMux = data.widgets[i].videos[j].muxAssetId || false;
                  if (hasMux == false) {
                    url =
                      data.widgets[i].videos[j].meta?.convertedH264?.videoUrl ||
                      data.widgets[i].videos[0].url ||
                      [];
                    if (url && url.length > 0) {
                      if (videoSource.src != url) {
                        video.src = url;
                      }
                    } else {
                      resetNewBg();
                      return;
                    }
                  } else {
                    resetNewBg();
                    return;
                  }
                }
              }
            }

            function getDeviceType() {
              var getDeviceType = '';
              var mediaQuery = window.matchMedia('(max-width: 768px)');
              if (mediaQuery.matches) {
                getDeviceType = 'MOBILE';
              } else {
                getDeviceType = 'DESKTOP';
              }
              return getDeviceType;
            }

            // START TEMPORARY
            const createContainerIconsEl = document.createElement('div');
            createContainerIconsEl.className = `vw-container-icons ${containerIconsClassName}`;
            const containerIconsEl = document
              .querySelector(`.videowise-background-component_${data.widgets[i].id}`)
              .appendChild(createContainerIconsEl);
            // END TEMPORARY

            let showControls = data.widgets[i].skins[0].showControls;
            let showPlayControl = data.widgets[i].skins[0].showPlayControl;
            let showSoundControl = data.widgets[i].skins[0].showSoundControl;
            let showFullscreenControl = data.widgets[i].skins[0].showFullscreenControl;

            if (getDeviceType == 'MOBILE') {
              showControls = data.widgets[i].skins[1].showControls;
              showPlayControl = data.widgets[i].skins[1].showPlayControl;
              showSoundControl = data.widgets[i].skins[1].showSoundControl;
              showFullscreenControl = data.widgets[i].skins[1].showFullscreenControl;
            }

            if (showControls && showPlayControl) {
              const btn =
                `<div class="vw--play-and-pause" style="width:${btnsSize};height:${btnsSize}"><button type="button" aria-label="PlayPause" id="btn-` +
                `${widgetId}` +
                '"><svg class="play" xmlns="http://www.w3.org/2000/svg" width="' +
                `${btnsSize}` +
                '" height="' +
                `${btnsSize}` +
                '"viewBox="0 0 32 32" fill="none"><path d="M10.6665 10H13.6665V22H10.6665V10Z" fill="white"/><path d="M18.3281 10H21.3281V22H18.3281V10Z" fill="white"/><g><circle cx="16" cy="16" r="13.25" stroke="white" stroke-width="1.5" /></svg>' +
                '<svg class="pause" xmlns="http://www.w3.org/2000/svg"' +
                `${btnsSize}` +
                '" height="' +
                `${btnsSize}` +
                '"viewBox="0 0 32 32" fill="none"><path d="M13 11L22 16L13 21V11Z" fill="white"/><g><circle cx="16" cy="16" r="13.25" stroke="white" stroke-width="1.5" /></g></svg>' +
                '</button> </div>';
              /* IOAN ROBCIUC
              video.insertAdjacentHTML('afterEnd', btn);
              */
              // START TEMPORARY
              containerIconsEl.innerHTML += btn;
              // END TEMPORARY

              // START TEMPORARY
              setTimeout(() => {
                const ppbtn = document.getElementById(`btn-${widgetId}`);
                ppbtn.addEventListener(
                  'click',
                  (event) => {
                    const playBtn = ppbtn.querySelector('.play');
                    const pauseBtn = ppbtn.querySelector('.pause');
                    if (video.paused) {
                      video.play();
                      playBtn.style.display = 'block';
                      pauseBtn.style.display = 'none';
                    } else {
                      video.pause();
                      playBtn.style.display = 'none';
                      pauseBtn.style.display = 'block';
                    }
                  },
                  false,
                );
              }, 1000);
              // END TEMPORARY
            }

            if (showControls && showSoundControl) {
              let mUnmute = '';
              mUnmute += `<div class="vw--mute-and-unmute"  style="width:${btnsSize};height:${btnsSize}">`;
              mUnmute += `<button type="button" aria-label="MuteUnmute" id="videoSound-${widgetId}">`;
              mUnmute += `<svg class="mute" width="${btnsSize}" height="${btnsSize}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M15.7916 2.48099C15.933 2.33343 16.1286 2.25 16.333 2.25H19C19.4142 2.25 19.75 2.58579 19.75 3V29C19.75 29.4142 19.4142 29.75 19 29.75H16.333C16.1286 29.75 15.9331 29.6666 15.7916 29.5191L8.01263 21.4055L2.9983 21.3929C2.58483 21.3918 2.2502 21.0563 2.2502 20.6429V11.3571C2.2502 10.9436 2.58494 10.6081 2.99848 10.6071L8.01286 10.5956L15.7916 2.48099ZM16.653 3.75L8.87497 11.8639C8.73393 12.011 8.53909 12.0944 8.33528 12.0949L3.7502 12.1054V19.8948L8.33525 19.9064C8.53898 19.9069 8.73373 19.9902 8.87472 20.1373L16.653 28.25H18.25V3.75H16.653ZM27.3117 6.98611L27.6628 7.64885C29.0001 10.1731 29.7188 13.0535 29.75 15.992V16.0079C29.7188 18.9464 29.0001 21.8268 27.6628 24.3511L27.3117 25.0138L25.9862 24.3116L26.3373 23.6488C27.5576 21.3455 28.22 18.7044 28.25 16C28.22 13.2955 27.5576 10.6544 26.3373 8.35107L25.9862 7.68834L27.3117 6.98611ZM23.6383 11.606L23.2443 10.9678L21.9679 11.7557L22.3618 12.3939C22.9678 13.3756 23.2925 14.6526 23.2456 15.9734C23.245 15.9911 23.245 16.0088 23.2456 16.0266C23.2925 17.3473 22.9678 18.6243 22.3618 19.606L21.9679 20.2442L23.2443 21.0321L23.6383 20.3939C24.4115 19.1411 24.7966 17.5759 24.7456 16C24.7966 14.424 24.4115 12.8588 23.6383 11.606Z" fill="white"/></svg>`;
              mUnmute += `<svg class="unmute" width="${btnsSize}" height="${btnsSize}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M15.7916 2.48099C15.933 2.33343 16.1286 2.25 16.333 2.25H19C19.4142 2.25 19.75 2.58579 19.75 3V29C19.75 29.4142 19.4142 29.75 19 29.75H16.333C16.1286 29.75 15.9331 29.6666 15.7916 29.5191L8.01263 21.4055L2.9983 21.3929C2.58483 21.3918 2.2502 21.0563 2.2502 20.6429V11.3571C2.2502 10.9436 2.58494 10.6081 2.99848 10.6071L8.01286 10.5956L15.7916 2.48099ZM16.653 3.75L8.87497 11.8639C8.73393 12.011 8.53909 12.0944 8.33528 12.0949L3.7502 12.1054V19.8948L8.33525 19.9064C8.53898 19.9069 8.73373 19.9902 8.87472 20.1373L16.653 28.25H18.25V3.75H16.653Z" fill="white"/><path d="M23.5 12.5L30.5 19.5M23.5 19.5L30.5 12.5" stroke="white" stroke-width="1.5" stroke-linecap="square"/></svg>`;
              mUnmute += `</button>`;
              mUnmute += '</div>';

              /* IOAN ROBCIUC
              video.insertAdjacentHTML('afterEnd', mUnmute);
              */
              // START TEMPORARY
              containerIconsEl.innerHTML += mUnmute;
              // END TEMPORARY

              // START TEMPORARY
              setTimeout(() => {
                const mubtn = document.getElementById(`videoSound-${widgetId}`);
                mubtn.addEventListener(
                  'click',
                  () => {
                    const muteBtn = mubtn.querySelector('.mute');
                    const unMuteBtn = mubtn.querySelector('.unmute');

                    if (video.muted) {
                      video.muted = false;
                      unMuteBtn.style.display = 'none';
                      muteBtn.style.display = 'block';
                      try {
                        window.dispatchEvent(
                          new CustomEvent(_constants__WEBPACK_IMPORTED_MODULE_0__.CUSTOM_EVENTS.VIDEO_SOUND_ON, {
                            detail: {
                              videoTitle: data.widgets[i].videos[0].title,
                              videoId: data.widgets[i].videos[0].id,
                              deviceType: getDeviceType(),
                              url: data.widgets[i].videos[0].url,
                              widgetId: data.widgets[i].id,
                            },
                          }),
                        );
                      } catch (error) {
                        console.error('Error dispatching VIDEO_SOUND_ON event:', error);
                      }
                    } else {
                      video.muted = true;
                      unMuteBtn.style.display = 'block';
                      muteBtn.style.display = 'none';
                      try {
                        window.dispatchEvent(
                          new CustomEvent(_constants__WEBPACK_IMPORTED_MODULE_0__.CUSTOM_EVENTS.VIDEO_SOUND_OFF, {
                            detail: {
                              videoTitle: data.widgets[i].videos[0].title,
                              videoId: data.widgets[i].videos[0].id,
                              deviceType: getDeviceType(),
                              url: data.widgets[i].videos[0].url,
                              widgetId: data.widgets[i].id,
                            },
                          }),
                        );
                      } catch (error) {
                        console.error('Error dispatching VIDEO_SOUND_OFF event:', error);
                      }
                    }
                  },
                  false,
                );
              }, 1000);
              // END TEMPORARY
            }

            if (showControls && showFullscreenControl) {
              let fullScreen = '';
              fullScreen += `<div class="vw--full-screen" style="width:${btnsSize};height:${btnsSize}">`;
              fullScreen += `<button type="button" aria-label="FullUnfull" id="fullScreen-${widgetId}">`;
              fullScreen += `<svg width="${btnsSize}" height="${btnsSize}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4C3.75 3.86193 3.86193 3.75 4 3.75H11V2.25H4C3.0335 2.25 2.25 3.0335 2.25 4V11H3.75V4ZM3.75 28C3.75 28.1381 3.86193 28.25 4 28.25H11V29.75H4C3.0335 29.75 2.25 28.9665 2.25 28V21H3.75V28ZM28 3.75C28.1381 3.75 28.25 3.86193 28.25 4V11H29.75V4C29.75 3.0335 28.9665 2.25 28 2.25H21V3.75H28ZM28.25 28C28.25 28.1381 28.1381 28.25 28 28.25H21V29.75H28C28.9665 29.75 29.75 28.9665 29.75 28V21H28.25V28Z" fill="white"/></svg>`;
              fullScreen += '</button>';
              fullScreen += '</div>';

              containerIconsEl.innerHTML += fullScreen;

              setTimeout(() => {
                const fullScreenBtn = document.getElementById(`fullScreen-${widgetId}`);
                if (fullScreenBtn) {
                  fullScreenBtn.addEventListener('click', () => {
                    if (video.requestFullscreen) {
                      video.requestFullscreen().catch((err) => {
                        console.error('Error attempting to enter fullscreen mode:', err.message);
                      });
                    } else if (video.webkitEnterFullscreen) {
                      video.webkitEnterFullscreen();
                    } else if (video.webkitRequestFullscreen) {
                      video.webkitRequestFullscreen();
                    } else {
                      console.warn(
                        'Fullscreen API is not supported in this browser for the video element.',
                      );
                    }
                  });
                }
              }, 1000);
            }
          }
        }
      })
      .catch((error) => {
        resetNewBg();
        console.error('Error:', error);
      });
  }
}

})();

/******/ })()
;