PageSourceSearch

https://sistemacreo.com/wp-content/themes/porto/js/theme-async.js?ver=6.5.3

js sistemacreo.com collected 2026-09-28 15:14:13 UTC 99,926 bytes, 3,330 lines download raw bytes

1( function ( theme, $ ) {
2	'use strict';
3
4	theme = theme || {};
5
6	$.extend( theme, {
7		mfpConfig: {
8			tClose: js_porto_vars.popup_close,
9			tLoading: '<div class="porto-ajax-loading"><i class="porto-loading-icon"></i></div>',
10			gallery: {
11				tPrev: js_porto_vars.popup_prev,
12				tNext: js_porto_vars.popup_next,
13				tCounter: js_porto_vars.mfp_counter
14			},
15			image: {
16				tError: js_porto_vars.mfp_img_error
17			},
18			ajax: {
19				tError: js_porto_vars.mfp_ajax_error
20			},
21			callbacks: {
22				open: function () {
23					$( 'body' ).addClass( 'lightbox-opened' );
24					var fixed = this.st.fixedContentPos;
25					if ( fixed ) {
26						$( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', theme.getScrollbarWidth() );
27					}
28					/* D3-Ahsan - Start */
29					var that = $( this._lastFocusedEl );
30					if ( ( that.closest( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) {
31
32						var portfolio_lightbox_thumbnails_base = that.closest( '.portfolios-lightbox.with-thumbs' ).find( '.porto-portfolios-lighbox-thumbn
32ails' ).clone(),
33							magnificPopup = $.magnificPopup.instance;
34
35						$( 'body' ).prepend( portfolio_lightbox_thumbnails_base );
36
37						var $portfolios_lightbox_thumbnails = $( 'body > .porto-portfolios-lighbox-thumbnails' ),
38							$portfolios_lightbox_thumbnails_carousel = $portfolios_lightbox_thumbnails.children( '.owl-carousel' );
39						$portfolios_lightbox_thumbnails_carousel.themeCarousel( $portfolios_lightbox_thumbnails_carousel.data( 'plugin-options' ) );
40						$portfolios_lightbox_thumbnails_carousel.trigger( 'refresh.owl.carousel' );
41
42						var $carousel_items_wrapper = $portfolios_lightbox_thumbnails_carousel.find( '.owl-stage' );
43
44						$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
45						$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
46
47						$.magnificPopup.instance.next = function () {
48							var magnificPopup = $.magnificPopup.instance;
49							$.magnificPopup.proto.next.call( this );
50							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
51							$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
52						};
53
54						$.magnificPopup.instance.prev = function () {
55							var magnificPopup = $.magnificPopup.instance;
56							$.magnificPopup.proto.prev.call( this );
57							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
58							$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
59						};
60
61						$carousel_items_wrapper.find( '.owl-item' ).on( 'click', function () {
62							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
63							$.magnificPopup.instance.goTo( $( this ).index() );
64							$( this ).addClass( 'current' );
65						} );
66
67					}
68					/* End - D3-Ahsan */
69				},
70				close: function () {
71					$( 'body' ).removeClass( 'lightbox-opened' );
72					var fixed = this.st.fixedContentPos;
73					if ( fixed ) {
74						$( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', '' );
75					}
76					$( '.owl-carousel .owl-stage' ).each( function () {
77						var $this = $( this ),
78							w = $this.width() + parseInt( $this.css( 'padding-left' ) ) + parseInt( $this.css( 'padding-right' ) );
79
80						$this.css( { 'width': w + 200 } );
81						setTimeout( function () {
82							$this.css( { 'width': w } );
83						}, 0 );
84					} );
85					/* D3-Ahsan - Start */
86					var that = $( this._lastFocusedEl );
87					if ( ( that.parents( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) {
88						$( ' body >
88 .porto-portfolios-lighbox-thumbnails' ).remove();
89					}
90					/* End - D3-Ahsan */
91				}
92			}
93		},
94	} );
95
96} ).apply( this, [ window.theme, jQuery ] );
97
98
99// Animate
100( function ( theme, $ ) {
101	'use strict';
102
103	theme = theme || {};
104
105	var instanceName = '__animate';
106
107	var Animate = function ( $el, opts ) {
108		return this.initialize( $el, opts );
109	};
110
111	Animate.defaults = {
112		accX: 0,
113		accY: -120,
114		delay: 1,
115		duration: 1000
116	};
117
118	Animate.prototype = {
119		initialize: function ( $el, opts ) {
120			if ( $el.data( instanceName ) ) {
121				return this;
122			}
123
124			this.$el = $el;
125
126			this
127				.setData()
128				.setOptions( opts )
129				.build();
130
131			return this;
132		},
133
134		setData: function () {
135			this.$el.data( instanceName, true );
136
137			return this;
138		},
139
140		setOptions: function ( opts ) {
141			this.options = $.extend( true, {}, Animate.defaults, opts, {
142				wrapper: this.$el
143			} );
144
145			return this;
146		},
147
148		build: function () {
149			var self = this,
150				$el = this.options.wrapper,
151				delay = 0,
152				duration = 0;
153
154			if ( $el.data( 'appear-animation-svg' ) ) {
155				$el.find( '[data-appear-animation]' ).each( function () {
156					var $this = $( this ),
157						opts;
158
159					var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) );
160					if ( pluginOptions )
161						opts = pluginOptions;
162
163					$this.themeAnimate( opts );
164				} );
165
166				return this;
167			}
168
169			$el.addClass( 'appear-animation' );
170
171			var el_obj = $el.get( 0 );
172
173			delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : self.options.delay );
174			if ( delay > 1 ) {
175				el_obj.style.animationDelay = delay + 'ms';
176			}
177
178			duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : self.options.duration );
179			if ( duration != 1000 ) {
180				el_obj.style.animationDuration = duration + 'ms';
181			}
182
183            /*if ( $el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).length ) {
184                $el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' );
185            }*/
186			$el.addClass( $el.data( 'appear-animation' ) + ' appear-animation-visible' );
187
188			return this;
189		}
190	};
191
192	// expose to scope
193	$.extend( theme, {
194		Animate: Animate
195	} );
196
197	// jquery plugin
198	$.fn.themeAnimate = function ( opts ) {
199		return this.map( function () {
200			var $this = $( this );
201
202			if ( $this.data( instanceName ) ) {
203				return $this;
204			} else {
205				return new theme.Animate( $this, opts );
206			}
207
208		} );
209	};
210
211} ).apply( this, [ window.theme, jQuery ] );
212
213// Animated Letters
214( function ( theme, $ ) {
215
216	theme = theme || {};
217
218	var instanceName = '__animatedLetters';
219
220	var PluginAnimatedLetters = function ( $el, opts ) {
221		return this.initialize( $el, opts );
222	};
223
224	PluginAnimatedLetters.defaults = {
225		animationName: 'typeWriter',
226		animationSpeed: 50,
227		startDelay: 500,
228		minWindowWidth: 768,
229		letterClass: ''
230	};
231
232	PluginAnimatedLetters.prototype = {
233		initialize: function ( $el, opts ) {
234			if ( $el.data( instanceName ) ) {
235				return this;
236			}
237
238			var self = this;
239
240			this.$el = $el;
241			this.initialText = $el.text();
242			this.timeoutId = null;
243			this
244				.setData()
245				.setOptions( opts )
246				.build()
247				.events();
248
249			return this;
250		},
251
252		setData: function () {
253			this.$el.data( instanceName, this );
254
255			return this;
256		},
257
258		setOptions: function ( opts ) {
259			this.options = $.extend( true, {}, PluginAnimatedLetters.defaults, opts, {
260				wrapper: this.$el
261			} );
262
263			return this;
264		},
265
266		build: function () {
267			var self = this,
268				letters = self.$el.text().split( '' );
269
270			if ( $( window ).width() < self.options.minWindowWidth ) {
271				self.$el.addClass( 'initialized' );
272				return this;
273			}
274
275			if ( self.options.firstLoadNoAnim ) {
276				self.$el.css( {
277					visibility: 'visible'
278				} );
279
280				// Inside Carousel
281				if ( self.$el.closest( '.owl-carousel' ).get( 0 ) ) {
282					setTimeout( function () {
283						self.$el.closest( '.owl-carousel' ).on( 'change.owl.carousel', function () {
284							self.options.firstLoadNoAnim = false;
285							self.build();
286						} );
287					}, 500 );
288				}
289
290				return this;
291			}
292
293			// Add class to show
294			self.$el.addClass( 'initialized' );
295
296			// Set Min Height to avoid flicking issues
297			self.setMinHeight();
298
299			self.$el.text( '' );
300
301			if ( self.options.animationName == 'typeWriter' ) {
302				self.$el.append( '<span class="letters-wrapper"></span><span class="typeWriter"></pre>' );
303
304				var index = 0;
305				var timeout = function () {
306					var st = setTimeout( function () {
307						var letter = letters[ index ];
308
309						self.$el.find( '.letters-wrapper' ).append( '<span class="letter ' + ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + '">' + letter + '</span>' );
310
311						index++;
312						timeout();
313					}, self.options.animationSpeed );
314
315					if ( index >= letters.length ) {
316						clearTimeout( st );
317					}
318				};
319				timeout();
320			} else {
321				this.timeoutId = setTimeout( function () {
322					for ( var i = 0; i < letters.length; i++ ) {
323						var letter = letters[ i ];
324
325						self.$el.append( '<span class="letter ' + ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + self.options.animationName + ' animated" style="animation-delay: ' + ( i * self.options.animationSpeed ) + 'ms;">' + letter + '</span>' );
326
327					}
328				}, self.options.startDelay );
329			}
330
331			return this;
332		},
333
334		setMinHeight: function () {
335			var self = this;
336
337			// if it's inside carousel
338			if ( self.$el.closest( '.owl-carousel' ).get( 0 ) ) {
339				self.$el.closest( '.owl-carousel' ).addClass( 'd-block' );
340				self.$el.css( 'min-height', self.$el.height() );
341				self.$el.closest( '.owl-carousel' ).removeClass( 'd-block' );
342			} else {
343				self.$el.css( 'min-height', self.$el.height() );
344			}
345
346			return this;
347		},
348
349		destroy: function () {
350			var self = this;
351
352			self.$el
353				.html( self.initialText )
354				.css( 'min-height', '' );
355			if ( this.timeoutId ) {
356				clearTimeout( this.timeoutId );
357				this.timeoutId = null;
358			}
359			return this;
360		},
361
362		events: function () {
363			var self = this;
364
365			// Destroy
366			self.$el.on( 'animated.letters.destroy', function () {
367				self.destroy();
368			} );
369
370			// Initialize
371			self.$el.on( 'animated.letters.initialize', function () {
372				self.build();
373			} );
374
375			return this;
376		}
377	};
378
379	// expose to scope
380	$.extend( theme, {
381		PluginAnimatedLetters: PluginAnimatedLetters
382	} );
383
384	// jquery plugin
385	$.fn.themePluginAnimatedLetters = function ( opts ) {
386		return this.map( function () {
387			var $this = $( this );
388
389			if ( $this.data( instanceName ) ) {
390				return $this.data( instanceName );
391			} else {
392				return new PluginAnimatedLetters( $this, opts );
393			}
394
395		} );
396	}
397
398} ).apply( this, [ window.theme, jQuery ] );
399
400// Carousel
401if ( typeof jQuery.fn.owlCarousel == 'function' ) {
402	( function ( theme, $ ) {
403		'use strict';
404
405		theme = theme || {};
406
407		var instanceName = '__carousel';
408
409		var Carousel = function ( $el, opts ) {
410			return this.initialize( $el, opts );
411		};
412
413		Carousel.defaults = $.extend( {}, {
414			loop: true,
415			navText: [],
416			themeConfig: false,
417			lazyLoad: true,
418			lg: 0,
419			md: 0,
420			sm: 0,
421			xs: 0,
422			single: false,
423			rtl: theme.rtl
424		} );
425
426		Carousel.prototype = {
427			initialize: function ( $el, opts ) {
428				if ( $el.data( instanceName ) ) {
429					return this;
430				}
431
432				this.$el = $el;
433
434				this
435					.setData()
436					.setOptions( opts )
437					.build();
438
439				return this;
440			},
441
442			setData: function () {
443				this.$el.data( instanceName, true );
444
445				return this;
446			},
447
448			setOptions: function ( opts ) {
449				if ( ( opts && opts.themeConfig ) || !opts ) {
450					this.options = $.extend( true, {}, Carousel.defaults, theme.owlConfig, opts, {
451						wrapper: this.$el,
452						themeConfig: true
453					} );
454				} else {
455					this.options = $.extend( true, {}, Carousel.defaults, opts, {
456						wrapper: this.$el
457					} );
458				}
459
460				return this;
461			},
462
463			calcOwlHeight: function ( $el ) {
464				var h = 0;
465				$el.find( '.owl-item.active' ).each( function () {
466					if ( h < $( this ).height() )
467						h = $( this ).height();
468				} );
469				$el.children( '.owl-stage-outer' ).height( h );
470			},
471
472			build: function () {
473				if ( !$.fn.owlCarousel ) {
474					return this;
475				}
476
477				var $el = this.options.wrapper,
478					loop = this.options.loop,
479					lg = this.options.lg,
480					md = this.options.md,
481					sm = this.options.sm,
482					xs = this.options.xs,
483					single = this.options.single,
484					zoom = $el.find( '.zoom' ).filter( function() {
485						if ( $( this ).closest( '.tb-image-type-slider' ).length ) {
486							return false;
487						}
488						return true;
489					} ).get( 0 ),
490					responsive = {},
491					items,
492					count = $el.find( '.owl-item' ).length > 0 ? $el.find( '.owl-item:not(.cloned)' ).length : $el.find( '> *' ).length,
493					fullscreen = typeof this.options.fullscreen == 'undefined' ? false : this.options.fullscreen;
494
495
496                /*if (fullscreen) {
497                    $el.children().width(window.innerWidth - theme.getScrollbarWidth());
498                    $el.children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight);
499                    $el.children().css('max-height', '100%');
500                    $(window).on('resize', function() {
501                        $el.find('.owl-item').children().width(window.innerWidth - theme.getScrollbarWidth());
502                        $el.find('.owl-item').children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight);
503                        $el.find('.owl-item').children().css('max-height', '100%');
504                    });
505                }*/
506
507				if ( single ) {
508					items = 1;
509				} else if ( typeof this.options.responsive != 'undefined' ) {
510					for ( var w in this.options.responsive ) {
511						var number_items = Number( this.options.responsive[ w ] );
512						responsive[ Number( w ) ] = { items: number_items, loop: ( loop && count >= number_items ) ? true : false };
513					}
514				} else {
515					items = this.options.items ? this.options.items : ( lg ? lg : 1 );
516					var isResponsive = ( this.options.xl || lg || md || sm || xs );
517					if ( isResponsive ) {
518						if ( this.options.xl ) {
519							responsive[ 1400 ] = { items: this.options.xl, loop: ( loop && count > this.options.xl ) ? true : false, mergeFit: this.options.mergeFit };
520						} else {
521							if ( lg && items > lg + 1 ) {
522								responsive[ 1400 ] = { items: items, loop: ( loop && count > items ) ? true : false, mergeFit: this.options.mergeFit };
523								if( theme.screen_lg < 1400 ) {
524									responsive[ theme.screen_lg ] = { items: lg + 1, loop: ( loop && count > lg + 1 ) ? true : false, mergeFit: this.options.mergeFit };
525								}
526							}
527						}
528						if ( typeof responsive[ 1400 ] == 'undefined' && typeof responsive[ theme.screen_lg ] == 'undefined' ) {
529							responsive[ theme.screen_lg ] = { items: items, loop: ( loop && count >= items ) ? true : false, mergeFit: this.options.mergeFit };
530						}
531						if ( lg ) responsive[ 992 ] = { items: lg, loop: ( loop && count >= lg ) ? true : false, mergeFit: this.options.mergeFit_lg };
532						if ( md ) responsive[ 768 ] = { items: md, loop: ( loop && count > md ) ? true : false, mergeFit: this.options.mergeFit_md };
533						if ( sm ) {
534							responsive[ 576 ] = { items: sm, loop: ( loop && count > sm ) ? true : false, mergeFit: this.options.mergeFit_sm };
535						} else {
536							responsive[ 576 ] = { items: 1, mergeFit: false };
537						}
538						if ( xs ) {
539							responsive[ 0 ] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_xs };
540						} else {
541							responsive[ 0 ] = { items: 1 };
542						}
543					}
544				}
545
546				if ( !$el.hasClass( 'show-nav-title' ) && this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) {
547					$el.addClass( 'show-nav-hover' );
548				}
549
550				this.options = $.extend( true, {}, this.options, {
551					items: items,
552					loop: ( loop && count > items ) ? true : false,
553					responsive: responsive,
554					onInitialized: function () {
555						if ( $el.hasClass( 'stage-margin' ) ) {
556							$el.find( '.owl-stage-outer' ).css( {
557								'margin-left': this.options.stagePadding,
558								'margin-right': this.options.stagePadding
559							} );
560						}
561						var heading_cls = '.porto-u-heading, .vc_custom_heading, .slider-title, .elementor-widget-heading, .porto-heading';
562						if ( $el.hasClass( 'show-dots-title' ) && ( $el.prev( heading_cls ).length || $el.closest( '.slider-wrapper' ).prev( heading_cls ).length || $el.closest( '.porto-recent-posts' ).prev( heading_cls ).length || $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls ).length ) ) {
563							var $obj = $el.prev( heading_cls );
564							if ( !$obj.length ) {
565								$obj = $el.closest( '.slider-wrapper' ).prev( heading_cls );
566							}
567							if ( !$obj.length ) {
568								$obj = $el.closest( '.porto-recent-posts' ).prev( heading_cls );
569							}
570							if ( !$obj.length ) {
571								$obj = $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls );
572							}
573							try {
574								var innerWidth = $obj.addClass( 'w-auto' ).css( 'display', 'inline-block' ).width();
575								$obj.removeClass( 'w-auto' ).css( 'display', '' );
576								if ( innerWidth + 15 + $el.find( '.owl-dots' ).width() <= $obj.width() ) {
577									$el.find( '.owl-dots' ).css( 'left', innerWidth + 15 + ( $el.width() - $obj.width() ) / 2 );
578									$el.find( '.owl-dots' ).css( 'top', -1 * $obj.height() / 2 - parseInt( $obj.css( 'margin-bottom' ) ) - $el.find( '.owl-dots' ).height() / 2 + 2 );
579								} else {
580									$el.find( '.owl-dots' ).css( 'position', 'static' );
581								}
582							} catch ( e ) { }
583						}
584					}
585				} );
586
587				// Auto Height Fixes
588				if ( this.options.autoHeight ) {
589					var thisobj = this;
590					$( window ).on( 'resize', function () {
591						thisobj.calcOwlHeight( $el );
592					} );
593
594					if ( theme.isLoaded ) {
595						setTimeout( function () {
596							thisobj.calcOwlHeight( $el );
597						}, 100 );
598					} else {
599						$( window ).on( 'load', function () {
600							thisobj.calcOwlHeight( $el );
601						} );
602					}
603				}
604
605				var links = false;
606				if ( zoom ) {
607					links = [];
608					var i = 0;
609
610					$el.find( '.zoom' ).each( function () {
611						var slide = {},
612							$zoom = $( this );
613
614						slide.src = $zoom.data( 'src' ) ? $zoom.data( 'src' ) : $zoom.data( 'mfp-src' );
615						slide.title = $zoom.data( 'title' );
616						links[ i ] = slide;
617						$zoom.data( 'index', i );
618						i++;
619					} );
620				}
621
622				if ( $el.hasClass( 'show-nav-title' ) ) {
623					this.options.stagePadding = 0;
624				} else {
625					if ( this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover )
626						$el.addClass( 'show-nav-hover' );
627					if ( this.options.themeConfig && !theme.slider_nav_hover && theme.slider_margin )
628						$el.addClass( 'stage-margin' );
629				}
630				if ( $el.hasClass( 'has-ccols-spacing' ) ) {
631					$el.removeClass( 'has-ccols-spacing' );
632				}
633				$el.owlCarousel( this.options );
634
635				if ( zoom && links ) {
636					$el.on( 'click', '.zoom', function ( e ) {
637						e.preventDefault();
638						if ( $.fn.magnificPopup ) {
639							var image_index = $( this ).data( 'index' );
640							if ( typeof image_index == 'undefined' ) {
641								image_index = ( $( this ).closest( '.owl-item' ).index() - $el.find( '.cloned' ).length / 2 ) % $el.data( 'owl.carousel' ).items().length;
642							}
643							$.magnificPopup.close();
644							$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
645								items: links,
646								gallery: {
647									enabled: true
648								},
649								type: 'image'
650							} ), image_index );
651						}
652						return false;
653					} );
654				}
655
656				return this;
657			}
658		}
659		// expose to scope
660		$.extend( theme, {
661			Carousel: Carousel
662		} );
663
664		// jquery plugin
665		$.fn.themeCarousel = function ( opts, zoom ) {
666			return this.map( function () {
667				var $this = $( this );
668
669				if ( $this.data( instanceName ) ) {
670					return $this;
671				} else {
672					return new theme.Carousel( $this, opts, zoom );
673				}
674
675			} );
676		}
677
678	} ).apply( this, [ window.theme, jQuery ] );
679}
680
681// Lightbox
682( function ( theme, $ ) {
683	'use strict';
684
685	theme = theme || {};
686
687	var instanceName = '__lightbox';
688
689	var Lightbox = function ( $el, opts ) {
690		return this.initialize( $el, opts );
691	};
692
693	Lightbox.defaults = {
694		callbacks: {
695			open: function () {
696				$( 'body' ).addClass( 'lightbox-opened' );
697			},
698			close: function () {
699				$( 'body' ).removeClass( 'lightbox-opened' );
700			}
701		}
702	};
703
704	Lightbox.prototype = {
705		initialize: function ( $el, opts ) {
706			if ( $el.data( instanceName ) ) {
707				return this;
708			}
709
710			this.$el = $el;
711
712			this
713				.setData()
714				.setOptions( opts )
715				.build();
716
717			return this;
718		},
719
720		setData: function () {
721			this.$el.data( instanceName, this );
722
723			return this;
724		},
725
726		setOptions: function ( opts ) {
727			this.options = $.extend( true, {}, Lightbox.defaults, theme.mfpConfig, opts, {
728				wrapper: this.$el
729			} );
730
731			return this;
732		},
733
734		build: function () {
735			if ( !$.fn.magnificPopup ) {
736				return this;
737			}
738
739			this.options.wrapper.magnificPopup( this.options );
740
741			return this;
742		}
743	};
744
745	// expose to scope
746	$.extend( theme, {
747		Lightbox: Lightbox
748	} );
749
750	// jquery plugin
751	$.fn.themeLightbox = function ( opts ) {
752		return this.map( function () {
753			var $this = $( this );
754
755			if ( $this.data( instanceName ) ) {
756				return $this.data( instanceName );
757			} else {
758				return new theme.Lightbox( $this, opts );
759			}
760
761		} );
762	}
763
764} ).apply( this, [ window.theme, jQuery ] );
765
766// Visual Composer Image Zoom
767( function ( theme, $ ) {
768	'use strict';
769
770	theme = theme || {};
771
772	var instanceName = '__toggle';
773
774	var VcImageZoom = function ( $el, opts ) {
775		return this.initialize( $el, opts );
776	};
777
778	VcImageZoom.defaults = {
779
780	};
781
782	VcImageZoom.prototype = {
783		initialize: function ( $el, opts ) {
784			if ( $el.data( instanceName ) ) {
785				return this;
786			}
787
788			this.$el = $el;
789
790			this
791				.setData()
792				.setOptions( opts )
793				.build();
794
795			return this;
796		},
797
798		setData: function () {
799			this.$el.data( instanceName, this );
800
801			return this;
802		},
803
804		setOptions: function ( opts ) {
805			this.options = $.extend( true, {}, VcImageZoom.defaults, opts, {
806				wrapper: this.$el
807			} );
808
809			return this;
810		},
811
812		build: function () {
813			var self = this,
814				$el = this.options.container;
815			$el.parent().magnificPopup( $.extend( true, {}, theme.mfpConfig, {
816				delegate: ".porto-vc-zoom",
817				gallery: {
818					enabled: true
819				},
820				mainClass: 'mfp-with-zoom',
821				zoom: {
822					enabled: true,
823					duration: 300
824				},
825				type: 'image'
826			} ) );
827
828			return this;
829		}
830	};
831
832	// expose to scope
833	$.extend( theme, {
834		VcImageZoom: VcImageZoom
835	} );
836
837	// jquery plugin
838	$.fn.themeVcImageZoom = function ( opts ) {
839		return this.map( function () {
840			var $this = $( this );
841
842			if ( $this.data( instanceName ) ) {
843				return $this.data( instanceName );
844			} else {
845				return new theme.VcImageZoom( $this, opts );
846			}
847
848		} );
849	}
850
851} ).apply( this, [ window.theme, jQuery ] );
852
853// Post Ajax on Modal
854( function ( theme, $ ) {
855	'use strict';
856
857	theme = theme || {};
858
859	var $rev_sliders;
860
861	$.extend( theme, {
862
863		PostAjaxModal: {
864
865			defaults: {
866				elements: '.page-portfolios'
867			},
868
869			initialize: function ( $elements, post_type ) {
870				this.$elements = ( $elements || $( this.defaults.elements ) );
871				if ( typeof post_type == 'undefined' ) {
872					post_type = 'portfolio';
873				}
874
875				this.build( post_type );
876
877				return this;
878			},
879
880			build: function ( post_type ) {
881				var parentobj = this,
882					postAjaxOnModal = {
883
884						$wrapper: null,
885						modals: [],
886						currentModal: 0,
887						total: 0,
888						p_type: 'portfolio',
889
890						build: function ( $this, p_type ) {
891							var self = this;
892							self.$wrapper = $this;
893							if ( !self.$wrapper ) {
894								return;
895							}
896							self.modals = [];
897							self.total = 0;
898							self.p_type = p_type;
899
900							$this.find( 'a[data-ajax-on-modal]' ).each( function () {
901								self.add( $( this ) );
902							} );
903
904							$this.off( 'mousedown', 'a[data-ajax-on-modal]' ).on( 'mousedown', 'a[data-ajax-on-modal]', function ( ev ) {
905								if ( ev.which == 2 ) {
906									ev.preventDefault();
907									return false;
908								}
909							} );
910						},
911
912						add: function ( $el ) {
913
914							var self = this,
915								href = $el.attr( 'href' ),
916								index = self.total;
917
918							self.modals.push( { src: href } );
919							self.total++;
920
921							$el.off( 'click' ).on( 'click', function ( e ) {
922								e.preventDefault();
923								self.show( index );
924								return false;
925							} );
926
927						},
928
929						next: function () {
930							var self = this;
931							if ( self.currentModal + 1 < self.total ) {
932								self.show( self.currentModal + 1 );
933							} else {
934								self.show( 0 );
935							}
936						},
937
938						prev: function () {
939							var self = this;
940
941							if ( ( self.currentModal - 1 ) >= 0 ) {
942								self.show( self.currentModal - 1 );
943							} else {
944								self.show( self.total - 1 );
945							}
946						},
947
948						show: function ( i ) {
949							var self = this;
950
951							self.currentModal = i;
952
953							if ( i < 0 || i > ( self.total - 1 ) ) {
954								return false;
955							}
956
957							$.magnificPopup.close();
958							$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
959								type: 'ajax',
960								items: self.modals,
961								gallery: {
962									enabled: true
963								},
964								ajax: {
965									settings: {
966										type: 'post',
967										data: {
968											ajax_action: self.p_type + '_ajax_modal'
969										}
970									}
971								},
972								mainClass: self.p_type + '-ajax-modal',
973								fixedContentPos: false,
974								callbacks: {
975									parseAjax: function ( mfpResponse ) {
976										var $response = $( mfpResponse.data ),
977											$post = $response.find( '#content article.' + self.p_type ),
978											$vc_css = $response.filter( 'style[data-type]:not("")' ),
979											vc_css = '';
980
981										$vc_css.each( function () {
982											vc_css += $( this ).text();
983										} );
984
985										if ( $( '#' + self.p_type + 'AjaxCSS' ).get( 0 ) ) {
986											$( '#' + self.p_type + 'AjaxCSS' ).text( vc_css );
987										} else {
988											$( '<style id="' + self.p_type + 'AjaxCSS">' + vc_css + '</style>' ).appendTo( "head" )
989										}
990
991										$post.find( '.' + self.p_type + '-nav-all' ).html( '<a href="#" data-ajax-' + self.p_type + '-close data-bs-tooltip data-original-title="' + js_porto_vars.popup_close + '" data-bs-placement="bottom"><i class="fas fa-th"></i></a>' );
992										$post.find( '.' + self.p_type + '-nav' ).html( '<a href="#" data-ajax-' + self.p_type + '-prev class="' + self.p_type + '-nav-prev" data-bs-tooltip data-original-title="' + js_porto_vars.popup_prev + '" data-bs-placement="bottom"><i class="fa"></i></a><a href="#" data-toggle="tooltip" data-ajax-' + self.p_type + '-next class="' + self.p_type + '-nav-next" data-bs-tooltip data-original-title="' + js_porto_vars.popup_next + '" data-bs-placement="bottom"><i class="fa"></i></a>' );
993										$post.find( '.elementor-invisible' ).removeClass( 'elementor-invisible' );
994										mfpResponse.data = '<div class="ajax-container">' + $post.html() + '</div>';
995									},
996									ajaxContentAdded: function () {
997										// Wrapper
998										var $wrapper = $( '.' + self.p_type + '-ajax-modal' );
999
1000										// Close
1001										$wrapper.find( 'a[data-ajax-' + self.p_type + '-close]' ).on( 'click', function ( e ) {
1002											e.preventDefault();
1003											$.magnificPopup.close();
1004											return false;
1005										} );
1006
1007										$rev_sliders = $wrapper.find( '.rev_slider, rs-module' );
1008
1009										// Remove Next and Close
1010										if ( self.modals.length <= 1 ) {
1011											$wrapper.find( 'a[data-ajax-' + self.p_type + '-prev], a[data-ajax-' + self.p_type + '-next]' ).remove();
1012										} else {
1013											// Prev
1014											$wrapper.find( 'a[data-ajax-' + self.p_type + '-prev]' ).on( 'click', function ( e ) {
1015												e.preventDefault();
1016												if ( $rev_sliders && $rev_sliders.get( 0 ) ) {
1017													try { $rev_sliders.revkill(); } catch ( err ) { }
1018												}
1019												$wrapper.find( '.mfp-arrow-left' ).trigger( 'click' );
1020												return false;
1021											} );
1022											// Next
1023											$wrapper.find( 'a[data-ajax-' + self.p_type + '-next]' ).on( 'click', function ( e ) {
1024												e.preventDefault();
1025												if ( $rev_sliders && $rev_sliders.get( 0 ) ) {
1026													try { $rev_sliders.revkill(); } catch ( err ) { }
1027												}
1028												$wrapper.find( '.mfp-arrow-right' ).trigger( 'click' );
1029												return false;
1030											} );
1031										}
1032										if ( 'portfolio' == self.p_type ) {
1033											$( window ).trigger( 'resize' );
1034										}
1035										porto_init();
1036										theme.refreshVCContent( $wrapper );
1037										setTimeout( function () {
1038											var videos = $wrapper.find( 'video' );
1039											if ( videos.get( 0 ) ) {
1040												videos.each( function () {
1041													$( this )[ 0 ].play();
1042													$( this ).parent().parent().parent().find( '.video-controls' ).attr( 'data-action', 'play' );
1043													$( this ).parent().parent().parent().find( '.video-controls' ).html( '<i class="ult-vid-cntrlpause"></i>' );
1044												} );
1045											}
1046										}, 600 );
1047										$wrapper.off( 'scroll' ).on( 'scroll', function () {
1048											$.fn.appear.run();
1049										} );
1050									},
1051									change: function () {
1052										$( '.mfp-wrap .ajax-container' ).trigger( 'click' );
1053									},
1054									beforeClose: function () {
1055										if ( $rev_sliders && $rev_sliders.get( 0 ) ) {
1056											try { $rev_sliders.revkill(); } catch ( err ) { }
1057										}
1058										// Wrapper
1059										var $wrapper = $( '.' + self.p_type + '-ajax-modal' );
1060										$wrapper.off( 'scroll' );
1061									}
1062								}
1063							} ), i );
1064						}
1065					};
1066
1067				parentobj.$elements.each( function () {
1068
1069					var $this = $( this );
1070
1071					if ( !$this.find( 'a[data-ajax-on-modal]' ).get( 0 ) ) {
1072						return;
1073					}
1074					if ( $this.data( post_type + 'AjaxOnModal' ) ) {
1075						return;
1076					}
1077
1078					postAjaxOnModal.build( $this, post_type );
1079
1080					$this.data( post_type + 'AjaxOnModal', postAjaxOnModal );
1081				} );
1082
1083				return parentobj;
1084			}
1085		}
1086
1087	} );
1088
1089	// Key Press
1090	$( document.documentElement ).on( 'keydown', function ( e ) {
1091		try {
1092			if ( e.keyCode == 37 || e.keyCode == 39 ) {
1093				if ( $rev_sliders && $rev_sliders.get( 0 ) ) {
1094					$rev_sliders.revkill();
1095				}
1096			}
1097		} catch ( err ) { }
1098	} );
1099
1100} ).apply( this, [ window.theme, jQuery ] );
1101
1102// Portfolio Ajax on Page
1103( function ( theme, $ ) {
1104	'use strict';
1105
1106	theme = theme || {};
1107
1108	var activePortfolioAjaxOnPage;
1109
1110	$.extend( theme, {
1111
1112		PortfolioAjaxPage: {
1113
1114			defaults: {
1115				elements: '.page-portfolios'
1116			},
1117
1118			initialize: function ( $elements ) {
1119				this.$elements = ( $elements || $( this.defaults.elements ) );
1120
1121				this.build();
1122
1123				return this;
1124			},
1125
1126			build: function () {
1127				var self = this;
1128
1129				self.$elements.each( function () {
1130
1131					var $this = $( this );
1132
1133					if ( !$this.find( '#portfolioAjaxBox' ).get( 0 ) ) {
1134						return;
1135					}
1136					if ( $this.data( 'portfolioAjaxOnPage' ) ) {
1137						return;
1138					}
1139
1140					var $container = $( this ),
1141						portfolioAjaxOnPage = {
1142
1143							$wrapper: $container,
1144							pages: [],
1145							currentPage: 0,
1146							total: 0,
1147							$ajaxBox: $this.find( '#portfolioAjaxBox' ),
1148							$ajaxBoxContent: $this.find( '#portfolioAjaxBoxContent' ),
1149
1150							build: function () {
1151								var self = this;
1152
1153								self.pages = [];
1154								self.total = 0;
1155
1156								$this.find( 'a[data-ajax-on-page]' ).each( function () {
1157									self.add( $( this ) );
1158								} );
1159
1160								$this.off( 'mousedown', 'a[data-ajax-on-page]' ).on( 'mousedown', 'a[data-ajax-on-page]', function ( ev ) {
1161									if ( ev.which == 2 ) {
1162										ev.preventDefault();
1163										return false;
1164									}
1165								} );
1166							},
1167
1168							add: function ( $el ) {
1169
1170								var self = this,
1171									href = $el.attr( 'href' );
1172
1173								self.pages.push( href );
1174								self.total++;
1175
1176								$el.off( 'click' ).on( 'click', function ( e ) {
1177									e.preventDefault();
1178									/* D3-Start */
1179									var _class = e.target.className
1180									if ( _class == 'owl-next' ) {
1181										return false;
1182									} else if ( _class == 'owl-prev' ) {
1183										return false;
1184									} else {
1185										self.show( self.pages.indexOf( href ) );
1186									}
1187									/* End-D3 */
1188									return false;
1189								} );
1190
1191							},
1192
1193							events: function () {
1194								var self = this;
1195
1196								// Close
1197								$this.off( 'click', 'a[data-ajax-portfolio-close]' ).on( 'click', 'a[data-ajax-portfolio-close]', function ( e ) {
1198									e.preventDefault();
1199									self.close();
1200									return false;
1201								} );
1202
1203								if ( self.total <= 1 ) {
1204									$( 'a[data-ajax-portfolio-prev], a[data-ajax-portfolio-next]' ).remove();
1205								} else {
1206									// Prev
1207									$this.off( 'click', 'a[data-ajax-portfolio-prev]' ).on( 'click', 'a[data-ajax-portfolio-prev]', function ( e ) {
1208										e.preventDefault();
1209										self.prev();
1210										return false;
1211									} );
1212									// Next
1213									$this.off( 'click', 'a[data-ajax-portfolio-next]' ).on( 'click', 'a[data-ajax-portfolio-next]', function ( e ) {
1214										e.preventDefault();
1215										self.next();
1216										return false;
1217									} );
1218								}
1219							},
1220
1221							close: function () {
1222								var self = this;
1223
1224								if ( self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).get( 0 ) ) {
1225									try { self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).revkill(); } catch ( err ) { }
1226								}
1227								self.$ajaxBoxContent.empty();
1228								self.$ajaxBox.removeClass( 'ajax-box-init' ).removeClass( 'ajax-box-loading' );
1229							},
1230
1231							next: function () {
1232								var self = this;
1233								if ( self.currentPage + 1 < self.total ) {
1234									self.show( self.currentPage + 1 );
1235								} else {
1236									self.show( 0 );
1237								}
1238							},
1239
1240							prev: function () {
1241								var self = this;
1242
1243								if ( ( self.currentPage - 1 ) >= 0 ) {
1244									self.show( self.currentPage - 1 );
1245								} else {
1246									self.show( self.total - 1 );
1247								}
1248							},
1249
1250							show: function ( i ) {
1251								var self = this;
1252
1253								activePortfolioAjaxOnPage = null;
1254
1255								if ( self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).get( 0 ) ) {
1256									try { self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).revkill(); } catch ( err ) { }
1257								}
1258								self.$ajaxBoxContent.empty();
1259								self.$ajaxBox.removeClass( 'ajax-box-init' ).addClass( 'ajax-box-loading' );
1260
1261								theme.scrolltoContainer( self.$ajaxBox );
1262
1263								self.currentPage = i;
1264
1265								if ( i < 0 || i > ( self.total - 1 ) ) {
1266									self.close();
1267									return false;
1268								}
1269
1270								// Ajax
1271								$.ajax( {
1272									url: self.pages[ i ],
1273									complete: function ( data ) {
1274										var $response = $( data.responseText ),
1275											$portfolio = $response.find( '#content article.portfolio' ),
1276											$vc_css = $response.filter( 'style[data-type]:not("")' ),
1277											vc_css = '';
1278
1279										if ( $( '#portfolioAjaxCSS' ).get( 0 ) ) {
1280											$( '#portfolioAjaxCSS' ).text( vc_css );
1281										} else {
1282											$( '<style id="portfolioAjaxCSS">' + vc_css + '</style>' ).appendTo( "head" )
1283										}
1284
1285										$portfolio.find( '.portfolio-nav-all' ).html( '<a href="#" data-ajax-portfolio-close data-bs-tooltip data-original-title="' + js_porto_vars.popup_close + '"><i class="fas fa-th"></i></a>' );
1286										$portfolio.find( '.portfolio-nav' ).html( '<a href="#" data-ajax-portfolio-prev class="portfolio-nav-prev" data-bs-tooltip data-original-title="' + js_porto_vars.popup_prev + '"><i class="fa"></i></a><a href="#" data-toggle="tooltip" data-ajax-portfolio-next class="portfolio-nav-next" data-bs-tooltip data-original-title="' + js_porto_vars.popup_next + '"><i class="fa"></i></a>' );
1287										self.$ajaxBoxContent.html( $portfolio.html() ).append( '<div class="row"><div class="col-lg-12"><hr class="tall"></div></div>' );
1288										self.$ajaxBox.removeClass( 'ajax-box-loading' );
1289										$( window ).trigger( 'resize' );
1290										porto_init();
1291										theme.refreshVCContent( self.$ajaxBoxContent );
1292										self.events();
1293										activePortfolioAjaxOnPage = self;
1294
1295										self.$ajaxBoxContent.find( '.lightbox:not(.manual)' ).each( function () {
1296											var $this = $( this ),
1297												opts;
1298
1299											var pluginOptions = $this.data( 'plugin-options' );
1300											if ( pluginOptions )
1301												opts = pluginOptions;
1302
1303											$this.themeLightbox( opts );
1304										} );
1305									}
1306								} );
1307							}
1308						};
1309
1310					portfolioAjaxOnPage.build();
1311
1312					$this.data( 'portfolioAjaxOnPage', portfolioAjaxOnPage );
1313				} );
1314
1315				return self;
1316			}
1317		}
1318
1319	} );
1320
1321	// Key Press
1322	$( document.documentElement ).on( 'keyup', function ( e ) {
1323		try {
1324			if ( !activePortfolioAjaxOnPage ) return;
1325			// Next
1326			if ( e.keyCode == 39 ) {
1327				activePortfolioAjaxOnPage.next();
1328			}
1329			// Prev
1330			if ( e.keyCode == 37 ) {
1331				activePortfolioAjaxOnPage.prev();
1332			}
1333		} catch ( err ) { }
1334	} );
1335
1336} ).apply( this, [ window.theme, jQuery ] );
1337
1338// Post Filter
1339( function ( theme, $ ) {
1340	'use strict';
1341
1342	theme = theme || {};
1343
1344	$.extend( theme, {
1345
1346		PostFilter: {
1347
1348			cache: {
1349			},
1350
1351			defaults: {
1352				elements: '.portfolio-filter'
1353			},
1354
1355			initialize: function ( $elements, post_type ) {
1356				this.$elements = ( $elements || $( this.defaults.elements ) );
1357				this.build( post_type );
1358
1359				return this;
1360			},
1361
1362			filterFn: function ( e ) {
1363				if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) {
1364					return;
1365				}
1366				var self = e.data.selfobj;
1367
1368				if ( self.isLoading ) {
1369					return false;
1370				}
1371				var $this = e.data.thisobj,
1372					$elements = e.data.elements,
1373					position = e.data.position,
1374					post_type = e.data.post_type,
1375					$parent = e.data.parent,
1376					$posts_wrap = e.data.posts_wrap,
1377					use_ajax = e.data.use_ajax,
1378					page_path = e.data.page_path,
1379					infinite_load = e.data.infinite_load,
1380					load_more = e.data.load_more;
1381				e.preventDefault();
1382				if ( $( this ).hasClass( 'active' ) ) {
1383					return;
1384				}
1385
1386				self.isLoading = true;
1387				var selector = $( this ).attr( 'data-filter' );
1388				if ( 'sidebar' == position ) {
1389					$( '.sidebar-overlay' ).trigger( 'click' );
1390				}
1391
1392				$this.find( '.active' ).removeClass( 'active' );
1393
1394				if ( use_ajax ) {
1395					var current_cat = '*' == selector ? '' : selector;
1396					if ( !page_path ) {
1397						page_path = $posts_wrap.data( 'page_path' );
1398					}
1399					if ( page_path ) {
1400						$posts_wrap.data( 'page_path', page_path.replace( /&category=[^&]*&/, '&category=' + current_cat + '&' ) );
1401					}
1402
1403					$( this ).addClass( 'active' );
1404					self.load_posts( current_cat, infinite_load || load_more ? true : false, $parent, post_type, $posts_wrap, undefined, $( this ).children( 'a' ).attr( 'href' ) );
1405				} else if ( 'faq' == post_type ) {
1406					$parent.find( '.faq' ).each( function () {
1407						var $that = $( this ), easing = "easeInOutQuart", timeout = 300;
1408						if ( selector == '*' ) {
1409							if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function () {
1410								$( this ).attr( 'style', '' ).show();
1411							} );
1412							selected++;
1413						} else {
1414							if ( $that.hasClass( selector ) ) {
1415								if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function () {
1416									$( this ).attr( 'style', '' ).show();
1417								} );
1418								selected++;
1419							} else {
1420								if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function () {
1421									$( this ).attr( 'style', '' ).hide();
1422								} );
1423							}
1424						}
1425					} );
1426
1427					if ( !selected && $parent.find( '.faqs-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) {
1428						$parent.find( '.faqs-infinite' ).infinitescroll( 'retrieve' );
1429					}
1430				} else if ( $parent.hasClass( 'portfolios-timeline' ) ) {
1431					var selected = 0;
1432					$parent.find( '.portfolio' ).each( function () {
1433						var $that = $( this ), easing = "easeInOutQuart", timeout = 300;
1434						if ( selector == '*' ) {
1435							if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function () {
1436								$( this ).attr( 'style', '' ).show();
1437							} );
1438							selected++;
1439						} else {
1440							if ( $that.hasClass( selector ) ) {
1441								if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function () {
1442									$( this ).attr( 'style', '' ).show();
1443								} );
1444								selected++;
1445							} else {
1446								if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function () {
1447									$( this ).attr( 'style', '' ).hide();
1448								} );
1449							}
1450						}
1451					} );
1452					if ( !selected && $parent.find( '.portfolios-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) {
1453						$parent.find( '.portfolios-infinite' ).infinitescroll( 'retrieve' );
1454					}
1455					setTimeout( function () {
1456						theme.FilterZoom.initialize( $parent );
1457					}, 400 );
1458				} else {
1459					$parent.find( '.' + post_type + '-row' ).isotope( {
1460						filter: selector == '*' ? selector : '.' + selector
1461					} );
1462				}
1463
1464				if ( !use_ajax ) {
1465					$( this ).addClass( 'active' );
1466					self.isLoading = false;
1467				}
1468
1469				if ( position == 'sidebar' ) {
1470					self.$elements.each( function () {
1471						var $that = $( this );
1472
1473						if ( $that == $this && $that.data( 'position' ) != 'sidebar' ) return;
1474						$that.find( 'li' ).removeClass( 'active' );
1475						$that.find( 'li[data-filter="' + selector + '"]' ).addClass( 'active' );
1476					} );
1477				}
1478
1479				if ( !use_ajax ) {
1480					window.location.hash = '#' + selector;
1481				}
1482				theme.refreshVCContent();
1483				return false;
1484			},
1485
1486			build: function ( post_type_param ) {
1487				var self = this;
1488
1489				self.$elements.each( function () {
1490					var $this = $( this ),
1491						position = $this.data( 'position' ),
1492						$parent,
1493						post_type;
1494					if ( typeof post_type_param == 'undefined' ) {
1495						if ( $this.hasClass( 'member-filter' ) ) {
1496							post_type = 'member';
1497						} else if ( $this.hasClass( 'faq-filter' ) ) {
1498							post_type = 'faq';
1499						} else if ( $this.hasClass( 'product-filter' ) ) {
1500							post_type = 'product';
1501						} else if ( $this.hasClass( 'post-filter' ) ) {
1502							post_type = 'post';
1503						} else if ( $this.hasClass( 'portfolio-filter' ) ) {
1504							post_type = 'portfolio';
1505						} else {
1506							post_type = $this.attr( 'data-filter-type' );
1507						}
1508					} else {
1509						post_type = post_type_param;
1510					}
1511
1512					if ( 'sidebar' == position ) {
1513						$parent = $( '.main-content .page-' + post_type + 's' );
1514						//theme.scrolltoContainer($parent);
1515					} else if ( 'global' == position ) {
1516						$parent = $( '.main-content .page-' + post_type + 's' );
1517					} else {
1518						$parent = $this.closest( '.page-' + post_type + 's' );
1519					}
1520					if ( !$parent.length ) {
1521						$parent = $this.closest( '.porto-posts-grid' );
1522					}
1523					if ( !$parent || !$parent.length ) {
1524						return;
1525					}
1526					var use_ajax = $this.hasClass( 'porto-ajax-filter' ),
1527						infinite_load = $parent.hasClass( 'load-infinite' ),
1528						load_more = $parent.hasClass( 'load-more' );
1529
1530					var $posts_wrap = $parent.find( '.' + post_type + 's-container' ),
1531						page_path;
1532					if ( use_ajax && ( ( !infinite_load && !load_more ) || !$parent.data( 'ajax_load_options' ) ) ) {
1533						var current_url = window.location.href;
1534						if ( -1 !== current_url.indexOf( '#' ) ) {
1535							current_url = current_url.split( '#' )[ 0 ];
1536						}
1537						page_path = theme.ajax_url + '?action=porto_ajax_posts&nonce=' + js_porto_vars.porto_nonce + '&post_type=' + post_type + '&current_link=' + current_url + '&category=&page=%cur_page%';
1538						if ( $parent.data( 'post_layout' ) ) {
1539							page_path += '&post_layout=' + $parent.data( 'post_layout' );
1540						}
1541						$posts_wrap.data( 'page_path', page_path );
1542					}
1543
1544					$this.find( 'li' ).on( 'click', { thisobj: $this, selfobj: self, elements: self.$elements, position: position, parent: $parent, post_type: post_type, posts_wrap: $posts_wrap, use_ajax: use_ajax, page_path: page_path, infinite_load: infinite_load, load_more: load_more }, self.filterFn );
1545				} );
1546
1547				$( window ).on( 'hashchange', { elements: self.$elements }, self.hashchange );
1548				self.hashchange( { data: { elements: self.$elements } } );
1549
1550				return self;
1551			},
1552
1553			hashchange: function ( e ) {
1554				if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) {
1555					return;
1556				}
1557				var $elements = e.data.elements,
1558					$filter = $( $elements.get( 0 ) ),
1559					hash = window.location.hash;
1560
1561				if ( hash ) {
1562					var $o = $filter.find( 'li[data-filter="' + hash.replace( '#', '' ) + '"]' );
1563					if ( !$o.hasClass( 'active' ) ) {
1564						$o.trigger( 'click' );
1565					}
1566				}
1567			},
1568
1569			set_elements: function ( $elements ) {
1570				var self = this;
1571				if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) {
1572					self.destroy( self.$elements );
1573					return;
1574				}
1575				self.$elements = $elements;
1576				$( window ).off( 'hashchange', self.hashchange ).on( 'hashchange', { elements: $elements }, self.hashchange );
1577			},
1578
1579			destroy: function ( $elements ) {
1580				if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) {
1581					return;
1582				}
1583				var self = this;
1584				$elements.find( 'li' ).off( 'click', self.filterFn );
1585				$( window ).off( 'hashchange', self.hashchange );
1586			},
1587
1588			load_posts: function ( cat, is_infinite, $parent, post_type, $posts_wrap, default_args, page_url ) {
1589				var pid = $parent.attr( 'id' ),
1590					self = this,
1591					is_archive = $parent.hasClass( 'archive-posts' ),
1592					successfn = function ( res, directcall ) {
1593						if ( !res ) {
1594							return;
1595						}
1596						if ( ( typeof directcall == 'undefined' || true !== directcall ) && typeof default_args == 'undefined' && pid ) {
1597							if ( !self.cache[ pid ] ) {
1598								self.cache[ pid ] = {};
1599							}
1600							self.cache[ pid ][ cat ] = res;
1601						}
1602						var $res = $( res ),
1603							is_shop = $parent.hasClass( 'archive-products' ),
1604							$posts = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ).children();
1605
1606						if ( !$posts.length ) {
1607							return;
1608						}
1609						if ( typeof $posts_wrap == 'undefined' || is_archive ) {
1610							$posts_wrap = $parent.find( '.' + post_type + 's-container' );
1611						}
1612						if ( !$posts_wrap.length ) {
1613							return;
1614						}
1615
1616						if ( $posts_wrap.data( 'isotope' ) ) {
1617							$posts_wrap.isotope( 'remove', $posts_wrap.children() );
1618						} else {
1619							$posts_wrap.children().remove();
1620						}
1621
1622						if ( $posts_wrap.hasClass( 'owl-loaded' ) ) {
1623							$posts_wrap.removeClass( 'owl-loaded' );
1624						}
1625
1626						$posts_wrap.append( $posts );
1627						theme.refreshVCContent( $posts );
1628
1629						// filter
1630						var $old_filter = $parent.find( '.' + post_type + '-filter' );
1631						if ( $old_filter.length && !$old_filter.hasClass( 'porto-ajax-filter' ) && !$parent.hasClass( 'load-infinite' ) && !$parent.hasClass( 'load-more' ) ) {
1632							var $new_filter = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.' + post_type + '-filter' );
1633							if ( $new_filter.length ) {
1634								$old_filter.find( 'li:first-child' ).trigger( 'click' );
1635								theme.PostFilter.destroy( $old_filter );
1636								$old_filter.replaceWith( $new_filter );
1637								//$new_filter = $parent.find( '.' + post_type + '-filter' );
1638								theme.PostFilter.initialize( $new_filter, post_type );
1639								theme.PostFilter.set_elements( $( 'ul[data-filter-type]' ) );
1640							}
1641						}
1642
1643						porto_init( $parent );
1644
1645						var behavior_action = '';
1646						if ( post_type != 'product' && post_type != 'member' && post_type != 'faq' && post_type != 'portfolio' && post_type != 'post' ) {
1647							behavior_action = 'ptu';
1648						} else {
1649							behavior_action = post_type;
1650						}
1651						theme.PostsInfinite[ behavior_action + 'Behavior' ]( $posts, $posts_wrap );
1652
1653						// pagination
1654						var $old_pagination = $parent.find( '.pagination-wrap' ),
1655							$new_pagination = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.pagination-wrap' ).eq( 0 ),
1656							has_pagination = false;
1657						if ( $old_pagination.length ) {
1658							if ( $new_pagination.length ) {
1659								$old_pagination.replaceWith( $new_pagination );
1660								has_pagination = true;
1661							} else {
1662								$old_pagination.children().remove();
1663							}
1664						} else if ( $new_pagination.length ) {
1665							$parent.append( $new_pagination );
1666							has_pagination = true;
1667						}
1668
1669						if ( is_infinite ) {
1670							var infinitescroll_ins = $posts_wrap.data( 'infinitescroll' );
1671							if ( has_pagination ) {
1672								var $new_posts_wrap = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' );
1673								if ( $new_posts_wrap.data( 'cur_page' ) ) {
1674									$posts_wrap.data( 'cur_page', $new_posts_wrap.data( 'cur_page' ) );
1675									$posts_wrap.data( 'max_page', $new_posts_wrap.data( 'max_page' ) );
1676								}
1677
1678								var should_init_again = true;
1679								if ( infinitescroll_ins ) {
1680									if ( infinitescroll_ins.options.state.isDestroyed ) {
1681										$posts_wrap.removeData( 'infinitescroll' );
1682									} else {
1683										should_init_again = false;
1684										if ( $new_posts_wrap.data( 'cur_page' ) ) {
1685											infinitescroll_ins.update( {
1686												maxPage: $new_posts_wrap.data( 'max_page' ),
1687												state: {
1688													currPage: $new_posts_wrap.data( 'cur_page' )
1689												}
1690											} );
1691										}
1692										if ( infinitescroll_ins.options.state.isPaused ) {
1693											infinitescroll_ins.resume();
1694										}
1695									}
1696								}
1697
1698								if ( should_init_again ) {
1699									var ins = $posts_wrap.data( '__postsinfinite' );
1700									if ( ins ) {
1701										ins.destroy();
1702									}
1703									new theme.PostsInfinite( $posts_wrap, '.' + post_type + ', .timeline-date', $posts_wrap.data( 'infiniteoptions' ), post_type );
1704								}
1705
1706								if ( is_archive ) {
1707									var page_path = $posts_wrap.siblings( '.pagination-wrap' ).find( '.next' ).attr( 'href' );
1708									if ( page_path ) {
1709										page_path += ( -1 !== page_path.indexOf( '?' ) ? '&' : '?' ) + 'portoajax=1&load_posts_only=2';
1710										page_path = page_path.replace( /(paged=)(\d+)|(page\/)(\d+)/, '$1$3%cur_page%' );
1711										$posts_wrap.data( 'page_path', page_path );
1712									}
1713								}
1714
1715								new theme.PostsInfinite( $posts_wrap, '.' + post_type + ', .timeline-date', $posts_wrap.data( 'infiniteoptions' ), post_type );
1716							}
1717						}
1718
1719						// in archive page
1720						if ( is_archive ) {
1721							// update widgets
1722							$( '.sidebar-content' ).each( function ( index ) {
1723								var $this = $( this ),
1724									$that = $( $res.find( '.sidebar-content' ).get( index ) );
1725
1726								$this.html( $that.html() );
1727
1728								// in shop
1729								if ( is_shop ) {
1730									if ( typeof updateSelect2 != 'undefined' && updateSelect2 ) {
1731										// Use Select2 enhancement if possible
1732										if ( jQuery().selectWoo ) {
1733											var porto_wc_layered_nav_select = function () {
1734												$this.find( 'select.woocommerce-widget-layered-nav-dropdown' ).each( function () {
1735													$( this ).selectWoo( {
1736														placeholder: $( this ).find( 'option' ).eq( 0 ).text(),
1737														minimumResultsForSearch: 5,
1738														width: '100%',
1739														allowClear: typeof $( this ).attr( 'multiple' ) != 'undefined' && $( this ).attr( 'multiple' ) == 'multiple' ? 'false' : 'true'
1740													} );
1741												} );
1742											};
1743											porto_wc_layered_nav_select();
1744										}
1745										$( 'body' ).children( 'span.select2-container' ).remove();
1746									}
1747								}
1748							} );
1749
1750							// in shop
1751							if ( is_shop ) {
1752								var $script = $res.filter( 'script:contains("var woocommerce_price_slider_params")' ).first();
1753								if ( $script && $script.length && $script.text().indexOf( '{' ) !== -1 && $script.text().indexOf( '}' ) !== -1 ) {
1754									var arrStr = $script.text().substring( $script.text().indexOf( '{' ), $script.text().indexOf( '}' ) + 1 );
1755									window.woocommerce_price_slider_params = JSON.parse( arrStr );
1756								}
1757
1758								// update entry title
1759								var $title = $( '.entry-title' );
1760								if ( $title.length ) {
1761									var $newTitle = $res.find( '.entry-title' ).eq( 0 );
1762									if ( $newTitle.length ) {
1763										$title.html( $newTitle.html() );
1764									}
1765								}
1766
1767								// update entry description
1768								var $desc = $( '.entry-description' );
1769								if ( $desc.length ) {
1770									var $newDesc = $res.find( '.entry-description' ).eq( 0 );
1771									if ( $newDesc.length ) {
1772										$desc.html( $newDesc.html() );
1773									}
1774								}
1775
1776								// top toolbar
1777								var shop_before = '.shop-loop-before',
1778									$shop_before = $( shop_before );
1779								if ( $shop_before.length ) {
1780									if ( $res.find( shop_before ).length ) {
1781										$shop_before.each( function ( index ) {
1782											var $res_shop_before = $res.find( shop_before ).eq( index );
1783											if ( $res_shop_before.length ) {
1784												$( this ).html( $res_shop_before.html() ).show();
1785											}
1786										} );
1787									} else {
1788										$shop_before.empty();
1789									}
1790								}
1791
1792								// update result count
1793								var $count = $( '.woocommerce-result-count' );
1794								if ( $count.length ) {
1795									var $newCount = $res.find( '.woocommerce-result-count' ).eq( 0 );
1796									if ( $newCount.length ) {
1797										$count[ 0 ].outerHTML = $newCount.length ? $newCount[ 0 ].outerHTML : '';
1798									}
1799								}
1800
1801								// trigger ready event
1802								$( document ).trigger( 'yith-wcan-ajax-filtered' );
1803							}
1804
1805							// update browser history (IE doesn't support it)
1806							if ( page_url && !navigator.userAgent.match( /msie/i ) ) {
1807								window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url );
1808							}
1809						}
1810
1811						$( document.body ).trigger( 'porto_load_posts_end', [ $parent.parent() ] );
1812					};
1813
1814				if ( typeof default_args == 'undefined' && typeof self.cache[ pid ] != 'undefined' && typeof self.cache[ pid ][ cat ] != 'undefined' && self.cache[ pid ][ cat ] ) {
1815					successfn( self.cache[ pid ][ cat ], true );
1816					self.isLoading = false;
1817					$parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove();
1818					return;
1819				}
1820
1821				var ajax_load_options = $parent.data( 'ajax_load_options' );
1822				if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) ||
1823					( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton screen in archive builder
1824					$posts_wrap = $parent.find( '.' + post_type + 's-container' );
1825					if ( ajax_load_options ) {
1826						var tag_name = 'div';
1827						if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) {
1828							tag_name = 'li';
1829						}
1830						$posts_wrap.addClass( 'skeleton-body' ).empty();
1831						for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) {
1832							$posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' );
1833						}
1834					} else {
1835						$posts_wrap.addClass( 'skeleton-body' ).children().empty();
1836					}
1837				} else {
1838					if ( !$parent.children( '.porto-loading-icon' ).length ) {
1839						$parent.append( '<i class="porto-loading-icon"></i>' );
1840					}
1841					$parent.addClass( 'porto-ajax-loading' );
1842				}
1843
1844				var current_url = window.location.href;
1845				if ( -1 !== current_url.indexOf( '#' ) ) {
1846					current_url = current_url.split( '#' )[ 0 ];
1847				}
1848
1849				var args, load_url = theme.ajax_url;
1850				if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder
1851					args = {
1852						portoajax: true,
1853						load_posts_only: true
1854					};
1855					if ( $parent.closest( '.porto-block' ).length ) {
1856						args[ 'builder_id' ] = $parent.closest( '.porto-block' ).data( 'id' );
1857					}
1858					load_url = typeof page_url != 'undefined' ? page_url : current_url;
1859				} else {
1860					args = {
1861						action: 'porto_ajax_posts',
1862						nonce: js_porto_vars.porto_nonce,
1863						post_type: post_type,
1864						current_link: current_url
1865					};
1866					if ( $parent.data( 'post_layout' ) ) {
1867						args[ 'post_layout' ] = $parent.data( 'post_layout' );
1868					}
1869					if ( ajax_load_options ) {
1870						args[ 'extra' ] = ajax_load_options;
1871					}
1872					if ( typeof default_args != 'undefined' ) {
1873						args = $.extend( args, default_args );
1874					}
1875				}
1876				if ( cat ) {
1877					args[ 'category' ] = cat;
1878				}
1879
1880				$.ajax( {
1881					url: load_url,
1882					type: 'post',
1883					data: args,
1884					success: successfn,
1885					complete: function () {
1886						self.isLoading = false;
1887						$posts_wrap.removeClass( 'skeleton-body' );
1888						$parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove();
1889					}
1890				} );
1891
1892			}
1893		}
1894
1895	} );
1896
1897} ).apply( this, [ window.theme, jQuery ] );
1898
1899// Member Ajax on Page
1900( function ( theme, $ ) {
1901	'use strict';
1902
1903	theme = theme || {};
1904
1905	var activeMemberAjaxOnPage;
1906
1907	$.extend( theme, {
1908
1909		MemberAjaxPage: {
1910
1911			defaults: {
1912				elements: '.page-members'
1913			},
1914
1915			initialize: function ( $elements ) {
1916				this.$elements = ( $elements || $( this.defaults.elements ) );
1917
1918				this.build();
1919
1920				return this;
1921			},
1922
1923			build: function () {
1924				var self = this;
1925
1926				self.$elements.each( function () {
1927
1928					var $this = $( this );
1929
1930					if ( !$this.find( '#memberAjaxBox' ).get( 0 ) )
1931						return;
1932
1933					var $container = $( this ),
1934						memberAjaxOnPage = {
1935
1936							$wrapper: $container,
1937							pages: [],
1938							currentPage: 0,
1939							total: 0,
1940							$ajaxBox: $this.find( '#memberAjaxBox' ),
1941							$ajaxBoxContent: $this.find( '#memberAjaxBoxContent' ),
1942
1943							build: function () {
1944								var self = this;
1945
1946								self.pages = [];
1947								self.total = 0;
1948
1949								$this.find( 'a[data-ajax-on-page]' ).each( function () {
1950									self.add( $( this ) );
1951								} );
1952
1953								$this.off( 'mousedown', 'a[data-ajax-on-page]' ).on( 'mousedown', 'a[data-ajax-on-page]', function ( ev ) {
1954									if ( ev.which == 2 ) {
1955										ev.preventDefault();
1956										return false;
1957									}
1958								} );
1959							},
1960
1961							add: function ( $el ) {
1962
1963								var self = this,
1964									href = $el.attr( 'href' );
1965
1966								self.pages.push( href );
1967								self.total++;
1968
1969								$el.off( 'click' ).on( 'click', function ( e ) {
1970									e.preventDefault();
1971									self.show( self.pages.indexOf( href ) );
1972									return false;
1973								} );
1974
1975							},
1976
1977							next: function () {
1978								var self = this;
1979								if ( self.currentPage + 1 < self.total ) {
1980									self.show( self.currentPage + 1 );
1981								} else {
1982									self.show( 0 );
1983								}
1984							},
1985
1986							prev: function () {
1987								var self = this;
1988
1989								if ( ( self.currentPage - 1 ) >= 0 ) {
1990									self.show( self.currentPage - 1 );
1991								} else {
1992									self.show( self.total - 1 );
1993								}
1994							},
1995
1996							show: function ( i ) {
1997								var self = this;
1998
1999								activeMemberAjaxOnPage = null;
2000
2001								if ( self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).get( 0 ) ) {
2002									try { self.$ajaxBoxContent.find( '.rev_slider, rs-module' ).revkill(); } catch ( err ) { }
2003								}
2004								self.$ajaxBoxContent.empty();
2005								self.$ajaxBox.removeClass( 'ajax-box-init' ).addClass( 'ajax-box-loading' );
2006
2007								theme.scrolltoContainer( self.$ajaxBox );
2008
2009								self.currentPage = i;
2010
2011								if ( i < 0 || i > ( self.total - 1 ) ) {
2012									self.close();
2013									return false;
2014								}
2015
2016								// Ajax
2017								$.ajax( {
2018									url: self.pages[ i ],
2019									complete: function ( data ) {
2020										var $response = $( data.responseText ),
2021											$member = $response.find( '#content article.member' ),
2022											$vc_css = $response.filter( 'style[data-type]:not("")' ),
2023											vc_css = '';
2024
2025										$vc_css.each( function () {
2026											vc_css += $( this ).text();
2027										} );
2028
2029										if ( $( '#memberAjaxCSS' ).get( 0 ) ) {
2030											$( '#memberAjaxCSS' ).text( vc_css );
2031										} else {
2032											$( '<style id="memberAjaxCSS">' + vc_css + '</style>' ).appendTo( "head" )
2033										}
2034
2035										var $append = self.$ajaxBox.find( '.ajax-content-append' ), html = '';
2036										if ( $append.length ) html = $append.html();
2037										self.$ajaxBoxContent.html( $member.html() ).prepend( '<div class="row"><div class="col-lg-12"><hr class="tall m-t-none"></div></div>' ).append( '<div class="row"><div class="col-md-12"><hr class="m-t-md"></div></div>' + html );
2038
2039										self.$ajaxBox.removeClass( 'ajax-box-loading' );
2040										$( window ).trigger( 'resize' );
2041										porto_init();
2042										theme.refreshVCContent( self.$ajaxBoxContent );
2043										activeMemberAjaxOnPage = self;
2044									}
2045								} );
2046							}
2047						};
2048
2049					memberAjaxOnPage.build();
2050
2051					$this.data( 'memberAjaxOnPage', memberAjaxOnPage );
2052				} );
2053
2054				return self;
2055			}
2056		}
2057
2058	} );
2059
2060	// Key Press
2061	$( document.documentElement ).on( 'keyup', function ( e ) {
2062		try {
2063			if ( !activeMemberAjaxOnPage ) return;
2064			// Next
2065			if ( e.keyCode == 39 ) {
2066				activeMemberAjaxOnPage.next();
2067			}
2068			// Prev
2069			if ( e.keyCode == 37 ) {
2070				activeMemberAjaxOnPage.prev();
2071			}
2072		} catch ( err ) { }
2073	} );
2074
2075} ).apply( this, [ window.theme, jQuery ] );
2076
2077// Filter Zoom
2078( function ( theme, $ ) {
2079	'use strict';
2080
2081	theme = theme || {};
2082
2083	$.extend( theme, {
2084
2085		FilterZoom: {
2086
2087			defaults: {
2088				elements: null
2089			},
2090
2091			initialize: function ( $elements ) {
2092				this.$elements = ( $elements || this.defaults.elements );
2093
2094				this.build();
2095
2096				return this;
2097			},
2098
2099			build: function () {
2100				var self = this;
2101
2102				self.$elements.each( function () {
2103					var $this = $( this ),
2104						zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 );
2105
2106					if ( !zoom ) return;
2107
2108					$this.find( '.zoom, .thumb-info-zoom' ).off( 'click' );
2109					var links = [];
2110					var i = 0;
2111					$this.find( 'article' ).each( function () {
2112						var $that = $( this );
2113						if ( $that.css( 'display' ) != 'none' ) {
2114							var $zoom = $that.find( '.zoom, .thumb-info-zoom' ),
2115								slide,
2116								src = $zoom.data( 'src' ),
2117								title = $zoom.data( 'title' );
2118
2119							$zoom.data( 'index', i );
2120							if ( Array.isArray( src ) ) {
2121								$.each( src, function ( index, value ) {
2122									slide = {};
2123									slide.src = value;
2124									slide.title = title[ index ];
2125									links[ i ] = slide;
2126									i++;
2127								} );
2128							} else {
2129								slide = {};
2130								slide.src = src;
2131								slide.title = title;
2132								links[ i ] = slide;
2133								i++;
2134							}
2135						}
2136					} );
2137					$this.find( 'article' ).each( function () {
2138						var $that = $( this );
2139						if ( $that.css( 'display' ) != 'none' ) {
2140							$that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function ( e ) {
2141								var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0;
2142								if ( $parent.get( 0 ) ) {
2143									var $slider = $parent.find( '.porto-carousel' );
2144									if ( $slider.get( 0 ) ) {
2145										offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2;
2146									}
2147								}
2148								e.preventDefault();
2149								if ( $.fn.magnificPopup ) {
2150									$.magnificPopup.close();
2151									$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
2152										items: links,
2153										gallery: {
2154											enabled: true
2155										},
2156										type: 'image'
2157									} ), $zoom.data( 'index' ) + offset );
2158								}
2159								return false;
2160							} );
2161						}
2162					} );
2163				} );
2164
2165				return self;
2166			}
2167		}
2168
2169	} );
2170
2171} ).apply( this, [ window.theme, jQuery ] );
2172
2173// Mouse Parallax
2174( function ( theme, $ ) {
2175	'use strict';
2176
2177	theme = theme || {};
2178
2179	var instanceName = '__parallax';
2180
2181	var Mouseparallax = function ( $el, opts ) {
2182		return this.initialize( $el, opts );
2183	};
2184
2185	Mouseparallax.prototype = {
2186		initialize: function ( $el, opts ) {
2187			this.$el = $el;
2188
2189			this
2190				.setData()
2191				.setOptions( opts )
2192				.build();
2193
2194			return this;
2195		},
2196
2197		setData: function () {
2198			this.$el.data( instanceName, this );
2199			return this;
2200		},
2201
2202		setOptions: function ( opts ) {
2203			this.options = $.extend( true, {}, {
2204				wrapper: this.$el,
2205				opts: opts
2206			} );
2207			return this;
2208		},
2209
2210		build: function () {
2211			if ( !$.fn.parallax ) {
2212				return this;
2213			}
2214
2215			var $el = this.options.wrapper,
2216				opts = this.options.opts
2217
2218			$el.parallax( opts );
2219		}
2220	};
2221
2222	//expose to scope
2223	$.extend( theme, {
2224		Mouseparallax: Mouseparallax
2225	} );
2226
2227	// jquery plugin
2228	$.fn.themeMouseparallax = function ( opts ) {
2229		var obj = this.map( function () {
2230			var $this = $( this );
2231
2232			if ( $this.data( instanceName ) ) {
2233				return $this.data( instanceName );
2234			} else {
2235				return new theme.Mouseparallax( $this, opts );
2236			}
2237		} );
2238		return obj;
2239	}
2240} ).apply( this, [ window.theme, jQuery ] );
2241
2242// Read More
2243( function ( theme, $ ) {
2244
2245	theme = theme || {};
2246
2247	var instanceName = '__readmore';
2248
2249	var PluginReadMore = function ( $el, opts ) {
2250		return this.initialize( $el, opts );
2251	};
2252
2253	PluginReadMore.defaults = {
2254		buttonOpenLabel: 'Read More <i class="fas fa-chevron-down text-2 ms-1"></i>',
2255		buttonCloseLabel: 'Read Less <i class="fas fa-chevron-up text-2 ms-1"></i>',
2256		enableToggle: true,
2257		maxHeight: 300,
2258		overlayColor: '#43a6a3',
2259		overlayHeight: 100,
2260		startOpened: false,
2261		align: 'left'
2262	};
2263
2264	PluginReadMore.prototype = {
2265		initialize: function ( $el, opts ) {
2266			var self = this;
2267
2268			this.$el = $el;
2269
2270			this
2271				.setData()
2272				.setOptions( opts )
2273				.build()
2274				.events()
2275				.resize();
2276
2277			if ( self.options.startOpened ) {
2278				self.options.wrapper.find( '.readmore-button-wrapper > button' ).trigger( 'click' );
2279			}
2280
2281			return this;
2282		},
2283
2284		setData: function () {
2285			this.$el.data( instanceName, this );
2286
2287			return this;
2288		},
2289
2290		setOptions: function ( opts ) {
2291			this.options = $.extend( true, {}, PluginReadMore.defaults, opts, {
2292				wrapper: this.$el
2293			} );
2294
2295			return this;
2296		},
2297
2298		build: function () {
2299			var self = this;
2300
2301			self.options.wrapper.addClass( 'position-relative' );
2302
2303			// Overlay
2304			self.options.wrapper.append( '<div class="readmore-overlay"></div>' );
2305
2306			// Check if is Safari
2307			var backgroundCssValue = 'linear-gradient(180deg, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)';
2308			if ( $( 'html' ).hasClass( 'safari' ) ) {
2309				backgroundCssValue = '-webkit-linear-gradient(top, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)'
2310			}
2311
2312			self.options.wrapper.find( '.readmore-overlay' ).css( {
2313				background: backgroundCssValue,
2314				position: 'absolute',
2315				bottom: 0,
2316				left: 0,
2317				width: '100%',
2318				height: self.options.overlayHeight,
2319				'z-index': 1
2320			} );
2321
2322			// Read More Button
2323			self.options.wrapper.find( '.readmore-button-wrapper' ).removeClass( 'd-none' ).css( {
2324				position: 'absolute',
2325				bottom: 0,
2326				left: 0,
2327				width: '100%',
2328				'z-index': 2
2329			} );
2330
2331			// Button Label
2332			self.options.wrapper.find( '.readmore-button-wrapper > button' ).html( self.options.buttonOpenLabel );
2333
2334			self.options.wrapper.css( {
2335				'height': self.options.maxHeight,
2336				'overflow-y': 'hidden'
2337			} );
2338
2339			// Alignment
2340			switch ( self.options.align ) {
2341				case 'center':
2342					self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-center' );
2343					break;
2344
2345				case 'right':
2346					self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-end' );
2347					break;
2348
2349				case 'left':
2350				default:
2351					self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-start' );
2352					break;
2353			}
2354
2355			return this;
2356
2357		},
2358
2359		events: function () {
2360			var self = this;
2361
2362			// Read More
2363			self.readMore = function () {
2364				self.options.wrapper.find( '.readmore-button-wrapper > button:not(.readless)' ).on( 'click', function ( e ) {
2365					e.preventDefault();
2366					self.options.wrapper.addClass( 'opened' );
2367
2368					var $this = $( this );
2369
2370					setTimeout( function () {
2371						self.options.wrapper.animate( {
2372							'height': self.options.wrapper[ 0 ].scrollHeight
2373						}, function () {
2374							if ( !self.options.enableToggle ) {
2375								$this.fadeOut();
2376							}
2377
2378							$this.html( self.options.buttonCloseLabel ).addClass( 'readless' ).off( 'click' );
2379
2380							self.readLess();
2381
2382							self.options.wrapper.find( '.readmore-overlay' ).fadeOut();
2383							self.options.wrapper.css( {
2384								'max-height': 'none',
2385								'overflow': 'visible'
2386							} );
2387
2388							self.options.wrapper.find( '.readmore-button-wrapper' ).animate( {
2389								bottom: -20
2390							} );
2391						} );
2392					}, 200 );
2393				} );
2394			}
2395
2396			// Read Less
2397			self.readLess = function () {
2398				self.options.wrapper.find( '.readmore-button-wrapper > button.readless' ).on( 'click', function ( e ) {
2399					e.preventDefault();
2400					self.options.wrapper.removeClass( 'opened' );
2401
2402					var $this = $( this );
2403
2404					// Button
2405					self.options.wrapper.find( '.readmore-button-wrapper' ).animate( {
2406						bottom: 0
2407					} );
2408
2409					// Overlay
2410					self.options.wrapper.find( '.readmore-overlay' ).fadeIn();
2411
2412					setTimeout( function () {
2413						self.options.wrapper.height( self.options.wrapper[ 0 ].scrollHeight ).animate( {
2414							'height': self.options.maxHeight
2415						}, function () {
2416							$this.html( self.options.buttonOpenLabel ).removeClass( 'readless' ).off( 'click' );
2417
2418							self.readMore();
2419
2420							self.options.wrapper.css( {
2421								'overflow': 'hidden'
2422							} );
2423						} );
2424					}, 200 );
2425				} );
2426			}
2427
2428			// First Load
2429			self.readMore();
2430
2431			return this;
2432		},
2433
2434		resize: function () {
2435			var self = this;
2436			window.addEventListener( 'resize', function () {
2437				self.options.wrapper.hasClass( 'opened' ) ? self.options.wrapper.css( { 'height': 'auto' } ) : self.options.wrapper.css( { 'height': self.options.maxHeight } );
2438			} )
2439		}
2440	};
2441
2442	// expose to scope
2443	$.extend( theme, {
2444		PluginReadMore: PluginReadMore
2445	} );
2446
2447	// jquery plugin
2448	$.fn.themePluginReadMore = function ( opts ) {
2449		return this.map( function () {
2450			var $this = $( this );
2451
2452			if ( $this.data( instanceName ) ) {
2453				return $this.data( instanceName );
2454			} else {
2455				return new PluginReadMore( $this, $this.data( 'plugin-options' ) );
2456			}
2457
2458		} );
2459	}
2460
2461} ).apply( this, [ window.theme, jQuery ] );
2462
2463/* initialize */
2464( function ( theme, $ ) {
2465	theme.initAsync = function ( $wrap, wrapObj ) {
2466		// Animate
2467		if ( $.fn.themeAnimate ) {
2468
2469			$( function () {
2470				var svgAnimates = wrapObj.querySelectorAll( 'svg [data-appear-animation]' );
2471				if ( svgAnimates.length ) {
2472					$( svgAnimates ).closest( 'svg' ).attr( 'data-appear-animation-svg', '1' );
2473				}
2474				var $animates = wrapObj.querySelectorAll( '[data-plugin-animate], [data-appear-animation], [data-appear-animation-svg]' );
2475				if ( $animates.length ) {
2476					var animateResize = function () {
2477						if ( window.innerWidth < 768 ) {
2478							window.removeEventListener( 'resize', animateResize );
2479							$animates.forEach( function ( o ) {
2480								o.classList.add( 'appear-animation-visible' );
2481							} );
2482						}
2483					};
2484					if ( theme.animation_support ) {
2485						window.addEventListener( 'resize', animateResize );
2486						theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults );
2487					} else {
2488						$animates.forEach( function ( o ) {
2489							o.classList.add( 'appear-animation-visible' );
2490						} );
2491					}
2492				}
2493			} );
2494		}
2495
2496		// Animated Letters
2497		if ( $.fn.themePluginAnimatedLetters && ( $( '[data-plugin-animated-letters]' ).length || $( '.animated-letters' ).length ) ) {
2498			theme.intObs( '[data-plugin-animated-letters]:not(.manual), .animated-letters', 'themePluginAnimatedLetters' );
2499		}
2500
2501		// Carousel
2502		if ( $.fn.themeCarousel ) {
2503
2504			$( function () {
2505				// Carousel Lazyload images
2506				var portoCarouselInit = function ( e ) {
2507					var $this = $( e.currentTarget );
2508
2509					$this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' );
2510					if ( $this.find( '.owl-item.cloned' ).length ) {
2511						$this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } );
2512						var $animates = e.currentTarget.querySelectorAll( '.appear-animation' );
2513						if ( $animates.length ) {
2514							theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults );
2515						}
2516						if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) {
2517							theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' );
2518						}
2519					}
2520
2521					setTimeout( function () {
2522						var $hiddenItems = $this.find( '.owl-item:not(.active)' );
2523						if ( !$( 'html' ).hasClass( 'no-csstransitions' ) && window.innerWidth > 767 ) {
2524							$hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' );
2525							$hiddenItems.find( '.appear-animation' ).each( function () {
2526								var $el = $( this ),
2527									delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 );
2528								if ( delay > 1 ) {
2529									this.style.animationDelay = delay + 'ms';
2530								}
2531
2532								var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 );
2533								if ( 1000 != duration ) {
2534									this.style.animationDuration = duration + 'ms';
2535								}
2536							} );
2537						}
2538						if ( window.innerWidth >= 1200 ) {
2539							$hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' );
2540						}
2541					}, 300 );
2542				};
2543				var portoCarouselTranslated = function ( e ) {
2544					var $this = $( e.currentTarget );
2545                    /*if ( window.innerWidth > 767 ) {
2546                        if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) {
2547                            $( document.body ).trigger( 'appear_refresh' );
2548                        }
2549                    }*/
2550
2551					var $active = $this.find( '.owl-item.active' );
2552					if ( $active.hasClass( 'translating' ) ) {
2553						$active.removeClass( 'translating' );
2554						return;
2555					}
2556					$this.find( '.owl-item.translating' ).removeClass( 'translating' );
2557					// Animated Letters
2558					$this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' );
2559					$this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' );
2560
2561					if ( window.innerWidth > 767 ) {
2562						// WPBakery
2563						$this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' );
2564						$active.find( '.appear-animation' ).each( function () {
2565							var $animation_item = $( this ),
2566								anim_name = $animation_item.data( 'appear-animation' );
2567							$animation_item.addClass( anim_name + ' appear-animation-visible' );
2568						} );
2569					}
2570
2571					// Elementor
2572					$active.find( '.slide-animate' ).each( function () {
2573						var $animation_item = $( this ),
2574							settings = $animation_item.data( 'settings' );
2575						if ( settings && ( settings._animation || settings.animation ) ) {
2576							var animation = settings._animation || settings.animation,
2577								delay = settings._animation_delay || settings.animation_delay || 0;
2578							theme.requestTimeout( function () {
2579								$animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation );
2580							}, delay );
2581						}
2582					} );
2583
2584					// Visual Composer
2585					if ( window.innerWidth >= 1200 ) {
2586						$this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' );
2587						$active.find( '[data-vce-animate]' ).each( function () {
2588							var $animation_item = $( this );
2589							if ( $animation_item.data( 'porto-origin-anim' ) ) {
2590								var anim_name = $animation_item.data( 'porto-origin-anim' );
2591								$animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true );
2592								var duration = parseFloat( window.getComputedStyle( this )[ 'animationDuration' ] ) * 1000,
2593									delay = parseFloat( window.getComputedStyle( this )[ 'animationDelay' ] ) * 1000;
2594								window.setTimeout( function () {
2595									$animation_item.attr( 'data-vcv-o-animated-fully', true );
2596								}, delay + duration + 5 );
2597							}
2598						} );
2599					}
2600				};
2601				var portoCarouselTranslateVC = function ( e ) {
2602					var $this = $( e.currentTarget );
2603					$this.find( '.owl-item.active' ).addClass( 'translating' );
2604
2605					if ( window.innerWidth >= 1200 ) {
2606						$this.find( '[data-vce-animate]' ).each( function () {
2607							var $animation_item = $( this );
2608							$animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' );
2609						} );
2610					}
2611				};
2612				var portoCarouselTranslateElementor = function ( e ) {
2613					var $this = $( e.currentTarget );
2614					$this.find( '.owl-item.active' ).addClass( 'translating' );
2615					$this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' );
2616					$this.find( '.slide-animate' ).each( function () {
2617						var $animation_item = $( this ),
2618							settings = $animation_item.data( 'settings' );
2619						if ( settings._animation || settings.animation ) {
2620							$animation_item.removeClass( settings._animation || settings.animation );
2621						}
2622					} );
2623				};
2624				var portoCarouselTranslateWPB = function ( e ) {
2625					if ( window.innerWidth > 767 ) {
2626						var $this = $( e.currentTarget );
2627						$this.find( '.owl-item.active' ).addClass( 'translating' );
2628						$this.find( '.appear-animation' ).each( function () {
2629							var $animation_item = $( this );
2630							$animation_item.removeClass( $animation_item.data( 'appear-animation' ) );
2631						} );
2632					}
2633				};
2634
2635				var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' );
2636				carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated );
2637				carouselItems.on( 'translate.owl.carousel', function () {
2638					// Hide elements inside carousel
2639					$( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' );
2640					// Animated Letters
2641					$( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' );
2642				} );
2643				carouselItems.filter( function () {
2644					if ( $( this ).find( '[data-vce-animate]' ).length ) {
2645						return true;
2646					}
2647					return false;
2648				} ).on( 'translate.owl.carousel', portoCarouselTranslateVC );
2649				carouselItems.filter( function () {
2650					var $anim_obj = $( this ).find( '.elementor-invisible' );
2651					if ( $anim_obj.length ) {
2652						$anim_obj.addClass( 'slide-animate' );
2653						return true;
2654					}
2655					return false;
2656				} ).on( 'translate.owl.carousel', portoCarouselTranslateElementor );
2657				carouselItems.filter( function () {
2658					if ( $( this ).find( '.appear-animation' ).length ) {
2659						return true;
2660					}
2661					return false;
2662				} ).on( 'translate.owl.carousel', portoCarouselTranslateWPB );
2663
2664				$wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function () {
2665					var $this = $( this ),
2666						opts;
2667
2668					var pluginOptions = $this.data( 'plugin-options' );
2669					if ( pluginOptions )
2670						opts = pluginOptions;
2671
2672					setTimeout( function () {
2673						$this.themeCarousel( opts );
2674					}, 0 );
2675				} );
2676			} );
2677
2678		}
2679
2680		// Thumb Gallery
2681		$wrap.find( '.thumb-gallery-thumbs' ).each( function () {
2682			var $thumbs = $( this ),
2683				$detail = $thumbs.parent().find( '.thumb-gallery-detail' ),
2684				flag = false,
2685				duration = 300;
2686
2687			if ( $thumbs.data( 'initThumbs' ) )
2688				return;
2689
2690			$detail.on( 'changed.owl.carousel', function ( e ) {
2691				if ( !flag ) {
2692					flag = true;
2693					var len = $detail.find( '.owl-item' ).length,
2694						cloned = $detail.find( '.cloned' ).length;
2695					if ( len ) {
2696						$thumbs.trigger( 'to.owl.carousel', [ ( e.item.index - cloned / 2 - 1 ) % len, duration, true ] );
2697					}
2698					flag = false;
2699				}
2700			} );
2701
2702			$thumbs.on( 'changed.owl.carousel', function ( e ) {
2703				if ( !flag ) {
2704					flag = true;
2705					var len = $thumbs.find( '.owl-item' ).length,
2706						cloned = $thumbs.find( '.cloned' ).length;
2707					if ( len ) {
2708						$detail.trigger( 'to.owl.carousel', [ ( e.item.index - cloned / 2 ) % len, duration, true ] );
2709					}
2710					flag = false;
2711				}
2712			} ).on( 'click', '.owl-item', function () {
2713				if ( !flag ) {
2714					flag = true;
2715					var len = $thumbs.find( '.owl-item' ).length,
2716						cloned = $thumbs.find( '.cloned' ).length;
2717					if ( len ) {
2718						$detail.trigger( 'to.owl.carousel', [ ( $( this ).index() - cloned / 2 ) % len, duration, true ] );
2719					}
2720					flag = false;
2721				}
2722			} ).data( 'initThumbs', true );
2723		} );
2724
2725		// Fixed video
2726		$wrap.find( '.video-fixed' ).each( function () {
2727			var $this = $( this ),
2728				$video = $this.find( 'video, iframe' );
2729
2730			if ( $video.length ) {
2731				window.addEventListener( 'scroll', function () {
2732					var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight();
2733					$video.css( "cssText", "top: " + offset + "px !important;" );
2734				}, { passive: true } );
2735			}
2736		} );
2737
2738	};
2739
2740	$( document.body ).trigger( 'porto_async_init' );
2741} ).apply( this, [ window.theme, jQuery ] );
2742
2743jQuery( document ).ready( function ( $ ) {
2744	'use strict';
2745
2746	// Visual Composer Image Zoom
2747	if ( $.fn.themeVcImageZoom ) {
2748
2749		$( function () {
2750			var $galleryParent = null;
2751			$( '.porto-vc-zoom:not(.manual)' ).each( function () {
2752				var $this = $( this ),
2753					opts,
2754					gallery = $this.attr( 'data-gallery' );
2755
2756				var pluginOptions = $this.data( 'plugin-options' );
2757				if ( pluginOptions )
2758					opts = pluginOptions;
2759
2760				if ( typeof opts == "undefined" ) {
2761					opts = {};
2762				}
2763				opts.container = $this.parent();
2764
2765				if ( gallery == 'true' ) {
2766					var container = 'vc_row';
2767
2768					if ( $this.attr( 'data-container' ) )
2769						container = $this.attr( 'data-container' );
2770
2771					var $parent = $( $this.closest( '.' + container ).get( 0 ) );
2772					if ( $parent.length > 0 && $galleryParent != null && $galleryParent.is( $parent ) ) {
2773						return;
2774					} else if ( $parent.length > 0 ) {
2775						$galleryParent = $parent;
2776					}
2777					if ( $galleryParent != null && $galleryParent.length > 0 ) {
2778						opts.container = $galleryParent;
2779					}
2780				}
2781
2782				$this.themeVcImageZoom( opts );
2783			} );
2784		} );
2785	}
2786
2787	function porto_modal_open( $this ) {
2788		var trigger = $this.data( 'trigger-id' ),
2789			overlayClass = $this.data( 'overlay-class' ),
2790			extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '',
2791			type = $this.data( 'type' );
2792		if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) {
2793			if ( typeof type == 'undefined' ) {
2794				type = 'inline';
2795			}
2796			if ( type == 'inline' ) {
2797				trigger = '#' + escape( trigger );
2798			}
2799			var args = {
2800				items: {
2801					src: trigger
2802				},
2803				type: type,
2804				mainClass: extraClass
2805			};
2806			if ( $this.hasClass( 'porto-onload' ) ) {
2807				args[ 'callbacks' ] = {
2808					'beforeClose': function () {
2809						if ( $( '.mfp-wrap .porto-disable-modal-onload' ).length && ( $( '.mfp-wrap .porto-disable-modal-onload' ).is( ':checked' ) || $( '.mfp-wrap .porto-disable-modal-onload input[type="checkbox"]' ).is( ':checked' ) ) ) {
2810							$.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } );
2811						}
2812					}
2813				};
2814			}
2815			if ( typeof overlayClass != "undefined" && overlayClass ) {
2816				args.mainClass += escape( overlayClass );
2817			}
2818			$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 );
2819		}
2820	}
2821
2822	function porto_init_magnific_popup_functions( $wrap ) {
2823		if ( typeof $wrap == 'undefined' || !$wrap.length ) {
2824			$wrap = $( document.body );
2825		}
2826		$wrap.find( '.lightbox:not(.manual)' ).each( function () {
2827			var $this = $( this ),
2828				opts;
2829
2830			var pluginOptions = $this.data( 'lightbox-options' );
2831			if ( pluginOptions ) {
2832				opts = pluginOptions;
2833			} else {
2834				pluginOptions = $this.data( 'plugin-options' );
2835				if ( typeof pluginOptions != 'object' ) {
2836					pluginOptions = JSON.parse( pluginOptions );
2837				}
2838				if ( pluginOptions ) {
2839					opts = pluginOptions;
2840				}
2841			}
2842
2843			$this.themeLightbox( opts );
2844		} );
2845
2846		// Popup with video or map
2847		$wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
2848			disableOn: 700,
2849			type: 'iframe',
2850			mainClass: 'mfp-fade',
2851			removalDelay: 160,
2852			preloader: false,
2853			fixedContentPos: false
2854		} ) );
2855
2856		// Popup with ajax
2857		$wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
2858			type: 'ajax'
2859		} ) );
2860
2861		// Popup with content
2862		$wrap.find( '.porto-popup-content' ).each( function () {
2863			var animation = $( this ).attr( 'data-animation' );
2864			$( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
2865				type: 'inline',
2866				fixedContentPos: false,
2867				fixedBgPos: true,
2868				overflowY: 'auto',
2869				closeBtnInside: true,
2870				preloader: false,
2871				midClick: true,
2872				removalDelay: 300,
2873				mainClass: animation
2874			} ) );
2875		} );
2876
2877		// Porto Modal
2878		$wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function ( index ) {
2879			var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ),
2880				args = {
2881					type: 'iframe',
2882					removalDelay: 160,
2883					preloader: false,
2884
2885					fixedContentPos: false
2886				};
2887			if ( typeof overlayClass != "undefined" && overlayClass ) {
2888				args.mainClass = escape( overlayClass );
2889			}
2890			$( this ).magnificPopup( args );
2891		} );
2892
2893		if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) {
2894			var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ),
2895				timeout = 0;
2896			if ( $obj.data( 'timeout' ) ) {
2897				timeout = parseInt( $obj.data( 'timeout' ), 10 );
2898			}
2899			setTimeout( function () {
2900				porto_modal_open( $obj );
2901			}, timeout );
2902		}
2903		$wrap.find( '.porto-modal-trigger' ).on( 'click', function ( e ) {
2904			e.preventDefault();
2905			porto_modal_open( $( this ) );
2906		} );
2907
2908		/* Woocommerce */
2909		// login popup
2910		if ( $wrap.hasClass( 'login-popup' ) ) {
2911			$wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( {
2912				items: {
2913					src: theme.ajax_url + '?action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce,
2914					type: 'ajax'
2915				},
2916				tLoading: '<i class="porto-loading-icon"></i>',
2917				callbacks: {
2918					ajaxContentAdded: function () {
2919						$( window ).trigger( 'porto_login_popup_opened' );
2920					}
2921				}
2922			} );
2923		}
2924
2925		$wrap.find( '.product-images' ).magnificPopup(
2926			$.extend( true, {}, theme.mfpConfig, {
2927				delegate: '.img-thumbnail a.zoom',
2928				type: 'image',
2929				gallery: { enabled: true }
2930			} )
2931		);
2932		$wrap.find( '.porto-posts-grid' ).each( function () {
2933			$( this ).magnificPopup(
2934				$.extend( true, {}, theme.mfpConfig, {
2935					delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom',
2936					type: 'image',
2937					gallery: { enabled: true }
2938				} )
2939			);
2940		} );
2941		$wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function () {
2942			var $this = $( this ),
2943				links = [];
2944			$this.find( 'a' ).each( function () {
2945				var slide = {};
2946				slide.src = $( this ).attr( 'href' );
2947				slide.title = $( this ).attr( 'title' );
2948				links.push( slide );
2949			} );
2950			if ( links.length ) {
2951				$this.on( 'click', function () {
2952					var $slider = $this.siblings( '.porto-carousel' );
2953					if ( $slider.length ) {
2954						var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2;
2955						$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
2956							items: links,
2957							gallery: {
2958								enabled: true
2959							},
2960							type: 'image'
2961						} ), offset );
2962					}
2963				} );
2964			}
2965		} );
2966	}
2967
2968	if ( $.fn.magnificPopup ) {
2969		porto_init_magnific_popup_functions();
2970	} else {
2971		setTimeout( function () {
2972			if ( $.fn.magnificPopup ) {
2973				porto_init_magnific_popup_functions();
2974			}
2975		}, 500 );
2976	}
2977	$( document.body ).on( 'porto_load_posts_end', function ( e, $posts_wrap ) {
2978		if ( $.fn.magnificPopup ) {
2979			porto_init_magnific_popup_functions( $posts_wrap );
2980		}
2981	} );
2982
2983	// Post Ajax Modal
2984	if ( typeof theme.PostAjaxModal !== 'undefined' ) {
2985		// Portfolio
2986		if ( $( '.page-portfolios' ).length ) {
2987			theme.PostAjaxModal.initialize( $( '.page-portfolios' ) );
2988		}
2989		// Member
2990		if ( $( '.page-members' ).length ) {
2991			theme.PostAjaxModal.initialize( $( '.page-members' ), 'member' );
2992		}
2993	}
2994
2995	// Portfolio Ajax on Page
2996	if ( typeof theme.PortfolioAjaxPage !== 'undefined' ) {
2997		theme.PortfolioAjaxPage.initialize();
2998	}
2999
3000	// Post Filter
3001	if ( typeof theme.PostFilter !== 'undefined' ) {
3002		var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' );
3003		if ( $postFilterElements.length ) {
3004			theme.PostFilter.initialize( $postFilterElements );
3005		}
3006	}
3007
3008	// Post ajax pagination
3009	$( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function ( e ) {
3010		var $this = $( this );
3011		if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) {
3012			return;
3013		}
3014		e.preventDefault();
3015		var $wrap = $this.closest( '.porto-ajax-load' ),
3016			post_type = $wrap.data( 'post_type' ),
3017			$obj = $wrap.find( '.' + post_type + 's-container' );
3018
3019		if ( !$obj.length || $wrap.hasClass( 'loading' ) ) {
3020			return;
3021		}
3022		$wrap.addClass( 'loading' );
3023		var $filter = $wrap.find( '.porto-ajax-filter' ),
3024			cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' );
3025		if ( '*' == cat ) {
3026			cat = '';
3027		}
3028		var default_args = {},
3029			page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ );
3030
3031		if ( page && Array.isArray( page ) && ( page[ 1 ] || page[ 2 ] ) ) {
3032			default_args[ 'page' ] = parseInt( page[ 1 ] || page[ 2 ] );
3033		} else {
3034			if ( $this.hasClass( 'prev' ) ) {
3035				default_args[ 'page' ] = parseInt( $this.next().text() );
3036			} else if ( $this.hasClass( 'next' ) ) {
3037				default_args[ 'page' ] = parseInt( $this.prev().text() );
3038			} else {
3039				default_args[ 'page' ] = parseInt( $this.text() );
3040			}
3041		}
3042
3043		theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) );
3044
3045	} );
3046
3047
3048	// Member Ajax on Page
3049	if ( typeof theme.MemberAjaxPage !== 'undefined' ) {
3050		theme.MemberAjaxPage.initialize();
3051	}
3052
3053	// Filter Zooms
3054	if ( typeof theme.FilterZoom !== 'undefined' ) {
3055		// Portfolio Filter Zoom
3056		theme.FilterZoom.initialize( $( '.page-portfolios' ) );
3057		// Member Filter Zoom
3058		theme.FilterZoom.initialize( $( '.page-members' ) );
3059		// Posts Related Style Filter Zoom
3060		theme.FilterZoom.initialize( $( '.blog-posts-related' ) );
3061	}
3062
3063	// close popup using esc key
3064	var $minicart_offcanvas = $( '.minicart-offcanvas' ),
3065		$wl_offcanvas = $( '.wishlist-offcanvas' ),
3066		$mobile_sidebar = $( '.mobile-sidebar' ),
3067		$mobile_panel = $( '#side-nav-panel' ),
3068		$overlay_search = $( '#header .btn-close-search-form' ),
3069		$html = $( 'html' );
3070	if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) {
3071		$( document.documentElement ).on( 'keyup', function ( e ) {
3072			try {
3073				if ( e.keyCode == 27 ) {
3074					$minicart_offcanvas.removeClass( 'minicart-opened' );
3075					$wl_offcanvas.removeClass( 'minicart-opened' );
3076					if ( $mobile_sidebar.length ) {
3077						$html.removeClass( 'filter-sidebar-opened' );
3078						$html.removeClass( 'sidebar-opened' );
3079						$( '.sidebar-overlay' ).removeClass( 'active' );
3080					}
3081					if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) {
3082						$html.removeClass( 'panel-opened' );
3083						$( '.panel-overlay' ).removeClass( 'active' );
3084					}
3085					if ( $overlay_search.length ) {
3086						$overlay_search.trigger( 'click' );
3087					}
3088				}
3089			} catch ( err ) { }
3090		} );
3091		$( '.skeleton-loading' ).on( 'skeleton-loaded', function () {
3092			$mobile_sidebar = $( '.mobile-sidebar' );
3093		} );
3094	}
3095
3096
3097	// Mouse Parallax
3098	if ( $.fn.themeMouseparallax ) {
3099		$( function () {
3100			$( '[data-plugin="mouse-parallax"]' ).each( function () {
3101				var $this = $( this ),
3102					opts;
3103				if ( $this.data( 'parallax' ) ) {
3104					$this.parallax( 'disable' );
3105					$this.removeData( 'parallax' );
3106					$this.removeData( 'options' );
3107				}
3108				if ( $this.hasClass( 'elementor-element' ) ) {
3109					$this.children( '.elementor-widget-container, .elementor-container, .elementor-widget-wrap, .elementor-column-wrap' ).addClass( 'layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) );
3110				} else {
3111					$this.children( '.layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) );
3112				}
3113
3114				var pluginOptions = $this.data( 'options' );
3115				if ( pluginOptions )
3116					opts = pluginOptions;
3117
3118				$this.themeMouseparallax( opts );
3119			} );
3120		} );
3121	}
3122
3123	if ( $.fn[ 'themePluginReadMore' ] && $( '[data-plugin-readmore]' ).length ) {
3124		$( '[data-plugin-readmore]:not(.manual)' ).themePluginReadMore();
3125	}
3126} );
3127
3128( function ( theme, $ ) {
3129	// init wishlist off-canvas
3130	if ( $( '.wishlist-popup' ).length ) {
3131		var worker = null;
3132
3133		$( '.wishlist-offcanvas .my-wishlist' ).on( 'click', function ( e ) {
3134			e.preventDefault();
3135			$( this ).parent().toggleClass( 'minicart-opened' );
3136		} );
3137		$( '.wishlist-offcanvas .minicart-overlay' ).on( 'click', function () {
3138			$( this ).closest( '.wishlist-offcanvas' ).removeClass( 'minicart-opened' );
3139		} );
3140
3141		var init_wishlist = function () {
3142			worker = new Worker( js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/woocommerce-worker.js' ) );
3143			worker.onmessage = function ( e ) {
3144				$( '.wishlist-popup' ).html( e.data );
3145			};
3146			worker.postMessage( { initWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } );
3147		};
3148
3149		if ( theme && theme.isLoaded ) {
3150			setTimeout( function () {
3151				init_wishlist();
3152			}, 100 );
3153		} else {
3154			$( window ).on( 'load', function () {
3155				init_wishlist();
3156			} );
3157		}
3158
3159		// remove from wishlist
3160		$( '.wishlist-popup' ).on( 'click', '.remove_from_wishlist', function ( e ) {
3161			e.preventDefault();
3162
3163			var $this = $( this ),
3164				id = $this.attr( 'data-product_id' ),
3165				$table = $( '.wishlist_table #yith-wcwl-row-' + id + ' .remove_from_wishlist' );
3166
3167			$this.closest( '.wishlist-item' ).find( '.ajax-loading' ).show();
3168
3169			if ( $table.length ) {
3170				$table.trigger( 'click' );
3171			} else {
3172				if( typeof yith_wcwl_l10n !== 'undefined' ) {
3173					$.ajax( {
3174						url: yith_wcwl_l10n.ajax_url,
3175						data: {
3176							action: yith_wcwl_l10n.actions.remove_from_wishlist_action,
3177							remove_from_wishlist: id,
3178							nonce: yith_wcwl_l10n.nonce.remove_from_wishlist_nonce,
3179							from: 'theme'
3180						},
3181						method: 'post',
3182						success: function ( data ) {
3183							var $wcwlWrap = $( '.yith-wcwl-add-to-wishlist.add-to-wishlist-' + id );
3184							if ( $wcwlWrap.length ) {
3185								var fragmentOptions = $wcwlWrap.data( 'fragment-options' ),
3186									$link = $wcwlWrap.find( 'a' );
3187								if ( $link.length ) {
3188									if ( fragmentOptions.in_default_wishlist ) {
3189										delete fragmentOptions.in_default_wishlist;
3190										$wcwlWrap.attr( JSON.stringify( fragmentOptions ) );
3191									}
3192									$wcwlWrap.removeClass( 'exists' );
3193									$wcwlWrap.find( '.yith-wcwl-wishlistexistsbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistexistsbrowse' );
3194									$wcwlWrap.find( '.yith-wcwl-wishlistaddedbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistaddedbrowse' );
3195									$link.attr( 'href', location.href + '?post_type=product&amp;add_to_wishlist=' + id ).attr( 'data-product-id', id ).attr( 'data-product-type', fragmentOptions.product_type );
3196									var text = $( '.single_add_to_wishlist' ).data( 'title' );
3197									if ( !text ) {
3198										text = 'Add to wishlist';
3199									}
3200									$link.attr( 'title', text ).attr( 'data-title', text ).addClass( 'add_to_wishlist single_add_to_wishlist' ).html( '<span>' + text + '</span>' );
3201								}
3202							}
3203							$( document.body ).trigger( 'removed_from_wishlist' );
3204							//$this.closest('.wishlist-item').remove();
3205						}
3206					} );
3207				}
3208			}
3209		} );
3210
3211		$( document.body ).on( 'added_to_wishlist removed_from_wishlist', function ( e ) {
3212			if ( worker ) {
3213				worker.postMessage( { loadWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } );
3214			}
3215		} );
3216	}
3217
3218	// init Youtube video api
3219	var $youtube_videos = $( '.porto-video-social.video-youtube' );
3220	if ( $youtube_videos.length ) {
3221		window.onYouTubeIframeAPIReady = function () {
3222			$youtube_videos.each( function () {
3223				var $this = $( this ),
3224					$wrap = $this.parent( '.video-wrapper' ),
3225					item_id = $this.attr( 'id' ),
3226					youtube_id = $this.data( 'video' ),
3227					is_loop = $this.data( 'loop' ),
3228					enable_audio = $this.data( 'audio' ),
3229					autoplay = 1,
3230					controls = 0;
3231				if ( '0' === $this.data( 'autoplay' ) ) {
3232					autoplay = 0;
3233				}
3234				if ( $this.data( 'controls' ) ) {
3235					controls = parseInt( $this.data( 'controls' ) );
3236				}
3237				new YT.Player( item_id, {
3238					width: '100%',
3239					//height: '100%',
3240					videoId: youtube_id,
3241					playerVars: {
3242						'autoplay': autoplay,
3243						'controls': controls,
3244						'modestbranding': 1,
3245						'rel': 0,
3246						'playsinline': 1,
3247						'showinfo': 0,
3248						'loop': is_loop
3249					},
3250					events: {
3251						onReady: function ( t ) {
3252							if ( $wrap.length ) {
3253								$wrap.themeFitVideo();
3254							}
3255							if ( 0 === parseInt( enable_audio ) && t && t.target && t.target.mute ) {
3256								t.target.mute();
3257							}
3258						}
3259					}
3260				} );
3261			} );
3262		};
3263
3264		if ( $( 'script[src*="www.youtube.com/iframe_api"]' ).length ) {
3265			setTimeout( onYouTubeIframeAPIReady, 350 );
3266		} else {
3267			var tag = document.createElement( 'script' );
3268			tag.src = "//www.youtube.com/iframe_api";
3269			var firstScriptTag = document.getElementsByTagName( 'script' )[ 0 ];
3270			firstScriptTag.parentNode.insertBefore( tag, firstScriptTag );
3271		}
3272	}
3273
3274	// init Vimeo video api
3275	var $vimeo_videos = $( '.porto-video-social.video-vimeo' );
3276	if ( $vimeo_videos.length ) {
3277		var portoVimeoInit = function () {
3278			$vimeo_videos.each( function () {
3279				var $this = $( this ),
3280					$wrap = $this.parent( '.fit-video' ),
3281					item_id = $this.attr( 'id' ),
3282					video_id = $this.data( 'video' ),
3283					is_loop = $this.data( 'loop' ),
3284					enable_audio = $this.data( 'audio' ),
3285					autoplay = true;
3286				if ( '0' === $this.data( 'autoplay' ) ) {
3287					autoplay = false;
3288				}
3289				var player = new Vimeo.Player( item_id, {
3290					id: video_id,
3291					loop: 1 === parseInt( is_loop ) ? true : false,
3292					autoplay: autoplay,
3293					transparent: false,
3294					background: true,
3295					muted: 0 === parseInt( enable_audio ) ? true : false,
3296					events: {
3297						onReady: function ( t ) {
3298							if ( $wrap.length ) {
3299								$wrap.themeFitVideo();
3300							}
3301							if ( 0 === parseInt( enable_audio ) && t && t.target && t.target.mute ) {
3302								t.target.mute();
3303							}
3304						}
3305					}
3306				} );
3307				if ( 0 === parseInt( enable_audio ) ) {
3308					player.setVolume( 0 );
3309				}
3310				if ( $wrap.length ) {
3311					player.ready().then( function () {
3312						$wrap.themeFitVideo();
3313					} );
3314				}
3315			} );
3316		};
3317
3318		if ( $( 'script[src="https://player.vimeo.com/api/player.js"]' ).length ) {
3319			setTimeout( portoVimeoInit, 350 );
3320		} else {
3321			var tag = document.createElement( 'script' );
3322			tag.addEventListener( 'load', function ( event ) {
3323				setTimeout( portoVimeoInit, 50 );
3324			} );
3325			tag.src = "https://player.vimeo.com/api/player.js";
3326			var firstScriptTag = document.getElementsByTagName( 'script' )[ 0 ];
3327			firstScriptTag.parentNode.insertBefore( tag, firstScriptTag );
3328		}
3329	}
3330} ).apply( this, [ window.theme, 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.