PageSourceSearch

https://www.mecc.nl/wp-content/themes/mecc-child/assets/js/owl.carousel.js?ver=1.0.0

js mecc.nl collected 2026-09-26 02:18:21 UTC 92,966 bytes, 3,431 lines download raw bytes

vendor: 92,854 bytes, lines 1-3427
1;(function($, window, document, undefined) {
2
3	/**
4	 * Creates a carousel.
5	 * @class The Owl Carousel.
6	 * @public
7	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
8	 * @param {Object} [options] - The options
9	 */
10	function Owl(element, options) {
11
12		/**
13		 * Current settings for the carousel.
14		 * @public
15		 */
16		this.settings = null;
17
18		/**
19		 * Current options set by the caller including defaults.
20		 * @public
21		 */
22		this.options = $.extend({}, Owl.Defaults, options);
23
24		/**
25		 * Plugin element.
26		 * @public
27		 */
28		this.$element = $(element);
29
30		/**
31		 * Proxied event handlers.
32		 * @protected
33		 */
34		this._handlers = {};
35
36		/**
37		 * References to the running plugins of this carousel.
38		 * @protected
39		 */
40		this._plugins = {};
41
42		/**
43		 * Currently suppressed events to prevent them from being retriggered.
44		 * @protected
45		 */
46		this._supress = {};
47
48		/**
49		 * Absolute current position.
50		 * @protected
51		 */
52		this._current = null;
53
54		/**
55		 * Animation speed in milliseconds.
56		 * @protected
57		 */
58		this._speed = null;
59
60		/**
61		 * Coordinates of all items in pixel.
62		 * @todo The name of this member is missleading.
63		 * @protected
64		 */
65		this._coordinates = [];
66
67		/**
68		 * Current breakpoint.
69		 * @todo Real media queries would be nice.
70		 * @protected
71		 */
72		this._breakpoint = null;
73
74		/**
75		 * Current width of the plugin element.
76		 */
77		this._width = null;
78
79		/**
80		 * All real items.
81		 * @protected
82		 */
83		this._items = [];
84
85		/**
86		 * All cloned items.
87		 * @protected
88		 */
89		this._clones = [];
90
91		/**
92		 * Merge values of all items.
93		 * @todo Maybe this could be part of a plugin.
94		 * @protected
95		 */
96		this._mergers = [];
97
98		/**
99		 * Widths of all items.
100		 */
101		this._widths = [];
102
103		/**
104		 * Invalidated parts within the update process.
105		 * @protected
106		 */
107		this._invalidated = {};
108
109		/**
110		 * Ordered list of workers for the update process.
111		 * @protected
112		 */
113		this._pipe = [];
114
115		/**
116		 * Current state information for the drag operation.
117		 * @todo #261
118		 * @protected
119		 */
120		this._drag = {
121			time: null,
122			target: null,
123			pointer: null,
124			stage: {
125				start: null,
126				current: null
127			},
128			direction: null
129		};
130
131		/**
132		 * Current state information and their tags.
133		 * @type {Object}
134		 * @protected
135		 */
136		this._states = {
137			current: {},
138			tags: {
139				'initializing': [ 'busy' ],
140				'animating': [ 'busy' ],
141				'dragging': [ 'interacting' ]
142			}
143		};
144
145		$.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
146			this._handlers[handler] = $.proxy(this[handler], this);
147		}, this));
148
149		$.each(Owl.Plugins, $.proxy(function(key, plugin) {
150			this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
151				= new plugin(this);
152		}, this));
153
154		$.each(Owl.Workers, $.proxy(function(priority, worker) {
155			this._pipe.push({
156				'filter': worker.filter,
157				'run': $.proxy(worker.run, this)
158			});
159		}, this));
160
161		this.setup();
162		this.initialize();
163	}
164
165	/**
166	 * Default options for the carousel.
167	 * @public
168	 */
169	Owl.Defaults = {
170		items: 3,
171		loop: false,
172		center: false,
173		rewind: false,
174		checkVisibility: true,
175
176		mouseDrag: true,
177		touchDrag: true,
178		pullDrag: true,
179		freeDrag: false,
180
181		margin: 0,
182		stagePadding: 0,
183
184		merge: false,
185		mergeFit: true,
186		autoWidth: false,
187
188		startPosition: 0,
189		rtl: false,
190
191		smartSpeed: 800,
192		fluidSpeed: false,
193		dragEndSpeed: false,
194
195		responsive: {},
196		responsiveRefreshRate: 200,
197		responsiveBaseElement: window,
198
199		fallbackEasing: 'swing',
200		slideTransition: '',
201
202		info: false,
203
204		nestedItemSelector: false,
205		itemElement: 'div',
206		stageElement: 'div',
207
208		refreshClass: 'owl-refresh',
209		loadedClass: 'owl-loaded',
210		loadingClass: 'owl-loading',
211		rtlClass: 'owl-rtl',
212		responsiveClass: 'owl-responsive',
213		dragClass: 'owl-drag1',
214		itemClass: 'owl-item',
215		stageClass: 'owl-stage',
216		stageOuterClass: 'owl-stage-outer',
217		grabClass: 'owl-grab1'
218	};
219
220	/**
221	 * Enumeration for width.
222	 * @public
223	 * @readonly
224	 * @enum {String}
225	 */
226	Owl.Width = {
227		Default: 'default',
228		Inner: 'inner',
229		Outer: 'outer'
230	};
231
232	/**
233	 * Enumeration for types.
234	 * @public
235	 * @readonly
236	 * @enum {String}
237	 */
238	Owl.Type = {
239		Event: 'event',
240		State: 'state'
241	};
242
243	/**
244	 * Contains all registered plugins.
245	 * @public
246	 */
247	Owl.Plugins = {};
248
249	/**
250	 * List of workers involved in the update process.
251	 */
252	Owl.Workers = [ {
253		filter: [ 'width', 'settings' ],
254		run: function() {
255			this._width = this.$element.width();
256		}
257	}, {
258		filter: [ 'width', 'items', 'settings' ],
259		run: function(cache) {
260			cache.current = this._items && this._items[this.relative(this._current)];
261		}
262	}, {
263		filter: [ 'items', 'settings' ],
264		run: function() {
265			this.$stage.children('.cloned').remove();
266		}
267	}, {
268		filter: [ 'width', 'items', 'settings' ],
269		run: function(cache) {
270			var margin = this.settings.margin || '',
271				grid = !this.settings.autoWidth,
272				rtl = this.settings.rtl,
273				css = {
274					'width': 'auto',
275					'margin-left': rtl ? margin : '',
276					'margin-right': rtl ? '' : margin
277				};
278
279			!grid && this.$stage.children().css(css);
280
281			cache.css = css;
282		}
283	}, {
284		filter: [ 'width', 'items', 'settings' ],
285		run: function(cache) {
286			var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
287				merge = null,
288				iterator = this._items.length,
289				grid = !this.settings.autoWidth,
290				widths = [];
291
292			cache.items = {
293				merge: false,
294				width: width
295			};
296
297			while (iterator--) {
298				merge = this._mergers[iterator];
299				merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
300
301				cache.items.merge = merge > 1 || cache.items.merge;
302
303				widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
304			}
305
306			this._widths = widths;
307		}
308	}, {
309		filter: [ 'items', 'settings' ],
310		run: function() {
311			var clones = [],
312				items = this._items,
313				settings = this.settings,
314				// TODO: Should be computed from number of min width items in stage
315				view = Math.max(settings.items * 2, 4),
316				size = Math.ceil(items.length / 2) * 2,
317				repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
318				append = '',
319				prepend = '';
320
321			repeat /= 2;
322
323			while (repeat > 0) {
324				// Switch to only using appended clones
325				clones.push(this.normalize(clones.length / 2, true));
326				append = append + items[clones[clones.length - 1]][0].outerHTML;
327				clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
328				prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
329				repeat -= 1;
330			}
331
332			this._clones = clones;
333
334			$(append).addClass('cloned').appendTo(this.$stage);
335			$(prepend).addClass('cloned').prependTo(this.$stage);
336		}
337	}, {
338		filter: [ 'width', 'items', 'settings' ],
339		run: function() {
340			var rtl = this.settings.rtl ? 1 : -1,
341				size = this._clones.length + this._items.length,
342				iterator = -1,
343				previous = 0,
344				current = 0,
345				coordinates = [];
346
347			while (++iterator < size) {
348				previous = coordinates[iterator - 1] || 0;
349				current = this._widths[this.relative(iterator)] + this.settings.margin;
350				coordinates.push(previous + current * rtl);
351			}
352
353			this._coordinates = coordinates;
354		}
355	}, {
356		filter: [ 'width', 'items', 'settings' ],
357		run: function() {
358			var padding = this.settings.stagePadding,
359				coordinates = this._coordinates,
360				css = {
361					'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
362					'padding-left': padding || '',
363					'padding-right': padding || ''
364				};
365
366			this.$stage.css(css);
367		}
368	}, {
369		filter: [ 'width', 'items', 'settings' ],
370		run: function(cache) {
371			var iterator = this._coordinates.length,
372				grid = !this.settings.autoWidth,
373				items = this.$stage.children();
374
375			if (grid && cache.items.merge) {
376				while (iterator--) {
377					cache.css.width = this._widths[this.relative(iterator)];
378					items.eq(iterator).css(cache.css);
379				}
380			} else if (grid) {
381				cache.css.width = cache.items.width;
382				items.css(cache.css);
383			}
384		}
385	}, {
386		filter: [ 'items' ],
387		run: function() {
388			this._coordinates.length < 1 && this.$stage.removeAttr('style');
389		}
390	}, {
391		filter: [ 'width', 'items', 'settings' ],
392		run: function(cache) {
393			cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
394			cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
395			this.reset(cache.current);
396		}
397	}, {
398		filter: [ 'position' ],
399		run: function() {
400			this.animate(this.coordinates(this._current));
401		}
402	}, {
403		filter: [ 'width', 'position', 'items', 'settings' ],
404		run: function() {
405			var rtl = this.settings.rtl ? 1 : -1,
406				padding = this.settings.stagePadding * 2,
407				begin = this.coordinates(this.current()) + padding,
408				end = begin + this.width() * rtl,
409				inner, outer, matches = [], i, n;
410
411			for (i = 0, n = this._coordinates.length; i < n; i++) {
412				inner = this._coordinates[i - 1] || 0;
413				outer = Math.abs(this._coordinates[i]) + padding * rtl;
414
415				if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
416					|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
417					matches.push(i);
418				}
419			}
420
421			this.$stage.children('.active').removeClass('active');
422			this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
423
424			this.$stage.children('.center').removeClass('center');
425			if (this.settings.center) {
426				this.$stage.children().eq(this.current()).addClass('center');
427			}
428		}
429	} ];
430
431	/**
432	 * Create the stage DOM element
433	 */
434	Owl.prototype.initializeStage = function() {
435		this.$stage = this.$element.find('.' + this.settings.stageClass);
436
437		// if the stage is already in the DOM, grab it and skip stage initialization
438		if (this.$stage.length) {
439			return;
440		}
441
442		this.$element.addClass(this.options.loadingClass);
443
444		// create stage
445		this.$stage = $('<' + this.settings.stageElement + '>', {
446			"class": this.settings.stageClass
447		}).wrap( $( '<div/>', {
448			"class": this.settings.stageOuterClass
449		}));
450
451		// append stage
452		this.$element.append(this.$stage.parent());
453	};
454
455	/**
456	 * Create item DOM elements
457	 */
458	Owl.prototype.initializeItems = function() {
459		var $items = this.$element.find('.owl-item');
460
461		// if the items are already in the DOM, grab them and skip item initialization
462		if ($items.length) {
463			this._items = $items.get().map(function(item) {
464				return $(item);
465			});
466
467			this._mergers = this._items.map(function() {
468				return 1;
469			});
470
471			this.refresh();
472
473			return;
474		}
475
476		// append content
477		this.replace(this.$element.children().not(this.$stage.parent()));
478
479		// check visibility
480		if (this.isVisible()) {
481			// update view
482			this.refresh();
483		} else {
484			// invalidate width
485			this.invalidate('width');
486		}
487
488		this.$element
489			.removeClass(this.options.loadingClass)
490			.addClass(this.options.loadedClass);
491	};
492
493	/**
494	 * Initializes the carousel.
495	 * @protected
496	 */
497	Owl.prototype.initialize = function() {
498		this.enter('initializing');
499		this.trigger('initialize');
500
501		this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
502
503		if (this.settings.autoWidth && !this.is('pre-loading')) {
504			var imgs, nestedSelector, width;
505			imgs = this.$element.find('img');
506			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
507			width = this.$element.children(nestedSelector).width();
508
509			if (imgs.length && width <= 0) {
510				this.preloadAutoWidthImages(imgs);
511			}
512		}
513
514		this.initializeStage();
515		this.initializeItems();
516
517		// register event handlers
518		this.registerEventHandlers();
519
520		this.leave('initializing');
521		this.trigger('initialized');
522	};
523
524	/**
525	 * @returns {Boolean} visibility of $element
526	 *                    if you know the carousel will always be visible you can set `checkVisibility` to `false` to
527	 *                    prevent the expensive browser layout forced reflow the $element.is(':visible') does
528	 */
529	Owl.prototype.isVisible = function() {
530		return this.settings.checkVisibility
531			? this.$element.is(':visible')
532			: true;
533	};
534
535	/**
536	 * Setups the current settings.
537	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
538	 * @todo Support for media queries by using `matchMedia` would be nice.
539	 * @public
540	 */
541	Owl.prototype.setup = function() {
542		var viewport = this.viewport(),
543			overwrites = this.options.responsive,
544			match = -1,
545			settings = null;
546
547		if (!overwrites) {
548			settings = $.extend({}, this.options);
549		} else {
550			$.each(overwrites, function(breakpoint) {
551				if (breakpoint <= viewport && breakpoint > match) {
552					match = Number(breakpoint);
553				}
554			});
555
556			settings = $.extend({}, this.options, overwrites[match]);
557			if (typeof settings.stagePadding === 'function') {
558				settings.stagePadding = settings.stagePadding();
559			}
560			delete settings.responsive;
561
562			// responsive class
563			if (settings.responsiveClass) {
564				this.$element.attr('class',
565					this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
566				);
567			}
568		}
569
570		this.trigger('change', { property: { name: 'settings', value: settings } });
571		this._breakpoint = match;
572		this.settings = settings;
573		this.invalidate('settings');
574		this.trigger('changed', { property: { name: 'settings', value: this.settings } });
575	};
576
577	/**
578	 * Updates option logic if necessery.
579	 * @protected
580	 */
581	Owl.prototype.optionsLogic = function() {
582		if (this.settings.autoWidth) {
583			this.settings.stagePadding = false;
584			this.settings.merge = false;
585		}
586	};
587
588	/**
589	 * Prepares an item before add.
590	 * @todo Rename event parameter `content` to `item`.
591	 * @protected
592	 * @returns {jQuery|HTMLElement} - The item container.
593	 */
594	Owl.prototype.prepare = function(item) {
595		var event = this.trigger('prepare', { content: item });
596
597		if (!event.data) {
598			event.data = $('<' + this.settings.itemElement + '/>')
599				.addClass(this.options.itemClass).append(item)
600		}
601
602		this.trigger('prepared', { content: event.data });
603
604		return event.data;
605	};
606
607	/**
608	 * Updates the view.
609	 * @public
610	 */
611	Owl.prototype.update = function() {
612		var i = 0,
613			n = this._pipe.length,
614			filter = $.proxy(function(p) { return this[p] }, this._invalidated),
615			cache = {};
616
617		while (i < n) {
618			if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
619				this._pipe[i].run(cache);
620			}
621			i++;
622		}
623
624		this._invalidated = {};
625
626		!this.is('valid') && this.enter('valid');
627	};
628
629	/**
630	 * Gets the width of the view.
631	 * @public
632	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
633	 * @returns {Number} - The width of the view in pixel.
634	 */
635	Owl.prototype.width = function(dimension) {
636		dimension = dimension || Owl.Width.Default;
637		switch (dimension) {
638			case Owl.Width.Inner:
639			case Owl.Width.Outer:
640				return this._width;
641			default:
642				return this._width - this.settings.stagePadding * 2 + this.settings.margin;
643		}
644	};
645
646	/**
647	 * Refreshes the carousel primarily for adaptive purposes.
648	 * @public
649	 */
650	Owl.prototype.refresh = function() {
651		this.enter('refreshing');
652		this.trigger('refresh');
653
654		this.setup();
655
656		this.optionsLogic();
657
658		this.$element.addClass(this.options.refreshClass);
659
660		this.update();
661
662		this.$element.removeClass(this.options.refreshClass);
663
664		this.leave('refreshing');
665		this.trigger('refreshed');
666	};
667
668	/**
669	 * Checks window `resize` event.
670	 * @protected
671	 */
672	Owl.prototype.onThrottledResize = function() {
673		window.clearTimeout(this.resizeTimer);
674		this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
675	};
676
677	/**
678	 * Checks window `resize` event.
679	 * @protected
680	 */
681	Owl.prototype.onResize = function() {
682		if (!this._items.length) {
683			return false;
684		}
685
686		if (this._width === this.$element.width()) {
687			return false;
688		}
689
690		if (!this.isVisible()) {
691			return false;
692		}
693
694		this.enter('resizing');
695
696		if (this.trigger('resize').isDefaultPrevented()) {
697			this.leave('resizing');
698			return false;
699		}
700
701		this.invalidate('width');
702
703		this.refresh();
704
705		this.leave('resizing');
706		this.trigger('resized');
707	};
708
709	/**
710	 * Registers event handlers.
711	 * @todo Check `msPointerEnabled`
712	 * @todo #261
713	 * @protected
714	 */
715	Owl.prototype.registerEventHandlers = function() {
716		if ($.support.transition) {
717			this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
718		}
719
720		if (this.settings.responsive !== false) {
721			this.on(window, 'resize', this._handlers.onThrottledResize);
722		}
723
724		if (this.settings.mouseDrag) {
725			this.$element.addClass(this.options.dragClass);
726			this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
727			this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
728		}
729
730		if (this.settings.touchDrag){
731			this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
732			this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
733		}
734	};
735
736	/**
737	 * Handles `touchstart` and `mousedown` events.
738	 * @todo Horizontal swipe threshold as option
739	 * @todo #261
740	 * @protected
741	 * @param {Event} event - The event arguments.
742	 */
743	Owl.prototype.onDragStart = function(event) {
744		var stage = null;
745
746		if (event.which === 3) {
747			return;
748		}
749
750		if ($.support.transform) {
751			stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
752			stage = {
753				x: stage[stage.length === 16 ? 12 : 4],
754				y: stage[stage.length === 16 ? 13 : 5]
755			};
756		} else {
757			stage = this.$stage.position();
758			stage = {
759				x: this.settings.rtl ?
760					stage.left + this.$stage.width() - this.width() + this.settings.margin :
761					stage.left,
762				y: stage.top
763			};
764		}
765
766		if (this.is('animating')) {
767			$.support.transform ? this.animate(stage.x) : this.$stage.stop()
768			this.invalidate('position');
769		}
770
771		this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
772
773		this.speed(0);
774
775		this._drag.time = new Date().getTime();
776		this._drag.target = $(event.target);
777		this._drag.stage.start = stage;
778		this._drag.stage.current = stage;
779		this._drag.pointer = this.pointer(event);
780
781		$(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
782
783		$(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
784			var delta = this.difference(this._drag.pointer, this.pointer(event));
785
786			$(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
787
788			if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
789				return;
790			}
791
792			event.preventDefault();
793
794			this.enter('dragging');
795			this.trigger('drag');
796		}, this));
797	};
798
799	/**
800	 * Handles the `touchmove` and `mousemove` events.
801	 * @todo #261
802	 * @protected
803	 * @param {Event} event - The event arguments.
804	 */
805	Owl.prototype.onDragMove = function(event) {
806		var minimum = null,
807			maximum = null,
808			pull = null,
809			delta = this.difference(this._drag.pointer, this.pointer(event)),
810			stage = this.difference(this._drag.stage.start, delta);
811
812		if (!this.is('dragging')) {
813			return;
814		}
815
816		event.preventDefault();
817
818		if (this.settings.loop) {
819			minimum = this.coordinates(this.minimum());
820			maximum = this.coordinates(this.maximum() + 1) - minimum;
821			stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
822		} else {
823			minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
824			maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
825			pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
826			stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
827		}
828
829		this._drag.stage.current = stage;
830
831		this.animate(stage.x);
832	};
833
834	/**
835	 * Handles the `touchend` and `mouseup` events.
836	 * @todo #261
837	 * @todo Threshold for click event
838	 * @protected
839	 * @param {Event} event - The event arguments.
840	 */
841	Owl.prototype.onDragEnd = function(event) {
842		var delta = this.difference(this._drag.pointer, this.pointer(event)),
843			stage = this._drag.stage.current,
844			direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
845
846		$(document).off('.owl.core');
847
848		this.$element.removeClass(this.options.grabClass);
849
850		if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
851			this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
852			this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
853			this.invalidate('position');
854			this.update();
855
856			this._drag.direction = direction;
857
858			if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
859				this._drag.target.one('click.owl.core', function() { return false; });
860			}
861		}
862
863		if (!this.is('dragging')) {
864			return;
865		}
866
867		this.leave('dragging');
868		this.trigger('dragged');
869	};
870
871	/**
872	 * Gets absolute position of the closest item for a coordinate.
873	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
874	 * @protected
875	 * @param {Number} coordinate - The coordinate in pixel.
876	 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
877	 * @return {Number} - The absolute position of the closest item.
878	 */
879	Owl.prototype.closest = function(coordinate, direction) {
880		var position = -1,
881			pull = 30,
882			width = this.width(),
883			coordinates = this.coordinates();
884
885		if (!this.settings.freeDrag) {
886			// check closest item
887			$.each(coordinates, $.proxy(function(index, value) {
888				// on a left pull, check on current index
889				if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
890					position = index;
891				// on a right pull, check on previous index
892				// to do so, subtract width from value and set position = index + 1
893				} else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
894					position = index + 1;
895				} else if (this.op(coordinate, '<', value)
896					&& this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) {
897					position = direction === 'left' ? index + 1 : index;
898				}
899				return position === -1;
900			}, this));
901		}
902
903		if (!this.settings.loop) {
904			// non loop boundries
905			if (this.op(coordinate, '>', coordinates[this.minimum()])) {
906				position = coordinate = this.minimum();
907			} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
908				position = coordinate = this.maximum();
909			}
910		}
911
912		return position;
913	};
914
915	/**
916	 * Animates the stage.
917	 * @todo #270
918	 * @public
919	 * @param {Number} coordinate - The coordinate in pixels.
920	 */
921	Owl.prototype.animate = function(coordinate) {
922		var animate = this.speed() > 0;
923
924		this.is('animating') && this.onTransitionEnd();
925
926		if (animate) {
927			this.enter('animating');
928			this.trigger('translate');
929		}
930
931		if ($.support.transform3d && $.support.transition) {
932			this.$stage.css({
933				transform: 'translate3d(' + coordinate + 'px,0px,0px)',
934				transition: (this.speed() / 1000) + 's' + (
935					this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
936				)
937			});
938		} else if (animate) {
939			this.$stage.animate({
940				left: coordinate + 'px'
941			}, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
942		} else {
943			this.$stage.css({
944				left: coordinate + 'px'
945			});
946		}
947	};
948
949	/**
950	 * Checks whether the carousel is in a specific state or not.
951	 * @param {String} state - The state to check.
952	 * @returns {Boolean} - The flag which indicates if the carousel is busy.
953	 */
954	Owl.prototype.is = function(state) {
955		return this._states.current[state] && this._states.current[state] > 0;
956	};
957
958	/**
959	 * Sets the absolute position of the current item.
960	 * @public
961	 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
962	 * @returns {Number} - The absolute position of the current item.
963	 */
964	Owl.prototype.current = function(position) {
965		if (position === undefined) {
966			return this._current;
967		}
968
969		if (this._items.length === 0) {
970			return undefined;
971		}
972
973		position = this.normalize(position);
974
975		if (this._current !== position) {
976			var event = this.trigger('change', { property: { name: 'position', value: position } });
977
978			if (event.data !== undefined) {
979				position = this.normalize(event.data);
980			}
981
982			this._current = position;
983
984			this.invalidate('position');
985
986			this.trigger('changed', { property: { name: 'position', value: this._current } });
987		}
988
989		return this._current;
990	};
991
992	/**
993	 * Invalidates the given part of the update routine.
994	 * @param {String} [part] - The part to invalidate.
995	 * @returns {Array.<String>} - The invalidated parts.
996	 */
997	Owl.prototype.invalidate = function(part) {
998		if ($.type(part) === 'string') {
999			this._invalidated[part] = true;
1000			this.is('valid') && this.leave('valid');
1001		}
1002		return $.map(this._invalidated, function(v, i) { return i });
1003	};
1004
1005	/**
1006	 * Resets the absolute position of the current item.
1007	 * @public
1008	 * @param {Number} position - The absolute position of the new item.
1009	 */
1010	Owl.prototype.reset = function(position) {
1011		position = this.normalize(position);
1012
1013		if (position === undefined) {
1014			return;
1015		}
1016
1017		this._speed = 0;
1018		this._current = position;
1019
1020		this.suppress([ 'translate', 'translated' ]);
1021
1022		this.animate(this.coordinates(position));
1023
1024		this.release([ 'translate', 'translated' ]);
1025	};
1026
1027	/**
1028	 * Normalizes an absolute or a relative position of an item.
1029	 * @public
1030	 * @param {Number} position - The absolute or relative position to normalize.
1031	 * @param {Boolean} [relative=false] - Whether the given position is relative or not.
1032	 * @returns {Number} - The normalized position.
1033	 */
1034	Owl.prototype.normalize = function(position, relative) {
1035		var n = this._items.length,
1036			m = relative ? 0 : this._clones.length;
1037
1038		if (!this.isNumeric(position) || n < 1) {
1039			position = undefined;
1040		} else if (position < 0 || position >= n + m) {
1041			position = ((position - m / 2) % n + n) % n + m / 2;
1042		}
1043
1044		return position;
1045	};
1046
1047	/**
1048	 * Converts an absolute position of an item into a relative one.
1049	 * @public
1050	 * @param {Number} position - The absolute position to convert.
1051	 * @returns {Number} - The converted position.
1052	 */
1053	Owl.prototype.relative = function(position) {
1054		position -= this._clones.length / 2;
1055		return this.normalize(position, true);
1056	};
1057
1058	/**
1059	 * Gets the maximum position for the current item.
1060	 * @public
1061	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1062	 * @returns {Number}
1063	 */
1064	Owl.prototype.maximum = function(relative) {
1065		var settings = this.settings,
1066			maximum = this._coordinates.length,
1067			iterator,
1068			reciprocalItemsWidth,
1069			elementWidth;
1070
1071		if (settings.loop) {
1072			maximum = this._clones.length / 2 + this._items.length - 1;
1073		} else if (settings.autoWidth || settings.merge) {
1074			iterator = this._items.length;
1075			if (iterator) {
1076				reciprocalItemsWidth = this._items[--iterator].width();
1077				elementWidth = this.$element.width();
1078				while (iterator--) {
1079					reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
1080					if (reciprocalItemsWidth > elementWidth) {
1081						break;
1082					}
1083				}
1084			}
1085			maximum = iterator + 1;
1086		} else if (settings.center) {
1087			maximum = this._items.length - 1;
1088		} else {
1089			maximum = this._items.length - settings.items;
1090		}
1091
1092		if (relative) {
1093			maximum -= this._clones.length / 2;
1094		}
1095
1096		return Math.max(maximum, 0);
1097	};
1098
1099	/**
1100	 * Gets the minimum position for the current item.
1101	 * @public
1102	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1103	 * @returns {Number}
1104	 */
1105	Owl.prototype.minimum = function(relative) {
1106		return relative ? 0 : this._clones.length / 2;
1107	};
1108
1109	/**
1110	 * Gets an item at the specified relative position.
1111	 * @public
1112	 * @param {Number} [position] - The relative position of the item.
1113	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1114	 */
1115	Owl.prototype.items = function(position) {
1116		if (position === undefined) {
1117			return this._items.slice();
1118		}
1119
1120		position = this.normalize(position, true);
1121		return this._items[position];
1122	};
1123
1124	/**
1125	 * Gets an item at the specified relative position.
1126	 * @public
1127	 * @param {Number} [position] - The relative position of the item.
1128	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1129	 */
1130	Owl.prototype.mergers = function(position) {
1131		if (position === undefined) {
1132			return this._mergers.slice();
1133		}
1134
1135		position = this.normalize(position, true);
1136		return this._mergers[position];
1137	};
1138
1139	/**
1140	 * Gets the absolute positions of clones for an item.
1141	 * @public
1142	 * @param {Number} [position] - The relative position of the item.
1143	 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
1144	 */
1145	Owl.prototype.clones = function(position) {
1146		var odd = this._clones.length / 2,
1147			even = odd + this._items.length,
1148			map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
1149
1150		if (position === undefined) {
1151			return $.map(this._clones, function(v, i) { return map(i) });
1152		}
1153
1154		return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
1155	};
1156
1157	/**
1158	 * Sets the current animation speed.
1159	 * @public
1160	 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
1161	 * @returns {Number} - The current animation speed in milliseconds.
1162	 */
1163	Owl.prototype.speed = function(speed) {
1164		if (speed !== undefined) {
1165			this._speed = speed;
1166		}
1167
1168		return this._speed;
1169	};
1170
1171	/**
1172	 * Gets the coordinate of an item.
1173	 * @todo The name of this method is missleanding.
1174	 * @public
1175	 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
1176	 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
1177	 */
1178	Owl.prototype.coordinates = function(position) {
1179		var multiplier = 1,
1180			newPosition = position - 1,
1181			coordinate;
1182
1183		if (position === undefined) {
1184			return $.map(this._coordinates, $.proxy(function(coordinate, index) {
1185				return this.coordinates(index);
1186			}, this));
1187		}
1188
1189		if (this.settings.center) {
1190			if (this.settings.rtl) {
1191				multiplier = -1;
1192				newPosition = position + 1;
1193			}
1194
1195			coordinate = this._coordinates[position];
1196			coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
1197		} else {
1198			coordinate = this._coordinates[newPosition] || 0;
1199		}
1200
1201		coordinate = Math.ceil(coordinate);
1202
1203		return coordinate;
1204	};
1205
1206	/**
1207	 * Calculates the speed for a translation.
1208	 * @protected
1209	 * @param {Number} from - The absolute position of the start item.
1210	 * @param {Number} to - The absolute position of the target item.
1211	 * @param {Number} [factor=undefined] - The time factor in milliseconds.
1212	 * @returns {Number} - The time in milliseconds for the translation.
1213	 */
1214	Owl.prototype.duration = function(from, to, factor) {
1215		if (factor === 0) {
1216			return 0;
1217		}
1218
1219		return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
1220	};
1221
1222	/**
1223	 * Slides to the specified item.
1224	 * @public
1225	 * @param {Number} position - The position of the item.
1226	 * @param {Number} [speed] - The time in milliseconds for the transition.
1227	 */
1228	Owl.prototype.to = function(position, speed) {
1229		var current = this.current(),
1230			revert = null,
1231			distance = position - this.relative(current),
1232			direction = (distance > 0) - (distance < 0),
1233			items = this._items.length,
1234			minimum = this.minimum(),
1235			maximum = this.maximum();
1236
1237		if (this.settings.loop) {
1238			if (!this.settings.rewind && Math.abs(distance) > items / 2) {
1239				distance += direction * -1 * items;
1240			}
1241
1242			position = current + distance;
1243			revert = ((position - minimum) % items + items) % items + minimum;
1244
1245			if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
1246				current = revert - distance;
1247				position = revert;
1248				this.reset(current);
1249			}
1250		} else if (this.settings.rewind) {
1251			maximum += 1;
1252			position = (position % maximum + maximum) % maximum;
1253		} else {
1254			position = Math.max(minimum, Math.min(maximum, position));
1255		}
1256
1257		this.speed(this.duration(current, position, speed));
1258		this.current(position);
1259
1260		if (this.isVisible()) {
1261			this.update();
1262		}
1263	};
1264
1265	/**
1266	 * Slides to the next item.
1267	 * @public
1268	 * @param {Number} [speed] - The time in milliseconds for the transition.
1269	 */
1270	Owl.prototype.next = function(speed) {
1271		speed = speed || false;
1272		this.to(this.relative(this.current()) + 1, speed);
1273	};
1274
1275	/**
1276	 * Slides to the previous item.
1277	 * @public
1278	 * @param {Number} [speed] - The time in milliseconds for the transition.
1279	 */
1280	Owl.prototype.prev = function(speed) {
1281		speed = speed || false;
1282		this.to(this.relative(this.current()) - 1, speed);
1283	};
1284
1285	/**
1286	 * Handles the end of an animation.
1287	 * @protected
1288	 * @param {Event} event - The event arguments.
1289	 */
1290	Owl.prototype.onTransitionEnd = function(event) {
1291
1292		// if css2 animation then event object is undefined
1293		if (event !== undefined) {
1294			event.stopPropagation();
1295
1296			// Catch only owl-stage transitionEnd event
1297			if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
1298				return false;
1299			}
1300		}
1301
1302		this.leave('animating');
1303		this.trigger('translated');
1304	};
1305
1306	/**
1307	 * Gets viewport width.
1308	 * @protected
1309	 * @return {Number} - The width in pixel.
1310	 */
1311	Owl.prototype.viewport = function() {
1312		var width;
1313		if (this.options.responsiveBaseElement !== window) {
1314			width = $(this.options.responsiveBaseElement).width();
1315		} else if (window.innerWidth) {
1316			width = window.innerWidth;
1317		} else if (document.documentElement && document.documentElement.clientWidth) {
1318			width = document.documentElement.clientWidth;
1319		} else {
1320			console.warn('Can not detect viewport width.');
1321		}
1322		return width;
1323	};
1324
1325	/**
1326	 * Replaces the current content.
1327	 * @public
1328	 * @param {HTMLElement|jQuery|String} content - The new content.
1329	 */
1330	Owl.prototype.replace = function(content) {
1331		this.$stage.empty();
1332		this._items = [];
1333
1334		if (content) {
1335			content = (content instanceof jQuery) ? content : $(content);
1336		}
1337
1338		if (this.settings.nestedItemSelector) {
1339			content = content.find('.' + this.settings.nestedItemSelector);
1340		}
1341
1342		content.filter(function() {
1343			return this.nodeType === 1;
1344		}).each($.proxy(function(index, item) {
1345			item = this.prepare(item);
1346			this.$stage.append(item);
1347			this._items.push(item);
1348			this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1349		}, this));
1350
1351		this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
1352
1353		this.invalidate('items');
1354	};
1355
1356	/**
1357	 * Adds an item.
1358	 * @todo Use `item` instead of `content` for the event arguments.
1359	 * @public
1360	 * @param {HTMLElement|jQuery|String} content - The item content to add.
1361	 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
1362	 */
1363	Owl.prototype.add = function(content, position) {
1364		var current = this.relative(this._current);
1365
1366		position = position === undefined ? this._items.length : this.normalize(position, true);
1367		content = content instanceof jQuery ? content : $(content);
1368
1369		this.trigger('add', { content: content, position: position });
1370
1371		content = this.prepare(content);
1372
1373		if (this._items.length === 0 || position === this._items.length) {
1374			this._items.length === 0 && this.$stage.append(content);
1375			this._items.length !== 0 && this._items[position - 1].after(content);
1376			this._items.push(content);
1377			this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1378		} else {
1379			this._items[position].before(content);
1380			this._items.splice(position, 0, content);
1381			this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1382		}
1383
1384		this._items[current] && this.reset(this._items[current].index());
1385
1386		this.invalidate('items');
1387
1388		this.trigger('added', { content: content, position: position });
1389	};
1390
1391	/**
1392	 * Removes an item by its position.
1393	 * @todo Use `item` instead of `content` for the event arguments.
1394	 * @public
1395	 * @param {Number} position - The relative position of the item to remove.
1396	 */
1397	Owl.prototype.remove = function(position) {
1398		position = this.normalize(position, true);
1399
1400		if (position === undefined) {
1401			return;
1402		}
1403
1404		this.trigger('remove', { content: this._items[position], position: position });
1405
1406		this._items[position].remove();
1407		this._items.splice(position, 1);
1408		this._mergers.splice(position, 1);
1409
1410		this.invalidate('items');
1411
1412		this.trigger('removed', { content: null, position: position });
1413	};
1414
1415	/**
1416	 * Preloads images with auto width.
1417	 * @todo Replace by a more generic approach
1418	 * @protected
1419	 */
1420	Owl.prototype.preloadAutoWidthImages = function(images) {
1421		images.each($.proxy(function(i, element) {
1422			this.enter('pre-loading');
1423			element = $(element);
1424			$(new Image()).one('load', $.proxy(function(e) {
1425				element.attr('src', e.target.src);
1426				element.css('opacity', 1);
1427				this.leave('pre-loading');
1428				!this.is('pre-loading') && !this.is('initializing') && this.refresh();
1429			}, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
1430		}, this));
1431	};
1432
1433	/**
1434	 * Destroys the carousel.
1435	 * @public
1436	 */
1437	Owl.prototype.destroy = function() {
1438
1439		this.$element.off('.owl.core');
1440		this.$stage.off('.owl.core');
1441		$(document).off('.owl.core');
1442
1443		if (this.settings.responsive !== false) {
1444			window.clearTimeout(this.resizeTimer);
1445			this.off(window, 'resize', this._handlers.onThrottledResize);
1446		}
1447
1448		for (var i in this._plugins) {
1449			this._plugins[i].destroy();
1450		}
1451
1452		this.$stage.children('.cloned').remove();
1453
1454		this.$stage.unwrap();
1455		this.$stage.children().contents().unwrap();
1456		this.$stage.children().unwrap();
1457		this.$stage.remove();
1458		this.$element
1459			.removeClass(this.options.refreshClass)
1460			.removeClass(this.options.loadingClass)
1461			.removeClass(this.options.loadedClass)
1462			.removeClass(this.options.rtlClass)
1463			.removeClass(this.options.dragClass)
1464			.removeClass(this.options.grabClass)
1465			.attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
1466			.removeData('owl.carousel');
1467	};
1468
1469	/**
1470	 * Operators to calculate right-to-left and left-to-right.
1471	 * @protected
1472	 * @param {Number} [a] - The left side operand.
1473	 * @param {String} [o] - The operator.
1474	 * @param {Number} [b] - The right side operand.
1475	 */
1476	Owl.prototype.op = function(a, o, b) {
1477		var rtl = this.settings.rtl;
1478		switch (o) {
1479			case '<':
1480				return rtl ? a > b : a < b;
1481			case '>':
1482				return rtl ? a < b : a > b;
1483			case '>=':
1484				return rtl ? a <= b : a >= b;
1485			case '<=':
1486				return rtl ? a >= b : a <= b;
1487			default:
1488				break;
1489		}
1490	};
1491
1492	/**
1493	 * Attaches to an internal event.
1494	 * @protected
1495	 * @param {HTMLElement} element - The event source.
1496	 * @param {String} event - The event name.
1497	 * @param {Function} listener - The event handler to attach.
1498	 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
1499	 */
1500	Owl.prototype.on = function(element, event, listener, capture) {
1501		if (element.addEventListener) {
1502			element.addEventListener(event, listener, capture);
1503		} else if (element.attachEvent) {
1504			element.attachEvent('on' + event, listener);
1505		}
1506	};
1507
1508	/**
1509	 * Detaches from an internal event.
1510	 * @protected
1511	 * @param {HTMLElement} element - The event source.
1512	 * @param {String} event - The event name.
1513	 * @param {Function} listener - The attached event handler to detach.
1514	 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
1515	 */
1516	Owl.prototype.off = function(element, event, listener, capture) {
1517		if (element.removeEventListener) {
1518			element.removeEventListener(event, listener, capture);
1519		} else if (element.detachEvent) {
1520			element.detachEvent('on' + event, listener);
1521		}
1522	};
1523
1524	/**
1525	 * Triggers a public event.
1526	 * @todo Remove `status`, `relatedTarget` should be used instead.
1527	 * @protected
1528	 * @param {String} name - The event name.
1529	 * @param {*} [data=null] - The event data.
1530	 * @param {String} [namespace=carousel] - The event namespace.
1531	 * @param {String} [state] - The state which is associated with the event.
1532	 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
1533	 * @returns {Event} - The event arguments.
1534	 */
1535	Owl.prototype.trigger = function(name, data, namespace, state, enter) {
1536		var status = {
1537			item: { count: this._items.length, index: this.current() }
1538		}, handler = $.camelCase(
1539			$.grep([ 'on', name, namespace ], function(v) { return v })
1540				.join('-').toLowerCase()
1541		), event = $.Event(
1542			[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
1543			$.extend({ relatedTarget: this }, status, data)
1544		);
1545
1546		if (!this._supress[name]) {
1547			$.each(this._plugins, function(name, plugin) {
1548				if (plugin.onTrigger) {
1549					plugin.onTrigger(event);
1550				}
1551			});
1552
1553			this.register({ type: Owl.Type.Event, name: name });
1554			this.$element.trigger(event);
1555
1556			if (this.settings && typeof this.settings[handler] === 'function') {
1557				this.settings[handler].call(this, event);
1558			}
1559		}
1560
1561		return event;
1562	};
1563
1564	/**
1565	 * Enters a state.
1566	 * @param name - The state name.
1567	 */
1568	Owl.prototype.enter = function(name) {
1569		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1570			if (this._states.current[name] === undefined) {
1571				this._states.current[name] = 0;
1572			}
1573
1574			this._states.current[name]++;
1575		}, this));
1576	};
1577
1578	/**
1579	 * Leaves a state.
1580	 * @param name - The state name.
1581	 */
1582	Owl.prototype.leave = function(name) {
1583		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1584			this._states.current[name]--;
1585		}, this));
1586	};
1587
1588	/**
1589	 * Registers an event or state.
1590	 * @public
1591	 * @param {Object} object - The event or state to register.
1592	 */
1593	Owl.prototype.register = function(object) {
1594		if (object.type === Owl.Type.Event) {
1595			if (!$.event.special[object.name]) {
1596				$.event.special[object.name] = {};
1597			}
1598
1599			if (!$.event.special[object.name].owl) {
1600				var _default = $.event.special[object.name]._default;
1601				$.event.special[object.name]._default = function(e) {
1602					if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
1603						return _default.apply(this, arguments);
1604					}
1605					return e.namespace && e.namespace.indexOf('owl') > -1;
1606				};
1607				$.event.special[object.name].owl = true;
1608			}
1609		} else if (object.type === Owl.Type.State) {
1610			if (!this._states.tags[object.name]) {
1611				this._states.tags[object.name] = object.tags;
1612			} else {
1613				this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
1614			}
1615
1616			this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
1617				return $.inArray(tag, this._states.tags[object.name]) === i;
1618			}, this));
1619		}
1620	};
1621
1622	/**
1623	 * Suppresses events.
1624	 * @protected
1625	 * @param {Array.<String>} events - The events to suppress.
1626	 */
1627	Owl.prototype.suppress = function(events) {
1628		$.each(events, $.proxy(function(index, event) {
1629			this._supress[event] = true;
1630		}, this));
1631	};
1632
1633	/**
1634	 * Releases suppressed events.
1635	 * @protected
1636	 * @param {Array.<String>} events - The events to release.
1637	 */
1638	Owl.prototype.release = function(events) {
1639		$.each(events, $.proxy(function(index, event) {
1640			delete this._supress[event];
1641		}, this));
1642	};
1643
1644	/**
1645	 * Gets unified pointer coordinates from event.
1646	 * @todo #261
1647	 * @protected
1648	 * @param {Event} - The `mousedown` or `touchstart` event.
1649	 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
1650	 */
1651	Owl.prototype.pointer = function(event) {
1652		var result = { x: null, y: null };
1653
1654		event = event.originalEvent || event || window.event;
1655
1656		event = event.touches && event.touches.length ?
1657			event.touches[0] : event.changedTouches && event.changedTouches.length ?
1658				event.changedTouches[0] : event;
1659
1660		if (event.pageX) {
1661			result.x = event.pageX;
1662			result.y = event.pageY;
1663		} else {
1664			result.x = event.clientX;
1665			result.y = event.clientY;
1666		}
1667
1668		return result;
1669	};
1670
1671	/**
1672	 * Determines if the input is a Number or something that can be coerced to a Number
1673	 * @protected
1674	 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
1675	 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
1676	 */
1677	Owl.prototype.isNumeric = function(number) {
1678		return !isNaN(parseFloat(number));
1679	};
1680
1681	/**
1682	 * Gets the difference of two vectors.
1683	 * @todo #261
1684	 * @protected
1685	 * @param {Object} - The first vector.
1686	 * @param {Object} - The second vector.
1687	 * @returns {Object} - The difference.
1688	 */
1689	Owl.prototype.difference = function(first, second) {
1690		return {
1691			x: first.x - second.x,
1692			y: first.y - second.y
1693		};
1694	};
1695
1696	/**
1697	 * The jQuery Plugin for the Owl Carousel
1698	 * @todo Navigation plugin `next` and `prev`
1699	 * @public
1700	 */
1701	$.fn.owlCarousel = function(option) {
1702		var args = Array.prototype.slice.call(arguments, 1);
1703
1704		return this.each(function() {
1705			var $this = $(this),
1706				data = $this.data('owl.carousel');
1707
1708			if (!data) {
1709				data = new Owl(this, typeof option == 'object' && option);
1710				$this.data('owl.carousel', data);
1711
1712				$.each([
1713					'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
1714				], function(i, event) {
1715					data.register({ type: Owl.Type.Event, name: event });
1716					data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
1717						if (e.namespace && e.relatedTarget !== this) {
1718							this.suppress([ event ]);
1719							data[event].apply(this, [].slice.call(arguments, 1));
1720							this.release([ event ]);
1721						}
1722					}, data));
1723				});
1724			}
1725
1726			if (typeof option == 'string' && option.charAt(0) !== '_') {
1727				data[option].apply(data, args);
1728			}
1729		});
1730	};
1731
1732	/**
1733	 * The constructor for the jQuery Plugin
1734	 * @public
1735	 */
1736	$.fn.owlCarousel.Constructor = Owl;
1737
1738})(window.Zepto || window.jQuery, window, document);
1739
1740/**
1741 * AutoRefresh Plugin
1742 * @version 2.3.4
1743 * @author Artus Kolanowski
1744 * @author David Deutsch
1745 * @license The MIT License (MIT)
1746 */
1747;(function($, window, document, undefined) {
1748
1749	/**
1750	 * Creates the auto refresh plugin.
1751	 * @class The Auto Refresh Plugin
1752	 * @param {Owl} carousel - The Owl Carousel
1753	 */
1754	var AutoRefresh = function(carousel) {
1755		/**
1756		 * Reference to the core.
1757		 * @protected
1758		 * @type {Owl}
1759		 */
1760		this._core = carousel;
1761
1762		/**
1763		 * Refresh interval.
1764		 * @protected
1765		 * @type {number}
1766		 */
1767		this._interval = null;
1768
1769		/**
1770		 * Whether the element is currently visible or not.
1771		 * @protected
1772		 * @type {Boolean}
1773		 */
1774		this._visible = null;
1775
1776		/**
1777		 * All event handlers.
1778		 * @protected
1779		 * @type {Object}
1780		 */
1781		this._handlers = {
1782			'initialized.owl.carousel': $.proxy(function(e) {
1783				if (e.namespace && this._core.settings.autoRefresh) {
1784					this.watch();
1785				}
1786			}, this)
1787		};
1788
1789		// set default options
1790		this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
1791
1792		// register event handlers
1793		this._core.$element.on(this._handlers);
1794	};
1795
1796	/**
1797	 * Default options.
1798	 * @public
1799	 */
1800	AutoRefresh.Defaults = {
1801		autoRefresh: true,
1802		autoRefreshInterval: 500
1803	};
1804
1805	/**
1806	 * Watches the element.
1807	 */
1808	AutoRefresh.prototype.watch = function() {
1809		if (this._interval) {
1810			return;
1811		}
1812
1813		this._visible = this._core.isVisible();
1814		this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
1815	};
1816
1817	/**
1818	 * Refreshes the element.
1819	 */
1820	AutoRefresh.prototype.refresh = function() {
1821		if (this._core.isVisible() === this._visible) {
1822			return;
1823		}
1824
1825		this._visible = !this._visible;
1826
1827		this._core.$element.toggleClass('owl-hidden', !this._visible);
1828
1829		this._visible && (this._core.invalidate('width') && this._core.refresh());
1830	};
1831
1832	/**
1833	 * Destroys the plugin.
1834	 */
1835	AutoRefresh.prototype.destroy = function() {
1836		var handler, property;
1837
1838		window.clearInterval(this._interval);
1839
1840		for (handler in this._handlers) {
1841			this._core.$element.off(handler, this._handlers[handler]);
1842		}
1843		for (property in Object.getOwnPropertyNames(this)) {
1844			typeof this[property] != 'function' && (this[property] = null);
1845		}
1846	};
1847
1848	$.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
1849
1850})(window.Zepto || window.jQuery, window, document);
1851
1852/**
1853 * Lazy Plugin
1854 * @version 2.3.4
1855 * @author Bartosz Wojciechowski
1856 * @author David Deutsch
1857 * @license The MIT License (MIT)
1858 */
1859;(function($, window, document, undefined) {
1860
1861	/**
1862	 * Creates the lazy plugin.
1863	 * @class The Lazy Plugin
1864	 * @param {Owl} carousel - The Owl Carousel
1865	 */
1866	var Lazy = function(carousel) {
1867
1868		/**
1869		 * Reference to the core.
1870		 * @protected
1871		 * @type {Owl}
1872		 */
1873		this._core = carousel;
1874
1875		/**
1876		 * Already loaded items.
1877		 * @protected
1878		 * @type {Array.<jQuery>}
1879		 */
1880		this._loaded = [];
1881
1882		/**
1883		 * Event handlers.
1884		 * @protected
1885		 * @type {Object}
1886		 */
1887		this._handlers = {
1888			'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
1889				if (!e.namespace) {
1890					return;
1891				}
1892
1893				if (!this._core.settings || !this._core.settings.lazyLoad) {
1894					return;
1895				}
1896
1897				if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
1898					var settings = this._core.settings,
1899						n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
1900						i = ((settings.center && n * -1) || 0),
1901						position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
1902						clones = this._core.clones().length,
1903						load = $.proxy(function(i, v) { this.load(v) }, this);
1904					//TODO: Need documentation for this new option
1905					if (settings.lazyLoadEager > 0) {
1906						n += settings.lazyLoadEager;
1907						// If the carousel is looping also preload images that are to the "left"
1908						if (settings.loop) {
1909              position -= settings.lazyLoadEager;
1910              n++;
1911            }
1912					}
1913
1914					while (i++ < n) {
1915						this.load(clones / 2 + this._core.relative(position));
1916						clones && $.each(this._core.clones(this._core.relative(position)), load);
1917						position++;
1918					}
1919				}
1920			}, this)
1921		};
1922
1923		// set the default options
1924		this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
1925
1926		// register event handler
1927		this._core.$element.on(this._handlers);
1928	};
1929
1930	/**
1931	 * Default options.
1932	 * @public
1933	 */
1934	Lazy.Defaults = {
1935		lazyLoad: false,
1936		lazyLoadEager: 0
1937	};
1938
1939	/**
1940	 * Loads all resources of an item at the specified position.
1941	 * @param {Number} position - The absolute position of the item.
1942	 * @protected
1943	 */
1944	Lazy.prototype.load = function(position) {
1945		var $item = this._core.$stage.children().eq(position),
1946			$elements = $item && $item.find('.owl-lazy');
1947
1948		if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
1949			return;
1950		}
1951
1952		$elements.each($.proxy(function(index, element) {
1953			var $element = $(element), image,
1954                url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset');
1955
1956			this._core.trigger('load', { element: $element, url: url }, 'lazy');
1957
1958			if ($element.is('img')) {
1959				$element.one('load.owl.lazy', $.proxy(function() {
1960					$element.css('opacity', 1);
1961					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
1962				}, this)).attr('src', url);
1963            } else if ($element.is('source')) {
1964                $element.one('load.owl.lazy', $.proxy(function() {
1965                    this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
1966                }, this)).attr('srcset', url);
1967			} else {
1968				image = new Image();
1969				image.onload = $.proxy(function() {
1970					$element.css({
1971						'background-image': 'url("' + url + '")',
1972						'opacity': '1'
1973					});
1974					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
1975				}, this);
1976				image.src = url;
1977			}
1978		}, this));
1979
1980		this._loaded.push($item.get(0));
1981	};
1982
1983	/**
1984	 * Destroys the plugin.
1985	 * @public
1986	 */
1987	Lazy.prototype.destroy = function() {
1988		var handler, property;
1989
1990		for (handler in this.handlers) {
1991			this._core.$element.off(handler, this.handlers[handler]);
1992		}
1993		for (property in Object.getOwnPropertyNames(this)) {
1994			typeof this[property] != 'function' && (this[property] = null);
1995		}
1996	};
1997
1998	$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
1999
2000})(window.Zepto || window.jQuery, window, document);
2001
2002/**
2003 * AutoHeight Plugin
2004 * @version 2.3.4
2005 * @author Bartosz Wojciechowski
2006 * @author David Deutsch
2007 * @license The MIT License (MIT)
2008 */
2009;(function($, window, document, undefined) {
2010
2011	/**
2012	 * Creates the auto height plugin.
2013	 * @class The Auto Height Plugin
2014	 * @param {Owl} carousel - The Owl Carousel
2015	 */
2016	var AutoHeight = function(carousel) {
2017		/**
2018		 * Reference to the core.
2019		 * @protected
2020		 * @type {Owl}
2021		 */
2022		this._core = carousel;
2023
2024		this._previousHeight = null;
2025
2026		/**
2027		 * All event handlers.
2028		 * @protected
2029		 * @type {Object}
2030		 */
2031		this._handlers = {
2032			'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
2033				if (e.namespace && this._core.settings.autoHeight) {
2034					this.update();
2035				}
2036			}, this),
2037			'changed.owl.carousel': $.proxy(function(e) {
2038				if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){
2039					this.update();
2040				}
2041			}, this),
2042			'loaded.owl.lazy': $.proxy(function(e) {
2043				if (e.namespace && this._core.settings.autoHeight
2044					&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
2045					this.update();
2046				}
2047			}, this)
2048		};
2049
2050		// set default options
2051		this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
2052
2053		// register event handlers
2054		this._core.$element.on(this._handlers);
2055		this._intervalId = null;
2056		var refThis = this;
2057
2058		// These changes have been taken from a PR by gavrochelegnou proposed in #1575
2059		// and have been made compatible with the latest jQuery version
2060		$(window).on('load', function() {
2061			if (refThis._core.settings.autoHeight) {
2062				refThis.update();
2063			}
2064		});
2065
2066		// Autoresize the height of the carousel when window is resized
2067		// When carousel has images, the height is dependent on the width
2068		// and should also change on resize
2069		$(window).resize(function() {
2070			if (refThis._core.settings.autoHeight) {
2071				if (refThis._intervalId != null) {
2072					clearTimeout(refThis._intervalId);
2073				}
2074
2075				refThis._intervalId = setTimeout(function() {
2076					refThis.update();
2077				}, 250);
2078			}
2079		});
2080
2081	};
2082
2083	/**
2084	 * Default options.
2085	 * @public
2086	 */
2087	AutoHeight.Defaults = {
2088		autoHeight: true,
2089		autoHeightClass: 'owl-height'
2090	};
2091
2092	/**
2093	 * Updates the view.
2094	 */
2095	AutoHeight.prototype.update = function() {
2096		var start = this._core._current,
2097			end = start + this._core.settings.items,
2098			lazyLoadEnabled = this._core.settings.lazyLoad,
2099			visible = this._core.$stage.children().toArray().slice(start, end),
2100			heights = [],
2101			maxheight = 0;
2102
2103		$.each(visible, function(index, item) {
2104			heights.push($(item).height());
2105		});
2106
2107		maxheight = Math.max.apply(null, heights);
2108
2109		if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) {
2110			maxheight = this._previousHeight;
2111		}
2112
2113		this._previousHeight = maxheight;
2114
2115		this._core.$stage.parent()
2116			.height(maxheight)
2117			.addClass(this._core.settings.autoHeightClass);
2118	};
2119
2120	AutoHeight.prototype.destroy = function() {
2121		var handler, property;
2122
2123		for (handler in this._handlers) {
2124			this._core.$element.off(handler, this._handlers[handler]);
2125		}
2126		for (property in Object.getOwnPropertyNames(this)) {
2127			typeof this[property] !== 'function' && (this[property] = null);
2128		}
2129	};
2130
2131	$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
2132
2133})(window.Zepto || window.jQuery, window, document);
2134
2135/**
2136 * Video Plugin
2137 * @version 2.3.4
2138 * @author Bartosz Wojciechowski
2139 * @author David Deutsch
2140 * @license The MIT License (MIT)
2141 */
2142;(function($, window, document, undefined) {
2143
2144	/**
2145	 * Creates the video plugin.
2146	 * @class The Video Plugin
2147	 * @param {Owl} carousel - The Owl Carousel
2148	 */
2149	var Video = function(carousel) {
2150		/**
2151		 * Reference to the core.
2152		 * @protected
2153		 * @type {Owl}
2154		 */
2155		this._core = carousel;
2156
2157		/**
2158		 * Cache all video URLs.
2159		 * @protected
2160		 * @type {Object}
2161		 */
2162		this._videos = {};
2163
2164		/**
2165		 * Current playing item.
2166		 * @protected
2167		 * @type {jQuery}
2168		 */
2169		this._playing = null;
2170
2171		/**
2172		 * All event handlers.
2173		 * @todo The cloned content removale is too late
2174		 * @protected
2175		 * @type {Object}
2176		 */
2177		this._handlers = {
2178			'initialized.owl.carousel': $.proxy(function(e) {
2179				if (e.namespace) {
2180					this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
2181				}
2182			}, this),
2183			'resize.owl.carousel': $.proxy(function(e) {
2184				if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
2185					e.preventDefault();
2186				}
2187			}, this),
2188			'refreshed.owl.carousel': $.proxy(function(e) {
2189				if (e.namespace && this._core.is('resizing')) {
2190					this._core.$stage.find('.cloned .owl-video-frame').remove();
2191				}
2192			}, this),
2193			'changed.owl.carousel': $.proxy(function(e) {
2194				if (e.namespace && e.property.name === 'position' && this._playing) {
2195					this.stop();
2196				}
2197			}, this),
2198			'prepared.owl.carousel': $.proxy(function(e) {
2199				if (!e.namespace) {
2200					return;
2201				}
2202
2203				var $element = $(e.content).find('.owl-video');
2204
2205				if ($element.length) {
2206					$element.css('display', 'none');
2207					this.fetch($element, $(e.content));
2208				}
2209			}, this)
2210		};
2211
2212		// set default options
2213		this._core.options = $.extend({}, Video.Defaults, this._core.options);
2214
2215		// register event handlers
2216		this._core.$element.on(this._handlers);
2217
2218		this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
2219			this.play(e);
2220		}, this));
2221	};
2222
2223	/**
2224	 * Default options.
2225	 * @public
2226	 */
2227	Video.Defaults = {
2228		video: false,
2229		videoHeight: false,
2230		videoWidth: false
2231	};
2232
2233	/**
2234	 * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
2235	 * @protected
2236	 * @param {jQuery} target - The target containing the video data.
2237	 * @param {jQuery} item - The item containing the video.
2238	 */
2239	Video.prototype.fetch = function(target, item) {
2240			var type = (function() {
2241					if (target.attr('data-vimeo-id')) {
2242						return 'vimeo';
2243					} else if (target.attr('data-vzaar-id')) {
2244						return 'vzaar'
2245					} else {
2246						return 'youtube';
2247					}
2248				})(),
2249				id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
2250				width = target.attr('data-width') || this._core.settings.videoWidth,
2251				height = target.attr('data-height') || this._core.settings.videoHeight,
2252				url = target.attr('href');
2253
2254		if (url) {
2255
2256			/*
2257					Parses the id's out of the following urls (and probably more):
2258					https://www.youtube.com/watch?v=:id
2259					https://youtu.be/:id
2260					https://vimeo.com/:id
2261					https://vimeo.com/channels/:channel/:id
2262					https://vimeo.com/groups/:group/videos/:id
2263					https://app.vzaar.com/videos/:id
2264
2265					Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
2266			*/
2267
2268			id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
2269
2270			if (id[3].indexOf('youtu') > -1) {
2271				type = 'youtube';
2272			} else if (id[3].indexOf('vimeo') > -1) {
2273				type = 'vimeo';
2274			} else if (id[3].indexOf('vzaar') > -1) {
2275				type = 'vzaar';
2276			} else {
2277				throw new Error('Video URL not supported.');
2278			}
2279			id = id[6];
2280		} else {
2281			throw new Error('Missing video URL.');
2282		}
2283
2284		this._videos[url] = {
2285			type: type,
2286			id: id,
2287			width: width,
2288			height: height
2289		};
2290
2291		item.attr('data-video', url);
2292
2293		this.thumbnail(target, this._videos[url]);
2294	};
2295
2296	/**
2297	 * Creates video thumbnail.
2298	 * @protected
2299	 * @param {jQuery} target - The target containing the video data.
2300	 * @param {Object} info - The video info object.
2301	 * @see `fetch`
2302	 */
2303	Video.prototype.thumbnail = function(target, video) {
2304		var tnLink,
2305			icon,
2306			path,
2307			dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
2308			customTn = target.find('img'),
2309			srcType = 'src',
2310			lazyClass = '',
2311			settings = this._core.settings,
2312			create = function(path) {
2313				icon = '<div class="owl-video-play-icon"></div>';
2314
2315				if (settings.lazyLoad) {
2316					tnLink = $('<div/>',{
2317						"class": 'owl-video-tn ' + lazyClass,
2318						"srcType": path
2319					});
2320				} else {
2321					tnLink = $( '<div/>', {
2322						"class": "owl-video-tn",
2323						"style": 'opacity:1;background-image:url(' + path + ')'
2324					});
2325				}
2326				target.after(tnLink);
2327				target.after(icon);
2328			};
2329
2330		// wrap video content into owl-video-wrapper div
2331		target.wrap( $( '<div/>', {
2332			"class": "owl-video-wrapper",
2333			"style": dimensions
2334		}));
2335
2336		if (this._core.settings.lazyLoad) {
2337			srcType = 'data-src';
2338			lazyClass = 'owl-lazy';
2339		}
2340
2341		// custom thumbnail
2342		if (customTn.length) {
2343			create(customTn.attr(srcType));
2344			customTn.remove();
2345			return false;
2346		}
2347
2348		if (video.type === 'youtube') {
2349			path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
2350			create(path);
2351		} else if (video.type === 'vimeo') {
2352			$.ajax({
2353				type: 'GET',
2354				url: '//vimeo.com/api/v2/video/' + video.id + '.json',
2355				jsonp: 'callback',
2356				dataType: 'jsonp',
2357				success: function(data) {
2358					path = data[0].thumbnail_large;
2359					create(path);
2360				}
2361			});
2362		} else if (video.type === 'vzaar') {
2363			$.ajax({
2364				type: 'GET',
2365				url: '//vzaar.com/api/videos/' + video.id + '.json',
2366				jsonp: 'callback',
2367				dataType: 'jsonp',
2368				success: function(data) {
2369					path = data.framegrab_url;
2370					create(path);
2371				}
2372			});
2373		}
2374	};
2375
2376	/**
2377	 * Stops the current video.
2378	 * @public
2379	 */
2380	Video.prototype.stop = function() {
2381		this._core.trigger('stop', null, 'video');
2382		this._playing.find('.owl-video-frame').remove();
2383		this._playing.removeClass('owl-video-playing');
2384		this._playing = null;
2385		this._core.leave('playing');
2386		this._core.trigger('stopped', null, 'video');
2387	};
2388
2389	/**
2390	 * Starts the current video.
2391	 * @public
2392	 * @param {Event} event - The event arguments.
2393	 */
2394	Video.prototype.play = function(event) {
2395		var target = $(event.target),
2396			item = target.closest('.' + this._core.settings.itemClass),
2397			video = this._videos[item.attr('data-video')],
2398			width = video.width || '100%',
2399			height = video.height || this._core.$stage.height(),
2400			html,
2401			iframe;
2402
2403		if (this._playing) {
2404			return;
2405		}
2406
2407		this._core.enter('playing');
2408		this._core.trigger('play', null, 'video');
2409
2410		item = this._core.items(this._core.relative(item.index()));
2411
2412		this._core.reset(item.index());
2413
2414		html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
2415		html.attr( 'height', height );
2416		html.attr( 'width', width );
2417		if (video.type === 'youtube') {
2418			html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
2419		} else if (video.type === 'vimeo') {
2420			html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
2421		} else if (video.type === 'vzaar') {
2422			html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
2423		}
2424
2425		iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video'));
2426
2427		this._playing = item.addClass('owl-video-playing');
2428	};
2429
2430	/**
2431	 * Checks whether an video is currently in full screen mode or not.
2432	 * @todo Bad style because looks like a readonly method but changes members.
2433	 * @protected
2434	 * @returns {Boolean}
2435	 */
2436	Video.prototype.isInFullScreen = function() {
2437		var element = document.fullscreenElement || document.mozFullScreenElement ||
2438				document.webkitFullscreenElement;
2439
2440		return element && $(element).parent().hasClass('owl-video-frame');
2441	};
2442
2443	/**
2444	 * Destroys the plugin.
2445	 */
2446	Video.prototype.destroy = function() {
2447		var handler, property;
2448
2449		this._core.$element.off('click.owl.video');
2450
2451		for (handler in this._handlers) {
2452			this._core.$element.off(handler, this._handlers[handler]);
2453		}
2454		for (property in Object.getOwnPropertyNames(this)) {
2455			typeof this[property] != 'function' && (this[property] = null);
2456		}
2457	};
2458
2459	$.fn.owlCarousel.Constructor.Plugins.Video = Video;
2460
2461})(window.Zepto || window.jQuery, window, document);
2462
2463/**
2464 * Animate Plugin
2465 * @version 2.3.4
2466 * @author Bartosz Wojciechowski
2467 * @author David Deutsch
2468 * @license The MIT License (MIT)
2469 */
2470;(function($, window, document, undefined) {
2471
2472	/**
2473	 * Creates the animate plugin.
2474	 * @class The Navigation Plugin
2475	 * @param {Owl} scope - The Owl Carousel
2476	 */
2477	var Animate = function(scope) {
2478		this.core = scope;
2479		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
2480		this.swapping = true;
2481		this.previous = undefined;
2482		this.next = undefined;
2483
2484		this.handlers = {
2485			'change.owl.carousel': $.proxy(function(e) {
2486				if (e.namespace && e.property.name == 'position') {
2487					this.previous = this.core.current();
2488					this.next = e.property.value;
2489				}
2490			}, this),
2491			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
2492				if (e.namespace) {
2493					this.swapping = e.type == 'translated';
2494				}
2495			}, this),
2496			'translate.owl.carousel': $.proxy(function(e) {
2497				if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
2498					this.swap();
2499				}
2500			}, this)
2501		};
2502
2503		this.core.$element.on(this.handlers);
2504	};
2505
2506	/**
2507	 * Default options.
2508	 * @public
2509	 */
2510	Animate.Defaults = {
2511		animateOut: false,
2512		animateIn: false
2513	};
2514
2515	/**
2516	 * Toggles the animation classes whenever an translations starts.
2517	 * @protected
2518	 * @returns {Boolean|undefined}
2519	 */
2520	Animate.prototype.swap = function() {
2521
2522		if (this.core.settings.items !== 1) {
2523			return;
2524		}
2525
2526		if (!$.support.animation || !$.support.transition) {
2527			return;
2528		}
2529
2530		this.core.speed(0);
2531
2532		var left,
2533			clear = $.proxy(this.clear, this),
2534			previous = this.core.$stage.children().eq(this.previous),
2535			next = this.core.$stage.children().eq(this.next),
2536			incoming = this.core.settings.animateIn,
2537			outgoing = this.core.settings.animateOut;
2538
2539		if (this.core.current() === this.previous) {
2540			return;
2541		}
2542
2543		if (outgoing) {
2544			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
2545			previous.one($.support.animation.end, clear)
2546				.css( { 'left': left + 'px' } )
2547				.addClass('animated owl-animated-out')
2548				.addClass(outgoing);
2549		}
2550
2551		if (incoming) {
2552			next.one($.support.animation.end, clear)
2553				.addClass('animated owl-animated-in')
2554				.addClass(incoming);
2555		}
2556	};
2557
2558	Animate.prototype.clear = function(e) {
2559		$(e.target).css( { 'left': '' } )
2560			.removeClass('animated owl-animated-out owl-animated-in')
2561			.removeClass(this.core.settings.animateIn)
2562			.removeClass(this.core.settings.animateOut);
2563		this.core.onTransitionEnd();
2564	};
2565
2566	/**
2567	 * Destroys the plugin.
2568	 * @public
2569	 */
2570	Animate.prototype.destroy = function() {
2571		var handler, property;
2572
2573		for (handler in this.handlers) {
2574			this.core.$element.off(handler, this.handlers[handler]);
2575		}
2576		for (property in Object.getOwnPropertyNames(this)) {
2577			typeof this[property] != 'function' && (this[property] = null);
2578		}
2579	};
2580
2581	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
2582
2583})(window.Zepto || window.jQuery, window, document);
2584
2585/**
2586 * Autoplay Plugin
2587 * @version 2.3.4
2588 * @author Bartosz Wojciechowski
2589 * @author Artus Kolanowski
2590 * @author David Deutsch
2591 * @author Tom De Caluwé
2592 * @license The MIT License (MIT)
2593 */
2594;(function($, window, document, undefined) {
2595
2596	/**
2597	 * Creates the autoplay plugin.
2598	 * @class The Autoplay Plugin
2599	 * @param {Owl} scope - The Owl Carousel
2600	 */
2601	var Autoplay = function(carousel) {
2602		/**
2603		 * Reference to the core.
2604		 * @protected
2605		 * @type {Owl}
2606		 */
2607		this._core = carousel;
2608
2609		/**
2610		 * The autoplay timeout id.
2611		 * @type {Number}
2612		 */
2613		this._call = null;
2614
2615		/**
2616		 * Depending on the state of the plugin, this variable contains either
2617		 * the start time of the timer or the current timer value if it's
2618		 * paused. Since we start in a paused state we initialize the timer
2619		 * value.
2620		 * @type {Number}
2621		 */
2622		this._time = 0;
2623
2624		/**
2625		 * Stores the timeout currently used.
2626		 * @type {Number}
2627		 */
2628		this._timeout = 0;
2629
2630		/**
2631		 * Indicates whenever the autoplay is paused.
2632		 * @type {Boolean}
2633		 */
2634		this._paused = true;
2635
2636		/**
2637		 * All event handlers.
2638		 * @protected
2639		 * @type {Object}
2640		 */
2641		this._handlers = {
2642			'changed.owl.carousel': $.proxy(function(e) {
2643				if (e.namespace && e.property.name === 'settings') {
2644					if (this._core.settings.autoplay) {
2645						this.play();
2646					} else {
2647						this.stop();
2648					}
2649				} else if (e.namespace && e.property.name === 'position' && this._paused) {
2650					// Reset the timer. This code is triggered when the position
2651					// of the carousel was changed through user interaction.
2652					this._time = 0;
2653				}
2654			}, this),
2655			'initialized.owl.carousel': $.proxy(function(e) {
2656				if (e.namespace && this._core.settings.autoplay) {
2657					this.play();
2658				}
2659			}, this),
2660			'play.owl.autoplay': $.proxy(function(e, t, s) {
2661				if (e.namespace) {
2662					this.play(t, s);
2663				}
2664			}, this),
2665			'stop.owl.autoplay': $.proxy(function(e) {
2666				if (e.namespace) {
2667					this.stop();
2668				}
2669			}, this),
2670			'mouseover.owl.autoplay': $.proxy(function() {
2671				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2672					this.pause();
2673				}
2674			}, this),
2675			'mouseleave.owl.autoplay': $.proxy(function() {
2676				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2677					this.play();
2678				}
2679			}, this),
2680			'touchstart.owl.core': $.proxy(function() {
2681				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2682					this.pause();
2683				}
2684			}, this),
2685			'touchend.owl.core': $.proxy(function() {
2686				if (this._core.settings.autoplayHoverPause) {
2687					this.play();
2688				}
2689			}, this)
2690		};
2691
2692		// register event handlers
2693		this._core.$element.on(this._handlers);
2694
2695		// set default options
2696		this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
2697	};
2698
2699	/**
2700	 * Default options.
2701	 * @public
2702	 */
2703	Autoplay.Defaults = {
2704		autoplay: false,
2705		autoplayTimeout: 5000,
2706		autoplayHoverPause: false,
2707		autoplaySpeed: false
2708	};
2709
2710	/**
2711	 * Transition to the next slide and set a timeout for the next transition.
2712	 * @private
2713	 * @param {Number} [speed] - The animation speed for the animations.
2714	 */
2715	Autoplay.prototype._next = function(speed) {
2716		this._call = window.setTimeout(
2717			$.proxy(this._next, this, speed),
2718			this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()
2719		);
2720
2721		if (this._core.is('interacting') || document.hidden) {
2722			return;
2723		}
2724		this._core.next(speed || this._core.settings.autoplaySpeed);
2725	}
2726
2727	/**
2728	 * Reads the current timer value when the timer is playing.
2729	 * @public
2730	 */
2731	Autoplay.prototype.read = function() {
2732		return new Date().getTime() - this._time;
2733	};
2734
2735	/**
2736	 * Starts the autoplay.
2737	 * @public
2738	 * @param {Number} [timeout] - The interval before the next animation starts.
2739	 * @param {Number} [speed] - The animation speed for the animations.
2740	 */
2741	Autoplay.prototype.play = function(timeout, speed) {
2742		var elapsed;
2743
2744		if (!this._core.is('rotating')) {
2745			this._core.enter('rotating');
2746		}
2747
2748		timeout = timeout || this._core.settings.autoplayTimeout;
2749
2750		// Calculate the elapsed time since the last transition. If the carousel
2751		// wasn't playing this calculation will yield zero.
2752		elapsed = Math.min(this._time % (this._timeout || timeout), timeout);
2753
2754		if (this._paused) {
2755			// Start the clock.
2756			this._time = this.read();
2757			this._paused = false;
2758		} else {
2759			// Clear the active timeout to allow replacement.
2760			window.clearTimeout(this._call);
2761		}
2762
2763		// Adjust the origin of the timer to match the new timeout value.
2764		this._time += this.read() % timeout - elapsed;
2765
2766		this._timeout = timeout;
2767		this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed);
2768	};
2769
2770	/**
2771	 * Stops the autoplay.
2772	 * @public
2773	 */
2774	Autoplay.prototype.stop = function() {
2775		if (this._core.is('rotating')) {
2776			// Reset the clock.
2777			this._time = 0;
2778			this._paused = true;
2779
2780			window.clearTimeout(this._call);
2781			this._core.leave('rotating');
2782		}
2783	};
2784
2785	/**
2786	 * Pauses the autoplay.
2787	 * @public
2788	 */
2789	Autoplay.prototype.pause = function() {
2790		if (this._core.is('rotating') && !this._paused) {
2791			// Pause the clock.
2792			this._time = this.read();
2793			this._paused = true;
2794
2795			window.clearTimeout(this._call);
2796		}
2797	};
2798
2799	/**
2800	 * Destroys the plugin.
2801	 */
2802	Autoplay.prototype.destroy = function() {
2803		var handler, property;
2804
2805		this.stop();
2806
2807		for (handler in this._handlers) {
2808			this._core.$element.off(handler, this._handlers[handler]);
2809		}
2810		for (property in Object.getOwnPropertyNames(this)) {
2811			typeof this[property] != 'function' && (this[property] = null);
2812		}
2813	};
2814
2815	$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
2816
2817})(window.Zepto || window.jQuery, window, document);
2818
2819/**
2820 * Navigation Plugin
2821 * @version 2.3.4
2822 * @author Artus Kolanowski
2823 * @author David Deutsch
2824 * @license The MIT License (MIT)
2825 */
2826;(function($, window, document, undefined) {
2827	'use strict';
2828
2829	/**
2830	 * Creates the navigation plugin.
2831	 * @class The Navigation Plugin
2832	 * @param {Owl} carousel - The Owl Carousel.
2833	 */
2834	var Navigation = function(carousel) {
2835		/**
2836		 * Reference to the core.
2837		 * @protected
2838		 * @type {Owl}
2839		 */
2840		this._core = carousel;
2841
2842		/**
2843		 * Indicates whether the plugin is initialized or not.
2844		 * @protected
2845		 * @type {Boolean}
2846		 */
2847		this._initialized = false;
2848
2849		/**
2850		 * The current paging indexes.
2851		 * @protected
2852		 * @type {Array}
2853		 */
2854		this._pages = [];
2855
2856		/**
2857		 * All DOM elements of the user interface.
2858		 * @protected
2859		 * @type {Object}
2860		 */
2861		this._controls = {};
2862
2863		/**
2864		 * Markup for an indicator.
2865		 * @protected
2866		 * @type {Array.<String>}
2867		 */
2868		this._templates = [];
2869
2870		/**
2871		 * The carousel element.
2872		 * @type {jQuery}
2873		 */
2874		this.$element = this._core.$element;
2875
2876		/**
2877		 * Overridden methods of the carousel.
2878		 * @protected
2879		 * @type {Object}
2880		 */
2881		this._overrides = {
2882			next: this._core.next,
2883			prev: this._core.prev,
2884			to: this._core.to
2885		};
2886
2887		/**
2888		 * All event handlers.
2889		 * @protected
2890		 * @type {Object}
2891		 */
2892		this._handlers = {
2893			'prepared.owl.carousel': $.proxy(function(e) {
2894				if (e.namespace && this._core.settings.dotsData) {
2895					this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
2896						$(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
2897				}
2898			}, this),
2899			'added.owl.carousel': $.proxy(function(e) {
2900				if (e.namespace && this._core.settings.dotsData) {
2901					this._templates.splice(e.position, 0, this._templates.pop());
2902				}
2903			}, this),
2904			'remove.owl.carousel': $.proxy(function(e) {
2905				if (e.namespace && this._core.settings.dotsData) {
2906					this._templates.splice(e.position, 1);
2907				}
2908			}, this),
2909			'changed.owl.carousel': $.proxy(function(e) {
2910				if (e.namespace && e.property.name == 'position') {
2911					this.draw();
2912				}
2913			}, this),
2914			'initialized.owl.carousel': $.proxy(function(e) {
2915				if (e.namespace && !this._initialized) {
2916					this._core.trigger('initialize', null, 'navigation');
2917					this.initialize();
2918					this.update();
2919					this.draw();
2920					this._initialized = true;
2921					this._core.trigger('initialized', null, 'navigation');
2922				}
2923			}, this),
2924			'refreshed.owl.carousel': $.proxy(function(e) {
2925				if (e.namespace && this._initialized) {
2926					this._core.trigger('refresh', null, 'navigation');
2927					this.update();
2928					this.draw();
2929					this._core.trigger('refreshed', null, 'navigation');
2930				}
2931			}, this)
2932		};
2933
2934		// set default options
2935		this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
2936
2937		// register event handlers
2938		this.$element.on(this._handlers);
2939	};
2940
2941	/**
2942	 * Default options.
2943	 * @public
2944	 * @todo Rename `slideBy` to `navBy`
2945	 */
2946	Navigation.Defaults = {
2947		nav: false,
2948		navText: [
2949			'<span aria-label="' + 'Previous' + '">&#x2039;</span>',
2950			'<span aria-label="' + 'Next' + '">&#x203a;</span>'
2951		],
2952		navSpeed: false,
2953		navElement: 'button type="button" role="presentation"',
2954		navContainer: false,
2955		navContainerClass: 'owl-nav',
2956		navClass: [
2957			'owl-prev',
2958			'owl-next'
2959		],
2960		slideBy: 1,
2961		dotClass: 'owl-dot',
2962		dotsClass: 'owl-dots',
2963		dots: true,
2964		dotsEach: false,
2965		dotsData: false,
2966		dotsSpeed: false,
2967		dotsContainer: false
2968	};
2969
2970	/**
2971	 * Initializes the layout of the plugin and extends the carousel.
2972	 * @protected
2973	 */
2974	Navigation.prototype.initialize = function() {
2975		var override,
2976			settings = this._core.settings;
2977
2978		// create DOM structure for relative navigation
2979		this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
2980			: $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
2981
2982		this._controls.$previous = $('<' + settings.navElement + '>')
2983			.addClass(settings.navClass[0])
2984			.html(settings.navText[0])
2985			.prependTo(this._controls.$relative)
2986			.on('click', $.proxy(function(e) {
2987				this.prev(settings.navSpeed);
2988			}, this));
2989		this._controls.$next = $('<' + settings.navElement + '>')
2990			.addClass(settings.navClass[1])
2991			.html(settings.navText[1])
2992			.appendTo(this._controls.$relative)
2993			.on('click', $.proxy(function(e) {
2994				this.next(settings.navSpeed);
2995			}, this));
2996
2997		// create DOM structure for absolute navigation
2998		if (!settings.dotsData) {
2999			this._templates = [ $('<button role="button">')
3000				.addClass(settings.dotClass)
3001				.append($('<span>'))
3002				.prop('outerHTML') ];
3003		}
3004
3005		this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
3006			: $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
3007
3008		this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
3009			var index = $(e.target).parent().is(this._controls.$absolute)
3010				? $(e.target).index() : $(e.target).parent().index();
3011
3012			e.preventDefault();
3013
3014			this.to(index, settings.dotsSpeed);
3015		}, this));
3016
3017		/*$el.on('focusin', function() {
3018			$(document).off(".carousel");
3019
3020			$(document).on('keydown.carousel', function(e) {
3021				if(e.keyCode == 37) {
3022					$el.trigger('prev.owl')
3023				}
3024				if(e.keyCode == 39) {
3025					$el.trigger('next.owl')
3026				}
3027			});
3028		});*/
3029
3030		// override public methods of the carousel
3031		for (override in this._overrides) {
3032			this._core[override] = $.proxy(this[override], this);
3033		}
3034	};
3035
3036	/**
3037	 * Destroys the plugin.
3038	 * @protected
3039	 */
3040	Navigation.prototype.destroy = function() {
3041		var handler, control, property, override, settings;
3042		settings = this._core.settings;
3043
3044		for (handler in this._handlers) {
3045			this.$element.off(handler, this._handlers[handler]);
3046		}
3047		for (control in this._controls) {
3048			if (control === '$relative' && settings.navContainer) {
3049				this._controls[control].html('');
3050			} else {
3051				this._controls[control].remove();
3052			}
3053		}
3054		for (override in this.overides) {
3055			this._core[override] = this._overrides[override];
3056		}
3057		for (property in Object.getOwnPropertyNames(this)) {
3058			typeof this[property] != 'function' && (this[property] = null);
3059		}
3060	};
3061
3062	/**
3063	 * Updates the internal state.
3064	 * @protected
3065	 */
3066	Navigation.prototype.update = function() {
3067		var i, j, k,
3068			lower = this._core.clones().length / 2,
3069			upper = lower + this._core.items().length,
3070			maximum = this._core.maximum(true),
3071			settings = this._core.settings,
3072			size = settings.center || settings.autoWidth || settings.dotsData
3073				? 1 : settings.dotsEach || settings.items;
3074
3075		if (settings.slideBy !== 'page') {
3076			settings.slideBy = Math.min(settings.slideBy, settings.items);
3077		}
3078
3079		if (settings.dots || settings.slideBy == 'page') {
3080			this._pages = [];
3081
3082			for (i = lower, j = 0, k = 0; i < upper; i++) {
3083				if (j >= size || j === 0) {
3084					this._pages.push({
3085						start: Math.min(maximum, i - lower),
3086						end: i - lower + size - 1
3087					});
3088					if (Math.min(maximum, i - lower) === maximum) {
3089						break;
3090					}
3091					j = 0, ++k;
3092				}
3093				j += this._core.mergers(this._core.relative(i));
3094			}
3095		}
3096	};
3097
3098	/**
3099	 * Draws the user interface.
3100	 * @todo The option `dotsData` wont work.
3101	 * @protected
3102	 */
3103	Navigation.prototype.draw = function() {
3104		var difference,
3105			settings = this._core.settings,
3106			disabled = this._core.items().length <= settings.items,
3107			index = this._core.relative(this._core.current()),
3108			loop = settings.loop || settings.rewind;
3109
3110		this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
3111
3112		if (settings.nav) {
3113			this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
3114			this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
3115		}
3116
3117		this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
3118
3119		if (settings.dots) {
3120			difference = this._pages.length - this._controls.$absolute.children().length;
3121
3122			if (settings.dotsData && difference !== 0) {
3123				this._controls.$absolute.html(this._templates.join(''));
3124			} else if (difference > 0) {
3125				this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
3126			} else if (difference < 0) {
3127				this._controls.$absolute.children().slice(difference).remove();
3128			}
3129
3130			this._controls.$absolute.find('.active').removeClass('active');
3131			this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
3132		}
3133	};
3134
3135	/**
3136	 * Extends event data.
3137	 * @protected
3138	 * @param {Event} event - The event object which gets thrown.
3139	 */
3140	Navigation.prototype.onTrigger = function(event) {
3141		var settings = this._core.settings;
3142
3143		event.page = {
3144			index: $.inArray(this.current(), this._pages),
3145			count: this._pages.length,
3146			size: settings && (settings.center || settings.autoWidth || settings.dotsData
3147				? 1 : settings.dotsEach || settings.items)
3148		};
3149	};
3150
3151	/**
3152	 * Gets the current page position of the carousel.
3153	 * @protected
3154	 * @returns {Number}
3155	 */
3156	Navigation.prototype.current = function() {
3157		var current = this._core.relative(this._core.current());
3158		return $.grep(this._pages, $.proxy(function(page, index) {
3159			return page.start <= current && page.end >= current;
3160		}, this)).pop();
3161	};
3162
3163	/**
3164	 * Gets the current succesor/predecessor position.
3165	 * @protected
3166	 * @returns {Number}
3167	 */
3168	Navigation.prototype.getPosition = function(successor) {
3169		var position, length,
3170			settings = this._core.settings;
3171
3172		if (settings.slideBy == 'page') {
3173			position = $.inArray(this.current(), this._pages);
3174			length = this._pages.length;
3175			successor ? ++position : --position;
3176			position = this._pages[((position % length) + length) % length].start;
3177		} else {
3178			position = this._core.relative(this._core.current());
3179			length = this._core.items().length;
3180			successor ? position += settings.slideBy : position -= settings.slideBy;
3181		}
3182
3183		return position;
3184	};
3185
3186	/**
3187	 * Slides to the next item or page.
3188	 * @public
3189	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
3190	 */
3191	Navigation.prototype.next = function(speed) {
3192		$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
3193	};
3194
3195	/**
3196	 * Slides to the previous item or page.
3197	 * @public
3198	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
3199	 */
3200	Navigation.prototype.prev = function(speed) {
3201		$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
3202	};
3203
3204	/**
3205	 * Slides to the specified item or page.
3206	 * @public
3207	 * @param {Number} position - The position of the item or page.
3208	 * @param {Number} [speed] - The time in milliseconds for the transition.
3209	 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
3210	 */
3211	Navigation.prototype.to = function(position, speed, standard) {
3212		var length;
3213
3214		if (!standard && this._pages.length) {
3215			length = this._pages.length;
3216			$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
3217		} else {
3218			$.proxy(this._overrides.to, this._core)(position, speed);
3219		}
3220	};
3221
3222	$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
3223
3224})(window.Zepto || window.jQuery, window, document);
3225
3226/**
3227 * Hash Plugin
3228 * @version 2.3.4
3229 * @author Artus Kolanowski
3230 * @author David Deutsch
3231 * @license The MIT License (MIT)
3232 */
3233;(function($, window, document, undefined) {
3234	'use strict';
3235
3236	/**
3237	 * Creates the hash plugin.
3238	 * @class The Hash Plugin
3239	 * @param {Owl} carousel - The Owl Carousel
3240	 */
3241	var Hash = function(carousel) {
3242		/**
3243		 * Reference to the core.
3244		 * @protected
3245		 * @type {Owl}
3246		 */
3247		this._core = carousel;
3248
3249		/**
3250		 * Hash index for the items.
3251		 * @protected
3252		 * @type {Object}
3253		 */
3254		this._hashes = {};
3255
3256		/**
3257		 * The carousel element.
3258		 * @type {jQuery}
3259		 */
3260		this.$element = this._core.$element;
3261
3262		/**
3263		 * All event handlers.
3264		 * @protected
3265		 * @type {Object}
3266		 */
3267		this._handlers = {
3268			'initialized.owl.carousel': $.proxy(function(e) {
3269				if (e.namespace && this._core.settings.startPosition === 'URLHash') {
3270					$(window).trigger('hashchange.owl.navigation');
3271				}
3272			}, this),
3273			'prepared.owl.carousel': $.proxy(function(e) {
3274				if (e.namespace) {
3275					var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
3276
3277					if (!hash) {
3278						return;
3279					}
3280
3281					this._hashes[hash] = e.content;
3282				}
3283			}, this),
3284			'changed.owl.carousel': $.proxy(function(e) {
3285				if (e.namespace && e.property.name === 'position') {
3286					var current = this._core.items(this._core.relative(this._core.current())),
3287						hash = $.map(this._hashes, function(item, hash) {
3288							return item === current ? hash : null;
3289						}).join();
3290
3291					if (!hash || window.location.hash.slice(1) === hash) {
3292						return;
3293					}
3294
3295					window.location.hash = hash;
3296				}
3297			}, this)
3298		};
3299
3300		// set default options
3301		this._core.options = $.extend({}, Hash.Defaults, this._core.options);
3302
3303		// register the event handlers
3304		this.$element.on(this._handlers);
3305
3306		// register event listener for hash navigation
3307		$(window).on('hashchange.owl.navigation', $.proxy(function(e) {
3308			var hash = window.location.hash.substring(1),
3309				items = this._core.$stage.children(),
3310				position = this._hashes[hash] && items.index(this._hashes[hash]);
3311
3312			if (position === undefined || position === this._core.current()) {
3313				return;
3314			}
3315
3316			this._core.to(this._core.relative(position), false, true);
3317		}, this));
3318	};
3319
3320	/**
3321	 * Default options.
3322	 * @public
3323	 */
3324	Hash.Defaults = {
3325		URLhashListener: false
3326	};
3327
3328	/**
3329	 * Destroys the plugin.
3330	 * @public
3331	 */
3332	Hash.prototype.destroy = function() {
3333		var handler, property;
3334
3335		$(window).off('hashchange.owl.navigation');
3336
3337		for (handler in this._handlers) {
3338			this._core.$element.off(handler, this._handlers[handler]);
3339		}
3340		for (property in Object.getOwnPropertyNames(this)) {
3341			typeof this[property] != 'function' && (this[property] = null);
3342		}
3343	};
3344
3345	$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
3346
3347})(window.Zepto || window.jQuery, window, document);
3348
3349/**
3350 * Support Plugin
3351 *
3352 * @version 2.3.4
3353 * @author Vivid Planet Software GmbH
3354 * @author Artus Kolanowski
3355 * @author David Deutsch
3356 * @license The MIT License (MIT)
3357 */
3358;(function($, window, document, undefined) {
3359
3360	var style = $('<support>').get(0).style,
3361		prefixes = 'Webkit Moz O ms'.split(' '),
3362		events = {
3363			transition: {
3364				end: {
3365					WebkitTransition: 'webkitTransitionEnd',
3366					MozTransition: 'transitionend',
3367					OTransition: 'oTransitionEnd',
3368					transition: 'transitionend'
3369				}
3370			},
3371			animation: {
3372				end: {
3373					WebkitAnimation: 'webkitAnimationEnd',
3374					MozAnimation: 'animationend',
3375					OAnimation: 'oAnimationEnd',
3376					animation: 'animationend'
3377				}
3378			}
3379		},
3380		tests = {
3381			csstransforms: function() {
3382				return !!test('transform');
3383			},
3384			csstransforms3d: function() {
3385				return !!test('perspective');
3386			},
3387			csstransitions: function() {
3388				return !!test('transition');
3389			},
3390			cssanimations: function() {
3391				return !!test('animation');
3392			}
3393		};
3394
3395	function test(property, prefixed) {
3396		var result = false,
3397			upper = property.charAt(0).toUpperCase() + property.slice(1);
3398
3399		$.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
3400			if (style[property] !== undefined) {
3401				result = prefixed ? property : true;
3402				return false;
3403			}
3404		});
3405
3406		return result;
3407	}
3408
3409	function prefixed(property) {
3410		return test(property, true);
3411	}
3412
3413	if (tests.csstransitions()) {
3414		/* jshint -W053 */
3415		$.support.transition = new String(prefixed('transition'))
3416		$.support.transition.end = events.transition.end[ $.support.transition ];
3417	}
3418
3419	if (tests.cssanimations()) {
3420		/* jshint -W053 */
3421		$.support.animation = new String(prefixed('animation'))
3422		$.support.animation.end = events.animation.end[ $.support.animation ];
3423	}
3424
3425	if (tests.csstransforms()) {
3426		/* jshint -W053 */
3427		$.support.transform = new String(prefixed('transform'));
3428		$.support.transform3d = tests.csstransforms3d();
3429	}
3430
3431})(window.Zepto || window.jQuery, window, document);

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.