PageSourceSearch

https://www.resq-club.com/wp-content/themes/uncode/library/js/app.js?ver=1403058823

js resq-club.com collected 2026-09-24 09:37:30 UTC 631,876 bytes, 19,725 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open uncode-sidecart-open', function(){
92		window.lenis.stop();
93	});
94
95	$(window).on('uncode-sidecart-closed', function(){
96		window.lenis.start();
97	});
98
99	$(document).on('unmodal-close', function(){
100		window.lenis.start();
101	});
102
103}
104
105/**
106 * iOS / mobile: Safari fires a window "resize" every time the address bar /
107 */
108if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null && typeof ScrollTrigger.config === 'function' ) {
109	ScrollTrigger.config({ ignoreMobileResize: true });
110}
111
112var checkScrollTriggerRefresh;
113
114$(function(){
115	$(document).on('uncode-scrolltrigger-refresh', function(){
116		clearRequestTimeout(checkScrollTriggerRefresh);
117		checkScrollTriggerRefresh = requestTimeout(function(){
118			ScrollTrigger.refresh();
119			$('.scroll-refresh-hidden').removeClass('opacity_0');
120		}, 500);
121	});
122});
123
124UNCODE.checkImgLoad = function( src, cb, err, el ) {
125	var img = new Image();
126	img.onload = function () {
127		var result = (img.width > 0) && (img.height > 0);
128		cb(el);
129	};
130	img.onerror = function () {
131		err();
132	};
133	img.src = src
134};
135
136UNCODE.betterResize = function() {
137	var setResize,
138		doubleResize = true,
139		oldW = UNCODE.wwidth,
140		oldH = UNCODE.wheight,
141		setCTA;
142	$(window).on( 'resize orientationchange', function(){
143		if ( oldW === UNCODE.wwidth ) {
144			return;
145		} else {
146			oldW = UNCODE.wwidth;
147			$(window).trigger('wwResize');
148		}
149
150		if ( oldH === UNCODE.wheight ) {
151			return;
152		} else {
153			oldH = UNCODE.wheight;
154			$(window).trigger('whResize');
155		}
156	});
157
158	$(window).on( 'resize orientationchange', function(){
159		clearRequestTimeout(setCTA);
160		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
161	});
162};
163
164UNCODE.shuffle = function(array) {
165	var currentIndex = array.length,
166		randomIndex;
167  
168	while (currentIndex > 0) {
169		randomIndex = Math.floor(Math.random() * currentIndex);
170		currentIndex--;
171		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
172	}
173  
174	return array;
175};
176
177Number.isInteger = Number.isInteger || function(value) {
178    return typeof value === "number" &&
179           isFinite(value) &&
180           Math.floor(value) === value;
181};
182
183UNCODE.utils = function() {
184	$(document).on('mouseover', 'a', function () {
185		if (!$(this).hasClass('star')) {
186			$(this).attr('data-title', $(this).attr('title'));
187			$(this).removeAttr('title');
188		}
189	});
190	$(document).on('mouseout', 'a', function () {
191		if (!$(this).hasClass('star')) {
192			$(this).attr('title', $(this).attr('data-title'));
193			$(this).removeAttr('data-title');
194		}
195	});
196
197	this.get_scroll_offset = function(e) {
198
199		var scroll_offset = 0,
200			target,
201			trigger;
202
203		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
204			target = e.target;
205			trigger = e.currentTarget;
206		}
207
208		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
209			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
210				UNCODE.hideMenu(100);
211			}
212		}
213
214		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
215			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
216			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
217				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile && ! $('.menu-mobile-transparent').length ) ) {
218					if ( !$('.menu-hided').length ) {
219						if ( $('body').hasClass('hmenu-center') ) {
220							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
221						} else {
222							scroll_offset += ~~$('.logo-container:visible').outerHeight();
223						}
224					}
225				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && UNCODE.wwidth > UNCODE.mediaQuery ) {
226					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
227					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
228				} else {
229					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
230						scroll_offset += UNCODE.menuMobileHeight;
231					} else {
232						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
233							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
234						} else {
235							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
236								scroll_offset += UNCODE.menuMobileHeight;
237							}
238						}
239					}
240				}
241			}
242
243		}
244
245		scroll_offset += UNCODE.bodyBorder;
246
247		return scroll_offset;
248	}
249
250	if ( !UNCODE.isFullPage ) {
251		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
252
253			var hash = (e.currentTarget).hash,
254			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
255			anchor = '';
256			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
257			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
258				e.preventDefault();
259				if (!$('#tab-reviews').is(':visible')) {
260					$('a[href="#tab-reviews"]').trigger('click');
261				}
262				var calc_scroll = $('.wootabs .tab-content').offset().top;
263				calc_scroll -= UNCODE.get_scroll_offset(e);
264
265				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
266					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
267
268					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
269						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
270					}
271				}
272
273				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
274					delta = bodyTop - calc_scroll,
275					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
276				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
277
278				requestTimeout(function(){
279					if (scrollSpeed == 0) {
280						$('html, body').scrollTop(calc_scroll);
281						UNCODE.scrolling = false;
282					} else {
283   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
284							$(this).stop();
285						}).animate({
286								scrollTop: calc_scroll
287							}, scrollSpeed, 'easeInOutCubic', function() {
288								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
289								UNCODE.scrolling = false;
290							}
291						);
292					}
293				}, 200);
294				return;
295			}
296			if (hash != undefined) {
297				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
298				var anchor = this.hash.slice(1);
299				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
300			  		if ( !specialFormat.test(hash) ) {
301			  			if ( $(hash).length )
302			  				anchor = $(hash);
303			  		}
304				}
305			}
306
307			if (is_scrolltop || anchor != '') {
308				if (is_scrolltop) {
309					e.preventDefault();
310					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
311					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
312					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
313
314					if (scrollSpeed == 0) {
315						$('html, body').scrollTop(0);
316						UNCODE.scrolling = false;
317					} else {
318   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
319							$(this).stop();
320						}).animate({
321							scrollTop: 0
322						}, scrollSpeed, 'easeInOutCubic', function() {
323							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
324							UNCODE.scrolling = false;
325						});
326					}
327				} else {
328					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
329					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a, #uncode-mobile-menu-block .menu-item > a'), function(index, val) {
330						var get_href = $(val).attr('href');
331						if (get_href != undefined) {
332							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
333							else $(val).parent().removeClass('active');
334						}
335					});
336					if (scrollSection.length) {
337						if ( $('body').hasClass('uncode-scroll-no-history') ) {
338							e.preventDefault();
339						}
340
341						if (UNCODE.menuOpened) {
342							if (UNCODE.wwidth < UNCODE.mediaQuery) {
343								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
344							} else {
345								$('.mmb-container-overlay .overlay-close').trigger('click');
346								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
347							}
348						}
349
350						var calc_scroll = scrollSection.offset().top,
351							getOffset = UNCODE.get_scroll_offset(e),
352							$logo = $('.logo-container:visible'),
353							logoH,
354							$menu = $('#masthead .menu-container'),
355							menuH;
356
357						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
358
359						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
360							delta = bodyTop - calc_scroll,
361							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
362						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
363
364						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
365							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
366								logoH = $logo.outerHeight(),
367								menuH = $menu.outerHeight();
368								if ( calc_scroll < ( logoH + menuH ) ) {
369									calc_scroll = 0;
370								}
371							}
372						}
373
374						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
375							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
376						}
377
378						if (scrollSpeed == 0) {
379							$('html, body').scrollTop(calc_scroll);
380							UNCODE.scrolling = false;
381						} else {
382	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
383								$(this).stop();
384							}).animate({
385								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
386							}, scrollSpeed, 'easeInOutCubic', function() {
387								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
388								UNCODE.scrolling = false;
389								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
390								||
391								$('.menu-hided').length ) {
392									calc_scroll = scrollSection.offset().top;
393									getOffset = UNCODE.get_scroll_offset(e);
394									calc_scroll -= getOffset;
395									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
396										$(this).stop();
397									}).animate({
398										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
399										}, scrollSpeed, 'easeInOutCubic', function() {
400											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
401											UNCODE.scrolling = false;
402										}
403									);
404								}
405							});
406						}
407					}
408				}
409			}
410		});
411		$('.header-scrolldown').on('click', function(event) {
412
413			event.preventDefault();
414
415			var pageHeader = $(event.target).closest('#page-header'),
416				pageHeaderTop = pageHeader.offset().top,
417				pageHeaderHeight = pageHeader.outerHeight(),
418				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
419			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
420
421			var calc_scroll = pageHeaderTop + pageHeaderHeight,
422			getOffset = UNCODE.get_scroll_offset(event);
423			calc_scroll -= getOffset;
424
425			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
426				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
427
428				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
429					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
430				}
431			}
432
433			if (scrollSpeed == 0) {
434				$('html, body').scrollTop(calc_scroll);
435				UNCODE.scrolling = false;
436			} else {
437					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
438						$(this).stop();
439					}).animate({
440						scrollTop: calc_scroll
441					}, scrollSpeed, 'easeInOutCubic', function() {
442						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
443						UNCODE.scrolling = false;
444						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
445							calc_scroll = pageHeaderTop + pageHeaderHeight;
446							getOffset = UNCODE.get_scroll_offset(event);
447							calc_scroll -= getOffset;
448								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
449									$(this).stop();
450								}).animate({
451									scrollTop: calc_scroll
452								}, scrollSpeed, 'easeInOutCubic', function() {
453									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
454									UNCODE.scrolling = false;
455								}
456							);
457						}
458					}
459				);
460			}
461		});
462	}
463
464	// Colomun hover effect
465	// =================
466	$(document).on('mouseenter', '.col-link', function(e) {
467		var uncol = $(e.target).prev('.uncol'),
468		el = uncol.find('.column-background');
469		if (el) {
470			$('.btn-container .btn', uncol).addClass('active');
471			var elOverlay = $(el[0]).find('.block-bg-overlay');
472			if (elOverlay.length) {
473				var getOpacity = $(elOverlay).css('opacity');
474				if (getOpacity != 1) {
475					getOpacity = Math.round(getOpacity * 100) / 100;
476					var newOpacity = getOpacity + .1;
477					$(elOverlay).data('data-opacity', getOpacity);
478					$(elOverlay).css('opacity', newOpacity);
479				}
480			}
481		}
482	}).on('mouseleave', '.col-link', function(e) {
483		var uncol = $(e.target).prev('.uncol'),
484		el = uncol.find('.column-background');
485		$('.btn-container .btn', uncol).removeClass('active');
486		if (el) {
487			var elOverlay = $(el[0]).find('.block-bg-overlay');
488			if (elOverlay.length) {
489				var getOpacity = $(elOverlay).data('data-opacity');
490				$(elOverlay).css('opacity', getOpacity);
491			}
492		}
493	});
494
495	// Admin bar
496	// ============
497	var fixAdminBar = function() {
498		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
499			var getAdminBar = $('#wpadminbar');
500			if (getAdminBar.length) {
501				if (getAdminBar.css('position') !== 'hidden') {
502					var getAdminBarHeight = getAdminBar.height();
503					if (getAdminBar.css('position') === 'fixed') {
504						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
505						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
506					} else {
507						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
508						$('.body-borders .top-border').css({'margin-top':'0px'});
509					}
510				}
511			}
512		}
513	};
514	window.addEventListener('load', fixAdminBar);
515	window.addEventListener('resize', fixAdminBar);
516	// Print
517	// ===========
518	var beforePrint = function() {
519		window.dispatchEvent(new CustomEvent('resize'));
520		window.dispatchEvent(UNCODE.boxEvent);
521	};
522
523	if (window.matchMedia) {
524		var mediaQueryList = window.matchMedia('print');
525		mediaQueryList.addListener(function(mql) {
526			if (mql.matches) {
527				beforePrint();
528			}
529		});
530	}
531
532	window.onbeforeprint = beforePrint;
533
534	// Safari srcset
535	var safariSrcSet = function(){
536		if ( !SiteParameters.is_frontend_editor ) {
537			$('html.safari img[sizes]').each(function(){
538				var $img = $(this),
539					sizeImg = parseInt($img.attr('sizes'));
540				if ( typeof(sizeImg) === 'number' ) {
541					$img.attr('sizes', (sizeImg) + 'px');
542				}
543			});
544		}
545	};
546	window.addEventListener('load', safariSrcSet);
547}
548
549UNCODE.lettering = function() {
550
551	var setCTA;
552	var highlightStill = function(){
553
554		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
555
556		$.each($heading_texts, function(key, el) {
557			var $heading = $(el);
558
559			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
560				return;
561			}
562
563			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
564				return;
565			}
566
567			var waypoint = new Waypoint({
568				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
569				element: el,
570				handler: function() {
571					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
572						anims_l = $anims.length;
573					$anims.each(function(_key_, _el_){
574						var $anim = $(_el_);
575
576						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
577							$anim.addClass('heading-text-highlight-animated');
578
579							if ( $heading.data('animate') === true ) {
580								$anim.css({
581									'-webkit-transition-duration': '0ms',
582									'-moz-transition-duration': '0ms',
583									'-o-transition-duration': '0ms',
584									'transition-duration': '0ms',
585								});
586							} else {
587								$anim.css({
588									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
589									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
590									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
591									'transition-delay': ((_key_ + 2) * 200) + 'ms',
592								});
593							}
594						}
595
596					});
597					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
598						$heading.data('animate', true);
599					});
600					$anims.removeAttr('data-animated');
601				},
602				offset: '100%'
603			});
604
605		});
606
607		Waypoint.refreshAll();
608		$( document.body ).trigger('uncode_waypoints');
609		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
610			$(document).trigger('uncode-scrolltrigger-refresh');
611		}
612
613	}
614
615	requestTimeout(function(){
616		highlightStill();
617		$(window).on( 'wwResize', function(){
618			clearRequestTimeout(setCTA);
619			setCTA = requestTimeout( highlightStill, 100 );
620		});
621	}, 400);
622
623};
624
625UNCODE.isUnmodalOpen = false;
626
627var manageVideoSize = function(){
628
629	var setVideoFit;
630	$('.wp-block-embed').each(function(){
631
632		var $this = $(this);
633
634		if ( $('iframe', $this).length ) {
635
636			var $iframe = $('> iframe, > a > iframe', $this),
637				w = parseFloat($iframe.attr('width')),
638				h = parseFloat($iframe.attr('height')),
639				url = $iframe.attr('src'),
640				ratio, frW;
641
642			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
643
644				ratio = h / w;
645				var setResizeiFto,
646					resizeiFrame = function(){
647					frW = $iframe.width();
648					$iframe.css({
649						height: frW * ratio
650					});
651				};
652				resizeiFrame();
653				$(window).on( 'wwResize load', function(){
654					clearRequestTimeout(setResizeiFto);
655					setResizeiFto = requestTimeout( function() {
656						resizeiFrame();
657					}, 10 );
658				});
659
660			}
661
662		}
663
664	});
665
666};
667
668manageVideoSize();
669
670UNCODE.vivus = function(icon, time, delay, file) {
671	if (typeof Vivus !== 'undefined') {
672		var icon_options = {
673			type: 'delayed',
674			pathTimingFunction: Vivus.EASE_OUT,
675			animTimingFunction: Vivus.LINEAR,
676			duration: time,
677		}
678
679		if (delay) {
680			icon_options.delayStart = delay;
681		}
682
683		if (file) {
684			icon_options.file = file;
685		}
686
687		new Vivus(icon, icon_options);
688	}
689};
690
691UNCODE.lastURL = '';
692
693UNCODE.getURLParams = function(current_location, is_string) {
694	var params = {};
695	if (is_string) {
696		var url = current_location.split('?')[1];
697	} else {
698		var url = current_location.search;
699		url = url.substring(1);
700	}
701	if (url) {
702		var parts = url.split('&');
703		for (var i = 0; i < parts.length; i++) {
704			var nv = parts[i].split('=');
705			if (!nv[0]) {
706				continue;
707			}
708			params[nv[0]] = nv[1] || true;
709		}
710	}
711	return params;
712}
713
714UNCODE.hasEqualURLParams = function(obj1, obj2) {
715	for (var i in obj1) {
716		if (obj1.hasOwnProperty(i)) {
717			if (!obj2.hasOwnProperty(i)) {
718				return false;
719			}
720			if (obj1[i] != obj2[i]) {
721				return false;
722			}
723		}
724	}
725	for (var i in obj2) {
726		if (obj2.hasOwnProperty(i)) {
727			if (!obj1.hasOwnProperty(i)) {
728				return false;
729			}
730			if (obj1[i] != obj2[i]) {
731				return false;
732			}
733		}
734	}
735    return true;
736}
737
738UNCODE.magnetic = function(){
739	
740	$(document).on('mousemove', '.un-magnetic-zone', function(e){
741
742		var $zone = $(this),
743			zoneOff = $zone.offset(),
744			$mgntcEl = $('.un-magnetic-el', this),
745			elBound = this.getBoundingClientRect(),
746			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
747
748		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
749	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
750	  
751		$mgntcEl.each(function(key, val){
752			var magneticValue = $(val).attr('data-mgntc') || 0.5;
753		
754			val.animate({
755				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
756			},{
757				duration: 500,
758				fill: 'forwards',
759			})
760	  	});
761	})
762	
763	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
764		var $mgntcEl = $('.un-magnetic-el', this);
765
766		$mgntcEl.each(function(key, val){
767			val.animate({
768		  		transform: 'translate(0)',
769			},{
770		  		duration: 500,
771		  		fill: 'forwards',
772			})
773	  	});
774	})
775};
776
777
778UNCODE.rowParallax = function(){
779
780	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
781		return;
782	}
783
784	var $rows = $('.parallax-move'),
785		stableHeight = UNCODE.wheight;
786	$rows.each(function(){
787		var $row = $(this),
788			_row = $row[0],
789			dataMove = $row.attr('data-parallax-move'),
790			dataSafe = $row.attr('data-parallax-safe'),
791            rowInViewport = false,
792			trans;
793
794		if ( $row.find('.parallax-move').length ) {
795			return;
796		}
797
798		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
799		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
800        dataMove = dataMove / 10;
801
802        if ( 'IntersectionObserver' in window ) {
803			var observer = new IntersectionObserver(function(entries) {
804	
805				entries.forEach(function(entry){
806					if ( entry.isIntersecting ) {
807						rowInViewport = true;
808					} else {
809						rowInViewport = false;
810					}
811				});
812	
813			}, { 
814				root: document,
815			});
816	
817			observer.observe(_row);
818		} else {
819            rowInViewport = true;
820		}
821
822		var loopRAF = function() {
823			if( rowInViewport ) {
824				var bound = _row.getBoundingClientRect(),
825					bound_top = bound.top,
826					bound_height = bound.height,
827					move = true,
828					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
829					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
830						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
831					fromBottom = docH - (scrolled + bound_top + bound_height);
832
833                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
834                    $row.find('>div').css({
835                        'transform':'none'
836                    });
837                    move = false;
838				}
839
840				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
841					$row.find('>div').css({
842						'transform':'none'
843					});
844					move = false;
845				}
846
847				if ( move ) {
848
849					if ( fromBottom < stableHeight ) {
850						//maybe Footer
851						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
852                    } else if ( scrolled + bound_top < stableHeight ) {
853						//maybe Header
854						trans = scrolled*(dataMove);
855					} else {
856						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
857					}
858
859                    $row.find('>div').css({
860                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
861                    });
862                }
863			}
864	
865			requestAnimationFrame(loopRAF);
866		};
867		
868		requestAnimationFrame(loopRAF);
869
870	});
871
872	$(window).on( 'load resize', function(e) {
873		if ( ! UNCODE.isMobile ) {
874			stableHeight = UNCODE.wheight;
875		}
876	});
877
878	$(window).on( 'load wwResize', function(e) {
879		if ( UNCODE.isMobile ) {
880			stableHeight = UNCODE.wheight;
881		}
882	});
883
884}
885
886UNCODE.changeSkinOnScroll = function(){
887	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
888		return;
889	}
890	var $masthead = $('#masthead'),
891		transDesktop,
892		transMobile,
893		changeSkin,
894
895	checkTransparencyAndChange = function( $col ){
896		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
897		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
898		changeSkin = $masthead.hasClass('menu-change-skin');
899
900		if ( ! transDesktop && ! transMobile ) {
901			return false;
902		}
903
904		if ( ! changeSkin ) {
905			return false;
906		}
907
908		if ( $col.hasClass('style-light') ){
909			$masthead.removeClass('style-dark-override').addClass('style-light-override');
910			return false;
911		} else if ( $col.hasClass('style-dark') ) {
912			$masthead.removeClass('style-light-override').addClass('style-dark-override');
913			return false;
914		}
915	};
916
917	var prev_row = 'normal',
918		odd = true,
919		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *):not(.block-wrapper-parent *)');
920	$.each($rows, function(index, row){
921		var $row = $(row),
922			$col = $('.uncol', $row).first(),
923			$slider = $('.uncode-slider', $row);
924
925		if ( $row.closest('li.menu-item').length ) {
926			return;
927		}
928
929		var wayDown = new Waypoint({
930			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
931			element: row,
932			handler: function(direction) {
933				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
934					if ( $slider.length ) {
935						$col = $('.owl-item.index-active .uncol', $slider).first();
936					}
937					checkTransparencyAndChange($col);
938				}
939				if ( odd === false ) {
940					if ( row.hasAttribute('data-bg-changer') ) {
941						prev_row = 'bg-changer';
942					} else {
943						prev_row = 'normal';
944					}
945					odd = true;
946				} else {
947					odd = false;
948				}
949			},
950			offset: function() {
951				return UNCODE.menuHeight / 2
952			}
953		});
954		var wayUp = new Waypoint({
955			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
956			element: row,
957			handler: function(direction) {
958				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
959					if ( $slider.length ) {
960						$col = $('.owl-item.index-active .uncol', $slider).first();
961					}
962					checkTransparencyAndChange($col);
963				}
964				if ( odd === false ) {
965					if ( row.hasAttribute('data-bg-changer') ) {
966						prev_row = 'bg-changer';
967					} else {
968						prev_row = 'normal';
969					}
970					odd = true;
971				} else {
972					odd = false;
973				}
974			},
975			offset: function() {
976				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
977			}
978		});
979	});
980
981};
982
983UNCODE.share = function() {
984	if (typeof Share !== 'undefined') {
985		var share_button_element = $('.share-button');
986		var share_button_url = share_button_element.data('url');
987
988		var share_button_config = {
989			ui: {
990				flyout: "top center",
991				button_font: false,
992				button_text: '',
993				icon_font: false
994			}
995		};
996
997		if (share_button_url) {
998			share_button_config.url = share_button_url.replace("&", "%26");
999		}
1000
1001		var share_button_top = new Share('.share-button', share_button_config);
1002
1003		$('li[data-network]', share_button_element).each(function(){
1004			var label = SiteParameters.uncode_share_label,
1005				network = $(this).attr('data-network');
1006			label = label.replace("%", network);
1007			$(this).attr('aria-label', label);
1008		});
1009	}
1010};
1011
1012UNCODE.tooltip = function() {
1013	if (typeof jQuery.fn.tooltip !== 'undefined') {
1014		$('.btn-tooltip').tooltip();
1015	}
1016};
1017
1018UNCODE.counters = function() {
1019	var $counters = $('.uncode-counter:not(.counter-init)');
1020	$counters.each(function(){
1021		var $counter = $(this).addClass('counter-init');
1022		if ( SiteParameters.is_frontend_editor ) {
1023			$counter.addClass('started');
1024		}
1025		if ( $counter.closest( '.owl-carousel' ).length ) {
1026			return;
1027		}
1028		$counter.addClass('started').counterUp({
1029			delay: 10,
1030			time: 1500
1031		});
1032	});
1033};
1034
1035UNCODE.countdowns = function() {
1036	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1037	$countdowns.each(function() {
1038		var $this = $(this).addClass('counter-init'),
1039			finalDate = $(this).data('uncode-countdown');
1040		$this.countdown(finalDate, function(event) {
1041			$this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>'));
1042		});
1043	});
1044};
1045
1046UNCODE.tabs = function() {
1047
1048	var tabSwitcher = function($el){
1049		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1049ical):not(.tab-switch)', $el).each(function(key, value){
1050			var $navs = $(value),
1051				$active = $('li.active', $navs),
1052				$active_a = $('> a', $active),
1053				$active_span = $('> span', $active_a),
1054				vertical = $navs.closest('.vertical-tab-menu').length;
1055			
1056			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1057				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1058			}
1059
1060			var $cursor = $('.switcher-cursor', $navs),
1061				active_w = $('a', $active).outerWidth(),
1062				span_w = $active_span.outerWidth(),
1063				active_pos = $active.position(),
1064				active_a_pos = $active_a.position(),
1065				span_pos = $active_span.position(),
1066				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1067				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1068
1069			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1070
1071			if ( ! vertical ) {
1072				$cursor.css({
1073					left: cursor_left,
1074					width: cursor_w
1075				});
1076			}
1077
1078			$navs.addClass('switch-init');
1079		});
1080	};
1081
1082	var $body = $('body');
1083	tabSwitcher($body);
1084
1085	var tabHoverIntent = function(){
1086		var setHover;
1087		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1088			.on('mouseover', function(e){
1089				var $this = $(e.target);
1090				setHover = requestTimeout(function() {
1091					$this.trigger('hover-int');
1092				}, 50);
1093			})
1094			.on('mouseout', function(){
1095				clearRequestTimeout(setHover);
1096			});
1097	};
1098	tabHoverIntent();
1099
1100	var tabInit = function(){
1101		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1102			e.preventDefault()
1103			var $el = $(this);
1104			$el.tab('show');
1105			var $container = $el.closest('.uncode-tabs');
1106			tabSwitcher($container);
1107			requestTimeout(function() {
1108				window.dispatchEvent(UNCODE.boxEvent);
1109				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1110
1111				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1112					window.dispatchEvent(new CustomEvent('boxResized'));
1113				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1114					window.dispatchEvent(new Event('resize'));
1115					$(window).trigger('uncode.re-layout');
1116				} 
1117
1118				var $active_panel = $('.tab-pane.active', $tabs);
1119
1120				$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1121					var element = $(val),
1122						delayAttr = element.attr('data-delay');
1123					if (delayAttr == undefined) delayAttr = 0;
1124					requestTimeout(function() {
1125						element.addClass('start_animation');
1126					}, delayAttr);
1127				});
1128
1129			}, 300);
1130
1131			var $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1132				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1133			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1134				var element = $(val);
1135				element.removeClass('start_animation');
1136			});
1137
1138			var $li = $el.closest('li'),
1139				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1140			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1141			$('.tab-pane', $li).slideDown(250);
1142			var completeSlideDown = requestTimeout(function(){
1143				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1144					var pos = $el.offset(),
1145						rect = $el[0].getBoundingClientRect(),
1146						$masthead = $('#masthead > .menu-container'),
1147						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1148
1149					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1150						$('html, body').animate({
1151							scrollTop: ( pos.top ) - considerMenu
1152						},{
1153							easing: 'easeInOutQuad',
1154							duration: 250
1155						});
1156					}
1157				}
1158			}, 260);
1159		});
1160	}
1161	tabInit();
1162
1163	var tabResponsive = function(){
1164		if ( SiteParameters.is_frontend_editor ) {
1165			return true;
1166		}
1167		var $tabContainers = $('.tab-container.tabs-breakpoint');
1168		$tabContainers.each(function(){
1169			var $tabContainer = $(this),
1170				$tabContent = $('.tab-content', $tabContainer),
1171				$nav = $('.nav-tabs', $tabContainer),
1172				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1173
1174			$('> li', $nav).each(function(){
1175				var $li = $(this),
1176					dataID = $li.attr('data-tab-id');
1177
1178				if ( UNCODE.wwidth <= mQuery ) {
1179					if ( ! $('.tab-pane', $li ).length ) {
1180						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1181						$tabContainer.addClass('tabs-appended');
1182						$li.append($append_pane);
1183					}
1184
1185					if ( $li.hasClass('active') ) {
1186						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1187					}
1188				} else {
1189					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1190						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1191						$tabContainer.removeClass('tabs-appended');
1192						$tabContent.prepend($append_pane.removeAttr('style'));
1193					}
1194				}
1195			});
1196		});
1197
1198	}
1199	tabResponsive();
1200
1201	$(window).on('wwResize', function(){
1202		tabHoverIntent();
1203		tabSwitcher($body);
1204	});
1205
1206	var setCTA;
1207	$(window).on( 'resize', function(){
1208		clearRequestTimeout(setCTA);
1209		setCTA = requestTimeout( tabResponsive, 100 );
1210	});
1211
1212	$('.nav-tabs').each(function(){
1213		var $nav = $(this),
1214			$lis = $('> li:not(.active)', $nav),
1215			$links = $('.tab-excerpt-link', $nav);
1216		$('.tab-excerpt', $lis).slideUp(400, function(){
1217			$(this).addClass('init');
1218		});
1219
1220		$links.each(function(){
1221			var $link = $(this),
1222				$par_a = $link.closest('a'),
1223				href = $link.attr('data-href'),
1224				target = $link.attr('data-target');
1225			$par_a.addClass('inner-link');
1226			$link.on('click', function(){
1227				var _link = document.createElement('a');
1228				_link.href = href;
1229				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1230				_link.click();
1231			});
1232		});
1233		$nav.addClass('tab-init');
1234	});
1235
1236	$('.uncode-tabs.tabs-no-lazy').each(function(){
1237		var $tabs = $(this),
1238			$panes = $('.tab-pane:not(.active)', $tabs);
1239		$panes.each(function(){
1240			var $pane = $(this),
1241				$imgs = $('img[loading="lazy"]', $pane);
1242			$imgs.removeAttr('loading');
1243			$imgs.removeAttr('decoding');
1244		});
1245	});
1246
1247};
1248UNCODE.collapse = function() {
1249	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1250		var $this = $(this),
1251			href
1252		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1253		var $target = $(target)
1254		var parent = $this.attr('data-parent')
1255		var $parent = parent && $(parent)
1256		var $title = $(this).parent()
1257		var $accordion = $(e.target).closest('.uncode-accordion')
1258		var $group = $this.closest('.group')
1259		var $panel_group = $this.closest('.panel-group')
1260		if ($parent) {
1261			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1262			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1263				$title.removeClass('active');
1264				$group.removeClass('active-group');
1265			} else {
1266				if ( $panel_group.attr('data-no-toggle') != true ) {
1267					$parent.find('.panel-title').removeClass('active')
1268					$parent.find('.group').removeClass('active-group')
1269				}
1270				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1271				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1272			}
1273		}
1274		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1275		requestTimeout(function() {
1276			var $accordion = $(e.target).closest('.uncode-accordion');
1277			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1278			  window.dispatchEvent(new CustomEvent('boxResized'));
1279			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1280				window.dispatchEvent(new Event('resize'));
1281				$(window).trigger('uncode.re-layout');
1282			} 
1283
1284			var $active_panel = $('.panel.active-group', $parent);
1285
1286			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1287				var element = $(val),
1288					delayAttr = element.attr('data-delay');
1289				if (delayAttr == undefined) delayAttr = 0;
1290				requestTimeout(function() {
1291					element.addClass('start_animation');
1292				}, delayAttr);
1293			});
1294
1295		}, 500);
1296
1297		$group.find('.panel-title:not(.active) > a').trigger('blur');
1298
1299	});
1300
1301	$('.uncode-accordion.tabs-no-lazy').each(function(){
1302		var $accordion = $(this),
1303			$panes = $('.panel:not(.active-group)', $accordion);
1304		$panes.each(function(){
1305			var $pane = $(this),
1306				$imgs = $('img[loading="lazy"]', $pane);
1307			$imgs.removeAttr('loading');
1308			$imgs.removeAttr('decoding');
1309		});
1310	});
1311};
1312
1313UNCODE.accessibility = function() {
1314    if ( ! SiteParameters.uncode_is_accessible ) {
1315        return;
1316    }
1317
1318    //
1319
1320};
1321UNCODE.bigText = function(el) {
1322	var bigTextLaunch = function(){
1323		if (el == undefined) {
1324			el = $('body');
1325		}
1326		$.each($('.bigtext', el), function(index, val) {
1327			$(val).bigtext({
1328				minfontsize: 24
1329			});
1330			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1331				opacity: 1
1332			});
1333			requestTimeout(function() {
1334				if ($(val).find('.animate_when_almost_visible').length != 0) {
1335					$(val).css({opacity: 1});
1336				}
1337			}, 400);
1338		});
1339	};
1340
1341	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1342		bigTextLaunch();
1343	}
1344	$(window).on( 'load', bigTextLaunch );
1345};
1346
1347UNCODE.process_shortpixel_image = function(image) {
1348	var data = {
1349		action: 'shortpixel_manual_optimization',
1350		image_id: image,
1351		cleanup: true
1352	};
1353
1354	$.get(SiteParameters.ajax_url, data);
1355};
1356
1357UNCODE.animateSubInside = function( _this, remove ){
1358	if ( typeof remove !== 'undefined' && remove === true ) {
1359		$(document).trigger('sub-menu-slide-up');
1360		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1361			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1362		});
1363	} else {
1364		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', _this), function(index, val) {
1365			var element = $(val),
1366				delayAttr = element.attr('data-delay');
1367			if (delayAttr == undefined) delayAttr = 0;
1368			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1369			element.addClass('start_animation');
1370		});
1371		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1372	}
1373};
1374
1375
1376UNCODE.menuToggleAnimation = function() {
1377	var $block = $('body'),
1378		$menuBlocks = $('.menu.unmenu-block', $block),
1379		$allSeqs = $('[data-delay-seq]', $block);
1380
1381	$allSeqs.each(function(key, seq){
1382		$(seq).removeAttr('data-delay');
1383	});
1384
1385	$menuBlocks.each(function(key, menu){
1386
1387		var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1388		$animatesHidden.each(function(key_, seq){
1389			$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1390		});
1391
1392		var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1393		$animatesVisibile.each(function(key_, seq){
1394			$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1395		});
1396
1397		var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1398			delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1399			interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1400		$delaySequentials.each(function(_key, seq){
1401			$(seq).attr('data-delay', delay + (interval*_key));
1402		});
1403	});
1404};
1405
1406// Registrato al caricamento dello script (prima di UNCODE.init → unBlockMenu),
1407// così il trigger sincrono 'unblock-toggles-init' trova già il listener attivo.
1408$(document).on('unblock-toggles-init', UNCODE.menuToggleAnimation);
1409
1410UNCODE.menuSystem = function() {
1411
1412	function menuMobile() {
1413		var $body = $('body'),
1414			scrolltop,
1415			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1416			$masthead = $('#masthead'),
1417			$menuBlock = $('#uncode-mobile-menu-block'),
1418			$box,
1419			$el,
1420			$el_transp,
1421			elHeight,
1422			offCanvasAnim,
1423			check,
1424			animating = false,
1425			stickyMobile = false,
1426			menuClose = new CustomEvent('menuMobileClose'),
1427			menuOpen = new CustomEvent('menuMobileOpen');
1428		UNCODE.menuOpened = false;
1429		$mobileToggleButton.on('click', function(event) {
1430			event.stopPropagation();
1431			var btn = this;
1432			if ($(btn).hasClass('overlay-close')) return;
1433			event.preventDefault();
1434			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1435			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1436				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1437				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1438				$el_transp = $('.menu-absolute.menu-transparent');
1439				if (UNCODE.isMobile) {
1440					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) {
1441						stickyMobile = true;
1442						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1443					} else {
1444						elHeight = 0;
1445						$.each($box.find('> div'), function(index, val) {
1446							elHeight += $(val).outerHeight();
1447						});
1448					}
1449				} else {
1450					elHeight = 0;
1451					$.each($el, function(index, val) {
1452						elHeight += $(val).outerHeight();
1453					});
1454				}
1455				var open = function() {
1456					clearTimeout(offCanvasAnim);
1457					if (!animating) {
1458						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1459						scrolltop = $(window).scrollTop();
1460						window.dispatchEvent(menuOpen);
1461						animating = true;
1462						UNCODE.menuOpened = true;
1463						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1464							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1465								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1466							}
1467							if ($('body.menu-offcanvas').length) {
1468								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1469								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1469UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1470							} else {
1471								if ( $('.menu-hide, .menu-sticky').length ) {
1472									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1473										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1474									}
1475								}
1476							}
1477						}
1478						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1479							//$("#masthead")[0].scrollIntoView();
1480							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1481						}
1482						$box.addClass('open-items');
1483						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1484							$el_transp.addClass('is_mobile_open');
1485						}
1486						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1487							btn.classList.add('close');
1488							$box.animate({
1489								height: elHeight
1490							}, 600, "easeInOutCirc", function() {
1491								animating = false;
1492								if (!stickyMobile) $box.css('height', 'auto');
1493							});
1494						} else {
1495							animating = false;
1496						}
1497
1498						if ( $menuBlock.length ) {
1499							UNCODE.animateSubInside($menuBlock);
1500						}
1501					}
1502				};
1503
1504				var close = function() {
1505					clearTimeout(offCanvasAnim);
1506					if (!animating) {
1507						window.dispatchEvent(menuClose);
1508						animating = true;
1509						UNCODE.menuOpened = false;
1510						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1511							btn.classList.remove('close');
1512							btn.classList.add('closing');
1513						}
1514						$box.addClass('close');
1515						requestTimeout(function() {
1516							$box.removeClass('close');
1517							$box.removeClass('open-items');
1518							btn.classList.remove('closing');
1519							if ($el_transp.length) {
1520								$el_transp.removeClass('is_mobile_open');
1521							}
1522						}, 500);
1523						$body.removeClass('opening-overlay-menu');
1524						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1525							$box.animate({
1526								height: 0
1527							}, {
1528								duration: 600,
1529								easing: "easeInOutCirc",
1530								complete: function(elements) {
1531									$(elements).css('height', '');
1532									animating = false;
1533									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1534										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1535									}
1536									$body.removeClass('open-overlay-menu');
1537									if ( $menuBlock.length ) {
1538										UNCODE.animateSubInside($menuBlock, true);
1539									}
1540								}
1541							});
1542						} else {
1543							animating = false;
1544							offCanvasAnim = setTimeout(function(){
1545								$body.removeClass('open-overlay-menu');
1546								if ( $menuBlock.length ) {
1547									UNCODE.animateSubInside($menuBlock, true);
1548								}
1549							}, 1000);
1550						}
1551					}
1552				};
1553				check = (!UNCODE.menuOpened) ? open() : close();
1554			}
1555		});
1556
1557		$('html').on('click', function(event){
1558			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1559				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1560			}
1561		});
1562
1563		window.addEventListener('menuMobileTrigged', function(e) {
1564			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1565		});
1566		window.addEventListener('orientationchange', function(e) {
1567			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1568		});
1569		window.addEventListener("resize", function() {
1570			if ($(window).width() < UNCODE.mediaQuery) {
1571				if (UNCODE.isMobile) {
1572					var $box = $('.box-container .main-menu-container'),
1573						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1574					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1575						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1576							elHeight = 0;
1577							$.each($el, function(index, val) {
1578								elHeight += $(val).outerHeight();
1579							});
1580							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
1581							$($box).css('height', elHeight + 'px');
1582						}
1583					}
1584				}
1585			} else {
1586				$('.menu-hide-vertical').removeAttr('style');
1587				$('.menu-container-mobile').removeAttr('style');
1588				$('.vmenu-container.menu-container').removeAttr('style');
1589
1590				if ( UNCODE.menuOpened ) {
1591					$('.open-items').removeClass('open-items');
1592					$('.is_mobile_open').removeClass('is_mobile_open');
1593					$('.open-overlay-menu').removeClass('open-overlay-menu');
1594					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1595				}
1596			}
1597		});
1598
1599		$(window).on('scroll', function(){
1600			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1601				$(window).scrollTop(scrolltop);
1602				return false;
1603			}
1604		});
1605
1606	};
1607
1608	function menuOffCanvas() {
1609		var menuClose = new CustomEvent('menuCanvasClose'),
1610			menuOpen = new CustomEvent('menuCanvasOpen');
1611		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1612			if ($(window).width() > UNCODE.mediaQuery) {
1613				if ( $('body.vmenu-offcanvas-overlay').length ) {
1614					if ($(event.currentTarget).hasClass('off-close')) {
1615						$(event.currentTarget).removeClass('off-close');
1616						requestTimeout(function() {
1617							window.dispatchEvent(menuClose);
1618						}, 500);
1619
1620					} else {
1621						$(event.currentTarget).addClass('off-close');
1622						window.dispatchEvent(menuOpen);
1623					}
1624				} else {
1625					if ($(event.currentTarget).hasClass('close')) {
1626						$(event.currentTarget).removeClass('close');
1627						$(event.currentTarget).addClass('closing');
1628						requestTimeout(function() {
1629							$(event.currentTarget).removeClass('closing');
1630							window.dispatchEvent(menuClose);
1631						}, 500);
1632
1633					} else {
1634						$(event.currentTarget).addClass('close');
1635						window.dispatchEvent(menuOpen);
1636					}
1637				}
1638			}
1639
1640			$('body').toggleClass('off-opened');
1641		});
1642
1643		$('body').on('click.menu-off-canvas-mobile', function(e){
1644			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1645				var $vMenuCont = $('#masthead .vmenu-container'),
1646					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1647
1648					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1649					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1650					vmenu_off = $vMenuCont.offset(),
1651					vmenu_l = parseFloat(vmenu_off.left),
1652					vmenu_t = parseFloat(vmenu_off.top),
1653					vmenu_r = vmenu_l + vmenu_w,
1654					vmenu_b = vmenu_t + vmenu_h,
1655
1656					close_h = parseFloat( $close_menu.outerHeight() ),
1657					close_w = parseFloat( $close_menu.outerWidth() ),
1658					close_off = $close_menu.offset(),
1659					close_l = parseFloat(close_off.left),
1660					close_t = parseFloat(close_off.top),
1661					close_r = close_l + close_w,
1662					close_b = close_t + close_h;
1663				if (
1664					!(
1665						e.clientX > vmenu_l &&
1666						e.clientX < vmenu_r
1667					)
1668					||
1669					(
1670						e.clientX > close_l &&
1671						e.clientX < close_r
1672					)
1673				) {
1674					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1675				}
1676			}
1677		});
1678	};
1679
1680	function menuOverlay() {
1681		if ( $('.overlay').length ) {
1682			$('.overlay').removeClass('hidden');
1683		}
1684		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1685			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) {
1686				var transDelay = (index / 20) + 0.1;
1687				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1688					transDelay = transDelay + 0.3;
1689				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1690			});
1691		}
1692	};
1693
1694	// menuToggleAnimation è definita a livello globale (vedi UNCODE.menuToggleAnimation
1695	// più in alto) e il listener 'unblock-toggles-init' viene registrato una sola volta
1696	// al caricamento dello script, così è già attivo quando UNCODE.unBlockMenu() lo lancia.
1697
1698	var $secondary_parent;
1699	function menuAppend() {
1700
1701		var $menuBlock = $('#uncode-mobile-menu-block').length;
1702		if ( $menuBlock ) {
1703			return;
1704		}
1705		var $body = $('body'),
1706			$menuCont = $('.menu-container:not(.vmenu-container)'),
1707			$vMenuCont = $('.menu-container.vmenu-container'),
1708			$cta = $('.navbar-cta'),
1709			$socials = $('.navbar-social:not(.appended-navbar)'),
1710			$ul = $('.navbar-main ul.menu-primary-inner'),
1711			$ulCta,
1712			$ulSocials,
1713			$navLast,
1714			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1715			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1716			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1717			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1718			$ulFirst = $('> ul', $firstNav),
1719			setCTA,
1720			appendCTA = function(){
1721				return true;
1722			},
1723			appendSocials = function(){
1724				return true;
1725			},
1726			appendSplit = function(){
1727				return true;
1728			};
1729
1730		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1731			$ulCta = $('> ul', $cta);
1732			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1733
1734			appendCTA = function(){
1735				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1736					$ul.after($ulCta);
1737				} else {
1738					$cta.append($ulCta);
1739				}
1740			}
1741		}
1742
1743		if ( ! $body.hasClass('cta-not-appended') ) {
1744			appendCTA();
1745		}
1746
1747		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1748		$smartSocial.each(function(){
1749			var $_smartSocial = $(this);
1750			$('> li', $_smartSocial).each(function(){
1751				var $li = $(this);
1752				if ( $li.hasClass('mobile-hidden') ) {
1753					$_smartSocial.addClass('mobile-hidden');
1754				} else {
1755					$_smartSocial.removeClass('mobile-hidden');
1756					return false;
1757				}
1758			});
1759
1760			$('> li', $_smartSocial).each(function(){
1761				var $li = $(this);
1762				if ( $li.hasClass('tablet-hidden') ) {
1763					$_smartSocial.addClass('tablet-hidden');
1764				} else {
1765					$_smartSocial.removeClass('tablet-hidden');
1766					return false;
1767				}
1768			});
1769		});
1770
1771		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1772			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1773			if ( $body.hasClass('hmenu-center-split') ) {
1774				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1775			} else {
1776				$navLast = $('.navbar-nav-last', $vMenuCont);
1777			}
1778
1779			if ( ! $navLast.length ) {
1780				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1781				if ( $body.hasClass('hmenu-center-split') ) {
1782					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1783					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1784				} else {
1785					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1786					$navLast = $('.navbar-nav-last', $vMenuCont);
1787				}
1788			}
1789
1790			appendSocials = function(){
1791				if ( !$body.hasClass('menu-overlay-center') ) {
1792				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1793				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1794				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1795				// 		$ulSocials.each(function(){
1796				// 			var $li_social = $(this);
1797				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1798				// 		});
1799				// 	}
1800				// } else {
1801					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1802						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1803						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1804							$('> ul.menu-smart-social li', $socials).remove();
1805						}
1806						$navLast.append($ulSocials);
1807					} else {
1808						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1809							$('> ul.menu-smart-social li', $navLast).remove();
1810						}
1811						$socials.append($ulSocials);
1812					}
1813				}
1814			}
1815			appendSocials();
1816		}
1817
1818		if ( $vMenuCont.length ) {
1819			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1820		} else {
1821			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1822		}
1823		if ( $accordion_secondary.length ) {
1824			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1825			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1826				if ( !$accordion_secondary_ph.length ) {
1827					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1828				}
1829				if ( $vMenuCont.length ) {
1830					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1831				} else {
1832					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1833						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1834					} else {
1835						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1836					}
1837				}
1838			} else {
1839				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1840					$accordion_secondary_ph.before($accordion_secondary);
1841				}
1842			}
1843		}
1844
1845		if ( $vMenuCont.length ) {
1846			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1847		} else {
1848			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1849		}
1850
1851		if ( $extra_icons.length ) {
1852			if ( $vMenuCont.length ) {
1853				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1854					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1855						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1856							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1857						$not_social.each(function(){
1858							if ( ! $primary_after.length ) {
1859								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1860								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1861								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1862							}
1863							var $extra_li = $(this);
1864							$primary_after.find('> ul').append($extra_li);
1865						});
1866					} else {
1867						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1868							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1869						$not_social.each(function(){
1870							var $extra_li = $(this);
1871							$extra_icons.find('> ul').append($extra_li);
1872						});
1873					}
1874				} /*else {
1875					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1876					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1877						if ( !$extra_icons_ph.length ) {
1878							$extra_icons.after('<span class="extra-icons-ph" />');
1879						}
1880						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1881							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1882						} else {
1883							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1884						}
1885					} else {
1886						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1887							$extra_icons_ph.before($extra_icons);
1888						}
1889					}
1890				}*/
1891			} else {
1892				if ( ! $body.hasClass('hmenu-center-double') ) {
1893					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1894						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1895							$primary_after = $('.nav.navbar-main-after', $menuCont);
1896
1897						if ( ! $primary_after.length && $not_social.length ) {
1898							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1899								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1900							} else {
1901								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1902							}
1903							$primary_after = $('.nav.navbar-main-after', $menuCont);
1904							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1905						}
1906						var tablet_hidden = true,
1907							mobile_hidden = true;
1908						$not_social.each(function(){
1909							var $extra_li = $(this);
1910							$primary_after.find('> ul').append($extra_li);
1911							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1912								tablet_hidden = false;
1913							}
1914							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1915								mobile_hidden = false;
1916							}
1917						});
1918						if ( tablet_hidden === true && $not_social.length ) {
1919							$primary_after.addClass('tablet-hidden');
1920						}
1921						if ( mobile_hidden === true && $not_social.length ) {
1922							$primary_after.addClass('mobile-hidden');
1923						}
1924					} else {
1925						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1926
1927						if ( $primary_after.length ) {
1928							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1929							$not_social.each(function(){
1930								var $extra_li = $(this);
1931								$extra_icons.find('> ul').append($extra_li);
1932							});
1933							$primary_after.remove();
1934						}
1935					}
1936				}
1937			}
1938		}
1939
1940		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1941			appendSplit = function(){
1942				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1943					if ( $extra_icons.length ) {
1944						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1945							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1946								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1947							$not_social.each(function(){
1948								var $extra_li = $(this);
1949								$append_ul.append($extra_li);
1950							});
1951							if ( $secondNav.length ) {
1952								$secondNav.append($append_ul);
1953							} else {
1954								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1955							}
1956						}
1957					}
1958					if ( $secondNav.length ) {
1959						$secondNav.prepend($ulFirst);
1960					} else {
1961						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1962					}
1963					$firstMenu.hide();
1964				} else {
1965					$firstNav.append($ulFirst);
1966					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1967					if ( $append_ul.length ) {
1968						var $not_social = $('> li:not(.social-icon)', $append_ul);
1969						$not_social.each(function(){
1970							var $extra_li = $(this);
1971							$extra_icons.find('> ul').append($extra_li);
1972						});
1973					}
1974					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1975					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1976					$firstMenu.css({
1977						'display': 'table-cell'
1978					});
1979				}
1980			}
1981		}
1982		appendSplit();
1983
1984		$(window).on( 'wwResize', function(){
1985			clearRequestTimeout(setCTA);
1986			setCTA = requestTimeout( function() {
1987				appendCTA();
1988				appendSocials();
1989				appendSplit();
1990			}, 10 );
1991		});
1992	}
1993	//menuMobileButton();
1994	menuMobile();
1995	menuOffCanvas();
1996	menuAppend();
1997	menuOverlay();
1998
1999	var stickyDropdownSearch = function(){
2000		var $masthead = $('#masthead'),
2001			$ddSearch = $('.overlay.overlay-search', $masthead),
2002			$styles = $('#stickyDropdownSearch').remove();
2003		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
2004			var $menuWrapper = $('.menu-wrapper'),
2005				$navbar = $('.menu-container-mobile', $menuWrapper),
2006				navbarH = $navbar.outerHeight(),
2007				//$topbar = $('.top-menu', $menuWrapper),
2008				//topbarH = $topbar.outerHeight(),
2009				_css;
2010
2011			_css = '<style id="stickyDropdownSearch">';
2012			_css += '@media (max-width: 959px) {';
2013			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
2014			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2015			_css += '}';
2016			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2017			_css += 'position: fixed;';
2018			_css += 'top: 0;';
2019			_css += '}';
2020			_css += '</style>';
2021
2022			$(_css).appendTo($('head'));
2023		}
2024	}
2025	stickyDropdownSearch();
2026
2027	var setMenuOverlay;
2028	$(window).on( 'wwResize', function(){
2029		if ( $('.overlay').length && $(window).width() > 1024 ) {
2030			$('.overlay').addClass('hidden');
2031		}
2032		clearRequestTimeout(setMenuOverlay);
2033		setMenuOverlay = requestTimeout( function(){
2034			menuOverlay();
2035			menuAppend();
2036			stickyDropdownSearch();
2037		}, 150 );
2038	});
2039	UNCODE.menuMegaBlock();
2040	UNCODE.menuSmartInit();
2041	$(window).on('wwResize', function(){
2042		UNCODE.menuSmartInit();
2043	});
2044
2045	$(window).on('menuOpen', function(){
2046		var $overlay = $('.overlay.overlay-unblock');
2047		if ( $overlay.length ) {
2048			UNCODE.animateSubInside($overlay);
2049		}
2050	});
2051
2052	$(window).on('menuClosed', function(){
2053		var $overlay = $('.overlay.overlay-unblock');
2054		if ( $overlay.length ) {
2055			UNCODE.animateSubInside($overlay, true);
2056			var $smartMenus = $overlay.find('.menu-smart');
2057			$smartMenus.each(function(key, smartMenu){
2058				$(smartMenu).smartmenus('menuHideAll');
2059			});
2060		}
2061	});
2062};
2063
2064UNCODE.menuSmartInit = function() {
2065	var $menusmart = $('[class*="menu-smart"]'),
2066		$masthead = $('#masthead'),
2067		$hMenu = $('.menu-horizontal-inner', $masthead),
2068		$focus = $('.overlay-menu-focus'),
2069		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2070		showTimeout = 50,
2071		hideTimeout = 50,
2072		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2073
2074	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2075		var menu_anim = $masthead.attr('data-menu-anim');
2076		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2077			$uls_anim.each(function(){
2078				var $ul_anim = $(this);
2079				if ( !$('> li[data-block]', $ul_anim).length ) {
2080					$ul_anim.addClass('animate_when_almost_visible');
2081					$ul_anim.addClass(menu_anim);
2082				} else {
2083					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2084					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2085						$ul_anim.addClass('animate_when_almost_visible');
2086						$ul_anim.addClass(dataB);
2087					}
2088				}
2089			});
2090		} else {
2091			$uls_anim.each(function(){
2092				var $ul_anim = $(this);
2093				if ( !$('> li[data-block]', $ul_anim).length ) {
2094					$ul_anim.removeClass('animate_when_almost_visible');
2095					$ul_anim.removeClass(menu_anim);
2096				} else {
2097					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2098					$ul_anim.removeClass('animate_when_almost_visible');
2099					$ul_anim.removeClass(dataB);
2100				}
2101			});
2102		}
2103	}
2104
2105	$('> li.menu-item-has-children', $menusmart).hover(function(){
2106		$(this).data('hover', true);
2107	}, function(){
2108		$(this).data('hover', false);
2109	});
2110
2111	$('> li.menu-item-has-children', $menusmart).each(function(){
2112		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2113	});
2114
2115	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2116		e.preventDefault();
2117	});
2118
2119	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2120			
2121		var $notLis = $('> .nav > ul > li a', $hMenu),
2122			$menuA = $('a', $masthead).not($notLis),
2123			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2124			showFuncCond = function() { return true };
2125
2126		if ( $('body').hasClass('focus-megamenu') ) {
2127			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2128			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2129		} else if ( $('body').hasClass('focus-links') ) {
2130			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2131		}
2132
2133		$hoverSelector.hover(function(){
2134			clearRequestTimeout(hideTimeoutFunc);
2135			showTimeoutFunc = requestTimeout(function(){
2136				$('body').addClass('navbar-hover');
2137			}, showTimeout*2);
2138		}, function(){
2139			hideTimeoutFunc = requestTimeout(function(){
2140				if ( ! $('.overlay-search.open', $masthead).length ) {
2141					$('body').removeClass('navbar-hover');
2142				}
2143			}, hideTimeout*2);
2144		});
2145	} else {
2146		showFuncCond = function() { return false };
2147	}
2148
2149	if ($menusmart.length > 0) {
2150		var objShowTimeout;
2151		$menusmart.smartmenus({
2152			subIndicators: false,
2153			subIndicatorsPos: 'append',
2154			//subMenusMinWidth: '13em',
2155			showOnClick: SiteParameters.menuShowOnClick,
2156			subIndicatorsText: '',
2157			showTimeout: showTimeout,
2158			hideTimeout: hideTimeout,
2159			scrollStep: 8,
2160			showFunction: function($ul, complete) {
2161				$(document).trigger('un-menu-show', $ul);
2162				clearRequestTimeout(showTimeoutFunc);
2163				$ul.fadeIn(0, 'linear', function(){
2164					complete();
2165					if ( $ul.hasClass('vc_row') ) {
2166						$ul.css({
2167							'display': 'table'
2168						});
2169					}
2170					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2171						$('body').addClass('open-megamenu');
2172					}
2173					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2174						$('body').addClass('navbar-hover');
2175					}
2176					var showed = 0;
2177					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2178						var $element = $(this),
2179							delayAttr = $element.attr('data-delay');
2180						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2181							if (delayAttr == undefined) delayAttr = 0;
2182							requestTimeout(function() {
2183								$element.addClass('start_animation');
2184							}, delayAttr);
2185						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2186							var grid = $element.closest('.cssgrid-animate-sequential');
2187
2188							var delay = index,
2189								delayAttr = parseInt($element.attr('data-delay'));
2190							if (isNaN(delayAttr)) delayAttr = 100;
2191							delay -= showed;
2192							objShowTimeout = requestTimeout(function() {
2193								$element.removeClass('zoom-reverse').addClass('start_animation');
2194								showed = index;
2195							}, delay * delayAttr);
2196						}
2197					});
2198					if ( $ul.is('.animate_when_almost_visible') ) {
2199						$ul.addClass('start_animation');
2200					}
2201				}).addClass('open-animated');
2202			},
2203			hideFunction: function($ul, complete) {
2204				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2205					$('body').removeClass('open-megamenu');
2206				}
2207				var fixIE = $('html.ie').length;
2208				if (fixIE) {
2209					var $rowParent = $($ul).closest('.main-menu-container');
2210					$rowParent.height('auto');
2211				}
2212				$ul.fadeOut(0, 'linear', function(){
2213					complete();
2214					$ul.removeClass('open-animated');
2215					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2216						$('body').removeClass('open-submenu');
2217					}
2218					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2219						$(this).removeClass('start_animation');
2220					});
2221					if ( $ul.is('.animate_when_almost_visible') ) {
2222						$ul.removeClass('start_animation');
2223					}
2224				});
2225				$ul.find('.start_animation').each(function(index, val) {
2226					clearRequestTimeout(subMenuRT);
2227					$(val).removeClass('start_animation');
2228				});
2229				$(document).trigger('un-menu-hide', $ul);
2230				clearRequestTimeout(objShowTimeout);
2231			},
2232			collapsibleShowFunction: function($ul, complete) {
2233				$ul.slideDown(400, 'easeInOutCirc', function(){
2234					UNCODE.animateSubInside($ul);
2235					complete();
2236				});
2237			},
2238			collapsibleHideFunction: function($ul, complete) {
2239				$ul.slideUp(200, 'easeInOutCirc', function(){
2240					complete();
2241				});
2242				$(document).trigger('sub-menu-slide-up');
2243			},
2244			hideOnClick: SiteParameters.menuHideOnClick,
2245		});
2246
2247		if ( $('body').hasClass('menu-accordion-active') ) {
2248			$menusmart.each(function(key, menu){
2249				$(menu).addClass('menu-smart-init');
2250				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2251			});
2252		}
2253
2254		$menusmart.each(function(key, menu){
2255			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2256				if ( $('> .trigger-window-resize', $sub).length ) {
2257					window.dispatchEvent(new Event('resize'));
2258					$(window).trigger('uncode.re-layout');
2259				} else if ( $('> .trigger-box-resize', $sub).length ) {
2260					window.dispatchEvent(new CustomEvent('boxResized'));
2261				}
2262				return false;
2263			});
2264		});
2265		
2266		$(document).on( 'uncode.smartmenu-appended', function(){
2267			requestTimeout(function(){
2268				$menusmart.smartmenus( 'refresh' );
2269			}, 1000);
2270		});
2271
2272	}
2273
2274	$('.main-menu-container').each(function(){
2275		var $main_cont = $(this),
2276			$uls = $('ul:not(.nav-tabs)', $main_cont);
2277
2278		$uls.each(function(){
2279			var $ul = $(this),
2280				mobile_hidden = true,
2281				tablet_hidden = true;
2282			$('> li:not(.hidden)', $ul).each(function(){
2283				if ( !$(this).hasClass('mobile-hidden') ) {
2284					mobile_hidden = false;
2285					return false;
2286				}
2287			});
2288			$('> li:not(.hidden)', $ul).each(function(){
2289				if ( !$(this).hasClass('tablet-hidden') ) {
2290					tablet_hidden = false;
2291					return false;
2292				}
2293			});
2294			if ( mobile_hidden ) {
2295				$ul.addClass('mobile-hidden');
2296			}
2297			if ( tablet_hidden ) {
2298				$ul.addClass('tablet-hidden');
2299			}
2300		});
2301
2302		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2303
2304		$divUlsMB.each(function(){
2305			var $divUlMB = $(this),
2306				div_mobile_hidden = true,
2307				div_tablet_hidden = true;
2308
2309			$('> ul:not(.hidden)', $divUlMB).each(function(){
2310				if ( !$(this).hasClass('mobile-hidden') ) {
2311					div_mobile_hidden = false;
2312					return false;
2313				}
2314			});
2315			$('> ul:not(.hidden)', $divUlMB).each(function(){
2316				if ( !$(this).hasClass('tablet-hidden') ) {
2317					div_tablet_hidden = false;
2318					return false;
2319				}
2320			});
2321			if ( div_mobile_hidden ) {
2322				$divUlMB.addClass('mobile-hidden');
2323			}
2324			if ( div_tablet_hidden ) {
2325				$divUlMB.addClass('tablet-hidden');
2326			}
2327		});
2328	});
2329
2330	var overlaySearchButton = function(){
2331		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2332
2333		$search_wrap.each(function(){
2334			var $form = $('form', this),
2335				$icon = $('i', $form);
2336
2337			$icon.on('click', function(){
2338				$form.submit();
2339			});
2340		});
2341	};
2342	overlaySearchButton();
2343}
2344
2345UNCODE.menuMegaBlock = function() {
2346	var $megaBlocks = $('.megamenu-block-wrapper');
2347	if ( ! $megaBlocks.length ) {
2348		return;
2349	}
2350
2351	$megaBlocks.each(function(){
2352		var $megaLi = $(this),
2353			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2354			dataLi = $megaLi.attr('data-block'),
2355			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2356			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2357		$megaUl.addClass(dataLi);
2358		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2359		$('img', $megaLi).removeAttr('loading');
2360	});
2361}
2362
2363UNCODE.unBlockMenu = function(){
2364	//Menu block
2365	var $unBlockMenus = $('.menu.unmenu-block');
2366
2367	$unBlockMenus.each(function(){
2368		var $unBlockMenu = $(this),
2369			$lastOnes;
2370
2371		if ( !$unBlockMenu.hasClass('first-grid') ) {
2372			$lastOnes = $('ul', $unBlockMenu).last();
2373			$lastOnes.each(function(){
2374                var _cols = $(this).css('grid-template-columns');
2375				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2376					$unBlockMenu.addClass('has-last-ones');
2377					$(this).addClass('last-one');
2378				} else {
2379					var $parentLi = $(this).closest('li'),
2380						$siblingLi = $parentLi.next();
2381					if ( !$siblingLi.length ) {
2382						$unBlockMenu.addClass('has-last-ones');
2383						$(this).addClass('last-one');
2384					}
2385				}
2386			});
2387		} else {
2388			var checkGrids = function(){
2389				$unBlockMenu.find('.last-ul').removeClass('last-one');
2390				var _cols = $unBlockMenu.css('grid-template-columns'),
2391                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2392					$lis = $('> li', $unBlockMenu),
2393					totLi = $lis.length,
2394					lastRowCount = totLi - (totLi % cols || cols),
2395					$lastLis = $lis.slice(cols).addClass('last-lis'),
2396    				$lastRowLis = $lis.slice(lastRowCount);
2397				$lastRowLis.each(function(){
2398					var $lastRowLi = $(this);
2399					$lastRowLi.find('ul').last().addClass('last-one');
2400				});
2401			}
2402			$(window).on('wwResize', checkGrids);
2403			checkGrids();
2404
2405		}
2406
2407	});
2408
2409	//Accordion
2410
2411	var $tgglBlocks = $('.unmenu-collapse');
2412	$tgglBlocks.each(function(key, val){
2413		var $acc = $(val),
2414			$titles = $('.menu-item-has-children > *:first-child', $acc),
2415			run = true;
2416
2417		var checkRun = function(){
2418			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2419				run = false;
2420			} else {
2421				run = true;
2422			}
2423
2424			if ( $titles.length ) {
2425				$titles.each(function(_key, _val){
2426					var $title = $(_val),
2427						$sub = $title.closest('li').find('> ul.un-submenu');
2428
2429					$sub.each(function(key, val){
2430						if ( run ) {
2431
2432							var total = $sub.length;
2433							var completed = 0;
2434				
2435							$(val).slideUp({
2436								duration: 1,
2437								complete: function() {
2438									$(this).addClass('toggle-init');
2439
2440									completed++;
2441
2442									if ( completed === total ) {
2443										$(document).trigger('unblock-toggles-init');
2444										$( document.body ).trigger( 'uncode_waypoints' );
2445									}
2446								}
2447							});
2448						} else {
2449							$(val).show();
2450						}
2451					});
2452				});
2453			} else {
2454				$(document).trigger('unblock-toggles-init');
2455				console.log('check');
2456				$( document.body ).trigger( 'uncode_waypoints' );
2457			}
2458		}
2459		checkRun();
2460
2461		$(window).on('wwResize menuClosed', checkRun);
2462
2463		if ( $titles.length ) {
2464			$titles.each(function(_key, _val){
2465				var $title = $(_val),
2466					$sub = $title.closest('li').find('> ul.un-submenu'),
2467					$menu = $sub.closest('.menu.unmenu-block'),
2468					$ulS;
2469
2470				$title.off('click').on('click', function(e){
2471					e.preventDefault();
2472					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2473					if ( run ) {
2474						if ( $sub.is(':visible') ) {
2475							$sub.slideUp(200, 'easeInOutCirc', function(){
2476								$.each($('.start_animation', $sub), function(index, val) {
2477									var element = $(val);
2478									element.removeClass('start_animation');
2479
2480								});
2481								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2482								$(document).trigger('sub-menu-slide-up');
2483							});
2484						} else {
2485							$ulS.slideUp({
2486								duration: 200,
2487								easing: 'easeInOutCirc',
2488								start: function(){
2489									var _this = $(this);
2490									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2491									$(document).trigger('sub-menu-slide-up');
2492								}
2493							});
2494
2495							$sub.slideDown({
2496								duration: 400,
2497								easing: 'easeInOutCirc',
2498								start: function() {
2499									var _this = $(this);
2500									_this.css('height', 0);
2501									if ( _this.hasClass('is-grid') ) {
2502										_this.css('display','grid');
2503									}
2504
2505									UNCODE.animateSubInside(_this)
2506									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2507								}
2508							});
2509						}
2510
2511					}
2512				});
2513			});
2514
2515			if ( $acc.closest('#masthead').length ) {
2516				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2517					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2518				});
2519			}
2520		}
2521
2522	});
2523	
2524};
2525
2526UNCODE.mobileMenuBlockSkins = function(){
2527	var $mobileBlock = $('#uncode-mobile-menu-block'),
2528		$parentDark = $mobileBlock.closest('.submenu-dark'),
2529		$parentLight = $mobileBlock.closest('.submenu-light');
2530
2531
2532	if ( $parentDark.length ) {
2533		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2534		$cols.each(function(key, val){
2535			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2536		});
2537	}
2538
2539	if ( $parentLight.length ) {
2540		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2541		$cols.each(function(key, val){
2542			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2543		});
2544	}
2545};
2546UNCODE.okvideo = function(ev) {
2547	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2548	$.okvideo = function(options) {
2549		// if the option var was just a string, turn it into an object
2550		if (typeof options !== 'object') options = {
2551			'video': options
2552		};
2553		var base = this;
2554		// kick things off
2555		base.init = function() {
2556			base.options = $.extend({}, $.okvideo.options, options);
2557			// support older versions of okvideo
2558			if (base.options.video === null) base.options.video = base.options.source;
2559			base.setOptions();
2560			var target = base.options.target || $('body');
2561			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2562			var zIndex = base.options.controls === 3 ? -999 : "auto";
2563			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2564				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
2565				if (OKEvents.utils.isMobile()) {
2566					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2567				} else {
2568					if (base.options.controls === 3) {
2569						target.append(mask)
2570					}
2571					if (base.options.adproof === 1) {
2572						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
2573					} else {
2574						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2575					}
2576				}
2577				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2578				if (base.options.playlist.list === null) {
2579					if (base.options.video.provider === 'youtube') {
2580						base.loadYouTubeAPI();
2581					} else if (base.options.video.provider === 'vimeo') {
2582						base.options.volume /= 100;
2583						base.loadVimeoAPI();
2584					}
2585				} else {
2586					base.loadYouTubeAPI();
2587				}
2588			}
2589		};
2590		// clean the options
2591		base.setOptions = function() {
2592			// exchange 'true' for '1' and 'false' for 3
2593			for (var key in this.options) {
2594				if (this.options[key] === true) this.options[key] = 1;
2595				if (this.options[key] === false) this.options[key] = 3;
2596			}
2597			if (base.options.playlist.list === null) {
2598				base.options.video = base.determineProvider();
2599			}
2600			// pass options to the window
2601			$(window).data('okoptions-' + base.options.id, base.options);
2602		};
2603		// insert js into the head and exectue a callback function
2604		base.insertJS = function(src, callback, provider){
2605			var tag;
2606			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2607				delete UNCODE.insertedSripts[src];
2608				var tags = document.getElementsByTagName('script');
2609				for (var i = tags.length; i >= 0; i--){
2610					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2611						tags[i].parentNode.removeChild(tags[i]);
2612					}
2613				}
2614			} else {
2615				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2616					tag = UNCODE.insertedSripts[src];
2617					if (callback){
2618						if (tag.readyState){  //IE
2619							tag.onreadystatechange = function(){
2620								if (tag.readyState === "loaded" ||
2621									tag.readyState === "complete"){
2622									tag.onreadystatechange = null;
2623									callback();
2624								}
2625							};
2626						} else {
2627							$(tag).on('load', callback);
2628						}
2629					}
2630					return;
2631				}
2632			}
2633			tag = document.createElement('script');
2634			if (callback){
2635				if (tag.readyState){  //IE
2636					tag.onreadystatechange = function(){
2637						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2638							tag.onreadystatechange = null;
2639							callback();
2640						}
2641					};
2642				} else {
2643					tag.onload = function() {
2644						callback();
2645					};
2646				}
2647			}
2648			tag.src = src;
2649			var firstScriptTag = document.getElementsByTagName('script')[0];
2650			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2651			if ( ! UNCODE.insertedSripts ) {
2652				UNCODE.insertedSripts = [];
2653			}
2654			UNCODE.insertedSripts[src] = tag;
2655		};
2656		// load the youtube api
2657		base.loadYouTubeAPI = function(callback) {
2658			if ( ev === 'uncode-more-items-loaded' ) {
2659				onYouTubeIframeAPIReady();
2660			} else {
2661				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2662			}
2663		};
2664		base.loadYouTubePlaylist = function() {
2665			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2666		};
2667		// load the vimeo api by replacing the div with an iframe and loading js
2668		base.loadVimeoAPI = function() {
2669			var source = '//player.vimeo.com/video/' + base.options.video.id + '?controls=0&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0',
2670			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2671			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2672			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2673			base.insertJS('//player.vimeo.com/api/player.js', function() {
2674				vimeoPlayerReady(base.options.id);
2675			}, 'vimeo');
2676		};
2677		// is it from youtube or vimeo?
2678		base.determineProvider = function() {
2679			var a = document.createElement('a');
2680			a.href = base.options.video;
2681			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2682				var videoid = a.href.split('/')[3].toString();
2683				var query = videoid.substring(videoid.indexOf('?') + 1);
2684				if (query != '') {
2685					var vars = query.split('&');
2686					for (var i = 0; i < vars.length; i++) {
2687						var pair = vars[i].split('=');
2688						if (pair[0] == 'v') {
2689							videoid = pair[1];
2690						}
2691					}
2692				}
2693				return {
2694					"provider": "youtube",
2695					"id": videoid
2696				};
2697			} else if (/vimeo.com/.test(base.options.video)) {
2698				return {
2699					"provider": "vimeo",
2700					"id": (a.href.split('/')[3].toString()).split('#')[0],
2701				};
2702			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2703				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2704				if (id.length == 11) {
2705					return {
2706						"provider": "youtube",
2707						"id": id.toString()
2708					};
2709				} else {
2710					for (var i = 0; i < base.options.video.length; i++) {
2711						if (typeof parseInt(base.options.video[i]) !== "number") {
2712							throw 'not vimeo but thought it was for a sec';
2713						}
2714					}
2715					return {
2716						"provider": "vimeo",
2717						"id": base.options.video
2718					};
2719				}
2720			} else {
2721				throw "OKVideo: Invalid video source";
2722			}
2723		};
2724		base.init();
2725	};
2726
2727	var checkResize,
2728		newW = UNCODE.wwidth;
2729
2730	$.okvideo.options = {
2731		id: null,
2732		source: null, // Deprecate dis l8r
2733		video: null,
2734		playlist: { // eat ur heart out @brokyo
2735			list: null,
2736			index: 0,
2737			startSeconds: 0,
2738			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2739		},
2740		disableKeyControl: 1,
2741		captions: 0,
2742		loop: 1,
2743		hd: 1,
2744		volume: 0,
2745		adproof: false,
2746		unstarted: null,
2747		onFinished: null,
2748		onReady: null,
2749		onPlay: null,
2750		onPause: null,
2751		buffering: null,
2752		controls: false,
2753		autoplay: true,
2754		annotations: true,
2755		cued: null
2756	};
2757	$.fn.okvideo = function(options) {
2758		options.target = this;
2759		return this.each(function() {
2760			(new $.okvideo(options));
2761		});
2762	};
2763
2764	var checkForVideos = function(){
2765		$(".uncode-video-container.video").each(function(index, el) {
2766			var $this = $(this),
2767				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2768				url = $this.attr('data-video'),
2769				id = $this.attr('data-id'),
2770				cloned = $this.closest('.owl-item');
2771
2772			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2773				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2774					$this.okvideo({
2775						id: id,
2776						source: url.split('#')[0],
2777						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2778						autoplay: 1,
2779						controls: 0,
2780						volume: 0,
2781						adproof: 0,
2782						caller: $this,
2783						hd: 1,
2784						onReady: function(player) {
2785							var getPlayer = player.c || player.h || player,
2786							$iframe,
2787							getContainer = $(getPlayer).closest('.background-element');
2788							if (getContainer.length) {
2789								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2790							}
2791
2792							if ( $this.hasClass('drop-move') ) {
2793
2794								var $iframe = $(getPlayer),
2795									w = parseFloat($iframe.attr('width')),
2796									h = parseFloat($iframe.attr('height')),
2797									ratio = h / w,
2798									setResizeiFto,
2799								resizeiFrame = function(){
2800									var dataW = $this.attr('data-w'),
2801										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2802										newH = newW * ratio;
2803									$iframe.css({
2804										width: newW,
2805										height: newH
2806									});
2807								};
2808								resizeiFrame();
2809								$(window).on( 'load', resizeiFrame );
2810								$(window).on( 'resize', function(){
2811									clearRequestTimeout(setResizeiFto);
2812									setResizeiFto = requestTimeout( function() {
2813										resizeiFrame();
2814									}, 10 );
2815								});
2816
2817							}
2818
2819						}
2820					});
2821				}
2822			}
2823		});
2824	};
2825
2826	checkForVideos();
2827
2828	$(window).on('load', function(){
2829		$('.mejs-fullscreen-button button').on('click', function(){
2830			var $button = $(this),
2831				$stuck = $button.closest('.is_stucked');
2832
2833			if ( $stuck.length ) {
2834				$stuck = $(this).trigger("sticky_kit:detach");
2835				window.scrollTo(0, 0);
2836			}
2837		});
2838	});
2839
2840	var checkVideoResize = function(){
2841		clearRequestTimeout(checkResize);
2842		checkResize = requestTimeout(function(){
2843			if ( newW !== UNCODE.wwidth ) {
2844				newW = UNCODE.wwidth;
2845				checkForVideos();
2846			}
2847		}, 1000);
2848	};
2849
2850	$(window).off('resize', checkVideoResize)
2851	.on( 'resize', checkVideoResize);
2852
2853};
2854
2855$(document).on('uncode-ajax-filtered.videos', function(){
2856	UNCODE.okvideo("uncode-more-items-loaded");
2857});
2858UNCODE.backgroundSelfVideos = function( $ctx ) {
2859
2860	var backgroundSelfVideosInit = function( $ctx ) {
2861		if ( SiteParameters.block_mobile_videos === true ) {
2862			return false;
2863		}
2864		if (typeof MediaElement === "function") {
2865			if ( typeof $ctx === 'undefined' ) {
2866				$ctx = document;
2867			}
2868		
2869			$(".background-video-shortcode", $ctx).each(function(index, el) {
2870				if ( $(this).closest('mediaelementwrapper').length ) {
2871					return true;
2872				}
2873				var $video_el = $(this),
2874					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2875					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2876					video_id = $video_el.attr('id');
2877
2878				if ( SiteParameters.is_frontend_editor ) {
2879					video_id = video_id + '_' + index;
2880					$video_el.attr('id', video_id);
2881				}
2882
2883				var media = new MediaElement(video_id, {
2884					startVolume: 0,
2885					loop: true,
2886					success: function(mediaElement, domObject) {
2887						domObject.volume = 0;
2888						$(mediaElement).data('started', false);
2889						mediaElement.addEventListener('timeupdate', function(e) {
2890							if (!$(e.target).data('started')) {
2891								$(mediaElement).data('started', true);
2892							}
2893						});
2894						mediaElement.addEventListener('loadedmetadata', function(e) {
2895							$('body').removeClass('video-not-supported');
2896							mediaElement.play();
2897						});
2898						if (!UNCODE.isMobile) {
2899							requestTimeout(function() {
2900								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2901							}, 100);
2902						}
2903						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2904							mediaElement.play();
2905						}
2906
2907						if ( $parent_drop_move.length ) {
2908							var setResizeMEto,
2909								resizeMediaElement = function(){
2910								var dataW = $parent_drop_move.attr('data-w'),
2911									videoW = domObject.width,
2912									videoH = domObject.height,
2913									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2914									newH = newW / ( videoW / videoH );
2915
2916								$(domObject).css({
2917									'height': newH,
2918									'width': newW
2919								});
2920							};
2921							$(window).on( 'resize load', function(){
2922								clearRequestTimeout(setResizeMEto);
2923								setResizeMEto = requestTimeout( function() {
2924									resizeMediaElement();
2925								}, 10 );
2926							});
2927						}
2928
2929						mediaElement.addEventListener('play', function() {
2930							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2931							$(mediaElement).closest('#page-header').addClass('video-started');
2932							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2933						}, true);
2934
2935					},
2936					// fires when a problem is detected
2937					error: function() {}
2938				});
2939			});
2940		} else {
2941
2942			if ( typeof $ctx === 'undefined' ) {
2943				$ctx = document;
2944			}
2945		
2946			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2947			Array.from(videos).forEach(function(video_el) {
2948				video_el.addEventListener('loadedmetadata', function(e) {
2949					$('body').removeClass('video-not-supported');
2950					video_el.play();
2951				});
2952				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2953					video_el.muted = true;
2954					video_el.loop = true;
2955					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2956					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2957					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2958					$('body').removeClass('video-not-supported');
2959					video_el.play();
2960				} else {
2961					requestTimeout(function(){
2962                         backgroundSelfVideosInit( $ctx );
2963					}, 1000);
2964				}
2965			});
2966		}
2967	};
2968
2969	backgroundSelfVideosInit( $ctx );
2970
2971	$(document).on('un-menu-show', function(){
2972		setTimeout(function(){
2973			UNCODE.initVideoComponent(document.body, '.un-submenu .uncode-video-container.video:not(.drop-move):not(.fluid-object), .un-submenu .uncode-video-container.self-video:not(.drop-move)');
2974		}, 1);
2975	});
2976
2977
2978	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2979		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2980			var $el = model.view.$el,
2981				shortcode = model.attributes.shortcode;
2982
2983			if (typeof MediaElement === "function") {
2984				backgroundSelfVideosInit( $el );
2985			} else {
2986				backgroundSelfVideosInit( $el[0] );
2987			}
2988		});
2989	}
2990};
2991
2992UNCODE.is_scrolling = false;
2993
2994UNCODE.disableHoverScroll = function() {
2995
2996	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2997		var body = document.body,
2998		timer;
2999
3000		window.addEventListener('scroll', function() {
3001			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
3002			clearRequestTimeout(timer);
3003			if ( body.classList && !body.classList.contains('disable-hover') ) {
3004				body.classList.add('disable-hover');
3005				window.dispatchEvent(new CustomEvent('disable-hover'));
3006			}
3007			UNCODE.is_scrolling = true;
3008
3009			timer = requestTimeout(function() {
3010				if ( body.classList ) {
3011					body.classList.remove('disable-hover');
3012					window.dispatchEvent(new CustomEvent('enable-hover'));
3013				}
3014				UNCODE.is_scrolling = false;
3015			}, delay);
3016		}, false);
3017	}
3018};
3019
3020UNCODE.isotopeLayout = function() {
3021	if ($('.isotope-layout').length > 0) {
3022		var isotopeContainersArray = [],
3023			typeGridArray = [],
3024			layoutGridArray = [],
3025			screenLgArray = [],
3026			screenMdArray = [],
3027			screenSmArray = [],
3028			transitionDuration = [],
3029			$filterItems = [],
3030			$filters = $('.isotope-system .isotope-filters'),
3031			$itemSelector = '.tmb-iso',
3032			$items,
3033			itemMargin,
3034			correctionFactor = 0,
3035			firstLoad = true,
3036			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3037		$('[class*="isotope-container"]').each(function(index) {
3038			var _this = $(this);
3039			var isoData = _this.data(),
3040			$data_lg,
3041			$data_md,
3042			$data_sm;
3043			_this.children('.tmb').addClass('tmb-iso');
3044			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3045			else $data_lg = '1000';
3046			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3047			else $data_md = '600';
3048			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3049			else $data_sm = '480';
3050			screenLgArray.push($data_lg);
3051			screenMdArray.push($data_md);
3052			screenSmArray.push($data_sm);
3053			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3054			if (isoData.type == 'metro') typeGridArray.push(true);
3055			else typeGridArray.push(false);
3056			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3057			else layoutGridArray.push('masonry');
3058			isotopeContainersArray.push(_this);
3059			_this.attr('data-iso-index', index);
3060		});
3061		var colWidth = function(index) {
3062				$(isotopeContainersArray[index]).width('');
3063				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3064					widthAvailable = $(isotopeContainersArray[index]).width(),
3065					columnNum = 12,
3066					columnWidth = 0,
3067					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3068					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3069					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3070					$rowContainer,
3071					paddingRow,
3072					$colContainer,
3073					paddingCol;
3074
3075				if ( consider_menu )
3076					winHeight = winHeight - UNCODE.menuHeight;
3077
3078				if ( data_vp_height === '1' ) {
3079					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3080					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3081					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3082					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3083					winHeight = winHeight - ( paddingRow + paddingCol );
3084				}
3085
3086				if (isPx) {
3087					columnWidth = Math.ceil(widthAvailable / columnNum);
3088					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3089				} else {
3090					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3091				}
3092				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3093				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3094				for (var i = 0, len = $items.length; i < len; i++) {
3095					var $item = $($items[i]),
3096						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3097						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3098						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3099
3100
3101					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3102						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3103					}
3104
3105					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3106						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3107					}
3108
3109					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3110						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3111							switch (parseInt(multiplier_w[1])) {
3112								case (5):
3113								case (4):
3114								case (3):
3115									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3116									multiplier_w[1] = 6;
3117									break;
3118								case (2):
3119								case (1):
3120									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3121									multiplier_w[1] = 3;
3122									break;
3123								default:
3124									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3125									multiplier_w[1] = 12;
3126									break;
3127							}
3128
3129							if (multiplier_w[1] == 2.4) { // 5 columns
3130								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3131								multiplier_w[1] = 6;
3132							}
3133						}
3134					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3135						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3136							switch (parseInt(multiplier_w[1])) {
3137								case (5):
3138								case (4):
3139								case (3):
3140								case (2):
3141								case (1):
3142									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3143									multiplier_w[1] = 6;
3144									break;
3145								default:
3146									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3147									multiplier_w[1] = 12;
3148									break;
3149							}
3150
3151							if (multiplier_w[1] == 2.4) { // 5 columns
3152								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3153								multiplier_w[1] = 6;
3154							}
3155						}
3156					} else if (widthAvailable < screenSmArray[index]) {
3157						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3158							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3159							multiplier_w[1] = 12;
3160							if (typeGridArray[index]) multiplier_h[1] = 12;
3161						}
3162					}
3163					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3164						height;
3165
3166					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3167						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3168						if ( widthAvailable < screenSmArray[index] ) {
3169							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3170						}
3171					} else {
3172						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3173					}
3174
3175					if (width >= widthAvailable) {
3176						$item.css({
3177							width: widthAvailable
3178						});
3179						if (typeGridArray[index]) {
3180							$item.children().add($item.find('.backimg')).css({
3181								height: height
3182							});
3183						}
3184					} else {
3185						$item.css({
3186							width: width
3187						});
3188						if (typeGridArray[index]) {
3189							$item.children().add($item.find('.backimg')).css({
3190								height: height
3191							});
3192						}
3193					}
3194				}
3195				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3196					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3197				} else {
3198					return columnWidth;
3199				}
3200			},
3201			init_isotope = function() {
3202				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3203					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3204						isotopeId = isotopeSystem.attr('id'),
3205						$layoutMode = layoutGridArray[i],
3206						setIsotopeFirstRowTimeOut,
3207					setIsotopeFirstRow = function(items){
3208						var firstRow = true;
3209						$(items).each(function(index, val){
3210							var el = items[index].element,
3211								el_top = items[index].position.y,
3212								$el = $(el);
3213							if ( index > 0 && el_top > 0 && firstRow ) {
3214								firstRow = false;
3215							} else if ( index == 0 && el_top == 0 ) {
3216								firstRow = true;
3217							}
3218							if ( firstRow ) {
3219								$el.removeClass('tmb-isotope-further-row');
3220							} else {
3221								$el.addClass('tmb-isotope-further-row');
3222							}
3223						});
3224					};
3225					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3226						//resizable: true,
3227						itemSelector: $itemSelector,
3228						layoutMode: $layoutMode,
3229						transitionDuration: transitionDuration[i],
3230						masonry: {
3231							columnWidth: colWidth(i)
3232						},
3233						vertical: {
3234							horizontalAlignment: 0.5,
3235						},
3236						sortBy: 'original-order',
3237						isOriginLeft: isOriginLeft
3238					})
3239					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3240					.on('layoutComplete', function( event, items ){
3241						if ( typeof items[0] !== 'undefined' ) {
3242							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3243								setIsotopeFirstRow(items);
3244							}
3245						}
3246					})
3247					.on('arrangeComplete', function( event, items ){
3248						if ( typeof items[0] !== 'undefined' ) {
3249							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3250								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3251								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3252									setIsotopeFirstRow(items);
3253								}, 100);
3254							}
3255						}
3256					});
3257					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3258						$(isotopeContainersArray[i]).infinitescroll({
3259								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3260								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3261								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3262								animate: false,
3263								behavior: 'local',
3264								debug: false,
3265								loading: {
3266									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3267									speed: 0,
3268									finished: undefined,
3269									msg: $('#' + isotopeId + ' .loadmore-button'),
3270								},
3271								errorCallback: function() {
3272									var isotope_system = $(this).closest('.isotope-system');
3273									$('.loading-button', isotope_system).hide();
3274									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3275								}
3276							},
3277							// append the new items to isotope on the infinitescroll callback function.
3278							function(newElements, opts) {
3279								var $isotope = $(this),
3280									isotope_system = $isotope.closest('.isotope-system'),
3281									isotopeId = isotope_system.attr('id'),
3282									filters = new Array(),
3283									$loading_button = isotope_system.find('.loading-button'),
3284									$infinite_button = isotope_system.find('.loadmore-button'),
3285									$numPages = $('a', $infinite_button).data('pages'),
3286									$woo_results,
3287									delay = 300;
3288								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3289								if ($isotope.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
3290									$infinite_button.show();
3291								} else {
3292									$infinite_button.hide();
3293								}
3294								$loading_button.hide();
3295								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3296								$('> li', $isotope).remove();
3297								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3298								$.each($(newElements), function (index, val) {
3299									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3300										$woo_results = $(val);
3301										delete newElements[index];
3302									} else {
3303										$(val).addClass('tmb-iso');
3304										if ($(val).is("li")) {
3305											filters.push($(val)[0]);
3306										}
3307									}
3308									$(val).addClass('uncode-appended');
3309								});
3310								newElements = newElements.filter(function(x) {
3311									return filters.indexOf(x) < 0
3312								});
3313								$.each($(filters), function(index, val) {
3314									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3315								});
3316								if ($woo_results && $woo_results.length > 0) {
3317									var old_count = isotope_system.find('.woocommerce-result-count').text();
3318									var new_count = $woo_results.find('.woocommerce-result-count').text();
3319									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3320									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3321									function replaceMatch(match, p1, p2) {
3322        								return old_start + '–' + new_end;
3323									}
3324									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3325									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3326								}
3327								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3328								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3329									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3330									if (typeof getLightbox === 'object') {
3331										getLightbox.refresh();
3332									} else {
3333										UNCODE.lightbox();
3334									}
3335								}
3336								if ( typeof twttr !== 'undefined' )
3337									twttr.widgets.load(isotopeContainersArray[i]);
3338
3339								requestTimeout(function() {
3340									Waypoint.refreshAll();
3341									$isotope.trigger('more-items-loaded');
3342									$(window).trigger('more-items-loaded');
3343									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3344									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3345										$(document).trigger('uncode-scrolltrigger-refresh');
3346									}
3347									fillIfNotScrollable($isotope);
3348								}, 1000);
3349
3350							});
3351						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3352							var $infinite_isotope = $(isotopeContainersArray[i]),
3353								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3354							$infinite_isotope.infinitescroll('pause');
3355							$infinite_button.on('click', function(event) {
3356								event.preventDefault();
3357								var $infinite_system = $(event.target).closest('.isotope-system'),
3358								$infinite_isotope = $infinite_system.find('.isotope-container'),
3359								isotopeId = $infinite_system.attr('id');
3360								$(event.currentTarget).html(SiteParameters.loading);
3361								$infinite_isotope.infinitescroll('resume');
3362								$infinite_isotope.infinitescroll('retrieve');
3363								$infinite_isotope.infinitescroll('pause');
3364							});
3365						}
3366						(function ($c) {
3367							requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
3368						})($(isotopeContainersArray[i]));
3369					}
3370				}
3371			},
3372			fillIfNotScrollable = function ($container) {
3373				if ($container.hasClass('isotope-infinite-button')) {
3374					return
3375				};
3376				if (!$container.hasClass('isotope-infinite')) {
3377					return
3378				};
3379				var infData = $container.data('infinitescroll');
3380				if (!infData || !infData.options || !infData.options.state) {
3381					return
3382				};
3383				var state = infData.options.state;
3384				if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPau
3384sed) {
3385					return
3386				};
3387				var $loadMoreA = $container.closest('.isotope-system').find('.loadmore-button a');
3388				var numPages = parseInt($loadMoreA.data('pages'), 10);
3389				if (!numPages || state.currPage >= numPages) {
3390					return
3391				};
3392				if (document.documentElement.scrollHeight > window.innerHeight + 1) {
3393					return
3394				};
3395				console.log('fillIfNotScrollable');
3396				$container.infinitescroll('retrieve');
3397			},
3398			onLayout = function(isotopeObj, startIndex, needsReload) {
3399				var needsReload = needsReload ? true : false;
3400
3401				if (typeof UNCODE.bigText !== 'undefined') {
3402					UNCODE.bigText();
3403				}
3404				isotopeObj.css('opacity', 1);
3405				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3406
3407				requestTimeout(function() {
3408					if (startIndex > 0) {
3409						reloadIsotope(isotopeObj);
3410						if (SiteParameters.dynamic_srcset_active === '1') {
3411							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3412							UNCODE.adaptive_srcset(isotopeObj);
3413						}
3414						// window.dispatchEvent(UNCODE.boxEvent);
3415					} else if (needsReload) {
3416						reloadIsotope(isotopeObj);
3417					}
3418
3419					UNCODE.adaptive();
3420					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3421						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3422					}
3423					if (typeof MediaElement === "function") {
3424						$(isotopeObj).find('audio,video').each(function() {
3425							$(this).mediaelementplayer({
3426	 							pauseOtherPlayers: false,
3427							});
3428						});
3429					}
3430					if ($(isotopeObj).find('.nested-carousel').length) {
3431						if (typeof UNCODE.carousel !== 'undefined') {
3432							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3433						}
3434						requestTimeout(function() {
3435							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3436						}, 200);
3437					} else {
3438						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3439					}
3440					isotopeObj.trigger('isotope-layout-complete');
3441
3442				}, 100);
3443
3444			},
3445			boxAnimation = function(items, startIndex, sequential, container) {
3446				var $allItems = items.length - startIndex,
3447					showed = 0,
3448					index = 0;
3449				if (container.closest('.owl-item').length == 1) return false;
3450				$.each(items, function(index, val) {
3451					var $this = $(val),
3452						elInner = $('> .t-inside', val);
3453					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3454						return;
3455					}
3456					if (val[0]) val = val[0];
3457					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3458						new Waypoint({
3459							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3460							element: val,
3461							handler: function() {
3462								var element = $('> .t-inside', this.element),
3463									parent = $(this.element),
3464									currentIndex = parent.index();
3465								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3466									delayAttr = parseInt(element.attr('data-delay'));
3467								if (isNaN(delayAttr)) delayAttr = 100;
3468								delay -= showed;
3469								var objTimeout = requestTimeout(function() {
3470									element.removeClass('zoom-reverse').addClass('start_animation');
3471									showed = parent.index();
3472									if ( container.data('isotope') ) {
3473										container.isotope('layout');
3474									}
3475								}, delay * delayAttr)
3476								parent.data('objTimeout', objTimeout);
3477								if (!UNCODE.isUnmodalOpen) {
3478									this.destroy();
3479								}
3480							},
3481							offset: '100%'
3482						})
3483					} else {
3484						if (elInner.hasClass('force-anim')) {
3485							elInner.addClass('start_animation');
3486						} else {
3487							elInner.css('opacity', 1);
3488						}
3489						container.isotope('layout');
3490					}
3491
3492					index++;
3493				});
3494			},
3495			reloadIsotope = function(isotopeObj) {
3496				var isoIndex = $(isotopeObj).attr('data-iso-index');
3497				var $layoutMode = ($(isotopeObj).data('layout'));
3498				if ($layoutMode === undefined) {
3499					$layoutMode = 'masonry';
3500				}
3501				if (isotopeObj.data('isotope')) {
3502					isotopeObj.isotope({
3503						itemSelector: $itemSelector,
3504						layoutMode: $layoutMode,
3505						transitionDuration: transitionDuration[isoIndex],
3506						masonry: {
3507							columnWidth: colWidth(isoIndex)
3508						},
3509						vertical: {
3510							horizontalAlignment: 0.5,
3511						},
3512						sortBy: 'original-order',
3513						isOriginLeft: isOriginLeft
3514					});
3515				}
3516			}
3517			;
3518		if ($('.isotope-pagination').length > 0) {
3519			$('.isotope-system').on('click', '.pagination a', function(evt) {
3520				evt.preventDefault();
3521
3522				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3523					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3524						container = $(this).closest('.isotope-system'),
3525						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3526						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3527					calc_scroll -= UNCODE.get_scroll_offset();
3528
3529					if ( pagination_disable_scroll !== 'disabled' ) {
3530						var menu_container = $('.menu-sticky');
3531						var menu = menu_container.find('.menu-container');
3532
3533						if (menu_container.length > 0 && menu.length > 0) {
3534							calc_scroll = calc_scroll - menu.outerHeight();
3535						}
3536
3537						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3538							delta = bodyTop - calc_scroll,
3539							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3540						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3541
3542						if (!UNCODE.isFullPage) {
3543							if (scrollSpeed == 0) {
3544								$('html, body').scrollTop(calc_scroll);
3545							} else {
3546								$('html, body').animate({
3547									scrollTop: calc_scroll
3548								}, {
3549									easing: 'easeInOutQuad',
3550									duration: scrollSpeed,
3551									complete: function () {
3552										UNCODE.scrolling = false;
3553									}
3554								});
3555							}
3556						}
3557					}
3558				}
3559
3560				loadIsotope($(this), true);
3561			});
3562		}
3563		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3564			if ($(this).hasClass('no-isotope-filter')) {
3565				return;
3566			}
3567			var $filter = $(this),
3568				filterContainer = $filter.closest('.isotope-filters'),
3569				filterValue = $filter.attr('data-filter'),
3570				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3571				transitionDuration = container.data().isotope.options.transitionDuration,
3572				delay = 300,
3573				filterItems = [];
3574
3575			var filter_items = function(){
3576				if (filterValue !== undefined) {
3577					container.addClass('grid-filtering');
3578					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3579						var parent = $(val).parent(),
3580							objTimeout = parent.data('objTimeout');
3581						if (objTimeout) {
3582							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3583							clearRequestTimeout(objTimeout);
3584						}
3585						if (transitionDuration == 0) {
3586							if ($(val).hasClass('animate_when_almost_visible')) {
3587								$(val).addClass('zoom-reverse').removeClass('start_animation');
3588							} else {
3589								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3590							}
3591						}
3592					});
3593					requestTimeout(function(){
3594						if ( filterValue == '*' ) {
3595							container.removeClass('isotope-filtered');
3596						} else {
3597							container.addClass('isotope-filtered');
3598						}
3599						container.isotope({
3600							filter: function() {
3601								var block = $(this),
3602								filterable = (filterValue == '*') || block.hasClass(filterValue),
3603								lightboxElements = $('[data-lbox^=ilightbox]', block);
3604								if (filterable) {
3605									if (lightboxElements.length) {
3606										lightboxElements.removeClass('lb-disabled');
3607										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3608									}
3609									filterItems.push(block);
3610								} else {
3611									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3612								}
3613								container.trigger('more-items-loaded');
3614								$(window).trigger('more-items-loaded');
3615								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3616								return filterable;
3617							}
3618						});
3619						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3620
3621					}, delay);
3622
3623					/** once filtered - start **/
3624					container.isotope('once', 'arrangeComplete', function() {
3625						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3626							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3627							if (typeof getLightbox === 'object') {
3628								getLightbox.refresh();
3629							} else {
3630								UNCODE.lightbox();
3631							}
3632						}
3633						if (transitionDuration == 0) {
3634							requestTimeout(function() {
3635								boxAnimation(filterItems, 0, false, container);
3636							}, 100);
3637						}
3638						requestTimeout(function() {
3639							Waypoint.refreshAll();
3640							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3641								$(document).trigger('uncode-scrolltrigger-refresh');
3642							}
3643							container.removeClass('grid-filtering');
3644						}, 2000);
3645						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
3646					});
3647					/** once filtered - end **/
3648				} else {
3649					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3650						$.each(UNCODE.lightboxArray, function(index, val) {
3651							UNCODE.lightboxArray[index].destroy();
3652						});
3653					}
3654					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3655						var parent = $(val).parent(),
3656							objTimeout = parent.data('objTimeout');
3657						if (objTimeout) {
3658							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3659							clearRequestTimeout(objTimeout);
3660						}
3661						if (transitionDuration == 0) {
3662							if ($(val).hasClass('animate_when_almost_visible')) {
3663								$(val).addClass('zoom-reverse').removeClass('start_animation');
3664							} else {
3665								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3666							}
3667						}
3668					});
3669					container.parent().addClass('grid-loading');
3670					loadIsotope($filter);
3671				}
3672			};
3673
3674			if (!$filter.hasClass('active')) {
3675				/** Scroll top with filtering */
3676				if (filterContainer.hasClass('filter-scroll')) {
3677                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3678                    calc_scroll -= UNCODE.get_scroll_offset();
3679
3680					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3681						delta = bodyTop - calc_scroll,
3682						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3683						filterTolerance = false,
3684						filter_timeout;
3685					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3686
3687					if ( !UNCODE.isFullPage ) {
3688						if (scrollSpeed == 0) {
3689							$('html, body').scrollTop(calc_scroll);
3690							UNCODE.scrolling = false;
3691							filter_items();
3692						} else {
3693
3694							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3695								filter_items();
3696								filterTolerance = true;
3697							}
3698
3699							$('html, body').animate({
3700								scrollTop: calc_scroll
3701							},{
3702								easing: 'easeInOutQuad',
3703								duration: scrollSpeed,
3704								complete: function(){
3705									UNCODE.scrolling = false;
3706									if ( !filterTolerance ) {
3707										filter_timeout = setTimeout(function(){
3708											clearTimeout(filter_timeout);
3709											filter_items();
3710										}, 200);
3711									}
3712								}
3713							});
3714						}
3715					}
3716				} else {
3717					filter_items();
3718				}
3719			}
3720			evt.preventDefault();
3721		});
3722
3723		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3724			var params = UNCODE.getURLParams(window.location);
3725			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3726
3727			UNCODE.lastURL = window.location.href;
3728
3729			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3730				return;
3731			}
3732
3733			if (params.id === undefined) {
3734				$.each($('.isotope-system'), function(index, val) {
3735					loadIsotope($(val));
3736				});
3737			} else {
3738				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3739					loadIsotope($('#' + params.id));
3740				}
3741			}
3742		});
3743
3744		var loadIsotope = function($href, $paginating) {
3745			var is_paginating = false;
3746
3747			if (undefined !== $paginating && $paginating) {
3748				var is_paginating = $paginating;
3749			}
3750
3751			var href = ($href.is("a") ? $href.attr('href') : location),
3752				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3753				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3754				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3755				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3756				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3757				isotopeId = isotopeSystem.attr('id');
3758			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3759				UNCODE.lastURL = href;
3760				history.pushState({
3761					myIsotope: true
3762				}, document.title, href);
3763			}
3764			if (is_paginating) {
3765				isotopeWrapper.addClass('grid-filtering');
3766			}
3767			$.ajax({
3768				url: href
3769			}).done(function(data) {
3770				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3771					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3772					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3773				isotopeWrapper.addClass('isotope-reloaded');
3774				requestTimeout(function() {
3775					isotopeWrapper.removeClass('grid-loading');
3776					isotopeWrapper.removeClass('isotope-reloaded');
3777					isotopeWrapper.removeClass('grid-filtering');
3778				}, 500);
3779				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3780					var parent = $(val).parent(),
3781						objTimeout = parent.data('objTimeout');
3782					if (objTimeout) {
3783						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3784						clearRequestTimeout(objTimeout);
3785					}
3786					if ($(val).hasClass('animate_when_almost_visible')) {
3787						$(val).addClass('zoom-reverse').removeClass('start_animation');
3788					} else {
3789						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3790					}
3791				});
3792				requestTimeout(function() {
3793					if (isotopeContainer.data('isotope')) {
3794						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3795						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3796						UNCODE.adaptive();
3797						if (SiteParameters.dynamic_srcset_active === '1') {
3798							UNCODE.adaptive_srcset(isotopeContainer);
3799						}
3800						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3801							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3802							if (typeof getLightbox === 'object') {
3803								getLightbox.refresh();
3804							} else {
3805								UNCODE.lightbox();
3806							}
3807						}
3808					}
3809					isotopeContainer.trigger('more-items-loaded');
3810					$(window).trigger('more-items-loaded');
3811					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3812				}, 300);
3813				$('.pagination', isotopeFooter).remove();
3814				isotopeFooter.append($resultPagination);
3815
3816				if (isotopeResultCount.length > 0) {
3817					$('.woocommerce-result-count', isotopeResultCount).remove();
3818					isotopeResultCount.append($resultCount);
3819				}
3820			});
3821		};
3822		$filters.each(function(i, buttonGroup) {
3823			var $buttonGroup = $(buttonGroup);
3824			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3825				$buttonGroup.find('.active').removeClass('active');
3826				$(this).addClass('active');
3827
3828			});
3829
3830			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3831				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3832				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3833			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3834				e.preventDefault();
3835				$cats_filters.slideToggle(400, 'easeInOutCirc');
3836			});
3837
3838		});
3839		window.addEventListener('boxResized', function(e) {
3840			if (UNCODE.printDialogOpen !== false) {
3841				return false;
3842			}
3843			$.each($('.isotope-layout'), function(index, val) {
3844				var $layoutMode = ($(this).data('layout'));
3845				if ($layoutMode === undefined) $layoutMode = 'masonry';
3846				if ($(this).data('isotope')) {
3847					$(this).isotope({
3848						itemSelector: $itemSelector,
3849						layoutMode: $layoutMode,
3850						transitionDuration: transitionDuration[index],
3851						masonry: {
3852							columnWidth: colWidth(index)
3853						},
3854						vertical: {
3855							horizontalAlignment: 0.5,
3856						},
3857						sortBy: 'original-order',
3858						isOriginLeft: isOriginLeft
3859					});
3860					$(this).isotope('unbindResize');
3861					if (SiteParameters.dynamic_srcset_active === '1') {
3862						UNCODE.refresh_dynamic_srcset_size($(this));
3863					}
3864				}
3865				$(this).find('.mejs-video,.mejs-audio').each(function() {
3866					$(this).trigger('resize');
3867				});
3868			});
3869		}, false);
3870
3871		init_isotope();
3872	};
3873}
3874
3875UNCODE.lightbox = function() {
3876	if ( SiteParameters.lbox_enhanced ) {
3877		return true;
3878	}
3879	UNCODE.lightboxArray = {};
3880	requestTimeout(function() {
3881		var groupsArr = {};
3882		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3883			var group = this.getAttribute("data-lbox"),
3884				values = $(this).data();
3885			$(this).attr('data-lbox-init','true')
3886			groupsArr[group] = values;
3887		});
3888		for (var i in groupsArr) {
3889			var skin = groupsArr[i].skin || 'black',
3890				path = groupsArr[i].dir || 'horizontal',
3891				thumbs = !groupsArr[i].notmb || false,
3892				arrows = !groupsArr[i].noarr || false,
3893				social = groupsArr[i].social || false,
3894				deeplink = groupsArr[i].deep || false,
3895				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3896				counter = $els.length,
3897				dataAlbum = $els.attr('data-album');
3898			if (social) social = {
3899				facebook: true,
3900				twitter: true,
3901				reddit: true,
3902				digg: true
3903			};
3904			UNCODE.lightboxArray[i] = $els.iLightBox({
3905				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3906				skin: skin,
3907				path: path,
3908				linkId: deeplink,
3909				infinite: false,
3910				//fullViewPort: 'fit',
3911				smartRecognition: false,
3912				fullAlone: true,
3913				maxScale: 1,
3914				minScale: .02,
3915				//fullStretchTypes: 'flash, video',
3916				overlay: {
3917					opacity: .94
3918				},
3919				controls: {
3920					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3921					fullscreen: true,
3922					thumbnail: thumbs,
3923					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3924				},
3925				show: {
3926					speed: 200
3927				},
3928				hide: {
3929					speed: 200
3930				},
3931				social: {
3932					start: false,
3933					buttons: social
3934				},
3935				caption: {
3936					start: false
3937				},
3938				styles: {
3939					nextOpacity: 1,
3940					nextScale: 1,
3941					prevOpacity: 1,
3942					prevScale: 1
3943				},
3944				effects: {
3945					switchSpeed: 400
3946				},
3947				slideshow: {
3948					pauseTime: 5000
3949				},
3950				thumbnails: {
3951					maxWidth: 60,
3952					maxHeight: 60,
3953					activeOpacity: .2
3954				},
3955				html5video: {
3956					preload: true
3957				},
3958				callback: {
3959					onOpen: function(){
3960						$(window).trigger('uncode-custom-cursor');
3961						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3962							iNoBounce.enable();
3963						}
3964					},
3965					onHide: function(){
3966						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3967							iNoBounce.disable()
3968						}
3969					},
3970				}
3971			});
3972
3973			$(document).on('infinite-loaded', function(){
3974				UNCODE.lightboxArray[i].refresh();
3975			});
3976
3977			$(window).on('gdprOpen', function(){
3978				UNCODE.lightboxArray[i].close();
3979			});
3980		};
3981	}, 100);
3982
3983	$(document).on('click', '.lb-disabled', function(e){
3984		e.preventDefault();
3985	});
3986};
3987
3988UNCODE.lightgallery = function( $el ) {
3989	if (!document._uncodeMarqueeGalleryBind) {
3990		document._uncodeMarqueeGalleryBind = true;
3991
3992		$(document).on('uncode-marquee-updated', function(e, data){
3993			if (!data || !data.context) return;
3994
3995			var $context = $(data.context);
3996
3997			var $targets = $context.find('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel')
3998				.add($context.filter('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel'));
3999
4000			if (!$targets.length) {
4001				$targets = $context.closest('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel');
4002			}
4003
4004			if (!$targets.length) return;
4005
4006			$targets.each(function(){
4007				$(this).removeAttr('data-lbox-init');
4008				$(this).find('[data-lbox-init]').removeAttr('data-lbox-init');
4009			});
4010
4011			UNCODE.lightgallery($targets);
4012		});
4013	}
4014
4015	var createSelectors = function(){
4016		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
4017			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4018				$(this).addClass('lbox-trigger-item');
4019			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4020				$(this).addClass('lbox-nested-item');
4021			} else {
4022				$(this).removeClass('lbox-trigger-item');
4023				$(this).removeClass('lbox-nested-item');
4024			}
4025		});
4026	};
4027
4028	createSelectors();
4029
4030	var galleries = [],
4031		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4032			return !$(this).closest('.nested-carousel').length;
4033		}),
4034		$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .linear-container:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box .icon-box-icon:not([data-lbox-init]), .icon-box .icon-box-content:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container:not([data-lbox-init])' + SiteParameters.uncode_lb_add_galleries).has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *, .linear-container *'), 
4035		$galleries = $_galleries.filter(function( index ) {
4036			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4037		}),
4038		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
4039
4040	if ( typeof $el === 'undefined' ) {
4041		$el = $galleries.add( $nested );
4042	}
4043
4044	var $disabled = $('a.lb-disabled');
4045	$disabled.on('click', function(e){
4046		e.preventDefault();
4047	});
4048
4049	var beforeSlide = function(event) {
4050		var detail = event.detail,
4051			info = detail.info,
4052			item = detail.item,
4053			$slide = $(detail.currentSlide.selector),
4054			$video = $('video', $slide),
4055			$previous = $(detail.previousSlide.selector),
4056			$prevVideo = $('video', $previous),
4057			isAudio = false;
4058
4059		if ( typeof info.src !== 'undefined' ) {
4060			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
4061		}
4062
4063		if ( ! $video.length && ( info.video || isAudio ) ) {
4064			if ( info.video ) {
4065				if ( typeof info.video === 'object' ) {
4066					var infoJson = info.video;
4067				} else {
4068					var infoJson = JSON.parse(info.video);
4069				}
4070				var src = infoJson.source[0].src,
4071					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
4072					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
4073					loop = $(item).attr('data-loop');
4074
4075			} else if ( isAudio ) {
4076				var src = info.src,
4077					autoplay = true,
4078					loop = false;
4079			}
4080			if ( typeof src !== 'undefined' ) {
4081				$slide.addClass('has-html5');
4082				var video = document.createElement('video');
4083				video.src = src;
4084				video.preload = 'auto';
4085				video.controls = 'controls';
4086				video.controlsList = 'nodownload';
4087				if ( autoplay ) {
4088					video.autoplay = 'autoplay';
4089				}
4090				if ( muted ) {
4091					video.muted = 'muted';
4092				}
4093				if ( loop ) {
4094					video.loop = 'loop';
4095				}
4096				$(video).appendTo($slide);
4097			}
4098		} else {
4099			var $video = $('video', $slide);
4100			if ( $video.length ) {
4101				$video[0].currentTime = 0;
4102				if ( $video[0].autoplay ) {
4103					$video[0].play();
4104				}
4105			}
4106		}
4107		if ( $prevVideo.length ) {
4108			$prevVideo[0].currentTime = 0;
4109			$prevVideo[0].pause();
4110		}
4111	};
4112
4113	var beforeOpen = function(event) {
4114		var detail = event.detail,
4115			items = detail.items,
4116			galleryItems = detail.galleryItems,
4117			outer = detail.outer.selector,
4118			i, ii;
4119		for ( i = 0; i < galleryItems.length; i++ ) {
4120			var item = galleryItems[i];
4121			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4122				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4123			}
4124		}
4125		for ( ii = 0; ii < items.length; ii++ ) {
4126			var item = items[ii];
4127			if ( $(item).attr('data-icon') === 'video' ) {
4128				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4129			}
4130		}
4131
4132	};
4133
4134	//caption builder
4135	var captionBuilder = function($el){
4136		$el.each( function( index, val ) {
4137			var $gallery = $(this).attr('data-lbox-init','true'),
4138				$_a = '.lbox-trigger-item',
4139				$_nested_a = '.lbox-nested-item';
4140
4141			$gallery.find($_a).add($_nested_a).each(function(){
4142				var $a = $(this),
4143					$img = $('img', $a).first(),
4144					imgw = $img.attr('data-width'),
4145					imgh = $img.attr('data-height'),
4146					caption = $a.attr('data-caption'),
4147					title = $a.attr('data-title');
4148
4149				if ( $img.length && $img.attr('data-crop') != true ) {
4150					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4151						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4152					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4153						$a.attr('data-external-thumb-image', $img[0].src);
4154					}
4155				}
4156
4157				if ( typeof title !== 'undefined' && title !== '' ) {
4158					title = '<h6>' + title + '</h6>';
4159				} else {
4160					title = '';
4161				}
4162
4163				if ( typeof caption !== 'undefined' && caption !== '' ) {
4164					caption = '<p>' + caption + '</p>';
4165					title += caption;
4166				}
4167
4168				if ( title !== '' ) {
4169					$a.attr( 'title', title );
4170				}
4171
4172				if ( $img.attr('data-crop') != true && typeof imgw !== 'undefined' && typeof imgh !== 'undefined' && imgw !== '' && imgh !== '' && ( typeof $a.attr('data-lg-size') === 'undefined' || !$a.attr('data-lg-size') ) ) {
4173					$a.attr('data-lg-size', imgw + '-' + imgh);
4174				}
4175			});
4176		});
4177	};
4178	captionBuilder($el);
4179
4180	//regular galleries
4181	$el.each( function( index, val ) {
4182		var $gallery = $(this),
4183			$_a = '.lbox-trigger-item',
4184			$_nested_a = '.lbox-nested-item',
4185			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4186			galleryID = $_first.attr('data-lbox'),
4187			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4188			tmb = $_first.attr('data-notmb'),
4189			social = $_first.attr('data-social'),
4190			deep = $_first.attr('data-deep'),
4191			zoom = $_first.attr('data-zoom-origin'),
4192			actual = $_first.attr('data-actual-size'),
4193			download = $_first.attr('data-download'),
4194			controls = $_first.attr('data-arrows') !== 'no',
4195			fullScreen = $_first.attr('data-full'),
4196			counter = $_first.attr('data-counter'),
4197			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4198			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4199			connect = $_first.attr('data-connect'),
4200			lgPlugins = [lgVideo],
4201			itemsLoadedTimeOut;
4202
4203		if ( typeof galleryID === 'undefined' ) {
4204			galleryID = $gallery.attr('id');
4205		}
4206
4207		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4208		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4209
4210		if ( typeof tmb == 'undefined' || !tmb ) {
4211			lgPlugins.push(lgThumbnail);
4212		}
4213		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4214			lgPlugins.push(lgZoom);
4215		}
4216		if ( typeof deep != 'undefined' && deep != '' ) {
4217			lgPlugins.push(lgHash);
4218		}
4219		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4220			lgPlugins.push(lgFullscreen);
4221		}
4222		if ( social ) {
4223			lgPlugins.push(lgShare);
4224		}
4225
4226		if ( galleries.indexOf( galleryID ) !== -1 ) {
4227			return true;
4228		}
4229
4230		galleries.push( galleryID );
4231		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4232			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4233		var gallery = lightGallery( $triggerGal[0], {
4234			addClass: containerClass,
4235			plugins: lgPlugins,
4236			mode: transition,
4237			selector: $selector,
4238			galleryId: galleryID,
4239			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4240			iframeWidth: '848px',
4241			iframeMaxWidth: '90%',
4242			iframeMaxHeight: '90%',
4243			exThumbImage: 'data-external-thumb-image',
4244			loadYouTubeThumbnail: false,
4245			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' || $gallery.closest('[data-lb-autoplay=yes]').length ),
4246			// autoplayFirstVideo: false,
4247			pager: false,
4248			startClass: 'lg-start-opacity',
4249			zoomFromOrigin: zoom,
4250			controls: controls,
4251			download: ( typeof download != 'undefined' && download != '' ),
4252			thumbWidth: 50,
4253			thumbHeight: '50px',
4254			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4255			loadYouTubePoster: false,
4256			enableDrag: $triggerGal.find($selector).length > 1,
4257			mobileSettings: {
4258				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4259			},
4260		});
4261
4262		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4263			e.preventDefault();
4264			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4265			gallery.openGallery(index-1);
4266		});
4267
4268		$gallery.on('uncode-gallery-trigger', function(){
4269			gallery.openGallery(0);
4270		});
4271
4272		$triggerGal.on('more-items-loaded', function(e, items) {
4273			clearRequestTimeout(itemsLoadedTimeOut);
4274			itemsLoadedTimeOut = requestTimeout(function(){
4275				createSelectors();
4276				captionBuilder($triggerGal);
4277				gallery.refresh();
4278			}, 100);
4279		});
4280
4281		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4282			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4283				$el = model.view.$el;
4284				if ( $el.find($triggerGal).length ) {
4285					gallery.destroy();
4286				}
4287			});
4288		}
4289
4290		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4291		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4292		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4293			$(window).trigger('uncode-custom-cursor');
4294		});
4295
4296	});
4297
4298	if ( typeof $el !== 'undefined' ) {
4299
4300		//album galleries
4301		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4302			var album = val,
4303				galleryID = index,
4304				$album = $(album),
4305				params = $album.attr('data-album'),
4306				tmb = $(val).attr('data-notmb'),
4307				social = $(val).attr('data-social'),
4308				deep = $(val).attr('data-deep'),
4309				actual = $(val).attr('data-actual-size'),
4310				download = $(val).attr('data-download'),
4311				controls = $(val).attr('data-arrows') !== 'no',
4312				fullScreen = $(val).attr('data-full'),
4313				counter = $(val).attr('data-counter'),
4314				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4315				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4316				lgPlugins = [lgVideo];
4317
4318			$(val).attr('data-lbox-init','true');
4319
4320			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4321			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4322
4323			if ( typeof tmb == 'undefined' || !tmb ) {
4324				lgPlugins.push(lgThumbnail);
4325			}
4326			if ( typeof actual != 'undefined' && actual != '' ) {
4327				lgPlugins.push(lgZoom);
4328			}
4329			if ( typeof deep != 'undefined' && deep != '' ) {
4330				lgPlugins.push(lgHash);
4331			}
4332			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4333				lgPlugins.push(lgFullscreen);
4334			}
4335			if ( social ) {
4336				lgPlugins.push(lgShare);
4337			}
4338
4339			var gallery = window.lightGallery(album, {
4340				dynamic: true,
4341				plugins: lgPlugins,
4342				dynamicEl: JSON.parse(params),
4343				galleryId: galleryID,
4344				addClass: containerClass,
4345				mode: transition,
4346				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4347				iframeWidth: '848px',
4348				iframeMaxWidth: '90%',
4349				iframeMaxHeight: '90%',
4350				loadYouTubeThumbnail: false,
4351				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4352				// autoplayFirstVideo: false,
4353				pager: false,
4354				startClass: 'lg-start-opacity',
4355				zoomFromOrigin: false,
4356				controls: controls,
4357				download: ( typeof download != 'undefined' && download != '' ),
4358				thumbWidth: 50,
4359				thumbHeight: '50px',
4360				loadYouTubePoster: false,
4361				counter: counter,
4362				exThumbImage: 'data-external-thumb-image',
4363				loadYouTubePoster: false,
4364				mobileSettings: {
4365					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4366				},
4367			});
4368
4369			$album.on('click', function(){
4370				gallery.openGallery(0);
4371			});
4372
4373			album.addEventListener('lgBeforeSlide', beforeSlide);
4374			album.addEventListener('lgBeforeOpen', beforeOpen);
4375			album.addEventListener('lgAfterOpen', function(){
4376				$(window).trigger('uncode-custom-cursor');
4377			});
4378
4379			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4380				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4381					$el = model.view.$el;
4382					if ( $el.find($album).length ) {
4383						gallery.destroy();
4384					}
4385				});
4386			}
4387
4388		});
4389
4390		//single images
4391		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4392			var gallery = lightGallery( $('.page-wrapper')[0], {
4393				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4394				iframeWidth: '848px',
4395				iframeMaxWidth: '90%',
4396				iframeMaxHeight: '90%',
4397				loadYouTubeThumbnail: false,
4398				// autoplayFirstVideo: false,
4399				startClass: 'lg-start-opacity',
4400				thumbWidth: 50,
4401				thumbHeight: '50px',
4402				download: false,
4403				loadYouTubePoster: false,
4404				counter: false
4405			});
4406
4407			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4408			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4409		});
4410	}
4411
4412	var galleryButtons = function(){
4413		var $buttons = $('.btn-gallery-trigger');
4414		$buttons.each(function(key, val){
4415			var $button = $(val),
4416				target = $button.attr('data-target'),
4417				$gallery = $('.un-media-gallery').first(),
4418				$row = $button.closest('.vc_row[data-parent]');
4419			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4420				$gallery = $('.un-media-gallery#' + target);
4421			} else if ( $('.un-media-gallery', $row).length ) {
4422				$gallery = $('.un-media-gallery', $row).first();
4423			}
4424			
4425			$button.on('click', 'a', function(e){
4426				e.preventDefault();
4427				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4428			});
4429		});
4430	};
4431	galleryButtons();
4432};
4433
4434UNCODE.carousel = function(container) {
4435	var $owlContainers = $('.owl-carousel-container', container);
4436	$owlContainers.each(function() {
4437		var $owlContainer = $(this),
4438			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4439			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4440			values = {},
4441			tempTimeStamp,
4442			newWidth = UNCODE.wwidth,
4443			$owlInsideEqual = [];
4444		$owlSelector.each(function() {
4445			var itemID = $(this).attr('id'),
4446				$elSelector = $(('#' + itemID).toString());
4447			values['id'] = itemID;
4448			values['items'] = 1;
4449			values['columns'] = 3;
4450			values['fade'] = false;
4451			values['nav'] = false;
4452			values['navmobile'] = false;
4453			values['navskin'] = 'light';
4454			values['navspeed'] = 400;
4455			values['dots'] = false;
4456			values['dotsmobile'] = false;
4457			values['loop'] = false;
4458			values['autoplay'] = false;
4459			values['timeout'] = 3000;
4460			values['autoheight'] = false;
4461			values['stagepadding'] = 0;
4462			values['margin'] = 0;
4463			values['lg'] = 1;
4464			values['md'] = 1;
4465			values['sm'] = 1;
4466			$.each($(this).data(), function(i, v) {
4467				values[i] = v;
4468			});
4469
4470			if ($(this).closest('.uncode-slider').length) {
4471				values['navskin'] = '';
4472				values['navmobile'] = false;
4473				//values['dotsmobile'] = true;
4474			} else {
4475				values['navskin'] = ' style-'+values['navskin']+' style-override';
4476			}
4477
4478			var setIndexActive = function(event, init){
4479				var init = typeof init === 'undefined' ? false : init,
4480					thiis = $(event.currentTarget);
4481				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4482					var scrolltop = $(document).scrollTop(),
4483						size = event.page.size,
4484						i;
4485					var setIndex = requestTimeout(function() {
4486						for ( i = 0; i < size; i++ ) {
4487							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4488							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4489							if (thiis.closest('.row-slider').length) {
4490								if (currentItem == undefined) {
4491									currentItem = thiis.children()[i];
4492								}
4493								if ($(currentItem).closest('#page-header').length) {
4494									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4495										UNCODE.switchColorsMenu(scrolltop, 'dark');
4496									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4497										UNCODE.switchColorsMenu(scrolltop, 'light');
4498									}
4499								}
4500								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4501								if (owlCustomNav.length) {
4502									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4503										owlCustomNav.addClass('style-dark').removeClass('style-light');
4504									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4505										owlCustomNav.addClass('style-light').removeClass('style-dark');
4506									}
4507								}
4508							}
4509							var itendIndex = $(currentItem).attr('data-index');
4510							if ( isNaN(itendIndex) ) {
4511								itendIndex = 1;
4512							}
4513							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4514							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4515							if ($.fn.counterUp) {
4516								if (size <= 1) {
4517									$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4518										var $counter = $(this);
4519										$counter.addClass('started').counterUp({
4520											delay: 10,
4521											time: 1500
4522										});
4523									});
4524								} else {
4525									$('.owl-item', $elSelector).eq(itemCont).find('.uncode-counter:not(.started)').addClass('started').counterUp({
4526										delay: 10,
4527										time: 1500
4528									});
4529								}
4530							}
4531						}
4532						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4533					}, 200);					
4534				}
4535				tempTimeStamp = event.timeStamp;
4536			}
4537
4538			/** Initialize */
4539			$elSelector.on('initialize.owl.carousel', function(event) {
4540				if (typeof UNCODE.owlNav !== 'undefined') {
4541					UNCODE.owlNav(itemID, event);
4542				}
4543
4544				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4545					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4546						var shortcode = model.attributes.shortcode,
4547							$el = model.view.$el,
4548							$row_wrap = $el.closest('.row');
4549						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4550							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4551						}
4552					});
4553					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4554						var shortcode = model.attributes.shortcode;
4555						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4556							tempTimeStamp = Math.floor(Date.now() / 1000);
4557						}
4558					});
4559					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4560						var shortcode = model.attributes.shortcode;
4561						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4562							UNCODE.owlNav(itemID, event);
4563							$elSelector.trigger('refresh.owl.carousel');
4564						}
4565					});
4566				}
4567				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4568				// 	$elSelector.closest('.mega-menu-inner').css({
4569				// 		visibility: 'hidden',
4570				// 		display: 'block'
4571				// 	});
4572				// 	$elSelector.data('owl.carousel');
4573				// 	$elSelector.trigger('refresh.owl.carousel');
4574				// 	$elSelector.closest('.mega-menu-inner').css({
4575				// 		display: 'none',
4576				// 		visibility: '',
4577				// 	});
4578				// }
4579				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4580				// 	$elSelector.trigger("to.owl.carousel", 0);
4581				// });
4582			});
4583
4584			/** Initialized */
4585			$elSelector.on('initialized.owl.navigation', function(event) {
4586				$('.owl-dot', event.currentTarget).each(function(key, val){
4587					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4588				});
4589			});
4590
4591			$elSelector.on('initialized.owl.carousel', function(event) {
4592
4593				if ( $('.isotope-container', event.currentTarget).length ) {
4594					window.dispatchEvent(UNCODE.boxEvent);
4595				}
4596
4597				$('.owl-dot.active', $elSelector).on('click', function(){
4598					return false;
4599				});
4600
4601				var thiis = $(event.currentTarget),
4602					// get the time from the data method
4603					time = thiis.data("timer-id"),
4604					rowParent = thiis.closest('.row-parent');
4605
4606				if ( typeof rowParent[0] !== 'undefined' ) {
4607					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4608				}
4609
4610				if (time) {
4611					clearRequestTimeout(time);
4612				}
4613
4614				thiis.addClass('showControls');
4615				var new_time = requestTimeout(function() {
4616					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4617					if (thiis.hasClass('owl-height-viewport'))
4618						setItemsRelHeight(thiis);
4619					if (thiis.hasClass('owl-height-equal') || thiis.closest('.uncode-wrapper').length) {
4620						setItemsHeight(thiis);
4621					}
4622					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4623					if (thiis.closest('.unequal, .unexpand').length) {
4624						UNCODE.setRowHeight(rowParent[0], true);
4625					}
4626					if (SiteParameters.dynamic_srcset_active === '1') {
4627						UNCODE.refresh_dynamic_srcset_size(thiis);
4628					}
4629				}, 350);
4630				// save the new time
4631				thiis.data("timer-id", new_time);
4632
4633				var scrolltop = $(document).scrollTop();
4634				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4635
4636				//if (!UNCODE.isMobile) {
4637					/** fix autoplay when visible **/
4638				$(window).on('load', function(){
4639					if (thiis.data('autoplay')) {
4640						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4641							thiis.trigger('stop.owl.autoplay');
4642						} else {
4643							thiis.trigger('play.owl.autoplay');
4644						}
4645					}
4646					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4647						return;
4648					}
4649					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4650						var carouselInView = new Waypoint.Inview({
4651							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4652							element: thiis[0],
4653							exited: function() {
4654								var el = $(this.element);
4655								if (el.data('autoplay') ) {
4656									el.trigger('stop.owl.autoplay');
4657									el.data('stopped','true');
4658								}
4659							},
4660							enter: function(direction) {
4661								var el = $(this.element);
4662								requestTimeout(function() {
4663									if (el.data('autoplay')) {
4664										el.trigger('play.owl.autoplay');
4665										el.data('stopped','false');
4666									}
4667								}, 100);
4668							}
4669						});
4670					}
4671					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4672						setTimeout(function(){
4673							window.lenis.resize();
4674						}, 1000);
4675					}
4676			  	
4677				});
4678				//}
4679
4680				// $(window).on('frontend:carousel_updated', function(){
4681				// 	Waypoint.refreshAll();
4682				// });
4683
4684				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4685					requestTimeout(function() {
4686						animate_thumb($('.t-inside', el), event);
4687					}, 400);
4688				} 
4689				if (thiis.closest('.isotope-system').length ) {
4690					requestTimeout(function() {
4691						thiis.closest('.isotope-container').isotope('layout');
4692					}, 400);
4693				}
4694				if (thiis.closest('.megamenu-block-wrapper').length ) {
4695					$(document).on('un-menu-show', function(e, $ul){
4696						if ( thiis.closest($ul).length ) {
4697							animate_thumb($('.t-inside', el), event);
4698						}
4699					});
4700				}
4701				if (thiis.closest('.overlay').length ) {
4702					$(window).on('menuOpen', function(e, $ul){
4703						animate_thumb($('.t-inside', el), event);
4704					});
4705				}
4706
4707				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4708				currentIndex = $(currentItem).attr('data-index');
4709
4710				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4711					if ($(val).closest('.uncode-slider').length) {
4712						$(val).removeClass('start_animation');
4713					}
4714				});
4715				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4716					if ($(val).closest('.uncode-slider').length) {
4717						$(val).removeClass('already-animated');
4718					}
4719				});
4720
4721				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4722					if ($(val).closest('.uncode-slider').length) {
4723						$(val).removeAttr('data-animated');
4724					}
4725				});
4726
4727				$.each($('.owl-item.cloned', thiis), function(index, val) {
4728					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4729				});
4730
4731				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4732					if ($(val).attr('data-index') != currentIndex) {
4733						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4734						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4735					}
4736					if ($(val).attr('data-index') != currentIndex) {
4737						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4738					}
4739					if ($(val).attr('data-index') == currentIndex) {
4740						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4741					}
4742				});
4743
4744				if (thiis.closest('.uncode-slider').length) {
4745					var el = thiis.closest('.row-parent')[0],
4746						section = thiis.closest('.vc_section');
4747					if ( section.length ) {
4748						el = $('> .row-parent', section)[0];
4749					}
4750					if ($(el).data('imgready')) {
4751						firstLoaded(el, event);
4752					} else {
4753						el.addEventListener("imgLoaded", function(el) {
4754							firstLoaded(el.target, event);
4755						}, false);
4756					}
4757					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4758					if (transHeight != null) {
4759						requestTimeout(function() {
4760							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4761						}, 100);
4762					}
4763				} else {
4764					var el = thiis;
4765					el.closest('.uncode-slider').addClass('slider-loaded');
4766				}
4767
4768				requestTimeout(function() {
4769					if (typeof UNCODE.bigText !== 'undefined') {
4770						UNCODE.bigText(thiis);
4771					}
4772					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4773						if (thiis.data('autoplay')) pauseOnHover(thiis);
4774					}
4775				}, 500);
4776
4777				if (thiis.closest('.unequal').length) {
4778					$owlInsideEqual.push(thiis.closest('.row-parent'));
4779				}
4780
4781				var containerClasses = '',
4782					containerStyle = '';
4783				if ( $('.owl-dots-classes', $owlContainer).length ) {
4784					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4785					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4786					$('.owl-dots-classes', $owlContainer).remove();
4787				}
4788
4789				if ( containerClasses !== '' ) {
4790					requestTimeout(function() {
4791						if ( containerClasses !== '' )
4792							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4793						if ( containerStyle !== '' )
4794							$('.owl-dots', $owlContainer).addClass(containerClasses);
4795					}, 100);
4796				}
4797
4798				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4799					$(val).closest('.row-inner').css({
4800						'margin-top': '-1px'
4801					});
4802				});
4803
4804				if ($.fn.isotope) {
4805					if ( thiis.closest('.isotope-container').length ) {
4806						if (thiis.closest('.isotope-container').data('isotope')) {
4807							requestTimeout(function(){
4808								thiis.closest('.isotope-container').isotope('layout');
4809							}, 300);
4810						}
4811						$(window).on('load', function(){
4812							if (thiis.closest('.isotope-container').data('isotope')) {
4813								thiis.closest('.isotope-container').isotope('layout');
4814							}
4815						});
4816					}
4817				}
4818
4819				if (thiis.data('autoplay')) {
4820					$(window).on('menuOpen', function(){
4821						if ( thiis.closest('.overlay').length ) {
4822							thiis.trigger('play.owl.autoplay');
4823							thiis.data('stopped','false');
4824						} else {
4825							thiis.trigger('stop.owl.autoplay');
4826							thiis.data('stopped','true');
4827						}
4828					});
4829					$(window).on('menuClose', function(){
4830						if ( thiis.closest('.overlay').length ) {
4831							thiis.trigger('stop.owl.autoplay');
4832							thiis.data('stopped','true');
4833						} else {
4834							thiis.trigger('play.owl.autoplay');
4835							thiis.data('stopped','false');
4836						}
4837					});
4838				}
4839
4840				setIndexActive(event, true);
4841
4842				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4843						return !$(this).closest('.nested-carousel').length;
4844					}),
4845					$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a),
4846					$galleries = $_galleries.filter(function( index ) {
4847						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4848					});
4849
4850				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4851					UNCODE.lightgallery( $galleries );
4852				}
4853
4854				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4855					$(document).trigger('uncode-scrolltrigger-refresh');
4856				}
4857
4858				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4859					thiis.trigger('stop.owl.autoplay');
4860					thiis.data('stopped','true');
4861				}
4862
4863				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4864					thiis.trigger('stop.owl.autoplay');
4865					thiis.data('stopped','false');
4866					$(document).on('un-menu-show', function(){
4867						thiis.trigger('play.owl.autoplay');
4868						thiis.data('stopped','false');
4869					}).on('un-menu-hide', function(){
4870						thiis.trigger('stop.owl.autoplay');
4871						thiis.data('stopped','true');
4872					});
4873				}
4874			});
4875
4876			$elSelector.on('resized.owl.carousel', function(event) {
4877				$('.owl-dot', event.currentTarget).each(function(key, val){
4878					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4879				});
4880			});
4881
4882			$elSelector.on('resized.owl.carousel', function(event) {
4883				var thiis = $(event.currentTarget);
4884				// if ($(this).closest('.nested-carousel').length) {
4885				// 	requestTimeout(function() {
4886				// 		window.dispatchEvent(UNCODE.boxEvent);
4887				// 	}, 200);
4888				// }
4889				if ( thiis.hasClass('owl-height-equal') )
4890					setItemsHeight(thiis);
4891
4892				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4893					newWidth = UNCODE.wwidth;
4894					setItemsRelHeight($elSelector);
4895				}
4896
4897				setIndexActive(event);
4898
4899				if (SiteParameters.dynamic_srcset_active === '1') {
4900					UNCODE.refresh_dynamic_srcset_size(thiis);
4901				}
4902
4903				if ($.fn.isotope) {
4904					$(window).on('load', function(){
4905						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4906							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4907						}
4908					});
4909				}
4910
4911				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4912					setTimeout(function(){
4913						window.lenis.resize();
4914					}, 1000);
4915				}
4916				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4917					$(document).trigger('uncode-scrolltrigger-refresh');
4918				}
4919			});
4920
4921			$elSelector.on('refreshed.owl.carousel', function(event) {
4922				setIndexActive(event);
4923			});
4924
4925			/** detect resize window for fluid height layout */
4926			var setFluidResize;
4927			function manageFluidCarouseHeight() {
4928				clearRequestTimeout(setFluidResize);
4929				setFluidResize = requestTimeout(function(){
4930					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4931						newWidth = UNCODE.wwidth;
4932						setItemsRelHeight($elSelector);
4933					}
4934				}, 100);
4935			}
4936			window.addEventListener('resize', manageFluidCarouseHeight);
4937
4938			/** Change */
4939			$elSelector.on('change.owl.carousel', function(event) {
4940				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4941			});
4942
4943			/** Changed */
4944			$elSelector.on('changed.owl.carousel', function(event) {
4945				var $row = $elSelector.parents('.row')[0];
4946				if ( typeof $row !== 'undefined' ) {
4947					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4948				}
4949				setIndexActive(event);
4950			});
4951
4952			var checkDrag = function(e) {
4953				$elSelector.addClass('owl-dragging');
4954			};
4955			$elSelector.on('drag.owl.carousel', function(event) {
4956				document.addEventListener("mousemove", checkDrag);
4957			});
4958
4959			$elSelector.on('dragged.owl.carousel', function(event) {
4960				$elSelector.removeClass('owl-dragging');
4961				document.removeEventListener("mousemove", checkDrag);
4962			});
4963
4964			$elSelector.on('translate.owl.carousel', function(event) {
4965				if (UNCODE.isMobile) {
4966					$(event.currentTarget).addClass('owl-translating');
4967				}
4968			});
4969
4970			/** Translated */
4971			$elSelector.on('translated.owl.carousel', function(event) {
4972
4973				var thiis = $(event.currentTarget),
4974					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4975					currentIndex = $(currentItem).attr('data-index'),
4976					stagePadding = thiis.data('stagepadding');
4977
4978				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4979
4980				if (!UNCODE.isMobile) {
4981					UNCODE.owlPlayVideo(thiis);
4982				}
4983
4984				requestTimeout(function(){
4985					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4986					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4987					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4988						if (lastDelayElems == undefined) lastDelayElems = 0;
4989						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4990						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4991						thiis.trigger('stop.owl.autoplay');
4992						requestTimeout(function() {
4993							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4994						}, maxDelay);
4995					}
4996				}, 200);
4997
4998				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4999					if ($(val).closest('.uncode-slider').length) {
5000						$(val).removeClass('start_animation');
5001					}
5002				});
5003
5004				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
5005					if ($(val).closest('.uncode-slider').length) {
5006						$(val).removeClass('already-animated');
5007					}
5008				});
5009
5010				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
5011					if ($(val).closest('.uncode-slider').length) {
5012						$(val).removeAttr('data-animated');
5013					}
5014				});
5015
5016				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
5017					if ($(val).attr('data-index') != currentIndex) {
5018						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
5019						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
5020					}
5021					if ($(val).attr('data-index') != currentIndex) {
5022						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
5023					}
5024					if ($(val).attr('data-index') == currentIndex) {
5025						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
5026					}
5027				});
5028
5029				if (UNCODE.isMobile) {
5030					thiis.removeClass('owl-translating');
5031				}
5032
5033				setIndexActive(event);
5034			});
5035
5036			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
5037
5038			/** Init carousel */
5039			$elSelector.not('.showControls').owlCarousel({
5040				items: values['items'],
5041				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
5042				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
5043				nav: values['nav'],
5044				dots: values['dots'],
5045				loop: values['loop'],
5046				stagePadding: values['stagepadding'],
5047				margin: 0,
5048				video: true,
5049				autoWidth: false,
5050				autoplay: false,
5051				autoplayTimeout: values['timeout'],
5052				autoplaySpeed: values['navspeed'],
5053				autoplayHoverPause: $(this).closest('.uncode-slider:not(.uncode-wrapper)').length || $(this).closest('.carousel-no-hover').length ? false : true,
5054				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
5055				itemSelector: SiteParameters.uncode_carousel_itemSelector,
5056				rtl: $('body').hasClass('rtl') ? true : false,
5057				fluidSpeed: true,
5058				navSpeed: values['navspeed'],
5059				dotsSpeed: values['navspeed'] / values['items'],
5060				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
5061				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
5062				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'],
5063				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
5064				responsiveClass: true,
5065				responsiveBaseElement: '.box-container',
5066				responsive: {
5067					0: {
5068						items: values['sm'],
5069						nav: values['navmobile'],
5070						dots: values['dotsmobile'],
5071						dotsSpeed: values['navspeed'] / values['sm'],
5072					},
5073					480: {
5074						items: values['sm'],
5075						nav: values['navmobile'],
5076						dots: values['dotsmobile'],
5077						dotsSpeed: values['navspeed'] / values['sm'],
5078					},
5079					570: {
5080						items: values['md'],
5081						nav: values['navmobile'],
5082						dots: values['dotsmobile'],
5083						dotsSpeed: values['navspeed'] / values['md'],
5084					},
5085					960: {
5086						items: values['lg'],
5087						dotsSpeed: values['navspeed'] / values['lg'],
5088					}
5089				}
5090			});
5091
5092			var transDuration = parseFloat(values['navspeed']) * 0.3;
5093			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5094
5095			$('.owl-item .tmb', $elSelector).css({
5096				'-webkit-transition-delay': transDuration + 'ms',
5097				'-moz-transition-delay': transDuration + 'ms',
5098				'-o-transition-delay': transDuration + 'ms',
5099				'transition-delay': transDuration + 'ms',
5100				'-webkit-transition-duration': transDuration2 + 'ms',
5101				'-moz-transition-duration': transDuration2 + 'ms',
5102				'-o-transition-duration': transDuration2 + 'ms',
5103				'transition-duration': transDuration2 + 'ms',
5104			});
5105
5106			requestTimeout(function() {
5107				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5108					UNCODE.setRowHeight($owlInsideEqual[i]);
5109				};
5110			}, 300);
5111
5112			$(window).on('load', function(){
5113				var $elCarousel = $elSelector.data('owl.carousel');
5114				if ( typeof $elCarousel !== 'undefined' ) {
5115					$elCarousel.trigger('refreshed');
5116					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5117						UNCODE.setRowHeight($owlInsideEqual[i]);
5118					};
5119				}
5120			});
5121
5122			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5123				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5124					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5125					$('#' + carousel_id).find('.owl-item').each( function() {
5126						var $item = $(this),
5127							index = ( $item.index() + 1 );
5128						$item.attr('data-index', index);
5129					});
5130				}
5131			});
5132
5133			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5134				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5135					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5136						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5137						$('#' + carousel_id).find('.owl-item').each( function() {
5138							var $item = $(this),
5139								index = ( $item.index() + 1 );
5140							$item.attr('data-index', index);
5141						});
5142					}
5143				});
5144			}
5145
5146		});
5147
5148		function firstLoaded(el, event) {
5149			var el = $(el),
5150			uncode_slider = el.find('.uncode-slider');
5151			el.find('.owl-carousel').css('opacity', 1);
5152			uncode_slider.addClass('slider-loaded');
5153			if (typeof UNCODE.bigText !== 'undefined') {
5154				UNCODE.bigText(el.find('.owl-item.active'));
5155			}
5156			//if (!UNCODE.isMobile) {
5157				requestTimeout(function() {
5158					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5159					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5160					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5161						if (lastDelayElems == undefined) lastDelayElems = 0;
5162						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5163						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5164						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5165						requestTimeout(function() {
5166							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5167						}, maxDelay);
5168					}
5169				}, 500);
5170
5171			//}
5172		}
5173
5174		function navHover(el) {
5175			var $owlCont = el,
5176				$owlPrev = $owlCont.find('.owl-prev'),
5177				$owlNext = $owlCont.find('.owl-next'),
5178				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5179				$owlPagination = $owlCont.next(),
5180				owlPrevW = $owlPrev.outerWidth(),
5181				owlNextW = $owlNext.outerWidth(),
5182				owlDotsH = $owlDots.innerHeight(),
5183				owlTime = 400,
5184				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5185			if ( $('body').hasClass('rtl') ) {
5186				$owlPrev.css("margin-right", -owlPrevW);
5187				$owlNext.css("margin-left", -owlNextW);
5188			} else {
5189				$owlPrev.css("margin-left", -owlPrevW);
5190				$owlNext.css("margin-right", -owlNextW);
5191			}
5192			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5193			$owlCont.mouseenter(function() {
5194				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5195				$owlPrev.add($owlNext).css({
5196					marginLeft: 0,
5197					marginRight: 0
5198				});
5199				if (!owlNested) {
5200					$owlDots.css({
5201						opacity: 1,
5202						bottom: 0
5203					});
5204				}
5205			}).mouseleave(function() {
5206				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5207				if ( $('body').hasClass('rtl') ) {
5208					$owlPrev.css("margin-right", -owlPrevW);
5209					$owlNext.css("margin-left", -owlNextW);
5210				} else {
5211					$owlPrev.css("margin-left", -owlPrevW);
5212					$owlNext.css("margin-right", -owlNextW);
5213				}
5214				if (!owlNested) {
5215					$owlDots.css({
5216						opacity: 1,
5217						bottom: -owlDotsH
5218					});
5219				}
5220			});
5221		};
5222
5223		function animate_elems($this) {
5224			var lastDelay;
5225			$.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) {
5226				var element = $(val),
5227					delayAttr = element.attr('data-delay'),
5228					$first_item = element.closest('.owl-item[data-index="1"]');
5229
5230				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5231					return false;
5232				}
5233
5234				if (delayAttr == undefined) delayAttr = 0;
5235				requestTimeout(function() {
5236					element.addClass('start_animation');
5237				}, delayAttr);
5238				lastDelay = delayAttr;
5239			});
5240			return lastDelay;
5241		}
5242
5243		function animate_thumb(items, event) {
5244			var lastDelay,
5245				itemIndex,
5246				thiis = $(event.currentTarget),
5247				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5248				numActives = $('.owl-item.active', thiis).length,
5249				stagePadding = thiis.data('stagepadding');
5250
5251			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5252
5253			thiis.data('tempIndex', event.item.index);
5254				$.each(items, function(index, val) {
5255					var parent = $(val).closest('.owl-item');
5256					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5257						return;
5258					}
5259					if (!$(val).hasClass('start_animation')) {
5260						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5261							var thumbInView = new Waypoint.Inview({
5262							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5263							  element: val,
5264							  enter: function(direction) {
5265								var element = $(this.element),
5266										delayAttr = parseInt(element.attr('data-delay')),
5267										itemIndex = element.closest('.owl-item').index() + 1,
5268										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5269										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5270									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5271										diffItem = menuIndex;
5272									} else {
5273										if (itemIndex > tempIndex) {
5274											thiis.data('tempIndex', itemIndex);
5275										}
5276									}
5277									if (isNaN(delayAttr)) delayAttr = 100;
5278									if (stagePadding) {
5279										var objTimeout = requestTimeout(function() {
5280											if ( !element.closest('.overlay:not(.open)').length ) {
5281												element.addClass('start_animation');
5282											}
5283										}, index * delayAttr);
5284										lastDelay = index * delayAttr;
5285									} else {
5286										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5287										var objTimeout = requestTimeout(function() {
5288											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5289										}, diffItem * delayAttr);
5290										lastDelay = diffItem * delayAttr;
5291									}
5292									parent.data('objTimeout', objTimeout);
5293									if (!UNCODE.isUnmodalOpen) {
5294										this.destroy();
5295									}
5296								}
5297							});
5298						}
5299					}
5300				});
5301				return lastDelay;
5302			}
5303
5304		function setItemsHeight(item) {
5305			$.each($('.owl-item', item), function(index, val) {
5306				var availableThumbHeight = $('.t-inside', $(val)).height(),
5307				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5308				difference = availableThumbHeight - innerThumbHeight;
5309				if ($('.tmb-content-under', val).length) {
5310					var visualPart = $('.t-entry-visual', val);
5311					if (visualPart.length) {
5312						difference -= $('.t-entry-visual', val).height();
5313					}
5314				}
5315				if (! $('.tmb-content-lateral', val).length)
5316					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5317			});
5318		}
5319
5320		function setItemsRelHeight(item) {
5321			$.each($('.owl-item', item), function(index, val) {
5322				var $rowContainer = $(item).parents('.row-parent').eq(0),
5323					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5324					$colContainer = $(item).parents('.uncell').eq(0),
5325					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5326					winHeight = UNCODE.wheight,
5327					multiplier_h = parseInt($(item).attr('data-vp-height')),
5328					data_viewport_h,
5329					consider_menu = $(item).data('vp-menu');
5330
5331				if ( consider_menu ) {
5332					winHeight = winHeight - UNCODE.menuHeight;
5333				}
5334
5335				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5336				$('.t-inside', val).css( 'height', data_viewport_h );
5337			});
5338		}
5339
5340		function pauseOnHover(slider) {
5341			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5342			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5343				mouseenter: function () {
5344					$(slider).addClass('owl-mouseenter');
5345					$(slider).trigger('stop.owl.autoplay');
5346				},
5347				mouseleave: function () {
5348					$(slider).removeClass('owl-mouseenter');
5349					$(slider).trigger('play.owl.autoplay');
5350				}
5351			});
5352		}
5353	});
5354};
5355
5356UNCODE.owlPlayVideo = function(carousel) {
5357	var player, iframe;
5358	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5359		var content = $(val).html();
5360		if (content == '') {
5361			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5362			$(val).append(getCloned);
5363		}
5364		if ($(this).attr('data-provider') == 'vimeo') {
5365			iframe = $(this).find('iframe');
5366			player = new Vimeo.Player(iframe[0]);
5367			player.play();
5368		} else if ($(this).attr('data-provider') == 'youtube') {
5369			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5370		} else {
5371			var player = $(this).find('video');
5372			if (player.length) {
5373				$(this).find('video')[0].volume = 0;
5374				$(this).find('video')[0].play();
5375				$(val).css('opacity', 1);
5376			}
5377		}
5378	});
5379};
5380
5381UNCODE.owlStopVideo = function(carousel) {
5382	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5383		var player, iframe;
5384		if ($(this).attr('data-provider') == 'vimeo') {
5385			iframe = $(this).find('iframe');
5386			player = new Vimeo.Player(iframe[0]);
5387			player.pause();
5388		} else if ($(this).attr('data-provider') == 'youtube') {
5389			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5390		} else {
5391			var player = $(this).find('video');
5392			if (player.length) {
5393				$(this).find('video')[0].volume = 0;
5394				$(this).find('video')[0].play();
5395			}
5396		}
5397	});
5398};
5399
5400UNCODE.animations = function() {
5401
5402	var runWaypoints_TO,
5403		runWaypoints_carousel_TO,
5404		runWaypoints_delay = 0,
5405	highlightComplexFunc = function($wrap, ev){
5406
5407		var $lines = $('.heading-line-wrap', $wrap),
5408			not_animate = false;
5409
5410		if ( $wrap.data('animate') === true ) {
5411			not_animate = true;
5412		}
5413
5414		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5415		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5416			return;
5417		}
5418
5419		$lines.each(function(_key, _value){
5420			var $line = $(_value),
5421				$inners = $('.split-word-inner', $line),
5422				$highlights = $('.heading-text-highlight-inner', $line);
5423
5424			var highlitInnerFunc = function(ev){
5425				var delay = 0;
5426				$highlights.each(function(h_key, high){
5427					var $highlight = $(high),
5428						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5429						$nextSplit = $split.nextUntil(),
5430						$next = $('.heading-text-highlight-inner', $nextSplit),
5431						countCh = $split.text().length;
5432
5433					$highlight.css({
5434						'-webkit-transition-duration': (30 * countCh) + 'ms',
5435						'-moz-transition-duration': (30 * countCh) + 'ms',
5436						'-o-transition-duration': (30 * countCh) + 'ms',
5437						'transition-duration': (30 * countCh) + 'ms',
5438					});
5439
5440					delay += (30 * countCh);
5441
5442					$next.css({
5443						'-webkit-transition-delay': delay + 'ms',
5444						'-moz-transition-delay': delay + 'ms',
5445						'-o-transition-delay': delay + 'ms',
5446						'transition-delay': delay + 'ms',
5447					});
5448				});
5449				$highlights.removeAttr('data-animated');
5450				if ( _key+1 === $lines.length ) {
5451					$wrap.data('animate', true);
5452				}
5453			};
5454
5455			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5456				if ( not_animate ) {
5457					$highlights.each(function(h_key, high){
5458						var $highlight = $(high);
5459						$highlight.css({
5460							'-webkit-transition-duration': '0ms',
5461							'-moz-transition-duration': '0ms',
5462							'-o-transition-duration': '0ms',
5463							'transition-duration': '0ms',
5464						});
5465					});
5466					$highlights.removeAttr('data-animated');
5467				} else {
5468					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5469						highlitInnerFunc();
5470					} else {
5471						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5472					}
5473				}
5474			}
5475		});
5476	};
5477
5478	$.each($('.header-content-inner'), function(index, val) {
5479		var element = $(val),
5480			transition = '';
5481		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5482		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5483		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5484		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5485		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5486		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5487		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5488		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5489		if (transition != '') {
5490			$(val).removeClass(transition);
5491			var container = element,
5492				containerDelay = container.attr('data-delay'),
5493				containerSpeed = container.attr('data-speed'),
5494				items = $('.header-title > *, .post-info', container);
5495			$.each(items, function(index, val) {
5496				var element = $(val),
5497					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5498					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5499				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5500					delayAttr = Number(delayAttr) + (400 * index);
5501					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5502					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5503				}
5504			});
5505			container.css('opacity', 1);
5506		}
5507	});
5508
5509	function animate_css_grids_on_load() {
5510		$('.cssgrid-system').each(function() {
5511			var grid = $(this);
5512			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5513			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5514		});
5515	}
5516
5517	var delayAdd = 0;
5518
5519	window.waypoint_animation = function(ev) {
5520		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)').filter(function(){
5521				var $el = $(this);
5522				if (!$el.is('[data-delay-seq]')) return true;
5523				return $el.is('[data-delay]');
5524			}), function(index, val) {
5525			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length || $(val).closest('.un-submenu').length || $(val).closest('#uncode-mobile-menu-block').length || $(val).closest('.has-unblock').length ) && !SiteParameters.is_frontend_editor ) ) {
5526				return true;
5527			}
5528			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5529				return;
5530			}
5531			var run = true,
5532				$carousel = $(val).closest('.owl-carousel'),
5533				marquee = $(val).closest('.tmb-linear').length;
5534			if ( $carousel.length ) {
5535				run = false;
5536			}
5537			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5538				run = false;
5539			}
5540			if (run) {
5541				new Waypoint({
5542					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5543					element: val,
5544					handler: function() {
5545						var element = $(this.element),
5546							index = element.index(),
5547							delayAttr = element.attr('data-delay');
5548						if (delayAttr == undefined) delayAttr = 0;
5549						// delayAttr = parseFloat(delayAttr) + delayAdd;
5550						// if ( marquee ) {
5551						// 	delayAdd += 50;
5552						// } else {
5553						// 	delayAdd = 0;
5554						// }
5555						requestTimeout(function() {
5556							element.addClass('start_animation');
5557						}, delayAttr);
5558						if (!UNCODE.isUnmodalOpen) {
5559							this.destroy();
5560						}
5561					},
5562					offset: UNCODE.isFullPage ? '100%' : '90%'
5563				});
5564			}
5565		});
5566		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5567			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5568				return;
5569			}
5570			var run = true,
5571				$carousel = $(val).closest('.owl-carousel');
5572			if ( $carousel.length ) {
5573				run = false;
5574			}
5575			if (run) {
5576				new Waypoint({
5577					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5578					element: val,
5579					handler: function() {
5580						var $element = $(this.element),
5581							$childs = $('.animate_when_parent_almost_visible', $element);
5582						$childs.each(function(key,el){
5583							var $child = $(el),
5584								delaySpeed = $child.attr('data-speed'),
5585								delayAttr = $child.attr('data-delay'),
5586								intervalAttr = $child.attr('data-interval');
5587							if (delayAttr == undefined) {
5588								delayAttr = 50*key;
5589							}
5590							requestTimeout(function() {
5591								$child.addClass('start_animation');
5592								if ( $child.hasClass('anim-line-checker') ) {
5593									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5594										var $line = $child.closest('.heading-line-wrap');
5595									});
5596								}
5597								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5598								highlightComplexFunc($wrapText, ev);
5599								if ( $child.hasClass('anim-tot-checker') ) {
5600									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5601										if ( $child.hasClass('anim-tot-checker') ) {
5602											$wrapText.addClass('already-animated');
5603											$element.trigger('already-animated');
5604										}
5605									});
5606								}
5607							}, delayAttr );
5608						});
5609						$element.addClass('start_animation');
5610						if (!UNCODE.isUnmodalOpen) {
5611							this.destroy();
5612						}
5613					},
5614					offset: UNCODE.isFullPage ? '100%' : '90%'
5615				});
5616			}
5617		});
5618	}
5619	window.waypoint_carousel_animation = function(ev) {
5620		$.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
5621			if ( $(val).hasClass('el-text-split') ) {
5622				return true;
5623			}
5624			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5625				return;
5626			}
5627			var run = true,
5628				$carousel = $(val).closest('.owl-carousel'),
5629				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5630				$all_first = $('.owl-item[data-index="1"]', $carousel);
5631			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5632				run = false;
5633			}
5634			if (run) {
5635				new Waypoint({
5636					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5637					element: val,
5638					handler: function() {
5639						var element = $(this.element),
5640							index = element.index(),
5641							delayAttr = element.attr('data-delay');
5642						if (delayAttr == undefined) delayAttr = 0;
5643						requestTimeout(function() {
5644							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5645								$all_first.attr('data-already-reached', 'true');
5646							}
5647							element.addClass('start_animation');
5648						}, delayAttr);
5649						if (!UNCODE.isUnmodalOpen) {
5650							this.destroy();
5651						}
5652					},
5653					offset: UNCODE.isFullPage ? '100%' : '90%'
5654				});
5655			}
5656		});
5657		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5658			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5659				return;
5660			}
5661			var run = true,
5662				$carousel = $(val).closest('.owl-carousel'),
5663				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5664				$all_first = $('.owl-item[data-index="1"]', $carousel);
5665			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5666				run = false;
5667			}
5668			if (run) {
5669				new Waypoint({
5670					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5671					element: val,
5672					handler: function() {
5673						var $element = $(this.element),
5674							$childs = $('.animate_when_parent_almost_visible', $element);
5675						$childs.each(function(key,el){
5676							var $child = $(el),
5677								delaySpeed = $child.attr('data-speed'),
5678								delayAttr = $child.attr('data-delay'),
5679								intervalAttr = $child.attr('data-interval');
5680							if (delayAttr == undefined) {
5681								delayAttr = 50*key;
5682							}
5683							requestTimeout(function() {
5684								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5685									$all_first.attr('data-already-reached', 'true');
5686								}
5687								$child.addClass('start_animation');
5688								if ( $child.hasClass('anim-line-checker') ) {
5689									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5690										var $line = $child.closest('.heading-line-wrap');
5691									});
5692								}
5693								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5694								highlightComplexFunc($wrapText, ev);
5695								if ( $child.hasClass('anim-tot-checker') ) {
5696									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5697										if ( $child.hasClass('anim-tot-checker') ) {
5698											$wrapText.addClass('already-animated');
5699										}
5700									});
5701								}
5702							}, delayAttr );
5703						});
5704						$element.addClass('start_animation');
5705						if (!UNCODE.isUnmodalOpen) {
5706							this.destroy();
5707						}
5708					},
5709					offset: UNCODE.isFullPage ? '100%' : '90%'
5710				});
5711			}
5712		});
5713	}
5714
5715	var runWaypoints = function(ev){
5716		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5717			runWaypoints_delay = 400;
5718		}
5719		clearRequestTimeout(runWaypoints_TO);
5720		runWaypoints_TO = requestTimeout(function() {
5721			window.waypoint_animation(ev);
5722		}, runWaypoints_delay);
5723
5724		clearRequestTimeout(runWaypoints_carousel_TO);
5725		runWaypoints_carousel_TO = requestTimeout(function() {
5726			window.waypoint_carousel_animation(ev);
5727		}, 400);
5728	};
5729	runWaypoints();
5730	animate_css_grids_on_load();
5731
5732	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5733		runWaypoints(ev);
5734	});
5735	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5736		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5737		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5738	}
5739};
5740
5741UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5742	var $allItems = elements.length - startIndex,
5743		showed = 0,
5744		index = 0,
5745		use_index = false
5746		;
5747
5748	if (filtering) {
5749		if (sequential) {
5750			use_index = true;
5751		}
5752		sequential = false;
5753	}
5754
5755	$.each(elements, function(index, val) {
5756		var $this = $(val),
5757			elInner = $('> .t-inside', val);
5758
5759		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5760			return;
5761		}
5762		if (val[0]) val = val[0];
5763
5764		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5765			new Waypoint({
5766				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5767				element: val,
5768				handler: function() {
5769					var element = $('> .t-inside', this.element),
5770						parent = $(this.element);
5771					var _index = use_index? index : 0;
5772
5773					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5774						delayAttr = parseInt(element.attr('data-delay'));
5775					if (isNaN(delayAttr)) delayAttr = 100;
5776					if (sequential || use_index) {
5777						delay -= showed;
5778					}
5779					var objTimeout = requestTimeout(function() {
5780						element.removeClass('zoom-reverse').addClass('start_animation');
5781						showed = index;
5782					}, delay * delayAttr);
5783					parent.data('objTimeout', objTimeout);
5784					if (!UNCODE.isUnmodalOpen) {
5785						this.destroy();
5786					}
5787				},
5788				offset: UNCODE.isFullPage ? '100%' : '90%'
5789			});
5790		}
5791
5792		index++;
5793	});
5794};
5795
5796UNCODE.tapHover = function() {
5797
5798	var isTouch = (
5799		'ontouchstart' in window ||
5800		navigator.maxTouchPoints > 0 ||
5801		navigator.msMaxTouchPoints > 0
5802	);
5803
5804	if (isTouch) {
5805		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5806			elClass = "hover";
5807
5808		$(window).on('click', function() {
5809			$el.removeClass(elClass);
5810		});
5811
5812		$el.on('click', function(e) {
5813			e.stopPropagation();
5814			var link = $(this);
5815			if ( ! link.hasClass(elClass)) {
5816				e.preventDefault();
5817				link.addClass("hover");
5818				$el.not(this).removeClass(elClass);
5819				return false;
5820			}
5821		});
5822	}
5823};
5824
5825UNCODE.onePage = function(isMobile) {
5826	var current = 0,
5827		last = 0,
5828		lastScrollTop = 0,
5829		forceScroll = false,
5830		lastScrolled = 0,
5831		isSectionscroller = ($('.main-onepage').length) ? true : false,
5832		isOnePage = false,
5833		getOffset = function () {
5834			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0);
5835			return calculateOffset;
5836		}
5837
5838	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5839
5840	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5841	// 	return false;
5842
5843	function init_onepage() {
5844		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5845			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5846		}
5847		last = $('.onepage-pagination li').last().find('a').data('index');
5848		$.each($('div[data-parent="true"]'), function(index, val) {
5849			$(this).attr('data-section', index);
5850			if (isMobile) return;
5851			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5852				return;
5853			}
5854			var sectionDown = new Waypoint({
5855				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5856				element: val,
5857				handler: function(direction) {
5858					if (direction == 'down') {
5859						changeMenuActive(this.element, index);
5860					}
5861				},
5862				offset: function() {
5863					return 5 + getOffset()
5864				}
5865			});
5866			var sectionUp = new Waypoint({
5867				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5868				element: val,
5869				handler: function(direction) {
5870					if (direction == 'up') {
5871						changeMenuActive(this.element, index);
5872					}
5873				},
5874				offset: function() {
5875					return -5 - getOffset()
5876				}
5877			});
5878
5879			if (isSectionscroller) {
5880				var label;
5881				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5882				else label = '';
5883				var getName = $(this).attr('data-name');
5884				if (getName == undefined) getName = index;
5885				if (label != '') {
5886					isOnePage = true;
5887					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5888					$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5889				}
5890			}
5891		});
5892
5893		if (isSectionscroller) {
5894			$.each($('ul.onepage-pagination li'), function(index, val) {
5895				var $this = $(val),
5896					$a = ('a', $this);
5897				$a.on('click', function(evt) {
5898					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5899						return false;
5900					}
5901					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5902						evt.preventDefault();
5903					}
5904					Waypoint.refreshAll();
5905					var el = $('a', evt.currentTarget);
5906					current = lastScrolled = parseInt(el.attr('data-index'));
5907					lastScrolled += 1;
5908					scrollBody(current);
5909				});
5910			});
5911		}
5912
5913		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5914		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5915			goToSection = String(window.location.hash).replace(/^#/, "");
5916			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5917		}
5918
5919		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5920			current = lastScrolled = goToSection;
5921			$(window).on('load', function(){
5922				if ( $('.owl-carousel').length ) {
5923					requestTimeout(function(){
5924						scrollBody(goToSection);
5925					}, 400);
5926				} else {
5927					scrollBody(goToSection);
5928				}
5929			});
5930		}
5931
5932	}
5933
5934	function changeMenuActive(section, index) {
5935		current = lastScrolled = parseInt($(section).attr('data-section'));
5936		if (isOnePage) {
5937			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5938			if (newSection.length) {
5939				$('ul.onepage-pagination li a').removeClass('is-selected');
5940				newSection.addClass('is-selected');
5941			}
5942			var getName = $('[data-section="' + index + '"]').attr('data-name');
5943			if (getName != undefined && getName !== '') {
5944				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5945					var get_href = $(val).attr('href');
5946					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5947						$(val).closest('.menu-smart').find('.active').removeClass('active');
5948						$(val).parent().addClass('active');
5949					}
5950				});
5951			}
5952		}
5953	}
5954
5955	if (isOnePage) {
5956		$(window).on('scroll', function() {
5957			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5958			if (bodyTop == 0) {
5959				$('ul.onepage-pagination li a').removeClass('is-selected');
5960				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5961				var getName = $('[data-section=0]').attr('data-name');
5962				if (getName != undefined && getName !== '') {
5963					$.each($('.menu-container .menu-item > a'), function(i, val) {
5964						var get_href = $(val).attr('href');
5965						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5966							$(val).closest('ul').find('.active').removeClass('active');
5967							$(val).parent().addClass('active');
5968						}
5969					});
5970				}
5971			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5972				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5973				if (lastSection.length) {
5974					$('ul.onepage-pagination li a').removeClass('is-selected');
5975					lastSection.addClass('is-selected');
5976				}
5977			}
5978		});
5979	}
5980
5981	var scrollBody = function(index) {
5982		$('ul.onepage-pagination li a').removeClass('is-selected');
5983		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5984
5985		var getSection = $('[data-section=' + index + ']'),
5986			scrollTo;
5987
5988		if (getSection == undefined) return;
5989
5990		var body = $("html, body"),
5991			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5992			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5993			getOffset = UNCODE.get_scroll_offset(index);
5994		if ( typeof getSection.offset() === 'undefined' )
5995			return;
5996		scrollTo = getSection.offset().top;
5997
5998		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5999		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
6000			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
6001			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
6002				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
6003			}
6004
6005			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
6006				if ( index === 0 ) {
6007					scrollTo = 0;
6008				} else {
6009					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
6010				}
6011			} else {
6012				scrollTo -= getOffset;
6013			}
6014		}
6015
6016		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6017		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6018
6019		if (index != 0) {
6020			UNCODE.scrolling = true;
6021		}
6022
6023		if (scrollSpeed == 0) {
6024			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6025			UNCODE.scrolling = false;
6026		} else {
6027			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6028				$(this).stop();
6029			}).animate({
6030				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6031			}, scrollSpeed, 'easeInOutCubic', function() {
6032				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6033				UNCODE.scrolling = false;
6034				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
6035				||
6036				$('.menu-hided').length ) {
6037					scrollTo = getSection.offset().top;
6038					getOffset = UNCODE.get_scroll_offset(index);
6039					scrollTo -= getOffset;
6040					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6041						$(this).stop();
6042					}).animate({
6043						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6044						}, scrollSpeed, 'easeInOutCubic', function() {
6045							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6046							UNCODE.scrolling = false;
6047						}
6048					);
6049				}
6050			});
6051		}
6052
6053	};
6054
6055	init_onepage();
6056};
6057
6058UNCODE.stickyElements = function() {
6059	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
6060	if (!isMobile_wide ) {
6061
6062		var $pageHeader = $('#page-header'),
6063			$headerRow = $('.vc_row', $pageHeader),
6064			$headerSection = $headerRow.closest('section[data-parent]'),
6065			startSticky = false;
6066
6067		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
6068			$headerRow.removeClass('sticky-element');
6069			$pageHeader.addClass('sticky-element');
6070			startSticky = true;
6071		}
6072
6073		var calculateOffset = function(el) {
6074			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
6075				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
6076				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
6077				elTop = window.pageYOffset + el.getBoundingClientRect().top;
6078
6079			sideOffset += UNCODE.bodyBorder;
6080
6081			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
6082			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
6083				if ($('.menu-shrink').length) {
6084					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
6085				} else {
6086					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
6087				}
6088			}
6089
6090			return sideOffset;
6091
6092		},
6093
6094		initStickyElement = function($els) {
6095			if ( $('body').hasClass('vc-safe-mode') ) {
6096				return true;
6097			}
6098			if ( typeof $els === 'undefined' ) {
6099				$els = $('.sticky-element');
6100			}
6101			$.each($els, function(index, element) {
6102				if ($(element).closest('.tab-pane').length) {
6103					var $paneParent = $(element).closest('.tab-pane');
6104					if ( !$paneParent.hasClass('active') ) {
6105						return true;
6106					}
6107				}
6108				$(element).stick_in_parent({
6109					sticky_class: 'is_stucked',
6110					offset_top: calculateOffset(element),
6111					bottoming: true,
6112					inner_scrolling: SiteParameters.sticky_elements === 'on'
6113				});
6114			});
6115		};
6116
6117		var oldW = UNCODE.wwidth,
6118			oldH = UNCODE.wHeight;
6119
6120		requestTimeout(function() {
6121			if ($('.sticky-element').length) {
6122
6123				if ($(window).width() > UNCODE.mediaQuery) {
6124					initStickyElement();
6125
6126					if ( startSticky === true ) {
6127						$('#page-header').trigger('sticky_kit:recalc');
6128					}
6129				}
6130
6131				$(window).on('resize lateral_resize', function(event) {
6132					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6133						$(".sticky-element").trigger("sticky_kit:detach");
6134						if ($(window).width() > UNCODE.mediaQuery) {
6135							initStickyElement();
6136						}
6137						oldW = UNCODE.wwidth;
6138						oldH = UNCODE.wHeight;
6139					}
6140				});
6141			}
6142		}, 1000);
6143
6144		if ($('.sticky-element').length) {
6145			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6146				requestTimeout(function() {
6147					$(document.body).trigger("sticky_kit:recalc");
6148				}, 100);
6149			});
6150		}
6151
6152		var $panels = $('.panel-collapse');
6153		if ( $panels.length ) {
6154			$panels.each(function(){
6155				var $panel = $(this);
6156				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6157					$(document.body).trigger("sticky_kit:recalc");
6158				});
6159			});
6160		}
6161
6162		$('.nav-tabs a').on('shown.bs.tab', function(e){
6163			var $tabs = $(e.target).closest('.tab-container'),
6164				$panel = $('.tab-pane.active', $tabs),
6165				$els = $(e.target).nextAll(".sticky-element");
6166
6167			$els.trigger("sticky_kit:detach");
6168			initStickyElement($els);
6169		});
6170
6171		$(window).on('vc-safe-mode-on', function(){
6172			$(".sticky-element").trigger("sticky_kit:detach");
6173		});
6174
6175		$(window).on('vc-safe-mode-off', function(){
6176			initStickyElement();
6177		});
6178	}
6179};
6180
6181UNCODE.twentytwenty = function() {
6182
6183  if (!$('.twentytwenty-container').length) return;
6184
6185// DOM.event.move
6186//
6187// 2.0.0
6188//
6189// Stephen Band
6190//
6191// Triggers 'movestart', 'move' and 'moveend' events after
6192// mousemoves following a mousedown cross a distance threshold,
6193// similar to the native 'dragstart', 'drag' and 'dragend' events.
6194// Move events are throttled to animation frames. Move event objects
6195// have the properties:
6196//
6197// pageX:
6198// pageY:     Page coordinates of pointer.
6199// startX:
6200// startY:    Page coordinates of pointer at movestart.
6201// distX:
6202// distY:     Distance the pointer has moved since movestart.
6203// deltaX:
6204// deltaY:    Distance the finger has moved since last event.
6205// velocityX:
6206// velocityY: Average velocity over last few events.
6207
6208
6209(function(fn) {
6210	if (typeof define === 'function' && define.amd) {
6211        define([], fn);
6212    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6213        module.exports = fn;
6214	} else {
6215		fn();
6216	}
6217})(function(){
6218	var assign = Object.assign || window.jQuery && jQuery.extend;
6219
6220	// Number of pixels a pressed pointer travels before movestart
6221	// event is fired.
6222	var threshold = 8;
6223
6224	// Shim for requestAnimationFrame, falling back to timer. See:
6225	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6226	var requestFrame = (function(){
6227		return (
6228			window.requestAnimationFrame ||
6229			window.webkitRequestAnimationFrame ||
6230			window.mozRequestAnimationFrame ||
6231			window.oRequestAnimationFrame ||
6232			window.msRequestAnimationFrame ||
6233			function(fn, element){
6234				return window.setTimeout(function(){
6235					fn();
6236				}, 25);
6237			}
6238		);
6239	})();
6240
6241	// Shim for customEvent
6242	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6243	(function () {
6244		if ( typeof window.CustomEvent === "function" ) return false;
6245		function CustomEvent ( event, params ) {
6246			params = params || { bubbles: false, cancelable: false, detail: undefined };
6247			var evt = document.createEvent( 'CustomEvent' );
6248			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6249			return evt;
6250		}
6251
6252		CustomEvent.prototype = window.Event.prototype;
6253		window.CustomEvent = CustomEvent;
6254	})();
6255
6256	var ignoreTags = {
6257			textarea: true,
6258			input: true,
6259			select: true,
6260			button: true
6261		};
6262
6263	var mouseevents = {
6264		move:   'mousemove',
6265		cancel: 'mouseup dragstart',
6266		end:    'mouseup'
6267	};
6268
6269	var touchevents = {
6270		move:   'touchmove',
6271		cancel: 'touchend',
6272		end:    'touchend'
6273	};
6274
6275	var rspaces = /\s+/;
6276
6277
6278	// DOM Events
6279
6280	var eventOptions = { bubbles: true, cancelable: true };
6281
6282	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6283
6284	function createEvent(type) {
6285		return new CustomEvent(type, eventOptions);
6286	}
6287
6288	function getEvents(node) {
6289		return node[eventsSymbol] || (node[eventsSymbol] = {});
6290	}
6291
6292	function on(node, types, fn, data, selector) {
6293		types = types.split(rspaces);
6294
6295		var events = getEvents(node);
6296		var i = types.length;
6297		var handlers, type;
6298
6299		function handler(e) { fn(e, data); }
6300
6301		while (i--) {
6302			type = types[i];
6303			handlers = events[type] || (events[type] = []);
6304			handlers.push([fn, handler]);
6305			node.addEventListener(type, handler);
6306		}
6307	}
6308
6309	function off(node, types, fn, selector) {
6310		types = types.split(rspaces);
6311
6312		var events = getEvents(node);
6313		var i = types.length;
6314		var type, handlers, k;
6315
6316		if (!events) { return; }
6317
6318		while (i--) {
6319			type = types[i];
6320			handlers = events[type];
6321			if (!handlers) { continue; }
6322			k = handlers.length;
6323			while (k--) {
6324				if (handlers[k][0] === fn) {
6325					node.removeEventListener(type, handlers[k][1]);
6326					handlers.splice(k, 1);
6327				}
6328			}
6329		}
6330	}
6331
6332	function trigger(node, type, properties) {
6333		// Don't cache events. It prevents you from triggering an event of a
6334		// given type from inside the handler of another event of that type.
6335		var event = createEvent(type);
6336		if (properties) { assign(event, properties); }
6337		node.dispatchEvent(event);
6338	}
6339
6340
6341	// Constructors
6342
6343	function Timer(fn){
6344		var callback = fn,
6345		    active = false,
6346		    running = false;
6347
6348		function trigger(time) {
6349			if (active){
6350				callback();
6351				requestFrame(trigger);
6352				running = true;
6353				active = false;
6354			}
6355			else {
6356				running = false;
6357			}
6358		}
6359
6360		this.kick = function(fn) {
6361			active = true;
6362			if (!running) { trigger(); }
6363		};
6364
6365		this.end = function(fn) {
6366			var cb = callback;
6367
6368			if (!fn) { return; }
6369
6370			// If the timer is not running, simply call the end callback.
6371			if (!running) {
6372				fn();
6373			}
6374			// If the timer is running, and has been kicked lately, then
6375			// queue up the current callback and the end callback, otherwise
6376			// just the end callback.
6377			else {
6378				callback = active ?
6379					function(){ cb(); fn(); } :
6380					fn ;
6381
6382				active = true;
6383			}
6384		};
6385	}
6386
6387
6388	// Functions
6389
6390	function noop() {}
6391
6392	function preventDefault(e) {
6393		e.preventDefault();
6394	}
6395
6396	function isIgnoreTag(e) {
6397		return !!ignoreTags[e.target.tagName.toLowerCase()];
6398	}
6399
6400	function isPrimaryButton(e) {
6401		// Ignore mousedowns on any button other than the left (or primary)
6402		// mouse button, or when a modifier key is pressed.
6403		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6404	}
6405
6406	function identifiedTouch(touchList, id) {
6407		var i, l;
6408
6409		if (touchList.identifiedTouch) {
6410			return touchList.identifiedTouch(id);
6411		}
6412
6413		// touchList.identifiedTouch() does not exist in
6414		// webkit yet… we must do the search ourselves...
6415
6416		i = -1;
6417		l = touchList.length;
6418
6419		while (++i < l) {
6420			if (touchList[i].identifier === id) {
6421				return touchList[i];
6422			}
6423		}
6424	}
6425
6426	function changedTouch(e, data) {
6427		var touch = identifiedTouch(e.changedTouches, data.identifier);
6428
6429		// This isn't the touch you're looking for.
6430		if (!touch) { return; }
6431
6432		// Chrome Android (at least) includes touches that have not
6433		// changed in e.changedTouches. That's a bit annoying. Check
6434		// that this touch has changed.
6435		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6436
6437		return touch;
6438	}
6439
6440
6441	// Handlers that decide when the first movestart is triggered
6442
6443	function mousedown(e){
6444		// Ignore non-primary buttons
6445		if (!isPrimaryButton(e)) { return; }
6446
6447		// Ignore form and interactive elements
6448		if (isIgnoreTag(e)) { return; }
6449
6450		on(document, mouseevents.move, mousemove, e);
6451		on(document, mouseevents.cancel, mouseend, e);
6452	}
6453
6454	function mousemove(e, data){
6455		checkThreshold(e, data, e, removeMouse);
6456	}
6457
6458	function mouseend(e, data) {
6459		removeMouse();
6460	}
6461
6462	function removeMouse() {
6463		off(document, mouseevents.move, mousemove);
6464		off(document, mouseevents.cancel, mouseend);
6465	}
6466
6467	function touchstart(e) {
6468		// Don't get in the way of interaction with form elements
6469		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6470
6471		var touch = e.changedTouches[0];
6472
6473		// iOS live updates the touch objects whereas Android gives us copies.
6474		// That means we can't trust the touchstart object to stay the same,
6475		// so we must copy the data. This object acts as a template for
6476		// movestart, move and moveend event objects.
6477		var data = {
6478			target:     touch.target,
6479			pageX:      touch.pageX,
6480			pageY:      touch.pageY,
6481			identifier: touch.identifier,
6482
6483			// The only way to make handlers individually unbindable is by
6484			// making them unique.
6485			touchmove:  function(e, data) { touchmove(e, data); },
6486			touchend:   function(e, data) { touchend(e, data); }
6487		};
6488
6489		on(document, touchevents.move, data.touchmove, data);
6490		on(document, touchevents.cancel, data.touchend, data);
6491	}
6492
6493	function touchmove(e, data) {
6494		var touch = changedTouch(e, data);
6495		if (!touch) { return; }
6496		checkThreshold(e, data, touch, removeTouch);
6497	}
6498
6499	function touchend(e, data) {
6500		var touch = identifiedTouch(e.changedTouches, data.identifier);
6501		if (!touch) { return; }
6502		removeTouch(data);
6503	}
6504
6505	function removeTouch(data) {
6506		off(document, touchevents.move, data.touchmove);
6507		off(document, touchevents.cancel, data.touchend);
6508	}
6509
6510	function checkThreshold(e, data, touch, fn) {
6511		var distX = touch.pageX - data.pageX;
6512		var distY = touch.pageY - data.pageY;
6513
6514		// Do nothing if the threshold has not been crossed.
6515		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6516
6517		triggerStart(e, data, touch, distX, distY, fn);
6518	}
6519
6520	function triggerStart(e, data, touch, distX, distY, fn) {
6521		var touches = e.targetTouches;
6522		var time = e.timeStamp - data.timeStamp;
6523
6524		// Create a movestart object with some special properties that
6525		// are passed only to the movestart handlers.
6526		var template = {
6527			altKey:     e.altKey,
6528			ctrlKey:    e.ctrlKey,
6529			shiftKey:   e.shiftKey,
6530			startX:     data.pageX,
6531			startY:     data.pageY,
6532			distX:      distX,
6533			distY:      distY,
6534			deltaX:     distX,
6535			deltaY:     distY,
6536			pageX:      touch.pageX,
6537			pageY:      touch.pageY,
6538			velocityX:  distX / time,
6539			velocityY:  distY / time,
6540			identifier: data.identifier,
6541			targetTouches: touches,
6542			finger: touches ? touches.length : 1,
6543			enableMove: function() {
6544				this.moveEnabled = true;
6545				this.enableMove = noop;
6546				e.preventDefault();
6547			}
6548		};
6549
6550		// Trigger the movestart event.
6551		trigger(data.target, 'movestart', template);
6552
6553		// Unbind handlers that tracked the touch or mouse up till now.
6554		fn(data);
6555	}
6556
6557
6558	// Handlers that control what happens following a movestart
6559
6560	function activeMousemove(e, data) {
6561		var timer  = data.timer;
6562
6563		data.touch = e;
6564		data.timeStamp = e.timeStamp;
6565		timer.kick();
6566	}
6567
6568	function activeMouseend(e, data) {
6569		var target = data.target;
6570		var event  = data.event;
6571		var timer  = data.timer;
6572
6573		removeActiveMouse();
6574
6575		endEvent(target, event, timer, function() {
6576			// Unbind the click suppressor, waiting until after mouseup
6577			// has been handled.
6578			setTimeout(function(){
6579				off(target, 'click', preventDefault);
6580			}, 0);
6581		});
6582	}
6583
6584	function removeActiveMouse() {
6585		off(document, mouseevents.move, activeMousemove);
6586		off(document, mouseevents.end, activeMouseend);
6587	}
6588
6589	function activeTouchmove(e, data) {
6590		var event = data.event;
6591		var timer = data.timer;
6592		var touch = changedTouch(e, event);
6593
6594		if (!touch) { return; }
6595
6596		// Stop the interface from gesturing
6597		e.preventDefault();
6598
6599		event.targetTouches = e.targetTouches;
6600		data.touch = touch;
6601		data.timeStamp = e.timeStamp;
6602
6603		timer.kick();
6604	}
6605
6606	function activeTouchend(e, data) {
6607		var target = data.target;
6608		var event  = data.event;
6609		var timer  = data.timer;
6610		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6611
6612		// This isn't the touch you're looking for.
6613		if (!touch) { return; }
6614
6615		removeActiveTouch(data);
6616		endEvent(target, event, timer);
6617	}
6618
6619	function removeActiveTouch(data) {
6620		off(document, touchevents.move, data.activeTouchmove);
6621		off(document, touchevents.end, data.activeTouchend);
6622	}
6623
6624
6625	// Logic for triggering move and moveend events
6626
6627	function updateEvent(event, touch, timeStamp) {
6628		var time = timeStamp - event.timeStamp;
6629
6630		event.distX =  touch.pageX - event.startX;
6631		event.distY =  touch.pageY - event.startY;
6632		event.deltaX = touch.pageX - event.pageX;
6633		event.deltaY = touch.pageY - event.pageY;
6634
6635		// Average the velocity of the last few events using a decay
6636		// curve to even out spurious jumps in values.
6637		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6638		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6639		event.pageX =  touch.pageX;
6640		event.pageY =  touch.pageY;
6641	}
6642
6643	function endEvent(target, event, timer, fn) {
6644		timer.end(function(){
6645			trigger(target, 'moveend', event);
6646			return fn && fn();
6647		});
6648	}
6649
6650
6651	// Set up the DOM
6652
6653	function movestart(e) {
6654		if (e.defaultPrevented) { return; }
6655		if (!e.moveEnabled) { return; }
6656
6657		var event = {
6658			startX:        e.startX,
6659			startY:        e.startY,
6660			pageX:         e.pageX,
6661			pageY:         e.pageY,
6662			distX:         e.distX,
6663			distY:         e.distY,
6664			deltaX:        e.deltaX,
6665			deltaY:        e.deltaY,
6666			velocityX:     e.velocityX,
6667			velocityY:     e.velocityY,
6668			identifier:    e.identifier,
6669			targetTouches: e.targetTouches,
6670			finger:        e.finger
6671		};
6672
6673		var data = {
6674			target:    e.target,
6675			event:     event,
6676			timer:     new Timer(update),
6677			touch:     undefined,
6678			timeStamp: e.timeStamp
6679		};
6680
6681		function update(time) {
6682			updateEvent(event, data.touch, data.timeStamp);
6683			trigger(data.target, 'move', event);
6684		}
6685
6686		if (e.identifier === undefined) {
6687			// We're dealing with a mouse event.
6688			// Stop clicks from propagating during a move
6689			on(e.target, 'click', preventDefault);
6690			on(document, mouseevents.move, activeMousemove, data);
6691			on(document, mouseevents.end, activeMouseend, data);
6692		}
6693		else {
6694			// In order to unbind correct handlers they have to be unique
6695			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6696			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6697
6698			// We're dealing with a touch.
6699			on(document, touchevents.move, data.activeTouchmove, data);
6700			on(document, touchevents.end, data.activeTouchend, data);
6701		}
6702	}
6703
6704	on(document, 'mousedown', mousedown);
6705	on(document, 'touchstart', touchstart);
6706	on(document, 'movestart', movestart);
6707
6708
6709	// jQuery special events
6710	//
6711	// jQuery event objects are copies of DOM event objects. They need
6712	// a little help copying the move properties across.
6713
6714	if (!window.jQuery) { return; }
6715
6716	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6717
6718	function enableMove1(e) { e.enableMove(); }
6719	function enableMove2(e) { e.enableMove(); }
6720	function enableMove3(e) { e.enableMove(); }
6721
6722	function add(handleObj) {
6723		var handler = handleObj.handler;
6724
6725		handleObj.handler = function(e) {
6726			// Copy move properties across from originalEvent
6727			var i = properties.length;
6728			var property;
6729
6730			while(i--) {
6731				property = properties[i];
6732				e[property] = e.originalEvent[property];
6733			}
6734
6735			handler.apply(this, arguments);
6736		};
6737	}
6738
6739	jQuery.event.special.movestart = {
6740		setup: function() {
6741			// Movestart must be enabled to allow other move events
6742			on(this, 'movestart', enableMove1);
6743
6744			// Do listen to DOM events
6745			return false;
6746		},
6747
6748		teardown: function() {
6749			off(this, 'movestart', enableMove1);
6750			return false;
6751		},
6752
6753		add: add
6754	};
6755
6756	jQuery.event.special.move = {
6757		setup: function() {
6758			on(this, 'movestart', enableMove2);
6759			return false;
6760		},
6761
6762		teardown: function() {
6763			off(this, 'movestart', enableMove2);
6764			return false;
6765		},
6766
6767		add: add
6768	};
6769
6770	jQuery.event.special.moveend = {
6771		setup: function() {
6772			on(this, 'movestart', enableMove3);
6773			return false;
6774		},
6775
6776		teardown: function() {
6777			off(this, 'movestart', enableMove3);
6778			return false;
6779		},
6780
6781		add: add
6782	};
6783});
6784
6785  $.fn.twentytwenty = function(options) {
6786    var options = $.extend({
6787      default_offset_pct: 0.5,
6788      orientation: 'horizontal',
6789      before_label: 'Before',
6790      after_label: 'After',
6791      no_overlay: false,
6792      move_slider_on_hover: false,
6793      move_with_handle_only: true,
6794      click_to_move: false
6795    }, options);
6796
6797    return this.each(function() {
6798
6799      var sliderPct = options.default_offset_pct;
6800      var container = $(this);
6801      var sliderOrientation = options.orientation;
6802      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6803      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6804
6805
6806      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6807      if(!options.no_overlay) {
6808        container.append("<div class='twentytwenty-overlay'></div>");
6809        var overlay = container.find(".twentytwenty-overlay");
6810        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6811        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6812      }
6813      var beforeImg = container.find("img:first");
6814      var afterImg = container.find("img:last");
6815      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6816      var slider = container.find(".twentytwenty-handle");
6817      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6818      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6819      container.addClass("twentytwenty-container");
6820      beforeImg.addClass("twentytwenty-before");
6821      afterImg.addClass("twentytwenty-after");
6822
6823      var calcOffset = function(dimensionPct) {
6824        var w = beforeImg.width();
6825        var h = beforeImg.height();
6826        return {
6827          w: w+"px",
6828          h: h+"px",
6829          cw: (dimensionPct*w)+"px",
6830          ch: (dimensionPct*h)+"px"
6831        };
6832      };
6833
6834      var adjustContainer = function(offset) {
6835      	if (sliderOrientation === 'vertical') {
6836          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6837          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6838      	}
6839      	else {
6840          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6841          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6842    	}
6843        container.css("height", offset.h);
6844      };
6845
6846      var adjustSlider = function(pct) {
6847        var offset = calcOffset(pct);
6848        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6849        adjustContainer(offset);
6850      };
6851
6852      // Return the number specified or the min/max number if it outside the range given.
6853      var minMaxNumber = function(num, min, max) {
6854        return Math.max(min, Math.min(max, num));
6855      };
6856
6857      // Calculate the slider percentage based on the position.
6858      var getSliderPercentage = function(positionX, positionY) {
6859        var sliderPercentage = (sliderOrientation === 'vertical') ?
6860          (positionY-offsetY)/imgHeight :
6861          (positionX-offsetX)/imgWidth;
6862
6863        return minMaxNumber(sliderPercentage, 0, 1);
6864      };
6865
6866
6867      $(window).on("resize.twentytwenty", function(e) {
6868        adjustSlider(sliderPct);
6869      });
6870
6871      var offsetX = 0;
6872      var offsetY = 0;
6873      var imgWidth = 0;
6874      var imgHeight = 0;
6875      var onMoveStart = function(e) {
6876        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6877          e.preventDefault();
6878        }
6879        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6880          e.preventDefault();
6881        }
6882        container.addClass("active");
6883        offsetX = container.offset().left;
6884        offsetY = container.offset().top;
6885        imgWidth = beforeImg.width();
6886        imgHeight = beforeImg.height();
6887      };
6888      var onMove = function(e) {
6889        if (container.hasClass("active")) {
6890          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6891          adjustSlider(sliderPct);
6892        }
6893      };
6894      var onMoveEnd = function() {
6895          container.removeClass("active");
6896      };
6897
6898      var moveTarget = options.move_with_handle_only ? slider : container;
6899      moveTarget.on("movestart",onMoveStart);
6900      moveTarget.on("move",onMove);
6901      moveTarget.on("moveend",onMoveEnd);
6902
6903      if (options.move_slider_on_hover) {
6904        container.on("mouseenter", onMoveStart);
6905        container.on("mousemove", onMove);
6906        container.on("mouseleave", onMoveEnd);
6907      }
6908
6909      slider.on("touchmove", function(e) {
6910        e.preventDefault();
6911      });
6912
6913      container.find("img").on("mousedown", function(event) {
6914        event.preventDefault();
6915      });
6916
6917      if (options.click_to_move) {
6918        container.on('click', function(e) {
6919          offsetX = container.offset().left;
6920          offsetY = container.offset().top;
6921          imgWidth = beforeImg.width();
6922          imgHeight = beforeImg.height();
6923
6924          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6925          adjustSlider(sliderPct);
6926        });
6927      }
6928
6929      $(window).trigger("resize.twentytwenty");
6930    });
6931  };
6932
6933
6934  $(window).on("load", function(e) {
6935  	$('.twentytwenty-container').each(function(){
6936  		var $container = $(this);
6937  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6938  			$container.twentytwenty();
6939  		}
6940  		$('img', $container).on('async-done', function(){
6941	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6942	  			$container.twentytwenty();
6943	  		}
6944	    });
6945  	});
6946  });
6947}
6948
6949UNCODE.justifiedGallery = function() {
6950
6951	var breakPointMe = function( val ) {
6952		val = parseInt( val );
6953		if ( isNaN(val) ) {
6954			return false;
6955		}
6956		if ( val >= 1500 ) {
6957			return 1;
6958		} else if ( val < 1500 && val >= 960 ) {
6959			return 2;
6960		} else if ( val < 960 && val >= 570 ) {
6961			return 3;
6962		} else if ( val < 570 ) {
6963			return 4;
6964		}
6965	}
6966
6967	var gutterByBreakpoint = function( bp, gutter ) {
6968		var ret;
6969		switch(gutter) {
6970		    case 'no-gutter':
6971		    	ret = 0;
6972		        break;
6973		    case 'px-gutter':
6974		    	ret = 1;
6975		        break;
6976		    case 'half-gutter':
6977		    	ret = 18;
6978		        break;
6979		    case 'double-gutter':
6980				switch(bp) {
6981				    case 3:
6982				    case 4:
6983				    	ret = 36;
6984				        break;
6985				    default:
6986				    	ret = 72;
6987				        break;
6988				}
6989		        break;
6990		    case 'triple-gutter':
6991				switch(bp) {
6992				    case 3:
6993				    case 4:
6994				    	ret = 36;
6995				        break;
6996				    default:
6997				    	ret = 108;
6998				        break;
6999				}
7000		        break;
7001		    case 'quad-gutter':
7002				switch(bp) {
7003				    case 2:
7004				    	ret = 108;
7005				        break;
7006				    case 3:
7007				    	ret = 72;
7008				        break;
7009				    case 4:
7010				    	ret = 36;
7011				        break;
7012				    default:
7013				    	ret = 144;
7014				        break;
7015				}
7016		        break;
7017		    default:
7018		    	ret = 36;//single-gutter
7019		}
7020		return ret;
7021	}
7022
7023	if ($('.justified-layout').length > 0) {
7024		var justifiedContainersArray = [],
7025			typeGridArray = [],
7026			layoutGridArray = [],
7027			transitionDuration = [],
7028			$filterItems = [],
7029			$filters = $('.justified-system .isotope-filters'),
7030			$itemSelector = '.tmb',
7031			$items,
7032			itemMargin,
7033			correctionFactor = 0,
7034			firstLoad = true,
7035			isOriginLeft = $('body').hasClass('rtl') ? false : true,
7036			prevW = breakPointMe(UNCODE.wwidth);
7037		$('[class*="justified-container"]').each(function() {
7038			var isoData = $(this).data();
7039			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7040			if (isoData.type == 'metro') typeGridArray.push(true);
7041			else typeGridArray.push(false);
7042			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
7043			else layoutGridArray.push('justified');
7044			justifiedContainersArray.push($(this));
7045		});
7046		var init_justifiedGallery = function() {
7047			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
7048				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
7049					justifiedId = justifiedSystem.attr('id'),
7050					$layoutMode = layoutGridArray[i],
7051					gutter = $(justifiedContainersArray[i]).data('gutter'),
7052					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
7053					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
7054					lastRow = $(justifiedContainersArray[i]).data('last-row'),
7055					margins;
7056
7057				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
7058				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
7059				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7060
7061				margins = gutterByBreakpoint(prevW, gutter);
7062
7063				$(justifiedContainersArray[i]).justifiedGallery({
7064					rowHeight: rowHeight,
7065					maxRowHeight: maxRowHeight,
7066					margins: margins,
7067					cssAnimation: true,
7068					lastRow: lastRow,
7069					waitThumbnailsLoad: false
7070				}).one('jg.complete', function(){ onLayout($(this), 0); } );
7071
7072				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
7073					$(justifiedContainersArray[i]).infinitescroll({
7074							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
7075							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7076							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
7077							animate: false,
7078							behavior: 'local',
7079							debug: false,
7080							loading: {
7081								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
7082								speed: 0,
7083								finished: undefined,
7084								msg: $('#' + justifiedId + ' .loadmore-button'),
7085							},
7086							errorCallback: function() {
7087								var justified_system = $(this).closest('.justified-system');
7088								$('.loading-button', justified_system).hide();
7089								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7090							}
7091						},
7092						// append the new items to galleryJustified on the infinitescroll callback function.
7093						function(newElements, opts) {
7094							var $galleryJustified = $(this),
7095								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7096								filters = new Array(),
7097								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7098								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7099								$numPages = $('a', $infinite_button).data('pages'),
7100								delay = 300;
7101							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7102							if ($galleryJustified.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
7103								$infinite_button.show();
7104							} else {
7105								$infinite_button.hide();
7106							}
7107							$loading_button.hide();
7108							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7109							$('> li', $galleryJustified).remove();
7110							$.each($(newElements), function(index, val) {
7111								$(val).addClass('tmb-iso');
7112								if ($(val).is("li")) {
7113									filters.push($(val)[0]);
7114								}
7115								$(val).addClass('uncode-appended');
7116							});
7117							newElements = newElements.filter(function(x) {
7118								return filters.indexOf(x) < 0
7119							});
7120							$.each($(filters), function(index, val) {
7121								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7122							});
7123							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7124							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7125								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7126								if (typeof getLightbox === 'object') {
7127									getLightbox.refresh();
7128								} else {
7129									UNCODE.lightbox();
7130								}
7131							}
7132							if ( typeof twttr !== 'undefined' )
7133								twttr.widgets.load(justifiedContainersArray[i]);
7134
7135							requestTimeout(function() {
7136								$galleryJustified.trigger('more-items-loaded');
7137								$(window).trigger('more-items-loaded');
7138								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7139								fillIfNotScrollable($galleryJustified);
7140							}, 1000);
7141						});
7142					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7143						var $infinite_justified = $(justifiedContainersArray[i]),
7144							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7145						$infinite_justified.infinitescroll('pause');
7146						$infinite_button.on('click', function(event) {
7147							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7148								$.each(UNCODE.lightboxArray, function(index, val) {
7149									UNCODE.lightboxArray[index].destroy();
7150								});
7151							}
7152							event.preventDefault();
7153							var $justified_system = $(event.target).closest('.justified-system'),
7154							$infinite_justified = $justified_system.find('.justified-container'),
7155							justifiedId = $justified_system.attr('id');
7156							$(event.currentTarget).html(SiteParameters.loading);
7157							$infinite_justified.infinitescroll('resume');
7158							$infinite_justified.infinitescroll('retrieve');
7159							$infinite_justified.infinitescroll('pause');
7160							$infinite_justified.trigger('more-items-loaded');
7161							$(window).trigger('more-items-loaded');
7162							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7163						});
7164					}
7165					(function ($c) {
7166						requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
7167					})($(justifiedContainersArray[i]));
7168				}
7169			}
7170		},
7171		fillIfNotScrollable = function ($container) {
7172			if ($container.hasClass('isotope-infinite-button')) return;
7173			if (!$container.hasClass('isotope-infinite')) return;
7174			var infData = $container.data('infinitescroll');
7175			if (!infData || !infData.options || !infData.options.state) return;
7176			var state = infData.options.state;
7177			if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPaused) return;
7178			var $loadMoreA = $container.closest('.justified-system').find('.loadmore-button a');
7179			var numPages = parseInt($loadMoreA.data('pages'), 10);
7180			if (!numPages || state.currPage >= numPages) return;
7181			if (document.documentElement.scrollHeight > window.innerHeight + 1) return;
7182			$container.infinitescroll('retrieve');
7183		},
7184		onLayout = function(justifiedObj, startIndex) {
7185			justifiedObj.css('opacity', 1);
7186			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7187			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7188
7189			requestTimeout(function() {
7190				// window.dispatchEvent(UNCODE.boxEvent);
7191				UNCODE.adaptive();
7192				if (SiteParameters.dynamic_srcset_active === '1') {
7193					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7194				}
7195				if (typeof MediaElement === "function") {
7196					$(justifiedObj).find('audio,video').each(function() {
7197						$(this).mediaelementplayer({
7198								pauseOtherPlayers: false,
7199						});
7200					});
7201				}
7202				if ($(justifiedObj).find('.nested-carousel').length) {
7203					if (typeof UNCODE.carousel !== 'undefined') {
7204						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7205					}
7206					requestTimeout(function() {
7207						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7208						justifiedObj.addClass('justified-gallery-finished')
7209						Waypoint.refreshAll();
7210					}, 200);
7211				} else {
7212					requestTimeout(function() {
7213						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7214						justifiedObj.addClass('justified-gallery-finished')
7215						Waypoint.refreshAll();
7216					}, 300);
7217				}
7218			}, 100);
7219
7220		},
7221		boxAnimation = function(items, startIndex, sequential, container) {
7222			var $allItems = items.length - startIndex,
7223				showed = 0,
7224				index = 0;
7225			if (container.closest('.owl-item').length == 1) return false;
7226			$.each(items, function(index, val) {
7227				var elInner = $('> .t-inside', val);
7228				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7229					return;
7230				}
7231				if (val[0]) val = val[0];
7232				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7233					new Waypoint({
7234						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7235						element: val,
7236						handler: function() {
7237							var element = $('> .t-inside', this.element),
7238								parent = $(this.element),
7239								currentIndex = parent.index();
7240							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7241								delayAttr = parseInt(element.attr('data-delay'));
7242							if (isNaN(delayAttr)) delayAttr = 100;
7243							delay -= showed;
7244							var objTimeout = requestTimeout(function() {
7245								element.removeClass('zoom-reverse').addClass('start_animation');
7246								showed = parent.index();
7247							}, delay * delayAttr);
7248							parent.data('objTimeout', objTimeout);
7249							if (!UNCODE.isUnmodalOpen) {
7250								this.destroy();
7251							}
7252						},
7253						offset: '100%'
7254					})
7255				} else {
7256					elInner.removeClass('animate_when_almost_visible');
7257					$(val).addClass('no-waypoint-animation');
7258					/*if (elInner.hasClass('force-anim')) {
7259						elInner.addClass('start_animation');
7260					} else {
7261						elInner.css('opacity', 1);
7262					}*/
7263				}
7264				index++;
7265			});
7266		};
7267		$filters.on('click', 'a[data-filter]', function(evt) {
7268			var $filter = $(this),
7269				filterContainer = $filter.closest('.isotope-filters'),
7270				filterValue = $filter.attr('data-filter'),
7271				container = $filter.closest('.justified-system').find($('.justified-layout')),
7272				lastRow = container.data('last-row'),
7273				transitionDuration = 0,
7274				delay = 300,
7275				filterItems = [];
7276
7277			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7278
7279			var filter_items = function(){
7280				if (filterValue !== undefined) {
7281					$.each($('> .tmb > .t-inside', container), function(index, val) {
7282						var parent = $(val).parent(),
7283							objTimeout = parent.data('objTimeout');
7284						if (objTimeout) {
7285							$(val).removeClass('zoom-reverse');
7286							clearRequestTimeout(objTimeout);
7287						}
7288						if (transitionDuration == 0) {
7289							if ($(val).hasClass('animate_when_almost_visible')) {
7290								$(val).addClass('zoom-reverse').removeClass('start_animation');
7291							} else {
7292								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7293							}
7294						}
7295					});
7296
7297					requestTimeout(function() {
7298						var $block,
7299							selector,
7300							lightboxElements,
7301							$boxes;
7302
7303						if ( filterValue !== '' && filterValue !== '*' ) {
7304							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7305							selector = '.' + filterValue;
7306							$.each($(selector, container), function(index, block) {
7307								lightboxElements = $('[data-lbox^=ilightbox]', block);
7308								if (lightboxElements.length) {
7309									lightboxElements.removeClass('lb-disabled');
7310									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7311								}
7312								filterItems.push(block);
7313							});
7314							container.justifiedGallery({
7315								filter: selector,
7316								lastRow: 'nojustify'
7317							});
7318						} else {
7319							container.justifiedGallery({
7320								filter: false,
7321								lastRow: lastRow
7322							});
7323							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7324							filterItems = $('> .tmb', container);
7325						}
7326						container.trigger('more-items-loaded');
7327						$(window).trigger('more-items-loaded');
7328						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7329
7330						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7331						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7332							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7333							if (typeof getLightbox === 'object') {
7334								getLightbox.refresh();
7335							} else {
7336								UNCODE.lightbox();
7337							}
7338						}
7339
7340						if (transitionDuration == 0) {
7341							requestTimeout(function() {
7342								boxAnimation(filterItems, 0, false, container);
7343							}, 100);
7344						}
7345						requestTimeout(function() {
7346							Waypoint.refreshAll();
7347							container.trigger('more-items-loaded');
7348							$(window).trigger('more-items-loaded');
7349							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7350							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7351								$(document).trigger('uncode-scrolltrigger-refresh');
7352							}
7353						}, 2000);
7354						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
7355
7356					}, delay);
7357				} else {
7358					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7359						$.each(UNCODE.lightboxArray, function(index, val) {
7360							UNCODE.lightboxArray[index].destroy();
7361						});
7362					}
7363					$.each($('> .tmb > .t-inside', container), function(index, val) {
7364						var parent = $(val).parent(),
7365							objTimeout = parent.data('objTimeout');
7366						if (objTimeout) {
7367							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7368							clearRequestTimeout(objTimeout);
7369						}
7370						if (transitionDuration == 0) {
7371							if ($(val).hasClass('animate_when_almost_visible')) {
7372								$(val).addClass('zoom-reverse').removeClass('start_animation');
7373							} else {
7374								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7375							}
7376						}
7377					});
7378					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7379						UNCODE.lightbox();
7380					}
7381					container.parent().addClass('justified-loading');
7382					container.trigger('more-items-loaded');
7383					$(window).trigger('more-items-loaded');
7384					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7385				}
7386			};
7387
7388			if (!$filter.hasClass('active')) {
7389				/** Scroll top with filtering */
7390				if (filterContainer.hasClass('filter-scroll')) {
7391                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7392                    calc_scroll -= UNCODE.get_scroll_offset();
7393
7394					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7395						delta = bodyTop - calc_scroll,
7396						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7397						filterTolerance = false,
7398						filter_timeout;
7399					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7400
7401					if ( !UNCODE.isFullPage ) {
7402						if (scrollSpeed == 0) {
7403							$('html, body').scrollTop(calc_scroll);
7404							UNCODE.scrolling = false;
7405							filter_items();
7406						} else {
7407
7408							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7409								filter_items();
7410								filterTolerance = true;
7411							}
7412
7413							$('html, body').animate({
7414								scrollTop: calc_scroll
7415							},{
7416								easing: 'easeInOutQuad',
7417								duration: scrollSpeed,
7418								complete: function(){
7419									UNCODE.scrolling = false;
7420									if ( !filterTolerance ) {
7421										filter_timeout = setTimeout(function(){
7422											clearTimeout(filter_timeout);
7423											filter_items();
7424										}, 200);
7425									}
7426								}
7427							});
7428						}
7429					}
7430				} else {
7431					filter_items();
7432				}
7433			}
7434			evt.preventDefault();
7435		});
7436
7437		$filters.each(function(i, buttonGroup) {
7438			var $buttonGroup = $(buttonGroup);
7439			$buttonGroup.on('click', 'a', function() {
7440				$buttonGroup.find('.active').removeClass('active');
7441				$(this).addClass('active');
7442			});
7443
7444			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7445				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7446				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7447			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7448				e.preventDefault();
7449				$cats_filters.slideToggle(400, 'easeInOutCirc');
7450			});
7451		});
7452		window.addEventListener('boxResized', function(e) {
7453			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7454				prevW = breakPointMe(UNCODE.wwidth);
7455				$.each($('.justified-layout'), function(index, val) {
7456					var gutter = $(this).data('gutter'),
7457						margins = gutterByBreakpoint( prevW, gutter);
7458					$(this).justifiedGallery({
7459						margins: margins
7460					});
7461					$(this).find('.mejs-video,.mejs-audio').each(function() {
7462						$(this).trigger('resize');
7463					});
7464				});
7465			}
7466		}, false);
7467
7468		init_justifiedGallery();
7469	};
7470};
7471
7472UNCODE.cssGrid = function() {
7473	if ($('.cssgrid-layout').length > 0) {
7474		var cssGridContainersArray = [];
7475		var transitionDuration = [];
7476		var $filters = $('.cssgrid-system .cssgrid-filters');
7477
7478		$('[class*="cssgrid-container"]').each(function() {
7479			cssGridContainersArray.push($(this));
7480			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7481		});
7482
7483		var init_cssGridAjax = function() {
7484			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7485				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7486					cssGridId = cssGridSystem.attr('id');
7487
7488				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7489
7490				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7491					$(cssGridContainersArray[i]).infinitescroll({
7492						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7493						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7494						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7495						animate: false,
7496						behavior: 'local',
7497						debug: false,
7498						loading: {
7499							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7500							speed: 0,
7501							finished: undefined,
7502							msg: $('#' + cssGridId + ' .loadmore-button'),
7503						},
7504						errorCallback: function() {
7505							var cssgrid_system = $(this).closest('.cssgrid-system');
7506							$('.loading-button', cssgrid_system).hide();
7507							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7508						}
7509					},
7510					// append the new items to cssGrid on the infinitescroll callback function.
7511					function(newElements, opts) {
7512						var $cssGrid = $(this),
7513							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7514							cssGridId = cssGridSystemCont.attr('id'),
7515							filters = new Array(),
7516							$loading_button = cssGridSystemCont.find('.loading-button'),
7517							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7518							$numPages = $('a', $infinite_button).data('pages'),
7519							$woo_results,
7520							delay = 300;
7521						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7522						$infinite_button.show();
7523						$loading_button.hide();
7524						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7525						$('> li', $cssGrid).remove();
7526						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7527						$.each($(newElements), function (index, val) {
7528							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7529								$woo_results = $(val);
7530								delete newElements[index];
7531							} else {
7532								$(val).addClass('tmb-grid');
7533								if ($(val).is("li")) {
7534									filters.push($(val)[0]);
7535								}
7536							}
7537							$(val).addClass('uncode-appended');
7538						});
7539						newElements = newElements.filter(function(x) {
7540							return filters.indexOf(x) < 0
7541						});
7542						$.each($(filters), function(index, val) {
7543							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7544						});
7545						if ($woo_results && $woo_results.length > 0) {
7546							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7547							var new_count = $woo_results.find('.woocommerce-result-count').text();
7548							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7549							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7550							function replaceMatch(match, p1, p2) {
7551        						return old_start + '–' + new_end;
7552							}
7553							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7554							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7555						}
7556
7557						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7558						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7559						if (filterValue !== undefined && filterValue != '*') {
7560							$(newElements).hide();
7561							var els_to_show = $();
7562							$(newElements).each(function() {
7563								var el = $(this);
7564								if (el.hasClass(filterValue)) {
7565									els_to_show = els_to_show.add(el);
7566									el.show();
7567								}
7568							});
7569							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7570						} else {
7571							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7572						}
7573
7574						UNCODE.adaptive();
7575						if (SiteParameters.dynamic_srcset_active === '1') {
7576							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7577						}
7578						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7579							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7580							if (typeof getLightbox === 'object') {
7581								getLightbox.refresh();
7582							} else {
7583								UNCODE.lightbox();
7584							}
7585						}
7586						if ( typeof twttr !== 'undefined' ) {
7587							twttr.widgets.load(cssGridContainersArray[i]);
7588						}
7589
7590						UNCODE.carousel($(newElements));
7591						requestTimeout(function() {
7592							$cssGrid.trigger('more-items-loaded');
7593							$(window).trigger('more-items-loaded');
7594							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7595						}, 1000);
7596
7597					});
7598					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7599						var $cssgrid_el = $(cssGridContainersArray[i]),
7600							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7601						$cssgrid_el.infinitescroll('pause');
7602						$infinite_button.on('click', function(event) {
7603							event.preventDefault();
7604							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7605							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7606							cssGridId = $cssgrid_system.attr('id');
7607							$(event.currentTarget).html(SiteParameters.loading);
7608							$cssgrid_el.infinitescroll('resume');
7609							$cssgrid_el.infinitescroll('retrieve');
7610							$cssgrid_el.infinitescroll('pause');
7611						});
7612					}
7613				}
7614			}
7615		};
7616
7617		init_cssGridAjax();
7618
7619		if ($('.cssgrid-pagination').length > 0) {
7620			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7621				evt.preventDefault();
7622
7623				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7624					var container = $(this).closest('.cssgrid-system'),
7625						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7626						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7627
7628					if ( pagination_disable_scroll !== 'disabled' ) {
7629						calc_scroll -= UNCODE.get_scroll_offset();
7630
7631						var menu_container = $('.menu-sticky');
7632						var menu = menu_container.find('.menu-container');
7633
7634						if (menu_container.length > 0 && menu.length > 0) {
7635							calc_scroll = calc_scroll - menu.outerHeight();
7636						}
7637
7638						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7639							delta = bodyTop - calc_scroll,
7640							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7641						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7642
7643						if ( !UNCODE.isFullPage ) {
7644							if (scrollSpeed == 0) {
7645								$('html, body').scrollTop(calc_scroll);
7646							} else {
7647								$('html, body').animate({
7648									scrollTop: calc_scroll
7649								},{
7650									easing: 'easeInOutQuad',
7651									duration: scrollSpeed,
7652									complete: function(){
7653										UNCODE.scrolling = false;
7654									}
7655								});
7656							}
7657						}
7658					}
7659				}
7660
7661				loadCssGrid($(this), true);
7662			});
7663		}
7664
7665		$filters.on('click', 'a.grid-nav-link', function(evt) {
7666			if ($(this).hasClass('no-grid-filter')) {
7667				return;
7668			}
7669			var $filter = $(this),
7670				filterContainer = $filter.closest('.cssgrid-filters'),
7671				filterValue = $filter.attr('data-filter'),
7672				containerSystem = $filter.closest('.cssgrid-system'),
7673				container = containerSystem.find($('.cssgrid-layout')),
7674				transitionDuration = containerSystem.data('transitionDuration'),
7675				delay = 300,
7676				filterItems = [],
7677				all_thumbs = container.find('.tmb-grid');
7678
7679			var filter_items = function(){
7680				if (filterValue !== undefined) {
7681					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7682						var parent = $(val).parent(),
7683							objTimeout = parent.data('objTimeout');
7684						if (objTimeout) {
7685							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7686							clearRequestTimeout(objTimeout);
7687						}
7688						if (transitionDuration == 0) {
7689							if ($(val).hasClass('animate_when_almost_visible')) {
7690								$(val).addClass('zoom-reverse').removeClass('start_animation');
7691							} else {
7692								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7693							}
7694						}
7695					});
7696					requestTimeout(function(){
7697						if ( filterValue == '*' ) {
7698							all_thumbs.show();
7699							all_thumbs.each(function(index, val) {
7700								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7701								filterItems.push($(this));
7702							});
7703						} else {
7704							all_thumbs.each(function() {
7705								var _tmb = $(this);
7706								if (_tmb.hasClass(filterValue)) {
7707									_tmb.show();
7708									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7709									filterItems.push(_tmb);
7710								} else {
7711									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7712									_tmb.hide();
7713								}
7714							});
7715						}
7716
7717						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7718
7719						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7720						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7721						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7722						if (lightboxElements.length) {
7723							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7724							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7725								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7726								if (typeof getLightbox === 'object') {
7727									getLightbox.refresh();
7728								} else {
7729									UNCODE.lightbox();
7730								}
7731							}
7732						}
7733						container.trigger('more-items-loaded');
7734						$(window).trigger('more-items-loaded');
7735						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7736					}, delay);
7737				} else {
7738					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7739						var parent = $(val).parent(),
7740							objTimeout = parent.data('objTimeout');
7741						if (objTimeout) {
7742							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7743							clearRequestTimeout(objTimeout);
7744						}
7745						if (transitionDuration == 0) {
7746							if ($(val).hasClass('animate_when_almost_visible')) {
7747								$(val).addClass('zoom-reverse').removeClass('start_animation');
7748							} else {
7749								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7750							}
7751						}
7752					});
7753					loadCssGrid($filter);
7754				}
7755			};
7756
7757			if (!$filter.hasClass('active')) {
7758				/** Scroll top with filtering */
7759				if (filterContainer.hasClass('filter-scroll')) {
7760                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7761                    calc_scroll -= UNCODE.get_scroll_offset();
7762
7763					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7764						delta = bodyTop - calc_scroll,
7765						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7766						filterTolerance = false,
7767						filter_timeout;
7768					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7769
7770					if ( !UNCODE.isFullPage ) {
7771						if (scrollSpeed == 0) {
7772							$('html, body').scrollTop(calc_scroll);
7773							UNCODE.scrolling = false;
7774							filter_items();
7775						} else {
7776
7777							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7778								filter_items();
7779								filterTolerance = true;
7780							}
7781
7782							$('html, body').animate({
7783								scrollTop: calc_scroll
7784							},{
7785								easing: 'easeInOutQuad',
7786								duration: scrollSpeed,
7787								complete: function(){
7788									UNCODE.scrolling = false;
7789									if ( !filterTolerance ) {
7790										filter_timeout = setTimeout(function(){
7791											clearTimeout(filter_timeout);
7792											filter_items();
7793										}, 200);
7794									}
7795								}
7796							});
7797						}
7798					}
7799				} else {
7800					filter_items();
7801				}
7802			}
7803			evt.preventDefault();
7804		});
7805
7806		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7807			var params = UNCODE.getURLParams(window.location);
7808			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7809
7810			UNCODE.lastURL = window.location.href;
7811
7812			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7813				return;
7814			}
7815
7816			if (params.id === undefined) {
7817				$.each($('.cssgrid-system'), function(index, val) {
7818					loadCssGrid($(val));
7819				});
7820			} else {
7821				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7822					loadCssGrid($('#' + params.id));
7823				}
7824			}
7825		});
7826
7827		var loadCssGrid = function($href, $paginating) {
7828			var is_paginating = false;
7829
7830			if (undefined !== $paginating && $paginating) {
7831				var is_paginating = $paginating;
7832			}
7833
7834			var href = ($href.is("a") ? $href.attr('href') : location),
7835				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7836				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7837				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7838				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7839				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7840				cssgridId = cssgridSystem.attr('id');
7841			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7842				UNCODE.lastURL = href;
7843				history.pushState({
7844					myCSSgrid: true
7845				}, document.title, href);
7846			}
7847			cssgridWrapper.addClass('cssgrid-loading');
7848			if (is_paginating) {
7849				cssgridWrapper.addClass('grid-filtering');
7850			}
7851			$.ajax({
7852				url: href
7853			}).done(function(data) {
7854				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7855					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7856					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7857				requestTimeout(function() {
7858					cssgridContainer.html($resultItems);
7859					cssgridWrapper.removeClass('cssgrid-loading');
7860					cssgridWrapper.removeClass('grid-filtering');
7861					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7862					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7863					UNCODE.adaptive();
7864					if (SiteParameters.dynamic_srcset_active === '1') {
7865						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7866					}
7867					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7868						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7869						if (typeof getLightbox === 'object') {
7870							getLightbox.refresh();
7871						} else {
7872							UNCODE.lightbox();
7873						}
7874					}
7875					cssgridContainer.trigger('more-items-loaded');
7876					$(window).trigger('more-items-loaded');
7877					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7878				}, 300);
7879
7880				$('.pagination', cssgridFooter).remove();
7881				cssgridFooter.append($resultPagination);
7882
7883				if (cssgridResultCount.length > 0) {
7884					$('.woocommerce-result-count', cssgridResultCount).remove();
7885					cssgridResultCount.append($resultCount);
7886				}
7887			});
7888		};
7889
7890		$filters.each(function(i, buttonGroup) {
7891			var $buttonGroup = $(buttonGroup);
7892			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7893				$buttonGroup.find('.active').removeClass('active');
7894				$(this).addClass('active');
7895
7896			});
7897
7898			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7899				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7900				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7901			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7902				e.preventDefault();
7903				$cats_filters.slideToggle(400, 'easeInOutCirc');
7904			});
7905
7906		});
7907	};
7908};
7909
7910UNCODE.linearGrid = function(){
7911	$('.linear-wrapper').each(function(){
7912		var $wrap = $(this),
7913			$system = $wrap.closest('.linear-system'),
7914			$dragger = $('[data-dragger]', $system),
7915			$row = $wrap.closest('.vc_row[data-parent]'),
7916			_row = $row[0],
7917			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7918			vertical = $cont.hasClass('linear-or-vertical'),
7919			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7920			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7921			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7922			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7923			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7924			isInViewport = false,
7925			isHover = false,
7926			init = false,
7927			stableHeight = UNCODE.wheight,
7928			wCont, hCont, docH, marqueeTL;
7929
7930		if ( ! $('.tmb', $cont).length ) {
7931			return;
7932		}
7933
7934		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7935		var dataX = dataSpeed;
7936
7937		dataSpeed += 5;
7938
7939		var checkLinearGridSize = function(){
7940			if ( !$wrap.is(':visible') )  {
7941				return;
7942			}
7943			$wrap.find('.cont-appended').remove();
7944
7945			if ( vertical ) {
7946				if ( ! SiteParameters.is_frontend_editor ) {
7947					hCont = $cont.outerHeight();
7948					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7949					if ( hCont < docH ) {
7950						var res = docH - hCont * 3,
7951							times = 2 * Math.round((res/hCont+1) / 2);
7952					}
7953					for ( var i = 0; i < times; i++ ) {
7954						var $cloneCont = $cont.clone(),
7955							$cloneCont2 = $cont.clone(),
7956							trans = ( (i+2) ) * 100;
7957						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7958						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7959						$cloneCont.find('a[data-lbox]').each(function(){
7960							var dataLbox = $(this).attr('data-lbox');
7961							$(this).attr('data-lbox', dataLbox + '_' + i);
7962						});
7963						$cloneCont.find('.wp-video-shortcode').each(function(){
7964							var thisID = $(this).attr('id');
7965							$(this).attr('id', thisID + '_' + i);
7966						});
7967						$cloneCont2.find('a[data-lbox]').each(function(){
7968							var dataLbox = $(this).attr('data-lbox');
7969							$(this).attr('data-lbox', dataLbox + '_2' + i);
7970						});
7971						$cloneCont2.find('.wp-video-shortcode').each(function(){
7972							var thisID = $(this).attr('id');
7973							$(this).attr('id', thisID + '__' + i);
7974						});
7975						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7976							UNCODE.lightgallery($cloneCont);
7977							UNCODE.lightgallery($cloneCont2);
7978						}
7979					}
7980                }
7981			} else {
7982				wCont = $cont.outerWidth();
7983				if ( (wCont) < UNCODE.wwidth*2 ) {
7984					var res = UNCODE.wwidth*2 - (wCont),
7985						times = 2 * Math.round((res/wCont+1) / 2);
7986				}
7987				for ( var i = 0; i < times; i++ ) {
7988					var $cloneCont = $cont.clone(),
7989						$cloneCont2 = $cont.clone(),
7990						trans = ( (i+2) ) * 100;
7991					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7992					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7993					$cloneCont.find('a[data-lbox]').each(function(){
7994						var dataLbox = $(this).attr('data-lbox');
7995						$(this).attr('data-lbox', dataLbox + '_' + i);
7996					});
7997					$cloneCont.find('[id]').each(function(){
7998						var thisID = $(this).attr('id');
7999						$(this).attr('id', thisID + '_' + i);
8000					});
8001					$cloneCont2.find('a[data-lbox]').each(function(){
8002						var dataLbox = $(this).attr('data-lbox');
8003						$(this).attr('data-lbox', dataLbox + '_2' + i);
8004					});
8005					$cloneCont2.find('[id]').each(function(){
8006						var thisID = $(this).attr('id');
8007						$(this).attr('id', thisID + '__' + i);
8008					});
8009                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
8010                        UNCODE.lightgallery($cloneCont);
8011                        UNCODE.lightgallery($cloneCont2);
8012                    }
8013                }
8014			}
8015		};
8016		if ( clone ) {
8017			checkLinearGridSize();
8018			$(window).on('resize.linearGrid', function(){
8019				checkLinearGridSize();
8020			});
8021		}
8022
8023		var continuousLinearMarquee = function(_xStrt){
8024			if ( !$wrap.is(':visible') )  {
8025				return;
8026			}
8027			var ease = 'none';
8028			wCont = $cont.outerWidth();
8029			hCont = $cont.outerHeight();
8030
8031			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
8032				xEnd = vertical ? hCont : wCont,
8033				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8034				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
8035				speedSlow = (xEnd + xStrt) / 45,
8036				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8037
8038			marqueeTL = new TimelineMax({paused:true, reversed:true});
8039
8040			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
8041				marqueeTL.play();
8042
8043				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
8044					var $column = $wrap.closest('.wpb_column'),
8045						$col_link = $('.col-link', $column),
8046						$hover_sel = $wrap;
8047
8048					if ( $col_link.length ) {
8049						$hover_sel = $wrap.add($column);
8050					}
8051
8052					$hover_sel.on('mouseover', function(){
8053						if ( $wrap.attr('data-hover') === 'yes' ) {
8054							//speed = ( 10 - dataSpeed ) * 5;
8055							ease = 'power2.out';
8056							marqueeTL.duration( speedSlow );
8057						} else {
8058							marqueeTL.pause();
8059						}
8060						isHover = true;
8061					}).on('mouseout', function(){
8062						if ( $wrap.attr('data-hover') === 'yes' ) {
8063							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
8064							ease = 'power2.in';
8065							marqueeTL.duration( speed );
8066						} else {
8067							marqueeTL.play();
8068						}
8069						isHover = false;
8070					});
8071				}
8072
8073				$(document).on('sub-menu-slide-up', function(){
8074					if ( isInMenu ) {
8075						marqueeTL.pause();
8076					}
8077				});
8078
8079			}
8080	
8081			gsap.killTweensOf($wrap);
8082			if ( vertical ) {
8083				marqueeTL.fromTo( $wrap, {
8084					y: xStrt * direction
8085				},
8086				{
8087					duration: speed,
8088					y: xEnd * direction * -1,
8089					onComplete: function(){
8090						continuousLinearMarquee();
8091					},
8092					ease: ease,
8093					paused: freezed
8094				});
8095			} else {
8096				marqueeTL.fromTo( $wrap, {
8097					x: xStrt * direction
8098				},
8099				{
8100					duration: speed,
8101					x: xEnd * direction * -1,
8102					onComplete: function(){
8103						continuousLinearMarquee();
8104					},
8105					ease: ease,
8106					paused: freezed
8107				});
8108			}
8109		};
8110
8111		var dragLinearContinuous = function(){
8112			if ( !$wrap.is(':visible') )  {
8113				return;
8114			}
8115			var matrix, _x, _y,
8116				dragAction = false;
8117			Draggable.create($wrap[0], {
8118				type: vertical ? "y" : "x",
8119				bounds: document.getElementById("container"),
8120				inertia: false,
8121				onPress: function (e) {
8122				},
8123				onRelease: function (e) {
8124					if ( dragAction === true ) {
8125						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8126						_x = matrix[12] || matrix[4];
8127						_y = matrix[13] || matrix[5];
8128						if ( vertical ) {
8129							continuousLinearMarquee(_y * -1);
8130						} else {
8131							continuousLinearMarquee(_x * -1);
8132						}
8133						$wrap.removeClass('linear-dragging');
8134					}
8135				},
8136				onDrag: function (e) {
8137					dragAction = true;
8138					$wrap.addClass('linear-dragging');
8139				},
8140				onDragEnd: function (e) {
8141					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8142					_x = matrix[12] || matrix[4];
8143					_y = matrix[13] || matrix[5];
8144					wCont = $cont.outerWidth();
8145					hCont = $cont.outerHeight();
8146					if ( vertical ) {
8147						if ( Math.abs(_y) > hCont ) {
8148							if ( _y < 0 ) {
8149								_y = hCont + parseFloat( _y );
8150							} else {
8151								_y = parseFloat( _y ) - hCont;
8152							}
8153						}
8154						continuousLinearMarquee(_y * -1);
8155					} else {
8156						if ( Math.abs(_x) > wCont ) {
8157							if ( _x < 0 ) {
8158								_x = wCont + parseFloat( _x );
8159							} else {
8160								_x = parseFloat( _x ) - wCont;
8161							}
8162						}
8163						continuousLinearMarquee(_x * -1);
8164					}
8165					$wrap.removeClass('linear-dragging');
8166					dragAction = false;
8167				},
8168			});
8169		};
8170
8171		var runScrollLinear = function(){
8172			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8173			if ( (!$wrap.is(':visible') || freezed) )  {
8174				return;
8175			}
8176			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8177				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8178			
8179			var linearGridScroll = function(){
8180				if ( isInViewport ) {
8181					var bound = _row.getBoundingClientRect();
8182
8183					var bound_top = bound.top,
8184						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8185
8186					if ( vertical ) {
8187						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8188					} else {
8189						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8190					}
8191					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8192						requestAnimationFrame(linearGridScroll);
8193					}
8194				}
8195				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8196					window.addEventListener("scroll", linearGridScroll);
8197				}
8198			};
8199
8200			$(window).on( 'load wwResize', function(e) {
8201				stableHeight = UNCODE.wheight;
8202				linearGridScroll();
8203			});
8204			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8205				requestAnimationFrame(linearGridScroll);
8206			}
8207		};
8208		
8209		var dragLinear = function(){
8210			if ( !$wrap.is(':visible') )  {
8211				return;
8212			}
8213			var matrix, _x, _y;
8214			Draggable.create($dragger[0], {
8215				type: vertical ? "y" : "x",
8216				bounds: document.getElementById("container"),
8217				inertia: false,
8218				onPress: function (e) {
8219				},
8220				onRelease: function (e) {
8221				},
8222				onDrag: function (e) {
8223					$wrap.addClass('linear-dragging');
8224				},
8225				onDragEnd: function (e) {
8226					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8227					_x = matrix[12] || matrix[4];
8228					_y = matrix[13] || matrix[5];
8229					wCont = $cont.outerWidth();
8230					hCont = $cont.outerHeight();
8231					if ( vertical ) {
8232						if ( Math.abs(_y) > hCont ) {
8233							if ( _y < 0 ) {
8234								_y = hCont + parseFloat( _y );
8235							} else {
8236								_y = parseFloat( _y ) - hCont;
8237							}
8238							gsap.to( $dragger[0], {
8239								duration: 0,
8240								y: _y,
8241							});
8242						}
8243					} else {
8244						if ( Math.abs(_x) > wCont ) {
8245							if ( _x < 0 ) {
8246								_x = wCont + parseFloat( _x );
8247							} else {
8248								_x = parseFloat( _x ) - wCont;
8249							}
8250							gsap.to( $dragger[0], {
8251								duration: 0,
8252								x: _x,
8253							});
8254						}
8255					}
8256					$wrap.removeClass('linear-dragging');
8257				},
8258			});
8259		};
8260
8261		if ( ! $('body').hasClass('compose-mode') ) {
8262			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8263				continuousLinearMarquee();
8264				$(window).on( 'wwResize', function(e) {
8265					continuousLinearMarquee();
8266				});	
8267				$(document).on('sub-menu-slide-down', function(){
8268					if ( isInMenu ) {
8269						continuousLinearMarquee();
8270					}
8271				});
8272				if ( $wrap.attr('data-draggable') === 'yes' ) {
8273					dragLinearContinuous();
8274				}
8275			}
8276
8277			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8278				runScrollLinear();
8279				if ( $wrap.attr('data-draggable') === 'yes' ) {
8280					dragLinear();
8281				}
8282			}
8283
8284			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8285				var observer = new IntersectionObserver(function(entries) {
8286						
8287					entries.forEach(function(entry){
8288						if ( entry.isIntersecting ) {
8289							isInViewport = true;
8290							if ( !init ) {
8291								init = true;
8292								continuousLinearMarquee();
8293							} else {
8294								if ( typeof marqueeTL !== 'undefined' ) {
8295									marqueeTL.play();
8296								}
8297							}
8298							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8299								requestAnimFrame(runScrollLinear);
8300							}
8301						} else {
8302							isInViewport = false;
8303							if ( typeof marqueeTL !== 'undefined' ) {
8304								marqueeTL.pause();
8305							}
8306						}
8307					});
8308				}, { 
8309					root: document,
8310				});
8311
8312				observer.observe(_row);
8313
8314			} else {
8315
8316				var checkVisible = function( el, off ) {
8317					if (typeof jQuery === "function" && el instanceof jQuery) {
8318						el = el[0];
8319					}
8320			
8321					off = typeof off=='undefined' ? 50 : off;
8322			
8323					var rect = el.getBoundingClientRect();
8324			
8325					return (
8326						(
8327							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8328							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8329							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8330						)
8331					);
8332				};
8333				
8334				var checkVisibility = function(){
8335
8336					if ( checkVisible($row) ) {
8337						isInViewport = true;
8338						if ( typeof marqueeTL !== 'undefined' ) {
8339							marqueeTL.play();
8340						}
8341					} else {
8342						isInViewport = false;
8343						if ( typeof marqueeTL !== 'undefined' ) {
8344							marqueeTL.pause();
8345						}
8346					}
8347				}
8348
8349				window.addEventListener("scroll", checkVisibility);
8350				checkVisibility();
8351
8352			}
8353		}
8354	});
8355};
8356UNCODE.wrapperMarquee = function () {
8357
8358	function createMarquee(opts) {
8359		if (!opts) return;
8360
8361		var parent = opts.parent;
8362		var originals = opts.originals;
8363
8364		if (!parent || !originals) return;
8365		if (parent.getAttribute('data-marquee-init') === '1') return;
8366		parent.setAttribute('data-marquee-init', '1');
8367
8368		function raf(cb) {
8369			return (window.requestAnimationFrame ||
8370				window.webkitRequestAnimationFrame ||
8371				window.mozRequestAnimationFrame ||
8372				function (fn) { return window.setTimeout(fn, 16); }
8373			)(cb);
8374		}
8375
8376		function caf(id) {
8377			return (window.cancelAnimationFrame ||
8378				window.webkitCancelAnimationFrame ||
8379				window.mozCancelAnimationFrame ||
8380				function (tid) { window.clearTimeout(tid); }
8381			)(id);
8382		}
8383
8384		function getWidth(el) {
8385			if (!el) return 0;
8386			if (el.getBoundingClientRect) return el.getBoundingClientRect().width;
8387			return el.offsetWidth || 0;
8388		}
8389
8390		function getPointX(e) {
8391			if (e.touches && e.touches.length) return e.touches[0].clientX;
8392			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientX;
8393			return e.clientX;
8394		}
8395
8396		function getPointY(e) {
8397			if (e.touches && e.touches.length) return e.touches[0].clientY;
8398			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientY;
8399			return e.clientY;
8400		}
8401
8402		function getPageY() {
8403			if (typeof window.pageYOffset === 'number') return window.pageYOffset;
8404			return (document.documentElement ? document.documentElement.scrollTop : 0);
8405		}
8406
8407		function getViewportW() {
8408			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
8409		}
8410
8411		var baseSpeed = (typeof opts.speed === 'number') ? opts.speed : 50;
8412		var direction = (typeof opts.direction === 'number') ? opts.direction : -1;
8413		var maxReps = (typeof opts.maxReps === 'number') ? opts.maxReps : 12;
8414
8415		var scrollDriven = (opts.scrollDriven === true);
8416		var scrollFactor = (typeof opts.scrollFactor === 'number') ? opts.scrollFactor : 0.6;
8417		var isScrollControlled = (opts.isScrollControlled === true);
8418
8419		var inViewOnly = (opts.inViewOnly !== false);
8420		var viewMargin = (typeof opts.viewMargin === 'number') ? opts.viewMargin : 80;
8421
8422		var hoverSpeed = (typeof opts.hoverSpeed === 'number') ? opts.hoverSpeed : null;
8423		var isHover = false;
8424
8425		var infinite = (opts.infinite === true) && !SiteParameters.is_frontend_editor;
8426		var draggable = (opts.draggable === true);
8427
8428		var freezeMode = (typeof opts.freeze === 'string') ? opts.freeze : null;
8429		var freezeBp = (typeof opts.freezeBp === 'number') ? opts.freezeBp : 960;
8430
8431		function isFrozenNow() {
8432			if (!freezeMode) return false;
8433
8434			var w = getViewportW();
8435			if (freezeMode === 'always') return true;
8436			if (freezeMode === 'desktop') return w >= freezeBp;
8437			if (freezeMode === 'mobile') return w < freezeBp;
8438
8439			return false;
8440		}
8441
8442		function closestRowParent(el) {
8443			if (!el || !el.closest) return null;
8444			return el.closest('[data-parent="true"]') || null;
8445		}
8446
8447		function ensureId(el, prefix) {
8448			if (!el) return null;
8449			if (el.id && el.id.length) return el.id;
8450
8451			var p = prefix || 'uncode-row';
8452			var rnd = (Math.random().toString(36).slice(2) + Date.now().toString(36)).slice(0, 12);
8453			el.id = p + '-' + rnd;
8454			return el.id;
8455		}
8456
8457		function dispatchClonesEvent(payload) {
8458			try {
8459				parent.dispatchEvent(new CustomEvent('uncode:marquee:clones-built', {
8460					bubbles: true,
8461					detail: payload
8462				}));
8463			} catch (e) {}
8464		}
8465
8466		var clonesEventRaf = 0;
8467		function dispatchClonesEventDebounced(payload) {
8468			if (clonesEventRaf) return;
8469			clonesEventRaf = raf(function () {
8470				clonesEventRaf = 0;
8471				dispatchClonesEvent(payload);
8472			});
8473		}
8474
8475		var base = [];
8476		var i;
8477		for (i = 0; i < originals.length; i++) base.push(originals[i]);
8478		if (!base.length) return;
8479
8480		var track = document.createElement('div');
8481		track.className = (opts.trackClassName ? opts.trackClassName : 'cs-track');
8482
8483		gsap.set(track, {
8484			x: 0,
8485			force3D: true,
8486			willChange: 'transform'
8487		});
8488
8489		var baseWrap = document.createElement('div');
8490		baseWrap.className = 'cs-base';
8491
8492		var leftWrap = null;
8493		var rightWrap = null;
8494
8495		parent.insertBefore(track, parent.firstChild);
8496
8497		if (infinite) {
8498			leftWrap = document.createElement('div');
8499			leftWrap.className = 'cs-clones cs-clones--left';
8500
8501			rightWrap = document.createElement('div');
8502			rightWrap.className = 'cs-clones cs-clones--right';
8503
8504			track.appendChild(leftWrap);
8505			track.appendChild(baseWrap);
8506			track.appendChild(rightWrap);
8507		} else {
8508			track.appendChild(baseWrap);
8509		}
8510
8511		var sourceWrap = document.createElement('div');
8512		sourceWrap.className = 'cs-source';
8513		sourceWrap.style.display = 'none';
8514
8515		track.parentNode.insertBefore(sourceWrap, track);
8516
8517		for (i = 0; i < base.length; i++) {
8518			sourceWrap.appendChild(base[i]);
8519		}
8520
8521		function fillBaseWrapFromSource() {
8522			baseWrap.innerHTML = '';
8523
8524			var fragBase = document.createDocumentFragment();
8525			var k, clone;
8526
8527			for (k = 0; k < base.length; k++) {
8528				clone = base[k].cloneNode(true);
8529				clone.setAttribute('data-marquee-clone', '1');
8530				clone.setAttribute('data-marquee-origin-index', k);
8531				clone.setAttribute('aria-hidden', 'true');
8532				fragBase.appendChild(clone);
8533			}
8534
8535			baseWrap.appendChild(fragBase);
8536		}
8537
8538		fillBaseWrapFromSource();
8539
8540		var cycleW = 1;
8541
8542		function clearClones() {
8543			if (!infinite) return;
8544			leftWrap.innerHTML = '';
8545			rightWrap.innerHTML = '';
8546		}
8547
8548		function measureCycle() {
8549			cycleW = baseWrap.scrollWidth || 0;
8550			if (!cycleW || cycleW < 1) cycleW = 1;
8551
8552			track.style.width = cycleW + 'px';
8553		}
8554
8555		function buildClones() {
8556			fillBaseWrapFromSource();
8557			
8558			measureCycle();
8559
8560			if (!infinite) {
8561				var rowP0 = closestRowParent(parent);
8562				var rowId0 = ensureId(rowP0, 'uncode-row');
8563
8564				dispatchClonesEventDebounced({
8565					type: 'measured-only',
8566					parent: parent,
8567					track: track,
8568					baseWrap: baseWrap,
8569					leftWrap: leftWrap,
8570					rightWrap: rightWrap,
8571					rowParent: rowP0,
8572					rowParentId: rowId0,
8573					infinite: false,
8574					cycleW: cycleW,
8575					reps: 0
8576				});
8577
8578				triggerMarqueeRefreshDebounced(baseWrap);
8579				dispatchMarqueeReady();
8580				return true;
8581			}
8582
8583			clearClones();
8584
8585			var parentW = getWidth(parent);
8586			if (!cycleW || !parentW) return false;
8587
8588			var reps = Math.ceil((parentW * 2) / cycleW) + 1;
8589			if (reps < 1) reps = 1;
8590			if (reps > maxReps) reps = maxReps;
8591
8592			var fragL = document.createDocumentFragment();
8593			var fragR = document.createDocumentFragment();
8594			var r, k, clone;
8595
8596			for (r = 0; r < reps; r++) {
8597				for (k = 0; k < base.length; k++) {
8598					clone = base[k].cloneNode(true);
8599					clone.setAttribute('data-marquee-clone', '1');
8600					clone.setAttribute('data-marquee-origin-index', k);
8601					clone.setAttribute('aria-hidden', 'true');
8602					fragL.appendChild(clone);
8603				}
8604			}
8605
8606			for (r = 0; r < reps; r++) {
8607				for (k = 0; k < base.length; k++) {
8608					clone = base[k].cloneNode(true);
8609					clone.setAttribute('data-marquee-clone', '1');
8610					clone.setAttribute('data-marquee-origin-index', k);
8611					clone.setAttribute('aria-hidden', 'true');
8612					fragR.appendChild(clone);
8613				}
8614			}
8615
8616			leftWrap.appendChild(fragL);
8617			rightWrap.appendChild(fragR);
8618
8619			measureCycle();
8620
8621			var rowP = closestRowParent(parent);
8622			var rowId = ensureId(rowP, 'uncode-row');
8623
8624			dispatchClonesEventDebounced({
8625				type: 'clones-built',
8626				parent: parent,
8627				track: track,
8628				baseWrap: baseWrap,
8629				leftWrap: leftWrap,
8630				rightWrap: rightWrap,
8631				rowParent: rowP,
8632				rowParentId: rowId,
8633				infinite: true,
8634				cycleW: cycleW,
8635				reps: reps
8636			});
8637
8638			triggerMarqueeRefreshDebounced(baseWrap);
8639			dispatchMarqueeReady();
8640
8641			return true;
8642		}
8643
8644		function findClosestClone(node) {
8645			while (node && node !== parent) {
8646				if (node.getAttribute && node.getAttribute('data-marquee-clone') === '1') {
8647					return node;
8648				}
8649				node = node.parentNode;
8650			}
8651			return null;
8652		}
8653
8654		function findClickableInsideClone(node, cloneRoot) {
8655			while (node && node !== cloneRoot) {
8656				if (node.matches && node.matches('a[href], [data-lbox], [data-lightbox], .uncode-lbox')) {
8657					return node;
8658				}
8659				node = node.parentNode;
8660			}
8661			return null;
8662		}
8663
8664		function findMatchingOriginalClickable(originalRoot, clickedEl) {
8665			if (!originalRoot || !clickedEl) return null;
8666
8667			var all = originalRoot.querySelectorAll('a[href], [data-lbox], [data-lightbox], .uncode-lbox');
8668			if (!all.length) return null;
8669
8670			var href = clickedEl.getAttribute && clickedEl.getAttribute('href');
8671			var dataLbox = clickedEl.getAttribute && clickedEl.getAttribute('data-lbox');
8672
8673			var i, el;
8674			for (i = 0; i < all.length; i++) {
8675				el = all[i];
8676
8677				if (dataLbox && el.getAttribute('data-lbox') === dataLbox) return el;
8678				if (href && el.getAttribute('href') === href) return el;
8679			}
8680
8681			return all[0];
8682		}
8683
8684		function onCloneDelegatedClick(e) {
8685			var cloneRoot = findClosestClone(e.target);
8686			if (!cloneRoot) return;
8687
8688			var clickedEl = findClickableInsideClone(e.target, cloneRoot);
8689			if (!clickedEl) return;
8690
8691			var idx = parseInt(cloneRoot.getAttribute('data-marquee-origin-index'), 10);
8692			if (isNaN(idx) || !base[idx]) return;
8693
8694			var originalClickable = findMatchingOriginalClickable(base[idx], clickedEl);
8695			if (!originalClickable) return;
8696
8697			if (e.preventDefault) e.preventDefault();
8698			if (e.stopPropagation) e.stopPropagation();
8699			e.cancelBubble = true;
8700
8701			originalClickable.dispatchEvent(new MouseEvent('click', {
8702				bubbles: true,
8703				cancelable: true,
8704				view: window
8705			}));
8706
8707			return false;
8708		}
8709
8710		var xRaw = 0;
8711		var manualOffset = 0;
8712		var lastTs = 0;
8713		var frameId = 0;
8714		var isActive = true;
8715
8716		var lastVisibilityCheck = 0;
8717		var visibilityCheckEvery = 120;
8718
8719		var isDragging = false;
8720		var isTouchDragging = false;
8721		var touchDirectionLocked = null;
8722		var dragStartX = 0;
8723		var dragStartY = 0;
8724		var dragStartOffset = 0;
8725		var hasDragged = false;
8726		var dragThreshold = 6;
8727		var touchDirectionThreshold = 8;
8728
8729		var throwV = 0;
8730		var lastDragX = 0;
8731		var lastDragT = 0;
8732
8733		var lastPageY = getPageY();
8734		var scrollVelocity = 0;
8735
8736		var io = new IntersectionObserver(function(entries) {
8737			isActive = entries[0].isIntersecting;
8738		}, { rootMargin: viewMargin + 'px' });
8739
8740		io.observe(parent);
8741
8742		function updateInView() {
8743			if (!inViewOnly) isActive = true;
8744		}
8745
8746		function getEffectiveSpeed() {
8747			if (hoverSpeed !== null && isHover) return hoverSpeed;
8748			return baseSpeed;
8749		}
8750
8751		function dispatchMarqueeReady() {
8752			if ( SiteParameters.is_frontend_editor ) return;
8753			requestTimeout(function() {
8754
8755				var rowP = closestRowParent(parent);
8756				var rowId = ensureId(rowP, 'uncode-row');
8757
8758				document.dispatchEvent(new CustomEvent('uncode:marquee:ready', {
8759					bubbles: true,
8760					detail: {
8761						parent: parent,
8762						baseWrap: baseWrap,
8763						leftWrap: leftWrap,
8764						rightWrap: rightWrap,
8765						infinite: infinite,
8766						rowParent: rowP,
8767						rowParentId: rowId,
8768					}
8769				}));
8770			}, 0);
8771		}
8772
8773		function triggerMarqueeReinit(contextEl) {
8774			try {
8775				$(document).trigger('uncode-marquee-updated', {
8776					parent: parent,
8777					context: contextEl || baseWrap,
8778					baseWrap: baseWrap,
8779					leftWrap: leftWrap,
8780					rightWrap: rightWrap
8781				});
8782			} catch (e) {}
8783		}
8784
8785		var marqueeRefreshT = 0;
8786		function triggerMarqueeRefreshDebounced(contextEl) {
8787			if (marqueeRefreshT) {
8788				window.clearTimeout(marqueeRefreshT);
8789			}
8790			marqueeRefreshT = window.setTimeout(function() {
8791				triggerMarqueeReinit(contextEl || baseWrap);
8792				marqueeRefreshT = 0;
8793			}, 60);
8794		}
8795		
8796		function render() {
8797			var x;
8798			var totalX = xRaw + manualOffset;
8799
8800			if (infinite) {
8801				var m = totalX % cycleW;
8802				if (m > 0) m -= cycleW;
8803				x = m;
8804			} else {
8805				x = totalX;
8806			}
8807
8808			gsap.set(track, {
8809				x: x,
8810				force3D: true
8811			});
8812		}
8813
8814		function tick(ts) {
8815			if (!lastTs) lastTs = ts;
8816			var dt = (ts - lastTs) / 1000;
8817			lastTs = ts;
8818
8819			if (dt > 0.05) dt = 0.05;
8820
8821			updateInView();
8822
8823			if (!isActive) {
8824				frameId = raf(tick);
8825				return;
8826			}
8827
8828			if (!isDragging) {
8829
8830				if (isFrozenNow()) {
8831					throwV = 0;
8832					frameId = raf(tick);
8833					return;
8834				}
8835
8836				if (isScrolling) {
8837					frameId = raf(tick);
8838					return;
8839				}
8840
8841				if (!scrollDriven) {
8842					var s = getEffectiveSpeed();
8843					if (s) xRaw += (direction * s * dt);
8844				}
8845
8846				if (throwV) {
8847					xRaw += (throwV * dt);
8848					throwV *= Math.pow(0.04, dt);
8849					if (throwV < 8 && throwV > -8) throwV = 0;
8850				}
8851
8852				render();
8853			}
8854
8855			frameId = raf(tick);
8856		}
8857
8858		function start() {
8859			if (!buildClones()) {
8860				window.setTimeout(start, 50);
8861				return;
8862			}
8863
8864			lastTs = 0;
8865
8866			if (isScrollControlled) {
8867				render();
8868				return;
8869			}
8870
8871			if (frameId) caf(frameId);
8872			frameId = raf(tick);
8873			render();
8874		}
8875
8876		function stop() {
8877			if (frameId) caf(frameId);
8878			frameId = 0;
8879		}
8880
8881		function onDown(e) {
8882			if (e.type === 'mousedown' && e.button !== 0) return;
8883			if (isFrozenNow()) return;
8884
8885			dragStartX = getPointX(e);
8886			dragStartY = getPointY(e);
8887			dragStartOffset = manualOffset;
8888			hasDragged = false;
8889
8890			throwV = 0;
8891			lastDragX = dragStartX;
8892			lastDragT = (new Date()).getTime();
8893
8894			isTouchDragging = e.type === 'touchstart';
8895			touchDirectionLocked = null;
8896
8897			if (!isTouchDragging) {
8898				isDragging = true;
8899
8900				if (e.preventDefault) e.preventDefault();
8901				if (e.stopPropagation) e.stopPropagation();
8902			} else {
8903				isDragging = false;
8904			}
8905
8906			bindMoveUp(true);
8907		}
8908
8909		function onMove(e) {
8910			var nowX = getPointX(e);
8911			var nowY = getPointY(e);
8912			var dx = nowX - dragStartX;
8913			var dy = nowY - dragStartY;
8914
8915			if (isTouchDragging && touchDirectionLocked === null) {
8916				if (Math.abs(dx) < touchDirectionThreshold && Math.abs(dy) < touchDirectionThreshold) {
8917					return;
8918				}
8919
8920				if (Math.abs(dy) > Math.abs(dx)) {
8921					touchDirectionLocked = 'vertical';
8922					isDragging = false;
8923					bindMoveUp(false);
8924					return;
8925				}
8926
8927				touchDirectionLocked = 'horizontal';
8928				isDragging = true;
8929			}
8930
8931			if (!isDragging) return;
8932
8933			if (!hasDragged && (dx < -dragThreshold || dx > dragThreshold)) hasDragged = true;
8934
8935			manualOffset = dragStartOffset + dx;
8936			render();
8937
8938			var nowT = (new Date()).getTime();
8939			var dtMs = nowT - lastDragT;
8940			if (dtMs > 0) {
8941				var vx = (nowX - lastDragX) / (dtMs / 1000);
8942				if (vx > 2500) vx = 2500;
8943				if (vx < -2500) vx = -2500;
8944				throwV = vx * 0.5;
8945			}
8946
8947			lastDragX = nowX;
8948			lastDragT = nowT;
8949
8950			if (e.preventDefault) e.preventDefault();
8951		}
8952
8953		function onUp(e) {
8954			if (!isDragging && !isTouchDragging) return;
8955
8956			isDragging = false;
8957			isTouchDragging = false;
8958			touchDirectionLocked = null;
8959
8960			lastTs = 0;
8961			lastPageY = getPageY();
8962
8963			render();
8964			bindMoveUp(false);
8965
8966			if (e && hasDragged && e.preventDefault) e.preventDefault();
8967
8968			setTimeout(function () { hasDragged = false; }, 0);
8969		}
8970
8971		function bindMoveUp(bind) {
8972			if (bind) {
8973				document.addEventListener('mousemove', onMove, false);
8974				document.addEventListener('mouseup', onUp, false);
8975				document.addEventListener('touchmove', onTouchMoveDetect, { passive: true });
8976				document.addEventListener('touchend', onUp, false);
8977				document.addEventListener('touchcancel', onUp, false);
8978			} else {
8979				document.removeEventListener('mousemove', onMove, false);
8980				document.removeEventListener('mouseup', onUp, false);
8981				document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8982				document.removeEventListener('touchmove', onMove, { passive: false });
8983				document.removeEventListener('touchend', onUp, false);
8984				document.removeEventListener('touchcancel', onUp, false);
8985			}
8986		}
8987
8988		function onTouchMoveDetect(e) {
8989			var dx = Math.abs(getPointX(e) - dragStartX);
8990			var dy = Math.abs(getPointY(e) - dragStartY);
8991			if (dx < touchDirectionThreshold && dy < touchDirectionThreshold) return;
8992
8993			document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8994
8995			if (dy > dx) {
8996				isDragging = false;
8997				touchDirectionLocked = 'vertical';
8998				bindMoveUp(false);
8999			} else {
9000				touchDirectionLocked = 'horizontal';
9001				isDragging = true;
9002				document.addEventListener('touchmove', onMove, { passive: false });
9003			}
9004		}
9005
9006		if (parent.addEventListener) {
9007			if (draggable) {
9008				parent.addEventListener('mousedown', onDown, false);
9009				parent.addEventListener('touchstart', onDown, { passive: true });
9010			}
9011
9012			if (hoverSpeed !== null) {
9013				parent.addEventListener('mouseenter', function () { isHover = true; }, false);
9014				parent.addEventListener('mouseleave', function () { isHover = false; }, false);
9015			}
9016
9017			parent.addEventListener('click', onCloneDelegatedClick, false);
9018
9019		} else {
9020			if (draggable) {
9021				parent.onmousedown = onDown;
9022				parent.ontouchstart = onDown;
9023			}
9024		}
9025
9026		function onClickCapture(e) {
9027			if (hasDragged) {
9028				if (e.preventDefault) e.preventDefault();
9029				if (e.stopPropagation) e.stopPropagation();
9030				e.cancelBubble = true;
9031				return false;
9032			}
9033		}
9034
9035		if (draggable) {
9036			if (parent.addEventListener) parent.addEventListener('click', onClickCapture, true);
9037			else parent.onclick = onClickCapture;
9038		}
9039
9040		var resizeTimer = 0;
9041		var lastResizeW = getViewportW();
9042
9043		function onResize() {
9044			var currentW = getViewportW();
9045
9046			if (Math.abs(currentW - lastResizeW) < 2) {
9047				return;
9048			}
9049
9050			lastResizeW = currentW;
9051
9052			if (resizeTimer) window.clearTimeout(resizeTimer);
9053
9054			resizeTimer = window.setTimeout(function () {
9055				buildClones();
9056				render();
9057			}, 150);
9058		}
9059
9060		if (window.addEventListener) window.addEventListener('resize', onResize, false);
9061		else window.onresize = onResize;
9062
9063		var isScrolling = false;
9064		var scrollEndTimer = 0;
9065
9066		function onWindowScroll() {
9067			isScrolling = true;
9068			if (scrollEndTimer) clearTimeout(scrollEndTimer);
9069			scrollEndTimer = setTimeout(function () {
9070				isScrolling = false;
9071				lastTs = 0; // evita spike dt alla ripresa
9072			}, 80);
9073		}
9074
9075		if (scrollDriven) {
9076			if (window.addEventListener) window.addEventListener('scroll', onWindowScroll, { passive: true });
9077			else window.onscroll = onWindowScroll;
9078		}
9079
9080		start();
9081
9082		window.setTimeout(function () {
9083			buildClones();
9084			render();
9085			triggerMarqueeRefreshDebounced(baseWrap);
9086		}, 500);
9087
9088		return {
9089			start: start,
9090			stop: stop,
9091			setX: function (value) { xRaw = value; render(); },
9092			addX: function (delta) { xRaw += delta; render(); },
9093			setManualOffset: function (value) { manualOffset = value; render(); },
9094			getManualOffset: function () { return manualOffset; },
9095			resetManualOffset: function () { manualOffset = 0; render(); },
9096			getCycleW: function () { return cycleW; },
9097			update: function () {
9098				buildClones();
9099				render();
9100			},
9101			isFrozen: function () { return isFrozenNow(); }
9102		};
9103	}
9104
9105	function initMarqueesOnce() {
9106		if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
9107			return false;
9108		}
9109		gsap.registerPlugin(ScrollTrigger);
9110		function getViewportW() {
9111			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9112		}
9113		var wrappers = document.querySelectorAll('.cs-wrapper-marquee, .cs-wrapper');
9114
9115		if (!wrappers || !wrappers.length) wrappers = document.getElementsByClassName('cs-wrapper');
9116
9117		var itemClass = 'cs-container';
9118
9119		if (!wrappers || !wrappers.length) {
9120			return false;
9121		}
9122
9123		function isScrollMode(wrapper) {
9124			var mode = wrapper.getAttribute('data-mode');
9125			return mode === 'marquee-scroll' || mode === 'marquee-scroll-opposite';
9126		}
9127
9128		function getDirection(wrapper) {
9129			var mode = wrapper.getAttribute('data-mode');
9130			if (mode === 'marquee-opposite' || mode === 'marquee-scroll-opposite') return 1;
9131			return -1;
9132		}
9133
9134		function clamp(v, a, b) { return v < a ? a : (v > b ? b : v); }
9135
9136		function readStep(wrapper) {
9137			var v = parseFloat(wrapper.getAttribute('data-speed'));
9138			if (isNaN(v)) v = 0;
9139			return clamp(v, -4, 4);
9140		}
9141
9142		function stepToPxPerSec(step, baseDefault) {
9143			return (baseDefault / 5) * (step + 5);
9144		}
9145
9146		function readFreeze(wrapper) {
9147			var f = wrapper.getAttribute('data-freeze');
9148			if (f !== 'always' && f !== 'desktop' && f !== 'mobile') return null;
9149			return f;
9150		}
9151
9152		function isFrozenByAttr(freezeMode, bp) {
9153			if (!freezeMode) return false;
9154			var w = window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9155			if (freezeMode === 'always') return true;
9156			if (freezeMode === 'desktop') return w >= bp;
9157			if (freezeMode === 'mobile') return w < bp;
9158			return false;
9159		}
9160
9161		var baseDefault = 50;
9162		var autoFactor = 5;
9163		var freezeBp = 960;
9164
9165		var inited = 0;
9166
9167		for (var i = 0; i < wrappers.length; i++) {
9168			(function (wrapper) {
9169
9170				if (wrapper.getAttribute('data-anim') !== 'uncode_slider_marquee') {
9171					return;
9172				}
9173
9174				var items = wrapper.getElementsByClassName(itemClass);
9175				if (!items || !items.length) {
9176					return;
9177				}
9178
9179				var scrollMode = isScrollMode(wrapper);
9180				var dir = getDirection(wrapper);
9181
9182				var step = readStep(wrapper);
9183				var pxPerSec = stepToPxPerSec(step, baseDefault);
9184				var autoplayPxPerSec = pxPerSec * autoFactor;
9185
9186				var needHover = wrapper.getAttribute('data-hover');
9187				var hoverSpeed;
9188				if (needHover === 'yes') hoverSpeed = autoplayPxPerSec * 0.2;
9189				else if (needHover === 'pause') hoverSpeed = 0;
9190				else hoverSpeed = autoplayPxPerSec;
9191
9192				var freeze = readFreeze(wrapper);
9193
9194				var marquee = createMarquee({
9195					parent: wrapper,
9196					originals: items,
9197					infinite: wrapper.getAttribute('data-infinite') === 'yes' && !SiteParameters.is_frontend_editor,
9198					speed: scrollMode ? 0 : autoplayPxPerSec,
9199					draggable: wrapper.getAttribute('data-draggable') === 'yes' || SiteParameters.is_frontend_editor,
9200					scrollDriven: false,
9201					isScrollControlled: scrollMode,
9202					inViewOnly: true,
9203					viewMargin: 300,
9204					maxReps: getViewportW() < 570 ? 4 : 8,
9205					direction: dir,
9206					hoverSpeed: scrollMode || SiteParameters.is_frontend_editor ? 0 : hoverSpeed,
9207					freeze: freeze && !SiteParameters.is_frontend_editor,
9208					freezeBp: freezeBp
9209				});
9210
9211				if (!marquee) {
9212					return;
9213				}
9214
9215				wrapper._uncodeMarqueeApi = marquee;
9216	
9217				inited++;
9218
9219				if (!scrollMode || SiteParameters.is_frontend_editor) {
9220					ScrollTrigger.create({
9221						trigger: wrapper,
9222						start: 'top bottom',
9223						end: 'bottom top',
9224						invalidateOnRefresh: true,
9225						refreshPriority: -1,
9226						onEnter: function () {
9227							if (isFrozenByAttr(freeze, freezeBp)) return;
9228							marquee.start();
9229						},
9230						onEnterBack: function () {
9231							if (isFrozenByAttr(freeze, freezeBp)) return;
9232							marquee.start();
9233						},
9234						onLeave: function () { marquee.stop(); },
9235						onLeaveBack: function () { marquee.stop(); }
9236					});
9237				} else {
9238					ScrollTrigger.create({
9239						trigger: wrapper,
9240						start: 'top bottom',
9241						end: 'bottom top',
9242						scrub: true,
9243						invalidateOnRefresh: true,
9244						refreshPriority: -1,
9245						onUpdate: function (self) {
9246							if (isFrozenByAttr(freeze, freezeBp)) return;
9247
9248							var w = marquee.getCycleW();
9249							if (!w) return;
9250
9251							var cycles = pxPerSec / baseDefault;
9252
9253							if (getViewportW() < 570) {
9254								cycles *= 0.55;
9255							}
9256
9257							marquee.setX(dir * self.progress * cycles * w);
9258						}
9259					});
9260				}
9261
9262			})(wrappers[i]);
9263		}
9264
9265		if (typeof ResizeObserver !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
9266			var t = 0;
9267			function refreshST() {
9268				if (t) window.clearTimeout(t);
9269				t = window.setTimeout(function () {
9270					ScrollTrigger.refresh();
9271				}, 150);
9272			}
9273
9274			var ro = new ResizeObserver(function () {
9275				refreshST();
9276			});
9277
9278			if (getViewportW() >= 960) {
9279				ro.observe(document.body);
9280			}
9281		}
9282
9283		window.setTimeout(function () {
9284			if (typeof ScrollTrigger !== 'undefined') {
9285				ScrollTrigger.sort();
9286				ScrollTrigger.refresh();
9287			}
9288		}, 0);
9289		
9290		return true;
9291	}
9292
9293	(function retryInit() {
9294		var tries = 0;
9295		var maxTries = 40;
9296		function go() {
9297			tries++;
9298			var ok = initMarqueesOnce();
9299			if (ok) return;
9300			if (tries >= maxTries) {
9301				return;
9302			}
9303			window.setTimeout(go, 100);
9304		}
9305		go();
9306	})();
9307};
9308UNCODE.wrapperSticky = function(){
9309    (function () {
9310        if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') return;
9311        gsap.registerPlugin(ScrollTrigger);
9312
9313        var wrappers = document.getElementsByClassName('cs-wrapper-sticky');
9314        var i;
9315
9316        function ensureTrack(wrapper) {
9317            var track = wrapper.querySelector('.cs-track');
9318            if (track) return track;
9319
9320            track = document.createElement('div');
9321            track.className = 'cs-track';
9322
9323            var items = wrapper.getElementsByClassName('cs-container');
9324            var list = [];
9325            var k;
9326            for (k = 0; k < items.length; k++) list.push(items[k]);
9327
9328            wrapper.insertBefore(track, wrapper.firstChild);
9329            for (k = 0; k < list.length; k++) track.appendChild(list[k]);
9330
9331            return track;
9332        }
9333
9334        function setupHorizontalPin(wrapper) {
9335            var track = ensureTrack(wrapper);
9336            var tween = null;
9337            var st = null;
9338
9339            function getTriggerElement() {
9340                if (wrapper.closest) {
9341                    return wrapper.closest('.vc_row[data-parent]') || wrapper;
9342                }
9343                return wrapper;
9344            }
9345
9346            function isStickyDisabled() {
9347                var w = window.innerWidth || document.documentElement.clientWidth;
9348
9349                if (wrapper.getAttribute('data-disable-sticky-mobile') === 'yes' && w < 570) {
9350                    return true;
9351                }
9352
9353                if (wrapper.getAttribute('data-disable-sticky-tablet') === 'yes' && w < 960) {
9354                    return true;
9355                }
9356
9357                return false;
9358            }
9359
9360            function getDirection() {
9361                var d = wrapper.getAttribute('data-direction');
9362                if (d === 'reverse' || d === 'rtl' || d === 'right') return 1;
9363                return -1;
9364            }
9365
9366            function getStartPosition() {
9367                var align = wrapper.getAttribute('data-align');
9368                return align ? align : 'top top';
9369            }
9370
9371            function getDistance() {
9372                var wrapperW = wrapper.getBoundingClientRect
9373                    ? wrapper.getBoundingClientRect().width
9374                    : wrapper.offsetWidth;
9375
9376                var dist = track.scrollWidth - wrapperW;
9377                if (dist < 0) dist = 0;
9378                return dist;
9379            }
9380
9381            function destroy() {
9382                if (st) {
9383                    st.kill();
9384                    st = null;
9385                }
9386
9387                if (tween) {
9388                    tween.kill();
9389                    tween = null;
9390                }
9391
9392                gsap.set(track, { clearProps: 'transform' });
9393            }
9394
9395            function make() {
9396                destroy();
9397
9398                if (isStickyDisabled()) {
9399                    return;
9400                }
9401
9402                var dist = getDistance();
9403                if (!dist) return;
9404
9405                var dir = getDirection();
9406                var startPos = getStartPosition();
9407                var triggerEl = getTriggerElement();
9408
9409                gsap.set(track, { x: 0 });
9410
9411                tween = gsap.to(track, {
9412                    x: dist * dir,
9413                    ease: 'none',
9414                    scrollTrigger: {
9415                        trigger: triggerEl,
9416                        start: startPos,
9417                        end: function () { return '+=' + dist; },
9418                        scrub: true,
9419                        pin: triggerEl,
9420                        anticipatePin: 1,
9421                        invalidateOnRefresh: true
9422                    }
9423                });
9424
9425                st = tween.scrollTrigger;
9426            }
9427
9428            make();
9429
9430            ScrollTrigger.addEventListener('refreshInit', function () {
9431                if (!isStickyDisabled()) {
9432                    gsap.set(track, { x: 0 });
9433                }
9434            });
9435
9436            var resizeT = 0;
9437            var lastResizeW = window.innerWidth || document.documentElement.clientWidth;
9438
9439            window.addEventListener('resize', function () {
9440                var currentW = window.innerWidth || document.documentElement.clientWidth;
9441
9442                if (Math.abs(currentW - lastResizeW) < 2) {
9443                    return;
9444                }
9445
9446                lastResizeW = currentW;
9447
9448                if (resizeT) window.clearTimeout(resizeT);
9449
9450                resizeT = window.setTimeout(function () {
9451                    make();
9452                    ScrollTrigger.refresh();
9453                }, 150);
9454            }, false);
9455
9456            setTimeout(function () {
9457                ScrollTrigger.refresh();
9458            }, 500);
9459        }
9460
9461        for (i = 0; i < wrappers.length; i++) {
9462            setupHorizontalPin(wrappers[i]);
9463        }
9464    })();
9465
9466};
9467UNCODE.mouseTrail = (function () {
9468
9469	"use strict";
9470
9471	var __globalDestroy = null;
9472
9473	return function () {
9474
9475		if (typeof __globalDestroy === "function") {
9476			try { __globalDestroy(); } catch (e) {}
9477			__globalDestroy = null;
9478		}
9479
9480		function initImageTrail(options) {
9481
9482			options = options || {};
9483
9484			var area = options.area;
9485			var hoverArea = options.hoverArea;
9486
9487			var images       = options.images || [];
9488			var size         = options.size != null ? options.size : 120;
9489
9490			var minWidth = (options.minWidth != null) ? options.minWidth : null;
9491			var maxWidth = (options.maxWidth != null) ? options.maxWidth : null;
9492
9493			var life         = options.life != null ? options.life : 1.6;
9494			var spawnEvery   = options.spawnEvery != null ? options.spawnEvery : 60;
9495			var touchSpawnEvery = options.touchSpawnEvery != null
9496				? options.touchSpawnEvery
9497				: spawnEvery * 2;
9498			var minDistance  = options.minDistance != null ? options.minDistance : 18;
9499			var rotateRange  = options.rotateRange != null ? options.rotateRange : 10;
9500			var scaleRange   = options.scaleRange || [0.9, 1.05];
9501			var zIndex       = options.zIndex != null ? options.zIndex : 10;
9502			var inOpacity    = options.inOpacity != null ? options.inOpacity : 0;
9503			var midOpacity   = options.midOpacity != null ? options.midOpacity : 1;
9504			var outOpacity   = options.outOpacity != null ? options.outOpacity : 0;
9505			var drift        = options.drift != null ? options.drift : true;
9506
9507			var poolSize     = options.poolSize != null ? options.poolSize : 16;
9508
9509			var inScale      = options.inScale != null ? options.inScale : 0.6;
9510			var outScale     = options.outScale != null ? options.outScale : 0.6;
9511			var inDuration   = options.inDuration != null ? options.inDuration : 0.2;
9512			var outDuration  = options.outDuration != null ? options.outDuration : 0.35;
9513			var inEase       = options.inEase || "power3.out";
9514			var outEase      = options.outEase || "power3.in";
9515
9516			var scrollOn     = options.scrollOn != null ? options.scrollOn : true;
9517
9518			if (!area || !hoverArea) return null;
9519
9520			var areaStyle = window.getComputedStyle(area);
9521			if (areaStyle.position === "static") area.style.position = "relative";
9522
9523			var lastTime = 0;
9524			var lastX = null;
9525			var lastY = null;
9526
9527			var pointerX = null;
9528			var pointerY = null;
9529
9530			var scrollLastTime = 0;
9531			var scrollLastPageY = null;
9532			var scrollSpawnEvery = options.scrollSpawnEvery != null ? options.scrollSpawnEvery : 220;
9533			var scrollMinDistance = options.scrollMinDistance != null ? options.scrollMinDistance : 40;
9534
9535			var touchViewportOn = options.touchViewportOn !== false;
9536			var desktopAutoOn = options.desktopAutoOn === true;
9537
9538			var safeW = options.safeW != null ? options.safeW : 0;
9539			var safeH = options.safeH != null ? options.safeH : 0;
9540			var safeMode = options.safeMode || "avoid";
9541			var particleSafeAreaOn = options.particleSafeAreaOn === true;
9542
9543			var isTouchDevice = (
9544				("ontouchstart" in window) ||
9545				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
9546				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
9547			) && !window.matchMedia("(pointer: fine)").matches;
9548
9549			var useAutoViewportTrail = isTouchDevice
9550				? touchViewportOn
9551				: desktopAutoOn;
9552
9553			var autoSpawnEvery = isTouchDevice
9554				? touchSpawnEvery
9555				: spawnEvery;
9556
9557			var autoTimer = null;
9558			var autoRunning = false;
9559			var rafWatch = 0;
9560			var watchActive = true;
9561
9562			var i = 0;
9563
9564			for (var p = 0; p < images.length; p++) {
9565				var preload = new Image();
9566				preload.src = images[p];
9567			}
9568
9569			var pool = [];
9570			var poolIndex = 0;
9571
9572			function rectVisible(rect, vh) {
9573				return rect.bottom > 0 && rect.top < vh && rect.height > 0;
9574			}
9575
9576			function buildSafeRect(rect) {
9577				if (!particleSafeAreaOn || !safeW || !safeH) return null;
9578
9579				var w = rect.width * (safeW / 100);
9580				var h = rect.height * (safeH / 100);
9581
9582				if (!w || !h) return null;
9583
9584				return {
9585					left: rect.left + (rect.width - w) / 2,
9586					top: rect.top + (rect.height - h) / 2,
9587					right: rect.left + (rect.width + w) / 2,
9588					bottom: rect.top + (rect.height + h) / 2,
9589					width: w,
9590					height: h
9591				};
9592			}
9593
9594			function pointInSafeRect(x, y, safeRect) {
9595				if (!safeRect) return false;
9596				return (
9597					x >= safeRect.left &&
9598					x <= safeRect.right &&
9599					y >= safeRect.top &&
9600					y <= safeRect.bottom
9601				);
9602			}
9603
9604			function randomPointInRect(rect) {
9605				var safeRect = buildSafeRect(rect);
9606
9607				if (!safeRect) {
9608					return {
9609						x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9610						y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9611					};
9612				}
9613
9614				if (safeMode === "soft") {
9615					var best = null;
9616					var cx = safeRect.left + safeRect.width / 2;
9617					var cy = safeRect.top + safeRect.height / 2;
9618
9619					for (var i = 0; i < 40; i++) {
9620						var x = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9621						var y = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9622
9623						var dx = x - cx;
9624						var dy = y - cy;
9625						var dist = Math.sqrt(dx * dx + dy * dy);
9626
9627						if (pointInSafeRect(x, y, safeRect)) {
9628							dist -= 99999;
9629						}
9630
9631						if (!best || dist > best.score) {
9632							best = {
9633								x: x,
9634								y: y,
9635								score: dist
9636							};
9637						}
9638					}
9639
9640					return {
9641						x: best.x,
9642						y: best.y
9643					};
9644				}
9645
9646				for (var j = 0; j < 40; j++) {
9647					var px = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9648					var py = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9649
9650					if (!pointInSafeRect(px, py, safeRect)) {
9651						return {
9652							x: px,
9653							y: py
9654						};
9655					}
9656				}
9657
9658				return {
9659					x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9660					y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9661				};
9662			}
9663
9664			function spawnRandomInViewportArea() {
9665				var rect = hoverArea.getBoundingClientRect();
9666				var vh = window.innerHeight || document.documentElement.clientHeight;
9667
9668				if (!rectVisible(rect, vh)) return;
9669
9670				var p = randomPointInRect(rect);
9671
9672				lastX = null;
9673				lastY = null;
9674
9675				spawn(p.x, p.y);
9676			}
9677
9678			function startAutoViewportTrail() {
9679				if (!useAutoViewportTrail || autoRunning) return;
9680
9681				autoRunning = true;
9682
9683				function loop() {
9684					if (!autoRunning) return;
9685					spawnRandomInViewportArea();
9686					autoTimer = setTimeout(loop, autoSpawnEvery);
9687				}
9688
9689				loop();
9690			}
9691
9692			function stopAutoViewportTrail() {
9693				autoRunning = false;
9694				if (autoTimer) {
9695					clearTimeout(autoTimer);
9696					autoTimer = null;
9697				}
9698			}
9699
9700			function resetPool() {
9701				for (var ii = 0; ii < pool.length; ii++) {
9702					var img = pool[ii];
9703					if (!img) continue;
9704
9705					img.__trailToken = (img.__trailToken || 0) + 1;
9706					gsap.killTweensOf(img);
9707
9708					gsap.set(img, {
9709						x: -9999,
9710						y: -9999,
9711						opacity: 0,
9712						scale: inScale,
9713						rotation: 0
9714					});
9715				}
9716			}
9717
9718			function onVisibilityChange() {
9719				if (document.visibilityState === "hidden") {
9720					stopAutoViewportTrail();
9721					resetPool();
9722					lastX = null;
9723					lastY = null;
9724					scrollLastPageY = null;
9725					pointerX = null;
9726					pointerY = null;
9727					lastTime = 0;
9728					scrollLastTime = 0;
9729					if (rafWatch) {
9730						cancelAnimationFrame(rafWatch);
9731						rafWatch = 0;
9732					}
9733				} else {
9734					resetPool();
9735					if (useAutoViewportTrail) {
9736						watchViewportAutoState();
9737					}
9738				}
9739			}
9740
9741			function watchViewportAutoState() {
9742				if (!watchActive || rafWatch) return;
9743
9744				function tick() {
9745					if (!watchActive) {
9746						rafWatch = 0;
9747						return;
9748					}
9749
9750					if (useAutoViewportTrail) {
9751						var rect = hoverArea.getBoundingClientRect();
9752						var vh = window.innerHeight || document.documentElement.clientHeight;
9753
9754						if (rectVisible(rect, vh)) startAutoViewportTrail();
9755						else stopAutoViewportTrail();
9756					}
9757
9758					rafWatch = requestAnimationFrame(tick);
9759				}
9760
9761				rafWatch = requestAnimationFrame(tick);
9762			}
9763
9764			function endsWith(str, suffix) {
9765				str = String(str);
9766				suffix = String(suffix);
9767				return str.indexOf(suffix, str.length - suffix.length) !== -1;
9768			}
9769
9770			function cssSizeToPx(value, referenceEl) {
9771				if (value == null) return null;
9772				if (typeof value === "number") return value;
9773
9774				value = String(value).trim();
9775
9776				if (endsWith(value, "px")) return parseFloat(value);
9777				if (endsWith(value, "vw")) return window.innerWidth * parseFloat(value) / 100;
9778				if (endsWith(value, "vh")) return window.innerHeight * parseFloat(value) / 100;
9779
9780				if (endsWith(value, "%")) {
9781					var rect = referenceEl.getBoundingClientRect();
9782					return rect.width * parseFloat(value) / 100;
9783				}
9784
9785				if (!isNaN(value)) return parseFloat(value);
9786
9787				return null;
9788			}
9789
9790			function getRandomWidthPx() {
9791
9792				if (minWidth == null && maxWidth == null) return null;
9793
9794				var minPx = cssSizeToPx(minWidth, area);
9795				var maxPx = cssSizeToPx(maxWidth, area);
9796
9797				if (minPx == null && maxPx == null) return null;
9798
9799				if (minPx == null) minPx = maxPx;
9800				if (maxPx == null) maxPx = minPx;
9801
9802				if (maxPx < minPx) {
9803					var t = minPx;
9804					minPx = maxPx;
9805					maxPx = t;
9806				}
9807
9808				return gsap.utils.random(minPx, maxPx, 1);
9809			}
9810
9811			function applySizing(el) {
9812				el.style.minWidth = "";
9813				el.style.maxWidth = "";
9814
9815				if (size !== "auto" && size != null) {
9816					el.style.width = (typeof size === "number") ? (size + "px") : String(size);
9817					el.style.height = "auto";
9818					return;
9819				}
9820
9821				el.style.width = "";
9822				el.style.height = "auto";
9823
9824				if (minWidth != null && minWidth !== "") el.style.minWidth = String(minWidth);
9825				if (maxWidth != null && maxWidth !== "") el.style.maxWidth = String(maxWidth);
9826			}
9827
9828			for (var k = 0; k < poolSize; k++) {
9829				var el = document.createElement("img");
9830				el.className = "trail-img";
9831
9832				applySizing(el);
9833
9834				el.style.zIndex = zIndex;
9835				el.style.position = "absolute";
9836				el.style.left = "0";
9837				el.style.top = "0";
9838				el.style.pointerEvents = "none";
9839				el.style.userSelect = "none";
9840				el.style.willChange = "transform,opacity";
9841
9842				el.__trailToken = 0;
9843
9844				area.appendChild(el);
9845
9846				gsap.set(el, {
9847					x: -9999,
9848					y: -9999,
9849					opacity: 0,
9850					scale: inScale,
9851					rotation: 0,
9852					transformOrigin: "50% 50%"
9853				});
9854
9855				pool.push(el);
9856			}
9857
9858			function whenDecoded(img, cb) {
9859				if (img && img.decode) {
9860					img.decode().then(function () { cb(); }).catch(function () { cb(); });
9861				} else {
9862					cb();
9863				}
9864			}
9865
9866			function spawn(clientX, clientY) {
9867
9868				if (!images.length) return;
9869
9870				var src = images[i % images.length];
9871				i++;
9872
9873				var img = pool[poolIndex % pool.length];
9874				poolIndex++;
9875
9876				if (img.parentNode !== area) area.appendChild(img);
9877
9878				img.__trailToken = (img.__trailToken || 0) + 1;
9879				var token = img.__trailToken;
9880
9881				gsap.killTweensOf(img);
9882
9883				applySizing(img);
9884
9885				if (img.getAttribute("src") !== src) {
9886					img.setAttribute("src", src);
9887				}
9888
9889				var rect = area.getBoundingClientRect();
9890				var localX = clientX - rect.left;
9891				var localY = clientY - rect.top;
9892
9893				var rot = gsap.utils.random(-rotateRange, rotateRange, 0.1);
9894				var scl = gsap.utils.random(scaleRange[0], scaleRange[1], 0.01);
9895
9896				var randomWidth = getRandomWidthPx();
9897				if (randomWidth) {
9898					img.style.width = randomWidth + "px";
9899					img.style.height = "auto";
9900				}
9901
9902				gsap.set(img, {
9903					x: localX,
9904					y: localY,
9905					xPercent: -50,
9906					yPercent: -50,
9907					rotation: rot,
9908					scale: inScale,
9909					opacity: inOpacity,
9910					transformOrigin: "50% 50%"
9911				});
9912
9913				whenDecoded(img, function () {
9914
9915					if (img.__trailToken !== token) return;
9916
9917					var tl = gsap.timeline({
9918						onComplete: function () {
9919							if (img.__trailToken !== token) return;
9920							gsap.set(img, { x: -9999, y: -9999, opacity: 0, scale: inScale, rotation: 0 });
9921						}
9922					});
9923
9924					tl.to(img, {
9925						opacity: midOpacity,
9926						scale: scl,
9927						duration: inDuration,
9928						ease: inEase
9929					}, 0);
9930
9931					if (drift) {
9932						tl.to(img, {
9933							x: "+=" + gsap.utils.random(-12, 12, 1),
9934							y: "+=" + gsap.utils.random(-18, 18, 1),
9935							rotation: rot + gsap.utils.random(-6, 6, 0.1),
9936							duration: life,
9937							ease: inEase
9938						}, 0);
9939					}
9940
9941					tl.to(img, {
9942						opacity: outOpacity,
9943						scale: outScale,
9944						duration: outDuration,
9945						ease: outEase
9946					}, Math.max(0, life - outDuration));
9947
9948				});
9949			}
9950
9951			function onMove(e) {
9952
9953				pointerX = e.clientX;
9954				pointerY = e.clientY;
9955
9956				var now = Date.now();
9957				if (now - lastTime < spawnEvery) return;
9958
9959				var x = e.clientX;
9960				var y = e.clientY;
9961
9962				if (lastX !== null) {
9963					var dx = x - lastX;
9964					var dy = y - lastY;
9965					var dist = Math.sqrt(dx * dx + dy * dy);
9966					if (dist < minDistance) return;
9967				}
9968
9969				lastTime = now;
9970				lastX = x;
9971				lastY = y;
9972
9973				spawn(x, y);
9974			}
9975
9976			function onLeave() {
9977				lastX = null;
9978				lastY = null;
9979				scrollLastPageY = null;
9980			}
9981
9982			function onPointerMove(e) {
9983				pointerX = e.clientX;
9984				pointerY = e.clientY;
9985			}
9986
9987			function pointInRect(x, y, rect) {
9988				return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
9989			}
9990
9991			function onScroll() {
9992
9993				if (pointerX === null || pointerY === null) return;
9994
9995				var now = Date.now();
9996				if (now - scrollLastTime < scrollSpawnEvery) return;
9997
9998				var rect = hoverArea.getBoundingClientRect();
9999				if (!pointInRect(pointerX, pointerY, rect)) return;
10000
10001				var pageY = window.pageYOffset || document.documentElement.scrollTop || 0;
10002
10003				if (scrollLastPageY !== null) {
10004					var scrollDelta = Math.abs(pageY - scrollLastPageY);
10005					if (scrollDelta < scrollMinDistance) return;
10006				}
10007
10008				var x = Math.min(Math.max(pointerX, rect.left + 1), rect.right - 1);
10009				var y = Math.min(Math.max(pointerY, rect.top + 1), rect.bottom - 1);
10010
10011				scrollLastTime = now;
10012				scrollLastPageY = pageY;
10013
10014				spawn(x, y);
10015			}
10016
10017			if (!useAutoViewportTrail) {
10018				hoverArea.addEventListener("mousemove", onMove);
10019				hoverArea.addEventListener("mouseleave", onLeave);
10020
10021				if (scrollOn) {
10022					window.addEventListener("mousemove", onPointerMove, { passive: true });
10023					window.addEventListener("scroll", onScroll, { passive: true });
10024				}
10025			} else {
10026				watchViewportAutoState();
10027			}
10028
10029			document.addEventListener("visibilitychange", onVisibilityChange);
10030
10031			return function () {
10032
10033				document.removeEventListener("visibilitychange", onVisibilityChange);
10034
10035				if (!useAutoViewportTrail) {
10036					hoverArea.removeEventListener("mousemove", onMove);
10037					hoverArea.removeEventListener("mouseleave", onLeave);
10038
10039					if (scrollOn) {
10040						window.removeEventListener("mousemove", onPointerMove);
10041						window.removeEventListener("scroll", onScroll);
10042					}
10043				}
10044
10045				stopAutoViewportTrail();
10046
10047				watchActive = false;
10048				if (rafWatch) {
10049					cancelAnimationFrame(rafWatch);
10050					rafWatch = 0;
10051				}
10052
10053				for (var ii = 0; ii < pool.length; ii++) {
10054					if (pool[ii] && pool[ii].parentNode) {
10055						gsap.killTweensOf(pool[ii]);
10056						pool[ii].parentNode.removeChild(pool[ii]);
10057					}
10058				}
10059				pool.length = 0;
10060			};
10061
10062		}
10063
10064		function getTrailImagesFromArea(area, useParticleImages) {
10065			var node = null;
10066
10067			if (useParticleImages) {
10068				node = area.querySelector(".particle-images");
10069				if (!node) node = area.querySelector(".trail-images");
10070			} else {
10071				node = area.querySelector(".trail-images");
10072				if (!node) node = area.querySelector(".particle-images");
10073			}
10074
10075			if (!node) return [];
10076
10077			var json = node.textContent || node.innerText || "[]";
10078			try {
10079				return JSON.parse(json);
10080			} catch (e) {
10081				return [];
10082			}
10083		}
10084
10085		function closestPolyfill(el, selector) {
10086			while (el && el.nodeType === 1) {
10087				if (matchesSelector(el, selector)) return el;
10088				el = el.parentNode;
10089			}
10090			return null;
10091		}
10092
10093		function matchesSelector(el, selector) {
10094			var p = Element.prototype;
10095			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10096			if (!fn) return false;
10097			return fn.call(el, selector);
10098		}
10099
10100		function getDataFromArea(area, key, fallback) {
10101			if (!area || !key) return fallback;
10102
10103			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10104			var raw = area.getAttribute(attr);
10105			if (raw == null) return fallback;
10106
10107			raw = String(raw).trim();
10108
10109			if (raw === "true") return true;
10110			if (raw === "false") return false;
10111			if (raw === "null") return null;
10112
10113			var num = raw.replace(",", ".");
10114			if (num !== "" && isFinite(num)) return parseFloat(num);
10115
10116			if (
10117				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10118				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10119			) {
10120				try { return JSON.parse(raw); } catch (e) {}
10121			}
10122
10123			return raw;
10124		}
10125
10126		var destroyers = [];
10127
10128		var areas = document.querySelectorAll(".uncode-bg-trail");
10129		for (var n = 0; n < areas.length; n++) {
10130
10131			var renderArea = areas[n];
10132
10133			if (renderArea.__trailDestroy && typeof renderArea.__trailDestroy === "function") {
10134				try { renderArea.__trailDestroy(); } catch (e) {}
10135				renderArea.__trailDestroy = null;
10136			}
10137
10138			var hoverArea = renderArea.closest
10139				? renderArea.closest('.vc_row[data-parent="true"]')
10140				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10141
10142			if (!hoverArea) continue;
10143
10144			var isTouchDevice = (
10145				("ontouchstart" in window) ||
10146				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
10147				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
10148			) && !window.matchMedia("(pointer: fine)").matches;
10149
10150			var desktopAutoOn = String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes";
10151			var mobileAutoOn = String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes";
10152
10153			var useParticleImages = isTouchDevice ? mobileAutoOn : desktopAutoOn;
10154
10155			var images = getTrailImagesFromArea(renderArea, useParticleImages);
10156
10157			renderArea.__trailDestroy = initImageTrail({
10158				area: renderArea,
10159				hoverArea: hoverArea,
10160				images: images,
10161				size: "auto",
10162
10163				minWidth: getDataFromArea(renderArea, "min-width", null),
10164				maxWidth: getDataFromArea(renderArea, "max-width", null),
10165
10166				life: (getDataFromArea(renderArea, "life", 1) +
10167					getDataFromArea(renderArea, "in-duration", 0.25) +
10168					getDataFromArea(renderArea, "out-duration", 0.3)),
10169
10170				spawnEvery: getDataFromArea(renderArea, "interval", 100),
10171				minDistance: getDataFromArea(renderArea, "distance", 150),
10172				scrollSpawnEvery: Math.max(180, getDataFromArea(renderArea, "interval", 100) * 2),
10173				scrollMinDistance: 30,
10174
10175				poolSize: getDataFromArea(renderArea, "count", 16),
10176
10177				inScale: 0,
10178				outScale: 0,
10179				inDuration: getDataFromArea(renderArea, "in-duration", 0.25),
10180				outDuration: getDataFromArea(renderArea, "out-duration", 0.3),
10181
10182				rotateRange: getDataFromArea(renderArea, "rotate", 10),
10183
10184				inOpacity: 0,
10185				midOpacity: 1,
10186				outOpacity: 0,
10187				drift: getDataFromArea(renderArea, "drift", false),
10188				scrollOn: getDataFromArea(renderArea, "scroll", false),
10189
10190				touchViewportOn: String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes",
10191				touchSpawnEvery: getDataFromArea(renderArea, "mobile-interval", 1750),
10192				desktopAutoOn: String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes",
10193
10194				particleSafeAreaOn: useParticleImages,
10195				safeW: getDataFromArea(renderArea, "safe-w", 0),
10196				safeH: getDataFromArea(renderArea, "safe-h", 0),
10197				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10198
10199				inEase: "power3.out",
10200				outEase: "power3.in"
10201			}) || null;
10202
10203			if (renderArea.__trailDestroy) {
10204				destroyers.push(renderArea.__trailDestroy);
10205			}
10206		}
10207
10208		__globalDestroy = function () {
10209			for (var i = 0; i < destroyers.length; i++) {
10210				try { destroyers[i](); } catch (e) {}
10211			}
10212			destroyers.length = 0;
10213		};
10214
10215	};
10216
10217})();
10218UNCODE.magneticPattern = (function () {
10219
10220	"use strict";
10221
10222	var __globalDestroy = null;
10223
10224	return function () {
10225
10226		if (typeof __globalDestroy === "function") {
10227			try { __globalDestroy(); } catch (e) {}
10228			__globalDestroy = null;
10229		}
10230
10231		function getMagneticImagesFromArea(area) {
10232			var node = area.querySelector(".magnetic-images");
10233			if (!node) return [];
10234			var json = node.textContent || node.innerText || "[]";
10235			try { return JSON.parse(json); } catch (e) { return []; }
10236		}
10237
10238		function closestPolyfill(el, selector) {
10239			while (el && el.nodeType === 1) {
10240				if (matchesSelector(el, selector)) return el;
10241				el = el.parentNode;
10242			}
10243			return null;
10244		}
10245
10246		function matchesSelector(el, selector) {
10247			var p = Element.prototype;
10248			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10249			if (!fn) return false;
10250			return fn.call(el, selector);
10251		}
10252
10253		function clamp01(v) {
10254			if (v < 0) return 0;
10255			if (v > 1) return 1;
10256			return v;
10257		}
10258
10259		function toNumber(value, fallback) {
10260			if (value == null) return fallback;
10261			var s = String(value).trim();
10262			if (!s) return fallback;
10263			s = s.replace(",", ".");
10264			var m = s.match(/-?\d+(\.\d+)?/);
10265			if (!m) return fallback;
10266			var n = parseFloat(m[0]);
10267			return isFinite(n) ? n : fallback;
10268		}
10269
10270		function getDataFromArea(area, key, fallback) {
10271			if (!area || !key) return fallback;
10272
10273			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10274			var raw = area.getAttribute(attr);
10275			if (raw == null) return fallback;
10276
10277			raw = String(raw).trim();
10278
10279			if (raw === "true") return true;
10280			if (raw === "false") return false;
10281			if (raw === "null") return null;
10282
10283			var num = raw.replace(",", ".");
10284			if (num !== "" && isFinite(num)) return parseFloat(num);
10285
10286			if (
10287				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10288				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10289			) {
10290				try { return JSON.parse(raw); } catch (e) {}
10291			}
10292
10293			return raw;
10294		}
10295
10296		function dedupeImages(list) {
10297			var uniq = [];
10298			var seen = {};
10299			for (var i = 0; i < list.length; i++) {
10300				var src = list[i];
10301				if (src == null) continue;
10302				src = String(src);
10303				if (!seen[src]) {
10304					seen[src] = true;
10305					uniq.push(src);
10306				}
10307			}
10308			return uniq;
10309		}
10310
10311		function rectsOverlap(a, b) {
10312			return !(
10313				a.x + a.w <= b.x ||
10314				b.x + b.w <= a.x ||
10315				a.y + a.h <= b.y ||
10316				b.y + b.h <= a.y
10317			);
10318		}
10319
10320		function initMagneticPattern(options) {
10321
10322			options = options || {};
10323
10324			var renderArea = options.area;
10325			var hoverArea  = options.hoverArea;
10326			var images     = options.images || [];
10327
10328			if (!renderArea || !hoverArea || !images.length) return null;
10329
10330			var count      = (options.count != null) ? options.count : 12;
10331			var padding    = (options.padding != null) ? options.padding : 24;
10332			var jitter     = (options.jitter != null) ? options.jitter : 0.35;
10333
10334			var rawMoveX   = (options.moveX != null) ? options.moveX : 200;
10335			var rawMoveY   = (options.moveY != null) ? options.moveY : 150;
10336			var rawSpillX  = (options.spillX != null) ? options.spillX : 0;
10337			var rawSpillY  = (options.spillY != null) ? options.spillY : 0;
10338
10339			var moveX      = cssLengthToPx(rawMoveX, hoverArea, 200);
10340			var moveY      = cssLengthToPx(rawMoveY, hoverArea, 150);
10341			var spillX     = cssLengthToPx(rawSpillX, renderArea, 0);
10342			var spillY     = cssLengthToPx(rawSpillY, renderArea, 0);
10343
10344			var easeDur    = (options.easeDur != null) ? options.easeDur : 0.6;
10345			var easeLeave  = (options.easeLeave != null) ? options.easeLeave : 1.2;
10346			var ease       = options.ease || "power3.out";
10347
10348			var opacityMin = (options.opacityMin != null) ? options.opacityMin : 0.25;
10349			var opacityMax = (options.opacityMax != null) ? options.opacityMax : 0.9;
10350
10351			var enableBlur = options.enableBlur === true;
10352			var blurMin    = (options.blurMin != null) ? options.blurMin : 0;
10353			var blurMax    = (options.blurMax != null) ? options.blurMax : 6;
10354
10355			var scaleMin   = (options.scaleMin != null) ? options.scaleMin : 0.6;
10356			var scaleMax   = (options.scaleMax != null) ? options.scaleMax : 1;
10357
10358			var depthMin   = (options.depthMin != null) ? options.depthMin : 0.3;
10359			var depthMax   = (options.depthMax != null) ? options.depthMax : 1;
10360
10361			var unique     = options.unique === true;
10362
10363			var zIndexBase     = (options.zIndexBase != null) ? options.zIndexBase : 1;
10364			var zIndexRange    = (options.zIndexRange != null) ? options.zIndexRange : 30;
10365			var enableRotation = options.enableRotation !== false;
10366			var rotationRange  = (options.rotationRange != null) ? options.rotationRange : 8;
10367
10368			var noOverlap = options.noOverlap === true;
10369			var attempts  = (options.attempts != null) ? options.attempts : 120;
10370			var gap       = (options.gap != null) ? options.gap : 8;
10371
10372			var baseWidth = (options.baseWidth != null) ? options.baseWidth : 300;
10373
10374			var depthEnabled = options.flatDepth !== true;
10375
10376			var enableScrollMotion = options.scrollMotion !== false;
10377
10378			var safeW = (options.safeW != null) ? options.safeW : 0;
10379			var safeH = (options.safeH != null) ? options.safeH : 0;
10380			var safeMode = options.safeMode || "avoid";
10381
10382			var items = [];
10383
10384			function cssLengthToPx(value, el, fallback) {
10385				if (value == null) return fallback;
10386
10387				if (typeof value === "number") return isFinite(value) ? value : fallback;
10388
10389				var s = String(value).trim();
10390				if (!s) return fallback;
10391
10392				var n = parseFloat(s.replace(",", "."));
10393				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10394
10395				var probe = document.createElement("div");
10396				probe.style.position = "absolute";
10397				probe.style.visibility = "hidden";
10398				probe.style.pointerEvents = "none";
10399				probe.style.width = s;
10400				probe.style.height = "0";
10401
10402				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10403				parent.appendChild(probe);
10404
10405				var px = probe.getBoundingClientRect().width;
10406				parent.removeChild(probe);
10407
10408				return (px && isFinite(px)) ? px : fallback;
10409			}
10410
10411			if (window.getComputedStyle(renderArea).position === "static") {
10412				renderArea.style.position = "relative";
10413			}
10414
10415			function lerp(a, b, t) {
10416				return a + (b - a) * t;
10417			}
10418
10419			function clearAll() {
10420				var nodes = renderArea.querySelectorAll(".pattern-img");
10421				for (var i = nodes.length - 1; i >= 0; i--) {
10422					if (nodes[i] && nodes[i].parentNode) nodes[i].parentNode.removeChild(nodes[i]);
10423				}
10424				items.length = 0;
10425			}
10426
10427			function buildSafeRect(virtualW, virtualH, originX, originY) {
10428				if (!safeW || !safeH) return null;
10429
10430				var szW = (safeW / 100) * virtualW;
10431				var szH = (safeH / 100) * virtualH;
10432
10433				if (!szW || !szH) return null;
10434
10435				return {
10436					x: originX + (virtualW - szW) / 2,
10437					y: originY + (virtualH - szH) / 2,
10438					w: szW,
10439					h: szH
10440				};
10441			}
10442
10443			var rafWatch = 0;
10444			var lastTop = null;
10445			var lastHeight = null;
10446			var watchActive = true;
10447
10448			function watchPosition() {
10449				if (!watchActive) return;
10450
10451				var rect = hoverArea.getBoundingClientRect();
10452				var top = Math.round(rect.top);
10453				var height = Math.round(rect.height);
10454
10455				var movedEnough =
10456					lastTop === null ||
10457					Math.abs(top - lastTop) > 1 ||
10458					Math.abs(height - lastHeight) > 1;
10459
10460				if (movedEnough) {
10461					lastTop = top;
10462					lastHeight = height;
10463					onScroll();
10464				}
10465
10466				rafWatch = requestAnimationFrame(watchPosition);
10467			}
10468			
10469			function buildLayout() {
10470
10471				clearAll();
10472
10473				var rect = renderArea.getBoundingClientRect();
10474
10475				var width  = rect.width  + spillX * 2;
10476				var height = rect.height + spillY * 2;
10477
10478				var originX = -spillX;
10479				var originY = -spillY;
10480
10481				var safeRect = buildSafeRect(width, height, originX, originY);
10482
10483				var imgs = unique ? dedupeImages(images) : images;
10484				var effectiveCount = unique ? Math.min(count, imgs.length) : count;
10485
10486				var cols = Math.ceil(Math.sqrt(effectiveCount));
10487				var rows = Math.ceil(effectiveCount / cols);
10488
10489				var cellW = (width  - padding * 2) / cols;
10490				var cellH = (height - padding * 2) / rows;
10491
10492				var frag = document.createDocumentFragment();
10493				var placed = [];
10494
10495				for (var i = 0; i < effectiveCount; i++) {
10496
10497					var src = imgs[i % imgs.length];
10498
10499					var el = document.createElement("img");
10500					el.className = "pattern-img";
10501					el.src = src;
10502
10503					el.style.position = "absolute";
10504					el.style.left = "0";
10505					el.style.top = "0";
10506					el.style.pointerEvents = "none";
10507					el.style.userSelect = "none";
10508					el.style.willChange = "transform,opacity,filter";
10509
10510					el.style.width = baseWidth + "px";
10511					el.style.height = "auto";
10512
10513					var col = i % cols;
10514					var row = Math.floor(i / cols);
10515
10516					var baseCellX = originX + padding + col * cellW;
10517					var baseCellY = originY + padding + row * cellH;
10518
10519					var baseX = baseCellX + cellW / 2 + (Math.random() - 0.5) * cellW * jitter;
10520					var baseY = baseCellY + cellH / 2 + (Math.random() - 0.5) * cellH * jitter;
10521
10522					var placedOk = true;
10523
10524					function isBadCandidate(x, y) {
10525						var cand = { x: x, y: y, w: baseWidth + gap, h: baseWidth + gap };
10526
10527						if (safeRect && rectsOverlap(cand, safeRect)) {
10528							if (safeMode === "avoid") return true;
10529						}
10530
10531						if (noOverlap) {
10532							for (var p = 0; p < placed.length; p++) {
10533								if (rectsOverlap(cand, placed[p])) return true;
10534							}
10535						}
10536
10537						return false;
10538					}
10539
10540					if (safeRect && safeMode === "soft") {
10541						var best = { x: baseX, y: baseY, score: -999999 };
10542						var softTries = Math.max(20, Math.min(120, attempts));
10543
10544						for (var st = 0; st < softTries; st++) {
10545							var rxS = baseCellX + (Math.random() * cellW);
10546							var ryS = baseCellY + (Math.random() * cellH);
10547
10548							var candS = { x: rxS, y: ryS, w: baseWidth + gap, h: baseWidth + gap };
10549
10550							var score = 0;
10551
10552							if (noOverlap) {
10553								for (var pp = 0; pp < placed.length; pp++) {
10554									if (rectsOverlap(candS, placed[pp])) { score -= 1000; break; }
10555								}
10556							}
10557
10558							if (rectsOverlap(candS, safeRect)) score -= 500;
10559
10560							var sx = safeRect.x + safeRect.w / 2;
10561							var sy = safeRect.y + safeRect.h / 2;
10562							var dxs = (rxS - sx);
10563							var dys = (ryS - sy);
10564							score += Math.sqrt(dxs * dxs + dys * dys);
10565
10566							if (score > best.score) best = { x: rxS, y: ryS, score: score };
10567						}
10568
10569						baseX = best.x;
10570						baseY = best.y;
10571
10572						if (noOverlap) {
10573							if (isBadCandidate(baseX, baseY)) {
10574								placedOk = false;
10575							}
10576						}
10577
10578					} else {
10579						if (noOverlap || safeRect) {
10580							placedOk = false;
10581
10582							for (var a = 0; a < attempts; a++) {
10583								var rx = baseCellX + (Math.random() * cellW);
10584								var ry = baseCellY + (Math.random() * cellH);
10585
10586								if (safeRect && safeMode === "avoid") {
10587									var cx = rx + (baseWidth / 2);
10588									var cy = ry + (baseWidth / 2);
10589									if (cx >= safeRect.x && cx <= safeRect.x + safeRect.w &&
10590										cy >= safeRect.y && cy <= safeRect.y + safeRect.h) {
10591										continue;
10592									}
10593								}
10594
10595								var cand = { x: rx, y: ry, w: baseWidth + gap, h: baseWidth + gap };
10596
10597								var collides = false;
10598								if (noOverlap) {
10599									for (var p = 0; p < placed.length; p++) {
10600										if (rectsOverlap(cand, placed[p])) { collides = true; break; }
10601									}
10602								}
10603
10604								if (!collides) {
10605									baseX = rx;
10606									baseY = ry;
10607									placed.push(cand);
10608									placedOk = true;
10609									break;
10610								}
10611							}
10612
10613							if (!placedOk) continue;
10614						}
10615					}
10616
10617					if (noOverlap && placedOk) {
10618						placed.push({ x: baseX, y: baseY, w: baseWidth + gap, h: baseWidth + gap });
10619					}
10620
10621					var rnd = Math.random();
10622					var tDepth = depthEnabled ? rnd : 0;
10623
10624					var tScale = depthEnabled ? (1 - tDepth) : Math.random();
10625					tScale = clamp01(tScale);
10626
10627					var scale = lerp(scaleMin, scaleMax, tScale);
10628
10629					var moveFactor = depthEnabled ? lerp(1, 0.25, tDepth) : 1;
10630
10631					var opacity = depthEnabled
10632						? lerp(opacityMax, opacityMin, tDepth)
10633						: lerp(opacityMin, opacityMax, Math.random());
10634
10635					var blur = 0;
10636					if (enableBlur) {
10637						blur = depthEnabled
10638							? lerp(blurMin, blurMax, tDepth)
10639							: lerp(blurMin, blurMax, Math.random());
10640					}
10641
10642					var tZ = depthEnabled
10643						? (1 - tDepth)
10644						: ((scaleMax === scaleMin) ? 1 : (scale - scaleMin) / (scaleMax - scaleMin));
10645					tZ = clamp01(tZ);
10646
10647					el.style.zIndex = zIndexBase + Math.round(zIndexRange * tZ);
10648
10649					var rot = 0;
10650					if (enableRotation) {
10651						rot = gsap.utils.random(-rotationRange, rotationRange, 0.1);
10652					}
10653
10654					gsap.set(el, {
10655						x: baseX,
10656						y: baseY,
10657						scale: scale,
10658						rotation: rot,
10659						opacity: opacity,
10660						filter: enableBlur ? "blur(" + blur.toFixed(2) + "px)" : "none"
10661					});
10662
10663					items.push({
10664						el: el,
10665						baseX: baseX,
10666						baseY: baseY,
10667						moveFactor: moveFactor
10668					});
10669
10670					frag.appendChild(el);
10671				}
10672
10673				renderArea.appendChild(frag);
10674			}
10675
10676			buildLayout();
10677
10678			function onMove(e) {
10679
10680				var rect = hoverArea.getBoundingClientRect();
10681				if (!rect.width || !rect.height) return;
10682
10683				var nx = (e.clientX - rect.left - rect.width / 2) / (rect.width / 2);
10684				var ny = (e.clientY - rect.top  - rect.height / 2) / (rect.height / 2);
10685
10686				for (var i = 0; i < items.length; i++) {
10687					var it = items[i];
10688
10689					var dx = -nx * moveX * it.moveFactor;
10690					var dy = -ny * moveY * it.moveFactor;
10691
10692					gsap.to(it.el, {
10693						x: it.baseX + dx,
10694						y: it.baseY + dy,
10695						duration: easeDur,
10696						ease: ease,
10697						overwrite: true
10698					});
10699				}
10700			}
10701
10702			function onScroll() {
10703
10704				if (!enableScrollMotion) return;
10705
10706				var rect = hoverArea.getBoundingClientRect();
10707				var vh = window.innerHeight || document.documentElement.clientHeight;
10708
10709				if (!rect.height) return;
10710
10711				// completamente fuori
10712				if (rect.bottom <= 0 || rect.top >= vh) {
10713					for (var k = 0; k < items.length; k++) {
10714						var it0 = items[k];
10715						gsap.to(it0.el, {
10716							x: it0.baseX,
10717							y: it0.baseY,
10718							duration: easeLeave,
10719							ease: ease,
10720							overwrite: true
10721						});
10722					}
10723					return;
10724				}
10725
10726				var travel = vh + rect.height;
10727				var progress = (vh - rect.top) / travel;
10728
10729				if (progress < 0) progress = 0;
10730				if (progress > 1) progress = 1;
10731
10732				var ny = progress * 2 - 1;
10733				var nx = ny * 0.35;
10734
10735				for (var i = 0; i < items.length; i++) {
10736					var it = items[i];
10737
10738					var dx = -nx * moveX * 0.35 * it.moveFactor;
10739					var dy = -ny * moveY * 0.35 * it.moveFactor;
10740
10741					gsap.to(it.el, {
10742						x: it.baseX + dx,
10743						y: it.baseY + dy,
10744						duration: easeDur,
10745						ease: ease,
10746						overwrite: true
10747					});
10748				}
10749			}
10750
10751			function onLeave() {
10752				for (var i = 0; i < items.length; i++) {
10753					var it = items[i];
10754					gsap.to(it.el, {
10755						x: it.baseX,
10756						y: it.baseY,
10757						duration: easeLeave,
10758						ease: ease,
10759						overwrite: true
10760					});
10761				}
10762			}
10763
10764			var sizeObserver = null;
10765			var lastLayoutW = 0;
10766			var lastLayoutH = 0;
10767
10768			function updateLayoutSizeCache() {
10769				var r = renderArea.getBoundingClientRect();
10770				lastLayoutW = Math.round(r.width);
10771				lastLayoutH = Math.round(r.height);
10772			}
10773
10774			function shouldRebuildLayout() {
10775				var r = renderArea.getBoundingClientRect();
10776				var newW = Math.round(r.width);
10777				var newH = Math.round(r.height);
10778
10779				var dw = Math.abs(newW - lastLayoutW);
10780				var dh = Math.abs(newH - lastLayoutH);
10781
10782				// rebuild sempre se cambia la larghezza
10783				// sull'altezza, tollera micro-variazioni tipiche del browser mobile durante lo scroll
10784				var mustRebuild = dw > 1 || dh > 80;
10785
10786				if (mustRebuild) {
10787					lastLayoutW = newW;
10788					lastLayoutH = newH;
10789				}
10790
10791				return mustRebuild;
10792			}
10793
10794			updateLayoutSizeCache();
10795
10796			if ("ResizeObserver" in window) {
10797				sizeObserver = new ResizeObserver(function () {
10798					if (shouldRebuildLayout()) {
10799						buildLayout();
10800					}
10801					onScroll();
10802				});
10803				sizeObserver.observe(renderArea);
10804			}
10805
10806			hoverArea.addEventListener("mousemove", onMove);
10807			hoverArea.addEventListener("mouseleave", onLeave);
10808
10809			function onWindowResize() {
10810				if (shouldRebuildLayout()) {
10811					buildLayout();
10812				}
10813				onScroll();
10814			}
10815
10816			window.addEventListener("resize", onWindowResize);
10817			window.addEventListener("scroll", onScroll, { passive: true });
10818			onScroll();
10819			watchPosition();
10820
10821			return function () {
10822				hoverArea.removeEventListener("mousemove", onMove);
10823				hoverArea.removeEventListener("mouseleave", onLeave);
10824				window.removeEventListener("resize", onWindowResize);
10825				window.removeEventListener("scroll", onScroll);
10826
10827				if (sizeObserver) {
10828					sizeObserver.disconnect();
10829					sizeObserver = null;
10830				}
10831
10832				watchActive = false;
10833				if (rafWatch) {
10834					cancelAnimationFrame(rafWatch);
10835					rafWatch = 0;
10836				}
10837				
10838				clearAll();
10839			};
10840
10841		}
10842
10843		var destroyers = [];
10844
10845		var areas = document.querySelectorAll(".uncode-bg-magnetic");
10846		for (var n = 0; n < areas.length; n++) {
10847			var renderArea = areas[n];
10848
10849			if (renderArea.__magneticDestroy && typeof renderArea.__magneticDestroy === "function") {
10850				try { renderArea.__magneticDestroy(); } catch (e) {}
10851				renderArea.__magneticDestroy = null;
10852			}
10853
10854			var hoverArea = renderArea.closest
10855				? renderArea.closest('.vc_row[data-parent="true"]')
10856				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10857
10858			if (!hoverArea) continue;
10859
10860			var images = getMagneticImagesFromArea(renderArea);
10861			if (!images.length) continue;
10862
10863			function cssLengthToPx(value, el, fallback) {
10864				if (value == null) return fallback;
10865
10866				if (typeof value === "number") return isFinite(value) ? value : fallback;
10867
10868				var s = String(value).trim();
10869				if (!s) return fallback;
10870
10871				var n = parseFloat(s.replace(",", "."));
10872				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10873
10874				var probe = document.createElement("div");
10875				probe.style.position = "absolute";
10876				probe.style.visibility = "hidden";
10877				probe.style.pointerEvents = "none";
10878				probe.style.width = s;
10879				probe.style.height = "0";
10880
10881				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10882				parent.appendChild(probe);
10883
10884				var px = probe.getBoundingClientRect().width;
10885				parent.removeChild(probe);
10886
10887				return (px && isFinite(px)) ? px : fallback;
10888			}
10889
10890			var rawMin = getDataFromArea(renderArea, "min-width", "100px");
10891			var rawMax = getDataFromArea(renderArea, "max-width", "300px");
10892
10893			var minW = cssLengthToPx(rawMin, renderArea, 100);
10894			var maxW = cssLengthToPx(rawMax, renderArea, 300);
10895			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
10896
10897			var scaleMin = (maxW > 0) ? (minW / maxW) : 1;
10898
10899			var rawMoveX = getDataFromArea(renderArea, "move-x", "400px");
10900			var rawMoveY = getDataFromArea(renderArea, "move-y", "300px");
10901			var rawSpillX = getDataFromArea(renderArea, "spill-x", null);
10902			var rawSpillY = getDataFromArea(renderArea, "spill-y", null);
10903
10904			if (rawSpillX == null || rawSpillX === "") {
10905				if (typeof rawMoveX === "number") rawSpillX = rawMoveX / 2;
10906				else rawSpillX = "calc((" + rawMoveX + ") / 2)";
10907			}
10908
10909			if (rawSpillY == null || rawSpillY === "") {
10910				if (typeof rawMoveY === "number") rawSpillY = rawMoveY / 2;
10911				else rawSpillY = "calc((" + rawMoveY + ") / 2)";
10912			}
10913
10914			renderArea.__magneticDestroy = initMagneticPattern({
10915				area: renderArea,
10916				hoverArea: hoverArea,
10917				images: images,
10918
10919				count: toNumber(getDataFromArea(renderArea, "count", 16), 16),
10920
10921				padding: 27,
10922				jitter: 0.35,
10923
10924				moveX: rawMoveX,
10925				moveY: rawMoveY,
10926				spillX: rawSpillX,
10927				spillY: rawSpillY,
10928
10929				easeDur: 0.7,
10930				easeLeave: 1.7,
10931				ease: "power3.out",
10932
10933				opacityMin: toNumber(getDataFromArea(renderArea, "min-opacity", 0.25), 0.25),
10934				opacityMax: toNumber(getDataFromArea(renderArea, "max-opacity", 1), 1),
10935
10936				zIndexBase: 1,
10937				zIndexRange: 30,
10938
10939				enableRotation: false,
10940				rotationRange: 8,
10941
10942				enableBlur: String(getDataFromArea(renderArea, "blur", "no")) === "yes",
10943				blurMin: 0,
10944				blurMax: 1.5,
10945
10946				baseWidth: maxW,
10947				scaleMin: scaleMin,
10948				scaleMax: 1,
10949
10950				flatDepth: String(getDataFromArea(renderArea, "depth", "no")) !== "yes",
10951
10952				noOverlap: String(getDataFromArea(renderArea, "no-overlap", "no")) === "yes",
10953				attempts: toNumber(getDataFromArea(renderArea, "attempts", 120), 120),
10954				gap: toNumber(getDataFromArea(renderArea, "gap", 8), 8),
10955
10956				depthMin: 0.25,
10957				depthMax: 1.0,
10958
10959				unique: String(getDataFromArea(renderArea, "unique", "no")) === "yes",
10960
10961				safeW: toNumber(getDataFromArea(renderArea, "safe-w", 0), 0),
10962				safeH: toNumber(getDataFromArea(renderArea, "safe-h", 0), 0),
10963				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10964
10965				scrollMotion: String(getDataFromArea(renderArea, "stop-scroll", "no")) !== "yes",
10966			}) || null;
10967
10968			if (renderArea.__magneticDestroy) {
10969				destroyers.push(renderArea.__magneticDestroy);
10970			}
10971		}
10972
10973		__globalDestroy = function () {
10974			for (var i = 0; i < destroyers.length; i++) {
10975				try { destroyers[i](); } catch (e) {}
10976			}
10977			destroyers.length = 0;
10978		};
10979
10980	};
10981
10982})();
10983UNCODE.thumbDrop = (function () {
10984
10985	"use strict";
10986
10987	var __globalDestroy = null;
10988
10989	return function () {
10990
10991		if (!window.Matter) return;
10992
10993		if (typeof __globalDestroy === "function") {
10994			try { __globalDestroy(); } catch (e) {}
10995			__globalDestroy = null;
10996		}
10997
10998		var Engine = Matter.Engine;
10999		var World  = Matter.World;
11000		var Bodies = Matter.Bodies;
11001		var Body   = Matter.Body;
11002		var Mouse  = Matter.Mouse;
11003		var MouseConstraint = Matter.MouseConstraint;
11004
11005		function getDropImagesFromArea(area) {
11006			var node = area.querySelector("script.drop-images");
11007			if (!node) return [];
11008			var json = node.textContent || node.innerText || "[]";
11009			try { return JSON.parse(json); } catch (e) { return []; }
11010		}
11011
11012		function matchesSelector(el, selector) {
11013			var p = Element.prototype;
11014			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
11015			if (!fn) return false;
11016			return fn.call(el, selector);
11017		}
11018
11019		function closestPolyfill(el, selector) {
11020			while (el && el.nodeType === 1) {
11021				if (matchesSelector(el, selector)) return el;
11022				el = el.parentNode;
11023			}
11024			return null;
11025		}
11026
11027		function debounce(fn, wait) {
11028			var t = null;
11029			return function () {
11030				var ctx = this;
11031				var args = arguments;
11032				clearTimeout(t);
11033				t = setTimeout(function () { fn.apply(ctx, args); }, wait);
11034			};
11035		}
11036
11037		function clamp(v, a, b) {
11038			return v < a ? a : (v > b ? b : v);
11039		}
11040
11041		function toNumber(value, fallback) {
11042			if (value == null) return fallback;
11043			var s = String(value).trim();
11044			if (!s) return fallback;
11045			s = s.replace(",", ".");
11046			var m = s.match(/-?\d+(\.\d+)?/);
11047			if (!m) return fallback;
11048			var n = parseFloat(m[0]);
11049			return isFinite(n) ? n : fallback;
11050		}
11051
11052		function cssLengthToPx(value, el, fallback) {
11053			if (value == null) return fallback;
11054
11055			if (typeof value === "number") return isFinite(value) ? value : fallback;
11056
11057			var s = String(value).trim();
11058			if (!s) return fallback;
11059
11060			var n = parseFloat(s.replace(",", "."));
11061			if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
11062
11063			var probe = document.createElement("div");
11064			probe.style.position = "absolute";
11065			probe.style.visibility = "hidden";
11066			probe.style.pointerEvents = "none";
11067			probe.style.width = "0";
11068			probe.style.height = "0";
11069
11070			var parent = (el && el.parentNode) ? el.parentNode : document.body;
11071			parent.appendChild(probe);
11072
11073			probe.style.width = s;
11074			var px = probe.getBoundingClientRect().width;
11075
11076			parent.removeChild(probe);
11077
11078			if (!px || !isFinite(px)) return fallback;
11079			return px;
11080		}
11081
11082		function getDataFromArea(area, key, fallback) {
11083			if (!area || !key) return fallback;
11084
11085			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
11086			var raw = area.getAttribute(attr);
11087			if (raw == null) return fallback;
11088
11089			raw = String(raw).trim();
11090
11091			if (raw === "true") return true;
11092			if (raw === "false") return false;
11093			if (raw === "null") return null;
11094
11095			var num = raw.replace(",", ".");
11096			if (num !== "" && isFinite(num)) return parseFloat(num);
11097
11098			if (
11099				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
11100				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
11101			) {
11102				try { return JSON.parse(raw); } catch (e) {}
11103			}
11104
11105			return raw;
11106		}
11107
11108		function raf2(cb) {
11109			requestAnimationFrame(function () {
11110				requestAnimationFrame(function () {
11111					cb();
11112				});
11113			});
11114		}
11115
11116		function normalizeDragMode(v) {
11117			if (v == null) return "";
11118			if (v === true) return "drag";
11119			var s = String(v).trim().toLowerCase();
11120			if (!s) return "";
11121			if (s === "1" || s === "yes" || s === "true") return "drag";
11122			if (s === "drag" || s === "hover") return s;
11123			return "";
11124		}
11125
11126		function initMatterDrop(options) {
11127			options = options || {};
11128
11129			var area    = options.area;
11130			var surface = options.surface;
11131			var images  = options.images || [];
11132
11133			var maxAvailable = images.length;
11134			var duplicateImages = options.duplicateImages !== false;
11135			var count = options.count != null ? options.count : Math.min(18, maxAvailable);
11136
11137			if (!duplicateImages && count > maxAvailable) {
11138				count = maxAvailable;
11139			}
11140
11141			var sizeMin    = options.sizeMin != null ? options.sizeMin : 140;
11142			var sizeMax    = options.sizeMax != null ? options.sizeMax : 260;
11143			var spawnEvery = options.spawnEvery != null ? options.spawnEvery : 160;
11144			var startDelay = options.startDelay != null ? options.startDelay : 0;
11145
11146			var gravityY    = options.gravityY != null ? options.gravityY : 1.25;
11147			var restitution = options.restitution != null ? options.restitution : 0.35;
11148			var frictionAir = options.frictionAir != null ? options.frictionAir : 0.02;
11149			var friction    = options.friction != null ? options.friction : 0.25;
11150			var density     = options.density != null ? options.density : 0.001;
11151
11152			var wallThickness = options.wallThickness != null ? options.wallThickness : 80;
11153			var floorPadding  = options.floorPadding != null ? options.floorPadding : 0;
11154
11155			var rotateRange = options.rotateRange != null ? options.rotateRange : 18;
11156
11157			var once       = options.once !== false;
11158			var threshold  = options.threshold != null ? options.threshold : 0.25;
11159			var rootMargin = options.rootMargin || "0px 0px -10% 0px";
11160
11161			var dragMode = normalizeDragMode(options.enableDrag);
11162			var enableDrag = dragMode === "drag";
11163			var enableHoverRepel = dragMode === "hover";
11164
11165			var dragStiffness = options.dragStiffness != null ? options.dragStiffness : 0.18;
11166			var dragDamping   = options.dragDamping != null ? options.dragDamping : 0.06;
11167
11168			var hoverRadius = options.hoverRadius != null ? options.hoverRadius : 260;
11169			var spawnXMode = String(options.spawnXMode || "random").toLowerCase();
11170			var spawnXFixed = options.spawnXFixed != null ? options.spawnXFixed : 50;
11171			var spawnXJitter = options.spawnXJitter != null ? options.spawnXJitter : 0;	
11172
11173			if (!area || !surface || !images.length) return null;
11174
11175			var cs = window.getComputedStyle(area);
11176			if (cs.position === "static") area.style.position = "absolute";
11177			if (!area.style.left) area.style.left = "0";
11178			if (!area.style.top) area.style.top = "0";
11179			if (!area.style.width) area.style.width = "100%";
11180			if (!area.style.height) area.style.height = "100%";
11181
11182			area.style.pointerEvents = enableDrag ? "auto" : "none";
11183
11184			var engine = Engine.create();
11185			engine.enableSleeping = false;
11186			engine.gravity.y = gravityY;
11187
11188			var alive = true;
11189			var started = false;
11190
11191			var bounds = { w: 0, h: 0 };
11192			var walls = null;
11193			var items = [];
11194
11195			var spawnTimer = null;
11196			var spawned = 0;
11197
11198			var ro = null;
11199			var pollTimer = null;
11200			var lastW = 0;
11201			var lastH = 0;
11202
11203			var mouseConstraint = null;
11204
11205			var rafId = 0;
11206			var io = null;
11207			var scrollHandler = null;
11208			var dragMousemoveHandler = null;
11209
11210			var hoverMoveHandler = null;
11211			var hoverLeaveHandler = null;
11212			var hoverX = null;
11213			var hoverY = null;
11214			var hoverActive = false;
11215
11216			function updateRects() {
11217				bounds.w = area.offsetWidth;
11218				bounds.h = area.offsetHeight;
11219			}
11220
11221			function removeWalls() {
11222				if (!walls) return;
11223				World.remove(engine.world, walls.floor);
11224				World.remove(engine.world, walls.left);
11225				World.remove(engine.world, walls.right);
11226				walls = null;
11227			}
11228
11229			function createWalls() {
11230				updateRects();
11231
11232				var w = bounds.w;
11233				var h = bounds.h;
11234				if (!w || !h) return false;
11235
11236				var t = wallThickness;
11237				var floorY = h + t * 0.5 + floorPadding;
11238
11239				var floor = Bodies.rectangle(w * 0.5, floorY, w + t * 2, t, { isStatic: true, restitution: 0, friction: 1 });
11240				var left  = Bodies.rectangle(-t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11241				var right = Bodies.rectangle(w + t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11242
11243				walls = { floor: floor, left: left, right: right };
11244				World.add(engine.world, [floor, left, right]);
11245
11246				return true;
11247			}
11248
11249			function setTransform(el, x, y, a) {
11250				el.style.transform = "translate3d(" + x + "px," + y + "px,0) rotate(" + a + "deg)";
11251			}
11252
11253			function preloadAll(list) {
11254				for (var i = 0; i < list.length; i++) {
11255					var im = new Image();
11256					im.src = list[i];
11257				}
11258			}
11259
11260			function recalcSpawnSizes() {
11261				if (!options.rawMin && !options.rawMax) return;
11262
11263				var newMin = cssLengthToPx(options.rawMin, area, sizeMin);
11264				var newMax = cssLengthToPx(options.rawMax, area, sizeMax);
11265
11266				if (newMax < newMin) { var t = newMin; newMin = newMax; newMax = t; }
11267
11268				sizeMin = newMin;
11269				sizeMax = newMax;
11270			}
11271
11272			function setupDrag() {
11273				if (!enableDrag || !Mouse || !MouseConstraint) return;
11274
11275				var mouse = Mouse.create(area);
11276				mouse.pixelRatio = 1;
11277
11278				mouseConstraint = MouseConstraint.create(engine, {
11279					mouse: mouse,
11280					constraint: {
11281						stiffness: dragStiffness,
11282						damping: dragDamping,
11283						render: { visible: false }
11284					}
11285				});
11286
11287				World.add(engine.world, mouseConstraint);
11288
11289				dragMousemoveHandler = function () {
11290					mouse.offset.x = 0;
11291					mouse.offset.y = 0;
11292				};
11293				area.addEventListener("mousemove", dragMousemoveHandler);
11294
11295				area.style.userSelect = "none";
11296				area.style.webkitUserSelect = "none";
11297			}
11298
11299			function setupHoverRepel() {
11300				if (!enableHoverRepel) return;
11301
11302				area.style.pointerEvents = "auto";
11303
11304				hoverMoveHandler = function (e) {
11305					var r = area.getBoundingClientRect();
11306					hoverX = e.clientX - r.left;
11307					hoverY = e.clientY - r.top;
11308
11309					hoverActive = true;
11310				};
11311
11312				hoverLeaveHandler = function () {
11313					hoverActive = false;
11314					hoverX = null;
11315					hoverY = null;
11316				};
11317
11318				area.addEventListener("mousemove", hoverMoveHandler);
11319				area.addEventListener("mouseleave", hoverLeaveHandler);
11320			}
11321
11322			function getSpawnX(w) {
11323				var minX = w * 0.5;
11324				var maxX = Math.max(minX, bounds.w - w * 0.5);
11325
11326				if (spawnXMode === "fixed") {
11327					var pct = clamp(spawnXFixed, 0, 100) / 100;
11328					var baseX = minX + (maxX - minX) * pct;
11329
11330					if (spawnXJitter > 0) {
11331						var jitterPx = (bounds.w * spawnXJitter / 100) * (Math.random() - 0.5);
11332						baseX += jitterPx;
11333					}
11334
11335					return clamp(baseX, minX, maxX);
11336				}
11337
11338				if (spawnXMode === "sequence") {
11339					var total = Math.max(1, count);
11340
11341					if (total === 1) {
11342						return (minX + maxX) * 0.5;
11343					}
11344
11345					var progress = duplicateImages
11346						? ((spawned % total) / (total - 1))
11347						: (spawned / Math.max(1, total - 1));
11348
11349					return minX + (maxX - minX) * progress;
11350				}
11351
11352				return minX + Math.random() * Math.max(0, maxX - minX);
11353			}
11354
11355			function spawnOne() {
11356				if (!alive) return;
11357				if (spawned >= count) return;
11358
11359				updateRects();
11360				if (!bounds.w || !bounds.h) return;
11361
11362				if (!duplicateImages && spawned >= images.length) return;
11363
11364				var src = duplicateImages
11365					? images[spawned % images.length]
11366					: images[spawned];
11367
11368				var w = Math.round(Matter.Common.random(sizeMin, sizeMax));
11369				var x = getSpawnX(w);
11370
11371				var img = new Image();
11372				img.onload = function () {
11373					if (!alive) return;
11374
11375					var css = getComputedStyle(area);
11376					var ratioVar = (css.getPropertyValue("--bgm-ratio") || "").trim();
11377					var ratio = null;
11378
11379					if (ratioVar) {
11380						var parts = ratioVar.split("/");
11381						if (parts.length === 2) {
11382							var rw = parseFloat(parts[0]);
11383							var rh = parseFloat(parts[1]);
11384							if (rw > 0 && rh > 0) ratio = rh / rw;
11385						}
11386					}
11387
11388					var r = ratio;
11389					if (!r) {
11390						if (img.naturalWidth && img.naturalHeight) r = img.naturalHeight / img.naturalWidth;
11391						else r = 1;
11392					}
11393
11394					var h = Math.max(20, Math.round(w * r));
11395
11396					var startY = -(h + 300);
11397
11398					var el = document.createElement("img");
11399					el.className = "drop-img";
11400					el.setAttribute("src", src);
11401					el.style.width = w + "px";
11402					el.style.height = h + "px";
11403					el.style.position = "absolute";
11404					el.style.left = "0";
11405					el.style.top = "0";
11406					el.style.willChange = "transform";
11407					el.style.pointerEvents = "none";
11408					el.style.userSelect = "none";
11409
11410					el.style.opacity = "0";
11411
11412					setTransform(el, x - w * 0.5, startY - h * 0.5, 0);
11413
11414					area.appendChild(el);
11415
11416					var body = Bodies.rectangle(x, startY, w, h, {
11417						restitution: restitution,
11418						frictionAir: frictionAir,
11419						friction: friction,
11420						density: density
11421					});
11422
11423					Body.setVelocity(body, {
11424						x: (Math.random() - 0.5) * 4,
11425						y: Math.random() * 2
11426					});
11427
11428					World.add(engine.world, body);
11429					items.push({ el: el, body: body, w: w, h: h });
11430
11431					requestAnimationFrame(function () {
11432						el.style.opacity = "1";
11433					});
11434
11435					setTransform(el, body.position.x - w * 0.5, body.position.y - h * 0.5, body.angle * 180 / Math.PI);
11436				};
11437				img.onerror = function () {};
11438				img.src = src;
11439
11440				spawned++;
11441			}
11442
11443			function applyHoverRepel() {
11444
11445				if (!enableHoverRepel) return;
11446				if (!hoverActive || hoverX == null || hoverY == null) return;
11447
11448				var radius = hoverRadius;
11449				var r2 = radius * radius;
11450
11451				for (var i = 0; i < items.length; i++) {
11452
11453					var b = items[i].body;
11454
11455					var dx = b.position.x - hoverX;
11456					var dy = b.position.y - hoverY;
11457
11458					var d2 = dx * dx + dy * dy;
11459					if (d2 > r2 || d2 < 0.001) continue;
11460
11461					var d = Math.sqrt(d2);
11462
11463					var nx = dx / d;
11464					var ny = dy / d;
11465
11466					var strength = (1 - d / radius) * 25;
11467
11468					Body.setVelocity(b, {
11469						x: b.velocity.x + nx * strength,
11470						y: b.velocity.y + ny * strength - strength * 0.6
11471					});
11472
11473					for (var j = 0; j < items.length; j++) {
11474
11475						if (i === j) continue;
11476
11477						var nb = items[j].body;
11478
11479						var ddx = nb.position.x - b.position.x;
11480						var ddy = nb.position.y - b.position.y;
11481
11482						var dist = Math.sqrt(ddx * ddx + ddy * ddy);
11483
11484						if (dist < 120 && dist > 0.001) {
11485
11486							var nnx = ddx / dist;
11487							var nny = ddy / dist;
11488
11489							Body.setVelocity(nb, {
11490								x: nb.velocity.x + nnx * 2,
11491								y: nb.velocity.y + nny * 2
11492							});
11493
11494						}
11495					}
11496				}
11497			}
11498
11499			function tick() {
11500				if (!alive) return;
11501
11502				applyHoverRepel();
11503
11504				if (mouseConstraint && mouseConstraint.body) {
11505					var dragged = mouseConstraint.body;
11506
11507					for (var di = 0; di < items.length; di++) {
11508						if (items[di].body === dragged) {
11509							var halfW = items[di].w * 0.5;
11510							var halfH = items[di].h * 0.5;
11511
11512							var clampedX = clamp(dragged.position.x, halfW + 2, bounds.w - halfW - 2);
11513							var clampedY = clamp(dragged.position.y, halfH + 2, bounds.h - halfH - 2);
11514
11515							if (clampedX !== dragged.position.x || clampedY !== dragged.position.y) {
11516								Body.setPosition(dragged, { x: clampedX, y: clampedY });
11517								Body.setVelocity(dragged, { x: 0, y: 0 });
11518							}
11519							break;
11520						}
11521					}
11522				}
11523	
11524				Engine.update(engine, 1000 / 60);
11525
11526				var sideLimit = Math.max(120, wallThickness * 1.5);
11527				var bottomLimit = bounds.h + Math.max(160, wallThickness * 1.5);
11528
11529				for (var i = 0; i < items.length; i++) {
11530					var it0 = items[i];
11531					var b0 = it0.body;
11532
11533					var halfW = it0.w * 0.5;
11534					var halfH = it0.h * 0.5;
11535
11536					var minX = halfW + 2;
11537					var maxX = bounds.w - halfW - 2;
11538					var rescueY = Math.max(halfH + 2, 20);
11539					var floorY = bounds.h - halfH - 2;
11540
11541					var outLeft = b0.position.x < -sideLimit;
11542					var outRight = b0.position.x > bounds.w + sideLimit;
11543					var outBottom = b0.position.y > bottomLimit;
11544
11545					if (outLeft || outRight || outBottom) {
11546						var safeX = clamp(b0.position.x, minX, maxX);
11547						var safeY = clamp(b0.position.y, rescueY, floorY);
11548
11549						if (outBottom) safeY = floorY;
11550
11551						Body.setPosition(b0, { x: safeX, y: safeY });
11552						Body.setVelocity(b0, { x: 0, y: 0 });
11553						Body.setAngularVelocity(b0, 0);
11554					}
11555				}
11556
11557				for (var j = 0; j < items.length; j++) {
11558					var it = items[j];
11559					var b = it.body;
11560					setTransform(it.el, b.position.x - it.w * 0.5, b.position.y - it.h * 0.5, b.angle * 180 / Math.PI);
11561				}
11562
11563				rafId = requestAnimationFrame(tick);
11564			}
11565
11566			function resetToNewSize() {
11567				if (!started) return;
11568
11569				removeWalls();
11570				if (!createWalls()) return;
11571
11572				updateRects();
11573
11574				var w = bounds.w;
11575				var h = bounds.h;
11576
11577				for (var i = 0; i < items.length; i++) {
11578					var it = items[i];
11579					var bw = it.w;
11580					var bh = it.h;
11581
11582					var px = clamp(it.body.position.x, bw * 0.5 + 2, w - bw * 0.5 - 2);
11583					var py = clamp(it.body.position.y, -2000, h - bh * 0.5 - 2);
11584					Body.setPosition(it.body, { x: px, y: py });
11585				}
11586			}
11587
11588			function startSizeObserver() {
11589				updateRects();
11590				lastW = bounds.w;
11591				lastH = bounds.h;
11592
11593				if ("ResizeObserver" in window) {
11594					ro = new ResizeObserver(function () {
11595						raf2(function () {
11596							updateRects();
11597							if (bounds.w !== lastW || bounds.h !== lastH) {
11598								lastW = bounds.w;
11599								lastH = bounds.h;
11600								resetToNewSize();
11601							}
11602						});
11603					});
11604					ro.observe(area);
11605					return;
11606				}
11607
11608				pollTimer = setInterval(function () {
11609					updateRects();
11610					if (bounds.w !== lastW || bounds.h !== lastH) {
11611						lastW = bounds.w;
11612						lastH = bounds.h;
11613						resetToNewSize();
11614					}
11615				}, 200);
11616			}
11617
11618			function stopSizeObserver() {
11619				if (ro) { ro.disconnect(); ro = null; }
11620				if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
11621			}
11622
11623			function startSpawning() {
11624				if (!alive) return;
11625				if (started) return;
11626
11627				var tries = 0;
11628				var stable = 0;
11629				var prevW = 0;
11630				var prevH = 0;
11631
11632				function check() {
11633					if (!alive) return;
11634
11635					updateRects();
11636
11637					if (!bounds.w || !bounds.h) {
11638						tries++;
11639						if (tries < 40) setTimeout(check, 150);
11640						return;
11641					}
11642
11643					if (bounds.w === prevW && bounds.h === prevH) stable++;
11644					else {
11645						stable = 0;
11646						prevW = bounds.w;
11647						prevH = bounds.h;
11648					}
11649
11650					if (stable < 2) {
11651						setTimeout(check, 150);
11652						return;
11653					}
11654
11655					started = true;
11656
11657					removeWalls();
11658					if (!createWalls()) {
11659						started = false;
11660						setTimeout(check, 200);
11661						return;
11662					}
11663
11664					setupDrag();
11665					setupHoverRepel();
11666					tick();
11667
11668					var start = function () {
11669						spawnOne();
11670						spawnTimer = setInterval(function () {
11671							if (!alive) return;
11672							if (spawned >= count) {
11673								clearInterval(spawnTimer);
11674								spawnTimer = null;
11675								return;
11676							}
11677							spawnOne();
11678						}, spawnEvery);
11679					};
11680
11681					if (startDelay > 0) setTimeout(start, startDelay);
11682					else start();
11683				}
11684
11685				check();
11686			}
11687
11688			function setupViewportTrigger() {
11689				if ("IntersectionObserver" in window) {
11690					io = new IntersectionObserver(function (entries) {
11691						for (var i = 0; i < entries.length; i++) {
11692							if (entries[i].isIntersecting) {
11693								startSpawning();
11694								if (once && io) { io.disconnect(); io = null; }
11695								break;
11696							}
11697						}
11698					}, { root: null, rootMargin: rootMargin, threshold: threshold });
11699
11700					io.observe(surface);
11701					return;
11702				}
11703
11704				scrollHandler = debounce(function () {
11705					var r = surface.getBoundingClientRect();
11706					var vh = window.innerHeight || document.documentElement.clientHeight;
11707					if (r.top < vh * 0.9 && r.bottom > vh * 0.1) {
11708						startSpawning();
11709						if (once && scrollHandler) {
11710							window.removeEventListener("scroll", scrollHandler);
11711							scrollHandler = null;
11712						}
11713					}
11714				}, 100);
11715
11716				window.addEventListener("scroll", scrollHandler);
11717				scrollHandler();
11718			}
11719
11720			recalcSpawnSizes();
11721			preloadAll(images);
11722			startSizeObserver();
11723			setupViewportTrigger();
11724
11725			return function destroy() {
11726				alive = false;
11727
11728				if (rafId) { cancelAnimationFrame(rafId); rafId = 0; }
11729
11730				stopSizeObserver();
11731
11732				if (io) { try { io.disconnect(); } catch (e) {} io = null; }
11733
11734				if (scrollHandler) {
11735					window.removeEventListener("scroll", scrollHandler);
11736					scrollHandler = null;
11737				}
11738
11739				if (spawnTimer) { clearInterval(spawnTimer); spawnTimer = null; }
11740
11741				if (dragMousemoveHandler) {
11742					area.removeEventListener("mousemove", dragMousemoveHandler);
11743					dragMousemoveHandler = null;
11744				}
11745
11746				if (hoverMoveHandler) {
11747					area.removeEventListener("mousemove", hoverMoveHandler);
11748					hoverMoveHandler = null;
11749				}
11750				if (hoverLeaveHandler) {
11751					area.removeEventListener("mouseleave", hoverLeaveHandler);
11752					hoverLeaveHandler = null;
11753				}
11754
11755				removeWalls();
11756
11757				if (mouseConstraint) {
11758					World.remove(engine.world, mouseConstraint);
11759					mouseConstraint = null;
11760				}
11761
11762				for (var i = 0; i < items.length; i++) {
11763					try { World.remove(engine.world, items[i].body); } catch (e) {}
11764					if (items[i].el && items[i].el.parentNode) items[i].el.parentNode.removeChild(items[i].el);
11765				}
11766				items.length = 0;
11767
11768				var nodes = area.querySelectorAll(".drop-img");
11769				for (var n = nodes.length - 1; n >= 0; n--) {
11770					if (nodes[n] && nodes[n].parentNode) nodes[n].parentNode.removeChild(nodes[n]);
11771				}
11772			};
11773		}
11774
11775		var destroyers = [];
11776
11777		var areas = document.querySelectorAll(".uncode-bg-drop");
11778		for (var n = 0; n < areas.length; n++) {
11779
11780			var renderArea = areas[n];
11781
11782			if (renderArea.__thumbDropDestroy && typeof renderArea.__thumbDropDestroy === "function") {
11783				try { renderArea.__thumbDropDestroy(); } catch (e) {}
11784				renderArea.__thumbDropDestroy = null;
11785			}
11786
11787			var surface = renderArea.closest
11788				? renderArea.closest('.vc_row[data-parent="true"]')
11789				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
11790
11791			if (!surface) continue;
11792
11793			var images = getDropImagesFromArea(renderArea);
11794			if (!images.length) continue;
11795
11796			var rawMin = getDataFromArea(renderArea, "min-width", "140px");
11797			var rawMax = getDataFromArea(renderArea, "max-width", "260px");
11798
11799			var minW = cssLengthToPx(rawMin, renderArea, 140);
11800			var maxW = cssLengthToPx(rawMax, renderArea, 260);
11801			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
11802
11803			renderArea.__thumbDropDestroy = initMatterDrop({
11804				area: renderArea,
11805				surface: surface,
11806				images: images,
11807
11808				rawMin: rawMin,
11809				rawMax: rawMax,
11810
11811				count: toNumber(getDataFromArea(renderArea, "count", 14), 14),
11812				duplicateImages: String(getDataFromArea(renderArea, "unique", "no")) !== "yes",
11813				sizeMin: minW,
11814				sizeMax: maxW,
11815
11816				spawnEvery: toNumber(getDataFromArea(renderArea, "interval", 160), 160),
11817				startDelay: toNumber(getDataFromArea(renderArea, "delay", 0), 0
11817),
11818
11819				gravityY: toNumber(getDataFromArea(renderArea, "gravity", 1.25), 1.25),
11820				restitution: toNumber(getDataFromArea(renderArea, "restitution", 0.35), 0.35),
11821				frictionAir: toNumber(getDataFromArea(renderArea, "friction-air", 0.02), 0.02),
11822				friction: toNumber(getDataFromArea(renderArea, "friction", 0.25), 0.25),
11823				density: toNumber(getDataFromArea(renderArea, "density", 0.001), 0.001),
11824
11825				wallThickness: toNumber(getDataFromArea(renderArea, "wall", 80), 80),
11826				floorPadding: toNumber(getDataFromArea(renderArea, "floor", 0), 0),
11827
11828				rotateRange: toNumber(getDataFromArea(renderArea, "rotate", 18), 18),
11829
11830				once: String(getDataFromArea(renderArea, "once", "yes")) !== "no",
11831				threshold: toNumber(getDataFromArea(renderArea, "threshold", 0.25), 0.25),
11832				rootMargin: String(getDataFromArea(renderArea, "root-margin", "0px 0px -10% 0px")),
11833
11834				enableDrag: String(getDataFromArea(renderArea, "interactive", "")),
11835
11836				dragStiffness: toNumber(getDataFromArea(renderArea, "drag-stiffness", 0.18), 0.18),
11837				dragDamping: toNumber(getDataFromArea(renderArea, "drag-damping", 0.06), 0.06),
11838
11839				hoverRadius: toNumber(getDataFromArea(renderArea, "hover-radius", 50), 50),
11840
11841				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11842				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11843				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11844				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11845				spawnXJitter: toNumber(getDataFromArea(renderArea, "spawn-x-jitter", 13), 13),
11846
11847			}) || null;
11848
11849			if (renderArea.__thumbDropDestroy) {
11850				destroyers.push(renderArea.__thumbDropDestroy);
11851			}
11852		}
11853
11854		__globalDestroy = function () {
11855			for (var i = 0; i < destroyers.length; i++) {
11856				try { destroyers[i](); } catch (e) {}
11857			}
11858			destroyers.length = 0;
11859		};
11860
11861	};
11862
11863})();
11864UNCODE.preventDoubleTransition = function() {
11865	$('.sticky-element .animate_when_almost_visible').each(function(){
11866		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
11867			$el.addClass('do_not_reanimate');
11868		});
11869	});
11870};
11871
11872UNCODE.checkScrollForTabs = function(){
11873	var goToSection = window.location.hash.replace('#', ''),
11874		$index;
11875
11876	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
11877	goToSection = encodeURIComponent(goToSection);
11878	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
11879
11880	$index.attr('data-parent', 'parent-' + goToSection);
11881
11882	if (window.location.hash != undefined && window.location.hash != '') {
11883		requestTimeout(function() {
11884			scrollBody('parent-' + goToSection);
11885		}, 500);
11886	}
11887
11888	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
11889		var hash = (e.currentTarget).hash;
11890		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
11891			$('a[href="' + hash + '"][data-tab-history]').click();
11892			scrollBody(hash);
11893		}
11894	});
11895
11896	var scrollBody = function(index) {
11897
11898		var getSection = $('a[href="' + index + '"][data-tab-history]'),
11899			scrollTo,
11900			safeGap = 27;
11901
11902		if ( ! getSection.length ) {
11903			getSection = $('div[data-parent="' + index + '"]');
11904
11905			if ( getSection.attr('data-target') == 'row' ) {
11906				getSection = getSection.closest('.vc_row');
11907				safeGap = 0;
11908			}
11909		}
11910
11911		if (typeof getSection === 'undefined' || ! getSection.length ) {
11912			return;
11913		}
11914
11915		var body = $("html, body"),
11916		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
11917		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
11918		getOffset = UNCODE.get_scroll_offset();
11919		if ( typeof getSection.offset() === 'undefined' )
11920			return;
11921		scrollTo = getSection.offset().top - safeGap;
11922		scrollTo -= getOffset;
11923
11924		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
11925		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
11926
11927		if (index != 0) {
11928			UNCODE.scrolling = true;
11929		}
11930
11931		if (scrollSpeed == 0) {
11932			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
11933			UNCODE.scrolling = false;
11934		} else {
11935			body.animate({
11936				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
11937			}, scrollSpeed, 'easeInOutQuad', function() {
11938				requestTimeout(function() {
11939					UNCODE.scrolling = false;
11940					if (getOffset != UNCODE.get_scroll_offset()) {
11941						scrollBody(index);
11942					}
11943				}, 100);
11944			});
11945		}
11946
11947	};
11948};
11949
11950UNCODE.printScreen = function() {
11951	var inlineMediaStyle = null,
11952		setResize;
11953
11954    function changeMediaStyle() {
11955		clearRequestTimeout(setResize);
11956		setResize = requestTimeout(function(){
11957	        var $head = document.getElementsByTagName('head')[0],
11958	        	$newStyle = document.createElement('style'),
11959	        	winW = window.innerWidth,
11960	        	printH = window.innerHeight;
11961
11962	        $newStyle.setAttribute('type', 'text/css');
11963	        $newStyle.setAttribute('media', 'print');
11964	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
11965
11966	        if (inlineMediaStyle != null) {
11967	            $head.replaceChild($newStyle, inlineMediaStyle)
11968	        } else {
11969	            $head.appendChild($newStyle);
11970	        }
11971	        inlineMediaStyle = $newStyle;
11972	    }, 1000);
11973    }
11974
11975    changeMediaStyle();
11976    window.addEventListener('resize', changeMediaStyle);
11977};
11978
11979UNCODE.fullPage = function() {
11980	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
11981		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
11982		return false;
11983	} else {
11984		requestTimeout(function() {
11985			window.scrollTo(0, 0);
11986		}, 10);
11987	}
11988
11989	var $masthead = $('#masthead'),
11990		$logo = $('#logo-container-mobile'),
11991		$logolink = $('[data-minheight]', $logo),
11992		logoMinScale = $logolink.data('minheight'),
11993		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
11994		$container = $('.main-container .post-content'),
11995		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
11996		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
11997		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
11998		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
11999		headerWithOpacity = $('.header-scroll-opacity', $header).length,
12000		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
12001		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
12002		scrollBar = true,
12003		effect,
12004		animationEndTimeOut,
12005		fp_anim_time = 900,
12006		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
12007		is_scrolling = false,
12008		dataNames = [],
12009		is_first = true,
12010		no_history = $('body').hasClass('uncode-scroll-no-history'),
12011		theres_footer = true;
12012
12013	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
12014		$('> div', $footer).each(function(index, el){
12015			if ( $(el).outerHeight() < 2 )
12016				theres_footer = false;
12017			else
12018				theres_footer = true;
12019		});
12020	}
12021
12022	if ( !$footer.length )
12023		theres_footer = false;
12024
12025	if ( !UNCODE.isFullPageSnap ) {
12026
12027		if ( $('body').hasClass('uncode-fullpage-zoom') )
12028			effect = 'scaleDown';
12029		else if ( $('body').hasClass('uncode-fullpage-parallax') )
12030			effect = 'moveparallax';
12031		else
12032			effect = 'movecurtain';
12033	}
12034
12035	if ( $('body').hasClass('uncode-fullpage-trid') )
12036		fp_anim_time = fp_anim_time*2;
12037
12038	if ( $header.length ) {
12039		if ( headerName !== '' )
12040			$header.attr('data-name', headerName);
12041		if ( headerLabel !== '' )
12042			$header.attr('data-label', headerLabel);
12043		$container.prepend($header);
12044	}
12045	if ( theres_footer ) {
12046		$container.append($footer);
12047		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
12048		$('aside.widget ul', $footer).addClass('no-list');
12049	}
12050
12051	var $all = $rows.add($header);
12052
12053	if ( theres_footer )
12054		$all = $all.add($footer);
12055
12056	$all.each(function(index, row) {
12057		if( index === 0 )
12058			$(row).addClass('uncode-scroll-active');
12059	});
12060
12061    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
12062
12063	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
12064		$("<ul class='onepage-pagination'></ul>").prependTo("body");
12065	}
12066
12067	$all.each(function(index, val) {
12068		var getName = $(val).data('name'),
12069			label;
12070
12071		if (typeof getName == 'undefined' || getName == 'undefined')
12072			getName = SiteParameters.slide_name + '-' + index;
12073
12074		//if ( dataNames.includes(getName) ) {
12075		if ( dataNames.indexOf(getName) > 0 ) {
12076			getName += '_' + index;
12077			$(val).data('name', getName);
12078		}
12079
12080		dataNames.push(getName);
12081
12082		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
12083
12084		if (typeof $(val).attr('data-label') !== 'undefined')
12085			label = $(val).attr('data-label');
12086		else label = '';
12087
12088		if ( $(val).is($footer) )
12089			return;
12090
12091		if (label != '' ) {
12092			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
12093			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
12094		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
12095			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + SiteParameters.uncode_one_dot_label + " " + index + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
12096		}
12097	});
12098
12099	var checkVisible = function( el, off ) {
12100		if (typeof jQuery === "function" && el instanceof jQuery) {
12101			el = el[0];
12102		}
12103
12104		off = typeof off=='undefined' ? 50 : off;
12105
12106		var rect = el.getBoundingClientRect();
12107
12108		return (
12109			(
12110				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12111				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12112				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
12113			)
12114		);
12115	};
12116
12117	var animationEndAction = function( index, nextIndex ) {
12118		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12119			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12120			player, iframe;
12121
12122		if ( !$nextSlide.is($footer) ) {
12123			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
12124		}
12125
12126		if ( !UNCODE.isFullPageSnap ) {
12127			activateKBurns( nextIndex );
12128		}
12129
12130		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12131			if ($(this).attr('data-provider') == 'vimeo') {
12132				iframe = $(this).find('iframe');
12133				player = new Vimeo.Player(iframe[0]);
12134				player.pause();
12135			} else if ($(this).attr('data-provider') == 'youtube') {
12136				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12137			} else {
12138				if ($(this).is('video')) {
12139					$(this)[0].volume = 0;
12140					$(this)[0].pause();
12141				}
12142			}
12143		});
12144
12145		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12146			if ( $nextSlide.is($header) )
12147				$header.removeClass('header-scrolled');
12148		}
12149
12150		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
12151		$otherEl.each(function(){
12152			var $otherThis = $(this),
12153				$bgwrapperOther = $('.background-inner', $otherThis);
12154			if ( !checkVisible($otherThis) )
12155				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
12156
12157		});
12158
12159		if ( !checkVisible($currentSlide) ) {
12160			$currentSlide.removeClass('uncode-scroll-visible');
12161			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
12162			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
12163				currentScroll.scrollTo(0, 0, 0);
12164		}
12165
12166		clearRequestTimeout(animationEndTimeOut);
12167		animationEndTimeOut = requestTimeout(function(){
12168			Waypoint.refreshAll();
12169			$( document.body ).trigger('uncode_waypoints');
12170			var eventFP = new CustomEvent('fp-slide-changed');
12171			window.dispatchEvent(eventFP);
12172			is_scrolling = false;
12173
12174			if ( is_first ) {
12175				$('ul.onepage-pagination a').removeClass('is-selected');
12176				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12177				is_first = false;
12178			}
12179
12180		}, 500);
12181	};
12182
12183	var postLeaveActions = function( nextIndex ){
12184		if ( menuHidden && ! UNCODE.isMobile )
12185			return false;
12186
12187		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12188			$cols = $('.uncol', $el),
12189			anchor = $el.data('anchor');
12190
12191		if ( ! UNCODE.isFullPageSnap ) {
12192			$.each($cols, function(index, val){
12193				if ( $(val).hasClass('style-light') ){
12194					$masthead.removeClass('style-dark-override').addClass('style-light-override');
12195					return false;
12196				} else if ( $(val).hasClass('style-dark') ) {
12197					$masthead.removeClass('style-light-override').addClass('style-dark-override');
12198					return false;
12199				}
12200			});
12201		}
12202
12203		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
12204			$('.menu-item' ).removeClass('active');
12205			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12206		}
12207
12208		if ( !UNCODE.isFullPageSnap ) {
12209			activateBackWash( nextIndex );
12210		}
12211	};
12212
12213	var activateBackWash = function( nextIndex ){
12214		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12215			$bgwrapper;
12216
12217		if ( $el.length ) {
12218			if ( $el.hasClass('with-zoomout') ) {
12219				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12220			} else if ( $('.with-zoomout', $el).length ) {
12221				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
12222			} else {
12223				return false;
12224			}
12225		} else {
12226			return false;
12227		}
12228
12229		$bgwrapper.addClass('uncode-zoomout');
12230
12231	};
12232
12233	var activateKBurns = function( nextIndex ){
12234		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12235			$bgwrapper;
12236
12237		if ( $el.length ) {
12238			if ( $el.hasClass('with-kburns') ) {
12239				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12240			} else if ( $('.with-kburns', $el).length ) {
12241				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
12242			} else {
12243				return false;
12244			}
12245		} else {
12246			return false;
12247		}
12248
12249		$bgwrapper.addClass('uncode-kburns');
12250
12251	};
12252
12253	var activateParallax = function( nextIndex, direction ){
12254
12255		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12256			$cell = $('.fp-tableCell', $el),
12257			animationEnd = 'webkitAnimationEnd animationend',
12258			cellAnim;
12259
12260		switch( direction ) {
12261			case 'up':
12262				cellAnim = 'moveFromTopInner';
12263				break;
12264			default:
12265				cellAnim = 'moveFromBottomInner';
12266		}
12267
12268		$cell.css({
12269			'animation-name': cellAnim,
12270			'animation-duration': fp_anim_time + 'ms',
12271			'animation-delay': '',
12272			'animation-timing-function': fp_easing,
12273			'animation-fill-mode': 'both',
12274		}).off(animationEnd)
12275		.on(animationEnd, function(event) {
12276			if ( event.originalEvent.animationName === cellAnim ) {
12277				$cell
12278					.css({
12279						'animation-name': '',
12280						'animation-duration': '',
12281						'animation-delay': '',
12282						'animation-timing-function': '',
12283						'animation-fill-mode': '',
12284					});
12285			}
12286		});
12287	};
12288
12289	var scrollHashes = function(){
12290		var hash = window.location.hash.replace('#', '').split('/'),
12291			hashInd;
12292		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
12293			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
12294				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
12295				$.fn.fullpage.moveTo(hashInd+1);
12296			}
12297		} else if( hash[0] === '' ) {
12298			$.fn.fullpage.moveTo(1);
12299		}
12300	};
12301
12302	var hideMenu = function( index, nextIndex ){
12303		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
12304			return false;
12305
12306		var hMenu = UNCODE.menuHeight,
12307			transTime = hMenu * 2;
12308
12309		if ( index === 1 && nextIndex > 1 ) {
12310			hMenu = hMenu * -1;
12311		} else if  ( index !== 1 && nextIndex === 1 ) {
12312			hMenu = 0;
12313		} else {
12314			return false;
12315		}
12316
12317		$masthead.css({
12318			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12319			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12320			'-webkit-transition': 'transform 0.5s ease-in-out',
12321			'transition': 'transform 0.5s ease-in-out'
12322		});
12323	};
12324
12325	var shrinkMenu = function( index, nextIndex ){
12326		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
12327			return false;
12328
12329		if ( index === 1 && nextIndex > 1 ) {
12330			$logo.addClass('shrinked');
12331			$('div', $logo).each(function(index, val){
12332				$(val).css({
12333					'height': logoMinScale,
12334					'line-height': logoMinScale
12335				});
12336				if ($(val).hasClass('text-logo')) {
12337					$(val).css({
12338						'font-size': logoMinScale + 'px'
12339					});
12340				}
12341			});
12342			requestTimeout(function() {
12343				UNCODE.menuMobileHeight = $masthead.outerHeight();
12344			}, 300);
12345		} else if ( index !== 1 && nextIndex === 1 ) {
12346			$logo.removeClass('shrinked');
12347			$('div', $logo).each(function(index, val){
12348				$(val).css({
12349					'height': logoMaxScale,
12350					'line-height': logoMaxScale
12351				});
12352				if ($(val).hasClass('text-logo')) {
12353					$(val).css({
12354						'font-size': logoMaxScale + 'px'
12355					});
12356				}
12357			});
12358			requestTimeout(function() {
12359				UNCODE.menuMobileHeight = $masthead.outerHeight();
12360			}, 300);
12361		} else {
12362			return false;
12363		}
12364
12365	};
12366
12367	var anchorLink = function(){
12368
12369		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
12370			var $this = $(e.currentTarget),
12371				hash = e.currentTarget.href.split('#'),
12372				current = window.location.href.split('#'),
12373				ind,
12374				currentMenuOpened = UNCODE.menuOpened,
12375				go = false;
12376
12377			var hash_url = hash[0].replace(/\/?$/, '/'),
12378				current_url = current[0].replace(/\/?$/, '/');
12379
12380			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
12381				hash = '#'+hash[1];
12382				e.preventDefault();
12383				go = true;
12384			}
12385
12386			if ( go ) {
12387
12388				if ( $(hash).length ) {
12389					ind = $(hash).closest('.fp-section').index();
12390				} else {
12391					hash = hash.slice(1);
12392					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
12393				}
12394
12395				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
12396					ind = $this.closest('.fp-section').index();
12397
12398				UNCODE.menuOpened = false;
12399
12400				$.fn.fullpage.moveTo(ind+1);
12401
12402				UNCODE.menuOpened = currentMenuOpened;
12403				if (UNCODE.menuOpened) {
12404					if (UNCODE.wwidth < UNCODE.mediaQuery) {
12405						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
12406					} else {
12407						$('.mmb-container-overlay .overlay-close').trigger('click');
12408						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
12409					}
12410				}
12411
12412			}
12413
12414		});
12415
12416		$('.header-scrolldown').on('click', function(event) {
12417			event.preventDefault();
12418			var scrollDown = $(this),
12419				ind = scrollDown.closest('.fp-section').index();
12420
12421			$.fn.fullpage.moveTo(ind+2);
12422		});
12423
12424		var anchor = $('.fp-section.active').data('anchor');
12425
12426		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
12427			$('.menu-item').removeClass('active');
12428			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12429		}
12430
12431	};
12432
12433	var slideLeave = function( index, nextIndex, direction ) {
12434		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12435			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12436			animationEnd = 'webkitAnimationEnd animationend',
12437			transitionEnd = 'webkitTransitionEnd transitionend',
12438			animOut = effect != 'scaleDown' ? effect + direction : effect,
12439			animIn,
12440			isFooter = false,
12441			isFooterNext = false,
12442			footerH = $footer.outerHeight(),
12443			timeout,
12444			player, iframe,
12445			footerCoeff;
12446		switch( direction ) {
12447			case 'up':
12448				animIn = 'moveFromTop';
12449				break;
12450			default:
12451				animIn = 'moveFromBottom';
12452		}
12453
12454		if ( $('body').hasClass('uncode-fullpage-trid') ) {
12455			animOut = animIn + 'trid';
12456			animIn = animOut + 'In';
12457		} else if ( UNCODE.isFullPageSnap ) {
12458			animIn = animOut = 'none';
12459		}
12460
12461		hideMenu(index, nextIndex);
12462		shrinkMenu(index, nextIndex);
12463
12464		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12465			if ($(this).attr('data-provider') == 'vimeo') {
12466				iframe = $(this).find('iframe');
12467				player = new Vimeo.Player(iframe[0]);
12468				player.pause();
12469			} else if ($(this).attr('data-provider') == 'youtube') {
12470				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12471			} else {
12472				if ($(this).is('video')) {
12473					$(this)[0].volume = 0;
12474					$(this)[0].pause();
12475				}
12476			}
12477		});
12478
12479		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
12480			if ($(this).attr('data-provider') == 'vimeo') {
12481				iframe = $(this).find('iframe');
12482				iframe.on('load', function(){
12483					player = new Vimeo.Player(iframe);
12484					player.setVolume(0);
12485					player.play();
12486				});
12487				player = new Vimeo.Player(iframe);
12488				player.setVolume(0);
12489				player.play();
12490			} else if ($(this).attr('data-provider') == 'youtube') {
12491				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
12492			} else {
12493				if ($(this).is('video')) {
12494					$(this)[0].volume = 0;
12495					$(this)[0].play();
12496				}
12497			}
12498		});
12499
12500		if ( $currentSlide.is($footer) )
12501			isFooter = true;
12502
12503		if ( $nextSlide.is($footer) )
12504			isFooterNext = true;
12505
12506		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12507			if ( $currentSlide.is($header) )
12508				$header.addClass('header-scrolled');
12509		}
12510
12511		footerCoeff = footerH;
12512
12513		if ( UNCODE.isFullPageSnap ) {
12514			postLeaveActions( nextIndex );
12515			activateBackWash( nextIndex );
12516			activateKBurns( nextIndex );
12517			requestTimeout(function(){
12518				animationEndAction( index, nextIndex );
12519			}, fp_anim_time+150);
12520		} else {
12521			if ( isFooterNext ) {
12522
12523				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
12524				$iscrollWrapper.addClass('no-scrolloverflow');
12525
12526				$nextSlide
12527				.add($currentSlide)
12528				.addClass('uncode-scroll-front')
12529				.addClass('uncode-scroll-active')
12530				.addClass('uncode-scroll-visible');
12531				$container.css({
12532					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12533					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12534					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12535					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12536				}).off(transitionEnd)
12537				.one(transitionEnd, function(){
12538					animationEndAction( index, nextIndex );
12539				});
12540
12541			} else if ( isFooter ) {
12542
12543				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
12544				.add($currentSlide)
12545				.addClass('uncode-scroll-front')
12546				.addClass('uncode-scroll-active')
12547				.addClass('uncode-scroll-visible');
12548				$container.css({
12549					'-webkit-transform': 'translate3d(0, 0, 0)',
12550					'transform': 'translate3d(0, 0, 0)',
12551					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12552					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12553				})
12554				.one(transitionEnd, function(){
12555					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
12556						clearRequestTimeout(timeout);
12557						timeout = requestTimeout(function(){
12558							$.fn.fullpage.moveTo(nextIndex);
12559							slideLeave( index-1, nextIndex, 'up' );
12560							$container.off(transitionEnd);
12561						}, 50);
12562					}
12563					animationEndAction( index, nextIndex );
12564				});
12565
12566			} else {
12567
12568				postLeaveActions( nextIndex );
12569
12570				if ( !$('body').hasClass('uncode-fullpage-trid') )
12571					activateParallax( nextIndex, direction );
12572
12573				var $outBg = $('.background-wrapper', $currentSlide);
12574
12575				$nextSlide
12576				.addClass('uncode-scroll-front')
12577				.addClass('uncode-scroll-active')
12578				.addClass('uncode-scroll-visible')
12579				.addClass('uncode-scroll-animating-in')
12580				.css({
12581					'z-index':4,
12582					'animation-name': animIn,
12583					'animation-duration': fp_anim_time + 'ms',
12584					'animation-delay': '',
12585					'animation-timing-function': fp_easing,
12586					'animation-fill-mode': 'both',
12587					'transition': 'initial',
12588				}).off(animationEnd)
12589				.on(animationEnd, function(event) {
12590					if ( event.originalEvent.animationName === animIn ) {
12591						$(this)
12592							.addClass('uncode-scroll-already')
12593							.removeClass('uncode-scroll-front')
12594							.removeClass('uncode-scroll-animating-in')
12595							.css({
12596								'animation-name': '',
12597								'animation-duration': '',
12598								'animation-delay': '',
12599								'animation-timing-function': '',
12600								'animation-fill-mode': '',
12601								'transition': 'initial',
12602							});
12603
12604						$currentSlide
12605							.removeClass('uncode-scroll-active')
12606							.add($outBg)
12607							.css({
12608								'animation-name': '',
12609								'animation-duration': '',
12610								'animation-delay': '',
12611								'animation-timing-function': '',
12612								'animation-fill-mode': '',
12613								'transition': 'initial',
12614							});
12615
12616						animationEndAction( index, nextIndex );
12617
12618					}
12619
12620					if ( nextIndex > 1 )
12621						$('body').addClass('window-scrolled');
12622					else
12623						$('body').removeClass('window-scrolled');
12624				});
12625
12626				$currentSlide
12627					.addClass('uncode-scroll-animating-out')
12628					.removeClass('uncode-scroll-front')
12629					.css({
12630						'z-index':'1',
12631						'animation-name': animOut,
12632						'animation-duration': fp_anim_time + 'ms',
12633						'animation-delay': '',
12634						'animation-timing-function': fp_easing,
12635						'animation-fill-mode': 'both',
12636						'transition': 'initial',
12637						'will-change': 'auto'
12638					}).off(animationEnd)
12639					.on(animationEnd, function(event) {
12640						if ( event.originalEvent.animationName === animOut ) {
12641							$currentSlide.removeClass('uncode-scroll-animating-out');
12642						}
12643					});
12644
12645				if ( $('body').hasClass('uncode-fp-opacity') ) {
12646					$currentSlide.find('> div').css({
12647						'animation-name': 'opacityout',
12648						'animation-duration': fp_anim_time + 'ms',
12649						'animation-delay': '',
12650						'animation-timing-function': fp_easing,
12651						'animation-fill-mode': 'both',
12652						'transition': 'initial',
12653					}).off(animationEnd)
12654					.on(animationEnd, function(event) {
12655						if ( event.originalEvent.animationName === 'opacityout' ) {
12656							$(event.currentTarget).css({
12657								'animation-name': '',
12658								'animation-duration': '',
12659								'animation-delay': '',
12660								'animation-timing-function': '',
12661								'animation-fill-mode': '',
12662								'transition': '',
12663							});
12664						}
12665					});
12666				}
12667			}
12668		}
12669
12670		$('.scroll-top').on('click', function(e){
12671			$.fn.fullpage.moveTo(1);
12672			return false;
12673		});
12674
12675	};
12676
12677	var init_fullPage = function(mode){
12678
12679		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
12680		// 	scrollBar = false;
12681		// }
12682
12683		var checkFPeffects;
12684
12685		$container.fullpage({
12686			sectionSelector: '.uncode-scroll-lock',
12687			scrollOverflow: true,
12688			scrollOverflowOptions: {
12689				click: false,
12690				preventDefaultException: { tagName:/.*/ }
12691			},
12692			normalScrollElements: ".masthead-vertical",
12693			navigation: false,
12694			scrollBar: scrollBar,
12695			scrollingSpeed: fp_anim_time,
12696			verticalCentered: true,
12697			anchors: no_history ? false : dataNames,
12698			recordHistory: !no_history,
12699			afterRender: function(){
12700				$('body').removeClass('fp-waiting');
12701				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
12702					var $invisible = $(this).addClass('hidden-scroll');//,
12703				});
12704				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
12705					var $visible = $(this).addClass('uncode-scroll-visible'),
12706						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
12707					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
12708				});
12709
12710				$('ul.onepage-pagination a').on('click', function(e){
12711					e.preventDefault();
12712					var $a = $(this),
12713						toIndex = $a.data('index');
12714
12715					$.fn.fullpage.moveTo(toIndex+1);
12716				});
12717
12718				requestTimeout(function(){
12719					scrollHashes();
12720				}, 1000);
12721
12722				$(window).on('hashchange', function(e){
12723					requestTimeout(function(){
12724						scrollHashes();
12725					}, 500);
12726				});
12727
12728				anchorLink();
12729
12730				if ( $('body').hasClass('uncode-fp-opacity') ) {
12731					$all.each(function(index, row) {
12732						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
12733							classBg;
12734
12735						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
12736							classBg = testmatch[0];
12737							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
12738						}
12739					});
12740				}
12741
12742				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
12743					$(window).on('menuOpen gdprOpen', function(){
12744						$.fn.fullpage.setAutoScrolling(false);
12745					}).on('menuClose gdprClose', function(){
12746						$.fn.fullpage.setAutoScrolling(true);
12747					});
12748				}
12749
12750				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
12751					requestTimeout(function(){
12752						$.fn.fullpage.setAutoScrolling(false);
12753					}, 1000);
12754				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
12755					$.fn.fullpage.setAutoScrolling(true);
12756				});
12757
12758				if ( !UNCODE.isFullPageSnap ) {
12759					clearRequestTimeout(checkFPeffects);
12760					checkFPeffects = requestTimeout(function(){
12761						activateBackWash( 1 );
12762						activateKBurns( 1 );
12763					}, 100);
12764				}
12765
12766			},
12767			onLeave: function( index, nextIndex, direction ){
12768
12769				if ( UNCODE.menuOpened || is_scrolling )
12770					return false;
12771
12772				is_scrolling = true;
12773
12774				var event = new CustomEvent('fp-slide-leave');
12775				window.dispatchEvent(event);
12776
12777				slideLeave( index, nextIndex, direction );
12778
12779				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
12780					if ( direction === 'up' ) {
12781						$.fn.fullpage.moveTo(nextIndex-1);
12782					} else {
12783						$.fn.fullpage.moveTo(nextIndex+1);
12784					}
12785					return false;
12786				}
12787
12788				$('ul.onepage-pagination a').removeClass('is-selected');
12789				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12790
12791			}
12792		});
12793	};
12794
12795	init_fullPage();
12796	$(window).on('load', function(){
12797		requestTimeout(function(){
12798			$.fn.fullpage.reBuild();
12799		}, 3000);
12800	});
12801
12802	var addScrollingClass,
12803		removeScrollingClass;
12804
12805	window.addEventListener("fp-slide-scroll", function(){
12806		addScrollingClass = requestTimeout( function(){
12807			$('body').addClass('fp-slide-scrolling');
12808		}, 10 );
12809
12810		clearRequestTimeout(removeScrollingClass);
12811		removeScrollingClass = requestTimeout( function(){
12812			$('body').removeClass('fp-slide-scrolling');
12813		}, 150 );
12814
12815		Waypoint.refreshAll();
12816	}, false);
12817
12818	var setFPheight = function(){
12819		var $body = document.body,
12820			$footer = document.getElementById('colophon'),
12821			$maincontainer = document.querySelector('.main-wrapper'),
12822			$boxcontainer = document.querySelector('.box-container'),
12823			$sections = document.querySelectorAll('.fp-section'),
12824			rect = $maincontainer.getBoundingClientRect(),
12825			rect2 = $boxcontainer.getBoundingClientRect(),
12826			$masthead = document.getElementById('masthead'),
12827			_hideMenu = false,
12828			menuHeight = UNCODE.menuHeight;
12829		$body.style.height = UNCODE.wheight + 'px';
12830
12831		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
12832			_hideMenu = true;
12833		}
12834		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
12835			menuHeight = 0
12836		}
12837
12838
12839		if ( theres_footer )
12840			$footer.style.top = (rect.height || rect2.height) + 'px';
12841
12842		for (var i = 0; i < $sections.length; i++) {
12843			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
12844		}
12845	};
12846
12847	setFPheight();
12848
12849	window.addEventListener('resize', setFPheight, false);
12850	window.addEventListener('orientationchange', setFPheight, false);
12851
12852};
12853
12854UNCODE.particles = function() {
12855	$(".vc-particles-background").each(function() {
12856		var $particle = $(this);
12857		var $parent = $particle.closest('[data-parent]');
12858
12859		$parent.prepend($particle);
12860		// $(window).trigger('resize');
12861	})
12862};
12863
12864
12865UNCODE.readMoreCol = function( $el ){
12866	if ( typeof $el === 'undefined' || $el === null ) {
12867		$el = $('body');
12868	}
12869	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
12870	$readMoreCols.each(function(){
12871		var $uncont = $(this),
12872			$row = $uncont.closest('.row-container'),
12873			max_h = $uncont.attr('data-ov-height'),
12874			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
12875			actual_max_h = $uncont.outerHeight(),
12876			inner_h,
12877			$read_more = $('+ .btn-more-wrap', $uncont),
12878			read_more_resize = $read_more.hasClass('trigger-resize'),
12879			marginClosedBtn = $uncont.attr('data-margin-closed'),
12880			marginClosed = 0,
12881			marginOpenBtn = $uncont.attr('data-margin-open'),
12882			marginOpen = 0,
12883			anim_t = 250,
12884			resized = false;
12885
12886		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
12887
12888		switch (marginClosedBtn) {
12889			case 'sm':
12890				marginClosed = 18
12891				break;
12892				
12893			case 'std':
12894				marginClosed = 36
12895				break;
12896				
12897			case 'lg':
12898				marginClosed = 72
12899				break;
12900				
12901			case '':
12902			default:
12903				marginClosed = 0
12904				break;
12905				
12906		}
12907
12908		switch (marginOpenBtn) {
12909			case 'sm':
12910				marginOpen = 18
12911				break;
12912				
12913			case 'std':
12914				marginOpen = 36
12915				break;
12916				
12917			case 'lg':
12918				marginOpen = 72
12919				break;
12920				
12921			case 'no':
12922				marginOpen = 0
12923				break;
12924				
12925		}
12926
12927		var checkToggleMobile = function(){
12928			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
12929				resized = true;
12930				if ( $read_more.hasClass('state-closed') ) {
12931					$uncont[0].style.height = '';
12932					$uncont[0].style.maxHeight = max_h_mobile;
12933				}
12934			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
12935				if ( $read_more.hasClass('state-closed') ) {
12936					$uncont[0].style.height = '';
12937					$uncont[0].style.maxHeight = max_h;
12938				}
12939				resized = false;
12940			}
12941		}
12942		checkToggleMobile();
12943		$(window).on('resize', function() {
12944			checkToggleMobile();
12945		});
12946
12947		$('a', $read_more).on('click', function(e){
12948			e.preventDefault();
12949
12950			var $a = $(this);
12951
12952			if ( $read_more.hasClass('state-closed') ) {
12953
12954				$read_more
12955					.removeClass('state-closed')
12956					.addClass('state-open');
12957
12958				$uncont.css({
12959					'max-height': 'none',
12960					'height': 'auto',
12961				});
12962	
12963				inner_h = parseFloat( $uncont.outerHeight() );
12964
12965				$uncont.css({
12966					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12967				});
12968		
12969				anim_t = inner_h - actual_max_h;
12970				if ( anim_t < 250 ) {
12971					anim_t = 250;
12972				} else if ( anim_t > 1000 ) {
12973					anim_t = 1000;
12974				}
12975
12976				$uncont.css({
12977					'transition-duration' : anim_t + 'ms'
12978				}).addClass('overflow-mask-animation').animate({
12979					'height': inner_h
12980				}, anim_t, 'easeInOutCubic', function(){
12981					$uncont.css({
12982						'height' : 'auto'
12983					}).removeClass('overflow-mask');
12984					if ( read_more_resize === true ) {
12985						window.dispatchEvent(new Event('resize'));
12986						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12987							ScrollTrigger.refresh(true);
12988						}
12989					}
12990				});
12991
12992				if ( marginOpen != '' ) {
12993					$read_more.animate({
12994						'margin-top' : marginOpen
12995					}, anim_t, 'easeInOutCubic');
12996				}
12997
12998			} else {
12999				$read_more
13000					.removeClass('state-open')
13001					.addClass('state-closed');
13002
13003				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
13004					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
13005				}, anim_t, 'easeInOutCubic', function(){
13006					if ( read_more_resize === true ) {
13007						window.dispatchEvent(new Event('resize'));
13008						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
13009							ScrollTrigger.refresh(true);
13010						}
13011					}
13012				});
13013
13014				if ( marginClosed !== '' ) {
13015					$read_more.animate({
13016						'margin-top' : marginClosed
13017					}, anim_t, 'easeInOutCubic');
13018				}
13019
13020				if ( $a.hasClass('toggle-scroll') ) {
13021                    var $masthead = $('#masthead > div:first-child'),
13022                        headH = $masthead.outerHeight(),
13023						rectTop = $row[0].getBoundingClientRect().top,
13024						checkNavBar = $a.hasClass('toggle-navbar'),
13025						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
13026                        offCont = ( $row.offset().top );
13027
13028					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13029						checkNavBar = checkNavBarMobile;
13030					}
13031
13032					if ( checkNavBar ) {
13033						offCont = offCont - headH;
13034					}
13035			
13036					if ( rectTop < headH ) {
13037						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
13038							$(this).stop();
13039						}).animate({
13040							scrollTop: offCont
13041						}, anim_t, 'easeInOutCubic');
13042					}
13043				}
13044
13045			}
13046		});
13047	});
13048}
13049UNCODE.filters = function() {
13050	var $systems = $('.isotope-system, .cssgrid-system');
13051
13052	$systems.each(function(index, val){
13053		var $system = $(this),
13054			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
13055			$widgets = $('.widgetized-cb-wrapper', $system),
13056			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
13057			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
13058			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
13059			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
13060
13061		if ($system.hasClass('isotope-processed')) {
13062			return;
13063		}
13064
13065		$cats_trigger.on('click', function(e) {
13066			if ( ! $('html').hasClass('screen-sm') ) {
13067				// $widgets.add($sorting_dd).slideUp(400);
13068				e.preventDefault();
13069				$widgets.slideUp(400, 'easeInOutCirc');
13070			}
13071		});
13072
13073		$('.filters-toggle-trigger', $system).on('click', function(e) {
13074			e.preventDefault();
13075			var $filters = $('.isotope-filters .menu-horizontal', $system);
13076			$filters.slideToggle(400, 'easeInOutCirc');
13077			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13078		});
13079
13080		$widget_trgr.on('click', function(e) {
13081			e.preventDefault();
13082			$widgets.slideToggle(400, 'easeInOutCirc');
13083			if (!$('html').hasClass('screen-sm')) {
13084				$cats_filters.slideUp(400, 'easeInOutCirc');
13085			}
13086			window.dispatchEvent(new CustomEvent('boxResized'));
13087		});
13088
13089		$sorting_trgr.on('click', function(e) {
13090			e.preventDefault();
13091			if (!$('html').hasClass('screen-sm')) {
13092				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13093			}
13094		});
13095
13096		$system.addClass('isotope-processed');
13097	});
13098
13099};
13100
13101UNCODE.widgets = function() {
13102	var widget_collapses = $('.widget-collapse');
13103
13104	widget_collapses.each(function(){
13105		var widget_collapse = $(this),
13106			widget_title = widget_collapse.find('.widget-title'),
13107			widget = widget_title.closest('.widget'),
13108			content = widget.children().not('.widget-title'),
13109			setCTA;
13110
13111		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13112			widget_title.toggleClass('open');
13113		}
13114
13115		widget_title.each(function() {
13116			var _this = $(this);
13117			var content = _this.closest('.widget').find('.widget-collapse-content');
13118
13119			$(window).on('load resize', function(){
13120				clearRequestTimeout(setCTA);
13121				setCTA = requestTimeout( function() {
13122					if ( content.is(':visible') ) {
13123						_this.addClass( 'open' );
13124					} else {
13125						_this.removeClass( 'open' );
13126					}
13127				}, 10 );
13128			})
13129
13130			_this.on( 'click', function(){
13131
13132				// Get content of :after element (+ icon) to check the visibility
13133				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
13134
13135				if (icon_content === 'none' || !icon_content) {
13136					return false;
13137				}
13138
13139				_this.toggleClass('open');
13140				var isOpen = _this.hasClass('open'),
13141					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
13142				content.animate({
13143					height: 'toggle',
13144					padding: 'toggle',
13145					opacity: 'toggle',
13146					top: isOpen ? 0 : hasBorder
13147				}, {
13148					duration: 400,
13149					easing: "easeInOutCirc",
13150				});
13151
13152				return false;
13153
13154			});
13155		});
13156	});
13157
13158	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
13159};
13160
13161UNCODE.unmodal = function() {
13162	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
13163		$('.unmodal-overlay').fadeIn();
13164		$('.unmodal-overlay').addClass('loading');
13165		$('body').addClass('uncode-unmodal-overlay-visible');
13166		$(window).trigger('unmodal-open');
13167	});
13168
13169	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
13170		$('.unmodal-overlay').fadeOut();
13171		$('.unmodal').fadeOut();
13172		$('body').removeClass('uncode-unmodal-overlay-visible');
13173		$('body').removeClass('uncode-unmodal-open');
13174		$('html').removeClass('uncode-unmodal-body-disable-scroll');
13175		$(document).trigger('unmodal-close');
13176		UNCODE.isUnmodalOpen = false;
13177	});
13178
13179	$(document).on('uncode-unmodal-show-content', function() {
13180		$('.unmodal-overlay').removeClass('loading');
13181		$('.unmodal').show();
13182		$('.unmodal').addClass('show-unmodal-with-animation');
13183		$('.unmodal-content')[0].scrollTop = 0;
13184		$('body').addClass('uncode-unmodal-open');
13185		UNCODE.isUnmodalOpen = true;
13186
13187		if ($('body').hasClass('qw-body-scroll-disabled')) {
13188			$('html').addClass('uncode-unmodal-body-disable-scroll');
13189		}
13190
13191		if ($('.unmodal').hasClass('auto-height')) {
13192			set_modal_height();
13193		}
13194	});
13195
13196	var set_modal_height = function() {
13197		var modal = $('.unmodal').css({height: 'auto'});
13198		var window_height = $(window).outerHeight();
13199		var modal_height = modal.outerHeight();
13200
13201		modal.css('height', 'auto');
13202
13203		if (modal_height > window_height) {
13204			modal.outerHeight(window_height);
13205		}
13206	}
13207
13208	if ($('.unmodal').hasClass('auto-height')) {
13209		var setCTA;
13210
13211		$(window).on('resize', function() {
13212			clearRequestTimeout(setCTA);
13213			setCTA = requestTimeout(function() {
13214				set_modal_height();
13215			}, 100);
13216		});
13217	}
13218};
13219
13220UNCODE.bgChanger = function() {
13221	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
13222		$bg_first = $('.vc_row[data-bg-remove]'),
13223		bg_remove = $bg_first.attr('data-bg-remove'),
13224		$first = $bg_changers.first(),
13225		$last = $bg_changers.last(),
13226		$bg_wrapper = $('#changer-back-color'),
13227		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
13228		setCTA, localH = UNCODE.wheight,
13229		isScrolling;
13230
13231	$bg_first.removeClass(bg_remove);
13232
13233	var bgChange = function($col, bgColor, skin, tmbskin){
13234		$bg_wrapper.attr( 'class', bgColor );
13235		var menuskin;
13236		if ( typeof skin !== 'undefined' ) {
13237			menuskin = skin.replace('style', 'menu')
13238		}
13239
13240		if ( $col.length ) {
13241			$('.uncol[data-skin-change]').each(function(){
13242				var $isoFooter = $('.isotope-footer', this);
13243				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
13244				if ( menuskin !== '' ) {
13245					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
13246				}
13247			});
13248
13249			$('.tmb[data-skin-change]').each(function(){
13250				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
13251			});
13252		}
13253	};
13254
13255	var $masthead = $('#masthead'),
13256		transDesktop,
13257		transMobile,
13258		changeSkin,
13259
13260	checkTransparencyAndChange = function( skin ){
13261		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
13262		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
13263		changeSkin = $masthead.hasClass('menu-change-skin');
13264
13265		if ( ! transDesktop && ! transMobile ) {
13266			return false;
13267		}
13268
13269		if ( ! changeSkin ) {
13270			return false;
13271		}
13272
13273		if ( skin === 'style-light' ){
13274			$masthead.removeClass('style-dark-override').addClass('style-light-override');
13275			return false;
13276		} else if ( skin === 'style-dark' ) {
13277			$masthead.removeClass('style-light-override').addClass('style-dark-override');
13278			return false;
13279		}
13280	};
13281
13282	var bg_waypoints = function(){
13283		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
13284
13285			$.each($bg_changers, function(index, row) {
13286
13287				var $row = $(row),
13288					$col = $('.uncol[data-skin-change]', $row).eq(0),
13289					skin,
13290					$tmbs,
13291					tmbskin,
13292					bgColor = $row.attr('data-bg-color');
13293
13294				if ( ! $row.is(':visible') ) {
13295					return false;
13296				}
13297
13298				if ( $col.length ) {
13299					skin = $col.attr('data-skin-change');
13300					$tmbs = $('.tmb[data-skin-change]', $row);
13301					tmbskin = skin.replace('style', 'tmb');
13302				}
13303
13304				if ( ! $row.hasClass('unscroll-horizontal') ) {
13305					$row.waypoint(function( dir ) {
13306						if ( dir === 'down' ) {
13307							bgChange($col, bgColor, skin, tmbskin);
13308							checkTransparencyAndChange(skin);
13309						} else {
13310							return;
13311						}
13312					}, {
13313						offset: '50%'
13314		  			});
13315
13316					$row.waypoint(function( dir ) {
13317						if ( dir === 'up' ) {
13318							bgChange($col, bgColor, skin, tmbskin);
13319							checkTransparencyAndChange(skin);
13320						} else {
13321							return;
13322						}
13323					}, {
13324						offset: function() {
13325							var clH = this.element.clientHeight,
13326								wH = window.innerHeight,
13327								ret = clH > 200 ? -100 : clH * -0.5;
13328							return ( wH / 2 ) - clH;
13329						}
13330					});
13331				}
13332
13333			});
13334
13335			$('body').addClass('bg-changer-init');
13336
13337		}
13338	};
13339
13340	var body = document.body,
13341	edges = false;
13342
13343	var throttle = function(fn, wait) {
13344		var time = Date.now();
13345		return function() {
13346			if ((time + wait - Date.now()) < 0) {
13347				fn();
13348				time = Date.now();
13349			}
13350		}
13351	}
13352
13353	var $wrapper = document.querySelector(".main-wrapper"),
13354		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
13355
13356	var $title = document.querySelector('#rotating');
13357	if ( $title !== null ) {
13358		$title.style.whiteSpace = 'nowrap';
13359		$title.style.transition = 'transform 200ms linear';
13360	}
13361
13362	window.addEventListener( 'scroll', throttle( function() {
13363		window.clearRequestTimeout( isScrolling );
13364
13365		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
13366
13367			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
13368				body = document.body,
13369				html = document.documentElement,
13370				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13371				$row = false,
13372				firstOff,
13373				lastOff;
13374
13375			if ( scrolled < 100 && $first.length ) {
13376				firstOff = $first.offset().top;
13377				if ( firstOff < 100 ) {
13378					var $row = $first;
13379				}
13380			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
13381				lastOff = $last.offset().top + $last.outerHeight();
13382				if ( lastOff > ( docH - 100 ) ) {
13383					var $row = $last;
13384				}
13385			}
13386
13387			if ( $row.length ) {
13388				var $col = $('.uncol[data-skin-change]', $row).eq(0),
13389					skin,
13390					$tmbs,
13391					tmbskin,
13392					bgColor = $row.attr('data-bg-color');
13393
13394				if ( $col.length ) {
13395					skin = $col.attr('data-skin-change');
13396					$tmbs = $('.tmb[data-skin-change]', $row);
13397					tmbskin = skin.replace('style', 'tmb');
13398				}
13399
13400				bgChange($col, bgColor, skin, tmbskin);
13401				checkTransparencyAndChange(skin);
13402				edges = true;
13403			}
13404
13405		}, 150);
13406
13407		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
13408			bg_waypoints();
13409			Waypoint.refreshAll();
13410			edges = false;
13411		}
13412
13413	}, 100), false);
13414
13415	$(window).on('resize', function() {
13416		clearRequestTimeout(setCTA);
13417		setCTA = requestTimeout(function() {
13418			if ( localH != UNCODE.wheight ) {
13419				localH = UNCODE.wheight;
13420				bg_waypoints();
13421				Waypoint.refreshAll();
13422			}
13423		}, 100);
13424	});
13425
13426	bg_waypoints();
13427
13428};
13429
13430UNCODE.skewIt = function() {
13431
13432	if ( $('body').hasClass('compose-mode') ) {
13433		return;
13434	}
13435
13436	var justscrolled = false;
13437
13438	var loadSkewIt = function(){
13439
13440		var $pageHeader = $('#page-header'),
13441			$page_body = $('.page-body'),
13442			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
13443
13444		if ( $header_skew.length ) {
13445			$pageHeader.addClass('uncode-skew').css({
13446				position: 'relative',
13447				zIndex: 1
13448			});
13449			$header_skew.removeClass('uncode-skew');
13450			$page_body.css({
13451				position: 'relative',
13452				zIndex: 0
13453			});
13454		}
13455
13456		var $skew = $('.uncode-skew'),
13457			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
13458			horizontal = $horizontal.length,
13459			stopSkewing,
13460			lastOffset = 0,
13461			lastDate = Date.now();
13462
13463		if ( ! $skew.length ) {
13464			return;
13465		}
13466
13467		var dropSkew = function(){
13468			if ( UNCODE.wwidth < UNCODE.mediaQuery )
13469				return;
13470
13471			$skew.each(function(){
13472				var $this = $(this),
13473					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13474
13475				if ( $drop.length ) {
13476					$this.css({
13477						'transform': 'skew(0)'
13478					});
13479					var bound = $this[0].getBoundingClientRect();
13480					$drop.css({
13481						left: bound.x * -1,
13482						top: bound.y * -1,
13483					});
13484				}
13485			});
13486		};
13487		dropSkew();
13488
13489		$(window).on('resize', dropSkew);
13490
13491		window.addEventListener( 'scroll', function() {
13492
13493			if ( justscrolled !== true ) {
13494				justscrolled = true;
13495				return;
13496			}
13497
13498			window.clearRequestTimeout( stopSkewing );
13499
13500			var now = Date.now(),
13501				delayInMs = now - lastDate,
13502				offset = window.pageYOffset || window.document.documentElement.scrollTop,
13503				newOffset = offset - lastOffset,
13504				speed = Math.pow((newOffset / delayInMs), 3) * -1,
13505				body = document.body,
13506				html = document.documentElement,
13507				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13508				wait = 50,
13509				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
13510
13511			if ((lastDate + wait - now) < 0) {
13512
13513				lastDate = now;
13514				lastOffset = offset;
13515
13516				if ( speed > 6 ) {
13517					speed = 6;
13518				} else if ( speed < -6 ) {
13519					speed = -6;
13520				}
13521
13522				if ( speed > 2 && offset < UNCODE.wheight ) {
13523					speed = 2;
13524				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
13525					speed = -2;
13526				}
13527
13528				var speedY = speed,
13529					speedX = speed * 1.25;
13530
13531				if ( horizontal ) {
13532					speedY = 0;
13533					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13534						speedX = 0;
13535						return;
13536					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13537						speedX = 0;
13538						return;
13539					}
13540				} else {
13541					speedX = 0;
13542				}
13543
13544				if ( ! $skew.closest('.enter-st').length ) {
13545					speedX = 0;
13546				}
13547
13548				gsap.killTweensOf($skew);
13549				gsap.to( $skew, {
13550					duration: 0.2,
13551					skewY: (speedY * maxSpeed) + "deg",
13552					skewX: (speedX * maxSpeed) + "deg",
13553					ease: Power0.easeNone,
13554					transformOrigin: 'center',
13555				});
13556
13557			}
13558
13559			stopSkewing = requestTimeout(function() {
13560				gsap.killTweensOf($skew);
13561				gsap.to( $skew, {
13562					duration: 0.5,
13563					skewY: "0deg",
13564					skewX: "0deg",
13565					transformOrigin: 'center',
13566					ease: Expo.easeOut,
13567				});
13568
13569				$skew.each(function(){
13570					var $this = $(this),
13571						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13572
13573					if ( $drop.length ) {
13574						var bound = $this[0].getBoundingClientRect()
13575						$drop.css({
13576							left: bound.x * -1,
13577							top: bound.y * -1,
13578						});
13579					}
13580				});
13581
13582			}, 200);
13583
13584		}, false);
13585
13586	};
13587
13588	$(window).on('load', loadSkewIt);
13589
13590};
13591
13592UNCODE.rotateIt = function() {
13593
13594	if ( $('body').hasClass('compose-mode') ) {
13595		return;
13596	}
13597
13598	var frameRotate = false;
13599	var loadRotateIt = function(){
13600
13601		var $toRotate = $('.uncode-rotate');
13602
13603		$toRotate.each(function(){
13604			var $rotate = $(this),
13605				deg = 0,
13606				dir = true,
13607				coeff = 1,
13608				lastOffset = 0,
13609				lastDate = Date.now();
13610
13611			var checkScroll = function($rotate){
13612				// if ( ! $rotate.length ) {
13613				// 	return;
13614				// }
13615
13616				var now = Date.now(),
13617					delayInMs = now - lastDate,
13618					offset = window.pageYOffset || window.document.documentElement.scrollTop,
13619					newOffset = offset - lastOffset,
13620					speed = (newOffset / delayInMs) * 5,
13621					body = document.body,
13622					html = document.documentElement,
13623					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
13624
13625				lastDate = now;
13626				lastOffset = offset;
13627
13628				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
13629					deg = 0;
13630				}
13631
13632				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
13633					deg = parseFloat(deg) + parseFloat(speed);
13634				}
13635
13636				if ( $rotate.hasClass('uncode-rotate-hover') ) {
13637					$rotate.hover(function(){
13638						coeff = 1.75;
13639					}, function(){
13640						coeff = 1;
13641					});
13642				}
13643
13644				// if ( speed > 0 ) {
13645				// 	dir = true
13646				// } else if ( speed < 0 ) {
13647				// 	dir = false
13648				// }
13649
13650				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
13651					deg = deg+coeff;
13652					// if ( dir ) {
13653					// 	deg = deg+coeff;
13654					// } else {
13655					// 	deg = deg-coeff;
13656					// }
13657				}
13658
13659				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13660					return false;
13661				}
13662				
13663				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
13664					var undeg = deg*-1;
13665					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
13666				} else {
13667					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
13668				}
13669
13670				requestAnimationFrame(function() {
13671					if ( frameRotate === true ) {
13672						frameRotate = false;
13673						return;
13674					}
13675					checkScroll($rotate);
13676				});
13677			};
13678
13679			checkScroll($rotate);
13680
13681		});
13682
13683	};
13684
13685	$(window).on('load', loadRotateIt);
13686
13687	var checkRotate;
13688	var resizeRotate = function(){
13689		var $inlineRotates = $('.inline-rotate');
13690		$inlineRotates.each(function(){
13691			$(this).addClass('inline-rotate-standby');
13692		});
13693		clearTimeout(checkRotate);
13694		checkRotate = setTimeout(function(){
13695			$('.inline-rotate').each(function(){
13696				$(this).removeClass('inline-rotate-standby');
13697				frameRotate = true;
13698			});
13699			loadRotateIt();
13700		}, 500);
13701	};
13702
13703	$(window).off('resize.inline-rotate', resizeRotate)
13704	.on('resize.inline-rotate', resizeRotate);
13705
13706};
13707
13708var marqueeCheckResize,
13709	initMarquee;
13710
13711UNCODE.textMarquee = function( $titles ) {
13712
13713	var isInitMarque = false;
13714	var lastMarqueeDocH = Math.round($(document).height());
13715
13716	var initTextMarquee = function( $titles ){
13717
13718		if ( typeof $titles == 'undefined' ) {
13719			$titles = $('.un-text-marquee');
13720		}
13721
13722		if ( ! $titles.length ) {
13723			return;
13724		}
13725
13726		isInitMarque = true;
13727
13728		var stableHeight = UNCODE.wheight;
13729
13730		$titles.each(function(){
13731			var $title = $(this),
13732				marqueeNS = '.textMarquee-' + Math.random().toString(36).slice(2),
13733				$span = $('> span, > i > span', $title),
13734				txt,
13735				first = true,
13736				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
13737				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
13738				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
13739				hasSticky = false,
13740				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
13741				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
13742				newW = UNCODE.wwidth,
13743				marqueeTL, inview,
13744				isInMenu = $title.closest('.megamenu-block-wrapper').length;
13745
13746
13747			var getStickyBound = function() {
13748				var $sticky = $title.closest('.sticky-trigger, .sticky-element');
13749
13750				if ( $sticky.length ) {
13751					var $pinSpacer = $sticky.closest('.pin-spacer');
13752					return $pinSpacer.length ? $pinSpacer : $sticky;
13753				}
13754
13755				var $pinSpacerOnly = $title.closest('.pin-spacer');
13756
13757				if ( $pinSpacerOnly.length ) {
13758					return $pinSpacerOnly;
13759				}
13760
13761				return $title.closest('.vc_row');
13762			};
13763
13764			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
13765				hasSticky = true;
13766				dataTrigger = 'row';
13767			}
13768
13769			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13770				dataNavBar = dataNavBarMobile;
13771			}
13772
13773			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
13774			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
13775			var dataX = dataSpeed;
13776
13777			dataSpeed += 5;
13778
13779			$('.marquee-clone-wrap', $title).remove();
13780
13781			txt = $span.html();
13782
13783			if ( ! $('.marquee-original-core', $span).length ) {
13784				txt = $span.html();
13785				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
13786			} else {
13787				txt = $('.marquee-original-core', $span).html();
13788			}
13789
13790			var spanW,
13791				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
13792				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
13793				speed = 10 - dataSpeed;
13794
13795			$span.prepend($prepended);
13796			$span.append($appended);
13797
13798			var continuousTextMarquee = function () {
13799				var bound = $title
13800						.css({
13801							transform: "none",
13802							opacity: 0,
13803						})
13804						.offset(),
13805					ease = "none";
13806
13807				var xStrt =
13808						first || $title.hasClass("un-marquee-infinite")
13809							? 0
13810							: UNCODE.wwidth - bound.left,
13811					xEnd = $title.hasClass("un-marquee-infinite")
13812						? spanW
13813						: spanW + bound.left,
13814					xSpeed =
13815						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
13816						dataSpeed,
13817					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
13818					speedSlow = (xEnd + xStrt) / 45,
13819					transFormVal,
13820					translX;
13821
13822				if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
13823					marqueeTL.kill();
13824				}
13825
13826				marqueeTL = new TimelineMax({ paused: true, reversed: true });
13827				marqueeTL.play();
13828
13829				var inViewElement =
13830						dataTrigger === "row" ? ( hasSticky ? getStickyBound()[0] : $title.closest(".vc_row")[0] ) : $title[0],
13831					wayOff =
13832						dataTrigger === "row" && dataNavBar === "yes"
13833							? UNCODE.menuHeight
13834							: 0;
13835
13836				if ( isInMenu ) {
13837					$(document).on('un-menu-show.marquee', function(e, $ul){
13838						marqueeTL.restart();
13839					});
13840					$(document).on('un-menu-hide.marquee', function(e, $ul){
13841						marqueeTL.pause();
13842					});
13843				} else {
13844					inview = new Waypoint.Inview({
13845						element: inViewElement,
13846						offset: wayOff,
13847						enter: function (direction) {
13848							marqueeTL.play();
13849						},
13850						exited: function (direction) {
13851							if (!$title.closest(".pin-spacer").length) {
13852								marqueeTL.pause();
13853							}
13854						},
13855					});
13856				}
13857
13858				if ($title.hasClass("un-marquee-hover")) {
13859					var $column = $title.closest(".wpb_column"),
13860						$col_link = $(".col-link", $column),
13861						$hover_sel = $title;
13862
13863					if ($col_link.length) {
13864						$hover_sel = $title.add($column);
13865					}
13866					$hover_sel
13867						.on("mouseover", function () {
13868							ease = "power2.out";
13869							transFormVal = $title.css("transform").split(/[()]/)[1];
13870							translX = transFormVal.split(",")[4];
13871							speedSlow = (xEnd + (xStrt - translX)) / 45;
13872							marqueeTL.duration(speedSlow);
13873						})
13874						.on("mouseout", function () {
13875							ease = "power2.in";
13876							transFormVal = $title.css("transform").split(/[()]/)[1];
13877							translX = transFormVal.split(",")[4];
13878							speedSlow =
13879								((xEnd + (xStrt - translX)) /
13880									(dataSpeed * dataSpeed * dataSpeed) /
13881									5) *
13882								dataSpeed;
13883							marqueeTL.duration(speedSlow);
13884						});
13885				}
13886		
13887				gsap.killTweensOf($title);
13888				marqueeTL.fromTo( $title, {
13889					opacity: 1,
13890					x: xStrt * direction * -1
13891				},
13892				{
13893					duration: xSpeed,
13894					x: xEnd * direction,
13895					onComplete: function(){
13896						first = false;
13897						if ( isInMenu ) {
13898							marqueeTL.restart();
13899						} else {
13900							continuousTextMarquee();
13901						}
13902					},
13903					onUpdate: function(){
13904						if ( ! $title[0].isConnected ) {
13905							marqueeTL.kill();
13906							initTextMarquee();
13907						}
13908					},
13909					ease: ease
13910				});
13911		
13912			};
13913			
13914			var runTextMarquee = function(){
13915				var $row = $title.closest('.vc_row');
13916				if ( hasSticky ) {
13917					$row = getStickyBound();
13918				}
13919				var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
13920
13921				if ( !$bound.length ) {
13922					return;
13923				}
13924
13925				if ( $title.data('marqueeScrollActive') ) {
13926					return;
13927				}
13928
13929				var boundEl = $bound[0],
13930					titleEl = $title[0],
13931					direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
13932					dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
13933
13934				$title.data('marqueeScrollActive', true);
13935
13936				var loop = function(){
13937					if ( ! titleEl.isConnected ) {
13938						$title.data('marqueeScrollActive', false);
13939						initTextMarquee();
13940						return;
13941					}
13942
13943					var bound = boundEl.getBoundingClientRect(),
13944						bound_top = bound.top,
13945						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
13946
13947					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
13948						if ( dataTrigger === 'row-middle' ) {
13949							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5);
13950						}
13951						if ( dataNavBar === 'yes' ) {
13952							bound_top = bound_top - UNCODE.menuHeight;
13953						}
13954						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
13955					}
13956
13957					titleEl.style.transform = 'translate3d(' + gsap_calc + 'px, 0, 0)';
13958
13959					requestAnimationFrame( loop );
13960				};
13961
13962				requestAnimationFrame( loop );
13963			};
13964
13965			var cloneSpan = function($_title, cntnt){
13966
13967				if ( $_title.hasClass('un-marquee-infinite') ) {
13968					$('> span.marquee-clone-wrap', $_title).text('');
13969				}
13970
13971				gsap.to( $_title, {
13972					duration: 0,
13973					x: 0
13974				});
13975
13976				spanW = $span.outerWidth();
13977
13978
13979				if ( !spanW ) {
13980					return;
13981				}
13982
13983				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
13984					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
13985
13986				if ( $_title.hasClass('un-marquee-infinite') ) {
13987
13988					for ( var i = 0; i < part; i++ ) {
13989						$prepended.append(cntnt + spaceSpan);
13990						$appended.append(cntnt + spaceSpan);
13991					}
13992				}
13993
13994				if ( $('body').hasClass('compose-mode') ) {
13995					$('.uncode_fe_safe').remove();
13996					return;
13997				}
13998
13999				if ( $title.closest('.marquee-freezed').length ) {
14000					return;
14001				}
14002
14003				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
14004					continuousTextMarquee();
14005				}
14006
14007				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
14008					runTextMarquee();
14009				}
14010
14011			};
14012
14013			var marqueeResize = function(e){
14014				if ( isInMenu ) {
14015					return;
14016				}
14017				var tOut = 1000;
14018				if ( isInMenu ) {
14019						gsap.killTweensOf($title);
14020						if ( typeof inview !== 'undefined' && inview !== null ) {
14021							inview.destroy();
14022						}
14023						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14024							marqueeTL.kill();
14025						}
14026						first = true;
14027						$(window).off(marqueeNS);
14028						$(document).off(marqueeNS);
14029						initTextMarquee();
14030				} else {
14031					clearRequestTimeout(marqueeCheckResize);
14032					marqueeCheckResize = requestTimeout(function(){
14033						if ( newW !== UNCODE.wwidth ) {
14034							gsap.killTweensOf($title);
14035							if ( typeof inview !== 'undefined' && inview !== null ) {
14036								inview.destroy();
14037							}
14038							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14039								marqueeTL.kill();
14040							}
14041							first = true;
14042							$(window).off(marqueeNS);
14043							$(document).off(marqueeNS);
14044							initTextMarquee();
14045							newW = UNCODE.wwidth;
14046						}
14047					}, tOut);
14048				}
14049			};
14050
14051			$(window).off('resize', marqueeResize)
14052			.on( 'resize', marqueeResize);
14053			$(window).off('uncode.re-layout', marqueeResize)
14054			.on( 'uncode.re-layout', marqueeResize);
14055
14056			cloneSpan($title, txt);
14057
14058			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14059				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
14060					var $_titles = $('.un-text-marquee',e.view.$el);
14061					clearRequestTimeout(marqueeCheckResize);
14062					marqueeCheckResize = requestTimeout(function(){
14063						initTextMarquee($_titles);
14064					}, 1000);
14065				});
14066			}
14067		});
14068
14069		$(window).on( 'load wwResize', function(e) {
14070			stableHeight = UNCODE.wheight;
14071		});
14072
14073	};
14074
14075	document.addEventListener("DOMContentLoaded", function() {
14076		if ( isInitMarque !== true ) {
14077			initTextMarquee();
14078		}
14079	});
14080
14081	if ( document.fonts && document.fonts.ready && typeof document.fonts.ready.then === 'function' ) {
14082		document.fonts.ready.then(function(){
14083			initTextMarquee();
14084		});
14085	}
14086
14087	$(window).on('focus load resize',function(){
14088		clearTimeout(initMarquee);
14089		initMarquee = setTimeout(function(){
14090			if ( isInitMarque !== true ) {
14091				initTextMarquee();
14092			}
14093		}, 500);
14094	});
14095	
14096	$(document).on('pumAfterOpen pumAfterClose', function(args){
14097		initTextMarquee();
14098	});
14099
14100	$(document).on('uncode-scrolltrigger-refresh', function(args){
14101		var nextDocH = Math.round($(document).height());
14102
14103		if ( Math.abs(nextDocH - lastMarqueeDocH) <= 2 ) {
14104			return;
14105		}
14106
14107		lastMarqueeDocH = nextDocH;
14108
14109		clearRequestTimeout(marqueeCheckResize);
14110
14111		marqueeCheckResize = requestTimeout(function(){
14112			initTextMarquee();
14113		}, 250);
14114	});
14115};
14116UNCODE.parallax = function() {
14117	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
14118		if ($('.parallax-el').length > 0) {
14119			var parallax_elements = new Rellax('.parallax-el');
14120			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
14121			window.addEventListener('boxResized', function(e) {
14122				parallax_elements.refresh();
14123			}, false);
14124			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
14125				requestTimeout(function() {
14126					parallax_elements.refresh();
14127				}, 100);
14128			});
14129
14130			if ( typeof UNCODE.hDoc === 'undefined' ) {
14131				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14132					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14133			}
14134		
14135			function paralraf(time) {
14136				requestAnimationFrame(paralraf)
14137		
14138				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14139					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14140				
14141				if ( UNCODE.hDoc !== newHdoc ) {
14142					UNCODE.hDoc = newHdoc;
14143					parallax_elements.refresh();
14144				}
14145			}
14146		
14147			requestAnimationFrame(paralraf)
14148		
14149		}
14150	}
14151};
14152
14153UNCODE.magicCursor = function(){
14154	var $customCursor = $('#uncode-custom-cursor'),
14155		$customPilot = $('#uncode-custom-cursor-pilot'),
14156		$tooltip = $('.title-tooltip', $customCursor),
14157		$cursorSpan = $('> span', $tooltip),
14158		currentBg = false,
14159		fromTitle = false,
14160		setTime,
14161		mouseEvent;
14162
14163		var spanW, spanH,
14164		maxW = false;
14165
14166	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
14167		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
14168			$tooltip.css({opacity: 0});
14169			delayt_time += 400;
14170		}
14171		clearRequestTimeout(setTime);
14172		setTime = requestTimeout(function() {
14173
14174			$tooltip.css({opacity: ''});
14175
14176			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
14177
14178			if ( cursorTitle !== '' ) {
14179				if ( fromTitle && dataTitle === 'boing' ) {
14180					setTimeout(function(){
14181						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
14182					}, 5);
14183				}
14184				$cursorSpan.attr('class', fontClass).html( cursorTitle );
14185			} else {
14186				if ( cursorType !== 'auto' ) {
14187					$cursorSpan.html('');
14188				}
14189			}
14190
14191			$cursorSpan.addClass('in-tooltip');
14192
14193			$customCursor.attr('data-cursor', cursorType);
14194
14195			if ( fromTitle ) {
14196				$customCursor.addClass('from-tooltip-title');
14197			} else {
14198				$customCursor.removeClass('from-tooltip-title');
14199			}
14200
14201			if ( cursorBg !== false ) {
14202				$customCursor.attr('data-bg', 'transparent');
14203			} else {
14204				$customCursor.removeAttr('data-bg');
14205			}
14206
14207			currentBg = cursorBg;
14208
14209			if ( cursorTitle !== '' ) {
14210				fromTitle = true;
14211				$customCursor.attr('data-cursor', cursorType);
14212				$customCursor.attr('data-title', 'true');
14213				$cursorSpan.css({width: ''});
14214			} else {
14215				fromTitle = false;
14216				$customCursor.removeAttr('data-title');
14217			}
14218			spanW = $cursorSpan.outerWidth();
14219			
14220			if ( spanW >= maxW && maxW !== false ) {
14221				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
14222				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
14223					width: maxW
14224				});
14225				spanW = maxW;
14226			} else {
14227				$customCursor.find('> span:first-child').removeClass('max-width');
14228			}
14229			spanH = $cursorSpan.outerHeight();
14230			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
14231				$customCursor.find('> span:first-child').add($tooltip).css({
14232					width: spanW,
14233					height: spanH
14234				});
14235			} else {
14236				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
14237			}
14238			if ( $customPilot.length ) {
14239				$customPilot.attr('data-cursor', cursorType);
14240			}
14241		}, delayt_time);
14242	}
14243
14244	function changeCursor($wrap){
14245		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14246		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
14247			$href = $wrap.find(href),
14248			cursorType,
14249			cursorTitle = '',
14250			tooltip_class = '',
14251			cursorBg = false;
14252
14253		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
14254			var $this = $(this).addClass("cursor-init"),
14255				$tmb = $this.closest('.tmb'),
14256				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
14257				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
14258				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
14259				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
14260				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
14261				$title = $('.t-entry-title', $tmb),
14262				is_frontend_editor = $this.closest('.vc_controls').length,
14263				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
14264				$parent_cursor = $this.closest('[class*="custom-cursor"]');
14265
14266			if ( is_frontend_editor ) {
14267				cursorType = 'auto';
14268			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
14269				cursorType = data_cursor;
14270			} else if ( $parent_cursor.length ) {
14271				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
14272					cursorType = 'icon-light';
14273				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
14274					cursorType = 'icon-diff';
14275				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
14276					cursorType = 'icon-accent';
14277				} else {
14278					cursorType = 'icon-dark';
14279				}
14280			} else {
14281				cursorType = 'pointer';
14282			}
14283
14284			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
14285				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
14286					cursorTitle = custom_text;
14287				} else {
14288					cursorTitle = $title.clone();
14289					$('a', cursorTitle).replaceWith(function() {
14290						return this.childNodes;
14291					});
14292					$('*', cursorTitle).replaceWith(function(){
14293						return $(this).removeAttr('class');
14294					});
14295					cursorTitle = cursorTitle.html();
14296				}
14297			} else {
14298				cursorTitle = '';
14299			}
14300
14301			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
14302				tooltip_class = data_class;
14303			} else {
14304				tooltip_class = '';
14305			}
14306
14307			if ( cursor_bg == 'true' ) {
14308				cursorBg = true;
14309			} else {
14310				cursorBg = false;
14311			}
14312
14313			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
14314		}).on("mouseleave.cursor", href, function(e) {
14315			var outTime = 150;
14316			if ( currentBg !== false && cursorBg === false ) {
14317				outTime = 0;
14318			}
14319			delayChangeCursor('auto', '', false, outTime, false, '');
14320		});
14321
14322		$(window).on('disable-hover', function(event) {
14323			document.addEventListener("mousemove", function(e) {
14324				mouseEvent = e;
14325			});
14326			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
14327		});
14328
14329		$(window).on('enable-hover', function(event) {
14330			if ( typeof mouseEvent !== 'undefined' ) {
14331				var x = mouseEvent.clientX,
14332					y = mouseEvent.clientY;
14333
14334				var elements = document.elementsFromPoint(x, y),
14335					$element = $(elements[0]);
14336
14337				$element.closest(href).trigger('mouseenter');
14338			}
14339		});
14340
14341	}
14342
14343	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14344		changeCursor();
14345	});
14346
14347	$(document).ajaxComplete(function( event, xhr, settings ) {
14348		changeCursor();
14349	});
14350
14351	$('.isotope-container').on('isotope-layout-complete', function() {
14352		var $this = $(this);
14353		changeCursor($this);
14354	});
14355
14356};
14357
14358UNCODE.magneticCursor = function(){
14359	function magneticCursor($wrap){
14360		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14361		var $magnetics = $wrap.find('.tmb-image-anim-magnetic .t-entry-visual').has('img:not(.avatar), .t-background-cover, .dummy.secondary-dummy-image, .t-secondary-background-cover').add($('.magnetic').has('.background-inner, .header-bg'));
14362
14363		$magnetics.on('mousemove', function(e){
14364			var $this = $(this),
14365				$el,
14366				bound = e.currentTarget.getBoundingClientRect(),
14367				coeff = 30,
14368				hor = (bound.width / 2) - (e.clientX - bound.left),
14369				ver = (bound.height / 2) - (e.clientY - bound.top),
14370				toX = hor / bound.width * coeff,
14371				toY = ver / bound.height * coeff,
14372				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
14373				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
14374				toScale = Math.max(scaleX, scaleY);
14375
14376			if ( $this.hasClass('magnetic') ) {
14377				$el = $('.background-inner, .header-bg', $this);
14378			} else {
14379				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14380			}
14381
14382			gsap.killTweensOf($el);
14383			gsap.to( $el, {
14384				duration: 0.75,
14385				x: toX,
14386				y: toY,
14387				scale: toScale,
14388				ease: Power1.easeOut,
14389				transformPerspective: 900,
14390				transformOrigin: 'center',
14391				force3D: true
14392			});
14393		}).on('mouseout', function(e){
14394			var $this = $(this),
14395				$el
14396			if ( $this.hasClass('magnetic') ) {
14397				$el = $('.background-inner, .header-bg', $this);
14398			} else {
14399				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14400			}
14401			gsap.killTweensOf($el);
14402			gsap.to( $el, {
14403				duration: 0.6,
14404				y: 0,
14405				x: 0,
14406				scale: 1,
14407				ease: Power1.easeOut,
14408				transformPerspective: 900,
14409				transformOrigin: 'center',
14410				force3D: true
14411			});
14412		});
14413	};
14414
14415	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14416		magneticCursor();
14417	});
14418
14419	$(document).ajaxComplete(function( event, xhr, settings ) {
14420		magneticCursor();
14421	});
14422
14423	$('.isotope-container').on('isotope-layout-complete', function() {
14424		var $this = $(this);
14425		magneticCursor($this);
14426	});
14427
14428};
14429
14430UNCODE.dropImage = function() {
14431
14432	/****************************
14433	 * Image hover *
14434	****************************/
14435	function imageHover(){
14436		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14437			return;
14438		}
14439
14440		var $postLists = $('.uncode-post-titles');
14441		$postLists.each(function(){
14442			var $list = $(this),
14443				timing = parseFloat( $list.attr('data-timing') ),
14444				default_image = $list.hasClass('uncode-post-titles-default-image'),
14445				default_title = $list.hasClass('uncode-post-titles-default-title'),
14446				$tmbs = $('.tmb', $list),
14447				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
14448				clientX,
14449				clientY,
14450				$row_parent = $list.closest('.vc_row'),
14451				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
14452				$col_parent = $list.closest('.uncell'),
14453				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
14454				stoppedScrolling = true,
14455				setCTA;
14456
14457			timing *= 0.001;
14458
14459			var drop_bgs = function(){
14460				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
14461					var $drop = $(this),
14462						srcset = $drop.attr('data-bgset'),
14463						setArr = srcset.split(","),
14464						setArrOrder = [],
14465						biggest = 0,
14466						checkBg = false,
14467						desktopBG = $drop.data('[data-background-image]'),
14468						mobileBG = $drop.data('[data-mobile-background-image]');
14469
14470					if ( $drop.hasClass('srcset-bg-async') ) {
14471
14472						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
14473							return;
14474						}
14475						
14476					}
14477
14478					if ( SiteParameters.uncode_adaptive == true ) {
14479						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
14480							$drop.css({
14481								'background-image' : 'url(' + setArr[0] + ')'
14482							});
14483						}
14484					} else {
14485						for ( var i = 0; i < setArr.length; i++ ) {
14486							var setLoop = setArr[i].trim().split(" ");
14487							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
14488								var parseSet = parseFloat(setLoop[1]);
14489								if ( biggest < parseSet ) {
14490									biggest = parseSet;
14491								}
14492								setArrOrder[parseSet] = setLoop[0];
14493								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
14494									checkBg = true;
14495									$drop.css({
14496										'background-image' : 'url(' + setLoop[0] + ')'
14497									});
14498								}
14499							}
14500						}
14501
14502						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
14503							$drop.css({
14504								'background-image' : 'url(' + setArrOrder[biggest] + ')'
14505							});
14506						}
14507					}
14508
14509				});
14510			};
14511
14512			drop_bgs();
14513
14514			var dropMovesSize = function(){
14515				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
14516					return;
14517				}
14518				$drop_moves.each(function(){
14519					var $drop_move = $(this),
14520						dataW = $drop_move.attr('data-w'),
14521						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
14522					if ( typeof dataW !== 'undefined' && dataW !== null ) {
14523						dataW = screenInfo.width / 12 * parseFloat( dataW );
14524					}
14525					$drop_moves.css({
14526						width: dataW
14527					});
14528
14529					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14530						$anim_parent.on('animationend', function(){
14531							var bound = $anim_parent[0].getBoundingClientRect();
14532							$drop_move.css({
14533								left: bound.x * -1,
14534								top: bound.y * -1,
14535							});
14536						});
14537					}
14538				});
14539
14540
14541			};
14542
14543			dropMovesSize();
14544
14545			$(window).on( 'resize', function(){
14546				clearRequestTimeout(setCTA);
14547				setCTA = requestTimeout( function() {
14548					drop_bgs();
14549					dropMovesSize();
14550				}, 100 );
14551			});
14552
14553			if ( $drop_row_parents.length ) {
14554				$row_parent.addClass( 'drop-added' );
14555			}
14556
14557			$drop_row_parents.each(function(index, val){
14558				var $drop = $(val);
14559				$row_parent.prepend($drop);
14560				manageVideos($drop, false);
14561				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14562					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14563				}
14564				if ( default_image && index == 0 ) {
14565					manageVideos($drop, true);
14566					var bgStyle = $drop.css('background-image');
14567					var match = bgStyle && bgStyle.match(/url\(["']?([^"')]+)["']?\)/);
14568					var bg_img = match ? match[1] : null;
14569					var image_ph = new Image();
14570
14571					if (bg_img) {
14572						image_ph.onload = function() {
14573							$drop.addClass('active');
14574							if (default_title) {
14575								$list.addClass('drop-hover');
14576								$tmbs.first().addClass('drop-active');
14577							}
14578						};
14579						image_ph.src = bg_img;
14580					}
14581					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14582						image_ph.onload = function() {
14583							$drop.addClass('active');
14584							if ( default_title ) {
14585								$list.addClass('drop-hover');
14586								$tmbs.first().addClass('drop-active');
14587							}
14588						};
14589						image_ph.src = bg_img;
14590					}
14591				}
14592			});
14593
14594			if ( $drop_col_parents.length ) {
14595				$col_parent.addClass( 'drop-added' );
14596			}
14597
14598			$drop_col_parents.each(function(index, val){
14599				var $drop = $(this);
14600				$col_parent.prepend($drop);
14601				manageVideos($drop, false);
14602				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14603					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14604				}
14605				if ( default_image && index == 0 ) {
14606					manageVideos($drop, true);
14607					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
14608						image_ph = new Image();
14609					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14610						image_ph.onload = function() {
14611							$drop.addClass('active');
14612							if ( default_title ) {
14613								$list.addClass('drop-hover');
14614								$tmbs.first().addClass('drop-active');
14615							}
14616						};
14617						image_ph.src = bg_img;
14618					}
14619				}
14620			});
14621
14622			function manageVideos( $el, start ) {
14623				var videoElem = $('video', $el),
14624					$iframe = $('iframe', $el),
14625					iframeID = $iframe.attr('id');
14626				if ( videoElem.length ) {
14627					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
14628						if ( start ) {
14629							videoElem[0].setCurrentTime(0);
14630							videoElem[0].play();
14631						} else {
14632							videoElem[0].pause();
14633							videoElem[0].setCurrentTime(0);
14634						}
14635					} else {
14636						if ( start ) {
14637							videoElem[0].currentTime = 0;
14638							videoElem[0].play();
14639						} else {
14640							videoElem[0].pause();
14641							videoElem[0].currentTime = 0;
14642						}
14643					}
14644				}
14645
14646				$el.data('active', start);
14647
14648				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
14649					var iframeIDv = iframeID.replace('okplayer-', ''),
14650						optionsV = $(window).data('okoptions-' + iframeIDv),
14651						vimeo = $iframe[0],
14652						playerV = new Vimeo.Player(vimeo),
14653						timeV = 0;
14654
14655					if (optionsV.time != null) {
14656						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
14657						for ( var i = 0; i < timeArr.length; i++ ) {
14658							if ( timeArr[i] === 'h' ) {
14659								timeV += parseFloat(timeArr[i-1]) * 3600;
14660							} else if ( timeArr[i] === 'm' ) {
14661								timeV += parseFloat(timeArr[i-1]) * 60;
14662							} else if ( timeArr[i] === 's' ) {
14663								timeV += parseFloat(timeArr[i-1]);
14664							}
14665						}
14666					}
14667					playerV.setCurrentTime(timeV);
14668					if ( start ) {
14669						playerV.setVolume(0);
14670						playerV.play();
14671					} else {
14672						playerV.pause();
14673					}
14674				} else if ( $el.attr('data-provider') === 'youtube' ) {
14675					if ( start ) {
14676						$el.trigger('uncode-resume');
14677					} else {
14678						$el.trigger('uncode-pause');
14679					}
14680				}
14681
14682			}
14683
14684			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
14685
14686				document.addEventListener("mousemove", function(e) {
14687					$drop_moves.each(function(){
14688						var $drop_move = $(this),
14689							duration = 0.4;
14690
14691						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
14692							duration = 0.8;
14693						}
14694
14695						clientX = e.clientX;
14696						clientY = e.clientY;
14697
14698						gsap.to( $drop_move, {
14699							duration: duration,
14700							x: clientX,
14701							y: clientY,
14702							ease: Power1.easeOut,
14703						});
14704					});
14705				});
14706
14707			} else {
14708
14709				$(window).on("touchend scroll", function(e) {
14710					$list.removeClass('drop-hover');
14711					$drop_moves.removeClass('active');
14712					$tmbs.removeClass('drop-active');
14713				});
14714
14715				$drop_moves.each(function(){
14716					var $drop_move = $(this),
14717						$tmb = $drop_move.closest('.tmb'),
14718						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
14719
14720					if ( $anim_parent.hasClass('uncode-skew') ) {
14721						$anim_parent.css({
14722							'transform': 'skew(0)'
14723						});
14724					}
14725
14726					$tmb.on('touchend', function(e){
14727						e.stopPropagation();
14728
14729						$drop_moves.removeClass('active');
14730						$tmbs.removeClass('drop-active');
14731
14732						$list.addClass('drop-hover');
14733						$tmb.addClass('drop-active');
14734						$drop_move.addClass('active');
14735						manageVideos($drop_move, true);
14736						clientX = e.changedTouches[0].clientX;
14737						clientY = e.changedTouches[0].clientY;
14738
14739						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14740							var bound = $anim_parent[0].getBoundingClientRect();
14741							clientX = clientX - bound.x;
14742							clientY = clientY - bound.y;
14743						}
14744
14745						$drop_move.css({
14746							left: clientX,
14747							top: clientY
14748						});
14749					});
14750				});
14751
14752			}
14753
14754			$tmbs.each(function(e){
14755				var $tmb = $(this),
14756					// $trgr = $('a', $tmb),
14757					$trgr = $tmb,
14758					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
14759					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
14759(.t-inside), .parallax-el'),
14760					$video = $('video', $tmb),
14761					$iframe = $('iframe', $tmb),
14762					$entryTxt = $('.t-entry-text', $tmb),
14763					stopBounding;
14764
14765				$entryTxt.add($drop_move).css({
14766					'transition-duration': timing + 's'
14767				});
14768
14769				if ( $video.length ) {
14770					var vidH = $video[0].videoHeight,
14771						vidW = $video[0].videoWidth;
14772					$video.css({
14773						'height': vidH,
14774						'width': vidW
14775					});
14776				}
14777
14778				if ( $iframe.length ) {
14779					var vidH = $drop_move.attr('data-height'),
14780						vidW = $drop_move.attr('data-width');
14781					$iframe.css({
14782						'height': vidH,
14783						'width': vidW
14784					});
14785				}
14786
14787				$iframe.each(function(){
14788					var $video = $(this),
14789						vidH = $video[0].videoHeight,
14790						vidW = $video[0].videoWidth;
14791					$video.css({
14792						'height': vidH,
14793						'width': vidW
14794					});
14795				});
14796
14797				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
14798					$trgr.on('mouseenter',function(e){
14799
14800						$list.addClass('drop-hover');
14801						$tmbs.removeClass('drop-active');
14802						$tmb.addClass('drop-active');
14803						$drop_move.addClass('active');
14804						manageVideos($drop_move, true);
14805
14806						var clientX = e.clientX,
14807							clientY = e.clientY;
14808						$drop_move.css({
14809							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
14810						});
14811
14812					})
14813					.on('mouseleave', function(e){
14814						$list.removeClass('drop-hover');
14815						$drop_move.css({
14816							'transition-duration': ( timing*1.25 ) + 's'
14817						});
14818						$drop_move.removeClass('active');
14819						$tmb.removeClass('drop-active');
14820						$drop_move.on('transitionend', function(e){
14821							$drop_move.off('transitionend');
14822							$drop_move.css({
14823								'transition-duration': timing + 's'
14824							});
14825							manageVideos($drop_move,false);
14826						});
14827					});
14828
14829					document.addEventListener('visibilitychange', function(){
14830						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
14831							$drop_move.css({
14832								'transition-duration': '0s'
14833							});
14834							$drop_move.removeClass('active');
14835							manageVideos($drop_move, false);
14836						}
14837					});
14838
14839					document.addEventListener('scroll', function(){
14840						window.clearRequestTimeout( stopBounding );
14841						if ( stoppedScrolling ) {
14842							stoppedScrolling = false;
14843							if ( $drop_move.hasClass('active') ) {
14844								$list.removeClass('drop-hover');
14845								$tmbs.removeClass('drop-active');
14846								$drop_move.removeClass('active');
14847								$drop_move.on('transitionend', function(e){
14848									$drop_move.off('transitionend');
14849									$drop_move.css({
14850										'transition-duration': timing + 's'
14851									});
14852									manageVideos($drop_move,false);
14853								});
14854							}
14855						}
14856
14857						stopBounding = requestTimeout(function() {
14858							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14859								var bound = $anim_parent[0].getBoundingClientRect();
14860								$drop_move.css({
14861									left: bound.x * -1,
14862									top: bound.y * -1,
14863								});
14864							}
14865							stoppedScrolling = true;
14866						}, 500);
14867					});
14868				}
14869
14870				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
14871					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
14872
14873				$drop.css({
14874					'transition-duration': timing + 's'
14875				});
14876
14877				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
14878					$trgr.on('mouseenter',function(e){
14879						$row_parent.add($col_parent).addClass('drop-list-loaded');
14880						$list.addClass('drop-hover');
14881
14882						if ( !$tmb.hasClass('drop-active') ) {
14883							$tmbs.removeClass('drop-active');
14884							$tmb.addClass('drop-active');
14885							if ( default_image && !$drop.hasClass('active') ) {
14886								var $prev = $('[data-drop].active', $row_parent);
14887								$prev.css({
14888									'transition-duration': (timing*1.5) + 's'
14889								});
14890								$prev.removeClass('active');
14891								$prev.on('transitionend', function(e){
14892									$prev.off('transitionend');
14893									manageVideos($prev,false);
14894								});
14895							}
14896							$drop.css({
14897								'transition-duration': timing + 's'
14898							});
14899							$drop.off('transitionend');
14900							$drop.addClass('active');
14901							manageVideos($drop, true);
14902						}
14903					})
14904					.on('mouseleave', function(e){
14905						if ( ( default_image && !default_title ) || !default_image ) {
14906							$list.removeClass('drop-hover');
14907							$tmb.removeClass('drop-active');
14908						}
14909						if ( ! default_image ) {
14910							$drop.css({
14911								'transition-duration': (timing*1.5) + 's'
14912							});
14913							$drop.removeClass('active');
14914
14915							$drop.on('transitionend', function(e){
14916								$drop.off('transitionend');
14917								manageVideos($drop,false);
14918							});
14919						}
14920					});
14921
14922					document.addEventListener('visibilitychange', function(){
14923						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
14924							$drop.css({
14925								'transition-duration': '0s'
14926							});
14927							$drop.removeClass('active');
14928							manageVideos($drop, false);
14929						}
14930					});
14931				}
14932			});
14933
14934		});
14935	};
14936
14937	$(window).on('load', function(event) {
14938		imageHover();
14939	});
14940
14941	var drop_wp_animation = function() {
14942		var $postLists = $('.uncode-post-titles');
14943		$postLists.each(function(){
14944			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
14945				new Waypoint({
14946					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
14947					element: val,
14948					handler: function() {
14949						var element = $(this.element),
14950							parent = element.closest('.tmb'),
14951							currentIndex = parent.index(),
14952							delay = currentIndex,
14953							delayAttr = parseInt(element.attr('data-delay'));
14954						if (isNaN(delayAttr)) delayAttr = 100;
14955						var objTimeout = requestTimeout(function() {
14956							element.addClass('start_animation');
14957
14958							var nextTimeout = requestTimeout(function() {
14959								$('.drop-image-separator', parent).addClass('start_animation');
14960							}, 50);
14961
14962						}, delay * delayAttr);
14963						if (!UNCODE.isUnmodalOpen) {
14964							this.destroy();
14965						}
14966					},
14967					offset: UNCODE.isFullPage ? '100%' : '90%'
14968				})
14969			});
14970		});
14971	}
14972
14973	var runWaypoints_TO,
14974		runWaypoints_delay = 0;
14975
14976	var runWaypoints = function(){
14977		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
14978			runWaypoints_delay = 400;
14979		}
14980		clearRequestTimeout(runWaypoints_TO);
14981		runWaypoints_TO = requestTimeout(function() {
14982			drop_wp_animation();
14983		}, runWaypoints_delay);
14984	};
14985	runWaypoints();
14986	$( document.body ).on( 'uncode_waypoints', runWaypoints );
14987	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14988		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
14989			// imageHover();
14990			runWaypoints();
14991		});
14992	}
14993};
14994
14995UNCODE.postTable = function() {
14996
14997	var clickRow = function(){
14998		var $postLists = $('.uncode-post-table');
14999
15000		$postLists.each(function(){
15001			var $postList = $(this),
15002				$tmbClicks = $('.tmb.tmb-click-row', $postList);
15003
15004			$tmbClicks.each(function(){
15005				var $tmb = $(this),
15006					$click = $('.table-click-row', $tmb);
15007				$('*:not(.table-click-row)', $tmb).on('click', function(e){
15008					e.preventDefault();
15009					e.stopPropagation();
15010					$click[0].click();
15011					return false;
15012				});
15013			});
15014
15015		})
15016	};
15017
15018	clickRow();
15019
15020	var hoverRow = function(){
15021		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
15022
15023		$postLists.on('mouseenter', function(){
15024			$(this).addClass('post-table-hover');
15025		});
15026		$postLists.on('mouseleave', function(){
15027			$(this).removeClass('post-table-hover');
15028		});
15029	}
15030
15031	hoverRow();
15032
15033	var drop_wp_animation = function() {
15034		var $postLists = $('.uncode-post-table');
15035		$postLists.each(function(){
15036			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
15037				new Waypoint({
15038					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15039					element: val,
15040					handler: function() {
15041						var element = $(this.element),
15042							parent = element.closest('.tmb'),
15043							currentIndex = parent.index(),
15044							delay = currentIndex,
15045							delayAttr = parseInt(element.attr('data-delay'));
15046						if (isNaN(delayAttr)) delayAttr = 100;
15047						var objTimeout = requestTimeout(function() {
15048							element.addClass('start_animation');
15049						}, delay * delayAttr);
15050						if (!UNCODE.isUnmodalOpen) {
15051							this.destroy();
15052						}
15053					},
15054					offset: UNCODE.isFullPage ? '100%' : '90%'
15055				})
15056			});
15057		});
15058	}
15059
15060	var runWaypoints_TO,
15061		runWaypoints_delay = 0;
15062
15063	var runWaypoints = function(){
15064		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
15065			runWaypoints_delay = 400;
15066		}
15067		clearRequestTimeout(runWaypoints_TO);
15068		runWaypoints_TO = requestTimeout(function() {
15069			drop_wp_animation();
15070		}, runWaypoints_delay);
15071	};
15072	runWaypoints();
15073	$( document.body ).on( 'uncode_waypoints', runWaypoints );
15074	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15075		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
15076			runWaypoints();
15077			// clickRow();
15078		});
15079	}
15080};
15081
15082UNCODE.rotatingTxt = function($ctxt) {
15083
15084	if ( $('body').hasClass('compose-mode') ) {
15085		return;
15086	}
15087
15088	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
15089	var setCTA;
15090
15091	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
15092		var $heading = $(this),
15093			// debug = 0,
15094			cycle = 0,
15095			$trgt,
15096			$toMove,
15097			$highl,
15098			$col = $heading.closest('.uncont'),
15099			txt,
15100			arrTxt,
15101			textFadeIn, textFadeOut,
15102			removeWraps;
15103
15104		var defineObjs = function() {
15105			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
15106				var $rtx = $(this),
15107					fx = $rtx.attr('data-fx'),
15108					wait = $rtx.attr('data-wait'),
15109					$prev = $(this).prev().addClass('prev-rotating-start'),
15110					splitToMove = [],
15111					splitArray = [],
15112					lineArray = [],
15113					lineIndex = 0,
15114					lineStart = true,
15115					lineEnd = false,
15116					startSplit = false,
15117					$line_wrap = $rtx.closest('.heading-line-wrap'),
15118					same_line = true,
15119					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
15120					indexRtx = $splits.index($rtx);
15121
15122				fx = typeof fx === 'undefined' ? '' : fx;
15123				wait = typeof wait === 'undefined' ? '' : wait;
15124
15125				$splits.each(function(key, val){
15126					var $split = $(this),
15127						$new_line_wrap = $split.closest('.heading-line-wrap');
15128
15129					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
15130						splitArray.push( $split );
15131					}
15132
15133					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15134						startSplit = false;
15135					}
15136
15137					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15138						splitArray.push( $split );
15139
15140						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
15141							same_line = true;
15142						} else {
15143							same_line = false;
15144						}
15145					}
15146
15147					if ( key == indexRtx ) {
15148						if ( /\S/.test($split.text()) ) {
15149							startSplit = true;
15150							$line_wrap = $split.closest('.heading-line-wrap');
15151							splitArray.push( $split );
15152						} else {
15153							indexRtx++;
15154						}
15155					}
15156
15157					$line_wrap = $new_line_wrap;
15158				});
15159
15160				$toMove = $($.map(splitToMove, function(el){return el.get();}));
15161				$trgt = $($.map(splitArray, function(el){return el.get();}));
15162
15163				if ( same_line ) {
15164					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
15165					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
15166				}
15167
15168				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
15169					$prev.addClass('empty-span-hidden');
15170				}
15171
15172				$highl = $('.heading-text-highlight-inner', $trgt);
15173
15174				$rtx.attr('data-animated', 'true');
15175				if ( cycle == 0 ) {
15176					$( document.body ).trigger('defer-highlights');
15177					cycle++;
15178					defineObjs();
15179					return;
15180				}
15181				cycle++;
15182
15183				txt = $rtx.attr('data-text');
15184				arrTxt = txt.split("|");
15185
15186				textFadeOut($trgt);
15187
15188			});
15189		};
15190
15191		removeWraps = function(){
15192
15193			// if ( debug == 1 ) return;
15194			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
15195			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
15196
15197
15198				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
15199					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
15200
15201				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
15202
15203				$splitFlow.each(function(){
15204					$(this).append($temp_highl);
15205				});
15206
15207				var $line_wrap = $wraps[wrap_k];
15208				var $parent_wrap = $line_wrap.parentNode;
15209				if ( $parent_wrap !== null ) {
15210					while ( $line_wrap.firstChild ) {
15211						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
15212					}
15213					$parent_wrap.removeChild($line_wrap);
15214				}
15215			}
15216			// debug++;
15217			defineObjs();
15218		};
15219
15220		var loop = 0;
15221		textFadeIn = function($trgt){
15222			var word = arrTxt[loop].split(" "),
15223				worsSpan = '',
15224				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15225				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15226				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
15227
15228			for (var w = 0; w < word.length; w++) {
15229				var highl;
15230				if ( $highl.length ) {
15231					highl = $highl[0].outerHTML;
15232				} else {
15233					highl = '';
15234				}
15235
15236				if ( w > 0 ) {
15237					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
15238				}
15239				var charachters = word[w].split('');
15240				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
15241				if ( ! SiteParameters.uncode_has_ligatures ) {
15242					for (var c = 0; c < charachters.length; c++) {
15243						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
15244					}
15245				} else {
15246					worsSpan += word[w];
15247				}
15248				worsSpan += '</span>' + highl + '</span></span>';
15249			}
15250
15251			if ( $wrap.length && $wrap_inner.length ) {
15252				var words_w = $wrap_inner.outerWidth();
15253				$wrap.css({
15254					width: words_w
15255				});
15256
15257				$highl = $('.heading-text-highlight-inner', $wrap);
15258				$highl.prependTo($wrap);
15259
15260				$wrap_inner.css({
15261					opacity: 0
15262				});
15263
15264				$wrap_inner.html(worsSpan);
15265				$('.heading-text-highlight-inner', $wrap_inner).remove();
15266				words_w = $wrap_inner.innerWidth();
15267
15268				var duration = 0.45;
15269
15270				$heading.removeClass('auto-width');
15271				if ( words_w > $col.width() ) {
15272					$heading.addClass('auto-width');
15273					words_w = 'auto';
15274					duration = 0;
15275				}
15276
15277				$wrap.css({
15278					'width': words_w,
15279					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
15280				});
15281
15282				var $word_inner = $('.split-word-inner', $wrap_inner),
15283					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
15284
15285				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15286
15287				if ( !$target_fx.length ) {
15288					return;
15289				}
15290
15291				gsap.killTweensOf($target_fx);
15292
15293				if ( fx !== 'zoom' ) {
15294					gsap.fromTo( $target_fx, {
15295						y: fx === 'opacity' ? '0%' : '-10%'
15296					},{
15297						delay: duration,
15298						duration: 0.25,
15299						y: '0%',
15300						ease: Circ.easeOut,
15301					});
15302
15303					if ( !$wrap_inner.length ) {
15304						return;
15305					}
15306
15307					gsap.fromTo( $wrap_inner, {
15308						opacity: 0,
15309					},{
15310						delay: duration,
15311						duration: 0.25,
15312						opacity: 1,
15313						ease: Circ.easeOut,
15314						onComplete: function(){
15315							$('> .heading-text-highlight-inner', $wrap).remove();
15316							$wrap_inner.html(worsSpan);
15317							removeWraps();
15318						}
15319					})
15320
15321				} else {
15322					gsap.fromTo( $target_fx, {
15323						transformOrigin: '50%',
15324						opacity: 0,
15325						scale: 0.875,
15326					},{
15327						opacity: 1,
15328						delay: duration,
15329						duration: 0.25,
15330						scale: 1,
15331						ease: Circ.easeOut,
15332						onComplete: function(){
15333							$('> .heading-text-highlight-inner', $wrap).remove();
15334							$wrap_inner.html(worsSpan);
15335							removeWraps();
15336						}
15337					});
15338				}
15339
15340			} else {
15341
15342				if ( !$wrap_inner.length ) {
15343					return;
15344				}
15345
15346				gsap.to( $wrap_inner, {
15347					duration: 0.4,
15348					opacity: 0,
15349					ease: Power1.easeOut,
15350					onComplete: function(){
15351						$wrap_inner.html(worsSpan);
15352						words_w = $wrap_inner.innerWidth();
15353
15354						gsap.to( $wrap_inner, {
15355							duration: 0.2,
15356							opacity: 1,
15357							ease: Power1.easeOut,
15358							onComplete: function(){
15359								$('> .heading-text-highlight-inner', $wrap).remove();
15360								$wrap_inner.html(worsSpan);
15361								removeWraps();
15362							}
15363						})
15364					}
15365				});
15366			}
15367
15368			if ( loop < arrTxt.length-1 ) {
15369				loop++;
15370			} else {
15371				loop = 0;
15372			}
15373
15374		};
15375
15376		textFadeOut = function($trgt){
15377			var $word_inner = $('.split-word-inner', $trgt),
15378				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15379				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15380				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
15381				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
15382
15383			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
15384
15385			var gsap_param = {
15386					delay: wait,
15387					duration: 0.25,
15388					y: fx === '' ? '10%' : '0%',
15389					opacity: 0,
15390					ease: Circ.easeOut,
15391					onStart: function(){
15392						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
15393							$highl = $('.heading-text-highlight-inner', $wrap);
15394							$highl.prependTo($wrap);
15395						}
15396					},
15397					onComplete: textFadeIn,
15398					onCompleteParams: [$trgt]
15399				};
15400
15401			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15402
15403			if ( fx === '' ) {
15404				gsap_param.y = '10%';
15405			} else if ( fx === 'zoom' ) {
15406				gsap_param.scale = '1.045';
15407			}
15408
15409			if ( !$target_fx.length ) {
15410				return;
15411			}
15412
15413			if ( $heading.data('waypoint') !== true ) {
15414				var textInView = new Waypoint.Inview({
15415					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15416					element: $heading[0],
15417					enter: function(direction) {
15418						$heading.data('waypoint',true);
15419						gsap.fromTo( $target_fx, {
15420							transformOrigin: '50%'
15421						}, gsap_param );
15422					}
15423				});
15424			} else {
15425				gsap.fromTo( $target_fx, {
15426					transformOrigin: '50%'
15427				}, gsap_param );
15428			}
15429		};
15430
15431		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15432			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
15433				var $el = model.view.$el,
15434					shortcode = model.attributes.shortcode;
15435
15436				UNCODE.rotatingTxt($el);
15437			});
15438		} else {
15439			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
15440				$heading.on('already-animated', function(){
15441					removeWraps();
15442					window.addEventListener('removeOldLines', function(){
15443						clearRequestTimeout(setCTA);
15444						setCTA = requestTimeout( removeWraps, 150 );
15445					});
15446				});
15447			} else {
15448				$(window).on('load', function(){
15449					removeWraps();
15450					window.addEventListener('removeOldLines', function(){
15451						clearRequestTimeout(setCTA);
15452						setCTA = requestTimeout( removeWraps, 150 );
15453					});
15454				});
15455			}
15456		}
15457	});
15458
15459};
15460
15461UNCODE.verticalText = function() {
15462	$(window).on('menuCanvasOpen', function(){
15463		$('.vertical-text--fixed').fadeOut(500);
15464		$('.horizontal-text--fixed').fadeOut(500);
15465	}).on('menuCanvasClose', function(){
15466		$('.vertical-text--fixed').fadeIn(500);
15467		$('.horizontal-text--fixed').fadeIn(500);
15468	});
15469
15470	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
15471	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
15472	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
15473	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
15474
15475	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
15476		window.addEventListener('scroll', function(e) {
15477			var totalPageHeight = document.body.scrollHeight;
15478			var scrollPoint = window.scrollY + window.innerHeight;
15479
15480			if (window.scrollY > 0) {
15481				showOnTopVerticalTexts.fadeOut();
15482				showOnTopHorizontalTexts.fadeOut();
15483			} else {
15484				showOnTopVerticalTexts.fadeIn();
15485				showOnTopHorizontalTexts.fadeIn();
15486			}
15487
15488			if (scrollPoint >= totalPageHeight) {
15489				hideOnBottomVerticalTexts.fadeOut();
15490				hideOnBottomHorizontalTexts.fadeOut();
15491			} else {
15492				hideOnBottomVerticalTexts.fadeIn();
15493				hideOnBottomHorizontalTexts.fadeIn();
15494			}
15495		}, false);
15496	}
15497};
15498
15499UNCODE.stickyScroll = function( $el ) {
15500	if ( typeof $el === 'undefined' || $el === null ) {
15501		$el = $('body');
15502	}
15503	var checkVisible = function( el, dir ) {
15504		if (typeof jQuery === "function" && el instanceof jQuery) {
15505			el = el[0];
15506		}
15507
15508		var off = 50;
15509		dir = typeof dir=='undefined' ? 'right' : dir;
15510		var rect = el.getBoundingClientRect();
15511
15512		return (
15513			(
15514				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15515				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15516				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
15517			) &&
15518			(
15519				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15520				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15521				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
15522				( rect.right <= window.innerWidth && rect.left >= 0 )
15523			)
15524		);
15525	};
15526
15527	var setItemsRelHeight = function(reset) {
15528		var $_el = $el;
15529		if ( $el.is('.index-scroll') ) {
15530			var $_el = $el.closest('.uncont');
15531		}
15532		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
15533		// 	$.each($('.tmb', item), function(index, val) {
15534		// 		if ( reset === true ) {
15535		// 			$(val).css( 'visibility', 'hidden' );
15536		// 		} else {
15537		// 			$(val).css( 'visibility', 'visible' );
15538		// 		}
15539		// 	});
15540		// });
15541		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
15542			$.each($('.tmb', item), function(index, val) {
15543				if ( reset === true ) {
15544					$(val).css( 'visibility', 'hidden' );
15545					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
15546				} else {
15547					var $rowParent = $(item).closest('.row-parent'),
15548						rowRatio = $rowParent.attr('data-height-ratio'),
15549						$rowInner = $(item).closest('.row-child'),
15550						rowRatioInner = $rowInner.attr('data-height'),
15551						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15552						$colContainer = $(item).closest('.uncell'),
15553						$uncont = $(item).closest('.uncont'),
15554						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
15555						safe_heigth = $(item).data('safe-height'),
15556						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
15557						offSet = $(item).offset().top - $uncont.offset().top,
15558						multiplier_h,
15559						data_viewport_h,
15560						body_border = $('.body-borders .top-border').outerHeight() * 2,
15561						remove_menu = $(item).data('vp-menu');
15562
15563					if ( rowRatio === 'full' || rowRatio === '' ) {
15564						rowRatio = 1;
15565					} else {
15566						rowRatio = rowRatio / 100;
15567					}
15568
15569					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
15570						rowRatio = rowRatio;
15571					} else {
15572						rowRatio = rowRatio * rowRatioInner / 100;
15573					}
15574
15575					winHeight = winHeight * rowRatio;
15576
15577					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
15578						multiplier_h = parseInt($(item).attr('data-vp-height'));
15579					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
15580						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
15581					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
15582						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
15583					}
15584
15585					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
15586						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
15587						if ( remove_menu === true ) {
15588							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
15589						}
15590						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
15591					} else {
15592						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
15593					}
15594
15595				}
15596			});
15597		});
15598		$('.index-scroll', $_el).each(function(i, item){
15599			var $uncoltable = $(item).closest('.uncoltable'),
15600				$rowParent = $(item).closest('.row-parent'),
15601				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15602				body_border = $('.body-borders .top-border').outerHeight() * 2,
15603				$index_row = $('.index-row', item),
15604				safe_heigth = $index_row.data('safe-height'),
15605				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
15606			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
15607				var data_viewport_h = winHeight - ( paddingRow + body_border );
15608				$uncoltable.css({
15609					'min-height': data_viewport_h
15610				});
15611			} else {
15612				$uncoltable.css({
15613					'min-height': 'auto'
15614				});
15615			}
15616		});
15617
15618	}
15619	setItemsRelHeight();
15620
15621	var $index_scrolls = $('.index-scroll', $el);
15622
15623	$index_scrolls.each(function(key, value){
15624		var $index = $(this),
15625			$parent_row = $index.closest('.vc_row[data-parent]'),
15626			$index_row = $('.index-row', $index),
15627			dir = $index_row.attr('data-direction');
15628		dir = typeof dir === 'undefined' ? 'right' : dir;
15629
15630		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
15631
15632		if ( $('.animate_when_almost_visible', $index).length ) {
15633			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
15634		}
15635
15636	});
15637
15638	var $horScrolls = $('.unscroll-horizontal', $el);
15639
15640	if ( $horScrolls.length ) {
15641
15642		$('body').addClass('scrolling-trigger');
15643
15644		$horScrolls.each(function(key, value){
15645			var $section = $(this),
15646				$index_scroll = $('.index-scroll', $section),
15647				$index_row = $('.index-row', $index_scroll),
15648				dir = $section.attr('data-direction'),
15649				wrap = $index_row.attr('data-wrap'),
15650				$pinWrap,
15651				$pinTrigger;
15652
15653			dir = typeof dir === 'undefined' ? 'right' : dir;
15654			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
15655			$pinWrap = $('<div class="pin-wrap" />');
15656			if ( SiteParameters.is_frontend_editor ) {
15657				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
15658				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
15659			} else {
15660				if ( wrap === 'column' ) {
15661					$index_scroll.wrapInner( $pinWrap );
15662				} else {
15663					$('> .row', $section).wrap( $pinWrap );
15664				}
15665				$section.wrapInner( $pinTrigger );
15666			}
15667
15668		});
15669
15670		var $pinWraps = $('.pin-wrap', $el);
15671
15672		var horScrollSizes = function(){
15673
15674			$pinWraps.each(function(key, val){
15675				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
15676					$pinTrigger = $pinWrap.closest('.pin-trigger'),
15677					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
15678					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
15679					$boxContainer = $('.box-container'),
15680					box_m = $boxContainer.css('margin-left'),
15681					st_active = true;
15682
15683				var setHorW,
15684				horWidth = function(){
15685					$index_scroll.each(function(){
15686						var $this = $(this),
15687							$index_row = $('.index-row', $this),
15688							$rowContainer = $index_row.closest('.vc_row'),
15689							$rowInner = $index_row.closest('.wpb_row'),
15690							$rowParent = $index_row.closest('.row-parent'),
15691							$tmbs = $('.tmb', $index_row),
15692							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
15693							$uncont = $index_row.closest('.uncont'),
15694							$parent_col = $index_row.closest('.wpb_column'),
15695							col_w = $uncont.width(),
15696							data_lg = parseFloat( $index_row.attr('data-lg') ),
15697							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
15698							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
15699							tmb_w;
15700
15701						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
15702						tmb_w = ( col_w + padding_tmb ) / data_lg;
15703
15704						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
15705							tmb_w = ( col_w + padding_tmb ) / data_sm;
15706						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
15707							tmb_w = ( col_w + padding_tmb ) / data_md;
15708						}
15709
15710						if ( !isNaN(tmb_w) ) {
15711							$tmbs.css({
15712								'width': tmb_w
15713							});
15714						}
15715
15716						$tmbs.css({
15717							'visibility': 'visible'
15718						});
15719
15720					});
15721				};
15722
15723				horWidth();
15724				clearRequestTimeout(setHorW);
15725				setHorW = requestTimeout( function(){
15726					setItemsRelHeight();
15727					horWidth();
15728				}, 100 );
15729
15730				if ( SiteParameters.is_frontend_editor ) {
15731					return;
15732				}
15733
15734				var $vmenu = $('body.vmenu .vmenu-container'),
15735					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
15736					winWidth = window.innerWidth - vmenuW,
15737					$tmb = $('.tmb', $index_scroll).eq(0),
15738					paddingRight = parseFloat( $tmb.css('padding-right') ),
15739					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
15739scroll.width() + paddingRight ) ),
15740					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
15741					scroll_anim;
15742
15743				if ( $('body').hasClass('rtl') ) {
15744					if ( dir === 'left' ) {
15745						scroll_anim = gsap.fromTo( $pinWrap, {
15746							x: stickyScrollLength
15747						},{
15748							x: 0,
15749							ease: "none"
15750						});
15751					} else {
15752						scroll_anim = gsap.fromTo( $pinWrap, {
15753							x: 0
15754						},{
15755							x: stickyScrollLength,
15756							ease: "none"
15757						});
15758					}
15759				} else {
15760					if ( dir === 'left' ) {
15761						scroll_anim = gsap.fromTo( $pinWrap, {
15762							x: -stickyScrollLength
15763						},{
15764							x: 0,
15765							ease: "none"
15766						});
15767					} else {
15768						scroll_anim = gsap.fromTo( $pinWrap, {
15769							x: 0
15770						},{
15771							x: -stickyScrollLength,
15772							ease: "none"
15773						});
15774					}
15775				}
15776
15777				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
15778					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
15779				}
15780
15781				var animationIncrease;
15782
15783				var checkForAnimations = function(){
15784					animationIncrease = 0
15785					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15786						var _this = this;
15787						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
15788							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15789							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15790							requestTimeout(function() {
15791								$(_this).addClass('start_animation');
15792							}, delayAttr + animationIncrease);
15793							animationIncrease += 150;
15794						}
15795						$(_this).on([
15796							'webkitAnimationEnd',
15797							'mozAnimationEnd',
15798							'MSAnimationEnd',
15799							'oanimationend',
15800							'animationend'
15801						].join(' '), function(e) {
15802							$(e.currentTarget).removeClass('animate_when_almost_visible');
15803						});
15804					});
15805
15806					var batchTime = 0;
15807
15808					var resetBatch = function(){
15809						batchTime = 0;
15810					}
15811
15812					if (ScrollTrigger.isScrolling()) {
15813						resetBatch();
15814					}
15815					
15816					$('.tmb-mask-reveal', $pinTrigger).each(function(){
15817						var _this = this,
15818							$this = $(_this),
15819							$inside = $('.t-inside', $this),
15820							delay = parseFloat( $inside.attr('data-delay') ),
15821							speed = parseFloat( $inside.attr('data-speed') ),
15822							easing = $inside.attr('data-easing'),
15823							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
15824
15825						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
15826						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
15827						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
15828						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
15829
15830						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
15831							$this.addClass('tmb-mask-init');
15832							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
15833								gsap.to($('.t-entry-visual-tc', $this), speed, {
15834									clipPath: 'inset(0% 0% 0% 0%)',
15835									delay: delay + batchTime,
15836									ease: easing,
15837								});
15838								gsap.to($('.t-entry-visual-cont', $this), speed, {
15839									clipPath: 'inset(0% 0% 0% 0%)',
15840									scale: 1,
15841									delay: delay + batchTime + (speed*bgDelay),
15842									ease: easing,
15843									onComplete: resetBatch,
15844								});
15845							} else {
15846								gsap.to($('.t-entry-visual-cont', $this), speed, {
15847									clipPath: 'inset(0% 0% 0% 0%)',
15848									scale: 1,
15849									delay: delay + batchTime,
15850									ease: easing,
15851									onComplete: resetBatch,
15852								});
15853							}
15854							batchTime += 0.1;
15855						}
15856					});
15857				
15858				};
15859				checkForAnimations();
15860
15861				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
15862				var start = 0;
15863
15864				var horST = ScrollTrigger.create({
15865					id: "stickySectionScrolling" + key,
15866					scrub: true,
15867					trigger: $pinTrigger[0],
15868					pin: true,
15869					anticipatePin: 1,
15870					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
15871					end: function() { return "+="+stickyScrollLength; },
15872					animation: scroll_anim,
15873					ease: Sine.easeOut,
15874					onUpdate: checkForAnimations,
15875					invalidateOnRefresh: true,
15876					onEnter: function(){
15877						$pinTrigger.addClass('enter-st');
15878					},
15879					onEnterBack: function(){
15880						$pinTrigger.addClass('enter-st');
15881					},
15882					onLeave: function(){
15883						$pinTrigger.removeClass('enter-st');
15884					},
15885					onLeaveBack: function(){
15886						$pinTrigger.removeClass('enter-st');
15887					}
15888				});
15889
15890				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
15891				window.dispatchEvent(new CustomEvent('boxResized'));
15892
15893				var testSecondTrigger = function(){
15894					animationIncrease = 0
15895					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15896						var _this = this;
15897						if ( checkVisible(_this) ) {
15898							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15899							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15900							requestTimeout(function() {
15901								$(_this).addClass('start_animation');
15902							}, delayAttr + animationIncrease);
15903							animationIncrease += 150;
15904						}
15905					});
15906
15907				};
15908
15909				var verST = ScrollTrigger.create({
15910					id: "verticalSectionScrolling" + key,
15911					trigger: $pinTrigger[0],
15912					start: "top center",
15913					end: function() { return "+="+UNCODE.wheight; },
15914					onUpdate: testSecondTrigger,
15915					invalidateOnRefresh: true
15916				});
15917
15918				var setCTA,
15919
15920				dis_enable_ST = function(){
15921					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
15922						horST.kill();
15923						verST.kill();
15924						$pinTrigger.addClass('disabled');
15925						st_active = false;
15926					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15927						horST.kill();
15928						verST.kill();
15929						$pinTrigger.addClass('disabled');
15930						st_active = false;
15931					}
15932				};
15933
15934				$(window).on('resize load', function() {
15935					clearRequestTimeout(setCTA);
15936					setCTA = requestTimeout(function() {
15937						dis_enable_ST();
15938						checkForAnimations();
15939					}, 500);
15940				});
15941
15942			});
15943		};
15944
15945		$(window).on( 'load', function(){
15946			horScrollSizes();
15947		});
15948		var setResize,
15949			setReLayout,
15950			doubleResize = true;
15951		$(window).on( 'load', function(){
15952			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
15953				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15954				Array.prototype.forEach.call($row_inners, function(el) {
15955					el.style.height = '';
15956					el.style.marginBottom = '';
15957				});
15958				setItemsRelHeight();
15959				horScrollSizes();
15960				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15961					$(document).trigger('uncode-scrolltrigger-refresh');
15962				}
15963			}
15964			var carousel = document.querySelector(".owl-carousel"),
15965				grid = document.querySelector(".isotope-container"),
15966				stickyAll = document.querySelectorAll(".index-scroll");
15967
15968			if ( stickyAll.length ) {
15969				var sticky = stickyAll[(stickyAll.length-1)];
15970			}
15971
15972			if ( typeof sticky !== "undefined" ) {
15973
15974				if ( typeof carousel !== "undefined" && carousel !== null ) {
15975					var carousel_position = sticky.compareDocumentPosition(carousel);
15976				}
15977				if ( typeof grid !== "undefined" && grid !== null ) {
15978					var grid_position = sticky.compareDocumentPosition(grid);
15979				}
15980
15981				if ( carousel_position === 2 || grid_position === 2 ) {
15982					setTimeout(function(){
15983						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15984							$(document).trigger('uncode-scrolltrigger-refresh');
15985						}
15986					}, 500);
15987				}
15988
15989			}
15990			
15991		});
15992        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
15993            android = /Android/.test(navigator.userAgent) && !window.MSStream;
15994		$(window).on( 'resize orientationchange', function(e){
15995			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
15996				return;
15997			}
15998			setItemsRelHeight(true);
15999			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
16000			Array.prototype.forEach.call($row_inners, function(el) {
16001				el.style.height = '';
16002				el.style.marginBottom = '';
16003			});
16004			clearRequestTimeout(setResize);
16005			setResize = requestTimeout( function(){
16006				setItemsRelHeight();
16007				horScrollSizes();
16008				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16009					$(document).trigger('uncode-scrolltrigger-refresh');
16010				}
16011				if ( doubleResize === true ) {
16012					window.dispatchEvent(new Event('resize'));
16013					doubleResize = false;
16014				} else {
16015					doubleResize = true;
16016				}
16017				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
16018			}, 100 );
16019		});
16020
16021		var show_pins = function(){
16022			$('.index-scroll').css({'opacity':'1'});
16023		};
16024		ScrollTrigger.addEventListener("refresh", show_pins);
16025		$(window).on( 'uncode.re-layout', function(){
16026			//$('.index-scroll').css({'opacity':'0'});
16027			$('.pin-spacer').each(function(){
16028				var space_h = $(this).outerHeight(),
16029					$row = $(this).closest('.row-container');
16030				$row.css({
16031					'height': space_h,
16032					'overflow': 'hidden'
16033				});
16034			});
16035			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16036				ScrollTrigger.refresh(true);
16037			}
16038			clearRequestTimeout(setReLayout);
16039			setReLayout = requestTimeout( function(){
16040				$('.row-container').each(function(){
16041					$(this).css({
16042						'height': '',
16043						'overflow': ''
16044					});
16045				});
16046			}, 1000);
16047		});
16048	}
16049
16050};
16051
16052UNCODE.stickyTrigger = function($el) {
16053	if (SiteParameters.is_frontend_editor) {
16054		return false;
16055	}
16056
16057	var resizeTimer;
16058	var oldW = UNCODE.wwidth;
16059	var stickyObservers = [];
16060	var stickyInstances = [];
16061	var isRefreshing = false;
16062	var pendingRefresh = false;
16063	var lastStickyMetrics = {
16064		rowH: 0,
16065		uncontH: 0
16066	};
16067
16068	function clearStickyInstances() {
16069		stickyInstances.forEach(function(st) {
16070			if (st && st.kill) {
16071				st.kill();
16072			}
16073		});
16074		stickyInstances = [];
16075	}
16076
16077	function clearStickyObservers() {
16078		stickyObservers.forEach(function(observer) {
16079			try {
16080				observer.disconnect();
16081			} catch (e) {}
16082		});
16083		stickyObservers = [];
16084	}
16085
16086	function getStickyMetrics() {
16087		var $firstSticky = $('.sticky-trigger').first();
16088		if (!$firstSticky.length) {
16089			return {
16090				rowH: 0,
16091				uncontH: 0
16092			};
16093		}
16094
16095		var $row = $firstSticky.closest('.vc_row');
16096		var $uncont = $firstSticky.closest('.uncont');
16097
16098		return {
16099			rowH: $row.length ? Math.round($row.outerHeight()) : 0,
16100			uncontH: $uncont.length ? Math.round($uncont.outerHeight()) : 0
16101		};
16102	}
16103
16104	function metricsChanged(nextMetrics) {
16105		return (
16106			Math.abs(nextMetrics.rowH - lastStickyMetrics.rowH) > 1 ||
16107			Math.abs(nextMetrics.uncontH - lastStickyMetrics.uncontH) > 1
16108		);
16109	}
16110
16111	function buildSticky() {
16112		clearStickyInstances();
16113		clearStickyObservers();
16114
16115		$('.sticky-trigger').each(function() {
16116			var $sticky = $(this);
16117			var $inside = $sticky.children('div').first();
16118			var $row = $sticky.closest('.vc_row');
16119			var $uncont = $sticky.closest('.uncont');
16120
16121			if (!$inside.length || !$row.length || !$uncont.length) {
16122				return;
16123			}
16124
16125			var st = ScrollTrigger.create({
16126				trigger: $sticky[0],
16127				start: function() {
16128					var insideH = $inside.outerHeight() || 0;
16129					return 'top center-=' + (insideH / 2);
16130				},
16131				endTrigger: $row[0],
16132				end: function() {
16133					var insideH = $inside.outerHeight() || 0;
16134					var rowBottom = $row.offset().top + $row.outerHeight();
16135					var uncontBottom = $uncont.offset().top + $uncont.outerHeight();
16136					var diffBottom = rowBottom - uncontBottom;
16137
16138					return 'bottom center+=' + (insideH / 2 + diffBottom);
16139				},
16140				anticipatePin: true,
16141				pin: true,
16142				pinSpacing: false,
16143				scrub: true,
16144				invalidateOnRefresh: true
16145			});
16146
16147			stickyInstances.push(st);
16148
16149			if (typeof ResizeObserver !== 'undefined') {
16150				var ro = new ResizeObserver(function() {
16151					if (isRefreshing) {
16152						pendingRefresh = true;
16153						return;
16154					}
16155
16156					var nextMetrics = getStickyMetrics();
16157
16158					if (!metricsChanged(nextMetrics)) {
16159						return;
16160					}
16161
16162					refreshSticky(true);
16163				});
16164
16165				try {
16166					// NON osservare $inside: tende a creare loop continui
16167					ro.observe($row[0]);
16168					ro.observe($uncont[0]);
16169					stickyObservers.push(ro);
16170				} catch (e) {}
16171			}
16172		});
16173
16174		lastStickyMetrics = getStickyMetrics();
16175	}
16176
16177	function refreshSticky(fromObserver) {
16178		clearRequestTimeout(resizeTimer);
16179
16180		resizeTimer = requestTimeout(function() {
16181			if (isRefreshing) {
16182				pendingRefresh = true;
16183				return;
16184			}
16185
16186			isRefreshing = true;
16187			pendingRefresh = false;
16188
16189			if (!fromObserver) {
16190				buildSticky();
16191			}
16192
16193			requestTimeout(function() {
16194				isRefreshing = false;
16195
16196				lastStickyMetrics = getStickyMetrics();
16197
16198				if (!fromObserver) {
16199					$(document).trigger('uncode-scrolltrigger-refresh');
16200				} else {
16201					$(document).trigger('uncode-scrolltrigger-refresh');
16202				}
16203
16204				if (pendingRefresh) {
16205					pendingRefresh = false;
16206					refreshSticky(true);
16207				}
16208			}, 120);
16209		}, fromObserver ? 160 : 100);
16210	}
16211
16212	function maybeDelayedRefresh() {
16213		var carousel = document.querySelector('.owl-carousel');
16214		var grid = document.querySelector('.isotope-container');
16215		var stickyAll = document.querySelectorAll('.sticky-trigger');
16216		var sticky = stickyAll.length ? stickyAll[stickyAll.length - 1] : null;
16217		var carousel_position;
16218		var grid_position;
16219
16220		if (!sticky) {
16221			return;
16222		}
16223
16224		if (carousel) {
16225			carousel_position = sticky.compareDocumentPosition(carousel);
16226		}
16227		if (grid) {
16228			grid_position = sticky.compareDocumentPosition(grid);
16229		}
16230
16231		if (carousel_position === 2 || grid_position === 2) {
16232			setTimeout(function() {
16233				refreshSticky(false);
16234			}, 500);
16235		}
16236	}
16237
16238	$(window).on('load', function() {
16239		buildSticky();
16240		maybeDelayedRefresh();
16241	});
16242
16243	$(window).on('resize uncode.re-layout', function(e) {
16244		if (e.type === 'resize' && oldW === UNCODE.wwidth) {
16245			return;
16246		}
16247
16248		oldW = UNCODE.wwidth;
16249		refreshSticky(false);
16250	});
16251
16252	$(document).on('uncode-sticky-refresh uncode-toggle-change', function() {
16253		refreshSticky(false);
16254	});
16255};
16256UNCODE.areaTextReveal = function() {
16257    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
16258        return;
16259    }
16260	if ( ! SiteParameters.is_frontend_editor ) {
16261        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
16262            android = /Android/.test(navigator.userAgent) && !window.MSStream,
16263            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16264            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16265                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16266            firstObs = true,
16267            isMobileUsing = false;
16268
16269        var observer = new ResizeObserver(function(){
16270            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16271                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16272                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16273                set = false;
16274            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
16275                set = true;
16276                prevW = newW;
16277            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16278                set = true;
16279                prevH = newH;
16280            }
16281            if ( set || firstObs ) {
16282                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
16283                firstObs = false;
16284            }
16285        }).observe(document.body);
16286
16287        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16288            window.scrollTo = function() {
16289                return;
16290            };
16291            isMobileUsing = true;
16292
16293            $('html, body').css({
16294                'overscroll-behavior': 'none'
16295            });
16296        }
16297
16298        var setTriggerObserve;
16299
16300        ScrollTrigger.observe({
16301            trigger: 'body',
16302            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
16303            onUp: function() { ScrollTrigger.update(); },
16304        });
16305    }
16306
16307    var textReveal = function(){
16308
16309        if ( SiteParameters.is_frontend_editor ) {
16310            return;
16311        }
16312
16313        var setTxtReveal,
16314            txtTrggrStart = false;
16315
16316        function headingReveal($sel){
16317            txtTrggrStart = true;
16318            $('.text-reveal', $sel).each(function(val, key){
16319                var $txtReveal = $(this).attr('data-init-reveal', true),
16320                    $trigger = $txtReveal,
16321                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
16322                    hReveal = $txtReveal.outerHeight(),
16323                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
16324                    $sticky = $txtReveal.closest('.sticky-element'),
16325                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16326                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16327                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
16328                    $lines = $('.heading-line-wrap', $txtReveal),
16329                    $words = $('.split-word-inner', $txtReveal),
16330                    $chars = $('.split-char', $txtReveal),
16331                    $elToReveal = $words;
16332
16333                if ( $pin.length ) {
16334                    return;
16335                } else if ( $sticky.length ) {
16336                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
16337                    $trigger = $sticky.parent();
16338                }
16339
16340                if ( dataReveal === 'chars' ) {
16341                    $elToReveal = $chars;
16342                } else if ( dataReveal === 'lines' ) {
16343                    $elToReveal = $lines;
16344                }
16345                
16346                var tl = gsap.timeline({
16347                    scrollTrigger: {
16348                        trigger: $trigger,
16349                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
16350                        end: "+=" + hReveal + "px",
16351                        id: "txt_reveal_" + key,
16352                        scrub: true,
16353                    }
16354                });
16355                gsap.set(
16356                    $elToReveal, {
16357                        opacity: dataRevealOpacity,
16358                    }
16359                )
16360                tl.fromTo($elToReveal, {
16361                    opacity: dataRevealOpacity,
16362                    duration: 1,
16363                }, {
16364                    opacity: 1,
16365                    stagger: 0.05,
16366                    duration: 1,
16367
16368                });
16369                $(window).on('uncode.tl-refresh', function(){
16370                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
16371                        tl.scrollTrigger.refresh();
16372                    }
16373                });
16374
16375                $rowParent.one( 'uncodeWordLines', function(){
16376                    clearRequestTimeout(setTxtReveal);
16377                    setTxtReveal = requestTimeout( function(){
16378                        gsap.set($elToReveal, {clearProps: true});
16379                        tl.kill(true);
16380                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
16381                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
16382                        }
16383                        headingReveal($sel)
16384                    }, 100);
16385                });
16386
16387            });
16388        };
16389
16390        window.addEventListener("load", function (e) {
16391            if (!txtTrggrStart) {
16392                headingReveal($("body"));
16393                $(window).trigger("resize");
16394            }
16395        });
16396
16397        $('.row-container[data-parent]').each(function(){
16398            if (!txtTrggrStart) {
16399                var $this = $(this);
16400                $this.on('uncodeWordLines', function(){
16401                    headingReveal($this);
16402                });
16403            }
16404        });
16405
16406        $(window).on('uncode-sticky-trigger-observe', function(e){
16407            clearRequestTimeout(setTriggerObserve);
16408            setTriggerObserve = requestTimeout( function(){
16409                $(window).trigger('uncode.tl-refresh');
16410            }, 2000 );
16411        });
16412    
16413    };
16414    textReveal();
16415
16416    var areaReveal = function(){
16417        if ( SiteParameters.is_frontend_editor ) {
16418            return;
16419        }
16420
16421        $('.scroll-trigger-el').each(function(){
16422            var $scrollTrgrEl = $(this),
16423                $row = $('> .row', $scrollTrgrEl),
16424                $row_in = $('> .row-inner', $row),
16425                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
16426                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
16427                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
16428                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
16429                $animateTrgrEl = $scrollTrgrEl,
16430                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
16431                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
16432                els = $scrollTrgrEl.attr('data-anim-els'),
16433                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
16434                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
16435                state = $scrollTrgrEl.attr('data-anim-state'),
16436                target = $scrollTrgrEl.attr('data-anim-target'),
16437                origin = $scrollTrgrEl.attr('data-anim-origin'),
16438                mask = $scrollTrgrEl.attr('data-anim-mask'),
16439                _scale = $scrollTrgrEl.attr('data-anim-scale'),
16440                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
16441                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
16442                radius = $scrollTrgrEl.attr('data-anim-radius'),
16443                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
16444                clip_path = $scrollTrgrEl.attr('data-clip-path'),
16445                animation_x = $scrollTrgrEl.attr('data-anim-x'),
16446                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
16447                animation_y = $scrollTrgrEl.attr('data-anim-y'),
16448                blur = $scrollTrgrEl.attr('data-anim-blur'),
16449                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
16450                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
16451                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
16452                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
16453                offTop = $scrollTrgrEl.attr('data-anim-top'),
16454                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
16455                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
16456                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
16457                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
16458                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
16459                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
16460                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
16461                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
16462                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
16463                setTxtReveal,
16464                txtTrggrStart = false,
16465                alreadyareaAnimateScrollTl = false;
16466    
16467            _scale = _scale === '' ? 0 : parseFloat( _scale );
16468            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
16469            offTop = offTop === '' ? 0 : parseFloat( offTop );
16470            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
16471            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
16472
16473            function areaAnimateScrollTl($el, id, last) {
16474                alreadyareaAnimateScrollTl = true;
16475
16476                var pTop = parseFloat( $row.css('padding-top') ),
16477                    innerGap = pTop + offSetCard * id,
16478                    scale = _scale,
16479                    rows_start = animation_rows_start;
16480                    
16481                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
16482                    rows_start = mobile_rows_start;
16483                    innerGap = 0 + parseFloat(mobile_start_add);
16484                }
16485
16486                if ( stepScale ) {
16487                    if ( _scale < 100 ) {
16488                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
16489                    }
16490                }
16491
16492                if ( els === 'content' ) {
16493                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
16494                } else if ( els === 'bg' ) {
16495                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
16496                } else {
16497                    $animateTrgrEl = $el;
16498                }
16499
16500                if ( rotate_alt === 'yes') {
16501                    rotate *= -1;
16502                    perspective *= -1;
16503                }
16504                
16505                if ( animation_x_alt === 'yes') {
16506                    animation_x *= -1;
16507                }
16508
16509                var $parentDiv = $el.closest('div[data-sticky]');
16510
16511                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
16512
16513                var scrllTrggr = {
16514                    trigger: $parentDiv,
16515                    end: function(){
16516                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
16517                    },
16518                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
16519                    pin: sticky === 'yes' || stickyCards ? true : false,
16520                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
16521                    scrub: true,
16522                    id: 'sticky_' + id,
16523                    anticipatePin: 1,
16524                    invalidateOnRefresh: true,
16525                    // markers: {
16526                    //     indent: 150 * id
16527                    // },
16528                    onToggle: function(){
16529                        $scrollTrgrEl.attr('data-revealed', true);
16530                    },
16531                };
16532
16533
16534                if ( !stickyLast && state === 'end' ) {
16535                    last = false;
16536                } 
16537
16538                if ( stickyCards ) {
16539                    if ( state !== 'end' ) {
16540                        if ( rows_start === 'center' ) {
16541                            scrllTrggr.start = "center center";
16542                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
16543                        } else if ( rows_start === 'bottom' ) {
16544                            if ( stickyOpts !== 'no' ) {
16545                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
16546                                scrllTrggr.end = "bottom bottom";
16547                            }
16548                        } else {
16549                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
16550                        } 
16551                        if ( stickyOpts === 'no' ) {
16552                            scrllTrggr.endTrigger = $el;
16553                            scrllTrggr.end = "+=100%";
16554                        } else {
16555                            scrllTrggr.endTrigger = $row;
16556                        }
16557                    } else {
16558                        if ( rows_start === 'center' ) {
16559                            scrllTrggr.start = "center center";
16560                        } else if ( rows_start === 'bottom' ) {
16561                            scrllTrggr.start = "bottom bottom";
16562                        } 
16563                        if ( stickyOpts !== 'no' ) {
16564                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
16565                            scrllTrggr.endTrigger = $lastEl;
16566                        } else {
16567                            scrllTrggr.end = "bottom bottom";
16568                        }
16569                    }
16570                }
16571                
16572                var tl = gsap.timeline({
16573                    scrollTrigger: scrllTrggr
16574                });
16575
16576                // var mark = last ? {
16577                //         startColor:"blue",
16578                //         endColor:"orange",
16579                //     } : false;
16580
16581                if ( !stickyCards ) {
16582                    var tlConds = tl;
16583                } else {
16584                    var scrllTrggrConds = {
16585                        trigger: $parentDiv,
16586                        end: function(){
16587                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
16588                        }, 
16589                        pin: (state === 'end' && last),
16590                        pinSpacing: false,
16591                        scrub: true,
16592                        id: 'card_' + id,
16593                        invalidateOnRefresh: true,
16594                        // markers: true,
16595                    };
16596
16597                    if ( stickyCards ) {
16598                        if ( state !== 'end' ) {
16599                            if ( stickyOpts === '' ) {
16600                                scrllTrggrConds.end = "bottom bottom-=100%";
16601                                scrllTrggrConds.endTrigger = $row_in;
16602                            }
16603
16604                            if ( rows_start === 'bottom' ) {
16605                                if ( stickyOpts !== 'no') {
16606                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
16607                                    scrllTrggrConds.end = "bottom bottom";
16608                                }
16609                            } else if ( rows_start === 'center' ) {
16610                                scrllTrggrConds.start =  "center center";
16611                            } else {
16612                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16613                            }
16614                            
16615                        } else {
16616                            if ( stickyOpts === '' ) {
16617                                if ( animLast ) {
16618                                    scrllTrggrConds.end = "bottom bottom-=100%";
16619                                } else {
16620                                    scrllTrggrConds.end = "bottom bottom";
16621                                }
16622                                scrllTrggrConds.endTrigger = $lastEl;
16623                            }
16624
16625                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
16626                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16627                                    scrllTrggrConds.start = "bottom bottom";
16628                                } else {
16629                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
16630                                }
16631                            } else if ( rows_start === 'center' ) {
16632                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16633                                    scrllTrggrConds.start =  "center center";
16634                                } else {
16635                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
16635+ window.innerHeight/2;
16636                                }
16637                            } else {
16638                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16639                                    scrllTrggrConds.start = "top top";
16640                                } else {
16641                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16642                                }
16643                            }
16644
16645                        }
16646
16647                    } else {
16648                        scrllTrggrConds.start =  start_topBottom;
16649                    }
16650
16651                    var tlConds = gsap.timeline({
16652                        scrollTrigger: scrllTrggrConds
16653                    });
16654                }
16655
16656                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
16657                    if ( target === 'mask' ) {
16658                        if ( state !== 'end' ) {
16659                            if ( mask === 'auto' ) {
16660                                gsap.set(
16661                                    $animateTrgrEl, {
16662                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16663                                        opacity: parseFloat(opacity)/100,
16664                                        filter: 'blur(' + blur + 'px)',
16665                                        visibility: 'visible',
16666                                    }
16667                                )
16668                                tlConds.fromTo($animateTrgrEl, {
16669                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16670                                    opacity: parseFloat(opacity)/100,
16671                                    filter: 'blur(' + blur + 'px)',
16672                                    duration: 1,
16673                                }, {
16674                                    opacity: 1,
16675                                    clipPath: 'inset(0% 0px round 0' + radiu
16675s_unit + ')',
16676                                    filter: 'blur(0px)',
16677                                    duration: 1,
16678                                    ease: easeOut,
16679                                    //delay: 0.1
16680                                });	
16681                            } else {
16682                                tlConds.fromTo($animateTrgrEl, {
16683                                    opacity: parseFloat(opacity)/100,
16684                                    clipPath: clip_path,
16685                                    filter: 'blur(' + blur + 'px)',
16686                                    duration: 1,
16687                                }, {
16688                                    opacity: 1,
16689                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16690                                    filter: 'blur(0px)',
16691                                    duration: 1,
16692                                    ease: easeOut,
16693                                    //delay: 0.1
16694                                });	
16695                            }
16696                        } else {
16697                            if ( mask === 'auto' ) {
16698                                tlConds.fromTo($animateTrgrEl, {
16699                                    opacity: 1,
16700                                    clipPath: 'inset(0% 0px round 0' + radiu
16700s_unit + ')',
16701                                    filter: 'blur(0px)',
16702                                    duration: 1,
16703                                },{
16704                                    opacity: parseFloat(opacity)/100,
16705                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16706                                    filter: 'blur(' + blur + 'px)',
16707                                    ease: easeOut,
16708                                    duration: 1,
16709                                    //delay: 0.1
16710                                });	
16711                            } else {
16712                                tlConds.fromTo($animateTrgrEl, {
16713                                    opacity: 1,
16714                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16715                                    filter: 'blur(0px)',
16716                                    duration: 1,
16717                                },{
16718                                    opacity: parseFloat(opacity)/100,
16719                                    clipPath: clip_path,
16720                                    filter: 'blur(' + blur + 'px)',
16721                                    duration: 1,
16722                                    ease: easeOut,
16723                                    //delay: 0.1
16724                                });	
16725                            }
16726                        }
16727                    } else {
16728                        if ( state !== 'end' ) {
16729                            if ( scale === 'auto' ) {
16730                                if ( radius ) {
16731                                    gsap.set(
16732                                        $animateTrgrEl, {
16733                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16734                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16735                                            x: animation_x + 'vw',
16736                                            y: animation_y + 'vh',
16737                                            filter: 'blur(' + blur + 'px)',
16738                                            rotation: rotate,
16739                                            rotationX: rotate == 0 ? perspective : 0,
16740                                            transformPerspective: '100vw',
16741                                            opacity: parseFloat(opacity)/100,
16742                                            transformOrigin: origin,
16743                                            borderRadius: radius + radius_unit,
16744                                            visibility: 'visible',
16745                                        }
16746                                    )
16747                                    tlConds.fromTo($animateTrgrEl, {
16748                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16749                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16750                                        x: animation_x + 'vw',
16751                                        y: animation_y + 'vh',
16752                                        filter: 'blur(' + blur + 'px)',
16753                                        rotation: rotate,
16754                                        rotationX: rotate == 0 ? perspective : 0,
16755                                        transformPerspective: '100vw',
16756                                        opacity: parseFloat(opacity)/100,
16757                                        borderRadius: radius + radius_unit,
16758                                        transformOrigin: origin,
16759                                        duration: 1,
16760                                    }, {
16761                                        scaleX: 1,
16762                                        scaleY: 1,
16763                                        x: 0,
16764                                        y: 0,
16765                                        filter: 'blur(0px)',
16766                                        rotation: 0,
16767                                        rotationX: 0,
16768                                        opacity: 1,
16769                                        borderRadius: 0 + radius_unit,
16770                                        transformOrigin: origin,
16771                                        duration: 1,
16772                                        ease: easeOut,
16773                                        //delay: 0.1
16774                                    });	
16775                                } else {
16776                                    gsap.set(
16777                                        $animateTrgrEl, {
16778                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16779                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16780                                            x: animation_x + 'vw',
16781                                            y: animation_y + 'vh',
16782                                            filter: 'blur(' + blur + 'px)',
16783                                            rotation: rotate,
16784                                            rotationX: rotate == 0 ? perspective : 0,
16785                                            transformPerspective: '100vw',
16786                                            opacity: parseFloat(opacity)/100,
16787                                            transformOrigin: origin,
16788                                            visibility: 'visible',
16789                                        }
16790                                    )
16791                                    tlConds.fromTo($animateTrgrEl, {
16792                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16793                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16794                                        x: animation_x + 'vw',
16795                                        y: animation_y + 'vh',
16796                                        filter: 'blur(' + blur + 'px)',
16797                                        rotation: rotate,
16798                                        rotationX: rotate == 0 ? perspective : 0,
16799                                        transformPerspective: '100vw',
16800                                        opacity: parseFloat(opacity)/100,
16801                                        transformOrigin: origin,
16802                                        duration: 1,
16803                                    }, {
16804                                        scaleX: 1,
16805                                        scaleY: 1,
16806                                        x: 0,
16807                                        y: 0,
16808                                        filter: 'blur(0px)',
16809                                        rotation: 0,
16810                                        rotationX: 0,
16811                                        opacity: 1,
16812                                        transformOrigin: origin,
16813                                        duration: 1,
16814                                        ease: easeOut,
16815                                        //delay: 0.1
16816                                    });	
16817                                }
16818                            } else {
16819                                if ( radius ) {
16820                                    gsap.set(
16821                                        $animateTrgrEl, {
16822                                            scaleX: parseFloat( scale ) / 100,
16823                                            scaleY: parseFloat( scale ) / 100,
16824                                            opacity: parseFloat(opacity)/100,
16825                                            x: animation_x + 'vw',
16826                                            y: animation_y + 'vh',
16827                                            filter: 'blur(' + blur + 'px)',
16828                                            rotation: rotate,
16829                                            rotationX: rotate == 0 ? perspective : 0,
16830                                            transformPerspective: '100vw',
16831                                            transformOrigin: origin,
16832                                            borderRadius: radius + radius_unit,
16833                                            visibility: 'visible',
16834                                        }
16835                                    )
16836                                    tlConds.fromTo($animateTrgrEl, {
16837                                        scaleX: parseFloat( scale ) / 100,
16838                                        scaleY: parseFloat( scale ) / 100,
16839                                        opacity: parseFloat(opacity)/100,
16840                                        x: animation_x + 'vw',
16841                                        y: animation_y + 'vh',
16842                                        filter: 'blur(' + blur + 'px)',
16843                                        rotation: rotate,
16844                                        rotationX: rotate == 0 ? perspective : 0,
16845                                        transformPerspective: '100vw',
16846                                        borderRadius: radius + radius_unit,
16847                                        transformOrigin: origin,
16848                                        duration: 1,
16849                                    }, {
16850                                        scaleX: 1,
16851                                        scaleY: 1,
16852                                        opacity: 1,
16853                                        x: 0,
16854                                        y: 0,
16855                                        filter: 'blur(0px)',
16856                                        rotation: 0,
16857                                        rotationX: 0,
16858                                        transformOrigin: origin,
16859                                        ease: easeOut,
16860                                        duration: 1,
16861                                        borderRadius: 0 + radius_unit,
16862                                        //delay: 0.1
16863                                    });	
16864                                } else {
16865                                    gsap.set(
16866                                        $animateTrgrEl, {
16867                                            scaleX: parseFloat( scale ) / 100,
16868                                            scaleY: parseFloat( scale ) / 100,
16869                                            opacity: parseFloat(opacity)/100,
16870                                            x: animation_x + 'vw',
16871                                            y: animation_y + 'vh',
16872                                            filter: 'blur(' + blur + 'px)',
16873                                            rotation: rotate,
16874                                            rotationX: rotate == 0 ? perspective : 0,
16875                                            transformPerspective: '100vw',
16876                                            transformOrigin: origin,
16877                                            visibility: 'visible',
16878                                        }
16879                                    )
16880                                    tlConds.fromTo($animateTrgrEl, {
16881                                        scaleX: parseFloat( scale ) / 100,
16882                                        scaleY: parseFloat( scale ) / 100,
16883                                        opacity: parseFloat(opacity)/100,
16884                                        x: animation_x + 'vw',
16885                                        y: animation_y + 'vh',
16886                                        filter: 'blur(' + blur + 'px)',
16887                                        rotation: rotate,
16888                                        rotationX: rotate == 0 ? perspective : 0,
16889                                        transformPerspective: '100vw',
16890                                        transformOrigin: origin,
16891                                        duration: 1,
16892                                    }, {
16893                                        scaleX: 1,
16894                                        scaleY: 1,
16895                                        opacity: 1,
16896                                        x: 0,
16897                                        y: 0,
16898                                        filter: 'blur(0px)',
16899                                        rotation: 0,
16900                                        rotationX: 0,
16901                                        transformOrigin: origin,
16902                                        duration: 1,
16903                                        ease: easeOut,
16904                                        //delay: 0.1
16905                                    });
16906                                }
16907                            }
16908                        } else {
16909                            if ( scale === 'auto' ) {
16910                                tlConds.fromTo($animateTrgrEl, {
16911                                    scaleX: 1,
16912                                    scaleY: 1,
16913                                    opacity: 1,
16914                                    x: 0,
16915                                    y: 0,
16916                                    filter: 'blur(0px)',
16917                                    rotation: 0,
16918                                    rotationX: 0,
16919                                    transformOrigin: origin,
16920                                    duration: 1,
16921                                }, {
16922                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16923                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16924                                    opacity: parseFloat(opacity)/100,
16925                                    x: animation_x + 'vw',
16926                                    y: animation_y + 'vh',
16927                                    filter: 'blur(' + blur + 'px)',
16928                                    rotation: rotate,
16929                                    rotationX: rotate == 0 ? perspective : 0,
16930                                    transformPerspective: '100vw',
16931                                    transformOrigin: origin,
16932                                    duration: 1,
16933                                    ease: easeOut,
16934                                    //delay: 0.1
16935                                })
16936                            } else {
16937                                tlConds.fromTo($animateTrgrEl, {
16938                                    scaleX: 1,
16939                                    scaleY: 1,
16940                                    opacity: 1,
16941                                    x: 0,
16942                                    y: 0,
16943                                    filter: 'blur(0px)',
16944                                    rotation: 0,
16945                                    rotationX: 0,
16946                                    transformPerspective: '100vw',
16947                                    transformOrigin: origin,
16948                                    borderRadius: 0 + radius_unit,
16949                                    duration: 1,
16950                                }, {
16951                                    scaleX: parseFloat( scale ) / 100,
16952                                    scaleY: parseFloat( scale ) / 100,
16953                                    opacity: parseFloat(opacity)/100,
16954                                    x: animation_x + 'vw',
16955                                    y: animation_y + 'vh',
16956                                    filter: 'blur(' + blur + 'px)',
16957                                    rotation: rotate,
16958                                    rotationX: rotate == 0 ? perspective : 0,
16959                                    transformPerspective: '100vw',
16960                                    transformOrigin: origin,
16961                                    borderRadius: radius + radius_unit,
16962                                    duration: 1,
16963                                    ease: easeOut,
16964                                    //delay: 0.1
16965                                })
16966                            }
16967                        }
16968                    }
16969                }
16970
16971                function headingReveal($el){
16972                    txtTrggrStart = true;
16973                    $('.text-reveal', $el).each(function(_key, _val){
16974                        var $txtReveal = $(_val),
16975                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16976                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16977                            $lines = $('.heading-line-wrap', $txtReveal),
16978                            $words = $('.split-word-inner', $txtReveal),
16979                            $chars = $('.split-char', $txtReveal),
16980                            _setTxtReveal,
16981                            $elToReveal = $words;
16982
16983                        if ( !(sticky === 'yes' || stickyCards) ) {
16984                            return;
16985                        }
16986            
16987                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
16988
16989                        if ( dataReveal === 'chars' ) {
16990                            $elToReveal = $chars;
16991                        } else if ( dataReveal === 'lines' ) {
16992                            $elToReveal = $lines;
16993                        }
16994
16995                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
16996                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
16997                        scrllTrggrTxt.pin = false;
16998
16999                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
17000                        var _tl = gsap.timeline({
17001                            scrollTrigger: scrllTrggrTxt
17002                        });
17003                        _tl.fromTo($elToReveal, {
17004                            opacity: dataRevealOpacity,
17005                        }, {
17006                            opacity: 1,
17007                            stagger: 0.05
17008                        });
17009
17010                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
17011                            clearRequestTimeout(_setTxtReveal);
17012                            _setTxtReveal = requestTimeout( function(){
17013                                gsap.set($elToReveal, {clearProps: true});
17014                                _tl.kill(true);
17015                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
17016                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
17017                                }
17018                                headingReveal($el)
17019                            }, 100);
17020                        });
17021
17022                    });
17023                };
17024
17025                if (!txtTrggrStart) {
17026                    headingReveal($el);
17027                }
17028
17029                $scrollTrgrEl.one( 'uncodeWordLines', function(){
17030                    if (!txtTrggrStart) {
17031                        headingReveal($el);
17032                    }
17033                });
17034                
17035                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
17036                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
17037                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
17038                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
17039                    
17040                $(window).on('uncode-sticky-trigger-observe', function(e){
17041                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17042                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
17043                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
17044                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
17045                    if ( stickyCards ) {
17046                        $('.tmb', $scrollTrgrEl).removeAttr('style');
17047                    }
17048                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
17049                    clearRequestTimeout(setTxtReveal);
17050                    setTxtReveal = requestTimeout( function(){
17051                        $(document).trigger('uncode-scrolltrigger-refresh');
17052                        if ( isMobileUsing ) {
17053                            if ( typeof tl !== 'undefined' ) {
17054                                tl.scrollTrigger.refresh();
17055                            }
17056                            if ( typeof tlConds !== 'undefined' ) {
17057                                tlConds.scrollTrigger.refresh();
17058                            }
17059                            $(window).trigger('scroll');
17060                            _width = __width;
17061                        } else if ( _width !== __width && ( isMobileUsing ) ) {
17062                            window.dispatchEvent(new CustomEvent('vc-resize'));
17063                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
17064                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
17065                                    if ( typeof tl !== 'undefined' ) {
17066                                        tl.scrollTrigger.refresh();
17067                                    }
17068                                    if ( typeof tlConds !== 'undefined' ) {
17069                                        tlConds.scrollTrigger.refresh();
17070                                    }
17071                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
17072                                }});
17073                            } else {
17074                                if ( typeof tl !== 'undefined' ) {
17075                                    tl.scrollTrigger.refresh();
17076                                }
17077                                if ( typeof tlConds !== 'undefined' ) {
17078                                    tlConds.scrollTrigger.refresh();
17079                                }
17080                                $(window).trigger('scroll');
17081                            }
17082                            _height = __height;
17083                        }
17084                    }, 500);
17085                });
17086
17087
17088                $(window).on('load ', function(e){
17089                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17090                    if ( _height !== ___height ) {
17091                        $scrollTrgrEl.attr('data-toggled', true);
17092                        $(window).trigger('resize');
17093                        if ( typeof tl !== 'undefined' ) {
17094                            tl.scrollTrigger.refresh();
17095                        }
17096                        if ( typeof tlConds !== 'undefined' ) {
17097                            tlConds.scrollTrigger.refresh();
17098                        }
17099                        _height = ___height;
17100                    }
17101
17102                    
17103                    
17104                    $(document).trigger('uncode-scrolltrigger-refresh');
17105
17106                });
17107
17108            };
17109
17110            var callAreaAnimateScrollTl = function() {
17111                if ( stickyCards ) {
17112                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
17113                        if ( key+1 < cardL || animLast || state !== 'end' ) {
17114                            var $this = $(val),
17115                                last = key+1===cardL;
17116                            areaAnimateScrollTl($this, key, last);
17117                        }
17118                    });
17119                } else {
17120                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
17121                }    
17122            };
17123
17124            $(window).on('wwResize', function(){
17125                if ( !alreadyareaAnimateScrollTl ) {
17126                    if ( noMobile ) {
17127                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17128                            return;
17129                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17130                            return;
17131                        }
17132                    }
17133                    
17134                    callAreaAnimateScrollTl();
17135                }
17136            })
17137
17138            if ( noMobile ) {
17139                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17140                    return;
17141                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17142                    return;
17143                }
17144            }
17145
17146            callAreaAnimateScrollTl();
17147
17148        });
17149
17150    };
17151
17152    areaReveal();
17153
17154};
17155UNCODE.thumbsReveal = function() {
17156
17157    var recalc = false,
17158        thumbsRevealResizeTO;
17159
17160    var isTouchDevice = function() {
17161        return (
17162            'ontouchstart' in window ||
17163            navigator.maxTouchPoints > 0 ||
17164            navigator.msMaxTouchPoints > 0
17165        );
17166    };
17167
17168    var resetThumbsReveal = function() {
17169        $('.tmb-mask-init').each(function(){
17170            var el = this;
17171
17172            if ( el._thumbsRevealST ) {
17173                el._thumbsRevealST.kill();
17174                el._thumbsRevealST = null;
17175            }
17176
17177            if ( el._thumbsRevealIO ) {
17178                el._thumbsRevealIO.disconnect();
17179                el._thumbsRevealIO = null;
17180            }
17181
17182            gsap.set($('img, video, .fluid-object', el), {
17183                clearProps: 'transform'
17184            });
17185
17186            $(el).removeClass('tmb-mask-init');
17187        });
17188
17189        revealThumbs();
17190    };
17191
17192    var revealThumbs = function( $el ){
17193        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
17194            $el = $('body');
17195        }
17196
17197        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
17198            var $container = $(this),
17199                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
17200                isContainer = false;
17201
17202            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
17203                $stickys.each(function(){
17204                    var $sticky = $(this).addClass('tmb-mask-init'),
17205                        $rellax = $sticky.closest('.parallax-el'),
17206                        $inside = $('.t-inside', $sticky),
17207                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
17208                        val = parseFloat( $inside.attr('data-scroll-val') ),
17209                        no_device = $inside.attr('data-anim-no-mobile') === 'yes';
17210
17211                    if ( no_device && isTouchDevice() ) {
17212                        gsap.set($media, {
17213                            clearProps: 'transform'
17214                        });
17215
17216                        return;
17217                    }
17218
17219                    if ( $rellax.length ) {
17220                        recalc = true;
17221                    }
17222
17223                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
17224                    
17225                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
17226
17227                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
17228                            ? val * 0.05 : 0;
17229
17230                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17231                            ? val * 4 : 0;
17232
17233                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17234                            ? parax * 0.01 : 0;
17235
17236                        var isThumbVisible = false;
17237                        var lastProgress = 0;
17238
17239                        var io = null;
17240
17241                        if (typeof IntersectionObserver !== 'undefined') {
17242                            io = new IntersectionObserver(function(entries){
17243                                var entry = entries[0];
17244
17245                                isThumbVisible = !!(
17246                                    entry &&
17247                                    entry.isIntersecting &&
17248                                    entry.intersectionRect &&
17249                                    entry.intersectionRect.width > 0 &&
17250                                    entry.intersectionRect.height > 0
17251                                );
17252
17253                                if (!isThumbVisible) {
17254                                    gsap.set($media, {
17255                                        yPercent: 0,
17256                                        scale: 1 + extra
17257                                    });
17258                                }
17259                            }, {
17260                                root: null,
17261                                threshold: 0.01
17262                            });
17263
17264                            io.observe($sticky[0]);
17265
17266                            $sticky[0]._thumbsRevealIO = io;
17267                        }
17268
17269                        var st = ScrollTrigger.create({
17270                            trigger: $sticky[0],
17271                            scrub: true,
17272                            start: 'top bottom',
17273                            end: 'bottom top',
17274                            onUpdate: function(self) {
17275                                lastProgress = self.progress;
17276
17277                                if (!isThumbVisible) return;
17278
17279                                var currentY = gsap.utils.interpolate(-parax, parax, lastProgress);
17280                                var currentScale = gsap.utils.interpolate(1 + zoom + extra, 1 + extra, lastProgress);
17281
17282                                gsap.set($media, {
17283                                    yPercent: currentY,
17284                                    scale: currentScale
17285                                });
17286                            }
17287                        });
17288
17289                        $sticky[0]._thumbsRevealST = st;
17290
17291                        if ( recalc ) {
17292                            $(window).on('uncode-thumbsreveal-refresh', function(){
17293                                if ( st ) {
17294                                    st.refresh();
17295                                }
17296                            });
17297                        }
17298                    }
17299                });
17300            }
17301
17302            if ( $container.has('.tmb-mask-reveal') ) {
17303                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
17304                    staggerTime = 0.1;
17305
17306                $('.t-inside', $container).each(function(){
17307                    var checkEasing = $(this).attr('data-easing');
17308
17309                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
17310                        gsap.registerPlugin(CustomEase);
17311                        return false;
17312                    }
17313                });
17314
17315                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
17316                    $markTrigger = $container;
17317                    isContainer = true;
17318                    staggerTime = 0;
17319                }
17320
17321                ScrollTrigger.batch( $markTrigger, {
17322                    start: function( el ){
17323                        return "top 96%";
17324                    },
17325                    onEnter: function(batch){
17326                        var $inside = $(batch).closest('.t-inside');
17327
17328                        if ( isContainer ) {
17329                            $inside = $(batch).find('.t-inside').first();
17330                        }
17331
17332                        var delay = parseFloat( $inside.attr('data-delay') ),
17333                            speed = parseFloat( $inside.attr('data-speed') ),
17334                            easing = $inside.attr('data-easing'),
17335                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
17336
17337                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay / 1000;
17338                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed / 1000;
17339                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
17340                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
17341
17342                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
17343                            gsap.to($('.t-entry-visual-tc', batch), speed, {
17344                                clipPath: 'inset(0% 0% 0% 0%)',
17345                                stagger: staggerTime,
17346                                delay: delay,
17347                                ease: easing
17348                            });
17349
17350                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17351                                clipPath: 'inset(0% 0% 0% 0%)',
17352                                stagger: staggerTime,
17353                                scale: 1,
17354                                delay: delay + (speed * bgDelay),
17355                                ease: easing
17356                            });
17357                        } else {
17358                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17359                                clipPath: 'inset(0% 0% 0% 0%)',
17360                                stagger: staggerTime,
17361                                scale: 1,
17362                                delay: delay,
17363                                ease: easing
17364                            });
17365                        }
17366                    }
17367                });
17368            }
17369        });
17370
17371        function raf(time) {
17372            requestAnimationFrame(raf);
17373            $(window).trigger('uncode-thumbsreveal-refresh');
17374        }
17375
17376        if ( recalc ) {
17377            requestAnimationFrame(raf);
17378        }
17379    };
17380
17381    $(window).on( 'load more-items-loaded', function(){
17382        revealThumbs();
17383    });
17384
17385    $(document).on('uncode-ajax-filtered', function(){
17386        revealThumbs();
17387    });
17388
17389    $(window).on('resize orientationchange', function(){
17390        clearTimeout(thumbsRevealResizeTO);
17391
17392        thumbsRevealResizeTO = setTimeout(function(){
17393            resetThumbsReveal();
17394        }, 150);
17395    });
17396
17397    document.addEventListener('uncode:marquee:ready', function(e) {
17398        if (!e || !e.detail || !e.detail.baseWrap) return;
17399
17400        var parent = e.detail.parent || e.detail.baseWrap;
17401        var $marquee = $(e.detail.baseWrap);
17402
17403        if (e.detail.leftWrap) {
17404            $marquee = $marquee.add(e.detail.leftWrap);
17405        }
17406
17407        if (e.detail.rightWrap) {
17408            $marquee = $marquee.add(e.detail.rightWrap);
17409        }
17410
17411        if (parent._uncodeThumbsRevealT) {
17412            clearRequestTimeout(parent._uncodeThumbsRevealT);
17413        }
17414
17415        parent._uncodeThumbsRevealT = requestTimeout(function() {
17416            $('.tmb-mask-init', $marquee).removeClass('tmb-mask-init');
17417            revealThumbs($marquee);
17418            parent._uncodeThumbsRevealT = null;
17419        }, 20);
17420    }, false);
17421    
17422    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
17423        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
17424            var $el = model.view.$el,
17425                shortcode = model.attributes.shortcode;
17426
17427            if ( $el.is('.custom-grid-container') ) {
17428                $el = $el.parent();
17429            }
17430
17431            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
17432                revealThumbs($el);
17433            }
17434        });
17435    }
17436
17437};
17438UNCODE.revslider = function() {
17439	var revSlider6In = function(){
17440		$('rs-module').each(function(){
17441			var $slider = $(this);
17442
17443			$slider.on('revolution.slide.onloaded', function(e, data){
17444				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17445					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
17446						scrolltop = $(document).scrollTop();
17447					if ( style != undefined ) {
17448						UNCODE.switchColorsMenu(scrolltop, style);
17449					}
17450				}
17451			});
17452
17453			$slider.on('revolution.slide.onchange', function(e, data){
17454				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17455					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
17456						scrolltop = $(document).scrollTop();
17457					if ( style != undefined ) {
17458						UNCODE.switchColorsMenu(scrolltop, style);
17459					}
17460				}
17461			});
17462
17463		});
17464
17465	};
17466	revSlider6In();
17467	$(window).on("load", revSlider6In );
17468
17469	document.addEventListener("sr.module.ready", function(e) { 
17470		var $slider = $('#'+e.id),
17471			settings = SR7.JSON[e.id];
17472
17473		if ( typeof settings !== 'undefined' && settings !== null ) {
17474			if ( $slider.closest(".header-revslider").length ) {
17475				var style = settings.slides[1].slide.attr.data,
17476					scrolltop = $(document).scrollTop();
17477				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17478				style = style[1];
17479				if ( style[1] != undefined ) {
17480					UNCODE.switchColorsMenu(scrolltop, style);
17481				}
17482			}
17483		}
17484	});
17485
17486	document.addEventListener("sr.slide.afterChange", function(e) {
17487		var $slider = $('#'+e.id),
17488			settings = SR7.JSON[e.id];
17489
17490		if ( typeof settings !== 'undefined' && settings !== null ) {
17491			if ( $slider.closest(".header-revslider").length ) {
17492				var style = settings.slides[e.current.id].slide.attr.data,
17493					scrolltop = $(document).scrollTop();
17494				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17495				style = style[1];
17496				if ( style != undefined ) {
17497					UNCODE.switchColorsMenu(scrolltop, style);
17498				}
17499			}
17500		}
17501	});
17502
17503};
17504UNCODE.layerslider = function() {
17505	$(window).on("load", function() {
17506
17507		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
17508
17509			var slideData = slider.slides.current.data,
17510				scrolltop = $(document).scrollTop();
17511			if( slideData && slideData.skin ) {
17512
17513				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
17514
17515			}
17516		});
17517
17518	});
17519};
17520
17521UNCODE.ajax_filters = function () {
17522	var isAjaxing = false;
17523
17524/*************************
17525 *
17526 * Filters Menu and Widgets Area
17527 *
17528 ************************/
17529
17530 	var clear_clicked = false;
17531
17532 	var init_ajax_grid = function(){
17533
17534		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
17535		$grids.each(function(index, val){
17536			var $body = $('body'),
17537				$grid = $(val).addClass('init-ajax-grid'),
17538				starting_point = $grid.attr('data-toggle'),
17539				$trigger = $('.uncode-toggle-ajax-filters', $grid),
17540				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
17541				$isotope_wrapper = $('.isotope-wrapper', $grid),
17542				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
17543				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
17544				$footprint = $('.ajax-filter-footprint', $grid),
17545				sidebar_w,
17546				data_w = parseFloat( $sidebar.attr('data-max-width') ),
17547				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
17548				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
17549				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
17550				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17551				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
17552				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
17553				sidew,
17554				$inside_row = $('> .row-parent', $vc_row),
17555				bg_row,
17556				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
17557				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
17558				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
17559				sidebar_overlay = false,
17560				sidebar_hover = false,
17561				switchMobile = false,
17562				scrollTop;
17563
17564			if ( $vc_row.attr('class') ) {
17565				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
17566			}
17567
17568			if ( bg_row != null ) {
17569				$side_header.add($side_footer).addClass(bg_row[0]);
17570			}
17571
17572			$trigger.add($apply_filters).on('click', function(e){
17573				e.preventDefault();
17574				e.stopPropagation();
17575				$grid = $('.ajax-grid-system').eq(0);
17576				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17577				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17578				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17579				sidebar_w = $sidebar_wrapper.width();
17580				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17581				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
17582					$(this).trigger('uncode-ajax-clear-filters');
17583				}
17584				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17585					$grid.toggleClass('ajax-hide-filters-blanks');
17586					$sidebar.slideToggle({
17587						duration: 400,
17588						easing: 'easeOutQuad',
17589					});
17590				} else {
17591					$grid.removeClass('ajax-hide-filters-blanks');
17592					$grid.toggleClass('ajax-hide-filters');
17593					if ( $grid.hasClass('ajax-hide-filters') ) {
17594						$body.addClass('ajax-hide-filters');
17595					} else {
17596						scrollTop = $('html, body').scrollTop();
17597						$body.removeClass('ajax-hide-filters');
17598					}
17599				}
17600				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17601					$('html, body').scrollTop(scrollTop);
17602				}
17603				return false;
17604			});
17605
17606			$close_btn.on('click', function(e){
17607				e.preventDefault();
17608				$grid = $('.ajax-grid-system').eq(0);
17609				$grid.addClass('ajax-hide-filters');
17610				if ( $grid.hasClass('ajax-hide-filters') ) {
17611					$body.addClass('ajax-hide-filters');
17612				} else {
17613					scrollTop = $('html, body').scrollTop();
17614					$body.removeClass('ajax-hide-filters');
17615				}
17616				$('html, body').scrollTop(scrollTop);
17617			});
17618
17619			$sidebar_wrapper.on('mouseover',function(){
17620				sidebar_hover = true;
17621			}).on('mouseout', function(){
17622				sidebar_hover = false;
17623			});
17624
17625			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
17626				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
17627					return;
17628				}
17629				if (undefined !== from && from === 'select_active_attributes') {
17630					return;
17631				}
17632				if ($(e.target).closest('.select2-container--open').length ) {
17633					return;
17634				}
17635				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
17636					$grid.add($body).addClass('ajax-hide-filters');
17637				}
17638			});
17639
17640			$sorting_trgr.on('click', function(e) {
17641				e.preventDefault();
17642			});
17643
17644			var inside_width = function(){
17645				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17646				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17647				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17648				$inside_row = $('> .row-parent', $vc_row);
17649				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
17650					sidew = $sidebar.width();
17651					$inside_row.css({
17652						width: sidew
17653					});
17654				} else {
17655					$inside_row.css({
17656						width: ''
17657					});
17658				}
17659			};
17660			inside_width();
17661
17662			var ajax_sidebar_position = function(e, f_editor){
17663				$grid = $('.ajax-grid-system').eq(0);
17664				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17665				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17666				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17667				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17668				$inside_row = $('> .row-parent', $vc_row);
17669				scrollTop = $('html, body').scrollTop();
17670				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery) || overlay_desktop ) ) {
17671					if ( switchMobile !== true ) {
17672						$grid.add($body).addClass('ajax-hide-filters');
17673						$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
17674						$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
17675						sidebar_overlay = true;
17676						$body.addClass('ajax-filter-sidebar-overlay');
17677						$sidebar_wrapper.addClass(skin);
17678						var sideHeadH = $side_header.outerHeight(),
17679							sideFooterH = $side_footer.outerHeight();
17680						if ( data_w !== '' && data_w > 0 ) {
17681							if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
17682								$sidebar.css({
17683									'max-width': data_w
17684								});
17685							} else {
17686								$sidebar.css({
17687									'max-width':'none'
17688								});
17689							}
17690						}
17691						$vc_row.css({
17692							'padding-top':sideHeadH,
17693							'padding-bottom':sideFooterH
17694						}).attr('data-lenis-prevent', true);
17695						var sidew = $sidebar.width();
17696						$inside_row.css({
17697							width: sidew
17698						});
17699						switchMobile = true;
17700					}
17701				} else {
17702					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
17703						scrollTop = $('html, body').scrollTop();
17704						$grid.add($body).removeClass('ajax-hide-filters');
17705					}
17706					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
17707						$grid.addClass('ajax-hide-filters-blanks');
17708						$sidebar.hide();
17709					}
17710					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
17711					$('.ajax-sidebar-placeholder', $grid).remove();
17712					sidebar_overlay = false;
17713					$body.removeClass('ajax-filter-sidebar-overlay');
17714					$sidebar_wrapper.removeClass(skin);
17715					if ( data_w !== '' && data_w > 0 ) {
17716						$sidebar.css({
17717							'max-width':'none'
17718						});
17719					}
17720					$vc_row.css({
17721						'padding-top':0,
17722						'padding-bottom':0,
17723					}).removeAttr('data-lenis-prevent');
17724
17725					$inside_row.css({
17726						width: ''
17727					});
17728
17729					if ( f_editor === true ) {
17730						UNCODE.ajax_filters();
17731					}
17732
17733					switchMobile = false;
17734				}
17735				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17736					$('html, body').scrollTop(scrollTop);
17737				}
17738			};
17739
17740			var sidebar_width = function(){
17741				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17742					sidebar_w = $footprint.width();
17743					$sidebar.css({ width: sidebar_w });
17744				} else {
17745					$sidebar.css({ width: '' });
17746				}
17747			};
17748			sidebar_width();
17749
17750			if ( SiteParameters.is_frontend_editor ) {
17751				ajax_sidebar_position();
17752			}
17753
17754			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
17755				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
17756					ajax_sidebar_position(e);
17757				}
17758				sidebar_width();
17759			});
17760
17761			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
17762				ajax_sidebar_position(e, true);
17763			});
17764
17765			$isotope_wrapper.on('transitionend', function(e){
17766				if ( $(e.target).hasClass('isotope-wrapper') ) {
17767					window.dispatchEvent(new CustomEvent('boxResized'));
17768				}
17769				return false;
17770			});
17771
17772			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
17773				var $grid = $('.ajax-grid-system').eq(0);
17774				$grid.addClass('ajax-hide-filters');
17775			}
17776
17777		});
17778	};
17779
17780	init_ajax_grid();
17781	$(document).on('uncode-ajax-filtered', init_ajax_grid);
17782
17783/*************************
17784 *
17785 * Hover hack
17786 *
17787 ************************/
17788 	var widget_hover_hack = function() {
17789 		$('.widget, .uncode_widget').each(function(){
17790			var $widget = $(this),
17791				class_w = $widget.attr('class'),
17792				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
17793				$footer = $widget.closest('#colophon');
17794
17795			if ( class_w.indexOf('widget_yith') > 0 ) {
17796				return true;
17797			}
17798
17799			$lis.each(function(){
17800 				var $li = $(this),
17801 					$a = $('a', $li),
17802 					$label = $a.closest('label');
17803
17804				if ( !$footer.length ) {
17805					$li.addClass('no-evts');
17806				}
17807
17808				if ( ! $('span', $a).length ) {
17809 					$li.addClass( 'li-hover' );
17810 				}
17811
17812 				$('li', $li).hover(function(e){
17813 					$(e.target).parents('li').each(function(){
17814 						$(this).addClass( 'parent-li-hover' );
17815 					});
17816					}, function (e) {
17817 					$(e.target).parents('li').each(function(key, val){
17818 						if ( key === 0) {
17819	 						$(val).removeClass( 'parent-li-hover' );
17820	 					}
17821 					});
17822 				});
17823
17824				$li.off('mouseup').on('mouseup', function (e) {
17825					if (e.which !== 3) {
17826						e.stopPropagation();
17827						var $a = $('a', this).first();
17828						$a[0].click();
17829					}
17830	 			});
17831 			});
17832 		});
17833	  }
17834
17835	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
17836
17837	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
17838		widget_hover_hack();
17839		$(document).on('uncode-ajax-filtered', widget_hover_hack);
17840	}
17841
17842/*************************
17843 *
17844 * Init Filters
17845 *
17846 ************************/
17847
17848	function init_filters() {
17849		$(document).on('click', '.term-filter-link', function(e) {
17850			var _this = $(this);
17851			var widget = _this.closest('.uncode_widget');
17852			var container = get_filters_container();
17853
17854			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17855				return true;
17856			}
17857
17858			e.preventDefault();
17859
17860			if (widget.hasClass('widget-ajax-filters--checkbox')) {
17861				_this.parent().find('input[type="checkbox"]').trigger('click');
17862			} else {
17863				if (_this.hasClass('term-filter-link--active')) {
17864					_this.removeClass('term-filter-link--active');
17865				} else {
17866					_this.addClass('term-filter-link--active');
17867
17868					if (widget.hasClass('widget-ajax-filters--single')) {
17869						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
17870					}
17871				}
17872
17873				if (!ajax_filters_button_mode) {
17874					var url = _this.attr('href');
17875
17876					reload_items(container, url, true);
17877				}
17878			}
17879		});
17880
17881		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
17882			var _this = $(this);
17883			var widget = _this.closest('.uncode_widget');
17884			var link = _this.closest('.term-filter').find('.term-filter-link');
17885			var url = link.attr('href');
17886			var container = get_filters_container();
17887
17888			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
17889				window.location = url;
17890				return;
17891			}
17892
17893			if (widget.hasClass('widget-ajax-filters--single')) {
17894				widget.find('input[type="checkbox"]').each(function() {
17895					if (_this.attr('id') !== $(this).attr('id')) {
17896						$(this).prop('checked', false);
17897						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
17898					}
17899				});
17900			}
17901
17902			if (_this.prop('checked')) {
17903				link.addClass('term-filter-link--active');
17904			} else {
17905				link.removeClass('term-filter-link--active');
17906			}
17907
17908			if (!ajax_filters_button_mode) {
17909				reload_items(container, url, true);
17910			}
17911		});
17912
17913		$(document).on('change', 'select.select--term-filters', function(e) {
17914			var _this = $(this);
17915			var selected = _this.find('option:selected');
17916			var option = $(selected);
17917			var url = option.attr('data-term-filter-url');
17918			var container = get_filters_container();
17919			var widget = _this.closest('.uncode_widget');
17920
17921			if (!ajax_filters_button_mode) {
17922				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17923					window.location = url;
17924				} else {
17925					reload_items(container, url, true);
17926				}
17927			}
17928		});
17929
17930		$(document).on('click', '.filter-list__link', function(e) {
17931			if (SiteParameters.is_frontend_editor) {
17932				return false;
17933			}
17934
17935			e.preventDefault();
17936
17937			var _this = $(this);
17938			var container = get_filters_container();
17939			var url = _this.attr('href');
17940			reload_items(container, url, true);
17941		});
17942
17943		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
17944			var _this = $(this);
17945			var container = get_filters_container();
17946			var url = _this.attr('href');
17947			reload_items(container, url, true);
17948		});
17949
17950		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
17951
17952			var _this = $(this);
17953			var container = get_filters_container();
17954			var url = _this.attr('href');
17955
17956			if ( container.length ) {
17957				e.preventDefault();
17958				reload_items(container, url, true);
17959			}
17960		});
17961
17962		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
17963			var _this = $(this);
17964			var container = get_filters_container();
17965
17966			if (container.length > 0) {
17967				e.preventDefault();
17968
17969				var min_price = $('#min_price').val();
17970				var max_price = $('#max_price').val();
17971				var location = window.location;
17972				var url = location.href;
17973				var page_uri = location.origin + location.pathname;
17974				var is_filtered = page_uri !== url;
17975
17976				if (is_filtered) {
17977					url = remove_parameter_from_url(url, 'min_price');
17978					url = remove_parameter_from_url(url, 'max_price');
17979				}
17980
17981				var concat = page_uri === url ? '?' : '&';
17982				var params = {'min_price': min_price, 'max_price': max_price};
17983
17984				url = url + concat + $.param(params);
17985
17986				reload_items(container, url, true);
17987			}
17988		});
17989
17990		if (!ajax_filters_button_mode && !window._uncode_search_bound) {
17991			window._uncode_search_bound = true;
17992			var search_timeout = parseInt(SiteParameters.ajax_filter_search_timeout, 10);
17993
17994			$(document).on('input', '.term-filters-search-input', function () {
17995				var _this = $(this);
17996				var container = get_filters_container();
17997				var value = _this.val();
17998
17999				if (window._uncode_search_timer) {
18000					clearTimeout(window._uncode_search_timer);
18001				}
18002
18003				window._uncode_search_timer = setTimeout(function () {
18004					update_search_url(container, value);
18005				}, search_timeout);
18006			});
18007		}
18008
18009		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
18010			var container = get_filters_container();
18011
18012			if (container.length) {
18013				e.preventDefault();
18014				var paramMap = {};
18015
18016				$('.term-filter-link--active').each(function () {
18017					collect_from_query(paramMap, this.href.split('?')[1] || '');
18018				});
18019
18020				$('.select--term-filters').each(function () {
18021					var select = $(this);
18022					var val = select.val();
18023
18024					if (!val) {
18025						return
18026					};
18027
18028					var selected_option = select.find('option:selected');
18029					var qUrl = selected_option.data('term-filter-url') || '';
18030
18031					collect_from_query(paramMap, qUrl.split('?')[1] || '');
18032				});
18033
18034				var search = $('.term-filters-search-input');
18035
18036				if (search.length > 0) {
18037					var search_value = search.val().trim();
18038					if (search_value) {
18039						paramMap[SiteParameters.ajax_filter_key_search] = {};
18040						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
18041					}
18042				}
18043
18044				var qsParts = [];
18045				$.each(paramMap, function (key, valSet) {
18046					var vals = Object.keys(valSet);
18047					qsParts.push(key + '=' + vals.join(','));
18048				});
18049
18050				var final_url = window.location.origin + window.location.pathname;
18051
18052				if (qsParts.length > 0) {
18053					qsParts.push('unfilter=1');
18054
18055					var qs = qsParts.join('&');
18056					final_url = '?' + qs;
18057				}
18058
18059				reload_items(container, final_url, true);
18060			}
18061		});
18062	}
18063
18064	function collect_from_query(paramMap, query) {
18065		$.each(query.split('&'), function (_, pair) {
18066			if (!pair) {
18067				return
18068			};
18069
18070			var kv  = pair.split('=');
18071			var key = kv[0];
18072			var val = kv[1] || '';
18073
18074			if (key === 'unfilter') {
18075				return;
18076			}
18077			if (!paramMap[key]) {
18078				paramMap[key] = {}
18079			};
18080
18081			paramMap[key][val] = 1;
18082		});
18083	}
18084
18085	function update_search_url(container, search_value) {
18086		var location = window.location;
18087		var url = location.href;
18088		var page_uri = location.origin + location.pathname;
18089		var is_filtered = page_uri !== url;
18090		var key_search = SiteParameters.ajax_filter_key_search;
18091		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
18092
18093		if (is_filtered) {
18094			url = remove_parameter_from_url(url, key_search);
18095			url = remove_parameter_from_url(url, key_unfilter);
18096		}
18097
18098		if (search_value) {
18099			var concat = page_uri === url ? '?' : '&';
18100			var params = {};
18101
18102			params[key_search] = search_value;
18103			params[key_unfilter] = 1;
18104			url = url + concat + $.param(params);
18105		} else {
18106			url = remove_parameter_from_url(url, key_search);
18107		}
18108
18109		reload_items(container, url, true);
18110	}
18111
18112	function remove_parameter_from_url(url, parameter) {
18113		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
18114	}
18115
18116	function get_filters_container() {
18117		var container = $('.ajax-grid-system');
18118
18119		if (container.length == 0) {
18120			container = $('.ajax-filters-target');
18121		}
18122
18123		return container;
18124	}
18125
18126	function update_widgets_state(widgets_states, container) {
18127		for (var i = widgets_states.length - 1; i >= 0; i--) {
18128			var state = widgets_states[i];
18129
18130			if (!state.collapse) {
18131				continue;
18132			}
18133
18134			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
18135
18136			if (state.open) {
18137				new_widget.find('.widget-title').addClass('open');
18138				if (state.css) {
18139					new_widget.find('.widget-collapse-content').attr('style', state.css);
18140				}
18141			} else {
18142				new_widget.find('.widget-title').removeClass('open');
18143				if (state.css) {
18144					new_widget.find('.widget-collapse-content').attr('style', state.css);
18145				}
18146			}
18147		}
18148	}
18149
18150	// Find filters container
18151	function find_filters_container(context) {
18152		const widget = context.find('.widget-ajax-filters').first();
18153		if (!widget.length) return $();
18154
18155		const sidebar = widget.closest('.ajax-filters-sidebar');
18156		if (sidebar.length) {
18157			return sidebar.find('.uncol').last();
18158		}
18159
18160		const col = widget.closest('.uncol');
18161		if (col.length) {
18162			return col;
18163		}
18164
18165		return $();
18166	}
18167
18168	// Reload items via AJAX
18169	function reload_items(container, url, push) {
18170		if (isAjaxing) {
18171			return
18172		};
18173
18174		isAjaxing = true;
18175
18176		container.addClass('grid-filtering');
18177
18178		$.ajax({
18179			url     : url,
18180			success : function(response) {
18181				if (!response) {
18182					return;
18183				}
18184
18185				$(document).trigger('uncode-ajax-pre-filtered');
18186
18187				var container_id = container.attr('id');
18188				var pagination = $('.row-navigation');
18189				var filters_container;
18190
18191				var isTargetFilterMode = container.hasClass('ajax-filters-target');
18192
18193				if (isTargetFilterMode) {
18194					filters_container = find_filters_container($(document));
18195				}
18196
18197				if (container_id) {
18198					var container_to_append = $(response).find('#' + container_id);
18199					var pagination_to_append = $(response).find('.row-navigation');
18200					var filters_to_append;
18201					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18202
18203					if (isTargetFilterMode) {
18204						filters_to_append = find_filters_container($(response));
18205					}
18206
18207					// Remember open/closed widgets
18208					var widgets = $('.uncode_widget');
18209					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
18210					var widgets_states = [];
18211
18212					widgets.each(function() {
18213						var widget = $(this);
18214						var id = widget.attr('data-id');
18215						var state = {
18216							'id': id,
18217							'collapse': false,
18218							'open': false,
18219							'css': false,
18220						};
18221
18222						var collapse_wrapper = widget.find('.widget-collapse-content');
18223
18224						if (collapse_wrapper.length > 0) {
18225							state.collapse = true;
18226
18227							var collapse_wrapper_css = collapse_wrapper.attr('style');
18228							var title = widget.find('.widget-title');
18229
18230							state.css = collapse_wrapper_css;
18231
18232							if (title.hasClass('open')) {
18233								state.open = true;
18234							} else {
18235								state.open = false;
18236							}
18237						}
18238
18239						widgets_states.push(state);
18240					});
18241
18242					// Update widgets state when it is not in target mode
18243					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
18244						update_widgets_state(widgets_states, container_to_append);
18245					}
18246
18247					// Update default sidebar state
18248					if (!container.hasClass('ajax-hide-filters')) {
18249						container_to_append.removeClass('ajax-hide-filters');
18250					}
18251
18252					// Update horizontal sidebar
18253					if (!container.hasClass('ajax-hide-filters-blanks')) {
18254						container_to_append.removeClass('ajax-hide-filters-blanks');
18255					}
18256					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
18257					if (horizontal_sidebar_wrapper.length > 0) {
18258						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
18259						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
18260						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
18261						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
18262
18263						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
18264						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
18265					}
18266
18267					// Append container
18268					container.replaceWith(container_to_append);
18269
18270					// Hide first thumbnail until the new srcset is loaded
18271					if (SiteParameters.dynamic_srcset_active === '1') {
18272						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
18273					}
18274
18275					// Remove loading attribute to images
18276					container_to_append.find('img').attr('loading', '');
18277
18278					// Append pagination
18279					if (pagination.length > 0) {
18280						if (pagination_to_append.length > 0) {
18281							pagination.html(pagination_to_append.html());
18282						} else {
18283							pagination.html('');
18284						}
18285					} else {
18286						if (pagination_to_append.length > 0) {
18287							$('.post-wrapper').append(pagination_to_append);
18288						}
18289					}
18290
18291					// Append filters
18292					if (isTargetFilterMode && filters_container.length > 0) {
18293						filters_container.html(filters_to_append.html());
18294					}
18295
18296					// Update widgets state when it is in target mode
18297					if (isTargetFilterMode && filters_container.length > 0) {
18298						update_widgets_state(widgets_states, filters_container);
18299					}
18300
18301					// Update off canvas sidebar (mobile and overlay)
18302					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18303
18304					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
18305						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
18306						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
18307						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
18308						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
18309
18310						// Update widgets state
18311						update_widgets_state(widgets_states, sidebar_to_append);
18312
18313						// Update sidebar
18314						sidebar_container.html(sidebar_to_append.html());
18315					}
18316
18317					if (push) {
18318						UNCODE.lastURL = url;
18319						window.history.pushState(
18320							{ pageTitle: document.title },
18321							'',
18322							url
18323						);
18324					}
18325
18326					if (typeof UNCODE.isotopeLayout !== 'undefined') {
18327						UNCODE.isotopeLayout();
18328					}
18329					if (typeof UNCODE.justifiedGallery !== 'undefined') {
18330						UNCODE.justifiedGallery();
18331					}
18332					if (typeof UNCODE.cssGrid !== 'undefined') {
18333						UNCODE.cssGrid();
18334					}
18335					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
18336						UNCODE.lightbox();
18337					}
18338					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
18339						UNCODE.lightgallery();
18340					}
18341					if (typeof UNCODE.carousel !== 'undefined') {
18342						UNCODE.carousel($('body'));
18343					}
18344					UNCODE.animations();
18345					if (typeof UNCODE.filters !== 'undefined') {
18346						UNCODE.filters();
18347					}
18348					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
18349						UNCODE.widgets();
18350					}
18351
18352					if (SiteParameters.dynamic_srcset_active === '1') {
18353						UNCODE.refresh_dynamic_srcset_size();
18354					}
18355
18356					if (typeof UNCODE.menuSmartInit !== 'undefined') {
18357						UNCODE.menuSmartInit();
18358					}
18359
18360					if (typeof UNCODE.parallax !== 'undefined') {
18361						UNCODE.parallax();
18362					}
18363
18364					maybe_scroll_to_top();
18365
18366					var woo_select2_cats = $('.dropdown_product_cat');
18367
18368					if (woo_select2_cats.length > 0) {
18369						woo_select2_cats.on( 'change', function() {
18370							if ( $(this).val() != '' ) {
18371								var this_page = '';
18372								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
18373								if ( home_url.indexOf( '?' ) > 0 ) {
18374									this_page = home_url + '&product_cat=' + $(this).val();
18375								} else {
18376									this_page = home_url + '?product_cat=' + $(this).val();
18377								}
18378								location.href = this_page;
18379							} else {
18380								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
18381							}
18382						});
18383
18384						if ( $().selectWoo ) {
18385							var wc_product_cat_select = function() {
18386								woo_select2_cats.selectWoo( {
18387									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
18388									minimumResultsForSearch: 5,
18389									width: '100%',
18390									allowClear: true,
18391									language: {
18392										noResults: function() {
18393											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
18394										}
18395									}
18396								} );
18397							};
18398							wc_product_cat_select();
18399						}
18400					}
18401
18402					$(document).trigger('uncode-ajax-filtered');
18403					$(document.body).trigger('init_price_filter');
18404					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
18405					window.document.dispatchEvent(new Event("DOMContentLoaded", {
18406						bubbles: true,
18407						cancelable: true
18408					}));
18409
18410					isAjaxing = false;
18411				}
18412			},
18413			error: function() {
18414				container.removeClass('grid-filtering');
18415
18416				isAjaxing = false;
18417
18418				if (SiteParameters.enable_debug == true) {
18419					// This console log is disabled by default
18420					// So nothing is printed in a typical installation
18421					//
18422					// It can be enabled for debugging purposes setting
18423					// the 'uncode_enable_debug_on_js_scripts' filter to true
18424					console.log('There was an error retrieving the products');
18425				}
18426			}
18427		});
18428	}
18429
18430	// Scroll to top after filtering
18431	function maybe_scroll_to_top() {
18432		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18433
18434		if (offcanvas_sidebar_wrapper.length > 0) {
18435			return;
18436		}
18437
18438		var container = get_filters_container();
18439		var bound = container[0].getBoundingClientRect();
18440
18441		if (bound.y < 0) {
18442			$(window).scrollTop(container.offset().top);
18443		}
18444	}
18445
18446	// Back/forward browser buttons
18447	$(window).on("popstate.ajaxfilters", function(e) {
18448		var location = window.location;
18449		var url = location.href;
18450		var params = UNCODE.getURLParams(window.location);
18451		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
18452
18453		UNCODE.lastURL = url;
18454
18455		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
18456			return;
18457		}
18458
18459		var container = get_filters_container();
18460
18461		reload_items(container, url, false);
18462	});
18463
18464	// Destroy load more before to init a new one
18465	$(window).on('uncode-ajax-pre-filtered', function() {
18466		if ($.fn.infinitescroll) {
18467			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
18468		}
18469	});
18470
18471	init_filters();
18472};
18473
18474UNCODE.videoThumbs = function() {
18475	var checkResize,
18476		newW = UNCODE.wwidth;
18477	var checkForVideos = function(){
18478
18479		$(window).on('okevents.y.change', function(e, y){
18480			var $video = $(y.target.g),
18481				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18482				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18483				restart = !$video_wrap.hasClass('play-pause'),
18484				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18485				setTime;
18486			if ( newW >= UNCODE.mediaQuery ) {
18487
18488				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
18489					$video_wrap.data('hovered', true);
18490					$video_wrap.addClass('played-on');
18491					y.target.pauseVideo();
18492					$tmb.on('mouseenter', function(){
18493						if ( restart ) {
18494							y.target.seekTo(0);
18495						}
18496						y.target.playVideo();
18497					}).on('mouseleave', function(){
18498						clearTimeout(setTime);
18499						setTime = setTimeout(function(){
18500							y.target.pauseVideo();
18501						}, 300);
18502					});
18503				}
18504
18505			} else {
18506				if( $mobile_video_wrap.length ) {
18507					$video_wrap.addClass('played-on');
18508					y.target.playVideo();
18509				}
18510			}
18511
18512		});
18513
18514		$(window).on('okevents.v.loaded', function(e, playerV){
18515			var $video = $(playerV.element),
18516				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18517				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18518				restart = !$video_wrap.hasClass('play-pause'),
18519				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
18519: $video.closest('.t-entry-visual, .un-inline-image'),
18520				setTime;
18521
18522			if ( newW >= UNCODE.mediaQuery ) {
18523				
18524				if( $video_wrap.length ) {
18525
18526					var playPromise = playerV.play();
18527					if (playPromise !== undefined) {
18528						playPromise.then(function( value ) {
18529							playerV.pause();
18530						});
18531					}
18532					$video_wrap.addClass('played-on');
18533					$tmb.on('mouseenter', function(){
18534						if ( restart ) {
18535							playerV.setCurrentTime(0)
18536						}
18537						playerV.play();
18538					}).on('mouseleave', function(){
18539						clearTimeout(setTime);
18540						setTime = setTimeout(function(){
18541							playerV.pause();
18542						}, 300);
18543					});
18544				}
18545
18546			} else {
18547
18548				if( $mobile_video_wrap.length ) {
18549					var playPromise = playerV.play();
18550					if (playPromise !== undefined) {
18551						playPromise.then(function( value ) {
18552							playerV.play();
18553						});
18554					}
18555					$video_wrap.addClass('played-on');
18556				}
18557			}
18558		});
18559
18560		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
18561			var $video = $(video),
18562				$noscript = $('noscript', $video),
18563				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18564				restart = !$video_wrap.hasClass('play-pause'),
18565				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18566				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18567				setTime,
18568			manageVideo = function(){
18569				video.currentTime = 0;
18570				video.pause();
18571				if ( newW >= UNCODE.mediaQuery ) {
18572					if ( $video_wrap.length ) {
18573						$video_wrap.addClass('played-on');
18574						$tmb.on('mouseenter', function(){
18575							if ( restart ) {
18576								video.currentTime = 0;
18577							}
18578							video.play();
18579						}).on('mouseleave', function(){
18580							clearTimeout(setTime);
18581							setTime = setTimeout(function(){
18582								video.pause();
18583							}, 300);
18584						});
18585					} else {
18586						video.play();
18587					}
18588				} else {
18589					if ( $mobile_video_wrap.length ) {
18590						$mobile_video_wrap.addClass('played-on');
18591						video.play();
18592					}
18593				}
18594
18595			};
18596			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
18597				$noscript.each(function(key, val){
18598					$noscript.after(val.textContent || val.innerText || val.innerHTML);
18599					$noscript.remove();
18600				});
18601			}
18602
18603			if (typeof MediaElement === "function") {
18604				$video.has('source[src]').mediaelementplayer({
18605					pauseOtherPlayers: false,
18606				});
18607			}
18608			if (video.readyState > 0) {
18609				manageVideo();
18610			} else {
18611				window.addEventListener("pageshow", function (event) {
18612					if (event.persisted) {
18613						manageVideo();
18614					}
18615				});				
18616				$video.on("loadedmetadata", function(_event) {
18617					manageVideo();
18618				});
18619			};
18620		});
18621	
18622	};
18623	
18624	checkForVideos();
18625
18626	var checkVideoResize = function(){
18627		clearRequestTimeout(checkResize);
18628		checkResize = requestTimeout(function(){
18629			if ( newW !== UNCODE.wwidth ) {
18630				checkForVideos();
18631				newW = UNCODE.wwidth;
18632			}
18633		}, 1000);
18634	};
18635
18636	$(window).off('resize.videos', checkVideoResize)
18637	.on( 'resize.videos', checkVideoResize);
18638
18639	$(window).off('more-items-loaded.videos', checkForVideos)
18640	.on('more-items-loaded.videos', checkForVideos);
18641
18642	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
18643	.on('uncode-ajax-filtered.videos', checkForVideos);
18644
18645};
18646UNCODE.inlineImgs = function() {
18647    var linkInlineImgs = function(){
18648        $('.un-inline-image').each(function(){
18649            var $img = $(this),
18650                href = $(this).attr('data-link-href'),
18651                dataImg = $img.data();
18652			if ( dataImg != '' && href != null && href !== '' ) {
18653                var class_stra_a = 'unline-image-link';
18654                if ( $(this).hasClass('un-inline-space-over') ) {
18655                    class_stra_a += ' un-inline-space-over';
18656                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
18657                    class_stra_a += ' un-inline-space-gutter';
18658                }
18659                var str_a = '<a class="' + class_stra_a + '" ';
18660                for (var key in dataImg) {
18661                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
18662                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
18663                    }
18664                }
18665                str_a += ' />';
18666                $img.wrap(str_a);
18667			}
18668        });
18669    };
18670    $(window).on('load', linkInlineImgs );
18671};
18672UNCODE.lottie = function() {
18673    if ( SiteParameters.is_frontend_editor ) {
18674        var $lottie_wraps = $('div.uncode-lottie-wrap');
18675        $lottie_wraps.each(function(){
18676            var $lottie_wrap = $(this),
18677                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
18678                $player_clone = $div_player.clone(),
18679                player_id = $div_player.attr('data-id'),
18680                $lottie_players = $('lottie-player', $lottie_wrap).remove();
18681            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
18682                if ( $('#'+player_id).length ) {
18683                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
18684                }
18685                $player_clone.attr('id', player_id);
18686                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
18687                $div_player.after($player_clone);
18688                $div_player.attr('data-init',true);
18689            }
18690        });
18691    }
18692    var $players = $('.uncode-lottie-wrap lottie-player');
18693    $players.each(function(){
18694        var player = this,
18695            this_id = $(player).attr('id'),
18696            _player = document.getElementById(this_id),
18697            trigger = $(player).attr('data-trigger'),
18698            pFrames = $(player).attr('data-frames').split(','),
18699            srcPlayer = $(player).attr('src');
18700
18701        _player.load(srcPlayer);
18702
18703        _player.addEventListener("ready", function() {
18704
18705            var $_shadow = _player.shadowRoot;
18706            $($_shadow).find('.error').remove();
18707
18708            var tFrames = _player.getLottie().totalFrames / 100,
18709                pFrame_from = Math.round(tFrames * pFrames[0]),
18710                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
18711                loop = $(player).attr('loop'),
18712                mode,
18713                actions;
18714
18715            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
18716                if ( trigger === 'scroll' ) {
18717                    mode = 'scroll';
18718                    actions = [
18719                        {
18720                            visibility:[0, 1.0],
18721                            type: "seek",
18722                            frames: [pFrame_from, pFrame_to],
18723                        }
18724                    ];
18725                } else if ( trigger === 'viewport') {
18726                    mode = 'scroll';
18727                    actions = [
18728                        {
18729                            visibility: [0.20, 1.0],
18730                            frames: [pFrame_from, pFrame_to],
18731                            type: loop ? "loop" : "play"
18732                        }
18733                    ];
18734                } else if ( trigger === 'hover') {
18735                    $(player).on('mouseenter', function(){
18736                        _player.play();
18737                    }).on('mouseleave', function(){
18738                        _player.pause();
18739                    });
18740                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
18741                        _player.seek(pFrame_from);
18742                        _player.addEventListener("frame", function(){
18743                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
18744                                _player.seek(pFrame_from);
18745                            }
18746                        });
18747                    }
18748                }
18749                LottieInteractivity.create({
18750                    player: '#' + this_id,
18751                    mode: mode,
18752                    actions: actions
18753                });
18754            } else {
18755                if ( pFrame_from > 0 && pFrame_from < 99 ) {
18756                    _player.seek(pFrame_from);
18757                    _player.addEventListener("frame", function(){
18758                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
18759                            _player.seek(pFrame_from);
18760                        }
18761                    });
18762                }
18763            }
18764        });
18765
18766        $(window).on('unlottie-destroy', function(){
18767            _player.destroy();
18768        });
18769    });
18770};
18771
18772UNCODE.animatedBgGradient = function( _el ) {
18773
18774    var ev;
18775
18776	if ( typeof _el === 'undefined' || _el === null ) {
18777        _el = document;
18778        ev = false;
18779	} else {
18780        _el = _el[0];
18781        ev = 'shortcode:update';
18782    }
18783
18784    var simplex = new SimplexNoise();
18785
18786    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
18787		this.block = blockOverlay;
18788		this.wrap = canvasWrap;
18789		this.config();
18790		this.checker();
18791		this.loopRAF();
18792        this.animLoader();
18793    };
18794
18795    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
18796
18797    AnimGradient.config = function() {
18798        this.canvas = document.createElement('canvas');
18799        this.wrap.appendChild(this.canvas);
18800        this.ctx = this.canvas.getContext('2d');
18801        this.count = 0;        
18802        this.isOrientationChanged = false;
18803        this.res = UNCODE.isMobile ? 90 : 110;
18804        this.resPercent = 100/this.res;
18805        this.resAround = this.resPercent/100;
18806        this.size = typeof this.block.getAttribute('data-bg-noise-size') !== 'undefined' && this.block.getAttribute('data-bg-noise-size') !== null && this.block.getAttribute('data-bg-noise-size') !== '' ? this.block.getAttribute('data-bg-noise-size') : 1;
18807
18808        this.canvas.classList.add('uncode-bg-animated-gradient');
18809        this.canvas.setAttribute('height', this.res);
18810        this.canvas.setAttribute('width', this.res);
18811        this.canvas.style = 'height: 100%; position: relative; width:100%;';
18812
18813        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
18814
18815        this.cx = this.canvas.width/2;
18816        this.cy = this.canvas.height/2;
18817        this.data = this.imgdata.data;
18818
18819        this.opts = {
18820            col_1st: typeof this.block.getAttribute('data-bg-noise-1') !== 'undefined' && this.block.getAttribute('data-bg-noise-1') !== null && this.block.getAttribute('data-bg-noise-1') !== '' ? this.block.getAttribute('data-bg-noise-1') : false,
18821            col_2nd: typeof this.block.getAttribute('data-bg-noise-2') !== 'undefined' && this.block.getAttribute('data-bg-noise-2') !== null && this.block.getAttribute('data-bg-noise-2') !== '' ? this.block.getAttribute('data-bg-noise-2') : false,
18822            time: typeof this.block.getAttribute('data-bg-noise-speed') !== 'undefined' && this.block.getAttribute('data-bg-noise-speed') !== null && this.block.getAttribute('data-bg-noise-speed') !== '' ? parseFloat(this.block.getAttribute('data-bg-noise-speed')) : 250,//100,250,1500
18823        };
18824
18825        this.lavaTime = 1;
18826        this.bg_colors = [];
18827
18828        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
18829            return;
18830        }
18831
18832        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
18833            this.singleColor = true;
18834        }
18835
18836        if( this.opts.col_1st ) {
18837
18838            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
18839
18840            this.bg_colors.push({
18841                r: rgbColor1.r,
18842                g: rgbColor1.g,
18843                b: rgbColor1.b
18844            });
18845        }
18846
18847        if( this.opts.col_2nd ) {
18848
18849            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
18850
18851            this.bg_colors.push({
18852                r: rgbColor2.r,
18853                g: rgbColor2.g,
18854                b: rgbColor2.b
18855            });
18856        }
18857
18858    };
18859
18860    AnimGradient.checker = function() {
18861        var scope = this;
18862        this.checkInViewPort();
18863      
18864        window.addEventListener('resize', function() {
18865            if(UNCODE.isMobile && !scope.isOrientationChanged) {
18866                return;
18867            }
18868            scope.ratioCalc();
18869        });
18870
18871        window.addEventListener("orientationchange", function() {
18872            scope.isOrientationChanged = true;
18873        });
18874
18875        this.ratioCalc();
18876    }; 
18877
18878    AnimGradient.ratioCalc = function() {
18879      
18880        var blockW = this.block.clientWidth,
18881            blockH = this.block.clientHeight;
18882
18883        if ( blockH == 0 || blockW == 0 )
18884            return;
18885
18886        var blockRatio = blockH/blockW;
18887
18888        if(blockRatio < 1) {
18889            this.ratioParam = {
18890                x: 1.4,
18891                y: blockRatio*1.4
18892            }
18893        } else {
18894            this.ratioParam = {
18895                x: blockRatio/3,
18896                y: 1
18897            }
18898        }
18899         
18900    };
18901
18902    AnimGradient.checkInViewPort = function() {
18903        var scope = this;
18904        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
18905            scope.isInViewport = true;
18906        } else if( 'IntersectionObserver' in window ) {
18907		    var observer = new IntersectionObserver(function(entries) {
18908  
18909                entries.forEach(function(entry){
18910                    if ( entry.isIntersecting ) {
18911                        scope.isInViewport = true;
18912                    } else {
18913                        scope.isInViewport = false;
18914                    }
18915                });
18916  
18917		    }, { 
18918			root: document,
18919		  });
18920  
18921		  observer.observe(scope.block);
18922		}
18923	};
18924	
18925    AnimGradient.hexToRGB = function(hexval) {
18926        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
18927        if (!hexecuted) {
18928            return false;
18929        }
18930        return {
18931            r: parseInt(hexecuted[1], 16),
18932            g: parseInt(hexecuted[2], 16),
18933            b: parseInt(hexecuted[3], 16)
18934        }
18935    };
18936
18937    AnimGradient.factor = function(val_1, val_2, lava) { 
18938        return val_1 * (1 - lava) + val_2 * lava;
18939    };
18940
18941    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
18942        if (this.singleColor) {
18943            return this.bg_colors[0][wave_l];
18944        }
18945        return this.factor(this.bg_colors[0][wave_l], this.bg_colors[1][wave_l], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*3.5)*noise/2 );
18946        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
18947    };
18948
18949    AnimGradient.lava = function(x, y, grade) {
18950        var radians = (Math.PI / 180) * grade,
18951        cos = Math.cos(radians),
18952        sin = Math.sin(radians),
18953        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
18954        return nx;
18955    };
18956    
18957    AnimGradient.loopRAF = function() {
18958
18959      var scope = this;
18960
18961        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
18962            for (var x = 0; x < this.res; x++) {
18963                for (var y = 0; y < this.res; y++) {
18964                    
18965                    var noise = simplex.noise3D((x / this.res * this.ratioParam.x)*this.size, (y / this.res * this.ratioParam.y)*this.size, this.count/this.opts.time); //original
18966        
18967                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
18968                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
18969                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
18970                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
18971                  
18972                }
18973            }
18974   
18975            this.count++;
18976          
18977            this.ctx.putImageData(this.imgdata, 0, 0);
18978         
18979        }
18980
18981        requestAnimationFrame(function() {
18982            scope.loopRAF();
18983        });
18984    };
18985
18986    AnimGradient.animLoader = function() {
18987        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
18988    };
18989
18990    var anim_init = function() {
18991        var bgs = _el.querySelectorAll('.block-bg-overlay');
18992      
18993        bgs.forEach(function(blockOverlay) {
18994            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
18995            if( !blockOverlay || !canvasWrap ) {
18996                return;
18997            }
18998            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
18999        });
19000    }
19001
19002    $(window).on('load', function(){
19003        anim_init();
19004    });
19005
19006    if ( ev === 'shortcode:update' ) {
19007        anim_init();
19008    }
19009
19010};
19011UNCODE.multibg = function(){
19012	var $bgsWraps = $('.uncode-multi-bgs'),
19013		$body = $('body');
19014	$bgsWraps.each(function(){
19015		var $bgWrap = $(this),
19016			transition = $bgWrap.attr('data-transition'),
19017			transitionTime = $bgWrap.attr('data-transition-time'),
19018			dataPace = $bgWrap.attr('data-transition-pace'),
19019			dataThreshold = $bgWrap.attr('data-transition-threshold'),
19020			dataTime = $bgWrap.attr('data-carousel-time'),
19021			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
19022			random = $bgWrap.attr('data-multi-random'),
19023			_bgWrap = $bgWrap[0],
19024			$multiBgs = $('.multi-background', $bgWrap),
19025			imgFirst,
19026			bgAmount = $multiBgs.length,
19027			isInViewport = false,
19028			lastScrollTop = 0,
19029			counter = 0,
19030			totMove = 0,
19031			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
19032			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
19033			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
19034			offX, offY,
19035			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
19036			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
19037			requestCarousel,
19038			is_header = $bgWrap.closest('#page-header').length,
19039			startTime = new Date();
19040
19041		transition = typeof transition === 'undefined' ? '' : transition;
19042
19043		if ( random === 'true' ) {
19044			UNCODE.shuffle($multiBgs);
19045		}
19046
19047		$multiBgs.find('.background-inner').attr('data-active','false');
19048
19049		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
19050
19051		var loadFirst = function(){
19052			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
19053				opacity: 1
19054			}, 250, 'easeInQuad').css({
19055				zIndex: 1
19056			});	
19057		}
19058
19059		var loadError = function(){
19060			console.log('Multi BG loading error');
19061		}
19062
19063		if ( imgFirst && imgFirst !== 'none' ) {
19064			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
19065		} else {
19066			loadFirst();
19067		}
19068
19069		var loadSlides = function( $thisBg ){
19070			$thisBg.attr('data-load', 'loaded');	
19071		}
19072
19073		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
19074			var $thisBg = $(val);
19075
19076			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
19077
19078				var _imgBg = $(val).find('.background-inner').css('background-image');
19079
19080				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
19081					$thisBg.attr('data-load', 'loaded');
19082				} else {
19083					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
19084					if ( typeof _imgBg !== 'undefined' ) {
19085						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
19086					}
19087				}
19088			}
19089		});
19090					
19091		var multiCarousel = function(e) {
19092
19093			clearRequestTimeout(requestCarousel);
19094
19095			var checkTime = new Date();
19096			if ( checkTime - startTime >= carouselTime && isInViewport ) {
19097				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
19098
19099				if ( $checkEl.attr('data-load') !== 'loaded' ) {
19100					requestTimeout(function(){
19101						multiCarousel();
19102					}, 100);
19103					return;
19104				}
19105
19106				counter++;
19107
19108				$multiBgs.each(function(ind, val){
19109					if ( ind === counter%bgAmount ) {
19110						$(val).stop(true,false).animate({
19111							opacity: 1
19112						}, wait, 'easeInQuad').css({
19113							zIndex: 1
19114						}).find('.background-inner').attr('data-active','true');
19115					} else {
19116						$(val).stop(true,false).animate({
19117							opacity: 0
19118						}, wait, 'easeInQuad', function(){
19119							$(val).find('.background-inner').attr('data-active','false');
19120						}).css({
19121							zIndex: 0
19122						});
19123					}
19124				});
19125
19126			}
19127
19128			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
19129				requestCarousel = requestTimeout(multiCarousel, carouselTime);
19130			}
19131	
19132		};
19133
19134		var multiMove = function(e) {
19135			if ( $body.hasClass('navbar-hover') ) {
19136				return;
19137			}
19138			var checkTime = new Date(),
19139                bound = $bgWrap[0].getBoundingClientRect(),
19140                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
19141			if (offX) {
19142				totMove += Math.sqrt(
19143					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
19144				);
19145			}
19146			if (
19147                totMove >= pace && 
19148                checkTime - startTime >= wait &&
19149                e.clientX <= (bound.left + bound.width) &&
19150                e.clientX >= bound.left &&
19151                e.clientY <= (bound.top + bound.height) &&
19152                e.clientY >= bound.top
19153            ) {
19154				counter++;
19155				startTime = checkTime;
19156				$multiBgs.each(function(ind, val){
19157					if ( ind === counter%bgAmount ) {
19158						$(val).stop(true,false).animate({
19159							opacity: 1
19160						}, wait, 'easeInQuad').css({
19161							zIndex: 1
19162						}).find('.background-inner').attr('data-active','true');
19163					} else {
19164						$(val).stop(true,false).animate({
19165							opacity: 0
19166						}, wait, 'easeInQuad', function(){
19167							$(val).find('.background-inner').attr('data-active','false');
19168						}).css({
19169							zIndex: 0
19170						});
19171					}
19172				});
19173
19174				totMove = 0;
19175			}
19176			
19177			offX = e.clientX;
19178			offY = e.clientY;
19179			
19180		};
19181
19182		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19183			document.addEventListener("mousemove", multiMove);
19184		}
19185
19186		window.addEventListener('resize', function() {
19187			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19188				document.removeEventListener("mousemove", multiMove);
19189				document.addEventListener("mousemove", multiMove);
19190			}
19191		});
19192
19193		var lightLoopRAF = function() {
19194
19195			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
19196				checkTime = new Date(),
19197				bound = $bgWrap[0].getBoundingClientRect(),
19198				thresholdHeader = is_header ? 100 : threshold,
19199				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
19200			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
19201				counter++;
19202				lastScrollTop = scrollTop;
19203				startTime = checkTime;
19204
19205				$multiBgs.each(function(ind, val){
19206					if ( ind === counter%bgAmount ) {
19207						$(val).stop(true,false).animate({
19208							opacity: 1
19209						}, wait, 'easeInQuad').css({
19210							zIndex: 1
19211						}).find('.background-inner').attr('data-active','true');
19212					} else {
19213						$(val).stop(true,false).animate({
19214							opacity: 0
19215						}, wait, 'easeInQuad', function(){
19216							$(val).find('.background-inner').attr('data-active','false');
19217						}).css({
19218							zIndex: 0
19219						});
19220					}
19221				});
19222
19223			}
19224
19225			requestAnimationFrame(function() {
19226				if ( isInViewport ) {
19227					lightLoopRAF();
19228				}
19229			});
19230		};
19231
19232		var currentInd = 0;
19233
19234		var loopRAF = function() {
19235
19236			var multiBgRotate = function(slideInd){
19237				currentInd = slideInd;
19238				$multiBgs.each(function(ind, val){
19239					if ( ind === slideInd ) {
19240						$(val).stop(true,false).animate({
19241							opacity: 1
19242						}, wait, 'easeInQuad').css({
19243							zIndex: 1
19244						}).find('.background-inner').attr('data-active','true');
19245					} else {
19246						$(val).stop(true,false).animate({
19247							opacity: 0
19248						}, wait, 'easeInQuad', function(){
19249							$(val).find('.background-inner').attr('data-active','false');
19250						}).css({
19251							zIndex: 0
19252						});
19253					}
19254				});
19255			};
19256			var bound = $bgWrap[0].getBoundingClientRect(),
19257				thresholdPX = UNCODE.wheight * threshold / 100,
19258				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
19259				movePX = totMove / bgAmount,
19260				moving = UNCODE.wheight - (bound.top + thresholdPX),
19261				slideInd = 0;
19262
19263			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
19264				multiBgRotate(0);
19265			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
19266				multiBgRotate(bgAmount-1);
19267			} else {
19268				slideInd = Math.ceil(moving/movePX) - 1;
19269				if ( slideInd < 0 ) {
19270					slideInd = 0;
19271				} else if ( slideInd >= bgAmount ) {
19272					slideInd = bgAmount-1;
19273				}
19274				if ( slideInd !== currentInd ) {
19275					multiBgRotate(slideInd);
19276				}
19277			}
19278
19279			requestAnimationFrame(function() {
19280				if ( isInViewport ) {
19281					loopRAF();
19282				}
19283			});
19284		};
19285
19286		if( 'IntersectionObserver' in window ) {
19287		    var observer = new IntersectionObserver(function(entries) {
19288  
19289                entries.forEach(function(entry){
19290                    if ( entry.isIntersecting ) {
19291                        isInViewport = true;
19292						if ( transition === 'scroll' ) {
19293							if ( autoScroll ) {
19294								loopRAF();
19295							} else {
19296								lightLoopRAF();
19297							}
19298						} else {
19299							multiCarousel();
19300						}
19301                    } else {
19302                        isInViewport = false;
19303                   }
19304                });
19305  
19306		    }, { 
19307				root: document,
19308				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
19309		  	});
19310
19311			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19312		  		observer.observe(_bgWrap);
19313			}
19314
19315			window.addEventListener('resize', function() {
19316				observer.unobserve(_bgWrap);
19317				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19318					observer.observe(_bgWrap);
19319				}
19320			});
19321	
19322		}
19323
19324	});
19325}
19326
19327UNCODE.owlNav = function(target, ev) {
19328    target = target.replace(/#\S+/g, '');
19329    var $carousel = $('#'+target),
19330        $slider = $carousel.closest('.uncode-slider'),
19331        $checkNavs = $('.uncode-owl-nav');
19332    if ( !$checkNavs.length ) {
19333        return;
19334    }
19335
19336    if ( $slider.length ){
19337        target = $slider.attr('id');
19338    }
19339
19340    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
19341        $row;
19342
19343    if ( ! $navs.length ) {
19344        $row = $carousel.closest('.vc_row.row-container');
19345        $navs = $('.uncode-owl-nav:not([data-target])', $row);
19346    }
19347        
19348    if ( ! $navs.length ) {
19349        return;
19350    }
19351
19352    $navs.each(function(){
19353        var $nav = $(this),
19354            $outer = $nav.closest('.uncode-owl-nav-out'),
19355            $inner = $nav.find('.uncode-owl-nav-in'),
19356            $navDots = $('.uncode-nav-dots', $nav),
19357            $navCounter = $('.uncode-nav-counter', $nav),
19358            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
19359            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
19360            skinInherit = $nav.hasClass('skin-inherit'),
19361            digit = parseFloat($nav.attr('data-digit')),
19362            counterDigit = parseFloat($nav.attr('data-counter-digit')),
19363            navSpeed = parseFloat($carousel.attr('data-navspeed'));
19364        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
19365
19366        if ( $nav.hasClass('pos-abs') ){
19367            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
19368                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
19369            }
19370            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
19371        } 
19372
19373        $carousel.on('refreshed.owl.carousel', counter);
19374        $carousel.on('resized.owl.carousel', counter);
19375        $carousel.on('changed.owl.carousel', counter);
19376
19377        if ( $carousel.closest('.un-submenu').length ) {
19378            $carousel.on('initialized.owl.carousel', counter);
19379        }
19380
19381        var totalSlides = 0;
19382
19383        function counter(event) {
19384            if (!event.namespace) {
19385                return;
19386            }
19387            var slides = event.relatedTarget,
19388                current = slides._current,
19389                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
19390                item = event.item,
19391                page = event.page,
19392                countPages = Math.ceil(item.count / page.size),
19393                $currentSlide = $carousel.find('.owl-item').eq(current),
19394                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
19395                activeSlide = Math.ceil(itemIndex / page.size),
19396                $prev = $nav.find('.uncode-nav-prev'),
19397                $next = $nav.find('.uncode-nav-next'),
19398                $col = $currentSlide.find('.uncol').first();
19399
19400            if ( totalSlides != countPages ) {
19401                totalSlides = countPages;
19402                $navDots.html('');
19403                var nav_html = '';
19404                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
19405                    var padN = sl_ind+1;
19406                    if ( digit && digit > 1 ) {
19407                        padN = String(padN).padStart(digit, '0');
19408                    }
19409                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
19410                }
19411                $navDots.html(nav_html);
19412
19413                var totalSlidesDigit = totalSlides;
19414
19415                if ( counterDigit && counterDigit > 1 ) {
19416                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
19417                }
19418                $counterTotal.html(totalSlidesDigit);
19419            }
19420
19421            if ( loop !== true ) {
19422                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
19423                if ( itemIndex === 1 ) {
19424                    $prev.addClass('uncode-nav-disabled');
19425                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
19426                    $next.addClass('uncode-nav-disabled');
19427                    activeSlide = Math.ceil(item.count / page.size);
19428                }
19429            }
19430
19431            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
19432            var activeSlideDigit = activeSlide;
19433
19434            if ( counterDigit && counterDigit > 1 ) {
19435                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
19436            }
19437            $counterIndex.html(activeSlideDigit);
19438
19439            if ( skinInherit ) {
19440                if ( $col.hasClass('style-light') ){
19441                    $nav.removeClass('style-dark').addClass('style-light');
19442                } else if ( $col.hasClass('style-dark') ) {
19443                    $nav.removeClass('style-light').addClass('style-dark');
19444                }
19445            }
19446
19447            $inner.removeClass('uncode-owl-nav-waiting');
19448
19449            if ( $nav.hasClass('outer-width') ) {
19450                var navW = $nav.outerWidth(),
19451                    nexW = $next.outerWidth(),
19452                    prevW = $prev.outerWidth(),
19453                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
19454
19455                if ( $nav.hasClass('h-align-justify') ) {
19456                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
19457                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
19458                        $inner.css({'margin': 'auto'});
19459                    } else {
19460                        $inner.css({'margin': ''});
19461                    }
19462                } else {
19463                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
19464                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
19465                        $inner.css({'margin': 'auto'});
19466                    } else {
19467                        $inner.css({'margin': ''});
19468                    }
19469                }
19470            }
19471        }
19472
19473        $nav.on('click', '.uncode-nav-index', function(){
19474            var $bullet = $(this),
19475                slide_index = parseFloat( $bullet.attr('data-key') );
19476            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
19477        });
19478        $nav.on('click', '.uncode-nav-prev', function(){
19479            $carousel.trigger('prev.owl.carousel', [navSpeed]);
19480        });
19481        $nav.on('click', '.uncode-nav-next', function(){
19482            $carousel.trigger('next.owl.carousel', [navSpeed]);
19483        });
19484
19485        if ( $nav.hasClass('animated-arrows') ) {
19486            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
19487                $(this).addClass("hover"); 
19488            }).on('animationend', function(){
19489                $(this).removeClass("hover");  
19490            });
19491        }
19492
19493        var positionNav = function(){
19494            if ( $nav.hasClass('window-width') ) {
19495                var navOff = parseFloat( $nav.offset().left ) * -1;
19496                if ( navOff > 0 ) {
19497                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
19498                } else {
19499                    $inner.css({ transform: 'none' });
19500                }
19501            }
19502        }
19503        positionNav();
19504        $(window).on('resize', positionNav);
19505        $(document).on('un-menu-show', positionNav);
19506    });
19507
19508    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
19509};
19510
19511	UNCODE.init = function() {
19512		var wfl_check = false, wfl_request, waypoint_request;
19513		UNCODE.preventDoubleTransition();
19514		UNCODE.betterResize();
19515		UNCODE.utils();
19516		UNCODE.unBlockMenu();
19517		UNCODE.mobileMenuBlockSkins();
19518		UNCODE.magnetic();
19519		if (typeof UNCODE.accessibility !== 'undefined') {
19520			UNCODE.accessibility();
19521		}
19522		if (typeof UNCODE.rowParallax !== 'undefined') {
19523			UNCODE.rowParallax();
19524		}
19525		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
19526			UNCODE.changeSkinOnScroll();
19527		}
19528		if (typeof UNCODE.share !== 'undefined') {
19529			UNCODE.share();
19530		}
19531		if (typeof UNCODE.tooltip !== 'undefined') {
19532			UNCODE.tooltip();
19533		}
19534		if (typeof UNCODE.counters !== 'undefined') {
19535			UNCODE.counters();
19536		}
19537		if (typeof UNCODE.countdowns !== 'undefined') {
19538			UNCODE.countdowns();
19539		}
19540		if (typeof UNCODE.tabs !== 'undefined') {
19541			UNCODE.tabs();
19542		}
19543		if (typeof UNCODE.collapse !== 'undefined') {
19544			UNCODE.collapse();
19545		}
19546		if (typeof UNCODE.bigText !== 'undefined') {
19547			UNCODE.bigText();
19548		}
19549		UNCODE.menuSystem();
19550		if (typeof UNCODE.bgChanger !== 'undefined') {
19551			UNCODE.bgChanger();
19552		}
19553		if (typeof UNCODE.magicCursor !== 'undefined') {
19554			UNCODE.magicCursor();
19555		}
19556		if (typeof UNCODE.magneticCursor !== 'undefined') {
19557			UNCODE.magneticCursor();
19558		}
19559		if (typeof UNCODE.dropImage !== 'undefined') {
19560			UNCODE.dropImage();
19561		}
19562		if (typeof UNCODE.postTable !== 'undefined') {
19563			UNCODE.postTable();
19564		}
19565		if (typeof UNCODE.rotatingTxt !== 'undefined') {
19566			UNCODE.rotatingTxt();
19567		}
19568		if (typeof UNCODE.okvideo !== 'undefined') {
19569			UNCODE.okvideo();
19570			window.addEventListener( "uncode-more-items-loaded", function() {
19571				UNCODE.okvideo("uncode-more-items-loaded");
19572			});
19573		}
19574		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
19575			UNCODE.backgroundSelfVideos();
19576		}
19577		UNCODE.tapHover();
19578		if (typeof UNCODE.isotopeLayout !== 'undefined') {
19579			UNCODE.isotopeLayout();
19580		}
19581		if (typeof UNCODE.justifiedGallery !== 'undefined') {
19582			UNCODE.justifiedGallery();
19583		}
19584		if (typeof UNCODE.cssGrid !== 'undefined') {
19585			UNCODE.cssGrid();
19586		}
19587		if (typeof UNCODE.linearGrid !== 'undefined') {
19588			UNCODE.linearGrid();
19589		}
19590		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
19591			UNCODE.lightbox();
19592		}
19593		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
19594			$(window).on('load more-items-loaded',function(){
19595				UNCODE.lightgallery();
19596			});
19597		}
19598		if (typeof UNCODE.carousel !== 'undefined') {
19599			UNCODE.carousel($('body'));
19600		}
19601		if (typeof UNCODE.lettering !== 'undefined') {
19602			UNCODE.lettering();
19603		}
19604		UNCODE.animations();
19605		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
19606			UNCODE.stickyElements();
19607		}
19608		if (typeof UNCODE.twentytwenty !== 'undefined') {
19609			UNCODE.twentytwenty();
19610		}
19611		UNCODE.disableHoverScroll();
19612		UNCODE.printScreen();
19613		if (typeof UNCODE.particles !== 'undefined') {
19614			UNCODE.particles();
19615		}
19616		if (typeof UNCODE.filters !== 'undefined') {
19617			UNCODE.filters();
19618		}
19619		if (typeof UNCODE.ajax_filters !== 'undefined') {
19620			UNCODE.ajax_filters();
19621		}
19622		if (typeof UNCODE.widgets !== 'undefined') {
19623			UNCODE.widgets();
19624		}
19625		if (typeof UNCODE.unmodal !== 'undefined') {
19626			UNCODE.unmodal();
19627		}
19628		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
19629			if ( !UNCODE.isFullPage ) {
19630				UNCODE.checkScrollForTabs();
19631			}
19632		}
19633		if (typeof UNCODE.onePage !== 'undefined') {
19634			UNCODE.onePage(UNCODE.isMobile);
19635		}
19636		if (typeof UNCODE.fullPage !== 'undefined') {
19637			$(document).ready(function(){
19638				UNCODE.fullPage();
19639			});
19640		}
19641		if (typeof UNCODE.skewIt !== 'undefined') {
19642			UNCODE.skewIt();
19643		}
19644		if (typeof UNCODE.rotateIt !== 'undefined') {
19645			UNCODE.rotateIt();
19646		}
19647		if (typeof UNCODE.textMarquee !== 'undefined') {
19648			UNCODE.textMarquee();
19649		}
19650		if (typeof UNCODE.stickyScroll !== 'undefined') {
19651			UNCODE.stickyScroll();
19652		}
19653		if (typeof UNCODE.stickyTrigger !== 'undefined') {
19654			UNCODE.stickyTrigger();
19655		}
19656		if (typeof UNCODE.areaTextReveal !== 'undefined') {
19657			UNCODE.areaTextReveal();
19658		}
19659		if (typeof UNCODE.thumbsReveal !== 'undefined') {
19660			UNCODE.thumbsReveal();
19661		}
19662		if (typeof UNCODE.verticalText !== 'undefined') {
19663			UNCODE.verticalText();
19664		}
19665		if (typeof UNCODE.videoThumbs !== 'undefined') {
19666			UNCODE.videoThumbs();
19667		}
19668		if (typeof UNCODE.revslider !== 'undefined') {
19669			UNCODE.revslider();
19670		}
19671		if (typeof UNCODE.layerslider !== 'undefined') {
19672			UNCODE.layerslider();
19673		}
19674		if (typeof UNCODE.lottie !== 'undefined') {
19675			UNCODE.lottie();
19676		}
19677		if (typeof UNCODE.inlineImgs !== 'undefined') {
19678			UNCODE.inlineImgs();
19679		}
19680		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
19681			UNCODE.animatedBgGradient();
19682		}
19683		if (typeof UNCODE.readMoreCol !== 'undefined') {
19684			UNCODE.readMoreCol();
19685		}
19686		if (typeof UNCODE.multibg !== 'undefined') {
19687			UNCODE.multibg();
19688		}
19689		if (typeof UNCODE.flexEqual !== 'undefined') {
19690			UNCODE.flexEqual();
19691		}
19692		if (typeof UNCODE.wrapperMarquee !== 'undefined') {
19693			UNCODE.wrapperMarquee();
19694		}
19695		if (typeof UNCODE.wrapperSticky !== 'undefined') {
19696			UNCODE.wrapperSticky();
19697		}
19698		if (typeof UNCODE.mouseTrail !== 'undefined') {
19699			UNCODE.mouseTrail();
19700		}
19701		if (typeof UNCODE.magneticPattern !== 'undefined') {
19702			UNCODE.magneticPattern();
19703		}
19704		if (typeof UNCODE.thumbDrop !== 'undefined') {
19705			UNCODE.thumbDrop();
19706		}
19707		$(window).on('load',function(){
19708			clearRequestTimeout(waypoint_request);
19709			waypoint_request = requestTimeout( function(){
19710				Waypoint.refreshAll();
19711			}, 1000);
19712		});
19713		$(window).one('load',function(){
19714			if (typeof UNCODE.parallax !== 'undefined') {
19715				UNCODE.parallax();
19716			}
19717		});
19718	}
19719
19720	if ( ! SiteParameters.is_frontend_editor ) {
19721		UNCODE.init();
19722	}
19723
19724
19725})(jQuery);

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.