PageSourceSearch

https://autosalpa.fi/static/studio/pub/web/branches/master/js/autosalpa.js?t=1791202984962

js autosalpa.fi collected 2026-10-05 22:12:05 UTC 1,394,521 bytes, 44,802 lines download raw bytes

1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true };
3},{"core-js/library/fn/array/from":18}],2:[function(require,module,exports){
4module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
5},{"core-js/library/fn/json/stringify":19}],3:[function(require,module,exports){
6module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
7},{"core-js/library/fn/object/assign":20}],4:[function(require,module,exports){
8module.exports = { "default": require("core-js/library/fn/object/define-properties"), __esModule: true };
9},{"core-js/library/fn/object/define-properties":21}],5:[function(require,module,exports){
10module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true };
11},{"core-js/library/fn/object/define-property":22}],6:[function(require,module,exports){
12module.exports = { "default": require("core-js/library/fn/object/get-prototype-of"), __esModule: true };
13},{"core-js/library/fn/object/get-prototype-of":23}],7:[function(require,module,exports){
14module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true };
15},{"core-js/library/fn/object/keys":24}],8:[function(require,module,exports){
16module.exports = { "default": require("core-js/library/fn/object/values"), __esModule: true };
17},{"core-js/library/fn/object/values":25}],9:[function(require,module,exports){
18module.exports = { "default": require("core-js/library/fn/promise"), __esModule: true };
19},{"core-js/library/fn/promise":26}],10:[function(require,module,exports){
20module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true };
21},{"core-js/library/fn/symbol":27}],11:[function(require,module,exports){
22module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true };
23},{"core-js/library/fn/symbol/iterator":28}],12:[function(require,module,exports){
24"use strict";
25
26exports.__esModule = true;
27
28var _promise = require("../core-js/promise");
29
30var _promise2 = _interopRequireDefault(_promise);
31
32function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
34exports.default = function (fn) {
35  return function () {
36    var gen = fn.apply(this, arguments);
37    return new _promise2.default(function (resolve, reject) {
38      function step(key, arg) {
39        try {
40          var info = gen[key](arg);
41          var value = info.value;
42        } catch (error) {
43          reject(error);
44          return;
45        }
46
47        if (info.done) {
48          resolve(value);
49        } else {
50          return _promise2.default.resolve(value).then(function (value) {
51            step("next", value);
52          }, function (err) {
53            step("throw", err);
54          });
55        }
56      }
57
58      return step("next");
59    });
60  };
61};
62},{"../core-js/promise":9}],13:[function(require,module,exports){
63"use strict";
64
65exports.__esModule = true;
66
67exports.default = function (instance, Constructor) {
68  if (!(instance instanceof Constructor)) {
69    throw new TypeError("Cannot call a class as a function");
70  }
71};
72},{}],14:[function(require,module,exports){
73"use strict";
74
75exports.__esModule = true;
76
77var _assign = require("../core-js/object/assign");
78
79var _assign2 = _interopRequireDefault(_assign);
80
81function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
82
83exports.default = _assign2.default || function (target) {
84  for (var i = 1; i < arguments.length; i++) {
85    var source = arguments[i];
86
87    for (var key in source) {
88      if (Object.prototype.hasOwnProperty.call(source, key)) {
89        target[key] = source[key];
90      }
91    }
92  }
93
94  return target;
95};
96},{"../core-js/object/assign":3}],15:[function(require,module,exports){
97"use strict";
98
99exports.__esModule = true;
100
101var _iterator = require("../core-js/symbol/iterator");
102
103var _iterator2 = _interopRequireDefault(_iterator);
104
105var _symbol = require("../core-js/symbol");
106
107var _symbol2 = _interopRequireDefault(_symbol);
108
109var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
110
111function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
112
113exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
114  return typeof obj === "undefined" ? "undefined" : _typeof(obj);
115} : function (obj) {
116  return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
117};
118},{"../core-js/symbol":10,"../core-js/symbol/iterator":11}],16:[function(require,module,exports){
119module.exports = require("regenerator-runtime");
120
121},{"regenerator-runtime":127}],17:[function(require,module,exports){
122/*! =======================================================
123                      VERSION  10.6.1              
124========================================================= */
125"use strict";
126
127var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
128
129/*! =========================================================
130 * bootstrap-slider.js
131 *
132 * Maintainers:
133 *		Kyle Kemp
134 *			- Twitter: @seiyria
135 *			- Github:  seiyria
136 *		Rohit Kalkur
137 *			- Twitter: @Rovolutionary
138 *			- Github:  rovolution
139 *
140 * =========================================================
141 *
142 * bootstrap-slider is released under the MIT License
143 * Copyright (c) 2019 Kyle Kemp, Rohit Kalkur, and contributors
144 *
145 * Permission is hereby granted, free of charge, to any person
146 * obtaining a copy of this software and associated documentation
147 * files (the "Software"), to deal in the Software without
148 * restriction, including without limitation the rights to use,
149 * copy, modify, merge, publish, distribute, sublicense, and/or sell
150 * copies of the Software, and to permit persons to whom the
151 * Software is furnished to do so, subject to the following
152 * conditions:
153 *
154 * The above copyright notice and this permission notice shall be
155 * included in all copies or substantial portions of the Software.
156 *
157 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
158 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
159 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
160 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
161 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
162 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
163 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
164 * OTHER DEALINGS IN THE SOFTWARE.
165 *
166 * ========================================================= */
167
vendor: 4,041 bytes, lines 168-311
168/**
169 * Bridget makes jQuery widgets
170 * v1.0.1
171 * MIT license
172 */
173var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object";
174
175(function (factory) {
176	if (typeof define === "function" && define.amd) {
177		define(["jquery"], factory);
178	} else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && module.exports) {
179		var jQuery;
180		try {
181			jQuery = require("jquery");
182		} catch (err) {
183			jQuery = null;
184		}
185		module.exports = factory(jQuery);
186	} else if (window) {
187		window.Slider = factory(window.jQuery);
188	}
189})(function ($) {
190	// Constants
191	var NAMESPACE_MAIN = 'slider';
192	var NAMESPACE_ALTERNATE = 'bootstrapSlider';
193
194	// Polyfill console methods
195	if (windowIsDefined && !window.console) {
196		window.console = {};
197	}
198	if (windowIsDefined && !window.console.log) {
199		window.console.log = function () {};
200	}
201	if (windowIsDefined && !window.console.warn) {
202		window.console.warn = function () {};
203	}
204
205	// Reference to Slider constructor
206	var Slider;
207
208	(function ($) {
209
210		'use strict';
211
212		// -------------------------- utils -------------------------- //
213
214		var slice = Array.prototype.slice;
215
216		function noop() {}
217
218		// -------------------------- definition -------------------------- //
219
220		function defineBridget($) {
221
222			// bail if no jQuery
223			if (!$) {
224				return;
225			}
226
227			// -------------------------- addOptionMethod -------------------------- //
228
229			/**
230    * adds option method -> $().plugin('option', {...})
231    * @param {Function} PluginClass - constructor class
232    */
233			function addOptionMethod(PluginClass) {
234				// don't overwrite original option method
235				if (PluginClass.prototype.option) {
236					return;
237				}
238
239				// option setter
240				PluginClass.prototype.option = function (opts) {
241					// bail out if not an object
242					if (!$.isPlainObject(opts)) {
243						return;
244					}
245					this.options = $.extend(true, this.options, opts);
246				};
247			}
248
249			// -------------------------- plugin bridge -------------------------- //
250
251			// helper function for logging errors
252			// $.error breaks jQuery chaining
253			var logError = typeof console === 'undefined' ? noop : function (message) {
254				console.error(message);
255			};
256
257			/**
258    * jQuery plugin bridge, access methods like $elem.plugin('method')
259    * @param {String} namespace - plugin name
260    * @param {Function} PluginClass - constructor class
261    */
262			function bridge(namespace, PluginClass) {
263				// add to jQuery fn namespace
264				$.fn[namespace] = function (options) {
265					if (typeof options === 'string') {
266						// call plugin method when first argument is a string
267						// get arguments for method
268						var args = slice.call(arguments, 1);
269
270						for (var i = 0, len = this.length; i < len; i++) {
271							var elem = this[i];
272							var instance = $.data(elem, namespace);
273							if (!instance) {
274								logError("cannot call methods on " + namespace + " prior to initialization; " + "attempted to call '" + options + "'");
275								continue;
276							}
277							if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {
278								logError("no such method '" + options + "' for " + namespace + " instance");
279								continue;
280							}
281
282							// trigger method with arguments
283							var returnValue = instance[options].apply(instance, args);
284
285							// break look and return first value if provided
286							if (returnValue !== undefined && returnValue !== instance) {
287								return returnValue;
288							}
289						}
290						// return this if no return value
291						return this;
292					} else {
293						var objects = this.map(function () {
294							var instance = $.data(this, namespace);
295							if (instance) {
296								// apply options & init
297								instance.option(options);
298								instance._init();
299							} else {
300								// initialize new instance
301								instance = new PluginClass(this, options);
302								$.data(this, namespace, instance);
303							}
304							return $(this);
305						});
306
307						if (!objects || objects.length > 1) {
308							return objects;
309						} else {
310							return objects[0];
311						}
vendor: 7,061 bytes, lines 311-530
311
312					}
313				};
314			}
315
316			// -------------------------- bridget -------------------------- //
317
318			/**
319    * converts a Prototypical class into a proper jQuery plugin
320    *   the class must have a ._init method
321    * @param {String} namespace - plugin name, used in $().pluginName
322    * @param {Function} PluginClass - constructor class
323    */
324			$.bridget = function (namespace, PluginClass) {
325				addOptionMethod(PluginClass);
326				bridge(namespace, PluginClass);
327			};
328
329			return $.bridget;
330		}
331
332		// get jquery from browser global
333		defineBridget($);
334	})($);
335
336	/*************************************************
337 			BOOTSTRAP-SLIDER SOURCE CODE
338 	**************************************************/
339
340	(function ($) {
341		var autoRegisterNamespace = void 0;
342
343		var ErrorMsgs = {
344			formatInvalidInputErrorMsg: function formatInvalidInputErrorMsg(input) {
345				return "Invalid input value '" + input + "' passed in";
346			},
347			callingContextNotSliderInstance: "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"
348		};
349
350		var SliderScale = {
351			linear: {
352				getValue: function getValue(value, options) {
353					if (value < options.min) {
354						return options.min;
355					} else if (value > options.max) {
356						return options.max;
357					} else {
358						return value;
359					}
360				},
361				toValue: function toValue(percentage) {
362					var rawValue = percentage / 100 * (this.options.max - this.options.min);
363					var shouldAdjustWithBase = true;
364					if (this.options.ticks_positions.length > 0) {
365						var minv,
366						    maxv,
367						    minp,
368						    maxp = 0;
369						for (var i = 1; i < this.options.ticks_positions.length; i++) {
370							if (percentage <= this.options.ticks_positions[i]) {
371								minv = this.options.ticks[i - 1];
372								minp = this.options.ticks_positions[i - 1];
373								maxv = this.options.ticks[i];
374								maxp = this.options.ticks_positions[i];
375
376								break;
377							}
378						}
379						var partialPercentage = (percentage - minp) / (maxp - minp);
380						rawValue = minv + partialPercentage * (maxv - minv);
381						shouldAdjustWithBase = false;
382					}
383
384					var adjustment = shouldAdjustWithBase ? this.options.min : 0;
385					var value = adjustment + Math.round(rawValue / this.options.step) * this.options.step;
386					return SliderScale.linear.getValue(value, this.options);
387				},
388				toPercentage: function toPercentage(value) {
389					if (this.options.max === this.options.min) {
390						return 0;
391					}
392
393					if (this.options.ticks_positions.length > 0) {
394						var minv,
395						    maxv,
396						    minp,
397						    maxp = 0;
398						for (var i = 0; i < this.options.ticks.length; i++) {
399							if (value <= this.options.ticks[i]) {
400								minv = i > 0 ? this.options.ticks[i - 1] : 0;
401								minp = i > 0 ? this.options.ticks_positions[i - 1] : 0;
402								maxv = this.options.ticks[i];
403								maxp = this.options.ticks_positions[i];
404
405								break;
406							}
407						}
408						if (i > 0) {
409							var partialPercentage = (value - minv) / (maxv - minv);
410							return minp + partialPercentage * (maxp - minp);
411						}
412					}
413
414					return 100 * (value - this.options.min) / (this.options.max - this.options.min);
415				}
416			},
417
418			logarithmic: {
419				/* Based on http://stackoverflow.com/questions/846221/logarithmic-slider */
420				toValue: function toValue(percentage) {
421					var offset = 1 - this.options.min;
422					var min = Math.log(this.options.min + offset);
423					var max = Math.log(this.options.max + offset);
424					var value = Math.exp(min + (max - min) * percentage / 100) - offset;
425					if (Math.round(value) === max) {
426						return max;
427					}
428					value = this.options.min + Math.round((value - this.options.min) / this.options.step) * this.options.step;
429					/* Rounding to the nearest step could exceed the min or
430      * max, so clip to those values. */
431					return SliderScale.linear.getValue(value, this.options);
432				},
433				toPercentage: function toPercentage(value) {
434					if (this.options.max === this.options.min) {
435						return 0;
436					} else {
437						var offset = 1 - this.options.min;
438						var max = Math.log(this.options.max + offset);
439						var min = Math.log(this.options.min + offset);
440						var v = Math.log(value + offset);
441						return 100 * (v - min) / (max - min);
442					}
443				}
444			}
445		};
446
447		/*************************************************
448  						CONSTRUCTOR
449  	**************************************************/
450		Slider = function Slider(element, options) {
451			createNewSlider.call(this, element, options);
452			return this;
453		};
454
455		function createNewSlider(element, options) {
456
457			/*
458   	The internal state object is used to store data about the current 'state' of slider.
459   	This includes values such as the `value`, `enabled`, etc...
460   */
461			this._state = {
462				value: null,
463				enabled: null,
464				offset: null,
465				size: null,
466				percentage: null,
467				inDrag: false,
468				over: false,
469				tickIndex: null
470			};
471
472			// The objects used to store the reference to the tick methods if ticks_tooltip is on
473			this.ticksCallbackMap = {};
474			this.handleCallbackMap = {};
475
476			if (typeof element === "string") {
477				this.element = document.querySelector(element);
478			} else if (element instanceof HTMLElement) {
479				this.element = element;
480			}
481
482			/*************************************************
483   					Process Options
484   	**************************************************/
485			options = options ? options : {};
486			var optionTypes = Object.keys(this.defaultOptions);
487
488			var isMinSet = options.hasOwnProperty('min');
489			var isMaxSet = options.hasOwnProperty('max');
490
491			for (var i = 0; i < optionTypes.length; i++) {
492				var optName = optionTypes[i];
493
494				// First check if an option was passed in via the constructor
495				var val = options[optName];
496				// If no data attrib, then check data atrributes
497				val = typeof val !== 'undefined' ? val : getDataAttrib(this.element, optName);
498				// Finally, if nothing was specified, use the defaults
499				val = val !== null ? val : this.defaultOptions[optName];
500
501				// Set all options on the instance of the Slider
502				if (!this.options) {
503					this.options = {};
504				}
505				this.options[optName] = val;
506			}
507
508			this.ticksAreValid = Array.isArray(this.options.ticks) && this.options.ticks.length > 0;
509
510			// Lock to ticks only when ticks[] is defined and set
511			if (!this.ticksAreValid) {
512				this.options.lock_to_ticks = false;
513			}
514
515			// Check options.rtl
516			if (this.options.rtl === 'auto') {
517				var computedStyle = window.getComputedStyle(this.element);
518				if (computedStyle != null) {
519					this.options.rtl = computedStyle.direction === 'rtl';
520				} else {
521					// Fix for Firefox bug in versions less than 62:
522					// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
523					// https://bugzilla.mozilla.org/show_bug.cgi?id=1467722
524					this.options.rtl = this.element.style.direction === 'rtl';
525				}
526			}
527
528			/*
529   	Validate `tooltip_position` against 'orientation`
530   	- if `tooltip_position` is incompatible with orientation, swit
530h it to a default compatible with specified `orientation`
531   		-- default for "vertical" -> "right", "left" if rtl
532   		-- default for "horizontal" -> "top"
533   */
534			if (this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) {
535				if (this.options.rtl) {
536					this.options.tooltip_position = "left";
537				} else {
538					this.options.tooltip_position = "right";
539				}
540			} else if (this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) {
541
542				this.options.tooltip_position = "top";
543			}
544
545			function getDataAttrib(element, optName) {
546				var dataName = "data-slider-" + optName.replace(/_/g, '-');
547				var dataValString = element.getAttribute(dataName);
548
549				try {
550					return JSON.parse(dataValString);
551				} catch (err) {
552					return dataValString;
553				}
554			}
555
556			/*************************************************
557   					Create Markup
558   	**************************************************/
559
560			var origWidth = this.element.style.width;
561			var updateSlider = false;
vendor: 4,746 bytes, lines 562-675
562			var parent = this.element.parentNode;
563			var sliderTrackSelection;
564			var sliderTrackLow, sliderTrackHigh;
565			var sliderMinHandle;
566			var sliderMaxHandle;
567
568			if (this.sliderElem) {
569				updateSlider = true;
570			} else {
571				/* Create elements needed for slider */
572				this.sliderElem = document.createElement("div");
573				this.sliderElem.className = "slider";
574
575				/* Create slider track elements */
576				var sliderTrack = document.createElement("div");
577				sliderTrack.className = "slider-track";
578
579				sliderTrackLow = document.createElement("div");
580				sliderTrackLow.className = "slider-track-low";
581
582				sliderTrackSelection = document.createElement("div");
583				sliderTrackSelection.className = "slider-selection";
584
585				sliderTrackHigh = document.createElement("div");
586				sliderTrackHigh.className = "slider-track-high";
587
588				sliderMinHandle = document.createElement("div");
589				sliderMinHandle.className = "slider-handle min-slider-handle";
590				sliderMinHandle.setAttribute('role', 'slider');
591				sliderMinHandle.setAttribute('aria-valuemin', this.options.min);
592				sliderMinHandle.setAttribute('aria-valuemax', this.options.max);
593
594				sliderMaxHandle = document.createElement("div");
595				sliderMaxHandle.className = "slider-handle max-slider-handle";
596				sliderMaxHandle.setAttribute('role', 'slider');
597				sliderMaxHandle.setAttribute('aria-valuemin', this.options.min);
598				sliderMaxHandle.setAttribute('aria-valuemax', this.options.max);
599
600				sliderTrack.appendChild(sliderTrackLow);
601				sliderTrack.appendChild(sliderTrackSelection);
602				sliderTrack.appendChild(sliderTrackHigh);
603
604				/* Create highlight range elements */
605				this.rangeHighlightElements = [];
606				var rangeHighlightsOpts = this.options.rangeHighlights;
607				if (Array.isArray(rangeHighlightsOpts) && rangeHighlightsOpts.length > 0) {
608					for (var j = 0; j < rangeHighlightsOpts.length; j++) {
609						var rangeHighlightElement = document.createElement("div");
610						var customClassString = rangeHighlightsOpts[j].class || "";
611						rangeHighlightElement.className = "slider-rangeHighlight slider-selection " + customClassString;
612						this.rangeHighlightElements.push(rangeHighlightElement);
613						sliderTrack.appendChild(rangeHighlightElement);
614					}
615				}
616
617				/* Add aria-labelledby to handle's */
618				var isLabelledbyArray = Array.isArray(this.options.labelledby);
619				if (isLabelledbyArray && this.options.labelledby[0]) {
620					sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby[0]);
621				}
622				if (isLabelledbyArray && this.options.labelledby[1]) {
623					sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby[1]);
624				}
625				if (!isLabelledbyArray && this.options.labelledby) {
626					sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby);
627					sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby);
628				}
629
630				/* Create ticks */
631				this.ticks = [];
632				if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
633					this.ticksContainer = document.createElement('div');
634					this.ticksContainer.className = 'slider-tick-container';
635
636					for (i = 0; i < this.options.ticks.length; i++) {
637						var tick = document.createElement('div');
638						tick.className = 'slider-tick';
639						if (this.options.ticks_tooltip) {
640							var tickListenerReference = this._addTickListener();
641							var enterCallback = tickListenerReference.addMouseEnter(this, tick, i);
642							var leaveCallback = tickListenerReference.addMouseLeave(this, tick);
643
644							this.ticksCallbackMap[i] = {
645								mouseEnter: enterCallback,
646								mouseLeave: leaveCallback
647							};
648						}
649						this.ticks.push(tick);
650						this.ticksContainer.appendChild(tick);
651					}
652
653					sliderTrackSelection.className += " tick-slider-selection";
654				}
655
656				this.tickLabels = [];
657				if (Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) {
658					this.tickLabelContainer = document.createElement('div');
659					this.tickLabelContainer.className = 'slider-tick-label-container';
660
661					for (i = 0; i < this.options.ticks_labels.length; i++) {
662						var label = document.createElement('div');
663						var noTickPositionsSpecified = this.options.ticks_positions.length === 0;
664						var tickLabelsIndex = this.options.reversed && noTickPositionsSpecified ? this.options.ticks_labels.length - (i + 1) : i;
665						label.className = 'slider-tick-label';
666						label.innerHTML = this.options.ticks_labels[tickLabelsIndex];
667
668						this.tickLabels.push(label);
669						this.tickLabelContainer.appendChild(label);
670					}
671				}
672
673				var createAndAppendTooltipSubElements = function createAndAppendTooltipSubElements(tooltipElem) {
674					var arrow = document.createElement("div");
675					arrow.className = "tooltip-
vendor: 3,775 bytes, lines 675-777
675arrow";
676
677					var inner = document.createElement("div");
678					inner.className = "tooltip-inner";
679
680					tooltipElem.appendChild(arrow);
681					tooltipElem.appendChild(inner);
682				};
683
684				/* Create tooltip elements */
685				var sliderTooltip = document.createElement("div");
686				sliderTooltip.className = "tooltip tooltip-main";
687				sliderTooltip.setAttribute('role', 'presentation');
688				createAndAppendTooltipSubElements(sliderTooltip);
689
690				var sliderTooltipMin = document.createElement("div");
691				sliderTooltipMin.className = "tooltip tooltip-min";
692				sliderTooltipMin.setAttribute('role', 'presentation');
693				createAndAppendTooltipSubElements(sliderTooltipMin);
694
695				var sliderTooltipMax = document.createElement("div");
696				sliderTooltipMax.className = "tooltip tooltip-max";
697				sliderTooltipMax.setAttribute('role', 'presentation');
698				createAndAppendTooltipSubElements(sliderTooltipMax);
699
700				/* Append components to sliderElem */
701				this.sliderElem.appendChild(sliderTrack);
702				this.sliderElem.appendChild(sliderTooltip);
703				this.sliderElem.appendChild(sliderTooltipMin);
704				this.sliderElem.appendChild(sliderTooltipMax);
705
706				if (this.tickLabelContainer) {
707					this.sliderElem.appendChild(this.tickLabelContainer);
708				}
709				if (this.ticksContainer) {
710					this.sliderElem.appendChild(this.ticksContainer);
711				}
712
713				this.sliderElem.appendChild(sliderMinHandle);
714				this.sliderElem.appendChild(sliderMaxHandle);
715
716				/* Append slider element to parent container, right before the original <input> element */
717				parent.insertBefore(this.sliderElem, this.element);
718
719				/* Hide original <input> element */
720				this.element.style.display = "none";
721			}
722			/* If JQuery exists, cache JQ references */
723			if ($) {
724				this.$element = $(this.element);
725				this.$sliderElem = $(this.sliderElem);
726			}
727
728			/*************************************************
729   						Setup
730   	**************************************************/
731			this.eventToCallbackMap = {};
732			this.sliderElem.id = this.options.id;
733
734			this.touchCapable = 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch;
735
736			this.touchX = 0;
737			this.touchY = 0;
738
739			this.tooltip = this.sliderElem.querySelector('.tooltip-main');
740			this.tooltipInner = this.tooltip.querySelector('.tooltip-inner');
741
742			this.tooltip_min = this.sliderElem.querySelector('.tooltip-min');
743			this.tooltipInner_min = this.tooltip_min.querySelector('.tooltip-inner');
744
745			this.tooltip_max = this.sliderElem.querySelector('.tooltip-max');
746			this.tooltipInner_max = this.tooltip_max.querySelector('.tooltip-inner');
747
748			if (SliderScale[this.options.scale]) {
749				this.options.scale = SliderScale[this.options.scale];
750			}
751
752			if (updateSlider === true) {
753				// Reset classes
754				this._removeClass(this.sliderElem, 'slider-horizontal');
755				this._removeClass(this.sliderElem, 'slider-vertical');
756				this._removeClass(this.sliderElem, 'slider-rtl');
757				this._removeClass(this.tooltip, 'hide');
758				this._removeClass(this.tooltip_min, 'hide');
759				this._removeClass(this.tooltip_max, 'hide');
760
761				// Undo existing inline styles for track
762				["left", "right", "top", "width", "height"].forEach(function (prop) {
763					this._removeProperty(this.trackLow, prop);
764					this._removeProperty(this.trackSelection, prop);
765					this._removeProperty(this.trackHigh, prop);
766				}, this);
767
768				// Undo inline styles on handles
769				[this.handle1, this.handle2].forEach(function (handle) {
770					this._removeProperty(handle, 'left');
771					this._removeProperty(handle, 'right');
772					this._removeProperty(handle, 'top');
773				}, this);
774
775				// Undo inline styles and classes on tooltips
776				[this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function (tooltip) {
777					this._removeProperty(tooltip, '
777left');
778					this._removeProperty(tooltip, 'right');
779					this._removeProperty(tooltip, 'top');
780
781					this._removeClass(tooltip, 'right');
782					this._removeClass(tooltip, 'left');
783					this._removeClass(tooltip, '
vendor: 17,438 bytes, lines 783-1303
783top');
784				}, this);
785			}
786
787			if (this.options.orientation === 'vertical') {
788				this._addClass(this.sliderElem, 'slider-vertical');
789				this.stylePos = 'top';
790				this.mousePos = 'pageY';
791				this.sizePos = 'offsetHeight';
792			} else {
793				this._addClass(this.sliderElem, 'slider-horizontal');
794				this.sliderElem.style.width = origWidth;
795				this.options.orientation = 'horizontal';
796				if (this.options.rtl) {
797					this.stylePos = 'right';
798				} else {
799					this.stylePos = 'left';
800				}
801				this.mousePos = 'clientX';
802				this.sizePos = 'offsetWidth';
803			}
804			// specific rtl class
805			if (this.options.rtl) {
806				this._addClass(this.sliderElem, 'slider-rtl');
807			}
808			this._setTooltipPosition();
809			/* In case ticks are specified, overwrite the min and max bounds */
810			if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
811				if (!isMaxSet) {
812					this.options.max = Math.max.apply(Math, this.options.ticks);
813				}
814				if (!isMinSet) {
815					this.options.min = Math.min.apply(Math, this.options.ticks);
816				}
817			}
818
819			if (Array.isArray(this.options.value)) {
820				this.options.range = true;
821				this._state.value = this.options.value;
822			} else if (this.options.range) {
823				// User wants a range, but value is not an array
824				this._state.value = [this.options.value, this.options.max];
825			} else {
826				this._state.value = this.options.value;
827			}
828
829			this.trackLow = sliderTrackLow || this.trackLow;
830			this.trackSelection = sliderTrackSelection || this.trackSelection;
831			this.trackHigh = sliderTrackHigh || this.trackHigh;
832
833			if (this.options.selection === 'none') {
834				this._addClass(this.trackLow, 'hide');
835				this._addClass(this.trackSelection, 'hide');
836				this._addClass(this.trackHigh, 'hide');
837			} else if (this.options.selection === 'after' || this.options.selection === 'before') {
838				this._removeClass(this.trackLow, 'hide');
839				this._removeClass(this.trackSelection, 'hide');
840				this._removeClass(this.trackHigh, 'hide');
841			}
842
843			this.handle1 = sliderMinHandle || this.handle1;
844			this.handle2 = sliderMaxHandle || this.handle2;
845
846			if (updateSlider === true) {
847				// Reset classes
848				this._removeClass(this.handle1, 'round triangle');
849				this._removeClass(this.handle2, 'round triangle hide');
850
851				for (i = 0; i < this.ticks.length; i++) {
852					this._removeClass(this.ticks[i], 'round triangle hide');
853				}
854			}
855
856			var availableHandleModifiers = ['round', 'triangle', 'custom'];
857			var isValidHandleType = availableHandleModifiers.indexOf(this.options.handle) !== -1;
858			if (isValidHandleType) {
859				this._addClass(this.handle1, this.options.handle);
860				this._addClass(this.handle2, this.options.handle);
861
862				for (i = 0; i < this.ticks.length; i++) {
863					this._addClass(this.ticks[i], this.options.handle);
864				}
865			}
866
867			this._state.offset = this._offset(this.sliderElem);
868			this._state.size = this.sliderElem[this.sizePos];
869			this.setValue(this._state.value);
870
871			/******************************************
872   				Bind Event Listeners
873   	******************************************/
874
875			// Bind keyboard handlers
876			this.handle1Keydown = this._keydown.bind(this, 0);
877			this.handle1.addEventListener("keydown", this.handle1Keydown, false);
878
879			this.handle2Keydown = this._keydown.bind(this, 1);
880			this.handle2.addEventListener("keydown", this.handle2Keydown, false);
881
882			this.mousedown = this._mousedown.bind(this);
883			this.touchstart = this._touchstart.bind(this);
884			this.touchmove = this._touchmove.bind(this);
885
886			if (this.touchCapable) {
887				this.sliderElem.addEventListener("touchstart", this.touchstart, false);
888				this.sliderElem.addEventListener("touchmove", this.touchmove, false);
889			}
890
891			this.sliderElem.addEventListener("mousedown", this.mousedown, false);
892
893			// Bind window handlers
894			this.resize = this._resize.bind(this);
895			window.addEventListener("resize", this.resize, false);
896
897			// Bind tooltip-related handlers
898			if (this.options.tooltip === 'hide') {
899				this._addClass(this.tooltip, 'hide');
900				this._addClass(this.tooltip_min, 'hide');
901				this._addClass(this.tooltip_max, 'hide');
902			} else if (this.options.tooltip === 'always') {
903				this._showTooltip();
904				this._alwaysShowTooltip = true;
905			} else {
906				this.showTooltip = this._showTooltip.bind(this);
907				this.hideTooltip = this._hideTooltip.bind(this);
908
909				if (this.options.ticks_tooltip) {
910					var callbackHandle = this._addTickListener();
911					//create handle1 listeners and store references in map
912					var mouseEnter = callbackHandle.addMouseEnter(this, this.handle1);
913					var mouseLeave = callbackHandle.addMouseLeave(this, this.handle1);
914					this.handleCallbackMap.handle1 = {
915						mouseEnter: mouseEnter,
916						mouseLeave: mouseLeave
917					};
918					//create handle2 listeners and store references in map
919					mouseEnter = callbackHandle.addMouseEnter(this, this.handle2);
920					mouseLeave = callbackHandle.addMouseLeave(this, this.handle2);
921					this.handleCallbackMap.handle2 = {
922						mouseEnter: mouseEnter,
923						mouseLeave: mouseLeave
924					};
925				} else {
926					this.sliderElem.addEventListener("mouseenter", this.showTooltip, false);
927					this.sliderElem.addEventListener("mouseleave", this.hideTooltip, false);
928
929					if (this.touchCapable) {
930						this.sliderElem.addEventListener("touchstart", this.showTooltip, false);
931						this.sliderElem.addEventListener("touchmove", this.showTooltip, false);
932						this.sliderElem.addEventListener("touchend", this.hideTooltip, false);
933					}
934				}
935
936				this.handle1.addEventListener("focus", this.showTooltip, false);
937				this.handle1.addEventListener("blur", this.hideTooltip, false);
938
939				this.handle2.addEventListener("focus", this.showTooltip, false);
940				this.handle2.addEventListener("blur", this.hideTooltip, false);
941
942				if (this.touchCapable) {
943					this.handle1.addEventListener("touchstart", this.showTooltip, false);
944					this.handle1.addEventListener("touchmove", this.showTooltip, false);
945					this.handle1.addEventListener("touchend", this.hideTooltip, false);
946
947					this.handle2.addEventListener("touchstart", this.showTooltip, false);
948					this.handle2.addEventListener("touchmove", this.showTooltip, false);
949					this.handle2.addEventListener("touchend", this.hideTooltip, false);
950				}
951			}
952
953			if (this.options.enabled) {
954				this.enable();
955			} else {
956				this.disable();
957			}
958		}
959
960		/*************************************************
961  				INSTANCE PROPERTIES/METHODS
962  	- Any methods bound to the prototype are considered
963  part of the plugin's `public` interface
964  	**************************************************/
965		Slider.prototype = {
966			_init: function _init() {}, // NOTE: Must exist to support bridget
967
968			constructor: Slider,
969
970			defaultOptions: {
971				id: "",
972				min: 0,
973				max: 10,
974				step: 1,
975				precision: 0,
976				orientation: 'horizontal',
977				value: 5,
978				range: false,
979				selection: 'before',
980				tooltip: 'show',
981				tooltip_split: false,
982				lock_to_ticks: false,
983				handle: 'round',
984				reversed: false,
985				rtl: 'auto',
986				enabled: true,
987				formatter: function formatter(val) {
988					if (Array.isArray(val)) {
989						return val[0] + " : " + val[1];
990					} else {
991						return val;
992					}
993				},
994				natural_arrow_keys: false,
995				ticks: [],
996				ticks_positions: [],
997				ticks_labels: [],
998				ticks_snap_bounds: 0,
999				ticks_tooltip: false,
1000				scale: 'linear',
1001				focus: false,
1002				tooltip_position: null,
1003				labelledby: null,
1004				rangeHighlights: []
1005			},
1006
1007			getElement: function getElement() {
1008				return this.sliderElem;
1009			},
1010
1011			getValue: function getValue() {
1012				if (this.options.range) {
1013					return this._state.value;
1014				} else {
1015					return this._state.value[0];
1016				}
1017			},
1018
1019			setValue: function setValue(val, triggerSlideEvent, triggerChangeEvent) {
1020				if (!val) {
1021					val = 0;
1022				}
1023				var oldValue = this.getValue();
1024				this._state.value = this._validateInputValue(val);
1025				var applyPrecision = this._applyPrecision.bind(this);
1026
1027				if (this.options.range) {
1028					this._state.value[0] = applyPrecision(this._state.value[0]);
1029					this._state.value[1] = applyPrecision(this._state.value[1]);
1030
1031					if (this.ticksAreValid && this.options.lock_to_ticks) {
1032						this._state.value[0] = this.options.ticks[this._getClosestTickIndex(this._state.value[0])];
1033						this._state.value[1] = this.options.ticks[this._getClosestTickIndex(this._state.value[1])];
1034					}
1035
1036					this._state.value[0] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[0]));
1037					this._state.value[1] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[1]));
1038				} else {
1039					this._state.value = applyPrecision(this._state.value);
1040
1041					if (this.ticksAreValid && this.options.lock_to_ticks) {
1042						this._state.value = this.options.ticks[this._getClosestTickIndex(this._state.value)];
1043					}
1044
1045					this._state.value = [Math.max(this.options.min, Math.min(this.options.max, this._state.value))];
1046					this._addClass(this.handle2, 'hide');
1047					if (this.options.selection === 'after') {
1048						this._state.value[1] = this.options.max;
1049					} else {
1050						this._state.value[1] = this.options.min;
1051					}
1052				}
1053
1054				// Determine which ticks the handle(s) are set at (if applicable)
1055				this._setTickIndex();
1056
1057				if (this.options.max > this.options.min) {
1058					this._state.percentage = [this._toPercentage(this._state.value[0]), this._toPercentage(this._state.value[1]), this.options.step * 100 / (this.options.max - this.options.min)];
1059				} else {
1060					this._state.percentage = [0, 0, 100];
1061				}
1062
1063				this._layout();
1064				var newValue = this.options.range ? this._state.value : this._state.value[0];
1065
1066				this._setDataVal(newValue);
1067				if (triggerSlideEvent === true) {
1068					this._trigger('slide', newValue);
1069				}
1070
1071				var hasChanged = false;
1072				if (Array.isArray(newValue)) {
1073					hasChanged = oldValue[0] !== newValue[0] || oldValue[1] !== newValue[1];
1074				} else {
1075					hasChanged = oldValue !== newValue;
1076				}
1077
1078				if (hasChanged && triggerChangeEvent === true) {
1079					this._trigger('change', {
1080						oldValue: oldValue,
1081						newValue: newValue
1082					});
1083				}
1084
1085				return this;
1086			},
1087
1088			destroy: function destroy() {
1089				// Remove event handlers on slider elements
1090				this._removeSliderEventHandlers();
1091
1092				// Remove the slider from the DOM
1093				this.sliderElem.parentNode.removeChild(this.sliderElem);
1094				/* Show original <input> element */
1095				this.element.style.display = "";
1096
1097				// Clear out custom event bindings
1098				this._cleanUpEventCallbacksMap();
1099
1100				// Remove data values
1101				this.element.removeAttribute("data");
1102
1103				// Remove JQuery handlers/data
1104				if ($) {
1105					this._unbindJQueryEventHandlers();
1106					if (autoRegisterNamespace === NAMESPACE_MAIN) {
1107						this.$element.removeData(autoRegisterNamespace);
1108					}
1109					this.$element.removeData(NAMESPACE_ALTERNATE);
1110				}
1111			},
1112
1113			disable: function disable() {
1114				this._state.enabled = false;
1115				this.handle1.removeAttribute("tabindex");
1116				this.handle2.removeAttribute("tabindex");
1117				this._addClass(this.sliderElem, 'slider-disabled');
1118				this._trigger('slideDisabled');
1119
1120				return this;
1121			},
1122
1123			enable: function enable() {
1124				this._state.enabled = true;
1125				this.handle1.setAttribute("tabindex", 0);
1126				this.handle2.setAttribute("tabindex", 0);
1127				this._removeClass(this.sliderElem, 'slider-disabled');
1128				this._trigger('slideEnabled');
1129
1130				return this;
1131			},
1132
1133			toggle: function toggle() {
1134				if (this._state.enabled) {
1135					this.disable();
1136				} else {
1137					this.enable();
1138				}
1139				return this;
1140			},
1141
1142			isEnabled: function isEnabled() {
1143				return this._state.enabled;
1144			},
1145
1146			on: function on(evt, callback) {
1147				this._bindNonQueryEventHandler(evt, callback);
1148				return this;
1149			},
1150
1151			off: function off(evt, callback) {
1152				if ($) {
1153					this.$element.off(evt, callback);
1154					this.$sliderElem.off(evt, callback);
1155				} else {
1156					this._unbindNonQueryEventHandler(evt, callback);
1157				}
1158			},
1159
1160			getAttribute: function getAttribute(attribute) {
1161				if (attribute) {
1162					return this.options[attribute];
1163				} else {
1164					return this.options;
1165				}
1166			},
1167
1168			setAttribute: function setAttribute(attribute, value) {
1169				this.options[attribute] = value;
1170				return this;
1171			},
1172
1173			refresh: function refresh(options) {
1174				var currentValue = this.getValue();
1175				this._removeSliderEventHandlers();
1176				createNewSlider.call(this, this.element, this.options);
1177				// Don't reset slider's value on refresh if `useCurrentValue` is true
1178				if (options && options.useCurrentValue === true) {
1179					this.setValue(currentValue);
1180				}
1181				if ($) {
1182					// Bind new instance of slider to the element
1183					if (autoRegisterNamespace === NAMESPACE_MAIN) {
1184						$.data(this.element, NAMESPACE_MAIN, this);
1185						$.data(this.element, NAMESPACE_ALTERNATE, this);
1186					} else {
1187						$.data(this.element, NAMESPACE_ALTERNATE, this);
1188					}
1189				}
1190				return this;
1191			},
1192
1193			relayout: function relayout() {
1194				this._resize();
1195				return this;
1196			},
1197
1198			/******************************+
1199   				HELPERS
1200   	- Any method that is not part of the public interface.
1201   - Place it underneath this comment block and write its signature like so:
1202   		_fnName : function() {...}
1203   	********************************/
1204			_removeTooltipListener: function _removeTooltipListener(event, handler) {
1205				this.handle1.removeEventListener(event, handler, false);
1206				this.handle2.removeEventListener(event, handler, false);
1207			},
1208			_removeSliderEventHandlers: function _removeSliderEventHandlers() {
1209				// Remove keydown event listeners
1210				this.handle1.removeEventListener("keydown", this.handle1Keydown, false);
1211				this.handle2.removeEventListener("keydown", this.handle2Keydown, false);
1212
1213				//remove the listeners from the ticks and handles if they had their own listeners
1214				if (this.options.ticks_tooltip) {
1215					var ticks = this.ticksContainer.getElementsByClassName('slider-tick');
1216					for (var i = 0; i < ticks.length; i++) {
1217						ticks[i].removeEventListener('mouseenter', this.ticksCallbackMap[i].mouseEnter, false);
1218						ticks[i].removeEventListener('mouseleave', this.ticksCallbackMap[i].mouseLeave, false);
1219					}
1220					if (this.handleCallbackMap.handle1 && this.handleCallbackMap.handle2) {
1221						this.handle1.removeEventListener('mouseenter', this.handleCallbackMap.handle1.mouseEnter, false);
1222						this.handle2.removeEventListener('mouseenter', this.handleCallbackMap.handle2.mouseEnter, false);
1223						this.handle1.removeEventListener('mouseleave', this.handleCallbackMap.handle1.mouseLeave, false);
1224						this.handle2.removeEventListener('mouseleave', this.handleCallbackMap.handle2.mouseLeave, false);
1225					}
1226				}
1227
1228				this.handleCallbackMap = null;
1229				this.ticksCallbackMap = null;
1230
1231				if (this.showTooltip) {
1232					this._removeTooltipListener("focus", this.showTooltip);
1233				}
1234				if (this.hideTooltip) {
1235					this._removeTooltipListener("blur", this.hideTooltip);
1236				}
1237
1238				// Remove event listeners from sliderElem
1239				if (this.showTooltip) {
1240					this.sliderElem.removeEventListener("mouseenter", this.showTooltip, false);
1241				}
1242				if (this.hideTooltip) {
1243					this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, false);
1244				}
1245
1246				this.sliderElem.removeEventListener("mousedown", this.mousedown, false);
1247
1248				if (this.touchCapable) {
1249					// Remove touch event listeners from handles
1250					if (this.showTooltip) {
1251						this.handle1.removeEventListener("touchstart", this.showTooltip, false);
1252						this.handle1.removeEventListener("touchmove", this.showTooltip, false);
1253						this.handle2.removeEventListener("touchstart", this.showTooltip, false);
1254						this.handle2.removeEventListener("touchmove", this.showTooltip, false);
1255					}
1256					if (this.hideTooltip) {
1257						this.handle1.removeEventListener("touchend", this.hideTooltip, false);
1258						this.handle2.removeEventListener("touchend", this.hideTooltip, false);
1259					}
1260
1261					// Remove event listeners from sliderElem
1262					if (this.showTooltip) {
1263						this.sliderElem.removeEventListener("touchstart", this.showTooltip, false);
1264						this.sliderElem.removeEventListener("touchmove", this.showTooltip, false);
1265					}
1266					if (this.hideTooltip) {
1267						this.sliderElem.removeEventListener("touchend", this.hideTooltip, false);
1268					}
1269
1270					this.sliderElem.removeEventListener("touchstart", this.touchstart, false);
1271					this.sliderElem.removeEventListener("touchmove", this.touchmove, false);
1272				}
1273
1274				// Remove window event listener
1275				window.removeEventListener("resize", this.resize, false);
1276			},
1277			_bindNonQueryEventHandler: function _bindNonQueryEventHandler(evt, callback) {
1278				if (this.eventToCallbackMap[evt] === undefined) {
1279					this.eventToCallbackMap[evt] = [];
1280				}
1281				this.eventToCallbackMap[evt].push(callback);
1282			},
1283			_unbindNonQueryEventHandler: function _unbindNonQueryEventHandler(evt, callback) {
1284				var callbacks = this.eventToCallbackMap[evt];
1285				if (callbacks !== undefined) {
1286					for (var i = 0; i < callbacks.length; i++) {
1287						if (callbacks[i] === callback) {
1288							callbacks.splice(i, 1);
1289							break;
1290						}
1291					}
1292				}
1293			},
1294			_cleanUpEventCallbacksMap: function _cleanUpEventCallbacksMap() {
1295				var eventNames = Object.keys(this.eventToCallbackMap);
1296				for (var i = 0; i < eventNames.length; i++) {
1297					var eventName = eventNames[i];
1298					delete this.eventToCallbackMap[eventName];
1299				}
1300			},
1301			_showTooltip: function _showTooltip() {
1302				if (this.options.tooltip_split === false) {
1303					this._addClass(this.tooltip, '
1303in');
1304					this.tooltip_min.style.display = 'none';
1305					this.tooltip_max.style.display = 'none';
1306				} else {
1307					this._addClass(this.tooltip_min, 'in');
1308					this._addClass(this.tooltip_max, 'in');
1309					this.tooltip.style.display = 'none';
1310				}
1311				this._state.over = true;
1312			},
1313			_hideTooltip: function _hideTooltip() {
1314				if (this._state.inDrag === false && this._alwaysShowTooltip !== true) {
1315					this._removeClass(this.tooltip, 'in');
1316					this._removeClass(this.tooltip_min, 'in');
1317					this._removeClass(this.tooltip_max, 'in');
1318				}
1319				this._state.over = false;
vendor: 12,482 bytes, lines 1320-1615
1320			},
1321			_setToolTipOnMouseOver: function _setToolTipOnMouseOver(tempState) {
1322				var self = this;
1323				var formattedTooltipVal = this.options.formatter(!tempState ? this._state.value[0] : tempState.value[0]);
1324				var positionPercentages = !tempState ? getPositionPercentages(this._state, this.options.reversed) : getPositionPercentages(tempState, this.options.reversed);
1325				this._setText(this.tooltipInner, formattedTooltipVal);
1326
1327				this.tooltip.style[this.stylePos] = positionPercentages[0] + "%";
1328
1329				function getPositionPercentages(state, reversed) {
1330					if (reversed) {
1331						return [100 - state.percentage[0], self.options.range ? 100 - state.percentage[1] : state.percentage[1]];
1332					}
1333					return [state.percentage[0], state.percentage[1]];
1334				}
1335			},
1336			_copyState: function _copyState() {
1337				return {
1338					value: [this._state.value[0], this._state.value[1]],
1339					enabled: this._state.enabled,
1340					offset: this._state.offset,
1341					size: this._state.size,
1342					percentage: [this._state.percentage[0], this._state.percentage[1], this._state.percentage[2]],
1343					inDrag: this._state.inDrag,
1344					over: this._state.over,
1345					// deleted or null'd keys
1346					dragged: this._state.dragged,
1347					keyCtrl: this._state.keyCtrl
1348				};
1349			},
1350			_addTickListener: function _addTickListener() {
1351				return {
1352					addMouseEnter: function addMouseEnter(reference, element, index) {
1353						var enter = function enter() {
1354							var tempState = reference._copyState();
1355							// Which handle is being hovered over?
1356							var val = element === reference.handle1 ? tempState.value[0] : tempState.value[1];
1357							var per = void 0;
1358
1359							// Setup value and percentage for tick's 'mouseenter'
1360							if (index !== undefined) {
1361								val = reference.options.ticks[index];
1362								per = reference.options.ticks_positions.length > 0 && reference.options.ticks_positions[index] || reference._toPercentage(reference.options.ticks[index]);
1363							} else {
1364								per = reference._toPercentage(val);
1365							}
1366
1367							tempState.value[0] = val;
1368							tempState.percentage[0] = per;
1369							reference._setToolTipOnMouseOver(tempState);
1370							reference._showTooltip();
1371						};
1372						element.addEventListener("mouseenter", enter, false);
1373						return enter;
1374					},
1375					addMouseLeave: function addMouseLeave(reference, element) {
1376						var leave = function leave() {
1377							reference._hideTooltip();
1378						};
1379						element.addEventListener("mouseleave", leave, false);
1380						return leave;
1381					}
1382				};
1383			},
1384			_layout: function _layout() {
1385				var positionPercentages;
1386				var formattedValue;
1387
1388				if (this.options.reversed) {
1389					positionPercentages = [100 - this._state.percentage[0], this.options.range ? 100 - this._state.percentage[1] : this._state.percentage[1]];
1390				} else {
1391					positionPercentages = [this._state.percentage[0], this._state.percentage[1]];
1392				}
1393
1394				this.handle1.style[this.stylePos] = positionPercentages[0] + "%";
1395				this.handle1.setAttribute('aria-valuenow', this._state.value[0]);
1396				formattedValue = this.options.formatter(this._state.value[0]);
1397				if (isNaN(formattedValue)) {
1398					this.handle1.setAttribute('aria-valuetext', formattedValue);
1399				} else {
1400					this.handle1.removeAttribute('aria-valuetext');
1401				}
1402
1403				this.handle2.style[this.stylePos] = positionPercentages[1] + "%";
1404				this.handle2.setAttribute('aria-valuenow', this._state.value[1]);
1405				formattedValue = this.options.formatter(this._state.value[1]);
1406				if (isNaN(formattedValue)) {
1407					this.handle2.setAttribute('aria-valuetext', formattedValue);
1408				} else {
1409					this.handle2.removeAttribute('aria-valuetext');
1410				}
1411
1412				/* Position highlight range elements */
1413				if (this.rangeHighlightElements.length > 0 && Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) {
1414					for (var _i = 0; _i < this.options.rangeHighlights.length; _i++) {
1415						var startPercent = this._toPercentage(this.options.rangeHighlights[_i].start);
1416						var endPercent = this._toPercentage(this.options.rangeHighlights[_i].end);
1417
1418						if (this.options.reversed) {
1419							var sp = 100 - endPercent;
1420							endPercent = 100 - startPercent;
1421							startPercent = sp;
1422						}
1423
1424						var currentRange = this._createHighlightRange(startPercent, endPercent);
1425
1426						if (currentRange) {
1427							if (this.options.orientation === 'vertical') {
1428								this.rangeHighlightElements[_i].style.top = currentRange.start + "%";
1429								this.rangeHighlightElements[_i].style.height = currentRange.size + "%";
1430							} else {
1431								if (this.options.rtl) {
1432									this.rangeHighlightElements[_i].style.right = currentRange.start + "%";
1433								} else {
1434									this.rangeHighlightElements[_i].style.left = currentRange.start + "%";
1435								}
1436								this.rangeHighlightElements[_i].style.width = currentRange.size + "%";
1437							}
1438						} else {
1439							this.rangeHighlightElements[_i].style.display = "none";
1440						}
1441					}
1442				}
1443
1444				/* Position ticks and labels */
1445				if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
1446
1447					var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width';
1448					var styleMargin;
1449					if (this.options.orientation === 'vertical') {
1450						styleMargin = 'marginTop';
1451					} else {
1452						if (this.options.rtl) {
1453							styleMargin = 'marginRight';
1454						} else {
1455							styleMargin = 'marginLeft';
1456						}
1457					}
1458					var labelSize = this._state.size / (this.options.ticks.length - 1);
1459
1460					if (this.tickLabelContainer) {
1461						var extraMargin = 0;
1462						if (this.options.ticks_positions.length === 0) {
1463							if (this.options.orientation !== 'vertical') {
1464								this.tickLabelContainer.style[styleMargin] = -labelSize / 2 + "px";
1465							}
1466
1467							extraMargin = this.tickLabelContainer.offsetHeight;
1468						} else {
1469							/* Chidren are position absolute, calculate height by finding the max offsetHeight of a child */
1470							for (i = 0; i < this.tickLabelContainer.childNodes.length; i++) {
1471								if (this.tickLabelContainer.childNodes[i].offsetHeight > extraMargin) {
1472									extraMargin = this.tickLabelContainer.childNodes[i].offsetHeight;
1473								}
1474							}
1475						}
1476						if (this.options.orientation === 'horizontal') {
1477							this.sliderElem.style.marginBottom = extraMargin + "px";
1478						}
1479					}
1480					for (var i = 0; i < this.options.ticks.length; i++) {
1481
1482						var percentage = this.options.ticks_positions[i] || this._toPercentage(this.options.ticks[i]);
1483
1484						if (this.options.reversed) {
1485							percentage = 100 - percentage;
1486						}
1487
1488						this.ticks[i].style[this.stylePos] = percentage + "%";
1489
1490						/* Set class labels to denote whether ticks are in the selection */
1491						this._removeClass(this.ticks[i], 'in-selection');
1492						if (!this.options.range) {
1493							if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
1494								this._addClass(this.ticks[i], 'in-selection');
1495							} else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
1496								this._addClass(this.ticks[i], 'in-selection');
1497							}
1498						} else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) {
1499							this._addClass(this.ticks[i], 'in-selection');
1500						}
1501
1502						if (this.tickLabels[i]) {
1503							this.tickLabels[i].style[styleSize] = labelSize + "px";
1504
1505							if (this.options.orientation !== 'vertical' && this.options.ticks_positions[i] !== undefined) {
1506								this.tickLabels[i].style.position = 'absolute';
1507								this.tickLabels[i].style[this.stylePos] = percentage + "%";
1508								this.tickLabels[i].style[styleMargin] = -labelSize / 2 + 'px';
1509							} else if (this.options.orientation === 'vertical') {
1510								if (this.options.rtl) {
1511									this.tickLabels[i].style['marginRight'] = this.sliderElem.offsetWidth + "px";
1512								} else {
1513									this.tickLabels[i].style['marginLeft'] = this.sliderElem.offsetWidth + "px";
1514								}
1515								this.tickLabelContainer.style[styleMargin] = this.sliderElem.offsetWidth / 2 * -1 + 'px';
1516							}
1517
1518							/* Set class labels to indicate tick labels are in the selection or selected */
1519							this._removeClass(this.tickLabels[i], 'label-in-selection label-is-selection');
1520							if (!this.options.range) {
1521								if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
1522									this._addClass(this.tickLabels[i], 'label-in-selection');
1523								} else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
1524									this._addClass(this.tickLabels[i], 'label-in-selection');
1525								}
1526								if (percentage === positionPercentages[0]) {
1527									this._addClass(this.tickLabels[i], 'label-is-selection');
1528								}
1529							} else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) {
1530								this._addClass(this.tickLabels[i], 'label-in-selection');
1531								if (percentage === positionPercentages[0] || positionPercentages[1]) {
1532									this._addClass(this.tickLabels[i], 'label-is-selection');
1533								}
1534							}
1535						}
1536					}
1537				}
1538
1539				var formattedTooltipVal;
1540
1541				if (this.options.range) {
1542					formattedTooltipVal = this.options.formatter(this._state.value);
1543					this._setText(this.tooltipInner, formattedTooltipVal);
1544					this.tooltip.style[this.stylePos] = (positionPercentages[1] + positionPercentages[0]) / 2 + "%";
1545
1546					var innerTooltipMinText = this.options.formatter(this._state.value[0]);
1547					this._setText(this.tooltipInner_min, innerTooltipMinText);
1548
1549					var innerTooltipMaxText = this.options.formatter(this._state.value[1]);
1550					this._setText(this.tooltipInner_max, innerTooltipMaxText);
1551
1552					this.tooltip_min.style[this.stylePos] = positionPercentages[0] + "%";
1553
1554					this.tooltip_max.style[this.stylePos] = positionPercentages[1] + "%";
1555				} else {
1556					formattedTooltipVal = this.options.formatter(this._state.value[0]);
1557					this._setText(this.tooltipInner, formattedTooltipVal);
1558
1559					this.tooltip.style[this.stylePos] = positionPercentages[0] + "%";
1560				}
1561
1562				if (this.options.orientation === 'vertical') {
1563					this.trackLow.style.top = '0';
1564					this.trackLow.style.height = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1565
1566					this.trackSelection.style.top = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1567					this.trackSelection.style.height = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1568
1569					this.trackHigh.style.bottom = '0';
1570					this.trackHigh.style.height = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1571				} else {
1572					if (this.stylePos === 'right') {
1573						this.trackLow.style.right = '0';
1574					} else {
1575						this.trackLow.style.left = '0';
1576					}
1577					this.trackLow.style.width = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1578
1579					if (this.stylePos === 'right') {
1580						this.trackSelection.style.right = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1581					} else {
1582						this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1583					}
1584					this.trackSelection.style.width = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1585
1586					if (this.stylePos === 'right') {
1587						this.trackHigh.style.left = '0';
1588					} else {
1589						this.trackHigh.style.right = '0';
1590					}
1591					this.trackHigh.style.width = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1592
1593					var offset_min = this.tooltip_min.getBoundingClientRect();
1594					var offset_max = this.tooltip_max.getBoundingClientRect();
1595
1596					if (this.options.tooltip_position === 'bottom') {
1597						if (offset_min.right > offset_max.left) {
1598							this._removeClass(this.tooltip_max, 'bottom');
1599							this._addClass(this.tooltip_max, 'top');
1600							this.tooltip_max.style.top = '';
1601							this.tooltip_max.style.bottom = 22 + 'px';
1602						} else {
1603							this._removeClass(this.tooltip_max, 'top');
1604							this._addClass(this.tooltip_max, 'bottom');
1605							this.tooltip_max.style.top = this.tooltip_min.style.top;
1606							this.tooltip_max.style.bottom = '';
1607						}
1608					} else {
1609						if (offset_min.right > offset_max.left) {
1610							this._removeClass(this.tooltip_max, 'top');
1611							this._addClass(this.tooltip_max, 'bottom');
1612							this.tooltip_max.style.top = 18 + 'px';
1613						} else {
1614							this._removeClass(this.tooltip_max, 'bottom');
1615							this._addClass(this.tooltip_max, '
vendor: 15,990 bytes, lines 1615-2122
1615top');
1616							this.tooltip_max.style.top = this.tooltip_min.style.top;
1617						}
1618					}
1619				}
1620			},
1621			_createHighlightRange: function _createHighlightRange(start, end) {
1622				if (this._isHighlightRange(start, end)) {
1623					if (start > end) {
1624						return { 'start': end, 'size': start - end };
1625					}
1626					return { 'start': start, 'size': end - start };
1627				}
1628				return null;
1629			},
1630			_isHighlightRange: function _isHighlightRange(start, end) {
1631				if (0 <= start && start <= 100 && 0 <= end && end <= 100) {
1632					return true;
1633				} else {
1634					return false;
1635				}
1636			},
1637			_resize: function _resize(ev) {
1638				/*jshint unused:false*/
1639				this._state.offset = this._offset(this.sliderElem);
1640				this._state.size = this.sliderElem[this.sizePos];
1641				this._layout();
1642			},
1643			_removeProperty: function _removeProperty(element, prop) {
1644				if (element.style.removeProperty) {
1645					element.style.removeProperty(prop);
1646				} else {
1647					element.style.removeAttribute(prop);
1648				}
1649			},
1650			_mousedown: function _mousedown(ev) {
1651				if (!this._state.enabled) {
1652					return false;
1653				}
1654
1655				if (ev.preventDefault) {
1656					ev.preventDefault();
1657				}
1658
1659				this._state.offset = this._offset(this.sliderElem);
1660				this._state.size = this.sliderElem[this.sizePos];
1661
1662				var percentage = this._getPercentage(ev);
1663
1664				if (this.options.range) {
1665					var diff1 = Math.abs(this._state.percentage[0] - percentage);
1666					var diff2 = Math.abs(this._state.percentage[1] - percentage);
1667					this._state.dragged = diff1 < diff2 ? 0 : 1;
1668					this._adjustPercentageForRangeSliders(percentage);
1669				} else {
1670					this._state.dragged = 0;
1671				}
1672
1673				this._state.percentage[this._state.dragged] = percentage;
1674
1675				if (this.touchCapable) {
1676					document.removeEventListener("touchmove", this.mousemove, false);
1677					document.removeEventListener("touchend", this.mouseup, false);
1678				}
1679
1680				if (this.mousemove) {
1681					document.removeEventListener("mousemove", this.mousemove, false);
1682				}
1683				if (this.mouseup) {
1684					document.removeEventListener("mouseup", this.mouseup, false);
1685				}
1686
1687				this.mousemove = this._mousemove.bind(this);
1688				this.mouseup = this._mouseup.bind(this);
1689
1690				if (this.touchCapable) {
1691					// Touch: Bind touch events:
1692					document.addEventListener("touchmove", this.mousemove, false);
1693					document.addEventListener("touchend", this.mouseup, false);
1694				}
1695				// Bind mouse events:
1696				document.addEventListener("mousemove", this.mousemove, false);
1697				document.addEventListener("mouseup", this.mouseup, false);
1698
1699				this._state.inDrag = true;
1700				var newValue = this._calculateValue();
1701
1702				this._trigger('slideStart', newValue);
1703
1704				this.setValue(newValue, false, true);
1705
1706				ev.returnValue = false;
1707
1708				if (this.options.focus) {
1709					this._triggerFocusOnHandle(this._state.dragged);
1710				}
1711
1712				return true;
1713			},
1714			_touchstart: function _touchstart(ev) {
1715				this._mousedown(ev);
1716			},
1717			_triggerFocusOnHandle: function _triggerFocusOnHandle(handleIdx) {
1718				if (handleIdx === 0) {
1719					this.handle1.focus();
1720				}
1721				if (handleIdx === 1) {
1722					this.handle2.focus();
1723				}
1724			},
1725			_keydown: function _keydown(handleIdx, ev) {
1726				if (!this._state.enabled) {
1727					return false;
1728				}
1729
1730				var dir;
1731				switch (ev.keyCode) {
1732					case 37: // left
1733					case 40:
1734						// down
1735						dir = -1;
1736						break;
1737					case 39: // right
1738					case 38:
1739						// up
1740						dir = 1;
1741						break;
1742				}
1743				if (!dir) {
1744					return;
1745				}
1746
1747				// use natural arrow keys instead of from min to max
1748				if (this.options.natural_arrow_keys) {
1749					var isHorizontal = this.options.orientation === 'horizontal';
1750					var isVertical = this.options.orientation === 'vertical';
1751					var isRTL = this.options.rtl;
1752					var isReversed = this.options.reversed;
1753
1754					if (isHorizontal) {
1755						if (isRTL) {
1756							if (!isReversed) {
1757								dir = -dir;
1758							}
1759						} else {
1760							if (isReversed) {
1761								dir = -dir;
1762							}
1763						}
1764					} else if (isVertical) {
1765						if (!isReversed) {
1766							dir = -dir;
1767						}
1768					}
1769				}
1770
1771				var val;
1772				if (this.ticksAreValid && this.options.lock_to_ticks) {
1773					var index = void 0;
1774					// Find tick index that handle 1/2 is currently on
1775					index = this.options.ticks.indexOf(this._state.value[handleIdx]);
1776					if (index === -1) {
1777						// Set default to first tick
1778						index = 0;
1779						window.console.warn('(lock_to_ticks) _keydown: index should not be -1');
1780					}
1781					index += dir;
1782					index = Math.max(0, Math.min(this.options.ticks.length - 1, index));
1783					val = this.options.ticks[index];
1784				} else {
1785					val = this._state.value[handleIdx] + dir * this.options.step;
1786				}
1787				var percentage = this._toPercentage(val);
1788				this._state.keyCtrl = handleIdx;
1789				if (this.options.range) {
1790					this._adjustPercentageForRangeSliders(percentage);
1791					var val1 = !this._state.keyCtrl ? val : this._state.value[0];
1792					var val2 = this._state.keyCtrl ? val : this._state.value[1];
1793					// Restrict values within limits
1794					val = [Math.max(this.options.min, Math.min(this.options.max, val1)), Math.max(this.options.min, Math.min(this.options.max, val2))];
1795				} else {
1796					val = Math.max(this.options.min, Math.min(this.options.max, val));
1797				}
1798
1799				this._trigger('slideStart', val);
1800
1801				this.setValue(val, true, true);
1802
1803				this._trigger('slideStop', val);
1804
1805				this._pauseEvent(ev);
1806				delete this._state.keyCtrl;
1807
1808				return false;
1809			},
1810			_pauseEvent: function _pauseEvent(ev) {
1811				if (ev.stopPropagation) {
1812					ev.stopPropagation();
1813				}
1814				if (ev.preventDefault) {
1815					ev.preventDefault();
1816				}
1817				ev.cancelBubble = true;
1818				ev.returnValue = false;
1819			},
1820			_mousemove: function _mousemove(ev) {
1821				if (!this._state.enabled) {
1822					return false;
1823				}
1824
1825				var percentage = this._getPercentage(ev);
1826				this._adjustPercentageForRangeSliders(percentage);
1827				this._state.percentage[this._state.dragged] = percentage;
1828
1829				var val = this._calculateValue(true);
1830				this.setValue(val, true, true);
1831
1832				return false;
1833			},
1834			_touchmove: function _touchmove(ev) {
1835				if (ev.changedTouches === undefined) {
1836					return;
1837				}
1838
1839				// Prevent page from scrolling and only drag the slider
1840				if (ev.preventDefault) {
1841					ev.preventDefault();
1842				}
1843			},
1844			_adjustPercentageForRangeSliders: function _adjustPercentageForRangeSliders(percentage) {
1845				if (this.options.range) {
1846					var precision = this._getNumDigitsAfterDecimalPlace(percentage);
1847					precision = precision ? precision - 1 : 0;
1848					var percentageWithAdjustedPrecision = this._applyToFixedAndParseFloat(percentage, precision);
1849					if (this._state.dragged === 0 && this._applyToFixedAndParseFloat(this._state.percentage[1], precision) < percentageWithAdjustedPrecision) {
1850						this._state.percentage[0] = this._state.percentage[1];
1851						this._state.dragged = 1;
1852					} else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) {
1853						this._state.percentage[1] = this._state.percentage[0];
1854						this._state.dragged = 0;
1855					} else if (this._state.keyCtrl === 0 && this._toPercentage(this._state.value[1]) < percentage) {
1856						this._state.percentage[0] = this._state.percentage[1];
1857						this._state.keyCtrl = 1;
1858						this.handle2.focus();
1859					} else if (this._state.keyCtrl === 1 && this._toPercentage(this._state.value[0]) > percentage) {
1860						this._state.percentage[1] = this._state.percentage[0];
1861						this._state.keyCtrl = 0;
1862						this.handle1.focus();
1863					}
1864				}
1865			},
1866			_mouseup: function _mouseup(ev) {
1867				if (!this._state.enabled) {
1868					return false;
1869				}
1870
1871				var percentage = this._getPercentage(ev);
1872				this._adjustPercentageForRangeSliders(percentage);
1873				this._state.percentage[this._state.dragged] = percentage;
1874
1875				if (this.touchCapable) {
1876					// Touch: Unbind touch event handlers:
1877					document.removeEventListener("touchmove", this.mousemove, false);
1878					document.removeEventListener("touchend", this.mouseup, false);
1879				}
1880				// Unbind mouse event handlers:
1881				document.removeEventListener("mousemove", this.mousemove, false);
1882				document.removeEventListener("mouseup", this.mouseup, false);
1883
1884				this._state.inDrag = false;
1885				if (this._state.over === false) {
1886					this._hideTooltip();
1887				}
1888				var val = this._calculateValue(true);
1889
1890				this.setValue(val, false, true);
1891				this._trigger('slideStop', val);
1892
1893				// No longer need 'dragged' after mouse up
1894				this._state.dragged = null;
1895
1896				return false;
1897			},
1898			_setValues: function _setValues(index, val) {
1899				var comp = 0 === index ? 0 : 100;
1900				if (this._state.percentage[index] !== comp) {
1901					val.data[index] = this._toValue(this._state.percentage[index]);
1902					val.data[index] = this._applyPrecision(val.data[index]);
1903				}
1904			},
1905			_calculateValue: function _calculateValue(snapToClosestTick) {
1906				var val = {};
1907				if (this.options.range) {
1908					val.data = [this.options.min, this.options.max];
1909					this._setValues(0, val);
1910					this._setValues(1, val);
1911					if (snapToClosestTick) {
1912						val.data[0] = this._snapToClosestTick(val.data[0]);
1913						val.data[1] = this._snapToClosestTick(val.data[1]);
1914					}
1915				} else {
1916					val.data = this._toValue(this._state.percentage[0]);
1917					val.data = parseFloat(val.data);
1918					val.data = this._applyPrecision(val.data);
1919					if (snapToClosestTick) {
1920						val.data = this._snapToClosestTick(val.data);
1921					}
1922				}
1923
1924				return val.data;
1925			},
1926			_snapToClosestTick: function _snapToClosestTick(val) {
1927				var min = [val, Infinity];
1928				for (var i = 0; i < this.options.ticks.length; i++) {
1929					var diff = Math.abs(this.options.ticks[i] - val);
1930					if (diff <= min[1]) {
1931						min = [this.options.ticks[i], diff];
1932					}
1933				}
1934				if (min[1] <= this.options.ticks_snap_bounds) {
1935					return min[0];
1936				}
1937				return val;
1938			},
1939
1940			_applyPrecision: function _applyPrecision(val) {
1941				var precision = this.options.precision || this._getNumDigitsAfterDecimalPlace(this.options.step);
1942				return this._applyToFixedAndParseFloat(val, precision);
1943			},
1944			_getNumDigitsAfterDecimalPlace: function _getNumDigitsAfterDecimalPlace(num) {
1945				var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
1946				if (!match) {
1947					return 0;
1948				}
1949				return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
1950			},
1951			_applyToFixedAndParseFloat: function _applyToFixedAndParseFloat(num, toFixedInput) {
1952				var truncatedNum = num.toFixed(toFixedInput);
1953				return parseFloat(truncatedNum);
1954			},
1955			/*
1956   	Credits to Mike Samuel for the following method!
1957   	Source: http://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number
1958   */
1959			_getPercentage: function _getPercentage(ev) {
1960				if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove' || ev.type === 'touchend')) {
1961					ev = ev.changedTouches[0];
1962				}
1963
1964				var eventPosition = ev[this.mousePos];
1965				var sliderOffset = this._state.offset[this.stylePos];
1966				var distanceToSlide = eventPosition - sliderOffset;
1967				if (this.stylePos === 'right') {
1968					distanceToSlide = -distanceToSlide;
1969				}
1970				// Calculate what percent of the length the slider handle has slid
1971				var percentage = distanceToSlide / this._state.size * 100;
1972				percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2];
1973				if (this.options.reversed) {
1974					percentage = 100 - percentage;
1975				}
1976
1977				// Make sure the percent is within the bounds of the slider.
1978				// 0% corresponds to the 'min' value of the slide
1979				// 100% corresponds to the 'max' value of the slide
1980				return Math.max(0, Math.min(100, percentage));
1981			},
1982			_validateInputValue: function _validateInputValue(val) {
1983				if (!isNaN(+val)) {
1984					return +val;
1985				} else if (Array.isArray(val)) {
1986					this._validateArray(val);
1987					return val;
1988				} else {
1989					throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(val));
1990				}
1991			},
1992			_validateArray: function _validateArray(val) {
1993				for (var i = 0; i < val.length; i++) {
1994					var input = val[i];
1995					if (typeof input !== 'number') {
1996						throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(input));
1997					}
1998				}
1999			},
2000			_setDataVal: function _setDataVal(val) {
2001				this.element.setAttribute('data-value', val);
2002				this.element.setAttribute('value', val);
2003				this.element.value = val;
2004			},
2005			_trigger: function _trigger(evt, val) {
2006				val = val || val === 0 ? val : undefined;
2007
2008				var callbackFnArray = this.eventToCallbackMap[evt];
2009				if (callbackFnArray && callbackFnArray.length) {
2010					for (var i = 0; i < callbackFnArray.length; i++) {
2011						var callbackFn = callbackFnArray[i];
2012						callbackFn(val);
2013					}
2014				}
2015
2016				/* If JQuery exists, trigger JQuery events */
2017				if ($) {
2018					this._triggerJQueryEvent(evt, val);
2019				}
2020			},
2021			_triggerJQueryEvent: function _triggerJQueryEvent(evt, val) {
2022				var eventData = {
2023					type: evt,
2024					value: val
2025				};
2026				this.$element.trigger(eventData);
2027				this.$sliderElem.trigger(eventData);
2028			},
2029			_unbindJQueryEventHandlers: function _unbindJQueryEventHandlers() {
2030				this.$element.off();
2031				this.$sliderElem.off();
2032			},
2033			_setText: function _setText(element, text) {
2034				if (typeof element.textContent !== "undefined") {
2035					element.textContent = text;
2036				} else if (typeof element.innerText !== "undefined") {
2037					element.innerText = text;
2038				}
2039			},
2040			_removeClass: function _removeClass(element, classString) {
2041				var classes = classString.split(" ");
2042				var newClasses = element.className;
2043
2044				for (var i = 0; i < classes.length; i++) {
2045					var classTag = classes[i];
2046					var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)");
2047					newClasses = newClasses.replace(regex, " ");
2048				}
2049
2050				element.className = newClasses.trim();
2051			},
2052			_addClass: function _addClass(element, classString) {
2053				var classes = classString.split(" ");
2054				var newClasses = element.className;
2055
2056				for (var i = 0; i < classes.length; i++) {
2057					var classTag = classes[i];
2058					var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)");
2059					var ifClassExists = regex.test(newClasses);
2060
2061					if (!ifClassExists) {
2062						newClasses += " " + classTag;
2063					}
2064				}
2065
2066				element.className = newClasses.trim();
2067			},
2068			_offsetLeft: function _offsetLeft(obj) {
2069				return obj.getBoundingClientRect().left;
2070			},
2071			_offsetRight: function _offsetRight(obj) {
2072				return obj.getBoundingClientRect().right;
2073			},
2074			_offsetTop: function _offsetTop(obj) {
2075				var offsetTop = obj.offsetTop;
2076				while ((obj = obj.offsetParent) && !isNaN(obj.offsetTop)) {
2077					offsetTop += obj.offsetTop;
2078					if (obj.tagName !== 'BODY') {
2079						offsetTop -= obj.scrollTop;
2080					}
2081				}
2082				return offsetTop;
2083			},
2084			_offset: function _offset(obj) {
2085				return {
2086					left: this._offsetLeft(obj),
2087					right: this._offsetRight(obj),
2088					top: this._offsetTop(obj)
2089				};
2090			},
2091			_css: function _css(elementRef, styleName, value) {
2092				if ($) {
2093					$.style(elementRef, styleName, value);
2094				} else {
2095					var style = styleName.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function (all, letter) {
2096						return letter.toUpperCase();
2097					});
2098					elementRef.style[style] = value;
2099				}
2100			},
2101			_toValue: function _toValue(percentage) {
2102				return this.options.scale.toValue.apply(this, [percentage]);
2103			},
2104			_toPercentage: function _toPercentage(value) {
2105				return this.options.scale.toPercentage.apply(this, [value]);
2106			},
2107			_setTooltipPosition: function _setTooltipPosition() {
2108				var tooltips = [this.tooltip, this.tooltip_min, this.tooltip_max];
2109				if (this.options.orientation === 'vertical') {
2110					var tooltipPos;
2111					if (this.options.tooltip_position) {
2112						tooltipPos = this.options.tooltip_position;
2113					} else {
2114						if (this.options.rtl) {
2115							tooltipPos = 'left';
2116						} else {
2117							tooltipPos = 'right';
2118						}
2119					}
2120					var oppositeSide = tooltipPos === 'left' ? 'right' : 'left';
2121					tooltips.forEach(function (tooltip) {
2122						this._addClass(tooltip, 
vendor: 1,621 bytes, lines 2122-2169
2122tooltipPos);
2123						tooltip.style[oppositeSide] = '100%';
2124					}.bind(this));
2125				} else if (this.options.tooltip_position === 'bottom') {
2126					tooltips.forEach(function (tooltip) {
2127						this._addClass(tooltip, 'bottom');
2128						tooltip.style.top = 22 + 'px';
2129					}.bind(this));
2130				} else {
2131					tooltips.forEach(function (tooltip) {
2132						this._addClass(tooltip, 'top');
2133						tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px';
2134					}.bind(this));
2135				}
2136			},
2137			_getClosestTickIndex: function _getClosestTickIndex(val) {
2138				var difference = Math.abs(val - this.options.ticks[0]);
2139				var index = 0;
2140				for (var i = 0; i < this.options.ticks.length; ++i) {
2141					var d = Math.abs(val - this.options.ticks[i]);
2142					if (d < difference) {
2143						difference = d;
2144						index = i;
2145					}
2146				}
2147				return index;
2148			},
2149			/**
2150    * Attempts to find the index in `ticks[]` the slider values are set at.
2151    * The indexes can be -1 to indicate the slider value is not set at a value in `ticks[]`.
2152    */
2153			_setTickIndex: function _setTickIndex() {
2154				if (this.ticksAreValid) {
2155					this._state.tickIndex = [this.options.ticks.indexOf(this._state.value[0]), this.options.ticks.indexOf(this._state.value[1])];
2156				}
2157			}
2158		};
2159
2160		/*********************************
2161  		Attach to global namespace
2162  	*********************************/
2163		if ($ && $.fn) {
2164			if (!$.fn.slider) {
2165				$.bridget(NAMESPACE_MAIN, Slider);
2166				autoRegisterNamespace = NAMESPACE_MAIN;
2167			} else {
2168				if (windowIsDefined) {
2169					window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSl
2169ider namespace instead.");
2170				}
2171				autoRegisterNamespace = NAMESPACE_ALTERNATE;
2172			}
2173			$.bridget(NAMESPACE_ALTERNATE, Slider);
2174
2175			// Auto-Register data-provide="slider" Elements
2176			$(function () {
2177				$("input[data-provide=slider]")[autoRegisterNamespace]();
2178			});
2179		}
2180	})($);
2181
2182	return Slider;
2183});
2184
2185},{"jquery":124}],18:[function(require,module,exports){
2186require('../../modules/es6.string.iterator');
2187require('../../modules/es6.array.from');
2188module.exports = require('../../modules/_core').Array.from;
2189
2190},{"../../modules/_core":36,"../../modules/es6.array.from":105,"../../modules/es6.string.iterator":114}],19:[function(require,module,exports){
2191var core = require('../../modules/_core');
2192var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
2193module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
2194  return $JSON.stringify.apply($JSON, arguments);
2195};
2196
2197},{"../../modules/_core":36}],20:[function(require,module,exports){
2198require('../../modules/es6.object.assign');
2199module.exports = require('../../modules/_core').Object.assign;
2200
2201},{"../../modules/_core":36,"../../modules/es6.object.assign":107}],21:[function(require,module,exports){
2202require('../../modules/es6.object.define-properties');
2203var $Object = require('../../modules/_core').Object;
2204module.exports = function defineProperties(T, D) {
2205  return $Object.defineProperties(T, D);
2206};
2207
2208},{"../../modules/_core":36,"../../modules/es6.object.define-properties":108}],22:[function(require,module,exports){
2209require('../../modules/es6.object.define-property');
2210var $Object = require('../../modules/_core').Object;
2211module.exports = function defineProperty(it, key, desc) {
2212  return $Object.defineProperty(it, key, desc);
2213};
2214
2215},{"../../modules/_core":36,"../../modules/es6.object.define-property":109}],23:[function(require,module,exports){
2216require('../../modules/es6.object.get-prototype-of');
2217module.exports = require('../../modules/_core').Object.getPrototypeOf;
2218
2219},{"../../modules/_core":36,"../../modules/es6.object.get-prototype-of":110}],24:[function(require,module,exports){
2220require('../../modules/es6.object.keys');
2221module.exports = require('../../modules/_core').Object.keys;
2222
2223},{"../../modules/_core":36,"../../modules/es6.object.keys":111}],25:[function(require,module,exports){
2224require('../../modules/es7.object.values');
2225module.exports = require('../../modules/_core').Object.values;
2226
2227},{"../../modules/_core":36,"../../modules/es7.object.values":116}],26:[function(require,module,exports){
2228require('../modules/es6.object.to-string');
2229require('../modules/es6.string.iterator');
2230require('../modules/web.dom.iterable');
2231require('../modules/es6.promise');
2232require('../modules/es7.promise.finally');
2233require('../modules/es7.promise.try');
2234module.exports = require('../modules/_core').Promise;
2235
2236},{"../modules/_core":36,"../modules/es6.object.to-string":112,"../modules/es6.promise":113,"../modules/es6.string.iterator":114,"../modules/es7.promise.finally":117,"../modules/es7.promise.try":118,"../modules/web.dom.iterable":121}],27:[function(require,module,exports){
2237require('../../modules/es6.symbol');
2238require('../../modules/es6.object.to-string');
2239require('../../modules/es7.symbol.async-iterator');
2240require('../../modules/es7.symbol.observable');
2241module.exports = require('../../modules/_core').Symbol;
2242
2243},{"../../modules/_core":36,"../../modules/es6.object.to-string":112,"../../modules/es6.symbol":115,"../../modules/es7.symbol.async-iterator":119,"../../modules/es7.symbol.observable":120}],28:[function(require,module,exports){
2244require('../../modules/es6.string.iterator');
2245require('../../modules/web.dom.iterable');
2246module.exports = require('../../modules/_wks-ext').f('iterator');
2247
2248},{"../../modules/_wks-ext":102,"../../modules/es6.string.iterator":114,"../../modules/web.dom.iterable":121}],29:[function(require,module,exports){
2249module.exports = function (it) {
2250  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2251  return it;
2252};
2253
2254},{}],30:[function(require,module,exports){
2255module.exports = function () { /* empty */ };
2256
2257},{}],31:[function(require,module,exports){
2258module.exports = function (it, Constructor, name, forbiddenField) {
vendor: 18,917 bytes, lines 2259-2780
2259  if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
2260    throw TypeError(name + ': incorrect invocation!');
2261  } return it;
2262};
2263
2264},{}],32:[function(require,module,exports){
2265var isObject = require('./_is-object');
2266module.exports = function (it) {
2267  if (!isObject(it)) throw TypeError(it + ' is not an object!');
2268  return it;
2269};
2270
2271},{"./_is-object":56}],33:[function(require,module,exports){
2272// false -> Array#indexOf
2273// true  -> Array#includes
2274var toIObject = require('./_to-iobject');
2275var toLength = require('./_to-length');
2276var toAbsoluteIndex = require('./_to-absolute-index');
2277module.exports = function (IS_INCLUDES) {
2278  return function ($this, el, fromIndex) {
2279    var O = toIObject($this);
2280    var length = toLength(O.length);
2281    var index = toAbsoluteIndex(fromIndex, length);
2282    var value;
2283    // Array#includes uses SameValueZero equality algorithm
2284    // eslint-disable-next-line no-self-compare
2285    if (IS_INCLUDES && el != el) while (length > index) {
2286      value = O[index++];
2287      // eslint-disable-next-line no-self-compare
2288      if (value != value) return true;
2289    // Array#indexOf ignores holes, Array#includes - not
2290    } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
2291      if (O[index] === el) return IS_INCLUDES || index || 0;
2292    } return !IS_INCLUDES && -1;
2293  };
2294};
2295
2296},{"./_to-absolute-index":93,"./_to-iobject":95,"./_to-length":96}],34:[function(require,module,exports){
2297// getting tag from 19.1.3.6 Object.prototype.toString()
2298var cof = require('./_cof');
2299var TAG = require('./_wks')('toStringTag');
2300// ES3 wrong here
2301var ARG = cof(function () { return arguments; }()) == 'Arguments';
2302
2303// fallback for IE11 Script Access Denied error
2304var tryGet = function (it, key) {
2305  try {
2306    return it[key];
2307  } catch (e) { /* empty */ }
2308};
2309
2310module.exports = function (it) {
2311  var O, T, B;
2312  return it === undefined ? 'Undefined' : it === null ? 'Null'
2313    // @@toStringTag case
2314    : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
2315    // builtinTag case
2316    : ARG ? cof(O)
2317    // ES3 arguments fallback
2318    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
2319};
2320
2321},{"./_cof":35,"./_wks":103}],35:[function(require,module,exports){
2322var toString = {}.toString;
2323
2324module.exports = function (it) {
2325  return toString.call(it).slice(8, -1);
2326};
2327
2328},{}],36:[function(require,module,exports){
2329var core = module.exports = { version: '2.6.5' };
2330if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
2331
2332},{}],37:[function(require,module,exports){
2333'use strict';
2334var $defineProperty = require('./_object-dp');
2335var createDesc = require('./_property-desc');
2336
2337module.exports = function (object, index, value) {
2338  if (index in object) $defineProperty.f(object, index, createDesc(0, value));
2339  else object[index] = value;
2340};
2341
2342},{"./_object-dp":69,"./_property-desc":83}],38:[function(require,module,exports){
2343// optional / simple context binding
2344var aFunction = require('./_a-function');
2345module.exports = function (fn, that, length) {
2346  aFunction(fn);
2347  if (that === undefined) return fn;
2348  switch (length) {
2349    case 1: return function (a) {
2350      return fn.call(that, a);
2351    };
2352    case 2: return function (a, b) {
2353      return fn.call(that, a, b);
2354    };
2355    case 3: return function (a, b, c) {
2356      return fn.call(that, a, b, c);
2357    };
2358  }
2359  return function (/* ...args */) {
2360    return fn.apply(that, arguments);
2361  };
2362};
2363
2364},{"./_a-function":29}],39:[function(require,module,exports){
2365// 7.2.1 RequireObjectCoercible(argument)
2366module.exports = function (it) {
2367  if (it == undefined) throw TypeError("Can't call method on  " + it);
2368  return it;
2369};
2370
2371},{}],40:[function(require,module,exports){
2372// Thank's IE8 for his funny defineProperty
2373module.exports = !require('./_fails')(function () {
2374  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
2375});
2376
2377},{"./_fails":45}],41:[function(require,module,exports){
2378var isObject = require('./_is-object');
2379var document = require('./_global').document;
2380// typeof document.createElement is 'object' in old IE
2381var is = isObject(document) && isObject(document.createElement);
2382module.exports = function (it) {
2383  return is ? document.createElement(it) : {};
2384};
2385
2386},{"./_global":47,"./_is-object":56}],42:[function(require,module,exports){
2387// IE 8- don't enum bug keys
2388module.exports = (
2389  'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
2390).split(',');
2391
2392},{}],43:[function(require,module,exports){
2393// all enumerable object keys, includes symbols
2394var getKeys = require('./_object-keys');
2395var gOPS = require('./_object-gops');
2396var pIE = require('./_object-pie');
2397module.exports = function (it) {
2398  var result = getKeys(it);
2399  var getSymbols = gOPS.f;
2400  if (getSymbols) {
2401    var symbols = getSymbols(it);
2402    var isEnum = pIE.f;
2403    var i = 0;
2404    var key;
2405    while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
2406  } return result;
2407};
2408
2409},{"./_object-gops":74,"./_object-keys":77,"./_object-pie":78}],44:[function(require,module,exports){
2410var global = require('./_global');
2411var core = require('./_core');
2412var ctx = require('./_ctx');
2413var hide = require('./_hide');
2414var has = require('./_has');
2415var PROTOTYPE = 'prototype';
2416
2417var $export = function (type, name, source) {
2418  var IS_FORCED = type & $export.F;
2419  var IS_GLOBAL = type & $export.G;
2420  var IS_STATIC = type & $export.S;
2421  var IS_PROTO = type & $export.P;
2422  var IS_BIND = type & $export.B;
2423  var IS_WRAP = type & $export.W;
2424  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
2425  var expProto = exports[PROTOTYPE];
2426  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
2427  var key, own, out;
2428  if (IS_GLOBAL) source = name;
2429  for (key in source) {
2430    // contains in native
2431    own = !IS_FORCED && target && target[key] !== undefined;
2432    if (own && has(exports, key)) continue;
2433    // export native or passed
2434    out = own ? target[key] : source[key];
2435    // prevent global pollution for namespaces
2436    exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
2437    // bind timers to global for call from export context
2438    : IS_BIND && own ? ctx(out, global)
2439    // wrap global constructors for prevent change them in library
2440    : IS_WRAP && target[key] == out ? (function (C) {
2441      var F = function (a, b, c) {
2442        if (this instanceof C) {
2443          switch (arguments.length) {
2444            case 0: return new C();
2445            case 1: return new C(a);
2446            case 2: return new C(a, b);
2447          } return new C(a, b, c);
2448        } return C.apply(this, arguments);
2449      };
2450      F[PROTOTYPE] = C[PROTOTYPE];
2451      return F;
2452    // make static versions for prototype methods
2453    })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
2454    // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
2455    if (IS_PROTO) {
2456      (exports.virtual || (exports.virtual = {}))[key] = out;
2457      // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
2458      if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
2459    }
2460  }
2461};
2462// type bitmap
2463$export.F = 1;   // forced
2464$export.G = 2;   // global
2465$export.S = 4;   // static
2466$export.P = 8;   // proto
2467$export.B = 16;  // bind
2468$export.W = 32;  // wrap
2469$export.U = 64;  // safe
2470$export.R = 128; // real proto method for `library`
2471module.exports = $export;
2472
2473},{"./_core":36,"./_ctx":38,"./_global":47,"./_has":48,"./_hide":49}],45:[function(require,module,exports){
2474module.exports = function (exec) {
2475  try {
2476    return !!exec();
2477  } catch (e) {
2478    return true;
2479  }
2480};
2481
2482},{}],46:[function(require,module,exports){
2483var ctx = require('./_ctx');
2484var call = require('./_iter-call');
2485var isArrayIter = require('./_is-array-iter');
2486var anObject = require('./_an-object');
2487var toLength = require('./_to-length');
2488var getIterFn = require('./core.get-iterator-method');
2489var BREAK = {};
2490var RETURN = {};
2491var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
2492  var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
2493  var f = ctx(fn, that, entries ? 2 : 1);
2494  var index = 0;
2495  var length, step, iterator, result;
2496  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
2497  // fast case for arrays with default iterator
2498  if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
2499    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
2500    if (result === BREAK || result === RETURN) return result;
2501  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
2502    result = call(iterator, f, step.value, entries);
2503    if (result === BREAK || result === RETURN) return result;
2504  }
2505};
2506exports.BREAK = BREAK;
2507exports.RETURN = RETURN;
2508
2509},{"./_an-object":32,"./_ctx":38,"./_is-array-iter":54,"./_iter-call":57,"./_to-length":96,"./core.get-iterator-method":104}],47:[function(require,module,exports){
2510// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
2511var global = module.exports = typeof window != 'undefined' && window.Math == Math
2512  ? window : typeof self != 'undefined' && self.Math == Math ? self
2513  // eslint-disable-next-line no-new-func
2514  : Function('return this')();
2515if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
2516
2517},{}],48:[function(require,module,exports){
2518var hasOwnProperty = {}.hasOwnProperty;
2519module.exports = function (it, key) {
2520  return hasOwnProperty.call(it, key);
2521};
2522
2523},{}],49:[function(require,module,exports){
2524var dP = require('./_object-dp');
2525var createDesc = require('./_property-desc');
2526module.exports = require('./_descriptors') ? function (object, key, value) {
2527  return dP.f(object, key, createDesc(1, value));
2528} : function (object, key, value) {
2529  object[key] = value;
2530  return object;
2531};
2532
2533},{"./_descriptors":40,"./_object-dp":69,"./_property-desc":83}],50:[function(require,module,exports){
2534var document = require('./_global').document;
2535module.exports = document && document.documentElement;
2536
2537},{"./_global":47}],51:[function(require,module,exports){
2538module.exports = !require('./_descriptors') && !require('./_fails')(function () {
2539  return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
2540});
2541
2542},{"./_descriptors":40,"./_dom-create":41,"./_fails":45}],52:[function(require,module,exports){
2543// fast apply, http://jsperf.lnkit.com/fast-apply/5
2544module.exports = function (fn, args, that) {
2545  var un = that === undefined;
2546  switch (args.length) {
2547    case 0: return un ? fn()
2548                      : fn.call(that);
2549    case 1: return un ? fn(args[0])
2550                      : fn.call(that, args[0]);
2551    case 2: return un ? fn(args[0], args[1])
2552                      : fn.call(that, args[0], args[1]);
2553    case 3: return un ? fn(args[0], args[1], args[2])
2554                      : fn.call(that, args[0], args[1], args[2]);
2555    case 4: return un ? fn(args[0], args[1], args[2], args[3])
2556                      : fn.call(that, args[0], args[1], args[2], args[3]);
2557  } return fn.apply(that, args);
2558};
2559
2560},{}],53:[function(require,module,exports){
2561// fallback for non-array-like ES3 and non-enumerable old V8 strings
2562var cof = require('./_cof');
2563// eslint-disable-next-line no-prototype-builtins
2564module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
2565  return cof(it) == 'String' ? it.split('') : Object(it);
2566};
2567
2568},{"./_cof":35}],54:[function(require,module,exports){
2569// check on default Array iterator
2570var Iterators = require('./_iterators');
2571var ITERATOR = require('./_wks')('iterator');
2572var ArrayProto = Array.prototype;
2573
2574module.exports = function (it) {
2575  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
2576};
2577
2578},{"./_iterators":62,"./_wks":103}],55:[function(require,module,exports){
2579// 7.2.2 IsArray(argument)
2580var cof = require('./_cof');
2581module.exports = Array.isArray || function isArray(arg) {
2582  return cof(arg) == 'Array';
2583};
2584
2585},{"./_cof":35}],56:[function(require,module,exports){
2586module.exports = function (it) {
2587  return typeof it === 'object' ? it !== null : typeof it === 'function';
2588};
2589
2590},{}],57:[function(require,module,exports){
2591// call something on iterator step with safe closing on error
2592var anObject = require('./_an-object');
2593module.exports = function (iterator, fn, value, entries) {
2594  try {
2595    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
2596  // 7.4.6 IteratorClose(iterator, completion)
2597  } catch (e) {
2598    var ret = iterator['return'];
2599    if (ret !== undefined) anObject(ret.call(iterator));
2600    throw e;
2601  }
2602};
2603
2604},{"./_an-object":32}],58:[function(require,module,exports){
2605'use strict';
2606var create = require('./_object-create');
2607var descriptor = require('./_property-desc');
2608var setToStringTag = require('./_set-to-string-tag');
2609var IteratorPrototype = {};
2610
2611// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
2612require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
2613
2614module.exports = function (Constructor, NAME, next) {
2615  Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
2616  setToStringTag(Constructor, NAME + ' Iterator');
2617};
2618
2619},{"./_hide":49,"./_object-create":68,"./_property-desc":83,"./_set-to-string-tag":87,"./_wks":103}],59:[function(require,module,exports){
2620'use strict';
2621var LIBRARY = require('./_library');
2622var $export = require('./_export');
2623var redefine = require('./_redefine');
2624var hide = require('./_hide');
2625var Iterators = require('./_iterators');
2626var $iterCreate = require('./_iter-create');
2627var setToStringTag = require('./_set-to-string-tag');
2628var getPrototypeOf = require('./_object-gpo');
2629var ITERATOR = require('./_wks')('iterator');
2630var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
2631var FF_ITERATOR = '@@iterator';
2632var KEYS = 'keys';
2633var VALUES = 'values';
2634
2635var returnThis = function () { return this; };
2636
2637module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
2638  $iterCreate(Constructor, NAME, next);
2639  var getMethod = function (kind) {
2640    if (!BUGGY && kind in proto) return proto[kind];
2641    switch (kind) {
2642      case KEYS: return function keys() { return new Constructor(this, kind); };
2643      case VALUES: return function values() { return new Constructor(this, kind); };
2644    } return function entries() { return new Constructor(this, kind); };
2645  };
2646  var TAG = NAME + ' Iterator';
2647  var DEF_VALUES = DEFAULT == VALUES;
2648  var VALUES_BUG = false;
2649  var proto = Base.prototype;
2650  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
2651  var $default = $native || getMethod(DEFAULT);
2652  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
2653  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
2654  var methods, key, IteratorPrototype;
2655  // Fix native
2656  if ($anyNative) {
2657    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
2658    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
2659      // Set @@toStringTag to native iterators
2660      setToStringTag(IteratorPrototype, TAG, true);
2661      // fix for some old engines
2662      if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
2663    }
2664  }
2665  // fix Array#{values, @@iterator}.name in V8 / FF
2666  if (DEF_VALUES && $native && $native.name !== VALUES) {
2667    VALUES_BUG = true;
2668    $default = function values() { return $native.call(this); };
2669  }
2670  // Define iterator
2671  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
2672    hide(proto, ITERATOR, $default);
2673  }
2674  // Plug for library
2675  Iterators[NAME] = $default;
2676  Iterators[TAG] = returnThis;
2677  if (DEFAULT) {
2678    methods = {
2679      values: DEF_VALUES ? $default : getMethod(VALUES),
2680      keys: IS_SET ? $default : getMethod(KEYS),
2681      entries: $entries
2682    };
2683    if (FORCED) for (key in methods) {
2684      if (!(key in proto)) redefine(proto, key, methods[key]);
2685    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
2686  }
2687  return methods;
2688};
2689
2690},{"./_export":44,"./_hide":49,"./_iter-create":58,"./_iterators":62,"./_library":63,"./_object-gpo":75,"./_redefine":85,"./_set-to-string-tag":87,"./_wks":103}],60:[function(require,module,exports){
2691var ITERATOR = require('./_wks')('iterator');
2692var SAFE_CLOSING = false;
2693
2694try {
2695  var riter = [7][ITERATOR]();
2696  riter['return'] = function () { SAFE_CLOSING = true; };
2697  // eslint-disable-next-line no-throw-literal
2698  Array.from(riter, function () { throw 2; });
2699} catch (e) { /* empty */ }
2700
2701module.exports = function (exec, skipClosing) {
2702  if (!skipClosing && !SAFE_CLOSING) return false;
2703  var safe = false;
2704  try {
2705    var arr = [7];
2706    var iter = arr[ITERATOR]();
2707    iter.next = function () { return { done: safe = true }; };
2708    arr[ITERATOR] = function () { return iter; };
2709    exec(arr);
2710  } catch (e) { /* empty */ }
2711  return safe;
2712};
2713
2714},{"./_wks":103}],61:[function(require,module,exports){
2715module.exports = function (done, value) {
2716  return { value: value, done: !!done };
2717};
2718
2719},{}],62:[function(require,module,exports){
2720module.exports = {};
2721
2722},{}],63:[function(require,module,exports){
2723module.exports = true;
2724
2725},{}],64:[function(require,module,exports){
2726var META = require('./_uid')('meta');
2727var isObject = require('./_is-object');
2728var has = require('./_has');
2729var setDesc = require('./_object-dp').f;
2730var id = 0;
2731var isExtensible = Object.isExtensible || function () {
2732  return true;
2733};
2734var FREEZE = !require('./_fails')(function () {
2735  return isExtensible(Object.preventExtensions({}));
2736});
2737var setMeta = function (it) {
2738  setDesc(it, META, { value: {
2739    i: 'O' + ++id, // object ID
2740    w: {}          // weak collections IDs
2741  } });
2742};
2743var fastKey = function (it, create) {
2744  // return primitive with prefix
2745  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
2746  if (!has(it, META)) {
2747    // can't set metadata to uncaught frozen object
2748    if (!isExtensible(it)) return 'F';
2749    // not necessary to add metadata
2750    if (!create) return 'E';
2751    // add missing metadata
2752    setMeta(it);
2753  // return object ID
2754  } return it[META].i;
2755};
2756var getWeak = function (it, create) {
2757  if (!has(it, META)) {
2758    // can't set metadata to uncaught frozen object
2759    if (!isExtensible(it)) return true;
2760    // not necessary to add metadata
2761    if (!create) return false;
2762    // add missing metadata
2763    setMeta(it);
2764  // return hash weak collections IDs
2765  } return it[META].w;
2766};
2767// add metadata on freeze-family methods calling
2768var onFreeze = function (it) {
2769  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
2770  return it;
2771};
2772var meta = module.exports = {
2773  KEY: META,
2774  NEED: false,
2775  fastKey: fastKey,
2776  getWeak: getWeak,
2777  onFreeze: onFreeze
2778};
2779
2780}
vendor: 8,831 bytes, lines 2780-3031
2780,{"./_fails":45,"./_has":48,"./_is-object":56,"./_object-dp":69,"./_uid":99}],65:[function(require,module,exports){
2781var global = require('./_global');
2782var macrotask = require('./_task').set;
2783var Observer = global.MutationObserver || global.WebKitMutationObserver;
2784var process = global.process;
2785var Promise = global.Promise;
2786var isNode = require('./_cof')(process) == 'process';
2787
2788module.exports = function () {
2789  var head, last, notify;
2790
2791  var flush = function () {
2792    var parent, fn;
2793    if (isNode && (parent = process.domain)) parent.exit();
2794    while (head) {
2795      fn = head.fn;
2796      head = head.next;
2797      try {
2798        fn();
2799      } catch (e) {
2800        if (head) notify();
2801        else last = undefined;
2802        throw e;
2803      }
2804    } last = undefined;
2805    if (parent) parent.enter();
2806  };
2807
2808  // Node.js
2809  if (isNode) {
2810    notify = function () {
2811      process.nextTick(flush);
2812    };
2813  // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
2814  } else if (Observer && !(global.navigator && global.navigator.standalone)) {
2815    var toggle = true;
2816    var node = document.createTextNode('');
2817    new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
2818    notify = function () {
2819      node.data = toggle = !toggle;
2820    };
2821  // environments with maybe non-completely correct, but existent Promise
2822  } else if (Promise && Promise.resolve) {
2823    // Promise.resolve without an argument throws an error in LG WebOS 2
2824    var promise = Promise.resolve(undefined);
2825    notify = function () {
2826      promise.then(flush);
2827    };
2828  // for other environments - macrotask based on:
2829  // - setImmediate
2830  // - MessageChannel
2831  // - window.postMessag
2832  // - onreadystatechange
2833  // - setTimeout
2834  } else {
2835    notify = function () {
2836      // strange IE + webpack dev server bug - use .call(global)
2837      macrotask.call(global, flush);
2838    };
2839  }
2840
2841  return function (fn) {
2842    var task = { fn: fn, next: undefined };
2843    if (last) last.next = task;
2844    if (!head) {
2845      head = task;
2846      notify();
2847    } last = task;
2848  };
2849};
2850
2851},{"./_cof":35,"./_global":47,"./_task":92}],66:[function(require,module,exports){
2852'use strict';
2853// 25.4.1.5 NewPromiseCapability(C)
2854var aFunction = require('./_a-function');
2855
2856function PromiseCapability(C) {
2857  var resolve, reject;
2858  this.promise = new C(function ($$resolve, $$reject) {
2859    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2860    resolve = $$resolve;
2861    reject = $$reject;
2862  });
2863  this.resolve = aFunction(resolve);
2864  this.reject = aFunction(reject);
2865}
2866
2867module.exports.f = function (C) {
2868  return new PromiseCapability(C);
2869};
2870
2871},{"./_a-function":29}],67:[function(require,module,exports){
2872'use strict';
2873// 19.1.2.1 Object.assign(target, source, ...)
2874var getKeys = require('./_object-keys');
2875var gOPS = require('./_object-gops');
2876var pIE = require('./_object-pie');
2877var toObject = require('./_to-object');
2878var IObject = require('./_iobject');
2879var $assign = Object.assign;
2880
2881// should work with symbols and should have deterministic property order (V8 bug)
2882module.exports = !$assign || require('./_fails')(function () {
2883  var A = {};
2884  var B = {};
2885  // eslint-disable-next-line no-undef
2886  var S = Symbol();
2887  var K = 'abcdefghijklmnopqrst';
2888  A[S] = 7;
2889  K.split('').forEach(function (k) { B[k] = k; });
2890  return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
2891}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
2892  var T = toObject(target);
2893  var aLen = arguments.length;
2894  var index = 1;
2895  var getSymbols = gOPS.f;
2896  var isEnum = pIE.f;
2897  while (aLen > index) {
2898    var S = IObject(arguments[index++]);
2899    var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
2900    var length = keys.length;
2901    var j = 0;
2902    var key;
2903    while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
2904  } return T;
2905} : $assign;
2906
2907},{"./_fails":45,"./_iobject":53,"./_object-gops":74,"./_object-keys":77,"./_object-pie":78,"./_to-object":97}],68:[function(require,module,exports){
2908// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
2909var anObject = require('./_an-object');
2910var dPs = require('./_object-dps');
2911var enumBugKeys = require('./_enum-bug-keys');
2912var IE_PROTO = require('./_shared-key')('IE_PROTO');
2913var Empty = function () { /* empty */ };
2914var PROTOTYPE = 'prototype';
2915
2916// Create object with fake `null` prototype: use iframe Object with cleared prototype
2917var createDict = function () {
2918  // Thrash, waste and sodomy: IE GC bug
2919  var iframe = require('./_dom-create')('iframe');
2920  var i = enumBugKeys.length;
2921  var lt = '<';
2922  var gt = '>';
2923  var iframeDocument;
2924  iframe.style.display = 'none';
2925  require('./_html').appendChild(iframe);
2926  iframe.src = 'javascript:'; // eslint-disable-line no-script-url
2927  // createDict = iframe.contentWindow.Object;
2928  // html.removeChild(iframe);
2929  iframeDocument = iframe.contentWindow.document;
2930  iframeDocument.open();
2931  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
2932  iframeDocument.close();
2933  createDict = iframeDocument.F;
2934  while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
2935  return createDict();
2936};
2937
2938module.exports = Object.create || function create(O, Properties) {
2939  var result;
2940  if (O !== null) {
2941    Empty[PROTOTYPE] = anObject(O);
2942    result = new Empty();
2943    Empty[PROTOTYPE] = null;
2944    // add "__proto__" for Object.getPrototypeOf polyfill
2945    result[IE_PROTO] = O;
2946  } else result = createDict();
2947  return Properties === undefined ? result : dPs(result, Properties);
2948};
2949
2950},{"./_an-object":32,"./_dom-create":41,"./_enum-bug-keys":42,"./_html":50,"./_object-dps":70,"./_shared-key":88}],69:[function(require,module,exports){
2951var anObject = require('./_an-object');
2952var IE8_DOM_DEFINE = require('./_ie8-dom-define');
2953var toPrimitive = require('./_to-primitive');
2954var dP = Object.defineProperty;
2955
2956exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
2957  anObject(O);
2958  P = toPrimitive(P, true);
2959  anObject(Attributes);
2960  if (IE8_DOM_DEFINE) try {
2961    return dP(O, P, Attributes);
2962  } catch (e) { /* empty */ }
2963  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
2964  if ('value' in Attributes) O[P] = Attributes.value;
2965  return O;
2966};
2967
2968},{"./_an-object":32,"./_descriptors":40,"./_ie8-dom-define":51,"./_to-primitive":98}],70:[function(require,module,exports){
2969var dP = require('./_object-dp');
2970var anObject = require('./_an-object');
2971var getKeys = require('./_object-keys');
2972
2973module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
2974  anObject(O);
2975  var keys = getKeys(Properties);
2976  var length = keys.length;
2977  var i = 0;
2978  var P;
2979  while (length > i) dP.f(O, P = keys[i++], Properties[P]);
2980  return O;
2981};
2982
2983},{"./_an-object":32,"./_descriptors":40,"./_object-dp":69,"./_object-keys":77}],71:[function(require,module,exports){
2984var pIE = require('./_object-pie');
2985var createDesc = require('./_property-desc');
2986var toIObject = require('./_to-iobject');
2987var toPrimitive = require('./_to-primitive');
2988var has = require('./_has');
2989var IE8_DOM_DEFINE = require('./_ie8-dom-define');
2990var gOPD = Object.getOwnPropertyDescriptor;
2991
2992exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
2993  O = toIObject(O);
2994  P = toPrimitive(P, true);
2995  if (IE8_DOM_DEFINE) try {
2996    return gOPD(O, P);
2997  } catch (e) { /* empty */ }
2998  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
2999};
3000
3001},{"./_descriptors":40,"./_has":48,"./_ie8-dom-define":51,"./_object-pie":78,"./_property-desc":83,"./_to-iobject":95,"./_to-primitive":98}],72:[function(require,module,exports){
3002// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
3003var toIObject = require('./_to-iobject');
3004var gOPN = require('./_object-gopn').f;
3005var toString = {}.toString;
3006
3007var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
3008  ? Object.getOwnPropertyNames(window) : [];
3009
3010var getWindowNames = function (it) {
3011  try {
3012    return gOPN(it);
3013  } catch (e) {
3014    return windowNames.slice();
3015  }
3016};
3017
3018module.exports.f = function getOwnPropertyNames(it) {
3019  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
3020};
3021
3022},{"./_object-gopn":73,"./_to-iobject":95}],73:[function(require,module,exports){
3023// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
3024var $keys = require('./_object-keys-internal');
3025var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');
3026
3027exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
3028  return $keys(O, hiddenKeys);
3029};
3030
3031},{"./_enum-bug-keys":42,"./_object-keys-internal":76}],74:[function(require,module,exports){
3032exports.f = Object.getOwnPropertySymbols;
3033
3034},{}],75:[function(require,module,exports){
3035// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
3036var has = require('./_has');
3037var toObject = require('./_to-object');
3038var IE_PROTO = require('./_shared-key')('IE_PROTO');
3039var ObjectProto = Object.prototype;
3040
3041module.exports = Object.getPrototypeOf || function (O) {
3042  O = toObject(O);
3043  if (has(O, IE_PROTO)) return O[IE_PROTO];
3044  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
3045    return O.constructor.prototype;
3046  } return O instanceof Object ? ObjectProto : null;
3047};
3048
3049},{"./_has":48,"./_shared-key":88,"./_to-object":97}],76:[function(require,module,exports){
3050var has = require('./_has');
3051var toIObject = require('./_to-iobject');
3052var arrayIndexOf = require('./_array-includes')(false);
3053var IE_PROTO = require('./_shared-key')('IE_PROTO');
3054
3055module.exports = function (object, names) {
3056  var O = toIObject(object);
3057  var i = 0;
3058  var result = [];
3059  var key;
3060  for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
3061  // Don't enum bug & hidden keys
3062  while (names.length > i) if (has(O, key = names[i++])) {
3063    ~arrayIndexOf(result, key) || result.push(key);
3064  }
3065  return result;
3066};
3067
3068},{"./_array-includes":33,"./_has":48,"./_shared-key":88,"./_to-iobject":95}],77:[function(require,module,exports){
3069// 19.1.2.14 / 15.2.3.14 Object.keys(O)
3070var $keys = require('./_object-keys-internal');
3071var enumBugKeys = require('./_enum-bug-keys');
3072
3073module.exports = Object.keys || function keys(O) {
3074  return $keys(O, enumBugKeys);
3075};
3076
3077},{"./_enum-bug-keys":42,"./_object-keys-internal":76}],78:[function(require,module,exports){
3078exports.f = {}.propertyIsEnumerable;
3079
3080},{}],79:[function(require,module,exports){
3081// most Object methods by ES6 should accept primitives
3082var $export = require('./_export');
3083var core = require('./_core');
3084var fails = require('./_fails');
3085module.exports = function (KEY, exec) {
3086  var fn = (core.Object || {})[KEY] || Object[KEY];
3087  var exp = {};
3088  exp[KEY] = exec(fn);
3089  $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
3090};
3091
3092},{"./_core":36,"./_export":44,"./_fails":45}],80:[function(require,module,exports){
3093var getKeys = require('./_object-keys');
3094var toIObject = require('./_to-iobject');
3095var isEnum = require('./_object-pie').f;
3096module.exports = function (isEntries) {
3097  return function (it) {
3098    var O = toIObject(it);
3099    var keys = getKeys(O);
3100    var length = keys.length;
3101    var i = 0;
3102    var result = [];
3103    var key;
3104    while (length > i) if (isEnum.call(O, key = keys[i++])) {
3105      result.push(isEntries ? [key, O[key]] : O[key]);
3106    } return result;
3107  };
3108};
3109
3110},{"./_object-keys":77,"./_object-pie":78,"./_to-iobject":95}],81:[function(require,module,exports){
3111module.exports = function (exec) {
3112  try {
3113    return { e: false, v: exec() };
3114  } catch (e) {
3115    return { e: true, v: e };
3116  }
3117};
3118
3119},{}],82:[function(require,module,exports){
3120var anObject = require('./_an-object');
3121var isObject = require('./_is-object');
3122var newPromiseCapability = require('./_new-promise-capability');
3123
3124module.exports = function (C, x) {
3125  anObject(C);
3126  if (isObject(x) && x.constructor === C) return x;
3127  var promiseCapability = newPromiseCapability.f(C);
3128  var resolve = promiseCapability.resolve;
3129  resolve(x);
3130  return promiseCapability.promise;
3131};
3132
3133},{"./_an-object":32,"./_is-object":56,"./_new-promise-capability":66}],83:[function(require,module,exports){
3134module.exports = function (bitmap, value) {
3135  return {
3136    enumerable: !(bitmap & 1),
3137    configurable: !(bitmap & 2),
3138    writable: !(bitmap & 4),
3139    value: value
3140  };
3141};
3142
3143},{}],84:[function(require,module,exports){
3144var hide = require('./_hide');
3145module.exports = function (target, src, safe) {
3146  for (var key in src) {
3147    if (safe && target[key]) target[key] = src[key];
3148    else hide(target, key, src[key]);
3149  } return target;
3150};
3151
3152},{"./_hide":49}],85:[function(require,module,exports){
3153module.exports = require('./_hide');
3154
3155},{"./_hide":49}],86:[function(require,module,exports){
3156'use strict';
3157var global = require('./_global');
3158var core = require('./_core');
3159var dP = require('./_object-dp');
3160var DESCRIPTORS = require('./_descriptors');
3161var SPECIES = require('./_wks')('species');
3162
3163module.exports = function (KEY) {
3164  var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
3165  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
3166    configurable: true,
3167    get: function () { return this; }
3168  });
3169};
3170
3171},{"./_core":36,"./_descriptors":40,"./_global":47,"./_object-dp":69,"./_wks":103}],87:[function(require,module,exports){
3172var def = require('./_object-dp').f;
3173var has = require('./_has');
3174var TAG = require('./_wks')('toStringTag');
3175
3176module.exports = function (it, tag, stat) {
3177  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
3178};
3179
3180},{"./_has":48,"./_object-dp":69,"./_wks":103}],88:[function(require,module,exports){
3181var shared = require('./_shared')('keys');
3182var uid = require('./_uid');
3183module.exports = function (key) {
vendor: 11,404 bytes, lines 3184-3497
3184  return shared[key] || (shared[key] = uid(key));
3185};
3186
3187},{"./_shared":89,"./_uid":99}],89:[function(require,module,exports){
3188var core = require('./_core');
3189var global = require('./_global');
3190var SHARED = '__core-js_shared__';
3191var store = global[SHARED] || (global[SHARED] = {});
3192
3193(module.exports = function (key, value) {
3194  return store[key] || (store[key] = value !== undefined ? value : {});
3195})('versions', []).push({
3196  version: core.version,
3197  mode: require('./_library') ? 'pure' : 'global',
3198  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
3199});
3200
3201},{"./_core":36,"./_global":47,"./_library":63}],90:[function(require,module,exports){
3202// 7.3.20 SpeciesConstructor(O, defaultConstructor)
3203var anObject = require('./_an-object');
3204var aFunction = require('./_a-function');
3205var SPECIES = require('./_wks')('species');
3206module.exports = function (O, D) {
3207  var C = anObject(O).constructor;
3208  var S;
3209  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
3210};
3211
3212},{"./_a-function":29,"./_an-object":32,"./_wks":103}],91:[function(require,module,exports){
3213var toInteger = require('./_to-integer');
3214var defined = require('./_defined');
3215// true  -> String#at
3216// false -> String#codePointAt
3217module.exports = function (TO_STRING) {
3218  return function (that, pos) {
3219    var s = String(defined(that));
3220    var i = toInteger(pos);
3221    var l = s.length;
3222    var a, b;
3223    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
3224    a = s.charCodeAt(i);
3225    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
3226      ? TO_STRING ? s.charAt(i) : a
3227      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
3228  };
3229};
3230
3231},{"./_defined":39,"./_to-integer":94}],92:[function(require,module,exports){
3232var ctx = require('./_ctx');
3233var invoke = require('./_invoke');
3234var html = require('./_html');
3235var cel = require('./_dom-create');
3236var global = require('./_global');
3237var process = global.process;
3238var setTask = global.setImmediate;
3239var clearTask = global.clearImmediate;
3240var MessageChannel = global.MessageChannel;
3241var Dispatch = global.Dispatch;
3242var counter = 0;
3243var queue = {};
3244var ONREADYSTATECHANGE = 'onreadystatechange';
3245var defer, channel, port;
3246var run = function () {
3247  var id = +this;
3248  // eslint-disable-next-line no-prototype-builtins
3249  if (queue.hasOwnProperty(id)) {
3250    var fn = queue[id];
3251    delete queue[id];
3252    fn();
3253  }
3254};
3255var listener = function (event) {
3256  run.call(event.data);
3257};
3258// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
3259if (!setTask || !clearTask) {
3260  setTask = function setImmediate(fn) {
3261    var args = [];
3262    var i = 1;
3263    while (arguments.length > i) args.push(arguments[i++]);
3264    queue[++counter] = function () {
3265      // eslint-disable-next-line no-new-func
3266      invoke(typeof fn == 'function' ? fn : Function(fn), args);
3267    };
3268    defer(counter);
3269    return counter;
3270  };
3271  clearTask = function clearImmediate(id) {
3272    delete queue[id];
3273  };
3274  // Node.js 0.8-
3275  if (require('./_cof')(process) == 'process') {
3276    defer = function (id) {
3277      process.nextTick(ctx(run, id, 1));
3278    };
3279  // Sphere (JS game engine) Dispatch API
3280  } else if (Dispatch && Dispatch.now) {
3281    defer = function (id) {
3282      Dispatch.now(ctx(run, id, 1));
3283    };
3284  // Browsers with MessageChannel, includes WebWorkers
3285  } else if (MessageChannel) {
3286    channel = new MessageChannel();
3287    port = channel.port2;
3288    channel.port1.onmessage = listener;
3289    defer = ctx(port.postMessage, port, 1);
3290  // Browsers with postMessage, skip WebWorkers
3291  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
3292  } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
3293    defer = function (id) {
3294      global.postMessage(id + '', '*');
3295    };
3296    global.addEventListener('message', listener, false);
3297  // IE8-
3298  } else if (ONREADYSTATECHANGE in cel('script')) {
3299    defer = function (id) {
3300      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
3301        html.removeChild(this);
3302        run.call(id);
3303      };
3304    };
3305  // Rest old browsers
3306  } else {
3307    defer = function (id) {
3308      setTimeout(ctx(run, id, 1), 0);
3309    };
3310  }
3311}
3312module.exports = {
3313  set: setTask,
3314  clear: clearTask
3315};
3316
3317},{"./_cof":35,"./_ctx":38,"./_dom-create":41,"./_global":47,"./_html":50,"./_invoke":52}],93:[function(require,module,exports){
3318var toInteger = require('./_to-integer');
3319var max = Math.max;
3320var min = Math.min;
3321module.exports = function (index, length) {
3322  index = toInteger(index);
3323  return index < 0 ? max(index + length, 0) : min(index, length);
3324};
3325
3326},{"./_to-integer":94}],94:[function(require,module,exports){
3327// 7.1.4 ToInteger
3328var ceil = Math.ceil;
3329var floor = Math.floor;
3330module.exports = function (it) {
3331  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
3332};
3333
3334},{}],95:[function(require,module,exports){
3335// to indexed object, toObject with fallback for non-array-like ES3 strings
3336var IObject = require('./_iobject');
3337var defined = require('./_defined');
3338module.exports = function (it) {
3339  return IObject(defined(it));
3340};
3341
3342},{"./_defined":39,"./_iobject":53}],96:[function(require,module,exports){
3343// 7.1.15 ToLength
3344var toInteger = require('./_to-integer');
3345var min = Math.min;
3346module.exports = function (it) {
3347  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
3348};
3349
3350},{"./_to-integer":94}],97:[function(require,module,exports){
3351// 7.1.13 ToObject(argument)
3352var defined = require('./_defined');
3353module.exports = function (it) {
3354  return Object(defined(it));
3355};
3356
3357},{"./_defined":39}],98:[function(require,module,exports){
3358// 7.1.1 ToPrimitive(input [, PreferredType])
3359var isObject = require('./_is-object');
3360// instead of the ES6 spec version, we didn't implement @@toPrimitive case
3361// and the second argument - flag - preferred type is a string
3362module.exports = function (it, S) {
3363  if (!isObject(it)) return it;
3364  var fn, val;
3365  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
3366  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
3367  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
3368  throw TypeError("Can't convert object to primitive value");
3369};
3370
3371},{"./_is-object":56}],99:[function(require,module,exports){
3372var id = 0;
3373var px = Math.random();
3374module.exports = function (key) {
3375  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
3376};
3377
3378},{}],100:[function(require,module,exports){
3379var global = require('./_global');
3380var navigator = global.navigator;
3381
3382module.exports = navigator && navigator.userAgent || '';
3383
3384},{"./_global":47}],101:[function(require,module,exports){
3385var global = require('./_global');
3386var core = require('./_core');
3387var LIBRARY = require('./_library');
3388var wksExt = require('./_wks-ext');
3389var defineProperty = require('./_object-dp').f;
3390module.exports = function (name) {
3391  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
3392  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
3393};
3394
3395},{"./_core":36,"./_global":47,"./_library":63,"./_object-dp":69,"./_wks-ext":102}],102:[function(require,module,exports){
3396exports.f = require('./_wks');
3397
3398},{"./_wks":103}],103:[function(require,module,exports){
3399var store = require('./_shared')('wks');
3400var uid = require('./_uid');
3401var Symbol = require('./_global').Symbol;
3402var USE_SYMBOL = typeof Symbol == 'function';
3403
3404var $exports = module.exports = function (name) {
3405  return store[name] || (store[name] =
3406    USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
3407};
3408
3409$exports.store = store;
3410
3411},{"./_global":47,"./_shared":89,"./_uid":99}],104:[function(require,module,exports){
3412var classof = require('./_classof');
3413var ITERATOR = require('./_wks')('iterator');
3414var Iterators = require('./_iterators');
3415module.exports = require('./_core').getIteratorMethod = function (it) {
3416  if (it != undefined) return it[ITERATOR]
3417    || it['@@iterator']
3418    || Iterators[classof(it)];
3419};
3420
3421},{"./_classof":34,"./_core":36,"./_iterators":62,"./_wks":103}],105:[function(require,module,exports){
3422'use strict';
3423var ctx = require('./_ctx');
3424var $export = require('./_export');
3425var toObject = require('./_to-object');
3426var call = require('./_iter-call');
3427var isArrayIter = require('./_is-array-iter');
3428var toLength = require('./_to-length');
3429var createProperty = require('./_create-property');
3430var getIterFn = require('./core.get-iterator-method');
3431
3432$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {
3433  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
3434  from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
3435    var O = toObject(arrayLike);
3436    var C = typeof this == 'function' ? this : Array;
3437    var aLen = arguments.length;
3438    var mapfn = aLen > 1 ? arguments[1] : undefined;
3439    var mapping = mapfn !== undefined;
3440    var index = 0;
3441    var iterFn = getIterFn(O);
3442    var length, result, step, iterator;
3443    if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
3444    // if object isn't iterable or it's array with default iterator - use simple case
3445    if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
3446      for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
3447        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
3448      }
3449    } else {
3450      length = toLength(O.length);
3451      for (result = new C(length); length > index; index++) {
3452        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
3453      }
3454    }
3455    result.length = index;
3456    return result;
3457  }
3458});
3459
3460},{"./_create-property":37,"./_ctx":38,"./_export":44,"./_is-array-iter":54,"./_iter-call":57,"./_iter-detect":60,"./_to-length":96,"./_to-object":97,"./core.get-iterator-method":104}],106:[function(require,module,exports){
3461'use strict';
3462var addToUnscopables = require('./_add-to-unscopables');
3463var step = require('./_iter-step');
3464var Iterators = require('./_iterators');
3465var toIObject = require('./_to-iobject');
3466
3467// 22.1.3.4 Array.prototype.entries()
3468// 22.1.3.13 Array.prototype.keys()
3469// 22.1.3.29 Array.prototype.values()
3470// 22.1.3.30 Array.prototype[@@iterator]()
3471module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
3472  this._t = toIObject(iterated); // target
3473  this._i = 0;                   // next index
3474  this._k = kind;                // kind
3475// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
3476}, function () {
3477  var O = this._t;
3478  var kind = this._k;
3479  var index = this._i++;
3480  if (!O || index >= O.length) {
3481    this._t = undefined;
3482    return step(1);
3483  }
3484  if (kind == 'keys') return step(0, index);
3485  if (kind == 'values') return step(0, O[index]);
3486  return step(0, [index, O[index]]);
3487}, 'values');
3488
3489// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
3490Iterators.Arguments = Iterators.Array;
3491
3492addToUnscopables('keys');
3493addToUnscopables('values');
3494addToUnscopables('entries');
3495
3496},{"./_add-to-unscopables":30,"./_iter-define":59,"./_iter-step":61,"./_iterators":62,"./_to-iobject":95}],107:[function(require,module,exports){
3497// 19.1.3.1 Object.assign(target, source)
vendor: 13,848 bytes, lines 3498-3882
3498var $export = require('./_export');
3499
3500$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });
3501
3502},{"./_export":44,"./_object-assign":67}],108:[function(require,module,exports){
3503var $export = require('./_export');
3504// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
3505$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') });
3506
3507},{"./_descriptors":40,"./_export":44,"./_object-dps":70}],109:[function(require,module,exports){
3508var $export = require('./_export');
3509// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
3510$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });
3511
3512},{"./_descriptors":40,"./_export":44,"./_object-dp":69}],110:[function(require,module,exports){
3513// 19.1.2.9 Object.getPrototypeOf(O)
3514var toObject = require('./_to-object');
3515var $getPrototypeOf = require('./_object-gpo');
3516
3517require('./_object-sap')('getPrototypeOf', function () {
3518  return function getPrototypeOf(it) {
3519    return $getPrototypeOf(toObject(it));
3520  };
3521});
3522
3523},{"./_object-gpo":75,"./_object-sap":79,"./_to-object":97}],111:[function(require,module,exports){
3524// 19.1.2.14 Object.keys(O)
3525var toObject = require('./_to-object');
3526var $keys = require('./_object-keys');
3527
3528require('./_object-sap')('keys', function () {
3529  return function keys(it) {
3530    return $keys(toObject(it));
3531  };
3532});
3533
3534},{"./_object-keys":77,"./_object-sap":79,"./_to-object":97}],112:[function(require,module,exports){
3535
3536},{}],113:[function(require,module,exports){
3537'use strict';
3538var LIBRARY = require('./_library');
3539var global = require('./_global');
3540var ctx = require('./_ctx');
3541var classof = require('./_classof');
3542var $export = require('./_export');
3543var isObject = require('./_is-object');
3544var aFunction = require('./_a-function');
3545var anInstance = require('./_an-instance');
3546var forOf = require('./_for-of');
3547var speciesConstructor = require('./_species-constructor');
3548var task = require('./_task').set;
3549var microtask = require('./_microtask')();
3550var newPromiseCapabilityModule = require('./_new-promise-capability');
3551var perform = require('./_perform');
3552var userAgent = require('./_user-agent');
3553var promiseResolve = require('./_promise-resolve');
3554var PROMISE = 'Promise';
3555var TypeError = global.TypeError;
3556var process = global.process;
3557var versions = process && process.versions;
3558var v8 = versions && versions.v8 || '';
3559var $Promise = global[PROMISE];
3560var isNode = classof(process) == 'process';
3561var empty = function () { /* empty */ };
3562var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
3563var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
3564
3565var USE_NATIVE = !!function () {
3566  try {
3567    // correct subclassing with @@species support
3568    var promise = $Promise.resolve(1);
3569    var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {
3570      exec(empty, empty);
3571    };
3572    // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3573    return (isNode || typeof PromiseRejectionEvent == 'function')
3574      && promise.then(empty) instanceof FakePromise
3575      // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3576      // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3577      // we can't detect it synchronously, so just check versions
3578      && v8.indexOf('6.6') !== 0
3579      && userAgent.indexOf('Chrome/66') === -1;
3580  } catch (e) { /* empty */ }
3581}();
3582
3583// helpers
3584var isThenable = function (it) {
3585  var then;
3586  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
3587};
3588var notify = function (promise, isReject) {
3589  if (promise._n) return;
3590  promise._n = true;
3591  var chain = promise._c;
3592  microtask(function () {
3593    var value = promise._v;
3594    var ok = promise._s == 1;
3595    var i = 0;
3596    var run = function (reaction) {
3597      var handler = ok ? reaction.ok : reaction.fail;
3598      var resolve = reaction.resolve;
3599      var reject = reaction.reject;
3600      var domain = reaction.domain;
3601      var result, then, exited;
3602      try {
3603        if (handler) {
3604          if (!ok) {
3605            if (promise._h == 2) onHandleUnhandled(promise);
3606            promise._h = 1;
3607          }
3608          if (handler === true) result = value;
3609          else {
3610            if (domain) domain.enter();
3611            result = handler(value); // may throw
3612            if (domain) {
3613              domain.exit();
3614              exited = true;
3615            }
3616          }
3617          if (result === reaction.promise) {
3618            reject(TypeError('Promise-chain cycle'));
3619          } else if (then = isThenable(result)) {
3620            then.call(result, resolve, reject);
3621          } else resolve(result);
3622        } else reject(value);
3623      } catch (e) {
3624        if (domain && !exited) domain.exit();
3625        reject(e);
3626      }
3627    };
3628    while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
3629    promise._c = [];
3630    promise._n = false;
3631    if (isReject && !promise._h) onUnhandled(promise);
3632  });
3633};
3634var onUnhandled = function (promise) {
3635  task.call(global, function () {
3636    var value = promise._v;
3637    var unhandled = isUnhandled(promise);
3638    var result, handler, console;
3639    if (unhandled) {
3640      result = perform(function () {
3641        if (isNode) {
3642          process.emit('unhandledRejection', value, promise);
3643        } else if (handler = global.onunhandledrejection) {
3644          handler({ promise: promise, reason: value });
3645        } else if ((console = global.console) && console.error) {
3646          console.error('Unhandled promise rejection', value);
3647        }
3648      });
3649      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
3650      promise._h = isNode || isUnhandled(promise) ? 2 : 1;
3651    } promise._a = undefined;
3652    if (unhandled && result.e) throw result.v;
3653  });
3654};
3655var isUnhandled = function (promise) {
3656  return promise._h !== 1 && (promise._a || promise._c).length === 0;
3657};
3658var onHandleUnhandled = function (promise) {
3659  task.call(global, function () {
3660    var handler;
3661    if (isNode) {
3662      process.emit('rejectionHandled', promise);
3663    } else if (handler = global.onrejectionhandled) {
3664      handler({ promise: promise, reason: promise._v });
3665    }
3666  });
3667};
3668var $reject = function (value) {
3669  var promise = this;
3670  if (promise._d) return;
3671  promise._d = true;
3672  promise = promise._w || promise; // unwrap
3673  promise._v = value;
3674  promise._s = 2;
3675  if (!promise._a) promise._a = promise._c.slice();
3676  notify(promise, true);
3677};
3678var $resolve = function (value) {
3679  var promise = this;
3680  var then;
3681  if (promise._d) return;
3682  promise._d = true;
3683  promise = promise._w || promise; // unwrap
3684  try {
3685    if (promise === value) throw TypeError("Promise can't be resolved itself");
3686    if (then = isThenable(value)) {
3687      microtask(function () {
3688        var wrapper = { _w: promise, _d: false }; // wrap
3689        try {
3690          then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
3691        } catch (e) {
3692          $reject.call(wrapper, e);
3693        }
3694      });
3695    } else {
3696      promise._v = value;
3697      promise._s = 1;
3698      notify(promise, false);
3699    }
3700  } catch (e) {
3701    $reject.call({ _w: promise, _d: false }, e); // wrap
3702  }
3703};
3704
3705// constructor polyfill
3706if (!USE_NATIVE) {
3707  // 25.4.3.1 Promise(executor)
3708  $Promise = function Promise(executor) {
3709    anInstance(this, $Promise, PROMISE, '_h');
3710    aFunction(executor);
3711    Internal.call(this);
3712    try {
3713      executor(ctx($resolve, this, 1), ctx($reject, this, 1));
3714    } catch (err) {
3715      $reject.call(this, err);
3716    }
3717  };
3718  // eslint-disable-next-line no-unused-vars
3719  Internal = function Promise(executor) {
3720    this._c = [];             // <- awaiting reactions
3721    this._a = undefined;      // <- checked in isUnhandled reactions
3722    this._s = 0;              // <- state
3723    this._d = false;          // <- done
3724    this._v = undefined;      // <- value
3725    this._h = 0;              // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
3726    this._n = false;          // <- notify
3727  };
3728  Internal.prototype = require('./_redefine-all')($Promise.prototype, {
3729    // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
3730    then: function then(onFulfilled, onRejected) {
3731      var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
3732      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
3733      reaction.fail = typeof onRejected == 'function' && onRejected;
3734      reaction.domain = isNode ? process.domain : undefined;
3735      this._c.push(reaction);
3736      if (this._a) this._a.push(reaction);
3737      if (this._s) notify(this, false);
3738      return reaction.promise;
3739    },
3740    // 25.4.5.1 Promise.prototype.catch(onRejected)
3741    'catch': function (onRejected) {
3742      return this.then(undefined, onRejected);
3743    }
3744  });
3745  OwnPromiseCapability = function () {
3746    var promise = new Internal();
3747    this.promise = promise;
3748    this.resolve = ctx($resolve, promise, 1);
3749    this.reject = ctx($reject, promise, 1);
3750  };
3751  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
3752    return C === $Promise || C === Wrapper
3753      ? new OwnPromiseCapability(C)
3754      : newGenericPromiseCapability(C);
3755  };
3756}
3757
3758$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
3759require('./_set-to-string-tag')($Promise, PROMISE);
3760require('./_set-species')(PROMISE);
3761Wrapper = require('./_core')[PROMISE];
3762
3763// statics
3764$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
3765  // 25.4.4.5 Promise.reject(r)
3766  reject: function reject(r) {
3767    var capability = newPromiseCapability(this);
3768    var $$reject = capability.reject;
3769    $$reject(r);
3770    return capability.promise;
3771  }
3772});
3773$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
3774  // 25.4.4.6 Promise.resolve(x)
3775  resolve: function resolve(x) {
3776    return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
3777  }
3778});
3779$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {
3780  $Promise.all(iter)['catch'](empty);
3781})), PROMISE, {
3782  // 25.4.4.1 Promise.all(iterable)
3783  all: function all(iterable) {
3784    var C = this;
3785    var capability = newPromiseCapability(C);
3786    var resolve = capability.resolve;
3787    var reject = capability.reject;
3788    var result = perform(function () {
3789      var values = [];
3790      var index = 0;
3791      var remaining = 1;
3792      forOf(iterable, false, function (promise) {
3793        var $index = index++;
3794        var alreadyCalled = false;
3795        values.push(undefined);
3796        remaining++;
3797        C.resolve(promise).then(function (value) {
3798          if (alreadyCalled) return;
3799          alreadyCalled = true;
3800          values[$index] = value;
3801          --remaining || resolve(values);
3802        }, reject);
3803      });
3804      --remaining || resolve(values);
3805    });
3806    if (result.e) reject(result.v);
3807    return capability.promise;
3808  },
3809  // 25.4.4.4 Promise.race(iterable)
3810  race: function race(iterable) {
3811    var C = this;
3812    var capability = newPromiseCapability(C);
3813    var reject = capability.reject;
3814    var result = perform(function () {
3815      forOf(iterable, false, function (promise) {
3816        C.resolve(promise).then(capability.resolve, reject);
3817      });
3818    });
3819    if (result.e) reject(result.v);
3820    return capability.promise;
3821  }
3822});
3823
3824},{"./_a-function":29,"./_an-instance":31,"./_classof":34,"./_core":36,"./_ctx":38,"./_export":44,"./_for-of":46,"./_global":47,"./_is-object":56,"./_iter-detect":60,"./_library":63,"./_microtask":65,"./_new-promise-capability":66,"./_perform":81,"./_promise-resolve":82,"./_redefine-all":84,"./_set-species":86,"./_set-to-string-tag":87,"./_species-constructor":90,"./_task":92,"./_user-agent":100,"./_wks":103}],114:[function(require,module,exports){
3825'use strict';
3826var $at = require('./_string-at')(true);
3827
3828// 21.1.3.27 String.prototype[@@iterator]()
3829require('./_iter-define')(String, 'String', function (iterated) {
3830  this._t = String(iterated); // target
3831  this._i = 0;                // next index
3832// 21.1.5.2.1 %StringIteratorPrototype%.next()
3833}, function () {
3834  var O = this._t;
3835  var index = this._i;
3836  var point;
3837  if (index >= O.length) return { value: undefined, done: true };
3838  point = $at(O, index);
3839  this._i += point.length;
3840  return { value: point, done: false };
3841});
3842
3843},{"./_iter-define":59,"./_string-at":91}],115:[function(require,module,exports){
3844'use strict';
3845// ECMAScript 6 symbols shim
3846var global = require('./_global');
3847var has = require('./_has');
3848var DESCRIPTORS = require('./_descriptors');
3849var $export = require('./_export');
3850var redefine = require('./_redefine');
3851var META = require('./_meta').KEY;
3852var $fails = require('./_fails');
3853var shared = require('./_shared');
3854var setToStringTag = require('./_set-to-string-tag');
3855var uid = require('./_uid');
3856var wks = require('./_wks');
3857var wksExt = require('./_wks-ext');
3858var wksDefine = require('./_wks-define');
3859var enumKeys = require('./_enum-keys');
3860var isArray = require('./_is-array');
3861var anObject = require('./_an-object');
3862var isObject = require('./_is-object');
3863var toIObject = require('./_to-iobject');
3864var toPrimitive = require('./_to-primitive');
3865var createDesc = require('./_property-desc');
3866var _create = require('./_object-create');
3867var gOPNExt = require('./_object-gopn-ext');
3868var $GOPD = require('./_object-gopd');
3869var $DP = require('./_object-dp');
3870var $keys = require('./_object-keys');
3871var gOPD = $GOPD.f;
3872var dP = $DP.f;
3873var gOPN = gOPNExt.f;
3874var $Symbol = global.Symbol;
3875var $JSON = global.JSON;
3876var _stringify = $JSON && $JSON.stringify;
3877var PROTOTYPE = 'prototype';
3878var HIDDEN = wks('_hidden');
3879var TO_PRIMITIVE = wks('toPrimitive');
3880var isEnum = {}.propertyIsEnumerable;
3881var SymbolRegistry = shared('symbol-registry');
3882var AllSymbols = shared('symbols');
vendor: 4,504 bytes, lines 3883-4007
3883var OPSymbols = shared('op-symbols');
3884var ObjectProto = Object[PROTOTYPE];
3885var USE_NATIVE = typeof $Symbol == 'function';
3886var QObject = global.QObject;
3887// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
3888var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
3889
3890// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
3891var setSymbolDesc = DESCRIPTORS && $fails(function () {
3892  return _create(dP({}, 'a', {
3893    get: function () { return dP(this, 'a', { value: 7 }).a; }
3894  })).a != 7;
3895}) ? function (it, key, D) {
3896  var protoDesc = gOPD(ObjectProto, key);
3897  if (protoDesc) delete ObjectProto[key];
3898  dP(it, key, D);
3899  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
3900} : dP;
3901
3902var wrap = function (tag) {
3903  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
3904  sym._k = tag;
3905  return sym;
3906};
3907
3908var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
3909  return typeof it == 'symbol';
3910} : function (it) {
3911  return it instanceof $Symbol;
3912};
3913
3914var $defineProperty = function defineProperty(it, key, D) {
3915  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
3916  anObject(it);
3917  key = toPrimitive(key, true);
3918  anObject(D);
3919  if (has(AllSymbols, key)) {
3920    if (!D.enumerable) {
3921      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
3922      it[HIDDEN][key] = true;
3923    } else {
3924      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
3925      D = _create(D, { enumerable: createDesc(0, false) });
3926    } return setSymbolDesc(it, key, D);
3927  } return dP(it, key, D);
3928};
3929var $defineProperties = function defineProperties(it, P) {
3930  anObject(it);
3931  var keys = enumKeys(P = toIObject(P));
3932  var i = 0;
3933  var l = keys.length;
3934  var key;
3935  while (l > i) $defineProperty(it, key = keys[i++], P[key]);
3936  return it;
3937};
3938var $create = function create(it, P) {
3939  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
3940};
3941var $propertyIsEnumerable = function propertyIsEnumerable(key) {
3942  var E = isEnum.call(this, key = toPrimitive(key, true));
3943  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
3944  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
3945};
3946var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
3947  it = toIObject(it);
3948  key = toPrimitive(key, true);
3949  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
3950  var D = gOPD(it, key);
3951  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
3952  return D;
3953};
3954var $getOwnPropertyNames = function getOwnPropertyNames(it) {
3955  var names = gOPN(toIObject(it));
3956  var result = [];
3957  var i = 0;
3958  var key;
3959  while (names.length > i) {
3960    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
3961  } return result;
3962};
3963var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
3964  var IS_OP = it === ObjectProto;
3965  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
3966  var result = [];
3967  var i = 0;
3968  var key;
3969  while (names.length > i) {
3970    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
3971  } return result;
3972};
3973
3974// 19.4.1.1 Symbol([description])
3975if (!USE_NATIVE) {
3976  $Symbol = function Symbol() {
3977    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
3978    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
3979    var $set = function (value) {
3980      if (this === ObjectProto) $set.call(OPSymbols, value);
3981      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
3982      setSymbolDesc(this, tag, createDesc(1, value));
3983    };
3984    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
3985    return wrap(tag);
3986  };
3987  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
3988    return this._k;
3989  });
3990
3991  $GOPD.f = $getOwnPropertyDescriptor;
3992  $DP.f = $defineProperty;
3993  require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
3994  require('./_object-pie').f = $propertyIsEnumerable;
3995  require('./_object-gops').f = $getOwnPropertySymbols;
3996
3997  if (DESCRIPTORS && !require('./_library')) {
3998    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
3999  }
4000
4001  wksExt.f = function (name) {
4002    return wrap(wks(name));
4003  };
4004}
4005
4006$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
4007
vendor: 4,829 bytes, lines 4008-4114
4008for (var es6Symbols = (
4009  // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
4010  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
4011).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
4012
4013for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
4014
4015$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
4016  // 19.4.2.1 Symbol.for(key)
4017  'for': function (key) {
4018    return has(SymbolRegistry, key += '')
4019      ? SymbolRegistry[key]
4020      : SymbolRegistry[key] = $Symbol(key);
4021  },
4022  // 19.4.2.5 Symbol.keyFor(sym)
4023  keyFor: function keyFor(sym) {
4024    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
4025    for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
4026  },
4027  useSetter: function () { setter = true; },
4028  useSimple: function () { setter = false; }
4029});
4030
4031$export($export.S + $export.F * !USE_NATIVE, 'Object', {
4032  // 19.1.2.2 Object.create(O [, Properties])
4033  create: $create,
4034  // 19.1.2.4 Object.defineProperty(O, P, Attributes)
4035  defineProperty: $defineProperty,
4036  // 19.1.2.3 Object.defineProperties(O, Properties)
4037  defineProperties: $defineProperties,
4038  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
4039  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
4040  // 19.1.2.7 Object.getOwnPropertyNames(O)
4041  getOwnPropertyNames: $getOwnPropertyNames,
4042  // 19.1.2.8 Object.getOwnPropertySymbols(O)
4043  getOwnPropertySymbols: $getOwnPropertySymbols
4044});
4045
4046// 24.3.2 JSON.stringify(value [, replacer [, space]])
4047$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
4048  var S = $Symbol();
4049  // MS Edge converts symbol values to JSON as {}
4050  // WebKit converts symbol values to JSON as null
4051  // V8 throws on boxed symbols
4052  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
4053})), 'JSON', {
4054  stringify: function stringify(it) {
4055    var args = [it];
4056    var i = 1;
4057    var replacer, $replacer;
4058    while (arguments.length > i) args.push(arguments[i++]);
4059    $replacer = replacer = args[1];
4060    if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
4061    if (!isArray(replacer)) replacer = function (key, value) {
4062      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
4063      if (!isSymbol(value)) return value;
4064    };
4065    args[1] = replacer;
4066    return _stringify.apply($JSON, args);
4067  }
4068});
4069
4070// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
4071$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
4072// 19.4.3.5 Symbol.prototype[@@toStringTag]
4073setToStringTag($Symbol, 'Symbol');
4074// 20.2.1.9 Math[@@toStringTag]
4075setToStringTag(Math, 'Math', true);
4076// 24.3.3 JSON[@@toStringTag]
4077setToStringTag(global.JSON, 'JSON', true);
4078
4079},{"./_an-object":32,"./_descriptors":40,"./_enum-keys":43,"./_export":44,"./_fails":45,"./_global":47,"./_has":48,"./_hide":49,"./_is-array":55,"./_is-object":56,"./_library":63,"./_meta":64,"./_object-create":68,"./_object-dp":69,"./_object-gopd":71,"./_object-gopn":73,"./_object-gopn-ext":72,"./_object-gops":74,"./_object-keys":77,"./_object-pie":78,"./_property-desc":83,"./_redefine":85,"./_set-to-string-tag":87,"./_shared":89,"./_to-iobject":95,"./_to-primitive":98,"./_uid":99,"./_wks":103,"./_wks-define":101,"./_wks-ext":102}],116:[function(require,module,exports){
4080// https://github.com/tc39/proposal-object-values-entries
4081var $export = require('./_export');
4082var $values = require('./_object-to-array')(false);
4083
4084$export($export.S, 'Object', {
4085  values: function values(it) {
4086    return $values(it);
4087  }
4088});
4089
4090},{"./_export":44,"./_object-to-array":80}],117:[function(require,module,exports){
4091// https://github.com/tc39/proposal-promise-finally
4092'use strict';
4093var $export = require('./_export');
4094var core = require('./_core');
4095var global = require('./_global');
4096var speciesConstructor = require('./_species-constructor');
4097var promiseResolve = require('./_promise-resolve');
4098
4099$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
4100  var C = speciesConstructor(this, core.Promise || global.Promise);
4101  var isFunction = typeof onFinally == 'function';
4102  return this.then(
4103    isFunction ? function (x) {
4104      return promiseResolve(C, onFinally()).then(function () { return x; });
4105    } : onFinally,
4106    isFunction ? function (e) {
4107      return promiseResolve(C, onFinally()).then(function () { throw e; });
4108    } : onFinally
4109  );
4110} });
4111
4112},{"./_core":36,"./_export":44,"./_global":47,"./_promise-resolve":82,"./_species-constructor":90}],118:[function(require,module,exports){
4113'use strict';
4114// https://github.com/tc39/proposal-promise-try
4115var $export = require('./_export');
4116var newPromiseCapability = require('./_new-promise-capability');
4117var perform = require('./_perform');
4118
4119$export($export.S, 'Promise', { 'try': function (callbackfn) {
4120  var promiseCapability = newPromiseCapability.f(this);
4121  var result = perform(callbackfn);
4122  (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
4123  return promiseCapability.promise;
4124} });
4125
4126},{"./_export":44,"./_new-promise-capability":66,"./_perform":81}],119:[function(require,module,exports){
4127require('./_wks-define')('asyncIterator');
4128
4129},{"./_wks-define":101}],120:[function(require,module,exports){
4130require('./_wks-define')('observable');
4131
4132},{"./_wks-define":101}],121:[function(require,module,exports){
4133require('./es6.array.iterator');
4134var global = require('./_global');
4135var hide = require('./_hide');
4136var Iterators = require('./_iterators');
4137var TO_STRING_TAG = require('./_wks')('toStringTag');
4138
4139var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
4140  'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
4141  'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
4142  'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
4143  'TextTrackList,TouchList').split(',');
4144
4145for (var i = 0; i < DOMIterables.length; i++) {
4146  var NAME = DOMIterables[i];
4147  var Collection = global[NAME];
4148  var proto = Collection && Collection.prototype;
4149  if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
4150  Iterators[NAME] = Iterators.Array;
4151}
4152
4153},{"./_global":47,"./_hide":49,"./_iterators":62,"./_wks":103,"./es6.array.iterator":106}],122:[function(require,module,exports){
4154(function webpackUniversalModuleDefinition(root, factory) {
4155	if(typeof exports === 'object' && typeof module === 'object')
4156		module.exports = factory();
4157	else if(typeof define === 'function' && define.amd)
4158		define("EffectiveInterestCalculator", [], factory);
4159	else if(typeof exports === 'object')
4160		exports["EffectiveInterestCalculator"] = factory();
4161	else
4162		root["EffectiveInterestCalculator"] = factory();
4163})(this, function() {
4164return /******/ (function(modules) { // webpackBootstrap
4165/******/ 	// The module cache
4166/******/ 	var installedModules = {};
4167/******/
4168/******/ 	// The require function
4169/******/ 	function __webpack_require__(moduleId) {
4170/******/
4171/******/ 		// Check if module is in cache
4172/******/ 		if(installedModules[moduleId])
4173/******/ 			return installedModules[moduleId].exports;
4174/******/
4175/******/ 		// Create a new module (and put it into the cache)
4176/******/ 		var module = installedModules[moduleId] = {
4177/******/ 			exports: {},
4178/******/ 			id: moduleId,
4179/******/ 			loaded: false
4180/******/ 		};
4181/******/
4182/******/ 		// Execute the module function
4183/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
4184/******/
4185/******/ 		// Flag the module as loaded
4186/******/ 		module.loaded = true;
4187/******/
4188/******/ 		// Return the exports of the module
4189/******/ 		return module.exports;
4190/******/ 	}
4191/******/
4192/******/
4193/******/ 	// expose the modules object (__webpack_modules__)
4194/******/ 	__webpack_require__.m = modules;
4195/******/
4196/******/ 	// expose the module cache
4197/******/ 	__webpack_require__.c = installedModules;
4198/******/
4199/******/ 	// __webpack_public_path__
4200/******/ 	__webpack_require__.p = "";
4201/******/
4202/******/ 	// Load entry module and return exports
4203/******/ 	return __webpack_require__(0);
4204/******/ })
4205/************************************************************************/
4206/******/ ([
4207/* 0 */
4208/***/ function(module, exports, __webpack_require__) {
4209
4210	'use strict';
4211	
4212	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4213	
4214	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4215	
4216	var NewtonRaphson = __webpack_require__(1);
4217	
4218	var EffectiveInterestCalculator = function () {
4219	  function EffectiveInterestCalculator() {
4220	    _classCallCheck(this, EffectiveInterestCalculator);
4221	  }
4222	
4223	  _createClass(EffectiveInterestCalculator, null, [{
4224	    key: 'withSpecifiedPayments',
4225	
4226	
4227	    /**
4228	     * Get the interest when you know all the payments and their dates. Use this function when you have
4229	     * administration fees at the first payment and/or when payments are irregular.
4230	     *
4231	     * @param principal
4232	     * @param startDateString in format 'YYYY-mm-dd'
4233	     * @param payments        array with payment dates and values ['YYYY-mm-dd'=>int]
4234	     * @param guess           A guess what the interest may be. Between zero and one. Example 0.045
4235	     *
4236	     * @return float
4237	     */
4238	    value: function withSpecifiedPayments(principal, startDateString, payments, guess) {
4239	      var values = [-1 * principal];
4240	      var days = [1];
4241	      var startDate = new Date(startDateString);
4242	
4243	      Object.keys(payments).forEach(function (date) {
4244	        values.push(payments[date]);
4245	        days.push(1 + Math.ceil(Math.abs(new Date(date).getTime() - startDate.getTime()) / (1000 * 3600 * 24)));
4246	      });
4247	
4248	      var fx = function fx(x) {
4249	        var sum = 0;
4250	
4251	        days.forEach(function (day, idx) {
4252	          sum += values[idx] * Math.pow(1 + x, (days[0] - day) / 365);
4253	        });
4254	
4255	        return sum;
4256	      };
4257	
4258	      var fdx = function fdx(x) {
4259	        var sum = 0;
4260	
4261	        days.forEach(function (day, idx) {
4262	          sum += 1 / 365 * (days[0] - day) * values[idx] * Math.pow(1 + x, (days[0] - day) / 365 - 1);
4263	        });
4264	
4265	        return sum;
4266	      };
4267	
4268	      return NewtonRaphson.run(fx, fdx, guess);
4269	    }
4270	
4271	    /**
4272	     * Get the effective interest when the monthly payments are exactly the same.
4273	     *
4274	     * @param principal      The total loan amount (Principal)
4275	     * @param payment        The monthly payment
4276	     * @param numberOfMonths The number of months
4277	     * @param guess          A guess of what the interest might be. Interest as a number between zero and one.
4278	     *                       Example 0.045
4279	     *
4280	     * @return float
4281	     */
4282	
4283	  }, {
4284	    key: 'withEqualPayments',
4285	    value: function withEqualPayments(principal, payment, numberOfMonths, guess) {
4286	
4287	      var fx = function fx(x) {
4288	        return payment - payment * Math.pow(1 + x, -1 * numberOfMonths) - x * principal;
4289	      };
4290	
4291	      var fdx = function fdx(x) {
4292	        return numberOfMonths * payment * Math.pow(1 + x, -1 * numberOfMonths - 1) - principal;
4293	      };
4294	
4295	      return 12 * NewtonRaphson.run(fx, fdx, guess);
4296	    }
4297	  }]);
4298	
4299	  return EffectiveInterestCalculator;
4300	}();
4301	
4302	module.exports = EffectiveInterestCalculator;
4303
4304/***/ },
4305/* 1 */
4306/***/ function(module, exports) {
4307
4308	'use strict';
4309	
4310	/**
4311	 * Newton-Raphsons method to do a numerical analysis to find the effective interest.
4312	 *
4313	 * {@link https://en.wikipedia.org/wiki/Newton%27s_method}
4314	 *
4315	 * @author Tobias Nyholm <[email protected]>
4316	 */
4317	
4318	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4319	
4320	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4321	
4322	var NewtonRaphson = function () {
4323	  function NewtonRaphson() {
4324	    _classCallCheck(this, NewtonRaphson);
4325	  }
4326	
4327	  _createClass(NewtonRaphson, null, [{
4328	    key: 'run',
4329	    value: function run(fx, fdx, guess) {
4330	      var precision = 4;
4331	      var errorLimit = Math.pow(10, -1 * precision);
4332	      var previousValue = 0;
4333	
4334	      do {
4335	        guess = Number(guess);
4336	        previousValue = Number(guess);
4337	        guess = previousValue - Number(fx(guess)) / Number(fdx(guess));
4338	      } while (Math.abs(guess - previousValue) > errorLimit);
4339	
4340	      return guess;
4341	    }
4342	  }]);
4343	
4344	  return NewtonRaphson;
4345	}();
4346	
4347	module.exports = NewtonRaphson;
4348
4349/***/ }
4350/******/ ])
4351});
4352;
4353
4354},{}],123:[function(require,module,exports){
4355(function (factory) {
4356    if (typeof define === 'function' && define.amd) {
4357        define(['jquery'], factory);
4358    } else if (typeof module === 'object' && module.exports) {
4359        module.exports = factory(require('jquery'));
4360    } else {
4361        factory(jQuery);
4362    }
4363}(function (jQuery) {
4364    /*!
4365     * jQuery Cycle2; version: 2.1.6 build: 20141007
4366     * http://jquery.malsup.com/cycle2/
4367     * Copyright (c) 2014 M. Alsup; Dual licensed: MIT/GPL
4368     */
4369    
vendor: 10,280 bytes, line 4369
4369!function(a){"use strict";function b(a){return(a||"").toLowerCase()}var c="2.1.6";a.fn.cycle=function(c){var d;return 0!==this.length||a.isReady?this.each(function(){var d,e,f,g,h=a(this),i=a.fn.cycle.log;if(!h.data("cycle.opts")){(h.data("cycle-log")===!1||c&&c.log===!1||e&&e.log===!1)&&(i=a.noop),i("--c2 init--"),d=h.data();for(var j in d)d.hasOwnProperty(j)&&/^cycle[A-Z]+/.test(j)&&(g=d[j],f=j.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,b),i(f+":",g,"("+typeof g+")"),d[f]=g);e=a.extend({},a.fn.cycle.defaults,d,c||{}),e.timeoutId=0,e.paused=e.paused||!1,e.container=h,e._maxZ=e.maxZ,e.API=a.extend({_container:h},a.fn.cycle.API),e.API.log=i,e.API.trigger=function(a,b){return e.container.trigger(a,b),e.API},h.data("cycle.opts",e),h.data("cycle.API",e.API),e.API.trigger("cycle-bootstrap",[e,e.API]),e.API.addInitialSlides(),e.API.preInitSlideshow(),e.slides.length&&e.API.initSlideshow()}}):(d={s:this.selector,c:this.context},a.fn.cycle.log("requeuing slideshow (dom not ready)"),a(function(){a(d.s,d.c).cycle(c)}),this)},a.fn.cycle.API={opts:function(){return this._container.data("cycle.opts")},addInitialSlides:function(){var b=this.opts(),c=b.slides;b.slideCount=0,b.slides=a(),c=c.jquery?c:b.container.find(c),b.random&&c.sort(function(){return Math.random()-.5}),b.API.add(c)},preInitSlideshow:function(){var b=this.opts();b.API.trigger("cycle-pre-initialize",[b]);var c=a.fn.cycle.transitions[b.fx];c&&a.isFunction(c.preInit)&&c.preInit(b),b._preInitialized=!0},postInitSlideshow:function(){var b=this.opts();b.API.trigger("cycle-post-initialize",[b]);var c=a.fn.cycle.transitions[b.fx];c&&a.isFunction(c.postInit)&&c.postInit(b)},initSlideshow:function(){var b,c=this.opts(),d=c.container;c.API.calcFirstSlide(),"static"==c.container.css("position")&&c.container.css("position","relative"),a(c.slides[c.currSlide]).css({opacity:1,display:"block",visibility:"visible"}),c.API.stackSlides(c.slides[c.currSlide],c.slides[c.nextSlide],!c.reverse),c.pauseOnHover&&(c.pauseOnHover!==!0&&(d=a(c.pauseOnHover)),d.hover(function(){c.API.pause(!0)},function(){c.API.resume(!0)})),c.timeout&&(b=c.API.getSlideOpts(c.currSlide),c.API.queueTransition(b,b.timeout+c.delay)),c._initialized=!0,c.API.updateView(!0),c.API.trigger("cycle-initialized",[c]),c.API.postInitSlideshow()},pause:function(b){var c=this.opts(),d=c.API.getSlideOpts(),e=c.hoverPaused||c.paused;b?c.hoverPaused=!0:c.paused=!0,e||(c.container.addClass("cycle-paused"),c.API.trigger("cycle-paused",[c]).log("cycle-paused"),d.timeout&&(clearTimeout(c.timeoutId),c.timeoutId=0,c._remainingTimeout-=a.now()-c._lastQueue,(c._remainingTimeout<0||isNaN(c._remainingTimeout))&&(c._remainingTimeout=void 0)))},resume:function(a){var b=this.opts(),c=!b.hoverPaused&&!b.paused;a?b.hoverPaused=!1:b.paused=!1,c||(b.container.removeClass("cycle-paused"),0===b.slides.filter(":animated").length&&b.API.queueTransition(b.API.getSlideOpts(),b._remainingTimeout),b.API.trigger("cycle-resumed",[b,b._remainingTimeout]).log("cycle-resumed"))},add:function(b,c){var d,e=this.opts(),f=e.slideCount,g=!1;"string"==a.type(b)&&(b=a.trim(b)),a(b).each(function(){var b,d=a(this);c?e.container.prepend(d):e.container.append(d),e.slideCount++,b=e.API.buildSlideOpts(d),e.slides=c?a(d).add(e.slides):e.slides.add(d),e.API.initSlide(b,d,--e._maxZ),d.data("cycle.opts",b),e.API.trigger("cycle-slide-added",[e,b,d])}),e.API.updateView(!0),g=e._preInitialized&&2>f&&e.slideCount>=1,g&&(e._initialized?e.timeout&&(d=e.slides.length,e.nextSlide=e.reverse?d-1:1,e.timeoutId||e.API.queueTransition(e)):e.API.initSlideshow())},calcFirstSlide:function(){var a,b=this.opts();a=parseInt(b.startingSlide||0,10),(a>=b.slides.length||0>a)&&(a=0),b.currSlide=a,b.reverse?(b.nextSlide=a-1,b.nextSlide<0&&(b.nextSlide=b.slides.length-1)):(b.nextSlide=a+1,b.nextSlide==b.slides.length&&(b.nextSlide=0))},calcNextSlide:function(){var a,b=this.opts();b.reverse?(a=b.nextSlide-1<0,b.nextSlide=a?b.slideCount-1:b.nextSlide-1,b.currSlide=a?0:b.nextSlide+1):(a=b.nextSlide+1==b.slides.length,b.nextSlide=a?0:b.nextSlide+1,b.currSlide=a?b.slides.length-1:b.nextSlide-1)},calcTx:function(b,c){var d,e=b;return e._tempFx?d=a.fn.cycle.transitions[e._tempFx]:c&&e.manualFx&&(d=a.fn.cycle.transitions[e.manualFx]),d||(d=a.fn.cycle.transitions[e.fx]),e._tempFx=null,this.opts()._tempFx=null,d||(d=a.fn.cycle.transitions.fade,e.API.log('Transition "'+e.fx+'" not found.  Using fade.')),d},prepareTx:function(a,b){var c,d,e,f,g,h=this.opts();return h.slideCount<2?void(h.timeoutId=0):(!a||h.busy&&!h.manualTrump||(h.API.stopTransition(),h.busy=!1,clearTimeout(h.timeoutId),h.timeoutId=0),void(h.busy||(0!==h.timeoutId||a)&&(d=h.slides[h.currSlide],e=h.slides[h.nextSlide],f=h.API.getSlideOpts(h.nextSlide),g=h.API.calcTx(f,a),h._tx=g,a&&void 0!==f.manualSpeed&&(f.speed=f.manualSpeed),h.nextSlide!=h.currSlide&&(a||!h.paused&&!h.hoverPaused&&h.timeout)?(h.API.trigger("cycle-before",[f,d,e,b]),g.before&&g.before(f,d,e,b),c=function(){h.busy=!1,h.container.data("cycle.opts")&&(g.after&&g.after(f,d,e,b),h.API.trigger("cycle-after",[f,d,e,b]),h.API.queueTransition(f),h.API.updateView(!0))},h.busy=!0,g.transition?g.transition(f,d,e,b,c):h.API.doTransition(f,d,e,b,c),h.API.calcNextSlide(),h.API.updateView()):h.API.queueTransition(f))))},doTransition:function(b,c,d,e,f){var g=b,h=a(c),i=a(d),j=function(){i.animate(g.animIn||{opacity:1},g.speed,g.easeIn||g.easing,f)};i.css(g.cssBefore||{}),h.animate(g.animOut||{},g.speed,g.easeOut||g.easing,function(){h.css(g.cssAfter||{}),g.sync||j()}),g.sync&&j()},queueTransition:function(b,c){var d=this.opts(),e=void 0!==c?c:b.timeout;return 0===d.nextSlide&&0===--d.loop?(d.API.log("terminating; loop=0"),d.timeout=0,e?setTimeout(function(){d.API.trigger("cycle-finished",[d])},e):d.API.trigger("cycle-finished",[d]),void(d.nextSlide=d.currSlide)):void 0!==d.continueAuto&&(d.continueAuto===!1||a.isFunction(d.continueAuto)&&d.continueAuto()===!1)?(d.API.log("terminating automatic transitions"),d.timeout=0,void(d.timeoutId&&clearTimeout(d.timeoutId))):void(e&&(d._lastQueue=a.now(),void 0===c&&(d._remainingTimeout=b.timeout),d.paused||d.hoverPaused||(d.timeoutId=setTimeout(function(){d.API.prepareTx(!1,!d.reverse)},e))))},stopTransition:function(){var a=this.opts();a.slides.filter(":animated").length&&(a.slides.stop(!1,!0),a.API.trigger("cycle-transition-stopped",[a])),a._tx&&a._tx.stopTransition&&a._tx.stopTransition(a)},advanceSlide:function(a){var b=this.opts();return clearTimeout(b.timeoutId),b.timeoutId=0,b.nextSlide=b.currSlide+a,b.nextSlide<0?b.nextSlide=b.slides.length-1:b.nextSlide>=b.slides.length&&(b.nextSlide=0),b.API.prepareTx(!0,a>=0),!1},buildSlideOpts:function(c){var d,e,f=this.opts(),g=c.data()||{};for(var h in g)g.hasOwnProperty(h)&&/^cycle[A-Z]+/.test(h)&&(d=g[h],e=h.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,b),f.API.log("["+(f.slideCount-1)+"]",e+":",d,"("+typeof d+")"),g[e]=d);g=a.extend({},a.fn.cycle.defaults,f,g),g.slideNum=f.slideCount;try{delete g.API,delete g.slideCount,delete g.currSlide,delete g.nextSlide,delete g.slides}catch(i){}return g},getSlideOpts:function(b){var c=this.opts();void 0===b&&(b=c.currSlide);var d=c.slides[b],e=a(d).data("cycle.opts");return a.extend({},c,e)},initSlide:function(b,c,d){var e=this.opts();c.css(b.slideCss||{}),d>0&&c.css("zIndex",d),isNaN(b.speed)&&(b.speed=a.fx.speeds[b.speed]||a.fx.speeds._default),b.sync||(b.speed=b.speed/2),c.addClass(e.slideClass)},updateView:function(a,b){var c=this.opts();if(c._initialized){var d=c.API.getSlideOpts(),e=c.slides[c.currSlide];!a&&b!==!0&&(c.API.trigger("cycle-update-view-before",[c,d,e]),c.updateView<0)||(c.slideActiveClass&&c.slides.removeClass(c.slideActiveClass).eq(c.currSlide).addClass(c.slideActiveClass),a&&c.hideNonActive&&c.slides.filter(":not(."+c.slideActiveClass+")").css("visibility","hidden"),0===c.updateView&&setTimeout(function(){c.API.trigger("cycle-update-view",[c,d,e,a])},d.speed/(c.sync?2:1)),0!==c.updateView&&c.API.trigger("cycle-update-view",[c,d,e,a]),a&&c.API.trigger("cycle-update-view-after",[c,d,e]))}},getComponent:function(b){var c=this.opts(),d=c[b];return"string"==typeof d?/^\s*[\>|\+|~]/.test(d)?c.container.find(d):a(d):d.jquery?d:a(d)},stackSlides:function(b,c,d){var e=this.opts();b||(b=e.slides[e.currSlide],c=e.slides[e.nextSlide],d=!e.reverse),a(b).css("zIndex",e.maxZ);var f,g=e.maxZ-2,h=e.slideCount;if(d){for(f=e.currSlide+1;h>f;f++)a(e.slides[f]).css("zIndex",g--);for(f=0;f<e.currSlide;f++)a(e.slides[f]).css("zIndex",g--)}else{for(f=e.currSlide-1;f>=0;f--)a(e.slides[f]).css("zIndex",g--);for(f=h-1;f>e.currSlide;f--)a(e.slides[f]).css("zIndex",g--)}a(c).css("zIndex",e.maxZ-1)},getSlideIndex:function(a){return this.opts().slides.index(a)}},a.fn.cycle.log=function(){window.console&&console.log&&console.log("[cycle2] "+Array.prototype.join.call(arguments," "))},a.fn.cycle.version=function(){return"Cycle2: "+c},a.fn.cycle.transitions={custom:{},none:{before:function(a,b,c,d){a.API.stackSlides(c,b,d),a.cssBefore={opacity:1,visibility:"visible",display:"block"}}},fade:{before:function(b,c,d,e){var f=b.API.getSlideOpts(b.nextSlide).slideCss||{};b.API.stackSlides(c,d,e),b.cssBefore=a.extend(f,{opacity:0,visibility:"visible",display:"block"}),b.animIn={opacity:1},b.animOut={opacity:0}}},fadeout:{before:function(b,c,d,e){var f=b.API.getSlideOpts(b.nextSlide).slideCss||{};b.API.stackSlides(c,d,e),b.cssBefore=a.extend(f,{opacity:1,visibility:"visible",display:"block"}),b.animOut={opacity:0}}},scrollHorz:{before:function(a,b,c,d){a.API.stackSlides(b,c,d);var e=a.container.css("overflow","hidden").width();a.cssBefore={left:d?e:-e,top:0,opacity:1,visibility:"visible",display:"block"},a.cssAfter={zIndex:a._maxZ-2,left:0},a.animIn={left:0},a.animOut={left:d?-e:e}}}},a.fn.cycle.defaults={allowWrap:!0,autoSelector:".cycle-slideshow[data-cycle-auto-init!=false]",delay:0,easing:null,fx:"fade",hideNonActive:!0,loop:0,manualFx:void 0,manualSpeed:void 0,manualTrump:!0,maxZ:100,pauseOnHover:!1,reverse:!1,slideActiveClass:"cycle-slide-active",slideClass:"cycle-slide",slideCss:{position:"absolute",top:0,left:0},slides:"> img",speed:500,startingSlide:0,sync:!0,timeout:4e3,updateView:0},a(document).ready(function(){a(a.fn.cycle.defaults.autoSelector).cycle()})}(jQuery),/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130913 */
vendor: 12,609 bytes, lines 4369-4380
4369
4370        function(a){"use strict";function b(b,d){var e,f,g,h=d.autoHeight;if("container"==h)f=a(d.slides[d.currSlide]).outerHeight(),d.container.height(f);else if(d._autoHeightRatio)d.container.height(d.container.width()/d._autoHeightRatio);else if("calc"===h||"number"==a.type(h)&&h>=0){if(g="calc"===h?c(b,d):h>=d.slides.length?0:h,g==d._sentinelIndex)return;d._sentinelIndex=g,d._sentinel&&d._sentinel.remove(),e=a(d.slides[g].cloneNode(!0)),e.removeAttr("id name rel").find("[id],[name],[rel]").removeAttr("id name rel"),e.css({position:"static",visibility:"hidden",display:"block"}).prependTo(d.container).addClass("cycle-sentinel cycle-slide").removeClass("cycle-slide-active"),e.find("*").css("visibility","hidden"),d._sentinel=e}}function c(b,c){var d=0,e=-1;return c.slides.each(function(b){var c=a(this).height();c>e&&(e=c,d=b)}),d}function d(b,c,d,e){var f=a(e).outerHeight();c.container.animate({height:f},c.autoHeightSpeed,c.autoHeightEasing)}function e(c,f){f._autoHeightOnResize&&(a(window).off("resize orientationchange",f._autoHeightOnResize),f._autoHeightOnResize=null),f.container.off("cycle-slide-added cycle-slide-removed",b),f.container.off("cycle-destroyed",e),f.container.off("cycle-before",d),f._sentinel&&(f._sentinel.remove(),f._sentinel=null)}a.extend(a.fn.cycle.defaults,{autoHeight:0,autoHeightSpeed:250,autoHeightEasing:null}),a(document).on("cycle-initialized",function(c,f){function g(){b(c,f)}var h,i=f.autoHeight,j=a.type(i),k=null;("string"===j||"number"===j)&&(f.container.on("cycle-slide-added cycle-slide-removed",b),f.container.on("cycle-destroyed",e),"container"==i?f.container.on("cycle-before",d):"string"===j&&/\d+\:\d+/.test(i)&&(h=i.match(/(\d+)\:(\d+)/),h=h[1]/h[2],f._autoHeightRatio=h),"number"!==j&&(f._autoHeightOnResize=function(){clearTimeout(k),k=setTimeout(g,50)},a(window).on("resize orientationchange",f._autoHeightOnResize)),setTimeout(g,30))})}(jQuery),/*! caption plugin for Cycle2;  version: 20130306 */
4371        function(a){"use strict";a.extend(a.fn.cycle.defaults,{caption:"> .cycle-caption",captionTemplate:"{{slideNum}} / {{slideCount}}",overlay:"> .cycle-overlay",overlayTemplate:"<div>{{title}}</div><div>{{desc}}</div>",captionModule:"caption"}),a(document).on("cycle-update-view",function(b,c,d,e){if("caption"===c.captionModule){a.each(["caption","overlay"],function(){var a=this,b=d[a+"Template"],f=c.API.getComponent(a);f.length&&b?(f.html(c.API.tmpl(b,d,c,e)),f.show()):f.hide()})}}),a(document).on("cycle-destroyed",function(b,c){var d;a.each(["caption","overlay"],function(){var a=this,b=c[a+"Template"];c[a]&&b&&(d=c.API.getComponent("caption"),d.empty())})})}(jQuery),/*! command plugin for Cycle2;  version: 20140415 */
4372        function(a){"use strict";var b=a.fn.cycle;a.fn.cycle=function(c){var d,e,f,g=a.makeArray(arguments);return"number"==a.type(c)?this.cycle("goto",c):"string"==a.type(c)?this.each(function(){var h;return d=c,f=a(this).data("cycle.opts"),void 0===f?void b.log('slideshow must be initialized before sending commands; "'+d+'" ignored'):(d="goto"==d?"jump":d,e=f.API[d],a.isFunction(e)?(h=a.makeArray(g),h.shift(),e.apply(f.API,h)):void b.log("unknown command: ",d))}):b.apply(this,arguments)},a.extend(a.fn.cycle,b),a.extend(b.API,{next:function(){var a=this.opts();if(!a.busy||a.manualTrump){var b=a.reverse?-1:1;a.allowWrap===!1&&a.currSlide+b>=a.slideCount||(a.API.advanceSlide(b),a.API.trigger("cycle-next",[a]).log("cycle-next"))}},prev:function(){var a=this.opts();if(!a.busy||a.manualTrump){var b=a.reverse?1:-1;a.allowWrap===!1&&a.currSlide+b<0||(a.API.advanceSlide(b),a.API.trigger("cycle-prev",[a]).log("cycle-prev"))}},destroy:function(){this.stop();var b=this.opts(),c=a.isFunction(a._data)?a._data:a.noop;clearTimeout(b.timeoutId),b.timeoutId=0,b.API.stop(),b.API.trigger("cycle-destroyed",[b]).log("cycle-destroyed"),b.container.removeData(),c(b.container[0],"parsedAttrs",!1),b.retainStylesOnDestroy||(b.container.removeAttr("style"),b.slides.removeAttr("style"),b.slides.removeClass(b.slideActiveClass)),b.slides.each(function(){var d=a(this);d.removeData(),d.removeClass(b.slideClass),c(this,"parsedAttrs",!1)})},jump:function(a,b){var c,d=this.opts();if(!d.busy||d.manualTrump){var e=parseInt(a,10);if(isNaN(e)||0>e||e>=d.slides.length)return void d.API.log("goto: invalid slide index: "+e);if(e==d.currSlide)return void d.API.log("goto: skipping, already on slide",e);d.nextSlide=e,clearTimeout(d.timeoutId),d.timeoutId=0,d.API.log("goto: ",e," (zero-index)"),c=d.currSlide<d.nextSlide,d._tempFx=b,d.API.prepareTx(!0,c)}},stop:function(){var b=this.opts(),c=b.container;clearTimeout(b.timeoutId),b.timeoutId=0,b.API.stopTransition(),b.pauseOnHover&&(b.pauseOnHover!==!0&&(c=a(b.pauseOnHover)),c.off("mouseenter mouseleave")),b.API.trigger("cycle-stopped",[b]).log("cycle-stopped")},reinit:function(){var a=this.opts();a.API.destroy(),a.container.cycle()},remove:function(b){for(var c,d,e=this.opts(),f=[],g=1,h=0;h<e.slides.length;h++)c=e.slides[h],h==b?d=c:(f.push(c),a(c).data("cycle.opts").slideNum=g,g++);d&&(e.slides=a(f),e.slideCount--,a(d).remove(),b==e.currSlide?e.API.advanceSlide(1):b<e.currSlide?e.currSlide--:e.currSlide++,e.API.trigger("cycle-slide-removed",[e,b,d]).log("cycle-slide-removed"),e.API.updateView())}}),a(document).on("click.cycle","[data-cycle-cmd]",function(b){b.preventDefault();var c=a(this),d=c.data("cycle-cmd"),e=c.data("cycle-context")||".cycle-slideshow";a(e).cycle(d,c.data("cycle-arg"))})}(jQuery),/*! hash plugin for Cycle2;  version: 20130905 */
4373        function(a){"use strict";function b(b,c){var d;return b._hashFence?void(b._hashFence=!1):(d=window.location.hash.substring(1),void b.slides.each(function(e){if(a(this).data("cycle-hash")==d){if(c===!0)b.startingSlide=e;else{var f=b.currSlide<e;b.nextSlide=e,b.API.prepareTx(!0,f)}return!1}}))}a(document).on("cycle-pre-initialize",function(c,d){b(d,!0),d._onHashChange=function(){b(d,!1)},a(window).on("hashchange",d._onHashChange)}),a(document).on("cycle-update-view",function(a,b,c){c.hash&&"#"+c.hash!=window.location.hash&&(b._hashFence=!0,window.location.hash=c.hash)}),a(document).on("cycle-destroyed",function(b,c){c._onHashChange&&a(window).off("hashchange",c._onHashChange)})}(jQuery),/*! loader plugin for Cycle2;  version: 20131121 */
4374        function(a){"use strict";a.extend(a.fn.cycle.defaults,{loader:!1}),a(document).on("cycle-bootstrap",function(b,c){function d(b,d){function f(b){var f;"wait"==c.loader?(h.push(b),0===j&&(h.sort(g),e.apply(c.API,[h,d]),c.container.removeClass("cycle-loading"))):(f=a(c.slides[c.currSlide]),e.apply(c.API,[b,d]),f.show(),c.container.removeClass("cycle-loading"))}function g(a,b){return a.data("index")-b.data("index")}var h=[];if("string"==a.type(b))b=a.trim(b);else if("array"===a.type(b))for(var i=0;i<b.length;i++)b[i]=a(b[i])[0];b=a(b);var j=b.length;j&&(b.css("visibility","hidden").appendTo("body").each(function(b){function g(){0===--i&&(--j,f(k))}var i=0,k=a(this),l=k.is("img")?k:k.find("img");return k.data("index",b),l=l.filter(":not(.cycle-loader-ignore)").filter(':not([src=""])'),l.length?(i=l.length,void l.each(function(){this.complete?g():a(this).load(function(){g()}).on("error",function(){0===--i&&(c.API.log("slide skipped; img not loaded:",this.src),0===--j&&"wait"==c.loader&&e.apply(c.API,[h,d]))})})):(--j,void h.push(k))}),j&&c.container.addClass("cycle-loading"))}var e;c.loader&&(e=c.API.add,c.API.add=d)})}(jQuery),/*! pager plugin for Cycle2;  version: 20140415 */
4375        function(a){"use strict";function b(b,c,d){var e,f=b.API.getComponent("pager");f.each(function(){var f=a(this);if(c.pagerTemplate){var g=b.API.tmpl(c.pagerTemplate,c,b,d[0]);e=a(g).appendTo(f)}else e=f.children().eq(b.slideCount-1);e.on(b.pagerEvent,function(a){b.pagerEventBubble||a.preventDefault(),b.API.page(f,a.currentTarget)})})}function c(a,b){var c=this.opts();if(!c.busy||c.manualTrump){var d=a.children().index(b),e=d,f=c.currSlide<e;c.currSlide!=e&&(c.nextSlide=e,c._tempFx=c.pagerFx,c.API.prepareTx(!0,f),c.API.trigger("cycle-pager-activated",[c,a,b]))}}a.extend(a.fn.cycle.defaults,{pager:"> .cycle-pager",pagerActiveClass:"cycle-pager-active",pagerEvent:"click.cycle",pagerEventBubble:void 0,pagerTemplate:"<span>&bull;</span>"}),a(document).on("cycle-bootstrap",function(a,c,d){d.buildPagerLink=b}),a(document).on("cycle-slide-added",function(a,b,d,e){b.pager&&(b.API.buildPagerLink(b,d,e),b.API.page=c)}),a(document).on("cycle-slide-removed",function(b,c,d){if(c.pager){var e=c.API.getComponent("pager");e.each(function(){var b=a(this);a(b.children()[d]).remove()})}}),a(document).on("cycle-update-view",function(b,c){var d;c.pager&&(d=c.API.getComponent("pager"),d.each(function(){a(this).children().removeClass(c.pagerActiveClass).eq(c.currSlide).addClass(c.pagerActiveClass)}))}),a(document).on("cycle-destroyed",function(a,b){var c=b.API.getComponent("pager");c&&(c.children().off(b.pagerEvent),b.pagerTemplate&&c.empty())})}(jQuery),/*! prevnext plugin for Cycle2;  version: 20140408 */
4376        function(a){"use strict";a.extend(a.fn.cycle.defaults,{next:"> .cycle-next",nextEvent:"click.cycle",disabledClass:"disabled",prev:"> .cycle-prev",prevEvent:"click.cycle",swipe:!1}),a(document).on("cycle-initialized",function(a,b){if(b.API.getComponent("next").on(b.nextEvent,function(a){a.preventDefault(),b.API.next()}),b.API.getComponent("prev").on(b.prevEvent,function(a){a.preventDefault(),b.API.prev()}),b.swipe){var c=b.swipeVert?"swipeUp.cycle":"swipeLeft.cycle swipeleft.cycle",d=b.swipeVert?"swipeDown.cycle":"swipeRight.cycle swiperight.cycle";b.container.on(c,function(){b._tempFx=b.swipeFx,b.API.next()}),b.container.on(d,function(){b._tempFx=b.swipeFx,b.API.prev()})}}),a(document).on("cycle-update-view",function(a,b){if(!b.allowWrap){var c=b.disabledClass,d=b.API.getComponent("next"),e=b.API.getComponent("prev"),f=b._prevBoundry||0,g=void 0!==b._nextBoundry?b._nextBoundry:b.slideCount-1;b.currSlide==g?d.addClass(c).prop("disabled",!0):d.removeClass(c).prop("disabled",!1),b.currSlide===f?e.addClass(c).prop("disabled",!0):e.removeClass(c).prop("disabled",!1)}}),a(document).on("cycle-destroyed",function(a,b){b.API.getComponent("prev").off(b.nextEvent),b.API.getComponent("next").off(b.prevEvent),b.container.off("swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle")})}(jQuery),/*! progressive loader plugin for Cycle2;  version: 20130315 */
4377        function(a){"use strict";a.extend(a.fn.cycle.defaults,{progressive:!1}),a(document).on("cycle-pre-initialize",function(b,c){if(c.progressive){var d,e,f=c.API,g=f.next,h=f.prev,i=f.prepareTx,j=a.type(c.progressive);if("array"==j)d=c.progressive;else if(a.isFunction(c.progressive))d=c.progressive(c);else if("string"==j){if(e=a(c.progressive),d=a.trim(e.html()),!d)return;if(/^(\[)/.test(d))try{d=a.parseJSON(d)}catch(k){return void f.log("error parsing progressive slides",k)}else d=d.split(new RegExp(e.data("cycle-split")||"\n")),d[d.length-1]||d.pop()}i&&(f.prepareTx=function(a,b){var e,f;return a||0===d.length?void i.apply(c.API,[a,b]):void(b&&c.currSlide==c.slideCount-1?(f=d[0],d=d.slice(1),c.container.one("cycle-slide-added",function(a,b){setTimeout(function(){b.API.advanceSlide(1)},50)}),c.API.add(f)):b||0!==c.currSlide?i.apply(c.API,[a,b]):(e=d.length-1,f=d[e],d=d.slice(0,e),c.container.one("cycle-slide-added",function(a,b){setTimeout(function(){b.currSlide=1,b.API.advanceSlide(-1)},50)}),c.API.add(f,!0)))}),g&&(f.next=function(){var a=this.opts();if(d.length&&a.currSlide==a.slideCount-1){var b=d[0];d=d.slice(1),a.container.one("cycle-slide-added",function(a,b){g.apply(b.API),b.container.removeClass("cycle-loading")}),a.container.addClass("cycle-loading"),a.API.add(b)}else g.apply(a.API)}),h&&(f.prev=function(){var a=this.opts();if(d.length&&0===a.currSlide){var b=d.length-1,c=d[b];d=d.slice(0,b),a.container.one("cycle-slide-added",function(a,b){b.currSlide=1,b.API.advanceSlide(-1),b.container.removeClass("cycle-loading")}),a.container.addClass("cycle-loading"),a.API.add(c,!0)}else h.apply(a.API)})}})}(jQuery),/*! tmpl plugin for Cycle2;  version: 20121227 */
4378        function(a){"use strict";a.extend(a.fn.cycle.defaults,{tmplRegex:"{{((.)?.*?)}}"}),a.extend(a.fn.cycle.API,{tmpl:function(b,c){var d=new RegExp(c.tmplRegex||a.fn.cycle.defaults.tmplRegex,"g"),e=a.makeArray(arguments);return e.shift(),b.replace(d,function(b,c){var d,f,g,h,i=c.split(".");for(d=0;d<e.length;d++)if(g=e[d]){if(i.length>1)for(h=g,f=0;f<i.length;f++)g=h,h=h[i[f]]||c;else h=g[c];if(a.isFunction(h))return h.apply(g,e);if(void 0!==h&&null!==h&&h!=c)return h}return c})}})}(jQuery);
4379}));
4380},{"jquery":124}
4380],124:[function(require,module,exports){
vendor: 42,881 bytes, lines 4381-5969
4381/*!
4382 * jQuery JavaScript Library v3.3.1
4383 * https://jquery.com/
4384 *
4385 * Includes Sizzle.js
4386 * https://sizzlejs.com/
4387 *
4388 * Copyright JS Foundation and other contributors
4389 * Released under the MIT license
4390 * https://jquery.org/license
4391 *
4392 * Date: 2018-01-20T17:24Z
4393 */
4394( function( global, factory ) {
4395
4396	"use strict";
4397
4398	if ( typeof module === "object" && typeof module.exports === "object" ) {
4399
4400		// For CommonJS and CommonJS-like environments where a proper `window`
4401		// is present, execute the factory and get jQuery.
4402		// For environments that do not have a `window` with a `document`
4403		// (such as Node.js), expose a factory as module.exports.
4404		// This accentuates the need for the creation of a real `window`.
4405		// e.g. var jQuery = require("jquery")(window);
4406		// See ticket #14549 for more info.
4407		module.exports = global.document ?
4408			factory( global, true ) :
4409			function( w ) {
4410				if ( !w.document ) {
4411					throw new Error( "jQuery requires a window with a document" );
4412				}
4413				return factory( w );
4414			};
4415	} else {
4416		factory( global );
4417	}
4418
4419// Pass this if window is not defined yet
4420} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
4421
4422// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
4423// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
4424// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
4425// enough that all such attempts are guarded in a try block.
4426"use strict";
4427
4428var arr = [];
4429
4430var document = window.document;
4431
4432var getProto = Object.getPrototypeOf;
4433
4434var slice = arr.slice;
4435
4436var concat = arr.concat;
4437
4438var push = arr.push;
4439
4440var indexOf = arr.indexOf;
4441
4442var class2type = {};
4443
4444var toString = class2type.toString;
4445
4446var hasOwn = class2type.hasOwnProperty;
4447
4448var fnToString = hasOwn.toString;
4449
4450var ObjectFunctionString = fnToString.call( Object );
4451
4452var support = {};
4453
4454var isFunction = function isFunction( obj ) {
4455
4456      // Support: Chrome <=57, Firefox <=52
4457      // In some browsers, typeof returns "function" for HTML <object> elements
4458      // (i.e., `typeof document.createElement( "object" ) === "function"`).
4459      // We don't want to classify *any* DOM node as a function.
4460      return typeof obj === "function" && typeof obj.nodeType !== "number";
4461  };
4462
4463
4464var isWindow = function isWindow( obj ) {
4465		return obj != null && obj === obj.window;
4466	};
4467
4468
4469
4470
4471	var preservedScriptAttributes = {
4472		type: true,
4473		src: true,
4474		noModule: true
4475	};
4476
4477	function DOMEval( code, doc, node ) {
4478		doc = doc || document;
4479
4480		var i,
4481			script = doc.createElement( "script" );
4482
4483		script.text = code;
4484		if ( node ) {
4485			for ( i in preservedScriptAttributes ) {
4486				if ( node[ i ] ) {
4487					script[ i ] = node[ i ];
4488				}
4489			}
4490		}
4491		doc.head.appendChild( script ).parentNode.removeChild( script );
4492	}
4493
4494
4495function toType( obj ) {
4496	if ( obj == null ) {
4497		return obj + "";
4498	}
4499
4500	// Support: Android <=2.3 only (functionish RegExp)
4501	return typeof obj === "object" || typeof obj === "function" ?
4502		class2type[ toString.call( obj ) ] || "object" :
4503		typeof obj;
4504}
4505/* global Symbol */
4506// Defining this global in .eslintrc.json would create a danger of using the global
4507// unguarded in another place, it seems safer to define global only for this module
4508
4509
4510
4511var
4512	version = "3.3.1",
4513
4514	// Define a local copy of jQuery
4515	jQuery = function( selector, context ) {
4516
4517		// The jQuery object is actually just the init constructor 'enhanced'
4518		// Need init if jQuery is called (just allow error to be thrown if not included)
4519		return new jQuery.fn.init( selector, context );
4520	},
4521
4522	// Support: Android <=4.0 only
4523	// Make sure we trim BOM and NBSP
4524	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
4525
4526jQuery.fn = jQuery.prototype = {
4527
4528	// The current version of jQuery being used
4529	jquery: version,
4530
4531	constructor: jQuery,
4532
4533	// The default length of a jQuery object is 0
4534	length: 0,
4535
4536	toArray: function() {
4537		return slice.call( this );
4538	},
4539
4540	// Get the Nth element in the matched element set OR
4541	// Get the whole matched element set as a clean array
4542	get: function( num ) {
4543
4544		// Return all the elements in a clean array
4545		if ( num == null ) {
4546			return slice.call( this );
4547		}
4548
4549		// Return just the one element from the set
4550		return num < 0 ? this[ num + this.length ] : this[ num ];
4551	},
4552
4553	// Take an array of elements and push it onto the stack
4554	// (returning the new matched element set)
4555	pushStack: function( elems ) {
4556
4557		// Build a new jQuery matched element set
4558		var ret = jQuery.merge( this.constructor(), elems );
4559
4560		// Add the old object onto the stack (as a reference)
4561		ret.prevObject = this;
4562
4563		// Return the newly-formed element set
4564		return ret;
4565	},
4566
4567	// Execute a callback for every element in the matched set.
4568	each: function( callback ) {
4569		return jQuery.each( this, callback );
4570	},
4571
4572	map: function( callback ) {
4573		return this.pushStack( jQuery.map( this, function( elem, i ) {
4574			return callback.call( elem, i, elem );
4575		} ) );
4576	},
4577
4578	slice: function() {
4579		return this.pushStack( slice.apply( this, arguments ) );
4580	},
4581
4582	first: function() {
4583		return this.eq( 0 );
4584	},
4585
4586	last: function() {
4587		return this.eq( -1 );
4588	},
4589
4590	eq: function( i ) {
4591		var len = this.length,
4592			j = +i + ( i < 0 ? len : 0 );
4593		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
4594	},
4595
4596	end: function() {
4597		return this.prevObject || this.constructor();
4598	},
4599
4600	// For internal use only.
4601	// Behaves like an Array's method, not like a jQuery method.
4602	push: push,
4603	sort: arr.sort,
4604	splice: arr.splice
4605};
4606
4607jQuery.extend = jQuery.fn.extend = function() {
4608	var options, name, src, copy, copyIsArray, clone,
4609		target = arguments[ 0 ] || {},
4610		i = 1,
4611		length = arguments.length,
4612		deep = false;
4613
4614	// Handle a deep copy situation
4615	if ( typeof target === "boolean" ) {
4616		deep = target;
4617
4618		// Skip the boolean and the target
4619		target = arguments[ i ] || {};
4620		i++;
4621	}
4622
4623	// Handle case when target is a string or something (possible in deep copy)
4624	if ( typeof target !== "object" && !isFunction( target ) ) {
4625		target = {};
4626	}
4627
4628	// Extend jQuery itself if only one argument is passed
4629	if ( i === length ) {
4630		target = this;
4631		i--;
4632	}
4633
4634	for ( ; i < length; i++ ) {
4635
4636		// Only deal with non-null/undefined values
4637		if ( ( options = arguments[ i ] ) != null ) {
4638
4639			// Extend the base object
4640			for ( name in options ) {
4641				src = target[ name ];
4642				copy = options[ name ];
4643
4644				// Prevent never-ending loop
4645				if ( target === copy ) {
4646					continue;
4647				}
4648
4649				// Recurse if we're merging plain objects or arrays
4650				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
4651					( copyIsArray = Array.isArray( copy ) ) ) ) {
4652
4653					if ( copyIsArray ) {
4654						copyIsArray = false;
4655						clone = src && Array.isArray( src ) ? src : [];
4656
4657					} else {
4658						clone = src && jQuery.isPlainObject( src ) ? src : {};
4659					}
4660
4661					// Never move original objects, clone them
4662					target[ name ] = jQuery.extend( deep, clone, copy );
4663
4664				// Don't bring in undefined values
4665				} else if ( copy !== undefined ) {
4666					target[ name ] = copy;
4667				}
4668			}
4669		}
4670	}
4671
4672	// Return the modified object
4673	return target;
4674};
4675
4676jQuery.extend( {
4677
4678	// Unique for each copy of jQuery on the page
4679	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
4680
4681	// Assume jQuery is ready without the ready module
4682	isReady: true,
4683
4684	error: function( msg ) {
4685		throw new Error( msg );
4686	},
4687
4688	noop: function() {},
4689
4690	isPlainObject: function( obj ) {
4691		var proto, Ctor;
4692
4693		// Detect obvious negatives
4694		// Use toString instead of jQuery.type to catch host objects
4695		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
4696			return false;
4697		}
4698
4699		proto = getProto( obj );
4700
4701		// Objects with no prototype (e.g., `Object.create( null )`) are plain
4702		if ( !proto ) {
4703			return true;
4704		}
4705
4706		// Objects with prototype are plain iff they were constructed by a global Object function
4707		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
4708		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
4709	},
4710
4711	isEmptyObject: function( obj ) {
4712
4713		/* eslint-disable no-unused-vars */
4714		// See https://github.com/eslint/eslint/issues/6125
4715		var name;
4716
4717		for ( name in obj ) {
4718			return false;
4719		}
4720		return true;
4721	},
4722
4723	// Evaluates a script in a global context
4724	globalEval: function( code ) {
4725		DOMEval( code );
4726	},
4727
4728	each: function( obj, callback ) {
4729		var length, i = 0;
4730
4731		if ( isArrayLike( obj ) ) {
4732			length = obj.length;
4733			for ( ; i < length; i++ ) {
4734				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
4735					break;
4736				}
4737			}
4738		} else {
4739			for ( i in obj ) {
4740				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
4741					break;
4742				}
4743			}
4744		}
4745
4746		return obj;
4747	},
4748
4749	// Support: Android <=4.0 only
4750	trim: function( text ) {
4751		return text == null ?
4752			"" :
4753			( text + "" ).replace( rtrim, "" );
4754	},
4755
4756	// results is for internal usage only
4757	makeArray: function( arr, results ) {
4758		var ret = results || [];
4759
4760		if ( arr != null ) {
4761			if ( isArrayLike( Object( arr ) ) ) {
4762				jQuery.merge( ret,
4763					typeof arr === "string" ?
4764					[ arr ] : arr
4765				);
4766			} else {
4767				push.call( ret, arr );
4768			}
4769		}
4770
4771		return ret;
4772	},
4773
4774	inArray: function( elem, arr, i ) {
4775		return arr == null ? -1 : indexOf.call( arr, elem, i );
4776	},
4777
4778	// Support: Android <=4.0 only, PhantomJS 1 only
4779	// push.apply(_, arraylike) throws on ancient WebKit
4780	merge: function( first, second ) {
4781		var len = +second.length,
4782			j = 0,
4783			i = first.length;
4784
4785		for ( ; j < len; j++ ) {
4786			first[ i++ ] = second[ j ];
4787		}
4788
4789		first.length = i;
4790
4791		return first;
4792	},
4793
4794	grep: function( elems, callback, invert ) {
4795		var callbackInverse,
4796			matches = [],
4797			i = 0,
4798			length = elems.length,
4799			callbackExpect = !invert;
4800
4801		// Go through the array, only saving the items
4802		// that pass the validator function
4803		for ( ; i < length; i++ ) {
4804			callbackInverse = !callback( elems[ i ], i );
4805			if ( callbackInverse !== callbackExpect ) {
4806				matches.push( elems[ i ] );
4807			}
4808		}
4809
4810		return matches;
4811	},
4812
4813	// arg is for internal usage only
4814	map: function( elems, callback, arg ) {
4815		var length, value,
4816			i = 0,
4817			ret = [];
4818
4819		// Go through the array, translating each of the items to their new values
4820		if ( isArrayLike( elems ) ) {
4821			length = elems.length;
4822			for ( ; i < length; i++ ) {
4823				value = callback( elems[ i ], i, arg );
4824
4825				if ( value != null ) {
4826					ret.push( value );
4827				}
4828			}
4829
4830		// Go through every key on the object,
4831		} else {
4832			for ( i in elems ) {
4833				value = callback( elems[ i ], i, arg );
4834
4835				if ( value != null ) {
4836					ret.push( value );
4837				}
4838			}
4839		}
4840
4841		// Flatten any nested arrays
4842		return concat.apply( [], ret );
4843	},
4844
4845	// A global GUID counter for objects
4846	guid: 1,
4847
4848	// jQuery.support is not used in Core but other projects attach their
4849	// properties to it so it needs to exist.
4850	support: support
4851} );
4852
4853if ( typeof Symbol === "function" ) {
4854	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
4855}
4856
4857// Populate the class2type map
4858jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
4859function( i, name ) {
4860	class2type[ "[object " + name + "]" ] = name.toLowerCase();
4861} );
4862
4863function isArrayLike( obj ) {
4864
4865	// Support: real iOS 8.2 only (not reproducible in simulator)
4866	// `in` check used to prevent JIT error (gh-2145)
4867	// hasOwn isn't used here due to false negatives
4868	// regarding Nodelist length in IE
4869	var length = !!obj && "length" in obj && obj.length,
4870		type = toType( obj );
4871
4872	if ( isFunction( obj ) || isWindow( obj ) ) {
4873		return false;
4874	}
4875
4876	return type === "array" || length === 0 ||
4877		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
4878}
4879var Sizzle =
4880/*!
4881 * Sizzle CSS Selector Engine v2.3.3
4882 * https://sizzlejs.com/
4883 *
4884 * Copyright jQuery Foundation and other contributors
4885 * Released under the MIT license
4886 * http://jquery.org/license
4887 *
4888 * Date: 2016-08-08
4889 */
4890(function( window ) {
4891
4892var i,
4893	support,
4894	Expr,
4895	getText,
4896	isXML,
4897	tokenize,
4898	compile,
4899	select,
4900	outermostContext,
4901	sortInput,
4902	hasDuplicate,
4903
4904	// Local document vars
4905	setDocument,
4906	document,
4907	docElem,
4908	documentIsHTML,
4909	rbuggyQSA,
4910	rbuggyMatches,
4911	matches,
4912	contains,
4913
4914	// Instance-specific data
4915	expando = "sizzle" + 1 * new Date(),
4916	preferredDoc = window.document,
4917	dirruns = 0,
4918	done = 0,
4919	classCache = createCache(),
4920	tokenCache = createCache(),
4921	compilerCache = createCache(),
4922	sortOrder = function( a, b ) {
4923		if ( a === b ) {
4924			hasDuplicate = true;
4925		}
4926		return 0;
4927	},
4928
4929	// Instance methods
4930	hasOwn = ({}).hasOwnProperty,
4931	arr = [],
4932	pop = arr.pop,
4933	push_native = arr.push,
4934	push = arr.push,
4935	slice = arr.slice,
4936	// Use a stripped-down indexOf as it's faster than native
4937	// https://jsperf.com/thor-indexof-vs-for/5
4938	indexOf = function( list, elem ) {
4939		var i = 0,
4940			len = list.length;
4941		for ( ; i < len; i++ ) {
4942			if ( list[i] === elem ) {
4943				return i;
4944			}
4945		}
4946		return -1;
4947	},
4948
4949	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
4950
4951	// Regular expressions
4952
4953	// http://www.w3.org/TR/css3-selectors/#whitespace
4954	whitespace = "[\\x20\\t\\r\\n\\f]",
4955
4956	// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
4957	identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
4958
4959	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
4960	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
4961		// Operator (capture 2)
4962		"*([*^$|!~]?=)" + whitespace +
4963		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
4964		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
4965		"*\\]",
4966
4967	pseudos = ":(" + identifier + ")(?:\\((" +
4968		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
4969		// 1. quoted (capture 3; capture 4 or capture 5)
4970		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
4971		// 2. simple (capture 6)
4972		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
4973		// 3. anything else (capture 2)
4974		".*" +
4975		")\\)|)",
4976
4977	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
4978	rwhitespace = new RegExp( whitespace + "+", "g" ),
4979	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
4980
4981	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
4982	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
4983
4984	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
4985
4986	rpseudo = new RegExp( pseudos ),
4987	ridentifier = new RegExp( "^" + identifier + "$" ),
4988
4989	matchExpr = {
4990		"ID": new RegExp( "^#(" + identifier + ")" ),
4991		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
4992		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
4993		"ATTR": new RegExp( "^" + attributes ),
4994		"PSEUDO": new RegExp( "^" + pseudos ),
4995		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
4996			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
4997			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
4998		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
4999		// For use in libraries implementing .is()
5000		// We use this for POS matching in `select`
5001		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
5002			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
5003	},
5004
5005	rinputs = /^(?:input|select|textarea|button)$/i,
5006	rheader = /^h\d$/i,
5007
5008	rnative = /^[^{]+\{\s*\[native \w/,
5009
5010	// Easily-parseable/retrievable ID or TAG or CLASS selectors
5011	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
5012
5013	rsibling = /[+~]/,
5014
5015	// CSS escapes
5016	// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
5017	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
5018	funescape = function( _, escaped, escapedWhitespace ) {
5019		var high = "0x" + escaped - 0x10000;
5020		// NaN means non-codepoint
5021		// Support: Firefox<24
5022		// Workaround erroneous numeric interpretation of +"0x"
5023		return high !== high || escapedWhitespace ?
5024			escaped :
5025			high < 0 ?
5026				// BMP codepoint
5027				String.fromCharCode( high + 0x10000 ) :
5028				// Supplemental Plane codepoint (surrogate pair)
5029				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
5030	},
5031
5032	// CSS string/identifier serialization
5033	// https://drafts.csswg.org/cssom/#common-serializing-idioms
5034	rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
5035	fcssescape = function( ch, asCodePoint ) {
5036		if ( asCodePoint ) {
5037
5038			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
5039			if ( ch === "\0" ) {
5040				return "\uFFFD";
5041			}
5042
5043			// Control characters and (dependent upon position) numbers get escaped as code points
5044			return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
5045		}
5046
5047		// Other potentially-special ASCII characters get backslash-escaped
5048		return "\\" + ch;
5049	},
5050
5051	// Used for iframes
5052	// See setDocument()
5053	// Removing the function wrapper causes a "Permission Denied"
5054	// error in IE
5055	unloadHandler = function() {
5056		setDocument();
5057	},
5058
5059	disabledAncestor = addCombinator(
5060		function( elem ) {
5061			return elem.disabled === true && ("form" in elem || "label" in elem);
5062		},
5063		{ dir: "parentNode", next: "legend" }
5064	);
5065
5066// Optimize for push.apply( _, NodeList )
5067try {
5068	push.apply(
5069		(arr = slice.call( preferredDoc.childNodes )),
5070		preferredDoc.childNodes
5071	);
5072	// Support: Android<4.0
5073	// Detect silently failing push.apply
5074	arr[ preferredDoc.childNodes.length ].nodeType;
5075} catch ( e ) {
5076	push = { apply: arr.length ?
5077
5078		// Leverage slice if possible
5079		function( target, els ) {
5080			push_native.apply( target, slice.call(els) );
5081		} :
5082
5083		// Support: IE<9
5084		// Otherwise append directly
5085		function( target, els ) {
5086			var j = target.length,
5087				i = 0;
5088			// Can't trust NodeList.length
5089			while ( (target[j++] = els[i++]) ) {}
5090			target.length = j - 1;
5091		}
5092	};
5093}
5094
5095function Sizzle( selector, context, results, seed ) {
5096	var m, i, elem, nid, match, groups, newSelector,
5097		newContext = context && context.ownerDocument,
5098
5099		// nodeType defaults to 9, since context defaults to document
5100		nodeType = context ? context.nodeType : 9;
5101
5102	results = results || [];
5103
5104	// Return early from calls with invalid selector or context
5105	if ( typeof selector !== "string" || !selector ||
5106		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
5107
5108		return results;
5109	}
5110
5111	// Try to shortcut find operations (as opposed to filters) in HTML documents
5112	if ( !seed ) {
5113
5114		if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
5115			setDocument( context );
5116		}
5117		context = context || document;
5118
5119		if ( documentIsHTML ) {
5120
5121			// If the selector is sufficiently simple, try using a "get*By*" DOM method
5122			// (excepting DocumentFragment context, where the methods don't exist)
5123			if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
5124
5125				// ID selector
5126				if ( (m = match[1]) ) {
5127
5128					// Document context
5129					if ( nodeType === 9 ) {
5130						if ( (elem = context.getElementById( m )) ) {
5131
5132							// Support: IE, Opera, Webkit
5133							// TODO: identify versions
5134							// getElementById can match elements by name instead of ID
5135							if ( elem.id === m ) {
5136								results.push( elem );
5137								return results;
5138							}
5139						} else {
5140							return results;
5141						}
5142
5143					// Element context
5144					} else {
5145
5146						// Support: IE, Opera, Webkit
5147						// TODO: identify versions
5148						// getElementById can match elements by name instead of ID
5149						if ( newContext && (elem = newContext.getElementById( m )) &&
5150							contains( context, elem ) &&
5151							elem.id === m ) {
5152
5153							results.push( elem );
5154							return results;
5155						}
5156					}
5157
5158				// Type selector
5159				} else if ( match[2] ) {
5160					push.apply( results, context.getElementsByTagName( selector ) );
5161					return results;
5162
5163				// Class selector
5164				} else if ( (m = match[3]) && support.getElementsByClassName &&
5165					context.getElementsByClassName ) {
5166
5167					push.apply( results, context.getElementsByClassName( m ) );
5168					return results;
5169				}
5170			}
5171
5172			// Take advantage of querySelectorAll
5173			if ( support.qsa &&
5174				!compilerCache[ selector + " " ] &&
5175				(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
5176
5177				if ( nodeType !== 1 ) {
5178					newContext = context;
5179					newSelector = selector;
5180
5181				// qSA looks outside Element context, which is not what we want
5182				// Thanks to Andrew Dupont for this workaround technique
5183				// Support: IE <=8
5184				// Exclude object elements
5185				} else if ( context.nodeName.toLowerCase() !== "object" ) {
5186
5187					// Capture the context ID, setting it first if necessary
5188					if ( (nid = context.getAttribute( "id" )) ) {
5189						nid = nid.replace( rcssescape, fcssescape );
5190					} else {
5191						context.setAttribute( "id", (nid = expando) );
5192					}
5193
5194					// Prefix every selector in the list
5195					groups = tokenize( selector );
5196					i = groups.length;
5197					while ( i-- ) {
5198						groups[i] = "#" + nid + " " + toSelector( groups[i] );
5199					}
5200					newSelector = groups.join( "," );
5201
5202					// Expand context for sibling selectors
5203					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
5204						context;
5205				}
5206
5207				if ( newSelector ) {
5208					try {
5209						push.apply( results,
5210							newContext.querySelectorAll( newSelector )
5211						);
5212						return results;
5213					} catch ( qsaError ) {
5214					} finally {
5215						if ( nid === expando ) {
5216							context.removeAttribute( "id" );
5217						}
5218					}
5219				}
5220			}
5221		}
5222	}
5223
5224	// All others
5225	return select( selector.replace( rtrim, "$1" ), context, results, seed );
5226}
5227
5228/**
5229 * Create key-value caches of limited size
5230 * @returns {function(string, object)} Returns the Object data after storing it on itself with
5231 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
5232 *	deleting the oldest entry
5233 */
5234function createCache() {
5235	var keys = [];
5236
5237	function cache( key, value ) {
5238		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
5239		if ( keys.push( key + " " ) > Expr.cacheLength ) {
5240			// Only keep the most recent entries
5241			delete cache[ keys.shift() ];
5242		}
5243		return (cache[ key + " " ] = value);
5244	}
5245	return cache;
5246}
5247
5248/**
5249 * Mark a function for special use by Sizzle
5250 * @param {Function} fn The function to mark
5251 */
5252function markFunction( fn ) {
5253	fn[ expando ] = true;
5254	return fn;
5255}
5256
5257/**
5258 * Support testing using an element
5259 * @param {Function} fn Passed the created element and returns a boolean result
5260 */
5261function assert( fn ) {
5262	var el = document.createElement("fieldset");
5263
5264	try {
5265		return !!fn( el );
5266	} catch (e) {
5267		return false;
5268	} finally {
5269		// Remove from its parent by default
5270		if ( el.parentNode ) {
5271			el.parentNode.removeChild( el );
5272		}
5273		// release memory in IE
5274		el = null;
5275	}
5276}
5277
5278/**
5279 * Adds the same handler for all of the specified attrs
5280 * @param {String} attrs Pipe-separated list of attributes
5281 * @param {Function} handler The method that will be applied
5282 */
5283function addHandle( attrs, handler ) {
5284	var arr = attrs.split("|"),
5285		i = arr.length;
5286
5287	while ( i-- ) {
5288		Expr.attrHandle[ arr[i] ] = handler;
5289	}
5290}
5291
5292/**
5293 * Checks document order of two siblings
5294 * @param {Element} a
5295 * @param {Element} b
5296 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
5297 */
5298function siblingCheck( a, b ) {
5299	var cur = b && a,
5300		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
5301			a.sourceIndex - b.sourceIndex;
5302
5303	// Use IE sourceIndex if available on both nodes
5304	if ( diff ) {
5305		return diff;
5306	}
5307
5308	// Check if b follows a
5309	if ( cur ) {
5310		while ( (cur = cur.nextSibling) ) {
5311			if ( cur === b ) {
5312				return -1;
5313			}
5314		}
5315	}
5316
5317	return a ? 1 : -1;
5318}
5319
5320/**
5321 * Returns a function to use in pseudos for input types
5322 * @param {String} type
5323 */
5324function createInputPseudo( type ) {
5325	return function( elem ) {
5326		var name = elem.nodeName.toLowerCase();
5327		return name === "input" && elem.type === type;
5328	};
5329}
5330
5331/**
5332 * Returns a function to use in pseudos for buttons
5333 * @param {String} type
5334 */
5335function createButtonPseudo( type ) {
5336	return function( elem ) {
5337		var name = elem.nodeName.toLowerCase();
5338		return (name === "input" || name === "button") && elem.type === type;
5339	};
5340}
5341
5342/**
5343 * Returns a function to use in pseudos for :enabled/:disabled
5344 * @param {Boolean} disabled true for :disabled; false for :enabled
5345 */
5346function createDisabledPseudo( disabled ) {
5347
5348	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
5349	return function( elem ) {
5350
5351		// Only certain elements can match :enabled or :disabled
5352		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
5353		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
5354		if ( "form" in elem ) {
5355
5356			// Check for inherited disabledness on relevant non-disabled elements:
5357			// * listed form-associated elements in a disabled fieldset
5358			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
5359			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
5360			// * option elements in a disabled optgroup
5361			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
5362			// All such elements have a "form" property.
5363			if ( elem.parentNode && elem.disabled === false ) {
5364
5365				// Option elements defer to a parent optgroup if present
5366				if ( "label" in elem ) {
5367					if ( "label" in elem.parentNode ) {
5368						return elem.parentNode.disabled === disabled;
5369					} else {
5370						return elem.disabled === disabled;
5371					}
5372				}
5373
5374				// Support: IE 6 - 11
5375				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
5376				return elem.isDisabled === disabled ||
5377
5378					// Where there is no isDisabled, check manually
5379					/* jshint -W018 */
5380					elem.isDisabled !== !disabled &&
5381						disabledAncestor( elem ) === disabled;
5382			}
5383
5384			return elem.disabled === disabled;
5385
5386		// Try to winnow out elements that can't be disabled before trusting the disabled property.
5387		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
5388		// even exist on them, let alone have a boolean value.
5389		} else if ( "label" in elem ) {
5390			return elem.disabled === disabled;
5391		}
5392
5393		// Remaining elements are neither :enabled nor :disabled
5394		return false;
5395	};
5396}
5397
5398/**
5399 * Returns a function to use in pseudos for positionals
5400 * @param {Function} fn
5401 */
5402function createPositionalPseudo( fn ) {
5403	return markFunction(function( argument ) {
5404		argument = +argument;
5405		return markFunction(function( seed, matches ) {
5406			var j,
5407				matchIndexes = fn( [], seed.length, argument ),
5408				i = matchIndexes.length;
5409
5410			// Match elements found at the specified indexes
5411			while ( i-- ) {
5412				if ( seed[ (j = matchIndexes[i]) ] ) {
5413					seed[j] = !(matches[j] = seed[j]);
5414				}
5415			}
5416		});
5417	});
5418}
5419
5420/**
5421 * Checks a node for validity as a Sizzle context
5422 * @param {Element|Object=} context
5423 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
5424 */
5425function testContext( context ) {
5426	return context && typeof context.getElementsByTagName !== "undefined" && context;
5427}
5428
5429// Expose support vars for convenience
5430support = Sizzle.support = {};
5431
5432/**
5433 * Detects XML nodes
5434 * @param {Element|Object} elem An element or a document
5435 * @returns {Boolean} True iff elem is a non-HTML XML node
5436 */
5437isXML = Sizzle.isXML = function( elem ) {
5438	// documentElement is verified for cases where it doesn't yet exist
5439	// (such as loading iframes in IE - #4833)
5440	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
5441	return documentElement ? documentElement.nodeName !== "HTML" : false;
5442};
5443
5444/**
5445 * Sets document-related variables once based on the current document
5446 * @param {Element|Object} [doc] An element or document object to use to set the document
5447 * @returns {Object} Returns the current document
5448 */
5449setDocument = Sizzle.setDocument = function( node ) {
5450	var hasCompare, subWindow,
5451		doc = node ? node.ownerDocument || node : preferredDoc;
5452
5453	// Return early if doc is invalid or already selected
5454	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
5455		return document;
5456	}
5457
5458	// Update global variables
5459	document = doc;
5460	docElem = document.documentElement;
5461	documentIsHTML = !isXML( document );
5462
5463	// Support: IE 9-11, Edge
5464	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
5465	if ( preferredDoc !== document &&
5466		(subWindow = document.defaultView) && subWindow.top !== subWindow ) {
5467
5468		// Support: IE 11, Edge
5469		if ( subWindow.addEventListener ) {
5470			subWindow.addEventListener( "unload", unloadHandler, false );
5471
5472		// Support: IE 9 - 10 only
5473		} else if ( subWindow.attachEvent ) {
5474			subWindow.attachEvent( "onunload", unloadHandler );
5475		}
5476	}
5477
5478	/* Attributes
5479	---------------------------------------------------------------------- */
5480
5481	// Support: IE<8
5482	// Verify that getAttribute really returns attributes and not properties
5483	// (excepting IE8 booleans)
5484	support.attributes = assert(function( el ) {
5485		el.className = "i";
5486		return !el.getAttribute("className");
5487	});
5488
5489	/* getElement(s)By*
5490	---------------------------------------------------------------------- */
5491
5492	// Check if getElementsByTagName("*") returns only elements
5493	support.getElementsByTagName = assert(function( el ) {
5494		el.appendChild( document.createComment("") );
5495		return !el.getElementsByTagName("*").length;
5496	});
5497
5498	// Support: IE<9
5499	support.getElementsByClassName = rnative.test( document.getElementsByClassName );
5500
5501	// Support: IE<10
5502	// Check if getElementById returns elements by name
5503	// The broken getElementById methods don't pick up programmatically-set names,
5504	// so use a roundabout getElementsByName test
5505	support.getById = assert(function( el ) {
5506		docElem.appendChild( el ).id = expando;
5507		return !document.getElementsByName || !document.getElementsByName( expando ).length;
5508	});
5509
5510	// ID filter and find
5511	if ( support.getById ) {
5512		Expr.filter["ID"] = function( id ) {
5513			var attrId = id.replace( runescape, funescape );
5514			return function( elem ) {
5515				return elem.getAttribute("id") === attrId;
5516			};
5517		};
5518		Expr.find["ID"] = function( id, context ) {
5519			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
5520				var elem = context.getElementById( id );
5521				return elem ? [ elem ] : [];
5522			}
5523		};
5524	} else {
5525		Expr.filter["ID"] =  function( id ) {
5526			var attrId = id.replace( runescape, funescape );
5527			return function( elem ) {
5528				var node = typeof elem.getAttributeNode !== "undefined" &&
5529					elem.getAttributeNode("id");
5530				return node && node.value === attrId;
5531			};
5532		};
5533
5534		// Support: IE 6 - 7 only
5535		// getElementById is not reliable as a find shortcut
5536		Expr.find["ID"] = function( id, context ) {
5537			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
5538				var node, i, elems,
5539					elem = context.getElementById( id );
5540
5541				if ( elem ) {
5542
5543					// Verify the id attribute
5544					node = elem.getAttributeNode("id");
5545					if ( node && node.value === id ) {
5546						return [ elem ];
5547					}
5548
5549					// Fall back on getElementsByName
5550					elems = context.getElementsByName( id );
5551					i = 0;
5552					while ( (elem = elems[i++]) ) {
5553						node = elem.getAttributeNode("id");
5554						if ( node && node.value === id ) {
5555							return [ elem ];
5556						}
5557					}
5558				}
5559
5560				return [];
5561			}
5562		};
5563	}
5564
5565	// Tag
5566	Expr.find["TAG"] = support.getElementsByTagName ?
5567		function( tag, context ) {
5568			if ( typeof context.getElementsByTagName !== "undefined" ) {
5569				return context.getElementsByTagName( tag );
5570
5571			// DocumentFragment nodes don't have gEBTN
5572			} else if ( support.qsa ) {
5573				return context.querySelectorAll( tag );
5574			}
5575		} :
5576
5577		function( tag, context ) {
5578			var elem,
5579				tmp = [],
5580				i = 0,
5581				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
5582				results = context.getElementsByTagName( tag );
5583
5584			// Filter out possible comments
5585			if ( tag === "*" ) {
5586				while ( (elem = results[i++]) ) {
5587					if ( elem.nodeType === 1 ) {
5588						tmp.push( elem );
5589					}
5590				}
5591
5592				return tmp;
5593			}
5594			return results;
5595		};
5596
5597	// Class
5598	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
5599		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
5600			return context.getElementsByClassName( className );
5601		}
5602	};
5603
5604	/* QSA/matchesSelector
5605	---------------------------------------------------------------------- */
5606
5607	// QSA and matchesSelector support
5608
5609	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
5610	rbuggyMatches = [];
5611
5612	// qSa(:focus) reports false when true (Chrome 21)
5613	// We allow this because of a bug in IE8/9 that throws an error
5614	// whenever `document.activeElement` is accessed on an iframe
5615	// So, we allow :focus to pass through QSA all the time to avoid the IE error
5616	// See https://bugs.jquery.com/ticket/13378
5617	rbuggyQSA = [];
5618
5619	if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
5620		// Build QSA regex
5621		// Regex strategy adopted from Diego Perini
5622		assert(function( el ) {
5623			// Select is set to empty string on purpose
5624			// This is to test IE's treatment of not explicitly
5625			// setting a boolean content attribute,
5626			// since its presence should be enough
5627			// https://bugs.jquery.com/ticket/12359
5628			docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
5629				"<select id='" + expando + "-\r\\' msallowcapture=''>" +
5630				"<option selected=''></option></select>";
5631
5632			// Support: IE8, Opera 11-12.16
5633			// Nothing should be selected when empty strings follow ^= or $= or *=
5634			// The test attribute must be unknown in Opera but "safe" for WinRT
5635			// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
5636			if ( el.querySelectorAll("[msallowcapture^='']").length ) {
5637				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
5638			}
5639
5640			// Support: IE8
5641			// Boolean attributes and "value" are not treated correctly
5642			if ( !el.querySelectorAll("[selected]").length ) {
5643				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
5644			}
5645
5646			// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
5647			if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
5648				rbuggyQSA.push("~=");
5649			}
5650
5651			// Webkit/Opera - :checked should return selected option elements
5652			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5653			// IE8 throws error here and will not see later tests
5654			if ( !el.querySelectorAll(":checked").length ) {
5655				rbuggyQSA.push(":checked");
5656			}
5657
5658			// Support: Safari 8+, iOS 8+
5659			// https://bugs.webkit.org/show_bug.cgi?id=136851
5660			// In-page `selector#id sibling-combinator selector` fails
5661			if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
5662				rbuggyQSA.push(".#.+[+~]");
5663			}
5664		});
5665
5666		assert(function( el ) {
5667			el.innerHTML = "<a href='' disabled='disabled'></a>" +
5668				"<select disabled='disabled'><option/></select>";
5669
5670			// Support: Windows 8 Native Apps
5671			// The type and name attributes are restricted during .innerHTML assignment
5672			var input = document.createElement("input");
5673			input.setAttribute( "type", "hidden" );
5674			el.appendChild( input ).setAttribute( "name", "D" );
5675
5676			// Support: IE8
5677			// Enforce case-sensitivity of name attribute
5678			if ( el.querySelectorAll("[name=d]").length ) {
5679				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
5680			}
5681
5682			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
5683			// IE8 throws error here and will not see later tests
5684			if ( el.querySelectorAll(":enabled").length !== 2 ) {
5685				rbuggyQSA.push( ":enabled", ":disabled" );
5686			}
5687
5688			// Support: IE9-11+
5689			// IE's :disabled selector does not pick up the children of disabled fieldsets
5690			docElem.appendChild( el ).disabled = true;
5691			if ( el.querySelectorAll(":disabled").length !== 2 ) {
5692				rbuggyQSA.push( ":enabled", ":disabled" );
5693			}
5694
5695			// Opera 10-11 does not throw on post-comma invalid pseudos
5696			el.querySelectorAll("*,:x");
5697			rbuggyQSA.push(",.*:");
5698		});
5699	}
5700
5701	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
5702		docElem.webkitMatchesSelector ||
5703		docElem.mozMatchesSelector ||
5704		docElem.oMatchesSelector ||
5705		docElem.msMatchesSelector) )) ) {
5706
5707		assert(function( el ) {
5708			// Check to see if it's possible to do matchesSelector
5709			// on a disconnected node (IE 9)
5710			support.disconnectedMatch = matches.call( el, "*" );
5711
5712			// This should fail with an exception
5713			// Gecko does not error, returns false instead
5714			matches.call( el, "[s!='']:x" );
5715			rbuggyMatches.push( "!=", pseudos );
5716		});
5717	}
5718
5719	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
5720	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
5721
5722	/* Contains
5723	---------------------------------------------------------------------- */
5724	hasCompare = rnative.test( docElem.compareDocumentPosition );
5725
5726	// Element contains another
5727	// Purposefully self-exclusive
5728	// As in, an element does not contain itself
5729	contains = hasCompare || rnative.test( docElem.contains ) ?
5730		function( a, b ) {
5731			var adown = a.nodeType === 9 ? a.documentElement : a,
5732				bup = b && b.parentNode;
5733			return a === bup || !!( bup && bup.nodeType === 1 && (
5734				adown.contains ?
5735					adown.contains( bup ) :
5736					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
5737			));
5738		} :
5739		function( a, b ) {
5740			if ( b ) {
5741				while ( (b = b.parentNode) ) {
5742					if ( b === a ) {
5743						return true;
5744					}
5745				}
5746			}
5747			return false;
5748		};
5749
5750	/* Sorting
5751	---------------------------------------------------------------------- */
5752
5753	// Document order sorting
5754	sortOrder = hasCompare ?
5755	function( a, b ) {
5756
5757		// Flag for duplicate removal
5758		if ( a === b ) {
5759			hasDuplicate = true;
5760			return 0;
5761		}
5762
5763		// Sort on method existence if only one input has compareDocumentPosition
5764		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
5765		if ( compare ) {
5766			return compare;
5767		}
5768
5769		// Calculate position if both inputs belong to the same document
5770		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
5771			a.compareDocumentPosition( b ) :
5772
5773			// Otherwise we know they are disconnected
5774			1;
5775
5776		// Disconnected nodes
5777		if ( compare & 1 ||
5778			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
5779
5780			// Choose the first element that is related to our preferred document
5781			if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
5782				return -1;
5783			}
5784			if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
5785				return 1;
5786			}
5787
5788			// Maintain original order
5789			return sortInput ?
5790				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
5791				0;
5792		}
5793
5794		return compare & 4 ? -1 : 1;
5795	} :
5796	function( a, b ) {
5797		// Exit early if the nodes are identical
5798		if ( a === b ) {
5799			hasDuplicate = true;
5800			return 0;
5801		}
5802
5803		var cur,
5804			i = 0,
5805			aup = a.parentNode,
5806			bup = b.parentNode,
5807			ap = [ a ],
5808			bp = [ b ];
5809
5810		// Parentless nodes are either documents or disconnected
5811		if ( !aup || !bup ) {
5812			return a === document ? -1 :
5813				b === document ? 1 :
5814				aup ? -1 :
5815				bup ? 1 :
5816				sortInput ?
5817				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
5818				0;
5819
5820		// If the nodes are siblings, we can do a quick check
5821		} else if ( aup === bup ) {
5822			return siblingCheck( a, b );
5823		}
5824
5825		// Otherwise we need full lists of their ancestors for comparison
5826		cur = a;
5827		while ( (cur = cur.parentNode) ) {
5828			ap.unshift( cur );
5829		}
5830		cur = b;
5831		while ( (cur = cur.parentNode) ) {
5832			bp.unshift( cur );
5833		}
5834
5835		// Walk down the tree looking for a discrepancy
5836		while ( ap[i] === bp[i] ) {
5837			i++;
5838		}
5839
5840		return i ?
5841			// Do a sibling check if the nodes have a common ancestor
5842			siblingCheck( ap[i], bp[i] ) :
5843
5844			// Otherwise nodes in our document sort first
5845			ap[i] === preferredDoc ? -1 :
5846			bp[i] === preferredDoc ? 1 :
5847			0;
5848	};
5849
5850	return document;
5851};
5852
5853Sizzle.matches = function( expr, elements ) {
5854	return Sizzle( expr, null, null, elements );
5855};
5856
5857Sizzle.matchesSelector = function( elem, expr ) {
5858	// Set document vars if needed
5859	if ( ( elem.ownerDocument || elem ) !== document ) {
5860		setDocument( elem );
5861	}
5862
5863	// Make sure that attribute selectors are quoted
5864	expr = expr.replace( rattributeQuotes, "='$1']" );
5865
5866	if ( support.matchesSelector && documentIsHTML &&
5867		!compilerCache[ expr + " " ] &&
5868		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
5869		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
5870
5871		try {
5872			var ret = matches.call( elem, expr );
5873
5874			// IE 9's matchesSelector returns false on disconnected nodes
5875			if ( ret || support.disconnectedMatch ||
5876					// As well, disconnected nodes are said to be in a document
5877					// fragment in IE 9
5878					elem.document && elem.document.nodeType !== 11 ) {
5879				return ret;
5880			}
5881		} catch (e) {}
5882	}
5883
5884	return Sizzle( expr, document, null, [ elem ] ).length > 0;
5885};
5886
5887Sizzle.contains = function( context, elem ) {
5888	// Set document vars if needed
5889	if ( ( context.ownerDocument || context ) !== document ) {
5890		setDocument( context );
5891	}
5892	return contains( context, elem );
5893};
5894
5895Sizzle.attr = function( elem, name ) {
5896	// Set document vars if needed
5897	if ( ( elem.ownerDocument || elem ) !== document ) {
5898		setDocument( elem );
5899	}
5900
5901	var fn = Expr.attrHandle[ name.toLowerCase() ],
5902		// Don't get fooled by Object.prototype properties (jQuery #13807)
5903		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
5904			fn( elem, name, !documentIsHTML ) :
5905			undefined;
5906
5907	return val !== undefined ?
5908		val :
5909		support.attributes || !documentIsHTML ?
5910			elem.getAttribute( name ) :
5911			(val = elem.getAttributeNode(name)) && val.specified ?
5912				val.value :
5913				null;
5914};
5915
5916Sizzle.escape = function( sel ) {
5917	return (sel + "").replace( rcssescape, fcssescape );
5918};
5919
5920Sizzle.error = function( msg ) {
5921	throw new Error( "Syntax error, unrecognized expression: " + msg );
5922};
5923
5924/**
5925 * Document sorting and removing duplicates
5926 * @param {ArrayLike} results
5927 */
5928Sizzle.uniqueSort = function( results ) {
5929	var elem,
5930		duplicates = [],
5931		j = 0,
5932		i = 0;
5933
5934	// Unless we *know* we can detect duplicates, assume their presence
5935	hasDuplicate = !support.detectDuplicates;
5936	sortInput = !support.sortStable && results.slice( 0 );
5937	results.sort( sortOrder );
5938
5939	if ( hasDuplicate ) {
5940		while ( (elem = results[i++]) ) {
5941			if ( elem === results[ i ] ) {
5942				j = duplicates.push( i );
5943			}
5944		}
5945		while ( j-- ) {
5946			results.splice( duplicates[ j ], 1 );
5947		}
5948	}
5949
5950	// Clear input after sorting to release objects
5951	// See https://github.com/jquery/sizzle/pull/225
5952	sortInput = null;
5953
5954	return results;
5955};
5956
5957/**
5958 * Utility function for retrieving the text value of an array of DOM nodes
5959 * @param {Array|Element} elem
5960 */
5961getText = Sizzle.getText = function( elem ) {
5962	var node,
5963		ret = "",
5964		i = 0,
5965		nodeType = elem.nodeType;
5966
5967	if ( !nodeType ) {
5968		// If no nodeType, this is expected to be an array
5969		while ( (node = elem[i++]) ) {
vendor: 11,976 bytes, lines 5970-6368
5970			// Do not traverse comment nodes
5971			ret += getText( node );
5972		}
5973	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
5974		// Use textContent for elements
5975		// innerText usage removed for consistency of new lines (jQuery #11153)
5976		if ( typeof elem.textContent === "string" ) {
5977			return elem.textContent;
5978		} else {
5979			// Traverse its children
5980			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
5981				ret += getText( elem );
5982			}
5983		}
5984	} else if ( nodeType === 3 || nodeType === 4 ) {
5985		return elem.nodeValue;
5986	}
5987	// Do not include comment or processing instruction nodes
5988
5989	return ret;
5990};
5991
5992Expr = Sizzle.selectors = {
5993
5994	// Can be adjusted by the user
5995	cacheLength: 50,
5996
5997	createPseudo: markFunction,
5998
5999	match: matchExpr,
6000
6001	attrHandle: {},
6002
6003	find: {},
6004
6005	relative: {
6006		">": { dir: "parentNode", first: true },
6007		" ": { dir: "parentNode" },
6008		"+": { dir: "previousSibling", first: true },
6009		"~": { dir: "previousSibling" }
6010	},
6011
6012	preFilter: {
6013		"ATTR": function( match ) {
6014			match[1] = match[1].replace( runescape, funescape );
6015
6016			// Move the given value to match[3] whether quoted or unquoted
6017			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
6018
6019			if ( match[2] === "~=" ) {
6020				match[3] = " " + match[3] + " ";
6021			}
6022
6023			return match.slice( 0, 4 );
6024		},
6025
6026		"CHILD": function( match ) {
6027			/* matches from matchExpr["CHILD"]
6028				1 type (only|nth|...)
6029				2 what (child|of-type)
6030				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
6031				4 xn-component of xn+y argument ([+-]?\d*n|)
6032				5 sign of xn-component
6033				6 x of xn-component
6034				7 sign of y-component
6035				8 y of y-component
6036			*/
6037			match[1] = match[1].toLowerCase();
6038
6039			if ( match[1].slice( 0, 3 ) === "nth" ) {
6040				// nth-* requires argument
6041				if ( !match[3] ) {
6042					Sizzle.error( match[0] );
6043				}
6044
6045				// numeric x and y parameters for Expr.filter.CHILD
6046				// remember that false/true cast respectively to 0/1
6047				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
6048				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
6049
6050			// other types prohibit arguments
6051			} else if ( match[3] ) {
6052				Sizzle.error( match[0] );
6053			}
6054
6055			return match;
6056		},
6057
6058		"PSEUDO": function( match ) {
6059			var excess,
6060				unquoted = !match[6] && match[2];
6061
6062			if ( matchExpr["CHILD"].test( match[0] ) ) {
6063				return null;
6064			}
6065
6066			// Accept quoted arguments as-is
6067			if ( match[3] ) {
6068				match[2] = match[4] || match[5] || "";
6069
6070			// Strip excess characters from unquoted arguments
6071			} else if ( unquoted && rpseudo.test( unquoted ) &&
6072				// Get excess from tokenize (recursively)
6073				(excess = tokenize( unquoted, true )) &&
6074				// advance to the next closing parenthesis
6075				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
6076
6077				// excess is a negative index
6078				match[0] = match[0].slice( 0, excess );
6079				match[2] = unquoted.slice( 0, excess );
6080			}
6081
6082			// Return only captures needed by the pseudo filter method (type and argument)
6083			return match.slice( 0, 3 );
6084		}
6085	},
6086
6087	filter: {
6088
6089		"TAG": function( nodeNameSelector ) {
6090			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
6091			return nodeNameSelector === "*" ?
6092				function() { return true; } :
6093				function( elem ) {
6094					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
6095				};
6096		},
6097
6098		"CLASS": function( className ) {
6099			var pattern = classCache[ className + " " ];
6100
6101			return pattern ||
6102				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
6103				classCache( className, function( elem ) {
6104					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
6105				});
6106		},
6107
6108		"ATTR": function( name, operator, check ) {
6109			return function( elem ) {
6110				var result = Sizzle.attr( elem, name );
6111
6112				if ( result == null ) {
6113					return operator === "!=";
6114				}
6115				if ( !operator ) {
6116					return true;
6117				}
6118
6119				result += "";
6120
6121				return operator === "=" ? result === check :
6122					operator === "!=" ? result !== check :
6123					operator === "^=" ? check && result.indexOf( check ) === 0 :
6124					operator === "*=" ? check && result.indexOf( check ) > -1 :
6125					operator === "$=" ? check && result.slice( -check.length ) === check :
6126					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
6127					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
6128					false;
6129			};
6130		},
6131
6132		"CHILD": function( type, what, argument, first, last ) {
6133			var simple = type.slice( 0, 3 ) !== "nth",
6134				forward = type.slice( -4 ) !== "last",
6135				ofType = what === "of-type";
6136
6137			return first === 1 && last === 0 ?
6138
6139				// Shortcut for :nth-*(n)
6140				function( elem ) {
6141					return !!elem.parentNode;
6142				} :
6143
6144				function( elem, context, xml ) {
6145					var cache, uniqueCache, outerCache, node, nodeIndex, start,
6146						dir = simple !== forward ? "nextSibling" : "previousSibling",
6147						parent = elem.parentNode,
6148						name = ofType && elem.nodeName.toLowerCase(),
6149						useCache = !xml && !ofType,
6150						diff = false;
6151
6152					if ( parent ) {
6153
6154						// :(first|last|only)-(child|of-type)
6155						if ( simple ) {
6156							while ( dir ) {
6157								node = elem;
6158								while ( (node = node[ dir ]) ) {
6159									if ( ofType ?
6160										node.nodeName.toLowerCase() === name :
6161										node.nodeType === 1 ) {
6162
6163										return false;
6164									}
6165								}
6166								// Reverse direction for :only-* (if we haven't yet done so)
6167								start = dir = type === "only" && !start && "nextSibling";
6168							}
6169							return true;
6170						}
6171
6172						start = [ forward ? parent.firstChild : parent.lastChild ];
6173
6174						// non-xml :nth-child(...) stores cache data on `parent`
6175						if ( forward && useCache ) {
6176
6177							// Seek `elem` from a previously-cached index
6178
6179							// ...in a gzip-friendly way
6180							node = parent;
6181							outerCache = node[ expando ] || (node[ expando ] = {});
6182
6183							// Support: IE <9 only
6184							// Defend against cloned attroperties (jQuery gh-1709)
6185							uniqueCache = outerCache[ node.uniqueID ] ||
6186								(outerCache[ node.uniqueID ] = {});
6187
6188							cache = uniqueCache[ type ] || [];
6189							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
6190							diff = nodeIndex && cache[ 2 ];
6191							node = nodeIndex && parent.childNodes[ nodeIndex ];
6192
6193							while ( (node = ++nodeIndex && node && node[ dir ] ||
6194
6195								// Fallback to seeking `elem` from the start
6196								(diff = nodeIndex = 0) || start.pop()) ) {
6197
6198								// When found, cache indexes on `parent` and break
6199								if ( node.nodeType === 1 && ++diff && node === elem ) {
6200									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
6201									break;
6202								}
6203							}
6204
6205						} else {
6206							// Use previously-cached element index if available
6207							if ( useCache ) {
6208								// ...in a gzip-friendly way
6209								node = elem;
6210								outerCache = node[ expando ] || (node[ expando ] = {});
6211
6212								// Support: IE <9 only
6213								// Defend against cloned attroperties (jQuery gh-1709)
6214								uniqueCache = outerCache[ node.uniqueID ] ||
6215									(outerCache[ node.uniqueID ] = {});
6216
6217								cache = uniqueCache[ type ] || [];
6218								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
6219								diff = nodeIndex;
6220							}
6221
6222							// xml :nth-child(...)
6223							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
6224							if ( diff === false ) {
6225								// Use the same loop as above to seek `elem` from the start
6226								while ( (node = ++nodeIndex && node && node[ dir ] ||
6227									(diff = nodeIndex = 0) || start.pop()) ) {
6228
6229									if ( ( ofType ?
6230										node.nodeName.toLowerCase() === name :
6231										node.nodeType === 1 ) &&
6232										++diff ) {
6233
6234										// Cache the index of each encountered element
6235										if ( useCache ) {
6236											outerCache = node[ expando ] || (node[ expando ] = {});
6237
6238											// Support: IE <9 only
6239											// Defend against cloned attroperties (jQuery gh-1709)
6240											uniqueCache = outerCache[ node.uniqueID ] ||
6241												(outerCache[ node.uniqueID ] = {});
6242
6243											uniqueCache[ type ] = [ dirruns, diff ];
6244										}
6245
6246										if ( node === elem ) {
6247											break;
6248										}
6249									}
6250								}
6251							}
6252						}
6253
6254						// Incorporate the offset, then check against cycle size
6255						diff -= last;
6256						return diff === first || ( diff % first === 0 && diff / first >= 0 );
6257					}
6258				};
6259		},
6260
6261		"PSEUDO": function( pseudo, argument ) {
6262			// pseudo-class names are case-insensitive
6263			// http://www.w3.org/TR/selectors/#pseudo-classes
6264			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
6265			// Remember that setFilters inherits from pseudos
6266			var args,
6267				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
6268					Sizzle.error( "unsupported pseudo: " + pseudo );
6269
6270			// The user may use createPseudo to indicate that
6271			// arguments are needed to create the filter function
6272			// just as Sizzle does
6273			if ( fn[ expando ] ) {
6274				return fn( argument );
6275			}
6276
6277			// But maintain support for old signatures
6278			if ( fn.length > 1 ) {
6279				args = [ pseudo, pseudo, "", argument ];
6280				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
6281					markFunction(function( seed, matches ) {
6282						var idx,
6283							matched = fn( seed, argument ),
6284							i = matched.length;
6285						while ( i-- ) {
6286							idx = indexOf( seed, matched[i] );
6287							seed[ idx ] = !( matches[ idx ] = matched[i] );
6288						}
6289					}) :
6290					function( elem ) {
6291						return fn( elem, 0, args );
6292					};
6293			}
6294
6295			return fn;
6296		}
6297	},
6298
6299	pseudos: {
6300		// Potentially complex pseudos
6301		"not": markFunction(function( selector ) {
6302			// Trim the selector passed to compile
6303			// to avoid treating leading and trailing
6304			// spaces as combinators
6305			var input = [],
6306				results = [],
6307				matcher = compile( selector.replace( rtrim, "$1" ) );
6308
6309			return matcher[ expando ] ?
6310				markFunction(function( seed, matches, context, xml ) {
6311					var elem,
6312						unmatched = matcher( seed, null, xml, [] ),
6313						i = seed.length;
6314
6315					// Match elements unmatched by `matcher`
6316					while ( i-- ) {
6317						if ( (elem = unmatched[i]) ) {
6318							seed[i] = !(matches[i] = elem);
6319						}
6320					}
6321				}) :
6322				function( elem, context, xml ) {
6323					input[0] = elem;
6324					matcher( input, null, xml, results );
6325					// Don't keep the element (issue #299)
6326					input[0] = null;
6327					return !results.pop();
6328				};
6329		}),
6330
6331		"has": markFunction(function( selector ) {
6332			return function( elem ) {
6333				return Sizzle( selector, elem ).length > 0;
6334			};
6335		}),
6336
6337		"contains": markFunction(function( text ) {
6338			text = text.replace( runescape, funescape );
6339			return function( elem ) {
6340				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
6341			};
6342		}),
6343
6344		// "Whether an element is represented by a :lang() selector
6345		// is based solely on the element's language value
6346		// being equal to the identifier C,
6347		// or beginning with the identifier C immediately followed by "-".
6348		// The matching of C against the element's language value is performed case-insensitively.
6349		// The identifier C does not have to be a valid language name."
6350		// http://www.w3.org/TR/selectors/#lang-pseudo
6351		"lang": markFunction( function( lang ) {
6352			// lang value must be a valid identifier
6353			if ( !ridentifier.test(lang || "") ) {
6354				Sizzle.error( "unsupported lang: " + lang );
6355			}
6356			lang = lang.replace( runescape, funescape ).toLowerCase();
6357			return function( elem ) {
6358				var elemLang;
6359				do {
6360					if ( (elemLang = documentIsHTML ?
6361						elem.lang :
6362						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
6363
6364						elemLang = elemLang.toLowerCase();
6365						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
6366					}
6367				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
6368				return false;
vendor: 23,967 bytes, lines 6369-7240
6369			};
6370		}),
6371
6372		// Miscellaneous
6373		"target": function( elem ) {
6374			var hash = window.location && window.location.hash;
6375			return hash && hash.slice( 1 ) === elem.id;
6376		},
6377
6378		"root": function( elem ) {
6379			return elem === docElem;
6380		},
6381
6382		"focus": function( elem ) {
6383			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
6384		},
6385
6386		// Boolean properties
6387		"enabled": createDisabledPseudo( false ),
6388		"disabled": createDisabledPseudo( true ),
6389
6390		"checked": function( elem ) {
6391			// In CSS3, :checked should return both checked and selected elements
6392			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
6393			var nodeName = elem.nodeName.toLowerCase();
6394			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
6395		},
6396
6397		"selected": function( elem ) {
6398			// Accessing this property makes selected-by-default
6399			// options in Safari work properly
6400			if ( elem.parentNode ) {
6401				elem.parentNode.selectedIndex;
6402			}
6403
6404			return elem.selected === true;
6405		},
6406
6407		// Contents
6408		"empty": function( elem ) {
6409			// http://www.w3.org/TR/selectors/#empty-pseudo
6410			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
6411			//   but not by others (comment: 8; processing instruction: 7; etc.)
6412			// nodeType < 6 works because attributes (2) do not appear as children
6413			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
6414				if ( elem.nodeType < 6 ) {
6415					return false;
6416				}
6417			}
6418			return true;
6419		},
6420
6421		"parent": function( elem ) {
6422			return !Expr.pseudos["empty"]( elem );
6423		},
6424
6425		// Element/input types
6426		"header": function( elem ) {
6427			return rheader.test( elem.nodeName );
6428		},
6429
6430		"input": function( elem ) {
6431			return rinputs.test( elem.nodeName );
6432		},
6433
6434		"button": function( elem ) {
6435			var name = elem.nodeName.toLowerCase();
6436			return name === "input" && elem.type === "button" || name === "button";
6437		},
6438
6439		"text": function( elem ) {
6440			var attr;
6441			return elem.nodeName.toLowerCase() === "input" &&
6442				elem.type === "text" &&
6443
6444				// Support: IE<8
6445				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
6446				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
6447		},
6448
6449		// Position-in-collection
6450		"first": createPositionalPseudo(function() {
6451			return [ 0 ];
6452		}),
6453
6454		"last": createPositionalPseudo(function( matchIndexes, length ) {
6455			return [ length - 1 ];
6456		}),
6457
6458		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
6459			return [ argument < 0 ? argument + length : argument ];
6460		}),
6461
6462		"even": createPositionalPseudo(function( matchIndexes, length ) {
6463			var i = 0;
6464			for ( ; i < length; i += 2 ) {
6465				matchIndexes.push( i );
6466			}
6467			return matchIndexes;
6468		}),
6469
6470		"odd": createPositionalPseudo(function( matchIndexes, length ) {
6471			var i = 1;
6472			for ( ; i < length; i += 2 ) {
6473				matchIndexes.push( i );
6474			}
6475			return matchIndexes;
6476		}),
6477
6478		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
6479			var i = argument < 0 ? argument + length : argument;
6480			for ( ; --i >= 0; ) {
6481				matchIndexes.push( i );
6482			}
6483			return matchIndexes;
6484		}),
6485
6486		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
6487			var i = argument < 0 ? argument + length : argument;
6488			for ( ; ++i < length; ) {
6489				matchIndexes.push( i );
6490			}
6491			return matchIndexes;
6492		})
6493	}
6494};
6495
6496Expr.pseudos["nth"] = Expr.pseudos["eq"];
6497
6498// Add button/input type pseudos
6499for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
6500	Expr.pseudos[ i ] = createInputPseudo( i );
6501}
6502for ( i in { submit: true, reset: true } ) {
6503	Expr.pseudos[ i ] = createButtonPseudo( i );
6504}
6505
6506// Easy API for creating new setFilters
6507function setFilters() {}
6508setFilters.prototype = Expr.filters = Expr.pseudos;
6509Expr.setFilters = new setFilters();
6510
6511tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
6512	var matched, match, tokens, type,
6513		soFar, groups, preFilters,
6514		cached = tokenCache[ selector + " " ];
6515
6516	if ( cached ) {
6517		return parseOnly ? 0 : cached.slice( 0 );
6518	}
6519
6520	soFar = selector;
6521	groups = [];
6522	preFilters = Expr.preFilter;
6523
6524	while ( soFar ) {
6525
6526		// Comma and first run
6527		if ( !matched || (match = rcomma.exec( soFar )) ) {
6528			if ( match ) {
6529				// Don't consume trailing commas as valid
6530				soFar = soFar.slice( match[0].length ) || soFar;
6531			}
6532			groups.push( (tokens = []) );
6533		}
6534
6535		matched = false;
6536
6537		// Combinators
6538		if ( (match = rcombinators.exec( soFar )) ) {
6539			matched = match.shift();
6540			tokens.push({
6541				value: matched,
6542				// Cast descendant combinators to space
6543				type: match[0].replace( rtrim, " " )
6544			});
6545			soFar = soFar.slice( matched.length );
6546		}
6547
6548		// Filters
6549		for ( type in Expr.filter ) {
6550			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
6551				(match = preFilters[ type ]( match ))) ) {
6552				matched = match.shift();
6553				tokens.push({
6554					value: matched,
6555					type: type,
6556					matches: match
6557				});
6558				soFar = soFar.slice( matched.length );
6559			}
6560		}
6561
6562		if ( !matched ) {
6563			break;
6564		}
6565	}
6566
6567	// Return the length of the invalid excess
6568	// if we're just parsing
6569	// Otherwise, throw an error or return tokens
6570	return parseOnly ?
6571		soFar.length :
6572		soFar ?
6573			Sizzle.error( selector ) :
6574			// Cache the tokens
6575			tokenCache( selector, groups ).slice( 0 );
6576};
6577
6578function toSelector( tokens ) {
6579	var i = 0,
6580		len = tokens.length,
6581		selector = "";
6582	for ( ; i < len; i++ ) {
6583		selector += tokens[i].value;
6584	}
6585	return selector;
6586}
6587
6588function addCombinator( matcher, combinator, base ) {
6589	var dir = combinator.dir,
6590		skip = combinator.next,
6591		key = skip || dir,
6592		checkNonElements = base && key === "parentNode",
6593		doneName = done++;
6594
6595	return combinator.first ?
6596		// Check against closest ancestor/preceding element
6597		function( elem, context, xml ) {
6598			while ( (elem = elem[ dir ]) ) {
6599				if ( elem.nodeType === 1 || checkNonElements ) {
6600					return matcher( elem, context, xml );
6601				}
6602			}
6603			return false;
6604		} :
6605
6606		// Check against all ancestor/preceding elements
6607		function( elem, context, xml ) {
6608			var oldCache, uniqueCache, outerCache,
6609				newCache = [ dirruns, doneName ];
6610
6611			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
6612			if ( xml ) {
6613				while ( (elem = elem[ dir ]) ) {
6614					if ( elem.nodeType === 1 || checkNonElements ) {
6615						if ( matcher( elem, context, xml ) ) {
6616							return true;
6617						}
6618					}
6619				}
6620			} else {
6621				while ( (elem = elem[ dir ]) ) {
6622					if ( elem.nodeType === 1 || checkNonElements ) {
6623						outerCache = elem[ expando ] || (elem[ expando ] = {});
6624
6625						// Support: IE <9 only
6626						// Defend against cloned attroperties (jQuery gh-1709)
6627						uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
6628
6629						if ( skip && skip === elem.nodeName.toLowerCase() ) {
6630							elem = elem[ dir ] || elem;
6631						} else if ( (oldCache = uniqueCache[ key ]) &&
6632							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
6633
6634							// Assign to newCache so results back-propagate to previous elements
6635							return (newCache[ 2 ] = oldCache[ 2 ]);
6636						} else {
6637							// Reuse newcache so results back-propagate to previous elements
6638							uniqueCache[ key ] = newCache;
6639
6640							// A match means we're done; a fail means we have to keep checking
6641							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
6642								return true;
6643							}
6644						}
6645					}
6646				}
6647			}
6648			return false;
6649		};
6650}
6651
6652function elementMatcher( matchers ) {
6653	return matchers.length > 1 ?
6654		function( elem, context, xml ) {
6655			var i = matchers.length;
6656			while ( i-- ) {
6657				if ( !matchers[i]( elem, context, xml ) ) {
6658					return false;
6659				}
6660			}
6661			return true;
6662		} :
6663		matchers[0];
6664}
6665
6666function multipleContexts( selector, contexts, results ) {
6667	var i = 0,
6668		len = contexts.length;
6669	for ( ; i < len; i++ ) {
6670		Sizzle( selector, contexts[i], results );
6671	}
6672	return results;
6673}
6674
6675function condense( unmatched, map, filter, context, xml ) {
6676	var elem,
6677		newUnmatched = [],
6678		i = 0,
6679		len = unmatched.length,
6680		mapped = map != null;
6681
6682	for ( ; i < len; i++ ) {
6683		if ( (elem = unmatched[i]) ) {
6684			if ( !filter || filter( elem, context, xml ) ) {
6685				newUnmatched.push( elem );
6686				if ( mapped ) {
6687					map.push( i );
6688				}
6689			}
6690		}
6691	}
6692
6693	return newUnmatched;
6694}
6695
6696function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
6697	if ( postFilter && !postFilter[ expando ] ) {
6698		postFilter = setMatcher( postFilter );
6699	}
6700	if ( postFinder && !postFinder[ expando ] ) {
6701		postFinder = setMatcher( postFinder, postSelector );
6702	}
6703	return markFunction(function( seed, results, context, xml ) {
6704		var temp, i, elem,
6705			preMap = [],
6706			postMap = [],
6707			preexisting = results.length,
6708
6709			// Get initial elements from seed or context
6710			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
6711
6712			// Prefilter to get matcher input, preserving a map for seed-results synchronization
6713			matcherIn = preFilter && ( seed || !selector ) ?
6714				condense( elems, preMap, preFilter, context, xml ) :
6715				elems,
6716
6717			matcherOut = matcher ?
6718				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
6719				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
6720
6721					// ...intermediate processing is necessary
6722					[] :
6723
6724					// ...otherwise use results directly
6725					results :
6726				matcherIn;
6727
6728		// Find primary matches
6729		if ( matcher ) {
6730			matcher( matcherIn, matcherOut, context, xml );
6731		}
6732
6733		// Apply postFilter
6734		if ( postFilter ) {
6735			temp = condense( matcherOut, postMap );
6736			postFilter( temp, [], context, xml );
6737
6738			// Un-match failing elements by moving them back to matcherIn
6739			i = temp.length;
6740			while ( i-- ) {
6741				if ( (elem = temp[i]) ) {
6742					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
6743				}
6744			}
6745		}
6746
6747		if ( seed ) {
6748			if ( postFinder || preFilter ) {
6749				if ( postFinder ) {
6750					// Get the final matcherOut by condensing this intermediate into postFinder contexts
6751					temp = [];
6752					i = matcherOut.length;
6753					while ( i-- ) {
6754						if ( (elem = matcherOut[i]) ) {
6755							// Restore matcherIn since elem is not yet a final match
6756							temp.push( (matcherIn[i] = elem) );
6757						}
6758					}
6759					postFinder( null, (matcherOut = []), temp, xml );
6760				}
6761
6762				// Move matched elements from seed to results to keep them synchronized
6763				i = matcherOut.length;
6764				while ( i-- ) {
6765					if ( (elem = matcherOut[i]) &&
6766						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
6767
6768						seed[temp] = !(results[temp] = elem);
6769					}
6770				}
6771			}
6772
6773		// Add elements to results, through postFinder if defined
6774		} else {
6775			matcherOut = condense(
6776				matcherOut === results ?
6777					matcherOut.splice( preexisting, matcherOut.length ) :
6778					matcherOut
6779			);
6780			if ( postFinder ) {
6781				postFinder( null, results, matcherOut, xml );
6782			} else {
6783				push.apply( results, matcherOut );
6784			}
6785		}
6786	});
6787}
6788
6789function matcherFromTokens( tokens ) {
6790	var checkContext, matcher, j,
6791		len = tokens.length,
6792		leadingRelative = Expr.relative[ tokens[0].type ],
6793		implicitRelative = leadingRelative || Expr.relative[" "],
6794		i = leadingRelative ? 1 : 0,
6795
6796		// The foundational matcher ensures that elements are reachable from top-level context(s)
6797		matchContext = addCombinator( function( elem ) {
6798			return elem === checkContext;
6799		}, implicitRelative, true ),
6800		matchAnyContext = addCombinator( function( elem ) {
6801			return indexOf( checkContext, elem ) > -1;
6802		}, implicitRelative, true ),
6803		matchers = [ function( elem, context, xml ) {
6804			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
6805				(checkContext = context).nodeType ?
6806					matchContext( elem, context, xml ) :
6807					matchAnyContext( elem, context, xml ) );
6808			// Avoid hanging onto element (issue #299)
6809			checkContext = null;
6810			return ret;
6811		} ];
6812
6813	for ( ; i < len; i++ ) {
6814		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
6815			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
6816		} else {
6817			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
6818
6819			// Return special upon seeing a positional matcher
6820			if ( matcher[ expando ] ) {
6821				// Find the next relative operator (if any) for proper handling
6822				j = ++i;
6823				for ( ; j < len; j++ ) {
6824					if ( Expr.relative[ tokens[j].type ] ) {
6825						break;
6826					}
6827				}
6828				return setMatcher(
6829					i > 1 && elementMatcher( matchers ),
6830					i > 1 && toSelector(
6831						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
6832						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
6833					).replace( rtrim, "$1" ),
6834					matcher,
6835					i < j && matcherFromTokens( tokens.slice( i, j ) ),
6836					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
6837					j < len && toSelector( tokens )
6838				);
6839			}
6840			matchers.push( matcher );
6841		}
6842	}
6843
6844	return elementMatcher( matchers );
6845}
6846
6847function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
6848	var bySet = setMatchers.length > 0,
6849		byElement = elementMatchers.length > 0,
6850		superMatcher = function( seed, context, xml, results, outermost ) {
6851			var elem, j, matcher,
6852				matchedCount = 0,
6853				i = "0",
6854				unmatched = seed && [],
6855				setMatched = [],
6856				contextBackup = outermostContext,
6857				// We must always have either seed elements or outermost context
6858				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
6859				// Use integer dirruns iff this is the outermost matcher
6860				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
6861				len = elems.length;
6862
6863			if ( outermost ) {
6864				outermostContext = context === document || context || outermost;
6865			}
6866
6867			// Add elements passing elementMatchers directly to results
6868			// Support: IE<9, Safari
6869			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
6870			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
6871				if ( byElement && elem ) {
6872					j = 0;
6873					if ( !context && elem.ownerDocument !== document ) {
6874						setDocument( elem );
6875						xml = !documentIsHTML;
6876					}
6877					while ( (matcher = elementMatchers[j++]) ) {
6878						if ( matcher( elem, context || document, xml) ) {
6879							results.push( elem );
6880							break;
6881						}
6882					}
6883					if ( outermost ) {
6884						dirruns = dirrunsUnique;
6885					}
6886				}
6887
6888				// Track unmatched elements for set filters
6889				if ( bySet ) {
6890					// They will have gone through all possible matchers
6891					if ( (elem = !matcher && elem) ) {
6892						matchedCount--;
6893					}
6894
6895					// Lengthen the array for every element, matched or not
6896					if ( seed ) {
6897						unmatched.push( elem );
6898					}
6899				}
6900			}
6901
6902			// `i` is now the count of elements visited above, and adding it to `matchedCount`
6903			// makes the latter nonnegative.
6904			matchedCount += i;
6905
6906			// Apply set filters to unmatched elements
6907			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
6908			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
6909			// no element matchers and no seed.
6910			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
6911			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
6912			// numerically zero.
6913			if ( bySet && i !== matchedCount ) {
6914				j = 0;
6915				while ( (matcher = setMatchers[j++]) ) {
6916					matcher( unmatched, setMatched, context, xml );
6917				}
6918
6919				if ( seed ) {
6920					// Reintegrate element matches to eliminate the need for sorting
6921					if ( matchedCount > 0 ) {
6922						while ( i-- ) {
6923							if ( !(unmatched[i] || setMatched[i]) ) {
6924								setMatched[i] = pop.call( results );
6925							}
6926						}
6927					}
6928
6929					// Discard index placeholder values to get only actual matches
6930					setMatched = condense( setMatched );
6931				}
6932
6933				// Add matches to results
6934				push.apply( results, setMatched );
6935
6936				// Seedless set matches succeeding multiple successful matchers stipulate sorting
6937				if ( outermost && !seed && setMatched.length > 0 &&
6938					( matchedCount + setMatchers.length ) > 1 ) {
6939
6940					Sizzle.uniqueSort( results );
6941				}
6942			}
6943
6944			// Override manipulation of globals by nested matchers
6945			if ( outermost ) {
6946				dirruns = dirrunsUnique;
6947				outermostContext = contextBackup;
6948			}
6949
6950			return unmatched;
6951		};
6952
6953	return bySet ?
6954		markFunction( superMatcher ) :
6955		superMatcher;
6956}
6957
6958compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
6959	var i,
6960		setMatchers = [],
6961		elementMatchers = [],
6962		cached = compilerCache[ selector + " " ];
6963
6964	if ( !cached ) {
6965		// Generate a function of recursive functions that can be used to check each element
6966		if ( !match ) {
6967			match = tokenize( selector );
6968		}
6969		i = match.length;
6970		while ( i-- ) {
6971			cached = matcherFromTokens( match[i] );
6972			if ( cached[ expando ] ) {
6973				setMatchers.push( cached );
6974			} else {
6975				elementMatchers.push( cached );
6976			}
6977		}
6978
6979		// Cache the compiled function
6980		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
6981
6982		// Save selector and tokenization
6983		cached.selector = selector;
6984	}
6985	return cached;
6986};
6987
6988/**
6989 * A low-level selection function that works with Sizzle's compiled
6990 *  selector functions
6991 * @param {String|Function} selector A selector or a pre-compiled
6992 *  selector function built with Sizzle.compile
6993 * @param {Element} context
6994 * @param {Array} [results]
6995 * @param {Array} [seed] A set of elements to match against
6996 */
6997select = Sizzle.select = function( selector, context, results, seed ) {
6998	var i, tokens, token, type, find,
6999		compiled = typeof selector === "function" && selector,
7000		match = !seed && tokenize( (selector = compiled.selector || selector) );
7001
7002	results = results || [];
7003
7004	// Try to minimize operations if there is only one selector in the list and no seed
7005	// (the latter of which guarantees us context)
7006	if ( match.length === 1 ) {
7007
7008		// Reduce context if the leading compound selector is an ID
7009		tokens = match[0] = match[0].slice( 0 );
7010		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
7011				context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
7012
7013			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
7014			if ( !context ) {
7015				return results;
7016
7017			// Precompiled matchers will still verify ancestry, so step up a level
7018			} else if ( compiled ) {
7019				context = context.parentNode;
7020			}
7021
7022			selector = selector.slice( tokens.shift().value.length );
7023		}
7024
7025		// Fetch a seed set for right-to-left matching
7026		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
7027		while ( i-- ) {
7028			token = tokens[i];
7029
7030			// Abort if we hit a combinator
7031			if ( Expr.relative[ (type = token.type) ] ) {
7032				break;
7033			}
7034			if ( (find = Expr.find[ type ]) ) {
7035				// Search, expanding context for leading sibling combinators
7036				if ( (seed = find(
7037					token.matches[0].replace( runescape, funescape ),
7038					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
7039				)) ) {
7040
7041					// If seed is empty or no tokens remain, we can return early
7042					tokens.splice( i, 1 );
7043					selector = seed.length && toSelector( tokens );
7044					if ( !selector ) {
7045						push.apply( results, seed );
7046						return results;
7047					}
7048
7049					break;
7050				}
7051			}
7052		}
7053	}
7054
7055	// Compile and execute a filtering function if one is not provided
7056	// Provide `match` to avoid retokenization if we modified the selector above
7057	( compiled || compile( selector, match ) )(
7058		seed,
7059		context,
7060		!documentIsHTML,
7061		results,
7062		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
7063	);
7064	return results;
7065};
7066
7067// One-time assignments
7068
7069// Sort stability
7070support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
7071
7072// Support: Chrome 14-35+
7073// Always assume duplicates if they aren't passed to the comparison function
7074support.detectDuplicates = !!hasDuplicate;
7075
7076// Initialize against the default document
7077setDocument();
7078
7079// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
7080// Detached nodes confoundingly follow *each other*
7081support.sortDetached = assert(function( el ) {
7082	// Should return 1, but returns 4 (following)
7083	return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
7084});
7085
7086// Support: IE<8
7087// Prevent attribute/property "interpolation"
7088// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
7089if ( !assert(function( el ) {
7090	el.innerHTML = "<a href='#'></a>";
7091	return el.firstChild.getAttribute("href") === "#" ;
7092}) ) {
7093	addHandle( "type|href|height|width", function( elem, name, isXML ) {
7094		if ( !isXML ) {
7095			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
7096		}
7097	});
7098}
7099
7100// Support: IE<9
7101// Use defaultValue in place of getAttribute("value")
7102if ( !support.attributes || !assert(function( el ) {
7103	el.innerHTML = "<input/>";
7104	el.firstChild.setAttribute( "value", "" );
7105	return el.firstChild.getAttribute( "value" ) === "";
7106}) ) {
7107	addHandle( "value", function( elem, name, isXML ) {
7108		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
7109			return elem.defaultValue;
7110		}
7111	});
7112}
7113
7114// Support: IE<9
7115// Use getAttributeNode to fetch booleans when getAttribute lies
7116if ( !assert(function( el ) {
7117	return el.getAttribute("disabled") == null;
7118}) ) {
7119	addHandle( booleans, function( elem, name, isXML ) {
7120		var val;
7121		if ( !isXML ) {
7122			return elem[ name ] === true ? name.toLowerCase() :
7123					(val = elem.getAttributeNode( name )) && val.specified ?
7124					val.value :
7125				null;
7126		}
7127	});
7128}
7129
7130return Sizzle;
7131
7132})( window );
7133
7134
7135
7136jQuery.find = Sizzle;
7137jQuery.expr = Sizzle.selectors;
7138
7139// Deprecated
7140jQuery.expr[ ":" ] = jQuery.expr.pseudos;
7141jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
7142jQuery.text = Sizzle.getText;
7143jQuery.isXMLDoc = Sizzle.isXML;
7144jQuery.contains = Sizzle.contains;
7145jQuery.escapeSelector = Sizzle.escape;
7146
7147
7148
7149
7150var dir = function( elem, dir, until ) {
7151	var matched = [],
7152		truncate = until !== undefined;
7153
7154	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
7155		if ( elem.nodeType === 1 ) {
7156			if ( truncate && jQuery( elem ).is( until ) ) {
7157				break;
7158			}
7159			matched.push( elem );
7160		}
7161	}
7162	return matched;
7163};
7164
7165
7166var siblings = function( n, elem ) {
7167	var matched = [];
7168
7169	for ( ; n; n = n.nextSibling ) {
7170		if ( n.nodeType === 1 && n !== elem ) {
7171			matched.push( n );
7172		}
7173	}
7174
7175	return matched;
7176};
7177
7178
7179var rneedsContext = jQuery.expr.match.needsContext;
7180
7181
7182
7183function nodeName( elem, name ) {
7184
7185  return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
7186
7187};
7188var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
7189
7190
7191
7192// Implement the identical functionality for filter and not
7193function winnow( elements, qualifier, not ) {
7194	if ( isFunction( qualifier ) ) {
7195		return jQuery.grep( elements, function( elem, i ) {
7196			return !!qualifier.call( elem, i, elem ) !== not;
7197		} );
7198	}
7199
7200	// Single element
7201	if ( qualifier.nodeType ) {
7202		return jQuery.grep( elements, function( elem ) {
7203			return ( elem === qualifier ) !== not;
7204		} );
7205	}
7206
7207	// Arraylike of elements (jQuery, arguments, Array)
7208	if ( typeof qualifier !== "string" ) {
7209		return jQuery.grep( elements, function( elem ) {
7210			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
7211		} );
7212	}
7213
7214	// Filtered directly for both simple and complex selectors
7215	return jQuery.filter( qualifier, elements, not );
7216}
7217
7218jQuery.filter = function( expr, elems, not ) {
7219	var elem = elems[ 0 ];
7220
7221	if ( not ) {
7222		expr = ":not(" + expr + ")";
7223	}
7224
7225	if ( elems.length === 1 && elem.nodeType === 1 ) {
7226		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
7227	}
7228
7229	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
7230		return elem.nodeType === 1;
7231	} ) );
7232};
7233
7234jQuery.fn.extend( {
7235	find: function( selector ) {
7236		var i, ret,
7237			len = this.length,
7238			self = this;
7239
7240		if ( typeof selector !== "string" ) {
vendor: 4,662 bytes, lines 7241-7426
7241			return this.pushStack( jQuery( selector ).filter( function() {
7242				for ( i = 0; i < len; i++ ) {
7243					if ( jQuery.contains( self[ i ], this ) ) {
7244						return true;
7245					}
7246				}
7247			} ) );
7248		}
7249
7250		ret = this.pushStack( [] );
7251
7252		for ( i = 0; i < len; i++ ) {
7253			jQuery.find( selector, self[ i ], ret );
7254		}
7255
7256		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
7257	},
7258	filter: function( selector ) {
7259		return this.pushStack( winnow( this, selector || [], false ) );
7260	},
7261	not: function( selector ) {
7262		return this.pushStack( winnow( this, selector || [], true ) );
7263	},
7264	is: function( selector ) {
7265		return !!winnow(
7266			this,
7267
7268			// If this is a positional/relative selector, check membership in the returned set
7269			// so $("p:first").is("p:last") won't return true for a doc with two "p".
7270			typeof selector === "string" && rneedsContext.test( selector ) ?
7271				jQuery( selector ) :
7272				selector || [],
7273			false
7274		).length;
7275	}
7276} );
7277
7278
7279// Initialize a jQuery object
7280
7281
7282// A central reference to the root jQuery(document)
7283var rootjQuery,
7284
7285	// A simple way to check for HTML strings
7286	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
7287	// Strict HTML recognition (#11290: must start with <)
7288	// Shortcut simple #id case for speed
7289	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
7290
7291	init = jQuery.fn.init = function( selector, context, root ) {
7292		var match, elem;
7293
7294		// HANDLE: $(""), $(null), $(undefined), $(false)
7295		if ( !selector ) {
7296			return this;
7297		}
7298
7299		// Method init() accepts an alternate rootjQuery
7300		// so migrate can support jQuery.sub (gh-2101)
7301		root = root || rootjQuery;
7302
7303		// Handle HTML strings
7304		if ( typeof selector === "string" ) {
7305			if ( selector[ 0 ] === "<" &&
7306				selector[ selector.length - 1 ] === ">" &&
7307				selector.length >= 3 ) {
7308
7309				// Assume that strings that start and end with <> are HTML and skip the regex check
7310				match = [ null, selector, null ];
7311
7312			} else {
7313				match = rquickExpr.exec( selector );
7314			}
7315
7316			// Match html or make sure no context is specified for #id
7317			if ( match && ( match[ 1 ] || !context ) ) {
7318
7319				// HANDLE: $(html) -> $(array)
7320				if ( match[ 1 ] ) {
7321					context = context instanceof jQuery ? context[ 0 ] : context;
7322
7323					// Option to run scripts is true for back-compat
7324					// Intentionally let the error be thrown if parseHTML is not present
7325					jQuery.merge( this, jQuery.parseHTML(
7326						match[ 1 ],
7327						context && context.nodeType ? context.ownerDocument || context : document,
7328						true
7329					) );
7330
7331					// HANDLE: $(html, props)
7332					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
7333						for ( match in context ) {
7334
7335							// Properties of context are called as methods if possible
7336							if ( isFunction( this[ match ] ) ) {
7337								this[ match ]( context[ match ] );
7338
7339							// ...and otherwise set as attributes
7340							} else {
7341								this.attr( match, context[ match ] );
7342							}
7343						}
7344					}
7345
7346					return this;
7347
7348				// HANDLE: $(#id)
7349				} else {
7350					elem = document.getElementById( match[ 2 ] );
7351
7352					if ( elem ) {
7353
7354						// Inject the element directly into the jQuery object
7355						this[ 0 ] = elem;
7356						this.length = 1;
7357					}
7358					return this;
7359				}
7360
7361			// HANDLE: $(expr, $(...))
7362			} else if ( !context || context.jquery ) {
7363				return ( context || root ).find( selector );
7364
7365			// HANDLE: $(expr, context)
7366			// (which is just equivalent to: $(context).find(expr)
7367			} else {
7368				return this.constructor( context ).find( selector );
7369			}
7370
7371		// HANDLE: $(DOMElement)
7372		} else if ( selector.nodeType ) {
7373			this[ 0 ] = selector;
7374			this.length = 1;
7375			return this;
7376
7377		// HANDLE: $(function)
7378		// Shortcut for document ready
7379		} else if ( isFunction( selector ) ) {
7380			return root.ready !== undefined ?
7381				root.ready( selector ) :
7382
7383				// Execute immediately if ready is not present
7384				selector( jQuery );
7385		}
7386
7387		return jQuery.makeArray( selector, this );
7388	};
7389
7390// Give the init function the jQuery prototype for later instantiation
7391init.prototype = jQuery.fn;
7392
7393// Initialize central reference
7394rootjQuery = jQuery( document );
7395
7396
7397var rparentsprev = /^(?:parents|prev(?:Until|All))/,
7398
7399	// Methods guaranteed to produce a unique set when starting from a unique set
7400	guaranteedUnique = {
7401		children: true,
7402		contents: true,
7403		next: true,
7404		prev: true
7405	};
7406
7407jQuery.fn.extend( {
7408	has: function( target ) {
7409		var targets = jQuery( target, this ),
7410			l = targets.length;
7411
7412		return this.filter( function() {
7413			var i = 0;
7414			for ( ; i < l; i++ ) {
7415				if ( jQuery.contains( this, targets[ i ] ) ) {
7416					return true;
7417				}
7418			}
7419		} );
7420	},
7421
7422	closest: function( selectors, context ) {
7423		var cur,
7424			i = 0,
7425			l = this.length,
7426			matched = [],
vendor: 6,003 bytes, lines 7427-7653
7427			targets = typeof selectors !== "string" && jQuery( selectors );
7428
7429		// Positional selectors never match, since there's no _selection_ context
7430		if ( !rneedsContext.test( selectors ) ) {
7431			for ( ; i < l; i++ ) {
7432				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
7433
7434					// Always skip document fragments
7435					if ( cur.nodeType < 11 && ( targets ?
7436						targets.index( cur ) > -1 :
7437
7438						// Don't pass non-elements to Sizzle
7439						cur.nodeType === 1 &&
7440							jQuery.find.matchesSelector( cur, selectors ) ) ) {
7441
7442						matched.push( cur );
7443						break;
7444					}
7445				}
7446			}
7447		}
7448
7449		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
7450	},
7451
7452	// Determine the position of an element within the set
7453	index: function( elem ) {
7454
7455		// No argument, return index in parent
7456		if ( !elem ) {
7457			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
7458		}
7459
7460		// Index in selector
7461		if ( typeof elem === "string" ) {
7462			return indexOf.call( jQuery( elem ), this[ 0 ] );
7463		}
7464
7465		// Locate the position of the desired element
7466		return indexOf.call( this,
7467
7468			// If it receives a jQuery object, the first element is used
7469			elem.jquery ? elem[ 0 ] : elem
7470		);
7471	},
7472
7473	add: function( selector, context ) {
7474		return this.pushStack(
7475			jQuery.uniqueSort(
7476				jQuery.merge( this.get(), jQuery( selector, context ) )
7477			)
7478		);
7479	},
7480
7481	addBack: function( selector ) {
7482		return this.add( selector == null ?
7483			this.prevObject : this.prevObject.filter( selector )
7484		);
7485	}
7486} );
7487
7488function sibling( cur, dir ) {
7489	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
7490	return cur;
7491}
7492
7493jQuery.each( {
7494	parent: function( elem ) {
7495		var parent = elem.parentNode;
7496		return parent && parent.nodeType !== 11 ? parent : null;
7497	},
7498	parents: function( elem ) {
7499		return dir( elem, "parentNode" );
7500	},
7501	parentsUntil: function( elem, i, until ) {
7502		return dir( elem, "parentNode", until );
7503	},
7504	next: function( elem ) {
7505		return sibling( elem, "nextSibling" );
7506	},
7507	prev: function( elem ) {
7508		return sibling( elem, "previousSibling" );
7509	},
7510	nextAll: function( elem ) {
7511		return dir( elem, "nextSibling" );
7512	},
7513	prevAll: function( elem ) {
7514		return dir( elem, "previousSibling" );
7515	},
7516	nextUntil: function( elem, i, until ) {
7517		return dir( elem, "nextSibling", until );
7518	},
7519	prevUntil: function( elem, i, until ) {
7520		return dir( elem, "previousSibling", until );
7521	},
7522	siblings: function( elem ) {
7523		return siblings( ( elem.parentNode || {} ).firstChild, elem );
7524	},
7525	children: function( elem ) {
7526		return siblings( elem.firstChild );
7527	},
7528	contents: function( elem ) {
7529        if ( nodeName( elem, "iframe" ) ) {
7530            return elem.contentDocument;
7531        }
7532
7533        // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
7534        // Treat the template element as a regular one in browsers that
7535        // don't support it.
7536        if ( nodeName( elem, "template" ) ) {
7537            elem = elem.content || elem;
7538        }
7539
7540        return jQuery.merge( [], elem.childNodes );
7541	}
7542}, function( name, fn ) {
7543	jQuery.fn[ name ] = function( until, selector ) {
7544		var matched = jQuery.map( this, fn, until );
7545
7546		if ( name.slice( -5 ) !== "Until" ) {
7547			selector = until;
7548		}
7549
7550		if ( selector && typeof selector === "string" ) {
7551			matched = jQuery.filter( selector, matched );
7552		}
7553
7554		if ( this.length > 1 ) {
7555
7556			// Remove duplicates
7557			if ( !guaranteedUnique[ name ] ) {
7558				jQuery.uniqueSort( matched );
7559			}
7560
7561			// Reverse order for parents* and prev-derivatives
7562			if ( rparentsprev.test( name ) ) {
7563				matched.reverse();
7564			}
7565		}
7566
7567		return this.pushStack( matched );
7568	};
7569} );
7570var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
7571
7572
7573
7574// Convert String-formatted options into Object-formatted ones
7575function createOptions( options ) {
7576	var object = {};
7577	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
7578		object[ flag ] = true;
7579	} );
7580	return object;
7581}
7582
7583/*
7584 * Create a callback list using the following parameters:
7585 *
7586 *	options: an optional list of space-separated options that will change how
7587 *			the callback list behaves or a more traditional option object
7588 *
7589 * By default a callback list will act like an event callback list and can be
7590 * "fired" multiple times.
7591 *
7592 * Possible options:
7593 *
7594 *	once:			will ensure the callback list can only be fired once (like a Deferred)
7595 *
7596 *	memory:			will keep track of previous values and will call any callback added
7597 *					after the list has been fired right away with the latest "memorized"
7598 *					values (like a Deferred)
7599 *
7600 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
7601 *
7602 *	stopOnFalse:	interrupt callings when a callback returns false
7603 *
7604 */
7605jQuery.Callbacks = function( options ) {
7606
7607	// Convert options from String-formatted to Object-formatted if needed
7608	// (we check in cache first)
7609	options = typeof options === "string" ?
7610		createOptions( options ) :
7611		jQuery.extend( {}, options );
7612
7613	var // Flag to know if list is currently firing
7614		firing,
7615
7616		// Last fire value for non-forgettable lists
7617		memory,
7618
7619		// Flag to know if list was already fired
7620		fired,
7621
7622		// Flag to prevent firing
7623		locked,
7624
7625		// Actual callback list
7626		list = [],
7627
7628		// Queue of execution data for repeatable lists
7629		queue = [],
7630
7631		// Index of currently firing callback (modified by add/remove as needed)
7632		firingIndex = -1,
7633
7634		// Fire callbacks
7635		fire = function() {
7636
7637			// Enforce single-firing
7638			locked = locked || options.once;
7639
7640			// Execute callbacks for all pending executions,
7641			// respecting firingIndex overrides and runtime changes
7642			fired = firing = true;
7643			for ( ; queue.length; firingIndex = -1 ) {
7644				memory = queue.shift();
7645				while ( ++firingIndex < list.length ) {
7646
7647					// Run callback and check for early termination
7648					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
7649						options.stopOnFalse ) {
7650
7651						// Jump to end and forget the data so .add doesn't re-fire
7652						firingIndex = list.length;
7653						memory = false;
vendor: 4,918 bytes, lines 7654-7863
7654					}
7655				}
7656			}
7657
7658			// Forget the data if we're done with it
7659			if ( !options.memory ) {
7660				memory = false;
7661			}
7662
7663			firing = false;
7664
7665			// Clean up if we're done firing for good
7666			if ( locked ) {
7667
7668				// Keep an empty list if we have data for future add calls
7669				if ( memory ) {
7670					list = [];
7671
7672				// Otherwise, this object is spent
7673				} else {
7674					list = "";
7675				}
7676			}
7677		},
7678
7679		// Actual Callbacks object
7680		self = {
7681
7682			// Add a callback or a collection of callbacks to the list
7683			add: function() {
7684				if ( list ) {
7685
7686					// If we have memory from a past run, we should fire after adding
7687					if ( memory && !firing ) {
7688						firingIndex = list.length - 1;
7689						queue.push( memory );
7690					}
7691
7692					( function add( args ) {
7693						jQuery.each( args, function( _, arg ) {
7694							if ( isFunction( arg ) ) {
7695								if ( !options.unique || !self.has( arg ) ) {
7696									list.push( arg );
7697								}
7698							} else if ( arg && arg.length && toType( arg ) !== "string" ) {
7699
7700								// Inspect recursively
7701								add( arg );
7702							}
7703						} );
7704					} )( arguments );
7705
7706					if ( memory && !firing ) {
7707						fire();
7708					}
7709				}
7710				return this;
7711			},
7712
7713			// Remove a callback from the list
7714			remove: function() {
7715				jQuery.each( arguments, function( _, arg ) {
7716					var index;
7717					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
7718						list.splice( index, 1 );
7719
7720						// Handle firing indexes
7721						if ( index <= firingIndex ) {
7722							firingIndex--;
7723						}
7724					}
7725				} );
7726				return this;
7727			},
7728
7729			// Check if a given callback is in the list.
7730			// If no argument is given, return whether or not list has callbacks attached.
7731			has: function( fn ) {
7732				return fn ?
7733					jQuery.inArray( fn, list ) > -1 :
7734					list.length > 0;
7735			},
7736
7737			// Remove all callbacks from the list
7738			empty: function() {
7739				if ( list ) {
7740					list = [];
7741				}
7742				return this;
7743			},
7744
7745			// Disable .fire and .add
7746			// Abort any current/pending executions
7747			// Clear all callbacks and values
7748			disable: function() {
7749				locked = queue = [];
7750				list = memory = "";
7751				return this;
7752			},
7753			disabled: function() {
7754				return !list;
7755			},
7756
7757			// Disable .fire
7758			// Also disable .add unless we have memory (since it would have no effect)
7759			// Abort any pending executions
7760			lock: function() {
7761				locked = queue = [];
7762				if ( !memory && !firing ) {
7763					list = memory = "";
7764				}
7765				return this;
7766			},
7767			locked: function() {
7768				return !!locked;
7769			},
7770
7771			// Call all callbacks with the given context and arguments
7772			fireWith: function( context, args ) {
7773				if ( !locked ) {
7774					args = args || [];
7775					args = [ context, args.slice ? args.slice() : args ];
7776					queue.push( args );
7777					if ( !firing ) {
7778						fire();
7779					}
7780				}
7781				return this;
7782			},
7783
7784			// Call all the callbacks with the given arguments
7785			fire: function() {
7786				self.fireWith( this, arguments );
7787				return this;
7788			},
7789
7790			// To know if the callbacks have already been called at least once
7791			fired: function() {
7792				return !!fired;
7793			}
7794		};
7795
7796	return self;
7797};
7798
7799
7800function Identity( v ) {
7801	return v;
7802}
7803function Thrower( ex ) {
7804	throw ex;
7805}
7806
7807function adoptValue( value, resolve, reject, noValue ) {
7808	var method;
7809
7810	try {
7811
7812		// Check for promise aspect first to privilege synchronous behavior
7813		if ( value && isFunction( ( method = value.promise ) ) ) {
7814			method.call( value ).done( resolve ).fail( reject );
7815
7816		// Other thenables
7817		} else if ( value && isFunction( ( method = value.then ) ) ) {
7818			method.call( value, resolve, reject );
7819
7820		// Other non-thenables
7821		} else {
7822
7823			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
7824			// * false: [ value ].slice( 0 ) => resolve( value )
7825			// * true: [ value ].slice( 1 ) => resolve()
7826			resolve.apply( undefined, [ value ].slice( noValue ) );
7827		}
7828
7829	// For Promises/A+, convert exceptions into rejections
7830	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
7831	// Deferred#then to conditionally suppress rejection.
7832	} catch ( value ) {
7833
7834		// Support: Android 4.0 only
7835		// Strict mode functions invoked without .call/.apply get global-object context
7836		reject.apply( undefined, [ value ] );
7837	}
7838}
7839
7840jQuery.extend( {
7841
7842	Deferred: function( func ) {
7843		var tuples = [
7844
7845				// action, add listener, callbacks,
7846				// ... .then handlers, argument index, [final state]
7847				[ "notify", "progress", jQuery.Callbacks( "memory" ),
7848					jQuery.Callbacks( "memory" ), 2 ],
7849				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
7850					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
7851				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
7852					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
7853			],
7854			state = "pending",
7855			promise = {
7856				state: function() {
7857					return state;
7858				},
7859				always: function() {
7860					deferred.done( arguments ).fail( arguments );
7861					return this;
7862				},
7863				"catch": function( fn ) {
vendor: 15,167 bytes, lines 7864-8455
7864					return promise.then( null, fn );
7865				},
7866
7867				// Keep pipe for back-compat
7868				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
7869					var fns = arguments;
7870
7871					return jQuery.Deferred( function( newDefer ) {
7872						jQuery.each( tuples, function( i, tuple ) {
7873
7874							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
7875							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
7876
7877							// deferred.progress(function() { bind to newDefer or newDefer.notify })
7878							// deferred.done(function() { bind to newDefer or newDefer.resolve })
7879							// deferred.fail(function() { bind to newDefer or newDefer.reject })
7880							deferred[ tuple[ 1 ] ]( function() {
7881								var returned = fn && fn.apply( this, arguments );
7882								if ( returned && isFunction( returned.promise ) ) {
7883									returned.promise()
7884										.progress( newDefer.notify )
7885										.done( newDefer.resolve )
7886										.fail( newDefer.reject );
7887								} else {
7888									newDefer[ tuple[ 0 ] + "With" ](
7889										this,
7890										fn ? [ returned ] : arguments
7891									);
7892								}
7893							} );
7894						} );
7895						fns = null;
7896					} ).promise();
7897				},
7898				then: function( onFulfilled, onRejected, onProgress ) {
7899					var maxDepth = 0;
7900					function resolve( depth, deferred, handler, special ) {
7901						return function() {
7902							var that = this,
7903								args = arguments,
7904								mightThrow = function() {
7905									var returned, then;
7906
7907									// Support: Promises/A+ section 2.3.3.3.3
7908									// https://promisesaplus.com/#point-59
7909									// Ignore double-resolution attempts
7910									if ( depth < maxDepth ) {
7911										return;
7912									}
7913
7914									returned = handler.apply( that, args );
7915
7916									// Support: Promises/A+ section 2.3.1
7917									// https://promisesaplus.com/#point-48
7918									if ( returned === deferred.promise() ) {
7919										throw new TypeError( "Thenable self-resolution" );
7920									}
7921
7922									// Support: Promises/A+ sections 2.3.3.1, 3.5
7923									// https://promisesaplus.com/#point-54
7924									// https://promisesaplus.com/#point-75
7925									// Retrieve `then` only once
7926									then = returned &&
7927
7928										// Support: Promises/A+ section 2.3.4
7929										// https://promisesaplus.com/#point-64
7930										// Only check objects and functions for thenability
7931										( typeof returned === "object" ||
7932											typeof returned === "function" ) &&
7933										returned.then;
7934
7935									// Handle a returned thenable
7936									if ( isFunction( then ) ) {
7937
7938										// Special processors (notify) just wait for resolution
7939										if ( special ) {
7940											then.call(
7941												returned,
7942												resolve( maxDepth, deferred, Identity, special ),
7943												resolve( maxDepth, deferred, Thrower, special )
7944											);
7945
7946										// Normal processors (resolve) also hook into progress
7947										} else {
7948
7949											// ...and disregard older resolution values
7950											maxDepth++;
7951
7952											then.call(
7953												returned,
7954												resolve( maxDepth, deferred, Identity, special ),
7955												resolve( maxDepth, deferred, Thrower, special ),
7956												resolve( maxDepth, deferred, Identity,
7957													deferred.notifyWith )
7958											);
7959										}
7960
7961									// Handle all other returned values
7962									} else {
7963
7964										// Only substitute handlers pass on context
7965										// and multiple values (non-spec behavior)
7966										if ( handler !== Identity ) {
7967											that = undefined;
7968											args = [ returned ];
7969										}
7970
7971										// Process the value(s)
7972										// Default process is resolve
7973										( special || deferred.resolveWith )( that, args );
7974									}
7975								},
7976
7977								// Only normal processors (resolve) catch and reject exceptions
7978								process = special ?
7979									mightThrow :
7980									function() {
7981										try {
7982											mightThrow();
7983										} catch ( e ) {
7984
7985											if ( jQuery.Deferred.exceptionHook ) {
7986												jQuery.Deferred.exceptionHook( e,
7987													process.stackTrace );
7988											}
7989
7990											// Support: Promises/A+ section 2.3.3.3.4.1
7991											// https://promisesaplus.com/#point-61
7992											// Ignore post-resolution exceptions
7993											if ( depth + 1 >= maxDepth ) {
7994
7995												// Only substitute handlers pass on context
7996												// and multiple values (non-spec behavior)
7997												if ( handler !== Thrower ) {
7998													that = undefined;
7999													args = [ e ];
8000												}
8001
8002												deferred.rejectWith( that, args );
8003											}
8004										}
8005									};
8006
8007							// Support: Promises/A+ section 2.3.3.3.1
8008							// https://promisesaplus.com/#point-57
8009							// Re-resolve promises immediately to dodge false rejection from
8010							// subsequent errors
8011							if ( depth ) {
8012								process();
8013							} else {
8014
8015								// Call an optional hook to record the stack, in case of exception
8016								// since it's otherwise lost when execution goes async
8017								if ( jQuery.Deferred.getStackHook ) {
8018									process.stackTrace = jQuery.Deferred.getStackHook();
8019								}
8020								window.setTimeout( process );
8021							}
8022						};
8023					}
8024
8025					return jQuery.Deferred( function( newDefer ) {
8026
8027						// progress_handlers.add( ... )
8028						tuples[ 0 ][ 3 ].add(
8029							resolve(
8030								0,
8031								newDefer,
8032								isFunction( onProgress ) ?
8033									onProgress :
8034									Identity,
8035								newDefer.notifyWith
8036							)
8037						);
8038
8039						// fulfilled_handlers.add( ... )
8040						tuples[ 1 ][ 3 ].add(
8041							resolve(
8042								0,
8043								newDefer,
8044								isFunction( onFulfilled ) ?
8045									onFulfilled :
8046									Identity
8047							)
8048						);
8049
8050						// rejected_handlers.add( ... )
8051						tuples[ 2 ][ 3 ].add(
8052							resolve(
8053								0,
8054								newDefer,
8055								isFunction( onRejected ) ?
8056									onRejected :
8057									Thrower
8058							)
8059						);
8060					} ).promise();
8061				},
8062
8063				// Get a promise for this deferred
8064				// If obj is provided, the promise aspect is added to the object
8065				promise: function( obj ) {
8066					return obj != null ? jQuery.extend( obj, promise ) : promise;
8067				}
8068			},
8069			deferred = {};
8070
8071		// Add list-specific methods
8072		jQuery.each( tuples, function( i, tuple ) {
8073			var list = tuple[ 2 ],
8074				stateString = tuple[ 5 ];
8075
8076			// promise.progress = list.add
8077			// promise.done = list.add
8078			// promise.fail = list.add
8079			promise[ tuple[ 1 ] ] = list.add;
8080
8081			// Handle state
8082			if ( stateString ) {
8083				list.add(
8084					function() {
8085
8086						// state = "resolved" (i.e., fulfilled)
8087						// state = "rejected"
8088						state = stateString;
8089					},
8090
8091					// rejected_callbacks.disable
8092					// fulfilled_callbacks.disable
8093					tuples[ 3 - i ][ 2 ].disable,
8094
8095					// rejected_handlers.disable
8096					// fulfilled_handlers.disable
8097					tuples[ 3 - i ][ 3 ].disable,
8098
8099					// progress_callbacks.lock
8100					tuples[ 0 ][ 2 ].lock,
8101
8102					// progress_handlers.lock
8103					tuples[ 0 ][ 3 ].lock
8104				);
8105			}
8106
8107			// progress_handlers.fire
8108			// fulfilled_handlers.fire
8109			// rejected_handlers.fire
8110			list.add( tuple[ 3 ].fire );
8111
8112			// deferred.notify = function() { deferred.notifyWith(...) }
8113			// deferred.resolve = function() { deferred.resolveWith(...) }
8114			// deferred.reject = function() { deferred.rejectWith(...) }
8115			deferred[ tuple[ 0 ] ] = function() {
8116				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
8117				return this;
8118			};
8119
8120			// deferred.notifyWith = list.fireWith
8121			// deferred.resolveWith = list.fireWith
8122			// deferred.rejectWith = list.fireWith
8123			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
8124		} );
8125
8126		// Make the deferred a promise
8127		promise.promise( deferred );
8128
8129		// Call given func if any
8130		if ( func ) {
8131			func.call( deferred, deferred );
8132		}
8133
8134		// All done!
8135		return deferred;
8136	},
8137
8138	// Deferred helper
8139	when: function( singleValue ) {
8140		var
8141
8142			// count of uncompleted subordinates
8143			remaining = arguments.length,
8144
8145			// count of unprocessed arguments
8146			i = remaining,
8147
8148			// subordinate fulfillment data
8149			resolveContexts = Array( i ),
8150			resolveValues = slice.call( arguments ),
8151
8152			// the master Deferred
8153			master = jQuery.Deferred(),
8154
8155			// subordinate callback factory
8156			updateFunc = function( i ) {
8157				return function( value ) {
8158					resolveContexts[ i ] = this;
8159					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
8160					if ( !( --remaining ) ) {
8161						master.resolveWith( resolveContexts, resolveValues );
8162					}
8163				};
8164			};
8165
8166		// Single- and empty arguments are adopted like Promise.resolve
8167		if ( remaining <= 1 ) {
8168			adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
8169				!remaining );
8170
8171			// Use .then() to unwrap secondary thenables (cf. gh-3000)
8172			if ( master.state() === "pending" ||
8173				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
8174
8175				return master.then();
8176			}
8177		}
8178
8179		// Multiple arguments are aggregated like Promise.all array elements
8180		while ( i-- ) {
8181			adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
8182		}
8183
8184		return master.promise();
8185	}
8186} );
8187
8188
8189// These usually indicate a programmer mistake during development,
8190// warn about them ASAP rather than swallowing them by default.
8191var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
8192
8193jQuery.Deferred.exceptionHook = function( error, stack ) {
8194
8195	// Support: IE 8 - 9 only
8196	// Console exists when dev tools are open, which can happen at any time
8197	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
8198		window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
8199	}
8200};
8201
8202
8203
8204
8205jQuery.readyException = function( error ) {
8206	window.setTimeout( function() {
8207		throw error;
8208	} );
8209};
8210
8211
8212
8213
8214// The deferred used on DOM ready
8215var readyList = jQuery.Deferred();
8216
8217jQuery.fn.ready = function( fn ) {
8218
8219	readyList
8220		.then( fn )
8221
8222		// Wrap jQuery.readyException in a function so that the lookup
8223		// happens at the time of error handling instead of callback
8224		// registration.
8225		.catch( function( error ) {
8226			jQuery.readyException( error );
8227		} );
8228
8229	return this;
8230};
8231
8232jQuery.extend( {
8233
8234	// Is the DOM ready to be used? Set to true once it occurs.
8235	isReady: false,
8236
8237	// A counter to track how many items to wait for before
8238	// the ready event fires. See #6781
8239	readyWait: 1,
8240
8241	// Handle when the DOM is ready
8242	ready: function( wait ) {
8243
8244		// Abort if there are pending holds or we're already ready
8245		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
8246			return;
8247		}
8248
8249		// Remember that the DOM is ready
8250		jQuery.isReady = true;
8251
8252		// If a normal DOM Ready event fired, decrement, and wait if need be
8253		if ( wait !== true && --jQuery.readyWait > 0 ) {
8254			return;
8255		}
8256
8257		// If there are functions bound, to execute
8258		readyList.resolveWith( document, [ jQuery ] );
8259	}
8260} );
8261
8262jQuery.ready.then = readyList.then;
8263
8264// The ready event handler and self cleanup method
8265function completed() {
8266	document.removeEventListener( "DOMContentLoaded", completed );
8267	window.removeEventListener( "load", completed );
8268	jQuery.ready();
8269}
8270
8271// Catch cases where $(document).ready() is called
8272// after the browser event has already occurred.
8273// Support: IE <=9 - 10 only
8274// Older IE sometimes signals "interactive" too soon
8275if ( document.readyState === "complete" ||
8276	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
8277
8278	// Handle it asynchronously to allow scripts the opportunity to delay ready
8279	window.setTimeout( jQuery.ready );
8280
8281} else {
8282
8283	// Use the handy event callback
8284	document.addEventListener( "DOMContentLoaded", completed );
8285
8286	// A fallback to window.onload, that will always work
8287	window.addEventListener( "load", completed );
8288}
8289
8290
8291
8292
8293// Multifunctional method to get and set values of a collection
8294// The value/s can optionally be executed if it's a function
8295var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
8296	var i = 0,
8297		len = elems.length,
8298		bulk = key == null;
8299
8300	// Sets many values
8301	if ( toType( key ) === "object" ) {
8302		chainable = true;
8303		for ( i in key ) {
8304			access( elems, fn, i, key[ i ], true, emptyGet, raw );
8305		}
8306
8307	// Sets one value
8308	} else if ( value !== undefined ) {
8309		chainable = true;
8310
8311		if ( !isFunction( value ) ) {
8312			raw = true;
8313		}
8314
8315		if ( bulk ) {
8316
8317			// Bulk operations run against the entire set
8318			if ( raw ) {
8319				fn.call( elems, value );
8320				fn = null;
8321
8322			// ...except when executing function values
8323			} else {
8324				bulk = fn;
8325				fn = function( elem, key, value ) {
8326					return bulk.call( jQuery( elem ), value );
8327				};
8328			}
8329		}
8330
8331		if ( fn ) {
8332			for ( ; i < len; i++ ) {
8333				fn(
8334					elems[ i ], key, raw ?
8335					value :
8336					value.call( elems[ i ], i, fn( elems[ i ], key ) )
8337				);
8338			}
8339		}
8340	}
8341
8342	if ( chainable ) {
8343		return elems;
8344	}
8345
8346	// Gets
8347	if ( bulk ) {
8348		return fn.call( elems );
8349	}
8350
8351	return len ? fn( elems[ 0 ], key ) : emptyGet;
8352};
8353
8354
8355// Matches dashed string for camelizing
8356var rmsPrefix = /^-ms-/,
8357	rdashAlpha = /-([a-z])/g;
8358
8359// Used by camelCase as callback to replace()
8360function fcamelCase( all, letter ) {
8361	return letter.toUpperCase();
8362}
8363
8364// Convert dashed to camelCase; used by the css and data modules
8365// Support: IE <=9 - 11, Edge 12 - 15
8366// Microsoft forgot to hump their vendor prefix (#9572)
8367function camelCase( string ) {
8368	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
8369}
8370var acceptData = function( owner ) {
8371
8372	// Accepts only:
8373	//  - Node
8374	//    - Node.ELEMENT_NODE
8375	//    - Node.DOCUMENT_NODE
8376	//  - Object
8377	//    - Any
8378	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
8379};
8380
8381
8382
8383
8384function Data() {
8385	this.expando = jQuery.expando + Data.uid++;
8386}
8387
8388Data.uid = 1;
8389
8390Data.prototype = {
8391
8392	cache: function( owner ) {
8393
8394		// Check if the owner object already has a cache
8395		var value = owner[ this.expando ];
8396
8397		// If not, create one
8398		if ( !value ) {
8399			value = {};
8400
8401			// We can accept data for non-element nodes in modern browsers,
8402			// but we should not, see #8335.
8403			// Always return an empty object.
8404			if ( acceptData( owner ) ) {
8405
8406				// If it is a node unlikely to be stringify-ed or looped over
8407				// use plain assignment
8408				if ( owner.nodeType ) {
8409					owner[ this.expando ] = value;
8410
8411				// Otherwise secure it in a non-enumerable property
8412				// configurable must be true to allow the property to be
8413				// deleted when data is removed
8414				} else {
8415					Object.defineProperty( owner, this.expando, {
8416						value: value,
8417						configurable: true
8418					} );
8419				}
8420			}
8421		}
8422
8423		return value;
8424	},
8425	set: function( owner, data, value ) {
8426		var prop,
8427			cache = this.cache( owner );
8428
8429		// Handle: [ owner, key, value ] args
8430		// Always use camelCase key (gh-2257)
8431		if ( typeof data === "string" ) {
8432			cache[ camelCase( data ) ] = value;
8433
8434		// Handle: [ owner, { properties } ] args
8435		} else {
8436
8437			// Copy the properties one-by-one to the cache object
8438			for ( prop in data ) {
8439				cache[ camelCase( prop ) ] = data[ prop ];
8440			}
8441		}
8442		return cache;
8443	},
8444	get: function( owner, key ) {
8445		return key === undefined ?
8446			this.cache( owner ) :
8447
8448			// Always use camelCase key (gh-2257)
8449			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
8450	},
8451	access: function( owner, key, value ) {
8452
8453		// In cases where either:
8454		//
8455		//   1. No key was specified
vendor: 8,694 bytes, lines 8456-8814
8456		//   2. A string key was specified, but no value provided
8457		//
8458		// Take the "read" path and allow the get method to determine
8459		// which value to return, respectively either:
8460		//
8461		//   1. The entire cache object
8462		//   2. The data stored at the key
8463		//
8464		if ( key === undefined ||
8465				( ( key && typeof key === "string" ) && value === undefined ) ) {
8466
8467			return this.get( owner, key );
8468		}
8469
8470		// When the key is not a string, or both a key and value
8471		// are specified, set or extend (existing objects) with either:
8472		//
8473		//   1. An object of properties
8474		//   2. A key and value
8475		//
8476		this.set( owner, key, value );
8477
8478		// Since the "set" path can have two possible entry points
8479		// return the expected data based on which path was taken[*]
8480		return value !== undefined ? value : key;
8481	},
8482	remove: function( owner, key ) {
8483		var i,
8484			cache = owner[ this.expando ];
8485
8486		if ( cache === undefined ) {
8487			return;
8488		}
8489
8490		if ( key !== undefined ) {
8491
8492			// Support array or space separated string of keys
8493			if ( Array.isArray( key ) ) {
8494
8495				// If key is an array of keys...
8496				// We always set camelCase keys, so remove that.
8497				key = key.map( camelCase );
8498			} else {
8499				key = camelCase( key );
8500
8501				// If a key with the spaces exists, use it.
8502				// Otherwise, create an array by matching non-whitespace
8503				key = key in cache ?
8504					[ key ] :
8505					( key.match( rnothtmlwhite ) || [] );
8506			}
8507
8508			i = key.length;
8509
8510			while ( i-- ) {
8511				delete cache[ key[ i ] ];
8512			}
8513		}
8514
8515		// Remove the expando if there's no more data
8516		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
8517
8518			// Support: Chrome <=35 - 45
8519			// Webkit & Blink performance suffers when deleting properties
8520			// from DOM nodes, so set to undefined instead
8521			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
8522			if ( owner.nodeType ) {
8523				owner[ this.expando ] = undefined;
8524			} else {
8525				delete owner[ this.expando ];
8526			}
8527		}
8528	},
8529	hasData: function( owner ) {
8530		var cache = owner[ this.expando ];
8531		return cache !== undefined && !jQuery.isEmptyObject( cache );
8532	}
8533};
8534var dataPriv = new Data();
8535
8536var dataUser = new Data();
8537
8538
8539
8540//	Implementation Summary
8541//
8542//	1. Enforce API surface and semantic compatibility with 1.9.x branch
8543//	2. Improve the module's maintainability by reducing the storage
8544//		paths to a single mechanism.
8545//	3. Use the same single mechanism to support "private" and "user" data.
8546//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
8547//	5. Avoid exposing implementation details on user objects (eg. expando properties)
8548//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
8549
8550var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
8551	rmultiDash = /[A-Z]/g;
8552
8553function getData( data ) {
8554	if ( data === "true" ) {
8555		return true;
8556	}
8557
8558	if ( data === "false" ) {
8559		return false;
8560	}
8561
8562	if ( data === "null" ) {
8563		return null;
8564	}
8565
8566	// Only convert to a number if it doesn't change the string
8567	if ( data === +data + "" ) {
8568		return +data;
8569	}
8570
8571	if ( rbrace.test( data ) ) {
8572		return JSON.parse( data );
8573	}
8574
8575	return data;
8576}
8577
8578function dataAttr( elem, key, data ) {
8579	var name;
8580
8581	// If nothing was found internally, try to fetch any
8582	// data from the HTML5 data-* attribute
8583	if ( data === undefined && elem.nodeType === 1 ) {
8584		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
8585		data = elem.getAttribute( name );
8586
8587		if ( typeof data === "string" ) {
8588			try {
8589				data = getData( data );
8590			} catch ( e ) {}
8591
8592			// Make sure we set the data so it isn't changed later
8593			dataUser.set( elem, key, data );
8594		} else {
8595			data = undefined;
8596		}
8597	}
8598	return data;
8599}
8600
8601jQuery.extend( {
8602	hasData: function( elem ) {
8603		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
8604	},
8605
8606	data: function( elem, name, data ) {
8607		return dataUser.access( elem, name, data );
8608	},
8609
8610	removeData: function( elem, name ) {
8611		dataUser.remove( elem, name );
8612	},
8613
8614	// TODO: Now that all calls to _data and _removeData have been replaced
8615	// with direct calls to dataPriv methods, these can be deprecated.
8616	_data: function( elem, name, data ) {
8617		return dataPriv.access( elem, name, data );
8618	},
8619
8620	_removeData: function( elem, name ) {
8621		dataPriv.remove( elem, name );
8622	}
8623} );
8624
8625jQuery.fn.extend( {
8626	data: function( key, value ) {
8627		var i, name, data,
8628			elem = this[ 0 ],
8629			attrs = elem && elem.attributes;
8630
8631		// Gets all values
8632		if ( key === undefined ) {
8633			if ( this.length ) {
8634				data = dataUser.get( elem );
8635
8636				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
8637					i = attrs.length;
8638					while ( i-- ) {
8639
8640						// Support: IE 11 only
8641						// The attrs elements can be null (#14894)
8642						if ( attrs[ i ] ) {
8643							name = attrs[ i ].name;
8644							if ( name.indexOf( "data-" ) === 0 ) {
8645								name = camelCase( name.slice( 5 ) );
8646								dataAttr( elem, name, data[ name ] );
8647							}
8648						}
8649					}
8650					dataPriv.set( elem, "hasDataAttrs", true );
8651				}
8652			}
8653
8654			return data;
8655		}
8656
8657		// Sets multiple values
8658		if ( typeof key === "object" ) {
8659			return this.each( function() {
8660				dataUser.set( this, key );
8661			} );
8662		}
8663
8664		return access( this, function( value ) {
8665			var data;
8666
8667			// The calling jQuery object (element matches) is not empty
8668			// (and therefore has an element appears at this[ 0 ]) and the
8669			// `value` parameter was not undefined. An empty jQuery object
8670			// will result in `undefined` for elem = this[ 0 ] which will
8671			// throw an exception if an attempt to read a data cache is made.
8672			if ( elem && value === undefined ) {
8673
8674				// Attempt to get data from the cache
8675				// The key will always be camelCased in Data
8676				data = dataUser.get( elem, key );
8677				if ( data !== undefined ) {
8678					return data;
8679				}
8680
8681				// Attempt to "discover" the data in
8682				// HTML5 custom data-* attrs
8683				data = dataAttr( elem, key );
8684				if ( data !== undefined ) {
8685					return data;
8686				}
8687
8688				// We tried really hard, but the data doesn't exist.
8689				return;
8690			}
8691
8692			// Set the data...
8693			this.each( function() {
8694
8695				// We always store the camelCased key
8696				dataUser.set( this, key, value );
8697			} );
8698		}, null, value, arguments.length > 1, null, true );
8699	},
8700
8701	removeData: function( key ) {
8702		return this.each( function() {
8703			dataUser.remove( this, key );
8704		} );
8705	}
8706} );
8707
8708
8709jQuery.extend( {
8710	queue: function( elem, type, data ) {
8711		var queue;
8712
8713		if ( elem ) {
8714			type = ( type || "fx" ) + "queue";
8715			queue = dataPriv.get( elem, type );
8716
8717			// Speed up dequeue by getting out quickly if this is just a lookup
8718			if ( data ) {
8719				if ( !queue || Array.isArray( data ) ) {
8720					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
8721				} else {
8722					queue.push( data );
8723				}
8724			}
8725			return queue || [];
8726		}
8727	},
8728
8729	dequeue: function( elem, type ) {
8730		type = type || "fx";
8731
8732		var queue = jQuery.queue( elem, type ),
8733			startLength = queue.length,
8734			fn = queue.shift(),
8735			hooks = jQuery._queueHooks( elem, type ),
8736			next = function() {
8737				jQuery.dequeue( elem, type );
8738			};
8739
8740		// If the fx queue is dequeued, always remove the progress sentinel
8741		if ( fn === "inprogress" ) {
8742			fn = queue.shift();
8743			startLength--;
8744		}
8745
8746		if ( fn ) {
8747
8748			// Add a progress sentinel to prevent the fx queue from being
8749			// automatically dequeued
8750			if ( type === "fx" ) {
8751				queue.unshift( "inprogress" );
8752			}
8753
8754			// Clear up the last queue stop function
8755			delete hooks.stop;
8756			fn.call( elem, next, hooks );
8757		}
8758
8759		if ( !startLength && hooks ) {
8760			hooks.empty.fire();
8761		}
8762	},
8763
8764	// Not public - generate a queueHooks object, or return the current one
8765	_queueHooks: function( elem, type ) {
8766		var key = type + "queueHooks";
8767		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
8768			empty: jQuery.Callbacks( "once memory" ).add( function() {
8769				dataPriv.remove( elem, [ type + "queue", key ] );
8770			} )
8771		} );
8772	}
8773} );
8774
8775jQuery.fn.extend( {
8776	queue: function( type, data ) {
8777		var setter = 2;
8778
8779		if ( typeof type !== "string" ) {
8780			data = type;
8781			type = "fx";
8782			setter--;
8783		}
8784
8785		if ( arguments.length < setter ) {
8786			return jQuery.queue( this[ 0 ], type );
8787		}
8788
8789		return data === undefined ?
8790			this :
8791			this.each( function() {
8792				var queue = jQuery.queue( this, type, data );
8793
8794				// Ensure a hooks for this queue
8795				jQuery._queueHooks( this, type );
8796
8797				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
8798					jQuery.dequeue( this, type );
8799				}
8800			} );
8801	},
8802	dequeue: function( type ) {
8803		return this.each( function() {
8804			jQuery.dequeue( this, type );
8805		} );
8806	},
8807	clearQueue: function( type ) {
8808		return this.queue( type || "fx", [] );
8809	},
8810
8811	// Get a promise resolved when queues of a certain type
8812	// are emptied (fx is the type by default)
8813	promise: function( type, obj ) {
8814		var tmp,
vendor: 37,137 bytes, lines 8815-10240
8815			count = 1,
8816			defer = jQuery.Deferred(),
8817			elements = this,
8818			i = this.length,
8819			resolve = function() {
8820				if ( !( --count ) ) {
8821					defer.resolveWith( elements, [ elements ] );
8822				}
8823			};
8824
8825		if ( typeof type !== "string" ) {
8826			obj = type;
8827			type = undefined;
8828		}
8829		type = type || "fx";
8830
8831		while ( i-- ) {
8832			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
8833			if ( tmp && tmp.empty ) {
8834				count++;
8835				tmp.empty.add( resolve );
8836			}
8837		}
8838		resolve();
8839		return defer.promise( obj );
8840	}
8841} );
8842var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
8843
8844var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
8845
8846
8847var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
8848
8849var isHiddenWithinTree = function( elem, el ) {
8850
8851		// isHiddenWithinTree might be called from jQuery#filter function;
8852		// in that case, element will be second argument
8853		elem = el || elem;
8854
8855		// Inline style trumps all
8856		return elem.style.display === "none" ||
8857			elem.style.display === "" &&
8858
8859			// Otherwise, check computed style
8860			// Support: Firefox <=43 - 45
8861			// Disconnected elements can have computed display: none, so first confirm that elem is
8862			// in the document.
8863			jQuery.contains( elem.ownerDocument, elem ) &&
8864
8865			jQuery.css( elem, "display" ) === "none";
8866	};
8867
8868var swap = function( elem, options, callback, args ) {
8869	var ret, name,
8870		old = {};
8871
8872	// Remember the old values, and insert the new ones
8873	for ( name in options ) {
8874		old[ name ] = elem.style[ name ];
8875		elem.style[ name ] = options[ name ];
8876	}
8877
8878	ret = callback.apply( elem, args || [] );
8879
8880	// Revert the old values
8881	for ( name in options ) {
8882		elem.style[ name ] = old[ name ];
8883	}
8884
8885	return ret;
8886};
8887
8888
8889
8890
8891function adjustCSS( elem, prop, valueParts, tween ) {
8892	var adjusted, scale,
8893		maxIterations = 20,
8894		currentValue = tween ?
8895			function() {
8896				return tween.cur();
8897			} :
8898			function() {
8899				return jQuery.css( elem, prop, "" );
8900			},
8901		initial = currentValue(),
8902		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
8903
8904		// Starting value computation is required for potential unit mismatches
8905		initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
8906			rcssNum.exec( jQuery.css( elem, prop ) );
8907
8908	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
8909
8910		// Support: Firefox <=54
8911		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
8912		initial = initial / 2;
8913
8914		// Trust units reported by jQuery.css
8915		unit = unit || initialInUnit[ 3 ];
8916
8917		// Iteratively approximate from a nonzero starting point
8918		initialInUnit = +initial || 1;
8919
8920		while ( maxIterations-- ) {
8921
8922			// Evaluate and update our best guess (doubling guesses that zero out).
8923			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
8924			jQuery.style( elem, prop, initialInUnit + unit );
8925			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
8926				maxIterations = 0;
8927			}
8928			initialInUnit = initialInUnit / scale;
8929
8930		}
8931
8932		initialInUnit = initialInUnit * 2;
8933		jQuery.style( elem, prop, initialInUnit + unit );
8934
8935		// Make sure we update the tween properties later on
8936		valueParts = valueParts || [];
8937	}
8938
8939	if ( valueParts ) {
8940		initialInUnit = +initialInUnit || +initial || 0;
8941
8942		// Apply relative offset (+=/-=) if specified
8943		adjusted = valueParts[ 1 ] ?
8944			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
8945			+valueParts[ 2 ];
8946		if ( tween ) {
8947			tween.unit = unit;
8948			tween.start = initialInUnit;
8949			tween.end = adjusted;
8950		}
8951	}
8952	return adjusted;
8953}
8954
8955
8956var defaultDisplayMap = {};
8957
8958function getDefaultDisplay( elem ) {
8959	var temp,
8960		doc = elem.ownerDocument,
8961		nodeName = elem.nodeName,
8962		display = defaultDisplayMap[ nodeName ];
8963
8964	if ( display ) {
8965		return display;
8966	}
8967
8968	temp = doc.body.appendChild( doc.createElement( nodeName ) );
8969	display = jQuery.css( temp, "display" );
8970
8971	temp.parentNode.removeChild( temp );
8972
8973	if ( display === "none" ) {
8974		display = "block";
8975	}
8976	defaultDisplayMap[ nodeName ] = display;
8977
8978	return display;
8979}
8980
8981function showHide( elements, show ) {
8982	var display, elem,
8983		values = [],
8984		index = 0,
8985		length = elements.length;
8986
8987	// Determine new display value for elements that need to change
8988	for ( ; index < length; index++ ) {
8989		elem = elements[ index ];
8990		if ( !elem.style ) {
8991			continue;
8992		}
8993
8994		display = elem.style.display;
8995		if ( show ) {
8996
8997			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
8998			// check is required in this first loop unless we have a nonempty display value (either
8999			// inline or about-to-be-restored)
9000			if ( display === "none" ) {
9001				values[ index ] = dataPriv.get( elem, "display" ) || null;
9002				if ( !values[ index ] ) {
9003					elem.style.display = "";
9004				}
9005			}
9006			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
9007				values[ index ] = getDefaultDisplay( elem );
9008			}
9009		} else {
9010			if ( display !== "none" ) {
9011				values[ index ] = "none";
9012
9013				// Remember what we're overwriting
9014				dataPriv.set( elem, "display", display );
9015			}
9016		}
9017	}
9018
9019	// Set the display of the elements in a second loop to avoid constant reflow
9020	for ( index = 0; index < length; index++ ) {
9021		if ( values[ index ] != null ) {
9022			elements[ index ].style.display = values[ index ];
9023		}
9024	}
9025
9026	return elements;
9027}
9028
9029jQuery.fn.extend( {
9030	show: function() {
9031		return showHide( this, true );
9032	},
9033	hide: function() {
9034		return showHide( this );
9035	},
9036	toggle: function( state ) {
9037		if ( typeof state === "boolean" ) {
9038			return state ? this.show() : this.hide();
9039		}
9040
9041		return this.each( function() {
9042			if ( isHiddenWithinTree( this ) ) {
9043				jQuery( this ).show();
9044			} else {
9045				jQuery( this ).hide();
9046			}
9047		} );
9048	}
9049} );
9050var rcheckableType = ( /^(?:checkbox|radio)$/i );
9051
9052var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
9053
9054var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
9055
9056
9057
9058// We have to close these tags to support XHTML (#13200)
9059var wrapMap = {
9060
9061	// Support: IE <=9 only
9062	option: [ 1, "<select multiple='multiple'>", "</select>" ],
9063
9064	// XHTML parsers do not magically insert elements in the
9065	// same way that tag soup parsers do. So we cannot shorten
9066	// this by omitting <tbody> or other required elements.
9067	thead: [ 1, "<table>", "</table>" ],
9068	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
9069	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
9070	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
9071
9072	_default: [ 0, "", "" ]
9073};
9074
9075// Support: IE <=9 only
9076wrapMap.optgroup = wrapMap.option;
9077
9078wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
9079wrapMap.th = wrapMap.td;
9080
9081
9082function getAll( context, tag ) {
9083
9084	// Support: IE <=9 - 11 only
9085	// Use typeof to avoid zero-argument method invocation on host objects (#15151)
9086	var ret;
9087
9088	if ( typeof context.getElementsByTagName !== "undefined" ) {
9089		ret = context.getElementsByTagName( tag || "*" );
9090
9091	} else if ( typeof context.querySelectorAll !== "undefined" ) {
9092		ret = context.querySelectorAll( tag || "*" );
9093
9094	} else {
9095		ret = [];
9096	}
9097
9098	if ( tag === undefined || tag && nodeName( context, tag ) ) {
9099		return jQuery.merge( [ context ], ret );
9100	}
9101
9102	return ret;
9103}
9104
9105
9106// Mark scripts as having already been evaluated
9107function setGlobalEval( elems, refElements ) {
9108	var i = 0,
9109		l = elems.length;
9110
9111	for ( ; i < l; i++ ) {
9112		dataPriv.set(
9113			elems[ i ],
9114			"globalEval",
9115			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
9116		);
9117	}
9118}
9119
9120
9121var rhtml = /<|&#?\w+;/;
9122
9123function buildFragment( elems, context, scripts, selection, ignored ) {
9124	var elem, tmp, tag, wrap, contains, j,
9125		fragment = context.createDocumentFragment(),
9126		nodes = [],
9127		i = 0,
9128		l = elems.length;
9129
9130	for ( ; i < l; i++ ) {
9131		elem = elems[ i ];
9132
9133		if ( elem || elem === 0 ) {
9134
9135			// Add nodes directly
9136			if ( toType( elem ) === "object" ) {
9137
9138				// Support: Android <=4.0 only, PhantomJS 1 only
9139				// push.apply(_, arraylike) throws on ancient WebKit
9140				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
9141
9142			// Convert non-html into a text node
9143			} else if ( !rhtml.test( elem ) ) {
9144				nodes.push( context.createTextNode( elem ) );
9145
9146			// Convert html into DOM nodes
9147			} else {
9148				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
9149
9150				// Deserialize a standard representation
9151				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
9152				wrap = wrapMap[ tag ] || wrapMap._default;
9153				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
9154
9155				// Descend through wrappers to the right content
9156				j = wrap[ 0 ];
9157				while ( j-- ) {
9158					tmp = tmp.lastChild;
9159				}
9160
9161				// Support: Android <=4.0 only, PhantomJS 1 only
9162				// push.apply(_, arraylike) throws on ancient WebKit
9163				jQuery.merge( nodes, tmp.childNodes );
9164
9165				// Remember the top-level container
9166				tmp = fragment.firstChild;
9167
9168				// Ensure the created nodes are orphaned (#12392)
9169				tmp.textContent = "";
9170			}
9171		}
9172	}
9173
9174	// Remove wrapper from fragment
9175	fragment.textContent = "";
9176
9177	i = 0;
9178	while ( ( elem = nodes[ i++ ] ) ) {
9179
9180		// Skip elements already in the context collection (trac-4087)
9181		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
9182			if ( ignored ) {
9183				ignored.push( elem );
9184			}
9185			continue;
9186		}
9187
9188		contains = jQuery.contains( elem.ownerDocument, elem );
9189
9190		// Append to fragment
9191		tmp = getAll( fragment.appendChild( elem ), "script" );
9192
9193		// Preserve script evaluation history
9194		if ( contains ) {
9195			setGlobalEval( tmp );
9196		}
9197
9198		// Capture executables
9199		if ( scripts ) {
9200			j = 0;
9201			while ( ( elem = tmp[ j++ ] ) ) {
9202				if ( rscriptType.test( elem.type || "" ) ) {
9203					scripts.push( elem );
9204				}
9205			}
9206		}
9207	}
9208
9209	return fragment;
9210}
9211
9212
9213( function() {
9214	var fragment = document.createDocumentFragment(),
9215		div = fragment.appendChild( document.createElement( "div" ) ),
9216		input = document.createElement( "input" );
9217
9218	// Support: Android 4.0 - 4.3 only
9219	// Check state lost if the name is set (#11217)
9220	// Support: Windows Web Apps (WWA)
9221	// `name` and `type` must use .setAttribute for WWA (#14901)
9222	input.setAttribute( "type", "radio" );
9223	input.setAttribute( "checked", "checked" );
9224	input.setAttribute( "name", "t" );
9225
9226	div.appendChild( input );
9227
9228	// Support: Android <=4.1 only
9229	// Older WebKit doesn't clone checked state correctly in fragments
9230	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
9231
9232	// Support: IE <=11 only
9233	// Make sure textarea (and checkbox) defaultValue is properly cloned
9234	div.innerHTML = "<textarea>x</textarea>";
9235	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
9236} )();
9237var documentElement = document.documentElement;
9238
9239
9240
9241var
9242	rkeyEvent = /^key/,
9243	rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
9244	rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
9245
9246function returnTrue() {
9247	return true;
9248}
9249
9250function returnFalse() {
9251	return false;
9252}
9253
9254// Support: IE <=9 only
9255// See #13393 for more info
9256function safeActiveElement() {
9257	try {
9258		return document.activeElement;
9259	} catch ( err ) { }
9260}
9261
9262function on( elem, types, selector, data, fn, one ) {
9263	var origFn, type;
9264
9265	// Types can be a map of types/handlers
9266	if ( typeof types === "object" ) {
9267
9268		// ( types-Object, selector, data )
9269		if ( typeof selector !== "string" ) {
9270
9271			// ( types-Object, data )
9272			data = data || selector;
9273			selector = undefined;
9274		}
9275		for ( type in types ) {
9276			on( elem, type, selector, data, types[ type ], one );
9277		}
9278		return elem;
9279	}
9280
9281	if ( data == null && fn == null ) {
9282
9283		// ( types, fn )
9284		fn = selector;
9285		data = selector = undefined;
9286	} else if ( fn == null ) {
9287		if ( typeof selector === "string" ) {
9288
9289			// ( types, selector, fn )
9290			fn = data;
9291			data = undefined;
9292		} else {
9293
9294			// ( types, data, fn )
9295			fn = data;
9296			data = selector;
9297			selector = undefined;
9298		}
9299	}
9300	if ( fn === false ) {
9301		fn = returnFalse;
9302	} else if ( !fn ) {
9303		return elem;
9304	}
9305
9306	if ( one === 1 ) {
9307		origFn = fn;
9308		fn = function( event ) {
9309
9310			// Can use an empty set, since event contains the info
9311			jQuery().off( event );
9312			return origFn.apply( this, arguments );
9313		};
9314
9315		// Use same guid so caller can remove using origFn
9316		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
9317	}
9318	return elem.each( function() {
9319		jQuery.event.add( this, types, fn, data, selector );
9320	} );
9321}
9322
9323/*
9324 * Helper functions for managing events -- not part of the public interface.
9325 * Props to Dean Edwards' addEvent library for many of the ideas.
9326 */
9327jQuery.event = {
9328
9329	global: {},
9330
9331	add: function( elem, types, handler, data, selector ) {
9332
9333		var handleObjIn, eventHandle, tmp,
9334			events, t, handleObj,
9335			special, handlers, type, namespaces, origType,
9336			elemData = dataPriv.get( elem );
9337
9338		// Don't attach events to noData or text/comment nodes (but allow plain objects)
9339		if ( !elemData ) {
9340			return;
9341		}
9342
9343		// Caller can pass in an object of custom data in lieu of the handler
9344		if ( handler.handler ) {
9345			handleObjIn = handler;
9346			handler = handleObjIn.handler;
9347			selector = handleObjIn.selector;
9348		}
9349
9350		// Ensure that invalid selectors throw exceptions at attach time
9351		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
9352		if ( selector ) {
9353			jQuery.find.matchesSelector( documentElement, selector );
9354		}
9355
9356		// Make sure that the handler has a unique ID, used to find/remove it later
9357		if ( !handler.guid ) {
9358			handler.guid = jQuery.guid++;
9359		}
9360
9361		// Init the element's event structure and main handler, if this is the first
9362		if ( !( events = elemData.events ) ) {
9363			events = elemData.events = {};
9364		}
9365		if ( !( eventHandle = elemData.handle ) ) {
9366			eventHandle = elemData.handle = function( e ) {
9367
9368				// Discard the second event of a jQuery.event.trigger() and
9369				// when an event is called after a page has unloaded
9370				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
9371					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
9372			};
9373		}
9374
9375		// Handle multiple events separated by a space
9376		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
9377		t = types.length;
9378		while ( t-- ) {
9379			tmp = rtypenamespace.exec( types[ t ] ) || [];
9380			type = origType = tmp[ 1 ];
9381			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
9382
9383			// There *must* be a type, no attaching namespace-only handlers
9384			if ( !type ) {
9385				continue;
9386			}
9387
9388			// If event changes its type, use the special event handlers for the changed type
9389			special = jQuery.event.special[ type ] || {};
9390
9391			// If selector defined, determine special event api type, otherwise given type
9392			type = ( selector ? special.delegateType : special.bindType ) || type;
9393
9394			// Update special based on newly reset type
9395			special = jQuery.event.special[ type ] || {};
9396
9397			// handleObj is passed to all event handlers
9398			handleObj = jQuery.extend( {
9399				type: type,
9400				origType: origType,
9401				data: data,
9402				handler: handler,
9403				guid: handler.guid,
9404				selector: selector,
9405				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
9406				namespace: namespaces.join( "." )
9407			}, handleObjIn );
9408
9409			// Init the event handler queue if we're the first
9410			if ( !( handlers = events[ type ] ) ) {
9411				handlers = events[ type ] = [];
9412				handlers.delegateCount = 0;
9413
9414				// Only use addEventListener if the special events handler returns false
9415				if ( !special.setup ||
9416					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
9417
9418					if ( elem.addEventListener ) {
9419						elem.addEventListener( type, eventHandle );
9420					}
9421				}
9422			}
9423
9424			if ( special.add ) {
9425				special.add.call( elem, handleObj );
9426
9427				if ( !handleObj.handler.guid ) {
9428					handleObj.handler.guid = handler.guid;
9429				}
9430			}
9431
9432			// Add to the element's handler list, delegates in front
9433			if ( selector ) {
9434				handlers.splice( handlers.delegateCount++, 0, handleObj );
9435			} else {
9436				handlers.push( handleObj );
9437			}
9438
9439			// Keep track of which events have ever been used, for event optimization
9440			jQuery.event.global[ type ] = true;
9441		}
9442
9443	},
9444
9445	// Detach an event or set of events from an element
9446	remove: function( elem, types, handler, selector, mappedTypes ) {
9447
9448		var j, origCount, tmp,
9449			events, t, handleObj,
9450			special, handlers, type, namespaces, origType,
9451			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
9452
9453		if ( !elemData || !( events = elemData.events ) ) {
9454			return;
9455		}
9456
9457		// Once for each type.namespace in types; type may be omitted
9458		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
9459		t = types.length;
9460		while ( t-- ) {
9461			tmp = rtypenamespace.exec( types[ t ] ) || [];
9462			type = origType = tmp[ 1 ];
9463			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
9464
9465			// Unbind all events (on this namespace, if provided) for the element
9466			if ( !type ) {
9467				for ( type in events ) {
9468					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
9469				}
9470				continue;
9471			}
9472
9473			special = jQuery.event.special[ type ] || {};
9474			type = ( selector ? special.delegateType : special.bindType ) || type;
9475			handlers = events[ type ] || [];
9476			tmp = tmp[ 2 ] &&
9477				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
9478
9479			// Remove matching events
9480			origCount = j = handlers.length;
9481			while ( j-- ) {
9482				handleObj = handlers[ j ];
9483
9484				if ( ( mappedTypes || origType === handleObj.origType ) &&
9485					( !handler || handler.guid === handleObj.guid ) &&
9486					( !tmp || tmp.test( handleObj.namespace ) ) &&
9487					( !selector || selector === handleObj.selector ||
9488						selector === "**" && handleObj.selector ) ) {
9489					handlers.splice( j, 1 );
9490
9491					if ( handleObj.selector ) {
9492						handlers.delegateCount--;
9493					}
9494					if ( special.remove ) {
9495						special.remove.call( elem, handleObj );
9496					}
9497				}
9498			}
9499
9500			// Remove generic event handler if we removed something and no more handlers exist
9501			// (avoids potential for endless recursion during removal of special event handlers)
9502			if ( origCount && !handlers.length ) {
9503				if ( !special.teardown ||
9504					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
9505
9506					jQuery.removeEvent( elem, type, elemData.handle );
9507				}
9508
9509				delete events[ type ];
9510			}
9511		}
9512
9513		// Remove data and the expando if it's no longer used
9514		if ( jQuery.isEmptyObject( events ) ) {
9515			dataPriv.remove( elem, "handle events" );
9516		}
9517	},
9518
9519	dispatch: function( nativeEvent ) {
9520
9521		// Make a writable jQuery.Event from the native event object
9522		var event = jQuery.event.fix( nativeEvent );
9523
9524		var i, j, ret, matched, handleObj, handlerQueue,
9525			args = new Array( arguments.length ),
9526			handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
9527			special = jQuery.event.special[ event.type ] || {};
9528
9529		// Use the fix-ed jQuery.Event rather than the (read-only) native event
9530		args[ 0 ] = event;
9531
9532		for ( i = 1; i < arguments.length; i++ ) {
9533			args[ i ] = arguments[ i ];
9534		}
9535
9536		event.delegateTarget = this;
9537
9538		// Call the preDispatch hook for the mapped type, and let it bail if desired
9539		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
9540			return;
9541		}
9542
9543		// Determine handlers
9544		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
9545
9546		// Run delegates first; they may want to stop propagation beneath us
9547		i = 0;
9548		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
9549			event.currentTarget = matched.elem;
9550
9551			j = 0;
9552			while ( ( handleObj = matched.handlers[ j++ ] ) &&
9553				!event.isImmediatePropagationStopped() ) {
9554
9555				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
9556				// a subset or equal to those in the bound event (both can have no namespace).
9557				if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
9558
9559					event.handleObj = handleObj;
9560					event.data = handleObj.data;
9561
9562					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
9563						handleObj.handler ).apply( matched.elem, args );
9564
9565					if ( ret !== undefined ) {
9566						if ( ( event.result = ret ) === false ) {
9567							event.preventDefault();
9568							event.stopPropagation();
9569						}
9570					}
9571				}
9572			}
9573		}
9574
9575		// Call the postDispatch hook for the mapped type
9576		if ( special.postDispatch ) {
9577			special.postDispatch.call( this, event );
9578		}
9579
9580		return event.result;
9581	},
9582
9583	handlers: function( event, handlers ) {
9584		var i, handleObj, sel, matchedHandlers, matchedSelectors,
9585			handlerQueue = [],
9586			delegateCount = handlers.delegateCount,
9587			cur = event.target;
9588
9589		// Find delegate handlers
9590		if ( delegateCount &&
9591
9592			// Support: IE <=9
9593			// Black-hole SVG <use> instance trees (trac-13180)
9594			cur.nodeType &&
9595
9596			// Support: Firefox <=42
9597			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
9598			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
9599			// Support: IE 11 only
9600			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
9601			!( event.type === "click" && event.button >= 1 ) ) {
9602
9603			for ( ; cur !== this; cur = cur.parentNode || this ) {
9604
9605				// Don't check non-elements (#13208)
9606				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
9607				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
9608					matchedHandlers = [];
9609					matchedSelectors = {};
9610					for ( i = 0; i < delegateCount; i++ ) {
9611						handleObj = handlers[ i ];
9612
9613						// Don't conflict with Object.prototype properties (#13203)
9614						sel = handleObj.selector + " ";
9615
9616						if ( matchedSelectors[ sel ] === undefined ) {
9617							matchedSelectors[ sel ] = handleObj.needsContext ?
9618								jQuery( sel, this ).index( cur ) > -1 :
9619								jQuery.find( sel, this, null, [ cur ] ).length;
9620						}
9621						if ( matchedSelectors[ sel ] ) {
9622							matchedHandlers.push( handleObj );
9623						}
9624					}
9625					if ( matchedHandlers.length ) {
9626						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
9627					}
9628				}
9629			}
9630		}
9631
9632		// Add the remaining (directly-bound) handlers
9633		cur = this;
9634		if ( delegateCount < handlers.length ) {
9635			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
9636		}
9637
9638		return handlerQueue;
9639	},
9640
9641	addProp: function( name, hook ) {
9642		Object.defineProperty( jQuery.Event.prototype, name, {
9643			enumerable: true,
9644			configurable: true,
9645
9646			get: isFunction( hook ) ?
9647				function() {
9648					if ( this.originalEvent ) {
9649							return hook( this.originalEvent );
9650					}
9651				} :
9652				function() {
9653					if ( this.originalEvent ) {
9654							return this.originalEvent[ name ];
9655					}
9656				},
9657
9658			set: function( value ) {
9659				Object.defineProperty( this, name, {
9660					enumerable: true,
9661					configurable: true,
9662					writable: true,
9663					value: value
9664				} );
9665			}
9666		} );
9667	},
9668
9669	fix: function( originalEvent ) {
9670		return originalEvent[ jQuery.expando ] ?
9671			originalEvent :
9672			new jQuery.Event( originalEvent );
9673	},
9674
9675	special: {
9676		load: {
9677
9678			// Prevent triggered image.load events from bubbling to window.load
9679			noBubble: true
9680		},
9681		focus: {
9682
9683			// Fire native event if possible so blur/focus sequence is correct
9684			trigger: function() {
9685				if ( this !== safeActiveElement() && this.focus ) {
9686					this.focus();
9687					return false;
9688				}
9689			},
9690			delegateType: "focusin"
9691		},
9692		blur: {
9693			trigger: function() {
9694				if ( this === safeActiveElement() && this.blur ) {
9695					this.blur();
9696					return false;
9697				}
9698			},
9699			delegateType: "focusout"
9700		},
9701		click: {
9702
9703			// For checkbox, fire native event so checked state will be right
9704			trigger: function() {
9705				if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
9706					this.click();
9707					return false;
9708				}
9709			},
9710
9711			// For cross-browser consistency, don't fire native .click() on links
9712			_default: function( event ) {
9713				return nodeName( event.target, "a" );
9714			}
9715		},
9716
9717		beforeunload: {
9718			postDispatch: function( event ) {
9719
9720				// Support: Firefox 20+
9721				// Firefox doesn't alert if the returnValue field is not set.
9722				if ( event.result !== undefined && event.originalEvent ) {
9723					event.originalEvent.returnValue = event.result;
9724				}
9725			}
9726		}
9727	}
9728};
9729
9730jQuery.removeEvent = function( elem, type, handle ) {
9731
9732	// This "if" is needed for plain objects
9733	if ( elem.removeEventListener ) {
9734		elem.removeEventListener( type, handle );
9735	}
9736};
9737
9738jQuery.Event = function( src, props ) {
9739
9740	// Allow instantiation without the 'new' keyword
9741	if ( !( this instanceof jQuery.Event ) ) {
9742		return new jQuery.Event( src, props );
9743	}
9744
9745	// Event object
9746	if ( src && src.type ) {
9747		this.originalEvent = src;
9748		this.type = src.type;
9749
9750		// Events bubbling up the document may have been marked as prevented
9751		// by a handler lower down the tree; reflect the correct value.
9752		this.isDefaultPrevented = src.defaultPrevented ||
9753				src.defaultPrevented === undefined &&
9754
9755				// Support: Android <=2.3 only
9756				src.returnValue === false ?
9757			returnTrue :
9758			returnFalse;
9759
9760		// Create target properties
9761		// Support: Safari <=6 - 7 only
9762		// Target should not be a text node (#504, #13143)
9763		this.target = ( src.target && src.target.nodeType === 3 ) ?
9764			src.target.parentNode :
9765			src.target;
9766
9767		this.currentTarget = src.currentTarget;
9768		this.relatedTarget = src.relatedTarget;
9769
9770	// Event type
9771	} else {
9772		this.type = src;
9773	}
9774
9775	// Put explicitly provided properties onto the event object
9776	if ( props ) {
9777		jQuery.extend( this, props );
9778	}
9779
9780	// Create a timestamp if incoming event doesn't have one
9781	this.timeStamp = src && src.timeStamp || Date.now();
9782
9783	// Mark it as fixed
9784	this[ jQuery.expando ] = true;
9785};
9786
9787// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
9788// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
9789jQuery.Event.prototype = {
9790	constructor: jQuery.Event,
9791	isDefaultPrevented: returnFalse,
9792	isPropagationStopped: returnFalse,
9793	isImmediatePropagationStopped: returnFalse,
9794	isSimulated: false,
9795
9796	preventDefault: function() {
9797		var e = this.originalEvent;
9798
9799		this.isDefaultPrevented = returnTrue;
9800
9801		if ( e && !this.isSimulated ) {
9802			e.preventDefault();
9803		}
9804	},
9805	stopPropagation: function() {
9806		var e = this.originalEvent;
9807
9808		this.isPropagationStopped = returnTrue;
9809
9810		if ( e && !this.isSimulated ) {
9811			e.stopPropagation();
9812		}
9813	},
9814	stopImmediatePropagation: function() {
9815		var e = this.originalEvent;
9816
9817		this.isImmediatePropagationStopped = returnTrue;
9818
9819		if ( e && !this.isSimulated ) {
9820			e.stopImmediatePropagation();
9821		}
9822
9823		this.stopPropagation();
9824	}
9825};
9826
9827// Includes all common event props including KeyEvent and MouseEvent specific props
9828jQuery.each( {
9829	altKey: true,
9830	bubbles: true,
9831	cancelable: true,
9832	changedTouches: true,
9833	ctrlKey: true,
9834	detail: true,
9835	eventPhase: true,
9836	metaKey: true,
9837	pageX: true,
9838	pageY: true,
9839	shiftKey: true,
9840	view: true,
9841	"char": true,
9842	charCode: true,
9843	key: true,
9844	keyCode: true,
9845	button: true,
9846	buttons: true,
9847	clientX: true,
9848	clientY: true,
9849	offsetX: true,
9850	offsetY: true,
9851	pointerId: true,
9852	pointerType: true,
9853	screenX: true,
9854	screenY: true,
9855	targetTouches: true,
9856	toElement: true,
9857	touches: true,
9858
9859	which: function( event ) {
9860		var button = event.button;
9861
9862		// Add which for key events
9863		if ( event.which == null && rkeyEvent.test( event.type ) ) {
9864			return event.charCode != null ? event.charCode : event.keyCode;
9865		}
9866
9867		// Add which for click: 1 === left; 2 === middle; 3 === right
9868		if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
9869			if ( button & 1 ) {
9870				return 1;
9871			}
9872
9873			if ( button & 2 ) {
9874				return 3;
9875			}
9876
9877			if ( button & 4 ) {
9878				return 2;
9879			}
9880
9881			return 0;
9882		}
9883
9884		return event.which;
9885	}
9886}, jQuery.event.addProp );
9887
9888// Create mouseenter/leave events using mouseover/out and event-time checks
9889// so that event delegation works in jQuery.
9890// Do the same for pointerenter/pointerleave and pointerover/pointerout
9891//
9892// Support: Safari 7 only
9893// Safari sends mouseenter too often; see:
9894// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
9895// for the description of the bug (it existed in older Chrome versions as well).
9896jQuery.each( {
9897	mouseenter: "mouseover",
9898	mouseleave: "mouseout",
9899	pointerenter: "pointerover",
9900	pointerleave: "pointerout"
9901}, function( orig, fix ) {
9902	jQuery.event.special[ orig ] = {
9903		delegateType: fix,
9904		bindType: fix,
9905
9906		handle: function( event ) {
9907			var ret,
9908				target = this,
9909				related = event.relatedTarget,
9910				handleObj = event.handleObj;
9911
9912			// For mouseenter/leave call the handler if related is outside the target.
9913			// NB: No relatedTarget if the mouse left/entered the browser window
9914			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
9915				event.type = handleObj.origType;
9916				ret = handleObj.handler.apply( this, arguments );
9917				event.type = fix;
9918			}
9919			return ret;
9920		}
9921	};
9922} );
9923
9924jQuery.fn.extend( {
9925
9926	on: function( types, selector, data, fn ) {
9927		return on( this, types, selector, data, fn );
9928	},
9929	one: function( types, selector, data, fn ) {
9930		return on( this, types, selector, data, fn, 1 );
9931	},
9932	off: function( types, selector, fn ) {
9933		var handleObj, type;
9934		if ( types && types.preventDefault && types.handleObj ) {
9935
9936			// ( event )  dispatched jQuery.Event
9937			handleObj = types.handleObj;
9938			jQuery( types.delegateTarget ).off(
9939				handleObj.namespace ?
9940					handleObj.origType + "." + handleObj.namespace :
9941					handleObj.origType,
9942				handleObj.selector,
9943				handleObj.handler
9944			);
9945			return this;
9946		}
9947		if ( typeof types === "object" ) {
9948
9949			// ( types-object [, selector] )
9950			for ( type in types ) {
9951				this.off( type, selector, types[ type ] );
9952			}
9953			return this;
9954		}
9955		if ( selector === false || typeof selector === "function" ) {
9956
9957			// ( types [, fn] )
9958			fn = selector;
9959			selector = undefined;
9960		}
9961		if ( fn === false ) {
9962			fn = returnFalse;
9963		}
9964		return this.each( function() {
9965			jQuery.event.remove( this, types, fn, selector );
9966		} );
9967	}
9968} );
9969
9970
9971var
9972
9973	/* eslint-disable max-len */
9974
9975	// See https://github.com/eslint/eslint/issues/3229
9976	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
9977
9978	/* eslint-enable */
9979
9980	// Support: IE <=10 - 11, Edge 12 - 13 only
9981	// In IE/Edge using regex groups here causes severe slowdowns.
9982	// See https://connect.microsoft.com/IE/feedback/details/1736512/
9983	rnoInnerhtml = /<script|<style|<link/i,
9984
9985	// checked="checked" or checked
9986	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
9987	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
9988
9989// Prefer a tbody over its parent table for containing new rows
9990function manipulationTarget( elem, content ) {
9991	if ( nodeName( elem, "table" ) &&
9992		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
9993
9994		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
9995	}
9996
9997	return elem;
9998}
9999
10000// Replace/restore the type attribute of script elements for safe DOM manipulation
10001function disableScript( elem ) {
10002	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
10003	return elem;
10004}
10005function restoreScript( elem ) {
10006	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
10007		elem.type = elem.type.slice( 5 );
10008	} else {
10009		elem.removeAttribute( "type" );
10010	}
10011
10012	return elem;
10013}
10014
10015function cloneCopyEvent( src, dest ) {
10016	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
10017
10018	if ( dest.nodeType !== 1 ) {
10019		return;
10020	}
10021
10022	// 1. Copy private data: events, handlers, etc.
10023	if ( dataPriv.hasData( src ) ) {
10024		pdataOld = dataPriv.access( src );
10025		pdataCur = dataPriv.set( dest, pdataOld );
10026		events = pdataOld.events;
10027
10028		if ( events ) {
10029			delete pdataCur.handle;
10030			pdataCur.events = {};
10031
10032			for ( type in events ) {
10033				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
10034					jQuery.event.add( dest, type, events[ type ][ i ] );
10035				}
10036			}
10037		}
10038	}
10039
10040	// 2. Copy user data
10041	if ( dataUser.hasData( src ) ) {
10042		udataOld = dataUser.access( src );
10043		udataCur = jQuery.extend( {}, udataOld );
10044
10045		dataUser.set( dest, udataCur );
10046	}
10047}
10048
10049// Fix IE bugs, see support tests
10050function fixInput( src, dest ) {
10051	var nodeName = dest.nodeName.toLowerCase();
10052
10053	// Fails to persist the checked state of a cloned checkbox or radio button.
10054	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
10055		dest.checked = src.checked;
10056
10057	// Fails to return the selected option to the default selected state when cloning options
10058	} else if ( nodeName === "input" || nodeName === "textarea" ) {
10059		dest.defaultValue = src.defaultValue;
10060	}
10061}
10062
10063function domManip( collection, args, callback, ignored ) {
10064
10065	// Flatten any nested arrays
10066	args = concat.apply( [], args );
10067
10068	var fragment, first, scripts, hasScripts, node, doc,
10069		i = 0,
10070		l = collection.length,
10071		iNoClone = l - 1,
10072		value = args[ 0 ],
10073		valueIsFunction = isFunction( value );
10074
10075	// We can't cloneNode fragments that contain checked, in WebKit
10076	if ( valueIsFunction ||
10077			( l > 1 && typeof value === "string" &&
10078				!support.checkClone && rchecked.test( value ) ) ) {
10079		return collection.each( function( index ) {
10080			var self = collection.eq( index );
10081			if ( valueIsFunction ) {
10082				args[ 0 ] = value.call( this, index, self.html() );
10083			}
10084			domManip( self, args, callback, ignored );
10085		} );
10086	}
10087
10088	if ( l ) {
10089		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
10090		first = fragment.firstChild;
10091
10092		if ( fragment.childNodes.length === 1 ) {
10093			fragment = first;
10094		}
10095
10096		// Require either new content or an interest in ignored elements to invoke the callback
10097		if ( first || ignored ) {
10098			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
10099			hasScripts = scripts.length;
10100
10101			// Use the original fragment for the last item
10102			// instead of the first because it can end up
10103			// being emptied incorrectly in certain situations (#8070).
10104			for ( ; i < l; i++ ) {
10105				node = fragment;
10106
10107				if ( i !== iNoClone ) {
10108					node = jQuery.clone( node, true, true );
10109
10110					// Keep references to cloned scripts for later restoration
10111					if ( hasScripts ) {
10112
10113						// Support: Android <=4.0 only, PhantomJS 1 only
10114						// push.apply(_, arraylike) throws on ancient WebKit
10115						jQuery.merge( scripts, getAll( node, "script" ) );
10116					}
10117				}
10118
10119				callback.call( collection[ i ], node, i );
10120			}
10121
10122			if ( hasScripts ) {
10123				doc = scripts[ scripts.length - 1 ].ownerDocument;
10124
10125				// Reenable scripts
10126				jQuery.map( scripts, restoreScript );
10127
10128				// Evaluate executable scripts on first document insertion
10129				for ( i = 0; i < hasScripts; i++ ) {
10130					node = scripts[ i ];
10131					if ( rscriptType.test( node.type || "" ) &&
10132						!dataPriv.access( node, "globalEval" ) &&
10133						jQuery.contains( doc, node ) ) {
10134
10135						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {
10136
10137							// Optional AJAX dependency, but won't run scripts if not present
10138							if ( jQuery._evalUrl ) {
10139								jQuery._evalUrl( node.src );
10140							}
10141						} else {
10142							DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
10143						}
10144					}
10145				}
10146			}
10147		}
10148	}
10149
10150	return collection;
10151}
10152
10153function remove( elem, selector, keepData ) {
10154	var node,
10155		nodes = selector ? jQuery.filter( selector, elem ) : elem,
10156		i = 0;
10157
10158	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
10159		if ( !keepData && node.nodeType === 1 ) {
10160			jQuery.cleanData( getAll( node ) );
10161		}
10162
10163		if ( node.parentNode ) {
10164			if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
10165				setGlobalEval( getAll( node, "script" ) );
10166			}
10167			node.parentNode.removeChild( node );
10168		}
10169	}
10170
10171	return elem;
10172}
10173
10174jQuery.extend( {
10175	htmlPrefilter: function( html ) {
10176		return html.replace( rxhtmlTag, "<$1></$2>" );
10177	},
10178
10179	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
10180		var i, l, srcElements, destElements,
10181			clone = elem.cloneNode( true ),
10182			inPage = jQuery.contains( elem.ownerDocument, elem );
10183
10184		// Fix IE cloning issues
10185		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
10186				!jQuery.isXMLDoc( elem ) ) {
10187
10188			// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
10189			destElements = getAll( clone );
10190			srcElements = getAll( elem );
10191
10192			for ( i = 0, l = srcElements.length; i < l; i++ ) {
10193				fixInput( srcElements[ i ], destElements[ i ] );
10194			}
10195		}
10196
10197		// Copy the events from the original to the clone
10198		if ( dataAndEvents ) {
10199			if ( deepDataAndEvents ) {
10200				srcElements = srcElements || getAll( elem );
10201				destElements = destElements || getAll( clone );
10202
10203				for ( i = 0, l = srcElements.length; i < l; i++ ) {
10204					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
10205				}
10206			} else {
10207				cloneCopyEvent( elem, clone );
10208			}
10209		}
10210
10211		// Preserve script evaluation history
10212		destElements = getAll( clone, "script" );
10213		if ( destElements.length > 0 ) {
10214			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
10215		}
10216
10217		// Return the cloned set
10218		return clone;
10219	},
10220
10221	cleanData: function( elems ) {
10222		var data, elem, type,
10223			special = jQuery.event.special,
10224			i = 0;
10225
10226		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
10227			if ( acceptData( elem ) ) {
10228				if ( ( data = elem[ dataPriv.expando ] ) ) {
10229					if ( data.events ) {
10230						for ( type in data.events ) {
10231							if ( special[ type ] ) {
10232								jQuery.event.remove( elem, type );
10233
10234							// This is a shortcut to avoid jQuery.event.remove's overhead
10235							} else {
10236								jQuery.removeEvent( elem, type, data.handle );
10237							}
10238						}
10239					}
10240
vendor: 1,119 bytes, lines 10241-10285
10241					// Support: Chrome <=35 - 45+
10242					// Assign undefined instead of using delete, see Data#remove
10243					elem[ dataPriv.expando ] = undefined;
10244				}
10245				if ( elem[ dataUser.expando ] ) {
10246
10247					// Support: Chrome <=35 - 45+
10248					// Assign undefined instead of using delete, see Data#remove
10249					elem[ dataUser.expando ] = undefined;
10250				}
10251			}
10252		}
10253	}
10254} );
10255
10256jQuery.fn.extend( {
10257	detach: function( selector ) {
10258		return remove( this, selector, true );
10259	},
10260
10261	remove: function( selector ) {
10262		return remove( this, selector );
10263	},
10264
10265	text: function( value ) {
10266		return access( this, function( value ) {
10267			return value === undefined ?
10268				jQuery.text( this ) :
10269				this.empty().each( function() {
10270					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
10271						this.textContent = value;
10272					}
10273				} );
10274		}, null, value, arguments.length );
10275	},
10276
10277	append: function() {
10278		return domManip( this, arguments, function( elem ) {
10279			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
10280				var target = manipulationTarget( this, elem );
10281				target.appendChild( elem );
10282			}
10283		} );
10284	},
10285
vendor: 52,786 bytes, lines 10286-12340
10286	prepend: function() {
10287		return domManip( this, arguments, function( elem ) {
10288			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
10289				var target = manipulationTarget( this, elem );
10290				target.insertBefore( elem, target.firstChild );
10291			}
10292		} );
10293	},
10294
10295	before: function() {
10296		return domManip( this, arguments, function( elem ) {
10297			if ( this.parentNode ) {
10298				this.parentNode.insertBefore( elem, this );
10299			}
10300		} );
10301	},
10302
10303	after: function() {
10304		return domManip( this, arguments, function( elem ) {
10305			if ( this.parentNode ) {
10306				this.parentNode.insertBefore( elem, this.nextSibling );
10307			}
10308		} );
10309	},
10310
10311	empty: function() {
10312		var elem,
10313			i = 0;
10314
10315		for ( ; ( elem = this[ i ] ) != null; i++ ) {
10316			if ( elem.nodeType === 1 ) {
10317
10318				// Prevent memory leaks
10319				jQuery.cleanData( getAll( elem, false ) );
10320
10321				// Remove any remaining nodes
10322				elem.textContent = "";
10323			}
10324		}
10325
10326		return this;
10327	},
10328
10329	clone: function( dataAndEvents, deepDataAndEvents ) {
10330		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
10331		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
10332
10333		return this.map( function() {
10334			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
10335		} );
10336	},
10337
10338	html: function( value ) {
10339		return access( this, function( value ) {
10340			var elem = this[ 0 ] || {},
10341				i = 0,
10342				l = this.length;
10343
10344			if ( value === undefined && elem.nodeType === 1 ) {
10345				return elem.innerHTML;
10346			}
10347
10348			// See if we can take a shortcut and just use innerHTML
10349			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
10350				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
10351
10352				value = jQuery.htmlPrefilter( value );
10353
10354				try {
10355					for ( ; i < l; i++ ) {
10356						elem = this[ i ] || {};
10357
10358						// Remove element nodes and prevent memory leaks
10359						if ( elem.nodeType === 1 ) {
10360							jQuery.cleanData( getAll( elem, false ) );
10361							elem.innerHTML = value;
10362						}
10363					}
10364
10365					elem = 0;
10366
10367				// If using innerHTML throws an exception, use the fallback method
10368				} catch ( e ) {}
10369			}
10370
10371			if ( elem ) {
10372				this.empty().append( value );
10373			}
10374		}, null, value, arguments.length );
10375	},
10376
10377	replaceWith: function() {
10378		var ignored = [];
10379
10380		// Make the changes, replacing each non-ignored context element with the new content
10381		return domManip( this, arguments, function( elem ) {
10382			var parent = this.parentNode;
10383
10384			if ( jQuery.inArray( this, ignored ) < 0 ) {
10385				jQuery.cleanData( getAll( this ) );
10386				if ( parent ) {
10387					parent.replaceChild( elem, this );
10388				}
10389			}
10390
10391		// Force callback invocation
10392		}, ignored );
10393	}
10394} );
10395
10396jQuery.each( {
10397	appendTo: "append",
10398	prependTo: "prepend",
10399	insertBefore: "before",
10400	insertAfter: "after",
10401	replaceAll: "replaceWith"
10402}, function( name, original ) {
10403	jQuery.fn[ name ] = function( selector ) {
10404		var elems,
10405			ret = [],
10406			insert = jQuery( selector ),
10407			last = insert.length - 1,
10408			i = 0;
10409
10410		for ( ; i <= last; i++ ) {
10411			elems = i === last ? this : this.clone( true );
10412			jQuery( insert[ i ] )[ original ]( elems );
10413
10414			// Support: Android <=4.0 only, PhantomJS 1 only
10415			// .get() because push.apply(_, arraylike) throws on ancient WebKit
10416			push.apply( ret, elems.get() );
10417		}
10418
10419		return this.pushStack( ret );
10420	};
10421} );
10422var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
10423
10424var getStyles = function( elem ) {
10425
10426		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
10427		// IE throws on elements created in popups
10428		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
10429		var view = elem.ownerDocument.defaultView;
10430
10431		if ( !view || !view.opener ) {
10432			view = window;
10433		}
10434
10435		return view.getComputedStyle( elem );
10436	};
10437
10438var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
10439
10440
10441
10442( function() {
10443
10444	// Executing both pixelPosition & boxSizingReliable tests require only one layout
10445	// so they're executed at the same time to save the second computation.
10446	function computeStyleTests() {
10447
10448		// This is a singleton, we need to execute it only once
10449		if ( !div ) {
10450			return;
10451		}
10452
10453		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
10454			"margin-top:1px;padding:0;border:0";
10455		div.style.cssText =
10456			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
10457			"margin:auto;border:1px;padding:1px;" +
10458			"width:60%;top:1%";
10459		documentElement.appendChild( container ).appendChild( div );
10460
10461		var divStyle = window.getComputedStyle( div );
10462		pixelPositionVal = divStyle.top !== "1%";
10463
10464		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
10465		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
10466
10467		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
10468		// Some styles come back with percentage values, even though they shouldn't
10469		div.style.right = "60%";
10470		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
10471
10472		// Support: IE 9 - 11 only
10473		// Detect misreporting of content dimensions for box-sizing:border-box elements
10474		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
10475
10476		// Support: IE 9 only
10477		// Detect overflow:scroll screwiness (gh-3699)
10478		div.style.position = "absolute";
10479		scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
10480
10481		documentElement.removeChild( container );
10482
10483		// Nullify the div so it wouldn't be stored in the memory and
10484		// it will also be a sign that checks already performed
10485		div = null;
10486	}
10487
10488	function roundPixelMeasures( measure ) {
10489		return Math.round( parseFloat( measure ) );
10490	}
10491
10492	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
10493		reliableMarginLeftVal,
10494		container = document.createElement( "div" ),
10495		div = document.createElement( "div" );
10496
10497	// Finish early in limited (non-browser) environments
10498	if ( !div.style ) {
10499		return;
10500	}
10501
10502	// Support: IE <=9 - 11 only
10503	// Style of cloned element affects source element cloned (#8908)
10504	div.style.backgroundClip = "content-box";
10505	div.cloneNode( true ).style.backgroundClip = "";
10506	support.clearCloneStyle = div.style.backgroundClip === "content-box";
10507
10508	jQuery.extend( support, {
10509		boxSizingReliable: function() {
10510			computeStyleTests();
10511			return boxSizingReliableVal;
10512		},
10513		pixelBoxStyles: function() {
10514			computeStyleTests();
10515			return pixelBoxStylesVal;
10516		},
10517		pixelPosition: function() {
10518			computeStyleTests();
10519			return pixelPositionVal;
10520		},
10521		reliableMarginLeft: function() {
10522			computeStyleTests();
10523			return reliableMarginLeftVal;
10524		},
10525		scrollboxSize: function() {
10526			computeStyleTests();
10527			return scrollboxSizeVal;
10528		}
10529	} );
10530} )();
10531
10532
10533function curCSS( elem, name, computed ) {
10534	var width, minWidth, maxWidth, ret,
10535
10536		// Support: Firefox 51+
10537		// Retrieving style before computed somehow
10538		// fixes an issue with getting wrong values
10539		// on detached elements
10540		style = elem.style;
10541
10542	computed = computed || getStyles( elem );
10543
10544	// getPropertyValue is needed for:
10545	//   .css('filter') (IE 9 only, #12537)
10546	//   .css('--customProperty) (#3144)
10547	if ( computed ) {
10548		ret = computed.getPropertyValue( name ) || computed[ name ];
10549
10550		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
10551			ret = jQuery.style( elem, name );
10552		}
10553
10554		// A tribute to the "awesome hack by Dean Edwards"
10555		// Android Browser returns percentage for some values,
10556		// but width seems to be reliably pixels.
10557		// This is against the CSSOM draft spec:
10558		// https://drafts.csswg.org/cssom/#resolved-values
10559		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
10560
10561			// Remember the original values
10562			width = style.width;
10563			minWidth = style.minWidth;
10564			maxWidth = style.maxWidth;
10565
10566			// Put in the new values to get a computed value out
10567			style.minWidth = style.maxWidth = style.width = ret;
10568			ret = computed.width;
10569
10570			// Revert the changed values
10571			style.width = width;
10572			style.minWidth = minWidth;
10573			style.maxWidth = maxWidth;
10574		}
10575	}
10576
10577	return ret !== undefined ?
10578
10579		// Support: IE <=9 - 11 only
10580		// IE returns zIndex value as an integer.
10581		ret + "" :
10582		ret;
10583}
10584
10585
10586function addGetHookIf( conditionFn, hookFn ) {
10587
10588	// Define the hook, we'll check on the first run if it's really needed.
10589	return {
10590		get: function() {
10591			if ( conditionFn() ) {
10592
10593				// Hook not needed (or it's not possible to use it due
10594				// to missing dependency), remove it.
10595				delete this.get;
10596				return;
10597			}
10598
10599			// Hook needed; redefine it so that the support test is not executed again.
10600			return ( this.get = hookFn ).apply( this, arguments );
10601		}
10602	};
10603}
10604
10605
10606var
10607
10608	// Swappable if display is none or starts with table
10609	// except "table", "table-cell", or "table-caption"
10610	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
10611	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
10612	rcustomProp = /^--/,
10613	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
10614	cssNormalTransform = {
10615		letterSpacing: "0",
10616		fontWeight: "400"
10617	},
10618
10619	cssPrefixes = [ "Webkit", "Moz", "ms" ],
10620	emptyStyle = document.createElement( "div" ).style;
10621
10622// Return a css property mapped to a potentially vendor prefixed property
10623function vendorPropName( name ) {
10624
10625	// Shortcut for names that are not vendor prefixed
10626	if ( name in emptyStyle ) {
10627		return name;
10628	}
10629
10630	// Check for vendor prefixed names
10631	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
10632		i = cssPrefixes.length;
10633
10634	while ( i-- ) {
10635		name = cssPrefixes[ i ] + capName;
10636		if ( name in emptyStyle ) {
10637			return name;
10638		}
10639	}
10640}
10641
10642// Return a property mapped along what jQuery.cssProps suggests or to
10643// a vendor prefixed property.
10644function finalPropName( name ) {
10645	var ret = jQuery.cssProps[ name ];
10646	if ( !ret ) {
10647		ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
10648	}
10649	return ret;
10650}
10651
10652function setPositiveNumber( elem, value, subtract ) {
10653
10654	// Any relative (+/-) values have already been
10655	// normalized at this point
10656	var matches = rcssNum.exec( value );
10657	return matches ?
10658
10659		// Guard against undefined "subtract", e.g., when used as in cssHooks
10660		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
10661		value;
10662}
10663
10664function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
10665	var i = dimension === "width" ? 1 : 0,
10666		extra = 0,
10667		delta = 0;
10668
10669	// Adjustment may not be necessary
10670	if ( box === ( isBorderBox ? "border" : "content" ) ) {
10671		return 0;
10672	}
10673
10674	for ( ; i < 4; i += 2 ) {
10675
10676		// Both box models exclude margin
10677		if ( box === "margin" ) {
10678			delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
10679		}
10680
10681		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
10682		if ( !isBorderBox ) {
10683
10684			// Add padding
10685			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
10686
10687			// For "border" or "margin", add border
10688			if ( box !== "padding" ) {
10689				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
10690
10691			// But still keep track of it otherwise
10692			} else {
10693				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
10694			}
10695
10696		// If we get here with a border-box (content + padding + border), we're seeking "content" or
10697		// "padding" or "margin"
10698		} else {
10699
10700			// For "content", subtract padding
10701			if ( box === "content" ) {
10702				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
10703			}
10704
10705			// For "content" or "padding", subtract border
10706			if ( box !== "margin" ) {
10707				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
10708			}
10709		}
10710	}
10711
10712	// Account for positive content-box scroll gutter when requested by providing computedVal
10713	if ( !isBorderBox && computedVal >= 0 ) {
10714
10715		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
10716		// Assuming integer scroll gutter, subtract the rest and round down
10717		delta += Math.max( 0, Math.ceil(
10718			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
10719			computedVal -
10720			delta -
10721			extra -
10722			0.5
10723		) );
10724	}
10725
10726	return delta;
10727}
10728
10729function getWidthOrHeight( elem, dimension, extra ) {
10730
10731	// Start with computed style
10732	var styles = getStyles( elem ),
10733		val = curCSS( elem, dimension, styles ),
10734		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
10735		valueIsBorderBox = isBorderBox;
10736
10737	// Support: Firefox <=54
10738	// Return a confounding non-pixel value or feign ignorance, as appropriate.
10739	if ( rnumnonpx.test( val ) ) {
10740		if ( !extra ) {
10741			return val;
10742		}
10743		val = "auto";
10744	}
10745
10746	// Check for style in case a browser which returns unreliable values
10747	// for getComputedStyle silently falls back to the reliable elem.style
10748	valueIsBorderBox = valueIsBorderBox &&
10749		( support.boxSizingReliable() || val === elem.style[ dimension ] );
10750
10751	// Fall back to offsetWidth/offsetHeight when value is "auto"
10752	// This happens for inline elements with no explicit setting (gh-3571)
10753	// Support: Android <=4.1 - 4.3 only
10754	// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
10755	if ( val === "auto" ||
10756		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
10757
10758		val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
10759
10760		// offsetWidth/offsetHeight provide border-box values
10761		valueIsBorderBox = true;
10762	}
10763
10764	// Normalize "" and auto
10765	val = parseFloat( val ) || 0;
10766
10767	// Adjust for the element's box model
10768	return ( val +
10769		boxModelAdjustment(
10770			elem,
10771			dimension,
10772			extra || ( isBorderBox ? "border" : "content" ),
10773			valueIsBorderBox,
10774			styles,
10775
10776			// Provide the current computed size to request scroll gutter calculation (gh-3589)
10777			val
10778		)
10779	) + "px";
10780}
10781
10782jQuery.extend( {
10783
10784	// Add in style property hooks for overriding the default
10785	// behavior of getting and setting a style property
10786	cssHooks: {
10787		opacity: {
10788			get: function( elem, computed ) {
10789				if ( computed ) {
10790
10791					// We should always get a number back from opacity
10792					var ret = curCSS( elem, "opacity" );
10793					return ret === "" ? "1" : ret;
10794				}
10795			}
10796		}
10797	},
10798
10799	// Don't automatically add "px" to these possibly-unitless properties
10800	cssNumber: {
10801		"animationIterationCount": true,
10802		"columnCount": true,
10803		"fillOpacity": true,
10804		"flexGrow": true,
10805		"flexShrink": true,
10806		"fontWeight": true,
10807		"lineHeight": true,
10808		"opacity": true,
10809		"order": true,
10810		"orphans": true,
10811		"widows": true,
10812		"zIndex": true,
10813		"zoom": true
10814	},
10815
10816	// Add in properties whose names you wish to fix before
10817	// setting or getting the value
10818	cssProps: {},
10819
10820	// Get and set the style property on a DOM Node
10821	style: function( elem, name, value, extra ) {
10822
10823		// Don't set styles on text and comment nodes
10824		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
10825			return;
10826		}
10827
10828		// Make sure that we're working with the right name
10829		var ret, type, hooks,
10830			origName = camelCase( name ),
10831			isCustomProp = rcustomProp.test( name ),
10832			style = elem.style;
10833
10834		// Make sure that we're working with the right name. We don't
10835		// want to query the value if it is a CSS custom property
10836		// since they are user-defined.
10837		if ( !isCustomProp ) {
10838			name = finalPropName( origName );
10839		}
10840
10841		// Gets hook for the prefixed version, then unprefixed version
10842		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
10843
10844		// Check if we're setting a value
10845		if ( value !== undefined ) {
10846			type = typeof value;
10847
10848			// Convert "+=" or "-=" to relative numbers (#7345)
10849			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
10850				value = adjustCSS( elem, name, ret );
10851
10852				// Fixes bug #9237
10853				type = "number";
10854			}
10855
10856			// Make sure that null and NaN values aren't set (#7116)
10857			if ( value == null || value !== value ) {
10858				return;
10859			}
10860
10861			// If a number was passed in, add the unit (except for certain CSS properties)
10862			if ( type === "number" ) {
10863				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
10864			}
10865
10866			// background-* props affect original clone's values
10867			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
10868				style[ name ] = "inherit";
10869			}
10870
10871			// If a hook was provided, use that value, otherwise just set the specified value
10872			if ( !hooks || !( "set" in hooks ) ||
10873				( value = hooks.set( elem, value, extra ) ) !== undefined ) {
10874
10875				if ( isCustomProp ) {
10876					style.setProperty( name, value );
10877				} else {
10878					style[ name ] = value;
10879				}
10880			}
10881
10882		} else {
10883
10884			// If a hook was provided get the non-computed value from there
10885			if ( hooks && "get" in hooks &&
10886				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
10887
10888				return ret;
10889			}
10890
10891			// Otherwise just get the value from the style object
10892			return style[ name ];
10893		}
10894	},
10895
10896	css: function( elem, name, extra, styles ) {
10897		var val, num, hooks,
10898			origName = camelCase( name ),
10899			isCustomProp = rcustomProp.test( name );
10900
10901		// Make sure that we're working with the right name. We don't
10902		// want to modify the value if it is a CSS custom property
10903		// since they are user-defined.
10904		if ( !isCustomProp ) {
10905			name = finalPropName( origName );
10906		}
10907
10908		// Try prefixed name followed by the unprefixed name
10909		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
10910
10911		// If a hook was provided get the computed value from there
10912		if ( hooks && "get" in hooks ) {
10913			val = hooks.get( elem, true, extra );
10914		}
10915
10916		// Otherwise, if a way to get the computed value exists, use that
10917		if ( val === undefined ) {
10918			val = curCSS( elem, name, styles );
10919		}
10920
10921		// Convert "normal" to computed value
10922		if ( val === "normal" && name in cssNormalTransform ) {
10923			val = cssNormalTransform[ name ];
10924		}
10925
10926		// Make numeric if forced or a qualifier was provided and val looks numeric
10927		if ( extra === "" || extra ) {
10928			num = parseFloat( val );
10929			return extra === true || isFinite( num ) ? num || 0 : val;
10930		}
10931
10932		return val;
10933	}
10934} );
10935
10936jQuery.each( [ "height", "width" ], function( i, dimension ) {
10937	jQuery.cssHooks[ dimension ] = {
10938		get: function( elem, computed, extra ) {
10939			if ( computed ) {
10940
10941				// Certain elements can have dimension info if we invisibly show them
10942				// but it must have a current display style that would benefit
10943				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
10944
10945					// Support: Safari 8+
10946					// Table columns in Safari have non-zero offsetWidth & zero
10947					// getBoundingClientRect().width unless display is changed.
10948					// Support: IE <=11 only
10949					// Running getBoundingClientRect on a disconnected node
10950					// in IE throws an error.
10951					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
10952						swap( elem, cssShow, function() {
10953							return getWidthOrHeight( elem, dimension, extra );
10954						} ) :
10955						getWidthOrHeight( elem, dimension, extra );
10956			}
10957		},
10958
10959		set: function( elem, value, extra ) {
10960			var matches,
10961				styles = getStyles( elem ),
10962				isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
10963				subtract = extra && boxModelAdjustment(
10964					elem,
10965					dimension,
10966					extra,
10967					isBorderBox,
10968					styles
10969				);
10970
10971			// Account for unreliable border-box dimensions by comparing offset* to computed and
10972			// faking a content-box to get border and padding (gh-3699)
10973			if ( isBorderBox && support.scrollboxSize() === styles.position ) {
10974				subtract -= Math.ceil(
10975					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
10976					parseFloat( styles[ dimension ] ) -
10977					boxModelAdjustment( elem, dimension, "border", false, styles ) -
10978					0.5
10979				);
10980			}
10981
10982			// Convert to pixels if value adjustment is needed
10983			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
10984				( matches[ 3 ] || "px" ) !== "px" ) {
10985
10986				elem.style[ dimension ] = value;
10987				value = jQuery.css( elem, dimension );
10988			}
10989
10990			return setPositiveNumber( elem, value, subtract );
10991		}
10992	};
10993} );
10994
10995jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
10996	function( elem, computed ) {
10997		if ( computed ) {
10998			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
10999				elem.getBoundingClientRect().left -
11000					swap( elem, { marginLeft: 0 }, function() {
11001						return elem.getBoundingClientRect().left;
11002					} )
11003				) + "px";
11004		}
11005	}
11006);
11007
11008// These hooks are used by animate to expand properties
11009jQuery.each( {
11010	margin: "",
11011	padding: "",
11012	border: "Width"
11013}, function( prefix, suffix ) {
11014	jQuery.cssHooks[ prefix + suffix ] = {
11015		expand: function( value ) {
11016			var i = 0,
11017				expanded = {},
11018
11019				// Assumes a single number if not a string
11020				parts = typeof value === "string" ? value.split( " " ) : [ value ];
11021
11022			for ( ; i < 4; i++ ) {
11023				expanded[ prefix + cssExpand[ i ] + suffix ] =
11024					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
11025			}
11026
11027			return expanded;
11028		}
11029	};
11030
11031	if ( prefix !== "margin" ) {
11032		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
11033	}
11034} );
11035
11036jQuery.fn.extend( {
11037	css: function( name, value ) {
11038		return access( this, function( elem, name, value ) {
11039			var styles, len,
11040				map = {},
11041				i = 0;
11042
11043			if ( Array.isArray( name ) ) {
11044				styles = getStyles( elem );
11045				len = name.length;
11046
11047				for ( ; i < len; i++ ) {
11048					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
11049				}
11050
11051				return map;
11052			}
11053
11054			return value !== undefined ?
11055				jQuery.style( elem, name, value ) :
11056				jQuery.css( elem, name );
11057		}, name, value, arguments.length > 1 );
11058	}
11059} );
11060
11061
11062function Tween( elem, options, prop, end, easing ) {
11063	return new Tween.prototype.init( elem, options, prop, end, easing );
11064}
11065jQuery.Tween = Tween;
11066
11067Tween.prototype = {
11068	constructor: Tween,
11069	init: function( elem, options, prop, end, easing, unit ) {
11070		this.elem = elem;
11071		this.prop = prop;
11072		this.easing = easing || jQuery.easing._default;
11073		this.options = options;
11074		this.start = this.now = this.cur();
11075		this.end = end;
11076		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
11077	},
11078	cur: function() {
11079		var hooks = Tween.propHooks[ this.prop ];
11080
11081		return hooks && hooks.get ?
11082			hooks.get( this ) :
11083			Tween.propHooks._default.get( this );
11084	},
11085	run: function( percent ) {
11086		var eased,
11087			hooks = Tween.propHooks[ this.prop ];
11088
11089		if ( this.options.duration ) {
11090			this.pos = eased = jQuery.easing[ this.easing ](
11091				percent, this.options.duration * percent, 0, 1, this.options.duration
11092			);
11093		} else {
11094			this.pos = eased = percent;
11095		}
11096		this.now = ( this.end - this.start ) * eased + this.start;
11097
11098		if ( this.options.step ) {
11099			this.options.step.call( this.elem, this.now, this );
11100		}
11101
11102		if ( hooks && hooks.set ) {
11103			hooks.set( this );
11104		} else {
11105			Tween.propHooks._default.set( this );
11106		}
11107		return this;
11108	}
11109};
11110
11111Tween.prototype.init.prototype = Tween.prototype;
11112
11113Tween.propHooks = {
11114	_default: {
11115		get: function( tween ) {
11116			var result;
11117
11118			// Use a property on the element directly when it is not a DOM element,
11119			// or when there is no matching style property that exists.
11120			if ( tween.elem.nodeType !== 1 ||
11121				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
11122				return tween.elem[ tween.prop ];
11123			}
11124
11125			// Passing an empty string as a 3rd parameter to .css will automatically
11126			// attempt a parseFloat and fallback to a string if the parse fails.
11127			// Simple values such as "10px" are parsed to Float;
11128			// complex values such as "rotate(1rad)" are returned as-is.
11129			result = jQuery.css( tween.elem, tween.prop, "" );
11130
11131			// Empty strings, null, undefined and "auto" are converted to 0.
11132			return !result || result === "auto" ? 0 : result;
11133		},
11134		set: function( tween ) {
11135
11136			// Use step hook for back compat.
11137			// Use cssHook if its there.
11138			// Use .style if available and use plain properties where available.
11139			if ( jQuery.fx.step[ tween.prop ] ) {
11140				jQuery.fx.step[ tween.prop ]( tween );
11141			} else if ( tween.elem.nodeType === 1 &&
11142				( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
11143					jQuery.cssHooks[ tween.prop ] ) ) {
11144				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
11145			} else {
11146				tween.elem[ tween.prop ] = tween.now;
11147			}
11148		}
11149	}
11150};
11151
11152// Support: IE <=9 only
11153// Panic based approach to setting things on disconnected nodes
11154Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
11155	set: function( tween ) {
11156		if ( tween.elem.nodeType && tween.elem.parentNode ) {
11157			tween.elem[ tween.prop ] = tween.now;
11158		}
11159	}
11160};
11161
11162jQuery.easing = {
11163	linear: function( p ) {
11164		return p;
11165	},
11166	swing: function( p ) {
11167		return 0.5 - Math.cos( p * Math.PI ) / 2;
11168	},
11169	_default: "swing"
11170};
11171
11172jQuery.fx = Tween.prototype.init;
11173
11174// Back compat <1.8 extension point
11175jQuery.fx.step = {};
11176
11177
11178
11179
11180var
11181	fxNow, inProgress,
11182	rfxtypes = /^(?:toggle|show|hide)$/,
11183	rrun = /queueHooks$/;
11184
11185function schedule() {
11186	if ( inProgress ) {
11187		if ( document.hidden === false && window.requestAnimationFrame ) {
11188			window.requestAnimationFrame( schedule );
11189		} else {
11190			window.setTimeout( schedule, jQuery.fx.interval );
11191		}
11192
11193		jQuery.fx.tick();
11194	}
11195}
11196
11197// Animations created synchronously will run synchronously
11198function createFxNow() {
11199	window.setTimeout( function() {
11200		fxNow = undefined;
11201	} );
11202	return ( fxNow = Date.now() );
11203}
11204
11205// Generate parameters to create a standard animation
11206function genFx( type, includeWidth ) {
11207	var which,
11208		i = 0,
11209		attrs = { height: type };
11210
11211	// If we include width, step value is 1 to do all cssExpand values,
11212	// otherwise step value is 2 to skip over Left and Right
11213	includeWidth = includeWidth ? 1 : 0;
11214	for ( ; i < 4; i += 2 - includeWidth ) {
11215		which = cssExpand[ i ];
11216		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
11217	}
11218
11219	if ( includeWidth ) {
11220		attrs.opacity = attrs.width = type;
11221	}
11222
11223	return attrs;
11224}
11225
11226function createTween( value, prop, animation ) {
11227	var tween,
11228		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
11229		index = 0,
11230		length = collection.length;
11231	for ( ; index < length; index++ ) {
11232		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
11233
11234			// We're done with this property
11235			return tween;
11236		}
11237	}
11238}
11239
11240function defaultPrefilter( elem, props, opts ) {
11241	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
11242		isBox = "width" in props || "height" in props,
11243		anim = this,
11244		orig = {},
11245		style = elem.style,
11246		hidden = elem.nodeType && isHiddenWithinTree( elem ),
11247		dataShow = dataPriv.get( elem, "fxshow" );
11248
11249	// Queue-skipping animations hijack the fx hooks
11250	if ( !opts.queue ) {
11251		hooks = jQuery._queueHooks( elem, "fx" );
11252		if ( hooks.unqueued == null ) {
11253			hooks.unqueued = 0;
11254			oldfire = hooks.empty.fire;
11255			hooks.empty.fire = function() {
11256				if ( !hooks.unqueued ) {
11257					oldfire();
11258				}
11259			};
11260		}
11261		hooks.unqueued++;
11262
11263		anim.always( function() {
11264
11265			// Ensure the complete handler is called before this completes
11266			anim.always( function() {
11267				hooks.unqueued--;
11268				if ( !jQuery.queue( elem, "fx" ).length ) {
11269					hooks.empty.fire();
11270				}
11271			} );
11272		} );
11273	}
11274
11275	// Detect show/hide animations
11276	for ( prop in props ) {
11277		value = props[ prop ];
11278		if ( rfxtypes.test( value ) ) {
11279			delete props[ prop ];
11280			toggle = toggle || value === "toggle";
11281			if ( value === ( hidden ? "hide" : "show" ) ) {
11282
11283				// Pretend to be hidden if this is a "show" and
11284				// there is still data from a stopped show/hide
11285				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
11286					hidden = true;
11287
11288				// Ignore all other no-op show/hide data
11289				} else {
11290					continue;
11291				}
11292			}
11293			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
11294		}
11295	}
11296
11297	// Bail out if this is a no-op like .hide().hide()
11298	propTween = !jQuery.isEmptyObject( props );
11299	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
11300		return;
11301	}
11302
11303	// Restrict "overflow" and "display" styles during box animations
11304	if ( isBox && elem.nodeType === 1 ) {
11305
11306		// Support: IE <=9 - 11, Edge 12 - 15
11307		// Record all 3 overflow attributes because IE does not infer the shorthand
11308		// from identically-valued overflowX and overflowY and Edge just mirrors
11309		// the overflowX value there.
11310		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
11311
11312		// Identify a display type, preferring old show/hide data over the CSS cascade
11313		restoreDisplay = dataShow && dataShow.display;
11314		if ( restoreDisplay == null ) {
11315			restoreDisplay = dataPriv.get( elem, "display" );
11316		}
11317		display = jQuery.css( elem, "display" );
11318		if ( display === "none" ) {
11319			if ( restoreDisplay ) {
11320				display = restoreDisplay;
11321			} else {
11322
11323				// Get nonempty value(s) by temporarily forcing visibility
11324				showHide( [ elem ], true );
11325				restoreDisplay = elem.style.display || restoreDisplay;
11326				display = jQuery.css( elem, "display" );
11327				showHide( [ elem ] );
11328			}
11329		}
11330
11331		// Animate inline elements as inline-block
11332		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
11333			if ( jQuery.css( elem, "float" ) === "none" ) {
11334
11335				// Restore the original display value at the end of pure show/hide animations
11336				if ( !propTween ) {
11337					anim.done( function() {
11338						style.display = restoreDisplay;
11339					} );
11340					if ( restoreDisplay == null ) {
11341						display = style.display;
11342						restoreDisplay = display === "none" ? "" : display;
11343					}
11344				}
11345				style.display = "inline-block";
11346			}
11347		}
11348	}
11349
11350	if ( opts.overflow ) {
11351		style.overflow = "hidden";
11352		anim.always( function() {
11353			style.overflow = opts.overflow[ 0 ];
11354			style.overflowX = opts.overflow[ 1 ];
11355			style.overflowY = opts.overflow[ 2 ];
11356		} );
11357	}
11358
11359	// Implement show/hide animations
11360	propTween = false;
11361	for ( prop in orig ) {
11362
11363		// General show/hide setup for this element animation
11364		if ( !propTween ) {
11365			if ( dataShow ) {
11366				if ( "hidden" in dataShow ) {
11367					hidden = dataShow.hidden;
11368				}
11369			} else {
11370				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
11371			}
11372
11373			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
11374			if ( toggle ) {
11375				dataShow.hidden = !hidden;
11376			}
11377
11378			// Show elements before animating them
11379			if ( hidden ) {
11380				showHide( [ elem ], true );
11381			}
11382
11383			/* eslint-disable no-loop-func */
11384
11385			anim.done( function() {
11386
11387			/* eslint-enable no-loop-func */
11388
11389				// The final step of a "hide" animation is actually hiding the element
11390				if ( !hidden ) {
11391					showHide( [ elem ] );
11392				}
11393				dataPriv.remove( elem, "fxshow" );
11394				for ( prop in orig ) {
11395					jQuery.style( elem, prop, orig[ prop ] );
11396				}
11397			} );
11398		}
11399
11400		// Per-property setup
11401		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
11402		if ( !( prop in dataShow ) ) {
11403			dataShow[ prop ] = propTween.start;
11404			if ( hidden ) {
11405				propTween.end = propTween.start;
11406				propTween.start = 0;
11407			}
11408		}
11409	}
11410}
11411
11412function propFilter( props, specialEasing ) {
11413	var index, name, easing, value, hooks;
11414
11415	// camelCase, specialEasing and expand cssHook pass
11416	for ( index in props ) {
11417		name = camelCase( index );
11418		easing = specialEasing[ name ];
11419		value = props[ index ];
11420		if ( Array.isArray( value ) ) {
11421			easing = value[ 1 ];
11422			value = props[ index ] = value[ 0 ];
11423		}
11424
11425		if ( index !== name ) {
11426			props[ name ] = value;
11427			delete props[ index ];
11428		}
11429
11430		hooks = jQuery.cssHooks[ name ];
11431		if ( hooks && "expand" in hooks ) {
11432			value = hooks.expand( value );
11433			delete props[ name ];
11434
11435			// Not quite $.extend, this won't overwrite existing keys.
11436			// Reusing 'index' because we have the correct "name"
11437			for ( index in value ) {
11438				if ( !( index in props ) ) {
11439					props[ index ] = value[ index ];
11440					specialEasing[ index ] = easing;
11441				}
11442			}
11443		} else {
11444			specialEasing[ name ] = easing;
11445		}
11446	}
11447}
11448
11449function Animation( elem, properties, options ) {
11450	var result,
11451		stopped,
11452		index = 0,
11453		length = Animation.prefilters.length,
11454		deferred = jQuery.Deferred().always( function() {
11455
11456			// Don't match elem in the :animated selector
11457			delete tick.elem;
11458		} ),
11459		tick = function() {
11460			if ( stopped ) {
11461				return false;
11462			}
11463			var currentTime = fxNow || createFxNow(),
11464				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
11465
11466				// Support: Android 2.3 only
11467				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
11468				temp = remaining / animation.duration || 0,
11469				percent = 1 - temp,
11470				index = 0,
11471				length = animation.tweens.length;
11472
11473			for ( ; index < length; index++ ) {
11474				animation.tweens[ index ].run( percent );
11475			}
11476
11477			deferred.notifyWith( elem, [ animation, percent, remaining ] );
11478
11479			// If there's more to do, yield
11480			if ( percent < 1 && length ) {
11481				return remaining;
11482			}
11483
11484			// If this was an empty animation, synthesize a final progress notification
11485			if ( !length ) {
11486				deferred.notifyWith( elem, [ animation, 1, 0 ] );
11487			}
11488
11489			// Resolve the animation and report its conclusion
11490			deferred.resolveWith( elem, [ animation ] );
11491			return false;
11492		},
11493		animation = deferred.promise( {
11494			elem: elem,
11495			props: jQuery.extend( {}, properties ),
11496			opts: jQuery.extend( true, {
11497				specialEasing: {},
11498				easing: jQuery.easing._default
11499			}, options ),
11500			originalProperties: properties,
11501			originalOptions: options,
11502			startTime: fxNow || createFxNow(),
11503			duration: options.duration,
11504			tweens: [],
11505			createTween: function( prop, end ) {
11506				var tween = jQuery.Tween( elem, animation.opts, prop, end,
11507						animation.opts.specialEasing[ prop ] || animation.opts.easing );
11508				animation.tweens.push( tween );
11509				return tween;
11510			},
11511			stop: function( gotoEnd ) {
11512				var index = 0,
11513
11514					// If we are going to the end, we want to run all the tweens
11515					// otherwise we skip this part
11516					length = gotoEnd ? animation.tweens.length : 0;
11517				if ( stopped ) {
11518					return this;
11519				}
11520				stopped = true;
11521				for ( ; index < length; index++ ) {
11522					animation.tweens[ index ].run( 1 );
11523				}
11524
11525				// Resolve when we played the last frame; otherwise, reject
11526				if ( gotoEnd ) {
11527					deferred.notifyWith( elem, [ animation, 1, 0 ] );
11528					deferred.resolveWith( elem, [ animation, gotoEnd ] );
11529				} else {
11530					deferred.rejectWith( elem, [ animation, gotoEnd ] );
11531				}
11532				return this;
11533			}
11534		} ),
11535		props = animation.props;
11536
11537	propFilter( props, animation.opts.specialEasing );
11538
11539	for ( ; index < length; index++ ) {
11540		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
11541		if ( result ) {
11542			if ( isFunction( result.stop ) ) {
11543				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
11544					result.stop.bind( result );
11545			}
11546			return result;
11547		}
11548	}
11549
11550	jQuery.map( props, createTween, animation );
11551
11552	if ( isFunction( animation.opts.start ) ) {
11553		animation.opts.start.call( elem, animation );
11554	}
11555
11556	// Attach callbacks from options
11557	animation
11558		.progress( animation.opts.progress )
11559		.done( animation.opts.done, animation.opts.complete )
11560		.fail( animation.opts.fail )
11561		.always( animation.opts.always );
11562
11563	jQuery.fx.timer(
11564		jQuery.extend( tick, {
11565			elem: elem,
11566			anim: animation,
11567			queue: animation.opts.queue
11568		} )
11569	);
11570
11571	return animation;
11572}
11573
11574jQuery.Animation = jQuery.extend( Animation, {
11575
11576	tweeners: {
11577		"*": [ function( prop, value ) {
11578			var tween = this.createTween( prop, value );
11579			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
11580			return tween;
11581		} ]
11582	},
11583
11584	tweener: function( props, callback ) {
11585		if ( isFunction( props ) ) {
11586			callback = props;
11587			props = [ "*" ];
11588		} else {
11589			props = props.match( rnothtmlwhite );
11590		}
11591
11592		var prop,
11593			index = 0,
11594			length = props.length;
11595
11596		for ( ; index < length; index++ ) {
11597			prop = props[ index ];
11598			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
11599			Animation.tweeners[ prop ].unshift( callback );
11600		}
11601	},
11602
11603	prefilters: [ defaultPrefilter ],
11604
11605	prefilter: function( callback, prepend ) {
11606		if ( prepend ) {
11607			Animation.prefilters.unshift( callback );
11608		} else {
11609			Animation.prefilters.push( callback );
11610		}
11611	}
11612} );
11613
11614jQuery.speed = function( speed, easing, fn ) {
11615	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
11616		complete: fn || !fn && easing ||
11617			isFunction( speed ) && speed,
11618		duration: speed,
11619		easing: fn && easing || easing && !isFunction( easing ) && easing
11620	};
11621
11622	// Go to the end state if fx are off
11623	if ( jQuery.fx.off ) {
11624		opt.duration = 0;
11625
11626	} else {
11627		if ( typeof opt.duration !== "number" ) {
11628			if ( opt.duration in jQuery.fx.speeds ) {
11629				opt.duration = jQuery.fx.speeds[ opt.duration ];
11630
11631			} else {
11632				opt.duration = jQuery.fx.speeds._default;
11633			}
11634		}
11635	}
11636
11637	// Normalize opt.queue - true/undefined/null -> "fx"
11638	if ( opt.queue == null || opt.queue === true ) {
11639		opt.queue = "fx";
11640	}
11641
11642	// Queueing
11643	opt.old = opt.complete;
11644
11645	opt.complete = function() {
11646		if ( isFunction( opt.old ) ) {
11647			opt.old.call( this );
11648		}
11649
11650		if ( opt.queue ) {
11651			jQuery.dequeue( this, opt.queue );
11652		}
11653	};
11654
11655	return opt;
11656};
11657
11658jQuery.fn.extend( {
11659	fadeTo: function( speed, to, easing, callback ) {
11660
11661		// Show any hidden elements after setting opacity to 0
11662		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
11663
11664			// Animate to the value specified
11665			.end().animate( { opacity: to }, speed, easing, callback );
11666	},
11667	animate: function( prop, speed, easing, callback ) {
11668		var empty = jQuery.isEmptyObject( prop ),
11669			optall = jQuery.speed( speed, easing, callback ),
11670			doAnimation = function() {
11671
11672				// Operate on a copy of prop so per-property easing won't be lost
11673				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
11674
11675				// Empty animations, or finishing resolves immediately
11676				if ( empty || dataPriv.get( this, "finish" ) ) {
11677					anim.stop( true );
11678				}
11679			};
11680			doAnimation.finish = doAnimation;
11681
11682		return empty || optall.queue === false ?
11683			this.each( doAnimation ) :
11684			this.queue( optall.queue, doAnimation );
11685	},
11686	stop: function( type, clearQueue, gotoEnd ) {
11687		var stopQueue = function( hooks ) {
11688			var stop = hooks.stop;
11689			delete hooks.stop;
11690			stop( gotoEnd );
11691		};
11692
11693		if ( typeof type !== "string" ) {
11694			gotoEnd = clearQueue;
11695			clearQueue = type;
11696			type = undefined;
11697		}
11698		if ( clearQueue && type !== false ) {
11699			this.queue( type || "fx", [] );
11700		}
11701
11702		return this.each( function() {
11703			var dequeue = true,
11704				index = type != null && type + "queueHooks",
11705				timers = jQuery.timers,
11706				data = dataPriv.get( this );
11707
11708			if ( index ) {
11709				if ( data[ index ] && data[ index ].stop ) {
11710					stopQueue( data[ index ] );
11711				}
11712			} else {
11713				for ( index in data ) {
11714					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
11715						stopQueue( data[ index ] );
11716					}
11717				}
11718			}
11719
11720			for ( index = timers.length; index--; ) {
11721				if ( timers[ index ].elem === this &&
11722					( type == null || timers[ index ].queue === type ) ) {
11723
11724					timers[ index ].anim.stop( gotoEnd );
11725					dequeue = false;
11726					timers.splice( index, 1 );
11727				}
11728			}
11729
11730			// Start the next in the queue if the last step wasn't forced.
11731			// Timers currently will call their complete callbacks, which
11732			// will dequeue but only if they were gotoEnd.
11733			if ( dequeue || !gotoEnd ) {
11734				jQuery.dequeue( this, type );
11735			}
11736		} );
11737	},
11738	finish: function( type ) {
11739		if ( type !== false ) {
11740			type = type || "fx";
11741		}
11742		return this.each( function() {
11743			var index,
11744				data = dataPriv.get( this ),
11745				queue = data[ type + "queue" ],
11746				hooks = data[ type + "queueHooks" ],
11747				timers = jQuery.timers,
11748				length = queue ? queue.length : 0;
11749
11750			// Enable finishing flag on private data
11751			data.finish = true;
11752
11753			// Empty the queue first
11754			jQuery.queue( this, type, [] );
11755
11756			if ( hooks && hooks.stop ) {
11757				hooks.stop.call( this, true );
11758			}
11759
11760			// Look for any active animations, and finish them
11761			for ( index = timers.length; index--; ) {
11762				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
11763					timers[ index ].anim.stop( true );
11764					timers.splice( index, 1 );
11765				}
11766			}
11767
11768			// Look for any animations in the old queue and finish them
11769			for ( index = 0; index < length; index++ ) {
11770				if ( queue[ index ] && queue[ index ].finish ) {
11771					queue[ index ].finish.call( this );
11772				}
11773			}
11774
11775			// Turn off finishing flag
11776			delete data.finish;
11777		} );
11778	}
11779} );
11780
11781jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
11782	var cssFn = jQuery.fn[ name ];
11783	jQuery.fn[ name ] = function( speed, easing, callback ) {
11784		return speed == null || typeof speed === "boolean" ?
11785			cssFn.apply( this, arguments ) :
11786			this.animate( genFx( name, true ), speed, easing, callback );
11787	};
11788} );
11789
11790// Generate shortcuts for custom animations
11791jQuery.each( {
11792	slideDown: genFx( "show" ),
11793	slideUp: genFx( "hide" ),
11794	slideToggle: genFx( "toggle" ),
11795	fadeIn: { opacity: "show" },
11796	fadeOut: { opacity: "hide" },
11797	fadeToggle: { opacity: "toggle" }
11798}, function( name, props ) {
11799	jQuery.fn[ name ] = function( speed, easing, callback ) {
11800		return this.animate( props, speed, easing, callback );
11801	};
11802} );
11803
11804jQuery.timers = [];
11805jQuery.fx.tick = function() {
11806	var timer,
11807		i = 0,
11808		timers = jQuery.timers;
11809
11810	fxNow = Date.now();
11811
11812	for ( ; i < timers.length; i++ ) {
11813		timer = timers[ i ];
11814
11815		// Run the timer and safely remove it when done (allowing for external removal)
11816		if ( !timer() && timers[ i ] === timer ) {
11817			timers.splice( i--, 1 );
11818		}
11819	}
11820
11821	if ( !timers.length ) {
11822		jQuery.fx.stop();
11823	}
11824	fxNow = undefined;
11825};
11826
11827jQuery.fx.timer = function( timer ) {
11828	jQuery.timers.push( timer );
11829	jQuery.fx.start();
11830};
11831
11832jQuery.fx.interval = 13;
11833jQuery.fx.start = function() {
11834	if ( inProgress ) {
11835		return;
11836	}
11837
11838	inProgress = true;
11839	schedule();
11840};
11841
11842jQuery.fx.stop = function() {
11843	inProgress = null;
11844};
11845
11846jQuery.fx.speeds = {
11847	slow: 600,
11848	fast: 200,
11849
11850	// Default speed
11851	_default: 400
11852};
11853
11854
11855// Based off of the plugin by Clint Helfers, with permission.
11856// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
11857jQuery.fn.delay = function( time, type ) {
11858	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
11859	type = type || "fx";
11860
11861	return this.queue( type, function( next, hooks ) {
11862		var timeout = window.setTimeout( next, time );
11863		hooks.stop = function() {
11864			window.clearTimeout( timeout );
11865		};
11866	} );
11867};
11868
11869
11870( function() {
11871	var input = document.createElement( "input" ),
11872		select = document.createElement( "select" ),
11873		opt = select.appendChild( document.createElement( "option" ) );
11874
11875	input.type = "checkbox";
11876
11877	// Support: Android <=4.3 only
11878	// Default value for a checkbox should be "on"
11879	support.checkOn = input.value !== "";
11880
11881	// Support: IE <=11 only
11882	// Must access selectedIndex to make default options select
11883	support.optSelected = opt.selected;
11884
11885	// Support: IE <=11 only
11886	// An input loses its value after becoming a radio
11887	input = document.createElement( "input" );
11888	input.value = "t";
11889	input.type = "radio";
11890	support.radioValue = input.value === "t";
11891} )();
11892
11893
11894var boolHook,
11895	attrHandle = jQuery.expr.attrHandle;
11896
11897jQuery.fn.extend( {
11898	attr: function( name, value ) {
11899		return access( this, jQuery.attr, name, value, arguments.length > 1 );
11900	},
11901
11902	removeAttr: function( name ) {
11903		return this.each( function() {
11904			jQuery.removeAttr( this, name );
11905		} );
11906	}
11907} );
11908
11909jQuery.extend( {
11910	attr: function( elem, name, value ) {
11911		var ret, hooks,
11912			nType = elem.nodeType;
11913
11914		// Don't get/set attributes on text, comment and attribute nodes
11915		if ( nType === 3 || nType === 8 || nType === 2 ) {
11916			return;
11917		}
11918
11919		// Fallback to prop when attributes are not supported
11920		if ( typeof elem.getAttribute === "undefined" ) {
11921			return jQuery.prop( elem, name, value );
11922		}
11923
11924		// Attribute hooks are determined by the lowercase version
11925		// Grab necessary hook if one is defined
11926		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
11927			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
11928				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
11929		}
11930
11931		if ( value !== undefined ) {
11932			if ( value === null ) {
11933				jQuery.removeAttr( elem, name );
11934				return;
11935			}
11936
11937			if ( hooks && "set" in hooks &&
11938				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
11939				return ret;
11940			}
11941
11942			elem.setAttribute( name, value + "" );
11943			return value;
11944		}
11945
11946		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
11947			return ret;
11948		}
11949
11950		ret = jQuery.find.attr( elem, name );
11951
11952		// Non-existent attributes return null, we normalize to undefined
11953		return ret == null ? undefined : ret;
11954	},
11955
11956	attrHooks: {
11957		type: {
11958			set: function( elem, value ) {
11959				if ( !support.radioValue && value === "radio" &&
11960					nodeName( elem, "input" ) ) {
11961					var val = elem.value;
11962					elem.setAttribute( "type", value );
11963					if ( val ) {
11964						elem.value = val;
11965					}
11966					return value;
11967				}
11968			}
11969		}
11970	},
11971
11972	removeAttr: function( elem, value ) {
11973		var name,
11974			i = 0,
11975
11976			// Attribute names can contain non-HTML whitespace characters
11977			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
11978			attrNames = value && value.match( rnothtmlwhite );
11979
11980		if ( attrNames && elem.nodeType === 1 ) {
11981			while ( ( name = attrNames[ i++ ] ) ) {
11982				elem.removeAttribute( name );
11983			}
11984		}
11985	}
11986} );
11987
11988// Hooks for boolean attributes
11989boolHook = {
11990	set: function( elem, value, name ) {
11991		if ( value === false ) {
11992
11993			// Remove boolean attributes when set to false
11994			jQuery.removeAttr( elem, name );
11995		} else {
11996			elem.setAttribute( name, name );
11997		}
11998		return name;
11999	}
12000};
12001
12002jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
12003	var getter = attrHandle[ name ] || jQuery.find.attr;
12004
12005	attrHandle[ name ] = function( elem, name, isXML ) {
12006		var ret, handle,
12007			lowercaseName = name.toLowerCase();
12008
12009		if ( !isXML ) {
12010
12011			// Avoid an infinite loop by temporarily removing this function from the getter
12012			handle = attrHandle[ lowercaseName ];
12013			attrHandle[ lowercaseName ] = ret;
12014			ret = getter( elem, name, isXML ) != null ?
12015				lowercaseName :
12016				null;
12017			attrHandle[ lowercaseName ] = handle;
12018		}
12019		return ret;
12020	};
12021} );
12022
12023
12024
12025
12026var rfocusable = /^(?:input|select|textarea|button)$/i,
12027	rclickable = /^(?:a|area)$/i;
12028
12029jQuery.fn.extend( {
12030	prop: function( name, value ) {
12031		return access( this, jQuery.prop, name, value, arguments.length > 1 );
12032	},
12033
12034	removeProp: function( name ) {
12035		return this.each( function() {
12036			delete this[ jQuery.propFix[ name ] || name ];
12037		} );
12038	}
12039} );
12040
12041jQuery.extend( {
12042	prop: function( elem, name, value ) {
12043		var ret, hooks,
12044			nType = elem.nodeType;
12045
12046		// Don't get/set properties on text, comment and attribute nodes
12047		if ( nType === 3 || nType === 8 || nType === 2 ) {
12048			return;
12049		}
12050
12051		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
12052
12053			// Fix name and attach hooks
12054			name = jQuery.propFix[ name ] || name;
12055			hooks = jQuery.propHooks[ name ];
12056		}
12057
12058		if ( value !== undefined ) {
12059			if ( hooks && "set" in hooks &&
12060				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
12061				return ret;
12062			}
12063
12064			return ( elem[ name ] = value );
12065		}
12066
12067		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
12068			return ret;
12069		}
12070
12071		return elem[ name ];
12072	},
12073
12074	propHooks: {
12075		tabIndex: {
12076			get: function( elem ) {
12077
12078				// Support: IE <=9 - 11 only
12079				// elem.tabIndex doesn't always return the
12080				// correct value when it hasn't been explicitly set
12081				// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
12082				// Use proper attribute retrieval(#12072)
12083				var tabindex = jQuery.find.attr( elem, "tabindex" );
12084
12085				if ( tabindex ) {
12086					return parseInt( tabindex, 10 );
12087				}
12088
12089				if (
12090					rfocusable.test( elem.nodeName ) ||
12091					rclickable.test( elem.nodeName ) &&
12092					elem.href
12093				) {
12094					return 0;
12095				}
12096
12097				return -1;
12098			}
12099		}
12100	},
12101
12102	propFix: {
12103		"for": "htmlFor",
12104		"class": "className"
12105	}
12106} );
12107
12108// Support: IE <=11 only
12109// Accessing the selectedIndex property
12110// forces the browser to respect setting selected
12111// on the option
12112// The getter ensures a default option is selected
12113// when in an optgroup
12114// eslint rule "no-unused-expressions" is disabled for this code
12115// since it considers such accessions noop
12116if ( !support.optSelected ) {
12117	jQuery.propHooks.selected = {
12118		get: function( elem ) {
12119
12120			/* eslint no-unused-expressions: "off" */
12121
12122			var parent = elem.parentNode;
12123			if ( parent && parent.parentNode ) {
12124				parent.parentNode.selectedIndex;
12125			}
12126			return null;
12127		},
12128		set: function( elem ) {
12129
12130			/* eslint no-unused-expressions: "off" */
12131
12132			var parent = elem.parentNode;
12133			if ( parent ) {
12134				parent.selectedIndex;
12135
12136				if ( parent.parentNode ) {
12137					parent.parentNode.selectedIndex;
12138				}
12139			}
12140		}
12141	};
12142}
12143
12144jQuery.each( [
12145	"tabIndex",
12146	"readOnly",
12147	"maxLength",
12148	"cellSpacing",
12149	"cellPadding",
12150	"rowSpan",
12151	"colSpan",
12152	"useMap",
12153	"frameBorder",
12154	"contentEditable"
12155], function() {
12156	jQuery.propFix[ this.toLowerCase() ] = this;
12157} );
12158
12159
12160
12161
12162	// Strip and collapse whitespace according to HTML spec
12163	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
12164	function stripAndCollapse( value ) {
12165		var tokens = value.match( rnothtmlwhite ) || [];
12166		return tokens.join( " " );
12167	}
12168
12169
12170function getClass( elem ) {
12171	return elem.getAttribute && elem.getAttribute( "class" ) || "";
12172}
12173
12174function classesToArray( value ) {
12175	if ( Array.isArray( value ) ) {
12176		return value;
12177	}
12178	if ( typeof value === "string" ) {
12179		return value.match( rnothtmlwhite ) || [];
12180	}
12181	return [];
12182}
12183
12184jQuery.fn.extend( {
12185	addClass: function( value ) {
12186		var classes, elem, cur, curValue, clazz, j, finalValue,
12187			i = 0;
12188
12189		if ( isFunction( value ) ) {
12190			return this.each( function( j ) {
12191				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
12192			} );
12193		}
12194
12195		classes = classesToArray( value );
12196
12197		if ( classes.length ) {
12198			while ( ( elem = this[ i++ ] ) ) {
12199				curValue = getClass( elem );
12200				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
12201
12202				if ( cur ) {
12203					j = 0;
12204					while ( ( clazz = classes[ j++ ] ) ) {
12205						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
12206							cur += clazz + " ";
12207						}
12208					}
12209
12210					// Only assign if different to avoid unneeded rendering.
12211					finalValue = stripAndCollapse( cur );
12212					if ( curValue !== finalValue ) {
12213						elem.setAttribute( "class", finalValue );
12214					}
12215				}
12216			}
12217		}
12218
12219		return this;
12220	},
12221
12222	removeClass: function( value ) {
12223		var classes, elem, cur, curValue, clazz, j, finalValue,
12224			i = 0;
12225
12226		if ( isFunction( value ) ) {
12227			return this.each( function( j ) {
12228				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
12229			} );
12230		}
12231
12232		if ( !arguments.length ) {
12233			return this.attr( "class", "" );
12234		}
12235
12236		classes = classesToArray( value );
12237
12238		if ( classes.length ) {
12239			while ( ( elem = this[ i++ ] ) ) {
12240				curValue = getClass( elem );
12241
12242				// This expression is here for better compressibility (see addClass)
12243				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
12244
12245				if ( cur ) {
12246					j = 0;
12247					while ( ( clazz = classes[ j++ ] ) ) {
12248
12249						// Remove *all* instances
12250						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
12251							cur = cur.replace( " " + clazz + " ", " " );
12252						}
12253					}
12254
12255					// Only assign if different to avoid unneeded rendering.
12256					finalValue = stripAndCollapse( cur );
12257					if ( curValue !== finalValue ) {
12258						elem.setAttribute( "class", finalValue );
12259					}
12260				}
12261			}
12262		}
12263
12264		return this;
12265	},
12266
12267	toggleClass: function( value, stateVal ) {
12268		var type = typeof value,
12269			isValidValue = type === "string" || Array.isArray( value );
12270
12271		if ( typeof stateVal === "boolean" && isValidValue ) {
12272			return stateVal ? this.addClass( value ) : this.removeClass( value );
12273		}
12274
12275		if ( isFunction( value ) ) {
12276			return this.each( function( i ) {
12277				jQuery( this ).toggleClass(
12278					value.call( this, i, getClass( this ), stateVal ),
12279					stateVal
12280				);
12281			} );
12282		}
12283
12284		return this.each( function() {
12285			var className, i, self, classNames;
12286
12287			if ( isValidValue ) {
12288
12289				// Toggle individual class names
12290				i = 0;
12291				self = jQuery( this );
12292				classNames = classesToArray( value );
12293
12294				while ( ( className = classNames[ i++ ] ) ) {
12295
12296					// Check each className given, space separated list
12297					if ( self.hasClass( className ) ) {
12298						self.removeClass( className );
12299					} else {
12300						self.addClass( className );
12301					}
12302				}
12303
12304			// Toggle whole class name
12305			} else if ( value === undefined || type === "boolean" ) {
12306				className = getClass( this );
12307				if ( className ) {
12308
12309					// Store className if set
12310					dataPriv.set( this, "__className__", className );
12311				}
12312
12313				// If the element has a class name or if we're passed `false`,
12314				// then remove the whole classname (if there was one, the above saved it).
12315				// Otherwise bring back whatever was previously saved (if anything),
12316				// falling back to the empty string if nothing was stored.
12317				if ( this.setAttribute ) {
12318					this.setAttribute( "class",
12319						className || value === false ?
12320						"" :
12321						dataPriv.get( this, "__className__" ) || ""
12322					);
12323				}
12324			}
12325		} );
12326	},
12327
12328	hasClass: function( selector ) {
12329		var className, elem,
12330			i = 0;
12331
12332		className = " " + selector + " ";
12333		while ( ( elem = this[ i++ ] ) ) {
12334			if ( elem.nodeType === 1 &&
12335				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
12336					return true;
12337			}
12338		}
12339
12340		return false;
vendor: 5,544 bytes, lines 12341-12576
12341	}
12342} );
12343
12344
12345
12346
12347var rreturn = /\r/g;
12348
12349jQuery.fn.extend( {
12350	val: function( value ) {
12351		var hooks, ret, valueIsFunction,
12352			elem = this[ 0 ];
12353
12354		if ( !arguments.length ) {
12355			if ( elem ) {
12356				hooks = jQuery.valHooks[ elem.type ] ||
12357					jQuery.valHooks[ elem.nodeName.toLowerCase() ];
12358
12359				if ( hooks &&
12360					"get" in hooks &&
12361					( ret = hooks.get( elem, "value" ) ) !== undefined
12362				) {
12363					return ret;
12364				}
12365
12366				ret = elem.value;
12367
12368				// Handle most common string cases
12369				if ( typeof ret === "string" ) {
12370					return ret.replace( rreturn, "" );
12371				}
12372
12373				// Handle cases where value is null/undef or number
12374				return ret == null ? "" : ret;
12375			}
12376
12377			return;
12378		}
12379
12380		valueIsFunction = isFunction( value );
12381
12382		return this.each( function( i ) {
12383			var val;
12384
12385			if ( this.nodeType !== 1 ) {
12386				return;
12387			}
12388
12389			if ( valueIsFunction ) {
12390				val = value.call( this, i, jQuery( this ).val() );
12391			} else {
12392				val = value;
12393			}
12394
12395			// Treat null/undefined as ""; convert numbers to string
12396			if ( val == null ) {
12397				val = "";
12398
12399			} else if ( typeof val === "number" ) {
12400				val += "";
12401
12402			} else if ( Array.isArray( val ) ) {
12403				val = jQuery.map( val, function( value ) {
12404					return value == null ? "" : value + "";
12405				} );
12406			}
12407
12408			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
12409
12410			// If set returns undefined, fall back to normal setting
12411			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
12412				this.value = val;
12413			}
12414		} );
12415	}
12416} );
12417
12418jQuery.extend( {
12419	valHooks: {
12420		option: {
12421			get: function( elem ) {
12422
12423				var val = jQuery.find.attr( elem, "value" );
12424				return val != null ?
12425					val :
12426
12427					// Support: IE <=10 - 11 only
12428					// option.text throws exceptions (#14686, #14858)
12429					// Strip and collapse whitespace
12430					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
12431					stripAndCollapse( jQuery.text( elem ) );
12432			}
12433		},
12434		select: {
12435			get: function( elem ) {
12436				var value, option, i,
12437					options = elem.options,
12438					index = elem.selectedIndex,
12439					one = elem.type === "select-one",
12440					values = one ? null : [],
12441					max = one ? index + 1 : options.length;
12442
12443				if ( index < 0 ) {
12444					i = max;
12445
12446				} else {
12447					i = one ? index : 0;
12448				}
12449
12450				// Loop through all the selected options
12451				for ( ; i < max; i++ ) {
12452					option = options[ i ];
12453
12454					// Support: IE <=9 only
12455					// IE8-9 doesn't update selected after form reset (#2551)
12456					if ( ( option.selected || i === index ) &&
12457
12458							// Don't return options that are disabled or in a disabled optgroup
12459							!option.disabled &&
12460							( !option.parentNode.disabled ||
12461								!nodeName( option.parentNode, "optgroup" ) ) ) {
12462
12463						// Get the specific value for the option
12464						value = jQuery( option ).val();
12465
12466						// We don't need an array for one selects
12467						if ( one ) {
12468							return value;
12469						}
12470
12471						// Multi-Selects return an array
12472						values.push( value );
12473					}
12474				}
12475
12476				return values;
12477			},
12478
12479			set: function( elem, value ) {
12480				var optionSet, option,
12481					options = elem.options,
12482					values = jQuery.makeArray( value ),
12483					i = options.length;
12484
12485				while ( i-- ) {
12486					option = options[ i ];
12487
12488					/* eslint-disable no-cond-assign */
12489
12490					if ( option.selected =
12491						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
12492					) {
12493						optionSet = true;
12494					}
12495
12496					/* eslint-enable no-cond-assign */
12497				}
12498
12499				// Force browsers to behave consistently when non-matching value is set
12500				if ( !optionSet ) {
12501					elem.selectedIndex = -1;
12502				}
12503				return values;
12504			}
12505		}
12506	}
12507} );
12508
12509// Radios and checkboxes getter/setter
12510jQuery.each( [ "radio", "checkbox" ], function() {
12511	jQuery.valHooks[ this ] = {
12512		set: function( elem, value ) {
12513			if ( Array.isArray( value ) ) {
12514				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
12515			}
12516		}
12517	};
12518	if ( !support.checkOn ) {
12519		jQuery.valHooks[ this ].get = function( elem ) {
12520			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
12521		};
12522	}
12523} );
12524
12525
12526
12527
12528// Return jQuery for attributes-only inclusion
12529
12530
12531support.focusin = "onfocusin" in window;
12532
12533
12534var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
12535	stopPropagationCallback = function( e ) {
12536		e.stopPropagation();
12537	};
12538
12539jQuery.extend( jQuery.event, {
12540
12541	trigger: function( event, data, elem, onlyHandlers ) {
12542
12543		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
12544			eventPath = [ elem || document ],
12545			type = hasOwn.call( event, "type" ) ? event.type : event,
12546			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
12547
12548		cur = lastElement = tmp = elem = elem || document;
12549
12550		// Don't do events on text and comment nodes
12551		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
12552			return;
12553		}
12554
12555		// focus/blur morphs to focusin/out; ensure we're not firing them right now
12556		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
12557			return;
12558		}
12559
12560		if ( type.indexOf( "." ) > -1 ) {
12561
12562			// Namespaced trigger; create a regexp to match event type in handle()
12563			namespaces = type.split( "." );
12564			type = namespaces.shift();
12565			namespaces.sort();
12566		}
12567		ontype = type.indexOf( ":" ) < 0 && "on" + type;
12568
12569		// Caller can pass in a jQuery.Event object, Object, or just an event type string
12570		event = event[ jQuery.expando ] ?
12571			event :
12572			new jQuery.Event( type, typeof event === "object" && event );
12573
12574		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
12575		event.isTrigger = onlyHandlers ? 2 : 3;
12576		event.namespace = namespaces.join( "." );
vendor: 32,532 bytes, lines 12577-13848
12577		event.rnamespace = event.namespace ?
12578			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
12579			null;
12580
12581		// Clean up the event in case it is being reused
12582		event.result = undefined;
12583		if ( !event.target ) {
12584			event.target = elem;
12585		}
12586
12587		// Clone any incoming data and prepend the event, creating the handler arg list
12588		data = data == null ?
12589			[ event ] :
12590			jQuery.makeArray( data, [ event ] );
12591
12592		// Allow special events to draw outside the lines
12593		special = jQuery.event.special[ type ] || {};
12594		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
12595			return;
12596		}
12597
12598		// Determine event propagation path in advance, per W3C events spec (#9951)
12599		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
12600		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
12601
12602			bubbleType = special.delegateType || type;
12603			if ( !rfocusMorph.test( bubbleType + type ) ) {
12604				cur = cur.parentNode;
12605			}
12606			for ( ; cur; cur = cur.parentNode ) {
12607				eventPath.push( cur );
12608				tmp = cur;
12609			}
12610
12611			// Only add window if we got to document (e.g., not plain obj or detached DOM)
12612			if ( tmp === ( elem.ownerDocument || document ) ) {
12613				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
12614			}
12615		}
12616
12617		// Fire handlers on the event path
12618		i = 0;
12619		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
12620			lastElement = cur;
12621			event.type = i > 1 ?
12622				bubbleType :
12623				special.bindType || type;
12624
12625			// jQuery handler
12626			handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
12627				dataPriv.get( cur, "handle" );
12628			if ( handle ) {
12629				handle.apply( cur, data );
12630			}
12631
12632			// Native handler
12633			handle = ontype && cur[ ontype ];
12634			if ( handle && handle.apply && acceptData( cur ) ) {
12635				event.result = handle.apply( cur, data );
12636				if ( event.result === false ) {
12637					event.preventDefault();
12638				}
12639			}
12640		}
12641		event.type = type;
12642
12643		// If nobody prevented the default action, do it now
12644		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
12645
12646			if ( ( !special._default ||
12647				special._default.apply( eventPath.pop(), data ) === false ) &&
12648				acceptData( elem ) ) {
12649
12650				// Call a native DOM method on the target with the same name as the event.
12651				// Don't do default actions on window, that's where global variables be (#6170)
12652				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
12653
12654					// Don't re-trigger an onFOO event when we call its FOO() method
12655					tmp = elem[ ontype ];
12656
12657					if ( tmp ) {
12658						elem[ ontype ] = null;
12659					}
12660
12661					// Prevent re-triggering of the same event, since we already bubbled it above
12662					jQuery.event.triggered = type;
12663
12664					if ( event.isPropagationStopped() ) {
12665						lastElement.addEventListener( type, stopPropagationCallback );
12666					}
12667
12668					elem[ type ]();
12669
12670					if ( event.isPropagationStopped() ) {
12671						lastElement.removeEventListener( type, stopPropagationCallback );
12672					}
12673
12674					jQuery.event.triggered = undefined;
12675
12676					if ( tmp ) {
12677						elem[ ontype ] = tmp;
12678					}
12679				}
12680			}
12681		}
12682
12683		return event.result;
12684	},
12685
12686	// Piggyback on a donor event to simulate a different one
12687	// Used only for `focus(in | out)` events
12688	simulate: function( type, elem, event ) {
12689		var e = jQuery.extend(
12690			new jQuery.Event(),
12691			event,
12692			{
12693				type: type,
12694				isSimulated: true
12695			}
12696		);
12697
12698		jQuery.event.trigger( e, null, elem );
12699	}
12700
12701} );
12702
12703jQuery.fn.extend( {
12704
12705	trigger: function( type, data ) {
12706		return this.each( function() {
12707			jQuery.event.trigger( type, data, this );
12708		} );
12709	},
12710	triggerHandler: function( type, data ) {
12711		var elem = this[ 0 ];
12712		if ( elem ) {
12713			return jQuery.event.trigger( type, data, elem, true );
12714		}
12715	}
12716} );
12717
12718
12719// Support: Firefox <=44
12720// Firefox doesn't have focus(in | out) events
12721// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
12722//
12723// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
12724// focus(in | out) events fire after focus & blur events,
12725// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
12726// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
12727if ( !support.focusin ) {
12728	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
12729
12730		// Attach a single capturing handler on the document while someone wants focusin/focusout
12731		var handler = function( event ) {
12732			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
12733		};
12734
12735		jQuery.event.special[ fix ] = {
12736			setup: function() {
12737				var doc = this.ownerDocument || this,
12738					attaches = dataPriv.access( doc, fix );
12739
12740				if ( !attaches ) {
12741					doc.addEventListener( orig, handler, true );
12742				}
12743				dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
12744			},
12745			teardown: function() {
12746				var doc = this.ownerDocument || this,
12747					attaches = dataPriv.access( doc, fix ) - 1;
12748
12749				if ( !attaches ) {
12750					doc.removeEventListener( orig, handler, true );
12751					dataPriv.remove( doc, fix );
12752
12753				} else {
12754					dataPriv.access( doc, fix, attaches );
12755				}
12756			}
12757		};
12758	} );
12759}
12760var location = window.location;
12761
12762var nonce = Date.now();
12763
12764var rquery = ( /\?/ );
12765
12766
12767
12768// Cross-browser xml parsing
12769jQuery.parseXML = function( data ) {
12770	var xml;
12771	if ( !data || typeof data !== "string" ) {
12772		return null;
12773	}
12774
12775	// Support: IE 9 - 11 only
12776	// IE throws on parseFromString with invalid input.
12777	try {
12778		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
12779	} catch ( e ) {
12780		xml = undefined;
12781	}
12782
12783	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
12784		jQuery.error( "Invalid XML: " + data );
12785	}
12786	return xml;
12787};
12788
12789
12790var
12791	rbracket = /\[\]$/,
12792	rCRLF = /\r?\n/g,
12793	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
12794	rsubmittable = /^(?:input|select|textarea|keygen)/i;
12795
12796function buildParams( prefix, obj, traditional, add ) {
12797	var name;
12798
12799	if ( Array.isArray( obj ) ) {
12800
12801		// Serialize array item.
12802		jQuery.each( obj, function( i, v ) {
12803			if ( traditional || rbracket.test( prefix ) ) {
12804
12805				// Treat each array item as a scalar.
12806				add( prefix, v );
12807
12808			} else {
12809
12810				// Item is non-scalar (array or object), encode its numeric index.
12811				buildParams(
12812					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
12813					v,
12814					traditional,
12815					add
12816				);
12817			}
12818		} );
12819
12820	} else if ( !traditional && toType( obj ) === "object" ) {
12821
12822		// Serialize object item.
12823		for ( name in obj ) {
12824			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
12825		}
12826
12827	} else {
12828
12829		// Serialize scalar item.
12830		add( prefix, obj );
12831	}
12832}
12833
12834// Serialize an array of form elements or a set of
12835// key/values into a query string
12836jQuery.param = function( a, traditional ) {
12837	var prefix,
12838		s = [],
12839		add = function( key, valueOrFunction ) {
12840
12841			// If value is a function, invoke it and use its return value
12842			var value = isFunction( valueOrFunction ) ?
12843				valueOrFunction() :
12844				valueOrFunction;
12845
12846			s[ s.length ] = encodeURIComponent( key ) + "=" +
12847				encodeURIComponent( value == null ? "" : value );
12848		};
12849
12850	// If an array was passed in, assume that it is an array of form elements.
12851	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
12852
12853		// Serialize the form elements
12854		jQuery.each( a, function() {
12855			add( this.name, this.value );
12856		} );
12857
12858	} else {
12859
12860		// If traditional, encode the "old" way (the way 1.3.2 or older
12861		// did it), otherwise encode params recursively.
12862		for ( prefix in a ) {
12863			buildParams( prefix, a[ prefix ], traditional, add );
12864		}
12865	}
12866
12867	// Return the resulting serialization
12868	return s.join( "&" );
12869};
12870
12871jQuery.fn.extend( {
12872	serialize: function() {
12873		return jQuery.param( this.serializeArray() );
12874	},
12875	serializeArray: function() {
12876		return this.map( function() {
12877
12878			// Can add propHook for "elements" to filter or add form elements
12879			var elements = jQuery.prop( this, "elements" );
12880			return elements ? jQuery.makeArray( elements ) : this;
12881		} )
12882		.filter( function() {
12883			var type = this.type;
12884
12885			// Use .is( ":disabled" ) so that fieldset[disabled] works
12886			return this.name && !jQuery( this ).is( ":disabled" ) &&
12887				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
12888				( this.checked || !rcheckableType.test( type ) );
12889		} )
12890		.map( function( i, elem ) {
12891			var val = jQuery( this ).val();
12892
12893			if ( val == null ) {
12894				return null;
12895			}
12896
12897			if ( Array.isArray( val ) ) {
12898				return jQuery.map( val, function( val ) {
12899					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
12900				} );
12901			}
12902
12903			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
12904		} ).get();
12905	}
12906} );
12907
12908
12909var
12910	r20 = /%20/g,
12911	rhash = /#.*$/,
12912	rantiCache = /([?&])_=[^&]*/,
12913	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
12914
12915	// #7653, #8125, #8152: local protocol detection
12916	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
12917	rnoContent = /^(?:GET|HEAD)$/,
12918	rprotocol = /^\/\//,
12919
12920	/* Prefilters
12921	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
12922	 * 2) These are called:
12923	 *    - BEFORE asking for a transport
12924	 *    - AFTER param serialization (s.data is a string if s.processData is true)
12925	 * 3) key is the dataType
12926	 * 4) the catchall symbol "*" can be used
12927	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
12928	 */
12929	prefilters = {},
12930
12931	/* Transports bindings
12932	 * 1) key is the dataType
12933	 * 2) the catchall symbol "*" can be used
12934	 * 3) selection will start with transport dataType and THEN go to "*" if needed
12935	 */
12936	transports = {},
12937
12938	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
12939	allTypes = "*/".concat( "*" ),
12940
12941	// Anchor tag for parsing the document origin
12942	originAnchor = document.createElement( "a" );
12943	originAnchor.href = location.href;
12944
12945// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
12946function addToPrefiltersOrTransports( structure ) {
12947
12948	// dataTypeExpression is optional and defaults to "*"
12949	return function( dataTypeExpression, func ) {
12950
12951		if ( typeof dataTypeExpression !== "string" ) {
12952			func = dataTypeExpression;
12953			dataTypeExpression = "*";
12954		}
12955
12956		var dataType,
12957			i = 0,
12958			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
12959
12960		if ( isFunction( func ) ) {
12961
12962			// For each dataType in the dataTypeExpression
12963			while ( ( dataType = dataTypes[ i++ ] ) ) {
12964
12965				// Prepend if requested
12966				if ( dataType[ 0 ] === "+" ) {
12967					dataType = dataType.slice( 1 ) || "*";
12968					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
12969
12970				// Otherwise append
12971				} else {
12972					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
12973				}
12974			}
12975		}
12976	};
12977}
12978
12979// Base inspection function for prefilters and transports
12980function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
12981
12982	var inspected = {},
12983		seekingTransport = ( structure === transports );
12984
12985	function inspect( dataType ) {
12986		var selected;
12987		inspected[ dataType ] = true;
12988		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
12989			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
12990			if ( typeof dataTypeOrTransport === "string" &&
12991				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
12992
12993				options.dataTypes.unshift( dataTypeOrTransport );
12994				inspect( dataTypeOrTransport );
12995				return false;
12996			} else if ( seekingTransport ) {
12997				return !( selected = dataTypeOrTransport );
12998			}
12999		} );
13000		return selected;
13001	}
13002
13003	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
13004}
13005
13006// A special extend for ajax options
13007// that takes "flat" options (not to be deep extended)
13008// Fixes #9887
13009function ajaxExtend( target, src ) {
13010	var key, deep,
13011		flatOptions = jQuery.ajaxSettings.flatOptions || {};
13012
13013	for ( key in src ) {
13014		if ( src[ key ] !== undefined ) {
13015			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
13016		}
13017	}
13018	if ( deep ) {
13019		jQuery.extend( true, target, deep );
13020	}
13021
13022	return target;
13023}
13024
13025/* Handles responses to an ajax request:
13026 * - finds the right dataType (mediates between content-type and expected dataType)
13027 * - returns the corresponding response
13028 */
13029function ajaxHandleResponses( s, jqXHR, responses ) {
13030
13031	var ct, type, finalDataType, firstDataType,
13032		contents = s.contents,
13033		dataTypes = s.dataTypes;
13034
13035	// Remove auto dataType and get content-type in the process
13036	while ( dataTypes[ 0 ] === "*" ) {
13037		dataTypes.shift();
13038		if ( ct === undefined ) {
13039			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
13040		}
13041	}
13042
13043	// Check if we're dealing with a known content-type
13044	if ( ct ) {
13045		for ( type in contents ) {
13046			if ( contents[ type ] && contents[ type ].test( ct ) ) {
13047				dataTypes.unshift( type );
13048				break;
13049			}
13050		}
13051	}
13052
13053	// Check to see if we have a response for the expected dataType
13054	if ( dataTypes[ 0 ] in responses ) {
13055		finalDataType = dataTypes[ 0 ];
13056	} else {
13057
13058		// Try convertible dataTypes
13059		for ( type in responses ) {
13060			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
13061				finalDataType = type;
13062				break;
13063			}
13064			if ( !firstDataType ) {
13065				firstDataType = type;
13066			}
13067		}
13068
13069		// Or just use first one
13070		finalDataType = finalDataType || firstDataType;
13071	}
13072
13073	// If we found a dataType
13074	// We add the dataType to the list if needed
13075	// and return the corresponding response
13076	if ( finalDataType ) {
13077		if ( finalDataType !== dataTypes[ 0 ] ) {
13078			dataTypes.unshift( finalDataType );
13079		}
13080		return responses[ finalDataType ];
13081	}
13082}
13083
13084/* Chain conversions given the request and the original response
13085 * Also sets the responseXXX fields on the jqXHR instance
13086 */
13087function ajaxConvert( s, response, jqXHR, isSuccess ) {
13088	var conv2, current, conv, tmp, prev,
13089		converters = {},
13090
13091		// Work with a copy of dataTypes in case we need to modify it for conversion
13092		dataTypes = s.dataTypes.slice();
13093
13094	// Create converters map with lowercased keys
13095	if ( dataTypes[ 1 ] ) {
13096		for ( conv in s.converters ) {
13097			converters[ conv.toLowerCase() ] = s.converters[ conv ];
13098		}
13099	}
13100
13101	current = dataTypes.shift();
13102
13103	// Convert to each sequential dataType
13104	while ( current ) {
13105
13106		if ( s.responseFields[ current ] ) {
13107			jqXHR[ s.responseFields[ current ] ] = response;
13108		}
13109
13110		// Apply the dataFilter if provided
13111		if ( !prev && isSuccess && s.dataFilter ) {
13112			response = s.dataFilter( response, s.dataType );
13113		}
13114
13115		prev = current;
13116		current = dataTypes.shift();
13117
13118		if ( current ) {
13119
13120			// There's only work to do if current dataType is non-auto
13121			if ( current === "*" ) {
13122
13123				current = prev;
13124
13125			// Convert response if prev dataType is non-auto and differs from current
13126			} else if ( prev !== "*" && prev !== current ) {
13127
13128				// Seek a direct converter
13129				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
13130
13131				// If none found, seek a pair
13132				if ( !conv ) {
13133					for ( conv2 in converters ) {
13134
13135						// If conv2 outputs current
13136						tmp = conv2.split( " " );
13137						if ( tmp[ 1 ] === current ) {
13138
13139							// If prev can be converted to accepted input
13140							conv = converters[ prev + " " + tmp[ 0 ] ] ||
13141								converters[ "* " + tmp[ 0 ] ];
13142							if ( conv ) {
13143
13144								// Condense equivalence converters
13145								if ( conv === true ) {
13146									conv = converters[ conv2 ];
13147
13148								// Otherwise, insert the intermediate dataType
13149								} else if ( converters[ conv2 ] !== true ) {
13150									current = tmp[ 0 ];
13151									dataTypes.unshift( tmp[ 1 ] );
13152								}
13153								break;
13154							}
13155						}
13156					}
13157				}
13158
13159				// Apply converter (if not an equivalence)
13160				if ( conv !== true ) {
13161
13162					// Unless errors are allowed to bubble, catch and return them
13163					if ( conv && s.throws ) {
13164						response = conv( response );
13165					} else {
13166						try {
13167							response = conv( response );
13168						} catch ( e ) {
13169							return {
13170								state: "parsererror",
13171								error: conv ? e : "No conversion from " + prev + " to " + current
13172							};
13173						}
13174					}
13175				}
13176			}
13177		}
13178	}
13179
13180	return { state: "success", data: response };
13181}
13182
13183jQuery.extend( {
13184
13185	// Counter for holding the number of active queries
13186	active: 0,
13187
13188	// Last-Modified header cache for next request
13189	lastModified: {},
13190	etag: {},
13191
13192	ajaxSettings: {
13193		url: location.href,
13194		type: "GET",
13195		isLocal: rlocalProtocol.test( location.protocol ),
13196		global: true,
13197		processData: true,
13198		async: true,
13199		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
13200
13201		/*
13202		timeout: 0,
13203		data: null,
13204		dataType: null,
13205		username: null,
13206		password: null,
13207		cache: null,
13208		throws: false,
13209		traditional: false,
13210		headers: {},
13211		*/
13212
13213		accepts: {
13214			"*": allTypes,
13215			text: "text/plain",
13216			html: "text/html",
13217			xml: "application/xml, text/xml",
13218			json: "application/json, text/javascript"
13219		},
13220
13221		contents: {
13222			xml: /\bxml\b/,
13223			html: /\bhtml/,
13224			json: /\bjson\b/
13225		},
13226
13227		responseFields: {
13228			xml: "responseXML",
13229			text: "responseText",
13230			json: "responseJSON"
13231		},
13232
13233		// Data converters
13234		// Keys separate source (or catchall "*") and destination types with a single space
13235		converters: {
13236
13237			// Convert anything to text
13238			"* text": String,
13239
13240			// Text to html (true = no transformation)
13241			"text html": true,
13242
13243			// Evaluate text as a json expression
13244			"text json": JSON.parse,
13245
13246			// Parse text as xml
13247			"text xml": jQuery.parseXML
13248		},
13249
13250		// For options that shouldn't be deep extended:
13251		// you can add your own custom options here if
13252		// and when you create one that shouldn't be
13253		// deep extended (see ajaxExtend)
13254		flatOptions: {
13255			url: true,
13256			context: true
13257		}
13258	},
13259
13260	// Creates a full fledged settings object into target
13261	// with both ajaxSettings and settings fields.
13262	// If target is omitted, writes into ajaxSettings.
13263	ajaxSetup: function( target, settings ) {
13264		return settings ?
13265
13266			// Building a settings object
13267			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
13268
13269			// Extending ajaxSettings
13270			ajaxExtend( jQuery.ajaxSettings, target );
13271	},
13272
13273	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
13274	ajaxTransport: addToPrefiltersOrTransports( transports ),
13275
13276	// Main method
13277	ajax: function( url, options ) {
13278
13279		// If url is an object, simulate pre-1.5 signature
13280		if ( typeof url === "object" ) {
13281			options = url;
13282			url = undefined;
13283		}
13284
13285		// Force options to be an object
13286		options = options || {};
13287
13288		var transport,
13289
13290			// URL without anti-cache param
13291			cacheURL,
13292
13293			// Response headers
13294			responseHeadersString,
13295			responseHeaders,
13296
13297			// timeout handle
13298			timeoutTimer,
13299
13300			// Url cleanup var
13301			urlAnchor,
13302
13303			// Request state (becomes false upon send and true upon completion)
13304			completed,
13305
13306			// To know if global events are to be dispatched
13307			fireGlobals,
13308
13309			// Loop variable
13310			i,
13311
13312			// uncached part of the url
13313			uncached,
13314
13315			// Create the final options object
13316			s = jQuery.ajaxSetup( {}, options ),
13317
13318			// Callbacks context
13319			callbackContext = s.context || s,
13320
13321			// Context for global events is callbackContext if it is a DOM node or jQuery collection
13322			globalEventContext = s.context &&
13323				( callbackContext.nodeType || callbackContext.jquery ) ?
13324					jQuery( callbackContext ) :
13325					jQuery.event,
13326
13327			// Deferreds
13328			deferred = jQuery.Deferred(),
13329			completeDeferred = jQuery.Callbacks( "once memory" ),
13330
13331			// Status-dependent callbacks
13332			statusCode = s.statusCode || {},
13333
13334			// Headers (they are sent all at once)
13335			requestHeaders = {},
13336			requestHeadersNames = {},
13337
13338			// Default abort message
13339			strAbort = "canceled",
13340
13341			// Fake xhr
13342			jqXHR = {
13343				readyState: 0,
13344
13345				// Builds headers hashtable if needed
13346				getResponseHeader: function( key ) {
13347					var match;
13348					if ( completed ) {
13349						if ( !responseHeaders ) {
13350							responseHeaders = {};
13351							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
13352								responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
13353							}
13354						}
13355						match = responseHeaders[ key.toLowerCase() ];
13356					}
13357					return match == null ? null : match;
13358				},
13359
13360				// Raw string
13361				getAllResponseHeaders: function() {
13362					return completed ? responseHeadersString : null;
13363				},
13364
13365				// Caches the header
13366				setRequestHeader: function( name, value ) {
13367					if ( completed == null ) {
13368						name = requestHeadersNames[ name.toLowerCase() ] =
13369							requestHeadersNames[ name.toLowerCase() ] || name;
13370						requestHeaders[ name ] = value;
13371					}
13372					return this;
13373				},
13374
13375				// Overrides response content-type header
13376				overrideMimeType: function( type ) {
13377					if ( completed == null ) {
13378						s.mimeType = type;
13379					}
13380					return this;
13381				},
13382
13383				// Status-dependent callbacks
13384				statusCode: function( map ) {
13385					var code;
13386					if ( map ) {
13387						if ( completed ) {
13388
13389							// Execute the appropriate callbacks
13390							jqXHR.always( map[ jqXHR.status ] );
13391						} else {
13392
13393							// Lazy-add the new callbacks in a way that preserves old ones
13394							for ( code in map ) {
13395								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
13396							}
13397						}
13398					}
13399					return this;
13400				},
13401
13402				// Cancel the request
13403				abort: function( statusText ) {
13404					var finalText = statusText || strAbort;
13405					if ( transport ) {
13406						transport.abort( finalText );
13407					}
13408					done( 0, finalText );
13409					return this;
13410				}
13411			};
13412
13413		// Attach deferreds
13414		deferred.promise( jqXHR );
13415
13416		// Add protocol if not provided (prefilters might expect it)
13417		// Handle falsy url in the settings object (#10093: consistency with old signature)
13418		// We also use the url parameter if available
13419		s.url = ( ( url || s.url || location.href ) + "" )
13420			.replace( rprotocol, location.protocol + "//" );
13421
13422		// Alias method option to type as per ticket #12004
13423		s.type = options.method || options.type || s.method || s.type;
13424
13425		// Extract dataTypes list
13426		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
13427
13428		// A cross-domain request is in order when the origin doesn't match the current origin.
13429		if ( s.crossDomain == null ) {
13430			urlAnchor = document.createElement( "a" );
13431
13432			// Support: IE <=8 - 11, Edge 12 - 15
13433			// IE throws exception on accessing the href property if url is malformed,
13434			// e.g. http://example.com:80x/
13435			try {
13436				urlAnchor.href = s.url;
13437
13438				// Support: IE <=8 - 11 only
13439				// Anchor's host property isn't correctly set when s.url is relative
13440				urlAnchor.href = urlAnchor.href;
13441				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
13442					urlAnchor.protocol + "//" + urlAnchor.host;
13443			} catch ( e ) {
13444
13445				// If there is an error parsing the URL, assume it is crossDomain,
13446				// it can be rejected by the transport if it is invalid
13447				s.crossDomain = true;
13448			}
13449		}
13450
13451		// Convert data if not already a string
13452		if ( s.data && s.processData && typeof s.data !== "string" ) {
13453			s.data = jQuery.param( s.data, s.traditional );
13454		}
13455
13456		// Apply prefilters
13457		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
13458
13459		// If request was aborted inside a prefilter, stop there
13460		if ( completed ) {
13461			return jqXHR;
13462		}
13463
13464		// We can fire global events as of now if asked to
13465		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
13466		fireGlobals = jQuery.event && s.global;
13467
13468		// Watch for a new set of requests
13469		if ( fireGlobals && jQuery.active++ === 0 ) {
13470			jQuery.event.trigger( "ajaxStart" );
13471		}
13472
13473		// Uppercase the type
13474		s.type = s.type.toUpperCase();
13475
13476		// Determine if request has content
13477		s.hasContent = !rnoContent.test( s.type );
13478
13479		// Save the URL in case we're toying with the If-Modified-Since
13480		// and/or If-None-Match header later on
13481		// Remove hash to simplify url manipulation
13482		cacheURL = s.url.replace( rhash, "" );
13483
13484		// More options handling for requests with no content
13485		if ( !s.hasContent ) {
13486
13487			// Remember the hash so we can put it back
13488			uncached = s.url.slice( cacheURL.length );
13489
13490			// If data is available and should be processed, append data to url
13491			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
13492				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
13493
13494				// #9682: remove data so that it's not used in an eventual retry
13495				delete s.data;
13496			}
13497
13498			// Add or update anti-cache param if needed
13499			if ( s.cache === false ) {
13500				cacheURL = cacheURL.replace( rantiCache, "$1" );
13501				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
13502			}
13503
13504			// Put hash and anti-cache on the URL that will be requested (gh-1732)
13505			s.url = cacheURL + uncached;
13506
13507		// Change '%20' to '+' if this is encoded form body content (gh-2658)
13508		} else if ( s.data && s.processData &&
13509			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
13510			s.data = s.data.replace( r20, "+" );
13511		}
13512
13513		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
13514		if ( s.ifModified ) {
13515			if ( jQuery.lastModified[ cacheURL ] ) {
13516				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
13517			}
13518			if ( jQuery.etag[ cacheURL ] ) {
13519				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
13520			}
13521		}
13522
13523		// Set the correct header, if data is being sent
13524		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
13525			jqXHR.setRequestHeader( "Content-Type", s.contentType );
13526		}
13527
13528		// Set the Accepts header for the server, depending on the dataType
13529		jqXHR.setRequestHeader(
13530			"Accept",
13531			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
13532				s.accepts[ s.dataTypes[ 0 ] ] +
13533					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
13534				s.accepts[ "*" ]
13535		);
13536
13537		// Check for headers option
13538		for ( i in s.headers ) {
13539			jqXHR.setRequestHeader( i, s.headers[ i ] );
13540		}
13541
13542		// Allow custom headers/mimetypes and early abort
13543		if ( s.beforeSend &&
13544			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
13545
13546			// Abort if not done already and return
13547			return jqXHR.abort();
13548		}
13549
13550		// Aborting is no longer a cancellation
13551		strAbort = "abort";
13552
13553		// Install callbacks on deferreds
13554		completeDeferred.add( s.complete );
13555		jqXHR.done( s.success );
13556		jqXHR.fail( s.error );
13557
13558		// Get transport
13559		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
13560
13561		// If no transport, we auto-abort
13562		if ( !transport ) {
13563			done( -1, "No Transport" );
13564		} else {
13565			jqXHR.readyState = 1;
13566
13567			// Send global event
13568			if ( fireGlobals ) {
13569				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
13570			}
13571
13572			// If request was aborted inside ajaxSend, stop there
13573			if ( completed ) {
13574				return jqXHR;
13575			}
13576
13577			// Timeout
13578			if ( s.async && s.timeout > 0 ) {
13579				timeoutTimer = window.setTimeout( function() {
13580					jqXHR.abort( "timeout" );
13581				}, s.timeout );
13582			}
13583
13584			try {
13585				completed = false;
13586				transport.send( requestHeaders, done );
13587			} catch ( e ) {
13588
13589				// Rethrow post-completion exceptions
13590				if ( completed ) {
13591					throw e;
13592				}
13593
13594				// Propagate others as results
13595				done( -1, e );
13596			}
13597		}
13598
13599		// Callback for when everything is done
13600		function done( status, nativeStatusText, responses, headers ) {
13601			var isSuccess, success, error, response, modified,
13602				statusText = nativeStatusText;
13603
13604			// Ignore repeat invocations
13605			if ( completed ) {
13606				return;
13607			}
13608
13609			completed = true;
13610
13611			// Clear timeout if it exists
13612			if ( timeoutTimer ) {
13613				window.clearTimeout( timeoutTimer );
13614			}
13615
13616			// Dereference transport for early garbage collection
13617			// (no matter how long the jqXHR object will be used)
13618			transport = undefined;
13619
13620			// Cache response headers
13621			responseHeadersString = headers || "";
13622
13623			// Set readyState
13624			jqXHR.readyState = status > 0 ? 4 : 0;
13625
13626			// Determine if successful
13627			isSuccess = status >= 200 && status < 300 || status === 304;
13628
13629			// Get response data
13630			if ( responses ) {
13631				response = ajaxHandleResponses( s, jqXHR, responses );
13632			}
13633
13634			// Convert no matter what (that way responseXXX fields are always set)
13635			response = ajaxConvert( s, response, jqXHR, isSuccess );
13636
13637			// If successful, handle type chaining
13638			if ( isSuccess ) {
13639
13640				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
13641				if ( s.ifModified ) {
13642					modified = jqXHR.getResponseHeader( "Last-Modified" );
13643					if ( modified ) {
13644						jQuery.lastModified[ cacheURL ] = modified;
13645					}
13646					modified = jqXHR.getResponseHeader( "etag" );
13647					if ( modified ) {
13648						jQuery.etag[ cacheURL ] = modified;
13649					}
13650				}
13651
13652				// if no content
13653				if ( status === 204 || s.type === "HEAD" ) {
13654					statusText = "nocontent";
13655
13656				// if not modified
13657				} else if ( status === 304 ) {
13658					statusText = "notmodified";
13659
13660				// If we have data, let's convert it
13661				} else {
13662					statusText = response.state;
13663					success = response.data;
13664					error = response.error;
13665					isSuccess = !error;
13666				}
13667			} else {
13668
13669				// Extract error from statusText and normalize for non-aborts
13670				error = statusText;
13671				if ( status || !statusText ) {
13672					statusText = "error";
13673					if ( status < 0 ) {
13674						status = 0;
13675					}
13676				}
13677			}
13678
13679			// Set data for the fake xhr object
13680			jqXHR.status = status;
13681			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
13682
13683			// Success/Error
13684			if ( isSuccess ) {
13685				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
13686			} else {
13687				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
13688			}
13689
13690			// Status-dependent callbacks
13691			jqXHR.statusCode( statusCode );
13692			statusCode = undefined;
13693
13694			if ( fireGlobals ) {
13695				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
13696					[ jqXHR, s, isSuccess ? success : error ] );
13697			}
13698
13699			// Complete
13700			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
13701
13702			if ( fireGlobals ) {
13703				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
13704
13705				// Handle the global AJAX counter
13706				if ( !( --jQuery.active ) ) {
13707					jQuery.event.trigger( "ajaxStop" );
13708				}
13709			}
13710		}
13711
13712		return jqXHR;
13713	},
13714
13715	getJSON: function( url, data, callback ) {
13716		return jQuery.get( url, data, callback, "json" );
13717	},
13718
13719	getScript: function( url, callback ) {
13720		return jQuery.get( url, undefined, callback, "script" );
13721	}
13722} );
13723
13724jQuery.each( [ "get", "post" ], function( i, method ) {
13725	jQuery[ method ] = function( url, data, callback, type ) {
13726
13727		// Shift arguments if data argument was omitted
13728		if ( isFunction( data ) ) {
13729			type = type || callback;
13730			callback = data;
13731			data = undefined;
13732		}
13733
13734		// The url can be an options object (which then must have .url)
13735		return jQuery.ajax( jQuery.extend( {
13736			url: url,
13737			type: method,
13738			dataType: type,
13739			data: data,
13740			success: callback
13741		}, jQuery.isPlainObject( url ) && url ) );
13742	};
13743} );
13744
13745
13746jQuery._evalUrl = function( url ) {
13747	return jQuery.ajax( {
13748		url: url,
13749
13750		// Make this explicit, since user can override this through ajaxSetup (#11264)
13751		type: "GET",
13752		dataType: "script",
13753		cache: true,
13754		async: false,
13755		global: false,
13756		"throws": true
13757	} );
13758};
13759
13760
13761jQuery.fn.extend( {
13762	wrapAll: function( html ) {
13763		var wrap;
13764
13765		if ( this[ 0 ] ) {
13766			if ( isFunction( html ) ) {
13767				html = html.call( this[ 0 ] );
13768			}
13769
13770			// The elements to wrap the target around
13771			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
13772
13773			if ( this[ 0 ].parentNode ) {
13774				wrap.insertBefore( this[ 0 ] );
13775			}
13776
13777			wrap.map( function() {
13778				var elem = this;
13779
13780				while ( elem.firstElementChild ) {
13781					elem = elem.firstElementChild;
13782				}
13783
13784				return elem;
13785			} ).append( this );
13786		}
13787
13788		return this;
13789	},
13790
13791	wrapInner: function( html ) {
13792		if ( isFunction( html ) ) {
13793			return this.each( function( i ) {
13794				jQuery( this ).wrapInner( html.call( this, i ) );
13795			} );
13796		}
13797
13798		return this.each( function() {
13799			var self = jQuery( this ),
13800				contents = self.contents();
13801
13802			if ( contents.length ) {
13803				contents.wrapAll( html );
13804
13805			} else {
13806				self.append( html );
13807			}
13808		} );
13809	},
13810
13811	wrap: function( html ) {
13812		var htmlIsFunction = isFunction( html );
13813
13814		return this.each( function( i ) {
13815			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
13816		} );
13817	},
13818
13819	unwrap: function( selector ) {
13820		this.parent( selector ).not( "body" ).each( function() {
13821			jQuery( this ).replaceWith( this.childNodes );
13822		} );
13823		return this;
13824	}
13825} );
13826
13827
13828jQuery.expr.pseudos.hidden = function( elem ) {
13829	return !jQuery.expr.pseudos.visible( elem );
13830};
13831jQuery.expr.pseudos.visible = function( elem ) {
13832	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
13833};
13834
13835
13836
13837
13838jQuery.ajaxSettings.xhr = function() {
13839	try {
13840		return new window.XMLHttpRequest();
13841	} catch ( e ) {}
13842};
13843
13844var xhrSuccessStatus = {
13845
13846		// File protocol always yields status code 0, assume 200
13847		0: 200,
13848
vendor: 1,240 bytes, lines 13849-13891
13849		// Support: IE <=9 only
13850		// #1450: sometimes IE returns 1223 when it should be 204
13851		1223: 204
13852	},
13853	xhrSupported = jQuery.ajaxSettings.xhr();
13854
13855support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
13856support.ajax = xhrSupported = !!xhrSupported;
13857
13858jQuery.ajaxTransport( function( options ) {
13859	var callback, errorCallback;
13860
13861	// Cross domain only allowed if supported through XMLHttpRequest
13862	if ( support.cors || xhrSupported && !options.crossDomain ) {
13863		return {
13864			send: function( headers, complete ) {
13865				var i,
13866					xhr = options.xhr();
13867
13868				xhr.open(
13869					options.type,
13870					options.url,
13871					options.async,
13872					options.username,
13873					options.password
13874				);
13875
13876				// Apply custom fields if provided
13877				if ( options.xhrFields ) {
13878					for ( i in options.xhrFields ) {
13879						xhr[ i ] = options.xhrFields[ i ];
13880					}
13881				}
13882
13883				// Override mime type if needed
13884				if ( options.mimeType && xhr.overrideMimeType ) {
13885					xhr.overrideMimeType( options.mimeType );
13886				}
13887
13888				// X-Requested-With header
13889				// For cross-domain requests, seeing as conditions for a preflight are
13890				// akin to a jigsaw puzzle, we simply never set it to be sure.
13891				// (it can always be set on a per-request basis or even using ajaxSetup)
vendor: 5,627 bytes, lines 13892-14113
13892				// For same-domain requests, won't change header if already provided.
13893				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
13894					headers[ "X-Requested-With" ] = "XMLHttpRequest";
13895				}
13896
13897				// Set headers
13898				for ( i in headers ) {
13899					xhr.setRequestHeader( i, headers[ i ] );
13900				}
13901
13902				// Callback
13903				callback = function( type ) {
13904					return function() {
13905						if ( callback ) {
13906							callback = errorCallback = xhr.onload =
13907								xhr.onerror = xhr.onabort = xhr.ontimeout =
13908									xhr.onreadystatechange = null;
13909
13910							if ( type === "abort" ) {
13911								xhr.abort();
13912							} else if ( type === "error" ) {
13913
13914								// Support: IE <=9 only
13915								// On a manual native abort, IE9 throws
13916								// errors on any property access that is not readyState
13917								if ( typeof xhr.status !== "number" ) {
13918									complete( 0, "error" );
13919								} else {
13920									complete(
13921
13922										// File: protocol always yields status 0; see #8605, #14207
13923										xhr.status,
13924										xhr.statusText
13925									);
13926								}
13927							} else {
13928								complete(
13929									xhrSuccessStatus[ xhr.status ] || xhr.status,
13930									xhr.statusText,
13931
13932									// Support: IE <=9 only
13933									// IE9 has no XHR2 but throws on binary (trac-11426)
13934									// For XHR2 non-text, let the caller handle it (gh-2498)
13935									( xhr.responseType || "text" ) !== "text"  ||
13936									typeof xhr.responseText !== "string" ?
13937										{ binary: xhr.response } :
13938										{ text: xhr.responseText },
13939									xhr.getAllResponseHeaders()
13940								);
13941							}
13942						}
13943					};
13944				};
13945
13946				// Listen to events
13947				xhr.onload = callback();
13948				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
13949
13950				// Support: IE 9 only
13951				// Use onreadystatechange to replace onabort
13952				// to handle uncaught aborts
13953				if ( xhr.onabort !== undefined ) {
13954					xhr.onabort = errorCallback;
13955				} else {
13956					xhr.onreadystatechange = function() {
13957
13958						// Check readyState before timeout as it changes
13959						if ( xhr.readyState === 4 ) {
13960
13961							// Allow onerror to be called first,
13962							// but that will not handle a native abort
13963							// Also, save errorCallback to a variable
13964							// as xhr.onerror cannot be accessed
13965							window.setTimeout( function() {
13966								if ( callback ) {
13967									errorCallback();
13968								}
13969							} );
13970						}
13971					};
13972				}
13973
13974				// Create the abort callback
13975				callback = callback( "abort" );
13976
13977				try {
13978
13979					// Do send the request (this may raise an exception)
13980					xhr.send( options.hasContent && options.data || null );
13981				} catch ( e ) {
13982
13983					// #14683: Only rethrow if this hasn't been notified as an error yet
13984					if ( callback ) {
13985						throw e;
13986					}
13987				}
13988			},
13989
13990			abort: function() {
13991				if ( callback ) {
13992					callback();
13993				}
13994			}
13995		};
13996	}
13997} );
13998
13999
14000
14001
14002// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
14003jQuery.ajaxPrefilter( function( s ) {
14004	if ( s.crossDomain ) {
14005		s.contents.script = false;
14006	}
14007} );
14008
14009// Install script dataType
14010jQuery.ajaxSetup( {
14011	accepts: {
14012		script: "text/javascript, application/javascript, " +
14013			"application/ecmascript, application/x-ecmascript"
14014	},
14015	contents: {
14016		script: /\b(?:java|ecma)script\b/
14017	},
14018	converters: {
14019		"text script": function( text ) {
14020			jQuery.globalEval( text );
14021			return text;
14022		}
14023	}
14024} );
14025
14026// Handle cache's special case and crossDomain
14027jQuery.ajaxPrefilter( "script", function( s ) {
14028	if ( s.cache === undefined ) {
14029		s.cache = false;
14030	}
14031	if ( s.crossDomain ) {
14032		s.type = "GET";
14033	}
14034} );
14035
14036// Bind script tag hack transport
14037jQuery.ajaxTransport( "script", function( s ) {
14038
14039	// This transport only deals with cross domain requests
14040	if ( s.crossDomain ) {
14041		var script, callback;
14042		return {
14043			send: function( _, complete ) {
14044				script = jQuery( "<script>" ).prop( {
14045					charset: s.scriptCharset,
14046					src: s.url
14047				} ).on(
14048					"load error",
14049					callback = function( evt ) {
14050						script.remove();
14051						callback = null;
14052						if ( evt ) {
14053							complete( evt.type === "error" ? 404 : 200, evt.type );
14054						}
14055					}
14056				);
14057
14058				// Use native DOM manipulation to avoid our domManip AJAX trickery
14059				document.head.appendChild( script[ 0 ] );
14060			},
14061			abort: function() {
14062				if ( callback ) {
14063					callback();
14064				}
14065			}
14066		};
14067	}
14068} );
14069
14070
14071
14072
14073var oldCallbacks = [],
14074	rjsonp = /(=)\?(?=&|$)|\?\?/;
14075
14076// Default jsonp settings
14077jQuery.ajaxSetup( {
14078	jsonp: "callback",
14079	jsonpCallback: function() {
14080		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
14081		this[ callback ] = true;
14082		return callback;
14083	}
14084} );
14085
14086// Detect, normalize options and install callbacks for jsonp requests
14087jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
14088
14089	var callbackName, overwritten, responseContainer,
14090		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
14091			"url" :
14092			typeof s.data === "string" &&
14093				( s.contentType || "" )
14094					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
14095				rjsonp.test( s.data ) && "data"
14096		);
14097
14098	// Handle iff the expected data type is "jsonp" or we have a parameter to set
14099	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
14100
14101		// Get callback name, remembering preexisting value associated with it
14102		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
14103			s.jsonpCallback() :
14104			s.jsonpCallback;
14105
14106		// Insert callback into url or form data
14107		if ( jsonProp ) {
14108			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
14109		} else if ( s.jsonp !== false ) {
14110			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
14111		}
14112
14113		// Use data converter to retrieve json after script execution
vendor: 2,987 bytes, lines 14114-14223
14114		s.converters[ "script json" ] = function() {
14115			if ( !responseContainer ) {
14116				jQuery.error( callbackName + " was not called" );
14117			}
14118			return responseContainer[ 0 ];
14119		};
14120
14121		// Force json dataType
14122		s.dataTypes[ 0 ] = "json";
14123
14124		// Install callback
14125		overwritten = window[ callbackName ];
14126		window[ callbackName ] = function() {
14127			responseContainer = arguments;
14128		};
14129
14130		// Clean-up function (fires after converters)
14131		jqXHR.always( function() {
14132
14133			// If previous value didn't exist - remove it
14134			if ( overwritten === undefined ) {
14135				jQuery( window ).removeProp( callbackName );
14136
14137			// Otherwise restore preexisting value
14138			} else {
14139				window[ callbackName ] = overwritten;
14140			}
14141
14142			// Save back as free
14143			if ( s[ callbackName ] ) {
14144
14145				// Make sure that re-using the options doesn't screw things around
14146				s.jsonpCallback = originalSettings.jsonpCallback;
14147
14148				// Save the callback name for future use
14149				oldCallbacks.push( callbackName );
14150			}
14151
14152			// Call if it was a function and we have a response
14153			if ( responseContainer && isFunction( overwritten ) ) {
14154				overwritten( responseContainer[ 0 ] );
14155			}
14156
14157			responseContainer = overwritten = undefined;
14158		} );
14159
14160		// Delegate to script
14161		return "script";
14162	}
14163} );
14164
14165
14166
14167
14168// Support: Safari 8 only
14169// In Safari 8 documents created via document.implementation.createHTMLDocument
14170// collapse sibling forms: the second one becomes a child of the first one.
14171// Because of that, this security measure has to be disabled in Safari 8.
14172// https://bugs.webkit.org/show_bug.cgi?id=137337
14173support.createHTMLDocument = ( function() {
14174	var body = document.implementation.createHTMLDocument( "" ).body;
14175	body.innerHTML = "<form></form><form></form>";
14176	return body.childNodes.length === 2;
14177} )();
14178
14179
14180// Argument "data" should be string of html
14181// context (optional): If specified, the fragment will be created in this context,
14182// defaults to document
14183// keepScripts (optional): If true, will include scripts passed in the html string
14184jQuery.parseHTML = function( data, context, keepScripts ) {
14185	if ( typeof data !== "string" ) {
14186		return [];
14187	}
14188	if ( typeof context === "boolean" ) {
14189		keepScripts = context;
14190		context = false;
14191	}
14192
14193	var base, parsed, scripts;
14194
14195	if ( !context ) {
14196
14197		// Stop scripts or inline event handlers from being executed immediately
14198		// by using document.implementation
14199		if ( support.createHTMLDocument ) {
14200			context = document.implementation.createHTMLDocument( "" );
14201
14202			// Set the base href for the created document
14203			// so any parsed elements with URLs
14204			// are based on the document's URL (gh-2965)
14205			base = context.createElement( "base" );
14206			base.href = document.location.href;
14207			context.head.appendChild( base );
14208		} else {
14209			context = document;
14210		}
14211	}
14212
14213	parsed = rsingleTag.exec( data );
14214	scripts = !keepScripts && [];
14215
14216	// Single tag
14217	if ( parsed ) {
14218		return [ context.createElement( parsed[ 1 ] ) ];
14219	}
14220
14221	parsed = buildFragment( [ data ], context, scripts );
14222
14223	if ( scripts && scripts.length ) {
vendor: 14,511 bytes, lines 14224-14744
14224		jQuery( scripts ).remove();
14225	}
14226
14227	return jQuery.merge( [], parsed.childNodes );
14228};
14229
14230
14231/**
14232 * Load a url into a page
14233 */
14234jQuery.fn.load = function( url, params, callback ) {
14235	var selector, type, response,
14236		self = this,
14237		off = url.indexOf( " " );
14238
14239	if ( off > -1 ) {
14240		selector = stripAndCollapse( url.slice( off ) );
14241		url = url.slice( 0, off );
14242	}
14243
14244	// If it's a function
14245	if ( isFunction( params ) ) {
14246
14247		// We assume that it's the callback
14248		callback = params;
14249		params = undefined;
14250
14251	// Otherwise, build a param string
14252	} else if ( params && typeof params === "object" ) {
14253		type = "POST";
14254	}
14255
14256	// If we have elements to modify, make the request
14257	if ( self.length > 0 ) {
14258		jQuery.ajax( {
14259			url: url,
14260
14261			// If "type" variable is undefined, then "GET" method will be used.
14262			// Make value of this field explicit since
14263			// user can override it through ajaxSetup method
14264			type: type || "GET",
14265			dataType: "html",
14266			data: params
14267		} ).done( function( responseText ) {
14268
14269			// Save response for use in complete callback
14270			response = arguments;
14271
14272			self.html( selector ?
14273
14274				// If a selector was specified, locate the right elements in a dummy div
14275				// Exclude scripts to avoid IE 'Permission Denied' errors
14276				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
14277
14278				// Otherwise use the full result
14279				responseText );
14280
14281		// If the request succeeds, this function gets "data", "status", "jqXHR"
14282		// but they are ignored because response was set above.
14283		// If it fails, this function gets "jqXHR", "status", "error"
14284		} ).always( callback && function( jqXHR, status ) {
14285			self.each( function() {
14286				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
14287			} );
14288		} );
14289	}
14290
14291	return this;
14292};
14293
14294
14295
14296
14297// Attach a bunch of functions for handling common AJAX events
14298jQuery.each( [
14299	"ajaxStart",
14300	"ajaxStop",
14301	"ajaxComplete",
14302	"ajaxError",
14303	"ajaxSuccess",
14304	"ajaxSend"
14305], function( i, type ) {
14306	jQuery.fn[ type ] = function( fn ) {
14307		return this.on( type, fn );
14308	};
14309} );
14310
14311
14312
14313
14314jQuery.expr.pseudos.animated = function( elem ) {
14315	return jQuery.grep( jQuery.timers, function( fn ) {
14316		return elem === fn.elem;
14317	} ).length;
14318};
14319
14320
14321
14322
14323jQuery.offset = {
14324	setOffset: function( elem, options, i ) {
14325		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
14326			position = jQuery.css( elem, "position" ),
14327			curElem = jQuery( elem ),
14328			props = {};
14329
14330		// Set position first, in-case top/left are set even on static elem
14331		if ( position === "static" ) {
14332			elem.style.position = "relative";
14333		}
14334
14335		curOffset = curElem.offset();
14336		curCSSTop = jQuery.css( elem, "top" );
14337		curCSSLeft = jQuery.css( elem, "left" );
14338		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
14339			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
14340
14341		// Need to be able to calculate position if either
14342		// top or left is auto and position is either absolute or fixed
14343		if ( calculatePosition ) {
14344			curPosition = curElem.position();
14345			curTop = curPosition.top;
14346			curLeft = curPosition.left;
14347
14348		} else {
14349			curTop = parseFloat( curCSSTop ) || 0;
14350			curLeft = parseFloat( curCSSLeft ) || 0;
14351		}
14352
14353		if ( isFunction( options ) ) {
14354
14355			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
14356			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
14357		}
14358
14359		if ( options.top != null ) {
14360			props.top = ( options.top - curOffset.top ) + curTop;
14361		}
14362		if ( options.left != null ) {
14363			props.left = ( options.left - curOffset.left ) + curLeft;
14364		}
14365
14366		if ( "using" in options ) {
14367			options.using.call( elem, props );
14368
14369		} else {
14370			curElem.css( props );
14371		}
14372	}
14373};
14374
14375jQuery.fn.extend( {
14376
14377	// offset() relates an element's border box to the document origin
14378	offset: function( options ) {
14379
14380		// Preserve chaining for setter
14381		if ( arguments.length ) {
14382			return options === undefined ?
14383				this :
14384				this.each( function( i ) {
14385					jQuery.offset.setOffset( this, options, i );
14386				} );
14387		}
14388
14389		var rect, win,
14390			elem = this[ 0 ];
14391
14392		if ( !elem ) {
14393			return;
14394		}
14395
14396		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
14397		// Support: IE <=11 only
14398		// Running getBoundingClientRect on a
14399		// disconnected node in IE throws an error
14400		if ( !elem.getClientRects().length ) {
14401			return { top: 0, left: 0 };
14402		}
14403
14404		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
14405		rect = elem.getBoundingClientRect();
14406		win = elem.ownerDocument.defaultView;
14407		return {
14408			top: rect.top + win.pageYOffset,
14409			left: rect.left + win.pageXOffset
14410		};
14411	},
14412
14413	// position() relates an element's margin box to its offset parent's padding box
14414	// This corresponds to the behavior of CSS absolute positioning
14415	position: function() {
14416		if ( !this[ 0 ] ) {
14417			return;
14418		}
14419
14420		var offsetParent, offset, doc,
14421			elem = this[ 0 ],
14422			parentOffset = { top: 0, left: 0 };
14423
14424		// position:fixed elements are offset from the viewport, which itself always has zero offset
14425		if ( jQuery.css( elem, "position" ) === "fixed" ) {
14426
14427			// Assume position:fixed implies availability of getBoundingClientRect
14428			offset = elem.getBoundingClientRect();
14429
14430		} else {
14431			offset = this.offset();
14432
14433			// Account for the *real* offset parent, which can be the document or its root element
14434			// when a statically positioned element is identified
14435			doc = elem.ownerDocument;
14436			offsetParent = elem.offsetParent || doc.documentElement;
14437			while ( offsetParent &&
14438				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
14439				jQuery.css( offsetParent, "position" ) === "static" ) {
14440
14441				offsetParent = offsetParent.parentNode;
14442			}
14443			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
14444
14445				// Incorporate borders into its offset, since they are outside its content origin
14446				parentOffset = jQuery( offsetParent ).offset();
14447				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
14448				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
14449			}
14450		}
14451
14452		// Subtract parent offsets and element margins
14453		return {
14454			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
14455			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
14456		};
14457	},
14458
14459	// This method will return documentElement in the following cases:
14460	// 1) For the element inside the iframe without offsetParent, this method will return
14461	//    documentElement of the parent window
14462	// 2) For the hidden or detached element
14463	// 3) For body or html element, i.e. in case of the html node - it will return itself
14464	//
14465	// but those exceptions were never presented as a real life use-cases
14466	// and might be considered as more preferable results.
14467	//
14468	// This logic, however, is not guaranteed and can change at any point in the future
14469	offsetParent: function() {
14470		return this.map( function() {
14471			var offsetParent = this.offsetParent;
14472
14473			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
14474				offsetParent = offsetParent.offsetParent;
14475			}
14476
14477			return offsetParent || documentElement;
14478		} );
14479	}
14480} );
14481
14482// Create scrollLeft and scrollTop methods
14483jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
14484	var top = "pageYOffset" === prop;
14485
14486	jQuery.fn[ method ] = function( val ) {
14487		return access( this, function( elem, method, val ) {
14488
14489			// Coalesce documents and windows
14490			var win;
14491			if ( isWindow( elem ) ) {
14492				win = elem;
14493			} else if ( elem.nodeType === 9 ) {
14494				win = elem.defaultView;
14495			}
14496
14497			if ( val === undefined ) {
14498				return win ? win[ prop ] : elem[ method ];
14499			}
14500
14501			if ( win ) {
14502				win.scrollTo(
14503					!top ? val : win.pageXOffset,
14504					top ? val : win.pageYOffset
14505				);
14506
14507			} else {
14508				elem[ method ] = val;
14509			}
14510		}, method, val, arguments.length );
14511	};
14512} );
14513
14514// Support: Safari <=7 - 9.1, Chrome <=37 - 49
14515// Add the top/left cssHooks using jQuery.fn.position
14516// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
14517// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
14518// getComputedStyle returns percent when specified for top/left/bottom/right;
14519// rather than make the css module depend on the offset module, just check for it here
14520jQuery.each( [ "top", "left" ], function( i, prop ) {
14521	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
14522		function( elem, computed ) {
14523			if ( computed ) {
14524				computed = curCSS( elem, prop );
14525
14526				// If curCSS returns percentage, fallback to offset
14527				return rnumnonpx.test( computed ) ?
14528					jQuery( elem ).position()[ prop ] + "px" :
14529					computed;
14530			}
14531		}
14532	);
14533} );
14534
14535
14536// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
14537jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
14538	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
14539		function( defaultExtra, funcName ) {
14540
14541		// Margin is only for outerHeight, outerWidth
14542		jQuery.fn[ funcName ] = function( margin, value ) {
14543			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
14544				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
14545
14546			return access( this, function( elem, type, value ) {
14547				var doc;
14548
14549				if ( isWindow( elem ) ) {
14550
14551					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
14552					return funcName.indexOf( "outer" ) === 0 ?
14553						elem[ "inner" + name ] :
14554						elem.document.documentElement[ "client" + name ];
14555				}
14556
14557				// Get document width or height
14558				if ( elem.nodeType === 9 ) {
14559					doc = elem.documentElement;
14560
14561					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
14562					// whichever is greatest
14563					return Math.max(
14564						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
14565						elem.body[ "offset" + name ], doc[ "offset" + name ],
14566						doc[ "client" + name ]
14567					);
14568				}
14569
14570				return value === undefined ?
14571
14572					// Get width or height on the element, requesting but not forcing parseFloat
14573					jQuery.css( elem, type, extra ) :
14574
14575					// Set width or height on the element
14576					jQuery.style( elem, type, value, extra );
14577			}, type, chainable ? margin : undefined, chainable );
14578		};
14579	} );
14580} );
14581
14582
14583jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
14584	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
14585	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
14586	function( i, name ) {
14587
14588	// Handle event binding
14589	jQuery.fn[ name ] = function( data, fn ) {
14590		return arguments.length > 0 ?
14591			this.on( name, null, data, fn ) :
14592			this.trigger( name );
14593	};
14594} );
14595
14596jQuery.fn.extend( {
14597	hover: function( fnOver, fnOut ) {
14598		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
14599	}
14600} );
14601
14602
14603
14604
14605jQuery.fn.extend( {
14606
14607	bind: function( types, data, fn ) {
14608		return this.on( types, null, data, fn );
14609	},
14610	unbind: function( types, fn ) {
14611		return this.off( types, null, fn );
14612	},
14613
14614	delegate: function( selector, types, data, fn ) {
14615		return this.on( types, selector, data, fn );
14616	},
14617	undelegate: function( selector, types, fn ) {
14618
14619		// ( namespace ) or ( selector, types [, fn] )
14620		return arguments.length === 1 ?
14621			this.off( selector, "**" ) :
14622			this.off( types, selector || "**", fn );
14623	}
14624} );
14625
14626// Bind a function to a context, optionally partially applying any
14627// arguments.
14628// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
14629// However, it is not slated for removal any time soon
14630jQuery.proxy = function( fn, context ) {
14631	var tmp, args, proxy;
14632
14633	if ( typeof context === "string" ) {
14634		tmp = fn[ context ];
14635		context = fn;
14636		fn = tmp;
14637	}
14638
14639	// Quick check to determine if target is callable, in the spec
14640	// this throws a TypeError, but we will just return undefined.
14641	if ( !isFunction( fn ) ) {
14642		return undefined;
14643	}
14644
14645	// Simulated bind
14646	args = slice.call( arguments, 2 );
14647	proxy = function() {
14648		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
14649	};
14650
14651	// Set the guid of unique handler to the same of original handler, so it can be removed
14652	proxy.guid = fn.guid = fn.guid || jQuery.guid++;
14653
14654	return proxy;
14655};
14656
14657jQuery.holdReady = function( hold ) {
14658	if ( hold ) {
14659		jQuery.readyWait++;
14660	} else {
14661		jQuery.ready( true );
14662	}
14663};
14664jQuery.isArray = Array.isArray;
14665jQuery.parseJSON = JSON.parse;
14666jQuery.nodeName = nodeName;
14667jQuery.isFunction = isFunction;
14668jQuery.isWindow = isWindow;
14669jQuery.camelCase = camelCase;
14670jQuery.type = toType;
14671
14672jQuery.now = Date.now;
14673
14674jQuery.isNumeric = function( obj ) {
14675
14676	// As of jQuery 3.0, isNumeric is limited to
14677	// strings and numbers (primitives or objects)
14678	// that can be coerced to finite numbers (gh-2662)
14679	var type = jQuery.type( obj );
14680	return ( type === "number" || type === "string" ) &&
14681
14682		// parseFloat NaNs numeric-cast false positives ("")
14683		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
14684		// subtraction forces infinities to NaN
14685		!isNaN( obj - parseFloat( obj ) );
14686};
14687
14688
14689
14690
14691// Register as a named AMD module, since jQuery can be concatenated with other
14692// files that may use define, but not via a proper concatenation script that
14693// understands anonymous AMD modules. A named AMD is safest and most robust
14694// way to register. Lowercase jquery is used because AMD module names are
14695// derived from file names, and jQuery is normally delivered in a lowercase
14696// file name. Do this after creating the global so that if an AMD module wants
14697// to call noConflict to hide this version of jQuery, it will work.
14698
14699// Note that for maximum portability, libraries that are not jQuery should
14700// declare themselves as anonymous modules, and avoid setting a global if an
14701// AMD loader is present. jQuery is a special case. For more information, see
14702// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
14703
14704if ( typeof define === "function" && define.amd ) {
14705	define( "jquery", [], function() {
14706		return jQuery;
14707	} );
14708}
14709
14710
14711
14712
14713var
14714
14715	// Map over jQuery in case of overwrite
14716	_jQuery = window.jQuery,
14717
14718	// Map over the $ in case of overwrite
14719	_$ = window.$;
14720
14721jQuery.noConflict = function( deep ) {
14722	if ( window.$ === jQuery ) {
14723		window.$ = _$;
14724	}
14725
14726	if ( deep && window.jQuery === jQuery ) {
14727		window.jQuery = _jQuery;
14728	}
14729
14730	return jQuery;
14731};
14732
14733// Expose jQuery and $ identifiers, even in AMD
14734// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
14735// and CommonJS for browser emulators (#13566)
14736if ( !noGlobal ) {
14737	window.jQuery = window.$ = jQuery;
14738}
14739
14740
14741
14742
14743return jQuery;
14744} );
14745
14746},{}],125:[function(require,module,exports){
14747/*!
14748 * mustache.js - Logic-less {{mustache}} templates with JavaScript
14749 * http://github.com/janl/mustache.js
14750 */
14751
14752/*global define: false Mustache: true*/
14753
14754(function defineMustache (global, factory) {
14755  if (typeof exports === 'object' && exports && typeof exports.nodeName !== 'string') {
14756    factory(exports); // CommonJS
14757  } else if (typeof define === 'function' && define.amd) {
14758    define(['exports'], factory
vendor: 21,401 bytes, lines 14758-15429
14758); // AMD
14759  } else {
14760    global.Mustache = {};
14761    factory(global.Mustache); // script, wsh, asp
14762  }
14763}(this, function mustacheFactory (mustache) {
14764
14765  var objectToString = Object.prototype.toString;
14766  var isArray = Array.isArray || function isArrayPolyfill (object) {
14767    return objectToString.call(object) === '[object Array]';
14768  };
14769
14770  function isFunction (object) {
14771    return typeof object === 'function';
14772  }
14773
14774  /**
14775   * More correct typeof string handling array
14776   * which normally returns typeof 'object'
14777   */
14778  function typeStr (obj) {
14779    return isArray(obj) ? 'array' : typeof obj;
14780  }
14781
14782  function escapeRegExp (string) {
14783    return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
14784  }
14785
14786  /**
14787   * Null safe way of checking whether or not an object,
14788   * including its prototype, has a given property
14789   */
14790  function hasProperty (obj, propName) {
14791    return obj != null && typeof obj === 'object' && (propName in obj);
14792  }
14793
14794  /**
14795   * Safe way of detecting whether or not the given thing is a primitive and
14796   * whether it has the given property
14797   */
14798  function primitiveHasOwnProperty (primitive, propName) {  
14799    return (
14800      primitive != null
14801      && typeof primitive !== 'object'
14802      && primitive.hasOwnProperty
14803      && primitive.hasOwnProperty(propName)
14804    );
14805  }
14806
14807  // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
14808  // See https://github.com/janl/mustache.js/issues/189
14809  var regExpTest = RegExp.prototype.test;
14810  function testRegExp (re, string) {
14811    return regExpTest.call(re, string);
14812  }
14813
14814  var nonSpaceRe = /\S/;
14815  function isWhitespace (string) {
14816    return !testRegExp(nonSpaceRe, string);
14817  }
14818
14819  var entityMap = {
14820    '&': '&amp;',
14821    '<': '&lt;',
14822    '>': '&gt;',
14823    '"': '&quot;',
14824    "'": '&#39;',
14825    '/': '&#x2F;',
14826    '`': '&#x60;',
14827    '=': '&#x3D;'
14828  };
14829
14830  function escapeHtml (string) {
14831    return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) {
14832      return entityMap[s];
14833    });
14834  }
14835
14836  var whiteRe = /\s*/;
14837  var spaceRe = /\s+/;
14838  var equalsRe = /\s*=/;
14839  var curlyRe = /\s*\}/;
14840  var tagRe = /#|\^|\/|>|\{|&|=|!/;
14841
14842  /**
14843   * Breaks up the given `template` string into a tree of tokens. If the `tags`
14844   * argument is given here it must be an array with two string values: the
14845   * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
14846   * course, the default is to use mustaches (i.e. mustache.tags).
14847   *
14848   * A token is an array with at least 4 elements. The first element is the
14849   * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
14850   * did not contain a symbol (i.e. {{myValue}}) this element is "name". For
14851   * all text that appears outside a symbol this element is "text".
14852   *
14853   * The second element of a token is its "value". For mustache tags this is
14854   * whatever else was inside the tag besides the opening symbol. For text tokens
14855   * this is the text itself.
14856   *
14857   * The third and fourth elements of the token are the start and end indices,
14858   * respectively, of the token in the original template.
14859   *
14860   * Tokens that are the root node of a subtree contain two more elements: 1) an
14861   * array of tokens in the subtree and 2) the index in the original template at
14862   * which the closing tag for that section begins.
14863   */
14864  function parseTemplate (template, tags) {
14865    if (!template)
14866      return [];
14867
14868    var sections = [];     // Stack to hold section tokens
14869    var tokens = [];       // Buffer to hold the tokens
14870    var spaces = [];       // Indices of whitespace tokens on the current line
14871    var hasTag = false;    // Is there a {{tag}} on the current line?
14872    var nonSpace = false;  // Is there a non-space char on the current line?
14873
14874    // Strips all whitespace tokens array for the current line
14875    // if there was a {{#tag}} on it and otherwise only space.
14876    function stripSpace () {
14877      if (hasTag && !nonSpace) {
14878        while (spaces.length)
14879          delete tokens[spaces.pop()];
14880      } else {
14881        spaces = [];
14882      }
14883
14884      hasTag = false;
14885      nonSpace = false;
14886    }
14887
14888    var openingTagRe, closingTagRe, closingCurlyRe;
14889    function compileTags (tagsToCompile) {
14890      if (typeof tagsToCompile === 'string')
14891        tagsToCompile = tagsToCompile.split(spaceRe, 2);
14892
14893      if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
14894        throw new Error('Invalid tags: ' + tagsToCompile);
14895
14896      openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*');
14897      closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1]));
14898      closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1]));
14899    }
14900
14901    compileTags(tags || mustache.tags);
14902
14903    var scanner = new Scanner(template);
14904
14905    var start, type, value, chr, token, openSection;
14906    while (!scanner.eos()) {
14907      start = scanner.pos;
14908
14909      // Match any text between tags.
14910      value = scanner.scanUntil(openingTagRe);
14911
14912      if (value) {
14913        for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
14914          chr = value.charAt(i);
14915
14916          if (isWhitespace(chr)) {
14917            spaces.push(tokens.length);
14918          } else {
14919            nonSpace = true;
14920          }
14921
14922          tokens.push([ 'text', chr, start, start + 1 ]);
14923          start += 1;
14924
14925          // Check for whitespace on the current line.
14926          if (chr === '\n')
14927            stripSpace();
14928        }
14929      }
14930
14931      // Match the opening tag.
14932      if (!scanner.scan(openingTagRe))
14933        break;
14934
14935      hasTag = true;
14936
14937      // Get the tag type.
14938      type = scanner.scan(tagRe) || 'name';
14939      scanner.scan(whiteRe);
14940
14941      // Get the tag value.
14942      if (type === '=') {
14943        value = scanner.scanUntil(equalsRe);
14944        scanner.scan(equalsRe);
14945        scanner.scanUntil(closingTagRe);
14946      } else if (type === '{') {
14947        value = scanner.scanUntil(closingCurlyRe);
14948        scanner.scan(curlyRe);
14949        scanner.scanUntil(closingTagRe);
14950        type = '&';
14951      } else {
14952        value = scanner.scanUntil(closingTagRe);
14953      }
14954
14955      // Match the closing tag.
14956      if (!scanner.scan(closingTagRe))
14957        throw new Error('Unclosed tag at ' + scanner.pos);
14958
14959      token = [ type, value, start, scanner.pos ];
14960      tokens.push(token);
14961
14962      if (type === '#' || type === '^') {
14963        sections.push(token);
14964      } else if (type === '/') {
14965        // Check section nesting.
14966        openSection = sections.pop();
14967
14968        if (!openSection)
14969          throw new Error('Unopened section "' + value + '" at ' + start);
14970
14971        if (openSection[1] !== value)
14972          throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
14973      } else if (type === 'name' || type === '{' || type === '&') {
14974        nonSpace = true;
14975      } else if (type === '=') {
14976        // Set the tags for the next time around.
14977        compileTags(value);
14978      }
14979    }
14980
14981    // Make sure there are no open sections when we're done.
14982    openSection = sections.pop();
14983
14984    if (openSection)
14985      throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
14986
14987    return nestTokens(squashTokens(tokens));
14988  }
14989
14990  /**
14991   * Combines the values of consecutive text tokens in the given `tokens` array
14992   * to a single token.
14993   */
14994  function squashTokens (tokens) {
14995    var squashedTokens = [];
14996
14997    var token, lastToken;
14998    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
14999      token = tokens[i];
15000
15001      if (token) {
15002        if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
15003          lastToken[1] += token[1];
15004          lastToken[3] = token[3];
15005        } else {
15006          squashedTokens.push(token);
15007          lastToken = token;
15008        }
15009      }
15010    }
15011
15012    return squashedTokens;
15013  }
15014
15015  /**
15016   * Forms the given array of `tokens` into a nested tree structure where
15017   * tokens that represent a section have two additional items: 1) an array of
15018   * all tokens that appear in that section and 2) the index in the original
15019   * template that represents the end of that section.
15020   */
15021  function nestTokens (tokens) {
15022    var nestedTokens = [];
15023    var collector = nestedTokens;
15024    var sections = [];
15025
15026    var token, section;
15027    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
15028      token = tokens[i];
15029
15030      switch (token[0]) {
15031        case '#':
15032        case '^':
15033          collector.push(token);
15034          sections.push(token);
15035          collector = token[4] = [];
15036          break;
15037        case '/':
15038          section = sections.pop();
15039          section[5] = token[2];
15040          collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
15041          break;
15042        default:
15043          collector.push(token);
15044      }
15045    }
15046
15047    return nestedTokens;
15048  }
15049
15050  /**
15051   * A simple string scanner that is used by the template parser to find
15052   * tokens in template strings.
15053   */
15054  function Scanner (string) {
15055    this.string = string;
15056    this.tail = string;
15057    this.pos = 0;
15058  }
15059
15060  /**
15061   * Returns `true` if the tail is empty (end of string).
15062   */
15063  Scanner.prototype.eos = function eos () {
15064    return this.tail === '';
15065  };
15066
15067  /**
15068   * Tries to match the given regular expression at the current position.
15069   * Returns the matched text if it can match, the empty string otherwise.
15070   */
15071  Scanner.prototype.scan = function scan (re) {
15072    var match = this.tail.match(re);
15073
15074    if (!match || match.index !== 0)
15075      return '';
15076
15077    var string = match[0];
15078
15079    this.tail = this.tail.substring(string.length);
15080    this.pos += string.length;
15081
15082    return string;
15083  };
15084
15085  /**
15086   * Skips all text until the given regular expression can be matched. Returns
15087   * the skipped string, which is the entire tail if no match can be made.
15088   */
15089  Scanner.prototype.scanUntil = function scanUntil (re) {
15090    var index = this.tail.search(re), match;
15091
15092    switch (index) {
15093      case -1:
15094        match = this.tail;
15095        this.tail = '';
15096        break;
15097      case 0:
15098        match = '';
15099        break;
15100      default:
15101        match = this.tail.substring(0, index);
15102        this.tail = this.tail.substring(index);
15103    }
15104
15105    this.pos += match.length;
15106
15107    return match;
15108  };
15109
15110  /**
15111   * Represents a rendering context by wrapping a view object and
15112   * maintaining a reference to the parent context.
15113   */
15114  function Context (view, parentContext) {
15115    this.view = view;
15116    this.cache = { '.': this.view };
15117    this.parent = parentContext;
15118  }
15119
15120  /**
15121   * Creates a new context using the given view with this context
15122   * as the parent.
15123   */
15124  Context.prototype.push = function push (view) {
15125    return new Context(view, this);
15126  };
15127
15128  /**
15129   * Returns the value of the given name in this context, traversing
15130   * up the context hierarchy if the value is absent in this context's view.
15131   */
15132  Context.prototype.lookup = function lookup (name) {
15133    var cache = this.cache;
15134
15135    var value;
15136    if (cache.hasOwnProperty(name)) {
15137      value = cache[name];
15138    } else {
15139      var context = this, intermediateValue, names, index, lookupHit = false;
15140
15141      while (context) {
15142        if (name.indexOf('.') > 0) {
15143          intermediateValue = context.view;
15144          names = name.split('.');
15145          index = 0;
15146
15147          /**
15148           * Using the dot notion path in `name`, we descend through the
15149           * nested objects.
15150           *
15151           * To be certain that the lookup has been successful, we have to
15152           * check if the last object in the path actually has the property
15153           * we are looking for. We store the result in `lookupHit`.
15154           *
15155           * This is specially necessary for when the value has been set to
15156           * `undefined` and we want to avoid looking up parent contexts.
15157           *
15158           * In the case where dot notation is used, we consider the lookup
15159           * to be successful even if the last "object" in the path is
15160           * not actually an object but a primitive (e.g., a string, or an
15161           * integer), because it is sometimes useful to access a property
15162           * of an autoboxed primitive, such as the length of a string.
15163           **/
15164          while (intermediateValue != null && index < names.length) {
15165            if (index === names.length - 1)
15166              lookupHit = (
15167                hasProperty(intermediateValue, names[index]) 
15168                || primitiveHasOwnProperty(intermediateValue, names[index])
15169              );
15170
15171            intermediateValue = intermediateValue[names[index++]];
15172          }
15173        } else {
15174          intermediateValue = context.view[name];
15175
15176          /**
15177           * Only checking against `hasProperty`, which always returns `false` if
15178           * `context.view` is not an object. Deliberately omitting the check
15179           * against `primitiveHasOwnProperty` if dot notation is not used.
15180           *
15181           * Consider this example:
15182           * ```
15183           * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"})
15184           * ```
15185           *
15186           * If we were to check also against `primitiveHasOwnProperty`, as we do
15187           * in the dot notation case, then render call would return:
15188           *
15189           * "The length of a football field is 9."
15190           *
15191           * rather than the expected:
15192           *
15193           * "The length of a football field is 100 yards."
15194           **/
15195          lookupHit = hasProperty(context.view, name);
15196        }
15197
15198        if (lookupHit) {
15199          value = intermediateValue;
15200          break;
15201        }
15202
15203        context = context.parent;
15204      }
15205
15206      cache[name] = value;
15207    }
15208
15209    if (isFunction(value))
15210      value = value.call(this.view);
15211
15212    return value;
15213  };
15214
15215  /**
15216   * A Writer knows how to take a stream of tokens and render them to a
15217   * string, given a context. It also maintains a cache of templates to
15218   * avoid the need to parse the same template twice.
15219   */
15220  function Writer () {
15221    this.cache = {};
15222  }
15223
15224  /**
15225   * Clears all cached templates in this writer.
15226   */
15227  Writer.prototype.clearCache = function clearCache () {
15228    this.cache = {};
15229  };
15230
15231  /**
15232   * Parses and caches the given `template` according to the given `tags` or
15233   * `mustache.tags` if `tags` is omitted,  and returns the array of tokens
15234   * that is generated from the parse.
15235   */
15236  Writer.prototype.parse = function parse (template, tags) {
15237    var cache = this.cache;
15238    var cacheKey = template + ':' + (tags || mustache.tags).join(':');
15239    var tokens = cache[cacheKey];
15240
15241    if (tokens == null)
15242      tokens = cache[cacheKey] = parseTemplate(template, tags);
15243
15244    return tokens;
15245  };
15246
15247  /**
15248   * High-level method that is used to render the given `template` with
15249   * the given `view`.
15250   *
15251   * The optional `partials` argument may be an object that contains the
15252   * names and templates of partials that are used in the template. It may
15253   * also be a function that is used to load partial templates on the fly
15254   * that takes a single argument: the name of the partial.
15255   *
15256   * If the optional `tags` argument is given here it must be an array with two
15257   * string values: the opening and closing tags used in the template (e.g.
15258   * [ "<%", "%>" ]). The default is to mustache.tags.
15259   */
15260  Writer.prototype.render = function render (template, view, partials, tags) {
15261    var tokens = this.parse(template, tags);
15262    var context = (view instanceof Context) ? view : new Context(view);
15263    return this.renderTokens(tokens, context, partials, template, tags);
15264  };
15265
15266  /**
15267   * Low-level method that renders the given array of `tokens` using
15268   * the given `context` and `partials`.
15269   *
15270   * Note: The `originalTemplate` is only ever used to extract the portion
15271   * of the original template that was contained in a higher-order section.
15272   * If the template doesn't use higher-order sections, this argument may
15273   * be omitted.
15274   */
15275  Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, tags) {
15276    var buffer = '';
15277
15278    var token, symbol, value;
15279    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
15280      value = undefined;
15281      token = tokens[i];
15282      symbol = token[0];
15283
15284      if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate);
15285      else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate);
15286      else if (symbol === '>') value = this.renderPartial(token, context, partials, tags);
15287      else if (symbol === '&') value = this.unescapedValue(token, context);
15288      else if (symbol === 'name') value = this.escapedValue(token, context);
15289      else if (symbol === 'text') value = this.rawValue(token);
15290
15291      if (value !== undefined)
15292        buffer += value;
15293    }
15294
15295    return buffer;
15296  };
15297
15298  Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate) {
15299    var self = this;
15300    var buffer = '';
15301    var value = context.lookup(token[1]);
15302
15303    // This function is used to render an arbitrary template
15304    // in the current context by higher-order sections.
15305    function subRender (template) {
15306      return self.render(template, context, partials);
15307    }
15308
15309    if (!value) return;
15310
15311    if (isArray(value)) {
15312      for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
15313        buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
15314      }
15315    } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {
15316      buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
15317    } else if (isFunction(value)) {
15318      if (typeof originalTemplate !== 'string')
15319        throw new Error('Cannot use higher-order sections without the original template');
15320
15321      // Extract the portion of the original template that the section contains.
15322      value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
15323
15324      if (value != null)
15325        buffer += value;
15326    } else {
15327      buffer += this.renderTokens(token[4], context, partials, originalTemplate);
15328    }
15329    return buffer;
15330  };
15331
15332  Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate) {
15333    var value = context.lookup(token[1]);
15334
15335    // Use JavaScript's definition of falsy. Include empty arrays.
15336    // See https://github.com/janl/mustache.js/issues/186
15337    if (!value || (isArray(value) && value.length === 0))
15338      return this.renderTokens(token[4], context, partials, originalTemplate);
15339  };
15340
15341  Writer.prototype.renderPartial = function renderPartial (token, context, partials, tags) {
15342    if (!partials) return;
15343
15344    var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
15345    if (value != null)
15346      return this.renderTokens(this.parse(value, tags), context, partials, value);
15347  };
15348
15349  Writer.prototype.unescapedValue = function unescapedValue (token, context) {
15350    var value = context.lookup(token[1]);
15351    if (value != null)
15352      return value;
15353  };
15354
15355  Writer.prototype.escapedValue = function escapedValue (token, context) {
15356    var value = context.lookup(token[1]);
15357    if (value != null)
15358      return mustache.escape(value);
15359  };
15360
15361  Writer.prototype.rawValue = function rawValue (token) {
15362    return token[1];
15363  };
15364
15365  mustache.name = 'mustache.js';
15366  mustache.version = '3.0.1';
15367  mustache.tags = [ '{{', '}}' ];
15368
15369  // All high-level mustache.* functions use this writer.
15370  var defaultWriter = new Writer();
15371
15372  /**
15373   * Clears all cached templates in the default writer.
15374   */
15375  mustache.clearCache = function clearCache () {
15376    return defaultWriter.clearCache();
15377  };
15378
15379  /**
15380   * Parses and caches the given template in the default writer and returns the
15381   * array of tokens it contains. Doing this ahead of time avoids the need to
15382   * parse templates on the fly as they are rendered.
15383   */
15384  mustache.parse = function parse (template, tags) {
15385    return defaultWriter.parse(template, tags);
15386  };
15387
15388  /**
15389   * Renders the `template` with the given `view` and `partials` using the
15390   * default writer. If the optional `tags` argument is given here it must be an
15391   * array with two string values: the opening and closing tags used in the
15392   * template (e.g. [ "<%", "%>" ]). The default is to mustache.tags.
15393   */
15394  mustache.render = function render (template, view, partials, tags) {
15395    if (typeof template !== 'string') {
15396      throw new TypeError('Invalid template! Template should be a "string" ' +
15397                          'but "' + typeStr(template) + '" was given as the first ' +
15398                          'argument for mustache#render(template, view, partials)');
15399    }
15400
15401    return defaultWriter.render(template, view, partials, tags);
15402  };
15403
15404  // This is here for backwards compatibility with 0.4.x.,
15405  /*eslint-disable */ // eslint wants camel cased function name
15406  mustache.to_html = function to_html (template, view, partials, send) {
15407    /*eslint-enable*/
15408
15409    var result = mustache.render(template, view, partials);
15410
15411    if (isFunction(send)) {
15412      send(result);
15413    } else {
15414      return result;
15415    }
15416  };
15417
15418  // Export the escaping function so that the user may override it.
15419  // See https://github.com/janl/mustache.js/issues/244
15420  mustache.escape = escapeHtml;
15421
15422  // Export these mainly for testing, but also for advanced usage.
15423  mustache.Scanner = Scanner;
15424  mustache.Context = Context;
15425  mustache.Writer = Writer;
15426
15427  return mustache;
15428}));
15429
vendor: 34,539 bytes, lines 15430-16833
15430},{}],126:[function(require,module,exports){
15431(function (global){
15432/*
15433	Ractive.js v1.3.2
15434	Build: 94abd9d4f610b652fd66284f97737db4333f75d6
15435	Date: Tue Mar 12 2019 20:47:47 GMT+0000 (UTC)
15436	Website: https://ractive.js.org
15437	License: MIT
15438*/
15439(function (global, factory) {
15440	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
15441	typeof define === 'function' && define.amd ? define(factory) :
15442	(function() {
15443		var current = global.Ractive;
15444		var exports = factory();
15445		global.Ractive = exports;
15446		exports.noConflict = function() { global.Ractive = current; return exports; };
15447	})();
15448}(this, (function () { 'use strict';
15449
15450/* istanbul ignore if */
15451if (!Object.assign) {
15452  Object.assign = function(target) {
15453    var sources = [], len = arguments.length - 1;
15454    while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
15455
15456    if (target == null) { throw new TypeError('Cannot convert undefined or null to object'); }
15457
15458    var to = Object(target);
15459    var sourcesLength = sources.length;
15460
15461    for (var index = 0; index < sourcesLength; index++) {
15462      var nextSource = sources[index];
15463      for (var nextKey in nextSource) {
15464        if (!Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { continue; }
15465        to[nextKey] = nextSource[nextKey];
15466      }
15467    }
15468
15469    return to;
15470  };
15471}
15472
15473function hasOwn(obj, prop) {
15474  return Object.prototype.hasOwnProperty.call(obj, prop);
15475}
15476
15477function fillGaps(target) {
15478  var sources = [], len = arguments.length - 1;
15479  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
15480
15481  for (var i = 0; i < sources.length; i++) {
15482    var source = sources[i];
15483    for (var key in source) {
15484      // Source can be a prototype-less object.
15485      if (key in target || !hasOwn(source, key)) { continue; }
15486      target[key] = source[key];
15487    }
15488  }
15489
15490  return target;
15491}
15492
15493function toPairs(obj) {
15494  if ( obj === void 0 ) obj = {};
15495
15496  var pairs = [];
15497  for (var key in obj) {
15498    // Source can be a prototype-less object.
15499    if (!hasOwn(obj, key)) { continue; }
15500    pairs.push([key, obj[key]]);
15501  }
15502  return pairs;
15503}
15504
15505var obj = Object;
15506
15507var assign = obj.assign;
15508
15509var create = obj.create;
15510
15511var defineProperty = obj.defineProperty;
15512
15513var defineProperties = obj.defineProperties;
15514
15515var keys = obj.keys;
15516
15517var toString = Object.prototype.toString;
15518
15519
15520var isArray = Array.isArray;
15521
15522function isEqual(a, b) {
15523  if (a === null && b === null) {
15524    return true;
15525  }
15526
15527  if (isObjectType(a) || isObjectType(b)) {
15528    return false;
15529  }
15530
15531  return a === b;
15532}
15533
15534// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
15535function isNumeric(thing) {
15536  return !isNaN(parseFloat(thing)) && isFinite(thing);
15537}
15538
15539function isObject(thing) {
15540  return thing && toString.call(thing) === '[object Object]';
15541}
15542
15543function isObjectLike(thing) {
15544  return !!(thing && (isObjectType(thing) || isFunction(thing)));
15545}
15546
15547function isObjectType(thing) {
15548  return typeof thing === 'object';
15549}
15550
15551function isFunction(thing) {
15552  return typeof thing === 'function';
15553}
15554
15555function isString(thing) {
15556  return typeof thing === 'string';
15557}
15558
15559function isNumber(thing) {
15560  return typeof thing === 'number';
15561}
15562
15563function isUndefined(thing) {
15564  return thing === undefined;
15565}
15566
15567/* istanbul ignore if */
15568if (!Array.prototype.find) {
15569  defineProperty(Array.prototype, 'find', {
15570    value: function value(callback, thisArg) {
15571      if (this === null || isUndefined(this))
15572        { throw new TypeError('Array.prototype.find called on null or undefined'); }
15573
15574      if (!isFunction(callback)) { throw new TypeError((callback + " is not a function")); }
15575
15576      var array = Object(this);
15577      var arrayLength = array.length >>> 0;
15578
15579      for (var index = 0; index < arrayLength; index++) {
15580        if (!hasOwn(array, index)) { continue; }
15581        if (!callback.call(thisArg, array[index], index, array)) { continue; }
15582        return array[index];
15583      }
15584
15585      return undefined;
15586    },
15587    configurable: true,
15588    writable: true
15589  });
15590}
15591
15592// NOTE: Node doesn't exist in IE8. Nothing can be done.
15593/* istanbul ignore if */
15594if (
15595  typeof window !== 'undefined' &&
15596  window.Node &&
15597  window.Node.prototype &&
15598  !window.Node.prototype.contains
15599) {
15600  Node.prototype.contains = function(node) {
15601    var this$1 = this;
15602
15603    if (!node) { throw new TypeError('node required'); }
15604
15605    do {
15606      if (this$1 === node) { return true; }
15607    } while ((node = node && node.parentNode));
15608
15609    return false;
15610  };
15611}
15612
15613/* istanbul ignore if */
15614if (typeof window !== 'undefined' && window.performance && !window.performance.now) {
15615  window.performance = window.performance || {};
15616
15617  var nowOffset = Date.now();
15618
15619  window.performance.now = function() {
15620    return Date.now() - nowOffset;
15621  };
15622}
15623
15624/* eslint no-console:"off" */
15625var win = typeof window !== 'undefined' ? window : null;
15626var doc = win ? document : null;
15627var isClient = !!doc;
15628var base = typeof global !== 'undefined' ? global : win;
15629var hasConsole =
15630  typeof console !== 'undefined' && isFunction(console.warn) && isFunction(console.warn.apply);
15631
15632var svg = doc
15633  ? doc.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1')
15634  : false;
15635
15636var vendors = ['o', 'ms', 'moz', 'webkit'];
15637
15638/* istanbul ignore if */
15639if (!base.Promise) {
15640  var PENDING = {};
15641  var FULFILLED = {};
15642  var REJECTED = {};
15643
15644  var Promise$1 = (base.Promise = function(callback) {
15645    var fulfilledHandlers = [];
15646    var rejectedHandlers = [];
15647    var state = PENDING;
15648    var result;
15649    var dispatchHandlers;
15650
15651    var makeResolver = function (newState) {
15652      return function(value) {
15653        if (state !== PENDING) { return; }
15654        result = value;
15655        state = newState;
15656        dispatchHandlers = makeDispatcher(
15657          state === FULFILLED ? fulfilledHandlers : rejectedHandlers,
15658          result
15659        );
15660        wait(dispatchHandlers);
15661      };
15662    };
15663
15664    var fulfill = makeResolver(FULFILLED);
15665    var reject = makeResolver(REJECTED);
15666
15667    try {
15668      callback(fulfill, reject);
15669    } catch (err) {
15670      reject(err);
15671    }
15672
15673    return {
15674      // `then()` returns a Promise - 2.2.7
15675      then: function then(onFulfilled, onRejected) {
15676        var promise2 = new Promise$1(function (fulfill, reject) {
15677          var processResolutionHandler = function (handler, handlers, forward) {
15678            if (isFunction(handler)) {
15679              handlers.push(function (p1result) {
15680                try {
15681                  resolve$1(promise2, handler(p1result), fulfill, reject);
15682                } catch (err) {
15683                  reject(err);
15684                }
15685              });
15686            } else {
15687              handlers.push(forward);
15688            }
15689          };
15690
15691          processResolutionHandler(onFulfilled, fulfilledHandlers, fulfill);
15692          processResolutionHandler(onRejected, rejectedHandlers, reject);
15693
15694          if (state !== PENDING) {
15695            wait(dispatchHandlers);
15696          }
15697        });
15698        return promise2;
15699      },
15700      catch: function catch$1(onRejected) {
15701        return this.then(null, onRejected);
15702      },
15703      finally: function finally$1(callback) {
15704        return this.then(
15705          function (v) {
15706            callback();
15707            return v;
15708          },
15709          function (e) {
15710            callback();
15711            throw e;
15712          }
15713        );
15714      }
15715    };
15716  });
15717
15718  Promise$1.all = function(promises) {
15719    return new Promise$1(function (fulfill, reject) {
15720      var result = [];
15721      var pending;
15722      var i;
15723
15724      if (!promises.length) {
15725        fulfill(result);
15726        return;
15727      }
15728
15729      var processPromise = function (promise, i) {
15730        if (promise && isFunction(promise.then)) {
15731          promise.then(function (value) {
15732            result[i] = value;
15733            --pending || fulfill(result);
15734          }, reject);
15735        } else {
15736          result[i] = promise;
15737          --pending || fulfill(result);
15738        }
15739      };
15740
15741      pending = i = promises.length;
15742
15743      while (i--) {
15744        processPromise(promises[i], i);
15745      }
15746    });
15747  };
15748
15749  Promise$1.race = function(promises) {
15750    return new Promise$1(function (fulfill, reject) {
15751      var pending = true;
15752      function ok(v) {
15753        if (!pending) { return; }
15754        pending = false;
15755        fulfill(v);
15756      }
15757      function fail(e) {
15758        if (!pending) { return; }
15759        pending = false;
15760        reject(e);
15761      }
15762      for (var i = 0; i < promises.length; i++) {
15763        if (promises[i] && isFunction(promises[i].then)) {
15764          promises[i].then(ok, fail);
15765        }
15766      }
15767    });
15768  };
15769
15770  Promise$1.resolve = function(value) {
15771    if (value && isFunction(value.then)) { return value; }
15772    return new Promise$1(function (fulfill) {
15773      fulfill(value);
15774    });
15775  };
15776
15777  Promise$1.reject = function(reason) {
15778    if (reason && isFunction(reason.then)) { return reason; }
15779    return new Promise$1(function (fulfill, reject) {
15780      reject(reason);
15781    });
15782  };
15783
15784  // TODO use MutationObservers or something to simulate setImmediate
15785  var wait = function(callback) {
15786    setTimeout(callback, 0);
15787  };
15788
15789  var makeDispatcher = function(handlers, result) {
15790    return function() {
15791      for (var handler = (void 0); (handler = handlers.shift()); ) {
15792        handler(result);
15793      }
15794    };
15795  };
15796
15797  var resolve$1 = function(promise, x, fulfil, reject) {
15798    var then;
15799    if (x === promise) {
15800      throw new TypeError("A promise's fulfillment handler cannot return the same promise");
15801    }
15802    if (x instanceof Promise$1) {
15803      x.then(fulfil, reject);
15804    } else if (x && (isObjectType(x) || isFunction(x))) {
15805      try {
15806        then = x.then;
15807      } catch (e) {
15808        reject(e);
15809        return;
15810      }
15811      if (isFunction(then)) {
15812        var called;
15813
15814        var resolvePromise = function(y) {
15815          if (called) { return; }
15816          called = true;
15817          resolve$1(promise, y, fulfil, reject);
15818        };
15819        var rejectPromise = function(r) {
15820          if (called) { return; }
15821          called = true;
15822          reject(r);
15823        };
15824
15825        try {
15826          then.call(x, resolvePromise, rejectPromise);
15827        } catch (e) {
15828          if (!called) {
15829            reject(e);
15830            called = true;
15831            return;
15832          }
15833        }
15834      } else {
15835        fulfil(x);
15836      }
15837    } else {
15838      fulfil(x);
15839    }
15840  };
15841}
15842
15843/* istanbul ignore if */
15844if (
15845  typeof window !== 'undefined' &&
15846  !(window.requestAnimationFrame && window.cancelAnimationFrame)
15847) {
15848  var lastTime = 0;
15849  window.requestAnimationFrame = function(callback) {
15850    var currentTime = Date.now();
15851    var timeToNextCall = Math.max(0, 16 - (currentTime - lastTime));
15852    var id = window.setTimeout(function () {
15853      callback(currentTime + timeToNextCall);
15854    }, timeToNextCall);
15855    lastTime = currentTime + timeToNextCall;
15856    return id;
15857  };
15858  window.cancelAnimationFrame = function(id) {
15859    clearTimeout(id);
15860  };
15861}
15862
15863var defaults = {
15864  // render placement:
15865  el: void 0,
15866  append: false,
15867  delegate: true,
15868  enhance: false,
15869
15870  // template:
15871  template: null,
15872
15873  // parse:
15874  allowExpressions: true,
15875  delimiters: ['{{', '}}'],
15876  tripleDelimiters: ['{{{', '}}}'],
15877  staticDelimiters: ['[[', ']]'],
15878  staticTripleDelimiters: ['[[[', ']]]'],
15879  csp: true,
15880  interpolate: false,
15881  preserveWhitespace: false,
15882  sanitize: false,
15883  stripComments: true,
15884  contextLines: 0,
15885
15886  // data & binding:
15887  data: create(null),
15888  helpers: create(null),
15889  computed: create(null),
15890  syncComputedChildren: false,
15891  resolveInstanceMembers: false,
15892  warnAboutAmbiguity: false,
15893  adapt: [],
15894  isolated: true,
15895  twoway: true,
15896  lazy: false,
15897
15898  // transitions:
15899  noIntro: false,
15900  noOutro: false,
15901  transitionsEnabled: true,
15902  complete: void 0,
15903  nestedTransitions: true,
15904
15905  // css:
15906  css: null,
15907  noCSSTransform: false
15908};
15909
15910// These are a subset of the easing equations found at
15911// https://raw.github.com/danro/easing-js - license info
15912// follows:
15913
15914// --------------------------------------------------
15915// easing.js v0.5.4
15916// Generic set of easing functions with AMD support
15917// https://github.com/danro/easing-js
15918// This code may be freely distributed under the MIT license
15919// http://danro.mit-license.org/
15920// --------------------------------------------------
15921// All functions adapted from Thomas Fuchs & Jeremy Kahn
15922// Easing Equations (c) 2003 Robert Penner, BSD license
15923// https://raw.github.com/danro/easing-js/master/LICENSE
15924// --------------------------------------------------
15925
15926// In that library, the functions named easeIn, easeOut, and
15927// easeInOut below are named easeInCubic, easeOutCubic, and
15928// (you guessed it) easeInOutCubic.
15929//
15930// You can add additional easing functions to this list, and they
15931// will be globally available.
15932
15933var easing = {
15934  linear: function linear(pos) {
15935    return pos;
15936  },
15937  easeIn: function easeIn(pos) {
15938    /* istanbul ignore next */
15939    return Math.pow(pos, 3);
15940  },
15941  easeOut: function easeOut(pos) {
15942    return Math.pow(pos - 1, 3) + 1;
15943  },
15944  easeInOut: function easeInOut(pos) {
15945    /* istanbul ignore next */
15946    if ((pos /= 0.5) < 1) {
15947      return 0.5 * Math.pow(pos, 3);
15948    }
15949    /* istanbul ignore next */
15950    return 0.5 * (Math.pow(pos - 2, 3) + 2);
15951  }
15952};
15953
15954function noop() {}
15955
15956/* global console */
15957/* eslint no-console:"off" */
15958
15959var alreadyWarned = {};
15960var log;
15961var printWarning;
15962var welcome;
15963
15964if (hasConsole) {
15965  var welcomeIntro = [
15966    "%cRactive.js %c1.3.2 %cin debug mode, %cmore...",
15967    'color: rgb(114, 157, 52); font-weight: normal;',
15968    'color: rgb(85, 85, 85); font-weight: normal;',
15969    'color: rgb(85, 85, 85); font-weight: normal;',
15970    'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;'
15971  ];
15972  var welcomeMessage = "You're running Ractive 1.3.2 in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\n\nTo disable debug mode, add this line at the start of your app:\n  Ractive.DEBUG = false;\n\nTo disable debug mode when your app is minified, add this snippet:\n  Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\n\nGet help and support:\n  http://ractive.js.org\n  http://stackoverflow.com/questions/tagged/ractivejs\n  http://groups.google.com/forum/#!forum/ractive-js\n  http://twitter.com/ractivejs\n\nFound a bug? Raise an issue:\n  https://github.com/ractivejs/ractive/issues\n\n";
15973
15974  welcome = function () {
15975    if (Ractive.WELCOME_MESSAGE === false) {
15976      welcome = noop;
15977      return;
15978    }
15979    var message = 'WELCOME_MESSAGE' in Ractive ? Ractive.WELCOME_MESSAGE : welcomeMessage;
15980    var hasGroup = !!console.groupCollapsed;
15981    if (hasGroup) { console.groupCollapsed.apply(console, welcomeIntro); }
15982    console.log(message);
15983    if (hasGroup) {
15984      console.groupEnd(welcomeIntro);
15985    }
15986
15987    welcome = noop;
15988  };
15989
15990  printWarning = function (message, args) {
15991    welcome();
15992
15993    // extract information about the instance this message pertains to, if applicable
15994    if (isObjectType(args[args.length - 1])) {
15995      var options = args.pop();
15996      var ractive = options ? options.ractive : null;
15997
15998      if (ractive) {
15999        // if this is an instance of a component that we know the name of, add
16000        // it to the message
16001        var name;
16002        if (ractive.component && (name = ractive.component.name)) {
16003          message = "<" + name + "> " + message;
16004        }
16005
16006        var node;
16007        if (
16008          (node =
16009            options.node || (ractive.fragment && ractive.fragment.rendered && ractive.find('*')))
16010        ) {
16011          args.push(node);
16012        }
16013      }
16014    }
16015
16016    console.warn.apply(
16017      console,
16018      ['%cRactive.js: %c' + message, 'color: rgb(114, 157, 52);', 'color: rgb(85, 85, 85);'].concat(
16019        args
16020      )
16021    );
16022  };
16023
16024  log = function() {
16025    console.log.apply(console, arguments);
16026  };
16027} else {
16028  printWarning = log = welcome = noop;
16029}
16030
16031function format(message, args) {
16032  return message.replace(/%s/g, function () { return args.shift(); });
16033}
16034
16035function fatal(message) {
16036  var args = [], len = arguments.length - 1;
16037  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
16038
16039  message = format(message, args);
16040  throw new Error(message);
16041}
16042
16043function logIfDebug() {
16044  if (Ractive.DEBUG) {
16045    log.apply(null, arguments);
16046  }
16047}
16048
16049function warn(message) {
16050  var args = [], len = arguments.length - 1;
16051  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
16052
16053  message = format(message, args);
16054  printWarning(message, args);
16055}
16056
16057function warnOnce(message) {
16058  var args = [], len = arguments.length - 1;
16059  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
16060
16061  message = format(message, args);
16062
16063  if (alreadyWarned[message]) {
16064    return;
16065  }
16066
16067  alreadyWarned[message] = true;
16068  printWarning(message, args);
16069}
16070
16071function warnIfDebug() {
16072  if (Ractive.DEBUG) {
16073    warn.apply(null, arguments);
16074  }
16075}
16076
16077function warnOnceIfDebug() {
16078  if (Ractive.DEBUG) {
16079    warnOnce.apply(null, arguments);
16080  }
16081}
16082
16083// Error messages that are used (or could be) in multiple places
16084var badArguments = 'Bad arguments';
16085var noRegistryFunctionReturn =
16086  'A function was specified for "%s" %s, but no %s was returned';
16087var missingPlugin = function (name, type) { return ("Missing \"" + name + "\" " + type + " plugin. You may need to download a plugin via http://ractive.js.org/integrations/#" + type + "s"); };
16088
16089function findInViewHierarchy(registryName, ractive, name) {
16090  var instance = findInstance(registryName, ractive, name);
16091  return instance ? instance[registryName][name] : null;
16092}
16093
16094function findInstance(registryName, ractive, name) {
16095  while (ractive) {
16096    if (name in ractive[registryName]) {
16097      return ractive;
16098    }
16099
16100    if (ractive.isolated) {
16101      return null;
16102    }
16103
16104    ractive = ractive.parent;
16105  }
16106}
16107
16108function interpolate(from, to, ractive, type) {
16109  if (from === to) { return null; }
16110
16111  if (type) {
16112    var interpol = findInViewHierarchy('interpolators', ractive, type);
16113    if (interpol) { return interpol(from, to) || null; }
16114
16115    fatal(missingPlugin(type, 'interpolator'));
16116  }
16117
16118  return (
16119    interpolators.number(from, to) ||
16120    interpolators.array(from, to) ||
16121    interpolators.object(from, to) ||
16122    null
16123  );
16124}
16125
16126var interpolators = {
16127  number: function number(from, to) {
16128    if (!isNumeric(from) || !isNumeric(to)) {
16129      return null;
16130    }
16131
16132    from = +from;
16133    to = +to;
16134
16135    var delta = to - from;
16136
16137    if (!delta) {
16138      return function() {
16139        return from;
16140      };
16141    }
16142
16143    return function(t) {
16144      return from + t * delta;
16145    };
16146  },
16147
16148  array: function array(from, to) {
16149    var len, i;
16150
16151    if (!isArray(from) || !isArray(to)) {
16152      return null;
16153    }
16154
16155    var intermediate = [];
16156    var interpolators = [];
16157
16158    i = len = Math.min(from.length, to.length);
16159    while (i--) {
16160      interpolators[i] = interpolate(from[i], to[i]);
16161    }
16162
16163    // surplus values - don't interpolate, but don't exclude them either
16164    for (i = len; i < from.length; i += 1) {
16165      intermediate[i] = from[i];
16166    }
16167
16168    for (i = len; i < to.length; i += 1) {
16169      intermediate[i] = to[i];
16170    }
16171
16172    return function(t) {
16173      var i = len;
16174
16175      while (i--) {
16176        intermediate[i] = interpolators[i](t);
16177      }
16178
16179      return intermediate;
16180    };
16181  },
16182
16183  object: function object(from, to) {
16184    if (!isObject(from) || !isObject(to)) {
16185      return null;
16186    }
16187
16188    var properties = [];
16189    var intermediate = {};
16190    var interpolators = {};
16191
16192    var loop = function ( prop ) {
16193      if (hasOwn(from, prop)) {
16194        if (hasOwn(to, prop)) {
16195          properties.push(prop);
16196          interpolators[prop] = interpolate(from[prop], to[prop]) || (function () { return to[prop]; });
16197        } else {
16198          intermediate[prop] = from[prop];
16199        }
16200      }
16201    };
16202
16203    for (var prop in from) loop( prop );
16204
16205    for (var prop$1 in to) {
16206      if (hasOwn(to, prop$1) && !hasOwn(from, prop$1)) {
16207        intermediate[prop$1] = to[prop$1];
16208      }
16209    }
16210
16211    var len = properties.length;
16212
16213    return function(t) {
16214      var i = len;
16215
16216      while (i--) {
16217        var prop = properties[i];
16218
16219        intermediate[prop] = interpolators[prop](t);
16220      }
16221
16222      return intermediate;
16223    };
16224  }
16225};
16226
16227var refPattern = /\[\s*(\*|[0-9]|[1-9][0-9]+)\s*\]/g;
16228var splitPattern = /([^\\](?:\\\\)*)\./;
16229var escapeKeyPattern = /\\|\./g;
16230var unescapeKeyPattern = /((?:\\)+)\1|\\(\.)/g;
16231
16232function escapeKey(key) {
16233  if (isString(key)) {
16234    return key.replace(escapeKeyPattern, '\\$&');
16235  }
16236
16237  return key;
16238}
16239
16240function normalise(ref) {
16241  return ref ? ref.replace(refPattern, '.$1') : '';
16242}
16243
16244function splitKeypath(keypath) {
16245  var result = [];
16246  var match;
16247
16248  keypath = normalise(keypath);
16249
16250  while ((match = splitPattern.exec(keypath))) {
16251    var index = match.index + match[1].length;
16252    result.push(keypath.substr(0, index));
16253    keypath = keypath.substr(index + 1);
16254  }
16255
16256  result.push(keypath);
16257
16258  return result;
16259}
16260
16261function unescapeKey(key) {
16262  if (isString(key)) {
16263    return key.replace(unescapeKeyPattern, '$1$2');
16264  }
16265
16266  return key;
16267}
16268
16269function addToArray(array, value) {
16270  var index = array.indexOf(value);
16271
16272  if (index === -1) {
16273    array.push(value);
16274  }
16275}
16276
16277function arrayContains(array, value) {
16278  for (var i = 0, c = array.length; i < c; i++) {
16279    if (array[i] == value) {
16280      return true;
16281    }
16282  }
16283
16284  return false;
16285}
16286
16287function arrayContentsMatch(a, b) {
16288  var i;
16289
16290  if (!isArray(a) || !isArray(b)) {
16291    return false;
16292  }
16293
16294  if (a.length !== b.length) {
16295    return false;
16296  }
16297
16298  i = a.length;
16299  while (i--) {
16300    if (a[i] !== b[i]) {
16301      return false;
16302    }
16303  }
16304
16305  return true;
16306}
16307
16308function ensureArray(x) {
16309  if (isString(x)) {
16310    return [x];
16311  }
16312
16313  if (isUndefined(x)) {
16314    return [];
16315  }
16316
16317  return x;
16318}
16319
16320function lastItem(array) {
16321  return array[array.length - 1];
16322}
16323
16324function removeFromArray(array, member) {
16325  if (!array) {
16326    return;
16327  }
16328
16329  var index = array.indexOf(member);
16330
16331  if (index !== -1) {
16332    array.splice(index, 1);
16333  }
16334}
16335
16336function combine() {
16337  var arrays = [], len = arguments.length;
16338  while ( len-- ) arrays[ len ] = arguments[ len ];
16339
16340  var res = arrays.concat.apply([], arrays);
16341  var i = res.length;
16342  while (i--) {
16343    var idx = res.indexOf(res[i]);
16344    if (~idx && idx < i) { res.splice(i, 1); }
16345  }
16346
16347  return res;
16348}
16349
16350function toArray(arrayLike) {
16351  var array = [];
16352  var i = arrayLike.length;
16353  while (i--) {
16354    array[i] = arrayLike[i];
16355  }
16356
16357  return array;
16358}
16359
16360function findMap(array, fn) {
16361  var len = array.length;
16362  for (var i = 0; i < len; i++) {
16363    var result = fn(array[i]);
16364    if (result) { return result; }
16365  }
16366}
16367
16368function buildNewIndices(one, two, comparator) {
16369  var oldArray = one;
16370  var newArray = two;
16371  if (comparator) {
16372    oldArray = oldArray.map(comparator);
16373    newArray = newArray.map(comparator);
16374  }
16375
16376  var oldLength = oldArray.length;
16377
16378  var usedIndices = {};
16379  var firstUnusedIndex = 0;
16380
16381  var result = oldArray.map(function (item) {
16382    var index;
16383    var start = firstUnusedIndex;
16384
16385    do {
16386      index = newArray.indexOf(item, start);
16387
16388      if (index === -1) {
16389        return -1;
16390      }
16391
16392      start = index + 1;
16393    } while (usedIndices[index] === true && start < oldLength);
16394
16395    // keep track of the first unused index, so we don't search
16396    // the whole of newArray for each item in oldArray unnecessarily
16397    if (index === firstUnusedIndex) {
16398      firstUnusedIndex += 1;
16399    }
16400    // allow next instance of next "equal" to be found item
16401    usedIndices[index] = true;
16402    return index;
16403  });
16404
16405  var len = (result.oldLen = oldArray.length);
16406  result.newLen = newArray.length;
16407
16408  if (len === result.newLen) {
16409    var i = 0;
16410    for (i; i < len; i++) {
16411      if (result[i] !== i) { break; }
16412    }
16413
16414    if (i === len) { result.same = true; }
16415  }
16416
16417  return result;
16418}
16419
16420var fnBind = Function.prototype.bind;
16421
16422function bind(fn, context) {
16423  if (!/this/.test(fn.toString())) { return fn; }
16424
16425  var bound = fnBind.call(fn, context);
16426  for (var prop in fn) { bound[prop] = fn[prop]; }
16427
16428  return bound;
16429}
16430
16431var shuffleTasks = { early: [], mark: [] };
16432var registerQueue = { early: [], mark: [] };
16433var noVirtual = { virtual: false };
16434
16435var ModelBase = function ModelBase(parent) {
16436  this.deps = [];
16437
16438  this.children = [];
16439  this.childByKey = {};
16440  this.links = [];
16441
16442  this.bindings = [];
16443
16444  if (parent) {
16445    this.parent = parent;
16446    this.root = parent.root;
16447  }
16448};
16449var ModelBase__proto__ = ModelBase.prototype;
16450
16451ModelBase__proto__.addShuffleTask = function addShuffleTask (task, stage) {
16452    if ( stage === void 0 ) stage = 'early';
16453
16454  shuffleTasks[stage].push(task);
16455};
16456ModelBase__proto__.addShuffleRegister = function addShuffleRegister (item, stage) {
16457    if ( stage === void 0 ) stage = 'early';
16458
16459  registerQueue[stage].push({ model: this, item: item });
16460};
16461
16462ModelBase__proto__.downstreamChanged = function downstreamChanged () {};
16463
16464ModelBase__proto__.findMatches = function findMatches (keys$$1) {
16465  var len = keys$$1.length;
16466
16467  var existingMatches = [this];
16468  var matches;
16469  var i;
16470
16471  var loop = function (  ) {
16472    var key = keys$$1[i];
16473
16474    if (key === '*') {
16475      matches = [];
16476      existingMatches.forEach(function (model) {
16477        matches.push.apply(matches, model.getValueChildren(model.get()));
16478      });
16479    } else {
16480      matches = existingMatches.map(function (model) { return model.joinKey(key); });
16481    }
16482
16483    existingMatches = matches;
16484  };
16485
16486    for (i = 0; i < len; i += 1) loop(  );
16487
16488  return matches;
16489};
16490
16491ModelBase__proto__.getKeypath = function getKeypath (ractive) {
16492  if (ractive !== this.ractive && this._link) { return this._link.target.getKeypath(ractive); }
16493
16494  if (!this.keypath) {
16495    var parent = this.parent && this.parent.getKeypath(ractive);
16496    this.keypath = parent
16497      ? ((this.parent.getKeypath(ractive)) + "." + (escapeKey(this.key)))
16498      : escapeKey(this.key);
16499  }
16500
16501  return this.keypath;
16502};
16503
16504ModelBase__proto__.getValueChildren = function getValueChildren (value) {
16505    var this$1 = this;
16506
16507  var children;
16508  if (isArray(value)) {
16509    children = [];
16510    if ('length' in this && this.length !== value.length) {
16511      children.push(this.joinKey('length'));
16512    }
16513    value.forEach(function (m, i) {
16514      children.push(this$1.joinKey(i));
16515    });
16516  } else if (isObject(value) || isFunction(value)) {
16517    children = keys(value).map(function (key) { return this$1.joinKey(key); });
16518  } else if (value != null) {
16519    children = [];
16520  }
16521
16522  var computed = this.computed;
16523  if (computed) {
16524    children.push.apply(children, keys(computed).map(function (k) { return this$1.joinKey(k); }));
16525  }
16526
16527  return children;
16528};
16529
16530ModelBase__proto__.getVirtual = function getVirtual (shouldCapture) {
16531    var this$1 = this;
16532
16533  var value = this.get(shouldCapture, { virtual: false });
16534  if (isObject(value)) {
16535    var result = isArray(value) ? [] : create(null);
16536
16537    var keys$$1 = keys(value);
16538    var i = keys$$1.length;
16539    while (i--) {
16540      var child = this$1.childByKey[keys$$1[i]];
16541      if (!child) { result[keys$$1[i]] = value[keys$$1[i]]; }
16542      else if (child._link) { result[keys$$1[i]] = child._link.getVirtual(); }
16543      else { result[keys$$1[i]] = child.getVirtual(); }
16544    }
16545
16546    i = this.children.length;
16547    while (i--) {
16548      var child$1 = this$1.children[i];
16549      if (!(child$1.key in result) && child$1._link) {
16550        result[child$1.key] = child$1._link.getVirtual();
16551      }
16552    }
16553
16554    if (this.computed) {
16555      keys$$1 = keys(this.computed);
16556      i = keys$$1.length;
16557      while (i--) {
16558        result[keys$$1[i]] = this$1.computed[keys$$1[i]].get();
16559      }
16560    }
16561
16562    return result;
16563  } else { return value; }
16564};
16565
16566ModelBase__proto__.has = function has (key) {
16567    var this$1 = this;
16568
16569  if (this._link) { return this._link.has(key); }
16570
16571  var value = this.get(false, noVirtual);
16572  if (!value) { return false; }
16573
16574  key = unescapeKey(key);
16575  if ((isFunction(value) || isObject(value)) && key in value) { return true; }
16576
16577  var computed = this.computed;
16578  if (computed && key in this.computed) { return true; }
16579
16580  computed = this.root.ractive && this.root.ractive.computed;
16581  if (computed) {
16582    keys(computed).forEach(function (k) {
16583      if (computed[k].pattern && computed[k].pattern.test(this$1.getKeypath())) { return true; }
16584    });
16585  }
16586
16587  return false;
16588};
16589
16590ModelBase__proto__.joinAll = function joinAll (keys$$1, opts) {
16591  var model = this;
16592  for (var i = 0; i < keys$$1.length; i += 1) {
16593    if (
16594      opts &&
16595      opts.lastLink === false &&
16596      i + 1 === keys$$1.length &&
16597      model.childByKey[keys$$1[i]] &&
16598      model.childByKey[keys$$1[i]]._link
16599    )
16600      { return model.childByKey[keys$$1[i]]; }
16601    model = model.joinKey(keys$$1[i], opts);
16602  }
16603
16604  return model;
16605};
16606
16607ModelBase__proto__.notifyUpstream = function notifyUpstream (startPath) {
16608    var this$1 = this;
16609
16610  var parent = this.parent;
16611  var path = startPath || [this.key];
16612  while (parent) {
16613    if (parent.patterns) { parent.patterns.forEach(function (o) { return o.notify(path.slice()); }); }
16614    path.unshift(parent.key);
16615    parent.links.forEach(function (l) { return l.notifiedUpstream(path, this$1.root); });
16616    parent.deps.forEach(function (d) { return d.handleChange(path); });
16617    parent.downstreamChanged(startPath);
16618    parent = parent.parent;
16619  }
16620};
16621
16622ModelBase__proto__.rebind = function rebind (next, previous, safe) {
16623    var this$1 = this;
16624
16625  if (this._link) {
16626    this._link.rebind(next, previous, false);
16627  }
16628
16629  // tell the deps to move to the new target
16630  var i = this.deps.length;
16631  while (i--) {
16632    if (this$1.deps[i].rebind) { this$1.deps[i].rebind(next, previous, safe); }
16633  }
16634
16635  i = this.links.length;
16636  while (i--) {
16637    var link = this$1.links[i];
16638    // only relink the root of the link tree
16639    if (link.owner && link.owner._link) { link.relinking(next, safe); }
16640  }
16641
16642  i = this.children.length;
16643  while (i--) {
16644    var child = this$1.children[i];
16645    child.rebind(next ? next.joinKey(child.key) : undefined, child._link || child, safe);
16646    if (this$1.dataModel) {
16647      this$1.addShuffleTask(function () { return checkDataLink(this$1, this$1.retrieve()); }, 'early');
16648    }
16649  }
16650
16651  i = this.bindings.length;
16652  while (i--) {
16653    this$1.bindings[i].rebind(next, previous, safe);
16654  }
16655};
16656
16657ModelBase__proto__.reference = function reference () {
16658  'refs' in this ? this.refs++ : (this.refs = 1);
16659};
16660
16661ModelBase__proto__.register = function register (dep) {
16662  this.deps.push(dep);
16663};
16664
16665ModelBase__proto__.registerLink = function registerLink (link) {
16666  addToArray(this.links, link);
16667};
16668
16669ModelBase__proto__.registerPatternObserver = function registerPatternObserver (observer) {
16670  (this.patterns || (this.patterns = [])).push(observer);
16671  this.register(observer);
16672};
16673
16674ModelBase__proto__.registerTwowayBinding = function registerTwowayBinding (binding) {
16675  this.bindings.push(binding);
16676};
16677
16678ModelBase__proto__.unreference = function unreference () {
16679  if ('refs' in this) { this.refs--; }
16680};
16681
16682ModelBase__proto__.unregister = function unregister (dep) {
16683  removeFromArray(this.deps, dep);
16684};
16685
16686ModelBase__proto__.unregisterLink = function unregisterLink (link) {
16687  removeFromArray(this.links, link);
16688};
16689
16690ModelBase__proto__.unregisterPatternObserver = function unregisterPatternObserver (observer) {
16691  removeFromArray(this.patterns, observer);
16692  this.unregister(observer);
16693};
16694
16695ModelBase__proto__.unregisterTwowayBinding = function unregisterTwowayBinding (binding) {
16696  removeFromArray(this.bindings, binding);
16697};
16698
16699ModelBase__proto__.updateFromBindings = function updateFromBindings$1 (cascade) {
16700    var this$1 = this;
16701
16702  var i = this.bindings.length;
16703  while (i--) {
16704    var value = this$1.bindings[i].getValue();
16705    if (value !== this$1.value) { this$1.set(value); }
16706  }
16707
16708  // check for one-way bindings if there are no two-ways
16709  if (!this.bindings.length) {
16710    var oneway = findBoundValue(this.deps);
16711    if (oneway && oneway.value !== this.value) { this.set(oneway.value); }
16712  }
16713
16714  if (cascade) {
16715    this.children.forEach(updateFromBindings);
16716    this.links.forEach(updateFromBindings);
16717    if (this._link) { this._link.updateFromBindings(cascade); }
16718  }
16719};
16720
16721// TODO: this may be better handled by overriding `get` on models with a parent that isRoot
16722function maybeBind(model, value, shouldBind) {
16723  if (shouldBind && isFunction(value) && model.parent && model.parent.isRoot) {
16724    if (!model.boundValue) {
16725      model.boundValue = bind(value._r_unbound || value, model.parent.ractive);
16726    }
16727
16728    return model.boundValue;
16729  }
16730
16731  return value;
16732}
16733
16734function updateFromBindings(model) {
16735  model.updateFromBindings(true);
16736}
16737
16738function findBoundValue(list) {
16739  var i = list.length;
16740  while (i--) {
16741    if (list[i].bound) {
16742      var owner = list[i].owner;
16743      if (owner) {
16744        var value = owner.name === 'checked' ? owner.node.checked : owner.node.value;
16745        return { value: value };
16746      }
16747    }
16748  }
16749}
16750
16751function fireShuffleTasks(stage) {
16752  if (!stage) {
16753    fireShuffleTasks('early');
16754    fireShuffleTasks('mark');
16755  } else {
16756    var tasks = shuffleTasks[stage];
16757    shuffleTasks[stage] = [];
16758    var i = tasks.length;
16759    while (i--) { tasks[i](); }
16760
16761    var register = registerQueue[stage];
16762    registerQueue[stage] = [];
16763    i = register.length;
16764    while (i--) { register[i].model.register(register[i].item); }
16765  }
16766}
16767
16768function shuffle(model, newIndices, link, unsafe) {
16769  model.shuffling = true;
16770
16771  var i = newIndices.length;
16772  while (i--) {
16773    var idx = newIndices[i];
16774    // nothing is actually changing, so move in the index and roll on
16775    if (i === idx) {
16776      continue;
16777    }
16778
16779    // rebind the children on i to idx
16780    if (i in model.childByKey)
16781      { model.childByKey[i].rebind(
16782        !~idx ? undefined : model.joinKey(idx),
16783        model.childByKey[i],
16784        !unsafe
16785      ); }
16786  }
16787
16788  var upstream = model.source().length !== model.source().value.length;
16789
16790  model.links.forEach(function (l) { return l.shuffle(newIndices); });
16791  if (!link) { fireShuffleTasks('early'); }
16792
16793  i = model.deps.length;
16794  while (i--) {
16795    if (model.deps[i].shuffle) { model.deps[i].shuffle(newIndices); }
16796  }
16797
16798  model[link ? 'marked' : 'mark']();
16799  if (!link) { fireShuffleTasks('mark'); }
16800
16801  if (upstream) { model.notifyUpstream(); }
16802
16803  model.shuffling = false;
16804}
16805
16806function checkDataLink(model, value) {
16807  if (value !== model.dataModel) {
16808    if (value && value.viewmodel && value.viewmodel.isRoot && model.childByKey.data) {
16809      model.childByKey.data.link(value.viewmodel, 'data');
16810      model.dataModel = value;
16811    } else if (model.dataModel) {
16812      model.childByKey.data.unlink();
16813      model.dataModel = true;
16814    }
16815  }
16816}
16817
16818var stack = [];
16819var captureGroup;
16820
16821function startCapturing() {
16822  stack.push((captureGroup = []));
16823}
16824
16825function stopCapturing() {
16826  var dependencies = stack.pop();
16827  captureGroup = stack[stack.length - 1];
16828  return dependencies;
16829}
16830
16831function capture(model) {
16832  if (captureGroup) {
16833    captureGroup.push(
vendor: 6,686 bytes, lines 16833-17090
16833model);
16834  }
16835}
16836
16837function bind$1(x) {
16838  x.bind();
16839}
16840function cancel(x) {
16841  x.cancel();
16842}
16843function destroyed(x) {
16844  x.destroyed();
16845}
16846function handleChange(x) {
16847  x.handleChange();
16848}
16849function mark(x) {
16850  x.mark();
16851}
16852function markForce(x) {
16853  x.mark(true);
16854}
16855function marked(x) {
16856  x.marked();
16857}
16858function markedAll(x) {
16859  x.markedAll();
16860}
16861function render(x) {
16862  x.render();
16863}
16864function shuffled(x) {
16865  x.shuffled();
16866}
16867function teardown(x) {
16868  x.teardown();
16869}
16870function unbind(x) {
16871  x.unbind();
16872}
16873function unrender(x) {
16874  x.unrender();
16875}
16876
16877function update(x) {
16878  x.update();
16879}
16880function toString$1(x) {
16881  return x.toString();
16882}
16883function toEscapedString(x) {
16884  return x.toString(true);
16885}
16886
16887// this is the dry method of checking to see if a rebind applies to
16888// a particular keypath because in some cases, a dep may be bound
16889// directly to a particular keypath e.g. foo.bars.0.baz and need
16890// to avoid getting kicked to foo.bars.1.baz if foo.bars is unshifted
16891function rebindMatch(template, next, previous, fragment) {
16892  var keypath = template.r || template;
16893
16894  // no valid keypath, go with next
16895  if (!keypath || !isString(keypath)) { return next; }
16896
16897  // completely contextual ref, go with next
16898  if (
16899    keypath === '.' ||
16900    keypath[0] === '@' ||
16901    (next || previous).isKey ||
16902    (next || previous).isKeypath
16903  )
16904    { return next; }
16905
16906  var parts = keypath.split('/');
16907  var keys = splitKeypath(parts[parts.length - 1]);
16908  var last = keys[keys.length - 1];
16909
16910  // check the keypath against the model keypath to see if it matches
16911  var model = next || previous;
16912
16913  // check to see if this was an alias
16914  if (model && keys.length === 1 && last !== model.key && fragment) {
16915    keys = findAlias(last, fragment) || keys;
16916  }
16917
16918  var i = keys.length;
16919  var match = true;
16920  var shuffling = false;
16921
16922  while (model && i--) {
16923    if (model.shuffling) { shuffling = true; }
16924    // non-strict comparison to account for indices in keypaths
16925    if (keys[i] != model.key) { match = false; }
16926    model = model.parent;
16927  }
16928
16929  // next is undefined, but keypath is shuffling and previous matches
16930  if (!next && match && shuffling) { return previous; }
16931  else if (next && !match && shuffling)
16932    // next is defined, but doesn't match the keypath
16933    { return previous; }
16934  else { return next; }
16935}
16936
16937function findAlias(name, fragment) {
16938  while (fragment) {
16939    var z = fragment.aliases;
16940    if (z && z[name]) {
16941      var aliases = (fragment.owner.iterations ? fragment.owner : fragment).owner.template.z;
16942      for (var i = 0; i < aliases.length; i++) {
16943        if (aliases[i].n === name) {
16944          var alias = aliases[i].x;
16945          if (!alias.r) { return false; }
16946          var parts = alias.r.split('/');
16947          return splitKeypath(parts[parts.length - 1]);
16948        }
16949      }
16950      return;
16951    }
16952
16953    fragment = fragment.componentParent || fragment.parent;
16954  }
16955}
16956
16957// temporary placeholder target for detached implicit links
16958var Missing = {
16959  key: '@missing',
16960  animate: noop,
16961  applyValue: noop,
16962  get: noop,
16963  getKeypath: function getKeypath() {
16964    return this.key;
16965  },
16966  joinAll: function joinAll() {
16967    return this;
16968  },
16969  joinKey: function joinKey() {
16970    return this;
16971  },
16972  mark: noop,
16973  registerLink: noop,
16974  shufle: noop,
16975  set: noop,
16976  unregisterLink: noop
16977};
16978Missing.parent = Missing;
16979
16980var LinkModel = (function (ModelBase) {
16981  function LinkModel(parent, owner, target, key) {
16982    ModelBase.call(this, parent);
16983
16984    this.owner = owner;
16985    this.target = target;
16986    this.key = isUndefined(key) ? owner.key : key;
16987    if (owner && owner.isLink) { this.sourcePath = (owner.sourcePath) + "." + (this.key); }
16988
16989    if (target) { target.registerLink(this); }
16990
16991    if (parent) { this.isReadonly = parent.isReadonly; }
16992
16993    this.isLink = true;
16994  }
16995
16996  if ( ModelBase ) LinkModel.__proto__ = ModelBase;
16997  var LinkModel__proto__ = LinkModel.prototype = Object.create( ModelBase && ModelBase.prototype );
16998  LinkModel__proto__.constructor = LinkModel;
16999
17000  LinkModel__proto__.animate = function animate (from, to, options, interpolator) {
17001    return this.target.animate(from, to, options, interpolator);
17002  };
17003
17004  LinkModel__proto__.applyValue = function applyValue (value) {
17005    if (this.boundValue) { this.boundValue = null; }
17006    this.target.applyValue(value);
17007  };
17008
17009  LinkModel__proto__.attach = function attach (fragment) {
17010    var model = resolveReference(fragment, this.key);
17011    if (model) {
17012      this.relinking(model, false);
17013    } else {
17014      // if there is no link available, move everything here to real models
17015      this.owner.unlink();
17016    }
17017  };
17018
17019  LinkModel__proto__.detach = function detach () {
17020    this.relinking(Missing, false);
17021  };
17022
17023  LinkModel__proto__.get = function get (shouldCapture, opts) {
17024    if ( opts === void 0 ) opts = {};
17025
17026    if (shouldCapture) {
17027      capture(this);
17028
17029      // may need to tell the target to unwrap
17030      opts.unwrap = 'unwrap' in opts ? opts.unwrap : true;
17031    }
17032
17033    var bind = 'shouldBind' in opts ? opts.shouldBind : true;
17034    opts.shouldBind = this.mapping && this.target.parent && this.target.parent.isRoot;
17035
17036    return maybeBind(this, this.target.get(false, opts), bind);
17037  };
17038
17039  LinkModel__proto__.getKeypath = function getKeypath (ractive) {
17040    if (ractive && ractive !== this.root.ractive) { return this.target.getKeypath(ractive); }
17041
17042    return ModelBase.prototype.getKeypath.call(this, ractive);
17043  };
17044
17045  LinkModel__proto__.handleChange = function handleChange$1 () {
17046    this.deps.forEach(handleChange);
17047    this.links.forEach(handleChange);
17048    this.notifyUpstream();
17049  };
17050
17051  LinkModel__proto__.isDetached = function isDetached () {
17052    return this.virtual && this.target === Missing;
17053  };
17054
17055  LinkModel__proto__.joinKey = function joinKey (key) {
17056    // TODO: handle nested links
17057    if (isUndefined(key) || key === '') { return this; }
17058
17059    if (!hasOwn(this.childByKey, key)) {
17060      var child = new LinkModel(this, this, this.target.joinKey(key), key);
17061      this.children.push(child);
17062      this.childByKey[key] = child;
17063    }
17064
17065    return this.childByKey[key];
17066  };
17067
17068  LinkModel__proto__.mark = function mark (force) {
17069    this.target.mark(force);
17070  };
17071
17072  LinkModel__proto__.marked = function marked$1 () {
17073    if (this.boundValue) { this.boundValue = null; }
17074
17075    this.links.forEach(marked);
17076
17077    this.deps.forEach(handleChange);
17078  };
17079
17080  LinkModel__proto__.markedAll = function markedAll$1 () {
17081    this.children.forEach(markedAll);
17082    this.marked();
17083  };
17084
17085  LinkModel__proto__.notifiedUpstream = function notifiedUpstream (startPath, root) {
17086    var this$1 = this;
17087
17088    this.links.forEach(function (l) { return l.notifiedUpstream(startPath, this$1.root); });
17089    this.deps.forEach(handleChange);
17090    if (startPath && this.rootLink
vendor: 10,548 bytes, lines 17090-17556
17090 && this.root !== root) {
17091      var path = startPath.slice(1);
17092      path.unshift(this.key);
17093      this.notifyUpstream(path);
17094    }
17095  };
17096
17097  LinkModel__proto__.relinked = function relinked () {
17098    this.target.registerLink(this);
17099    this.children.forEach(function (c) { return c.relinked(); });
17100  };
17101
17102  LinkModel__proto__.relinking = function relinking (target, safe) {
17103    var this$1 = this;
17104
17105    if (this.rootLink && this.sourcePath)
17106      { target = rebindMatch(this.sourcePath, target, this.target); }
17107    if (!target || this.target === target) { return; }
17108
17109    this.target && this.target.unregisterLink(this);
17110
17111    this.target = target;
17112    this.children.forEach(function (c) {
17113      c.relinking(target.joinKey(c.key), safe);
17114    });
17115
17116    if (this.rootLink)
17117      { this.addShuffleTask(function () {
17118        this$1.relinked();
17119        if (!safe) {
17120          this$1.markedAll();
17121          this$1.notifyUpstream();
17122        }
17123      }); }
17124  };
17125
17126  LinkModel__proto__.set = function set (value) {
17127    if (this.boundValue) { this.boundValue = null; }
17128    this.target.set(value);
17129  };
17130
17131  LinkModel__proto__.shuffle = function shuffle$1 (newIndices) {
17132    // watch for extra shuffles caused by a shuffle in a downstream link
17133    if (this.shuffling) { return; }
17134
17135    // let the real model handle firing off shuffles
17136    if (!this.target.shuffling) {
17137      if (this.target.shuffle) {
17138        this.target.shuffle(newIndices);
17139      } else {
17140        // the target is a computation, which can't shuffle
17141        this.target.mark();
17142      }
17143    } else {
17144      shuffle(this, newIndices, true);
17145    }
17146  };
17147
17148  LinkModel__proto__.source = function source () {
17149    if (this.target.source) { return this.target.source(); }
17150    else { return this.target; }
17151  };
17152
17153  LinkModel__proto__.teardown = function teardown$3 () {
17154    if (this._link) { this._link.teardown(); }
17155    this.target.unregisterLink(this);
17156    this.children.forEach(teardown);
17157  };
17158
17159  return LinkModel;
17160}(ModelBase));
17161
17162ModelBase.prototype.link = function link(model, keypath, options) {
17163  var lnk = this._link || new LinkModel(this.parent, this, model, this.key);
17164  lnk.implicit = options && options.implicit;
17165  lnk.mapping = options && options.mapping;
17166  lnk.sourcePath = keypath;
17167  lnk.rootLink = true;
17168  if (this._link) { this._link.relinking(model, false); }
17169  this.rebind(lnk, this, false);
17170  fireShuffleTasks();
17171
17172  this._link = lnk;
17173  lnk.markedAll();
17174
17175  this.notifyUpstream();
17176  return lnk;
17177};
17178
17179ModelBase.prototype.unlink = function unlink() {
17180  if (this._link) {
17181    var ln = this._link;
17182    this._link = undefined;
17183    ln.rebind(this, ln, false);
17184    fireShuffleTasks();
17185    ln.teardown();
17186    this.notifyUpstream();
17187  }
17188};
17189
17190function fromExpression(body, length) {
17191  if ( length === void 0 ) length = 0;
17192
17193  var args = new Array(length);
17194
17195  while (length--) {
17196    args[length] = "_" + length;
17197  }
17198
17199  // Functions created directly with new Function() look like this:
17200  //     function anonymous (_0 /**/) { return _0*2 }
17201  //
17202  // With this workaround, we get a little more compact:
17203  //     function (_0){return _0*2}
17204  return new Function([], ("return function (" + (args.join(',')) + "){return(" + body + ");};"))();
17205}
17206
17207var functions = create(null);
17208
17209function getFunction(str, i) {
17210  if (functions[str]) { return functions[str]; }
17211  return (functions[str] = createFunction(str, i));
17212}
17213
17214function addFunctions(template) {
17215  if (!template) { return; }
17216
17217  var exp = template.e;
17218
17219  if (!exp) { return; }
17220
17221  keys(exp).forEach(function (str) {
17222    if (functions[str]) { return; }
17223    functions[str] = exp[str];
17224  });
17225}
17226
17227var TEMPLATE_VERSION = 4;
17228
17229var leadingWhitespace = /^\s+/;
17230
17231var ParseError = function(message) {
17232  this.name = 'ParseError';
17233  this.message = message;
17234  try {
17235    throw new Error(message);
17236  } catch (e) {
17237    this.stack = e.stack;
17238  }
17239};
17240
17241ParseError.prototype = Error.prototype;
17242
17243var Parser = function(str, options) {
17244  var item;
17245  var lineStart = 0;
17246
17247  this.str = str;
17248  this.options = options || {};
17249  this.pos = 0;
17250
17251  this.lines = this.str.split('\n');
17252  this.lineEnds = this.lines.map(function (line) {
17253    var lineEnd = lineStart + line.length + 1; // +1 for the newline
17254
17255    lineStart = lineEnd;
17256    return lineEnd;
17257  }, 0);
17258
17259  // Custom init logic
17260  if (this.init) { this.init(str, options); }
17261
17262  var items = [];
17263
17264  while (this.pos < this.str.length && (item = this.read())) {
17265    items.push(item);
17266  }
17267
17268  this.leftover = this.remaining();
17269  this.result = this.postProcess ? this.postProcess(items, options) : items;
17270};
17271
17272Parser.prototype = {
17273  read: function read(converters) {
17274    var this$1 = this;
17275
17276    var i, item;
17277
17278    if (!converters) { converters = this.converters; }
17279
17280    var pos = this.pos;
17281
17282    var len = converters.length;
17283    for (i = 0; i < len; i += 1) {
17284      this$1.pos = pos; // reset for each attempt
17285
17286      if ((item = converters[i](this$1))) {
17287        return item;
17288      }
17289    }
17290
17291    return null;
17292  },
17293
17294  getContextMessage: function getContextMessage(pos, message) {
17295    var ref = this.getLinePos(pos);
17296    var lineNum = ref[0];
17297    var columnNum = ref[1];
17298    if (this.options.contextLines === -1) {
17299      return [lineNum, columnNum, (message + " at line " + lineNum + " character " + columnNum)];
17300    }
17301
17302    var line = this.lines[lineNum - 1];
17303
17304    var contextUp = '';
17305    var contextDown = '';
17306    if (this.options.contextLines) {
17307      var start =
17308        lineNum - 1 - this.options.contextLines < 0 ? 0 : lineNum - 1 - this.options.contextLines;
17309      contextUp = this.lines
17310        .slice(start, lineNum - 1 - start)
17311        .join('\n')
17312        .replace(/\t/g, '  ');
17313      contextDown = this.lines
17314        .slice(lineNum, lineNum + this.options.contextLines)
17315        .join('\n')
17316        .replace(/\t/g, '  ');
17317      if (contextUp) {
17318        contextUp += '\n';
17319      }
17320      if (contextDown) {
17321        contextDown = '\n' + contextDown;
17322      }
17323    }
17324
17325    var numTabs = 0;
17326    var annotation =
17327      contextUp +
17328      line.replace(/\t/g, function (match, char) {
17329        if (char < columnNum) {
17330          numTabs += 1;
17331        }
17332
17333        return '  ';
17334      }) +
17335      '\n' +
17336      new Array(columnNum + numTabs).join(' ') +
17337      '^----' +
17338      contextDown;
17339
17340    return [
17341      lineNum,
17342      columnNum,
17343      (message + " at line " + lineNum + " character " + columnNum + ":\n" + annotation)
17344    ];
17345  },
17346
17347  getLinePos: function getLinePos(char) {
17348    var this$1 = this;
17349
17350    var lineNum = 0;
17351    var lineStart = 0;
17352
17353    while (char >= this.lineEnds[lineNum]) {
17354      lineStart = this$1.lineEnds[lineNum];
17355      lineNum += 1;
17356    }
17357
17358    var columnNum = char - lineStart;
17359    return [lineNum + 1, columnNum + 1, char]; // line/col should be one-based, not zero-based!
17360  },
17361
17362  error: function error(message) {
17363    var ref = this.getContextMessage(this.pos, message);
17364    var lineNum = ref[0];
17365    var columnNum = ref[1];
17366    var msg = ref[2];
17367
17368    var error = new ParseError(msg);
17369
17370    error.line = lineNum;
17371    error.character = columnNum;
17372    error.shortMessage = message;
17373
17374    throw error;
17375  },
17376
17377  matchString: function matchString(string) {
17378    if (this.str.substr(this.pos, string.length) === string) {
17379      this.pos += string.length;
17380      return string;
17381    }
17382  },
17383
17384  matchPattern: function matchPattern(pattern) {
17385    var match;
17386
17387    if ((match = pattern.exec(this.remaining()))) {
17388      this.pos += match[0].length;
17389      return match[1] || match[0];
17390    }
17391  },
17392
17393  sp: function sp() {
17394    this.matchPattern(leadingWhitespace);
17395  },
17396
17397  remaining: function remaining() {
17398    return this.str.substring(this.pos);
17399  },
17400
17401  nextChar: function nextChar() {
17402    return this.str.charAt(this.pos);
17403  },
17404
17405  warn: function warn(message) {
17406    var msg = this.getContextMessage(this.pos, message)[2];
17407
17408    warnIfDebug(msg);
17409  }
17410};
17411
17412Parser.extend = function(proto) {
17413  var Parent = this;
17414  var Child = function(str, options) {
17415    Parser.call(this, str, options);
17416  };
17417
17418  Child.prototype = create(Parent.prototype);
17419
17420  for (var key in proto) {
17421    if (hasOwn(proto, key)) {
17422      Child.prototype[key] = proto[key];
17423    }
17424  }
17425
17426  Child.extend = Parser.extend;
17427  return Child;
17428};
17429
17430var TEXT = 1;
17431var INTERPOLATOR = 2;
17432var TRIPLE = 3;
17433var SECTION = 4;
17434var INVERTED = 5;
17435var CLOSING = 6;
17436var ELEMENT = 7;
17437var PARTIAL = 8;
17438var COMMENT = 9;
17439var DELIMCHANGE = 10;
17440var ANCHOR = 11;
17441var ATTRIBUTE = 13;
17442var CLOSING_TAG = 14;
17443var COMPONENT = 15;
17444var YIELDER = 16;
17445var INLINE_PARTIAL = 17;
17446var DOCTYPE = 18;
17447var ALIAS = 19;
17448
17449var AWAIT = 55;
17450
17451var NUMBER_LITERAL = 20;
17452var STRING_LITERAL = 21;
17453var ARRAY_LITERAL = 22;
17454var OBJECT_LITERAL = 23;
17455var BOOLEAN_LITERAL = 24;
17456var REGEXP_LITERAL = 25;
17457
17458var GLOBAL = 26;
17459var KEY_VALUE_PAIR = 27;
17460
17461var REFERENCE = 30;
17462var REFINEMENT = 31;
17463var MEMBER = 32;
17464var PREFIX_OPERATOR = 33;
17465var BRACKETED = 34;
17466var CONDITIONAL = 35;
17467var INFIX_OPERATOR = 36;
17468
17469var INVOCATION = 40;
17470
17471var SECTION_IF = 50;
17472var SECTION_UNLESS = 51;
17473var SECTION_EACH = 52;
17474var SECTION_WITH = 53;
17475var SECTION_IF_WITH = 54;
17476
17477var ELSE = 60;
17478var ELSEIF = 61;
17479var THEN = 62;
17480var CATCH = 63;
17481
17482var EVENT = 70;
17483var DECORATOR = 71;
17484var TRANSITION = 72;
17485var BINDING_FLAG = 73;
17486var DELEGATE_FLAG = 74;
17487
17488var delimiterChangePattern = /^[^\s=]+/;
17489var whitespacePattern = /^\s+/;
17490
17491function readDelimiterChange(parser) {
17492  if (!parser.matchString('=')) {
17493    return null;
17494  }
17495
17496  var start = parser.pos;
17497
17498  // allow whitespace before new opening delimiter
17499  parser.sp();
17500
17501  var opening = parser.matchPattern(delimiterChangePattern);
17502  if (!opening) {
17503    parser.pos = start;
17504    return null;
17505  }
17506
17507  // allow whitespace (in fact, it's necessary...)
17508  if (!parser.matchPattern(whitespacePattern)) {
17509    return null;
17510  }
17511
17512  var closing = parser.matchPattern(delimiterChangePattern);
17513  if (!closing) {
17514    parser.pos = start;
17515    return null;
17516  }
17517
17518  // allow whitespace before closing '='
17519  parser.sp();
17520
17521  if (!parser.matchString('=')) {
17522    parser.pos = start;
17523    return null;
17524  }
17525
17526  return [opening, closing];
17527}
17528
17529var regexpPattern = /^(\/(?:[^\n\r\u2028\u2029/\\[]|\\.|\[(?:[^\n\r\u2028\u2029\]\\]|\\.)*])+\/(?:([gimuy])(?![a-z]*\2))*(?![a-zA-Z_$0-9]))/;
17530
17531function readNumberLiteral(parser) {
17532  var result;
17533
17534  if ((result = parser.matchPattern(regexpPattern))) {
17535    return {
17536      t: REGEXP_LITERAL,
17537      v: result
17538    };
17539  }
17540
17541  return null;
17542}
17543
17544var pattern = /[-/\\^$*+?.()|[\]{}]/g;
17545
17546function escapeRegExp(str) {
17547  return str.replace(pattern, '\\$&');
17548}
17549
17550var regExpCache = {};
17551
17552function getLowestIndex(haystack, needles) {
17553  return haystack.search(
17554    regExpCache[needles.join()] ||
17555      (regExpCache[needles.join()] = new RegExp(needles.map(escapeRegExp).join('|')))
17556  )
vendor: 7,576 bytes, lines 17556-18010
17556;
17557}
17558
17559// https://github.com/kangax/html-minifier/issues/63#issuecomment-37763316
17560//export const booleanAttributes = /^(allowFullscreen|async|autofocus|autoplay|checked|compact|controls|declare|default|defaultChecked|defaultMuted|defaultSelected|defer|disabled|enabled|formNoValidate|hidden|indeterminate|inert|isMap|itemScope|loop|multiple|muted|noHref|noResize|noShade|noValidate|noWrap|open|pauseOnExit|readOnly|required|reversed|scoped|seamless|selected|sortable|translate|trueSpeed|typeMustMatch|visible)$/i;
17561var booleanAttributes = {
17562  allowfullscreen: 1,
17563  async: 1,
17564  autofocus: 1,
17565  autoplay: 1,
17566  checked: 1,
17567  compact: 1,
17568  controls: 1,
17569  declare: 1,
17570  default: 1,
17571  defaultchecked: 1,
17572  defaultmuted: 1,
17573  defaultselected: 1,
17574  defer: 1,
17575  disabled: 1,
17576  enabled: 1,
17577  formnovalidate: 1,
17578  hidden: 1,
17579  indeterminate: 1,
17580  inert: 1,
17581  ismap: 1,
17582  itemscope: 1,
17583  loop: 1,
17584  multiple: 1,
17585  muted: 1,
17586  nohref: 1,
17587  noresize: 1,
17588  noshade: 1,
17589  novalidate: 1,
17590  nowrap: 1,
17591  open: 1,
17592  pauseonexit: 1,
17593  readonly: 1,
17594  required: 1,
17595  reversed: 1,
17596  scoped: 1,
17597  seamless: 1,
17598  selected: 1,
17599  sortable: 1,
17600  translate: 1,
17601  truespeed: 1,
17602  typemustmatch: 1,
17603  visible: 1
17604};
17605var voidElements = {
17606  area: 1,
17607  base: 1,
17608  br: 1,
17609  col: 1,
17610  command: 1,
17611  doctype: 1,
17612  embed: 1,
17613  hr: 1,
17614  img: 1,
17615  input: 1,
17616  keygen: 1,
17617  link: 1,
17618  meta: 1,
17619  param: 1,
17620  source: 1,
17621  track: 1,
17622  wbr: 1
17623};
17624
17625var htmlEntities = {
17626  quot: 34,
17627  amp: 38,
17628  apos: 39,
17629  lt: 60,
17630  gt: 62,
17631  nbsp: 160,
17632  iexcl: 161,
17633  cent: 162,
17634  pound: 163,
17635  curren: 164,
17636  yen: 165,
17637  brvbar: 166,
17638  sect: 167,
17639  uml: 168,
17640  copy: 169,
17641  ordf: 170,
17642  laquo: 171,
17643  not: 172,
17644  shy: 173,
17645  reg: 174,
17646  macr: 175,
17647  deg: 176,
17648  plusmn: 177,
17649  sup2: 178,
17650  sup3: 179,
17651  acute: 180,
17652  micro: 181,
17653  para: 182,
17654  middot: 183,
17655  cedil: 184,
17656  sup1: 185,
17657  ordm: 186,
17658  raquo: 187,
17659  frac14: 188,
17660  frac12: 189,
17661  frac34: 190,
17662  iquest: 191,
17663  Agrave: 192,
17664  Aacute: 193,
17665  Acirc: 194,
17666  Atilde: 195,
17667  Auml: 196,
17668  Aring: 197,
17669  AElig: 198,
17670  Ccedil: 199,
17671  Egrave: 200,
17672  Eacute: 201,
17673  Ecirc: 202,
17674  Euml: 203,
17675  Igrave: 204,
17676  Iacute: 205,
17677  Icirc: 206,
17678  Iuml: 207,
17679  ETH: 208,
17680  Ntilde: 209,
17681  Ograve: 210,
17682  Oacute: 211,
17683  Ocirc: 212,
17684  Otilde: 213,
17685  Ouml: 214,
17686  times: 215,
17687  Oslash: 216,
17688  Ugrave: 217,
17689  Uacute: 218,
17690  Ucirc: 219,
17691  Uuml: 220,
17692  Yacute: 221,
17693  THORN: 222,
17694  szlig: 223,
17695  agrave: 224,
17696  aacute: 225,
17697  acirc: 226,
17698  atilde: 227,
17699  auml: 228,
17700  aring: 229,
17701  aelig: 230,
17702  ccedil: 231,
17703  egrave: 232,
17704  eacute: 233,
17705  ecirc: 234,
17706  euml: 235,
17707  igrave: 236,
17708  iacute: 237,
17709  icirc: 238,
17710  iuml: 239,
17711  eth: 240,
17712  ntilde: 241,
17713  ograve: 242,
17714  oacute: 243,
17715  ocirc: 244,
17716  otilde: 245,
17717  ouml: 246,
17718  divide: 247,
17719  oslash: 248,
17720  ugrave: 249,
17721  uacute: 250,
17722  ucirc: 251,
17723  uuml: 252,
17724  yacute: 253,
17725  thorn: 254,
17726  yuml: 255,
17727  OElig: 338,
17728  oelig: 339,
17729  Scaron: 352,
17730  scaron: 353,
17731  Yuml: 376,
17732  fnof: 402,
17733  circ: 710,
17734  tilde: 732,
17735  Alpha: 913,
17736  Beta: 914,
17737  Gamma: 915,
17738  Delta: 916,
17739  Epsilon: 917,
17740  Zeta: 918,
17741  Eta: 919,
17742  Theta: 920,
17743  Iota: 921,
17744  Kappa: 922,
17745  Lambda: 923,
17746  Mu: 924,
17747  Nu: 925,
17748  Xi: 926,
17749  Omicron: 927,
17750  Pi: 928,
17751  Rho: 929,
17752  Sigma: 931,
17753  Tau: 932,
17754  Upsilon: 933,
17755  Phi: 934,
17756  Chi: 935,
17757  Psi: 936,
17758  Omega: 937,
17759  alpha: 945,
17760  beta: 946,
17761  gamma: 947,
17762  delta: 948,
17763  epsilon: 949,
17764  zeta: 950,
17765  eta: 951,
17766  theta: 952,
17767  iota: 953,
17768  kappa: 954,
17769  lambda: 955,
17770  mu: 956,
17771  nu: 957,
17772  xi: 958,
17773  omicron: 959,
17774  pi: 960,
17775  rho: 961,
17776  sigmaf: 962,
17777  sigma: 963,
17778  tau: 964,
17779  upsilon: 965,
17780  phi: 966,
17781  chi: 967,
17782  psi: 968,
17783  omega: 969,
17784  thetasym: 977,
17785  upsih: 978,
17786  piv: 982,
17787  ensp: 8194,
17788  emsp: 8195,
17789  thinsp: 8201,
17790  zwnj: 8204,
17791  zwj: 8205,
17792  lrm: 8206,
17793  rlm: 8207,
17794  ndash: 8211,
17795  mdash: 8212,
17796  lsquo: 8216,
17797  rsquo: 8217,
17798  sbquo: 8218,
17799  ldquo: 8220,
17800  rdquo: 8221,
17801  bdquo: 8222,
17802  dagger: 8224,
17803  Dagger: 8225,
17804  bull: 8226,
17805  hellip: 8230,
17806  permil: 8240,
17807  prime: 8242,
17808  Prime: 8243,
17809  lsaquo: 8249,
17810  rsaquo: 8250,
17811  oline: 8254,
17812  frasl: 8260,
17813  euro: 8364,
17814  image: 8465,
17815  weierp: 8472,
17816  real: 8476,
17817  trade: 8482,
17818  alefsym: 8501,
17819  larr: 8592,
17820  uarr: 8593,
17821  rarr: 8594,
17822  darr: 8595,
17823  harr: 8596,
17824  crarr: 8629,
17825  lArr: 8656,
17826  uArr: 8657,
17827  rArr: 8658,
17828  dArr: 8659,
17829  hArr: 8660,
17830  forall: 8704,
17831  part: 8706,
17832  exist: 8707,
17833  empty: 8709,
17834  nabla: 8711,
17835  isin: 8712,
17836  notin: 8713,
17837  ni: 8715,
17838  prod: 8719,
17839  sum: 8721,
17840  minus: 8722,
17841  lowast: 8727,
17842  radic: 8730,
17843  prop: 8733,
17844  infin: 8734,
17845  ang: 8736,
17846  and: 8743,
17847  or: 8744,
17848  cap: 8745,
17849  cup: 8746,
17850  int: 8747,
17851  there4: 8756,
17852  sim: 8764,
17853  cong: 8773,
17854  asymp: 8776,
17855  ne: 8800,
17856  equiv: 8801,
17857  le: 8804,
17858  ge: 8805,
17859  sub: 8834,
17860  sup: 8835,
17861  nsub: 8836,
17862  sube: 8838,
17863  supe: 8839,
17864  oplus: 8853,
17865  otimes: 8855,
17866  perp: 8869,
17867  sdot: 8901,
17868  lceil: 8968,
17869  rceil: 8969,
17870  lfloor: 8970,
17871  rfloor: 8971,
17872  lang: 9001,
17873  rang: 9002,
17874  loz: 9674,
17875  spades: 9824,
17876  clubs: 9827,
17877  hearts: 9829,
17878  diams: 9830
17879};
17880var controlCharacters = [
17881  8364,
17882  129,
17883  8218,
17884  402,
17885  8222,
17886  8230,
17887  8224,
17888  8225,
17889  710,
17890  8240,
17891  352,
17892  8249,
17893  338,
17894  141,
17895  381,
17896  143,
17897  144,
17898  8216,
17899  8217,
17900  8220,
17901  8221,
17902  8226,
17903  8211,
17904  8212,
17905  732,
17906  8482,
17907  353,
17908  8250,
17909  339,
17910  157,
17911  382,
17912  376
17913];
17914var entityPattern = new RegExp(
17915  '&(#?(?:x[\\w\\d]+|\\d+|' + keys(htmlEntities).join('|') + '));?',
17916  'g'
17917);
17918var codePointSupport = isFunction(String.fromCodePoint);
17919var codeToChar = codePointSupport ? String.fromCodePoint : String.fromCharCode;
17920
17921function decodeCharacterReferences(html) {
17922  return html.replace(entityPattern, function (match, entity) {
17923    var code;
17924
17925    // Handle named entities
17926    if (entity[0] !== '#') {
17927      code = htmlEntities[entity];
17928    } else if (entity[1] === 'x') {
17929      code = parseInt(entity.substring(2), 16);
17930    } else {
17931      code = parseInt(entity.substring(1), 10);
17932    }
17933
17934    if (!code) {
17935      return match;
17936    }
17937
17938    return codeToChar(validateCode(code));
17939  });
17940}
17941
17942var lessThan = /</g;
17943var greaterThan = />/g;
17944var amp = /&/g;
17945var invalid = 65533;
17946
17947function escapeHtml(str) {
17948  return str
17949    .replace(amp, '&amp;')
17950    .replace(lessThan, '&lt;')
17951    .replace(greaterThan, '&gt;');
17952}
17953
17954// some code points are verboten. If we were inserting HTML, the browser would replace the illegal
17955// code points with alternatives in some cases - since we're bypassing that mechanism, we need
17956// to replace them ourselves
17957//
17958// Source: http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Illegal_characters
17959/* istanbul ignore next */
17960function validateCode(code) {
17961  if (!code) {
17962    return invalid;
17963  }
17964
17965  // line feed becomes generic whitespace
17966  if (code === 10) {
17967    return 32;
17968  }
17969
17970  // ASCII range. (Why someone would use HTML entities for ASCII characters I don't know, but...)
17971  if (code < 128) {
17972    return code;
17973  }
17974
17975  // code points 128-159 are dealt with leniently by browsers, but they're incorrect. We need
17976  // to correct the mistake or we'll end up with missing € signs and so on
17977  if (code <= 159) {
17978    return controlCharacters[code - 128];
17979  }
17980
17981  // basic multilingual plane
17982  if (code < 55296) {
17983    return code;
17984  }
17985
17986  // UTF-16 surrogate halves
17987  if (code <= 57343) {
17988    return invalid;
17989  }
17990
17991  // rest of the basic multilingual plane
17992  if (code <= 65535) {
17993    return code;
17994  } else if (!codePointSupport) {
17995    return invalid;
17996  }
17997
17998  // supplementary multilingual plane 0x10000 - 0x1ffff
17999  if (code >= 65536 && code <= 131071) {
18000    return code;
18001  }
18002
18003  // supplementary ideographic plane 0x20000 - 0x2ffff
18004  if (code >= 131072 && code <= 196607) {
18005    return code;
18006  }
18007
18008  return invalid;
18009}
18010
vendor: 10,452 bytes, lines 18011-18441
18011var expectedExpression = 'Expected a JavaScript expression';
18012var expectedParen = 'Expected closing paren';
18013
18014// bulletproof number regex from https://gist.github.com/Rich-Harris/7544330
18015var numberPattern = /^(?:[+-]?)0*(?:(?:(?:[1-9]\d*)?\.\d+)|(?:(?:0|[1-9]\d*)\.)|(?:0|[1-9]\d*))(?:[eE][+-]?\d+)?/;
18016
18017function readNumberLiteral$1(parser) {
18018  var result;
18019
18020  if ((result = parser.matchPattern(numberPattern))) {
18021    return {
18022      t: NUMBER_LITERAL,
18023      v: result
18024    };
18025  }
18026
18027  return null;
18028}
18029
18030function readBooleanLiteral(parser) {
18031  var remaining = parser.remaining();
18032
18033  if (remaining.substr(0, 4) === 'true') {
18034    parser.pos += 4;
18035    return {
18036      t: BOOLEAN_LITERAL,
18037      v: 'true'
18038    };
18039  }
18040
18041  if (remaining.substr(0, 5) === 'false') {
18042    parser.pos += 5;
18043    return {
18044      t: BOOLEAN_LITERAL,
18045      v: 'false'
18046    };
18047  }
18048
18049  return null;
18050}
18051
18052// Match one or more characters until: ", ', \, or EOL/EOF.
18053// EOL/EOF is written as (?!.) (meaning there's no non-newline char next).
18054var stringMiddlePattern = /^(?=.)[^"'\\]+?(?:(?!.)|(?=["'\\]))/;
18055
18056// Match one escape sequence, including the backslash.
18057var escapeSequencePattern = /^\\(?:[`'"\\bfnrt]|0(?![0-9])|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|(?=.)[^ux0-9])/;
18058
18059// Match one ES5 line continuation (backslash + line terminator).
18060var lineContinuationPattern = /^\\(?:\r\n|[\u000A\u000D\u2028\u2029])/;
18061
18062// Helper for defining getDoubleQuotedString and getSingleQuotedString.
18063function makeQuotedStringMatcher(okQuote) {
18064  return function(parser) {
18065    var literal = '"';
18066    var done = false;
18067    var next;
18068
18069    while (!done) {
18070      next =
18071        parser.matchPattern(stringMiddlePattern) ||
18072        parser.matchPattern(escapeSequencePattern) ||
18073        parser.matchString(okQuote);
18074      if (next) {
18075        if (next === "\"") {
18076          literal += "\\\"";
18077        } else if (next === "\\'") {
18078          literal += "'";
18079        } else {
18080          literal += next;
18081        }
18082      } else {
18083        next = parser.matchPattern(lineContinuationPattern);
18084        if (next) {
18085          // convert \(newline-like) into a \u escape, which is allowed in JSON
18086          literal += '\\u' + ('000' + next.charCodeAt(1).toString(16)).slice(-4);
18087        } else {
18088          done = true;
18089        }
18090      }
18091    }
18092
18093    literal += '"';
18094
18095    // use JSON.parse to interpret escapes
18096    return JSON.parse(literal);
18097  };
18098}
18099
18100var singleMatcher = makeQuotedStringMatcher("\"");
18101var doubleMatcher = makeQuotedStringMatcher("'");
18102
18103function readStringLiteral(parser) {
18104  var start = parser.pos;
18105  var quote = parser.matchString("'") || parser.matchString("\"");
18106
18107  if (quote) {
18108    var string = (quote === "'" ? singleMatcher : doubleMatcher)(parser);
18109
18110    if (!parser.matchString(quote)) {
18111      parser.pos = start;
18112      return null;
18113    }
18114
18115    return {
18116      t: STRING_LITERAL,
18117      v: string
18118    };
18119  }
18120
18121  return null;
18122}
18123
18124// Match one or more characters until: ", ', or \
18125var stringMiddlePattern$1 = /^[^`"\\\$]+?(?:(?=[`"\\\$]))/;
18126
18127var escapes = /[\r\n\t\b\f]/g;
18128function getString(literal) {
18129  return JSON.parse(("\"" + (literal.replace(escapes, escapeChar)) + "\""));
18130}
18131
18132function escapeChar(c) {
18133  switch (c) {
18134    case '\n':
18135      return '\\n';
18136    case '\r':
18137      return '\\r';
18138    case '\t':
18139      return '\\t';
18140    case '\b':
18141      return '\\b';
18142    case '\f':
18143      return '\\f';
18144  }
18145}
18146
18147function readTemplateStringLiteral(parser) {
18148  if (!parser.matchString('`')) { return null; }
18149
18150  var literal = '';
18151  var done = false;
18152  var next;
18153  var parts = [];
18154
18155  while (!done) {
18156    next =
18157      parser.matchPattern(stringMiddlePattern$1) ||
18158      parser.matchPattern(escapeSequencePattern) ||
18159      parser.matchString('$') ||
18160      parser.matchString('"');
18161    if (next) {
18162      if (next === "\"") {
18163        literal += "\\\"";
18164      } else if (next === '\\`') {
18165        literal += '`';
18166      } else if (next === '$') {
18167        if (parser.matchString('{')) {
18168          parts.push({ t: STRING_LITERAL, v: getString(literal) });
18169          literal = '';
18170
18171          parser.sp();
18172          var expr = readExpression(parser);
18173
18174          if (!expr) { parser.error('Expected valid expression'); }
18175
18176          parts.push({ t: BRACKETED, x: expr });
18177
18178          parser.sp();
18179          if (!parser.matchString('}'))
18180            { parser.error("Expected closing '}' after interpolated expression"); }
18181        } else {
18182          literal += '$';
18183        }
18184      } else {
18185        literal += next;
18186      }
18187    } else {
18188      next = parser.matchPattern(lineContinuationPattern);
18189      if (next) {
18190        // convert \(newline-like) into a \u escape, which is allowed in JSON
18191        literal += '\\u' + ('000' + next.charCodeAt(1).toString(16)).slice(-4);
18192      } else {
18193        done = true;
18194      }
18195    }
18196  }
18197
18198  if (literal.length) { parts.push({ t: STRING_LITERAL, v: getString(literal) }); }
18199
18200  if (!parser.matchString('`')) { parser.error("Expected closing '`'"); }
18201
18202  if (parts.length === 1) {
18203    return parts[0];
18204  } else {
18205    var result = parts.pop();
18206    var part;
18207
18208    while ((part = parts.pop())) {
18209      result = {
18210        t: INFIX_OPERATOR,
18211        s: '+',
18212        o: [part, result]
18213      };
18214    }
18215
18216    return {
18217      t: BRACKETED,
18218      x: result
18219    };
18220  }
18221}
18222
18223var name = /^[a-zA-Z_$][a-zA-Z_$0-9]*/;
18224var spreadPattern = /^\s*\.{3}/;
18225var legalReference = /^(?:[a-zA-Z$_0-9]|\\\.)+(?:(?:\.(?:[a-zA-Z$_0-9]|\\\.)+)|(?:\[[0-9]+\]))*/;
18226var relaxedName = /^[a-zA-Z_$][-\/a-zA-Z_$0-9]*(?:\.(?:[a-zA-Z_$][-\/a-zA-Z_$0-9]*))*/;
18227
18228var identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
18229
18230// http://mathiasbynens.be/notes/javascript-properties
18231// can be any name, string literal, or number literal
18232function readKey(parser) {
18233  var token;
18234
18235  if ((token = readStringLiteral(parser))) {
18236    return identifier.test(token.v) ? token.v : '"' + token.v.replace(/"/g, '\\"') + '"';
18237  }
18238
18239  if ((token = readNumberLiteral$1(parser))) {
18240    return token.v;
18241  }
18242
18243  if ((token = parser.matchPattern(name))) {
18244    return token;
18245  }
18246
18247  return null;
18248}
18249
18250function readKeyValuePair(parser) {
18251  var spread;
18252  var start = parser.pos;
18253
18254  // allow whitespace between '{' and key
18255  parser.sp();
18256
18257  var refKey = parser.nextChar() !== "'" && parser.nextChar() !== '"';
18258  if (refKey) { spread = parser.matchPattern(spreadPattern); }
18259
18260  var key = spread ? readExpression(parser) : readKey(parser);
18261  if (key === null) {
18262    parser.pos = start;
18263    return null;
18264  }
18265
18266  // allow whitespace between key and ':'
18267  parser.sp();
18268
18269  // es2015 shorthand property
18270  if (refKey && (parser.nextChar() === ',' || parser.nextChar() === '}')) {
18271    if (!spread && !name.test(key)) {
18272      parser.error(("Expected a valid reference, but found '" + key + "' instead."));
18273    }
18274
18275    var pair = {
18276      t: KEY_VALUE_PAIR,
18277      k: key,
18278      v: {
18279        t: REFERENCE,
18280        n: key
18281      }
18282    };
18283
18284    if (spread) {
18285      pair.p = true;
18286    }
18287
18288    return pair;
18289  }
18290
18291  // next character must be ':'
18292  if (!parser.matchString(':')) {
18293    parser.pos = start;
18294    return null;
18295  }
18296
18297  // allow whitespace between ':' and value
18298  parser.sp();
18299
18300  // next expression must be a, well... expression
18301  var value = readExpression(parser);
18302  if (value === null) {
18303    parser.pos = start;
18304    return null;
18305  }
18306
18307  return {
18308    t: KEY_VALUE_PAIR,
18309    k: key,
18310    v: value
18311  };
18312}
18313
18314function readKeyValuePairs(parser) {
18315  var start = parser.pos;
18316
18317  var pair = readKeyValuePair(parser);
18318  if (pair === null) {
18319    return null;
18320  }
18321
18322  var pairs = [pair];
18323
18324  if (parser.matchString(',')) {
18325    var keyValuePairs = readKeyValuePairs(parser);
18326
18327    if (!keyValuePairs) {
18328      parser.pos = start;
18329      return null;
18330    }
18331
18332    return pairs.concat(keyValuePairs);
18333  }
18334
18335  return pairs;
18336}
18337
18338function readObjectLiteral(parser) {
18339  var start = parser.pos;
18340
18341  // allow whitespace
18342  parser.sp();
18343
18344  if (!parser.matchString('{')) {
18345    parser.pos = start;
18346    return null;
18347  }
18348
18349  var keyValuePairs = readKeyValuePairs(parser);
18350
18351  // allow whitespace between final value and '}'
18352  parser.sp();
18353
18354  if (!parser.matchString('}')) {
18355    parser.pos = start;
18356    return null;
18357  }
18358
18359  return {
18360    t: OBJECT_LITERAL,
18361    m: keyValuePairs
18362  };
18363}
18364
18365function readArrayLiteral(parser) {
18366  var start = parser.pos;
18367
18368  // allow whitespace before '['
18369  parser.sp();
18370
18371  if (!parser.matchString('[')) {
18372    parser.pos = start;
18373    return null;
18374  }
18375
18376  var expressionList = readExpressionList(parser, true);
18377
18378  if (!parser.matchString(']')) {
18379    parser.pos = start;
18380    return null;
18381  }
18382
18383  return {
18384    t: ARRAY_LITERAL,
18385    m: expressionList
18386  };
18387}
18388
18389function readLiteral(parser) {
18390  return (
18391    readNumberLiteral$1(parser) ||
18392    readBooleanLiteral(parser) ||
18393    readStringLiteral(parser) ||
18394    readTemplateStringLiteral(parser) ||
18395    readObjectLiteral(parser) ||
18396    readArrayLiteral(parser) ||
18397    readNumberLiteral(parser)
18398  );
18399}
18400
18401// if a reference is a browser global, we don't deference it later, so it needs special treatment
18402var globals = /^(?:Array|console|Date|RegExp|decodeURIComponent|decodeURI|encodeURIComponent|encodeURI|isFinite|isNaN|parseFloat|parseInt|JSON|Math|NaN|undefined|null|Object|Number|String|Boolean)\b/;
18403
18404// keywords are not valid references, with the exception of `this`
18405var keywords = /^(?:break|case|catch|continue|debugger|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|void|while|with)$/;
18406
18407var prefixPattern = /^(?:\@\.|\@|~\/|(?:\^\^\/(?:\^\^\/)*(?:\.\.\/)*)|(?:\.\.\/)+|\.\/(?:\.\.\/)*|\.)/;
18408var specials = /^(key|index|keypath|rootpath|this|global|shared|context|event|node|local|style|helpers|last|macro)/;
18409
18410function readReference(parser) {
18411  var prefix, name$$1, global, reference, lastDotIndex;
18412
18413  var startPos = parser.pos;
18414
18415  prefix = parser.matchPattern(prefixPattern) || '';
18416  name$$1 =
18417    (!prefix && parser.relaxedNames && parser.matchPattern(relaxedName)) ||
18418    parser.matchPattern(legalReference);
18419  var actual = prefix.length + ((name$$1 && name$$1.length) || 0);
18420
18421  if (prefix === '@.') {
18422    prefix = '@';
18423    if (name$$1) { name$$1 = 'this.' + name$$1; }
18424    else { name$$1 = 'this'; }
18425  }
18426
18427  if (!name$$1 && prefix) {
18428    name$$1 = prefix;
18429    prefix = '';
18430  }
18431
18432  if (!name$$1) {
18433    return null;
18434  }
18435
18436  if (prefix === '@') {
18437    if (!specials.test(name$$1)) {
18438      parser.error(("Unrecognized special reference @" + name$$1));
18439    } else if ((!name$$1.indexOf('event') || !name$$1.indexOf('node')) && !parser.inEvent) {
18440      parser.error("@event and @node are only valid references within an event directive");
18441    } else if (~
vendor: 17,409 bytes, lines 18441-19160
18441name$$1.indexOf('context')) {
18442      parser.pos = parser.pos - (name$$1.length - 7);
18443      return {
18444        t: BRACKETED,
18445        x: {
18446          t: REFERENCE,
18447          n: '@context'
18448        }
18449      };
18450    }
18451  }
18452
18453  // bug out if it's a keyword (exception for ancestor/restricted refs - see https://github.com/ractivejs/ractive/issues/1497)
18454  if (!prefix && !parser.relaxedNames && keywords.test(name$$1)) {
18455    parser.pos = startPos;
18456    return null;
18457  }
18458
18459  // if this is a browser global, stop here
18460  if (!prefix && globals.test(name$$1)) {
18461    global = globals.exec(name$$1)[0];
18462    parser.pos = startPos + global.length;
18463
18464    return {
18465      t: GLOBAL,
18466      v: global
18467    };
18468  }
18469
18470  reference = (prefix || '') + normalise(name$$1);
18471
18472  if (parser.matchString('(')) {
18473    // if this is a method invocation (as opposed to a function) we need
18474    // to strip the method name from the reference combo, else the context
18475    // will be wrong
18476    // but only if the reference was actually a member and not a refinement
18477    lastDotIndex = reference.lastIndexOf('.');
18478    if (lastDotIndex !== -1 && name$$1[name$$1.length - 1] !== ']') {
18479      if (lastDotIndex === 0) {
18480        reference = '.';
18481        parser.pos = startPos;
18482      } else {
18483        var refLength = reference.length;
18484        reference = reference.substr(0, lastDotIndex);
18485        parser.pos = startPos + (actual - (refLength - lastDotIndex));
18486      }
18487    } else {
18488      parser.pos -= 1;
18489    }
18490  }
18491
18492  return {
18493    t: REFERENCE,
18494    n: reference.replace(/^this\./, './').replace(/^this$/, '.')
18495  };
18496}
18497
18498function readBracketedExpression(parser) {
18499  if (!parser.matchString('(')) { return null; }
18500
18501  parser.sp();
18502
18503  var expr = readExpression(parser);
18504
18505  if (!expr) { parser.error(expectedExpression); }
18506
18507  parser.sp();
18508
18509  if (!parser.matchString(')')) { parser.error(expectedParen); }
18510
18511  return {
18512    t: BRACKETED,
18513    x: expr
18514  };
18515}
18516
18517function readPrimary(parser) {
18518  return readLiteral(parser) || readReference(parser) || readBracketedExpression(parser);
18519}
18520
18521function readRefinement(parser) {
18522  // some things call for strict refinement (partial names), meaning no space between reference and refinement
18523  if (!parser.strictRefinement) {
18524    parser.sp();
18525  }
18526
18527  // "." name
18528  if (parser.matchString('.')) {
18529    parser.sp();
18530
18531    var name$$1 = parser.matchPattern(name);
18532    if (name$$1) {
18533      return {
18534        t: REFINEMENT,
18535        n: name$$1
18536      };
18537    }
18538
18539    parser.error('Expected a property name');
18540  }
18541
18542  // "[" expression "]"
18543  if (parser.matchString('[')) {
18544    parser.sp();
18545
18546    var expr = readExpression(parser);
18547    if (!expr) { parser.error(expectedExpression); }
18548
18549    parser.sp();
18550
18551    if (!parser.matchString(']')) { parser.error("Expected ']'"); }
18552
18553    return {
18554      t: REFINEMENT,
18555      x: expr
18556    };
18557  }
18558
18559  return null;
18560}
18561
18562function readMemberOrInvocation(parser) {
18563  var expression = readPrimary(parser);
18564
18565  if (!expression) { return null; }
18566
18567  while (expression) {
18568    var refinement = readRefinement(parser);
18569    if (refinement) {
18570      expression = {
18571        t: MEMBER,
18572        x: expression,
18573        r: refinement
18574      };
18575    } else if (parser.matchString('(')) {
18576      parser.sp();
18577      var expressionList = readExpressionList(parser, true);
18578
18579      parser.sp();
18580
18581      if (!parser.matchString(')')) {
18582        parser.error(expectedParen);
18583      }
18584
18585      expression = {
18586        t: INVOCATION,
18587        x: expression
18588      };
18589
18590      if (expressionList) { expression.o = expressionList; }
18591    } else {
18592      break;
18593    }
18594  }
18595
18596  return expression;
18597}
18598
18599var readTypeOf;
18600
18601var makePrefixSequenceMatcher = function(symbol, fallthrough) {
18602  return function(parser) {
18603    var expression;
18604
18605    if ((expression = fallthrough(parser))) {
18606      return expression;
18607    }
18608
18609    if (!parser.matchString(symbol)) {
18610      return null;
18611    }
18612
18613    parser.sp();
18614
18615    expression = readExpression(parser);
18616    if (!expression) {
18617      parser.error(expectedExpression);
18618    }
18619
18620    return {
18621      s: symbol,
18622      o: expression,
18623      t: PREFIX_OPERATOR
18624    };
18625  };
18626};
18627
18628// create all prefix sequence matchers, return readTypeOf
18629(function() {
18630  var i, len, matcher, fallthrough;
18631
18632  var prefixOperators = '! ~ + - typeof'.split(' ');
18633
18634  fallthrough = readMemberOrInvocation;
18635  for (i = 0, len = prefixOperators.length; i < len; i += 1) {
18636    matcher = makePrefixSequenceMatcher(prefixOperators[i], fallthrough);
18637    fallthrough = matcher;
18638  }
18639
18640  // typeof operator is higher precedence than multiplication, so provides the
18641  // fallthrough for the multiplication sequence matcher we're about to create
18642  // (we're skipping void and delete)
18643  readTypeOf = fallthrough;
18644})();
18645
18646var readTypeof = readTypeOf;
18647
18648var readLogicalOr;
18649
18650var makeInfixSequenceMatcher = function(symbol, fallthrough) {
18651  return function(parser) {
18652    // > and / have to be quoted
18653    if (parser.inUnquotedAttribute && (symbol === '>' || symbol === '/'))
18654      { return fallthrough(parser); }
18655
18656    var start, left, right;
18657
18658    left = fallthrough(parser);
18659    if (!left) {
18660      return null;
18661    }
18662
18663    // Loop to handle left-recursion in a case like `a * b * c` and produce
18664    // left association, i.e. `(a * b) * c`.  The matcher can't call itself
18665    // to parse `left` because that would be infinite regress.
18666    while (true) {
18667      start = parser.pos;
18668
18669      parser.sp();
18670
18671      if (!parser.matchString(symbol)) {
18672        parser.pos = start;
18673        return left;
18674      }
18675
18676      // special case - in operator must not be followed by [a-zA-Z_$0-9]
18677      if (symbol === 'in' && /[a-zA-Z_$0-9]/.test(parser.remaining().charAt(0))) {
18678        parser.pos = start;
18679        return left;
18680      }
18681
18682      parser.sp();
18683
18684      // right operand must also consist of only higher-precedence operators
18685      right = fallthrough(parser);
18686      if (!right) {
18687        parser.pos = start;
18688        return left;
18689      }
18690
18691      left = {
18692        t: INFIX_OPERATOR,
18693        s: symbol,
18694        o: [left, right]
18695      };
18696
18697      // Loop back around.  If we don't see another occurrence of the symbol,
18698      // we'll return left.
18699    }
18700  };
18701};
18702
18703// create all infix sequence matchers, and return readLogicalOr
18704(function() {
18705  var i, len, matcher, fallthrough;
18706
18707  // All the infix operators on order of precedence (source: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Operator_Precedence)
18708  // Each sequence matcher will initially fall through to its higher precedence
18709  // neighbour, and only attempt to match if one of the higher precedence operators
18710  // (or, ultimately, a literal, reference, or bracketed expression) already matched
18711  var infixOperators = '* / % + - << >> >>> < <= > >= in instanceof == != === !== & ^ | && ||'.split(
18712    ' '
18713  );
18714
18715  // A typeof operator is higher precedence than multiplication
18716  fallthrough = readTypeof;
18717  for (i = 0, len = infixOperators.length; i < len; i += 1) {
18718    matcher = makeInfixSequenceMatcher(infixOperators[i], fallthrough);
18719    fallthrough = matcher;
18720  }
18721
18722  // Logical OR is the fallthrough for the conditional matcher
18723  readLogicalOr = fallthrough;
18724})();
18725
18726var readLogicalOr$1 = readLogicalOr;
18727
18728// The conditional operator is the lowest precedence operator, so we start here
18729function getConditional(parser) {
18730  var expression = readLogicalOr$1(parser);
18731  if (!expression) {
18732    return null;
18733  }
18734
18735  var start = parser.pos;
18736
18737  parser.sp();
18738
18739  if (!parser.matchString('?')) {
18740    parser.pos = start;
18741    return expression;
18742  }
18743
18744  parser.sp();
18745
18746  var ifTrue = readExpression(parser);
18747  if (!ifTrue) {
18748    parser.error(expectedExpression);
18749  }
18750
18751  parser.sp();
18752
18753  if (!parser.matchString(':')) {
18754    parser.error('Expected ":"');
18755  }
18756
18757  parser.sp();
18758
18759  var ifFalse = readExpression(parser);
18760  if (!ifFalse) {
18761    parser.error(expectedExpression);
18762  }
18763
18764  return {
18765    t: CONDITIONAL,
18766    o: [expression, ifTrue, ifFalse]
18767  };
18768}
18769
18770function readExpression(parser) {
18771  // if eval is false, no expressions
18772  if (parser.allowExpressions === false) {
18773    var ref = readReference(parser);
18774    parser.sp();
18775    return ref;
18776  }
18777
18778  // The conditional operator is the lowest precedence operator (except yield,
18779  // assignment operators, and commas, none of which are supported), so we
18780  // start there. If it doesn't match, it 'falls through' to progressively
18781  // higher precedence operators, until it eventually matches (or fails to
18782  // match) a 'primary' - a literal or a reference. This way, the abstract syntax
18783  // tree has everything in its proper place, i.e. 2 + 3 * 4 === 14, not 20.
18784  return getConditional(parser);
18785}
18786
18787function readExpressionList(parser, spread) {
18788  var isSpread;
18789  var expressions = [];
18790
18791  var pos = parser.pos;
18792
18793  do {
18794    parser.sp();
18795
18796    if (spread) {
18797      isSpread = parser.matchPattern(spreadPattern);
18798    }
18799
18800    var expr = readExpression(parser);
18801
18802    if (expr === null && expressions.length) {
18803      parser.error(expectedExpression);
18804    } else if (expr === null) {
18805      parser.pos = pos;
18806      return null;
18807    }
18808
18809    if (isSpread) {
18810      expr.p = true;
18811    }
18812
18813    expressions.push(expr);
18814
18815    parser.sp();
18816  } while (parser.matchString(','));
18817
18818  return expressions;
18819}
18820
18821function readExpressionOrReference(parser, expectedFollowers) {
18822  var start = parser.pos;
18823  var expression = readExpression(parser);
18824
18825  if (!expression) {
18826    // valid reference but invalid expression e.g. `{{new}}`?
18827    var ref = parser.matchPattern(/^(\w+)/);
18828    if (ref) {
18829      return {
18830        t: REFERENCE,
18831        n: ref
18832      };
18833    }
18834
18835    return null;
18836  }
18837
18838  for (var i = 0; i < expectedFollowers.length; i += 1) {
18839    if (parser.remaining().substr(0, expectedFollowers[i].length) === expectedFollowers[i]) {
18840      return expression;
18841    }
18842  }
18843
18844  parser.pos = start;
18845  return readReference(parser);
18846}
18847
18848function flattenExpression(expression) {
18849  var refs;
18850  var count = 0;
18851
18852  extractRefs(expression, (refs = []));
18853  var stringified = stringify(expression);
18854
18855  return {
18856    r: refs,
18857    s: getVars(stringified)
18858  };
18859
18860  function getVars(expr) {
18861    var vars = [];
18862    for (var i = count - 1; i >= 0; i--) {
18863      vars.push(("x$" + i));
18864    }
18865    return vars.length ? ("(function(){var " + (vars.join(',')) + ";return(" + expr + ");})()") : expr;
18866  }
18867
18868  function stringify(node) {
18869    if (isString(node)) {
18870      return node;
18871    }
18872
18873    switch (node.t) {
18874      case BOOLEAN_LITERAL:
18875      case GLOBAL:
18876      case NUMBER_LITERAL:
18877      case REGEXP_LITERAL:
18878        return node.v;
18879
18880      case STRING_LITERAL:
18881        return JSON.stringify(String(node.v));
18882
18883      case ARRAY_LITERAL:
18884        if (node.m && hasSpread(node.m)) {
18885          return ("[].concat(" + (makeSpread(node.m, '[', ']', stringify)) + ")");
18886        } else {
18887          return '[' + (node.m ? node.m.map(stringify).join(',') : '') + ']';
18888        }
18889
18890      case OBJECT_LITERAL:
18891        if (node.m && hasSpread(node.m)) {
18892          return ("Object.assign({}," + (makeSpread(node.m, '{', '}', stringifyPair)) + ")");
18893        } else {
18894          return '{' + (node.m ? node.m.map(function (n) { return ((n.k) + ":" + (stringify(n.v))); }).join(',') : '') + '}';
18895        }
18896
18897      case PREFIX_OPERATOR:
18898        return (node.s === 'typeof' ? 'typeof ' : node.s) + stringify(node.o);
18899
18900      case INFIX_OPERATOR:
18901        return (
18902          stringify(node.o[0]) +
18903          (node.s.substr(0, 2) === 'in' ? ' ' + node.s + ' ' : node.s) +
18904          stringify(node.o[1])
18905        );
18906
18907      case INVOCATION:
18908        if (node.o && hasSpread(node.o)) {
18909          var id = count++;
18910          return ("(x$" + id + "=" + (stringify(node.x)) + ").apply(x$" + id + "," + (stringify({
18911            t: ARRAY_LITERAL,
18912            m: node.o
18913          })) + ")");
18914        } else {
18915          return stringify(node.x) + '(' + (node.o ? node.o.map(stringify).join(',') : '') + ')';
18916        }
18917
18918      case BRACKETED:
18919        return '(' + stringify(node.x) + ')';
18920
18921      case MEMBER:
18922        return stringify(node.x) + stringify(node.r);
18923
18924      case REFINEMENT:
18925        return node.n ? '.' + node.n : '[' + stringify(node.x) + ']';
18926
18927      case CONDITIONAL:
18928        return stringify(node.o[0]) + '?' + stringify(node.o[1]) + ':' + stringify(node.o[2]);
18929
18930      case REFERENCE:
18931        return '_' + refs.indexOf(node.n);
18932
18933      default:
18934        throw new Error('Expected legal JavaScript');
18935    }
18936  }
18937
18938  function stringifyPair(node) {
18939    return node.p ? stringify(node.k) : ((node.k) + ":" + (stringify(node.v)));
18940  }
18941
18942  function makeSpread(list, open, close, fn) {
18943    var out = list.reduce(
18944      function (a, c) {
18945        if (c.p) {
18946          a.str += "" + (a.open ? close + ',' : a.str.length ? ',' : '') + (fn(c));
18947        } else {
18948          a.str += "" + (!a.str.length ? open : !a.open ? ',' + open : ',') + (fn(c));
18949        }
18950        a.open = !c.p;
18951        return a;
18952      },
18953      { open: false, str: '' }
18954    );
18955    if (out.open) { out.str += close; }
18956    return out.str;
18957  }
18958}
18959
18960function hasSpread(list) {
18961  for (var i = 0; i < list.length; i++) {
18962    if (list[i].p) { return true; }
18963  }
18964
18965  return false;
18966}
18967
18968// TODO maybe refactor this?
18969function extractRefs(node, refs) {
18970  if (node.t === REFERENCE && isString(node.n)) {
18971    if (!~refs.indexOf(node.n)) {
18972      refs.unshift(node.n);
18973    }
18974  }
18975
18976  var list = node.o || node.m;
18977  if (list) {
18978    if (isObject(list)) {
18979      extractRefs(list, refs);
18980    } else {
18981      var i = list.length;
18982      while (i--) {
18983        extractRefs(list[i], refs);
18984      }
18985    }
18986  }
18987
18988  if (node.k && node.t === KEY_VALUE_PAIR && !isString(node.k)) {
18989    extractRefs(node.k, refs);
18990  }
18991
18992  if (node.x) {
18993    extractRefs(node.x, refs);
18994  }
18995
18996  if (node.r) {
18997    extractRefs(node.r, refs);
18998  }
18999
19000  if (node.v) {
19001    extractRefs(node.v, refs);
19002  }
19003}
19004
19005function refineExpression(expression, mustache) {
19006  var referenceExpression;
19007
19008  if (expression) {
19009    while (expression.t === BRACKETED && expression.x) {
19010      expression = expression.x;
19011    }
19012
19013    if (expression.t === REFERENCE) {
19014      var n = expression.n;
19015      if (!~n.indexOf('@context')) {
19016        mustache.r = expression.n;
19017      } else {
19018        mustache.x = flattenExpression(expression);
19019      }
19020    } else {
19021      if ((referenceExpression = getReferenceExpression(expression))) {
19022        mustache.rx = referenceExpression;
19023      } else {
19024        mustache.x = flattenExpression(expression);
19025      }
19026    }
19027
19028    return mustache;
19029  }
19030}
19031
19032// TODO refactor this! it's bewildering
19033function getReferenceExpression(expression) {
19034  var members = [];
19035  var refinement;
19036
19037  while (expression.t === MEMBER && expression.r.t === REFINEMENT) {
19038    refinement = expression.r;
19039
19040    if (refinement.x) {
19041      if (refinement.x.t === REFERENCE) {
19042        members.unshift(refinement.x);
19043      } else {
19044        members.unshift(flattenExpression(refinement.x));
19045      }
19046    } else {
19047      members.unshift(refinement.n);
19048    }
19049
19050    expression = expression.x;
19051  }
19052
19053  if (expression.t !== REFERENCE) {
19054    return null;
19055  }
19056
19057  return {
19058    r: expression.n,
19059    m: members
19060  };
19061}
19062
19063var attributeNamePattern = /^[^\s"'>\/=(]+/;
19064var onPattern = /^on/;
19065var eventPattern = /^on-([a-zA-Z\*\.$_]((?:[a-zA-Z\*\.$_0-9\-]|\\-)+))$/;
19066var reservedEventNames = /^(?:change|reset|teardown|update|construct|config|init|render|complete|unrender|detach|insert|destruct|attachchild|detachchild)$/;
19067var decoratorPattern = /^as-([a-z-A-Z][-a-zA-Z_0-9]*)$/;
19068var transitionPattern = /^([a-zA-Z](?:(?!-in-out)[-a-zA-Z_0-9])*)-(in|out|in-out)$/;
19069var boundPattern = /^((bind|class)-(([-a-zA-Z0-9_])+))$/;
19070var directives = {
19071  lazy: { t: BINDING_FLAG, v: 'l' },
19072  twoway: { t: BINDING_FLAG, v: 't' },
19073  'no-delegation': { t: DELEGATE_FLAG }
19074};
19075var unquotedAttributeValueTextPattern = /^[^\s"'=<>\/`]+/;
19076var proxyEvent = /^[^\s"'=<>@\[\]()]*/;
19077var whitespace = /^\s+/;
19078
19079var slashes = /\\/g;
19080function splitEvent(str) {
19081  var result = [];
19082  var s = 0;
19083
19084  for (var i = 0; i < str.length; i++) {
19085    if (str[i] === '-' && str[i - 1] !== '\\') {
19086      result.push(str.substring(s, i).replace(slashes, ''));
19087      s = i + 1;
19088    }
19089  }
19090
19091  result.push(str.substring(s).replace(slashes, ''));
19092
19093  return result;
19094}
19095
19096function readAttribute(parser) {
19097  var name, i, nearest, idx;
19098
19099  parser.sp();
19100
19101  name = parser.matchPattern(attributeNamePattern);
19102  if (!name) {
19103    return null;
19104  }
19105
19106  // check for accidental delimiter consumption e.g. <tag bool{{>attrs}} />
19107  nearest = name.length;
19108  for (i = 0; i < parser.tags.length; i++) {
19109    if (~(idx = name.indexOf(parser.tags[i].open))) {
19110      if (idx < nearest) { nearest = idx; }
19111    }
19112  }
19113  if (nearest < name.length) {
19114    parser.pos -= name.length - nearest;
19115    name = name.substr(0, nearest);
19116    if (!name) { return null; }
19117  }
19118
19119  return { n: name };
19120}
19121
19122function readAttributeValue(parser) {
19123  var start = parser.pos;
19124
19125  // next character must be `=`, `/`, `>` or whitespace
19126  if (!/[=\/>\s]/.test(parser.nextChar())) {
19127    parser.error('Expected `=`, `/`, `>` or whitespace');
19128  }
19129
19130  parser.sp();
19131
19132  if (!parser.matchString('=')) {
19133    parser.pos = start;
19134    return null;
19135  }
19136
19137  parser.sp();
19138
19139  var valueStart = parser.pos;
19140  var startDepth = parser.sectionDepth;
19141
19142  var value =
19143    readQuotedAttributeValue(parser, "'") ||
19144    readQuotedAttributeValue(parser, "\"") ||
19145    readUnquotedAttributeValue(parser);
19146
19147  if (value === null) {
19148    parser.error('Expected valid attribute value');
19149  }
19150
19151  if (parser.sectionDepth !== startDepth) {
19152    parser.pos = valueStart;
19153    parser.error(
19154      'An attribute value must contain as many opening section tags as closing section tags'
19155    );
19156  }
19157
19158  if (!value.length) {
19159    return '';
19160  }
vendor: 2,048 bytes, lines 19160-19254
19160
19161
19162  if (value.length === 1 && isString(value[0])) {
19163    return decodeCharacterReferences(value[0]);
19164  }
19165
19166  return value;
19167}
19168
19169function readUnquotedAttributeValueToken(parser) {
19170  var text, index;
19171
19172  var start = parser.pos;
19173
19174  text = parser.matchPattern(unquotedAttributeValueTextPattern);
19175
19176  if (!text) {
19177    return null;
19178  }
19179
19180  var haystack = text;
19181  var needles = parser.tags.map(function (t) { return t.open; }); // TODO refactor... we do this in readText.js as well
19182
19183  if ((index = getLowestIndex(haystack, needles)) !== -1) {
19184    text = text.substr(0, index);
19185    parser.pos = start + text.length;
19186  }
19187
19188  return text;
19189}
19190
19191function readUnquotedAttributeValue(parser) {
19192  parser.inAttribute = true;
19193
19194  var tokens = [];
19195
19196  var token = readMustache(parser) || readUnquotedAttributeValueToken(parser);
19197  while (token) {
19198    tokens.push(token);
19199    token = readMustache(parser) || readUnquotedAttributeValueToken(parser);
19200  }
19201
19202  if (!tokens.length) {
19203    return null;
19204  }
19205
19206  parser.inAttribute = false;
19207  return tokens;
19208}
19209
19210function readQuotedAttributeValue(parser, quoteMark) {
19211  var start = parser.pos;
19212
19213  if (!parser.matchString(quoteMark)) {
19214    return null;
19215  }
19216
19217  parser.inAttribute = quoteMark;
19218
19219  var tokens = [];
19220
19221  var token = readMustache(parser) || readQuotedStringToken(parser, quoteMark);
19222  while (token !== null) {
19223    tokens.push(token);
19224    token = readMustache(parser) || readQuotedStringToken(parser, quoteMark);
19225  }
19226
19227  if (!parser.matchString(quoteMark)) {
19228    parser.pos = start;
19229    return null;
19230  }
19231
19232  parser.inAttribute = false;
19233
19234  return tokens;
19235}
19236
19237function readQuotedStringToken(parser, quoteMark) {
19238  var haystack = parser.remaining();
19239
19240  var needles = parser.tags.map(function (t) { return t.open; }); // TODO refactor... we do this in readText.js as well
19241  needles.push(quoteMark);
19242
19243  var index = getLowestIndex(haystack, needles);
19244
19245  if (index === -1) {
19246    parser.error('Quoted attribute value must have a closing quote');
19247  }
19248
19249  if (!index) {
19250    return null;
19251  }
19252
19253  parser.pos += index;
19254  return haystack.substr(0, index
vendor: 15,551 bytes, lines 19254-19906
19254);
19255}
19256
19257function readAttributeOrDirective(parser) {
19258  var match, directive;
19259
19260  var attribute = readAttribute(parser, false);
19261
19262  if (!attribute) { return null; }
19263
19264  // lazy, twoway
19265  if ((directive = directives[attribute.n])) {
19266    attribute.t = directive.t;
19267    if (directive.v) { attribute.v = directive.v; }
19268    delete attribute.n; // no name necessary
19269    parser.sp();
19270    if (parser.nextChar() === '=') { attribute.f = readAttributeValue(parser); }
19271  } else if ((match = decoratorPattern.exec(attribute.n))) {
19272    // decorators
19273    attribute.n = match[1];
19274    attribute.t = DECORATOR;
19275    readArguments(parser, attribute);
19276  } else if ((match = transitionPattern.exec(attribute.n))) {
19277    // transitions
19278    attribute.n = match[1];
19279    attribute.t = TRANSITION;
19280    readArguments(parser, attribute);
19281    attribute.v = match[2] === 'in-out' ? 't0' : match[2] === 'in' ? 't1' : 't2';
19282  } else if ((match = eventPattern.exec(attribute.n))) {
19283    // on-click etc
19284    attribute.n = splitEvent(match[1]);
19285    attribute.t = EVENT;
19286
19287    if (parser.matchString('(')) {
19288      attribute.a = flattenExpression({
19289        t: ARRAY_LITERAL,
19290        m: readExpressionList(parser)
19291      });
19292      if (!parser.matchString(')')) { parser.error("Expected closing ')'"); }
19293    }
19294
19295    parser.inEvent = true;
19296
19297    // check for a proxy event
19298    if (!readProxyEvent(parser, attribute)) {
19299      // otherwise, it's an expression
19300      readArguments(parser, attribute, true);
19301    } else if (reservedEventNames.test(attribute.f)) {
19302      parser.pos -= attribute.f.length;
19303      parser.error(
19304        'Cannot use reserved event names (change, reset, teardown, update, construct, config, init, render, unrender, complete, detach, insert, destruct, attachchild, detachchild)'
19305      );
19306    }
19307
19308    parser.inEvent = false;
19309  } else if ((match = boundPattern.exec(attribute.n))) {
19310    // bound directives
19311    var bind = match[2] === 'bind';
19312    attribute.n = bind ? match[3] : match[1];
19313    attribute.t = ATTRIBUTE;
19314    readArguments(parser, attribute, false, true);
19315
19316    if (!attribute.f && bind) {
19317      attribute.f = [{ t: INTERPOLATOR, r: match[3] }];
19318    }
19319  } else {
19320    parser.sp();
19321    var value = parser.nextChar() === '=' ? readAttributeValue(parser) : null;
19322    attribute.f = value != null ? value : attribute.f;
19323
19324    if (parser.sanitizeEventAttributes && onPattern.test(attribute.n)) {
19325      return { exclude: true };
19326    } else {
19327      attribute.f = attribute.f || (attribute.f === '' ? '' : 0);
19328      attribute.t = ATTRIBUTE;
19329    }
19330  }
19331
19332  return attribute;
19333}
19334
19335function readProxyEvent(parser, attribute) {
19336  var start = parser.pos;
19337  if (!parser.matchString('=')) { parser.error("Missing required directive arguments"); }
19338
19339  var quote = parser.matchString("'") || parser.matchString("\"");
19340  parser.sp();
19341  var proxy = parser.matchPattern(proxyEvent);
19342
19343  if (proxy !== undefined) {
19344    if (quote) {
19345      parser.sp();
19346      if (!parser.matchString(quote)) { parser.pos = start; }
19347      else { return (attribute.f = proxy) || true; }
19348    } else if (!parser.matchPattern(whitespace)) {
19349      parser.pos = start;
19350    } else {
19351      return (attribute.f = proxy) || true;
19352    }
19353  } else {
19354    parser.pos = start;
19355  }
19356}
19357
19358function readArguments(parser, attribute, required, single) {
19359  if ( required === void 0 ) required = false;
19360  if ( single === void 0 ) single = false;
19361
19362  parser.sp();
19363  if (!parser.matchString('=')) {
19364    if (required) { parser.error("Missing required directive arguments"); }
19365    return;
19366  }
19367  parser.sp();
19368
19369  var quote = parser.matchString('"') || parser.matchString("'");
19370  var spread = parser.spreadArgs;
19371  parser.spreadArgs = true;
19372  parser.inUnquotedAttribute = !quote;
19373  var expr = single
19374    ? readExpressionOrReference(parser, [quote || ' ', '/', '>'])
19375    : { m: readExpressionList(parser), t: ARRAY_LITERAL };
19376  parser.inUnquotedAttribute = false;
19377  parser.spreadArgs = spread;
19378
19379  if (quote) {
19380    parser.sp();
19381    if (parser.matchString(quote) !== quote) { parser.error(("Expected matching quote '" + quote + "'")); }
19382  }
19383
19384  if (single) {
19385    var interpolator = { t: INTERPOLATOR };
19386    refineExpression(expr, interpolator);
19387    attribute.f = [interpolator];
19388  } else {
19389    attribute.f = flattenExpression(expr);
19390  }
19391}
19392
19393var delimiterChangeToken = { t: DELIMCHANGE, exclude: true };
19394
19395function readMustache(parser) {
19396  var mustache, i;
19397
19398  // If we're inside a <script> or <style> tag, and we're not
19399  // interpolating, bug out
19400  if (parser.interpolate[parser.inside] === false) {
19401    return null;
19402  }
19403
19404  for (i = 0; i < parser.tags.length; i += 1) {
19405    if ((mustache = readMustacheOfType(parser, parser.tags[i]))) {
19406      return mustache;
19407    }
19408  }
19409
19410  if (parser.inTag && !parser.inAttribute) {
19411    mustache = readAttributeOrDirective(parser);
19412    if (mustache) {
19413      parser.sp();
19414      return mustache;
19415    }
19416  }
19417}
19418
19419function readMustacheOfType(parser, tag) {
19420  var mustache, reader, i;
19421
19422  var start = parser.pos;
19423
19424  if (parser.matchString('\\' + tag.open)) {
19425    if (start === 0 || parser.str[start - 1] !== '\\') {
19426      return tag.open;
19427    }
19428  } else if (!parser.matchString(tag.open)) {
19429    return null;
19430  }
19431
19432  // delimiter change?
19433  if ((mustache = readDelimiterChange(parser))) {
19434    // find closing delimiter or abort...
19435    if (!parser.matchString(tag.close)) {
19436      return null;
19437    }
19438
19439    // ...then make the switch
19440    tag.open = mustache[0];
19441    tag.close = mustache[1];
19442    parser.sortMustacheTags();
19443
19444    return delimiterChangeToken;
19445  }
19446
19447  parser.sp();
19448
19449  // illegal section closer
19450  if (parser.matchString('/')) {
19451    parser.pos -= 1;
19452    var rewind = parser.pos;
19453    if (!readNumberLiteral(parser)) {
19454      parser.pos = rewind - tag.close.length;
19455      if (parser.inAttribute) {
19456        parser.pos = start;
19457        return null;
19458      } else {
19459        parser.error("Attempted to close a section that wasn't open");
19460      }
19461    } else {
19462      parser.pos = rewind;
19463    }
19464  }
19465
19466  for (i = 0; i < tag.readers.length; i += 1) {
19467    reader = tag.readers[i];
19468
19469    if ((mustache = reader(parser, tag))) {
19470      if (tag.isStatic) {
19471        mustache.s = 1;
19472      }
19473
19474      if (parser.includeLinePositions) {
19475        mustache.q = parser.getLinePos(start);
19476      }
19477
19478      return mustache;
19479    }
19480  }
19481
19482  parser.pos = start;
19483  return null;
19484}
19485
19486function readTriple(parser, tag) {
19487  var expression = readExpression(parser);
19488
19489  if (!expression) {
19490    return null;
19491  }
19492
19493  if (!parser.matchString(tag.close)) {
19494    parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19495  }
19496
19497  var triple = { t: TRIPLE };
19498  refineExpression(expression, triple); // TODO handle this differently - it's mysterious
19499
19500  return triple;
19501}
19502
19503function readUnescaped(parser, tag) {
19504  if (!parser.matchString('&')) {
19505    return null;
19506  }
19507
19508  parser.sp();
19509
19510  var expression = readExpression(parser);
19511
19512  if (!expression) {
19513    return null;
19514  }
19515
19516  if (!parser.matchString(tag.close)) {
19517    parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19518  }
19519
19520  var triple = { t: TRIPLE };
19521  refineExpression(expression, triple); // TODO handle this differently - it's mysterious
19522
19523  return triple;
19524}
19525
19526var legalAlias = /^(?:[a-zA-Z$_0-9]|\\\.)+(?:(?:(?:[a-zA-Z$_0-9]|\\\.)+)|(?:\[[0-9]+\]))*/;
19527var asRE = /^as/i;
19528
19529function readAliases(parser) {
19530  var aliases = [];
19531  var alias;
19532  var start = parser.pos;
19533
19534  parser.sp();
19535
19536  alias = readAlias(parser);
19537
19538  if (alias) {
19539    alias.x = refineExpression(alias.x, {});
19540    aliases.push(alias);
19541
19542    parser.sp();
19543
19544    while (parser.matchString(',')) {
19545      alias = readAlias(parser);
19546
19547      if (!alias) {
19548        parser.error('Expected another alias.');
19549      }
19550
19551      alias.x = refineExpression(alias.x, {});
19552      aliases.push(alias);
19553
19554      parser.sp();
19555    }
19556
19557    return aliases;
19558  }
19559
19560  parser.pos = start;
19561  return null;
19562}
19563
19564function readAlias(parser) {
19565  var start = parser.pos;
19566
19567  parser.sp();
19568
19569  var expr = readExpression(parser, []);
19570
19571  if (!expr) {
19572    parser.pos = start;
19573    return null;
19574  }
19575
19576  parser.sp();
19577  parser.matchPattern(asRE);
19578  parser.sp();
19579
19580  var alias = parser.matchPattern(legalAlias);
19581
19582  if (!alias) {
19583    parser.pos = start;
19584    return null;
19585  }
19586
19587  return { n: alias, x: expr };
19588}
19589
19590function readPartial(parser, tag) {
19591  var type = parser.matchString('>') || parser.matchString('yield');
19592  var partial = { t: type === '>' ? PARTIAL : YIELDER };
19593  var aliases;
19594
19595  if (!type) { return null; }
19596
19597  parser.sp();
19598
19599  if (type === '>' || !(aliases = parser.matchString('with'))) {
19600    // Partial names can include hyphens, so we can't use readExpression
19601    // blindly. Instead, we use the `relaxedNames` flag to indicate that
19602    // `foo-bar` should be read as a single name, rather than 'subtract
19603    // bar from foo'
19604    parser.relaxedNames = parser.strictRefinement = true;
19605    var expression = readExpression(parser);
19606    parser.relaxedNames = parser.strictRefinement = false;
19607
19608    if (!expression && type === '>') { return null; }
19609
19610    if (expression) {
19611      refineExpression(expression, partial); // TODO...
19612      parser.sp();
19613      if (type !== '>') { aliases = parser.matchString('with'); }
19614    }
19615  }
19616
19617  parser.sp();
19618
19619  // check for alias context e.g. `{{>foo bar as bat, bip as bop}}`
19620  if (aliases || type === '>') {
19621    aliases = readAliases(parser);
19622    if (aliases && aliases.length) {
19623      partial.z = aliases;
19624    } else {
19625      // otherwise check for literal context e.g. `{{>foo bar}}` then
19626      // turn it into `{{#with bar}}{{>foo}}{{/with}}`
19627      var context = readExpression(parser);
19628      if (context) {
19629        partial.c = {};
19630        refineExpression(context, partial.c);
19631      }
19632
19633      // allow aliases after context
19634      if (parser.matchString(',')) {
19635        aliases = readAliases(parser);
19636        if (aliases && aliases.length) {
19637          partial.z = aliases;
19638        }
19639      }
19640    }
19641
19642    if (type !== '>' && (!partial.c && !partial.z)) {
19643      // {{yield with}} requires some aliases
19644      parser.error("Expected a context or one or more aliases");
19645    }
19646  }
19647
19648  parser.sp();
19649
19650  if (!parser.matchString(tag.close)) {
19651    parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19652  }
19653
19654  return partial;
19655}
19656
19657function readComment(parser, tag) {
19658  if (!parser.matchString('!')) {
19659    return null;
19660  }
19661
19662  var index = parser.remaining().indexOf(tag.close);
19663
19664  if (index !== -1) {
19665    parser.pos += index + tag.close.length;
19666    return { t: COMMENT };
19667  }
19668}
19669
19670function readInterpolator(parser, tag) {
19671  var expression, err;
19672
19673  var start = parser.pos;
19674
19675  // TODO would be good for perf if we could do away with the try-catch
19676  try {
19677    expression = readExpressionOrReference(parser, [tag.close]);
19678  } catch (e) {
19679    err = e;
19680  }
19681
19682  if (!expression) {
19683    if (parser.str.charAt(start) === '!') {
19684      // special case - comment
19685      parser.pos = start;
19686      return null;
19687    }
19688
19689    if (err) {
19690      throw err;
19691    }
19692  }
19693
19694  if (!parser.matchString(tag.close)) {
19695    parser.error(("Expected closing delimiter '" + (tag.close) + "' after reference"));
19696
19697    if (!expression) {
19698      // special case - comment
19699      if (parser.nextChar() === '!') {
19700        return null;
19701      }
19702
19703      parser.error("Expected expression or legal reference");
19704    }
19705  }
19706
19707  var interpolator = { t: INTERPOLATOR };
19708  refineExpression(expression, interpolator); // TODO handle this differently - it's mysterious
19709
19710  return interpolator;
19711}
19712
19713function readClosing(parser, tag) {
19714  var start = parser.pos;
19715
19716  if (!parser.matchString(tag.open)) {
19717    return null;
19718  }
19719
19720  parser.sp();
19721
19722  if (!parser.matchString('/')) {
19723    parser.pos = start;
19724    return null;
19725  }
19726
19727  parser.sp();
19728
19729  var remaining = parser.remaining();
19730  var index = remaining.indexOf(tag.close);
19731
19732  if (index !== -1) {
19733    var closing = {
19734      t: CLOSING,
19735      r: remaining.substr(0, index).split(' ')[0]
19736    };
19737
19738    parser.pos += index;
19739
19740    if (!parser.matchString(tag.close)) {
19741      parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19742    }
19743
19744    return closing;
19745  }
19746
19747  parser.pos = start;
19748  return null;
19749}
19750
19751var patterns = {
19752  else: /^\s*else\s*/,
19753  elseif: /^\s*elseif\s+/,
19754  then: /^\s*then\s*/,
19755  catch: /^\s*catch\s*/
19756};
19757
19758var types = {
19759  else: ELSE,
19760  elseif: ELSEIF,
19761  then: THEN,
19762  catch: CATCH
19763};
19764
19765function readInlineBlock(parser, tag, type) {
19766  var start = parser.pos;
19767
19768  if (!parser.matchString(tag.open)) {
19769    return null;
19770  }
19771
19772  if (!parser.matchPattern(patterns[type])) {
19773    parser.pos = start;
19774    return null;
19775  }
19776
19777  var res = { t: types[type] };
19778
19779  if (type === 'elseif') {
19780    res.x = readExpression(parser);
19781  } else if (type === 'catch' || type === 'then') {
19782    var nm = parser.matchPattern(name);
19783    if (nm) { res.n = nm; }
19784  }
19785
19786  if (!parser.matchString(tag.close)) {
19787    parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19788  }
19789
19790  return res;
19791}
19792
19793var handlebarsBlockCodes = {
19794  each: SECTION_EACH,
19795  if: SECTION_IF,
19796  with: SECTION_IF_WITH,
19797  unless: SECTION_UNLESS
19798};
19799
19800var indexRefPattern = /^\s*:\s*([a-zA-Z_$][a-zA-Z_$0-9]*)/;
19801var keyIndexRefPattern = /^\s*,\s*([a-zA-Z_$][a-zA-Z_$0-9]*)/;
19802var handlebarsBlockPattern = new RegExp('^(' + keys(handlebarsBlockCodes).join('|') + ')\\b');
19803
19804function readSection(parser, tag) {
19805  var expression,
19806    section,
19807    child,
19808    children,
19809    hasElse,
19810    block,
19811    unlessBlock,
19812    closed,
19813    i,
19814    expectedClose,
19815    hasThen,
19816    hasCatch,
19817    inlineThen;
19818  var aliasOnly = false;
19819
19820  var start = parser.pos;
19821
19822  if (parser.matchString('^')) {
19823    // watch out for parent context refs - {{^^/^^/foo}}
19824    if (parser.matchString('^/')) {
19825      parser.pos = start;
19826      return null;
19827    }
19828    section = { t: SECTION, f: [], n: SECTION_UNLESS };
19829  } else if (parser.matchString('#')) {
19830    section = { t: SECTION, f: [] };
19831
19832    if (parser.matchString('partial')) {
19833      parser.pos = start - parser.standardDelimiters[0].length;
19834      parser.error(
19835        'Partial definitions can only be at the top level of the template, or immediately inside components'
19836      );
19837    }
19838
19839    if ((block = parser.matchString('await'))) {
19840      expectedClose = block;
19841      section.t = AWAIT;
19842    } else if ((block = parser.matchPattern(handlebarsBlockPattern))) {
19843      expectedClose = block;
19844      section.n = handlebarsBlockCodes[block];
19845    }
19846  } else {
19847    return null;
19848  }
19849
19850  parser.sp();
19851
19852  if (block === 'with') {
19853    var aliases = readAliases(parser);
19854    if (aliases) {
19855      aliasOnly = true;
19856      section.z = aliases;
19857      section.t = ALIAS;
19858    }
19859  } else if (block === 'each') {
19860    var alias = readAlias(parser);
19861    if (alias) {
19862      section.z = [{ n: alias.n, x: { r: '.' } }];
19863      expression = alias.x;
19864    }
19865  }
19866
19867  if (!aliasOnly) {
19868    if (!expression) { expression = readExpression(parser); }
19869
19870    if (!expression) {
19871      parser.error('Expected expression');
19872    }
19873
19874    // extra each aliases
19875    if (block === 'each' && parser.matchString(',')) {
19876      var aliases$1 = readAliases(parser);
19877      if (aliases$1) {
19878        if (section.z) { aliases$1.unshift(section.z[0]); }
19879        section.z = aliases$1;
19880      }
19881    }
19882
19883    // optional index and key references
19884    if ((block === 'each' || !block) && (i = parser.matchPattern(indexRefPattern))) {
19885      var extra;
19886
19887      if ((extra = parser.matchPattern(keyIndexRefPattern))) {
19888        section.i = i + ',' + extra;
19889      } else {
19890        section.i = i;
19891      }
19892    } else if (block === 'await' && parser.matchString('then')) {
19893      parser.sp();
19894      hasThen = true;
19895      inlineThen = parser.matchPattern(name);
19896      if (!inlineThen) { inlineThen = true; }
19897    }
19898
19899    if (!block && expression.n) {
19900      expectedClose = expression.n;
19901    }
19902  }
19903
19904  parser.sp();
19905
19906  if (
vendor: 29,950 bytes, lines 19906-21040
19906!parser.matchString(tag.close)) {
19907    parser.error(("Expected closing delimiter '" + (tag.close) + "'"));
19908  }
19909
19910  parser.sectionDepth += 1;
19911  children = section.f;
19912
19913  var pos;
19914  do {
19915    pos = parser.pos;
19916    if ((child = readClosing(parser, tag))) {
19917      if (expectedClose && child.r !== expectedClose) {
19918        if (!block) {
19919          if (child.r)
19920            { parser.warn(
19921              ("Expected " + (tag.open) + "/" + expectedClose + (tag.close) + " but found " + (tag.open) + "/" + (child.r) + (tag.close))
19922            ); }
19923        } else {
19924          parser.pos = pos;
19925          parser.error(("Expected " + (tag.open) + "/" + expectedClose + (tag.close)));
19926        }
19927      }
19928
19929      parser.sectionDepth -= 1;
19930      closed = true;
19931    } else if (
19932      !aliasOnly &&
19933      ((child = readInlineBlock(parser, tag, 'elseif')) ||
19934        (child = readInlineBlock(parser, tag, 'else')) ||
19935        (block === 'await' &&
19936          ((child = readInlineBlock(parser, tag, 'then')) ||
19937            (child = readInlineBlock(parser, tag, 'catch')))))
19938    ) {
19939      if (section.n === SECTION_UNLESS) {
19940        parser.error('{{else}} not allowed in {{#unless}}');
19941      }
19942
19943      if (hasElse) {
19944        if (child.t === ELSE) {
19945          parser.error('there can only be one {{else}} block, at the end of a section');
19946        } else if (child.t === ELSEIF) {
19947          parser.error('illegal {{elseif...}} after {{else}}');
19948        }
19949      }
19950
19951      if (!unlessBlock && (inlineThen || !hasThen) && !hasCatch) {
19952        if (block === 'await') {
19953          var s = { f: children };
19954          section.f = [s];
19955          if (inlineThen) {
19956            s.t = THEN;
19957            inlineThen !== true && (s.n = inlineThen);
19958          } else {
19959            s.t = SECTION;
19960          }
19961        } else {
19962          unlessBlock = [];
19963        }
19964      }
19965
19966      var mustache = {
19967        t: SECTION,
19968        f: (children = [])
19969      };
19970
19971      if (child.t === ELSE) {
19972        if (block === 'await') {
19973          section.f.push(mustache);
19974          mustache.t = ELSE;
19975        } else {
19976          mustache.n = SECTION_UNLESS;
19977          unlessBlock.push(mustache);
19978        }
19979        hasElse = true;
19980      } else if (child.t === ELSEIF) {
19981        mustache.n = SECTION_IF;
19982        refineExpression(child.x, mustache);
19983        unlessBlock.push(mustache);
19984      } else if (child.t === THEN) {
19985        if (hasElse) { parser.error('{{then}} block must appear before any {{else}} block'); }
19986        if (hasCatch) { parser.error('{{then}} block must appear before any {{catch}} block'); }
19987        if (hasThen) { parser.error('there can only be one {{then}} block per {{#await}}'); }
19988        mustache.t = THEN;
19989        hasThen = true;
19990        child.n && (mustache.n = child.n);
19991        section.f.push(mustache);
19992      } else if (child.t === CATCH) {
19993        if (hasElse) { parser.error('{{catch}} block must appear before any {{else}} block'); }
19994        if (hasCatch) { parser.error('there can only be one {{catch}} block per {{#await}}'); }
19995        mustache.t = CATCH;
19996        hasCatch = true;
19997        mustache.n = child.n;
19998        section.f.push(mustache);
19999      }
20000    } else {
20001      child = parser.read(READERS);
20002
20003      if (!child) {
20004        break;
20005      }
20006
20007      children.push(child);
20008    }
20009  } while (!closed);
20010
20011  if (unlessBlock) {
20012    section.l = unlessBlock;
20013  }
20014
20015  if (!aliasOnly) {
20016    refineExpression(expression, section);
20017  }
20018
20019  if (block === 'await' && (inlineThen || !hasThen) && !hasCatch && !hasElse) {
20020    var s$1 = { f: section.f };
20021    section.f = [s$1];
20022    if (inlineThen) {
20023      s$1.t = THEN;
20024      inlineThen !== true && (s$1.n = inlineThen);
20025    } else {
20026      s$1.t = SECTION;
20027    }
20028  }
20029
20030  // TODO if a section is empty it should be discarded. Don't do
20031  // that here though - we need to clean everything up first, as
20032  // it may contain removeable whitespace. As a temporary measure,
20033  // to pass the existing tests, remove empty `f` arrays
20034  if (!section.f.length) {
20035    delete section.f;
20036  }
20037
20038  return section;
20039}
20040
20041var OPEN_COMMENT = '<!--';
20042var CLOSE_COMMENT = '-->';
20043
20044function readHtmlComment(parser) {
20045  var start = parser.pos;
20046
20047  if (parser.textOnlyMode || !parser.matchString(OPEN_COMMENT)) {
20048    return null;
20049  }
20050
20051  var remaining = parser.remaining();
20052  var endIndex = remaining.indexOf(CLOSE_COMMENT);
20053
20054  if (endIndex === -1) {
20055    parser.error("Illegal HTML - expected closing comment sequence ('-->')");
20056  }
20057
20058  var content = remaining.substr(0, endIndex);
20059  parser.pos += endIndex + 3;
20060
20061  var comment = {
20062    t: COMMENT,
20063    c: content
20064  };
20065
20066  if (parser.includeLinePositions) {
20067    comment.q = parser.getLinePos(start);
20068  }
20069
20070  return comment;
20071}
20072
20073var leadingLinebreak = /^[ \t\f\r\n]*\r?\n/;
20074var trailingLinebreak = /\r?\n[ \t\f\r\n]*$/;
20075
20076function stripStandalones(items) {
20077  var i, current, backOne, backTwo, lastSectionItem;
20078
20079  for (i = 1; i < items.length; i += 1) {
20080    current = items[i];
20081    backOne = items[i - 1];
20082    backTwo = items[i - 2];
20083
20084    // if we're at the end of a [text][comment][text] sequence...
20085    if (isString(current) && isComment(backOne) && isString(backTwo)) {
20086      // ... and the comment is a standalone (i.e. line breaks either side)...
20087      if (trailingLinebreak.test(backTwo) && leadingLinebreak.test(current)) {
20088        // ... then we want to remove the whitespace after the first line break
20089        items[i - 2] = backTwo.replace(trailingLinebreak, '\n');
20090
20091        // and the leading line break of the second text token
20092        items[i] = current.replace(leadingLinebreak, '');
20093      }
20094    }
20095
20096    // if the current item is a section, and it is preceded by a linebreak, and
20097    // its first item is a linebreak...
20098    if (isSection(current) && isString(backOne)) {
20099      if (
20100        trailingLinebreak.test(backOne) &&
20101        isString(current.f[0]) &&
20102        leadingLinebreak.test(current.f[0])
20103      ) {
20104        items[i - 1] = backOne.replace(trailingLinebreak, '\n');
20105        current.f[0] = current.f[0].replace(leadingLinebreak, '');
20106      }
20107    }
20108
20109    // if the last item was a section, and it is followed by a linebreak, and
20110    // its last item is a linebreak...
20111    if (isString(current) && isSection(backOne)) {
20112      lastSectionItem = lastItem(backOne.f);
20113
20114      if (
20115        isString(lastSectionItem) &&
20116        trailingLinebreak.test(lastSectionItem) &&
20117        leadingLinebreak.test(current)
20118      ) {
20119        backOne.f[backOne.f.length - 1] = lastSectionItem.replace(trailingLinebreak, '\n');
20120        items[i] = current.replace(leadingLinebreak, '');
20121      }
20122    }
20123  }
20124
20125  return items;
20126}
20127
20128function isComment(item) {
20129  return item.t === COMMENT || item.t === DELIMCHANGE;
20130}
20131
20132function isSection(item) {
20133  return (item.t === SECTION || item.t === INVERTED) && item.f;
20134}
20135
20136function trimWhitespace(items, leadingPattern, trailingPattern) {
20137  var item;
20138
20139  if (leadingPattern) {
20140    item = items[0];
20141    if (isString(item)) {
20142      item = item.replace(leadingPattern, '');
20143
20144      if (!item) {
20145        items.shift();
20146      } else {
20147        items[0] = item;
20148      }
20149    }
20150  }
20151
20152  if (trailingPattern) {
20153    item = lastItem(items);
20154    if (isString(item)) {
20155      item = item.replace(trailingPattern, '');
20156
20157      if (!item) {
20158        items.pop();
20159      } else {
20160        items[items.length - 1] = item;
20161      }
20162    }
20163  }
20164}
20165
20166var contiguousWhitespace = /[ \t\f\r\n]+/g;
20167var leadingWhitespace$1 = /^[ \t\f\r\n]+/;
20168var trailingWhitespace = /[ \t\f\r\n]+$/;
20169var leadingNewLine = /^(?:\r\n|\r|\n)/;
20170var trailingNewLine = /(?:\r\n|\r|\n)$/;
20171
20172function cleanup(
20173  items,
20174  stripComments,
20175  preserveWhitespace,
20176  removeLeadingWhitespace,
20177  removeTrailingWhitespace,
20178  whiteSpaceElements
20179) {
20180  if (isString(items)) { return; }
20181
20182  var i,
20183    item,
20184    previousItem,
20185    nextItem,
20186    preserveWhitespaceInsideFragment,
20187    removeLeadingWhitespaceInsideFragment,
20188    removeTrailingWhitespaceInsideFragment;
20189
20190  // First pass - remove standalones and comments etc
20191  stripStandalones(items);
20192
20193  i = items.length;
20194  while (i--) {
20195    item = items[i];
20196
20197    // Remove delimiter changes, unsafe elements etc
20198    if (item.exclude) {
20199      items.splice(i, 1);
20200    } else if (stripComments && item.t === COMMENT) {
20201      // Remove comments, unless we want to keep them
20202      items.splice(i, 1);
20203    }
20204  }
20205
20206  // If necessary, remove leading and trailing whitespace
20207  trimWhitespace(
20208    items,
20209    removeLeadingWhitespace ? leadingWhitespace$1 : null,
20210    removeTrailingWhitespace ? trailingWhitespace : null
20211  );
20212
20213  i = items.length;
20214  while (i--) {
20215    item = items[i];
20216    removeLeadingWhitespaceInsideFragment = removeTrailingWhitespaceInsideFragment = false;
20217
20218    // Recurse
20219    if (item.f) {
20220      var isPreserveWhitespaceElement =
20221        item.t === ELEMENT &&
20222        (whiteSpaceElements[item.e.toLowerCase()] || whiteSpaceElements[item.e]);
20223      preserveWhitespaceInsideFragment = preserveWhitespace || isPreserveWhitespaceElement;
20224
20225      if (!preserveWhitespace && isPreserveWhitespaceElement) {
20226        trimWhitespace(item.f, leadingNewLine, trailingNewLine);
20227      }
20228
20229      if (!preserveWhitespaceInsideFragment) {
20230        previousItem = items[i - 1];
20231        nextItem = items[i + 1];
20232
20233        // if the previous item was a text item with trailing whitespace,
20234        // remove leading whitespace inside the fragment
20235        if (!previousItem || (isString(previousItem) && trailingWhitespace.test(previousItem))) {
20236          removeLeadingWhitespaceInsideFragment = true;
20237        }
20238
20239        // and vice versa
20240        if (!nextItem || (isString(nextItem) && leadingWhitespace$1.test(nextItem))) {
20241          removeTrailingWhitespaceInsideFragment = true;
20242        }
20243      }
20244
20245      cleanup(
20246        item.f,
20247        stripComments,
20248        preserveWhitespaceInsideFragment,
20249        removeLeadingWhitespaceInsideFragment,
20250        removeTrailingWhitespaceInsideFragment,
20251        whiteSpaceElements
20252      );
20253    }
20254
20255    // Split if-else blocks into two (an if, and an unless)
20256    if (item.l) {
20257      cleanup(
20258        item.l,
20259        stripComments,
20260        preserveWhitespace,
20261        removeLeadingWhitespaceInsideFragment,
20262        removeTrailingWhitespaceInsideFragment,
20263        whiteSpaceElements
20264      );
20265
20266      item.l.forEach(function (s) { return (s.l = 1); });
20267      item.l.unshift(i + 1, 0);
20268      items.splice.apply(items, item.l);
20269      delete item.l; // TODO would be nice if there was a way around this
20270    }
20271
20272    // Clean up conditional attributes
20273    if (item.m) {
20274      cleanup(
20275        item.m,
20276        stripComments,
20277        preserveWhitespace,
20278        removeLeadingWhitespaceInsideFragment,
20279        removeTrailingWhitespaceInsideFragment,
20280        whiteSpaceElements
20281      );
20282      if (item.m.length < 1) { delete item.m; }
20283    }
20284  }
20285
20286  // final pass - fuse text nodes together
20287  i = items.length;
20288  while (i--) {
20289    if (isString(items[i])) {
20290      if (isString(items[i + 1])) {
20291        items[i] = items[i] + items[i + 1];
20292        items.splice(i + 1, 1);
20293      }
20294
20295      if (!preserveWhitespace) {
20296        items[i] = items[i].replace(contiguousWhitespace, ' ');
20297      }
20298
20299      if (items[i] === '') {
20300        items.splice(i, 1);
20301      }
20302    }
20303  }
20304}
20305
20306var closingTagPattern = /^([a-zA-Z]{1,}:?[a-zA-Z0-9\-]*)\s*\>/;
20307
20308function readClosingTag(parser) {
20309  var tag;
20310
20311  var start = parser.pos;
20312
20313  // are we looking at a closing tag?
20314  if (!parser.matchString('</')) {
20315    return null;
20316  }
20317
20318  if ((tag = parser.matchPattern(closingTagPattern))) {
20319    if (parser.inside && tag !== parser.inside) {
20320      parser.pos = start;
20321      return null;
20322    }
20323
20324    return {
20325      t: CLOSING_TAG,
20326      e: tag
20327    };
20328  }
20329
20330  // We have an illegal closing tag, report it
20331  parser.pos -= 2;
20332  parser.error('Illegal closing tag');
20333}
20334
20335function hyphenateCamel(camelCaseStr) {
20336  return camelCaseStr.replace(/([A-Z])/g, function (match, $1) {
20337    return '-' + $1.toLowerCase();
20338  });
20339}
20340
20341var tagNamePattern = /^[a-zA-Z]{1,}:?[a-zA-Z0-9\-]*/;
20342var anchorPattern = /^[a-zA-Z_$][-a-zA-Z0-9_$]*/;
20343var validTagNameFollower = /^[\s\n\/>]/;
20344var semiEnd = /;\s*$/;
20345var exclude = { exclude: true };
20346
20347// based on http://developers.whatwg.org/syntax.html#syntax-tag-omission
20348var disallowedContents = {
20349  li: ['li'],
20350  dt: ['dt', 'dd'],
20351  dd: ['dt', 'dd'],
20352  p: 'address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul'.split(
20353    ' '
20354  ),
20355  rt: ['rt', 'rp'],
20356  rp: ['rt', 'rp'],
20357  optgroup: ['optgroup'],
20358  option: ['option', 'optgroup'],
20359  thead: ['tbody', 'tfoot'],
20360  tbody: ['tbody', 'tfoot'],
20361  tfoot: ['tbody'],
20362  tr: ['tr', 'tbody'],
20363  td: ['td', 'th', 'tr'],
20364  th: ['td', 'th', 'tr']
20365};
20366
20367function readElement$1(parser) {
20368  var attribute,
20369    selfClosing,
20370    children,
20371    partials,
20372    hasPartials,
20373    child,
20374    closed,
20375    pos,
20376    remaining,
20377    closingTag,
20378    anchor;
20379
20380  var start = parser.pos;
20381
20382  if (parser.inside || parser.inAttribute || parser.textOnlyMode) {
20383    return null;
20384  }
20385
20386  if (!parser.matchString('<')) {
20387    return null;
20388  }
20389
20390  // if this is a closing tag, abort straight away
20391  if (parser.nextChar() === '/') {
20392    return null;
20393  }
20394
20395  var element = {};
20396  if (parser.includeLinePositions) {
20397    element.q = parser.getLinePos(start);
20398  }
20399
20400  // check for doctype decl
20401  if (parser.matchString('!')) {
20402    element.t = DOCTYPE;
20403    if (!parser.matchPattern(/^doctype/i)) {
20404      parser.error('Expected DOCTYPE declaration');
20405    }
20406
20407    element.a = parser.matchPattern(/^(.+?)>/);
20408    return element;
20409  } else if ((anchor = parser.matchString('#'))) {
20410    // check for anchor
20411    parser.sp();
20412    element.t = ANCHOR;
20413    element.n = parser.matchPattern(anchorPattern);
20414  } else {
20415    // otherwise, it's an element/component
20416    element.t = ELEMENT;
20417
20418    // element name
20419    element.e = parser.matchPattern(tagNamePattern);
20420    if (!element.e) {
20421      return null;
20422    }
20423  }
20424
20425  // next character must be whitespace, closing solidus or '>'
20426  if (!validTagNameFollower.test(parser.nextChar())) {
20427    parser.error('Illegal tag name');
20428  }
20429
20430  parser.sp();
20431
20432  parser.inTag = true;
20433
20434  // directives and attributes
20435  while ((attribute = readMustache(parser))) {
20436    if (attribute !== false) {
20437      if (!element.m) { element.m = []; }
20438      element.m.push(attribute);
20439    }
20440
20441    parser.sp();
20442  }
20443
20444  parser.inTag = false;
20445
20446  // allow whitespace before closing solidus
20447  parser.sp();
20448
20449  // self-closing solidus?
20450  if (parser.matchString('/')) {
20451    selfClosing = true;
20452  }
20453
20454  // closing angle bracket
20455  if (!parser.matchString('>')) {
20456    return null;
20457  }
20458
20459  var lowerCaseName = (element.e || element.n).toLowerCase();
20460  var preserveWhitespace = parser.preserveWhitespace;
20461
20462  if (!selfClosing && (anchor || !voidElements[element.e.toLowerCase()])) {
20463    if (!anchor) {
20464      parser.elementStack.push(lowerCaseName);
20465
20466      // Special case - if we open a script element, further tags should
20467      // be ignored unless they're a closing script element
20468      if (lowerCaseName in parser.interpolate) {
20469        parser.inside = lowerCaseName;
20470      }
20471    }
20472
20473    children = [];
20474    partials = create(null);
20475
20476    do {
20477      pos = parser.pos;
20478      remaining = parser.remaining();
20479
20480      if (!remaining) {
20481        // if this happens to be a script tag and there's no content left, it's because
20482        // a closing script tag can't appear in a script
20483        if (parser.inside === 'script') {
20484          closed = true;
20485          break;
20486        }
20487
20488        parser.error(
20489          ("Missing end " + (parser.elementStack.length > 1 ? 'tags' : 'tag') + " (" + (parser.elementStack
20490            .reverse()
20491            .map(function (x) { return ("</" + x + ">"); })
20492            .join('')) + ")")
20493        );
20494      }
20495
20496      // if for example we're in an <li> element, and we see another
20497      // <li> tag, close the first so they become siblings
20498      if (!anchor && !canContain(lowerCaseName, remaining)) {
20499        closed = true;
20500      } else if (!anchor && (closingTag = readClosingTag(parser))) {
20501        // closing tag
20502        closed = true;
20503
20504        var closingTagName = closingTag.e.toLowerCase();
20505
20506        // if this *isn't* the closing tag for the current element...
20507        if (closingTagName !== lowerCaseName) {
20508          // rewind parser
20509          parser.pos = pos;
20510
20511          // if it doesn't close a parent tag, error
20512          if (!~parser.elementStack.indexOf(closingTagName)) {
20513            var errorMessage = 'Unexpected closing tag';
20514
20515            // add additional help for void elements, since component names
20516            // might clash with them
20517            if (voidElements[closingTagName.toLowerCase()]) {
20518              errorMessage += " (<" + closingTagName + "> is a void element - it cannot contain children)";
20519            }
20520
20521            parser.error(errorMessage);
20522          }
20523        }
20524      } else if (anchor && readAnchorClose(parser, element.n)) {
20525        closed = true;
20526      } else {
20527        // implicit close by closing section tag. TODO clean this up
20528        var tag = {
20529          open: parser.standardDelimiters[0],
20530          close: parser.standardDelimiters[1]
20531        };
20532        if (readClosing(parser, tag) || readInline(parser, tag)) {
20533          closed = true;
20534          parser.pos = pos;
20535        } else if ((child = parser.read(PARTIAL_READERS))) {
20536          if (partials[child.n]) {
20537            parser.pos = pos;
20538            parser.error('Duplicate partial definition');
20539          }
20540
20541          cleanup(
20542            child.f,
20543            parser.stripComments,
20544            preserveWhitespace,
20545            !preserveWhitespace,
20546            !preserveWhitespace,
20547            parser.whiteSpaceElements
20548          );
20549
20550          partials[child.n] = child.f;
20551          hasPartials = true;
20552        } else {
20553          if ((child = parser.read(READERS))) {
20554            children.push(child);
20555          } else {
20556            closed = true;
20557          }
20558        }
20559      }
20560    } while (!closed);
20561
20562    if (children.length) {
20563      element.f = children;
20564    }
20565
20566    if (hasPartials) {
20567      element.p = partials;
20568    }
20569
20570    parser.elementStack.pop();
20571  }
20572
20573  parser.inside = null;
20574
20575  if (parser.sanitizeElements && parser.sanitizeElements.indexOf(lowerCaseName) !== -1) {
20576    return exclude;
20577  }
20578
20579  if (
20580    element.m &&
20581    lowerCaseName !== 'input' &&
20582    lowerCaseName !== 'select' &&
20583    lowerCaseName !== 'textarea' &&
20584    lowerCaseName !== 'option'
20585  ) {
20586    var attrs = element.m;
20587    var classes, styles, cls, style;
20588    var i = 0;
20589    var a;
20590    while (i < attrs.length) {
20591      a = attrs[i];
20592
20593      if (a.t !== ATTRIBUTE) {
20594        i++;
20595        continue;
20596      }
20597
20598      if (a.n.indexOf('class-') === 0 && !a.f) {
20599        // static class directives
20600        (classes || (classes = [])).push(a.n.slice(6));
20601        attrs.splice(i, 1);
20602      } else if (a.n.indexOf('style-') === 0 && isString(a.f)) {
20603        // static style directives
20604        (styles || (styles = [])).push(((hyphenateCamel(a.n.slice(6))) + ": " + (a.f) + ";"));
20605        attrs.splice(i, 1);
20606      } else if (a.n === 'class' && isString(a.f)) {
20607        // static class attrs
20608        (classes || (classes = [])).push(a.f);
20609        attrs.splice(i, 1);
20610      } else if (a.n === 'style' && isString(a.f)) {
20611        // static style attrs
20612        (styles || (styles = [])).push(a.f + (semiEnd.test(a.f) ? '' : ';'));
20613        attrs.splice(i, 1);
20614      } else if (a.n === 'class') {
20615        cls = a;
20616        i++;
20617      } else if (a.n === 'style') {
20618        style = a;
20619        i++;
20620      } else if (
20621        !~a.n.indexOf(':') &&
20622        a.n !== 'value' &&
20623        a.n !== 'contenteditable' &&
20624        isString(a.f)
20625      ) {
20626        a.g = 1;
20627        i++;
20628      } else {
20629        i++;
20630      }
20631    }
20632
20633    if (classes) {
20634      if (!cls || !isString(cls.f))
20635        { attrs.unshift({ t: ATTRIBUTE, n: 'class', f: classes.join(' '), g: 1 }); }
20636      else { cls.f += ' ' + classes.join(' '); }
20637    } else if (cls && isString(cls.f)) { cls.g = 1; }
20638
20639    if (styles) {
20640      if (!style || !isString(style.f))
20641        { attrs.unshift({ t: ATTRIBUTE, n: 'style', f: styles.join(' '), g: 1 }); }
20642      else { style.f += '; ' + styles.join(' '); }
20643    } else if (style && isString(style.f)) { style.g = 1; }
20644  }
20645
20646  return element;
20647}
20648
20649function canContain(name, remaining) {
20650  var match = /^<([a-zA-Z][a-zA-Z0-9]*)/.exec(remaining);
20651  var disallowed = disallowedContents[name];
20652
20653  if (!match || !disallowed) {
20654    return true;
20655  }
20656
20657  return !~disallowed.indexOf(match[1].toLowerCase());
20658}
20659
20660function readAnchorClose(parser, name) {
20661  var pos = parser.pos;
20662  if (!parser.matchString('</')) {
20663    return null;
20664  }
20665
20666  parser.matchString('#');
20667  parser.sp();
20668
20669  if (!parser.matchString(name)) {
20670    parser.pos = pos;
20671    return null;
20672  }
20673
20674  parser.sp();
20675
20676  if (!parser.matchString('>')) {
20677    parser.pos = pos;
20678    return null;
20679  }
20680
20681  return true;
20682}
20683
20684var inlines = /^\s*(elseif|else|then|catch)\s*/;
20685function readInline(parser, tag) {
20686  var pos = parser.pos;
20687  if (!parser.matchString(tag.open)) { return; }
20688  if (parser.matchPattern(inlines)) {
20689    return true;
20690  } else {
20691    parser.pos = pos;
20692  }
20693}
20694
20695function readText(parser) {
20696  var index, disallowed, barrier;
20697
20698  var remaining = parser.remaining();
20699
20700  if (parser.textOnlyMode) {
20701    disallowed = parser.tags.map(function (t) { return t.open; });
20702    disallowed = disallowed.concat(parser.tags.map(function (t) { return '\\' + t.open; }));
20703
20704    index = getLowestIndex(remaining, disallowed);
20705  } else {
20706    barrier = parser.inside ? '</' + parser.inside : '<';
20707
20708    if (parser.inside && !parser.interpolate[parser.inside]) {
20709      index = remaining.indexOf(barrier);
20710    } else {
20711      disallowed = parser.tags.map(function (t) { return t.open; });
20712      disallowed = disallowed.concat(parser.tags.map(function (t) { return '\\' + t.open; }));
20713
20714      // http://developers.whatwg.org/syntax.html#syntax-attributes
20715      if (parser.inAttribute === true) {
20716        // we're inside an unquoted attribute value
20717        disallowed.push("\"", "'", "=", "<", ">", '`');
20718      } else if (parser.inAttribute) {
20719        // quoted attribute value
20720        disallowed.push(parser.inAttribute);
20721      } else {
20722        disallowed.push(barrier);
20723      }
20724
20725      index = getLowestIndex(remaining, disallowed);
20726    }
20727  }
20728
20729  if (!index) {
20730    return null;
20731  }
20732
20733  if (index === -1) {
20734    index = remaining.length;
20735  }
20736
20737  parser.pos += index;
20738
20739  if ((parser.inside && parser.inside !== 'textarea') || parser.textOnlyMode) {
20740    return remaining.substr(0, index);
20741  } else {
20742    return decodeCharacterReferences(remaining.substr(0, index));
20743  }
20744}
20745
20746var partialDefinitionSectionPattern = /^\s*#\s*partial\s+/;
20747
20748function readPartialDefinitionSection(parser) {
20749  var child, closed;
20750
20751  var start = parser.pos;
20752
20753  var delimiters = parser.standardDelimiters;
20754
20755  if (!parser.matchString(delimiters[0])) {
20756    return null;
20757  }
20758
20759  if (!parser.matchPattern(partialDefinitionSectionPattern)) {
20760    parser.pos = start;
20761    return null;
20762  }
20763
20764  var name = parser.matchPattern(/^[a-zA-Z_$][a-zA-Z_$0-9\-\/]*/);
20765
20766  if (!name) {
20767    parser.error('expected legal partial name');
20768  }
20769
20770  parser.sp();
20771  if (!parser.matchString(delimiters[1])) {
20772    parser.error(("Expected closing delimiter '" + (delimiters[1]) + "'"));
20773  }
20774
20775  var content = [];
20776
20777  var open = delimiters[0];
20778  var close = delimiters[1];
20779
20780  do {
20781    if ((child = readClosing(parser, { open: open, close: close }))) {
20782      if (child.r !== 'partial') {
20783        parser.error(("Expected " + open + "/partial" + close));
20784      }
20785
20786      closed = true;
20787    } else {
20788      child = parser.read(READERS);
20789
20790      if (!child) {
20791        parser.error(("Expected " + open + "/partial" + close));
20792      }
20793
20794      content.push(child);
20795    }
20796  } while (!closed);
20797
20798  return {
20799    t: INLINE_PARTIAL,
20800    n: name,
20801    f: content
20802  };
20803}
20804
20805function readTemplate(parser) {
20806  var fragment = [];
20807  var partials = create(null);
20808  var hasPartials = false;
20809
20810  var preserveWhitespace = parser.preserveWhitespace;
20811
20812  while (parser.pos < parser.str.length) {
20813    var pos = parser.pos;
20814    var item = (void 0), partial = (void 0);
20815
20816    if ((partial = parser.read(PARTIAL_READERS))) {
20817      if (partials[partial.n]) {
20818        parser.pos = pos;
20819        parser.error('Duplicated partial definition');
20820      }
20821
20822      cleanup(
20823        partial.f,
20824        parser.stripComments,
20825        preserveWhitespace,
20826        !preserveWhitespace,
20827        !preserveWhitespace,
20828        parser.whiteSpaceElements
20829      );
20830
20831      partials[partial.n] = partial.f;
20832      hasPartials = true;
20833    } else if ((item = parser.read(READERS))) {
20834      fragment.push(item);
20835    } else {
20836      parser.error('Unexpected template content');
20837    }
20838  }
20839
20840  var result = {
20841    v: TEMPLATE_VERSION,
20842    t: fragment
20843  };
20844
20845  if (hasPartials) {
20846    result.p = partials;
20847  }
20848
20849  return result;
20850}
20851
20852function insertExpressions(obj, expr) {
20853  keys(obj).forEach(function (key) {
20854    if (isExpression(key, obj)) { return addTo(obj, expr); }
20855
20856    var ref = obj[key];
20857    if (hasChildren(ref)) { insertExpressions(ref, expr); }
20858  });
20859}
20860
20861function isExpression(key, obj) {
20862  return key === 's' && isArray(obj.r);
20863}
20864
20865function addTo(obj, expr) {
20866  var s = obj.s;
20867  var r = obj.r;
20868  if (!expr[s]) { expr[s] = fromExpression(s, r.length); }
20869}
20870
20871function hasChildren(ref) {
20872  return isArray(ref) || isObject(ref);
20873}
20874
20875var shared = {};
20876
20877// See https://github.com/ractivejs/template-spec for information
20878// about the Ractive template specification
20879
20880var STANDARD_READERS = [
20881  readPartial,
20882  readUnescaped,
20883  readSection,
20884  readInterpolator,
20885  readComment
20886];
20887var TRIPLE_READERS = [readTriple];
20888
20889var READERS = [readMustache, readHtmlComment, readElement$1, readText];
20890var PARTIAL_READERS = [readPartialDefinitionSection];
20891
20892var preserveWhitespaceElements = { pre: 1, script: 1, style: 1, textarea: 1 };
20893
20894var defaultInterpolate = { textarea: true, script: true, style: true, template: true };
20895
20896var StandardParser = Parser.extend({
20897  init: function init(str, options) {
20898    var tripleDelimiters = options.tripleDelimiters || shared.defaults.tripleDelimiters;
20899    var staticDelimiters = options.staticDelimiters || shared.defaults.staticDelimiters;
20900    var staticTripleDelimiters =
20901      options.staticTripleDelimiters || shared.defaults.staticTripleDelimiters;
20902
20903    this.standardDelimiters = options.delimiters || shared.defaults.delimiters;
20904
20905    this.tags = [
20906      {
20907        isStatic: false,
20908        isTriple: false,
20909        open: this.standardDelimiters[0],
20910        close: this.standardDelimiters[1],
20911        readers: STANDARD_READERS
20912      },
20913      {
20914        isStatic: false,
20915        isTriple: true,
20916        open: tripleDelimiters[0],
20917        close: tripleDelimiters[1],
20918        readers: TRIPLE_READERS
20919      },
20920      {
20921        isStatic: true,
20922        isTriple: false,
20923        open: staticDelimiters[0],
20924        close: staticDelimiters[1],
20925        readers: STANDARD_READERS
20926      },
20927      {
20928        isStatic: true,
20929        isTriple: true,
20930        open: staticTripleDelimiters[0],
20931        close: staticTripleDelimiters[1],
20932        readers: TRIPLE_READERS
20933      }
20934    ];
20935
20936    this.contextLines = options.contextLines || shared.defaults.contextLines;
20937
20938    this.sortMustacheTags();
20939
20940    this.sectionDepth = 0;
20941    this.elementStack = [];
20942
20943    this.interpolate = assign(
20944      {},
20945      defaultInterpolate,
20946      shared.defaults.interpolate,
20947      options.interpolate
20948    );
20949
20950    if (options.sanitize === true) {
20951      options.sanitize = {
20952        // blacklist from https://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/lang/html/html4-elements-whitelist.json
20953        elements: 'applet base basefont body frame frameset head html isindex link meta noframes noscript object param script style title'.split(
20954          ' '
20955        ),
20956        eventAttributes: true
20957      };
20958    }
20959
20960    this.stripComments = options.stripComments !== false;
20961    this.preserveWhitespace = isObjectType(options.preserveWhitespace)
20962      ? false
20963      : options.preserveWhitespace;
20964    this.sanitizeElements = options.sanitize && options.sanitize.elements;
20965    this.sanitizeEventAttributes = options.sanitize && options.sanitize.eventAttributes;
20966    this.includeLinePositions = options.includeLinePositions;
20967    this.textOnlyMode = options.textOnlyMode;
20968    this.csp = options.csp;
20969    this.allowExpressions = options.allowExpressions;
20970
20971    if (options.expression) { this.converters = [readExpression]; }
20972
20973    if (options.attributes) { this.inTag = true; }
20974
20975    // special whitespace handling requested for certain elements
20976    this.whiteSpaceElements = assign({}, options.preserveWhitespace, preserveWhitespaceElements);
20977  },
20978
20979  postProcess: function postProcess(result, options) {
20980    var parserResult = result[0];
20981
20982    if (options.expression) {
20983      var expr = flattenExpression(parserResult);
20984      expr.e = fromExpression(expr.s, expr.r.length);
20985      return expr;
20986    } else {
20987      // special case - empty string
20988      if (!result.length) {
20989        return { t: [], v: TEMPLATE_VERSION };
20990      }
20991
20992      if (this.sectionDepth > 0) {
20993        this.error('A section was left open');
20994      }
20995
20996      cleanup(
20997        parserResult.t,
20998        this.stripComments,
20999        this.preserveWhitespace,
21000        !this.preserveWhitespace,
21001        !this.preserveWhitespace,
21002        this.whiteSpaceElements
21003      );
21004
21005      if (this.csp !== false) {
21006        var expr$1 = {};
21007
21008        insertExpressions(parserResult.t, expr$1);
21009        insertExpressions(parserResult.p || {}, expr$1);
21010
21011        if (keys(expr$1).length) { parserResult.e = expr$1; }
21012      }
21013
21014      return parserResult;
21015    }
21016  },
21017
21018  converters: [readTemplate],
21019
21020  sortMustacheTags: function sortMustacheTags() {
21021    // Sort in order of descending opening delimiter length (longer first),
21022    // to protect against opening delimiters being substrings of each other
21023    this.tags.sort(function (a, b) {
21024      return b.open.length - a.open.length;
21025    });
21026  }
21027});
21028
21029function parse(template, options) {
21030  return new StandardParser(template, options || {}).result;
21031}
21032
21033var parseOptions = [
21034  'delimiters',
21035  'tripleDelimiters',
21036  'staticDelimiters',
21037  'staticTripleDelimiters',
21038  'csp',
21039  'interpolate',
21040  'preserveWhitespace
vendor: 5,983 bytes, lines 21040-21264
21040',
21041  'sanitize',
21042  'stripComments',
21043  'contextLines',
21044  'allowExpressions',
21045  'attributes'
21046];
21047
21048var TEMPLATE_INSTRUCTIONS = "Either preparse or use a ractive runtime source that includes the parser. ";
21049
21050var COMPUTATION_INSTRUCTIONS = "Either include a version of Ractive that can parse or convert your computation strings to functions.";
21051
21052function throwNoParse(method, error, instructions) {
21053  if (!method) {
21054    fatal(("Missing Ractive.parse - cannot parse " + error + ". " + instructions));
21055  }
21056}
21057
21058function createFunction(body, length) {
21059  throwNoParse(fromExpression, 'new expression function', TEMPLATE_INSTRUCTIONS);
21060  return fromExpression(body, length);
21061}
21062
21063function createFunctionFromString(str, bindTo) {
21064  throwNoParse(parse, 'compution string "${str}"', COMPUTATION_INSTRUCTIONS);
21065  var tpl = parse(str, { expression: true });
21066  return function() {
21067    return tpl.e.apply(bindTo, tpl.r.map(function (r) { return bindTo.get(r); }));
21068  };
21069}
21070
21071var parser = {
21072  fromId: function fromId(id, options) {
21073    if (!doc) {
21074      if (options && options.noThrow) {
21075        return;
21076      }
21077      throw new Error(("Cannot retrieve template #" + id + " as Ractive is not running in a browser."));
21078    }
21079
21080    if (id) { id = id.replace(/^#/, ''); }
21081
21082    var template;
21083
21084    if (!(template = doc.getElementById(id))) {
21085      if (options && options.noThrow) {
21086        return;
21087      }
21088      throw new Error(("Could not find template element with id #" + id));
21089    }
21090
21091    if (template.tagName.toUpperCase() !== 'SCRIPT') {
21092      if (options && options.noThrow) {
21093        return;
21094      }
21095      throw new Error(("Template element with id #" + id + ", must be a <script> element"));
21096    }
21097
21098    return 'textContent' in template ? template.textContent : template.innerHTML;
21099  },
21100
21101  isParsed: function isParsed(template) {
21102    return !isString(template);
21103  },
21104
21105  getParseOptions: function getParseOptions(ractive) {
21106    // Could be Ractive or a Component
21107    if (ractive.defaults) {
21108      ractive = ractive.defaults;
21109    }
21110
21111    return parseOptions.reduce(function (val, key) {
21112      val[key] = ractive[key];
21113      return val;
21114    }, {});
21115  },
21116
21117  parse: function parse$1(template, options) {
21118    throwNoParse(parse, 'template', TEMPLATE_INSTRUCTIONS);
21119    var parsed = parse(template, options);
21120    addFunctions(parsed);
21121    return parsed;
21122  },
21123
21124  parseFor: function parseFor(template, ractive) {
21125    return this.parse(template, this.getParseOptions(ractive));
21126  }
21127};
21128
21129function getComputationSignature(ractive, key, signature) {
21130  var getter;
21131  var setter;
21132
21133  // useful for debugging
21134  var getterString;
21135  var getterUseStack;
21136  var setterString;
21137
21138  if (isFunction(signature)) {
21139    getter = bind(signature, ractive);
21140    getterString = signature.toString();
21141    getterUseStack = true;
21142  }
21143
21144  if (isString(signature)) {
21145    getter = createFunctionFromString(signature, ractive);
21146    getterString = signature;
21147  }
21148
21149  if (isObjectType(signature)) {
21150    if (isString(signature.get)) {
21151      getter = createFunctionFromString(signature.get, ractive);
21152      getterString = signature.get;
21153    } else if (isFunction(signature.get)) {
21154      getter = bind(signature.get, ractive);
21155      getterString = signature.get.toString();
21156      getterUseStack = true;
21157    } else {
21158      fatal('`%s` computation must have a `get()` method', key);
21159    }
21160
21161    if (isFunction(signature.set)) {
21162      setter = bind(signature.set, ractive);
21163      setterString = signature.set.toString();
21164    }
21165  }
21166
21167  return {
21168    getter: getter,
21169    setter: setter,
21170    getterString: getterString,
21171    setterString: setterString,
21172    getterUseStack: getterUseStack
21173  };
21174}
21175
21176var id = 0;
21177
21178var TransitionManager = function TransitionManager(callback, parent) {
21179  this.callback = callback;
21180  this.parent = parent;
21181
21182  this.intros = [];
21183  this.outros = [];
21184
21185  this.children = [];
21186  this.totalChildren = this.outroChildren = 0;
21187
21188  this.detachQueue = [];
21189  this.outrosComplete = false;
21190
21191  this.id = id++;
21192
21193  if (parent) {
21194    parent.addChild(this);
21195  }
21196};
21197var TransitionManager__proto__ = TransitionManager.prototype;
21198
21199TransitionManager__proto__.add = function add (transition) {
21200  var list = transition.isIntro ? this.intros : this.outros;
21201  transition.starting = true;
21202  list.push(transition);
21203};
21204
21205TransitionManager__proto__.addChild = function addChild (child) {
21206  this.children.push(child);
21207
21208  this.totalChildren += 1;
21209  this.outroChildren += 1;
21210};
21211
21212TransitionManager__proto__.checkStart = function checkStart () {
21213  if (this.parent && this.parent.started) { this.start(); }
21214};
21215
21216TransitionManager__proto__.decrementOutros = function decrementOutros () {
21217  this.outroChildren -= 1;
21218  check(this);
21219};
21220
21221TransitionManager__proto__.decrementTotal = function decrementTotal () {
21222  this.totalChildren -= 1;
21223  check(this);
21224};
21225
21226TransitionManager__proto__.detachNodes = function detachNodes () {
21227    var this$1 = this;
21228
21229  var len = this.detachQueue.length;
21230  for (var i = 0; i < len; i++) { this$1.detachQueue[i].detach(); }
21231  len = this.children.length;
21232  for (var i$1 = 0; i$1 < len; i$1++) { this$1.children[i$1].detachNodes(); }
21233  this.detachQueue = [];
21234};
21235
21236TransitionManager__proto__.ready = function ready () {
21237  if (this.detachQueue.length) { detachImmediate(this); }
21238};
21239
21240TransitionManager__proto__.remove = function remove (transition) {
21241  var list = transition.isIntro ? this.intros : this.outros;
21242  removeFromArray(list, transition);
21243  check(this);
21244};
21245
21246TransitionManager__proto__.start = function start () {
21247  this.started = true;
21248  this.children.forEach(function (c) { return c.start(); });
21249  this.intros.concat(this.outros).forEach(function (t) { return t.start(); });
21250  check(this);
21251};
21252
21253function check(tm) {
21254  if (!tm.started || tm.outros.length || tm.outroChildren) { return; }
21255
21256  // If all outros are complete, and we haven't already done this,
21257  // we notify the parent if there is one, otherwise
21258  // start detaching nodes
21259  if (!tm.outrosComplete) {
21260    tm.outrosComplete = true;
21261
21262    if (tm.parent) { tm.parent.decrementOutros(tm); }
21263
21264    if (
21264!tm.parent || tm.parent.outrosComplete) {
21265      tm.detachNodes();
21266    }
21267  }
21268
21269  // Once everything is done, we can notify parent transition
21270  // manager and call the callback
21271  if (!tm.intros.length && !tm.totalChildren) {
21272    if (isFunction(tm.callback)) {
21273      tm.callback();
21274    }
21275
21276    if (tm.parent && !tm.notifiedTotal) {
21277      tm.notifiedTotal = true;
21278      tm.parent.decrementTotal();
21279    }
21280  }
vendor: 14,385 bytes, lines 21280-21845
21280
21281}
21282
21283// check through the detach queue to see if a node is up or downstream from a
21284// transition and if not, go ahead and detach it
21285function detachImmediate(manager) {
21286  var queue = manager.detachQueue;
21287  var outros = collectAllOutros(manager);
21288
21289  if (!outros.length) {
21290    manager.detachNodes();
21291  } else {
21292    var i = queue.length;
21293    var j = 0;
21294    var node, trans;
21295    var nqueue = (manager.detachQueue = []);
21296
21297    start: while (i--) {
21298      node = queue[i].node;
21299      j = outros.length;
21300      while (j--) {
21301        trans = outros[j].element.node;
21302        // check to see if the node is, contains, or is contained by the transitioning node
21303        if (trans === node || trans.contains(node) || node.contains(trans)) {
21304          nqueue.push(queue[i]);
21305          continue start;
21306        }
21307      }
21308
21309      // no match, we can drop it
21310      queue[i].detach();
21311    }
21312  }
21313}
21314
21315function collectAllOutros(manager, _list) {
21316  var list = _list;
21317
21318  // if there's no list, we're starting at the root to build one
21319  if (!list) {
21320    list = [];
21321    var parent = manager;
21322    while (parent.parent) { parent = parent.parent; }
21323    return collectAllOutros(parent, list);
21324  } else {
21325    // grab all outros from child managers
21326    var i = manager.children.length;
21327    while (i--) {
21328      list = collectAllOutros(manager.children[i], list);
21329    }
21330
21331    // grab any from this manager if there are any
21332    if (manager.outros.length) { list = list.concat(manager.outros); }
21333
21334    return list;
21335  }
21336}
21337
21338var batch;
21339
21340var runloop = {
21341  active: function active() {
21342    return !!batch;
21343  },
21344
21345  start: function start() {
21346    var fulfilPromise;
21347    var promise = new Promise(function (f) { return (fulfilPromise = f); });
21348
21349    batch = {
21350      previousBatch: batch,
21351      transitionManager: new TransitionManager(fulfilPromise, batch && batch.transitionManager),
21352      fragments: [],
21353      tasks: [],
21354      immediateObservers: [],
21355      deferredObservers: [],
21356      promise: promise
21357    };
21358
21359    return promise;
21360  },
21361
21362  end: function end() {
21363    flushChanges();
21364
21365    if (!batch.previousBatch) { batch.transitionManager.start(); }
21366    else { batch.transitionManager.checkStart(); }
21367
21368    batch = batch.previousBatch;
21369  },
21370
21371  addFragment: function addFragment(fragment) {
21372    addToArray(batch.fragments, fragment);
21373  },
21374
21375  // TODO: come up with a better way to handle fragments that trigger their own update
21376  addFragmentToRoot: function addFragmentToRoot(fragment) {
21377    if (!batch) { return; }
21378
21379    var b = batch;
21380    while (b.previousBatch) {
21381      b = b.previousBatch;
21382    }
21383
21384    addToArray(b.fragments, fragment);
21385  },
21386
21387  addObserver: function addObserver(observer, defer) {
21388    if (!batch) {
21389      observer.dispatch();
21390    } else {
21391      addToArray(defer ? batch.deferredObservers : batch.immediateObservers, observer);
21392    }
21393  },
21394
21395  registerTransition: function registerTransition(transition) {
21396    transition._manager = batch.transitionManager;
21397    batch.transitionManager.add(transition);
21398  },
21399
21400  // synchronise node detachments with transition ends
21401  detachWhenReady: function detachWhenReady(thing) {
21402    batch.transitionManager.detachQueue.push(thing);
21403  },
21404
21405  scheduleTask: function scheduleTask(task, postRender) {
21406    var _batch;
21407
21408    if (!batch) {
21409      task();
21410    } else {
21411      _batch = batch;
21412      while (postRender && _batch.previousBatch) {
21413        // this can't happen until the DOM has been fully updated
21414        // otherwise in some situations (with components inside elements)
21415        // transitions and decorators will initialise prematurely
21416        _batch = _batch.previousBatch;
21417      }
21418
21419      _batch.tasks.push(task);
21420    }
21421  },
21422
21423  promise: function promise() {
21424    if (!batch) { return Promise.resolve(); }
21425
21426    var target = batch;
21427    while (target.previousBatch) {
21428      target = target.previousBatch;
21429    }
21430
21431    return target.promise || Promise.resolve();
21432  }
21433};
21434
21435function dispatch(observer) {
21436  observer.dispatch();
21437}
21438
21439function flushChanges() {
21440  var which = batch.immediateObservers;
21441  batch.immediateObservers = [];
21442  which.forEach(dispatch);
21443
21444  // Now that changes have been fully propagated, we can update the DOM
21445  // and complete other tasks
21446  var i = batch.fragments.length;
21447  var fragment;
21448
21449  which = batch.fragments;
21450  batch.fragments = [];
21451
21452  while (i--) {
21453    fragment = which[i];
21454    fragment.update();
21455  }
21456
21457  batch.transitionManager.ready();
21458
21459  which = batch.deferredObservers;
21460  batch.deferredObservers = [];
21461  which.forEach(dispatch);
21462
21463  var tasks = batch.tasks;
21464  batch.tasks = [];
21465
21466  for (i = 0; i < tasks.length; i += 1) {
21467    tasks[i]();
21468  }
21469
21470  // If updating the view caused some model blowback - e.g. a triple
21471  // containing <option> elements caused the binding on the <select>
21472  // to update - then we start over
21473  if (
21474    batch.fragments.length ||
21475    batch.immediateObservers.length ||
21476    batch.deferredObservers.length ||
21477    batch.tasks.length
21478  )
21479    { return flushChanges(); }
21480}
21481
21482// TODO what happens if a transition is aborted?
21483
21484var tickers = [];
21485var running = false;
21486
21487function tick() {
21488  runloop.start();
21489
21490  var now = performance.now();
21491
21492  var i;
21493  var ticker;
21494
21495  for (i = 0; i < tickers.length; i += 1) {
21496    ticker = tickers[i];
21497
21498    if (!ticker.tick(now)) {
21499      // ticker is complete, remove it from the stack, and decrement i so we don't miss one
21500      tickers.splice(i--, 1);
21501    }
21502  }
21503
21504  runloop.end();
21505
21506  if (tickers.length) {
21507    requestAnimationFrame(tick);
21508  } else {
21509    running = false;
21510  }
21511}
21512
21513var Ticker = function Ticker(options) {
21514  this.duration = options.duration;
21515  this.step = options.step;
21516  this.complete = options.complete;
21517  this.easing = options.easing;
21518
21519  this.start = performance.now();
21520  this.end = this.start + this.duration;
21521
21522  this.running = true;
21523
21524  tickers.push(this);
21525  if (!running) { requestAnimationFrame(tick); }
21526};
21527var Ticker__proto__ = Ticker.prototype;
21528
21529Ticker__proto__.tick = function tick (now) {
21530  if (!this.running) { return false; }
21531
21532  if (now > this.end) {
21533    if (this.step) { this.step(1); }
21534    if (this.complete) { this.complete(1); }
21535
21536    return false;
21537  }
21538
21539  var elapsed = now - this.start;
21540  var eased = this.easing(elapsed / this.duration);
21541
21542  if (this.step) { this.step(eased); }
21543
21544  return true;
21545};
21546
21547Ticker__proto__.stop = function stop () {
21548  if (this.abort) { this.abort(); }
21549  this.running = false;
21550};
21551
21552var prefixers = {};
21553
21554// TODO this is legacy. sooner we can replace the old adaptor API the better
21555/* istanbul ignore next */
21556function prefixKeypath(obj, prefix) {
21557  var prefixed = {};
21558
21559  if (!prefix) {
21560    return obj;
21561  }
21562
21563  prefix += '.';
21564
21565  for (var key in obj) {
21566    if (hasOwn(obj, key)) {
21567      prefixed[prefix + key] = obj[key];
21568    }
21569  }
21570
21571  return prefixed;
21572}
21573
21574function getPrefixer(rootKeypath) {
21575  var rootDot;
21576
21577  if (!prefixers[rootKeypath]) {
21578    rootDot = rootKeypath ? rootKeypath + '.' : '';
21579
21580    /* istanbul ignore next */
21581    prefixers[rootKeypath] = function(relativeKeypath, value) {
21582      var obj;
21583
21584      if (isString(relativeKeypath)) {
21585        obj = {};
21586        obj[rootDot + relativeKeypath] = value;
21587        return obj;
21588      }
21589
21590      if (isObjectType(relativeKeypath)) {
21591        // 'relativeKeypath' is in fact a hash, not a keypath
21592        return rootDot ? prefixKeypath(relativeKeypath, rootKeypath) : relativeKeypath;
21593      }
21594    };
21595  }
21596
21597  return prefixers[rootKeypath];
21598}
21599
21600var shared$1 = {};
21601
21602var Model = (function (ModelBase) {
21603  function Model(parent, key) {
21604    ModelBase.call(this, parent);
21605
21606    this.ticker = null;
21607
21608    if (parent) {
21609      this.key = unescapeKey(key);
21610      this.isReadonly = parent.isReadonly;
21611
21612      if (parent.value) {
21613        this.value = parent.value[this.key];
21614        if (isArray(this.value)) { this.length = this.value.length; }
21615        this.adapt();
21616      }
21617    }
21618  }
21619
21620  if ( ModelBase ) Model.__proto__ = ModelBase;
21621  var Model__proto__ = Model.prototype = Object.create( ModelBase && ModelBase.prototype );
21622  Model__proto__.constructor = Model;
21623
21624  Model__proto__.adapt = function adapt () {
21625    var this$1 = this;
21626
21627    var adaptors = this.root.adaptors;
21628    var len = adaptors.length;
21629
21630    this.rewrap = false;
21631
21632    // Exit early if no adaptors
21633    if (len === 0) { return; }
21634
21635    var value = this.wrapper
21636      ? 'newWrapperValue' in this
21637        ? this.newWrapperValue
21638        : this.wrapperValue
21639      : this.value;
21640
21641    // TODO remove this legacy nonsense
21642    var ractive = this.root.ractive;
21643    var keypath = this.getKeypath();
21644
21645    // tear previous adaptor down if present
21646    if (this.wrapper) {
21647      var shouldTeardown =
21648        this.wrapperValue === value
21649          ? false
21650          : !this.wrapper.reset || this.wrapper.reset(value) === false;
21651
21652      if (shouldTeardown) {
21653        this.wrapper.teardown();
21654        delete this.wrapper;
21655        delete this.wrapperValue;
21656        delete this.newWrapperValue;
21657
21658        // don't branch for undefined values
21659        if (this.value !== undefined) {
21660          var parentValue = this.parent.value || this.parent.createBranch(this.key);
21661          if (parentValue[this.key] !== value) { parentValue[this.key] = value; }
21662          this.value = value;
21663        }
21664      } else {
21665        delete this.newWrapperValue;
21666        this.value = this.wrapper.get();
21667        return;
21668      }
21669    }
21670
21671    var i;
21672
21673    for (i = 0; i < len; i += 1) {
21674      var adaptor = adaptors[i];
21675      if (adaptor.filter(value, keypath, ractive)) {
21676        this$1.wrapper = adaptor.wrap(ractive, value, keypath, getPrefixer(keypath));
21677        this$1.wrapperValue = value;
21678        this$1.wrapper.__model = this$1; // massive temporary hack to enable array adaptor
21679
21680        this$1.value = this$1.wrapper.get();
21681
21682        break;
21683      }
21684    }
21685  };
21686
21687  Model__proto__.animate = function animate (from, to, options, interpolator) {
21688    var this$1 = this;
21689
21690    if (this.ticker) { this.ticker.stop(); }
21691
21692    var fulfilPromise;
21693    var promise = new Promise(function (fulfil) { return (fulfilPromise = fulfil); });
21694
21695    this.ticker = new Ticker({
21696      duration: options.duration,
21697      easing: options.easing,
21698      step: function (t) {
21699        var value = interpolator(t);
21700        this$1.applyValue(value);
21701        if (options.step) { options.step(t, value); }
21702      },
21703      complete: function () {
21704        this$1.applyValue(to);
21705        if (options.complete) { options.complete(to); }
21706
21707        this$1.ticker = null;
21708        fulfilPromise(to);
21709      }
21710    });
21711
21712    promise.stop = this.ticker.stop;
21713    return promise;
21714  };
21715
21716  Model__proto__.applyValue = function applyValue (value, notify) {
21717    if ( notify === void 0 ) notify = true;
21718
21719    if (isEqual(value, this.value)) { return; }
21720    if (this.boundValue) { this.boundValue = null; }
21721
21722    if (this.parent.wrapper && this.parent.wrapper.set) {
21723      this.parent.wrapper.set(this.key, value);
21724      this.parent.value = this.parent.wrapper.get();
21725
21726      this.value = this.parent.value[this.key];
21727      if (this.wrapper) { this.newWrapperValue = this.value; }
21728      this.adapt();
21729    } else if (this.wrapper) {
21730      this.newWrapperValue = value;
21731      this.adapt();
21732    } else {
21733      var parentValue = this.parent.value || this.parent.createBranch(this.key);
21734      if (isObjectLike(parentValue)) {
21735        parentValue[this.key] = value;
21736      } else {
21737        warnIfDebug(("Attempted to set a property of a non-object '" + (this.getKeypath()) + "'"));
21738        return;
21739      }
21740
21741      this.value = value;
21742      this.adapt();
21743    }
21744
21745    if (this.dataModel || (value && value.viewmodel && value.viewmodel.isRoot)) {
21746      checkDataLink(this, value);
21747    }
21748
21749    // keep track of array stuff
21750    if (isArray(value)) {
21751      this.length = value.length;
21752      this.isArray = true;
21753    } else {
21754      this.isArray = false;
21755    }
21756
21757    // notify dependants
21758    this.links.forEach(handleChange);
21759    this.children.forEach(mark);
21760    this.deps.forEach(handleChange);
21761
21762    if (notify) { this.notifyUpstream(); }
21763
21764    if (this.parent.isArray) {
21765      if (this.key === 'length') { this.parent.length = value; }
21766      else { this.parent.joinKey('length').mark(); }
21767    }
21768  };
21769
21770  Model__proto__.compute = function compute (key, computed) {
21771    var registry = this.computed || (this.computed = {});
21772
21773    if (registry[key]) {
21774      registry[key].signature = getComputationSignature(this.root.ractive, key, computed);
21775      registry[key].mark();
21776    } else {
21777      registry[key] = new shared$1.Computation(
21778        this,
21779        getComputationSignature(this.root.ractive, key, computed),
21780        key
21781      );
21782    }
21783
21784    return registry[key];
21785  };
21786
21787  Model__proto__.createBranch = function createBranch (key) {
21788    var branch = isNumeric(key) ? [] : {};
21789    this.applyValue(branch, false);
21790
21791    return branch;
21792  };
21793
21794  Model__proto__.get = function get (shouldCapture, opts) {
21795    if (this._link) { return this._link.get(shouldCapture, opts); }
21796    if (shouldCapture) { capture(this); }
21797    // if capturing, this value needs to be unwrapped because it's for external use
21798    if (opts && opts.virtual) { return this.getVirtual(false); }
21799    return maybeBind(
21800      this,
21801      (opts && 'unwrap' in opts ? opts.unwrap !== false : shouldCapture) && this.wrapper
21802        ? this.wrapperValue
21803        : this.value,
21804      !opts || opts.shouldBind !== false
21805    );
21806  };
21807
21808  Model__proto__.joinKey = function joinKey (key, opts) {
21809    var this$1 = this;
21810
21811    if (this._link) {
21812      if (opts && opts.lastLink !== false && (isUndefined(key) || key === '')) { return this; }
21813      return this._link.joinKey(key);
21814    }
21815
21816    if (isUndefined(key) || key === '') { return this; }
21817
21818    var child;
21819    if (hasOwn(this.childByKey, key)) { child = this.childByKey[key]; }
21820    else { child = this.computed && this.computed[key]; }
21821
21822    if (!child) {
21823      var computed;
21824      if (this.isRoot && this.ractive && (computed = this.ractive.computed[key])) {
21825        child = this.compute(key, computed);
21826      } else if (!this.isRoot && this.root.ractive) {
21827        var registry = this.root.ractive.computed;
21828        for (var k in registry) {
21829          computed = registry[k];
21830          if (computed.pattern && computed.pattern.test(this$1.getKeypath() + '.' + key)) {
21831            child = this$1.compute(key, computed);
21832          }
21833        }
21834      }
21835    }
21836
21837    if (!child) {
21838      child = new Model(this, key);
21839      this.children.push(child);
21840      this.childByKey[key] = child;
21841
21842      if (key === 'data') {
21843        var val = this.retrieve();
21844        if (val && val.viewmodel && val.viewmodel.isRoot) {
21845          
vendor: 14,964 bytes, lines 21845-22378
21845child.link(val.viewmodel, 'data');
21846          this.dataModel = val;
21847        }
21848      }
21849    }
21850
21851    if (child._link && (!opts || opts.lastLink !== false)) { return child._link; }
21852
21853    return child;
21854  };
21855
21856  Model__proto__.mark = function mark$1 (force) {
21857    if (this._link) { return this._link.mark(force); }
21858
21859    var old = this.value;
21860    var value = this.retrieve();
21861
21862    if (this.dataModel || (value && value.viewmodel && value.viewmodel.isRoot)) {
21863      checkDataLink(this, value);
21864    }
21865
21866    if (force || !isEqual(value, old)) {
21867      this.value = value;
21868      if (this.boundValue) { this.boundValue = null; }
21869
21870      // make sure the wrapper stays in sync
21871      if (old !== value || this.rewrap) {
21872        if (this.wrapper) { this.newWrapperValue = value; }
21873        this.adapt();
21874      }
21875
21876      // keep track of array stuff
21877      if (isArray(value)) {
21878        this.length = value.length;
21879        this.isArray = true;
21880      } else {
21881        this.isArray = false;
21882      }
21883
21884      this.children.forEach(force ? markForce : mark);
21885      this.links.forEach(marked);
21886
21887      this.deps.forEach(handleChange);
21888    }
21889  };
21890
21891  Model__proto__.merge = function merge (array, comparator) {
21892    var newIndices = buildNewIndices(
21893      this.value === array ? recreateArray(this) : this.value,
21894      array,
21895      comparator
21896    );
21897    this.parent.value[this.key] = array;
21898    this.shuffle(newIndices, true);
21899  };
21900
21901  Model__proto__.retrieve = function retrieve () {
21902    return this.parent.value ? this.parent.value[this.key] : undefined;
21903  };
21904
21905  Model__proto__.set = function set (value) {
21906    if (this.ticker) { this.ticker.stop(); }
21907    this.applyValue(value);
21908  };
21909
21910  Model__proto__.shuffle = function shuffle$2 (newIndices, unsafe) {
21911    shuffle(this, newIndices, false, unsafe);
21912  };
21913
21914  Model__proto__.source = function source () {
21915    return this;
21916  };
21917
21918  Model__proto__.teardown = function teardown$4 () {
21919    var this$1 = this;
21920
21921    if (this._link) {
21922      this._link.teardown();
21923      this._link = null;
21924    }
21925    this.children.forEach(teardown);
21926    if (this.wrapper) { this.wrapper.teardown(); }
21927    if (this.computed) { keys(this.computed).forEach(function (k) { return this$1.computed[k].teardown(); }); }
21928  };
21929
21930  return Model;
21931}(ModelBase));
21932
21933function recreateArray(model) {
21934  var array = [];
21935
21936  for (var i = 0; i < model.length; i++) {
21937    array[i] = (model.childByKey[i] || {}).value;
21938  }
21939
21940  return array;
21941}
21942
21943/* global global */
21944var data = {};
21945
21946var SharedModel = (function (Model) {
21947  function SharedModel(value, name, ractive) {
21948    Model.call(this, null, ("@" + name));
21949    this.key = "@" + name;
21950    this.value = value;
21951    this.isRoot = true;
21952    this.root = this;
21953    this.adaptors = [];
21954    this.ractive = ractive;
21955  }
21956
21957  if ( Model ) SharedModel.__proto__ = Model;
21958  var SharedModel__proto__ = SharedModel.prototype = Object.create( Model && Model.prototype );
21959  SharedModel__proto__.constructor = SharedModel;
21960
21961  SharedModel__proto__.getKeypath = function getKeypath () {
21962    return this.key;
21963  };
21964
21965  SharedModel__proto__.retrieve = function retrieve () {
21966    return this.value;
21967  };
21968
21969  return SharedModel;
21970}(Model));
21971
21972var SharedModel$1 = new SharedModel(data, 'shared');
21973
21974var GlobalModel = new SharedModel(base, 'global');
21975
21976function findContext(fragment) {
21977  var frag = fragment;
21978  while (frag && !frag.context && !frag.aliases) { frag = frag.parent; }
21979  return frag;
21980}
21981
21982function resolveReference(fragment, ref) {
21983  var initialFragment = fragment;
21984  // current context ref
21985  if (ref === '.') { return fragment.findContext(); }
21986
21987  // ancestor references
21988  if (ref[0] === '~') { return fragment.ractive.viewmodel.joinAll(splitKeypath(ref.slice(2))); }
21989
21990  // scoped references
21991  if (ref[0] === '.' || ref[0] === '^') {
21992    var frag = fragment;
21993    var parts = ref.split('/');
21994    var explicitContext = parts[0] === '^^';
21995
21996    // find nearest context node
21997    while (frag && !frag.context) {
21998      frag = up(frag);
21999    }
22000    var context$1 = frag && frag.context;
22001
22002    // walk up the context chain
22003    while (frag && parts[0] === '^^') {
22004      parts.shift();
22005
22006      // the current fragment should always be a context,
22007      // and if it happens to be an iteration, jump above the each block
22008      if (frag.isIteration) {
22009        frag = frag.parent.parent;
22010      } else {
22011        // otherwise jump above the current fragment
22012        frag = up(frag);
22013      }
22014
22015      // walk to the next contexted fragment
22016      while (frag && !frag.context) {
22017        frag = up(frag);
22018      }
22019      context$1 = frag && frag.context;
22020    }
22021
22022    if (!context$1 && explicitContext) {
22023      throw new Error(
22024        ("Invalid context parent reference ('" + ref + "'). There is not context at that level.")
22025      );
22026    }
22027
22028    // walk up the context path
22029    while (parts[0] === '.' || parts[0] === '..') {
22030      var part = parts.shift();
22031
22032      if (part === '..') {
22033        context$1 = context$1.parent;
22034      }
22035    }
22036
22037    ref = parts.join('/');
22038
22039    // special case - `{{.foo}}` means the same as `{{./foo}}`
22040    if (ref[0] === '.') { ref = ref.slice(1); }
22041    return context$1.joinAll(splitKeypath(ref));
22042  }
22043
22044  var keys$$1 = splitKeypath(ref);
22045  if (!keys$$1.length) { return; }
22046  var base = keys$$1.shift();
22047
22048  // special refs
22049  if (base[0] === '@') {
22050    // shorthand from outside the template
22051    // @this referring to local ractive instance
22052    if (base === '@this' || base === '@') {
22053      return fragment.ractive.viewmodel.getRactiveModel().joinAll(keys$$1);
22054    } else if (base === '@index' || base === '@key') {
22055      // @index or @key referring to the nearest repeating index or key
22056      if (keys$$1.length) { badReference(base); }
22057      var repeater = findIter(fragment);
22058      return repeater && repeater[("get" + (base[1] === 'i' ? 'Index' : 'Key'))]();
22059    } else if (base === '@last') {
22060      var repeater$1 = findIter(fragment);
22061      return repeater$1 && repeater$1.parent.getLast();
22062    } else if (base === '@global') {
22063      // @global referring to window or global
22064      return GlobalModel.joinAll(keys$$1);
22065    } else if (base === '@shared') {
22066      // @global referring to window or global
22067      return SharedModel$1.joinAll(keys$$1);
22068    } else if (base === '@keypath' || base === '@rootpath') {
22069      // @keypath or @rootpath, the current keypath string
22070      var root = ref[1] === 'r' ? fragment.ractive.root : null;
22071      var f = fragment;
22072
22073      while (
22074        f &&
22075        (!f.context || (f.isRoot && f.ractive.component && (root || !f.ractive.isolated)))
22076      ) {
22077        f = f.isRoot ? f.componentParent : f.parent;
22078      }
22079
22080      return f.getKeypath(root);
22081    } else if (base === '@context') {
22082      return new SharedModel(fragment.getContext(), 'context').joinAll(keys$$1);
22083    } else if (base === '@local') {
22084      // @context-local data
22085      return fragment.getContext()._data.joinAll(keys$$1);
22086    } else if (base === '@style') {
22087      // @style shared model
22088      return fragment.ractive.constructor._cssModel.joinAll(keys$$1);
22089    } else if (base === '@helpers') {
22090      // @helpers instance model
22091      return fragment.ractive.viewmodel.getHelpers().joinAll(keys$$1);
22092    } else if (base === '@macro') {
22093      var handle = findMacro(fragment);
22094      if (handle) { return new SharedModel(handle, 'macro').joinAll(keys$$1); }
22095      else { return; }
22096    } else {
22097      // nope
22098      throw new Error(("Invalid special reference '" + base + "'"));
22099    }
22100  }
22101
22102  // helpers
22103  if (base && !keys$$1.length) {
22104    var helpers = fragment.ractive.viewmodel.getHelpers();
22105    if (helpers.has(base)) { return helpers.joinKey(base); }
22106  }
22107
22108  var context = findContext(fragment);
22109
22110  // check immediate context for a match
22111  if (context) {
22112    if (context.context) {
22113      context = context.context;
22114    } else {
22115      // alias block, so get next full context for later
22116      context = fragment.findContext();
22117    }
22118  } else {
22119    context = fragment.findContext();
22120  }
22121
22122  // walk up the fragment hierarchy looking for a matching ref, alias, or key in a context
22123  var createMapping = false;
22124  var shouldWarn = fragment.ractive.warnAboutAmbiguity;
22125  var crossed = 0;
22126  var model;
22127
22128  while (fragment) {
22129    // repeated fragments
22130    if (fragment.isIteration) {
22131      if (base === fragment.parent.keyRef) {
22132        model = fragment.getKey();
22133      } else if (base === fragment.parent.indexRef) {
22134        model = fragment.getIndex();
22135      }
22136
22137      if (model && keys$$1.length) { badReference(base); }
22138    }
22139
22140    // alias node or iteration
22141    if (!model && fragment.aliases && hasOwn(fragment.aliases, base)) {
22142      model = fragment.aliases[base];
22143    }
22144
22145    // check fragment context to see if it has the key we need
22146    if (!model && fragment.context && fragment.context.has(base)) {
22147      model = fragment.context.joinKey(base);
22148
22149      // this is an implicit mapping
22150      if (createMapping) {
22151        if (shouldWarn)
22152          { warnIfDebug(
22153            ("'" + ref + "' resolved but is ambiguous and will create a mapping to a parent component.")
22154          ); }
22155      } else if (shouldWarn && crossed) { warnIfDebug(("'" + ref + "' resolved but is ambiguous.")); }
22156    }
22157
22158    if (model) {
22159      if (createMapping) {
22160        model = initialFragment.ractive.viewmodel.createLink(base, model, base, { implicit: true });
22161      }
22162
22163      if (keys$$1.length > 0 && isFunction(model.joinAll)) {
22164        model = model.joinAll(keys$$1);
22165      }
22166
22167      return model;
22168    }
22169
22170    // don't consider alias blocks when checking for ambiguity
22171    if (fragment.context && !fragment.aliases) { crossed = 1; }
22172
22173    if (
22174      (fragment.componentParent || (!fragment.parent && fragment.ractive.component)) &&
22175      !fragment.ractive.isolated
22176    ) {
22177      // ascend through component boundary
22178      fragment = fragment.componentParent || fragment.ractive.component.up;
22179      createMapping = true;
22180    } else {
22181      fragment = fragment.parent;
22182    }
22183  }
22184
22185  // if enabled, check the instance for a match
22186  var instance = initialFragment.ractive;
22187  if (instance.resolveInstanceMembers && base !== 'data' && base in instance) {
22188    return instance.viewmodel
22189      .getRactiveModel()
22190      .joinKey(base)
22191      .joinAll(keys$$1);
22192  }
22193
22194  if (shouldWarn) {
22195    warnIfDebug(("'" + ref + "' is ambiguous and did not resolve."));
22196  }
22197
22198  // didn't find anything, so go ahead and create the key on the local model
22199  return context.joinKey(base).joinAll(keys$$1);
22200}
22201
22202function up(fragment) {
22203  return fragment && ((!fragment.ractive.isolated && fragment.componentParent) || fragment.parent);
22204}
22205
22206function findIter(start) {
22207  var fragment = start;
22208  var next;
22209  while (!fragment.isIteration && (next = up(fragment))) {
22210    fragment = next;
22211  }
22212
22213  return fragment.isIteration && fragment;
22214}
22215
22216function findMacro(start) {
22217  var fragment = start;
22218  while (fragment) {
22219    if (fragment.owner.handle) { return fragment.owner.handle; }
22220    fragment = up(fragment);
22221  }
22222}
22223
22224function badReference(key) {
22225  throw new Error(("An index or key reference (" + key + ") cannot have child properties"));
22226}
22227
22228var extern = {};
22229
22230function getRactiveContext(ractive) {
22231  var assigns = [], len = arguments.length - 1;
22232  while ( len-- > 0 ) assigns[ len ] = arguments[ len + 1 ];
22233
22234  var fragment =
22235    ractive.fragment ||
22236    ractive._fakeFragment ||
22237    (ractive._fakeFragment = new FakeFragment(ractive));
22238  return fragment.getContext.apply(fragment, assigns);
22239}
22240
22241function getContext() {
22242  var assigns = [], len = arguments.length;
22243  while ( len-- ) assigns[ len ] = arguments[ len ];
22244
22245  if (!this.ctx) { this.ctx = new extern.Context(this); }
22246  assigns.unshift(create(this.ctx));
22247  return assign.apply(null, assigns);
22248}
22249
22250var FakeFragment = function FakeFragment(ractive) {
22251  this.ractive = ractive;
22252};
22253
22254FakeFragment.prototype.findContext = function findContext () {
22255  return this.ractive.viewmodel;
22256};
22257var proto = FakeFragment.prototype;
22258proto.getContext = getContext;
22259proto.find = proto.findComponent = proto.findAll = proto.findAllComponents = noop;
22260
22261function findParentWithContext(fragment) {
22262  var frag = fragment;
22263  while (frag && !frag.context) { frag = frag.parent; }
22264  if (!frag) { return fragment && fragment.ractive.fragment; }
22265  else { return frag; }
22266}
22267
22268var keep = false;
22269
22270function set(pairs, options) {
22271  var k = keep;
22272
22273  var deep = options && options.deep;
22274  var shuffle = options && options.shuffle;
22275  var promise = runloop.start();
22276  if (options && 'keep' in options) { keep = options.keep; }
22277
22278  var i = pairs.length;
22279  while (i--) {
22280    var model = pairs[i][0];
22281    var value = pairs[i][1];
22282    var keypath = pairs[i][2];
22283
22284    if (!model) {
22285      runloop.end();
22286      throw new Error(("Failed to set invalid keypath '" + keypath + "'"));
22287    }
22288
22289    if (deep) { deepSet(model, value); }
22290    else if (shuffle) {
22291      var array = value;
22292      var target = model.get();
22293      // shuffle target array with itself
22294      if (!array) { array = target; }
22295
22296      // if there's not an array there yet, go ahead and set
22297      if (isUndefined(target)) {
22298        model.set(array);
22299      } else {
22300        if (!isArray(target) || !isArray(array)) {
22301          runloop.end();
22302          throw new Error('You cannot merge an array with a non-array');
22303        }
22304
22305        var comparator = getComparator(shuffle);
22306        model.merge(array, comparator);
22307      }
22308    } else { model.set(value); }
22309  }
22310
22311  runloop.end();
22312
22313  keep = k;
22314
22315  return promise;
22316}
22317
22318var star = /\*/;
22319function gather(ractive, keypath, base, isolated) {
22320  if (!base && (keypath[0] === '.' || keypath[1] === '^')) {
22321    warnIfDebug(
22322      "Attempted to set a relative keypath from a non-relative context. You can use a context object to set relative keypaths."
22323    );
22324    return [];
22325  }
22326
22327  var keys$$1 = splitKeypath(keypath);
22328  var model = base || ractive.viewmodel;
22329
22330  if (star.test(keypath)) {
22331    return model.findMatches(keys$$1);
22332  } else {
22333    if (model === ractive.viewmodel) {
22334      // allow implicit mappings
22335      if (
22336        ractive.component &&
22337        !ractive.isolated &&
22338        !model.has(keys$$1[0]) &&
22339        keypath[0] !== '@' &&
22340        keypath[0] &&
22341        !isolated
22342      ) {
22343        return [resolveReference(ractive.fragment || new FakeFragment(ractive), keypath)];
22344      } else {
22345        return [model.joinAll(keys$$1)];
22346      }
22347    } else {
22348      return [model.joinAll(keys$$1)];
22349    }
22350  }
22351}
22352
22353function build(ractive, keypath, value, isolated) {
22354  var sets = [];
22355
22356  // set multiple keypaths in one go
22357  if (isObject(keypath)) {
22358    var loop = function ( k ) {
22359      if (hasOwn(keypath, k)) {
22360        sets.push.apply(sets, gather(ractive, k, null, isolated).map(function (m) { return [m, keypath[k], k]; }));
22361      }
22362    };
22363
22364    for (var k in keypath) loop( k );
22365  } else {
22366    // set a single keypath
22367    sets.push.apply(sets, gather(ractive, keypath, null, isolated).map(function (m) { return [m, value, keypath]; }));
22368  }
22369
22370  return sets;
22371}
22372
22373var deepOpts = { virtual: false };
22374function deepSet(model, value) {
22375  var dest = model.get(false, deepOpts);
22376
22377  // if dest doesn't exist, just set it
22378  if (dest == null || !isObjectTyp
vendor: 8,313 bytes, lines 22378-22702
22378e(value)) { return model.set(value); }
22379  if (!isObjectType(dest)) { return model.set(value); }
22380
22381  for (var k in value) {
22382    if (hasOwn(value, k)) {
22383      deepSet(model.joinKey(k), value[k]);
22384    }
22385  }
22386}
22387
22388var comparators = {};
22389function getComparator(option) {
22390  if (option === true) { return null; } // use existing arrays
22391  if (isFunction(option)) { return option; }
22392
22393  if (isString(option)) {
22394    return comparators[option] || (comparators[option] = function (thing) { return thing[option]; });
22395  }
22396
22397  throw new Error('If supplied, options.compare must be a string, function, or true'); // TODO link to docs
22398}
22399
22400var errorMessage = 'Cannot add to a non-numeric value';
22401
22402function add(ractive, keypath, d, options) {
22403  if (!isString(keypath) || !isNumeric(d)) {
22404    throw new Error('Bad arguments');
22405  }
22406
22407  var sets = build(ractive, keypath, d, options && options.isolated);
22408
22409  return set(
22410    sets.map(function (pair) {
22411      var model = pair[0];
22412      var add = pair[1];
22413      var value = model.get();
22414      if (!isNumeric(add) || !isNumeric(value)) { throw new Error(errorMessage); }
22415      return [model, value + add];
22416    })
22417  );
22418}
22419
22420function Ractive$add(keypath, d, options) {
22421  var num = isNumber(d) ? d : 1;
22422  var opts = isObjectType(d) ? d : options;
22423  return add(this, keypath, num, opts);
22424}
22425
22426function immediate(value) {
22427  var result = Promise.resolve(value);
22428  defineProperty(result, 'stop', { value: noop });
22429  return result;
22430}
22431
22432var linear = easing.linear;
22433
22434function getOptions(options, instance) {
22435  options = options || {};
22436
22437  var easing$$1;
22438  if (options.easing) {
22439    easing$$1 = isFunction(options.easing) ? options.easing : instance.easing[options.easing];
22440  }
22441
22442  return {
22443    easing: easing$$1 || linear,
22444    duration: 'duration' in options ? options.duration : 400,
22445    complete: options.complete || noop,
22446    step: options.step || noop,
22447    interpolator: options.interpolator
22448  };
22449}
22450
22451function animate(ractive, model, to, options) {
22452  options = getOptions(options, ractive);
22453  var from = model.get();
22454
22455  // don't bother animating values that stay the same
22456  if (isEqual(from, to)) {
22457    options.complete(options.to);
22458    return immediate(to);
22459  }
22460
22461  var interpolator = interpolate(from, to, ractive, options.interpolator);
22462
22463  // if we can't interpolate the value, set it immediately
22464  if (!interpolator) {
22465    runloop.start();
22466    model.set(to);
22467    runloop.end();
22468
22469    return immediate(to);
22470  }
22471
22472  return model.animate(from, to, options, interpolator);
22473}
22474
22475function Ractive$animate(keypath, to, options) {
22476  if (isObjectType(keypath)) {
22477    var keys$$1 = keys(keypath);
22478
22479    throw new Error(("ractive.animate(...) no longer supports objects. Instead of ractive.animate({\n  " + (keys$$1.map(function (key) { return ("'" + key + "': " + (keypath[key])); }).join('\n  ')) + "\n}, {...}), do\n\n" + (keys$$1.map(function (key) { return ("ractive.animate('" + key + "', " + (keypath[key]) + ", {...});"); }).join('\n')) + "\n"));
22480  }
22481
22482  return animate(this, this.viewmodel.joinAll(splitKeypath(keypath)), to, options);
22483}
22484
22485function enqueue(ractive, event) {
22486  if (ractive.event) {
22487    ractive._eventQueue.push(ractive.event);
22488  }
22489
22490  ractive.event = event;
22491}
22492
22493function dequeue(ractive) {
22494  if (ractive._eventQueue.length) {
22495    ractive.event = ractive._eventQueue.pop();
22496  } else {
22497    ractive.event = null;
22498  }
22499}
22500
22501var initStars = {};
22502var bubbleStars = {};
22503
22504// cartesian product of name parts and stars
22505// adjusted appropriately for special cases
22506function variants(name, initial) {
22507  var map = initial ? initStars : bubbleStars;
22508  if (map[name]) { return map[name]; }
22509
22510  var parts = name.split('.');
22511  var result = [];
22512  var base = false;
22513
22514  // initial events the implicit namespace of 'this'
22515  if (initial) {
22516    parts.unshift('this');
22517    base = true;
22518  }
22519
22520  // use max - 1 bits as a bitmap to pick a part or a *
22521  // need to skip the full star case if the namespace is synthetic
22522  var max = Math.pow(2, parts.length) - (initial ? 1 : 0);
22523  for (var i = 0; i < max; i++) {
22524    var join = [];
22525    for (var j = 0; j < parts.length; j++) {
22526      join.push(1 & (i >> j) ? '*' : parts[j]);
22527    }
22528    result.unshift(join.join('.'));
22529  }
22530
22531  if (base) {
22532    // include non-this-namespaced versions
22533    if (parts.length > 2) {
22534      result.push.apply(result, variants(name, false));
22535    } else {
22536      result.push('*');
22537      result.push(name);
22538    }
22539  }
22540
22541  map[name] = result;
22542  return result;
22543}
22544
22545function fireEvent(ractive, eventName, context, args) {
22546  if ( args === void 0 ) args = [];
22547
22548  if (!eventName) {
22549    return;
22550  }
22551
22552  context.name = eventName;
22553  args.unshift(context);
22554
22555  var eventNames = ractive._nsSubs ? variants(eventName, true) : ['*', eventName];
22556
22557  return fireEventAs(ractive, eventNames, context, args, true);
22558}
22559
22560function fireEventAs(ractive, eventNames, context, args, initialFire) {
22561  if ( initialFire === void 0 ) initialFire = false;
22562
22563  var bubble = true;
22564
22565  if (initialFire || ractive._nsSubs) {
22566    enqueue(ractive, context);
22567
22568    var i = eventNames.length;
22569    while (i--) {
22570      if (eventNames[i] in ractive._subs) {
22571        bubble = notifySubscribers(ractive, ractive._subs[eventNames[i]], context, args) && bubble;
22572      }
22573    }
22574
22575    dequeue(ractive);
22576  }
22577
22578  if (ractive.parent && bubble) {
22579    if (initialFire && ractive.component) {
22580      var fullName = ractive.component.name + '.' + eventNames[eventNames.length - 1];
22581      eventNames = variants(fullName, false);
22582
22583      if (context && !context.component) {
22584        context.component = ractive;
22585      }
22586    }
22587
22588    bubble = fireEventAs(ractive.parent, eventNames, context, args);
22589  }
22590
22591  return bubble;
22592}
22593
22594function notifySubscribers(ractive, subscribers, context, args) {
22595  var originalEvent = null;
22596  var stopEvent = false;
22597
22598  // subscribers can be modified inflight, e.g. "once" functionality
22599  // so we need to copy to make sure everyone gets called
22600  subscribers = subscribers.slice();
22601
22602  for (var i = 0, len = subscribers.length; i < len; i += 1) {
22603    if (!subscribers[i].off && subscribers[i].handler.apply(ractive, args) === false) {
22604      stopEvent = true;
22605    }
22606  }
22607
22608  if (context && stopEvent && (originalEvent = context.event)) {
22609    originalEvent.preventDefault && originalEvent.preventDefault();
22610    originalEvent.stopPropagation && originalEvent.stopPropagation();
22611  }
22612
22613  return !stopEvent;
22614}
22615
22616var Hook = function Hook(event) {
22617  this.event = event;
22618  this.method = 'on' + event;
22619};
22620
22621Hook.prototype.fire = function fire (ractive, arg) {
22622  var context = getRactiveContext(ractive);
22623  var method = this.method;
22624
22625  if (ractive[method]) {
22626    arg ? ractive[method](context, arg) : ractive[method](context);
22627  }
22628
22629  fireEvent(ractive, this.event, context, arg ? [arg, ractive] : [ractive]);
22630};
22631
22632function getChildQueue(queue, ractive) {
22633  return queue[ractive._guid] || (queue[ractive._guid] = []);
22634}
22635
22636function fire(hookQueue, ractive) {
22637  var childQueue = getChildQueue(hookQueue.queue, ractive);
22638
22639  hookQueue.hook.fire(ractive);
22640
22641  // queue is "live" because components can end up being
22642  // added while hooks fire on parents that modify data values.
22643  while (childQueue.length) {
22644    fire(hookQueue, childQueue.shift());
22645  }
22646
22647  delete hookQueue.queue[ractive._guid];
22648}
22649
22650var HookQueue = function HookQueue(event) {
22651  this.hook = new Hook(event);
22652  this.inProcess = {};
22653  this.queue = {};
22654};
22655var HookQueue__proto__ = HookQueue.prototype;
22656
22657HookQueue__proto__.begin = function begin (ractive) {
22658  this.inProcess[ractive._guid] = true;
22659};
22660
22661HookQueue__proto__.end = function end (ractive) {
22662  var parent = ractive.parent;
22663
22664  // If this is *isn't* a child of a component that's in process,
22665  // it should call methods or fire at this point
22666  if (!parent || !this.inProcess[parent._guid]) {
22667    fire(this, ractive);
22668  } else {
22669    // elsewise, handoff to parent to fire when ready
22670    getChildQueue(this.queue, parent).push(ractive);
22671  }
22672
22673  delete this.inProcess[ractive._guid];
22674};
22675
22676var hooks = {};
22677[
22678  'construct',
22679  'config',
22680  'attachchild',
22681  'detach',
22682  'detachchild',
22683  'insert',
22684  'complete',
22685  'reset',
22686  'render',
22687  'unrendering',
22688  'unrender',
22689  'teardown',
22690  'destruct',
22691  'update'
22692].forEach(function (hook) {
22693  hooks[hook] = new Hook(hook);
22694});
22695hooks.init = new HookQueue('init');
22696
22697function findAnchors(fragment, name) {
22698  if ( name === void 0 ) name = null;
22699
22700  var res = [];
22701
22702  findAnchorsIn(fragment, name, res
vendor: 50,680 bytes, lines 22702-24608
22702);
22703
22704  return res;
22705}
22706
22707function findAnchorsIn(item, name, result) {
22708  if (item.isAnchor) {
22709    if (!name || item.name === name) {
22710      result.push(item);
22711    }
22712  } else if (item.items) {
22713    item.items.forEach(function (i) { return findAnchorsIn(i, name, result); });
22714  } else if (item.iterations) {
22715    item.iterations.forEach(function (i) { return findAnchorsIn(i, name, result); });
22716  } else if (item.fragment && !item.component) {
22717    findAnchorsIn(item.fragment, name, result);
22718  }
22719}
22720
22721function updateAnchors(instance, name) {
22722  if ( name === void 0 ) name = null;
22723
22724  var anchors = findAnchors(instance.fragment, name);
22725  var idxs = {};
22726  var children = instance._children.byName;
22727
22728  anchors.forEach(function (a) {
22729    var name = a.name;
22730    if (!(name in idxs)) { idxs[name] = 0; }
22731    var idx = idxs[name];
22732    var child = (children[name] || [])[idx];
22733
22734    if (child && child.lastBound !== a) {
22735      if (child.lastBound) { child.lastBound.removeChild(child); }
22736      a.addChild(child);
22737    }
22738
22739    idxs[name]++;
22740  });
22741}
22742
22743function unrenderChild(meta) {
22744  if (meta.instance.fragment.rendered) {
22745    meta.shouldDestroy = true;
22746    meta.instance.unrender();
22747  }
22748  meta.instance.el = null;
22749}
22750
22751function attachChild(child, options) {
22752  if ( options === void 0 ) options = {};
22753
22754  var children = this._children;
22755  var idx;
22756
22757  if (child.parent && child.parent !== this)
22758    { throw new Error(
22759      ("Instance " + (child._guid) + " is already attached to a different instance " + (child.parent._guid) + ". Please detach it from the other instance using detachChild first.")
22760    ); }
22761  else if (child.parent)
22762    { throw new Error(("Instance " + (child._guid) + " is already attached to this instance.")); }
22763
22764  var meta = {
22765    instance: child,
22766    ractive: this,
22767    name: options.name || child.constructor.name || 'Ractive',
22768    target: options.target || false,
22769    bubble: bubble,
22770    findNextNode: findNextNode
22771  };
22772  meta.nameOption = options.name;
22773
22774  // child is managing itself
22775  if (!meta.target) {
22776    meta.up = this.fragment;
22777    meta.external = true;
22778  } else {
22779    var list;
22780    if (!(list = children.byName[meta.target])) {
22781      list = [];
22782      this.set(("@this.children.byName." + (meta.target)), list);
22783    }
22784    idx = options.prepend ? 0 : options.insertAt !== undefined ? options.insertAt : list.length;
22785  }
22786
22787  child.parent = this;
22788  child.root = this.root;
22789  child.component = meta;
22790  children.push(meta);
22791
22792  var promise = runloop.start();
22793
22794  var rm = child.viewmodel.getRactiveModel();
22795  rm.joinKey('parent', { lastLink: false }).link(this.viewmodel.getRactiveModel());
22796  rm.joinKey('root', { lastLink: false }).link(this.root.viewmodel.getRactiveModel());
22797
22798  hooks.attachchild.fire(child);
22799
22800  if (meta.target) {
22801    unrenderChild(meta);
22802    this.splice(("@this.children.byName." + (meta.target)), idx, 0, meta);
22803    updateAnchors(this, meta.target);
22804  } else {
22805    if (!child.isolated) { child.viewmodel.attached(this.fragment); }
22806  }
22807
22808  runloop.end();
22809
22810  promise.ractive = child;
22811  return promise.then(function () { return child; });
22812}
22813
22814function bubble() {
22815  runloop.addFragment(this.instance.fragment);
22816}
22817
22818function findNextNode() {
22819  if (this.anchor) { return this.anchor.findNextNode(); }
22820}
22821
22822function compute(path, computed) {
22823  this.computed[path] = computed;
22824  if (isString(computed) || isFunction(computed))
22825    { computed = this.computed[path] = { get: computed }; }
22826
22827  var keys = splitKeypath(path);
22828  if (!~path.indexOf('*')) {
22829    var last = keys.pop();
22830    return this.viewmodel.joinAll(keys).compute(last, computed);
22831  } else {
22832    computed.pattern = new RegExp(
22833      '^' +
22834        keys
22835          .map(function (k) { return k.replace(/\*\*/g, '(.+)').replace(/\*/g, '((?:\\\\.|[^\\.])+)'); })
22836          .join('\\.') +
22837        '$'
22838    );
22839  }
22840}
22841
22842function Ractive$compute(path, computed) {
22843  var promise = runloop.start();
22844  var comp = compute.call(this, path, computed);
22845
22846  if (comp) {
22847    var keys = splitKeypath(path);
22848    if (keys.length === 1 && !comp.isReadonly) {
22849      comp.set(this.viewmodel.value[keys[0]]);
22850    }
22851
22852    var first = keys.reduce(function (a, c) { return a && a.childByKey[c]; }, this.viewmodel);
22853    if (first) {
22854      first.rebind(comp, first, false);
22855      if (first.parent) { delete first.parent.childByKey[first.key]; }
22856      fireShuffleTasks();
22857    }
22858  }
22859
22860  runloop.end();
22861
22862  return promise;
22863}
22864
22865function Ractive$detach() {
22866  if (this.isDetached) {
22867    return this.el;
22868  }
22869
22870  if (this.el) {
22871    removeFromArray(this.el.__ractive_instances__, this);
22872  }
22873
22874  this.el = this.fragment.detach();
22875  this.isDetached = true;
22876
22877  hooks.detach.fire(this);
22878  return this.el;
22879}
22880
22881function detachChild(child) {
22882  var children = this._children;
22883  var meta, index;
22884
22885  var i = children.length;
22886  while (i--) {
22887    if (children[i].instance === child) {
22888      index = i;
22889      meta = children[i];
22890      break;
22891    }
22892  }
22893
22894  if (!meta || child.parent !== this)
22895    { throw new Error(("Instance " + (child._guid) + " is not attached to this instance.")); }
22896
22897  var promise = runloop.start();
22898
22899  if (meta.anchor) { meta.anchor.removeChild(meta); }
22900  if (!child.isolated) { child.viewmodel.detached(); }
22901
22902  children.splice(index, 1);
22903  if (meta.target) {
22904    this.splice(
22905      ("@this.children.byName." + (meta.target)),
22906      children.byName[meta.target].indexOf(meta),
22907      1
22908    );
22909    updateAnchors(this, meta.target);
22910  }
22911  var rm = child.viewmodel.getRactiveModel();
22912  rm.joinKey('parent', { lastLink: false }).unlink();
22913  rm.joinKey('root', { lastLink: false }).link(rm);
22914  child.root = child;
22915  child.parent = null;
22916  child.component = null;
22917
22918  hooks.detachchild.fire(child);
22919
22920  runloop.end();
22921
22922  promise.ractive = child;
22923  return promise.then(function () { return child; });
22924}
22925
22926function Ractive$find(selector, options) {
22927  var this$1 = this;
22928  if ( options === void 0 ) options = {};
22929
22930  if (!this.rendered)
22931    { throw new Error(
22932      ("Cannot call ractive.find('" + selector + "') unless instance is rendered to the DOM")
22933    ); }
22934
22935  var node = this.fragment.find(selector, options);
22936  if (node) { return node; }
22937
22938  if (options.remote) {
22939    for (var i = 0; i < this._children.length; i++) {
22940      if (!this$1._children[i].instance.fragment.rendered) { continue; }
22941      node = this$1._children[i].instance.find(selector, options);
22942      if (node) { return node; }
22943    }
22944  }
22945}
22946
22947function Ractive$findAll(selector, options) {
22948  if ( options === void 0 ) options = {};
22949
22950  if (!this.rendered)
22951    { throw new Error(
22952      ("Cannot call ractive.findAll('" + selector + "', ...) unless instance is rendered to the DOM")
22953    ); }
22954
22955  if (!isArray(options.result)) { options.result = []; }
22956
22957  this.fragment.findAll(selector, options);
22958
22959  if (options.remote) {
22960    // seach non-fragment children
22961    this._children.forEach(function (c) {
22962      if (!c.target && c.instance.fragment && c.instance.fragment.rendered) {
22963        c.instance.findAll(selector, options);
22964      }
22965    });
22966  }
22967
22968  return options.result;
22969}
22970
22971function Ractive$findAllComponents(selector, options) {
22972  if (!options && isObjectType(selector)) {
22973    options = selector;
22974    selector = '';
22975  }
22976
22977  options = options || {};
22978
22979  if (!isArray(options.result)) { options.result = []; }
22980
22981  this.fragment.findAllComponents(selector, options);
22982
22983  if (options.remote) {
22984    // search non-fragment children
22985    this._children.forEach(function (c) {
22986      if (!c.target && c.instance.fragment && c.instance.fragment.rendered) {
22987        if (!selector || c.name === selector) {
22988          options.result.push(c.instance);
22989        }
22990
22991        c.instance.findAllComponents(selector, options);
22992      }
22993    });
22994  }
22995
22996  return options.result;
22997}
22998
22999function Ractive$findComponent(selector, options) {
23000  var this$1 = this;
23001  if ( options === void 0 ) options = {};
23002
23003  if (isObjectType(selector)) {
23004    options = selector;
23005    selector = '';
23006  }
23007
23008  var child = this.fragment.findComponent(selector, options);
23009  if (child) { return child; }
23010
23011  if (options.remote) {
23012    if (!selector && this._children.length) { return this._children[0].instance; }
23013    for (var i = 0; i < this._children.length; i++) {
23014      // skip children that are or should be in an anchor
23015      if (this$1._children[i].target) { continue; }
23016      if (this$1._children[i].name === selector) { return this$1._children[i].instance; }
23017      child = this$1._children[i].instance.findComponent(selector, options);
23018      if (child) { return child; }
23019    }
23020  }
23021}
23022
23023function Ractive$findContainer(selector) {
23024  if (this.container) {
23025    if (this.container.component && this.container.component.name === selector) {
23026      return this.container;
23027    } else {
23028      return this.container.findContainer(selector);
23029    }
23030  }
23031
23032  return null;
23033}
23034
23035function Ractive$findParent(selector) {
23036  if (this.parent) {
23037    if (this.parent.component && this.parent.component.name === selector) {
23038      return this.parent;
23039    } else {
23040      return this.parent.findParent(selector);
23041    }
23042  }
23043
23044  return null;
23045}
23046
23047function findElement(start, orComponent, name) {
23048  if ( orComponent === void 0 ) orComponent = true;
23049
23050  while (
23051    start &&
23052    (start.type !== ELEMENT || (name && start.name !== name)) &&
23053    (!orComponent || (start.type !== COMPONENT && start.type !== ANCHOR))
23054  ) {
23055    // start is a fragment - look at the owner
23056    if (start.owner) { start = start.owner; }
23057    else if (start.component)
23058      // start is a component or yielder - look at the container
23059      { start = start.containerFragment || start.component.up; }
23060    else if (start.parent)
23061      // start is an item - look at the parent
23062      { start = start.parent; }
23063    else if (start.up)
23064      // start is an item without a parent - look at the parent fragment
23065      { start = start.up; }
23066    else { start = undefined; }
23067  }
23068
23069  return start;
23070}
23071
23072// This function takes an array, the name of a mutator method, and the
23073// arguments to call that mutator method with, and returns an array that
23074// maps the old indices to their new indices.
23075
23076// So if you had something like this...
23077//
23078//     array = [ 'a', 'b', 'c', 'd' ];
23079//     array.push( 'e' );
23080//
23081// ...you'd get `[ 0, 1, 2, 3 ]` - in other words, none of the old indices
23082// have changed. If you then did this...
23083//
23084//     array.unshift( 'z' );
23085//
23086// ...the indices would be `[ 1, 2, 3, 4, 5 ]` - every item has been moved
23087// one higher to make room for the 'z'. If you removed an item, the new index
23088// would be -1...
23089//
23090//     array.splice( 2, 2 );
23091//
23092// ...this would result in [ 0, 1, -1, -1, 2, 3 ].
23093//
23094// This information is used to enable fast, non-destructive shuffling of list
23095// sections when you do e.g. `ractive.splice( 'items', 2, 2 );
23096
23097function getNewIndices(length, methodName, args) {
23098  var newIndices = [];
23099
23100  var spliceArguments = getSpliceEquivalent(length, methodName, args);
23101
23102  if (!spliceArguments) {
23103    return null; // TODO support reverse and sort?
23104  }
23105
23106  var balance = spliceArguments.length - 2 - spliceArguments[1];
23107
23108  var removeStart = Math.min(length, spliceArguments[0]);
23109  var removeEnd = removeStart + spliceArguments[1];
23110  newIndices.startIndex = removeStart;
23111
23112  var i;
23113  for (i = 0; i < removeStart; i += 1) {
23114    newIndices.push(i);
23115  }
23116
23117  for (; i < removeEnd; i += 1) {
23118    newIndices.push(-1);
23119  }
23120
23121  for (; i < length; i += 1) {
23122    newIndices.push(i + balance);
23123  }
23124
23125  // there is a net shift for the rest of the array starting with index + balance
23126  if (balance !== 0) {
23127    newIndices.touchedFrom = spliceArguments[0];
23128  } else {
23129    newIndices.touchedFrom = length;
23130  }
23131
23132  return newIndices;
23133}
23134
23135// The pop, push, shift an unshift methods can all be represented
23136// as an equivalent splice
23137function getSpliceEquivalent(length, methodName, args) {
23138  switch (methodName) {
23139    case 'splice':
23140      if (args[0] !== undefined && args[0] < 0) {
23141        args[0] = length + Math.max(args[0], -length);
23142      }
23143
23144      if (isUndefined(args[0])) { args[0] = 0; }
23145
23146      while (args.length < 2) {
23147        args.push(length - args[0]);
23148      }
23149
23150      if (!isNumber(args[1])) {
23151        args[1] = length - args[0];
23152      }
23153
23154      // ensure we only remove elements that exist
23155      args[1] = Math.min(args[1], length - args[0]);
23156
23157      return args;
23158
23159    case 'sort':
23160    case 'reverse':
23161      return null;
23162
23163    case 'pop':
23164      if (length) {
23165        return [length - 1, 1];
23166      }
23167      return [0, 0];
23168
23169    case 'push':
23170      return [length, 0].concat(args);
23171
23172    case 'shift':
23173      return [0, length ? 1 : 0];
23174
23175    case 'unshift':
23176      return [0, 0].concat(args);
23177  }
23178}
23179
23180var arrayProto = Array.prototype;
23181
23182function makeArrayMethod(methodName) {
23183  function path(keypath) {
23184    var args = [], len = arguments.length - 1;
23185    while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
23186
23187    return model(this.viewmodel.joinAll(splitKeypath(keypath)), args);
23188  }
23189
23190  function model(mdl, args) {
23191    var array = mdl.get();
23192
23193    if (!isArray(array)) {
23194      if (isUndefined(array)) {
23195        array = [];
23196        var result$1 = arrayProto[methodName].apply(array, args);
23197        var promise$1 = runloop.start().then(function () { return result$1; });
23198        mdl.set(array);
23199        runloop.end();
23200        return promise$1;
23201      } else {
23202        throw new Error(
23203          ("shuffle array method " + methodName + " called on non-array at " + (mdl.getKeypath()))
23204        );
23205      }
23206    }
23207
23208    var newIndices = getNewIndices(array.length, methodName, args);
23209    var result = arrayProto[methodName].apply(array, args);
23210
23211    var promise = runloop.start().then(function () { return result; });
23212    promise.result = result;
23213
23214    if (newIndices) {
23215      if (mdl.shuffle) {
23216        mdl.shuffle(newIndices);
23217      } else {
23218        // it's a computation, which don't have a shuffle, so just invalidate
23219        mdl.mark();
23220      }
23221    } else {
23222      mdl.set(result);
23223    }
23224
23225    runloop.end();
23226
23227    return promise;
23228  }
23229
23230  return { path: path, model: model };
23231}
23232
23233function update$1(ractive, model, options) {
23234  // if the parent is wrapped, the adaptor will need to be updated before
23235  // updating on this keypath
23236  if (model.parent && model.parent.wrapper) {
23237    model.parent.adapt();
23238  }
23239
23240  var promise = runloop.start();
23241
23242  model.mark(options && options.force);
23243
23244  // notify upstream of changes
23245  model.notifyUpstream();
23246
23247  runloop.end();
23248
23249  hooks.update.fire(ractive, model);
23250
23251  return promise;
23252}
23253
23254function Ractive$update(keypath, options) {
23255  var opts, path;
23256
23257  if (isString(keypath)) {
23258    path = splitKeypath(keypath);
23259    opts = options;
23260  } else {
23261    opts = keypath;
23262  }
23263
23264  return update$1(this, path ? this.viewmodel.joinAll(path) : this.viewmodel, opts);
23265}
23266
23267var modelPush = makeArrayMethod('push').model;
23268var modelPop = makeArrayMethod('pop').model;
23269var modelShift = makeArrayMethod('shift').model;
23270var modelUnshift = makeArrayMethod('unshift').model;
23271var modelSort = makeArrayMethod('sort').model;
23272var modelSplice = makeArrayMethod('splice').model;
23273var modelReverse = makeArrayMethod('reverse').model;
23274
23275var ContextData = (function (Model) {
23276  function ContextData(options) {
23277    Model.call(this, null, null);
23278
23279    this.isRoot = true;
23280    this.root = this;
23281    this.value = {};
23282    this.ractive = options.ractive;
23283    this.adaptors = [];
23284    this.context = options.context;
23285  }
23286
23287  if ( Model ) ContextData.__proto__ = Model;
23288  var ContextData__proto__ = ContextData.prototype = Object.create( Model && Model.prototype );
23289  ContextData__proto__.constructor = ContextData;
23290
23291  ContextData__proto__.getKeypath = function getKeypath () {
23292    return '@context.data';
23293  };
23294
23295  ContextData__proto__.rebound = function rebound () {};
23296
23297  return ContextData;
23298}(Model));
23299
23300var Context = function Context(fragment, element) {
23301  this.fragment = fragment;
23302  this.element = element || findElement(fragment);
23303  this.node = this.element && this.element.node;
23304  this.ractive = fragment.ractive;
23305  this.root = this;
23306};
23307var Context__proto__ = Context.prototype;
23308
23309var prototypeAccessors = { decorators: {},_data: {} };
23310
23311prototypeAccessors.decorators.get = function () {
23312  var items = {};
23313  if (!this.element) { return items; }
23314  this.element.decorators.forEach(function (d) { return (items[d.name] = d.handle); });
23315  return items;
23316};
23317
23318prototypeAccessors._data.get = function () {
23319  return (
23320    this.model ||
23321    (this.root.model = new ContextData({
23322      ractive: this.ractive,
23323      context: this.root
23324    }))
23325  );
23326};
23327
23328// the usual mutation suspects
23329Context__proto__.add = function add (keypath, d, options) {
23330  var num = isNumber(d) ? +d : 1;
23331  var opts = isObjectType(d) ? d : options;
23332  return set(
23333    build$1(this, keypath, num).map(function (pair) {
23334      var model = pair[0];
23335        var val = pair[1];
23336      var value = model.get();
23337      if (!isNumeric(val) || !isNumeric(value)) { throw new Error('Cannot add non-numeric value'); }
23338      return [model, value + val];
23339    }),
23340    opts
23341  );
23342};
23343
23344Context__proto__.animate = function animate$1 (keypath, value, options) {
23345  var model = findModel(this, keypath).model;
23346  return animate(this.ractive, model, value, options);
23347};
23348
23349Context__proto__.find = function find (selector) {
23350  return this.fragment.find(selector);
23351};
23352
23353Context__proto__.findAll = function findAll (selector) {
23354  var result = [];
23355  this.fragment.findAll(selector, { result: result });
23356  return result;
23357};
23358
23359Context__proto__.findAllComponents = function findAllComponents (selector) {
23360  var result = [];
23361  this.fragment.findAllComponents(selector, { result: result });
23362  return result;
23363};
23364
23365Context__proto__.findComponent = function findComponent (selector) {
23366  return this.fragment.findComponent(selector);
23367};
23368
23369// get relative keypaths and values
23370Context__proto__.get = function get (keypath) {
23371  if (!keypath) { return this.fragment.findContext().get(true); }
23372
23373  var ref = findModel(this, keypath);
23374    var model = ref.model;
23375
23376  return model ? model.get(true) : undefined;
23377};
23378
23379Context__proto__.getParent = function getParent (component) {
23380  var fragment = this.fragment;
23381
23382  if (!fragment.parent && component) { fragment = fragment.componentParent; }
23383  else {
23384    if (fragment.context) { fragment = findParentWithContext(fragment.parent); }
23385    else {
23386      fragment = findParentWithContext(fragment.parent);
23387      if (fragment) {
23388        if (!fragment.parent && component) { fragment = fragment.componentParent; }
23389        else { fragment = findParentWithContext(fragment.parent); }
23390      }
23391    }
23392  }
23393
23394  if (!fragment || fragment === this.fragment) { return; }
23395  else { return fragment.getContext(); }
23396};
23397
23398Context__proto__.hasListener = function hasListener (name, bubble) {
23399  // if the owner is a component, start there because the nearest element
23400  // may exist outside of the immediate context (yield)
23401  var el = this.fragment.owner.component
23402    ? this.fragment.owner
23403    : this.element || this.fragment.owner;
23404  var base;
23405
23406  do {
23407    base = el.component || el;
23408    if (base.template.t === ELEMENT) {
23409      if (findEvent(base, name)) { return true; }
23410    }
23411    el = el.up && el.up.owner;
23412    if (el && el.component) { el = el.component; }
23413  } while (el && bubble);
23414};
23415
23416Context__proto__.link = function link (source, dest) {
23417  var there = findModel(this, source).model;
23418  var here = findModel(this, dest).model;
23419  var promise = runloop.start();
23420  here.link(there, source);
23421  runloop.end();
23422  return promise;
23423};
23424
23425Context__proto__.listen = function listen (event, handler) {
23426  var el = this.element;
23427  el.on(event, handler);
23428  return {
23429    cancel: function cancel() {
23430      el.off(event, handler);
23431    }
23432  };
23433};
23434
23435Context__proto__.observe = function observe (keypath, callback, options) {
23436    if ( options === void 0 ) options = {};
23437
23438  if (isObject(keypath)) { options = callback || {}; }
23439  options.fragment = this.fragment;
23440  return this.ractive.observe(keypath, callback, options);
23441};
23442
23443Context__proto__.observeOnce = function observeOnce (keypath, callback, options) {
23444    if ( options === void 0 ) options = {};
23445
23446  if (isObject(keypath)) { options = callback || {}; }
23447  options.fragment = this.fragment;
23448  return this.ractive.observeOnce(keypath, callback, options);
23449};
23450
23451Context__proto__.pop = function pop (keypath) {
23452  return modelPop(findModel(this, keypath).model, []);
23453};
23454
23455Context__proto__.push = function push (keypath) {
23456    var values = [], len = arguments.length - 1;
23457    while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
23458
23459  return modelPush(findModel(this, keypath).model, values);
23460};
23461
23462Context__proto__.raise = function raise (name, event) {
23463    var args = [], len = arguments.length - 2;
23464    while ( len-- > 0 ) args[ len ] = arguments[ len + 2 ];
23465
23466  var el = this.element;
23467  var ev;
23468
23469  while (el) {
23470    if (el.component) { el = el.component; }
23471    ev = findEvent(el, name);
23472    if (ev) {
23473      return ev.fire(
23474        ev.element.getContext(
23475          event || {},
23476          event && !('original' in event) ? { original: {} } : {}
23477        ),
23478        args
23479      );
23480    }
23481
23482    el = el.up && el.up.owner;
23483  }
23484};
23485
23486Context__proto__.readLink = function readLink (keypath, options) {
23487  return this.ractive.readLink(this.resolve(keypath), options);
23488};
23489
23490Context__proto__.resolve = function resolve (path, ractive) {
23491  var ref = findModel(this, path);
23492    var model = ref.model;
23493    var instance = ref.instance;
23494  return model ? model.getKeypath(ractive || instance) : path;
23495};
23496
23497Context__proto__.reverse = function reverse (keypath) {
23498  return modelReverse(findModel(this, keypath).model, []);
23499};
23500
23501Context__proto__.set = function set$2 (keypath, value, options) {
23502  return set(build$1(this, keypath, value), options);
23503};
23504
23505Context__proto__.shift = function shift (keypath) {
23506  return modelShift(findModel(this, keypath).model, []);
23507};
23508
23509Context__proto__.splice = function splice (keypath, index, drop) {
23510    var add = [], len = arguments.length - 3;
23511    while ( len-- > 0 ) add[ len ] = arguments[ len + 3 ];
23512
23513  add.unshift(index, drop);
23514  return modelSplice(findModel(this, keypath).model, add);
23515};
23516
23517Context__proto__.sort = function sort (keypath) {
23518  return modelSort(findModel(this, keypath).model, []);
23519};
23520
23521Context__proto__.subtract = function subtract (keypath, d, options) {
23522  var num = isNumber(d) ? d : 1;
23523  var opts = isObjectType(d) ? d : options;
23524  return set(
23525    build$1(this, keypath, num).map(function (pair) {
23526      var model = pair[0];
23527        var val = pair[1];
23528      var value = model.get();
23529      if (!isNumeric(val) || !isNumeric(value)) { throw new Error('Cannot add non-numeric value'); }
23530      return [model, value - val];
23531    }),
23532    opts
23533  );
23534};
23535
23536Context__proto__.toggle = function toggle (keypath, options) {
23537  var ref = findModel(this, keypath);
23538    var model = ref.model;
23539  return set([[model, !model.get()]], options);
23540};
23541
23542Context__proto__.unlink = function unlink (dest) {
23543  var here = findModel(this, dest).model;
23544  var promise = runloop.start();
23545  if (here.owner && here.owner._link) { here.owner.unlink(); }
23546  runloop.end();
23547  return promise;
23548};
23549
23550Context__proto__.unlisten = function unlisten (event, handler) {
23551  this.element.off(event, handler);
23552};
23553
23554Context__proto__.unshift = function unshift (keypath) {
23555    var add = [], len = arguments.length - 1;
23556    while ( len-- > 0 ) add[ len ] = arguments[ len + 1 ];
23557
23558  return modelUnshift(findModel(this, keypath).model, add);
23559};
23560
23561Context__proto__.update = function update (keypath, options) {
23562  return update$1(this.ractive, findModel(this, keypath).model, options);
23563};
23564
23565Context__proto__.updateModel = function updateModel (keypath, cascade) {
23566  var ref = findModel(this, keypath);
23567    var model = ref.model;
23568  var promise = runloop.start();
23569  model.updateFromBindings(cascade);
23570  runloop.end();
23571  return promise;
23572};
23573
23574// two-way binding related helpers
23575Context__proto__.isBound = function isBound () {
23576  var ref = this.getBindingModel(this);
23577    var model = ref.model;
23578  return !!model;
23579};
23580
23581Context__proto__.getBindingPath = function getBindingPath (ractive) {
23582  var ref = this.getBindingModel(this);
23583    var model = ref.model;
23584    var instance = ref.instance;
23585  if (model) { return model.getKeypath(ractive || instance); }
23586};
23587
23588Context__proto__.getBinding = function getBinding () {
23589  var ref = this.getBindingModel(this);
23590    var model = ref.model;
23591  if (model) { return model.get(true); }
23592};
23593
23594Context__proto__.getBindingModel = function getBindingModel (ctx) {
23595  var el = ctx.element;
23596  return { model: el.binding && el.binding.model, instance: el.up.ractive };
23597};
23598
23599Context__proto__.setBinding = function setBinding (value) {
23600  var ref = this.getBindingModel(this);
23601    var model = ref.model;
23602  return set([[model, value]]);
23603};
23604
23605Object.defineProperties( Context__proto__, prototypeAccessors );
23606
23607Context.forRactive = getRactiveContext;
23608// circular deps are fun
23609extern.Context = Context;
23610
23611// TODO: at some point perhaps this could support relative * keypaths?
23612function build$1(ctx, keypath, value) {
23613  var sets = [];
23614
23615  // set multiple keypaths in one go
23616  if (isObject(keypath)) {
23617    for (var k in keypath) {
23618      if (hasOwn(keypath, k)) {
23619        sets.push([findModel(ctx, k).model, keypath[k]]);
23620      }
23621    }
23622  } else {
23623    // set a single keypath
23624    sets.push([findModel(ctx, keypath).model, value]);
23625  }
23626
23627  return sets;
23628}
23629
23630function findModel(ctx, path) {
23631  var frag = ctx.fragment;
23632
23633  if (!isString(path)) {
23634    return { model: frag.findContext(), instance: path };
23635  }
23636
23637  return { model: resolveReference(frag, path), instance: frag.ractive };
23638}
23639
23640function findEvent(el, name) {
23641  return el.events && el.events.find && el.events.find(function (e) { return ~e.template.n.indexOf(name); });
23642}
23643
23644function Ractive$fire(eventName) {
23645  var args = [], len = arguments.length - 1;
23646  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
23647
23648  var ctx;
23649
23650  // watch for reproxy
23651  if (args[0] instanceof Context) {
23652    var proto = args.shift();
23653    ctx = create(proto);
23654    assign(ctx, proto);
23655  } else if (isObjectType(args[0]) && (args[0] === null || args[0].constructor === Object)) {
23656    ctx = Context.forRactive(this, args.shift());
23657  } else {
23658    ctx = Context.forRactive(this);
23659  }
23660
23661  return fireEvent(this, eventName, ctx, args);
23662}
23663
23664function Ractive$get(keypath, opts) {
23665  if (!isString(keypath)) { return this.viewmodel.get(true, keypath); }
23666
23667  var keys = splitKeypath(keypath);
23668  var key = keys[0];
23669
23670  var model;
23671
23672  if (!this.viewmodel.has(key)) {
23673    // if this is an inline component, we may need to create
23674    // an implicit mapping
23675    if (this.component && !this.isolated) {
23676      model = resolveReference(this.fragment || new FakeFragment(this), key);
23677    }
23678  }
23679
23680  model = this.viewmodel.joinAll(keys);
23681  return model.get(true, opts);
23682}
23683
23684var query = doc && doc.querySelector;
23685
23686function getContext$1(node) {
23687  if (isString(node) && query) {
23688    node = query.call(document, node);
23689  }
23690
23691  var instances;
23692  if (node) {
23693    if (node._ractive) {
23694      return node._ractive.proxy.getContext();
23695    } else if ((instances = node.__ractive_instances__)) {
23696      if (instances.length === 1) { return getRactiveContext(instances[0]); }
23697    } else { return getContext$1(node.parentNode); }
23698  }
23699}
23700
23701function getContext$2(node, options) {
23702  if (!node) { return getRactiveContext(this); }
23703
23704  if (isString(node)) {
23705    node = this.find(node, options);
23706  }
23707
23708  return getContext$1(node);
23709}
23710
23711var html = 'http://www.w3.org/1999/xhtml';
23712var mathml = 'http://www.w3.org/1998/Math/MathML';
23713var svg$1 = 'http://www.w3.org/2000/svg';
23714var xlink = 'http://www.w3.org/1999/xlink';
23715var xml = 'http://www.w3.org/XML/1998/namespace';
23716var xmlns = 'http://www.w3.org/2000/xmlns';
23717
23718var namespaces = { html: html, mathml: mathml, svg: svg$1, xlink: xlink, xml: xml, xmlns: xmlns };
23719
23720var createElement;
23721var matches;
23722var div;
23723var methodNames;
23724var unprefixed;
23725var prefixed;
23726var i;
23727var j;
23728var makeFunction;
23729
23730// Test for SVG support
23731if (!svg) {
23732  /* istanbul ignore next */
23733  createElement = function (type, ns, extend) {
23734    if (ns && ns !== html) {
23735      throw "This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you're trying to render SVG in an older browser. See http://ractive.js.org/support/#svgs for more information";
23736    }
23737
23738    return extend ? doc.createElement(type, extend) : doc.createElement(type);
23739  };
23740} else {
23741  createElement = function (type, ns, extend) {
23742    if (!ns || ns === html) {
23743      return extend ? doc.createElement(type, extend) : doc.createElement(type);
23744    }
23745
23746    return extend ? doc.createElementNS(ns, type, extend) : doc.createElementNS(ns, type);
23747  };
23748}
23749
23750function createDocumentFragment() {
23751  return doc.createDocumentFragment();
23752}
23753
23754function getElement(input) {
23755  var output;
23756
23757  if (!input || typeof input === 'boolean') {
23758    return;
23759  }
23760
23761  /* istanbul ignore next */
23762  if (!win || !doc || !input) {
23763    return null;
23764  }
23765
23766  // We already have a DOM node - no work to do. (Duck typing alert!)
23767  if (input.nodeType) {
23768    return input;
23769  }
23770
23771  // Get node from string
23772  if (isString(input)) {
23773    // try ID first
23774    output = doc.getElementById(input);
23775
23776    // then as selector, if possible
23777    if (!output && doc.querySelector) {
23778      try {
23779        output = doc.querySelector(input);
23780      } catch (e) {
23781        /* this space intentionally left blank */
23782      }
23783    }
23784
23785    // did it work?
23786    if (output && output.nodeType) {
23787      return output;
23788    }
23789  }
23790
23791  // If we've been given a collection (jQuery, Zepto etc), extract the first item
23792  if (input[0] && input[0].nodeType) {
23793    return input[0];
23794  }
23795
23796  return null;
23797}
23798
23799if (!isClient) {
23800  matches = null;
23801} else {
23802  div = createElement('div');
23803  methodNames = ['matches', 'matchesSelector'];
23804
23805  makeFunction = function(methodName) {
23806    return function(node, selector) {
23807      return node[methodName](selector);
23808    };
23809  };
23810
23811  i = methodNames.length;
23812
23813  while (i-- && !matches) {
23814    unprefixed = methodNames[i];
23815
23816    if (div[unprefixed]) {
23817      matches = makeFunction(unprefixed);
23818    } else {
23819      j = vendors.length;
23820      while (j--) {
23821        prefixed = vendors[i] + unprefixed.substr(0, 1).toUpperCase() + unprefixed.substring(1);
23822
23823        if (div[prefixed]) {
23824          matches = makeFunction(prefixed);
23825          break;
23826        }
23827      }
23828    }
23829  }
23830
23831  // IE8... and apparently phantom some?
23832  /* istanbul ignore next */
23833  if (!matches) {
23834    matches = function(node, selector) {
23835      var parentNode, i;
23836
23837      parentNode = node.parentNode;
23838
23839      if (!parentNode) {
23840        // empty dummy <div>
23841        div.innerHTML = '';
23842
23843        parentNode = div;
23844        node = node.cloneNode();
23845
23846        div.appendChild(node);
23847      }
23848
23849      var nodes = parentNode.querySelectorAll(selector);
23850
23851      i = nodes.length;
23852      while (i--) {
23853        if (nodes[i] === node) {
23854          return true;
23855        }
23856      }
23857
23858      return false;
23859    };
23860  }
23861}
23862
23863function detachNode(node) {
23864  // stupid ie
23865  // eslint-disable-next-line valid-typeof
23866  if (node && typeof node.parentNode !== 'unknown' && node.parentNode) {
23867    node.parentNode.removeChild(node);
23868  }
23869
23870  return node;
23871}
23872
23873function safeToStringValue(value) {
23874  return value == null || (isNumber(value) && isNaN(value)) || !value.toString ? '' : '' + value;
23875}
23876
23877function safeAttributeString(string) {
23878  return safeToStringValue(string)
23879    .replace(/&/g, '&amp;')
23880    .replace(/"/g, '&quot;')
23881    .replace(/'/g, '&#39;');
23882}
23883
23884function Ractive$insert(target, anchor) {
23885  if (!this.fragment.rendered) {
23886    // TODO create, and link to, documentation explaining this
23887    throw new Error(
23888      'The API has changed - you must call `ractive.render(target[, anchor])` to render your Ractive instance. Once rendered you can use `ractive.insert()`.'
23889    );
23890  }
23891
23892  target = getElement(target);
23893  anchor = getElement(anchor) || null;
23894
23895  if (!target) {
23896    throw new Error('You must specify a valid target to insert into');
23897  }
23898
23899  target.insertBefore(this.detach(), anchor);
23900  this.el = target;
23901
23902  (target.__ractive_instances__ || (target.__ractive_instances__ = [])).push(this);
23903  this.isDetached = false;
23904
23905  fireInsertHook(this);
23906}
23907
23908function fireInsertHook(ractive) {
23909  hooks.insert.fire(ractive);
23910
23911  ractive.findAllComponents('*').forEach(function (child) {
23912    fireInsertHook(child.instance);
23913  });
23914}
23915
23916function link(there, here, options) {
23917  var model;
23918  var target = (options && (options.ractive || options.instance)) || this;
23919
23920  // may need to allow a mapping to resolve implicitly
23921  var sourcePath = splitKeypath(there);
23922  if (!target.viewmodel.has(sourcePath[0]) && target.component) {
23923    model = resolveReference(target.component.up, sourcePath[0]);
23924    model = model.joinAll(sourcePath.slice(1));
23925  }
23926
23927  var src = model || target.viewmodel.joinAll(sourcePath);
23928  var dest = this.viewmodel.joinAll(splitKeypath(here), { lastLink: false });
23929
23930  if (isUpstream(src, dest) || isUpstream(dest, src)) {
23931    throw new Error('A keypath cannot be linked to itself.');
23932  }
23933
23934  var promise = runloop.start();
23935
23936  dest.link(src, (options && options.keypath) || there);
23937
23938  runloop.end();
23939
23940  return promise;
23941}
23942
23943function isUpstream(check, start) {
23944  var model = start;
23945  while (model) {
23946    if (model === check || model.owner === check) { return true; }
23947    model = model.target || model.parent;
23948  }
23949}
23950
23951var Observer = function Observer(ractive, model, callback, options) {
23952  this.context = options.context || ractive;
23953  this.callback = callback;
23954  this.ractive = ractive;
23955  this.keypath = options.keypath;
23956  this.options = options;
23957
23958  if (model) { this.resolved(model); }
23959
23960  if (isFunction(options.old)) {
23961    this.oldContext = create(ractive);
23962    this.oldFn = options.old;
23963  }
23964
23965  if (options.init !== false) {
23966    this.dirty = true;
23967    this.dispatch();
23968  } else {
23969    updateOld(this);
23970  }
23971
23972  this.dirty = false;
23973};
23974var Observer__proto__ = Observer.prototype;
23975
23976Observer__proto__.cancel = function cancel () {
23977  this.cancelled = true;
23978  if (this.model) {
23979    this.model.unregister(this);
23980  } else {
23981    this.resolver.unbind();
23982  }
23983  removeFromArray(this.ractive._observers, this);
23984};
23985
23986Observer__proto__.dispatch = function dispatch () {
23987  if (!this.cancelled) {
23988    this.callback.call(this.context, this.newValue, this.oldValue, this.keypath);
23989    updateOld(this, true);
23990    this.dirty = false;
23991  }
23992};
23993
23994Observer__proto__.handleChange = function handleChange () {
23995    var this$1 = this;
23996
23997  if (!this.dirty) {
23998    var newValue = this.model.get();
23999    if (isEqual(newValue, this.oldValue)) { return; }
24000
24001    this.newValue = newValue;
24002
24003    if (this.options.strict && this.newValue === this.oldValue) { return; }
24004
24005    runloop.addObserver(this, this.options.defer);
24006    this.dirty = true;
24007
24008    if (this.options.once) { runloop.scheduleTask(function () { return this$1.cancel(); }); }
24009  } else {
24010    // make sure the newValue stays updated in case this observer gets touched multiple times in one loop
24011    this.newValue = this.model.get();
24012  }
24013};
24014
24015Observer__proto__.rebind = function rebind (next, previous) {
24016    var this$1 = this;
24017
24018  next = rebindMatch(this.keypath, next, previous);
24019  if (next === this.model) { return false; }
24020
24021  if (this.model) { this.model.unregister(this); }
24022  if (next) { next.addShuffleTask(function () { return this$1.resolved(next); }); }
24023};
24024
24025Observer__proto__.resolved = function resolved (model) {
24026  this.model = model;
24027
24028  this.oldValue = undefined;
24029  this.newValue = model.get();
24030
24031  model.register(this);
24032};
24033
24034function updateOld(observer, fresh) {
24035  var next = fresh
24036    ? observer.model
24037      ? observer.model.get()
24038      : observer.newValue
24039    : observer.newValue;
24040  observer.oldValue = observer.oldFn
24041    ? observer.oldFn.call(observer.oldContext, undefined, next, observer.keypath)
24042    : next;
24043}
24044
24045var star$1 = /\*+/g;
24046
24047var PatternObserver = function PatternObserver(ractive, baseModel, keys$$1, callback, options) {
24048  var this$1 = this;
24049
24050  this.context = options.context || ractive;
24051  this.ractive = ractive;
24052  this.baseModel = baseModel;
24053  this.keys = keys$$1;
24054  this.callback = callback;
24055
24056  var pattern = keys$$1.join('\\.').replace(star$1, '(.+)');
24057  var baseKeypath = (this.baseKeypath = baseModel.getKeypath(ractive));
24058  this.pattern = new RegExp(("^" + (baseKeypath ? baseKeypath + '\\.' : '') + pattern + "$"));
24059  this.recursive = keys$$1.length === 1 && keys$$1[0] === '**';
24060  if (this.recursive) { this.keys = ['*']; }
24061  if (options.old) {
24062    this.oldContext = create(ractive);
24063    this.oldFn = options.old;
24064  }
24065
24066  this.oldValues = {};
24067  this.newValues = {};
24068
24069  this.defer = options.defer;
24070  this.once = options.once;
24071  this.strict = options.strict;
24072
24073  this.dirty = false;
24074  this.changed = [];
24075  this.partial = false;
24076  this.links = options.links;
24077
24078  var models = baseModel.findMatches(this.keys);
24079
24080  models.forEach(function (model) {
24081    this$1.newValues[model.getKeypath(this$1.ractive)] = model.get();
24082  });
24083
24084  if (options.init !== false) {
24085    this.dispatch();
24086  } else {
24087    updateOld$1(this, this.newValues);
24088  }
24089
24090  baseModel.registerPatternObserver(this);
24091};
24092var PatternObserver__proto__ = PatternObserver.prototype;
24093
24094PatternObserver__proto__.cancel = function cancel () {
24095  this.baseModel.unregisterPatternObserver(this);
24096  removeFromArray(this.ractive._observers, this);
24097};
24098
24099PatternObserver__proto__.dispatch = function dispatch () {
24100    var this$1 = this;
24101
24102  var newValues = this.newValues;
24103  this.newValues = {};
24104  keys(newValues).forEach(function (keypath) {
24105    var newValue = newValues[keypath];
24106    var oldValue = this$1.oldValues[keypath];
24107
24108    if (this$1.strict && newValue === oldValue) { return; }
24109    if (isEqual(newValue, oldValue)) { return; }
24110
24111    var args = [newValue, oldValue, keypath];
24112    if (keypath) {
24113      var wildcards = this$1.pattern.exec(keypath);
24114      if (wildcards) {
24115        args = args.concat(wildcards.slice(1));
24116      }
24117    }
24118
24119    this$1.callback.apply(this$1.context, args);
24120  });
24121
24122  updateOld$1(this, newValues, this.partial);
24123
24124  this.dirty = false;
24125};
24126
24127PatternObserver__proto__.notify = function notify (key) {
24128  this.changed.push(key);
24129};
24130
24131PatternObserver__proto__.shuffle = function shuffle (newIndices) {
24132    var this$1 = this;
24133
24134  if (!isArray(this.baseModel.value)) { return; }
24135
24136  var max = this.baseModel.value.length;
24137
24138  for (var i = 0; i < newIndices.length; i++) {
24139    if (newIndices[i] === -1 || newIndices[i] === i) { continue; }
24140    this$1.changed.push([i]);
24141  }
24142
24143  for (var i$1 = newIndices.touchedFrom; i$1 < max; i$1++) {
24144    this$1.changed.push([i$1]);
24145  }
24146};
24147
24148PatternObserver__proto__.handleChange = function handleChange () {
24149    var this$1 = this;
24150
24151  if (!this.dirty || this.changed.length) {
24152    if (!this.dirty) { this.newValues = {}; }
24153
24154    if (!this.changed.length) {
24155      this.baseModel.findMatches(this.keys).forEach(function (model) {
24156        var keypath = model.getKeypath(this$1.ractive);
24157        this$1.newValues[keypath] = model.get();
24158      });
24159      this.partial = false;
24160    } else {
24161      var count = 0;
24162
24163      if (this.recursive) {
24164        this.changed.forEach(function (keys$$1) {
24165          var model = this$1.baseModel.joinAll(keys$$1);
24166          if (model.isLink && !this$1.links) { return; }
24167          count++;
24168          this$1.newValues[model.getKeypath(this$1.ractive)] = model.get();
24169        });
24170      } else {
24171        var ok = this.baseModel.isRoot
24172          ? this.changed.map(function (keys$$1) { return keys$$1.map(escapeKey).join('.'); })
24173          : this.changed.map(function (keys$$1) { return this$1.baseKeypath + '.' + keys$$1.map(escapeKey).join('.'); });
24174
24175        this.baseModel.findMatches(this.keys).forEach(function (model) {
24176          var keypath = model.getKeypath(this$1.ractive);
24177          var check = function (k) {
24178            return (
24179              (k.indexOf(keypath) === 0 &&
24180                (k.length === keypath.length || k[keypath.length] === '.')) ||
24181              (keypath.indexOf(k) === 0 &&
24182                (k.length === keypath.length || keypath[k.length] === '.'))
24183            );
24184          };
24185
24186          // is this model on a changed keypath?
24187          if (ok.filter(check).length) {
24188            count++;
24189            this$1.newValues[keypath] = model.get();
24190          }
24191        });
24192      }
24193
24194      // no valid change triggered, so bail to avoid breakage
24195      if (!count) { return; }
24196
24197      this.partial = true;
24198    }
24199
24200    runloop.addObserver(this, this.defer);
24201    this.dirty = true;
24202    this.changed.length = 0;
24203
24204    if (this.once) { this.cancel(); }
24205  }
24206};
24207
24208function updateOld$1(observer, vals, partial) {
24209  var olds = observer.oldValues;
24210
24211  if (observer.oldFn) {
24212    if (!partial) { observer.oldValues = {}; }
24213
24214    keys(vals).forEach(function (k) {
24215      var args = [olds[k], vals[k], k];
24216      var parts = observer.pattern.exec(k);
24217      if (parts) {
24218        args.push.apply(args, parts.slice(1));
24219      }
24220      observer.oldValues[k] = observer.oldFn.apply(observer.oldContext, args);
24221    });
24222  } else {
24223    if (partial) {
24224      keys(vals).forEach(function (k) { return (olds[k] = vals[k]); });
24225    } else {
24226      observer.oldValues = vals;
24227    }
24228  }
24229}
24230
24231function negativeOne() {
24232  return -1;
24233}
24234
24235var ArrayObserver = function ArrayObserver(ractive, model, callback, options) {
24236  this.ractive = ractive;
24237  this.model = model;
24238  this.keypath = model.getKeypath();
24239  this.callback = callback;
24240  this.options = options;
24241
24242  this.pending = null;
24243
24244  model.register(this);
24245
24246  if (options.init !== false) {
24247    this.sliced = [];
24248    this.shuffle([]);
24249    this.dispatch();
24250  } else {
24251    this.sliced = this.slice();
24252  }
24253};
24254var ArrayObserver__proto__ = ArrayObserver.prototype;
24255
24256ArrayObserver__proto__.cancel = function cancel () {
24257  this.model.unregister(this);
24258  removeFromArray(this.ractive._observers, this);
24259};
24260
24261ArrayObserver__proto__.dispatch = function dispatch () {
24262  this.callback(this.pending);
24263  this.pending = null;
24264  if (this.options.once) { this.cancel(); }
24265};
24266
24267ArrayObserver__proto__.handleChange = function handleChange (path) {
24268  if (this.pending) {
24269    // post-shuffle
24270    runloop.addObserver(this, this.options.defer);
24271  } else if (!path) {
24272    // entire array changed
24273    this.shuffle(this.sliced.map(negativeOne));
24274    this.handleChange();
24275  }
24276};
24277
24278ArrayObserver__proto__.shuffle = function shuffle (newIndices) {
24279    var this$1 = this;
24280
24281  var newValue = this.slice();
24282
24283  var inserted = [];
24284  var deleted = [];
24285  var start;
24286
24287  var hadIndex = {};
24288
24289  newIndices.forEach(function (newIndex, oldIndex) {
24290    hadIndex[newIndex] = true;
24291
24292    if (newIndex !== oldIndex && isUndefined(start)) {
24293      start = oldIndex;
24294    }
24295
24296    if (newIndex === -1) {
24297      deleted.push(this$1.sliced[oldIndex]);
24298    }
24299  });
24300
24301  if (isUndefined(start)) { start = newIndices.length; }
24302
24303  var len = newValue.length;
24304  for (var i = 0; i < len; i += 1) {
24305    if (!hadIndex[i]) { inserted.push(newValue[i]); }
24306  }
24307
24308  this.pending = { inserted: inserted, deleted: deleted, start: start };
24309  this.sliced = newValue;
24310};
24311
24312ArrayObserver__proto__.slice = function slice () {
24313  var value = this.model.get();
24314  return isArray(value) ? value.slice() : [];
24315};
24316
24317function observe(keypath, callback, options) {
24318  var this$1 = this;
24319
24320  var observers = [];
24321  var map;
24322  var opts;
24323
24324  if (isObject(keypath)) {
24325    map = keypath;
24326    opts = callback || {};
24327  } else {
24328    if (isFunction(keypath)) {
24329      map = { '': keypath };
24330      opts = callback || {};
24331    } else {
24332      map = {};
24333      map[keypath] = callback;
24334      opts = options || {};
24335    }
24336  }
24337
24338  var silent = false;
24339  keys(map).forEach(function (keypath) {
24340    var callback = map[keypath];
24341    var caller = function() {
24342      var args = [], len = arguments.length;
24343      while ( len-- ) args[ len ] = arguments[ len ];
24344
24345      if (silent) { return; }
24346      return callback.apply(this, args);
24347    };
24348
24349    var keypaths = keypath.split(' ');
24350    if (keypaths.length > 1) { keypaths = keypaths.filter(function (k) { return k; }); }
24351
24352    keypaths.forEach(function (keypath) {
24353      opts.keypath = keypath;
24354      var observer = createObserver(this$1, keypath, caller, opts);
24355      if (observer) { observers.push(observer); }
24356    });
24357  });
24358
24359  // add observers to the Ractive instance, so they can be
24360  // cancelled on ractive.teardown()
24361  this._observers.push.apply(this._observers, observers);
24362
24363  return {
24364    cancel: function () { return observers.forEach(function (o) { return o.cancel(); }); },
24365    isSilenced: function () { return silent; },
24366    silence: function () { return (silent = true); },
24367    resume: function () { return (silent = false); }
24368  };
24369}
24370
24371function createObserver(ractive, keypath, callback, options) {
24372  var keys$$1 = splitKeypath(keypath);
24373  var wildcardIndex = keys$$1.indexOf('*');
24374  if (!~wildcardIndex) { wildcardIndex = keys$$1.indexOf('**'); }
24375
24376  options.fragment = options.fragment || ractive.fragment;
24377
24378  var model;
24379  if (!options.fragment) {
24380    model = ractive.viewmodel.joinKey(keys$$1[0]);
24381  } else {
24382    // .*.whatever relative wildcard is a special case because splitkeypath doesn't handle the leading .
24383    if (~keys$$1[0].indexOf('.*')) {
24384      model = options.fragment.findContext();
24385      wildcardIndex = 0;
24386      keys$$1[0] = keys$$1[0].slice(1);
24387    } else {
24388      model =
24389        wildcardIndex === 0
24390          ? options.fragment.findContext()
24391          : resolveReference(options.fragment, keys$$1[0]);
24392    }
24393  }
24394
24395  // the model may not exist key
24396  if (!model) { model = ractive.viewmodel.joinKey(keys$$1[0]); }
24397
24398  if (!~wildcardIndex) {
24399    model = model.joinAll(keys$$1.slice(1));
24400    if (options.array) {
24401      return new ArrayObserver(ractive, model, callback, options);
24402    } else {
24403      return new Observer(ractive, model, callback, options);
24404    }
24405  } else {
24406    var double = keys$$1.indexOf('**');
24407    if (~double) {
24408      if (double + 1 !== keys$$1.length || ~keys$$1.indexOf('*')) {
24409        warnOnceIfDebug(
24410          "Recursive observers may only specify a single '**' at the end of the path."
24411        );
24412        return;
24413      }
24414    }
24415
24416    model = model.joinAll(keys$$1.slice(1, wildcardIndex));
24417
24418    return new PatternObserver(ractive, model, keys$$1.slice(wildcardIndex), callback, options);
24419  }
24420}
24421
24422var onceOptions = { init: false, once: true };
24423
24424function observeOnce(keypath, callback, options) {
24425  if (isObject(keypath) || isFunction(keypath)) {
24426    options = assign(callback || {}, onceOptions);
24427    return this.observe(keypath, options);
24428  }
24429
24430  options = assign(options || {}, onceOptions);
24431  return this.observe(keypath, callback, options);
24432}
24433
24434var trim = function (str) { return str.trim(); };
24435
24436var notEmptyString = function (str) { return str !== ''; };
24437
24438function Ractive$off(eventName, callback) {
24439  var this$1 = this;
24440
24441  // if no event is specified, remove _all_ event listeners
24442  if (!eventName) {
24443    this._subs = {};
24444  } else {
24445    // Handle multiple space-separated event names
24446    var eventNames = eventName
24447      .split(' ')
24448      .map(trim)
24449      .filter(notEmptyString);
24450
24451    eventNames.forEach(function (event) {
24452      var subs = this$1._subs[event];
24453      // if given a specific callback to remove, remove only it
24454      if (subs && callback) {
24455        var entry = subs.find(function (s) { return s.callback === callback; });
24456        if (entry) {
24457          removeFromArray(subs, entry);
24458          entry.off = true;
24459
24460          if (event.indexOf('.')) { this$1._nsSubs--; }
24461        }
24462      } else if (subs) {
24463        // otherwise, remove all listeners for this event
24464        if (event.indexOf('.')) { this$1._nsSubs -= subs.length; }
24465        subs.length = 0;
24466      }
24467    });
24468  }
24469
24470  return this;
24471}
24472
24473function Ractive$on(eventName, callback) {
24474  var this$1 = this;
24475
24476  // eventName may already be a map
24477  var map = isObjectType(eventName) ? eventName : {};
24478  // or it may be a string along with a callback
24479  if (isString(eventName)) { map[eventName] = callback; }
24480
24481  var silent = false;
24482  var events = [];
24483
24484  var loop = function ( k ) {
24485    var callback$1 = map[k];
24486    var caller = function() {
24487      var args = [], len = arguments.length;
24488      while ( len-- ) args[ len ] = arguments[ len ];
24489
24490      if (!silent) { return callback$1.apply(this, args); }
24491    };
24492    var entry = {
24493      callback: callback$1,
24494      handler: caller
24495    };
24496
24497    if (hasOwn(map, k)) {
24498      var names = k
24499        .split(' ')
24500        .map(trim)
24501        .filter(notEmptyString);
24502      names.forEach(function (n) {
24503        (this$1._subs[n] || (this$1._subs[n] = [])).push(entry);
24504        if (n.indexOf('.')) { this$1._nsSubs++; }
24505        events.push([n, entry]);
24506      });
24507    }
24508  };
24509
24510  for (var k in map) loop( k );
24511
24512  return {
24513    cancel: function () { return events.forEach(function (e) { return this$1.off(e[0], e[1].callback); }); },
24514    isSilenced: function () { return silent; },
24515    silence: function () { return (silent = true); },
24516    resume: function () { return (silent = false); }
24517  };
24518}
24519
24520function Ractive$once(eventName, handler) {
24521  var listener = this.on(eventName, function() {
24522    handler.apply(this, arguments);
24523    listener.cancel();
24524  });
24525
24526  // so we can still do listener.cancel() manually
24527  return listener;
24528}
24529
24530var pop = makeArrayMethod('pop').path;
24531
24532var push = makeArrayMethod('push').path;
24533
24534function readLink(keypath, options) {
24535  if ( options === void 0 ) options = {};
24536
24537  var path = splitKeypath(keypath);
24538
24539  if (this.viewmodel.has(path[0])) {
24540    var model = this.viewmodel.joinAll(path);
24541
24542    if (!model.isLink) { return; }
24543
24544    while ((model = model.target) && options.canonical !== false) {
24545      if (!model.isLink) { break; }
24546    }
24547
24548    if (model) { return { ractive: model.root.ractive, keypath: model.getKeypath() }; }
24549  }
24550}
24551
24552var PREFIX = '/* Ractive.js component styles */';
24553
24554// Holds current definitions of styles.
24555var styleDefinitions = [];
24556
24557// Flag to tell if we need to update the CSS
24558var isDirty = false;
24559
24560// These only make sense on the browser. See additional setup below.
24561var styleElement = null;
24562var useCssText = null;
24563
24564function addCSS(styleDefinition) {
24565  styleDefinitions.push(styleDefinition);
24566  isDirty = true;
24567}
24568
24569function applyCSS(force) {
24570  var styleElement = style();
24571
24572  // Apply only seems to make sense when we're in the DOM. Server-side renders
24573  // can call toCSS to get the updated CSS.
24574  if (!styleElement || (!force && !isDirty)) { return; }
24575
24576  if (useCssText) {
24577    styleElement.styleSheet.cssText = getCSS(null);
24578  } else {
24579    styleElement.innerHTML = getCSS(null);
24580  }
24581
24582  isDirty = false;
24583}
24584
24585function getCSS(cssIds) {
24586  var filteredStyleDefinitions = cssIds
24587    ? styleDefinitions.filter(function (style) { return ~cssIds.indexOf(style.id); })
24588    : styleDefinitions;
24589
24590  filteredStyleDefinitions.forEach(function (d) { return (d.applied = true); });
24591
24592  return filteredStyleDefinitions.reduce(
24593    function (styles, style) { return ("" + (styles ? (styles + "\n\n/* {" + (style.id) + "} */\n" + (style.styles)) : '')); },
24594    PREFIX
24595  );
24596}
24597
24598function style() {
24599  // If we're on the browser, additional setup needed.
24600  if (doc && !styleElement) {
24601    styleElement = doc.createElement('style');
24602    styleElement.type = 'text/css';
24603    styleElement.setAttribute('data-ractive-css', '');
24604
24605    doc.getElementsByTagName('head')[0].appendChild(styleElement);
24606
24607    useCssText = !!styleElement.styleSheet;
24608 
vendor: 8,919 bytes, lines 24608-24923
24608 }
24609
24610  return styleElement;
24611}
24612
24613var adaptConfigurator = {
24614  extend: function (Parent, proto, options) {
24615    proto.adapt = combine(proto.adapt, ensureArray(options.adapt));
24616  },
24617
24618  init: function init() {}
24619};
24620
24621var remove = /\/\*(?:[\s\S]*?)\*\//g;
24622var escape = /url\(\s*(['"])(?:\\[\s\S]|(?!\1).)*\1\s*\)|url\((?:\\[\s\S]|[^)])*\)|(['"])(?:\\[\s\S]|(?!\2).)*\2/gi;
24623var value = /\0(\d+)/g;
24624
24625// Removes comments and strings from the given CSS to make it easier to parse.
24626// Callback receives the cleaned CSS and a function which can be used to put
24627// the removed strings back in place after parsing is done.
24628function cleanCss(css, callback, additionalReplaceRules) {
24629  if ( additionalReplaceRules === void 0 ) additionalReplaceRules = [];
24630
24631  var values = [];
24632  var reconstruct = function (css) { return css.replace(value, function (match, n) { return values[n]; }); };
24633  css = css.replace(escape, function (match) { return ("\u0000" + (values.push(match) - 1)); }).replace(remove, '');
24634
24635  additionalReplaceRules.forEach(function (pattern) {
24636    css = css.replace(pattern, function (match) { return ("\u0000" + (values.push(match) - 1)); });
24637  });
24638
24639  return callback(css, reconstruct);
24640}
24641
24642var selectorsPattern = /(?:^|\}|\{|\x01)\s*([^\{\}\0\x01]+)\s*(?=\{)/g;
24643var importPattern = /@import\s*\([^)]*\)\s*;?/gi;
24644var importEndPattern = /\x01/g;
24645var keyframesDeclarationPattern = /@keyframes\s+[^\{\}]+\s*\{(?:[^{}]+|\{[^{}]+})*}/gi;
24646var selectorUnitPattern = /((?:(?:\[[^\]]+\])|(?:[^\s\+\>~:]))+)((?:::?[^\s\+\>\~\(:]+(?:\([^\)]+\))?)*\s*[\s\+\>\~]?)\s*/g;
24647var excludePattern = /^(?:@|\d+%)/;
24648var dataRvcGuidPattern = /\[data-ractive-css~="\{[a-z0-9-]+\}"]/g;
24649
24650function trim$1(str) {
24651  return str.trim();
24652}
24653
24654function extractString(unit) {
24655  return unit.str;
24656}
24657
24658function transformSelector(selector, parent) {
24659  var selectorUnits = [];
24660  var match;
24661
24662  while ((match = selectorUnitPattern.exec(selector))) {
24663    selectorUnits.push({
24664      str: match[0],
24665      base: match[1],
24666      modifiers: match[2]
24667    });
24668  }
24669
24670  // For each simple selector within the selector, we need to create a version
24671  // that a) combines with the id, and b) is inside the id
24672  var base = selectorUnits.map(extractString);
24673
24674  var transformed = [];
24675  var i = selectorUnits.length;
24676
24677  while (i--) {
24678    var appended = base.slice();
24679
24680    // Pseudo-selectors should go after the attribute selector
24681    var unit = selectorUnits[i];
24682    appended[i] = unit.base + parent + unit.modifiers || '';
24683
24684    var prepended = base.slice();
24685    prepended[i] = parent + ' ' + prepended[i];
24686
24687    transformed.push(appended.join(' '), prepended.join(' '));
24688  }
24689
24690  return transformed.join(', ');
24691}
24692
24693function transformCss(css, id) {
24694  var dataAttr = "[data-ractive-css~=\"{" + id + "}\"]";
24695
24696  var transformed;
24697
24698  if (dataRvcGuidPattern.test(css)) {
24699    transformed = css.replace(dataRvcGuidPattern, dataAttr);
24700  } else {
24701    transformed = cleanCss(
24702      css,
24703      function (css, reconstruct) {
24704        css = css
24705          .replace(importPattern, '$&\x01')
24706          .replace(selectorsPattern, function (match, $1) {
24707            // don't transform at-rules and keyframe declarations
24708            if (excludePattern.test($1)) { return match; }
24709
24710            var selectors = $1.split(',').map(trim$1);
24711            var transformed =
24712              selectors.map(function (selector) { return transformSelector(selector, dataAttr); }).join(', ') + ' ';
24713
24714            return match.replace($1, transformed);
24715          })
24716          .replace(importEndPattern, '');
24717
24718        return reconstruct(css);
24719      },
24720      [keyframesDeclarationPattern]
24721    );
24722  }
24723
24724  return transformed;
24725}
24726
24727function s4() {
24728  return Math.floor((1 + Math.random()) * 0x10000)
24729    .toString(16)
24730    .substring(1);
24731}
24732
24733function uuid() {
24734  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
24735}
24736
24737function setCSSData(keypath, value, options) {
24738  var opts = isObjectType(keypath) ? value : options;
24739  var model = this._cssModel;
24740
24741  model.locked = true;
24742  var promise = set(build({ viewmodel: model }, keypath, value, true), opts);
24743  model.locked = false;
24744
24745  var cascade = runloop.start();
24746  this.extensions.forEach(function (e) {
24747    var model = e._cssModel;
24748    model.mark();
24749    model.downstreamChanged('', 1);
24750  });
24751  runloop.end();
24752
24753  applyChanges(this, !opts || opts.apply !== false);
24754
24755  return promise.then(function () { return cascade; });
24756}
24757
24758function applyChanges(component, apply) {
24759  var local = recomputeCSS(component);
24760  var child = component.extensions
24761    .map(function (e) { return applyChanges(e, false); })
24762    .reduce(function (a, c) { return c || a; }, false);
24763
24764  if (apply && (local || child)) {
24765    var def = component._cssDef;
24766    if (!def || (def && def.applied)) { applyCSS(true); }
24767  }
24768
24769  return local || child;
24770}
24771
24772function recomputeCSS(component) {
24773  var css = component.css;
24774
24775  if (!isFunction(css)) { return; }
24776
24777  var def = component._cssDef;
24778  var result = evalCSS(component, css);
24779  var styles = def.transform ? transformCss(result, def.id) : result;
24780
24781  if (def.styles === styles) { return; }
24782
24783  def.styles = styles;
24784
24785  return true;
24786}
24787
24788var CSSModel = (function (SharedModel) {
24789  function CSSModel(component) {
24790    SharedModel.call(this, component.cssData, '@style');
24791    this.component = component;
24792  }
24793
24794  if ( SharedModel ) CSSModel.__proto__ = SharedModel;
24795  var CSSModel__proto__ = CSSModel.prototype = Object.create( SharedModel && SharedModel.prototype );
24796  CSSModel__proto__.constructor = CSSModel;
24797
24798  CSSModel__proto__.downstreamChanged = function downstreamChanged (path, depth) {
24799    if (this.locked) { return; }
24800
24801    var component = this.component;
24802
24803    component.extensions.forEach(function (e) {
24804      var model = e._cssModel;
24805      model.mark();
24806      model.downstreamChanged(path, depth || 1);
24807    });
24808
24809    if (!depth) {
24810      applyChanges(component, true);
24811    }
24812  };
24813
24814  return CSSModel;
24815}(SharedModel));
24816
24817var hasCurly = /\{/;
24818var cssConfigurator = {
24819  name: 'css',
24820
24821  // Called when creating a new component definition
24822  extend: function (Parent, proto, options, Child) {
24823    Child._cssIds = gatherIds(Parent);
24824
24825    defineProperty(Child, 'cssData', {
24826      configurable: true,
24827      value: assign(create(Parent.cssData), options.cssData || {})
24828    });
24829
24830    defineProperty(Child, '_cssModel', {
24831      configurable: true,
24832      value: new CSSModel(Child)
24833    });
24834
24835    if (options.css) { initCSS(options, Child, proto); }
24836  },
24837
24838  // Called when creating a new component instance
24839  init: function (Parent, target, options) {
24840    if (!options.css) { return; }
24841
24842    warnIfDebug("\nThe css option is currently not supported on a per-instance basis and will be discarded. Instead, we recommend instantiating from a component definition with a css option.\n\nconst Component = Ractive.extend({\n\t...\n\tcss: '/* your css */',\n\t...\n});\n\nconst componentInstance = new Component({ ... })\n\t\t");
24843  }
24844};
24845
24846function gatherIds(start) {
24847  var cmp = start;
24848  var ids = [];
24849
24850  while (cmp) {
24851    if (cmp.prototype.cssId) { ids.push(cmp.prototype.cssId); }
24852    cmp = cmp.Parent;
24853  }
24854
24855  return ids;
24856}
24857
24858function evalCSS(component, css) {
24859  if (isString(css)) { return css; }
24860
24861  var cssData = component.cssData;
24862  var model = component._cssModel;
24863  var data = function data(path) {
24864    return model.joinAll(splitKeypath(path)).get();
24865  };
24866  data.__proto__ = cssData;
24867
24868  var result = css.call(component, data);
24869  return isString(result) ? result : '';
24870}
24871
24872function initCSS(options, target, proto) {
24873  var css =
24874    options.css === true
24875      ? ''
24876      : isString(options.css) && !hasCurly.test(options.css)
24877      ? getElement(options.css) || options.css
24878      : options.css;
24879  var cssProp = css;
24880
24881  var id = options.cssId || uuid();
24882
24883  if (isObjectType(css)) {
24884    css = 'textContent' in css ? css.textContent : css.innerHTML;
24885    cssProp = css;
24886  } else if (isFunction(css)) {
24887    cssProp = css;
24888    css = evalCSS(target, css);
24889  }
24890
24891  var def = {
24892    transform: 'noCSSTransform' in options ? !options.noCSSTransform : !options.noCssTransform
24893  };
24894
24895  defineProperty(target, '_cssDef', { configurable: true, value: def });
24896
24897  defineProperty(target, 'css', {
24898    get: function get() {
24899      return cssProp;
24900    },
24901    set: function set(next) {
24902      cssProp = next;
24903      var css = evalCSS(target, cssProp);
24904      var styles = def.styles;
24905      def.styles = def.transform ? transformCss(css, id) : css;
24906      if (def.applied && styles !== def.styles) { applyCSS(true); }
24907    }
24908  });
24909
24910  def.styles = def.transform ? transformCss(css, id) : css;
24911  def.id = proto.cssId = id;
24912  target._cssIds.push(id);
24913
24914  addCSS(target._cssDef);
24915}
24916
24917function validate(data) {
24918  // Warn if userOptions.data is a non-POJO
24919  if (data && data.constructor !== Object) {
24920    if (isFunction(data)) {
24921      // TODO do we need to support this in the new Ractive() case?
24922    } else if (!isObjectType(data)) {
24923      fatal(("data option must be an object or a function, `" + data + "` is not val
vendor: 9,133 bytes, lines 24923-25262
24923id"));
24924    } else {
24925      warnIfDebug(
24926        'If supplied, options.data should be a plain JavaScript object - using a non-POJO as the root object may work, but is discouraged'
24927      );
24928    }
24929  }
24930}
24931
24932var dataConfigurator = {
24933  name: 'data',
24934
24935  extend: function (Parent, proto, options) {
24936    var key;
24937    var value;
24938
24939    // check for non-primitives, which could cause mutation-related bugs
24940    if (options.data && isObject(options.data)) {
24941      for (key in options.data) {
24942        value = options.data[key];
24943
24944        if (value && isObjectType(value)) {
24945          if (isObject(value) || isArray(value)) {
24946            warnIfDebug("Passing a `data` option with object and array properties to Ractive.extend() is discouraged, as mutating them is likely to cause bugs. Consider using a data function instead:\n\n  // this...\n  data: function () {\n    return {\n      myObject: {}\n    };\n  })\n\n  // instead of this:\n  data: {\n    myObject: {}\n  }");
24947          }
24948        }
24949      }
24950    }
24951
24952    proto.data = combine$1(proto.data, options.data);
24953  },
24954
24955  init: function (Parent, ractive, options) {
24956    var result = combine$1(Parent.prototype.data, options.data);
24957
24958    if (isFunction(result)) { result = result.call(ractive); }
24959
24960    // bind functions to the ractive instance at the top level,
24961    // unless it's a non-POJO (in which case alarm bells should ring)
24962    if (result && result.constructor === Object) {
24963      for (var prop in result) {
24964        if (isFunction(result[prop])) {
24965          var value = result[prop];
24966          result[prop] = bind(value, ractive);
24967          result[prop]._r_unbound = value;
24968        }
24969      }
24970    }
24971
24972    return result || {};
24973  },
24974
24975  reset: function reset(ractive) {
24976    var result = this.init(ractive.constructor, ractive, ractive.viewmodel);
24977    ractive.viewmodel.root.set(result);
24978    return true;
24979  }
24980};
24981
24982function emptyData() {
24983  return {};
24984}
24985
24986function combine$1(parentValue, childValue) {
24987  validate(childValue);
24988
24989  var parentIsFn = isFunction(parentValue);
24990
24991  // Very important, otherwise child instance can become
24992  // the default data object on Ractive or a component.
24993  // then ractive.set() ends up setting on the prototype!
24994  if (!childValue && !parentIsFn) {
24995    // this needs to be a function so that it can still inherit parent defaults
24996    childValue = emptyData;
24997  }
24998
24999  var childIsFn = isFunction(childValue);
25000
25001  // Fast path, where we just need to copy properties from
25002  // parent to child
25003  if (!parentIsFn && !childIsFn) {
25004    return fromProperties(childValue, parentValue);
25005  }
25006
25007  return function() {
25008    var child = childIsFn ? callDataFunction(childValue, this) : childValue;
25009    var parent = parentIsFn ? callDataFunction(parentValue, this) : parentValue;
25010
25011    return fromProperties(child, parent);
25012  };
25013}
25014
25015function callDataFunction(fn, context) {
25016  var data = fn.call(context);
25017
25018  if (!data) { return; }
25019
25020  if (!isObjectType(data)) {
25021    fatal('Data function must return an object');
25022  }
25023
25024  if (data.constructor !== Object) {
25025    warnOnceIfDebug(
25026      'Data function returned something other than a plain JavaScript object. This might work, but is strongly discouraged'
25027    );
25028  }
25029
25030  return data;
25031}
25032
25033function fromProperties(primary, secondary) {
25034  if (primary && secondary) {
25035    for (var key in secondary) {
25036      if (!(key in primary)) {
25037        primary[key] = secondary[key];
25038      }
25039    }
25040
25041    return primary;
25042  }
25043
25044  return primary || secondary;
25045}
25046
25047var templateConfigurator = {
25048  name: 'template',
25049
25050  extend: function extend(Parent, proto, options) {
25051    // only assign if exists
25052    if ('template' in options) {
25053      var template = options.template;
25054
25055      if (isFunction(template)) {
25056        proto.template = template;
25057      } else {
25058        proto.template = parseTemplate(template, proto);
25059      }
25060    }
25061  },
25062
25063  init: function init(Parent, ractive, options) {
25064    // TODO because of prototypal inheritance, we might just be able to use
25065    // ractive.template, and not bother passing through the Parent object.
25066    // At present that breaks the test mocks' expectations
25067    var template = 'template' in options ? options.template : Parent.prototype.template;
25068    template = template || { v: TEMPLATE_VERSION, t: [] };
25069
25070    if (isFunction(template)) {
25071      var fn = template;
25072      template = getDynamicTemplate(ractive, fn);
25073
25074      ractive._config.template = {
25075        fn: fn,
25076        result: template
25077      };
25078    }
25079
25080    template = parseTemplate(template, ractive);
25081
25082    // TODO the naming of this is confusing - ractive.template refers to [...],
25083    // but Component.prototype.template refers to {v:1,t:[],p:[]}...
25084    // it's unnecessary, because the developer never needs to access
25085    // ractive.template
25086    ractive.template = template.t;
25087
25088    if (template.p) {
25089      extendPartials(ractive.partials, template.p);
25090    }
25091  },
25092
25093  reset: function reset(ractive) {
25094    var result = resetValue(ractive);
25095
25096    if (result) {
25097      var parsed = parseTemplate(result, ractive);
25098
25099      ractive.template = parsed.t;
25100      extendPartials(ractive.partials, parsed.p, true);
25101
25102      return true;
25103    }
25104  }
25105};
25106
25107function resetValue(ractive) {
25108  var initial = ractive._config.template;
25109
25110  // If this isn't a dynamic template, there's nothing to do
25111  if (!initial || !initial.fn) {
25112    return;
25113  }
25114
25115  var result = getDynamicTemplate(ractive, initial.fn);
25116
25117  // TODO deep equality check to prevent unnecessary re-rendering
25118  // in the case of already-parsed templates
25119  if (result !== initial.result) {
25120    initial.result = result;
25121    return result;
25122  }
25123}
25124
25125function getDynamicTemplate(ractive, fn) {
25126  return fn.call(ractive, {
25127    fromId: parser.fromId,
25128    isParsed: parser.isParsed,
25129    parse: function parse(template, options) {
25130      if ( options === void 0 ) options = parser.getParseOptions(ractive);
25131
25132      return parser.parse(template, options);
25133    }
25134  });
25135}
25136
25137function parseTemplate(template, ractive) {
25138  if (isString(template)) {
25139    // parse will validate and add expression functions
25140    template = parseAsString(template, ractive);
25141  } else {
25142    // need to validate and add exp for already parsed template
25143    validate$1(template);
25144    addFunctions(template);
25145  }
25146
25147  return template;
25148}
25149
25150function parseAsString(template, ractive) {
25151  // ID of an element containing the template?
25152  if (template[0] === '#') {
25153    template = parser.fromId(template);
25154  }
25155
25156  return parser.parseFor(template, ractive);
25157}
25158
25159function validate$1(template) {
25160  // Check that the template even exists
25161  if (template == undefined) {
25162    throw new Error(("The template cannot be " + template + "."));
25163  } else if (!isNumber(template.v)) {
25164    // Check the parsed template has a version at all
25165    throw new Error(
25166      "The template parser was passed a non-string template, but the template doesn't have a version.  Make sure you're passing in the template you think you are."
25167    );
25168  } else if (template.v !== TEMPLATE_VERSION) {
25169    // Check we're using the correct version
25170    throw new Error(
25171      ("Mismatched template version (expected " + TEMPLATE_VERSION + ", got " + (template.v) + ") Please ensure you are using the latest version of Ractive.js in your build process as well as in your app")
25172    );
25173  }
25174}
25175
25176function extendPartials(existingPartials, newPartials, overwrite) {
25177  if (!newPartials) { return; }
25178
25179  // TODO there's an ambiguity here - we need to overwrite in the `reset()`
25180  // case, but not initially...
25181
25182  for (var key in newPartials) {
25183    if (overwrite || !hasOwn(existingPartials, key)) {
25184      existingPartials[key] = newPartials[key];
25185    }
25186  }
25187}
25188
25189var registryNames = [
25190  'adaptors',
25191  'components',
25192  'computed',
25193  'decorators',
25194  'easing',
25195  'events',
25196  'helpers',
25197  'interpolators',
25198  'partials',
25199  'transitions'
25200];
25201
25202var registriesOnDefaults = ['computed', 'helpers'];
25203
25204var Registry = function Registry(name, useDefaults) {
25205  this.name = name;
25206  this.useDefaults = useDefaults;
25207};
25208var Registry__proto__ = Registry.prototype;
25209
25210Registry__proto__.extend = function extend (Parent, proto, options) {
25211  var parent = this.useDefaults ? Parent.defaults : Parent;
25212  var target = this.useDefaults ? proto : proto.constructor;
25213  this.configure(parent, target, options);
25214};
25215
25216Registry__proto__.init = function init () {
25217  // noop
25218};
25219
25220Registry__proto__.configure = function configure (Parent, target, options) {
25221  var name = this.name;
25222  var option = options[name];
25223
25224  var registry = create(Parent[name]);
25225
25226  assign(registry, option);
25227
25228  target[name] = registry;
25229
25230  if (name === 'partials' && target[name]) {
25231    keys(target[name]).forEach(function (key) {
25232      addFunctions(target[name][key]);
25233    });
25234  }
25235};
25236
25237Registry__proto__.reset = function reset (ractive) {
25238  var registry = ractive[this.name];
25239  var changed = false;
25240
25241  keys(registry).forEach(function (key) {
25242    var item = registry[key];
25243
25244    if (item._fn) {
25245      if (item._fn.isOwner) {
25246        registry[key] = item._fn;
25247      } else {
25248        delete registry[key];
25249      }
25250      changed = true;
25251    }
25252  });
25253
25254  return changed;
25255};
25256
25257var registries = registryNames.map(function (name) {
25258  var putInDefaults = registriesOnDefaults.indexOf(name) > -1;
25259  return new Registry(name, putInDefaults);
25260});
25261
25262function wrap
25262(parent, name, method) {
25263  if (!/_super/.test(method)) { return method; }
25264
25265  function wrapper() {
25266    var superMethod = getSuperMethod(wrapper._parent, name);
25267    var hasSuper = '_super' in this;
25268    var oldSuper = this._super;
25269
25270    this._super = superMethod;
25271
25272    var result = method.apply(this, arguments);
25273
25274    if (hasSuper) {
25275      this._super = oldSuper;
25276    } else {
25277      delete this._super;
25278    }
25279
25280    return result;
25281  }
25282
25283  wrapper._parent = parent;
25284  wrapper._method = method;
25285
25286  return wrapper;
25287}
25288
25289function getSuperMethod(parent, name) {
25290  if (name in parent) {
25291    var value = parent[name];
25292
25293    return isFunction(value) ? value : function () { return value; };
25294  }
25295
25296  return noop;
25297}
25298
vendor: 4,132 bytes, lines 25299-25419
25299function getMessage(deprecated, correct, isError) {
25300  return (
25301    "options." + deprecated + " has been deprecated in favour of options." + correct + "." +
25302    (isError ? (" You cannot specify both options, please use options." + correct + ".") : '')
25303  );
25304}
25305
25306function deprecateOption(options, deprecatedOption, correct) {
25307  if (deprecatedOption in options) {
25308    if (!(correct in options)) {
25309      warnIfDebug(getMessage(deprecatedOption, correct));
25310      options[correct] = options[deprecatedOption];
25311    } else {
25312      throw new Error(getMessage(deprecatedOption, correct, true));
25313    }
25314  }
25315}
25316
25317function deprecate(options) {
25318  deprecateOption(options, 'beforeInit', 'onconstruct');
25319  deprecateOption(options, 'init', 'onrender');
25320  deprecateOption(options, 'complete', 'oncomplete');
25321  deprecateOption(options, 'eventDefinitions', 'events');
25322
25323  // Using extend with Component instead of options,
25324  // like Human.extend( Spider ) means adaptors as a registry
25325  // gets copied to options. So we have to check if actually an array
25326  if (isArray(options.adaptors)) {
25327    deprecateOption(options, 'adaptors', 'adapt');
25328  }
25329}
25330
25331var config = {
25332  extend: function (Parent, proto, options, Child) { return configure('extend', Parent, proto, options, Child); },
25333  init: function (Parent, ractive, options) { return configure('init', Parent, ractive, options); },
25334  reset: function (ractive) { return order.filter(function (c) { return c.reset && c.reset(ractive); }).map(function (c) { return c.name; }); }
25335};
25336
25337var custom = {
25338  adapt: adaptConfigurator,
25339  computed: config,
25340  css: cssConfigurator,
25341  data: dataConfigurator,
25342  helpers: config,
25343  template: templateConfigurator
25344};
25345
25346var defaultKeys = keys(defaults);
25347
25348var isStandardKey = makeObj(defaultKeys.filter(function (key) { return !custom[key]; }));
25349
25350// blacklisted keys that we don't double extend
25351var isBlacklisted = makeObj(
25352  defaultKeys.concat(registries.map(function (r) { return r.name; }), ['on', 'observe', 'attributes', 'cssData', 'use'])
25353);
25354
25355var order = [].concat(
25356  defaultKeys.filter(function (key) { return !registries[key] && !custom[key]; }),
25357  registries,
25358  //custom.data,
25359  custom.template,
25360  custom.css
25361);
25362
25363function configure(method, Parent, target, options, Child) {
25364  deprecate(options);
25365
25366  for (var key in options) {
25367    if (hasOwn(isStandardKey, key)) {
25368      var value = options[key];
25369
25370      // warn the developer if they passed a function and ignore its value
25371
25372      // NOTE: we allow some functions on "el" because we duck type element lists
25373      // and some libraries or ef'ed-up virtual browsers (phantomJS) return a
25374      // function object as the result of querySelector methods
25375      if (key !== 'el' && isFunction(value)) {
25376        warnIfDebug(
25377          (key + " is a Ractive option that does not expect a function and will be ignored"),
25378          method === 'init' ? target : null
25379        );
25380      } else {
25381        target[key] = value;
25382      }
25383    }
25384  }
25385
25386  // disallow combination of `append` and `enhance`
25387  if (target.append && target.enhance) {
25388    throw new Error('Cannot use append and enhance at the same time');
25389  }
25390
25391  registries.forEach(function (registry) {
25392    registry[method](Parent, target, options, Child);
25393  });
25394
25395  adaptConfigurator[method](Parent, target, options, Child);
25396  templateConfigurator[method](Parent, target, options, Child);
25397  cssConfigurator[method](Parent, target, options, Child);
25398
25399  extendOtherMethods(Parent.prototype, target, options);
25400}
25401
25402var _super = /\b_super\b/;
25403function extendOtherMethods(parent, target, options) {
25404  for (var key in options) {
25405    if (!isBlacklisted[key] && hasOwn(options, key)) {
25406      var member = options[key];
25407
25408      // if this is a method that overwrites a method, wrap it:
25409      if (isFunction(member)) {
25410        if (
25411          (key in proto$9 ||
25412            (key.slice(0, 2) === 'on' && key.slice(2) in hooks && key in target)) &&
25413          !_super.test(member.toString())
25414        ) {
25415          warnIfDebug(
25416            ("Overriding Ractive prototype function '" + key + "' without calling the '" + _super + "' method can be very dangerous.")
25417          );
25418        }
25419        member = wrap
vendor: 10,885 bytes, lines 25419-25825
25419(parent, key, member);
25420      }
25421
25422      target[key] = member;
25423    }
25424  }
25425}
25426
25427function makeObj(array) {
25428  var obj = {};
25429  array.forEach(function (x) { return (obj[x] = true); });
25430  return obj;
25431}
25432
25433var Item = function Item(options) {
25434  this.up = options.up;
25435  this.ractive = options.up.ractive;
25436
25437  this.template = options.template;
25438  this.index = options.index;
25439  this.type = options.template.t;
25440
25441  this.dirty = false;
25442};
25443var Item__proto__ = Item.prototype;
25444
25445Item__proto__.bubble = function bubble () {
25446  if (!this.dirty) {
25447    this.dirty = true;
25448    this.up.bubble();
25449  }
25450};
25451
25452Item__proto__.destroyed = function destroyed () {
25453  if (this.fragment) { this.fragment.destroyed(); }
25454};
25455
25456Item__proto__.find = function find () {
25457  return null;
25458};
25459
25460Item__proto__.findComponent = function findComponent () {
25461  return null;
25462};
25463
25464Item__proto__.findNextNode = function findNextNode () {
25465  return this.up.findNextNode(this);
25466};
25467
25468Item__proto__.rebound = function rebound (update) {
25469  if (this.fragment) { this.fragment.rebound(update); }
25470};
25471
25472Item__proto__.shuffled = function shuffled () {
25473  if (this.fragment) { this.fragment.shuffled(); }
25474};
25475
25476Item__proto__.valueOf = function valueOf () {
25477  return this.toString();
25478};
25479
25480Item.prototype.findAll = noop;
25481Item.prototype.findAllComponents = noop;
25482
25483var ContainerItem = (function (Item) {
25484  function ContainerItem(options) {
25485    Item.call(this, options);
25486  }
25487
25488  if ( Item ) ContainerItem.__proto__ = Item;
25489  var ContainerItem__proto__ = ContainerItem.prototype = Object.create( Item && Item.prototype );
25490  ContainerItem__proto__.constructor = ContainerItem;
25491
25492  ContainerItem__proto__.detach = function detach () {
25493    return this.fragment ? this.fragment.detach() : createDocumentFragment();
25494  };
25495
25496  ContainerItem__proto__.find = function find (selector) {
25497    if (this.fragment) {
25498      return this.fragment.find(selector);
25499    }
25500  };
25501
25502  ContainerItem__proto__.findAll = function findAll (selector, options) {
25503    if (this.fragment) {
25504      this.fragment.findAll(selector, options);
25505    }
25506  };
25507
25508  ContainerItem__proto__.findComponent = function findComponent (name) {
25509    if (this.fragment) {
25510      return this.fragment.findComponent(name);
25511    }
25512  };
25513
25514  ContainerItem__proto__.findAllComponents = function findAllComponents (name, options) {
25515    if (this.fragment) {
25516      this.fragment.findAllComponents(name, options);
25517    }
25518  };
25519
25520  ContainerItem__proto__.firstNode = function firstNode (skipParent) {
25521    return this.fragment && this.fragment.firstNode(skipParent);
25522  };
25523
25524  ContainerItem__proto__.toString = function toString (escape) {
25525    return this.fragment ? this.fragment.toString(escape) : '';
25526  };
25527
25528  return ContainerItem;
25529}(Item));
25530
25531var space = /\s+/;
25532
25533function readStyle(css) {
25534  if (!isString(css)) { return {}; }
25535
25536  return cleanCss(css, function (css, reconstruct) {
25537    return css
25538      .split(';')
25539      .filter(function (rule) { return !!rule.trim(); })
25540      .map(reconstruct)
25541      .reduce(function (rules, rule) {
25542        var i = rule.indexOf(':');
25543        var name = rule.substr(0, i).trim();
25544        rules[name] = rule.substr(i + 1).trim();
25545        return rules;
25546      }, {});
25547  });
25548}
25549
25550function readClass(str) {
25551  var list = str.split(space);
25552
25553  // remove any empty entries
25554  var i = list.length;
25555  while (i--) {
25556    if (!list[i]) { list.splice(i, 1); }
25557  }
25558
25559  return list;
25560}
25561
25562var textTypes = [
25563  undefined,
25564  'text',
25565  'search',
25566  'url',
25567  'email',
25568  'hidden',
25569  'password',
25570  'search',
25571  'reset',
25572  'submit'
25573];
25574
25575function getUpdateDelegate(attribute) {
25576  var element = attribute.element;
25577  var name = attribute.name;
25578
25579  if (name === 'value') {
25580    if (attribute.interpolator) { attribute.interpolator.bound = true; }
25581
25582    // special case - selects
25583    if (element.name === 'select' && name === 'value') {
25584      return element.getAttribute('multiple') ? updateMultipleSelectValue : updateSelectValue;
25585    }
25586
25587    if (element.name === 'textarea') { return updateStringValue; }
25588
25589    // special case - contenteditable
25590    if (element.getAttribute('contenteditable') != null) { return updateContentEditableValue; }
25591
25592    // special case - <input>
25593    if (element.name === 'input') {
25594      var type = element.getAttribute('type');
25595
25596      // type='file' value='{{fileList}}'>
25597      if (type === 'file') { return noop; } // read-only
25598
25599      // type='radio' name='{{twoway}}'
25600      if (type === 'radio' && element.binding && element.binding.attribute.name === 'name')
25601        { return updateRadioValue; }
25602
25603      if (~textTypes.indexOf(type)) { return updateStringValue; }
25604    }
25605
25606    return updateValue;
25607  }
25608
25609  var node = element.node;
25610
25611  // special case - <input type='radio' name='{{twoway}}' value='foo'>
25612  if (attribute.isTwoway && name === 'name') {
25613    if (node.type === 'radio') { return updateRadioName; }
25614    if (node.type === 'checkbox') { return updateCheckboxName; }
25615  }
25616
25617  if (name === 'style') { return updateStyleAttribute; }
25618
25619  if (name.indexOf('style-') === 0) { return updateInlineStyle; }
25620
25621  // special case - class names. IE fucks things up, again
25622  if (name === 'class' && (!node.namespaceURI || node.namespaceURI === html))
25623    { return updateClassName; }
25624
25625  if (name.indexOf('class-') === 0) { return updateInlineClass; }
25626
25627  if (attribute.isBoolean) {
25628    var type$1 = element.getAttribute('type');
25629    if (attribute.interpolator && name === 'checked' && (type$1 === 'checkbox' || type$1 === 'radio'))
25630      { attribute.interpolator.bound = true; }
25631    return updateBoolean;
25632  }
25633
25634  if (attribute.namespace && attribute.namespace !== attribute.node.namespaceURI)
25635    { return updateNamespacedAttribute; }
25636
25637  return updateAttribute;
25638}
25639
25640function updateMultipleSelectValue(reset) {
25641  var value = this.getValue();
25642
25643  if (!isArray(value)) { value = [value]; }
25644
25645  var options = this.node.options;
25646  var i = options.length;
25647
25648  if (reset) {
25649    while (i--) { options[i].selected = false; }
25650  } else {
25651    while (i--) {
25652      var option = options[i];
25653      var optionValue = option._ractive ? option._ractive.value : option.value; // options inserted via a triple don't have _ractive
25654
25655      option.selected = arrayContains(value, optionValue);
25656    }
25657  }
25658}
25659
25660function updateSelectValue(reset) {
25661  var value = this.getValue();
25662
25663  if (!this.locked) {
25664    // TODO is locked still a thing?
25665    this.node._ractive.value = value;
25666
25667    var options = this.node.options;
25668    var i = options.length;
25669    var wasSelected = false;
25670
25671    if (reset) {
25672      while (i--) { options[i].selected = false; }
25673    } else {
25674      while (i--) {
25675        var option = options[i];
25676        var optionValue = option._ractive ? option._ractive.value : option.value; // options inserted via a triple don't have _ractive
25677        if (option.disabled && option.selected) { wasSelected = true; }
25678
25679        if (optionValue == value) {
25680          // double equals as we may be comparing numbers with strings
25681          option.selected = true;
25682          return;
25683        }
25684      }
25685    }
25686
25687    if (!wasSelected) { this.node.selectedIndex = -1; }
25688  }
25689}
25690
25691function updateContentEditableValue(reset) {
25692  var value = this.getValue();
25693
25694  if (!this.locked) {
25695    if (reset) { this.node.innerHTML = ''; }
25696    else { this.node.innerHTML = isUndefined(value) ? '' : value; }
25697  }
25698}
25699
25700function updateRadioValue(reset) {
25701  var node = this.node;
25702  var wasChecked = node.checked;
25703
25704  var value = this.getValue();
25705
25706  if (reset) { return (node.checked = false); }
25707
25708  //node.value = this.element.getAttribute( 'value' );
25709  node.value = this.node._ractive.value = value;
25710  node.checked = this.element.compare(value, this.element.getAttribute('name'));
25711
25712  // This is a special case - if the input was checked, and the value
25713  // changed so that it's no longer checked, the twoway binding is
25714  // most likely out of date. To fix it we have to jump through some
25715  // hoops... this is a little kludgy but it works
25716  if (wasChecked && !node.checked && this.element.binding && this.element.binding.rendered) {
25717    this.element.binding.group.model.set(this.element.binding.group.getValue());
25718  }
25719}
25720
25721function updateValue(reset) {
25722  if (!this.locked) {
25723    if (reset) {
25724      this.node.removeAttribute('value');
25725      this.node.value = this.node._ractive.value = null;
25726    } else {
25727      var value = this.getValue();
25728
25729      this.node.value = this.node._ractive.value = value;
25730      this.node.setAttribute('value', safeToStringValue(value));
25731    }
25732  }
25733}
25734
25735function updateStringValue(reset) {
25736  if (!this.locked) {
25737    if (reset) {
25738      this.node._ractive.value = '';
25739      this.node.removeAttribute('value');
25740    } else {
25741      var value = this.getValue();
25742
25743      this.node._ractive.value = value;
25744
25745      var safeValue = safeToStringValue(value);
25746
25747      // fixes #3281 – Safari moves caret position when setting an input value to the same value
25748      if (this.node.value !== safeValue) {
25749        this.node.value = safeValue;
25750      }
25751
25752      this.node.setAttribute('value', safeValue);
25753    }
25754  }
25755}
25756
25757function updateRadioName(reset) {
25758  if (reset) { this.node.checked = false; }
25759  else { this.node.checked = this.element.compare(this.getValue(), this.element.binding.getValue()); }
25760}
25761
25762function updateCheckboxName(reset) {
25763  var ref = this;
25764  var element = ref.element;
25765  var node = ref.node;
25766  var binding = element.binding;
25767
25768  var value = this.getValue();
25769  var valueAttribute = element.getAttribute('value');
25770
25771  if (!isArray(value)) {
25772    binding.isChecked = node.checked = element.compare(value, valueAttribute);
25773  } else {
25774    var i = value.length;
25775    while (i--) {
25776      if (element.compare(valueAttribute, value[i])) {
25777        binding.isChecked = node.checked = true;
25778        return;
25779      }
25780    }
25781    binding.isChecked = node.checked = false;
25782  }
25783}
25784
25785function updateStyleAttribute(reset) {
25786  var props = reset ? {} : readStyle(this.getValue() || '');
25787  var style = this.node.style;
25788  var keys$$1 = keys(props);
25789  var prev = this.previous || [];
25790
25791  var i = 0;
25792  while (i < keys$$1.length) {
25793    if (keys$$1[i] in style) {
25794      var safe = props[keys$$1[i]].replace('!important', '');
25795      style.setProperty(keys$$1[i], safe, safe.length !== props[keys$$1[i]].length ? 'important' : '');
25796    }
25797    i++;
25798  }
25799
25800  // remove now-missing attrs
25801  i = prev.length;
25802  while (i--) {
25803    if (!~keys$$1.indexOf(prev[i]) && prev[i] in style) { style.setProperty(prev[i], '', ''); }
25804  }
25805
25806  this.previous = keys$$1;
25807}
25808
25809function updateInlineStyle(reset) {
25810  if (!this.style) {
25811    this.style = hyphenateCamel(this.name.substr(6));
25812  }
25813
25814  if (reset && this.node.style.getPropertyValue(this.style) !== this.last) { return; }
25815
25816  var value = reset ? '' : safeToStringValue(this.getValue());
25817  var safe = value.replace('!important', '');
25818  this.node.style.setProperty(this.style, safe, safe.length !== value.length ? 'important' : '');
25819  this.last = this.node.style.getPropertyValue(this.style);
25820}
25821
25822function updateClassName(reset) {
25823  var value = reset ? [] : readClass(safeToStringValue(this.getValue()));
25824
25825  // watch out for we
vendor: 569 bytes, lines 25825-25848
25825rdo svg elements
25826  var cls = this.node.className;
25827  cls = cls.baseVal !== undefined ? cls.baseVal : cls;
25828
25829  var attr = readClass(cls);
25830  var prev = this.previous || [];
25831
25832  var className = value.concat(attr.filter(function (c) { return !~prev.indexOf(c); })).join(' ');
25833
25834  if (className !== cls) {
25835    if (!isString(this.node.className)) {
25836      this.node.className.baseVal = className;
25837    } else {
25838      this.node.className = className;
25839    }
25840  }
25841
25842  this.previous = value;
25843}
25844
25845function updateInlineClass(reset) {
25846  var name = this.name.substr(6);
25847
25848  // watch out for we
vendor: 29,246 bytes, lines 25848-26928
25848rdo svg elements
25849  var cls = this.node.className;
25850  cls = cls.baseVal !== undefined ? cls.baseVal : cls;
25851
25852  var attr = readClass(cls);
25853  var value = reset ? false : this.getValue();
25854
25855  if (!this.inlineClass) { this.inlineClass = name; }
25856
25857  if (value && !~attr.indexOf(name)) { attr.push(name); }
25858  else if (!value && ~attr.indexOf(name)) { attr.splice(attr.indexOf(name), 1); }
25859
25860  if (!isString(this.node.className)) {
25861    this.node.className.baseVal = attr.join(' ');
25862  } else {
25863    this.node.className = attr.join(' ');
25864  }
25865}
25866
25867function updateBoolean(reset) {
25868  // with two-way binding, only update if the change wasn't initiated by the user
25869  // otherwise the cursor will often be sent to the wrong place
25870  if (!this.locked) {
25871    if (reset) {
25872      if (this.useProperty) { this.node[this.propertyName] = false; }
25873      this.node.removeAttribute(this.propertyName);
25874    } else {
25875      if (this.useProperty) {
25876        this.node[this.propertyName] = this.getValue();
25877      } else {
25878        var val = this.getValue();
25879        if (val) {
25880          this.node.setAttribute(this.propertyName, isString(val) ? val : '');
25881        } else {
25882          this.node.removeAttribute(this.propertyName);
25883        }
25884      }
25885    }
25886  }
25887}
25888
25889function updateAttribute(reset) {
25890  if (reset) {
25891    if (this.node.getAttribute(this.name) === this.value) {
25892      this.node.removeAttribute(this.name);
25893    }
25894  } else {
25895    this.value = safeToStringValue(this.getString());
25896    this.node.setAttribute(this.name, this.value);
25897  }
25898}
25899
25900function updateNamespacedAttribute(reset) {
25901  if (reset) {
25902    if (
25903      this.value ===
25904      this.node.getAttributeNS(this.namespace, this.name.slice(this.name.indexOf(':') + 1))
25905    ) {
25906      this.node.removeAttributeNS(this.namespace, this.name.slice(this.name.indexOf(':') + 1));
25907    }
25908  } else {
25909    this.value = safeToStringValue(this.getString());
25910    this.node.setAttributeNS(
25911      this.namespace,
25912      this.name.slice(this.name.indexOf(':') + 1),
25913      this.value
25914    );
25915  }
25916}
25917
25918var propertyNames = {
25919  'accept-charset': 'acceptCharset',
25920  accesskey: 'accessKey',
25921  bgcolor: 'bgColor',
25922  class: 'className',
25923  codebase: 'codeBase',
25924  colspan: 'colSpan',
25925  contenteditable: 'contentEditable',
25926  datetime: 'dateTime',
25927  dirname: 'dirName',
25928  for: 'htmlFor',
25929  'http-equiv': 'httpEquiv',
25930  ismap: 'isMap',
25931  maxlength: 'maxLength',
25932  novalidate: 'noValidate',
25933  pubdate: 'pubDate',
25934  readonly: 'readOnly',
25935  rowspan: 'rowSpan',
25936  tabindex: 'tabIndex',
25937  usemap: 'useMap'
25938};
25939
25940var div$1 = doc ? createElement('div') : null;
25941
25942var attributes = false;
25943function inAttributes() {
25944  return attributes;
25945}
25946
25947var ConditionalAttribute = (function (Item) {
25948  function ConditionalAttribute(options) {
25949    Item.call(this, options);
25950
25951    this.attributes = [];
25952
25953    this.owner = options.owner;
25954
25955    this.fragment = new Fragment({
25956      ractive: this.ractive,
25957      owner: this,
25958      template: this.template
25959    });
25960
25961    // this fragment can't participate in node-y things
25962    this.fragment.findNextNode = noop;
25963
25964    this.dirty = false;
25965  }
25966
25967  if ( Item ) ConditionalAttribute.__proto__ = Item;
25968  var ConditionalAttribute__proto__ = ConditionalAttribute.prototype = Object.create( Item && Item.prototype );
25969  ConditionalAttribute__proto__.constructor = ConditionalAttribute;
25970
25971  ConditionalAttribute__proto__.bind = function bind () {
25972    this.fragment.bind();
25973  };
25974
25975  ConditionalAttribute__proto__.bubble = function bubble () {
25976    if (!this.dirty) {
25977      this.dirty = true;
25978      this.owner.bubble();
25979    }
25980  };
25981
25982  ConditionalAttribute__proto__.destroyed = function destroyed () {
25983    this.unrender();
25984  };
25985
25986  ConditionalAttribute__proto__.render = function render () {
25987    this.node = this.owner.node;
25988    if (this.node) {
25989      this.isSvg = this.node.namespaceURI === svg$1;
25990    }
25991
25992    attributes = true;
25993    if (!this.rendered) { this.fragment.render(); }
25994
25995    this.rendered = true;
25996    this.dirty = true; // TODO this seems hacky, but necessary for tests to pass in browser AND node.js
25997    this.update();
25998    attributes = false;
25999  };
26000
26001  ConditionalAttribute__proto__.toString = function toString () {
26002    return this.fragment.toString();
26003  };
26004
26005  ConditionalAttribute__proto__.unbind = function unbind (view) {
26006    this.fragment.unbind(view);
26007  };
26008
26009  ConditionalAttribute__proto__.unrender = function unrender () {
26010    this.rendered = false;
26011    this.fragment.unrender();
26012  };
26013
26014  ConditionalAttribute__proto__.update = function update () {
26015    var this$1 = this;
26016
26017    var str;
26018    var attrs;
26019
26020    if (this.dirty) {
26021      this.dirty = false;
26022
26023      var current = attributes;
26024      attributes = true;
26025      this.fragment.update();
26026
26027      if (this.rendered && this.node) {
26028        str = this.fragment.toString();
26029
26030        attrs = parseAttributes(str, this.isSvg);
26031
26032        // any attributes that previously existed but no longer do
26033        // must be removed
26034        this.attributes
26035          .filter(function (a) { return notIn(attrs, a); })
26036          .forEach(function (a) {
26037            this$1.node.removeAttribute(a.name);
26038          });
26039
26040        attrs.forEach(function (a) {
26041          this$1.node.setAttribute(a.name, a.value);
26042        });
26043
26044        this.attributes = attrs;
26045      }
26046
26047      attributes = current || false;
26048    }
26049  };
26050
26051  return ConditionalAttribute;
26052}(Item));
26053
26054var onlyWhitespace = /^\s*$/;
26055function parseAttributes(str, isSvg) {
26056  if (onlyWhitespace.test(str)) { return []; }
26057  var tagName = isSvg ? 'svg' : 'div';
26058  return str
26059    ? (div$1.innerHTML = "<" + tagName + " " + str + "></" + tagName + ">") && toArray(div$1.childNodes[0].attributes)
26060    : [];
26061}
26062
26063function notIn(haystack, needle) {
26064  var i = haystack.length;
26065
26066  while (i--) {
26067    if (haystack[i].name === needle.name) {
26068      return false;
26069    }
26070  }
26071
26072  return true;
26073}
26074
26075function lookupNamespace(node, prefix) {
26076  var qualified = "xmlns:" + prefix;
26077
26078  while (node) {
26079    if (node.hasAttribute && node.hasAttribute(qualified)) { return node.getAttribute(qualified); }
26080    node = node.parentNode;
26081  }
26082
26083  return namespaces[prefix];
26084}
26085
26086var attribute = false;
26087function inAttribute() {
26088  return attribute;
26089}
26090
26091var Attribute = (function (Item) {
26092  function Attribute(options) {
26093    Item.call(this, options);
26094
26095    this.name = options.template.n;
26096    this.namespace = null;
26097
26098    this.owner = options.owner || options.up.owner || options.element || findElement(options.up);
26099    this.element =
26100      options.element || (this.owner.attributeByName ? this.owner : findElement(options.up));
26101    this.up = options.up; // shared
26102    this.ractive = this.up.ractive;
26103
26104    this.rendered = false;
26105    this.updateDelegate = null;
26106    this.fragment = null;
26107
26108    this.element.attributeByName[this.name] = this;
26109
26110    if (!isArray(options.template.f)) {
26111      this.value = options.template.f;
26112      if (this.value === 0) {
26113        this.value = '';
26114      } else if (isUndefined(this.value)) {
26115        this.value = true;
26116      }
26117      return;
26118    } else {
26119      this.fragment = new Fragment({
26120        owner: this,
26121        template: options.template.f
26122      });
26123    }
26124
26125    this.interpolator =
26126      this.fragment &&
26127      this.fragment.items.length === 1 &&
26128      this.fragment.items[0].type === INTERPOLATOR &&
26129      this.fragment.items[0];
26130
26131    if (this.interpolator) { this.interpolator.owner = this; }
26132  }
26133
26134  if ( Item ) Attribute.__proto__ = Item;
26135  var Attribute__proto__ = Attribute.prototype = Object.create( Item && Item.prototype );
26136  Attribute__proto__.constructor = Attribute;
26137
26138  Attribute__proto__.bind = function bind () {
26139    if (this.fragment) {
26140      this.fragment.bind();
26141    }
26142  };
26143
26144  Attribute__proto__.bubble = function bubble () {
26145    if (!this.dirty) {
26146      this.up.bubble();
26147      this.element.bubble();
26148      this.dirty = true;
26149    }
26150  };
26151
26152  Attribute__proto__.firstNode = function firstNode () {};
26153
26154  Attribute__proto__.getString = function getString () {
26155    attribute = true;
26156    var value = this.fragment
26157      ? this.fragment.toString()
26158      : this.value != null
26159      ? '' + this.value
26160      : '';
26161    attribute = false;
26162    return value;
26163  };
26164
26165  // TODO could getValue ever be called for a static attribute,
26166  // or can we assume that this.fragment exists?
26167  Attribute__proto__.getValue = function getValue () {
26168    attribute = true;
26169    var value = this.fragment
26170      ? this.fragment.valueOf()
26171      : booleanAttributes[this.name.toLowerCase()]
26172      ? true
26173      : this.value;
26174    attribute = false;
26175    return value;
26176  };
26177
26178  Attribute__proto__.render = function render () {
26179    var node = this.element.node;
26180    this.node = node;
26181
26182    // should we use direct property access, or setAttribute?
26183    if (!node.namespaceURI || node.namespaceURI === namespaces.html) {
26184      this.propertyName = propertyNames[this.name] || this.name;
26185
26186      if (node[this.propertyName] !== undefined) {
26187        this.useProperty = true;
26188      }
26189
26190      // is attribute a boolean attribute or 'value'? If so we're better off doing e.g.
26191      // node.selected = true rather than node.setAttribute( 'selected', '' )
26192      if (booleanAttributes[this.name.toLowerCase()] || this.isTwoway) {
26193        this.isBoolean = true;
26194      }
26195
26196      if (this.propertyName === 'value') {
26197        node._ractive.value = this.value;
26198      }
26199    }
26200
26201    if (node.namespaceURI) {
26202      var index = this.name.indexOf(':');
26203      if (index !== -1) {
26204        this.namespace = lookupNamespace(node, this.name.slice(0, index));
26205      } else {
26206        this.namespace = node.namespaceURI;
26207      }
26208    }
26209
26210    this.rendered = true;
26211    this.updateDelegate = getUpdateDelegate(this);
26212    this.updateDelegate();
26213  };
26214
26215  Attribute__proto__.toString = function toString () {
26216    if (inAttributes()) { return ''; }
26217    attribute = true;
26218
26219    var value = this.getValue();
26220
26221    // Special case - select and textarea values (should not be stringified)
26222    if (
26223      this.name === 'value' &&
26224      (this.element.getAttribute('contenteditable') !== undefined ||
26225        (this.element.name === 'select' || this.element.name === 'textarea'))
26226    ) {
26227      return;
26228    }
26229
26230    // Special case – bound radio `name` attributes
26231    if (
26232      this.name === 'name' &&
26233      this.element.name === 'input' &&
26234      this.interpolator &&
26235      this.element.getAttribute('type') === 'radio'
26236    ) {
26237      return ("name=\"{{" + (this.interpolator.model.getKeypath()) + "}}\"");
26238    }
26239
26240    // Special case - style and class attributes and directives
26241    if (
26242      this.owner === this.element &&
26243      (this.name === 'style' || this.name === 'class' || this.style || this.inlineClass)
26244    ) {
26245      return;
26246    }
26247
26248    if (
26249      !this.rendered &&
26250      this.owner === this.element &&
26251      (!this.name.indexOf('style-') || !this.name.indexOf('class-'))
26252    ) {
26253      if (!this.name.indexOf('style-')) {
26254        this.style = hyphenateCamel(this.name.substr(6));
26255      } else {
26256        this.inlineClass = this.name.substr(6);
26257      }
26258
26259      return;
26260    }
26261
26262    if (booleanAttributes[this.name.toLowerCase()])
26263      { return value
26264        ? isString(value)
26265          ? ((this.name) + "=\"" + (safeAttributeString(value)) + "\"")
26266          : this.name
26267        : ''; }
26268    if (value == null) { return ''; }
26269
26270    var str = safeAttributeString(this.getString());
26271    attribute = false;
26272
26273    return str ? ((this.name) + "=\"" + str + "\"") : this.name;
26274  };
26275
26276  Attribute__proto__.unbind = function unbind (view) {
26277    if (this.fragment) { this.fragment.unbind(view); }
26278  };
26279
26280  Attribute__proto__.unrender = function unrender () {
26281    this.updateDelegate(true);
26282
26283    this.rendered = false;
26284  };
26285
26286  Attribute__proto__.update = function update () {
26287    if (this.dirty) {
26288      var binding;
26289      this.dirty = false;
26290      if (this.fragment) { this.fragment.update(); }
26291      if (this.rendered) { this.updateDelegate(); }
26292      if (this.isTwoway && !this.locked) {
26293        this.interpolator.twowayBinding.lastVal(true, this.interpolator.model.get());
26294      } else if (this.name === 'value' && (binding = this.element.binding)) {
26295        // special case: name bound element with dynamic value
26296        var attr = binding.attribute;
26297        if (attr && !attr.dirty && attr.rendered) {
26298          this.element.binding.attribute.updateDelegate();
26299        }
26300      }
26301    }
26302  };
26303
26304  return Attribute;
26305}(Item));
26306
26307var BindingFlag = (function (Item) {
26308  function BindingFlag(options) {
26309    Item.call(this, options);
26310
26311    this.owner = options.owner || options.up.owner || findElement(options.up);
26312    this.element = this.owner.attributeByName ? this.owner : findElement(options.up);
26313    this.flag = options.template.v === 'l' ? 'lazy' : 'twoway';
26314    this.bubbler = this.owner === this.element ? this.element : this.up;
26315
26316    if (this.element.type === ELEMENT) {
26317      if (isArray(options.template.f)) {
26318        this.fragment = new Fragment({
26319          owner: this,
26320          template: options.template.f
26321        });
26322      }
26323
26324      this.interpolator =
26325        this.fragment &&
26326        this.fragment.items.length === 1 &&
26327        this.fragment.items[0].type === INTERPOLATOR &&
26328        this.fragment.items[0];
26329    }
26330  }
26331
26332  if ( Item ) BindingFlag.__proto__ = Item;
26333  var BindingFlag__proto__ = BindingFlag.prototype = Object.create( Item && Item.prototype );
26334  BindingFlag__proto__.constructor = BindingFlag;
26335
26336  BindingFlag__proto__.bind = function bind () {
26337    if (this.fragment) { this.fragment.bind(); }
26338    set$1(this, this.getValue(), true);
26339  };
26340
26341  BindingFlag__proto__.bubble = function bubble () {
26342    if (!this.dirty) {
26343      this.bubbler.bubble();
26344      this.dirty = true;
26345    }
26346  };
26347
26348  BindingFlag__proto__.getValue = function getValue () {
26349    if (this.fragment) { return this.fragment.valueOf(); }
26350    else if ('value' in this) { return this.value; }
26351    else if ('f' in this.template) { return this.template.f; }
26352    else { return true; }
26353  };
26354
26355  BindingFlag__proto__.render = function render () {
26356    set$1(this, this.getValue(), true);
26357  };
26358
26359  BindingFlag__proto__.toString = function toString () {
26360    return '';
26361  };
26362
26363  BindingFlag__proto__.unbind = function unbind (view) {
26364    if (this.fragment) { this.fragment.unbind(view); }
26365
26366    delete this.element[this.flag];
26367  };
26368
26369  BindingFlag__proto__.unrender = function unrender () {
26370    if (this.element.rendered) { this.element.recreateTwowayBinding(); }
26371  };
26372
26373  BindingFlag__proto__.update = function update () {
26374    if (this.dirty) {
26375      this.dirty = false;
26376      if (this.fragment) { this.fragment.update(); }
26377      set$1(this, this.getValue(), true);
26378    }
26379  };
26380
26381  return BindingFlag;
26382}(Item));
26383
26384function set$1(flag, value, update) {
26385  if (value === 0) {
26386    flag.value = true;
26387  } else if (value === 'true') {
26388    flag.value = true;
26389  } else if (value === 'false' || value === '0') {
26390    flag.value = false;
26391  } else {
26392    flag.value = value;
26393  }
26394
26395  var current = flag.element[flag.flag];
26396  flag.element[flag.flag] = flag.value;
26397  if (update && !flag.element.attributes.binding && current !== flag.value) {
26398    flag.element.recreateTwowayBinding();
26399  }
26400
26401  return flag.value;
26402}
26403
26404function Comment(options) {
26405  Item.call(this, options);
26406}
26407
26408var proto$1 = create(Item.prototype);
26409
26410assign(proto$1, {
26411  bind: noop,
26412  unbind: noop,
26413  update: noop,
26414
26415  detach: function detach() {
26416    return detachNode(this.node);
26417  },
26418
26419  firstNode: function firstNode() {
26420    return this.node;
26421  },
26422
26423  render: function render(target) {
26424    this.rendered = true;
26425
26426    this.node = doc.createComment(this.template.c);
26427    target.appendChild(this.node);
26428  },
26429
26430  toString: function toString() {
26431    return ("<!-- " + (this.template.c) + " -->");
26432  },
26433
26434  unrender: function unrender(shouldDestroy) {
26435    if (this.rendered && shouldDestroy) { this.detach(); }
26436    this.rendered = false;
26437  }
26438});
26439
26440Comment.prototype = proto$1;
26441
26442// Teardown. This goes through the root fragment and all its children, removing observers
26443// and generally cleaning up after itself
26444
26445function Ractive$teardown() {
26446  var this$1 = this;
26447
26448  if (this.torndown) {
26449    warnIfDebug('ractive.teardown() was called on a Ractive instance that was already torn down');
26450    return Promise.resolve();
26451  }
26452
26453  this.shouldDestroy = true;
26454  return teardown$1(this, function () { return (this$1.fragment.rendered ? this$1.unrender() : Promise.resolve()); });
26455}
26456
26457function teardown$1(instance, getPromise) {
26458  instance.torndown = true;
26459  instance.fragment.unbind();
26460  instance._observers.slice().forEach(cancel);
26461
26462  if (instance.el && instance.el.__ractive_instances__) {
26463    removeFromArray(instance.el.__ractive_instances__, instance);
26464  }
26465
26466  var promise = getPromise();
26467
26468  hooks.teardown.fire(instance);
26469
26470  promise.then(function () {
26471    hooks.destruct.fire(instance);
26472    instance.viewmodel.teardown();
26473  });
26474
26475  return promise;
26476}
26477
26478var RactiveModel = (function (SharedModel) {
26479  function RactiveModel(ractive) {
26480    SharedModel.call(this, ractive, '@this');
26481    this.ractive = ractive;
26482  }
26483
26484  if ( SharedModel ) RactiveModel.__proto__ = SharedModel;
26485  var RactiveModel__proto__ = RactiveModel.prototype = Object.create( SharedModel && SharedModel.prototype );
26486  RactiveModel__proto__.constructor = RactiveModel;
26487
26488  RactiveModel__proto__.joinKey = function joinKey (key) {
26489    var model = SharedModel.prototype.joinKey.call(this, key);
26490
26491    if ((key === 'root' || key === 'parent') && !model.isLink) { return initLink(model, key); }
26492    else if (key === 'data') { return this.ractive.viewmodel; }
26493    else if (key === 'cssData') { return this.ractive.constructor._cssModel; }
26494
26495    return model;
26496  };
26497
26498  return RactiveModel;
26499}(SharedModel));
26500
26501function initLink(model, key) {
26502  model.applyValue = function(value) {
26503    this.parent.value[key] = value;
26504    if (value && value.viewmodel) {
26505      this.link(value.viewmodel.getRactiveModel(), key);
26506      this._link.markedAll();
26507    } else {
26508      this.link(create(Missing), key);
26509      this._link.markedAll();
26510    }
26511  };
26512
26513  if (key === 'root') {
26514    var mark = model.mark;
26515    model.mark = function(force) {
26516      if (this._marking) { return; }
26517      this._marking = true;
26518      mark.apply(this, force);
26519      this._marking = false;
26520    };
26521  }
26522
26523  model.applyValue(model.parent.ractive[key], key);
26524  model._link.set = function (v) { return model.applyValue(v); };
26525  model._link.applyValue = function (v) { return model.applyValue(v); };
26526
26527  return model._link;
26528}
26529
26530var specialModels = {
26531  '@this': function _this(root) {
26532    return root.getRactiveModel();
26533  },
26534  '@global': function _global() {
26535    return GlobalModel;
26536  },
26537  '@shared': function _shared() {
26538    return SharedModel$1;
26539  },
26540  '@style': function _style(root) {
26541    return root.getRactiveModel().joinKey('cssData');
26542  },
26543  '@helpers': function _helpers(root) {
26544    return root.getHelpers();
26545  }
26546};
26547specialModels['@'] = specialModels['@this'];
26548
26549var RootModel = (function (Model) {
26550  function RootModel(options) {
26551    Model.call(this, null, null);
26552
26553    this.isRoot = true;
26554    this.root = this;
26555    this.ractive = options.ractive; // TODO sever this link
26556
26557    this.value = options.data;
26558    this.adaptors = options.adapt;
26559    this.adapt();
26560  }
26561
26562  if ( Model ) RootModel.__proto__ = Model;
26563  var RootModel__proto__ = RootModel.prototype = Object.create( Model && Model.prototype );
26564  RootModel__proto__.constructor = RootModel;
26565
26566  RootModel__proto__.attached = function attached (fragment) {
26567    attachImplicits(this, fragment);
26568  };
26569
26570  RootModel__proto__.createLink = function createLink (keypath, target, targetPath, options) {
26571    var keys = splitKeypath(keypath);
26572
26573    var model = this;
26574    while (keys.length) {
26575      var key = keys.shift();
26576      model = model.childByKey[key] || model.joinKey(key);
26577    }
26578
26579    return model.link(target, targetPath, options);
26580  };
26581
26582  RootModel__proto__.detached = function detached () {
26583    detachImplicits(this);
26584  };
26585
26586  RootModel__proto__.get = function get (shouldCapture, options) {
26587    if (shouldCapture) { capture(this); }
26588
26589    if (!options || options.virtual !== false) {
26590      return this.getVirtual();
26591    } else {
26592      return this.value;
26593    }
26594  };
26595
26596  RootModel__proto__.getHelpers = function getHelpers () {
26597    if (!this.helpers) { this.helpers = new SharedModel(this.ractive.helpers, 'helpers', this.ractive); }
26598    return this.helpers;
26599  };
26600
26601  RootModel__proto__.getKeypath = function getKeypath () {
26602    return '';
26603  };
26604
26605  RootModel__proto__.getRactiveModel = function getRactiveModel () {
26606    return this.ractiveModel || (this.ractiveModel = new RactiveModel(this.ractive));
26607  };
26608
26609  RootModel__proto__.getValueChildren = function getValueChildren () {
26610    var children = Model.prototype.getValueChildren.call(this, this.value);
26611
26612    this.children.forEach(function (child) {
26613      if (child._link) {
26614        var idx = children.indexOf(child);
26615        if (~idx) { children.splice(idx, 1, child._link); }
26616        else { children.push(child._link); }
26617      }
26618    });
26619
26620    return children;
26621  };
26622
26623  RootModel__proto__.has = function has (key) {
26624    if (key[0] === '~' && key[1] === '/') { key = key.slice(2); }
26625    if (specialModels[key] || key === '') { return true; }
26626
26627    if (Model.prototype.has.call(this, key)) {
26628      return true;
26629    } else {
26630      var unescapedKey = unescapeKey(key);
26631
26632      // mappings/links and computations
26633      if (this.childByKey[unescapedKey] && this.childByKey[unescapedKey]._link) { return true; }
26634    }
26635  };
26636
26637  RootModel__proto__.joinKey = function joinKey (key, opts) {
26638    if (key[0] === '~' && key[1] === '/') { key = key.slice(2); }
26639
26640    if (key[0] === '@') {
26641      var fn = specialModels[key];
26642      if (fn) { return fn(this); }
26643    } else {
26644      return Model.prototype.joinKey.call(this, key, opts);
26645    }
26646  };
26647
26648  RootModel__proto__.set = function set (value) {
26649    // TODO wrapping root node is a baaaad idea. We should prevent this
26650    var wrapper = this.wrapper;
26651    if (wrapper) {
26652      var shouldTeardown = !wrapper.reset || wrapper.reset(value) === false;
26653
26654      if (shouldTeardown) {
26655        wrapper.teardown();
26656        this.wrapper = null;
26657        this.value = value;
26658        this.adapt();
26659      }
26660    } else {
26661      this.value = value;
26662      this.adapt();
26663    }
26664
26665    this.deps.forEach(handleChange);
26666    this.children.forEach(mark);
26667  };
26668
26669  RootModel__proto__.retrieve = function retrieve () {
26670    return this.wrapper ? this.wrapper.get() : this.value;
26671  };
26672
26673  RootModel__proto__.teardown = function teardown () {
26674    Model.prototype.teardown.call(this);
26675    this.ractiveModel && this.ractiveModel.teardown();
26676  };
26677
26678  return RootModel;
26679}(Model));
26680RootModel.prototype.update = noop;
26681
26682function attachImplicits(model, fragment) {
26683  if (model._link && model._link.implicit && model._link.isDetached()) {
26684    model.attach(fragment);
26685  }
26686
26687  // look for virtual children to relink and cascade
26688  for (var k in model.childByKey) {
26689    if (model.value) {
26690      if (k in model.value) {
26691        attachImplicits(model.childByKey[k], fragment);
26692      } else if (!model.childByKey[k]._link || model.childByKey[k]._link.isDetached()) {
26693        var mdl = resolveReference(fragment, k);
26694        if (mdl) {
26695          model.childByKey[k].link(mdl, k, { implicit: true });
26696        }
26697      }
26698    }
26699  }
26700}
26701
26702function detachImplicits(model) {
26703  if (model._link && model._link.implicit) {
26704    model.unlink();
26705  }
26706
26707  for (var k in model.childByKey) {
26708    detachImplicits(model.childByKey[k]);
26709  }
26710}
26711
26712function subscribe(instance, options, type) {
26713  var subs = (instance.constructor[("_" + type)] || []).concat(toPairs(options[type] || []));
26714  var single = type === 'on' ? 'once' : (type + "Once");
26715
26716  subs.forEach(function (ref) {
26717    var target = ref[0];
26718    var config = ref[1];
26719
26720    if (isFunction(config)) {
26721      instance[type](target, config);
26722    } else if (isObjectType(config) && isFunction(config.handler)) {
26723      instance[config.once ? single : type](target, config.handler, create(config));
26724    }
26725  });
26726}
26727
26728var registryNames$1 = [
26729  'adaptors',
26730  'components',
26731  'decorators',
26732  'easing',
26733  'events',
26734  'interpolators',
26735  'partials',
26736  'transitions'
26737];
26738
26739var protoRegistries = ['computed', 'helpers'];
26740
26741var uid = 0;
26742
26743function construct(ractive, options) {
26744  if (Ractive.DEBUG) { welcome(); }
26745
26746  initialiseProperties(ractive);
26747  handleAttributes(ractive);
26748
26749  // set up event subscribers
26750  subscribe(ractive, options, 'on');
26751
26752  // if there's not a delegation setting, inherit from parent if it's not default
26753  if (
26754    !hasOwn(options, 'delegate') &&
26755    ractive.parent &&
26756    ractive.parent.delegate !== ractive.delegate
26757  ) {
26758    ractive.delegate = false;
26759  }
26760
26761  // plugins that need to run at construct
26762  if (isArray(options.use)) {
26763    ractive.use.apply(ractive, options.use.filter(function (p) { return p.construct; }));
26764  }
26765
26766  hooks.construct.fire(ractive, options);
26767  if (options.onconstruct) { options.onconstruct.call(ractive, getRactiveContext(ractive), options); }
26768
26769  // Add registries
26770  var i = registryNames$1.length;
26771  while (i--) {
26772    var name = registryNames$1[i];
26773    ractive[name] = assign(create(ractive.constructor[name] || null), options[name]);
26774  }
26775
26776  i = protoRegistries.length;
26777  while (i--) {
26778    var name$1 = protoRegistries[i];
26779    ractive[name$1] = assign(create(ractive.constructor.prototype[name$1]), options[name$1]);
26780  }
26781
26782  if (ractive._attributePartial) {
26783    ractive.partials['extra-attributes'] = ractive._attributePartial;
26784    delete ractive._attributePartial;
26785  }
26786
26787  // Create a viewmodel
26788  var viewmodel = new RootModel({
26789    adapt: getAdaptors(ractive, ractive.adapt, options),
26790    data: dataConfigurator.init(ractive.constructor, ractive, options),
26791    ractive: ractive
26792  });
26793
26794  // once resolved, share the adaptors array between the root model and instance
26795  ractive.adapt = viewmodel.adaptors;
26796
26797  ractive.viewmodel = viewmodel;
26798
26799  for (var k in ractive.computed) {
26800    compute.call(ractive, k, ractive.computed[k]);
26801  }
26802}
26803
26804function getAdaptors(ractive, protoAdapt, options) {
26805  protoAdapt = protoAdapt.map(lookup);
26806  var adapt = ensureArray(options.adapt).map(lookup);
26807
26808  var srcs = [protoAdapt, adapt];
26809  if (ractive.parent && !ractive.isolated) {
26810    srcs.push(ractive.parent.viewmodel.adaptors);
26811  }
26812
26813  return combine.apply(null, srcs);
26814
26815  function lookup(adaptor) {
26816    if (isString(adaptor)) {
26817      adaptor = findInViewHierarchy('adaptors', ractive, adaptor);
26818
26819      if (!adaptor) {
26820        fatal(missingPlugin(adaptor, 'adaptor'));
26821      }
26822    }
26823
26824    return adaptor;
26825  }
26826}
26827
26828function initialiseProperties(ractive) {
26829  // Generate a unique identifier, for places where you'd use a weak map if it
26830  // existed
26831  ractive._guid = 'r-' + uid++;
26832
26833  // events
26834  ractive._subs = create(null);
26835  ractive._nsSubs = 0;
26836
26837  // storage for item configuration from instantiation to reset,
26838  // like dynamic functions or original values
26839  ractive._config = {};
26840
26841  // events
26842  ractive.event = null;
26843  ractive._eventQueue = [];
26844
26845  // observers
26846  ractive._observers = [];
26847
26848  // external children
26849  ractive._children = [];
26850  ractive._children.byName = {};
26851  ractive.children = ractive._children;
26852
26853  if (!ractive.component) {
26854    ractive.root = ractive;
26855    ractive.parent = ractive.container = null; // TODO container still applicable?
26856  }
26857}
26858
26859function handleAttributes(ractive) {
26860  var component = ractive.component;
26861  var attributes = ractive.constructor.attributes;
26862
26863  if (attributes && component) {
26864    var tpl = component.template;
26865    var attrs = tpl.m ? tpl.m.slice() : [];
26866
26867    // grab all of the passed attribute names
26868    var props = attrs.filter(function (a) { return a.t === ATTRIBUTE; }).map(function (a) { return a.n; });
26869
26870    // warn about missing requireds
26871    attributes.required.forEach(function (p) {
26872      if (!~props.indexOf(p)) {
26873        warnIfDebug(("Component '" + (component.name) + "' requires attribute '" + p + "' to be provided"));
26874      }
26875    });
26876
26877    // set up a partial containing non-property attributes
26878    var all = attributes.optional.concat(attributes.required);
26879    var partial = [];
26880    var i = attrs.length;
26881    while (i--) {
26882      var a = attrs[i];
26883      if (a.t === ATTRIBUTE && !~all.indexOf(a.n)) {
26884        if (attributes.mapAll) {
26885          // map the attribute if requested and make the extra attribute in the partial refer to the mapping
26886          partial.unshift({
26887            t: ATTRIBUTE,
26888            n: a.n,
26889            f: [{ t: INTERPOLATOR, r: ("~/" + (a.n)) }]
26890          });
26891        } else {
26892          // transfer the attribute to the extra attributes partal
26893          partial.unshift(attrs.splice(i, 1)[0]);
26894        }
26895      } else if (
26896        !attributes.mapAll &&
26897        (a.t === DECORATOR || a.t === TRANSITION || a.t === BINDING_FLAG)
26898      ) {
26899        partial.unshift(attrs.splice(i, 1)[0]);
26900      }
26901    }
26902
26903    if (partial.length) { component.template = { t: tpl.t, e: tpl.e, f: tpl.f, m: attrs, p: tpl.p }; }
26904    ractive._attributePartial = partial;
26905  }
26906}
26907
26908var Component = (function (Item) {
26909  function Component(options, ComponentConstructor) {
26910    var this$1 = this;
26911
26912    Item.call(this, options);
26913    var template = options.template;
26914    this.isAnchor = template.t === ANCHOR;
26915    this.type = this.isAnchor ? ANCHOR : COMPONENT; // override ELEMENT from super
26916    var attrs = template.m;
26917
26918    var partials = template.p || {};
26919    if (!('content' in partials)) { partials.content = template.f || []; }
26920    this._partials = partials; // TEMP
26921
26922    if (this.isAnchor) {
26923      this.name = template.n;
26924
26925      this.addChild = addChild;
26926      this.removeChild = removeChild;
26927    } else {
26928      var instance = 
vendor: 916 bytes, lines 26928-26958
26928create(ComponentConstructor.prototype);
26929
26930      this.instance = instance;
26931      this.name = template.e;
26932
26933      if (instance.el || instance.target) {
26934        warnIfDebug(
26935          ("The <" + (this.name) + "> component has a default '" + (instance.el ? 'el' : 'target') + "' property; it has been disregarded")
26936        );
26937        instance.el = instance.target = null;
26938      }
26939
26940      // find container
26941      var fragment = options.up;
26942      var container;
26943      while (fragment) {
26944        if (fragment.owner.type === YIELDER) {
26945          container = fragment.owner.container;
26946          break;
26947        }
26948
26949        fragment = fragment.parent;
26950      }
26951
26952      // add component-instance-specific properties
26953      instance.parent = this.up.ractive;
26954      instance.container = container || null;
26955      instance.root = instance.parent.root;
26956      instance.component = this;
26957
26958      construct(this.instance, { partials: partials }
vendor: 8,366 bytes, lines 26958-27278
26958);
26959
26960      // these can be modified during construction
26961      template = this.template;
26962      attrs = template.m;
26963
26964      // allow components that are so inclined to add programmatic mappings
26965      if (isArray(this.mappings)) {
26966        attrs = (attrs || []).concat(this.mappings);
26967      } else if (isString(this.mappings)) {
26968        attrs = (attrs || []).concat(parser.parse(this.mappings, { attributes: true }).t);
26969      }
26970
26971      // for hackability, this could be an open option
26972      // for any ractive instance, but for now, just
26973      // for components and just for ractive...
26974      instance._inlinePartials = partials;
26975    }
26976
26977    this.attributeByName = {};
26978    this.attributes = [];
26979
26980    if (attrs) {
26981      var leftovers = [];
26982      attrs.forEach(function (template) {
26983        switch (template.t) {
26984          case ATTRIBUTE:
26985          case EVENT:
26986            this$1.attributes.push(
26987              createItem({
26988                owner: this$1,
26989                up: this$1.up,
26990                template: template
26991              })
26992            );
26993            break;
26994
26995          case TRANSITION:
26996          case BINDING_FLAG:
26997          case DECORATOR:
26998            break;
26999
27000          default:
27001            leftovers.push(template);
27002            break;
27003        }
27004      });
27005
27006      if (leftovers.length) {
27007        this.attributes.push(
27008          new ConditionalAttribute({
27009            owner: this,
27010            up: this.up,
27011            template: leftovers
27012          })
27013        );
27014      }
27015    }
27016
27017    this.eventHandlers = [];
27018  }
27019
27020  if ( Item ) Component.__proto__ = Item;
27021  var Component__proto__ = Component.prototype = Object.create( Item && Item.prototype );
27022  Component__proto__.constructor = Component;
27023
27024  Component__proto__.bind = function bind () {
27025    if (!this.isAnchor) {
27026      this.attributes.forEach(bind$1);
27027      this.eventHandlers.forEach(bind$1);
27028
27029      initialise(
27030        this.instance,
27031        {
27032          partials: this._partials
27033        },
27034        {
27035          cssIds: this.up.cssIds
27036        }
27037      );
27038
27039      if (this.instance.target || this.instance.el) { this.extern = true; }
27040
27041      this.bound = true;
27042    }
27043  };
27044
27045  Component__proto__.bubble = function bubble () {
27046    if (!this.dirty) {
27047      this.dirty = true;
27048      this.up.bubble();
27049    }
27050  };
27051
27052  Component__proto__.destroyed = function destroyed () {
27053    if (!this.isAnchor && this.instance.fragment) { this.instance.fragment.destroyed(); }
27054  };
27055
27056  Component__proto__.detach = function detach () {
27057    if (this.isAnchor) {
27058      if (this.instance) { return this.instance.fragment.detach(); }
27059      return createDocumentFragment();
27060    }
27061
27062    return this.instance.fragment.detach();
27063  };
27064
27065  Component__proto__.find = function find (selector, options) {
27066    if (this.instance) { return this.instance.fragment.find(selector, options); }
27067  };
27068
27069  Component__proto__.findAll = function findAll (selector, options) {
27070    if (this.instance) { this.instance.fragment.findAll(selector, options); }
27071  };
27072
27073  Component__proto__.findComponent = function findComponent (name, options) {
27074    if (!name || this.name === name) { return this.instance; }
27075
27076    if (this.instance.fragment) {
27077      return this.instance.fragment.findComponent(name, options);
27078    }
27079  };
27080
27081  Component__proto__.findAllComponents = function findAllComponents (name, options) {
27082    var result = options.result;
27083
27084    if (this.instance && (!name || this.name === name)) {
27085      result.push(this.instance);
27086    }
27087
27088    if (this.instance) { this.instance.findAllComponents(name, options); }
27089  };
27090
27091  Component__proto__.firstNode = function firstNode (skipParent) {
27092    if (this.instance) { return this.instance.fragment.firstNode(skipParent); }
27093  };
27094
27095  Component__proto__.getContext = function getContext () {
27096    var assigns = [], len = arguments.length;
27097    while ( len-- ) assigns[ len ] = arguments[ len ];
27098
27099    assigns.unshift(this.instance);
27100    return getRactiveContext.apply(null, assigns);
27101  };
27102
27103  Component__proto__.rebound = function rebound (update$$1) {
27104    this.attributes.forEach(function (x) { return x.rebound(update$$1); });
27105  };
27106
27107  Component__proto__.render = function render$2 (target, occupants) {
27108    if (this.isAnchor) {
27109      this.rendered = true;
27110      this.target = target;
27111
27112      if (!checking.length) {
27113        checking.push(this.ractive);
27114        if (occupants) {
27115          this.occupants = occupants;
27116          checkAnchors();
27117          this.occupants = null;
27118        } else {
27119          runloop.scheduleTask(checkAnchors, true);
27120        }
27121      }
27122    } else {
27123      this.attributes.forEach(render);
27124      this.eventHandlers.forEach(render);
27125
27126      if (this.extern) {
27127        this.instance.delegate = false;
27128        this.instance.render();
27129      } else {
27130        render$1(this.instance, target, null, occupants);
27131      }
27132
27133      this.rendered = true;
27134    }
27135  };
27136
27137  Component__proto__.shuffled = function shuffled () {
27138    Item.prototype.shuffled.call(this);
27139    this.instance &&
27140      !this.instance.isolated &&
27141      this.instance.fragment &&
27142      this.instance.fragment.shuffled();
27143  };
27144
27145  Component__proto__.toString = function toString () {
27146    if (this.instance) { return this.instance.toHTML(); }
27147  };
27148
27149  Component__proto__.unbind = function unbind$1 (view) {
27150    if (!this.isAnchor) {
27151      this.bound = false;
27152
27153      this.attributes.forEach(unbind);
27154
27155      if (view) { this.instance.fragment.unbind(); }
27156      else { teardown$1(this.instance, function () { return runloop.promise(); }); }
27157    }
27158  };
27159
27160  Component__proto__.unrender = function unrender$1 (shouldDestroy) {
27161    this.shouldDestroy = shouldDestroy;
27162
27163    if (this.isAnchor) {
27164      if (this.item) { unrenderItem(this, this.item); }
27165      this.target = null;
27166      if (!checking.length) {
27167        checking.push(this.ractive);
27168        runloop.scheduleTask(checkAnchors, true);
27169      }
27170    } else {
27171      this.instance.unrender();
27172      this.instance.el = this.instance.target = null;
27173      this.attributes.forEach(unrender);
27174      this.eventHandlers.forEach(unrender);
27175    }
27176
27177    this.rendered = false;
27178  };
27179
27180  Component__proto__.update = function update$2 () {
27181    this.dirty = false;
27182    if (this.instance) {
27183      this.instance.fragment.update();
27184      this.attributes.forEach(update);
27185      this.eventHandlers.forEach(update);
27186    }
27187  };
27188
27189  return Component;
27190}(Item));
27191
27192function addChild(meta) {
27193  if (this.item) { this.removeChild(this.item); }
27194
27195  var child = meta.instance;
27196  meta.anchor = this;
27197
27198  meta.up = this.up;
27199  meta.name = meta.nameOption || this.name;
27200  this.name = meta.name;
27201
27202  if (!child.isolated) { child.viewmodel.attached(this.up); }
27203
27204  // render as necessary
27205  if (this.rendered) {
27206    renderItem(this, meta);
27207  }
27208}
27209
27210function removeChild(meta) {
27211  // unrender as necessary
27212  if (this.item === meta) {
27213    unrenderItem(this, meta);
27214    this.name = this.template.n;
27215  }
27216}
27217
27218function renderItem(anchor, meta) {
27219  if (!anchor.rendered) { return; }
27220
27221  meta.shouldDestroy = false;
27222  meta.up = anchor.up;
27223
27224  anchor.item = meta;
27225  anchor.instance = meta.instance;
27226  var nextNode = anchor.up.findNextNode(anchor);
27227
27228  if (meta.instance.fragment.rendered) {
27229    meta.instance.unrender();
27230  }
27231
27232  meta.partials = meta.instance.partials;
27233  meta.instance.partials = assign(create(meta.partials), meta.partials, anchor._partials);
27234
27235  meta.instance.fragment.unbind(true);
27236  meta.instance.fragment.componentParent = anchor.up;
27237  meta.instance.fragment.bind(meta.instance.viewmodel);
27238
27239  anchor.attributes.forEach(bind$1);
27240  anchor.eventHandlers.forEach(bind$1);
27241  anchor.attributes.forEach(render);
27242  anchor.eventHandlers.forEach(render);
27243
27244  var target = anchor.up.findParentNode();
27245  render$1(meta.instance, target, target.contains(nextNode) ? nextNode : null, anchor.occupants);
27246
27247  if (meta.lastBound !== anchor) {
27248    meta.lastBound = anchor;
27249  }
27250}
27251
27252function unrenderItem(anchor, meta) {
27253  if (!anchor.rendered) { return; }
27254
27255  meta.shouldDestroy = true;
27256  meta.instance.unrender();
27257
27258  anchor.eventHandlers.forEach(unrender);
27259  anchor.attributes.forEach(unrender);
27260  anchor.eventHandlers.forEach(unbind);
27261  anchor.attributes.forEach(unbind);
27262
27263  meta.instance.el = meta.instance.anchor = null;
27264  meta.instance.fragment.componentParent = null;
27265  meta.up = null;
27266  meta.anchor = null;
27267  anchor.item = null;
27268  anchor.instance = null;
27269}
27270
27271var checking = [];
27272function checkAnchors() {
27273  var list = checking;
27274  checking = [];
27275
27276  list.forEach(updateAnchors);
27277}
27278
27279function setupArgsFn(item, template, fragment, opts) {
27280  if ( opts === void 0 ) opts = {};
27281
27282  if (template && template.f && template.f.s) {
27283    item.fn = getFunction(template.f.s, template.f.r.length);
27284    if (opts.register === true) {
27285      item.models = resolveArgs(item, template, fragment, opts);
27286    }
27287  }
27288}
27289
27290function resolveArgs(item, template, fragment, opts) {
27291  if ( opts === void 0 ) opts = {};
27292
27293  return template.f.r.map(function (ref, i) {
27294    var model;
27295
27296    if (opts.specialRef && (model = opts.specialRef(ref, i))) { return model; }
27297
27298    model = resolveReference(fragment, ref);
27299    if (opts.register === true) {
27300      model.register(item);
27301    }
27302
27303    return model;
27304  });
27305}
27306
27307function teardownArgsFn(item, template) {
27308  if (template && template.f && template.f.s) {
27309    if (item.models)
27310      { item.models.forEach(function (m) {
27311        if (m && m.unregister) { m.unregister(item); }
27312      }); }
27313    item.models = null;
27314  }
27315}
27316
27317var missingDecorator = {
27318  update: noop,
27319  teardown: noop
27320};
27321
27322var Decorator = function Decorator(options) {
27323  this.owner = options.owner || options.up.owner || findElement(options.up);
27324  this.element = this.owner.attributeByName ? this.owner : findElement(options.up);
27325  this.up = options.up || this.owner.up;
27326  this.ractive = this.owner.ractive;
27327  var template = (this.template = options.template);
27328
27329  this.name = template.n;
27330
27331  this.node = null;
27332  this.handle = null;
27333
27334  this.element.decorators.push(this);
27335};
27336var Decorator__proto__ = Decorator.prototype;
27337
27338Decorator__proto__.bind = function bind () {
27339  // if the owner is the elment, make sure the context includes the element
27340  var frag = this.element === this.owner ? new Fragment({ owner: this.owner }) : this.up;
27341  setupArgsFn(this, this.template, frag, { register: true });
27342};
27343
27344Decorator__proto__.bubble = function bubble () {
27345  if (!this.dirty) {
27346    this.dirty = true;
27347    // decorators may be owned directly by an element or by a fragment if conditional
27348    this.owner.bubble();
27349    this.up.bubble();
27350  }
27351};
27352
27353Decorator__proto__.destroyed = function destroyed () {
27354  if (this.handle) {
27355    this.handle.teardown();
27356    this.handle = null;
27357  }
27358  this.shouldDestroy = true;
27359};
27360
27361Decorator__proto__.handleChange = function handleChange () {
27362  this.bubble();
27363};
27364
27365Decorator__proto__.rebind = function rebind (next, previous, safe) {
27366  var idx = this.models.indexOf(previous);
27367  if (!~idx) { return; }
27368
27369  next = rebindMatch(this.template.f.r[idx], next, previous);
27370  if (next === previous) { return; }
27371
27372  previous.unregister(this);
27373  this.models.splice(idx, 1, next);
27374  if (next) { next.addShuffleRegister(this, 'mark'); }
27375
27376  if (!safe) { this.bubble(); }
27377};
27378
27379Decorator__proto__.rebound = function rebound (update) {
27380  teardownArgsFn(this, this.template);
27381  setupArgsFn(this, this.template, this.up, { register: true });
27382  if (update) { this.bubble(); }
27383};
27384
27385Decorator__proto__.render = function render () {
27386    var this$1 = this;
27387
27388  this.shouldDestroy = false;
vendor: 10,625 bytes, lines 27389-27750
27389  if (this.handle) { this.unrender(); }
27390  runloop.scheduleTask(function () {
27391    // bail if the host element has managed to become unrendered
27392    if (!this$1.element.rendered) { return; }
27393
27394    var fn = findInViewHierarchy('decorators', this$1.ractive, this$1.name);
27395
27396    if (!fn) {
27397      warnOnce(missingPlugin(this$1.name, 'decorator'));
27398      this$1.handle = missingDecorator;
27399      return;
27400    }
27401
27402    this$1.node = this$1.element.node;
27403
27404    var args;
27405    if (this$1.fn) {
27406      args = this$1.models.map(function (model) {
27407        if (!model) { return undefined; }
27408
27409        return model.get();
27410      });
27411      args = this$1.fn.apply(this$1.ractive, args);
27412    }
27413
27414    this$1.handle = fn.apply(this$1.ractive, [this$1.node].concat(args));
27415
27416    if (!this$1.handle || !this$1.handle.teardown) {
27417      throw new Error(
27418        ("The '" + (this$1.name) + "' decorator must return an object with a teardown method")
27419      );
27420    }
27421
27422    // watch out for decorators that cause their host element to be unrendered
27423    if (this$1.shouldDestroy) { this$1.destroyed(); }
27424  }, true);
27425};
27426
27427Decorator__proto__.toString = function toString () {
27428  return '';
27429};
27430
27431Decorator__proto__.unbind = function unbind () {
27432  teardownArgsFn(this, this.template);
27433};
27434
27435Decorator__proto__.unrender = function unrender (shouldDestroy) {
27436  if ((!shouldDestroy || this.element.rendered) && this.handle) {
27437    this.handle.teardown();
27438    this.handle = null;
27439  }
27440};
27441
27442Decorator__proto__.update = function update () {
27443  var instance = this.handle;
27444
27445  if (!this.dirty) {
27446    if (instance && instance.invalidate) {
27447      runloop.scheduleTask(function () { return instance.invalidate(); }, true);
27448    }
27449    return;
27450  }
27451
27452  this.dirty = false;
27453
27454  if (instance) {
27455    if (!instance.update) {
27456      this.unrender();
27457      this.render();
27458    } else {
27459      var args = this.models.map(function (model) { return model && model.get(); });
27460      instance.update.apply(this.ractive, this.fn.apply(this.ractive, args));
27461    }
27462  }
27463};
27464
27465Decorator.prototype.firstNode = noop;
27466
27467var Doctype = (function (Item) {
27468  function Doctype () {
27469    Item.apply(this, arguments);
27470  }
27471
27472  if ( Item ) Doctype.__proto__ = Item;
27473  var Doctype__proto__ = Doctype.prototype = Object.create( Item && Item.prototype );
27474  Doctype__proto__.constructor = Doctype;
27475
27476  Doctype__proto__.toString = function toString () {
27477    return '<!DOCTYPE' + this.template.a + '>';
27478  };
27479
27480  return Doctype;
27481}(Item));
27482
27483var proto$2 = Doctype.prototype;
27484proto$2.bind = proto$2.render = proto$2.teardown = proto$2.unbind = proto$2.unrender = proto$2.update = noop;
27485
27486var Binding = function Binding(element, name) {
27487  if ( name === void 0 ) name = 'value';
27488
27489  this.element = element;
27490  this.ractive = element.ractive;
27491  this.attribute = element.attributeByName[name];
27492
27493  var interpolator = this.attribute.interpolator;
27494  interpolator.twowayBinding = this;
27495
27496  var model = interpolator.model;
27497
27498  if (model.isReadonly && !model.setRoot) {
27499    var keypath = model.getKeypath().replace(/^@/, '');
27500    warnOnceIfDebug(
27501      ("Cannot use two-way binding on <" + (element.name) + "> element: " + keypath + " is read-only. To suppress this warning use <" + (element.name) + " twoway='false'...>"),
27502      { ractive: this.ractive }
27503    );
27504    return false;
27505  }
27506
27507  this.attribute.isTwoway = true;
27508  this.model = model;
27509
27510  // initialise value, if it's undefined
27511  var value = model.get();
27512  this.wasUndefined = isUndefined(value);
27513
27514  if (isUndefined(value) && this.getInitialValue) {
27515    value = this.getInitialValue();
27516    model.set(value);
27517  }
27518  this.lastVal(true, value);
27519
27520  var parentForm = findElement(this.element, false, 'form');
27521  if (parentForm) {
27522    this.resetValue = value;
27523    parentForm.formBindings.push(this);
27524  }
27525};
27526var Binding__proto__ = Binding.prototype;
27527
27528Binding__proto__.bind = function bind () {
27529  this.model.registerTwowayBinding(this);
27530};
27531
27532Binding__proto__.handleChange = function handleChange () {
27533    var this$1 = this;
27534
27535  var value = this.getValue();
27536  if (this.lastVal() === value) { return; }
27537
27538  runloop.start();
27539  this.attribute.locked = true;
27540  this.model.set(value);
27541  this.lastVal(true, value);
27542
27543  // if the value changes before observers fire, unlock to be updatable cause something weird and potentially freezy is up
27544  if (this.model.get() !== value) { this.attribute.locked = false; }
27545  else { runloop.scheduleTask(function () { return (this$1.attribute.locked = false); }); }
27546
27547  runloop.end();
27548};
27549
27550Binding__proto__.lastVal = function lastVal (setting, value) {
27551  if (setting) { this.lastValue = value; }
27552  else { return this.lastValue; }
27553};
27554
27555Binding__proto__.rebind = function rebind (next, previous) {
27556    var this$1 = this;
27557
27558  if (this.model && this.model === previous) { previous.unregisterTwowayBinding(this); }
27559  if (next) {
27560    this.model = next;
27561    runloop.scheduleTask(function () { return next.registerTwowayBinding(this$1); });
27562  }
27563};
27564
27565Binding__proto__.rebound = function rebound () {
27566  if (this.model) { this.model.unregisterTwowayBinding(this); }
27567  this.model = this.attribute.interpolator.model;
27568  this.model && this.model.registerTwowayBinding(this);
27569};
27570
27571Binding__proto__.render = function render () {
27572  this.node = this.element.node;
27573  this.node._ractive.binding = this;
27574  this.rendered = true; // TODO is this used anywhere?
27575};
27576
27577Binding__proto__.setFromNode = function setFromNode (node) {
27578  this.model.set(node.value);
27579};
27580
27581Binding__proto__.unbind = function unbind () {
27582  this.model && this.model.unregisterTwowayBinding(this);
27583};
27584
27585Binding.prototype.unrender = noop;
27586
27587// This is the handler for DOM events that would lead to a change in the model
27588// (i.e. change, sometimes, input, and occasionally click and keyup)
27589function handleDomEvent() {
27590  this._ractive.binding.handleChange();
27591}
27592
27593var CheckboxBinding = (function (Binding) {
27594  function CheckboxBinding(element) {
27595    Binding.call(this, element, 'checked');
27596  }
27597
27598  if ( Binding ) CheckboxBinding.__proto__ = Binding;
27599  var CheckboxBinding__proto__ = CheckboxBinding.prototype = Object.create( Binding && Binding.prototype );
27600  CheckboxBinding__proto__.constructor = CheckboxBinding;
27601
27602  CheckboxBinding__proto__.render = function render () {
27603    Binding.prototype.render.call(this);
27604
27605    this.element.on('change', handleDomEvent);
27606
27607    if (this.node.attachEvent) {
27608      this.element.on('click', handleDomEvent);
27609    }
27610  };
27611
27612  CheckboxBinding__proto__.unrender = function unrender () {
27613    this.element.off('change', handleDomEvent);
27614
27615    if (this.node.attachEvent) {
27616      this.element.off('click', handleDomEvent);
27617    }
27618  };
27619
27620  CheckboxBinding__proto__.getInitialValue = function getInitialValue () {
27621    return !!this.element.getAttribute('checked');
27622  };
27623
27624  CheckboxBinding__proto__.getValue = function getValue () {
27625    return this.node.checked;
27626  };
27627
27628  CheckboxBinding__proto__.setFromNode = function setFromNode (node) {
27629    this.model.set(node.checked);
27630  };
27631
27632  return CheckboxBinding;
27633}(Binding));
27634
27635function getBindingGroup(group, model, getValue) {
27636  var hash = group + "-bindingGroup";
27637  return model[hash] || (model[hash] = new BindingGroup(hash, model, getValue));
27638}
27639
27640var BindingGroup = function BindingGroup(hash, model, getValue) {
27641  var this$1 = this;
27642
27643  this.model = model;
27644  this.hash = hash;
27645  this.getValue = function () {
27646    this$1.value = getValue.call(this$1);
27647    return this$1.value;
27648  };
27649
27650  this.bindings = [];
27651};
27652var BindingGroup__proto__ = BindingGroup.prototype;
27653
27654BindingGroup__proto__.add = function add (binding) {
27655  this.bindings.push(binding);
27656};
27657
27658BindingGroup__proto__.bind = function bind () {
27659  this.value = this.model.get();
27660  this.model.registerTwowayBinding(this);
27661  this.bound = true;
27662};
27663
27664BindingGroup__proto__.remove = function remove (binding) {
27665  removeFromArray(this.bindings, binding);
27666  if (!this.bindings.length) {
27667    this.unbind();
27668  }
27669};
27670
27671BindingGroup__proto__.unbind = function unbind () {
27672  this.model.unregisterTwowayBinding(this);
27673  this.bound = false;
27674  delete this.model[this.hash];
27675};
27676
27677BindingGroup.prototype.rebind = Binding.prototype.rebind;
27678
27679var push$1 = [].push;
27680
27681function getValue() {
27682  var this$1 = this;
27683
27684  var all = this.bindings
27685    .filter(function (b) { return b.node && b.node.checked; })
27686    .map(function (b) { return b.element.getAttribute('value'); });
27687  var res = [];
27688  all.forEach(function (v) {
27689    if (!this$1.bindings[0].arrayContains(res, v)) { res.push(v); }
27690  });
27691  return res;
27692}
27693
27694var CheckboxNameBinding = (function (Binding) {
27695  function CheckboxNameBinding(element) {
27696    Binding.call(this, element, 'name');
27697
27698    this.checkboxName = true; // so that ractive.updateModel() knows what to do with this
27699
27700    // Each input has a reference to an array containing it and its
27701    // group, as two-way binding depends on being able to ascertain
27702    // the status of all inputs within the group
27703    this.group = getBindingGroup('checkboxes', this.model, getValue);
27704    this.group.add(this);
27705
27706    if (this.noInitialValue) {
27707      this.group.noInitialValue = true;
27708    }
27709
27710    // If no initial value was set, and this input is checked, we
27711    // update the model
27712    if (this.group.noInitialValue && this.element.getAttribute('checked')) {
27713      var existingValue = this.model.get();
27714      var bindingValue = this.element.getAttribute('value');
27715
27716      if (!this.arrayContains(existingValue, bindingValue)) {
27717        push$1.call(existingValue, bindingValue); // to avoid triggering runloop with array adaptor
27718      }
27719    }
27720  }
27721
27722  if ( Binding ) CheckboxNameBinding.__proto__ = Binding;
27723  var CheckboxNameBinding__proto__ = CheckboxNameBinding.prototype = Object.create( Binding && Binding.prototype );
27724  CheckboxNameBinding__proto__.constructor = CheckboxNameBinding;
27725
27726  CheckboxNameBinding__proto__.bind = function bind () {
27727    if (!this.group.bound) {
27728      this.group.bind();
27729    }
27730  };
27731
27732  CheckboxNameBinding__proto__.getInitialValue = function getInitialValue () {
27733    // This only gets called once per group (of inputs that
27734    // share a name), because it only gets called if there
27735    // isn't an initial value. By the same token, we can make
27736    // a note of that fact that there was no initial value,
27737    // and populate it using any `checked` attributes that
27738    // exist (which users should avoid, but which we should
27739    // support anyway to avoid breaking expectations)
27740    this.noInitialValue = true; // TODO are noInitialValue and wasUndefined the same thing?
27741    return [];
27742  };
27743
27744  CheckboxNameBinding__proto__.getValue = function getValue () {
27745    return this.group.value;
27746  };
27747
27748  CheckboxNameBinding__proto__.handleChange = function handleChange () {
27749    this.isChecked = this.element.node.checked;
27750    this.group.value = this.model.get()
vendor: 32,061 bytes, lines 27750-28882
27750.slice();
27751    var value = this.element.getAttribute('value');
27752    if (this.isChecked && !this.arrayContains(this.group.value, value)) {
27753      this.group.value.push(value);
27754    } else if (!this.isChecked && this.arrayContains(this.group.value, value)) {
27755      this.removeFromArray(this.group.value, value);
27756    }
27757    // make sure super knows there's a change
27758    this.lastValue = null;
27759    Binding.prototype.handleChange.call(this);
27760  };
27761
27762  CheckboxNameBinding__proto__.render = function render () {
27763    Binding.prototype.render.call(this);
27764
27765    var node = this.node;
27766
27767    var existingValue = this.model.get();
27768    var bindingValue = this.element.getAttribute('value');
27769
27770    if (isArray(existingValue)) {
27771      this.isChecked = this.arrayContains(existingValue, bindingValue);
27772    } else {
27773      this.isChecked = this.element.compare(existingValue, bindingValue);
27774    }
27775    node.name = '{{' + this.model.getKeypath() + '}}';
27776    node.checked = this.isChecked;
27777
27778    this.element.on('change', handleDomEvent);
27779
27780    // in case of IE emergency, bind to click event as well
27781    if (this.node.attachEvent) {
27782      this.element.on('click', handleDomEvent);
27783    }
27784  };
27785
27786  CheckboxNameBinding__proto__.setFromNode = function setFromNode (node) {
27787    this.group.bindings.forEach(function (binding) { return (binding.wasUndefined = true); });
27788
27789    if (node.checked) {
27790      var valueSoFar = this.group.getValue();
27791      valueSoFar.push(this.element.getAttribute('value'));
27792
27793      this.group.model.set(valueSoFar);
27794    }
27795  };
27796
27797  CheckboxNameBinding__proto__.unbind = function unbind () {
27798    this.group.remove(this);
27799  };
27800
27801  CheckboxNameBinding__proto__.unrender = function unrender () {
27802    var el = this.element;
27803
27804    el.off('change', handleDomEvent);
27805
27806    if (this.node.attachEvent) {
27807      el.off('click', handleDomEvent);
27808    }
27809  };
27810
27811  CheckboxNameBinding__proto__.arrayContains = function arrayContains (selectValue, optionValue) {
27812    var this$1 = this;
27813
27814    var i = selectValue.length;
27815    while (i--) {
27816      if (this$1.element.compare(optionValue, selectValue[i])) { return true; }
27817    }
27818    return false;
27819  };
27820
27821  CheckboxNameBinding__proto__.removeFromArray = function removeFromArray (array, item) {
27822    var this$1 = this;
27823
27824    if (!array) { return; }
27825    var i = array.length;
27826    while (i--) {
27827      if (this$1.element.compare(item, array[i])) {
27828        array.splice(i, 1);
27829      }
27830    }
27831  };
27832
27833  return CheckboxNameBinding;
27834}(Binding));
27835
27836var ContentEditableBinding = (function (Binding) {
27837  function ContentEditableBinding () {
27838    Binding.apply(this, arguments);
27839  }
27840
27841  if ( Binding ) ContentEditableBinding.__proto__ = Binding;
27842  var ContentEditableBinding__proto__ = ContentEditableBinding.prototype = Object.create( Binding && Binding.prototype );
27843  ContentEditableBinding__proto__.constructor = ContentEditableBinding;
27844
27845  ContentEditableBinding__proto__.getInitialValue = function getInitialValue () {
27846    return this.element.fragment ? this.element.fragment.toString() : '';
27847  };
27848
27849  ContentEditableBinding__proto__.getValue = function getValue () {
27850    return this.element.node.innerHTML;
27851  };
27852
27853  ContentEditableBinding__proto__.render = function render () {
27854    Binding.prototype.render.call(this);
27855
27856    var el = this.element;
27857
27858    el.on('change', handleDomEvent);
27859    el.on('blur', handleDomEvent);
27860
27861    if (!this.ractive.lazy) {
27862      el.on('input', handleDomEvent);
27863
27864      if (this.node.attachEvent) {
27865        el.on('keyup', handleDomEvent);
27866      }
27867    }
27868  };
27869
27870  ContentEditableBinding__proto__.setFromNode = function setFromNode (node) {
27871    this.model.set(node.innerHTML);
27872  };
27873
27874  ContentEditableBinding__proto__.unrender = function unrender () {
27875    var el = this.element;
27876
27877    el.off('blur', handleDomEvent);
27878    el.off('change', handleDomEvent);
27879    el.off('input', handleDomEvent);
27880    el.off('keyup', handleDomEvent);
27881  };
27882
27883  return ContentEditableBinding;
27884}(Binding));
27885
27886function handleBlur() {
27887  handleDomEvent.call(this);
27888
27889  var value = this._ractive.binding.model.get();
27890  this.value = value == undefined ? '' : value;
27891}
27892
27893function handleDelay(delay) {
27894  var timeout;
27895
27896  return function() {
27897    var this$1 = this;
27898
27899    if (timeout) { clearTimeout(timeout); }
27900
27901    timeout = setTimeout(function () {
27902      var binding = this$1._ractive.binding;
27903      if (binding.rendered) { handleDomEvent.call(this$1); }
27904      timeout = null;
27905    }, delay);
27906  };
27907}
27908
27909var GenericBinding = (function (Binding) {
27910  function GenericBinding () {
27911    Binding.apply(this, arguments);
27912  }
27913
27914  if ( Binding ) GenericBinding.__proto__ = Binding;
27915  var GenericBinding__proto__ = GenericBinding.prototype = Object.create( Binding && Binding.prototype );
27916  GenericBinding__proto__.constructor = GenericBinding;
27917
27918  GenericBinding__proto__.getInitialValue = function getInitialValue () {
27919    return '';
27920  };
27921
27922  GenericBinding__proto__.getValue = function getValue () {
27923    return this.node.value;
27924  };
27925
27926  GenericBinding__proto__.render = function render () {
27927    Binding.prototype.render.call(this);
27928
27929    // any lazy setting for this element overrides the root
27930    // if the value is a number, it's a timeout
27931    var lazy = this.ractive.lazy;
27932    var timeout = false;
27933    var el = this.element;
27934
27935    if ('lazy' in this.element) {
27936      lazy = this.element.lazy;
27937    }
27938
27939    if (isNumeric(lazy)) {
27940      timeout = +lazy;
27941      lazy = false;
27942    }
27943
27944    this.handler = timeout ? handleDelay(timeout) : handleDomEvent;
27945
27946    var node = this.node;
27947
27948    el.on('change', handleDomEvent);
27949
27950    if (node.type !== 'file') {
27951      if (!lazy) {
27952        el.on('input', this.handler);
27953
27954        // IE is a special snowflake
27955        if (node.attachEvent) {
27956          el.on('keyup', this.handler);
27957        }
27958      }
27959
27960      el.on('blur', handleBlur);
27961    }
27962  };
27963
27964  GenericBinding__proto__.unrender = function unrender () {
27965    var el = this.element;
27966    this.rendered = false;
27967
27968    el.off('change', handleDomEvent);
27969    el.off('input', this.handler);
27970    el.off('keyup', this.handler);
27971    el.off('blur', handleBlur);
27972  };
27973
27974  return GenericBinding;
27975}(Binding));
27976
27977var FileBinding = (function (GenericBinding) {
27978  function FileBinding () {
27979    GenericBinding.apply(this, arguments);
27980  }
27981
27982  if ( GenericBinding ) FileBinding.__proto__ = GenericBinding;
27983  var FileBinding__proto__ = FileBinding.prototype = Object.create( GenericBinding && GenericBinding.prototype );
27984  FileBinding__proto__.constructor = FileBinding;
27985
27986  FileBinding__proto__.getInitialValue = function getInitialValue () {
27987    /* istanbul ignore next */
27988    return undefined;
27989  };
27990
27991  FileBinding__proto__.getValue = function getValue () {
27992    /* istanbul ignore next */
27993    return this.node.files;
27994  };
27995
27996  FileBinding__proto__.render = function render () {
27997    /* istanbul ignore next */
27998    this.element.lazy = false;
27999    /* istanbul ignore next */
28000    GenericBinding.prototype.render.call(this);
28001  };
28002
28003  FileBinding__proto__.setFromNode = function setFromNode (node) {
28004    /* istanbul ignore next */
28005    this.model.set(node.files);
28006  };
28007
28008  return FileBinding;
28009}(GenericBinding));
28010
28011function getSelectedOptions(select) {
28012  /* istanbul ignore next */
28013  return select.selectedOptions
28014    ? toArray(select.selectedOptions)
28015    : select.options
28016    ? toArray(select.options).filter(function (option) { return option.selected; })
28017    : [];
28018}
28019
28020var MultipleSelectBinding = (function (Binding) {
28021  function MultipleSelectBinding () {
28022    Binding.apply(this, arguments);
28023  }
28024
28025  if ( Binding ) MultipleSelectBinding.__proto__ = Binding;
28026  var MultipleSelectBinding__proto__ = MultipleSelectBinding.prototype = Object.create( Binding && Binding.prototype );
28027  MultipleSelectBinding__proto__.constructor = MultipleSelectBinding;
28028
28029  MultipleSelectBinding__proto__.getInitialValue = function getInitialValue () {
28030    return this.element.options
28031      .filter(function (option) { return option.getAttribute('selected'); })
28032      .map(function (option) { return option.getAttribute('value'); });
28033  };
28034
28035  MultipleSelectBinding__proto__.getValue = function getValue () {
28036    var options = this.element.node.options;
28037    var len = options.length;
28038
28039    var selectedValues = [];
28040
28041    for (var i = 0; i < len; i += 1) {
28042      var option = options[i];
28043
28044      if (option.selected) {
28045        var optionValue = option._ractive ? option._ractive.value : option.value;
28046        selectedValues.push(optionValue);
28047      }
28048    }
28049
28050    return selectedValues;
28051  };
28052
28053  MultipleSelectBinding__proto__.handleChange = function handleChange () {
28054    var attribute = this.attribute;
28055    var previousValue = attribute.getValue();
28056
28057    var value = this.getValue();
28058
28059    if (isUndefined(previousValue) || !arrayContentsMatch(value, previousValue)) {
28060      Binding.prototype.handleChange.call(this);
28061    }
28062
28063    return this;
28064  };
28065
28066  MultipleSelectBinding__proto__.render = function render () {
28067    Binding.prototype.render.call(this);
28068
28069    this.element.on('change', handleDomEvent);
28070
28071    if (isUndefined(this.model.get())) {
28072      // get value from DOM, if possible
28073      this.handleChange();
28074    }
28075  };
28076
28077  MultipleSelectBinding__proto__.setFromNode = function setFromNode (node) {
28078    var selectedOptions = getSelectedOptions(node);
28079    var i = selectedOptions.length;
28080    var result = new Array(i);
28081
28082    while (i--) {
28083      var option = selectedOptions[i];
28084      result[i] = option._ractive ? option._ractive.value : option.value;
28085    }
28086
28087    this.model.set(result);
28088  };
28089
28090  MultipleSelectBinding__proto__.unrender = function unrender () {
28091    this.element.off('change', handleDomEvent);
28092  };
28093
28094  return MultipleSelectBinding;
28095}(Binding));
28096
28097var NumericBinding = (function (GenericBinding) {
28098  function NumericBinding () {
28099    GenericBinding.apply(this, arguments);
28100  }
28101
28102  if ( GenericBinding ) NumericBinding.__proto__ = GenericBinding;
28103  var NumericBinding__proto__ = NumericBinding.prototype = Object.create( GenericBinding && GenericBinding.prototype );
28104  NumericBinding__proto__.constructor = NumericBinding;
28105
28106  NumericBinding__proto__.getInitialValue = function getInitialValue () {
28107    return undefined;
28108  };
28109
28110  NumericBinding__proto__.getValue = function getValue () {
28111    var value = parseFloat(this.node.value);
28112    return isNaN(value) ? undefined : value;
28113  };
28114
28115  NumericBinding__proto__.setFromNode = function setFromNode (node) {
28116    var value = parseFloat(node.value);
28117    if (!isNaN(value)) { this.model.set(value); }
28118  };
28119
28120  return NumericBinding;
28121}(GenericBinding));
28122
28123var siblings = {};
28124
28125function getSiblings(hash) {
28126  return siblings[hash] || (siblings[hash] = []);
28127}
28128
28129var RadioBinding = (function (Binding) {
28130  function RadioBinding(element) {
28131    Binding.call(this, element, 'checked');
28132
28133    this.siblings = getSiblings(this.ractive._guid + this.element.getAttribute('name'));
28134    this.siblings.push(this);
28135  }
28136
28137  if ( Binding ) RadioBinding.__proto__ = Binding;
28138  var RadioBinding__proto__ = RadioBinding.prototype = Object.create( Binding && Binding.prototype );
28139  RadioBinding__proto__.constructor = RadioBinding;
28140
28141  RadioBinding__proto__.getValue = function getValue () {
28142    return this.node.checked;
28143  };
28144
28145  RadioBinding__proto__.handleChange = function handleChange () {
28146    runloop.start();
28147
28148    this.siblings.forEach(function (binding) {
28149      binding.model.set(binding.getValue());
28150    });
28151
28152    runloop.end();
28153  };
28154
28155  RadioBinding__proto__.render = function render () {
28156    Binding.prototype.render.call(this);
28157
28158    this.element.on('change', handleDomEvent);
28159
28160    if (this.node.attachEvent) {
28161      this.element.on('click', handleDomEvent);
28162    }
28163  };
28164
28165  RadioBinding__proto__.setFromNode = function setFromNode (node) {
28166    this.model.set(node.checked);
28167  };
28168
28169  RadioBinding__proto__.unbind = function unbind () {
28170    removeFromArray(this.siblings, this);
28171  };
28172
28173  RadioBinding__proto__.unrender = function unrender () {
28174    this.element.off('change', handleDomEvent);
28175
28176    if (this.node.attachEvent) {
28177      this.element.off('click', handleDomEvent);
28178    }
28179  };
28180
28181  return RadioBinding;
28182}(Binding));
28183
28184function getValue$1() {
28185  var checked = this.bindings.filter(function (b) { return b.node.checked; });
28186  if (checked.length > 0) {
28187    return checked[0].element.getAttribute('value');
28188  }
28189}
28190
28191var RadioNameBinding = (function (Binding) {
28192  function RadioNameBinding(element) {
28193    var this$1 = this;
28194
28195    Binding.call(this, element, 'name');
28196
28197    this.group = getBindingGroup('radioname', this.model, getValue$1);
28198    this.group.add(this);
28199
28200    if (element.checked) {
28201      this.group.value = this.getValue();
28202    }
28203
28204    this.attribute.interpolator.pathChanged = function () { return this$1.updateName(); };
28205  }
28206
28207  if ( Binding ) RadioNameBinding.__proto__ = Binding;
28208  var RadioNameBinding__proto__ = RadioNameBinding.prototype = Object.create( Binding && Binding.prototype );
28209  RadioNameBinding__proto__.constructor = RadioNameBinding;
28210
28211  RadioNameBinding__proto__.bind = function bind () {
28212    if (!this.group.bound) {
28213      this.group.bind();
28214    }
28215  };
28216
28217  RadioNameBinding__proto__.getInitialValue = function getInitialValue () {
28218    if (this.element.getAttribute('checked')) {
28219      return this.element.getAttribute('value');
28220    }
28221  };
28222
28223  RadioNameBinding__proto__.getValue = function getValue () {
28224    return this.element.getAttribute('value');
28225  };
28226
28227  RadioNameBinding__proto__.handleChange = function handleChange () {
28228    // If this <input> is the one that's checked, then the value of its
28229    // `name` model gets set to its value
28230    if (this.node.checked) {
28231      this.group.value = this.getValue();
28232      Binding.prototype.handleChange.call(this);
28233    }
28234
28235    this.updateName();
28236  };
28237
28238  RadioNameBinding__proto__.lastVal = function lastVal (setting, value) {
28239    if (!this.group) { return; }
28240    if (setting) { this.group.lastValue = value; }
28241    else { return this.group.lastValue; }
28242  };
28243
28244  RadioNameBinding__proto__.rebind = function rebind (next, previous) {
28245    Binding.prototype.rebind.call(this, next, previous);
28246    this.updateName();
28247  };
28248
28249  RadioNameBinding__proto__.rebound = function rebound (update) {
28250    Binding.prototype.rebound.call(this, update);
28251    this.updateName();
28252  };
28253
28254  RadioNameBinding__proto__.render = function render () {
28255    Binding.prototype.render.call(this);
28256
28257    var node = this.node;
28258
28259    this.updateName();
28260    node.checked = this.element.compare(this.model.get(), this.element.getAttribute('value'));
28261
28262    this.element.on('change', handleDomEvent);
28263
28264    if (node.attachEvent) {
28265      this.element.on('click', handleDomEvent);
28266    }
28267  };
28268
28269  RadioNameBinding__proto__.setFromNode = function setFromNode (node) {
28270    if (node.checked) {
28271      this.group.model.set(this.element.getAttribute('value'));
28272    }
28273  };
28274
28275  RadioNameBinding__proto__.unbind = function unbind () {
28276    this.group.remove(this);
28277  };
28278
28279  RadioNameBinding__proto__.unrender = function unrender () {
28280    var el = this.element;
28281
28282    el.off('change', handleDomEvent);
28283
28284    if (this.node.attachEvent) {
28285      el.off('click', handleDomEvent);
28286    }
28287  };
28288
28289  RadioNameBinding__proto__.updateName = function updateName () {
28290    if (this.node) { this.node.name = "{{" + (this.model.getKeypath()) + "}}"; }
28291  };
28292
28293  return RadioNameBinding;
28294}(Binding));
28295
28296var SingleSelectBinding = (function (Binding) {
28297  function SingleSelectBinding () {
28298    Binding.apply(this, arguments);
28299  }
28300
28301  if ( Binding ) SingleSelectBinding.__proto__ = Binding;
28302  var SingleSelectBinding__proto__ = SingleSelectBinding.prototype = Object.create( Binding && Binding.prototype );
28303  SingleSelectBinding__proto__.constructor = SingleSelectBinding;
28304
28305  SingleSelectBinding__proto__.forceUpdate = function forceUpdate () {
28306    var this$1 = this;
28307
28308    var value = this.getValue();
28309
28310    if (value !== undefined) {
28311      this.attribute.locked = true;
28312      runloop.scheduleTask(function () { return (this$1.attribute.locked = false); });
28313      this.model.set(value);
28314    }
28315  };
28316
28317  SingleSelectBinding__proto__.getInitialValue = function getInitialValue () {
28318    if (this.element.getAttribute('value') !== undefined) {
28319      return;
28320    }
28321
28322    var options = this.element.options;
28323    var len = options.length;
28324
28325    if (!len) { return; }
28326
28327    var value;
28328    var optionWasSelected;
28329    var i = len;
28330
28331    // take the final selected option...
28332    while (i--) {
28333      var option = options[i];
28334
28335      if (option.getAttribute('selected')) {
28336        if (!option.getAttribute('disabled')) {
28337          value = option.getAttribute('value');
28338        }
28339
28340        optionWasSelected = true;
28341        break;
28342      }
28343    }
28344
28345    // or the first non-disabled option, if none are selected
28346    if (!optionWasSelected) {
28347      while (++i < len) {
28348        if (!options[i].getAttribute('disabled')) {
28349          value = options[i].getAttribute('value');
28350          break;
28351        }
28352      }
28353    }
28354
28355    // This is an optimisation (aka hack) that allows us to forgo some
28356    // other more expensive work
28357    // TODO does it still work? seems at odds with new architecture
28358    if (value !== undefined) {
28359      this.element.attributeByName.value.value = value;
28360    }
28361
28362    return value;
28363  };
28364
28365  SingleSelectBinding__proto__.getValue = function getValue () {
28366    var options = this.node.options;
28367    var len = options.length;
28368
28369    var i;
28370    for (i = 0; i < len; i += 1) {
28371      var option = options[i];
28372
28373      if (options[i].selected && !options[i].disabled) {
28374        return option._ractive ? option._ractive.value : option.value;
28375      }
28376    }
28377  };
28378
28379  SingleSelectBinding__proto__.render = function render () {
28380    Binding.prototype.render.call(this);
28381    this.element.on('change', handleDomEvent);
28382  };
28383
28384  SingleSelectBinding__proto__.setFromNode = function setFromNode (node) {
28385    var option = getSelectedOptions(node)[0];
28386    this.model.set(option._ractive ? option._ractive.value : option.value);
28387  };
28388
28389  SingleSelectBinding__proto__.unrender = function unrender () {
28390    this.element.off('change', handleDomEvent);
28391  };
28392
28393  return SingleSelectBinding;
28394}(Binding));
28395
28396function isBindable(attribute) {
28397  // The fragment must be a single non-string fragment
28398  if (
28399    !attribute ||
28400    !attribute.template.f ||
28401    attribute.template.f.length !== 1 ||
28402    attribute.template.f[0].s
28403  )
28404    { return false; }
28405
28406  // A binding is an interpolator `{{ }}`, yey.
28407  if (attribute.template.f[0].t === INTERPOLATOR) { return true; }
28408
28409  // The above is probably the only true case. For the rest, show an appropriate
28410  // warning before returning false.
28411
28412  // You can't bind a triple curly. HTML values on an attribute makes no sense.
28413  if (attribute.template.f[0].t === TRIPLE)
28414    { warnIfDebug('It is not possible create a binding using a triple mustache.'); }
28415
28416  return false;
28417}
28418
28419function selectBinding(element) {
28420  var name = element.name;
28421  var attributes = element.attributeByName;
28422  if (name !== 'input' && name !== 'textarea' && name !== 'select' && !attributes.contenteditable)
28423    { return; }
28424  var isBindableByValue = isBindable(attributes.value);
28425  var isBindableByContentEditable = isBindable(attributes.contenteditable);
28426  var isContentEditable = element.getAttribute('contenteditable');
28427
28428  // contenteditable
28429  // Bind if the contenteditable is true or a binding that may become true.
28430  if ((isContentEditable || isBindableByContentEditable) && isBindableByValue)
28431    { return ContentEditableBinding; }
28432
28433  // <input>
28434  if (name === 'input') {
28435    var type = element.getAttribute('type');
28436
28437    if (type === 'radio') {
28438      var isBindableByName = isBindable(attributes.name);
28439      var isBindableByChecked = isBindable(attributes.checked);
28440
28441      // For radios we can either bind the name or checked, but not both.
28442      // Name binding is handed instead.
28443      if (isBindableByName && isBindableByChecked) {
28444        warnIfDebug(
28445          'A radio input can have two-way binding on its name attribute, or its checked attribute - not both',
28446          { ractive: element.root }
28447        );
28448        return RadioNameBinding;
28449      }
28450
28451      if (isBindableByName) { return RadioNameBinding; }
28452
28453      if (isBindableByChecked) { return RadioBinding; }
28454
28455      // Dead end. Unknown binding on radio input.
28456      return null;
28457    }
28458
28459    if (type === 'checkbox') {
28460      var isBindableByName$1 = isBindable(attributes.name);
28461      var isBindableByChecked$1 = isBindable(attributes.checked);
28462
28463      // A checkbox with bindings for both name and checked. Checked treated as
28464      // the checkbox value, name is treated as a regular binding.
28465      //
28466      // See https://github.com/ractivejs/ractive/issues/1749
28467      if (isBindableByName$1 && isBindableByChecked$1) { return CheckboxBinding; }
28468
28469      if (isBindableByName$1) { return CheckboxNameBinding; }
28470
28471      if (isBindableByChecked$1) { return CheckboxBinding; }
28472
28473      // Dead end. Unknown binding on checkbox input.
28474      return null;
28475    }
28476
28477    if (type === 'file' && isBindableByValue) { return FileBinding; }
28478
28479    if (type === 'number' && isBindableByValue) { return NumericBinding; }
28480
28481    if (type === 'range' && isBindableByValue) { return NumericBinding; }
28482
28483    // Some input of unknown type (browser usually falls back to text).
28484    if (isBindableByValue) { return GenericBinding; }
28485
28486    // Dead end. Some unknown input and an unbindable.
28487    return null;
28488  }
28489
28490  // <select>
28491  if (name === 'select' && isBindableByValue) {
28492    return element.getAttribute('multiple') ? MultipleSelectBinding : SingleSelectBinding;
28493  }
28494
28495  // <textarea>
28496  if (name === 'textarea' && isBindableByValue) { return GenericBinding; }
28497
28498  // Dead end. Some unbindable element.
28499  return null;
28500}
28501
28502var endsWithSemi = /;\s*$/;
28503
28504var Element = (function (ContainerItem) {
28505  function Element(options) {
28506    var this$1 = this;
28507
28508    ContainerItem.call(this, options);
28509
28510    this.name = options.template.e.toLowerCase();
28511
28512    // find parent element
28513    this.parent = findElement(this.up, false);
28514
28515    if (this.parent && this.parent.name === 'option') {
28516      throw new Error(
28517        ("An <option> element cannot contain other elements (encountered <" + (this.name) + ">)")
28518      );
28519    }
28520
28521    this.decorators = [];
28522
28523    // create attributes
28524    this.attributeByName = {};
28525
28526    var attrs;
28527    var n, attr, val, cls, name, template, leftovers;
28528
28529    var m = this.template.m;
28530    var len = (m && m.length) || 0;
28531
28532    for (var i = 0; i < len; i++) {
28533      template = m[i];
28534      if (template.g) {
28535        (this$1.statics || (this$1.statics = {}))[template.n] = isString(template.f)
28536          ? template.f
28537          : template.n;
28538      } else {
28539        switch (template.t) {
28540          case ATTRIBUTE:
28541          case BINDING_FLAG:
28542          case DECORATOR:
28543          case EVENT:
28544          case TRANSITION:
28545            attr = createItem({
28546              owner: this$1,
28547              up: this$1.up,
28548              template: template
28549            });
28550
28551            n = template.n;
28552
28553            attrs = attrs || (attrs = this$1.attributes = []);
28554
28555            if (n === 'value') { val = attr; }
28556            else if (n === 'name') { name = attr; }
28557            else if (n === 'class') { cls = attr; }
28558            else { attrs.push(attr); }
28559
28560            break;
28561
28562          case DELEGATE_FLAG:
28563            this$1.delegate = false;
28564            break;
28565
28566          default:
28567            (leftovers || (leftovers = [])).push(template);
28568            break;
28569        }
28570      }
28571    }
28572
28573    if (val) { attrs.push(val); }
28574    if (name) { attrs.push(name); }
28575    if (cls) { attrs.unshift(cls); }
28576
28577    if (leftovers) {
28578      (attrs || (this.attributes = [])).push(
28579        new ConditionalAttribute({
28580          owner: this,
28581          up: this.up,
28582          template: leftovers
28583        })
28584      );
28585
28586      // empty leftovers array
28587      leftovers = [];
28588    }
28589
28590    // create children
28591    if (options.template.f && !options.deferContent) {
28592      this.fragment = new Fragment({
28593        template: options.template.f,
28594        owner: this,
28595        cssIds: null
28596      });
28597    }
28598
28599    this.binding = null; // filled in later
28600  }
28601
28602  if ( ContainerItem ) Element.__proto__ = ContainerItem;
28603  var Element__proto__ = Element.prototype = Object.create( ContainerItem && ContainerItem.prototype );
28604  Element__proto__.constructor = Element;
28605
28606  Element__proto__.bind = function bind () {
28607    var attrs = this.attributes;
28608    if (attrs) {
28609      attrs.binding = true;
28610      var len = attrs.length;
28611      for (var i = 0; i < len; i++) { attrs[i].bind(); }
28612      attrs.binding = false;
28613    }
28614
28615    if (this.fragment) { this.fragment.bind(); }
28616
28617    // create two-way binding if necessary
28618    if (!this.binding) { this.recreateTwowayBinding(); }
28619    else { this.binding.bind(); }
28620  };
28621
28622  Element__proto__.createTwowayBinding = function createTwowayBinding () {
28623    if ('twoway' in this ? this.twoway : this.ractive.twoway) {
28624      var Binding = selectBinding(this);
28625      if (Binding) {
28626        var binding = new Binding(this);
28627        if (binding && binding.model) { return binding; }
28628      }
28629    }
28630  };
28631
28632  Element__proto__.destroyed = function destroyed$1 () {
28633    if (this.attributes) { this.attributes.forEach(destroyed); }
28634    if (this.fragment) { this.fragment.destroyed(); }
28635  };
28636
28637  Element__proto__.detach = function detach () {
28638    // if this element is no longer rendered, the transitions are complete and the attributes can be torn down
28639    if (!this.rendered) { this.destroyed(); }
28640
28641    return detachNode(this.node);
28642  };
28643
28644  Element__proto__.find = function find (selector, options) {
28645    if (this.node && matches(this.node, selector)) { return this.node; }
28646    if (this.fragment) {
28647      return this.fragment.find(selector, options);
28648    }
28649  };
28650
28651  Element__proto__.findAll = function findAll (selector, options) {
28652    var result = options.result;
28653
28654    if (matches(this.node, selector)) {
28655      result.push(this.node);
28656    }
28657
28658    if (this.fragment) {
28659      this.fragment.findAll(selector, options);
28660    }
28661  };
28662
28663  Element__proto__.findNextNode = function findNextNode () {
28664    return null;
28665  };
28666
28667  Element__proto__.firstNode = function firstNode () {
28668    return this.node;
28669  };
28670
28671  Element__proto__.getAttribute = function getAttribute (name) {
28672    if (this.statics && name in this.statics) { return this.statics[name]; }
28673    var attribute = this.attributeByName[name];
28674    return attribute ? attribute.getValue() : undefined;
28675  };
28676
28677  Element__proto__.getContext = function getContext () {
28678    var assigns = [], len = arguments.length;
28679    while ( len-- ) assigns[ len ] = arguments[ len ];
28680
28681    if (this.fragment) { return (ref = this.fragment).getContext.apply(ref, assigns); }
28682
28683    if (!this.ctx) { this.ctx = new Context(this.up, this); }
28684    assigns.unshift(create(this.ctx));
28685    return assign.apply(null, assigns);
28686    var ref;
28687  };
28688
28689  Element__proto__.off = function off (event, callback, capture) {
28690    if ( capture === void 0 ) capture = false;
28691
28692    var delegate = this.up.delegate;
28693    var ref = this.listeners && this.listeners[event];
28694
28695    if (!ref) { return; }
28696    removeFromArray(ref, callback);
28697
28698    if (delegate) {
28699      var listeners =
28700        (delegate.listeners || (delegate.listeners = [])) &&
28701        (delegate.listeners[event] || (delegate.listeners[event] = []));
28702      if (listeners.refs && !--listeners.refs) { delegate.off(event, delegateHandler, true); }
28703    } else if (this.rendered) {
28704      var n = this.node;
28705      var add = n.addEventListener;
28706      var rem = n.removeEventListener;
28707
28708      if (!ref.length) {
28709        rem.call(n, event, handler, capture);
28710      } else if (ref.length && !ref.refs && capture) {
28711        rem.call(n, event, handler, true);
28712        add.call(n, event, handler, false);
28713      }
28714    }
28715  };
28716
28717  Element__proto__.on = function on (event, callback, capture) {
28718    if ( capture === void 0 ) capture = false;
28719
28720    var delegate = this.up.delegate;
28721    var ref = (this.listeners || (this.listeners = {}))[event] || (this.listeners[event] = []);
28722
28723    if (delegate) {
28724      var listeners =
28725        ((delegate.listeners || (delegate.listeners = [])) && delegate.listeners[event]) ||
28726        (delegate.listeners[event] = []);
28727      if (!listeners.refs) {
28728        listeners.refs = 0;
28729        delegate.on(event, delegateHandler, true);
28730        listeners.refs++;
28731      } else {
28732        listeners.refs++;
28733      }
28734    } else if (this.rendered) {
28735      var n = this.node;
28736      var add = n.addEventListener;
28737      var rem = n.removeEventListener;
28738
28739      if (!ref.length) {
28740        add.call(n, event, handler, capture);
28741      } else if (ref.length && !ref.refs && capture) {
28742        rem.call(n, event, handler, false);
28743        add.call(n, event, handler, true);
28744      }
28745    }
28746
28747    addToArray(this.listeners[event], callback);
28748  };
28749
28750  Element__proto__.recreateTwowayBinding = function recreateTwowayBinding () {
28751    if (this.binding) {
28752      this.binding.unbind();
28753      this.binding.unrender();
28754    }
28755
28756    if ((this.binding = this.createTwowayBinding())) {
28757      this.binding.bind();
28758      if (this.rendered) { this.binding.render(); }
28759    }
28760  };
28761
28762  Element__proto__.rebound = function rebound (update$$1) {
28763    ContainerItem.prototype.rebound.call(this, update$$1);
28764    if (this.attributes) { this.attributes.forEach(function (x) { return x.rebound(update$$1); }); }
28765    if (this.binding) { this.binding.rebound(update$$1); }
28766  };
28767
28768  Element__proto__.render = function render (target, occupants) {
28769    var this$1 = this;
28770
28771    // TODO determine correct namespace
28772    this.namespace = getNamespace(this);
28773
28774    var node;
28775    var existing = false;
28776
28777    if (occupants) {
28778      var n;
28779      while ((n = occupants.shift())) {
28780        if (
28781          n.nodeName.toUpperCase() === this$1.template.e.toUpperCase() &&
28782          n.namespaceURI === this$1.namespace
28783        ) {
28784          this$1.node = node = n;
28785          existing = true;
28786          break;
28787        } else {
28788          detachNode(n);
28789        }
28790      }
28791    }
28792
28793    if (!existing && this.node) {
28794      node = this.node;
28795      target.appendChild(node);
28796      existing = true;
28797    }
28798
28799    if (!node) {
28800      var name = this.template.e;
28801      node = createElement(
28802        this.namespace === html ? name.toLowerCase() : name,
28803        this.namespace,
28804        this.getAttribute('is')
28805      );
28806      this.node = node;
28807    }
28808
28809    // tie the node to this vdom element
28810    defineProperty(node, '_ractive', {
28811      value: {
28812        proxy: this
28813      },
28814      configurable: true
28815    });
28816
28817    if (this.statics) {
28818      keys(this.statics).forEach(function (k) {
28819        node.setAttribute(k, this$1.statics[k]);
28820      });
28821    }
28822
28823    if (existing && this.foundNode) { this.foundNode(node); }
28824
28825    // register intro before rendering content so children can find the intro
28826    var intro = this.intro;
28827    if (intro && intro.shouldFire('intro')) {
28828      intro.isIntro = true;
28829      intro.isOutro = false;
28830      runloop.registerTransition(intro);
28831    }
28832
28833    if (this.fragment) {
28834      var children = existing ? toArray(node.childNodes) : undefined;
28835
28836      this.fragment.render(node, children);
28837
28838      // clean up leftover children
28839      if (children) {
28840        children.forEach(detachNode);
28841      }
28842    }
28843
28844    if (existing) {
28845      // store initial values for two-way binding
28846      if (this.binding && this.binding.wasUndefined) { this.binding.setFromNode(node); }
28847      // remove unused attributes
28848      var i = node.attributes.length;
28849      while (i--) {
28850        var name$1 = node.attributes[i].name;
28851        if (!(name$1 in this$1.attributeByName) && (!this$1.statics || !(name$1 in this$1.statics)))
28852          { node.removeAttribute(name$1); }
28853      }
28854    }
28855
28856    // Is this a top-level node of a component? If so, we may need to add
28857    // a data-ractive-css attribute, for CSS encapsulation
28858    if (this.up.cssIds) {
28859      node.setAttribute('data-ractive-css', this.up.cssIds.map(function (x) { return ("{" + x + "}"); }).join(' '));
28860    }
28861
28862    if (this.attributes) {
28863      var len = this.attributes.length;
28864      for (var i$1 = 0; i$1 < len; i$1++) { this$1.attributes[i$1].render(); }
28865    }
28866    if (this.binding) { this.binding.render(); }
28867
28868    if (!this.up.delegate && this.listeners) {
28869      var ls = this.listeners;
28870      for (var k in ls) {
28871        if (ls[k] && ls[k].length) { this$1.node.addEventListener(k, handler, !!ls[k].refs); }
28872      }
28873    }
28874
28875    if (!existing) {
28876      target.appendChild(node);
28877    }
28878
28879    this.rendered = true;
28880  };
28881
28882  Element__proto__.
28882toString = function toString () {
28883    var this$1 = this;
28884
28885    var tagName = this.template.e;
28886
28887    var attrs = (this.attributes && this.attributes.map(stringifyAttribute).join('')) || '';
28888
28889    if (this.statics)
vendor: 31,426 bytes, lines 28890-29985
28890      { keys(this.statics).forEach(
28891        function (k) { return k !== 'class' && k !== 'style' && (attrs = " " + k + "=\"" + (this$1.statics[k]) + "\"" + attrs); }
28892      ); }
28893
28894    // Special case - selected options
28895    if (this.name === 'option' && this.isSelected()) {
28896      attrs += ' selected';
28897    }
28898
28899    // Special case - two-way radio name bindings
28900    if (this.name === 'input' && inputIsCheckedRadio(this)) {
28901      attrs += ' checked';
28902    }
28903
28904    // Special case style and class attributes and directives
28905    var style = this.statics ? this.statics.style : undefined;
28906    var cls = this.statics ? this.statics.class : undefined;
28907    this.attributes &&
28908      this.attributes.forEach(function (attr) {
28909        if (attr.name === 'class') {
28910          cls = (cls || '') + (cls ? ' ' : '') + safeAttributeString(attr.getString());
28911        } else if (attr.name === 'style') {
28912          style = (style || '') + (style ? ' ' : '') + safeAttributeString(attr.getString());
28913          if (style && !endsWithSemi.test(style)) { style += ';'; }
28914        } else if (attr.style) {
28915          style =
28916            (style || '') +
28917            (style ? ' ' : '') +
28918            (attr.style) + ": " + (safeAttributeString(attr.getString())) + ";";
28919        } else if (attr.inlineClass && attr.getValue()) {
28920          cls = (cls || '') + (cls ? ' ' : '') + attr.inlineClass;
28921        }
28922      });
28923    // put classes first, then inline style
28924    if (style !== undefined) { attrs = ' style' + (style ? ("=\"" + style + "\"") : '') + attrs; }
28925    if (cls !== undefined) { attrs = ' class' + (cls ? ("=\"" + cls + "\"") : '') + attrs; }
28926
28927    if (this.up.cssIds) {
28928      attrs += " data-ractive-css=\"" + (this.up.cssIds.map(function (x) { return ("{" + x + "}"); }).join(' ')) + "\"";
28929    }
28930
28931    var str = "<" + tagName + attrs + ">";
28932
28933    if (voidElements[this.name.toLowerCase()]) { return str; }
28934
28935    // Special case - textarea
28936    if (this.name === 'textarea' && this.getAttribute('value') !== undefined) {
28937      str += escapeHtml(this.getAttribute('value'));
28938    } else if (this.getAttribute('contenteditable') !== undefined) {
28939      // Special case - contenteditable
28940      str += this.getAttribute('value') || '';
28941    }
28942
28943    if (this.fragment) {
28944      str += this.fragment.toString(!/^(?:script|style)$/i.test(this.template.e)); // escape text unless script/style
28945    }
28946
28947    str += "</" + tagName + ">";
28948    return str;
28949  };
28950
28951  Element__proto__.unbind = function unbind (view) {
28952    var attrs = this.attributes;
28953    if (attrs) {
28954      attrs.unbinding = true;
28955      var len = attrs.length;
28956      for (var i = 0; i < len; i++) { attrs[i].unbind(view); }
28957      attrs.unbinding = false;
28958    }
28959
28960    if (this.binding) { this.binding.unbind(view); }
28961    if (this.fragment) { this.fragment.unbind(view); }
28962  };
28963
28964  Element__proto__.unrender = function unrender (shouldDestroy) {
28965    if (!this.rendered) { return; }
28966    this.rendered = false;
28967
28968    // unrendering before intro completed? complete it now
28969    // TODO should be an API for aborting transitions
28970    var transition = this.intro;
28971    if (transition && transition.complete) { transition.complete(); }
28972
28973    // Detach as soon as we can
28974    if (this.name === 'option') {
28975      // <option> elements detach immediately, so that
28976      // their parent <select> element syncs correctly, and
28977      // since option elements can't have transitions anyway
28978      this.detach();
28979    } else if (shouldDestroy) {
28980      runloop.detachWhenReady(this);
28981    }
28982
28983    // outro transition
28984    var outro = this.outro;
28985    if (outro && outro.shouldFire('outro')) {
28986      outro.isIntro = false;
28987      outro.isOutro = true;
28988      runloop.registerTransition(outro);
28989    }
28990
28991    if (this.fragment) { this.fragment.unrender(); }
28992
28993    if (this.binding) { this.binding.unrender(); }
28994  };
28995
28996  Element__proto__.update = function update () {
28997    if (this.dirty) {
28998      this.dirty = false;
28999
29000      var attrs = this.attributes;
29001      if (attrs) {
29002        var len = attrs.length;
29003        for (var i = 0; i < len; i++) { attrs[i].update(); }
29004      }
29005
29006      if (this.fragment) { this.fragment.update(); }
29007    }
29008  };
29009
29010  return Element;
29011}(ContainerItem));
29012
29013function inputIsCheckedRadio(element) {
29014  var nameAttr = element.attributeByName.name;
29015  return (
29016    element.getAttribute('type') === 'radio' &&
29017    (nameAttr || {}).interpolator &&
29018    element.getAttribute('value') === nameAttr.interpolator.model.get()
29019  );
29020}
29021
29022function stringifyAttribute(attribute) {
29023  var str = attribute.toString();
29024  return str ? ' ' + str : '';
29025}
29026
29027function getNamespace(element) {
29028  // Use specified namespace...
29029  var xmlns$$1 = element.getAttribute('xmlns');
29030  if (xmlns$$1) { return xmlns$$1; }
29031
29032  // ...or SVG namespace, if this is an <svg> element
29033  if (element.name === 'svg') { return svg$1; }
29034
29035  var parent = element.parent;
29036
29037  if (parent) {
29038    // ...or HTML, if the parent is a <foreignObject>
29039    if (parent.name === 'foreignobject') { return html; }
29040
29041    // ...or inherit from the parent node
29042    return parent.node.namespaceURI;
29043  }
29044
29045  return element.ractive.el.namespaceURI;
29046}
29047
29048function delegateHandler(ev) {
29049  var name = ev.type;
29050  var end = ev.currentTarget;
29051  var endEl = end._ractive && end._ractive.proxy;
29052  var node = ev.target;
29053  var bubble = true;
29054  var listeners;
29055
29056  // starting with the origin node, walk up the DOM looking for ractive nodes with a matching event listener
29057  while (bubble && node && node !== end) {
29058    var proxy = node._ractive && node._ractive.proxy;
29059    if (proxy && proxy.up.delegate === endEl && shouldFire(ev, node, end)) {
29060      listeners = proxy.listeners && proxy.listeners[name];
29061
29062      if (listeners) {
29063        var len = listeners.length;
29064        for (var i = 0; i < len; i++) { bubble = listeners[i].call(node, ev) !== false && bubble; }
29065      }
29066    }
29067
29068    node = node.parentNode || node.correspondingUseElement; // SVG with a <use> element in certain environments
29069  }
29070
29071  return bubble;
29072}
29073
29074var UIEvent = win !== null ? win.UIEvent : null;
29075function shouldFire(event, start, end) {
29076  if (UIEvent && event instanceof UIEvent) {
29077    var node = start;
29078    while (node && node !== end) {
29079      if (node.disabled) { return false; }
29080      node = node.parentNode || node.correspondingUseElement;
29081    }
29082  }
29083
29084  return true;
29085}
29086
29087function handler(ev) {
29088  var this$1 = this;
29089
29090  var el = this._ractive.proxy;
29091  var listeners;
29092  if (el.listeners && (listeners = el.listeners[ev.type])) {
29093    var len = listeners.length;
29094    for (var i = 0; i < len; i++) { listeners[i].call(this$1, ev); }
29095  }
29096}
29097
29098var Form = (function (Element) {
29099  function Form(options) {
29100    Element.call(this, options);
29101    this.formBindings = [];
29102  }
29103
29104  if ( Element ) Form.__proto__ = Element;
29105  var Form__proto__ = Form.prototype = Object.create( Element && Element.prototype );
29106  Form__proto__.constructor = Form;
29107
29108  Form__proto__.render = function render (target, occupants) {
29109    Element.prototype.render.call(this, target, occupants);
29110    this.on('reset', handleReset);
29111  };
29112
29113  Form__proto__.unrender = function unrender (shouldDestroy) {
29114    this.off('reset', handleReset);
29115    Element.prototype.unrender.call(this, shouldDestroy);
29116  };
29117
29118  return Form;
29119}(Element));
29120
29121function handleReset() {
29122  var element = this._ractive.proxy;
29123
29124  runloop.start();
29125  element.formBindings.forEach(updateModel);
29126  runloop.end();
29127}
29128
29129function updateModel(binding) {
29130  binding.model.set(binding.resetValue);
29131}
29132
29133var DOMEvent = function DOMEvent(name, owner) {
29134  if (name.indexOf('*') !== -1) {
29135    fatal(
29136      ("Only component proxy-events may contain \"*\" wildcards, <" + (owner.name) + " on-" + name + "=\"...\"/> is not valid")
29137    );
29138  }
29139
29140  this.name = name;
29141  this.owner = owner;
29142  this.handler = null;
29143};
29144var DOMEvent__proto__ = DOMEvent.prototype;
29145
29146DOMEvent__proto__.bind = function bind () {};
29147
29148DOMEvent__proto__.render = function render (directive) {
29149    var this$1 = this;
29150
29151  var name = this.name;
29152
29153  var register = function () {
29154    var node = this$1.owner.node;
29155
29156    this$1.owner.on(
29157      name,
29158      (this$1.handler = function (event) {
29159        return directive.fire({
29160          node: node,
29161          original: event,
29162          event: event,
29163          name: name
29164        });
29165      })
29166    );
29167  };
29168
29169  if (name !== 'load') {
29170    // schedule events so that they take place after twoway binding
29171    runloop.scheduleTask(register, true);
29172  } else {
29173    // unless its a load event
29174    register();
29175  }
29176};
29177
29178DOMEvent__proto__.unbind = function unbind () {};
29179
29180DOMEvent__proto__.unrender = function unrender () {
29181  if (this.handler) { this.owner.off(this.name, this.handler); }
29182};
29183
29184var CustomEvent = function CustomEvent(eventPlugin, owner, name, args) {
29185  this.eventPlugin = eventPlugin;
29186  this.owner = owner;
29187  this.name = name;
29188  this.handler = null;
29189  this.args = args;
29190};
29191var CustomEvent__proto__ = CustomEvent.prototype;
29192
29193CustomEvent__proto__.bind = function bind () {};
29194
29195CustomEvent__proto__.render = function render (directive) {
29196    var this$1 = this;
29197
29198  runloop.scheduleTask(function () {
29199    var node = this$1.owner.node;
29200
29201    this$1.handler = this$1.eventPlugin.apply(
29202      this$1.owner.ractive,
29203      [
29204        node,
29205        function (event) {
29206            if ( event === void 0 ) event = {};
29207
29208          if (event.original) { event.event = event.original; }
29209          else { event.original = event.event; }
29210
29211          event.name = this$1.name;
29212          event.node = event.node || node;
29213          return directive.fire(event);
29214        }
29215      ].concat(this$1.args || [])
29216    );
29217  });
29218};
29219
29220CustomEvent__proto__.unbind = function unbind () {};
29221
29222CustomEvent__proto__.unrender = function unrender () {
29223  this.handler.teardown();
29224};
29225
29226var RactiveEvent = function RactiveEvent(component, name) {
29227  this.component = component;
29228  this.name = name;
29229  this.handler = null;
29230};
29231var RactiveEvent__proto__ = RactiveEvent.prototype;
29232
29233RactiveEvent__proto__.bind = function bind (directive) {
29234  var ractive = this.component.instance;
29235
29236  this.handler = ractive.on(this.name, function () {
29237      var args = [], len = arguments.length;
29238      while ( len-- ) args[ len ] = arguments[ len ];
29239
29240    // watch for reproxy
29241    if (args[0] instanceof Context) {
29242      var ctx = args.shift();
29243      ctx.component = ractive;
29244      directive.fire(ctx, args);
29245    } else {
29246      directive.fire({}, args);
29247    }
29248
29249    // cancel bubbling
29250    return false;
29251  });
29252};
29253
29254RactiveEvent__proto__.render = function render () {};
29255
29256RactiveEvent__proto__.unbind = function unbind () {
29257  this.handler.cancel();
29258};
29259
29260RactiveEvent__proto__.unrender = function unrender () {};
29261
29262var specialPattern = /^(event|arguments|@node|@event|@context)(\..+)?$/;
29263var dollarArgsPattern = /^\$(\d+)(\..+)?$/;
29264
29265var EventDirective = function EventDirective(options) {
29266  this.owner = options.owner || options.up.owner || findElement(options.up);
29267  this.element = this.owner.attributeByName ? this.owner : findElement(options.up, true);
29268  this.template = options.template;
29269  this.up = options.up;
29270  this.ractive = options.up.ractive;
29271  this.events = [];
29272};
29273var EventDirective__proto__ = EventDirective.prototype;
29274
29275EventDirective__proto__.bind = function bind () {
29276    var this$1 = this;
29277
29278  // sometimes anchors will cause an unbind without unrender
29279  if (this.events.length) {
29280    this.events.forEach(function (e) { return e.unrender(); });
29281    this.events = [];
29282  }
29283
29284  if (this.element.type === COMPONENT || this.element.type === ANCHOR) {
29285    this.template.n.forEach(function (n) {
29286      this$1.events.push(new RactiveEvent(this$1.element, n));
29287    });
29288  } else {
29289    var args;
29290    if ((args = this.template.a)) {
29291      var rs = args.r.map(function (r) {
29292        var model = resolveReference(this$1.up, r);
29293        return model ? model.get() : undefined;
29294      });
29295      try {
29296        args = getFunction(args.s, rs.length).apply(null, rs);
29297      } catch (err) {
29298        args = null;
29299        warnIfDebug(
29300          ("Failed to compute args for event on-" + (this.template.n.join('- ')) + ": " + (err.message ||
29301            err))
29302        );
29303      }
29304    }
29305
29306    this.template.n.forEach(function (n) {
29307      var fn = findInViewHierarchy('events', this$1.ractive, n);
29308      if (fn) {
29309        this$1.events.push(new CustomEvent(fn, this$1.element, n, args));
29310      } else {
29311        this$1.events.push(new DOMEvent(n, this$1.element));
29312      }
29313    });
29314  }
29315
29316  // method calls
29317  this.models = null;
29318
29319  addToArray(this.element.events || (this.element.events = []), this);
29320
29321  setupArgsFn(this, this.template);
29322  if (!this.fn) { this.action = this.template.f; }
29323
29324  this.events.forEach(function (e) { return e.bind(this$1); });
29325};
29326
29327EventDirective__proto__.destroyed = function destroyed () {
29328  this.events.forEach(function (e) { return e.unrender(); });
29329};
29330
29331EventDirective__proto__.fire = function fire (event, args) {
29332    var this$1 = this;
29333    if ( args === void 0 ) args = [];
29334
29335  var context =
29336    event instanceof Context && event.refire ? event : this.element.getContext(event);
29337
29338  if (this.fn) {
29339    var values = [];
29340
29341    var models = resolveArgs(this, this.template, this.up, {
29342      specialRef: function specialRef(ref) {
29343        var specialMatch = specialPattern.exec(ref);
29344        if (specialMatch) {
29345          // on-click="foo(event.node)"
29346          return {
29347            special: specialMatch[1],
29348            keys: specialMatch[2] ? splitKeypath(specialMatch[2].substr(1)) : []
29349          };
29350        }
29351
29352        var dollarMatch = dollarArgsPattern.exec(ref);
29353        if (dollarMatch) {
29354          // on-click="foo($1)"
29355          return {
29356            special: 'arguments',
29357            keys: [dollarMatch[1] - 1].concat(
29358              dollarMatch[2] ? splitKeypath(dollarMatch[2].substr(1)) : []
29359            )
29360          };
29361        }
29362      }
29363    });
29364
29365    if (models) {
29366      models.forEach(function (model) {
29367        if (!model) { return values.push(undefined); }
29368
29369        if (model.special) {
29370          var which = model.special;
29371          var obj;
29372
29373          if (which === '@node') {
29374            obj = this$1.element.node;
29375          } else if (which === '@event') {
29376            obj = event && event.event;
29377          } else if (which === 'event') {
29378            warnOnceIfDebug(
29379              "The event reference available to event directives is deprecated and should be replaced with @context and @event"
29380            );
29381            obj = context;
29382          } else if (which === '@context') {
29383            obj = context;
29384          } else {
29385            obj = args;
29386          }
29387
29388          var keys = model.keys.slice();
29389
29390          while (obj && keys.length) { obj = obj[keys.shift()]; }
29391          return values.push(obj);
29392        }
29393
29394        if (model.wrapper) {
29395          return values.push(model.wrapperValue);
29396        }
29397
29398        values.push(model.get());
29399      });
29400    }
29401
29402    // make event available as `this.event`
29403    var ractive = this.ractive;
29404    var oldEvent = ractive.event;
29405
29406    ractive.event = context;
29407    var returned = this.fn.apply(ractive, values);
29408    var result = returned.pop();
29409
29410    // Auto prevent and stop if return is explicitly false
29411    if (result === false) {
29412      var original = event ? event.original : undefined;
29413      if (original) {
29414        original.preventDefault && original.preventDefault();
29415        original.stopPropagation && original.stopPropagation();
29416      } else {
29417        warnOnceIfDebug(
29418          ("handler '" + (this.template.n.join(
29419            ' '
29420          )) + "' returned false, but there is no event available to cancel")
29421        );
29422      }
29423    } else if (!returned.length && isArray(result) && isString(result[0])) {
29424      // watch for proxy events
29425      result = fireEvent(this.ractive, result.shift(), context, result);
29426    }
29427
29428    ractive.event = oldEvent;
29429
29430    return result;
29431  } else {
29432    return fireEvent(this.ractive, this.action, context, args);
29433  }
29434};
29435
29436EventDirective__proto__.handleChange = function handleChange () {};
29437
29438EventDirective__proto__.render = function render () {
29439    var this$1 = this;
29440
29441  this.events.forEach(function (e) { return e.render(this$1); });
29442};
29443
29444EventDirective__proto__.toString = function toString () {
29445  return '';
29446};
29447
29448EventDirective__proto__.unbind = function unbind (view) {
29449  removeFromArray(this.element.events, this);
29450  this.events.forEach(function (e) { return e.unbind(view); });
29451};
29452
29453EventDirective__proto__.unrender = function unrender () {
29454  this.events.forEach(function (e) { return e.unrender(); });
29455};
29456
29457var proto$3 = EventDirective.prototype;
29458proto$3.firstNode = proto$3.rebound = proto$3.update = noop;
29459
29460function progressiveText(item, target, occupants, text) {
29461  if (occupants) {
29462    var n = occupants[0];
29463    if (n && n.nodeType === 3) {
29464      var idx = n.nodeValue.indexOf(text);
29465      occupants.shift();
29466
29467      if (idx === 0) {
29468        if (n.nodeValue.length !== text.length) {
29469          occupants.unshift(n.splitText(text.length));
29470        }
29471      } else {
29472        n.nodeValue = text;
29473      }
29474    } else {
29475      n = item.node = doc.createTextNode(text);
29476      if (occupants[0]) {
29477        target.insertBefore(n, occupants[0]);
29478      } else {
29479        target.appendChild(n);
29480      }
29481    }
29482
29483    item.node = n;
29484  } else {
29485    if (!item.node) { item.node = doc.createTextNode(text); }
29486    target.appendChild(item.node);
29487  }
29488}
29489
29490var ComputationChild = (function (Model) {
29491  function ComputationChild(parent, key) {
29492    Model.call(this, parent, key);
29493
29494    this.isReadonly = !this.root.ractive.syncComputedChildren;
29495    this.dirty = true;
29496    this.isComputed = true;
29497  }
29498
29499  if ( Model ) ComputationChild.__proto__ = Model;
29500  var ComputationChild__proto__ = ComputationChild.prototype = Object.create( Model && Model.prototype );
29501  ComputationChild__proto__.constructor = ComputationChild;
29502
29503  var prototypeAccessors$1 = { setRoot: {} };
29504
29505  prototypeAccessors$1.setRoot.get = function () {
29506    return this.parent.setRoot;
29507  };
29508
29509  ComputationChild__proto__.applyValue = function applyValue (value) {
29510    Model.prototype.applyValue.call(this, value);
29511
29512    if (!this.isReadonly) {
29513      var source = this.parent;
29514      // computed models don't have a shuffle method
29515      while (source && source.shuffle) {
29516        source = source.parent;
29517      }
29518
29519      if (source) {
29520        source.dependencies.forEach(mark);
29521      }
29522    }
29523
29524    if (this.setRoot) {
29525      this.setRoot.set(this.setRoot.value);
29526    }
29527  };
29528
29529  ComputationChild__proto__.get = function get (shouldCapture, opts) {
29530    if (shouldCapture) { capture(this); }
29531
29532    if (this.dirty) {
29533      this.dirty = false;
29534      var parentValue = this.parent.get();
29535      this.value = parentValue ? parentValue[this.key] : undefined;
29536      if (this.wrapper) { this.newWrapperValue = this.value; }
29537      this.adapt();
29538    }
29539
29540    return (opts && 'unwrap' in opts ? opts.unwrap !== false : shouldCapture) && this.wrapper
29541      ? this.wrapperValue
29542      : this.value;
29543  };
29544
29545  ComputationChild__proto__.handleChange = function handleChange$2 () {
29546    if (this.dirty) { return; }
29547    this.dirty = true;
29548
29549    if (this.boundValue) { this.boundValue = null; }
29550
29551    this.links.forEach(marked);
29552    this.deps.forEach(handleChange);
29553    this.children.forEach(handleChange);
29554  };
29555
29556  ComputationChild__proto__.joinKey = function joinKey (key) {
29557    if (isUndefined(key) || key === '') { return this; }
29558
29559    if (!hasOwn(this.childByKey, key)) {
29560      var child = new ComputationChild(this, key);
29561      this.children.push(child);
29562      this.childByKey[key] = child;
29563    }
29564
29565    return this.childByKey[key];
29566  };
29567
29568  Object.defineProperties( ComputationChild__proto__, prototypeAccessors$1 );
29569
29570  return ComputationChild;
29571}(Model));
29572
29573/* global console */
29574/* eslint no-console:"off" */
29575
29576var Computation = (function (Model) {
29577  function Computation(parent, signature, key) {
29578    Model.call(this, parent, key);
29579
29580    this.signature = signature;
29581
29582    this.isReadonly = !this.signature.setter;
29583    this.isComputed = true;
29584
29585    this.dependencies = [];
29586
29587    this.children = [];
29588    this.childByKey = {};
29589
29590    this.deps = [];
29591
29592    this.dirty = true;
29593
29594    // TODO: is there a less hackish way to do this?
29595    this.shuffle = undefined;
29596  }
29597
29598  if ( Model ) Computation.__proto__ = Model;
29599  var Computation__proto__ = Computation.prototype = Object.create( Model && Model.prototype );
29600  Computation__proto__.constructor = Computation;
29601
29602  var prototypeAccessors$2 = { setRoot: {} };
29603
29604  prototypeAccessors$2.setRoot.get = function () {
29605    if (this.signature.setter) { return this; }
29606  };
29607
29608  Computation__proto__.get = function get (shouldCapture, opts) {
29609    if (shouldCapture) { capture(this); }
29610
29611    if (this.dirty) {
29612      this.dirty = false;
29613      var old = this.value;
29614      this.value = this.getValue();
29615      // this may cause a view somewhere to update, so it must be in a runloop
29616      if (!runloop.active()) {
29617        runloop.start();
29618        if (!isEqual(old, this.value)) { this.notifyUpstream(); }
29619        runloop.end();
29620      } else {
29621        if (!isEqual(old, this.value)) { this.notifyUpstream(); }
29622      }
29623      if (this.wrapper) { this.newWrapperValue = this.value; }
29624      this.adapt();
29625    }
29626
29627    // if capturing, this value needs to be unwrapped because it's for external use
29628    return maybeBind(
29629      this,
29630      // if unwrap is supplied, it overrides capture
29631      this.wrapper && (opts && 'unwrap' in opts ? opts.unwrap !== false : shouldCapture)
29632        ? this.wrapperValue
29633        : this.value,
29634      !opts || opts.shouldBind !== false
29635    );
29636  };
29637
29638  Computation__proto__.getContext = function getContext () {
29639    return this.parent.isRoot ? this.root.ractive : this.parent.get(false, noVirtual);
29640  };
29641
29642  Computation__proto__.getValue = function getValue () {
29643    startCapturing();
29644    var result;
29645
29646    try {
29647      result = this.signature.getter.call(this.root.ractive, this.getContext());
29648    } catch (err) {
29649      warnIfDebug(("Failed to compute " + (this.getKeypath()) + ": " + (err.message || err)));
29650
29651      // TODO this is all well and good in Chrome, but...
29652      // ...also, should encapsulate this stuff better, and only
29653      // show it if Ractive.DEBUG
29654      if (hasConsole) {
29655        if (console.groupCollapsed)
29656          { console.groupCollapsed(
29657            '%cshow details',
29658            'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;'
29659          ); }
29660        var sig = this.signature;
29661        console.error(
29662          ((err.name) + ": " + (err.message) + "\n\n" + (sig.getterString) + (sig.getterUseStack ? '\n\n' + err.stack : ''))
29663        );
29664        if (console.groupCollapsed) { console.groupEnd(); }
29665      }
29666    }
29667
29668    var dependencies = stopCapturing();
29669    this.setDependencies(dependencies);
29670
29671    return result;
29672  };
29673
29674  Computation__proto__.mark = function mark () {
29675    this.handleChange();
29676  };
29677
29678  Computation__proto__.rebind = function rebind (next, previous) {
29679    // computations will grab all of their deps again automagically
29680    if (next !== previous) { this.handleChange(); }
29681  };
29682
29683  Computation__proto__.set = function set (value) {
29684    if (this.isReadonly) {
29685      throw new Error(("Cannot set read-only computed value '" + (this.key) + "'"));
29686    }
29687
29688    this.signature.setter(value);
29689    this.mark();
29690  };
29691
29692  Computation__proto__.setDependencies = function setDependencies (dependencies) {
29693    var this$1 = this;
29694
29695    // unregister any soft dependencies we no longer have
29696    var i = this.dependencies.length;
29697    while (i--) {
29698      var model = this$1.dependencies[i];
29699      if (!~dependencies.indexOf(model)) { model.unregister(this$1); }
29700    }
29701
29702    // and add any new ones
29703    i = dependencies.length;
29704    while (i--) {
29705      var model$1 = dependencies[i];
29706      if (!~this$1.dependencies.indexOf(model$1)) { model$1.register(this$1); }
29707    }
29708
29709    this.dependencies = dependencies;
29710  };
29711
29712  Computation__proto__.teardown = function teardown () {
29713    var this$1 = this;
29714
29715    var i = this.dependencies.length;
29716    while (i--) {
29717      if (this$1.dependencies[i]) { this$1.dependencies[i].unregister(this$1); }
29718    }
29719    if (this.parent.computed[this.key] === this) { delete this.parent.computed[this.key]; }
29720    Model.prototype.teardown.call(this);
29721  };
29722
29723  Object.defineProperties( Computation__proto__, prototypeAccessors$2 );
29724
29725  return Computation;
29726}(Model));
29727
29728var prototype = Computation.prototype;
29729var child = ComputationChild.prototype;
29730prototype.handleChange = child.handleChange;
29731prototype.joinKey = child.joinKey;
29732
29733shared$1.Computation = Computation;
29734
29735var ExpressionProxy = (function (Model) {
29736  function ExpressionProxy(fragment, template) {
29737    var this$1 = this;
29738
29739    Model.call(this, fragment.ractive.viewmodel, null);
29740
29741    this.fragment = fragment;
29742    this.template = template;
29743
29744    this.isReadonly = true;
29745    this.isComputed = true;
29746    this.dirty = true;
29747
29748    this.fn =
29749      fragment.ractive.allowExpressions === false
29750        ? noop
29751        : getFunction(template.s, template.r.length);
29752
29753    this.models = this.template.r.map(function (ref) {
29754      return resolveReference(this$1.fragment, ref);
29755    });
29756    this.dependencies = [];
29757
29758    this.shuffle = undefined;
29759
29760    this.bubble();
29761  }
29762
29763  if ( Model ) ExpressionProxy.__proto__ = Model;
29764  var ExpressionProxy__proto__ = ExpressionProxy.prototype = Object.create( Model && Model.prototype );
29765  ExpressionProxy__proto__.constructor = ExpressionProxy;
29766
29767  ExpressionProxy__proto__.bubble = function bubble (actuallyChanged) {
29768    if ( actuallyChanged === void 0 ) actuallyChanged = true;
29769
29770    // refresh the keypath
29771    this.keypath = undefined;
29772
29773    if (actuallyChanged) {
29774      this.handleChange();
29775    }
29776  };
29777
29778  ExpressionProxy__proto__.getKeypath = function getKeypath () {
29779    var this$1 = this;
29780
29781    if (!this.template) { return '@undefined'; }
29782    if (!this.keypath) {
29783      this.keypath =
29784        '@' +
29785        this.template.s.replace(/_(\d+)/g, function (match, i) {
29786          if (i >= this$1.models.length) { return match; }
29787
29788          var model = this$1.models[i];
29789          return model ? model.getKeypath() : '@undefined';
29790        });
29791    }
29792
29793    return this.keypath;
29794  };
29795
29796  ExpressionProxy__proto__.getValue = function getValue () {
29797    var this$1 = this;
29798
29799    startCapturing();
29800    var result;
29801
29802    try {
29803      var params = this.models.map(function (m) { return (m ? m.get(true) : undefined); });
29804      result = this.fn.apply(this.fragment.ractive, params);
29805    } catch (err) {
29806      warnIfDebug(("Failed to compute " + (this.getKeypath()) + ": " + (err.message || err)));
29807    }
29808
29809    var dependencies = stopCapturing();
29810    // remove missing deps
29811    this.dependencies
29812      .filter(function (d) { return !~dependencies.indexOf(d); })
29813      .forEach(function (d) {
29814        d.unregister(this$1);
29815        removeFromArray(this$1.dependencies, d);
29816      });
29817    // register new deps
29818    dependencies
29819      .filter(function (d) { return !~this$1.dependencies.indexOf(d); })
29820      .forEach(function (d) {
29821        d.register(this$1);
29822        this$1.dependencies.push(d);
29823      });
29824
29825    return result;
29826  };
29827
29828  ExpressionProxy__proto__.notifyUpstream = function notifyUpstream () {};
29829
29830  ExpressionProxy__proto__.rebind = function rebind (next, previous, safe) {
29831    var idx = this.models.indexOf(previous);
29832
29833    if (~idx) {
29834      next = rebindMatch(this.template.r[idx], next, previous);
29835      if (next !== previous) {
29836        previous.unregister(this);
29837        this.models.splice(idx, 1, next);
29838        if (next) { next.addShuffleRegister(this, 'mark'); }
29839      }
29840    }
29841    this.bubble(!safe);
29842  };
29843
29844  ExpressionProxy__proto__.rebound = function rebound (update) {
29845    var this$1 = this;
29846
29847    this.models = this.template.r.map(function (ref) { return resolveReference(this$1.fragment, ref); });
29848    if (update) { this.bubble(true); }
29849  };
29850
29851  ExpressionProxy__proto__.retrieve = function retrieve () {
29852    return this.get();
29853  };
29854
29855  ExpressionProxy__proto__.teardown = function teardown () {
29856    var this$1 = this;
29857
29858    this.fragment = undefined;
29859    if (this.dependencies) { this.dependencies.forEach(function (d) { return d.unregister(this$1); }); }
29860    Model.prototype.teardown.call(this);
29861  };
29862
29863  ExpressionProxy__proto__.unreference = function unreference () {
29864    Model.prototype.unreference.call(this);
29865    collect(this);
29866  };
29867
29868  ExpressionProxy__proto__.unregister = function unregister (dep) {
29869    Model.prototype.unregister.call(this, dep);
29870    collect(this);
29871  };
29872
29873  ExpressionProxy__proto__.unregisterLink = function unregisterLink (link) {
29874    Model.prototype.unregisterLink.call(this, link);
29875    collect(this);
29876  };
29877
29878  return ExpressionProxy;
29879}(Model));
29880
29881var prototype$1 = ExpressionProxy.prototype;
29882var computation = Computation.prototype;
29883prototype$1.get = computation.get;
29884prototype$1.handleChange = computation.handleChange;
29885prototype$1.joinKey = computation.joinKey;
29886prototype$1.mark = computation.mark;
29887prototype$1.unbind = noop;
29888
29889function collect(model) {
29890  if (!model.deps.length && !model.refs && !model.links.length) { model.teardown(); }
29891}
29892
29893var ReferenceExpressionProxy = (function (LinkModel) {
29894  function ReferenceExpressionProxy(fragment, template) {
29895    LinkModel.call(this, null, null, null, '@undefined');
29896    this.root = fragment.ractive.viewmodel;
29897    this.template = template;
29898    this.rootLink = true;
29899    this.template = template;
29900    this.fragment = fragment;
29901
29902    this.rebound();
29903  }
29904
29905  if ( LinkModel ) ReferenceExpressionProxy.__proto__ = LinkModel;
29906  var ReferenceExpressionProxy__proto__ = ReferenceExpressionProxy.prototype = Object.create( LinkModel && LinkModel.prototype );
29907  ReferenceExpressionProxy__proto__.constructor = ReferenceExpressionProxy;
29908
29909  ReferenceExpressionProxy__proto__.getKeypath = function getKeypath () {
29910    return this.model ? this.model.getKeypath() : '@undefined';
29911  };
29912
29913  ReferenceExpressionProxy__proto__.rebound = function rebound () {
29914    var this$1 = this;
29915
29916    var fragment = this.fragment;
29917    var template = this.template;
29918
29919    var base = (this.base = resolve(fragment, template));
29920    var idx;
29921
29922    if (this.proxy) {
29923      teardown$2(this);
29924    }
29925
29926    var proxy = (this.proxy = {
29927      rebind: function (next, previous) {
29928        if (previous === base) {
29929          next = rebindMatch(template, next, previous);
29930          if (next !== base) {
29931            this$1.base = base = next;
29932          }
29933        } else if (~(idx = members.indexOf(previous))) {
29934          next = rebindMatch(template.m[idx].n, next, previous);
29935          if (next !== members[idx]) {
29936            members.splice(idx, 1, next || Missing);
29937          }
29938        }
29939
29940        if (next !== previous) {
29941          previous.unregister(proxy);
29942          if (next) { next.addShuffleTask(function () { return next.register(proxy); }); }
29943        }
29944      },
29945      handleChange: function () {
29946        pathChanged();
29947      }
29948    });
29949
29950    base.register(proxy);
29951
29952    var members = (this.members = template.m.map(function (tpl) {
29953      if (isString(tpl)) {
29954        return { get: function () { return tpl; } };
29955      }
29956
29957      var model;
29958
29959      if (tpl.t === REFERENCE) {
29960        model = resolveReference(fragment, tpl.n);
29961        model.register(proxy);
29962
29963        return model;
29964      }
29965
29966      model = new ExpressionProxy(fragment, tpl);
29967      model.register(proxy);
29968      return model;
29969    }));
29970
29971    var pathChanged = function () {
29972      var model = base.joinAll(
29973        members.reduce(function (list, m) {
29974          var k = m.get();
29975          if (isArray(k)) { return list.concat(k); }
29976          else { list.push(escapeKey(String(k))); }
29977          return list;
29978        }, [])
29979      );
29980
29981      if (model !== this$1.model) {
29982        this$1.model = model;
29983        this$1.relinking(model);
29984        fireShuffleTasks();
29985        refreshPathDeps(this$1
vendor: 5,341 bytes, lines 29985-30176
29985);
29986      }
29987    };
29988
29989    pathChanged();
29990  };
29991
29992  ReferenceExpressionProxy__proto__.teardown = function teardown () {
29993    teardown$2(this);
29994    LinkModel.prototype.teardown.call(this);
29995  };
29996
29997  ReferenceExpressionProxy__proto__.unreference = function unreference () {
29998    LinkModel.prototype.unreference.call(this);
29999    if (!this.deps.length && !this.refs) { this.teardown(); }
30000  };
30001
30002  ReferenceExpressionProxy__proto__.unregister = function unregister (dep) {
30003    LinkModel.prototype.unregister.call(this, dep);
30004    if (!this.deps.length && !this.refs) { this.teardown(); }
30005  };
30006
30007  return ReferenceExpressionProxy;
30008}(LinkModel));
30009
30010function teardown$2(proxy) {
30011  if (proxy.base) { proxy.base.unregister(proxy.proxy); }
30012  if (proxy.models) {
30013    proxy.models.forEach(function (m) {
30014      if (m.unregister) { m.unregister(proxy); }
30015    });
30016  }
30017}
30018
30019function refreshPathDeps(proxy) {
30020  var len = proxy.deps.length;
30021  var i, v;
30022
30023  for (i = 0; i < len; i++) {
30024    v = proxy.deps[i];
30025    if (v.pathChanged) { v.pathChanged(); }
30026    if (v.fragment && v.fragment.pathModel) { v.fragment.pathModel.applyValue(proxy.getKeypath()); }
30027  }
30028
30029  len = proxy.children.length;
30030  for (i = 0; i < len; i++) {
30031    refreshPathDeps(proxy.children[i]);
30032  }
30033}
30034
30035var eproto = ExpressionProxy.prototype;
30036var proto$4 = ReferenceExpressionProxy.prototype;
30037
30038proto$4.unreference = eproto.unreference;
30039proto$4.unregister = eproto.unregister;
30040proto$4.unregisterLink = eproto.unregisterLink;
30041
30042function resolve(fragment, template) {
30043  if (template.r) {
30044    return resolveReference(fragment, template.r);
30045  } else if (template.x) {
30046    return new ExpressionProxy(fragment, template.x);
30047  } else if (template.rx) {
30048    return new ReferenceExpressionProxy(fragment, template.rx);
30049  }
30050}
30051
30052var Mustache = (function (Item) {
30053  function Mustache(options) {
30054    Item.call(this, options);
30055
30056    if (options.owner) { this.parent = options.owner; }
30057
30058    this.isStatic = !!options.template.s;
30059
30060    this.model = null;
30061    this.dirty = false;
30062  }
30063
30064  if ( Item ) Mustache.__proto__ = Item;
30065  var Mustache__proto__ = Mustache.prototype = Object.create( Item && Item.prototype );
30066  Mustache__proto__.constructor = Mustache;
30067
30068  Mustache__proto__.bind = function bind (pre) {
30069    // yield mustaches and inner contexts should resolve in container context
30070    var start = this.template.y
30071      ? this.template.y.containerFragment
30072      : this.containerFragment || this.up;
30073    // try to find a model for this view
30074    var model = pre || resolve(start, this.template);
30075
30076    if (model) {
30077      var value = model.get();
30078
30079      if (this.isStatic) {
30080        this.model = { get: function () { return value; } };
30081        model.unreference();
30082        return;
30083      }
30084
30085      model.register(this);
30086      this.model = model;
30087    }
30088  };
30089
30090  Mustache__proto__.handleChange = function handleChange () {
30091    this.bubble();
30092  };
30093
30094  Mustache__proto__.rebind = function rebind (next, previous, safe) {
30095    if (this.isStatic) { return; }
30096
30097    next = rebindMatch(this.template, next, previous, this.up);
30098    if (next === this.model) { return false; }
30099
30100    if (this.model) {
30101      this.model.unregister(this);
30102    }
30103    if (next) { next.addShuffleRegister(this, 'mark'); }
30104    this.model = next;
30105    if (!safe) { this.handleChange(); }
30106    return true;
30107  };
30108
30109  Mustache__proto__.rebound = function rebound (update) {
30110    if (this.model) {
30111      if (this.model.rebound) { this.model.rebound(update); }
30112      else {
30113        // check to see if the model actually changed...
30114        // yield mustaches and inner contexts should resolve in container context
30115        var start = this.template.y
30116          ? this.template.y.containerFragment
30117          : this.containerFragment || this.up;
30118        // try to find a model for this view
30119        var model = resolve(start, this.template);
30120        if (model !== this.model) {
30121          this.model.unregister(this);
30122          this.bind(model);
30123        }
30124      }
30125
30126      if (update) { this.bubble(); }
30127    }
30128    if (this.fragment) { this.fragment.rebound(update); }
30129  };
30130
30131  Mustache__proto__.unbind = function unbind () {
30132    if (!this.isStatic) {
30133      this.model && this.model.unregister(this);
30134      this.model = undefined;
30135    }
30136  };
30137
30138  return Mustache;
30139}(Item));
30140
30141function MustacheContainer(options) {
30142  Mustache.call(this, options);
30143}
30144
30145var proto$5 = (MustacheContainer.prototype = Object.create(ContainerItem.prototype));
30146
30147assign(proto$5, Mustache.prototype, { constructor: MustacheContainer });
30148
30149var Interpolator = (function (Mustache) {
30150  function Interpolator () {
30151    Mustache.apply(this, arguments);
30152  }
30153
30154  if ( Mustache ) Interpolator.__proto__ = Mustache;
30155  var Interpolator__proto__ = Interpolator.prototype = Object.create( Mustache && Mustache.prototype );
30156  Interpolator__proto__.constructor = Interpolator;
30157
30158  Interpolator__proto__.bubble = function bubble () {
30159    if (this.owner) { this.owner.bubble(); }
30160    Mustache.prototype.bubble.call(this);
30161  };
30162
30163  Interpolator__proto__.detach = function detach () {
30164    return detachNode(this.node);
30165  };
30166
30167  Interpolator__proto__.firstNode = function firstNode () {
30168    return this.node;
30169  };
30170
30171  Interpolator__proto__.getString = function getString () {
30172    return this.model ? safeToStringValue(this.model.get()) : '';
30173  };
30174
30175  Interpolator__proto__.render = function render (target, occupants) {
30176    if (inAttributes()) { return; }
vendor: 7,152 bytes, lines 30177-30458
30177    var value = (this.value = this.getString());
30178
30179    this.rendered = true;
30180
30181    progressiveText(this, target, occupants, value);
30182  };
30183
30184  Interpolator__proto__.toString = function toString (escape) {
30185    var string = this.getString();
30186    return escape ? escapeHtml(string) : string;
30187  };
30188
30189  Interpolator__proto__.unrender = function unrender (shouldDestroy) {
30190    if (shouldDestroy) { this.detach(); }
30191    this.rendered = false;
30192  };
30193
30194  Interpolator__proto__.update = function update () {
30195    if (this.dirty) {
30196      this.dirty = false;
30197      if (this.rendered) {
30198        var value = this.getString();
30199        if (value !== this.value) { this.node.data = this.value = value; }
30200      }
30201    }
30202  };
30203
30204  Interpolator__proto__.valueOf = function valueOf () {
30205    return this.model ? this.model.get() : undefined;
30206  };
30207
30208  return Interpolator;
30209}(Mustache));
30210
30211var Input = (function (Element) {
30212  function Input () {
30213    Element.apply(this, arguments);
30214  }
30215
30216  if ( Element ) Input.__proto__ = Element;
30217  var Input__proto__ = Input.prototype = Object.create( Element && Element.prototype );
30218  Input__proto__.constructor = Input;
30219
30220  Input__proto__.render = function render (target, occupants) {
30221    Element.prototype.render.call(this, target, occupants);
30222    this.node.defaultValue = this.node.value;
30223  };
30224  Input__proto__.compare = function compare (value, attrValue) {
30225    var comparator = this.getAttribute('value-comparator');
30226    if (comparator) {
30227      if (isFunction(comparator)) {
30228        return comparator(value, attrValue);
30229      }
30230      if (value && attrValue) {
30231        return value[comparator] == attrValue[comparator];
30232      }
30233    }
30234    return value == attrValue;
30235  };
30236
30237  return Input;
30238}(Element));
30239
30240// simple JSON parser, without the restrictions of JSON parse
30241// (i.e. having to double-quote keys).
30242//
30243// If passed a hash of values as the second argument, ${placeholders}
30244// will be replaced with those values
30245
30246var specials$1 = {
30247  true: true,
30248  false: false,
30249  null: null,
30250  undefined: undefined
30251};
30252
30253var specialsPattern = new RegExp('^(?:' + keys(specials$1).join('|') + ')');
30254var numberPattern$1 = /^(?:[+-]?)(?:(?:(?:0|[1-9]\d*)?\.\d+)|(?:(?:0|[1-9]\d*)\.)|(?:0|[1-9]\d*))(?:[eE][+-]?\d+)?/;
30255var placeholderPattern = /\$\{([^\}]+)\}/g;
30256var placeholderAtStartPattern = /^\$\{([^\}]+)\}/;
30257var onlyWhitespace$1 = /^\s*$/;
30258
30259var JsonParser = Parser.extend({
30260  init: function init(str, options) {
30261    this.values = options.values;
30262    this.sp();
30263  },
30264
30265  postProcess: function postProcess(result) {
30266    if (result.length !== 1 || !onlyWhitespace$1.test(this.leftover)) {
30267      return null;
30268    }
30269
30270    return { value: result[0].v };
30271  },
30272
30273  converters: [
30274    function getPlaceholder(parser) {
30275      if (!parser.values) { return null; }
30276
30277      var placeholder = parser.matchPattern(placeholderAtStartPattern);
30278
30279      if (placeholder && hasOwn(parser.values, placeholder)) {
30280        return { v: parser.values[placeholder] };
30281      }
30282    },
30283
30284    function getSpecial(parser) {
30285      var special = parser.matchPattern(specialsPattern);
30286      if (special) { return { v: specials$1[special] }; }
30287    },
30288
30289    function getNumber(parser) {
30290      var number = parser.matchPattern(numberPattern$1);
30291      if (number) { return { v: +number }; }
30292    },
30293
30294    function getString(parser) {
30295      var stringLiteral = readStringLiteral(parser);
30296      var values = parser.values;
30297
30298      if (stringLiteral && values) {
30299        return {
30300          v: stringLiteral.v.replace(placeholderPattern, function (match, $1) { return $1 in values ? values[$1] : $1; }
30301          )
30302        };
30303      }
30304
30305      return stringLiteral;
30306    },
30307
30308    function getObject(parser) {
30309      if (!parser.matchString('{')) { return null; }
30310
30311      var result = {};
30312
30313      parser.sp();
30314
30315      if (parser.matchString('}')) {
30316        return { v: result };
30317      }
30318
30319      var pair;
30320      while ((pair = getKeyValuePair(parser))) {
30321        result[pair.key] = pair.value;
30322
30323        parser.sp();
30324
30325        if (parser.matchString('}')) {
30326          return { v: result };
30327        }
30328
30329        if (!parser.matchString(',')) {
30330          return null;
30331        }
30332      }
30333
30334      return null;
30335    },
30336
30337    function getArray(parser) {
30338      if (!parser.matchString('[')) { return null; }
30339
30340      var result = [];
30341
30342      parser.sp();
30343
30344      if (parser.matchString(']')) {
30345        return { v: result };
30346      }
30347
30348      var valueToken;
30349      while ((valueToken = parser.read())) {
30350        result.push(valueToken.v);
30351
30352        parser.sp();
30353
30354        if (parser.matchString(']')) {
30355          return { v: result };
30356        }
30357
30358        if (!parser.matchString(',')) {
30359          return null;
30360        }
30361
30362        parser.sp();
30363      }
30364
30365      return null;
30366    }
30367  ]
30368});
30369
30370function getKeyValuePair(parser) {
30371  parser.sp();
30372
30373  var key = readKey(parser);
30374
30375  if (!key) { return null; }
30376
30377  var pair = { key: key };
30378
30379  parser.sp();
30380  if (!parser.matchString(':')) {
30381    return null;
30382  }
30383  parser.sp();
30384
30385  var valueToken = parser.read();
30386
30387  if (!valueToken) { return null; }
30388
30389  pair.value = valueToken.v;
30390  return pair;
30391}
30392
30393function parseJSON(str, values) {
30394  var parser = new JsonParser(str, { values: values });
30395  return parser.result;
30396}
30397
30398var Mapping = (function (Item) {
30399  function Mapping(options) {
30400    Item.call(this, options);
30401
30402    this.name = options.template.n;
30403
30404    this.owner = options.owner || options.up.owner || options.element || findElement(options.up);
30405    this.element =
30406      options.element || (this.owner.attributeByName ? this.owner : findElement(options.up));
30407    this.up = this.element.up; // shared
30408    this.ractive = this.up.ractive;
30409
30410    this.element.attributeByName[this.name] = this;
30411
30412    this.value = options.template.f;
30413  }
30414
30415  if ( Item ) Mapping.__proto__ = Item;
30416  var Mapping__proto__ = Mapping.prototype = Object.create( Item && Item.prototype );
30417  Mapping__proto__.constructor = Mapping;
30418
30419  Mapping__proto__.bind = function bind () {
30420    var template = this.template.f;
30421    var viewmodel = this.element.instance.viewmodel;
30422
30423    if (template === 0) {
30424      // empty attributes are `true`
30425      viewmodel.joinKey(this.name).set(true);
30426    } else if (isString(template)) {
30427      var parsed = parseJSON(template);
30428      viewmodel.joinKey(this.name).set(parsed ? parsed.value : template);
30429    } else if (isArray(template)) {
30430      createMapping(this, true);
30431    }
30432  };
30433
30434  Mapping__proto__.rebound = function rebound (update) {
30435    if (this.boundFragment) { this.boundFragment.rebound(update); }
30436    if (this.link) {
30437      this.model = resolve(this.up, this.template.f[0]);
30438      var model = this.element.instance.viewmodel.joinAll(splitKeypath(this.name));
30439      model.link(this.model, this.name, { mapping: true });
30440    }
30441  };
30442
30443  Mapping__proto__.render = function render () {};
30444
30445  Mapping__proto__.unbind = function unbind (view) {
30446    if (this.model) { this.model.unregister(this); }
30447    if (this.boundFragment) { this.boundFragment.unbind(view); }
30448
30449    if (this.element.bound) {
30450      if (this.link.target === this.model) { this.link.owner.unlink(); }
30451    }
30452  };
30453
30454  Mapping__proto__.unrender = function unrender () {};
30455
30456  Mapping__proto__.update = function update () {
30457    if (this.dirty) {
30458      this.dirty = false;
vendor: 7,206 bytes, lines 30459-30693
30459      if (this.boundFragment) { this.boundFragment.update(); }
30460    }
30461  };
30462
30463  return Mapping;
30464}(Item));
30465
30466function createMapping(item) {
30467  var template = item.template.f;
30468  var viewmodel = item.element.instance.viewmodel;
30469  var childData = viewmodel.value;
30470
30471  if (template.length === 1 && template[0].t === INTERPOLATOR) {
30472    var model = resolve(item.up, template[0]);
30473    var val = model.get(false);
30474
30475    // if the interpolator is not static
30476    if (!template[0].s) {
30477      item.model = model;
30478      item.link = viewmodel.createLink(item.name, model, template[0].r, {
30479        mapping: true
30480      });
30481
30482      // initialize parent side of the mapping from child data
30483      if (isUndefined(val) && !model.isReadonly && item.name in childData) {
30484        model.set(childData[item.name]);
30485      }
30486    } else if (!isObjectType(val) || template[0].x) {
30487      // copy non-object, non-computed vals through
30488      viewmodel.joinKey(splitKeypath(item.name)).set(val);
30489    } else {
30490      // warn about trying to copy an object
30491      warnIfDebug(("Cannot copy non-computed object value from static mapping '" + (item.name) + "'"));
30492    }
30493
30494    // if the item isn't going to manage the model, give it a change to tear down if it's computed
30495    if (model !== item.model) { model.unregister(); }
30496  } else {
30497    item.boundFragment = new Fragment({
30498      owner: item,
30499      template: template
30500    }).bind();
30501
30502    item.model = viewmodel.joinKey(splitKeypath(item.name));
30503    item.model.set(item.boundFragment.valueOf());
30504
30505    // item is a *bit* of a hack
30506    item.boundFragment.bubble = function () {
30507      Fragment.prototype.bubble.call(item.boundFragment);
30508      // defer this to avoid mucking around model deps if there happens to be an expression involved
30509      runloop.scheduleTask(function () {
30510        item.boundFragment.update();
30511        item.model.set(item.boundFragment.valueOf());
30512      });
30513    };
30514  }
30515}
30516
30517var Option = (function (Element) {
30518  function Option(options) {
30519    var template = options.template;
30520    if (!template.a) { template.a = {}; }
30521
30522    // If the value attribute is missing, use the element's content,
30523    // as long as it isn't disabled
30524    if (isUndefined(template.a.value) && !('disabled' in template.a)) {
30525      template.a.value = template.f || '';
30526    }
30527
30528    Element.call(this, options);
30529
30530    this.select = findElement(this.parent || this.up, false, 'select');
30531  }
30532
30533  if ( Element ) Option.__proto__ = Element;
30534  var Option__proto__ = Option.prototype = Object.create( Element && Element.prototype );
30535  Option__proto__.constructor = Option;
30536
30537  Option__proto__.bind = function bind () {
30538    if (!this.select) {
30539      Element.prototype.bind.call(this);
30540      return;
30541    }
30542
30543    // If the select has a value, it overrides the `selected` attribute on
30544    // this option - so we delete the attribute
30545    var selectedAttribute = this.attributeByName.selected;
30546    if (selectedAttribute && this.select.getAttribute('value') !== undefined) {
30547      var index = this.attributes.indexOf(selectedAttribute);
30548      this.attributes.splice(index, 1);
30549      delete this.attributeByName.selected;
30550    }
30551
30552    Element.prototype.bind.call(this);
30553    this.select.options.push(this);
30554  };
30555
30556  Option__proto__.bubble = function bubble () {
30557    // if we're using content as value, may need to update here
30558    var value = this.getAttribute('value');
30559    if (this.node && this.node.value !== value) {
30560      this.node._ractive.value = value;
30561    }
30562    Element.prototype.bubble.call(this);
30563  };
30564
30565  Option__proto__.getAttribute = function getAttribute (name) {
30566    var attribute = this.attributeByName[name];
30567    return attribute
30568      ? attribute.getValue()
30569      : name === 'value' && this.fragment
30570      ? this.fragment.valueOf()
30571      : undefined;
30572  };
30573
30574  Option__proto__.isSelected = function isSelected () {
30575    var this$1 = this;
30576
30577    var optionValue = this.getAttribute('value');
30578
30579    if (isUndefined(optionValue) || !this.select) {
30580      return false;
30581    }
30582
30583    var selectValue = this.select.getAttribute('value');
30584
30585    if (this.select.compare(selectValue, optionValue)) {
30586      return true;
30587    }
30588
30589    if (this.select.getAttribute('multiple') && isArray(selectValue)) {
30590      var i = selectValue.length;
30591      while (i--) {
30592        if (this$1.select.compare(selectValue[i], optionValue)) {
30593          return true;
30594        }
30595      }
30596    }
30597  };
30598
30599  Option__proto__.render = function render (target, occupants) {
30600    Element.prototype.render.call(this, target, occupants);
30601
30602    if (!this.attributeByName.value) {
30603      this.node._ractive.value = this.getAttribute('value');
30604    }
30605  };
30606
30607  Option__proto__.unbind = function unbind (view) {
30608    Element.prototype.unbind.call(this, view);
30609
30610    if (this.select) {
30611      removeFromArray(this.select.options, this);
30612    }
30613  };
30614
30615  return Option;
30616}(Element));
30617
30618function getPartialTemplate(ractive, name, up) {
30619  // If the partial in instance or view heirarchy instances, great
30620  var partial = getPartialFromRegistry(ractive, name, up || {});
30621  if (partial) { return partial; }
30622
30623  // Does it exist on the page as a script tag?
30624  partial = parser.fromId(name, { noThrow: true });
30625  if (partial) {
30626    // parse and register to this ractive instance
30627    var parsed = parser.parseFor(partial, ractive);
30628
30629    // register extra partials on the ractive instance if they don't already exist
30630    if (parsed.p) { fillGaps(ractive.partials, parsed.p); }
30631
30632    // register (and return main partial if there are others in the template)
30633    return (ractive.partials[name] = parsed.t);
30634  }
30635}
30636
30637function getPartialFromRegistry(ractive, name, up) {
30638  // if there was an instance up-hierarchy, cool
30639  var partial = findParentPartial(name, up.owner);
30640  if (partial) { return partial; }
30641
30642  // find first instance in the ractive or view hierarchy that has this partial
30643  var instance = findInstance('partials', ractive, name);
30644
30645  if (!instance) {
30646    return;
30647  }
30648
30649  partial = instance.partials[name];
30650
30651  // partial is a function?
30652  var fn;
30653  if (isFunction(partial)) {
30654    fn = partial;
30655    // super partial
30656    if (fn.styleSet) { return fn; }
30657
30658    fn = partial.bind(instance);
30659    fn.isOwner = hasOwn(instance.partials, name);
30660    partial = fn.call(ractive, parser);
30661  }
30662
30663  if (!partial && partial !== '') {
30664    warnIfDebug(noRegistryFunctionReturn, name, 'partial', 'partial', {
30665      ractive: ractive
30666    });
30667    return;
30668  }
30669
30670  // If this was added manually to the registry,
30671  // but hasn't been parsed, parse it now
30672  if (!parser.isParsed(partial)) {
30673    // use the parseOptions of the ractive instance on which it was found
30674    var parsed = parser.parseFor(partial, instance);
30675
30676    // Partials cannot contain nested partials!
30677    // TODO add a test for this
30678    if (parsed.p) {
30679      warnIfDebug('Partials ({{>%s}}) cannot contain nested inline partials', name, { ractive: ractive });
30680    }
30681
30682    // if fn, use instance to store result, otherwise needs to go
30683    // in the correct point in prototype chain on instance or constructor
30684    var target = fn ? instance : findOwner(instance, name);
30685
30686    // may be a template with partials, which need to be registered and main template extracted
30687    target.partials[name] = partial = parsed.t;
30688  }
30689
30690  // store for reset
30691  if (fn) { partial._fn = fn; }
30692
30693  
vendor: 7,183 bytes, lines 30693-30965
30693return partial.v ? partial.t : partial;
30694}
30695
30696function findOwner(ractive, key) {
30697  return hasOwn(ractive.partials, key) ? ractive : findConstructor(ractive.constructor, key);
30698}
30699
30700function findConstructor(constructor, key) {
30701  if (!constructor) {
30702    return;
30703  }
30704  return hasOwn(constructor.partials, key) ? constructor : findConstructor(constructor.Parent, key);
30705}
30706
30707function findParentPartial(name, parent) {
30708  if (parent) {
30709    if (
30710      parent.template &&
30711      parent.template.p &&
30712      !isArray(parent.template.p) &&
30713      hasOwn(parent.template.p, name)
30714    ) {
30715      return parent.template.p[name];
30716    } else if (parent.up && parent.up.owner) {
30717      return findParentPartial(name, parent.up.owner);
30718    }
30719  }
30720}
30721
30722function Partial(options) {
30723  MustacheContainer.call(this, options);
30724
30725  var tpl = options.template;
30726
30727  // yielder is a special form of partial that will later require special handling
30728  if (tpl.t === YIELDER) {
30729    this.yielder = 1;
30730  } else if (tpl.t === ELEMENT) {
30731    // this is a macro partial, complete with macro constructor
30732    // leaving this as an element will confuse up-template searches
30733    this.type = PARTIAL;
30734    this.macro = options.macro;
30735  }
30736}
30737
30738var proto$6 = (Partial.prototype = create(MustacheContainer.prototype));
30739
30740assign(proto$6, {
30741  constructor: Partial,
30742
30743  bind: function bind() {
30744    var template = this.template;
30745
30746    if (this.yielder) {
30747      // the container is the instance that owns this node
30748      this.container = this.up.ractive;
30749      this.component = this.container.component;
30750      this.containerFragment = this.up;
30751
30752      // normal component
30753      if (this.component) {
30754        // yields skip the owning instance and go straight to the surrounding context
30755        this.up = this.component.up;
30756
30757        // {{yield}} is equivalent to {{yield content}}
30758        if (!template.r && !template.x && !template.rx) { this.refName = 'content'; }
30759      } else {
30760        // plain-ish instance that may be attached to a parent later
30761        this.fragment = new Fragment({
30762          owner: this,
30763          template: []
30764        });
30765        this.fragment.bind();
30766        return;
30767      }
30768    }
30769
30770    // this is a macro/super partial
30771    if (this.macro) {
30772      this.fn = this.macro;
30773    } else {
30774      // this is a plain partial or yielder
30775      if (!this.refName) { this.refName = template.r; }
30776
30777      // if the refName exists as a partial, this is a plain old partial reference where no model binding will happen
30778      if (this.refName) {
30779        partialFromValue(this, this.refName);
30780      }
30781
30782      // this is a dynamic/inline partial
30783      if (!this.partial && !this.fn) {
30784        MustacheContainer.prototype.bind.call(this);
30785        if (this.model) { partialFromValue(this, this.model.get()); }
30786      }
30787    }
30788
30789    if (!this.partial && !this.fn) {
30790      warnOnceIfDebug(("Could not find template for partial '" + (this.name) + "'"));
30791    }
30792
30793    createFragment(this, this.partial || []);
30794
30795    // macro/super partial
30796    if (this.fn) { initMacro(this); }
30797
30798    this.fragment.bind();
30799  },
30800
30801  bubble: function bubble() {
30802    if (!this.dirty) {
30803      this.dirty = true;
30804
30805      if (this.yielder) {
30806        this.containerFragment.bubble();
30807      } else {
30808        this.up.bubble();
30809      }
30810    }
30811  },
30812
30813  findNextNode: function findNextNode() {
30814    return (this.containerFragment || this.up).findNextNode(this);
30815  },
30816
30817  handleChange: function handleChange() {
30818    this.dirtyTemplate = true;
30819    this.externalChange = true;
30820    this.bubble();
30821  },
30822
30823  rebound: function rebound(update) {
30824    var this$1 = this;
30825
30826    if (this._attrs) {
30827      keys(this._attrs).forEach(function (k) { return this$1._attrs[k].rebound(update); });
30828    }
30829    MustacheContainer.prototype.rebound.call(this, update);
30830  },
30831
30832  refreshAttrs: function refreshAttrs() {
30833    var this$1 = this;
30834
30835    keys(this._attrs).forEach(function (k) {
30836      this$1.handle.attributes[k] = !this$1._attrs[k].items.length || this$1._attrs[k].valueOf();
30837    });
30838  },
30839
30840  resetTemplate: function resetTemplate() {
30841    var this$1 = this;
30842
30843    if (this.fn && this.proxy) {
30844      this.last = 0;
30845      if (this.externalChange) {
30846        if (isFunction(this.proxy.teardown)) { this.proxy.teardown(); }
30847        this.fn = this.proxy = null;
30848      } else {
30849        this.partial = this.fnTemplate;
30850        return true;
30851      }
30852    }
30853
30854    this.partial = null;
30855
30856    if (this.refName) {
30857      this.partial = getPartialTemplate(this.ractive, this.refName, this.up);
30858    }
30859
30860    if (!this.partial && this.model) {
30861      partialFromValue(this, this.model.get());
30862    }
30863
30864    if (!this.fn) {
30865      if (this.last && this.partial === this.last) { return false; }
30866      else if (this.partial) {
30867        this.last = this.partial;
30868        contextifyTemplate(this);
30869      }
30870    }
30871
30872    this.unbindAttrs();
30873
30874    if (this.fn) {
30875      initMacro(this);
30876      if (isFunction(this.proxy.render)) { runloop.scheduleTask(function () { return this$1.proxy.render(); }); }
30877    } else if (!this.partial) {
30878      warnOnceIfDebug(("Could not find template for partial '" + (this.name) + "'"));
30879    }
30880
30881    return true;
30882  },
30883
30884  render: function render(target, occupants) {
30885    if (this.fn && this.fn._cssDef && !this.fn._cssDef.applied) { applyCSS(); }
30886
30887    this.fragment.render(target, occupants);
30888
30889    if (this.proxy && isFunction(this.proxy.render)) { this.proxy.render(); }
30890  },
30891
30892  unbind: function unbind(view) {
30893    this.fragment.unbind(view);
30894
30895    this.unbindAttrs(view);
30896
30897    MustacheContainer.prototype.unbind.call(this, view);
30898  },
30899
30900  unbindAttrs: function unbindAttrs(view) {
30901    var this$1 = this;
30902
30903    if (this._attrs) {
30904      keys(this._attrs).forEach(function (k) {
30905        this$1._attrs[k].unbind(view);
30906      });
30907    }
30908  },
30909
30910  unrender: function unrender(shouldDestroy) {
30911    if (this.proxy && isFunction(this.proxy.teardown)) { this.proxy.teardown(); }
30912
30913    this.fragment.unrender(shouldDestroy);
30914  },
30915
30916  update: function update() {
30917    var this$1 = this;
30918
30919    var proxy = this.proxy;
30920    this.updating = 1;
30921
30922    if (this.dirtyAttrs) {
30923      this.dirtyAttrs = false;
30924      keys(this._attrs).forEach(function (k) { return this$1._attrs[k].update(); });
30925      this.refreshAttrs();
30926      if (isFunction(proxy.update)) { proxy.update(this.handle.attributes); }
30927    }
30928
30929    if (this.dirtyTemplate) {
30930      this.dirtyTemplate = false;
30931      this.resetTemplate() && this.fragment.resetTemplate(this.partial || []);
30932    }
30933
30934    if (this.dirty) {
30935      this.dirty = false;
30936      if (proxy && isFunction(proxy.invalidate)) { proxy.invalidate(); }
30937      this.fragment.update();
30938    }
30939
30940    this.externalChange = false;
30941    this.updating = 0;
30942  }
30943});
30944
30945function createFragment(self, partial) {
30946  self.partial = self.last = partial;
30947  contextifyTemplate(self);
30948
30949  var options = {
30950    owner: self,
30951    template: self.partial
30952  };
30953
30954  if (self.yielder) { options.ractive = self.container.parent; }
30955
30956  if (self.fn) { options.cssIds = self.fn._cssIds; }
30957
30958  self.fragment = new Fragment(options);
30959}
30960
30961function contextifyTemplate(self) {
30962  if (self.template.c) {
30963    self.partial = [{ t: SECTION, n: SECTION_WITH, f: self.partial, z: self.template.z }];
30964    assign(self.partial[0], self.template.c);
30965    if (self.yielder) { self.partial[0].y = self
vendor: 11,552 bytes, lines 30965-31371
30965; }
30966  }
30967}
30968
30969function partialFromValue(self, value, okToParse) {
30970  var tpl = value;
30971
30972  if (isArray(tpl)) {
30973    self.partial = tpl;
30974  } else if (tpl && isObjectType(tpl)) {
30975    if (isArray(tpl.t)) { self.partial = tpl.t; }
30976    else if (isString(tpl.template))
30977      { self.partial = parsePartial(tpl.template, tpl.template, self.ractive).t; }
30978  } else if (isFunction(tpl) && tpl.styleSet) {
30979    self.fn = tpl;
30980    if (self.fragment) { self.fragment.cssIds = tpl._cssIds; }
30981  } else if (tpl != null) {
30982    tpl = getPartialTemplate(self.ractive, '' + tpl, self.containerFragment || self.up);
30983    if (tpl) {
30984      self.name = value;
30985      if (tpl.styleSet) {
30986        self.fn = tpl;
30987        if (self.fragment) { self.fragment.cssIds = tpl._cssIds; }
30988      } else { self.partial = tpl; }
30989    } else if (okToParse) {
30990      self.partial = parsePartial('' + value, '' + value, self.ractive).t;
30991    } else {
30992      self.name = value;
30993    }
30994  }
30995
30996  return self.partial;
30997}
30998
30999function setTemplate(template) {
31000  partialFromValue(this, template, true);
31001
31002  if (!this.initing) {
31003    this.dirtyTemplate = true;
31004    this.fnTemplate = this.partial;
31005
31006    if (this.updating) {
31007      this.bubble();
31008      runloop.promise();
31009    } else {
31010      var promise = runloop.start();
31011
31012      this.bubble();
31013      runloop.end();
31014
31015      return promise;
31016    }
31017  }
31018}
31019
31020function aliasLocal(ref, name) {
31021  var aliases = this.fragment.aliases || (this.fragment.aliases = {});
31022  if (!name) {
31023    aliases[ref] = this._data;
31024  } else {
31025    aliases[name] = this._data.joinAll(splitKeypath(ref));
31026  }
31027}
31028
31029var extras = 'extra-attributes';
31030
31031function initMacro(self) {
31032  var fn = self.fn;
31033  var fragment = self.fragment;
31034
31035  // defensively copy the template in case it changes
31036  var template = (self.template = assign({}, self.template));
31037  var handle = (self.handle = fragment.getContext({
31038    proxy: self,
31039    aliasLocal: aliasLocal,
31040    name: self.template.e || self.name,
31041    attributes: {},
31042    setTemplate: setTemplate.bind(self),
31043    template: template,
31044    macro: fn
31045  }));
31046
31047  if (!template.p) { template.p = {}; }
31048  template.p = handle.partials = assign({}, template.p);
31049  if (!hasOwn(template.p, 'content')) { template.p.content = template.f || []; }
31050
31051  if (isArray(fn.attributes)) {
31052    self._attrs = {};
31053
31054    var invalidate = function() {
31055      this.dirty = true;
31056      self.dirtyAttrs = true;
31057      self.bubble();
31058    };
31059
31060    if (isArray(template.m)) {
31061      var attrs = template.m;
31062      template.p[extras] = template.m = attrs.filter(function (a) { return !~fn.attributes.indexOf(a.n); });
31063      attrs
31064        .filter(function (a) { return ~fn.attributes.indexOf(a.n); })
31065        .forEach(function (a) {
31066          var fragment = new Fragment({
31067            template: a.f,
31068            owner: self
31069          });
31070          fragment.bubble = invalidate;
31071          fragment.findFirstNode = noop;
31072          self._attrs[a.n] = fragment;
31073        });
31074    } else {
31075      template.p[extras] = [];
31076    }
31077  } else {
31078    template.p[extras] = template.m;
31079  }
31080
31081  if (self._attrs) {
31082    keys(self._attrs).forEach(function (k) {
31083      self._attrs[k].bind();
31084    });
31085    self.refreshAttrs();
31086  }
31087
31088  self.initing = 1;
31089  self.proxy = fn.call(self.ractive, handle, handle.attributes) || {};
31090  if (!self.partial) { self.partial = []; }
31091  self.fnTemplate = self.partial;
31092  self.initing = 0;
31093
31094  contextifyTemplate(self);
31095  fragment.resetTemplate(self.partial);
31096}
31097
31098function parsePartial(name, partial, ractive) {
31099  var parsed;
31100
31101  try {
31102    parsed = parser.parse(partial, parser.getParseOptions(ractive));
31103  } catch (e) {
31104    warnIfDebug(("Could not parse partial from expression '" + name + "'\n" + (e.message)));
31105  }
31106
31107  return parsed || { t: [] };
31108}
31109
31110var KeyModel = function KeyModel(value, context, instance) {
31111  this.value = this.key = value;
31112  this.context = context;
31113  this.isReadonly = this.isKey = true;
31114  this.deps = [];
31115  this.links = [];
31116  this.children = [];
31117  this.instance = instance;
31118};
31119var KeyModel__proto__ = KeyModel.prototype;
31120
31121KeyModel__proto__.applyValue = function applyValue (value) {
31122  if (value !== this.value) {
31123    this.value = this.key = value;
31124    this.deps.forEach(handleChange);
31125    this.links.forEach(handleChange);
31126    this.children.forEach(function (c) {
31127      c.applyValue(c.context.getKeypath(c.instance));
31128    });
31129  }
31130};
31131
31132KeyModel__proto__.destroyed = function destroyed () {
31133  if (this.upstream) { this.upstream.unregisterChild(this); }
31134};
31135
31136KeyModel__proto__.get = function get (shouldCapture) {
31137  if (shouldCapture) { capture(this); }
31138  return unescapeKey(this.value);
31139};
31140
31141KeyModel__proto__.getKeypath = function getKeypath () {
31142  return unescapeKey(this.value);
31143};
31144
31145KeyModel__proto__.has = function has () {
31146  return false;
31147};
31148
31149KeyModel__proto__.rebind = function rebind (next, previous) {
31150    var this$1 = this;
31151
31152  var i = this.deps.length;
31153  while (i--) { this$1.deps[i].rebind(next, previous, false); }
31154
31155  i = this.links.length;
31156  while (i--) { this$1.links[i].relinking(next, false); }
31157};
31158
31159KeyModel__proto__.register = function register (dependant) {
31160  this.deps.push(dependant);
31161};
31162
31163KeyModel__proto__.registerChild = function registerChild (child) {
31164  addToArray(this.children, child);
31165  child.upstream = this;
31166};
31167
31168KeyModel__proto__.registerLink = function registerLink (link) {
31169  addToArray(this.links, link);
31170};
31171
31172KeyModel__proto__.unregister = function unregister (dependant) {
31173  removeFromArray(this.deps, dependant);
31174};
31175
31176KeyModel__proto__.unregisterChild = function unregisterChild (child) {
31177  removeFromArray(this.children, child);
31178};
31179
31180KeyModel__proto__.unregisterLink = function unregisterLink (link) {
31181  removeFromArray(this.links, link);
31182};
31183
31184KeyModel.prototype.reference = noop;
31185KeyModel.prototype.unreference = noop;
31186
31187var keypathString = /^"(\\"|[^"])+"$/;
31188
31189var RepeatedFragment = function RepeatedFragment(options) {
31190  this.parent = options.owner.up;
31191
31192  // bit of a hack, so reference resolution works without another
31193  // layer of indirection
31194  this.up = this;
31195  this.owner = options.owner;
31196  this.ractive = this.parent.ractive;
31197  this.delegate =
31198    this.ractive.delegate !== false && (this.parent.delegate || findDelegate(this.parent));
31199  // delegation disabled by directive
31200  if (this.delegate && this.delegate.delegate === false) { this.delegate = false; }
31201  // let the element know it's a delegate handler
31202  if (this.delegate) { this.delegate.delegate = this.delegate; }
31203
31204  // encapsulated styles should be inherited until they get applied by an element
31205  this.cssIds = 'cssIds' in options ? options.cssIds : this.parent ? this.parent.cssIds : null;
31206
31207  this.context = null;
31208  this.rendered = false;
31209  this.iterations = [];
31210
31211  this.template = options.template;
31212
31213  this.indexRef = options.indexRef;
31214  this.keyRef = options.keyRef;
31215
31216  this.pendingNewIndices = null;
31217  this.previousIterations = null;
31218
31219  // track array versus object so updates of type rest
31220  this.isArray = false;
31221};
31222var RepeatedFragment__proto__ = RepeatedFragment.prototype;
31223
31224RepeatedFragment__proto__.bind = function bind (context) {
31225    var this$1 = this;
31226
31227  this.context = context;
31228  this.bound = true;
31229  var value = context.get();
31230
31231  var aliases = (this.aliases = this.owner.template.z && this.owner.template.z.slice());
31232
31233  var shuffler = aliases && aliases.find(function (a) { return a.n === 'shuffle'; });
31234  if (shuffler && shuffler.x && shuffler.x.x) {
31235    if (shuffler.x.x.s === 'true') { this.shuffler = true; }
31236    else if (keypathString.test(shuffler.x.x.s))
31237      { this.shuffler = splitKeypath(shuffler.x.x.s.slice(1, -1)); }
31238  }
31239
31240  if (this.shuffler) { this.values = shuffleValues(this, this.shuffler); }
31241
31242  if (this.source) { this.source.model.unbind(this.source); }
31243  var source = context.isComputed && aliases && aliases.find(function (a) { return a.n === 'source'; });
31244  if (source && source.x && source.x.r) {
31245    var model = resolve(this, source.x);
31246    this.source = {
31247      handleChange: function handleChange() {},
31248      rebind: function rebind(next) {
31249        this.model.unregister(this);
31250        this.model = next;
31251        next.register(this);
31252      }
31253    };
31254    this.source.model = model;
31255    model.register(this.source);
31256  }
31257
31258  // {{#each array}}...
31259  if ((this.isArray = isArray(value))) {
31260    // we can't use map, because of sparse arrays
31261    this.iterations = [];
31262    var max = (this.length = value.length);
31263    for (var i = 0; i < max; i += 1) {
31264      this$1.iterations[i] = this$1.createIteration(i, i);
31265    }
31266  } else if (isObject(value)) {
31267    // {{#each object}}...
31268    this.isArray = false;
31269
31270    // TODO this is a dreadful hack. There must be a neater way
31271    if (this.indexRef) {
31272      var refs = this.indexRef.split(',');
31273      this.keyRef = refs[0];
31274      this.indexRef = refs[1];
31275    }
31276
31277    var ks = keys(value);
31278    this.length = ks.length;
31279
31280    this.iterations = ks.map(function (key, index) {
31281      return this$1.createIteration(key, index);
31282    });
31283  }
31284
31285  return this;
31286};
31287
31288RepeatedFragment__proto__.bubble = function bubble (index) {
31289  if (!this.bubbled) { this.bubbled = []; }
31290  this.bubbled.push(index);
31291
31292  if (!this.rebounding) { this.owner.bubble(); }
31293};
31294
31295RepeatedFragment__proto__.createIteration = function createIteration (key, index) {
31296  var fragment = new Fragment({
31297    owner: this,
31298    template: this.template
31299  });
31300
31301  fragment.isIteration = true;
31302  fragment.delegate = this.delegate;
31303
31304  if (this.aliases) { fragment.aliases = {}; }
31305  swizzleFragment(this, fragment, key, index);
31306
31307  return fragment.bind(fragment.context);
31308};
31309
31310RepeatedFragment__proto__.destroyed = function destroyed () {
31311    var this$1 = this;
31312
31313  var len = this.iterations.length;
31314  for (var i = 0; i < len; i++) { this$1.iterations[i].destroyed(); }
31315  if (this.pathModel) { this.pathModel.destroyed(); }
31316  if (this.rootModel) { this.rootModel.destroyed(); }
31317};
31318
31319RepeatedFragment__proto__.detach = function detach () {
31320  var docFrag = createDocumentFragment();
31321  this.iterations.forEach(function (fragment) { return docFrag.appendChild(fragment.detach()); });
31322  return docFrag;
31323};
31324
31325RepeatedFragment__proto__.find = function find (selector, options) {
31326  return findMap(this.iterations, function (i) { return i.find(selector, options); });
31327};
31328
31329RepeatedFragment__proto__.findAll = function findAll (selector, options) {
31330  return this.iterations.forEach(function (i) { return i.findAll(selector, options); });
31331};
31332
31333RepeatedFragment__proto__.findAllComponents = function findAllComponents (name, options) {
31334  return this.iterations.forEach(function (i) { return i.findAllComponents(name, options); });
31335};
31336
31337RepeatedFragment__proto__.findComponent = function findComponent (name, options) {
31338  return findMap(this.iterations, function (i) { return i.findComponent(name, options); });
31339};
31340
31341RepeatedFragment__proto__.findContext = function findContext () {
31342  return this.context;
31343};
31344
31345RepeatedFragment__proto__.findNextNode = function findNextNode (iteration) {
31346    var this$1 = this;
31347
31348  if (iteration.index < this.iterations.length - 1) {
31349    for (var i = iteration.index + 1; i < this.iterations.length; i++) {
31350      var node = this$1.iterations[i].firstNode(true);
31351      if (node) { return node; }
31352    }
31353  }
31354
31355  return this.owner.findNextNode();
31356};
31357
31358RepeatedFragment__proto__.firstNode = function firstNode (skipParent) {
31359  return this.iterations[0] ? this.iterations[0].firstNode(skipParent) : null;
31360};
31361
31362RepeatedFragment__proto__.getLast = function getLast () {
31363  return this.lastModel || (this.lastModel = new KeyModel(this.length - 1));
31364};
31365
31366RepeatedFragment__proto__.rebind = function rebind (next) {
31367    var this$1 = this;
31368
31369  this.context = next;
31370  if (this.source) { return; }
31371  
31371this.iterations.forEach(function (fragment) {
31372    swizzleFragment(this$1, fragment, fragment.key, fragment.index);
31373  });
31374};
31375
31376RepeatedFragment__proto__.rebound = function rebound (update$$1) {
31377    var this$1 = this;
31378
31379  this.context = this.owner.model;
31380  this.iterations.forEach(function (f, i) {
31381    f.context = contextFor(this$1, f, i);
31382    f.rebound(update$$1);
31383  });
31384};
31385
31386RepeatedFragment__proto__.render = function render (target, occupants) {
31387  var xs = this.iterations;
31388  if (xs) {
31389    var len = xs.length;
31390    for (var i = 0; i < len; i++) {
31391      xs[i].render(target, occupants);
31392    }
31393  }
31394
31395  this.rendered = true;
31396};
31397
31398RepeatedFragment__proto__.shuffle = function shuffle (newIndices, merge) {
31399    var this$1 = this;
31400
31401  if (!this.pendingNewIndices) { this.previousIterations = this.iterations.slice(); }
31402
31403  if (!this.pendingNewIndices) { this.pendingNewIndices = []; }
31404
31405  this.pendingNewIndices.push(newIndices);
31406
31407  var iterations = [];
31408
31409  newIndices.forEach(function (newIndex, oldIndex) {
31410    if (newIndex === -1) { return; }
31411
31412    var fragment = this$1.iterations[oldIndex];
31413    iterations[newIndex] = fragment;
31414
31415    if (newIndex !== oldIndex && fragment) {
31416      fragment.dirty = true;
31417      if (merge) { fragment.shouldRebind = 1; }
31418    }
31419  });
31420
31421  this.iterations = iterations;
31422
31423  // if merging, we're in the midst of an update already
31424  if (!merge) { this.bubble(); }
31425};
31426
31427RepeatedFragment__proto__.shuffled = function shuffled$1
vendor: 12,927 bytes, lines 31427-31856
31427 () {
31428  this.iterations.forEach(shuffled);
31429};
31430
31431RepeatedFragment__proto__.toString = function toString (escape) {
31432  return this.iterations ? this.iterations.map(escape ? toEscapedString : toString$1).join('') : '';
31433};
31434
31435RepeatedFragment__proto__.unbind = function unbind (view) {
31436  this.bound = false;
31437  if (this.source) { this.source.model.unregister(this.source); }
31438  var iterations = this.pendingNewIndices ? this.previousIterations : this.iterations;
31439  var len = iterations.length;
31440  for (var i = 0; i < len; i++) { iterations[i].unbind(view); }
31441  return this;
31442};
31443
31444RepeatedFragment__proto__.unrender = function unrender (shouldDestroy) {
31445    var this$1 = this;
31446
31447  var len = this.iterations.length;
31448  for (var i = 0; i < len; i++) { this$1.iterations[i].unrender(shouldDestroy); }
31449  if (this.pendingNewIndices && this.previousIterations) {
31450    len = this.previousIterations.length;
31451    for (var i$1 = 0; i$1 < len; i$1++) { this$1.previousIterations[i$1].unrender(shouldDestroy); }
31452  }
31453  this.rendered = false;
31454};
31455
31456RepeatedFragment__proto__.update = function update$3 () {
31457    var this$1 = this;
31458
31459  if (this.pendingNewIndices) {
31460    this.bubbled.length = 0;
31461    this.updatePostShuffle();
31462    return;
31463  }
31464
31465  if (this.updating) { return; }
31466  this.updating = true;
31467
31468  if (this.shuffler) {
31469    var values = shuffleValues(this, this.shuffler);
31470    var newIndices = buildNewIndices(this.values, values);
31471    if (!newIndices.same) {
31472      this.shuffle(newIndices, true);
31473      this.updatePostShuffle();
31474    } else {
31475      this.iterations.forEach(update);
31476    }
31477  } else {
31478    var len = this.iterations.length;
31479    for (var i = 0; i < len; i++) {
31480      var f = this$1.iterations[i];
31481      f && f.idxModel && f.idxModel.applyValue(i);
31482    }
31483
31484    var value = this.context.get();
31485    var wasArray = this.isArray;
31486
31487    var toRemove;
31488    var oldKeys;
31489    var reset = true;
31490    var i$1;
31491
31492    if ((this.isArray = isArray(value))) {
31493      // if there's a source to map back to, make sure everything stays bound correctly
31494      if (this.source) {
31495        this.rebounding = 1;
31496        var source = this.source.model.get();
31497        this.iterations.forEach(function (f, c) {
31498          if (c < value.length && f.lastValue !== value[c] && ~(i$1 = source.indexOf(value[c]))) {
31499            swizzleFragment(this$1, f, c, c);
31500            f.rebound(true);
31501          }
31502        });
31503        this.rebounding = 0;
31504      }
31505
31506      if (wasArray) {
31507        reset = false;
31508        if (this.iterations.length > value.length) {
31509          toRemove = this.iterations.splice(value.length);
31510        }
31511      }
31512    } else if (isObject(value) && !wasArray) {
31513      reset = false;
31514      toRemove = [];
31515      oldKeys = {};
31516      i$1 = this.iterations.length;
31517
31518      while (i$1--) {
31519        var fragment = this$1.iterations[i$1];
31520        if (fragment.key in value) {
31521          oldKeys[fragment.key] = true;
31522        } else {
31523          this$1.iterations.splice(i$1, 1);
31524          toRemove.push(fragment);
31525        }
31526      }
31527    }
31528
31529    var newLength = isArray(value) ? value.length : isObject(value) ? keys(value).length : 0;
31530    this.length = newLength;
31531    this.updateLast();
31532
31533    if (reset) {
31534      toRemove = this.iterations;
31535      this.iterations = [];
31536    }
31537
31538    if (toRemove) {
31539      len = toRemove.length;
31540      for (var i$2 = 0; i$2 < len; i$2++) { toRemove[i$2].unbind().unrender(true); }
31541    }
31542
31543    // update the remaining ones
31544    if (!reset && this.isArray && this.bubbled && this.bubbled.length) {
31545      var bubbled = this.bubbled;
31546      this.bubbled = [];
31547      len = bubbled.length;
31548      for (var i$3 = 0; i$3 < len; i$3++)
31549        { this$1.iterations[bubbled[i$3]] && this$1.iterations[bubbled[i$3]].update(); }
31550    } else {
31551      len = this.iterations.length;
31552      for (var i$4 = 0; i$4 < len; i$4++) { this$1.iterations[i$4].update(); }
31553    }
31554
31555    // add new iterations
31556    var docFrag;
31557    var fragment$1;
31558
31559    if (newLength > this.iterations.length) {
31560      docFrag = this.rendered ? createDocumentFragment() : null;
31561      i$1 = this.iterations.length;
31562
31563      if (isArray(value)) {
31564        while (i$1 < value.length) {
31565          fragment$1 = this$1.createIteration(i$1, i$1);
31566
31567          this$1.iterations.push(fragment$1);
31568          if (this$1.rendered) { fragment$1.render(docFrag); }
31569
31570          i$1 += 1;
31571        }
31572      } else if (isObject(value)) {
31573        // TODO this is a dreadful hack. There must be a neater way
31574        if (this.indexRef && !this.keyRef) {
31575          var refs = this.indexRef.split(',');
31576          this.keyRef = refs[0];
31577          this.indexRef = refs[1];
31578        }
31579
31580        keys(value).forEach(function (key) {
31581          if (!oldKeys || !(key in oldKeys)) {
31582            fragment$1 = this$1.createIteration(key, i$1);
31583
31584            this$1.iterations.push(fragment$1);
31585            if (this$1.rendered) { fragment$1.render(docFrag); }
31586
31587            i$1 += 1;
31588          }
31589        });
31590      }
31591
31592      if (this.rendered) {
31593        var parentNode = this.parent.findParentNode();
31594        var anchor = this.parent.findNextNode(this.owner);
31595
31596        parentNode.insertBefore(docFrag, anchor);
31597      }
31598    }
31599  }
31600
31601  this.updating = false;
31602};
31603
31604RepeatedFragment__proto__.updateLast = function updateLast () {
31605  if (this.lastModel) { this.lastModel.applyValue(this.length - 1); }
31606};
31607
31608RepeatedFragment__proto__.updatePostShuffle = function updatePostShuffle () {
31609    var this$1 = this;
31610
31611  var newIndices = this.pendingNewIndices[0];
31612  var parentNode = this.rendered ? this.parent.findParentNode() : null;
31613  var nextNode = parentNode && this.owner.findNextNode();
31614  var docFrag = parentNode ? createDocumentFragment() : null;
31615
31616  // map first shuffle through
31617  this.pendingNewIndices.slice(1).forEach(function (indices) {
31618    newIndices.forEach(function (newIndex, oldIndex) {
31619      newIndices[oldIndex] = indices[newIndex];
31620    });
31621  });
31622
31623  var len = (this.length = this.context.get().length);
31624  var prev = this.previousIterations;
31625  var iters = this.iterations;
31626  var value = this.context.get();
31627  var stash = {};
31628  var idx, dest, pos, next, anchor, rebound;
31629
31630  var map = new Array(newIndices.length);
31631  newIndices.forEach(function (e, i) { return (map[e] = i); });
31632
31633  this.updateLast();
31634
31635  idx = pos = 0;
31636  while (idx < len) {
31637    // if there's not an existing thing to shuffle, handle that
31638    if (isUndefined(map[idx])) {
31639      next = iters[idx] = this$1.createIteration(idx, idx);
31640      if (parentNode) {
31641        anchor = prev[pos];
31642        anchor = (anchor && parentNode && anchor.firstNode()) || nextNode;
31643
31644        next.render(docFrag);
31645        parentNode.insertBefore(docFrag, anchor);
31646      }
31647
31648      idx++;
31649    } else {
31650      dest = newIndices[pos];
31651
31652      if (dest === -1) {
31653        // if it needs to be dropped, drop it
31654        prev[pos] && prev[pos].unbind().unrender(true);
31655        prev[pos++] = 0;
31656      } else if (dest > idx) {
31657        // if it needs to move down, stash it
31658        stash[dest] = prev[pos];
31659        prev[pos++] = null;
31660      } else {
31661        // get the fragment that goes for this idx
31662        iters[idx] = next = iters[idx] || stash[idx] || this$1.createIteration(idx, idx);
31663
31664        // if it's an existing fragment, swizzle
31665        if (stash[idx] || pos !== idx) {
31666          rebound = this$1.source && next.lastValue !== value[idx];
31667          swizzleFragment(this$1, next, idx, idx);
31668        }
31669
31670        // does next need to be moved?
31671        if (parentNode && (stash[idx] || !prev[pos])) {
31672          anchor = prev[pos + 1];
31673          anchor = (anchor && parentNode && anchor.firstNode()) || nextNode;
31674
31675          if (stash[idx]) {
31676            parentNode.insertBefore(next.detach(), anchor);
31677          } else {
31678            next.render(docFrag);
31679            parentNode.insertBefore(docFrag, anchor);
31680          }
31681        }
31682
31683        prev[pos++] = 0;
31684        idx++;
31685      }
31686
31687      if (next && isObjectType(next)) {
31688        if (next.shouldRebind || rebound) {
31689          next.rebound(rebound);
31690          next.shouldRebind = 0;
31691        }
31692        next.update();
31693        next.shuffled();
31694      }
31695    }
31696  }
31697
31698  // clean up any stragglers
31699  var plen = prev.length;
31700  for (var i = 0; i < plen; i++) { prev[i] && prev[i].unbind().unrender(true); }
31701
31702  if (this.shuffler) { this.values = shuffleValues(this, this.shuffler); }
31703
31704  this.pendingNewIndices = null;
31705  this.previousIterations = null;
31706};
31707
31708RepeatedFragment.prototype.getContext = getContext;
31709RepeatedFragment.prototype.getKeypath = getKeypath;
31710
31711// find the topmost delegate
31712function findDelegate(start) {
31713  var frag = start;
31714  var delegate, el;
31715
31716  out: while (frag) {
31717    // find next element
31718    el = 0;
31719    while (!el && frag) {
31720      if (frag.owner.type === ELEMENT) { el = frag.owner; }
31721      if (frag.owner.ractive && frag.owner.ractive.delegate === false) { break out; }
31722      frag = frag.parent || frag.componentParent;
31723    }
31724
31725    if (el.delegate === false) { break out; }
31726    delegate = el.delegate || el;
31727
31728    // find next repeated fragment
31729    while (frag) {
31730      if (frag.iterations) { break; }
31731      if (frag.owner.ractive && frag.owner.ractive.delegate === false) { break out; }
31732      frag = frag.parent || frag.componentParent;
31733    }
31734  }
31735
31736  return delegate;
31737}
31738
31739function swizzleFragment(section, fragment, key, idx) {
31740  var model = section.context ? contextFor(section, fragment, key) : undefined;
31741
31742  fragment.key = key;
31743  fragment.index = idx;
31744  fragment.context = model;
31745  if (section.source) { fragment.lastValue = model && model.get(); }
31746
31747  if (fragment.idxModel) { fragment.idxModel.applyValue(idx); }
31748  if (fragment.keyModel) { fragment.keyModel.applyValue(key); }
31749  if (fragment.pathModel) {
31750    fragment.pathModel.context = model;
31751    fragment.pathModel.applyValue(model.getKeypath());
31752  }
31753  if (fragment.rootModel) {
31754    fragment.rootModel.context = model;
31755    fragment.rootModel.applyValue(model.getKeypath(fragment.ractive.root));
31756  }
31757
31758  // handle any aliases
31759  var aliases = fragment.aliases;
31760  section.aliases &&
31761    section.aliases.forEach(function (a) {
31762      if (a.x.r === '.') { aliases[a.n] = model; }
31763      else if (a.x.r === '@index') { aliases[a.n] = fragment.getIndex(); }
31764      else if (a.x.r === '@key') { aliases[a.n] = fragment.getKey(); }
31765      else if (a.x.r === '@keypath') { aliases[a.n] = fragment.getKeypath(); }
31766      else if (a.x.r === '@rootpath') { aliases[a.n] = fragment.getKeypath(true); }
31767    });
31768}
31769
31770function shuffleValues(section, shuffler) {
31771  var array = section.context.get() || [];
31772  if (shuffler === true) {
31773    return array.slice();
31774  } else {
31775    return array.map(function (v) { return shuffler.reduce(function (a, c) { return a && a[c]; }, v); });
31776  }
31777}
31778
31779function contextFor(section, fragment, key) {
31780  if (section.source) {
31781    var idx;
31782    var source = section.source.model.get();
31783    if (source.indexOf && ~(idx = source.indexOf(section.context.joinKey(key).get())))
31784      { return section.source.model.joinKey(idx); }
31785  }
31786
31787  return section.context.joinKey(key);
31788}
31789
31790function isEmpty(value) {
31791  return (
31792    !value ||
31793    (isArray(value) && value.length === 0) ||
31794    (isObject(value) && keys(value).length === 0)
31795  );
31796}
31797
31798function getType(value, hasIndexRef) {
31799  if (hasIndexRef || isArray(value)) { return SECTION_EACH; }
31800  if (isObjectLike(value)) { return SECTION_IF_WITH; }
31801  if (isUndefined(value)) { return null; }
31802  return SECTION_IF;
31803}
31804
31805var Section = (function (MustacheContainer) {
31806  function Section(options) {
31807    MustacheContainer.call(this, options);
31808
31809    this.isAlias = options.template.t === ALIAS;
31810    this.sectionType = options.template.n || (this.isAlias && SECTION_WITH) || null;
31811    this.templateSectionType = this.sectionType;
31812    this.subordinate = options.template.l === 1;
31813    this.fragment = null;
31814  }
31815
31816  if ( MustacheContainer ) Section.__proto__ = MustacheContainer;
31817  var Section__proto__ = Section.prototype = Object.create( MustacheContainer && MustacheContainer.prototype );
31818  Section__proto__.constructor = Section;
31819
31820  Section__proto__.bind = function bind () {
31821    MustacheContainer.prototype.bind.call(this);
31822
31823    if (this.subordinate) {
31824      this.sibling = this.up.items[this.up.items.indexOf(this) - 1];
31825      this.sibling.nextSibling = this;
31826    }
31827
31828    // if we managed to bind, we need to create children
31829    if (this.model || this.isAlias) {
31830      this.dirty = true;
31831      this.update();
31832    } else if (
31833      this.sectionType &&
31834      this.sectionType === SECTION_UNLESS &&
31835      (!this.sibling || !this.sibling.isTruthy())
31836    ) {
31837      this.fragment = new Fragment({
31838        owner: this,
31839        template: this.template.f
31840      }).bind();
31841    }
31842  };
31843
31844  Section__proto__.bubble = function bubble () {
31845    if (!this.dirty && this.yield) {
31846      this.dirty = true;
31847      this.containerFragment.bubble();
31848    } else { MustacheContainer.prototype.bubble.call(this); }
31849  };
31850
31851  Section__proto__.detach = function detach () {
31852    var frag = this.fragment || this.detached;
31853    return frag ? frag.detach() : MustacheContainer.prototype.detach.call(this);
31854  };
31855
31856  Section__proto__.
vendor: 2,833 bytes, lines 31856-31935
31856isTruthy = function isTruthy () {
31857    if (this.subordinate && this.sibling.isTruthy()) { return true; }
31858    var value = !this.model ? undefined : this.model.isRoot ? this.model.value : this.model.get();
31859    return !!value && (this.templateSectionType === SECTION_IF_WITH || !isEmpty(value));
31860  };
31861
31862  Section__proto__.rebind = function rebind (next, previous, safe) {
31863    if (MustacheContainer.prototype.rebind.call(this, next, previous, safe)) {
31864      if (this.fragment && this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS) {
31865        this.fragment.rebind(next);
31866      }
31867    }
31868  };
31869
31870  Section__proto__.rebound = function rebound (update) {
31871    if (this.model) {
31872      if (this.model.rebound) { this.model.rebound(update); }
31873      else {
31874        MustacheContainer.prototype.unbind.call(this);
31875        MustacheContainer.prototype.bind.call(this);
31876        if (
31877          this.sectionType === SECTION_WITH ||
31878          this.sectionType === SECTION_IF_WITH ||
31879          this.sectionType === SECTION_EACH
31880        ) {
31881          if (this.fragment) { this.fragment.rebind(this.model); }
31882        }
31883
31884        if (update) { this.bubble(); }
31885      }
31886    }
31887    if (this.fragment) { this.fragment.rebound(update); }
31888  };
31889
31890  Section__proto__.render = function render (target, occupants) {
31891    this.rendered = true;
31892    if (this.fragment) { this.fragment.render(target, occupants); }
31893  };
31894
31895  Section__proto__.shuffle = function shuffle (newIndices) {
31896    if (this.fragment && this.sectionType === SECTION_EACH) {
31897      this.fragment.shuffle(newIndices);
31898    }
31899  };
31900
31901  Section__proto__.unbind = function unbind (view) {
31902    MustacheContainer.prototype.unbind.call(this, view);
31903    if (this.fragment) { this.fragment.unbind(view); }
31904  };
31905
31906  Section__proto__.unrender = function unrender (shouldDestroy) {
31907    if (this.rendered && this.fragment) { this.fragment.unrender(shouldDestroy); }
31908    this.rendered = false;
31909  };
31910
31911  Section__proto__.update = function update () {
31912    var this$1 = this;
31913
31914    if (!this.dirty) { return; }
31915
31916    if (this.fragment && this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS) {
31917      this.fragment.context = this.model;
31918    }
31919
31920    if (!this.model && this.sectionType !== SECTION_UNLESS && !this.isAlias) { return; }
31921
31922    this.dirty = false;
31923
31924    var value = !this.model ? undefined : this.model.isRoot ? this.model.value : this.model.get();
31925    var siblingFalsey = !this.subordinate || !this.sibling.isTruthy();
31926    var lastType = this.sectionType;
31927
31928    if (this.yield && this.yield !== value) {
31929      this.up = this.containerFragment;
31930      this.container = null;
31931      this.yield = null;
31932      if (this.rendered) { this.fragment.unbind().unrender(true); }
31933      this.fragment = null;
31934    } else if (this.rendered && !this.yield && value instanceof Context) {
31935      if (this.rendered
vendor: 42,040 bytes, lines 31935-33456
31935) { this.fragment.unbind().unrender(true); }
31936      this.fragment = null;
31937    }
31938
31939    // watch for switching section types
31940    if (this.sectionType === null || this.templateSectionType === null)
31941      { this.sectionType = getType(value, this.template.i); }
31942    if (lastType && lastType !== this.sectionType && this.fragment) {
31943      if (this.rendered) {
31944        this.fragment.unbind().unrender(true);
31945      }
31946
31947      this.fragment = null;
31948    }
31949
31950    var newFragment;
31951
31952    var fragmentShouldExist =
31953      this.sectionType === SECTION_EACH || // each always gets a fragment, which may have no iterations
31954      this.sectionType === SECTION_WITH || // with (partial context) always gets a fragment
31955      (siblingFalsey &&
31956        (this.sectionType === SECTION_UNLESS ? !this.isTruthy() : this.isTruthy())) || // if, unless, and if-with depend on siblings and the condition
31957      this.isAlias;
31958
31959    if (fragmentShouldExist) {
31960      if (!this.fragment) { this.fragment = this.detached; }
31961
31962      if (this.fragment) {
31963        // check for detached fragment
31964        if (this.detached) {
31965          attach(this, this.fragment);
31966          this.detached = false;
31967          this.rendered = true;
31968        }
31969
31970        if (!this.fragment.bound) { this.fragment.bind(this.model); }
31971        this.fragment.update();
31972      } else {
31973        if (this.sectionType === SECTION_EACH) {
31974          newFragment = new RepeatedFragment({
31975            owner: this,
31976            template: this.template.f,
31977            indexRef: this.template.i
31978          }).bind(this.model);
31979        } else {
31980          // only with and if-with provide context - if and unless do not
31981          var context =
31982            this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS
31983              ? this.model
31984              : null;
31985
31986          if (value instanceof Context) {
31987            this.yield = value;
31988            this.containerFragment = this.up;
31989            this.up = value.fragment;
31990            this.container = value.ractive;
31991            context = undefined;
31992          }
31993
31994          newFragment = new Fragment({
31995            owner: this,
31996            template: this.template.f
31997          }).bind(context);
31998        }
31999      }
32000    } else {
32001      if (this.fragment && this.rendered) {
32002        if (keep !== true) {
32003          this.fragment.unbind().unrender(true);
32004        } else {
32005          this.unrender(false);
32006          this.detached = this.fragment;
32007          runloop.promise().then(function () {
32008            if (this$1.detached) { this$1.detach(); }
32009          });
32010        }
32011      } else if (this.fragment) {
32012        this.fragment.unbind();
32013      }
32014
32015      this.fragment = null;
32016    }
32017
32018    if (newFragment) {
32019      if (this.rendered) {
32020        attach(this, newFragment);
32021      }
32022
32023      this.fragment = newFragment;
32024    }
32025
32026    if (this.nextSibling) {
32027      this.nextSibling.dirty = true;
32028      this.nextSibling.update();
32029    }
32030  };
32031
32032  return Section;
32033}(MustacheContainer));
32034
32035function attach(section, fragment) {
32036  var anchor = (section.containerFragment || section.up).findNextNode(section);
32037
32038  if (anchor) {
32039    var docFrag = createDocumentFragment();
32040    fragment.render(docFrag);
32041
32042    anchor.parentNode.insertBefore(docFrag, anchor);
32043  } else {
32044    fragment.render(section.up.findParentNode());
32045  }
32046}
32047
32048var Select = (function (Element) {
32049  function Select(options) {
32050    Element.call(this, options);
32051    this.options = [];
32052  }
32053
32054  if ( Element ) Select.__proto__ = Element;
32055  var Select__proto__ = Select.prototype = Object.create( Element && Element.prototype );
32056  Select__proto__.constructor = Select;
32057
32058  Select__proto__.foundNode = function foundNode (node) {
32059    if (this.binding) {
32060      var selectedOptions = getSelectedOptions(node);
32061
32062      if (selectedOptions.length > 0) {
32063        this.selectedOptions = selectedOptions;
32064      }
32065    }
32066  };
32067
32068  Select__proto__.render = function render (target, occupants) {
32069    Element.prototype.render.call(this, target, occupants);
32070    this.sync();
32071
32072    var node = this.node;
32073
32074    var i = node.options.length;
32075    while (i--) {
32076      node.options[i].defaultSelected = node.options[i].selected;
32077    }
32078
32079    this.rendered = true;
32080  };
32081
32082  Select__proto__.sync = function sync () {
32083    var this$1 = this;
32084
32085    var selectNode = this.node;
32086
32087    if (!selectNode) { return; }
32088
32089    var options = toArray(selectNode.options);
32090
32091    if (this.selectedOptions) {
32092      options.forEach(function (o) {
32093        if (this$1.selectedOptions.indexOf(o) >= 0) { o.selected = true; }
32094        else { o.selected = false; }
32095      });
32096      this.binding.setFromNode(selectNode);
32097      delete this.selectedOptions;
32098      return;
32099    }
32100
32101    var selectValue = this.getAttribute('value');
32102    var isMultiple = this.getAttribute('multiple');
32103    var array = isMultiple && isArray(selectValue);
32104
32105    // If the <select> has a specified value, that should override
32106    // these options
32107    if (selectValue !== undefined) {
32108      var optionWasSelected;
32109
32110      options.forEach(function (o) {
32111        var optionValue = o._ractive ? o._ractive.value : o.value;
32112        var shouldSelect = isMultiple
32113          ? array && this$1.valueContains(selectValue, optionValue)
32114          : this$1.compare(selectValue, optionValue);
32115
32116        if (shouldSelect) {
32117          optionWasSelected = true;
32118        }
32119
32120        o.selected = shouldSelect;
32121      });
32122
32123      if (!optionWasSelected && !isMultiple) {
32124        if (this.binding) {
32125          this.binding.forceUpdate();
32126        }
32127      }
32128    } else if (this.binding && this.binding.forceUpdate) {
32129      // Otherwise the value should be initialised according to which
32130      // <option> element is selected, if twoway binding is in effect
32131      this.binding.forceUpdate();
32132    }
32133  };
32134  Select__proto__.valueContains = function valueContains (selectValue, optionValue) {
32135    var this$1 = this;
32136
32137    var i = selectValue.length;
32138    while (i--) {
32139      if (this$1.compare(optionValue, selectValue[i])) { return true; }
32140    }
32141  };
32142  Select__proto__.compare = function compare (optionValue, selectValue) {
32143    var comparator = this.getAttribute('value-comparator');
32144    if (comparator) {
32145      if (isFunction(comparator)) {
32146        return comparator(selectValue, optionValue);
32147      }
32148      if (selectValue && optionValue) {
32149        return selectValue[comparator] == optionValue[comparator];
32150      }
32151    }
32152    return selectValue == optionValue;
32153  };
32154  Select__proto__.update = function update () {
32155    var dirty = this.dirty;
32156    Element.prototype.update.call(this);
32157    if (dirty) {
32158      this.sync();
32159    }
32160  };
32161
32162  return Select;
32163}(Element));
32164
32165var Textarea = (function (Input) {
32166  function Textarea(options) {
32167    var template = options.template;
32168
32169    options.deferContent = true;
32170
32171    Input.call(this, options);
32172
32173    // check for single interpolator binding
32174    if (!this.attributeByName.value) {
32175      if (template.f && isBindable({ template: template })) {
32176        (this.attributes || (this.attributes = [])).push(
32177          createItem({
32178            owner: this,
32179            template: { t: ATTRIBUTE, f: template.f, n: 'value' },
32180            up: this.up
32181          })
32182        );
32183      } else {
32184        this.fragment = new Fragment({
32185          owner: this,
32186          cssIds: null,
32187          template: template.f
32188        });
32189      }
32190    }
32191  }
32192
32193  if ( Input ) Textarea.__proto__ = Input;
32194  var Textarea__proto__ = Textarea.prototype = Object.create( Input && Input.prototype );
32195  Textarea__proto__.constructor = Textarea;
32196
32197  Textarea__proto__.bubble = function bubble () {
32198    var this$1 = this;
32199
32200    if (!this.dirty) {
32201      this.dirty = true;
32202
32203      if (this.rendered && !this.binding && this.fragment) {
32204        runloop.scheduleTask(function () {
32205          this$1.dirty = false;
32206          this$1.node.value = this$1.fragment.toString();
32207        });
32208      }
32209
32210      this.up.bubble(); // default behaviour
32211    }
32212  };
32213
32214  return Textarea;
32215}(Input));
32216
32217var Text = (function (Item) {
32218  function Text(options) {
32219    Item.call(this, options);
32220    this.type = TEXT;
32221  }
32222
32223  if ( Item ) Text.__proto__ = Item;
32224  var Text__proto__ = Text.prototype = Object.create( Item && Item.prototype );
32225  Text__proto__.constructor = Text;
32226
32227  Text__proto__.detach = function detach () {
32228    return detachNode(this.node);
32229  };
32230
32231  Text__proto__.firstNode = function firstNode () {
32232    return this.node;
32233  };
32234
32235  Text__proto__.render = function render (target, occupants) {
32236    if (inAttributes()) { return; }
32237    this.rendered = true;
32238
32239    progressiveText(this, target, occupants, this.template);
32240  };
32241
32242  Text__proto__.toString = function toString (escape) {
32243    return escape ? escapeHtml(this.template) : this.template;
32244  };
32245
32246  Text__proto__.unrender = function unrender (shouldDestroy) {
32247    if (this.rendered && shouldDestroy) { this.detach(); }
32248    this.rendered = false;
32249  };
32250
32251  Text__proto__.valueOf = function valueOf () {
32252    return this.template;
32253  };
32254
32255  return Text;
32256}(Item));
32257
32258var proto$7 = Text.prototype;
32259proto$7.bind = proto$7.unbind = proto$7.update = noop;
32260
32261var visible;
32262var hidden = 'hidden';
32263
32264if (doc) {
32265  var prefix$2;
32266
32267  /* istanbul ignore next */
32268  if (hidden in doc) {
32269    prefix$2 = '';
32270  } else {
32271    var i$1 = vendors.length;
32272    while (i$1--) {
32273      var vendor = vendors[i$1];
32274      hidden = vendor + 'Hidden';
32275
32276      if (hidden in doc) {
32277        prefix$2 = vendor;
32278        break;
32279      }
32280    }
32281  }
32282
32283  /* istanbul ignore else */
32284  if (prefix$2 !== undefined) {
32285    doc.addEventListener(prefix$2 + 'visibilitychange', onChange);
32286    onChange();
32287  } else {
32288    // gah, we're in an old browser
32289    if ('onfocusout' in doc) {
32290      doc.addEventListener('focusout', onHide);
32291      doc.addEventListener('focusin', onShow);
32292    } else {
32293      win.addEventListener('pagehide', onHide);
32294      win.addEventListener('blur', onHide);
32295
32296      win.addEventListener('pageshow', onShow);
32297      win.addEventListener('focus', onShow);
32298    }
32299
32300    visible = true; // until proven otherwise. Not ideal but hey
32301  }
32302}
32303
32304function onChange() {
32305  visible = !doc[hidden];
32306}
32307
32308/* istanbul ignore next */
32309function onHide() {
32310  visible = false;
32311}
32312
32313/* istanbul ignore next */
32314function onShow() {
32315  visible = true;
32316}
32317
32318var prefix;
32319
32320/* istanbul ignore next */
32321if (!isClient) {
32322  prefix = null;
32323} else {
32324  var prefixCache = {};
32325  var testStyle = createElement('div').style;
32326
32327  // technically this also normalizes on hyphenated styles as well
32328  prefix = function(prop) {
32329    if (!prefixCache[prop]) {
32330      var name = hyphenateCamel(prop);
32331
32332      if (testStyle[prop] !== undefined) {
32333        prefixCache[prop] = name;
32334      } else {
32335        /* istanbul ignore next */
32336        // test vendors...
32337        var i = vendors.length;
32338        while (i--) {
32339          var vendor = "-" + (vendors[i]) + "-" + name;
32340          if (testStyle[vendor] !== undefined) {
32341            prefixCache[prop] = vendor;
32342            break;
32343          }
32344        }
32345      }
32346    }
32347
32348    return prefixCache[prop];
32349  };
32350}
32351
32352var prefix$1 = prefix;
32353
32354var vendorPattern = new RegExp('^(?:' + vendors.join('|') + ')([A-Z])');
32355
32356function hyphenate(str) {
32357  /* istanbul ignore next */
32358  if (!str) { return ''; } // edge case
32359
32360  /* istanbul ignore next */
32361  if (vendorPattern.test(str)) { str = '-' + str; }
32362
32363  return str.replace(/[A-Z]/g, function (match) { return '-' + match.toLowerCase(); });
32364}
32365
32366var createTransitions;
32367
32368if (!isClient) {
32369  createTransitions = null;
32370} else {
32371  var testStyle$1 = createElement('div').style;
32372  var linear$1 = function (x) { return x; };
32373
32374  var canUseCssTransitions = {};
32375  var cannotUseCssTransitions = {};
32376
32377  // determine some facts about our environment
32378  var TRANSITION$1;
32379  var TRANSITIONEND;
32380  var CSS_TRANSITIONS_ENABLED;
32381  var TRANSITION_DURATION;
32382  var TRANSITION_PROPERTY;
32383  var TRANSITION_TIMING_FUNCTION;
32384
32385  if (testStyle$1.transition !== undefined) {
32386    TRANSITION$1 = 'transition';
32387    TRANSITIONEND = 'transitionend';
32388    CSS_TRANSITIONS_ENABLED = true;
32389  } else if (testStyle$1.webkitTransition !== undefined) {
32390    TRANSITION$1 = 'webkitTransition';
32391    TRANSITIONEND = 'webkitTransitionEnd';
32392    CSS_TRANSITIONS_ENABLED = true;
32393  } else {
32394    CSS_TRANSITIONS_ENABLED = false;
32395  }
32396
32397  if (TRANSITION$1) {
32398    TRANSITION_DURATION = TRANSITION$1 + 'Duration';
32399    TRANSITION_PROPERTY = TRANSITION$1 + 'Property';
32400    TRANSITION_TIMING_FUNCTION = TRANSITION$1 + 'TimingFunction';
32401  }
32402
32403  createTransitions = function(t, to, options, changedProperties, resolve) {
32404    // Wait a beat (otherwise the target styles will be applied immediately)
32405    // TODO use a fastdom-style mechanism?
32406    setTimeout(function () {
32407      var jsTransitionsComplete;
32408      var cssTransitionsComplete;
32409      var cssTimeout; // eslint-disable-line prefer-const
32410
32411      function transitionDone() {
32412        clearTimeout(cssTimeout);
32413      }
32414
32415      function checkComplete() {
32416        if (jsTransitionsComplete && cssTransitionsComplete) {
32417          t.unregisterCompleteHandler(transitionDone);
32418          // will changes to events and fire have an unexpected consequence here?
32419          t.ractive.fire(t.name + ':end', t.node, t.isIntro);
32420          resolve();
32421        }
32422      }
32423
32424      // this is used to keep track of which elements can use CSS to animate
32425      // which properties
32426      var hashPrefix = (t.node.namespaceURI || '') + t.node.tagName;
32427
32428      // need to reset transition properties
32429      var style = t.node.style;
32430      var previous = {
32431        property: style[TRANSITION_PROPERTY],
32432        timing: style[TRANSITION_TIMING_FUNCTION],
32433        duration: style[TRANSITION_DURATION]
32434      };
32435
32436      function transitionEndHandler(event) {
32437        if (event.target !== t.node) { return; }
32438        var index = changedProperties.indexOf(event.propertyName);
32439
32440        if (index !== -1) {
32441          changedProperties.splice(index, 1);
32442        }
32443
32444        if (changedProperties.length) {
32445          // still transitioning...
32446          return;
32447        }
32448
32449        clearTimeout(cssTimeout);
32450        cssTransitionsDone();
32451      }
32452
32453      function cssTransitionsDone() {
32454        style[TRANSITION_PROPERTY] = previous.property;
32455        style[TRANSITION_TIMING_FUNCTION] = previous.duration;
32456        style[TRANSITION_DURATION] = previous.timing;
32457
32458        t.node.removeEventListener(TRANSITIONEND, transitionEndHandler, false);
32459
32460        cssTransitionsComplete = true;
32461        checkComplete();
32462      }
32463
32464      t.node.addEventListener(TRANSITIONEND, transitionEndHandler, false);
32465
32466      // safety net in case transitionend never fires
32467      cssTimeout = setTimeout(function () {
32468        changedProperties = [];
32469        cssTransitionsDone();
32470      }, options.duration + (options.delay || 0) + 50);
32471      t.registerCompleteHandler(transitionDone);
32472
32473      style[TRANSITION_PROPERTY] = changedProperties.join(',');
32474      var easingName = hyphenate(options.easing || 'linear');
32475      style[TRANSITION_TIMING_FUNCTION] = easingName;
32476      var cssTiming = style[TRANSITION_TIMING_FUNCTION] === easingName;
32477      style[TRANSITION_DURATION] = options.duration / 1000 + 's';
32478
32479      setTimeout(function () {
32480        var i = changedProperties.length;
32481        var hash;
32482        var originalValue = null;
32483        var index;
32484        var propertiesToTransitionInJs = [];
32485        var prop;
32486        var suffix;
32487        var interpolator;
32488
32489        while (i--) {
32490          prop = changedProperties[i];
32491          hash = hashPrefix + prop;
32492
32493          if (cssTiming && CSS_TRANSITIONS_ENABLED && !cannotUseCssTransitions[hash]) {
32494            var initial = style[prop];
32495            style[prop] = to[prop];
32496
32497            // If we're not sure if CSS transitions are supported for
32498            // this tag/property combo, find out now
32499            if (!(hash in canUseCssTransitions)) {
32500              originalValue = t.getStyle(prop);
32501
32502              // if this property is transitionable in this browser,
32503              // the current style will be different from the target style
32504              canUseCssTransitions[hash] = t.getStyle(prop) != to[prop];
32505              cannotUseCssTransitions[hash] = !canUseCssTransitions[hash];
32506
32507              // Reset, if we're going to use timers after all
32508              if (cannotUseCssTransitions[hash]) {
32509                style[prop] = initial;
32510              }
32511            }
32512          }
32513
32514          if (!cssTiming || !CSS_TRANSITIONS_ENABLED || cannotUseCssTransitions[hash]) {
32515            // we need to fall back to timer-based stuff
32516            if (originalValue === null) { originalValue = t.getStyle(prop); }
32517
32518            // need to remove this from changedProperties, otherwise transitionEndHandler
32519            // will get confused
32520            index = changedProperties.indexOf(prop);
32521            if (index === -1) {
32522              warnIfDebug(
32523                'Something very strange happened with transitions. Please raise an issue at https://github.com/ractivejs/ractive/issues - thanks!',
32524                { node: t.node }
32525              );
32526            } else {
32527              changedProperties.splice(index, 1);
32528            }
32529
32530            // TODO Determine whether this property is animatable at all
32531
32532            suffix = /[^\d]*$/.exec(originalValue)[0];
32533            interpolator = interpolate(parseFloat(originalValue), parseFloat(to[prop]));
32534
32535            // ...then kick off a timer-based transition
32536            if (interpolator) {
32537              propertiesToTransitionInJs.push({
32538                name: prop,
32539                interpolator: interpolator,
32540                suffix: suffix
32541              });
32542            } else {
32543              style[prop] = to[prop];
32544            }
32545
32546            originalValue = null;
32547          }
32548        }
32549
32550        // javascript transitions
32551        if (propertiesToTransitionInJs.length) {
32552          var easing;
32553
32554          if (isString(options.easing)) {
32555            easing = t.ractive.easing[options.easing];
32556
32557            if (!easing) {
32558              warnOnceIfDebug(missingPlugin(options.easing, 'easing'));
32559              easing = linear$1;
32560            }
32561          } else if (isFunction(options.easing)) {
32562            easing = options.easing;
32563          } else {
32564            easing = linear$1;
32565          }
32566
32567          new Ticker({
32568            duration: options.duration,
32569            easing: easing,
32570            step: function step(pos) {
32571              var i = propertiesToTransitionInJs.length;
32572              while (i--) {
32573                var prop = propertiesToTransitionInJs[i];
32574                style[prop.name] = prop.interpolator(pos) + prop.suffix;
32575              }
32576            },
32577            complete: function complete() {
32578              jsTransitionsComplete = true;
32579              checkComplete();
32580            }
32581          });
32582        } else {
32583          jsTransitionsComplete = true;
32584        }
32585
32586        if (changedProperties.length) {
32587          style[TRANSITION_PROPERTY] = changedProperties.join(',');
32588        } else {
32589          style[TRANSITION_PROPERTY] = 'none';
32590
32591          // We need to cancel the transitionEndHandler, and deal with
32592          // the fact that it will never fire
32593          t.node.removeEventListener(TRANSITIONEND, transitionEndHandler, false);
32594          cssTransitionsComplete = true;
32595          checkComplete();
32596        }
32597      }, 0);
32598    }, options.delay || 0);
32599  };
32600}
32601
32602var createTransitions$1 = createTransitions;
32603
32604var getComputedStyle = win && win.getComputedStyle;
32605var resolved = Promise.resolve();
32606
32607var names = {
32608  t0: 'intro-outro',
32609  t1: 'intro',
32610  t2: 'outro'
32611};
32612
32613var Transition = function Transition(options) {
32614  this.owner = options.owner || options.up.owner || findElement(options.up);
32615  this.element = this.owner.attributeByName ? this.owner : findElement(options.up);
32616  this.ractive = this.owner.ractive;
32617  this.template = options.template;
32618  this.up = options.up;
32619  this.options = options;
32620  this.onComplete = [];
32621};
32622var Transition__proto__ = Transition.prototype;
32623
32624Transition__proto__.animateStyle = function animateStyle (style, value, options) {
32625    var this$1 = this;
32626
32627  if (arguments.length === 4) {
32628    throw new Error(
32629      't.animateStyle() returns a promise - use .then() instead of passing a callback'
32630    );
32631  }
32632
32633  // Special case - page isn't visible. Don't animate anything, because
32634  // that way you'll never get CSS transitionend events
32635  if (!visible) {
32636    this.setStyle(style, value);
32637    return resolved;
32638  }
32639
32640  var to;
32641
32642  if (isString(style)) {
32643    to = {};
32644    to[style] = value;
32645  } else {
32646    to = style;
32647
32648    // shuffle arguments
32649    options = value;
32650  }
32651
32652  return new Promise(function (fulfil) {
32653    // Edge case - if duration is zero, set style synchronously and complete
32654    if (!options.duration) {
32655      this$1.setStyle(to);
32656      fulfil();
32657      return;
32658    }
32659
32660    // Get a list of the properties we're animating
32661    var propertyNames = keys(to);
32662    var changedProperties = [];
32663
32664    // Store the current styles
32665    var computedStyle = getComputedStyle(this$1.node);
32666
32667    var i = propertyNames.length;
32668    while (i--) {
32669      var prop = propertyNames[i];
32670      var name = prefix$1(prop);
32671
32672      var current = computedStyle[prefix$1(prop)];
32673
32674      // record the starting points
32675      var init = this$1.node.style[name];
32676      if (!(name in this$1.originals)) { this$1.originals[name] = this$1.node.style[name]; }
32677      this$1.node.style[name] = to[prop];
32678      this$1.targets[name] = this$1.node.style[name];
32679      this$1.node.style[name] = init;
32680
32681      // we need to know if we're actually changing anything
32682      if (current != to[prop]) {
32683        // use != instead of !==, so we can compare strings with numbers
32684        changedProperties.push(name);
32685
32686        // if we happened to prefix, make sure there is a properly prefixed value
32687        to[name] = to[prop];
32688
32689        // make the computed style explicit, so we can animate where
32690        // e.g. height='auto'
32691        this$1.node.style[name] = current;
32692      }
32693    }
32694
32695    // If we're not actually changing anything, the transitionend event
32696    // will never fire! So we complete early
32697    if (!changedProperties.length) {
32698      fulfil();
32699      return;
32700    }
32701
32702    createTransitions$1(this$1, to, options, changedProperties, fulfil);
32703  });
32704};
32705
32706Transition__proto__.bind = function bind () {
32707  var options = this.options;
32708  var type = options.template && options.template.v;
32709  if (type) {
32710    if (type === 't0' || type === 't1') { this.element.intro = this; }
32711    if (type === 't0' || type === 't2') { this.element.outro = this; }
32712    this.eventName = names[type];
32713  }
32714
32715  var ractive = this.owner.ractive;
32716
32717  this.name = options.name || options.template.n;
32718
32719  if (options.params) {
32720    this.params = options.params;
32721  }
32722
32723  if (isFunction(this.name)) {
32724    this._fn = this.name;
32725    this.name = this._fn.name;
32726  } else {
32727    this._fn = findInViewHierarchy('transitions', ractive, this.name);
32728  }
32729
32730  if (!this._fn) {
32731    warnOnceIfDebug(missingPlugin(this.name, 'transition'), { ractive: ractive });
32732  }
32733
32734  setupArgsFn(this, options.template);
32735};
32736
32737Transition__proto__.getParams = function getParams () {
32738  if (this.params) { return this.params; }
32739
32740  // get expression args if supplied
32741  if (this.fn) {
32742    var values = resolveArgs(this, this.template, this.up).map(function (model) {
32743      if (!model) { return undefined; }
32744
32745      return model.get();
32746    });
32747    return this.fn.apply(this.ractive, values);
32748  }
32749};
32750
32751Transition__proto__.getStyle = function getStyle (props) {
32752  var computedStyle = getComputedStyle(this.node);
32753
32754  if (isString(props)) {
32755    return computedStyle[prefix$1(props)];
32756  }
32757
32758  if (!isArray(props)) {
32759    throw new Error(
32760      'Transition$getStyle must be passed a string, or an array of strings representing CSS properties'
32761    );
32762  }
32763
32764  var styles = {};
32765
32766  var i = props.length;
32767  while (i--) {
32768    var prop = props[i];
32769    var value = computedStyle[prefix$1(prop)];
32770
32771    if (value === '0px') { value = 0; }
32772    styles[prop] = value;
32773  }
32774
32775  return styles;
32776};
32777
32778Transition__proto__.processParams = function processParams (params, defaults) {
32779  if (isNumber(params)) {
32780    params = { duration: params };
32781  } else if (isString(params)) {
32782    if (params === 'slow') {
32783      params = { duration: 600 };
32784    } else if (params === 'fast') {
32785      params = { duration: 200 };
32786    } else {
32787      params = { duration: 400 };
32788    }
32789  } else if (!params) {
32790    params = {};
32791  }
32792
32793  return assign({}, defaults, params);
32794};
32795
32796Transition__proto__.registerCompleteHandler = function registerCompleteHandler (fn) {
32797  addToArray(this.onComplete, fn);
32798};
32799
32800Transition__proto__.setStyle = function setStyle (style, value) {
32801    var this$1 = this;
32802
32803  if (isString(style)) {
32804    var name = prefix$1(style);
32805    if (!hasOwn(this.originals, name)) { this.originals[name] = this.node.style[name]; }
32806    this.node.style[name] = value;
32807    this.targets[name] = this.node.style[name];
32808  } else {
32809    var prop;
32810    for (prop in style) {
32811      if (hasOwn(style, prop)) {
32812        this$1.setStyle(prop, style[prop]);
32813      }
32814    }
32815  }
32816
32817  return this;
32818};
32819
32820Transition__proto__.shouldFire = function shouldFire (type) {
32821  if (!this.ractive.transitionsEnabled) { return false; }
32822
32823  // check for noIntro and noOutro cases, which only apply when the owner ractive is rendering and unrendering, respectively
32824  if (type === 'intro' && this.ractive.rendering && nearestProp('noIntro', this.ractive, true))
32825    { return false; }
32826  if (type === 'outro' && this.ractive.unrendering && nearestProp('noOutro', this.ractive, false))
32827    { return false; }
32828
32829  var params = this.getParams(); // this is an array, the params object should be the first member
32830  // if there's not a parent element, this can't be nested, so roll on
32831  if (!this.element.parent) { return true; }
32832
32833  // if there is a local param, it takes precedent
32834  if (params && params[0] && isObject(params[0]) && 'nested' in params[0]) {
32835    if (params[0].nested !== false) { return true; }
32836  } else {
32837    // use the nearest instance setting
32838    // find the nearest instance that actually has a nested setting
32839    if (nearestProp('nestedTransitions', this.ractive) !== false) { return true; }
32840  }
32841
32842  // check to see if this is actually a nested transition
32843  var el = this.element.parent;
32844  while (el) {
32845    if (el[type] && el[type].starting) { return false; }
32846    el = el.parent;
32847  }
32848
32849  return true;
32850};
32851
32852Transition__proto__.start = function start () {
32853    var this$1 = this;
32854
32855  var node = (this.node = this.element.node);
32856  var originals = (this.originals = {}); //= node.getAttribute( 'style' );
32857  var targets = (this.targets = {});
32858
32859  var completed;
32860  var args = this.getParams();
32861
32862  // create t.complete() - we don't want this on the prototype,
32863  // because we don't want `this` silliness when passing it as
32864  // an argument
32865  this.complete = function (noReset) {
32866    this$1.starting = false;
32867    if (completed) {
32868      return;
32869    }
32870
32871    this$1.onComplete.forEach(function (fn) { return fn(); });
32872    if (!noReset && this$1.isIntro) {
32873      for (var k in targets) {
32874        if (node.style[k] === targets[k]) { node.style[k] = originals[k]; }
32875      }
32876    }
32877
32878    this$1._manager.remove(this$1);
32879
32880    completed = true;
32881  };
32882
32883  // If the transition function doesn't exist, abort
32884  if (!this._fn) {
32885    this.complete();
32886    return;
32887  }
32888
32889  var promise = this._fn.apply(this.ractive, [this].concat(args));
32890  if (promise) { promise.then(this.complete); }
32891};
32892
32893Transition__proto__.toString = function toString () {
32894  return '';
32895};
32896
32897Transition__proto__.unbind = function unbind () {
32898  if (!this.element.attributes.unbinding) {
32899    var type = this.options && this.options.template && this.options.template.v;
32900    if (type === 't0' || type === 't1') { this.element.intro = null; }
32901    if (type === 't0' || type === 't2') { this.element.outro = null; }
32902  }
32903};
32904
32905Transition__proto__.unregisterCompleteHandler = function unregisterCompleteHandler (fn) {
32906  removeFromArray(this.onComplete, fn);
32907};
32908
32909var proto$8 = Transition.prototype;
32910proto$8.destroyed = proto$8.firstNode = proto$8.rebound = proto$8.render = proto$8.unrender = proto$8.update = noop;
32911
32912function nearestProp(prop, ractive, rendering) {
32913  var instance = ractive;
32914  while (instance) {
32915    if (
32916      hasOwn(instance, prop) &&
32917      (isUndefined(rendering) || rendering ? instance.rendering : instance.unrendering)
32918    )
32919      { return instance[prop]; }
32920    instance = instance.component && instance.component.ractive;
32921  }
32922
32923  return ractive[prop];
32924}
32925
32926var elementCache = {};
32927
32928var ieBug;
32929var ieBlacklist;
32930
32931try {
32932  createElement('table').innerHTML = 'foo';
32933} catch (/* istanbul ignore next */ err) {
32934  ieBug = true;
32935
32936  ieBlacklist = {
32937    TABLE: ['<table class="x">', '</table>'],
32938    THEAD: ['<table><thead class="x">', '</thead></table>'],
32939    TBODY: ['<table><tbody class="x">', '</tbody></table>'],
32940    TR: ['<table><tr class="x">', '</tr></table>'],
32941    SELECT: ['<select class="x">', '</select>']
32942  };
32943}
32944
32945function insertHtml(html$$1, node) {
32946  var nodes = [];
32947
32948  // render 0 and false
32949  if (html$$1 == null || html$$1 === '') { return nodes; }
32950
32951  var container;
32952  var wrapper;
32953  var selectedOption;
32954
32955  /* istanbul ignore if */
32956  if (ieBug && (wrapper = ieBlacklist[node.tagName])) {
32957    container = element('DIV');
32958    container.innerHTML = wrapper[0] + html$$1 + wrapper[1];
32959    container = container.querySelector('.x');
32960
32961    if (container.tagName === 'SELECT') {
32962      selectedOption = container.options[container.selectedIndex];
32963    }
32964  } else if (node.namespaceURI === svg$1) {
32965    container = element('DIV');
32966    container.innerHTML = '<svg class="x">' + html$$1 + '</svg>';
32967    container = container.querySelector('.x');
32968  } else if (node.tagName === 'TEXTAREA') {
32969    container = createElement('div');
32970
32971    if (typeof container.textContent !== 'undefined') {
32972      container.textContent = html$$1;
32973    } else {
32974      container.innerHTML = html$$1;
32975    }
32976  } else {
32977    container = element(node.tagName);
32978    container.innerHTML = html$$1;
32979
32980    if (container.tagName === 'SELECT') {
32981      selectedOption = container.options[container.selectedIndex];
32982    }
32983  }
32984
32985  var child;
32986  while ((child = container.firstChild)) {
32987    nodes.push(child);
32988    container.removeChild(child);
32989  }
32990
32991  // This is really annoying. Extracting <option> nodes from the
32992  // temporary container <select> causes the remaining ones to
32993  // become selected. So now we have to deselect them. IE8, you
32994  // amaze me. You really do
32995  // ...and now Chrome too
32996  var i;
32997  if (node.tagName === 'SELECT') {
32998    i = nodes.length;
32999    while (i--) {
33000      if (nodes[i] !== selectedOption) {
33001        nodes[i].selected = false;
33002      }
33003    }
33004  }
33005
33006  return nodes;
33007}
33008
33009function element(tagName) {
33010  return elementCache[tagName] || (elementCache[tagName] = createElement(tagName));
33011}
33012
33013var Triple = (function (Mustache) {
33014  function Triple(options) {
33015    Mustache.call(this, options);
33016  }
33017
33018  if ( Mustache ) Triple.__proto__ = Mustache;
33019  var Triple__proto__ = Triple.prototype = Object.create( Mustache && Mustache.prototype );
33020  Triple__proto__.constructor = Triple;
33021
33022  Triple__proto__.detach = function detach () {
33023    var docFrag = createDocumentFragment();
33024    if (this.nodes) { this.nodes.forEach(function (node) { return docFrag.appendChild(node); }); }
33025    return docFrag;
33026  };
33027
33028  Triple__proto__.find = function find (selector) {
33029    var this$1 = this;
33030
33031    var len = this.nodes.length;
33032    var i;
33033
33034    for (i = 0; i < len; i += 1) {
33035      var node = this$1.nodes[i];
33036
33037      if (node.nodeType !== 1) { continue; }
33038
33039      if (matches(node, selector)) { return node; }
33040
33041      var queryResult = node.querySelector(selector);
33042      if (queryResult) { return queryResult; }
33043    }
33044
33045    return null;
33046  };
33047
33048  Triple__proto__.findAll = function findAll (selector, options) {
33049    var this$1 = this;
33050
33051    var result = options.result;
33052    var len = this.nodes.length;
33053    var i;
33054
33055    for (i = 0; i < len; i += 1) {
33056      var node = this$1.nodes[i];
33057
33058      if (node.nodeType !== 1) { continue; }
33059
33060      if (matches(node, selector)) { result.push(node); }
33061
33062      var queryAllResult = node.querySelectorAll(selector);
33063      if (queryAllResult) {
33064        result.push.apply(result, queryAllResult);
33065      }
33066    }
33067  };
33068
33069  Triple__proto__.findComponent = function findComponent () {
33070    return null;
33071  };
33072
33073  Triple__proto__.firstNode = function firstNode () {
33074    return this.rendered && this.nodes[0];
33075  };
33076
33077  Triple__proto__.render = function render (target, occupants, anchor) {
33078    var this$1 = this;
33079
33080    if (!this.nodes) {
33081      var html = this.model ? this.model.get() : '';
33082      this.nodes = insertHtml(html, target);
33083    }
33084
33085    var nodes = this.nodes;
33086
33087    // progressive enhancement
33088    if (occupants) {
33089      var i = -1;
33090      var next;
33091
33092      // start with the first node that should be rendered
33093      while (occupants.length && (next = this.nodes[i + 1])) {
33094        var n = (void 0);
33095        // look through the occupants until a matching node is found
33096        while ((n = occupants.shift())) {
33097          var t = n.nodeType;
33098
33099          if (
33100            t === next.nodeType &&
33101            ((t === 1 && n.outerHTML === next.outerHTML) ||
33102              ((t === 3 || t === 8) && n.nodeValue === next.nodeValue))
33103          ) {
33104            this$1.nodes.splice(++i, 1, n); // replace the generated node with the existing one
33105            break;
33106          } else {
33107            target.removeChild(n); // remove the non-matching existing node
33108          }
33109        }
33110      }
33111
33112      if (i >= 0) {
33113        // update the list of remaining nodes to attach, excluding any that were replaced by existing nodes
33114        nodes = this.nodes.slice(i);
33115      }
33116
33117      // update the anchor to be the next occupant
33118      if (occupants.length) { anchor = occupants[0]; }
33119    }
33120
33121    // attach any remainging nodes to the parent
33122    if (nodes.length) {
33123      var frag = createDocumentFragment();
33124      nodes.forEach(function (n) { return frag.appendChild(n); });
33125
33126      if (anchor) {
33127        target.insertBefore(frag, anchor);
33128      } else {
33129        target.appendChild(frag);
33130      }
33131    }
33132
33133    this.rendered = true;
33134  };
33135
33136  Triple__proto__.toString = function toString () {
33137    var value = this.model && this.model.get();
33138    value = value != null ? '' + value : '';
33139
33140    return inAttribute() ? decodeCharacterReferences(value) : value;
33141  };
33142
33143  Triple__proto__.unrender = function unrender () {
33144    if (this.nodes)
33145      { this.nodes.forEach(function (node) {
33146        // defer detachment until all relevant outros are done
33147        runloop.detachWhenReady({
33148          node: node,
33149          detach: function detach() {
33150            detachNode(node);
33151          }
33152        });
33153      }); }
33154    this.rendered = false;
33155    this.nodes = null;
33156  };
33157
33158  Triple__proto__.update = function update () {
33159    if (this.rendered && this.dirty) {
33160      this.dirty = false;
33161
33162      this.unrender();
33163      this.render(this.up.findParentNode(), null, this.up.findNextNode(this));
33164    } else {
33165      // make sure to reset the dirty flag even if not rendered
33166      this.dirty = false;
33167    }
33168  };
33169
33170  return Triple;
33171}(Mustache));
33172
33173// finds the component constructor in the registry or view hierarchy registries
33174function getComponentConstructor(ractive, name) {
33175  var instance = findInstance('components', ractive, name);
33176  var Component;
33177
33178  if (instance) {
33179    Component = instance.components[name];
33180
33181    if (Component && !Component.isInstance) {
33182      if (Component.default && Component.default.isInstance) { Component = Component.default; }
33183      else if (!Component.then && isFunction(Component)) {
33184        // function option, execute and store for reset
33185        var fn = Component.bind(instance);
33186        fn.isOwner = hasOwn(instance.components, name);
33187        Component = fn();
33188
33189        if (!Component) {
33190          warnIfDebug(noRegistryFunctionReturn, name, 'component', 'component', {
33191            ractive: ractive
33192          });
33193          return;
33194        }
33195
33196        if (isString(Component)) {
33197          // allow string lookup
33198          Component = getComponentConstructor(ractive, Component);
33199        }
33200
33201        Component._fn = fn;
33202        instance.components[name] = Component;
33203      }
33204    }
33205  }
33206
33207  return Component;
33208}
33209
33210function asyncProxy(promise, options) {
33211  var partials = options.template.p || {};
33212  var name = options.template.e;
33213
33214  var opts = assign({}, options, {
33215    template: { t: ELEMENT, e: name },
33216    macro: function macro(handle) {
33217      handle.setTemplate(partials['async-loading'] || []);
33218      promise.then(
33219        function (cmp) {
33220          options.up.ractive.components[name] = cmp;
33221          if (partials['async-loaded']) {
33222            handle.partials.component = [options.template];
33223            handle.setTemplate(partials['async-loaded']);
33224          } else {
33225            handle.setTemplate([options.template]);
33226          }
33227        },
33228        function (err) {
33229          if (partials['async-failed']) {
33230            handle.aliasLocal('error', 'error');
33231            handle.set('@local.error', err);
33232            handle.setTemplate(partials['async-failed']);
33233          } else {
33234            handle.setTemplate([]);
33235          }
33236        }
33237      );
33238    }
33239  });
33240  return new Partial(opts);
33241}
33242
33243function extract(tpl, type, name) {
33244  var p = tpl.f.find(function (s) { return s.t === type; });
33245  if (p) {
33246    if (p.n)
33247      { return [
33248        {
33249          t: 19,
33250          n: 54,
33251          f: p.f || [],
33252          z: [{ n: p.n, x: { r: ("__await." + name) } }]
33253        }
33254      ]; }
33255    else { return p.f || []; }
33256  } else { return []; }
33257}
33258
33259function Await(options) {
33260  var tpl = options.template;
33261
33262  var success = extract(tpl, THEN, 'value');
33263  var error = extract(tpl, CATCH, 'error');
33264  var pending = extract(tpl, SECTION);
33265  var undef = extract(tpl, ELSE);
33266
33267  var opts = assign({}, options, {
33268    template: {
33269      t: ELEMENT,
33270      m: [
33271        {
33272          t: ATTRIBUTE,
33273          n: 'for',
33274          f: [{ t: INTERPOLATOR, r: tpl.r, rx: tpl.rx, x: tpl.x }]
33275        }
33276      ]
33277    },
33278    macro: function macro(handle, attrs) {
33279      handle.aliasLocal('__await');
33280
33281      function update(attrs) {
33282        if (attrs.for && isFunction(attrs.for.then)) {
33283          handle.setTemplate(pending);
33284
33285          attrs.for.then(
33286            function (v) {
33287              handle.set('@local.value', v);
33288              handle.setTemplate(success);
33289            },
33290            function (e) {
33291              handle.set('@local.error', e);
33292              handle.setTemplate(error);
33293            }
33294          );
33295        } else if (isUndefined(attrs.for)) {
33296          handle.setTemplate(undef);
33297        } else {
33298          handle.set('@local.value', attrs.for);
33299          handle.setTemplate(success);
33300        }
33301      }
33302
33303      update(attrs);
33304
33305      return {
33306        update: update
33307      };
33308    }
33309  });
33310
33311  opts.macro.attributes = ['for'];
33312
33313  return new Partial(opts);
33314}
33315
33316var constructors = {};
33317constructors[ALIAS] = Section;
33318constructors[ANCHOR] = Component;
33319constructors[AWAIT] = Await;
33320constructors[DOCTYPE] = Doctype;
33321constructors[INTERPOLATOR] = Interpolator;
33322constructors[PARTIAL] = Partial;
33323constructors[SECTION] = Section;
33324constructors[TRIPLE] = Triple;
33325constructors[YIELDER] = Partial;
33326
33327constructors[ATTRIBUTE] = Attribute;
33328constructors[BINDING_FLAG] = BindingFlag;
33329constructors[DECORATOR] = Decorator;
33330constructors[EVENT] = EventDirective;
33331constructors[TRANSITION] = Transition;
33332constructors[COMMENT] = Comment;
33333
33334var specialElements = {
33335  doctype: Doctype,
33336  form: Form,
33337  input: Input,
33338  option: Option,
33339  select: Select,
33340  textarea: Textarea
33341};
33342
33343function createItem(options) {
33344  if (isString(options.template)) {
33345    return new Text(options);
33346  }
33347
33348  var ctor;
33349  var name;
33350  var type = options.template.t;
33351
33352  if (type === ELEMENT) {
33353    name = options.template.e;
33354
33355    // could be a macro partial
33356    ctor = findInstance('partials', options.up.ractive, name);
33357    if (ctor) {
33358      ctor = ctor.partials[name];
33359      if (ctor.styleSet) {
33360        options.macro = ctor;
33361        return new Partial(options);
33362      }
33363    }
33364
33365    // could be component or element
33366    ctor = getComponentConstructor(options.up.ractive, name);
33367    if (ctor) {
33368      if (isFunction(ctor.then)) {
33369        return asyncProxy(ctor, options);
33370      } else if (isFunction(ctor)) {
33371        return new Component(options, ctor);
33372      }
33373    }
33374
33375    ctor = specialElements[name.toLowerCase()] || Element;
33376    return new ctor(options);
33377  }
33378
33379  var Item;
33380
33381  // component mappings are a special case of attribute
33382  if (type === ATTRIBUTE) {
33383    var el = options.owner;
33384    if (!el || (el.type !== ANCHOR && el.type !== COMPONENT && el.type !== ELEMENT)) {
33385      el = findElement(options.up);
33386    }
33387    options.element = el;
33388
33389    Item = el.type === COMPONENT || el.type === ANCHOR ? Mapping : Attribute;
33390  } else {
33391    Item = constructors[type];
33392  }
33393
33394  if (!Item) { throw new Error(("Unrecognised item type " + type)); }
33395
33396  return new Item(options);
33397}
33398
33399// TODO all this code needs to die
33400function processItems(items, values, guid, counter) {
33401  if ( counter === void 0 ) counter = 0;
33402
33403  return items
33404    .map(function (item) {
33405      if (item.type === TEXT) {
33406        return item.template;
33407      }
33408
33409      if (item.fragment) {
33410        if (item.fragment.iterations) {
33411          return item.fragment.iterations
33412            .map(function (fragment) {
33413              return processItems(fragment.items, values, guid, counter);
33414            })
33415            .join('');
33416        } else {
33417          return processItems(item.fragment.items, values, guid, counter);
33418        }
33419      }
33420
33421      var placeholderId = guid + "-" + (counter++);
33422      var model = item.model || item.newModel;
33423
33424      values[placeholderId] = model
33425        ? model.wrapper
33426          ? model.wrapperValue
33427          : model.get()
33428        : undefined;
33429
33430      return '${' + placeholderId + '}';
33431    })
33432    .join('');
33433}
33434
33435function resolveAliases(aliases, fragment, dest) {
33436  if ( dest === void 0 ) dest = {};
33437
33438  for (var i = 0; i < aliases.length; i++) {
33439    if (!dest[aliases[i].n]) {
33440      var m = resolve(fragment, aliases[i].x);
33441      dest[aliases[i].n] = m;
33442      m.reference();
33443    }
33444  }
33445
33446  return dest;
33447}
33448
33449var Fragment = function Fragment(options) {
33450  this.owner = options.owner; // The item that owns this fragment - an element, section, partial, or attribute
33451
33452  this.isRoot = !options.owner.up;
33453  this.parent = this.isRoot ? null : this.owner.up;
33454  this.ractive = options.ractive || (this.isRoot ? options.owner : this.parent.ractive);
33455
33456  this.componentParent =
33456 this.isRoot && this.ractive.component ? this.ractive.component.up :
vendor: 7,530 bytes, lines 33456-33726
33456 null;
33457  if (!this.isRoot || this.ractive.delegate) {
33458    this.delegate = this.owner.containerFragment
33459      ? this.owner.containerFragment && this.owner.containerFragment.delegate
33460      : (this.componentParent && this.componentParent.delegate) ||
33461        (this.parent && this.parent.delegate);
33462  } else {
33463    this.delegate = false;
33464  }
33465
33466  this.context = null;
33467  this.rendered = false;
33468
33469  // encapsulated styles should be inherited until they get applied by an element
33470  if ('cssIds' in options) {
33471    this.cssIds = options.cssIds && options.cssIds.length && options.cssIds;
33472  } else {
33473    this.cssIds = this.parent ? this.parent.cssIds : null;
33474  }
33475
33476  this.dirty = false;
33477  this.dirtyValue = true; // used for attribute values
33478
33479  this.template = options.template || [];
33480  this.createItems();
33481};
33482var Fragment__proto__ = Fragment.prototype;
33483
33484Fragment__proto__.bind = function bind (context) {
33485    var this$1 = this;
33486
33487  this.context = context;
33488
33489  if (this.owner.template.z) {
33490    this.aliases = resolveAliases(
33491      this.owner.template.z,
33492      this.owner.containerFragment || this.parent
33493    );
33494  }
33495
33496  var len = this.items.length;
33497  for (var i = 0; i < len; i++) { this$1.items[i].bind(); }
33498  this.bound = true;
33499
33500  // in rare cases, a forced resolution (or similar) will cause the
33501  // fragment to be dirty before it's even finished binding. In those
33502  // cases we update immediately
33503  if (this.dirty) { this.update(); }
33504
33505  return this;
33506};
33507
33508Fragment__proto__.bubble = function bubble () {
33509  this.dirtyValue = true;
33510
33511  if (!this.dirty) {
33512    this.dirty = true;
33513
33514    if (this.isRoot) {
33515      // TODO encapsulate 'is component root, but not overall root' check?
33516      if (this.ractive.component) {
33517        this.ractive.component.bubble();
33518      } else if (this.bound) {
33519        runloop.addFragment(this);
33520      }
33521    } else {
33522      this.owner.bubble(this.index);
33523    }
33524  }
33525};
33526
33527Fragment__proto__.createItems = function createItems () {
33528    var this$1 = this;
33529
33530  // this is a hot code path
33531  var max = this.template.length;
33532  this.items = [];
33533  for (var i = 0; i < max; i++) {
33534    this$1.items[i] = createItem({
33535      up: this$1,
33536      template: this$1.template[i],
33537      index: i
33538    });
33539  }
33540};
33541
33542Fragment__proto__.destroyed = function destroyed () {
33543    var this$1 = this;
33544
33545  var len = this.items.length;
33546  for (var i = 0; i < len; i++) { this$1.items[i].destroyed(); }
33547  if (this.pathModel) { this.pathModel.destroyed(); }
33548  if (this.rootModel) { this.rootModel.destroyed(); }
33549};
33550
33551Fragment__proto__.detach = function detach () {
33552  var docFrag = createDocumentFragment();
33553  var xs = this.items;
33554  var len = xs.length;
33555  for (var i = 0; i < len; i++) {
33556    docFrag.appendChild(xs[i].detach());
33557  }
33558  return docFrag;
33559};
33560
33561Fragment__proto__.find = function find (selector, options) {
33562  return findMap(this.items, function (i) { return i.find(selector, options); });
33563};
33564
33565Fragment__proto__.findAll = function findAll (selector, options) {
33566  if (this.items) {
33567    this.items.forEach(function (i) { return i.findAll && i.findAll(selector, options); });
33568  }
33569};
33570
33571Fragment__proto__.findComponent = function findComponent (name, options) {
33572  return findMap(this.items, function (i) { return i.findComponent(name, options); });
33573};
33574
33575Fragment__proto__.findAllComponents = function findAllComponents (name, options) {
33576  if (this.items) {
33577    this.items.forEach(function (i) { return i.findAllComponents && i.findAllComponents(name, options); });
33578  }
33579};
33580
33581Fragment__proto__.findContext = function findContext () {
33582  var base = findParentWithContext(this);
33583  if (!base || !base.context) { return this.ractive.viewmodel; }
33584  else { return base.context; }
33585};
33586
33587Fragment__proto__.findNextNode = function findNextNode (item) {
33588    var this$1 = this;
33589
33590  // search for the next node going forward
33591  if (item) {
33592    var it;
33593    for (var i = item.index + 1; i < this.items.length; i++) {
33594      it = this$1.items[i];
33595      if (!it || !it.firstNode) { continue; }
33596
33597      var node = it.firstNode(true);
33598      if (node) { return node; }
33599    }
33600  }
33601
33602  // if this is the root fragment, and there are no more items,
33603  // it means we're at the end...
33604  if (this.isRoot) {
33605    if (this.ractive.component) {
33606      return this.ractive.component.up.findNextNode(this.ractive.component);
33607    }
33608
33609    // TODO possible edge case with other content
33610    // appended to this.ractive.el?
33611    return null;
33612  }
33613
33614  if (this.parent) { return this.owner.findNextNode(this); } // the argument is in case the parent is a RepeatedFragment
33615};
33616
33617Fragment__proto__.findParentNode = function findParentNode () {
33618  var fragment = this;
33619
33620  do {
33621    if (fragment.owner.type === ELEMENT) {
33622      return fragment.owner.node;
33623    }
33624
33625    if (fragment.isRoot && !fragment.ractive.component) {
33626      // TODO encapsulate check
33627      return fragment.ractive.el;
33628    }
33629
33630    if (fragment.owner.type === YIELDER) {
33631      fragment = fragment.owner.containerFragment;
33632    } else {
33633      fragment = fragment.componentParent || fragment.parent; // TODO ugh
33634    }
33635  } while (fragment);
33636
33637  throw new Error('Could not find parent node'); // TODO link to issue tracker
33638};
33639
33640Fragment__proto__.firstNode = function firstNode (skipParent) {
33641  var node = findMap(this.items, function (i) { return i.firstNode(true); });
33642  if (node) { return node; }
33643  if (skipParent) { return null; }
33644
33645  return this.parent.findNextNode(this.owner);
33646};
33647
33648Fragment__proto__.getKey = function getKey () {
33649  return this.keyModel || (this.keyModel = new KeyModel(this.key));
33650};
33651
33652Fragment__proto__.getIndex = function getIndex () {
33653  return this.idxModel || (this.idxModel = new KeyModel(this.index));
33654};
33655
33656Fragment__proto__.rebind = function rebind (next) {
33657  this.context = next;
33658  if (this.rootModel) { this.rootModel.context = this.context; }
33659  if (this.pathModel) { this.pathModel.context = this.context; }
33660};
33661
33662Fragment__proto__.rebound = function rebound (update$$1) {
33663  if (this.owner.template.z) {
33664    var aliases = this.aliases;
33665    for (var k in aliases) {
33666      if (aliases[k].rebound) { aliases[k].rebound(update$$1); }
33667      else {
33668        aliases[k].unreference();
33669        aliases[k] = 0;
33670      }
33671    }
33672
33673    resolveAliases(this.owner.template.z, this.owner.containerFragment || this.parent, aliases);
33674  }
33675
33676  this.items.forEach(function (x) { return x.rebound(update$$1); });
33677  if (update$$1) {
33678    if (this.rootModel) { this.rootModel.applyValue(this.context.getKeypath(this.ractive.root)); }
33679    if (this.pathModel) { this.pathModel.applyValue(this.context.getKeypath()); }
33680  }
33681};
33682
33683Fragment__proto__.render = function render (target, occupants) {
33684  if (this.rendered) { throw new Error('Fragment is already rendered!'); }
33685  this.rendered = true;
33686
33687  var xs = this.items;
33688  var len = xs.length;
33689  for (var i = 0; i < len; i++) {
33690    xs[i].render(target, occupants);
33691  }
33692};
33693
33694Fragment__proto__.resetTemplate = function resetTemplate (template) {
33695  var wasBound = this.bound;
33696  var wasRendered = this.rendered;
33697
33698  // TODO ensure transitions are disabled globally during reset
33699
33700  if (wasBound) {
33701    if (wasRendered) { this.unrender(true); }
33702    this.unbind();
33703  }
33704
33705  this.template = template;
33706  this.createItems();
33707
33708  if (wasBound) {
33709    this.bind(this.context);
33710
33711    if (wasRendered) {
33712      var parentNode = this.findParentNode();
33713      var anchor = this.findNextNode();
33714
33715      if (anchor) {
33716        var docFrag = createDocumentFragment();
33717        this.render(docFrag);
33718        parentNode.insertBefore(docFrag, anchor);
33719      } else {
33720        this.render(parentNode);
33721      }
33722    }
33723  }
33724};
33725
33726Fragment__proto__.shuffled = function shuffled$
337262
vendor: 14,994 bytes, lines 33726-34277
33726 () {
33727  this.items.forEach(shuffled);
33728  if (this.rootModel) { this.rootModel.applyValue(this.context.getKeypath(this.ractive.root)); }
33729  if (this.pathModel) { this.pathModel.applyValue(this.context.getKeypath()); }
33730};
33731
33732Fragment__proto__.toString = function toString (escape) {
33733  return this.items.map(escape ? toEscapedString : toString$1).join('');
33734};
33735
33736Fragment__proto__.unbind = function unbind (view) {
33737    var this$1 = this;
33738
33739  if (this.owner.template.z && !this.owner.yielder) {
33740    for (var k in this$1.aliases) {
33741      this$1.aliases[k].unreference();
33742    }
33743
33744    this.aliases = {};
33745  }
33746
33747  this.context = null;
33748  var len = this.items.length;
33749  for (var i = 0; i < len; i++) { this$1.items[i].unbind(view); }
33750  this.bound = false;
33751
33752  return this;
33753};
33754
33755Fragment__proto__.unrender = function unrender (shouldDestroy) {
33756    var this$1 = this;
33757
33758  var len = this.items.length;
33759  for (var i = 0; i < len; i++) { this$1.items[i].unrender(shouldDestroy); }
33760  this.rendered = false;
33761};
33762
33763Fragment__proto__.update = function update () {
33764    var this$1 = this;
33765
33766  if (this.dirty) {
33767    if (!this.updating) {
33768      this.dirty = false;
33769      this.updating = true;
33770      var len = this.items.length;
33771      for (var i = 0; i < len; i++) { this$1.items[i].update(); }
33772      this.updating = false;
33773    } else if (this.isRoot) {
33774      runloop.addFragmentToRoot(this);
33775    }
33776  }
33777};
33778
33779Fragment__proto__.valueOf = function valueOf () {
33780  if (this.items.length === 1) {
33781    return this.items[0].valueOf();
33782  }
33783
33784  if (this.dirtyValue) {
33785    var values = {};
33786    var source = processItems(this.items, values, this.ractive._guid);
33787    var parsed = parseJSON(source, values);
33788
33789    this.value = parsed ? parsed.value : this.toString();
33790
33791    this.dirtyValue = false;
33792  }
33793
33794  return this.value;
33795};
33796Fragment.prototype.getContext = getContext;
33797Fragment.prototype.getKeypath = getKeypath;
33798
33799function getKeypath(root) {
33800  var base = findParentWithContext(this);
33801  var model;
33802  if (root) {
33803    if (!this.rootModel) {
33804      this.rootModel = new KeyModel(
33805        this.context.getKeypath(this.ractive.root),
33806        this.context,
33807        this.ractive.root
33808      );
33809      model = this.rootModel;
33810    } else { return this.rootModel; }
33811  } else {
33812    if (!this.pathModel) {
33813      this.pathModel = new KeyModel(this.context.getKeypath(), this.context);
33814      model = this.pathModel;
33815    } else { return this.pathModel; }
33816  }
33817
33818  if (base && base.context) { base.getKeypath(root).registerChild(model); }
33819
33820  return model;
33821}
33822
33823function initialise(ractive, userOptions, options) {
33824  // initialize settable computeds
33825  var computed = ractive.viewmodel.computed;
33826  if (computed) {
33827    for (var k in computed) {
33828      if (k in ractive.viewmodel.value && computed[k] && !computed[k].isReadonly) {
33829        computed[k].set(ractive.viewmodel.value[k]);
33830      }
33831    }
33832  }
33833
33834  // init config from Parent and options
33835  config.init(ractive.constructor, ractive, userOptions);
33836
33837  // call any passed in plugins
33838  if (isArray(userOptions.use))
33839    { ractive.use.apply(ractive, userOptions.use.filter(function (p) { return !p.construct; })); }
33840
33841  hooks.config.fire(ractive);
33842
33843  hooks.init.begin(ractive);
33844
33845  var fragment = (ractive.fragment = createFragment$1(ractive, options));
33846  if (fragment) { fragment.bind(ractive.viewmodel); }
33847
33848  hooks.init.end(ractive);
33849
33850  // general config done, set up observers
33851  subscribe(ractive, userOptions, 'observe');
33852
33853  if (fragment) {
33854    // render automatically ( if `el` is specified )
33855    var el = (ractive.el = ractive.target = getElement(ractive.el || ractive.target));
33856    if (el && !ractive.component) {
33857      var promise = ractive.render(el, ractive.append);
33858
33859      if (Ractive.DEBUG_PROMISES) {
33860        promise.catch(function (err) {
33861          warnOnceIfDebug(
33862            'Promise debugging is enabled, to help solve errors that happen asynchronously. Some browsers will log unhandled promise rejections, in which case you can safely disable promise debugging:\n  Ractive.DEBUG_PROMISES = false;'
33863          );
33864          warnIfDebug('An error happened during rendering', { ractive: ractive });
33865          logIfDebug(err);
33866
33867          throw err;
33868        });
33869      }
33870    }
33871  }
33872}
33873
33874function createFragment$1(ractive, options) {
33875  if ( options === void 0 ) options = {};
33876
33877  if (ractive.template) {
33878    var cssIds = [].concat(ractive.constructor._cssIds || [], options.cssIds || []);
33879
33880    return new Fragment({
33881      owner: ractive,
33882      template: ractive.template,
33883      cssIds: cssIds
33884    });
33885  }
33886}
33887
33888function render$1(ractive, target, anchor, occupants) {
33889  // set a flag to let any transitions know that this instance is currently rendering
33890  ractive.rendering = true;
33891
33892  var promise = runloop.start();
33893  runloop.scheduleTask(function () { return hooks.render.fire(ractive); }, true);
33894
33895  if (ractive.fragment.rendered) {
33896    throw new Error(
33897      'You cannot call ractive.render() on an already rendered instance! Call ractive.unrender() first'
33898    );
33899  }
33900
33901  if (ractive.destroyed) {
33902    ractive.destroyed = false;
33903    ractive.fragment = createFragment$1(ractive).bind(ractive.viewmodel);
33904  }
33905
33906  anchor = getElement(anchor) || ractive.anchor;
33907
33908  ractive.el = ractive.target = target;
33909  ractive.anchor = anchor;
33910
33911  // ensure encapsulated CSS is up-to-date
33912  if (ractive.cssId) { applyCSS(); }
33913
33914  if (target) {
33915    (target.__ractive_instances__ || (target.__ractive_instances__ = [])).push(ractive);
33916
33917    if (anchor) {
33918      var docFrag = doc.createDocumentFragment();
33919      ractive.fragment.render(docFrag);
33920      target.insertBefore(docFrag, anchor);
33921    } else {
33922      ractive.fragment.render(target, occupants);
33923    }
33924  }
33925
33926  runloop.end();
33927  ractive.rendering = false;
33928
33929  return promise.then(function () {
33930    if (ractive.torndown) { return; }
33931
33932    hooks.complete.fire(ractive);
33933  });
33934}
33935
33936function Ractive$render(target, anchor) {
33937  if (this.torndown) {
33938    warnIfDebug('ractive.render() was called on a Ractive instance that was already torn down');
33939    return Promise.resolve();
33940  }
33941
33942  target = getElement(target) || this.el;
33943
33944  if (!this.append && target) {
33945    // Teardown any existing instances *before* trying to set up the new one -
33946    // avoids certain weird bugs
33947    var others = target.__ractive_instances__;
33948    if (others) { others.forEach(teardown); }
33949
33950    // make sure we are the only occupants
33951    if (!this.enhance) {
33952      target.innerHTML = ''; // TODO is this quicker than removeChild? Initial research inconclusive
33953    }
33954  }
33955
33956  var occupants = this.enhance ? toArray(target.childNodes) : null;
33957  var promise = render$1(this, target, anchor, occupants);
33958
33959  if (occupants) {
33960    while (occupants.length) { target.removeChild(occupants.pop()); }
33961  }
33962
33963  return promise;
33964}
33965
33966var shouldRerender = ['template', 'partials', 'components', 'decorators', 'events'];
33967
33968function Ractive$reset(data) {
33969  data = data || {};
33970
33971  if (!isObjectType(data)) {
33972    throw new Error('The reset method takes either no arguments, or an object containing new data');
33973  }
33974
33975  // TEMP need to tidy this up
33976  data = dataConfigurator.init(this.constructor, this, { data: data });
33977
33978  var promise = runloop.start();
33979
33980  // If the root object is wrapped, try and use the wrapper's reset value
33981  var wrapper = this.viewmodel.wrapper;
33982  if (wrapper && wrapper.reset) {
33983    if (wrapper.reset(data) === false) {
33984      // reset was rejected, we need to replace the object
33985      this.viewmodel.set(data);
33986    }
33987  } else {
33988    this.viewmodel.set(data);
33989  }
33990
33991  // reset config items and track if need to rerender
33992  var changes = config.reset(this);
33993  var rerender;
33994
33995  var i = changes.length;
33996  while (i--) {
33997    if (shouldRerender.indexOf(changes[i]) > -1) {
33998      rerender = true;
33999      break;
34000    }
34001  }
34002
34003  if (rerender) {
34004    hooks.unrender.fire(this);
34005    this.fragment.resetTemplate(this.template);
34006    hooks.render.fire(this);
34007    hooks.complete.fire(this);
34008  }
34009
34010  runloop.end();
34011
34012  hooks.reset.fire(this, data);
34013
34014  return promise;
34015}
34016
34017function collect$1(source, name, attr, dest) {
34018  source.forEach(function (item) {
34019    // queue to rerender if the item is a partial and the current name matches
34020    if (item.type === PARTIAL && (item.refName === name || item.name === name)) {
34021      item.inAttribute = attr;
34022      dest.push(item);
34023      return; // go no further
34024    }
34025
34026    // if it has a fragment, process its items
34027    if (item.fragment) {
34028      collect$1(item.fragment.iterations || item.fragment.items, name, attr, dest);
34029    } else if (isArray(item.items)) {
34030      // or if it is itself a fragment, process its items
34031      collect$1(item.items, name, attr, dest);
34032    } else if (item.type === COMPONENT && item.instance) {
34033      // or if it is a component, step in and process its items
34034      // ...unless the partial is shadowed
34035      if (item.instance.partials[name]) { return; }
34036      collect$1(item.instance.fragment.items, name, attr, dest);
34037    }
34038
34039    // if the item is an element, process its attributes too
34040    if (item.type === ELEMENT) {
34041      if (isArray(item.attributes)) {
34042        collect$1(item.attributes, name, true, dest);
34043      }
34044    }
34045  });
34046}
34047
34048function resetPartial(name, partial) {
34049  var collection = [];
34050  collect$1(this.fragment.items, name, false, collection);
34051
34052  var promise = runloop.start();
34053
34054  this.partials[name] = partial;
34055  collection.forEach(handleChange);
34056
34057  runloop.end();
34058
34059  return promise;
34060}
34061
34062// TODO should resetTemplate be asynchronous? i.e. should it be a case
34063// of outro, update template, intro? I reckon probably not, since that
34064// could be achieved with unrender-resetTemplate-render. Also, it should
34065// conceptually be similar to resetPartial, which couldn't be async
34066
34067function Ractive$resetTemplate(template) {
34068  templateConfigurator.init(null, this, { template: template });
34069
34070  var transitionsEnabled = this.transitionsEnabled;
34071  this.transitionsEnabled = false;
34072
34073  // Is this is a component, we need to set the `shouldDestroy`
34074  // flag, otherwise it will assume by default that a parent node
34075  // will be detached, and therefore it doesn't need to bother
34076  // detaching its own nodes
34077  var component = this.component;
34078  if (component) { component.shouldDestroy = true; }
34079  this.unrender();
34080  if (component) { component.shouldDestroy = false; }
34081
34082  var promise = runloop.start();
34083
34084  // remove existing fragment and create new one
34085  this.fragment.unbind().unrender(true);
34086
34087  this.fragment = new Fragment({
34088    template: this.template,
34089    root: this,
34090    owner: this
34091  });
34092
34093  var docFrag = createDocumentFragment();
34094  this.fragment.bind(this.viewmodel).render(docFrag);
34095
34096  // if this is a component, its el may not be valid, so find a
34097  // target based on the component container
34098  if (component && !component.external) {
34099    this.fragment.findParentNode().insertBefore(docFrag, component.findNextNode());
34100  } else {
34101    this.el.insertBefore(docFrag, this.anchor);
34102  }
34103
34104  runloop.end();
34105
34106  this.transitionsEnabled = transitionsEnabled;
34107
34108  return promise;
34109}
34110
34111var reverse = makeArrayMethod('reverse').path;
34112
34113function Ractive$set(keypath, value, options) {
34114  var ractive = this;
34115
34116  var opts = isObjectType(keypath) ? value : options;
34117
34118  return set(build(ractive, keypath, value, opts && opts.isolated), opts);
34119}
34120
34121var shift = makeArrayMethod('shift').path;
34122
34123var sort = makeArrayMethod('sort').path;
34124
34125var splice = makeArrayMethod('splice').path;
34126
34127function Ractive$subtract(keypath, d, options) {
34128  var num = isNumber(d) ? -d : -1;
34129  var opts = isObjectType(d) ? d : options;
34130  return add(this, keypath, num, opts);
34131}
34132
34133function Ractive$toggle(keypath, options) {
34134  if (!isString(keypath)) {
34135    throw new TypeError(badArguments);
34136  }
34137
34138  return set(
34139    gather(this, keypath, null, options && options.isolated).map(function (m) { return [m, !m.get()]; }),
34140    options
34141  );
34142}
34143
34144function Ractive$toCSS() {
34145  var cssIds = [this.cssId ].concat( this.findAllComponents().map(function (c) { return c.cssId; }));
34146  var uniqueCssIds = keys(cssIds.reduce(function (ids, id) { return (ids[id] = true, ids); }, {}));
34147  return getCSS(uniqueCssIds);
34148}
34149
34150function Ractive$toHTML() {
34151  return this.fragment.toString(true);
34152}
34153
34154function toText() {
34155  return this.fragment.toString(false);
34156}
34157
34158function Ractive$transition(name, node, params) {
34159  if (node instanceof HTMLElement) {
34160    // good to go
34161  } else if (isObject(node)) {
34162    // omitted, use event node
34163    params = node;
34164  }
34165
34166  // if we allow query selector, then it won't work
34167  // simple params like "fast"
34168
34169  // else if ( typeof node === 'string' ) {
34170  // 	// query selector
34171  // 	node = this.find( node )
34172  // }
34173
34174  node = node || this.event.node;
34175
34176  if (!node || !node._ractive) {
34177    fatal(("No node was supplied for transition " + name));
34178  }
34179
34180  params = params || {};
34181  var owner = node._ractive.proxy;
34182  var transition = new Transition({ owner: owner, up: owner.up, name: name, params: params });
34183  transition.bind();
34184
34185  var promise = runloop.start();
34186  runloop.registerTransition(transition);
34187  runloop.end();
34188
34189  promise.then(function () { return transition.unbind(); });
34190  return promise;
34191}
34192
34193function unlink(here) {
34194  var promise = runloop.start();
34195  this.viewmodel.joinAll(splitKeypath(here), { lastLink: false }).unlink();
34196  runloop.end();
34197  return promise;
34198}
34199
34200function Ractive$unrender() {
34201  if (!this.fragment.rendered) {
34202    warnIfDebug('ractive.unrender() was called on a Ractive instance that was not rendered');
34203    return Promise.resolve();
34204  }
34205
34206  this.unrendering = true;
34207  var promise = runloop.start();
34208
34209  hooks.unrendering.fire(this);
34210
34211  // If this is a component, and the component isn't marked for destruction,
34212  // don't detach nodes from the DOM unnecessarily
34213  var shouldDestroy =
34214    !this.component ||
34215    (this.component.anchor || {}).shouldDestroy ||
34216    this.component.shouldDestroy ||
34217    this.shouldDestroy;
34218  this.fragment.unrender(shouldDestroy);
34219  if (shouldDestroy) { this.destroyed = true; }
34220
34221  removeFromArray(this.el.__ractive_instances__, this);
34222
34223  hooks.unrender.fire(this);
34224
34225  runloop.end();
34226  this.unrendering = false;
34227
34228  return promise;
34229}
34230
34231var unshift = makeArrayMethod('unshift').path;
34232
34233function Ractive$updateModel(keypath, cascade) {
34234  var promise = runloop.start();
34235
34236  if (!keypath) {
34237    this.viewmodel.updateFromBindings(true);
34238  } else {
34239    this.viewmodel.joinAll(splitKeypath(keypath)).updateFromBindings(cascade !== false);
34240  }
34241
34242  runloop.end();
34243
34244  return promise;
34245}
34246
34247function use() {
34248  var this$1 = this;
34249  var plugins = [], len = arguments.length;
34250  while ( len-- ) plugins[ len ] = arguments[ len ];
34251
34252  plugins.forEach(function (p) {
34253    p({
34254      proto: this$1,
34255      Ractive: this$1.constructor.Ractive,
34256      instance: this$1
34257    });
34258  });
34259  return this;
34260}
34261
34262var proto$9 = {
34263  add: Ractive$add,
34264  animate: Ractive$animate,
34265  attachChild: attachChild,
34266  compute: Ractive$compute,
34267  detach: Ractive$detach,
34268  detachChild: detachChild,
34269  find: Ractive$find,
34270  findAll: Ractive$findAll,
34271  findAllComponents: Ractive$findAllComponents,
34272  findComponent: Ractive$findComponent,
34273  findContainer: Ractive$findContainer,
34274  findParent: Ractive$findParent,
34275  fire: Ractive$fire,
34276  get: Ractive$get,
34277  get
vendor: 6,406 bytes, lines 34277-34520
34277Context: getContext$2,
34278  insert: Ractive$insert,
34279  link: link,
34280  observe: observe,
34281  observeOnce: observeOnce,
34282  off: Ractive$off,
34283  on: Ractive$on,
34284  once: Ractive$once,
34285  pop: pop,
34286  push: push,
34287  readLink: readLink,
34288  render: Ractive$render,
34289  reset: Ractive$reset,
34290  resetPartial: resetPartial,
34291  resetTemplate: Ractive$resetTemplate,
34292  reverse: reverse,
34293  set: Ractive$set,
34294  shift: shift,
34295  sort: sort,
34296  splice: splice,
34297  subtract: Ractive$subtract,
34298  teardown: Ractive$teardown,
34299  toggle: Ractive$toggle,
34300  toCSS: Ractive$toCSS,
34301  toCss: Ractive$toCSS,
34302  toHTML: Ractive$toHTML,
34303  toHtml: Ractive$toHTML,
34304  toText: toText,
34305  transition: Ractive$transition,
34306  unlink: unlink,
34307  unrender: Ractive$unrender,
34308  unshift: unshift,
34309  update: Ractive$update,
34310  updateModel: Ractive$updateModel,
34311  use: use
34312};
34313
34314function isInstance(object) {
34315  return object && object instanceof this;
34316}
34317
34318function styleGet(keypath, opts) {
34319  return this._cssModel.joinAll(splitKeypath(keypath)).get(true, opts);
34320}
34321
34322var styles = [];
34323
34324function addStyle(id, css) {
34325  if (styles.find(function (s) { return s.id === id; }))
34326    { throw new Error(("Extra styles with the id '" + id + "' have already been added.")); }
34327  styles.push({ id: id, css: css });
34328
34329  if (!this.css) {
34330    Object.defineProperty(this, 'css', { configurable: false, writable: false, value: buildCSS });
34331  }
34332
34333  if (!this._cssDef) {
34334    Object.defineProperty(this, '_cssDef', {
34335      configurable: true,
34336      writable: false,
34337      value: {
34338        transform: false,
34339        id: 'Ractive.addStyle'
34340      }
34341    });
34342
34343    addCSS(this._cssDef);
34344  }
34345
34346  recomputeCSS(this);
34347  applyCSS(true);
34348}
34349
34350function buildCSS(data) {
34351  return styles
34352    .map(function (s) { return "\n/* ---- extra style " + (s.id) + " */\n" + (isFunction(s.css) ? s.css(data) : s.css); })
34353    .join('');
34354}
34355
34356function hasStyle(id) {
34357  return !!styles.find(function (s) { return s.id === id; });
34358}
34359
34360function sharedSet(keypath, value, options) {
34361  var opts = isObjectType(keypath) ? value : options;
34362  var model = SharedModel$1;
34363
34364  return set(build({ viewmodel: model }, keypath, value, true), opts);
34365}
34366
34367function sharedGet(keypath, opts) {
34368  return SharedModel$1.joinAll(splitKeypath(keypath)).get(true, opts);
34369}
34370
34371function use$1() {
34372  var this$1 = this;
34373  var plugins = [], len = arguments.length;
34374  while ( len-- ) plugins[ len ] = arguments[ len ];
34375
34376  plugins.forEach(function (p) {
34377    isFunction(p) &&
34378      p({
34379        proto: this$1.prototype,
34380        Ractive: this$1.Ractive,
34381        instance: this$1
34382      });
34383  });
34384  return this;
34385}
34386
34387var callsSuper = /super\s*\(|\.call\s*\(\s*this/;
34388
34389function extend() {
34390  var options = [], len = arguments.length;
34391  while ( len-- ) options[ len ] = arguments[ len ];
34392
34393  if (!options.length) {
34394    return extendOne(this);
34395  } else {
34396    return options.reduce(extendOne, this);
34397  }
34398}
34399
34400function extendWith(Class, options) {
34401  if ( options === void 0 ) options = {};
34402
34403  return extendOne(this, options, Class);
34404}
34405
34406function extendOne(Parent, options, Target) {
34407  if ( options === void 0 ) options = {};
34408
34409  var proto;
34410  var Child = isFunction(Target) && Target;
34411
34412  if (options.prototype instanceof Ractive) {
34413    throw new Error("Ractive no longer supports multiple inheritance.");
34414  }
34415
34416  if (Child) {
34417    if (!(Child.prototype instanceof Parent)) {
34418      throw new Error(
34419        "Only classes that inherit the appropriate prototype may be used with extend"
34420      );
34421    }
34422    if (!callsSuper.test(Child.toString())) {
34423      throw new Error("Only classes that call super in their constructor may be used with extend");
34424    }
34425
34426    proto = Child.prototype;
34427  } else {
34428    Child = function(options) {
34429      if (!(this instanceof Child)) { return new Child(options); }
34430
34431      construct(this, options || {});
34432      initialise(this, options || {}, {});
34433    };
34434
34435    proto = create(Parent.prototype);
34436    proto.constructor = Child;
34437
34438    Child.prototype = proto;
34439  }
34440
34441  // Static properties
34442  defineProperties(Child, {
34443    // alias prototype as defaults
34444    defaults: { value: proto },
34445
34446    extend: { value: extend, writable: true, configurable: true },
34447    extendWith: { value: extendWith, writable: true, configurable: true },
34448    extensions: { value: [] },
34449    use: { value: use$1 },
34450
34451    isInstance: { value: isInstance },
34452
34453    Parent: { value: Parent },
34454    Ractive: { value: Ractive },
34455
34456    styleGet: { value: styleGet.bind(Child), configurable: true },
34457    styleSet: { value: setCSSData.bind(Child), configurable: true }
34458  });
34459
34460  // extend configuration
34461  config.extend(Parent, proto, options, Child);
34462
34463  // store event and observer registries on the constructor when extending
34464  Child._on = (Parent._on || []).concat(toPairs(options.on));
34465  Child._observe = (Parent._observe || []).concat(toPairs(options.observe));
34466
34467  Parent.extensions.push(Child);
34468
34469  // attribute defs are not inherited, but they need to be stored
34470  if (options.attributes) {
34471    var attrs;
34472
34473    // allow an array of optional props or an object with arrays for optional and required props
34474    if (isArray(options.attributes)) {
34475      attrs = { optional: options.attributes, required: [] };
34476    } else {
34477      attrs = options.attributes;
34478    }
34479
34480    // make sure the requisite keys actually store arrays
34481    if (!isArray(attrs.required)) { attrs.required = []; }
34482    if (!isArray(attrs.optional)) { attrs.optional = []; }
34483
34484    Child.attributes = attrs;
34485  }
34486
34487  dataConfigurator.extend(Parent, proto, options, Child);
34488
34489  defineProperty(Child, 'helpers', { writable: true, value: proto.helpers });
34490
34491  if (isArray(options.use)) { Child.use.apply(Child, options.use); }
34492
34493  return Child;
34494}
34495
34496defineProperties(Ractive, {
34497  sharedGet: { value: sharedGet },
34498  sharedSet: { value: sharedSet },
34499  styleGet: { configurable: true, value: styleGet.bind(Ractive) },
34500  styleSet: { configurable: true, value: setCSSData.bind(Ractive) },
34501  addCSS: { configurable: false, value: addStyle.bind(Ractive) },
34502  hasCSS: { configurable: false, value: hasStyle.bind(Ractive) }
34503});
34504
34505function macro(fn, opts) {
34506  if (!isFunction(fn)) { throw new Error("The macro must be a function"); }
34507
34508  assign(fn, opts);
34509
34510  defineProperties(fn, {
34511    extensions: { value: [] },
34512    _cssIds: { value: [] },
34513    cssData: { value: assign(create(this.cssData), fn.cssData || {}) },
34514
34515    styleGet: { value: styleGet.bind(fn) },
34516    styleSet: { value: setCSSData.bind(fn) }
34517  });
34518
34519  defineProperty(fn, '_cssModel', { value: new CSSModel(fn) });
34520
34521  if (fn.css) { initCSS(fn, fn, fn); }
34522
34523  this.extensions.push(fn);
34524
34525  return fn;
34526}
34527
34528function joinKeys() {
34529  var keys = [], len = arguments.length;
34530  while ( len-- ) keys[ len ] = arguments[ len ];
34531
34532  return keys.map(escapeKey).join('.');
34533}
34534
34535function splitKeypath$1(keypath) {
34536  return splitKeypath(keypath).map(unescapeKey);
34537}
34538
34539function findPlugin(name, type, instance) {
34540  return findInViewHierarchy(type, instance, name);
34541}
34542
34543function Ractive(options) {
34544  if (!(this instanceof Ractive)) { return new Ractive(options); }
34545
34546  construct(this, options || {});
34547  initialise(this, options || {}, {});
34548}
34549
34550// check to see if we're being asked to force Ractive as a global for some weird environments
34551if (win && !win.Ractive) {
34552  var opts$1 = '';
34553  var script =
34554    document.currentScript ||
34555    /* istanbul ignore next */ document.querySelector('script[data-ractive-options]');
34556
34557  if (script) { opts$1 = script.getAttribute('data-ractive-options') || ''; }
34558
34559  /* istanbul ignore next */
34560  if (~opts$1.indexOf('ForceGlobal')) { win.Ractive = Ractive; }
34561} else if (win) {
34562  warn("Ractive already appears to be loaded while loading 1.3.2.");
34563}
34564
34565assign(Ractive.prototype, proto$9, defaults);
34566Ractive.prototype.constructor = Ractive;
34567
34568// alias prototype as `defaults`
34569Ractive.defaults = Ractive.prototype;
34570
34571// share defaults with the parser
34572shared.defaults = Ractive.defaults;
34573shared.Ractive = Ractive;
34574
34575// static properties
34576defineProperties(Ractive, {
34577  // debug flag
34578  DEBUG: { writable: true, value: true },
34579  DEBUG_PROMISES: { writable: true, value: true },
34580
34581  // static methods:
34582  extend: { value: extend },
34583  extendWith: { value: extendWith },
34584  escapeKey: { value: escapeKey },
34585  evalObjectString: { value: parseJSON },
34586  findPlugin: { value: findPlugin },
34587  getContext: { value: getContext$1 },
34588  getCSS: { value: getCSS },
34589  isInstance: { value: isInstance },
34590  joinKeys: { value: joinKeys },
34591  macro: { value: macro },
34592  normaliseKeypath: { value: normalise },
34593  parse: { value: parse },
34594  splitKeypath: { value: splitKeypath$1 },
34595  // sharedSet and styleSet are in _extend because circular refs
34596  unescapeKey: { value: unescapeKey },
34597  use: { value: use$1 },
34598
34599  // support
34600  enhance: { writable: true, value: false },
34601  svg: { value: svg },
34602  tick: {
34603    get: function get() {
34604      return batch && batch.promise;
34605    }
34606  },
34607
34608  // version
34609  VERSION: { value: '1.3.2' },
34610
34611  // plugins
34612  adaptors: { writable: true, value: {} },
34613  components: { writable: true, value: {} },
34614  decorators: { writable: true, value: {} },
34615  easing: { writable: true, value: easing },
34616  events: { writable: true, value: {} },
34617  extensions: { value: [] },
34618  helpers: { writable: true, value: defaults.helpers },
34619  interpolators: { writable: true, value: interpolators },
34620  partials: { writable: true, value: {} },
34621  transitions: { writable: true, value: {} },
34622
34623  // CSS variables
34624  cssData: { configurable: true, value: {} },
34625
34626  // access to @shared without an instance
34627  sharedData: { value: data },
34628
34629  // for getting the source Ractive lib from a constructor
34630  Ractive: { value: Ractive },
34631
34632  // to allow extending contexts
34633  Context: { value: extern.Context.prototype }
34634});
34635
34636// cssData must already be in place
34637defineProperty(Ractive, '_cssModel', {
34638  configurable: true,
34639  value: new CSSModel(Ractive)
34640});
34641
34642defineProperty(Ractive.prototype, 'rendered', {
34643  get: function get() {
34644    return this.fragment && this.fragment.rendered;
34645  }
34646});
34647
34648return Ractive;
34649
34650})));
34651
34652
34653}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
34654
34655},{}],127:[function(require,module,exports){
34656/**
34657 * Copyright (c) 2014-present, Facebook, Inc.
34658 *
34659 * This source code is licensed under the MIT license found in the
34660 * LICENSE file in the root directory of this source tree.
34661 */
34662
34663// This method of obtaining a reference to the global object needs to be
34664// kept identical to the way it is obtained in runtime.js
34665var g = (function() { return this })() || Function("return this")();
34666
34667// Use `getOwnPropertyNames` because not all browsers support calling
34668// `hasOwnProperty` on the global `self` object in a worker. See #183.
34669var hadRuntime = g.regeneratorRuntime &&
34670  Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
34671
34672// Save the old regeneratorRuntime in case it needs to be restored later.
34673var oldRuntime = hadRuntime && g.regeneratorRuntime;
34674
34675// Force reevalutation of runtime.js.
34676g.regeneratorRuntime = undefined;
34677
34678module.exports = require("./runtime");
34679
34680if (hadRuntime) {
34681  // Restore the original runtime.
34682  g.regeneratorRuntime = oldRuntime;
34683} else {
34684  // Remove the global property added by runtime.js.
34685  try {
34686    delete g.regeneratorRuntime;
34687  } catch(e) {
34688    g.regeneratorRuntime = undefined;
34689  }
34690}
34691
34692},{"./runtime":128}],128:[function(require,module,exports){
vendor: 24,126 bytes, lines 34692-35420
34692
34693/**
34694 * Copyright (c) 2014-present, Facebook, Inc.
34695 *
34696 * This source code is licensed under the MIT license found in the
34697 * LICENSE file in the root directory of this source tree.
34698 */
34699
34700!(function(global) {
34701  "use strict";
34702
34703  var Op = Object.prototype;
34704  var hasOwn = Op.hasOwnProperty;
34705  var undefined; // More compressible than void 0.
34706  var $Symbol = typeof Symbol === "function" ? Symbol : {};
34707  var iteratorSymbol = $Symbol.iterator || "@@iterator";
34708  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
34709  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
34710
34711  var inModule = typeof module === "object";
34712  var runtime = global.regeneratorRuntime;
34713  if (runtime) {
34714    if (inModule) {
34715      // If regeneratorRuntime is defined globally and we're in a module,
34716      // make the exports object identical to regeneratorRuntime.
34717      module.exports = runtime;
34718    }
34719    // Don't bother evaluating the rest of this file if the runtime was
34720    // already defined globally.
34721    return;
34722  }
34723
34724  // Define the runtime globally (as expected by generated code) as either
34725  // module.exports (if we're in a module) or a new, empty object.
34726  runtime = global.regeneratorRuntime = inModule ? module.exports : {};
34727
34728  function wrap(innerFn, outerFn, self, tryLocsList) {
34729    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
34730    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
34731    var generator = Object.create(protoGenerator.prototype);
34732    var context = new Context(tryLocsList || []);
34733
34734    // The ._invoke method unifies the implementations of the .next,
34735    // .throw, and .return methods.
34736    generator._invoke = makeInvokeMethod(innerFn, self, context);
34737
34738    return generator;
34739  }
34740  runtime.wrap = wrap;
34741
34742  // Try/catch helper to minimize deoptimizations. Returns a completion
34743  // record like context.tryEntries[i].completion. This interface could
34744  // have been (and was previously) designed to take a closure to be
34745  // invoked without arguments, but in all the cases we care about we
34746  // already have an existing method we want to call, so there's no need
34747  // to create a new function object. We can even get away with assuming
34748  // the method takes exactly one argument, since that happens to be true
34749  // in every case, so we don't have to touch the arguments object. The
34750  // only additional allocation required is the completion record, which
34751  // has a stable shape and so hopefully should be cheap to allocate.
34752  function tryCatch(fn, obj, arg) {
34753    try {
34754      return { type: "normal", arg: fn.call(obj, arg) };
34755    } catch (err) {
34756      return { type: "throw", arg: err };
34757    }
34758  }
34759
34760  var GenStateSuspendedStart = "suspendedStart";
34761  var GenStateSuspendedYield = "suspendedYield";
34762  var GenStateExecuting = "executing";
34763  var GenStateCompleted = "completed";
34764
34765  // Returning this object from the innerFn has the same effect as
34766  // breaking out of the dispatch switch statement.
34767  var ContinueSentinel = {};
34768
34769  // Dummy constructor functions that we use as the .constructor and
34770  // .constructor.prototype properties for functions that return Generator
34771  // objects. For full spec compliance, you may wish to configure your
34772  // minifier not to mangle the names of these two functions.
34773  function Generator() {}
34774  function GeneratorFunction() {}
34775  function GeneratorFunctionPrototype() {}
34776
34777  // This is a polyfill for %IteratorPrototype% for environments that
34778  // don't natively support it.
34779  var IteratorPrototype = {};
34780  IteratorPrototype[iteratorSymbol] = function () {
34781    return this;
34782  };
34783
34784  var getProto = Object.getPrototypeOf;
34785  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
34786  if (NativeIteratorPrototype &&
34787      NativeIteratorPrototype !== Op &&
34788      hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
34789    // This environment has a native %IteratorPrototype%; use it instead
34790    // of the polyfill.
34791    IteratorPrototype = NativeIteratorPrototype;
34792  }
34793
34794  var Gp = GeneratorFunctionPrototype.prototype =
34795    Generator.prototype = Object.create(IteratorPrototype);
34796  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
34797  GeneratorFunctionPrototype.constructor = GeneratorFunction;
34798  GeneratorFunctionPrototype[toStringTagSymbol] =
34799    GeneratorFunction.displayName = "GeneratorFunction";
34800
34801  // Helper for defining the .next, .throw, and .return methods of the
34802  // Iterator interface in terms of a single ._invoke method.
34803  function defineIteratorMethods(prototype) {
34804    ["next", "throw", "return"].forEach(function(method) {
34805      prototype[method] = function(arg) {
34806        return this._invoke(method, arg);
34807      };
34808    });
34809  }
34810
34811  runtime.isGeneratorFunction = function(genFun) {
34812    var ctor = typeof genFun === "function" && genFun.constructor;
34813    return ctor
34814      ? ctor === GeneratorFunction ||
34815        // For the native GeneratorFunction constructor, the best we can
34816        // do is to check its .name property.
34817        (ctor.displayName || ctor.name) === "GeneratorFunction"
34818      : false;
34819  };
34820
34821  runtime.mark = function(genFun) {
34822    if (Object.setPrototypeOf) {
34823      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
34824    } else {
34825      genFun.__proto__ = GeneratorFunctionPrototype;
34826      if (!(toStringTagSymbol in genFun)) {
34827        genFun[toStringTagSymbol] = "GeneratorFunction";
34828      }
34829    }
34830    genFun.prototype = Object.create(Gp);
34831    return genFun;
34832  };
34833
34834  // Within the body of any async function, `await x` is transformed to
34835  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
34836  // `hasOwn.call(value, "__await")` to determine if the yielded value is
34837  // meant to be awaited.
34838  runtime.awrap = function(arg) {
34839    return { __await: arg };
34840  };
34841
34842  function AsyncIterator(generator) {
34843    function invoke(method, arg, resolve, reject) {
34844      var record = tryCatch(generator[method], generator, arg);
34845      if (record.type === "throw") {
34846        reject(record.arg);
34847      } else {
34848        var result = record.arg;
34849        var value = result.value;
34850        if (value &&
34851            typeof value === "object" &&
34852            hasOwn.call(value, "__await")) {
34853          return Promise.resolve(value.__await).then(function(value) {
34854            invoke("next", value, resolve, reject);
34855          }, function(err) {
34856            invoke("throw", err, resolve, reject);
34857          });
34858        }
34859
34860        return Promise.resolve(value).then(function(unwrapped) {
34861          // When a yielded Promise is resolved, its final value becomes
34862          // the .value of the Promise<{value,done}> result for the
34863          // current iteration. If the Promise is rejected, however, the
34864          // result for this iteration will be rejected with the same
34865          // reason. Note that rejections of yielded Promises are not
34866          // thrown back into the generator function, as is the case
34867          // when an awaited Promise is rejected. This difference in
34868          // behavior between yield and await is important, because it
34869          // allows the consumer to decide what to do with the yielded
34870          // rejection (swallow it and continue, manually .throw it back
34871          // into the generator, abandon iteration, whatever). With
34872          // await, by contrast, there is no opportunity to examine the
34873          // rejection reason outside the generator function, so the
34874          // only option is to throw it from the await expression, and
34875          // let the generator function handle the exception.
34876          result.value = unwrapped;
34877          resolve(result);
34878        }, reject);
34879      }
34880    }
34881
34882    var previousPromise;
34883
34884    function enqueue(method, arg) {
34885      function callInvokeWithMethodAndArg() {
34886        return new Promise(function(resolve, reject) {
34887          invoke(method, arg, resolve, reject);
34888        });
34889      }
34890
34891      return previousPromise =
34892        // If enqueue has been called before, then we want to wait until
34893        // all previous Promises have been resolved before calling invoke,
34894        // so that results are always delivered in the correct order. If
34895        // enqueue has not been called before, then it is important to
34896        // call invoke immediately, without waiting on a callback to fire,
34897        // so that the async generator function has the opportunity to do
34898        // any necessary setup in a predictable way. This predictability
34899        // is why the Promise constructor synchronously invokes its
34900        // executor callback, and why async functions synchronously
34901        // execute code before the first await. Since we implement simple
34902        // async functions in terms of async generators, it is especially
34903        // important to get this right, even though it requires care.
34904        previousPromise ? previousPromise.then(
34905          callInvokeWithMethodAndArg,
34906          // Avoid propagating failures to Promises returned by later
34907          // invocations of the iterator.
34908          callInvokeWithMethodAndArg
34909        ) : callInvokeWithMethodAndArg();
34910    }
34911
34912    // Define the unified helper method that is used to implement .next,
34913    // .throw, and .return (see defineIteratorMethods).
34914    this._invoke = enqueue;
34915  }
34916
34917  defineIteratorMethods(AsyncIterator.prototype);
34918  AsyncIterator.prototype[asyncIteratorSymbol] = function () {
34919    return this;
34920  };
34921  runtime.AsyncIterator = AsyncIterator;
34922
34923  // Note that simple async functions are implemented on top of
34924  // AsyncIterator objects; they just return a Promise for the value of
34925  // the final result produced by the iterator.
34926  runtime.async = function(innerFn, outerFn, self, tryLocsList) {
34927    var iter = new AsyncIterator(
34928      wrap(innerFn, outerFn, self, tryLocsList)
34929    );
34930
34931    return runtime.isGeneratorFunction(outerFn)
34932      ? iter // If outerFn is a generator, return the full iterator.
34933      : iter.next().then(function(result) {
34934          return result.done ? result.value : iter.next();
34935        });
34936  };
34937
34938  function makeInvokeMethod(innerFn, self, context) {
34939    var state = GenStateSuspendedStart;
34940
34941    return function invoke(method, arg) {
34942      if (state === GenStateExecuting) {
34943        throw new Error("Generator is already running");
34944      }
34945
34946      if (state === GenStateCompleted) {
34947        if (method === "throw") {
34948          throw arg;
34949        }
34950
34951        // Be forgiving, per 25.3.3.3.3 of the spec:
34952        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
34953        return doneResult();
34954      }
34955
34956      context.method = method;
34957      context.arg = arg;
34958
34959      while (true) {
34960        var delegate = context.delegate;
34961        if (delegate) {
34962          var delegateResult = maybeInvokeDelegate(delegate, context);
34963          if (delegateResult) {
34964            if (delegateResult === ContinueSentinel) continue;
34965            return delegateResult;
34966          }
34967        }
34968
34969        if (context.method === "next") {
34970          // Setting context._sent for legacy support of Babel's
34971          // function.sent implementation.
34972          context.sent = context._sent = context.arg;
34973
34974        } else if (context.method === "throw") {
34975          if (state === GenStateSuspendedStart) {
34976            state = GenStateCompleted;
34977            throw context.arg;
34978          }
34979
34980          context.dispatchException(context.arg);
34981
34982        } else if (context.method === "return") {
34983          context.abrupt("return", context.arg);
34984        }
34985
34986        state = GenStateExecuting;
34987
34988        var record = tryCatch(innerFn, self, context);
34989        if (record.type === "normal") {
34990          // If an exception is thrown from innerFn, we leave state ===
34991          // GenStateExecuting and loop back for another invocation.
34992          state = context.done
34993            ? GenStateCompleted
34994            : GenStateSuspendedYield;
34995
34996          if (record.arg === ContinueSentinel) {
34997            continue;
34998          }
34999
35000          return {
35001            value: record.arg,
35002            done: context.done
35003          };
35004
35005        } else if (record.type === "throw") {
35006          state = GenStateCompleted;
35007          // Dispatch the exception by looping back around to the
35008          // context.dispatchException(context.arg) call above.
35009          context.method = "throw";
35010          context.arg = record.arg;
35011        }
35012      }
35013    };
35014  }
35015
35016  // Call delegate.iterator[context.method](context.arg) and handle the
35017  // result, either by returning a { value, done } result from the
35018  // delegate iterator, or by modifying context.method and context.arg,
35019  // setting context.delegate to null, and returning the ContinueSentinel.
35020  function maybeInvokeDelegate(delegate, context) {
35021    var method = delegate.iterator[context.method];
35022    if (method === undefined) {
35023      // A .throw or .return when the delegate iterator has no .throw
35024      // method always terminates the yield* loop.
35025      context.delegate = null;
35026
35027      if (context.method === "throw") {
35028        if (delegate.iterator.return) {
35029          // If the delegate iterator has a return method, give it a
35030          // chance to clean up.
35031          context.method = "return";
35032          context.arg = undefined;
35033          maybeInvokeDelegate(delegate, context);
35034
35035          if (context.method === "throw") {
35036            // If maybeInvokeDelegate(context) changed context.method from
35037            // "return" to "throw", let that override the TypeError below.
35038            return ContinueSentinel;
35039          }
35040        }
35041
35042        context.method = "throw";
35043        context.arg = new TypeError(
35044          "The iterator does not provide a 'throw' method");
35045      }
35046
35047      return ContinueSentinel;
35048    }
35049
35050    var record = tryCatch(method, delegate.iterator, context.arg);
35051
35052    if (record.type === "throw") {
35053      context.method = "throw";
35054      context.arg = record.arg;
35055      context.delegate = null;
35056      return ContinueSentinel;
35057    }
35058
35059    var info = record.arg;
35060
35061    if (! info) {
35062      context.method = "throw";
35063      context.arg = new TypeError("iterator result is not an object");
35064      context.delegate = null;
35065      return ContinueSentinel;
35066    }
35067
35068    if (info.done) {
35069      // Assign the result of the finished delegate to the temporary
35070      // variable specified by delegate.resultName (see delegateYield).
35071      context[delegate.resultName] = info.value;
35072
35073      // Resume execution at the desired location (see delegateYield).
35074      context.next = delegate.nextLoc;
35075
35076      // If context.method was "throw" but the delegate handled the
35077      // exception, let the outer generator proceed normally. If
35078      // context.method was "next", forget context.arg since it has been
35079      // "consumed" by the delegate iterator. If context.method was
35080      // "return", allow the original .return call to continue in the
35081      // outer generator.
35082      if (context.method !== "return") {
35083        context.method = "next";
35084        context.arg = undefined;
35085      }
35086
35087    } else {
35088      // Re-yield the result returned by the delegate method.
35089      return info;
35090    }
35091
35092    // The delegate iterator is finished, so forget it and continue with
35093    // the outer generator.
35094    context.delegate = null;
35095    return ContinueSentinel;
35096  }
35097
35098  // Define Generator.prototype.{next,throw,return} in terms of the
35099  // unified ._invoke helper method.
35100  defineIteratorMethods(Gp);
35101
35102  Gp[toStringTagSymbol] = "Generator";
35103
35104  // A Generator should always return itself as the iterator object when the
35105  // @@iterator function is called on it. Some browsers' implementations of the
35106  // iterator prototype chain incorrectly implement this, causing the Generator
35107  // object to not be returned from this call. This ensures that doesn't happen.
35108  // See https://github.com/facebook/regenerator/issues/274 for more details.
35109  Gp[iteratorSymbol] = function() {
35110    return this;
35111  };
35112
35113  Gp.toString = function() {
35114    return "[object Generator]";
35115  };
35116
35117  function pushTryEntry(locs) {
35118    var entry = { tryLoc: locs[0] };
35119
35120    if (1 in locs) {
35121      entry.catchLoc = locs[1];
35122    }
35123
35124    if (2 in locs) {
35125      entry.finallyLoc = locs[2];
35126      entry.afterLoc = locs[3];
35127    }
35128
35129    this.tryEntries.push(entry);
35130  }
35131
35132  function resetTryEntry(entry) {
35133    var record = entry.completion || {};
35134    record.type = "normal";
35135    delete record.arg;
35136    entry.completion = record;
35137  }
35138
35139  function Context(tryLocsList) {
35140    // The root entry object (effectively a try statement without a catch
35141    // or a finally block) gives us a place to store values thrown from
35142    // locations where there is no enclosing try statement.
35143    this.tryEntries = [{ tryLoc: "root" }];
35144    tryLocsList.forEach(pushTryEntry, this);
35145    this.reset(true);
35146  }
35147
35148  runtime.keys = function(object) {
35149    var keys = [];
35150    for (var key in object) {
35151      keys.push(key);
35152    }
35153    keys.reverse();
35154
35155    // Rather than returning an object with a next method, we keep
35156    // things simple and return the next function itself.
35157    return function next() {
35158      while (keys.length) {
35159        var key = keys.pop();
35160        if (key in object) {
35161          next.value = key;
35162          next.done = false;
35163          return next;
35164        }
35165      }
35166
35167      // To avoid creating an additional object, we just hang the .value
35168      // and .done properties off the next function object itself. This
35169      // also ensures that the minifier will not anonymize the function.
35170      next.done = true;
35171      return next;
35172    };
35173  };
35174
35175  function values(iterable) {
35176    if (iterable) {
35177      var iteratorMethod = iterable[iteratorSymbol];
35178      if (iteratorMethod) {
35179        return iteratorMethod.call(iterable);
35180      }
35181
35182      if (typeof iterable.next === "function") {
35183        return iterable;
35184      }
35185
35186      if (!isNaN(iterable.length)) {
35187        var i = -1, next = function next() {
35188          while (++i < iterable.length) {
35189            if (hasOwn.call(iterable, i)) {
35190              next.value = iterable[i];
35191              next.done = false;
35192              return next;
35193            }
35194          }
35195
35196          next.value = undefined;
35197          next.done = true;
35198
35199          return next;
35200        };
35201
35202        return next.next = next;
35203      }
35204    }
35205
35206    // Return an iterator with no values.
35207    return { next: doneResult };
35208  }
35209  runtime.values = values;
35210
35211  function doneResult() {
35212    return { value: undefined, done: true };
35213  }
35214
35215  Context.prototype = {
35216    constructor: Context,
35217
35218    reset: function(skipTempReset) {
35219      this.prev = 0;
35220      this.next = 0;
35221      // Resetting context._sent for legacy support of Babel's
35222      // function.sent implementation.
35223      this.sent = this._sent = undefined;
35224      this.done = false;
35225      this.delegate = null;
35226
35227      this.method = "next";
35228      this.arg = undefined;
35229
35230      this.tryEntries.forEach(resetTryEntry);
35231
35232      if (!skipTempReset) {
35233        for (var name in this) {
35234          // Not sure about the optimal order of these conditions:
35235          if (name.charAt(0) === "t" &&
35236              hasOwn.call(this, name) &&
35237              !isNaN(+name.slice(1))) {
35238            this[name] = undefined;
35239          }
35240        }
35241      }
35242    },
35243
35244    stop: function() {
35245      this.done = true;
35246
35247      var rootEntry = this.tryEntries[0];
35248      var rootRecord = rootEntry.completion;
35249      if (rootRecord.type === "throw") {
35250        throw rootRecord.arg;
35251      }
35252
35253      return this.rval;
35254    },
35255
35256    dispatchException: function(exception) {
35257      if (this.done) {
35258        throw exception;
35259      }
35260
35261      var context = this;
35262      function handle(loc, caught) {
35263        record.type = "throw";
35264        record.arg = exception;
35265        context.next = loc;
35266
35267        if (caught) {
35268          // If the dispatched exception was caught by a catch block,
35269          // then let that catch block handle the exception normally.
35270          context.method = "next";
35271          context.arg = undefined;
35272        }
35273
35274        return !! caught;
35275      }
35276
35277      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
35278        var entry = this.tryEntries[i];
35279        var record = entry.completion;
35280
35281        if (entry.tryLoc === "root") {
35282          // Exception thrown outside of any try block that could handle
35283          // it, so set the completion value of the entire function to
35284          // throw the exception.
35285          return handle("end");
35286        }
35287
35288        if (entry.tryLoc <= this.prev) {
35289          var hasCatch = hasOwn.call(entry, "catchLoc");
35290          var hasFinally = hasOwn.call(entry, "finallyLoc");
35291
35292          if (hasCatch && hasFinally) {
35293            if (this.prev < entry.catchLoc) {
35294              return handle(entry.catchLoc, true);
35295            } else if (this.prev < entry.finallyLoc) {
35296              return handle(entry.finallyLoc);
35297            }
35298
35299          } else if (hasCatch) {
35300            if (this.prev < entry.catchLoc) {
35301              return handle(entry.catchLoc, true);
35302            }
35303
35304          } else if (hasFinally) {
35305            if (this.prev < entry.finallyLoc) {
35306              return handle(entry.finallyLoc);
35307            }
35308
35309          } else {
35310            throw new Error("try statement without catch or finally");
35311          }
35312        }
35313      }
35314    },
35315
35316    abrupt: function(type, arg) {
35317      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
35318        var entry = this.tryEntries[i];
35319        if (entry.tryLoc <= this.prev &&
35320            hasOwn.call(entry, "finallyLoc") &&
35321            this.prev < entry.finallyLoc) {
35322          var finallyEntry = entry;
35323          break;
35324        }
35325      }
35326
35327      if (finallyEntry &&
35328          (type === "break" ||
35329           type === "continue") &&
35330          finallyEntry.tryLoc <= arg &&
35331          arg <= finallyEntry.finallyLoc) {
35332        // Ignore the finally entry if control is not jumping to a
35333        // location outside the try/catch block.
35334        finallyEntry = null;
35335      }
35336
35337      var record = finallyEntry ? finallyEntry.completion : {};
35338      record.type = type;
35339      record.arg = arg;
35340
35341      if (finallyEntry) {
35342        this.method = "next";
35343        this.next = finallyEntry.finallyLoc;
35344        return ContinueSentinel;
35345      }
35346
35347      return this.complete(record);
35348    },
35349
35350    complete: function(record, afterLoc) {
35351      if (record.type === "throw") {
35352        throw record.arg;
35353      }
35354
35355      if (record.type === "break" ||
35356          record.type === "continue") {
35357        this.next = record.arg;
35358      } else if (record.type === "return") {
35359        this.rval = this.arg = record.arg;
35360        this.method = "return";
35361        this.next = "end";
35362      } else if (record.type === "normal" && afterLoc) {
35363        this.next = afterLoc;
35364      }
35365
35366      return ContinueSentinel;
35367    },
35368
35369    finish: function(finallyLoc) {
35370      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
35371        var entry = this.tryEntries[i];
35372        if (entry.finallyLoc === finallyLoc) {
35373          this.complete(entry.completion, entry.afterLoc);
35374          resetTryEntry(entry);
35375          return ContinueSentinel;
35376        }
35377      }
35378    },
35379
35380    "catch": function(tryLoc) {
35381      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
35382        var entry = this.tryEntries[i];
35383        if (entry.tryLoc === tryLoc) {
35384          var record = entry.completion;
35385          if (record.type === "throw") {
35386            var thrown = record.arg;
35387            resetTryEntry(entry);
35388          }
35389          return thrown;
35390        }
35391      }
35392
35393      // The context.catch method must only be called with a location
35394      // argument that corresponds to a known catch block.
35395      throw new Error("illegal catch attempt");
35396    },
35397
35398    delegateYield: function(iterable, resultName, nextLoc) {
35399      this.delegate = {
35400        iterator: values(iterable),
35401        resultName: resultName,
35402        nextLoc: nextLoc
35403      };
35404
35405      if (this.method === "next") {
35406        // Deliberately forget the last sent value so that we don't
35407        // accidentally pass it on to the delegate.
35408        this.arg = undefined;
35409      }
35410
35411      return ContinueSentinel;
35412    }
35413  };
35414})(
35415  // In sloppy mode, unbound `this` refers to the global object, fallback to
35416  // Function constructor if we're in global strict mode. That is sadly a form
35417  // of indirect eval which violates Content Security Policy.
35418  (function() { return this })() || Function("return this")()
35419);
35420
35421},{}],129:[function(require,module,exports){
35422(function (global){
35423'use strict';
35424
35425var _typeof2 = require('babel-runtime/helpers/typeof');
35426
35427var _typeof3 = _interopRequireDefault(_typeof2);
35428
35429var _branchBar = require('./modules/branch-bar');
35430
35431var _branchBar2 = _interopRequireDefault(_branchBar);
35432
35433var _jquery = require('jquery');
35434
35435var _jquery2 = _interopRequireDefault(_jquery);
35436
35437var _mustache = require('mustache');
35438
35439var _mustache2 = _interopRequireDefault(_mustache);
35440
35441var _jquery3 = require('jquery.cycle2');
35442
35443var _jquery4 = _interopRequireDefault(_jquery3);
35444
35445var _accordions = require('./modules/accordions');
35446
35447var _accordions2 = _interopRequireDefault(_accordions);
35448
35449require('./sopimus/index');
35450
35451var _financeCalc = require('./financeCalc');
35452
35453var _financeCalc2 = _interopRequireDefault(_financeCalc);
35454
35455function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35456
35457global.$ = _jquery2.default;
35458global.jQuery = _jquery2.default;
35459global.Mustache = _mustache2.default;
35460
35461require('../static/libs/jquery.cookie');
35462require('./global.js');
35463require('./libs.js');
35464require('./searches.js');
35465require('./form-helper.js');
35466require('./megasearch.js');
35467//require('./financeCalc');
35468
35469/*
35470* jquery-match-height 0.7.0 by @liabru
35471* http://brm.io/jquery-match-height/
35472* License MIT
35473*/
35474
35475!function (t) {
35476	'use strict';
35477	'function' == typeof define && define.amd ? define(['jquery'], t) : 'undefined' != typeof module && module.exports ? module.exports = t(require('jquery')) : t(jQuery);
35478}(function (t) {
35479	var e = -1,
35480	    o = -1,
35481	    i = function i(t) {
35482		return parseFloat(t) || 0;
35483	},
35484	    a = function a(e) {
35485		var o = 1,
35486		    a = t(e),
35487		    n = null,
35488		    r = [];return a.each(function () {
35489			var e = t(this),
35490			    a = e.offset().top - i(e.css('margin-top')),
35491			    s = r.length > 0 ? r[r.length - 1] : null;null === s ? r.push(e) : Math.floor(Math.abs(n - a)) <= o ? r[r.length - 1] = s.add(e) : r.push(e), n = a;
35492		}), r;
35493	},
35494	    n = function n(e) {
35495		var o = {
35496			byRow: !0, property: "height", target: null, remove: !1 };return 'object' == (typeof e === 'undefined' ? 'undefined' : (0, _typeof3.default)(e)) ? t.extend(o, e) : ('boolean' == typeof e ? o.byRow = e : 'remove' === e && (o.remove = !0), o);
35497	},
35498	    r = t.fn.matchHeight = function (e) {
35499		var o = n(e);if (o.remove) {
35500			var i = this;return this.css(o.property, ''), t.each(r._groups, function (t, e) {
35501				e.elements = e.elements.not(i);
35502			}), this;
35503		}return this.length <= 1 && !o.target ? this : (r._groups.push({ elements: this, options: o }), r._apply(this, o), this);
35504	};r.version = '0.7.0', r._groups = [], r._throttle = 80, r._maintainScroll = !1, r._beforeUpdate = null, r._afterUpdate = null, r._rows = a, r._parse = i, r._parseOptions = n, r._apply = function (e, o) {
35505		var s = n(o),
35506		    h = t(e),
35507		    l = [h],
35508		    c = t(window).scrollTop(),
35509		    p = t("html").outerHeight(!0),
35510		    d = h.parents().filter(":hidden");return d.each(function () {
35511			var e = t(this);e.data('style-cache', e.attr('style'));
35512		}), d.css('display', 'block'), s.byRow && !s.target && (h.each(function () {
35513			var e = t(this),
35514			    o = e.css('display');'inline-block' !== o && 'flex' !== o && 'inline-flex' !== o && (o = 'block'), e.data('style-cache', e.attr('style')), e.css({ display: o, 'padding-top': '0',
35515				'padding-bottom': '0', 'margin-top': '0', 'margin-bottom': '0', 'border-top-width': '0', 'border-bottom-width': '0', height: '100px', overflow: 'hidden' });
35516		}), l = a(h), h.each(function () {
35517			var e = t(this);e.attr('style', e.data('style-cache') || '');
35518		})), t.each(l, function (e, o) {
35519			var a = t(o),
35520			    n = 0;if (s.target) n = s.target.outerHeight(!1);else {
35521				if (s.byRow && a.length <= 1) return void a.css(s.property, "");a.each(function () {
35522					var e = t(this),
35523					    o = e.attr("style"),
35524					    i = e.css("display");"inline-block" !== i && "flex" !== i && 'inline-flex' !== i && (i = 'block');var a = {
35525						display: i };a[s.property] = "", e.css(a), e.outerHeight(!1) > n && (n = e.outerHeight(!1)), o ? e.attr('style', o) : e.css('display', '');
35526				});
35527			}a.each(function () {
35528				var e = t(this),
35529				    o = 0;s.target && e.is(s.target) || ('border-box' !== e.css('box-sizing') && (o += i(e.css('border-top-width')) + i(e.css('border-bottom-width')), o += i(e.css('padding-top')) + i(e.css('padding-bottom'))), e.css(s.property, n - o + 'px'));
35530			});
35531		}), d.each(function () {
35532			var e = t(this);e.attr('style', e.data('style-cache') || null);
35533		}), r._maintainScroll && t(window).scrollTop(c / p * t('html').outerHeight(!0)), this;
35534	}, r._applyDataApi = function () {
35535		var e = {};t('[data-match-height], [data-mh]').each(function () {
35536			var o = t(this),
35537			    i = o.attr('data-mh') || o.attr('data-match-height');i in e ? e[i] = e[i].add(o) : e[i] = o;
35538		}), t.each(e, function () {
35539			this.matchHeight(!0);
35540		});
35541	};var s = function s(e) {
35542		r._beforeUpdate && r._beforeUpdate(e, r._groups), t.each(r._groups, function () {
35543			r._apply(this.elements, this.options);
35544		}), r._afterUpdate && r._afterUpdate(e, r._groups);
35545	};r._update = function (i, a) {
35546		if (a && 'resize' === a.type) {
35547			var n = t(window).width();if (n === e) return;e = n;
35548		}i ? -1 === o && (o = setTimeout(function () {
35549			s(a), o = -1;
35550		}, r._throttle)) : s(a);
35551	}, t(r._applyDataApi), t(window).bind('load', function (t) {
35552		r._update(!1, t);
35553	}), t(window).bind('resize orientationchange', function (t) {
35554		r._update(!0, t);
35555	});
35556});
35557
35558global.navigation = function () {
35559	var nav = {};
35560
35561	nav.toggle = function (section, elem) {
35562		//If the clicked item is active we will hide it
35563		if (elem.hasClass('active') || elem.hasClass('close')) {
35564			//Hide what is currently open and remove active classes from parents etc
35565			(0, _jquery2.default)('html').css('overflow', 'auto');
35566			elem.removeClass('active');
35567			$sectionSelectionItem.removeClass('active');
35568			$menuSectionParent.removeClass('active');
35569			$menuSectionParent.find('section.active').removeClass('active');
35570			$sectionSelectionItem.find('.active').removeClass('active');
35571			(0, _jquery2.default)('body').removeClass('menu-section-open');
35572			if (section == '#navigation') {
35573				(0, _jquery2.default)('body').addClass('main-nav-hidden');
35574			}
35575		} else {
35576			(0, _jquery2.default)('html').css('overflow', 'hidden');
35577			//If the clicked is not active we will first remove others from their active state
35578			$sectionSelectionItem.removeClass('active');
35579			$menuSectionParent.find('section.active').removeClass('active');
35580			$sectionSelectionItem.find('.active').removeClass('active');
35581
35582			//Make sure the parent knows something is active
35583			$menuSectionParent.addClass('active');
35584
35585			//Lets make the section we want active
35586			(0, _jquery2.default)(section).addClass('active');
35587			elem.addClass('active');
35588
35589			//When a section is open I want to hide main and footer to remove scrolls
35590			if (section != '#navigation') {
35591				(0, _jquery2.default)('body').addClass('menu-section-open');
35592			} else {
35593				(0, _jquery2.default)('body').removeClass('menu-section-open');
35594				(0, _jquery2.default)('body').removeClass('main-nav-hidden');
35595			}
35596
35597			if (section == '#megasearch') {
35598				(0, _jquery2.default)('#megasearch input[name=search]').focus();
35599				if (_jquery2.default.cookie('megasearchTerms') && _jquery2.default.cookie('megasearchTerms') != '') {
35600
35601					megasearch.search(_jquery2.default.cookie('megasearchTerms'));
35602
35603					(0, _jquery2.default)('#megasearch input[name=search]').val(_jquery2.default.cookie('megasearchTerms'));
35604				}
35605			}
35606
35607			if (section == '#service' && !(0, _jquery2.default)('#service').hasClass('loaded')) {
35608				//$('.lazy').lazyload();
35609				(0, _jquery2.default)('#service').addClass('loaded');
35610			}
35611		}
35612	};
35613
35614	//Navigation
35615	nav.init = function () {
35616		//On huge screens the navigation is active on default
35617		if (parseInt(windowWidth) > 1264) {
35618			(0, _jquery2.default)('nav ul.sections li.navigation a').addClass('active');
35619		}
35620
35621		if (document.getElementById('main-navigation')) {
35622			document.body.classList.add('navigation-exists');
35623
35624			//Hide navigation if on a campaign page
35625			if (document.querySelector('.campaign-page') && parseInt(windowWidth) > 1264) {
35626				navigation.toggle('#navigation', (0, _jquery2.default)('li.navigation a'));
35627			}
35628		}
35629
35630		$sectionSelectionItem.on('click', 'a', function (e) {
35631			//Defines the id of the section the user clicked
35632			var section = (0, _jquery2.default)(this).attr('href');
35633			if (section.indexOf('#') > -1) {
35634				e.preventDefault();
35635				navigation.toggle(section, (0, _jquery2.default)(this));
35636			}
35637		});
35638
35639		// Open navi links outside nav (for example "Log in" link)
35640		(0, _jquery2.default)('.external-navi-link').click(function (e) {
35641			e.preventDefault();
35642			$sectionSelectionItem.find('a[href="' + (0, _jquery2.default)(this).attr('href') + '"]').click();
35643		});
35644
35645		// Open club login if login failed
35646		if ((0, _jquery2.default)('#login-failed').length) {
35647			navigation.toggle('#club', (0, _jquery2.default)('li.club a'));
35648			(0, _jquery2.default)('#login-failed').remove();
35649		}
35650		if ((0, _jquery2.default)('#login-failed-clubpage').length) {
35651			(0, _jquery2.default)('.heading a.login').hide();
35652			(0, _jquery2.default)('.login-form').show();
35653			(0, _jquery2.default)('#login-failed-clubpage').remove();
35654		}
35655
35656		//Frontpage search opens megasearch
35657		(0, _jquery2.default)('.search-input').click(function (e) {
35658			navigation.toggle('#megasearch', (0, _jquery2.default)('li.megasearch a'));
35659			(0, _jquery2.default)('html').css('overflow', 'hidden');
35660		});
35661
35662		(0, _jquery2.default)('.section-title .close').click(function (e) {
35663			e.preventDefault();
35664			navigation.toggle('#navigation', (0, _jquery2.default)('li.navigation a'));
35665		});
35666
35667		//Sub level
35668		$mainNavItem.on('click', 'a', function (e) {
35669			if ((0, _jquery2.default)(this).parent().hasClass('children')) {
35670				e.preventDefault();
35671				(0, _jquery2.default)('.navigation-sub-level .page').removeClass('active');
35672				var pageClass = (0, _jquery2.default)(this).data('page-class');
35673				(0, _jquery2.default)('.' + pageClass).addClass('active');
35674				$navigations.addClass('animate');
35675				$navigations.addClass('sub');
35676			}
35677		});
35678
35679		$subNavItem.on('click', 'a', function (e) {
35680			if ((0, _jquery2.default)(this).parent().hasClass('children')) {
35681				e.preventDefault();
35682
35683				(0, _jquery2.default)('.navigation-last-level .page').removeClass('active');
35684				var pageClass = (0, _jquery2.default)(this).data('page-class');
35685				(0, _jquery2.default)('.' + pageClass).addClass('active');
35686				$navigations.addClass('animate');
35687				$navigations.addClass('last');
35688			}
35689		});
35690
35691		//Go to main level of nav
35692		(0, _jquery2.default)('.navigation-sub-level .back').bind('touchstart touchend touchmove click', function (e) {
35693			e.preventDefault();
35694			var $this = (0, _jquery2.default)(this);
35695			$navigations.addClass('animate');
35696			$navigations.removeClass('sub');
35697			setTimeout(function () {
35698				$this.parent().parent().removeClass('active');
35699			}, 400);
35700		});
35701		(0, _jquery2.default)('.navigation-last-level .back').bind('touchstart touchend touchmove click', function (e) {
35702			e.preventDefault();
35703			var $this = (0, _jquery2.default)(this);
35704			$navigations.addClass('animate');
35705			$navigations.removeClass('last');
35706			$navigations.addClass('sub');
35707			setTimeout(function () {
35708				$this.parent().parent().removeClass('active');
35709			}, 400);
35710		});
35711
35712		//Show carsearch
35713		(0, _jquery2.default)('.navigation .carsearch, #main-navigation .car-search').on('click', 'a', function (e) {
35714			if (searchPage) {
35715				e.preventDefault();
35716				(0, _jquery2.default)('body').removeClass('main-nav-hidden');
35717				(0, _jquery2.default)('#main-navigation .menu-sections').addClass('active');
35718				(0, _jquery2.default)('#navigation').addClass('active');
35719				(0, _jquery2.default)('.navigation-sub-level').hide();
35720				(0, _jquery2.default)('.navigation-last-level').hide();
35721				(0, _jquery2.default)('.filters.car-filters').addClass('active');
35722				$navigations.addClass('animate');
35723				$navigations.addClass('sub');
35724				userFilters = 'car';
35725			}
35726		});
35727
35728		(0, _jquery2.default)('.filters.car-filters .back').bind('touchstart touchend touchmove click', function (e) {
35729			e.preventDefault();
35730			(0, _jquery2.default)('.navigations').removeClass('sub');
35731			(0, _jquery2.default)('.navigation-sub-level').show();
35732			(0, _jquery2.default)('.navigation-last-level').show();
35733			(0, _jquery2.default)('.filters.car-filters').removeClass('active');
35734		});
35735
35736		//Show tyresearch
35737		(0, _jquery2.default)('.navigation .tyresearch').on('click', 'a', function (e) {
35738			if (!searchPage && windowWidth > 480) {} else {
35739				e.preventDefault();
35740				(0, _jquery2.default)('.filters.tyre-filters').addClass('active');
35741				(0, _jquery2.default)('.navigation-last-level').hide();
35742				$navigations.addClass('animate');
35743				$navigations.addClass('show-tyres');
35744				userFilters = 'tyre';
35745			}
35746		});
35747
35748		(0, _jquery2.default)('.filters.tyre-filters .back').bind('touchstart touchend touchmove click', function (e) {
35749			e.preventDefault();
35750
35751			$navigations.addClass('animate');
35752			$navigations.removeClass('show-tyres');
35753			(0, _jquery2.default)('.navigation-sub-level').show();
35754			(0, _jquery2.default)('.navigation-last-level').show();
35755			(0, _jquery2.default)('.filters.tyre-filters').removeClass('active');
35756		});
35757
35758		if (typeof document.location.href.split('#')[1] !== "undefined" && document.location.href.split('#')[1].indexOf('megasearch') != -1) {
35759			navigation.toggle('#megasearch', (0, _jquery2.default)('li.megasearch a'));
35760		}
35761	};
35762
35763	if (document.body.classList.contains('car-search')) {
35764		var navigationSection = document.getElementById('navigation');
35765		var shouldCloseNav = false;
35766
35767		document.documentElement.addEventListener('click', function (event) {
35768			if (window.innerWidth <= 639 && navigationSection && navigationSection.classList.contains('active')) {
35769				if (shouldCloseNav) {
35770					var currentParent = event.target.parentNode;
35771
35772					while (currentParent && currentParent !== document) {
35773						if (currentParent === navigationSection) {
35774							break;
35775						} else {
35776							currentParent = currentParent.parentNode;
35777						}
35778					}
35779
35780					if (currentParent === document) {
35781						event.preventDefault();
35782						navigation.toggle('#navigation', (0, _jquery2.default)('li.navigation a'));
35783						shouldCloseNav = false;
35784					}
35785				} else {
35786					shouldCloseNav = true;
35787				}
35788			} else if (shouldCloseNav) {
35789				shouldCloseNav = false;
35790			}
35791		});
35792	}
35793
35794	return nav;
35795}();
35796
35797(0, _jquery2.default)(function () {
35798	_branchBar2.default.init();
35799	navigation.init();
35800	search.init();
35801	_accordions2.default.init();
35802
35803	//frontpage articles carousel
35804	var $articlesCarousel = (0, _jquery2.default)('.articles-carousel');
35805	if ($articlesCarousel.length > 0) {
35806		$articlesCarousel.cycle({
35807			timeout: 7000,
35808			slides: ".slide",
35809			fx: "carousel",
35810			carouselVisible: 1,
35811			carouselFluid: true
35812		});
35813	}
35814
35815	if ((0, _jquery2.default)('.autosalpa-60-vuotta').length) {
35816		(0, _jquery2.default)(window).stellar({ positionProperty: 'transform', hideDistantElements: false });
35817	}
35818
35819	var club_carousel = (0, _jquery2.default)('.club-carousel');
35820	if (club_carousel.length > 0) {
35821		(0, _jquery2.default)('.club-carousel').cycle({
35822			slides: ".slide",
35823			pagerTemplate: "<span></span>"
35824		});
35825		(0, _jquery2.default)('.club-carousel').find('.cycle-pager span').append('<span class="meter"></span>');
35826		(0, _jquery2.default)('nav .navigation a').click(function () {
35827			(0, _jquery2.default)('.club-carousel').cycle({
35828				reinit: true,
35829				slides: "p",
35830				pagerTemplate: "<span></span>"
35831			});
35832		});
35833	}
35834
35835	var $offerCarousel = (0, _jquery2.default)('.offer-carousel .carousel-container');
35836	if ($offerCarousel.length > 0) {
35837		var slideAmount = 4;
35838		if ((0, _jquery2.default)(window).width() < 1160 && (0, _jquery2.default)(window).width() > 900) {
35839			slideAmount = 3;
35840		} else if ((0, _jquery2.default)(window).width() <= 900 && (0, _jquery2.default)(window).width() > 768) {
35841			slideAmount = 2;
35842		} else if ((0, _jquery2.default)(window).width() <= 768) {
35843			slideAmount = 1;
35844		}
35845		$offerCarousel.cycle({
35846			timeout: 2000,
35847			slides: ".slide",
35848			fx: "carousel",
35849			carouselVisible: slideAmount,
35850			carouselFluid: true,
35851			next: ".cycle-next",
35852			prev: ".cycle-prev"
35853		});
35854	}
35855
35856	/*var club_section = $('.club-section');
35857 if(club_section.length){
35858 	club_section.each(function(){
35859 		var height = $(this).outerHeight();
35860 		if(!$(this).hasClass('yellow'))
35861 			$(this).find('.grid-1.img div').css({minHeight:height});
35862 	})
35863 }*/
35864
35865	if ((0, _jquery2.default)('.login-form').length) {
35866		(0, _jquery2.default)('.login-form form a.loginbutton').click(function () {
35867			(0, _jquery2.default)(this).prev('button').click();
35868		});
35869	}
35870
35871	(0, _jquery2.default)('.timeline .show-full').click(function (ev) {
35872		ev.preventDefault();
35873		(0, _jquery2.default)(this).parent().css({ height: 'auto' }).find('.shader, .show-full').remove();
35874		//$(this).remove();
35875	});
35876
35877	//login gum
35878	(0, _jquery2.default)('form.stage-extranet').submit(function (e) {
35879		//e.preventDefault();
35880		var $username = (0, _jquery2.default)(this).find('input[name=username]');
35881		var usernameVal = $username.val() != '' ? $username.val().toLowerCase() : $username.val();
35882		$username.val(usernameVal);
35883	});
35884
35885	if ((0, _jquery2.default)('#testdrives .td-item').length) {
35886		setTimeout(function () {
35887			(0, _jquery2.default)('#testdrives .td-item').slice(7).fadeOut();
35888			if ((0, _jquery2.default)('#testdrives .td-item').length > 7 && (0, _jquery2.default)('#testdrives .td-item').length != 0) {
35889				(0, _jquery2.default)('#testdrives .td-item').last().after('<div class="grid-fourth text-center td-show-more"><h3>Näytä lisää</h3></div>');
35890			}
35891			(0, _jquery2.default)('#testdrives .td-show-more').click(function () {
35892				/*$('#testdrives .td-item:hidden').slice(0,4).fadeIn();*/ // Show 4 more
35893				if ((0, _jquery2.default)('#FilterSelect').val() != 'all') {
35894					(0, _jquery2.default)('#testdrives .td-item:hidden').hasClass((0, _jquery2.default)('#FilterSelect').val()).fadeIn();
35895				} else {
35896					(0, _jquery2.default)('#testdrives .td-item:hidden').fadeIn();
35897				}
35898				if ((0, _jquery2.default)('#testdrives .td-item:hidden').length < 1) {
35899					(0, _jquery2.default)('.td-show-more').hide();
35900				}
35901			});
35902		}, 1000);
35903	}
35904
35905	if ((0, _jquery2.default)('#testrepairs .td-item').length) {
35906		setTimeout(function () {
35907			(0, _jquery2.default)('#testrepairs .td-item').slice(7).fadeOut();
35908			if ((0, _jquery2.default)('#testrepairs .td-item').length > 7 && (0, _jquery2.default)('#testrepairs .td-item').length != 0) {
35909				(0, _jquery2.default)('#testrepairs .td-item').last().after('<div class="grid-fourth text-center td-show-more"><h3>Näytä lisää</h3></div>');
35910			}
35911			(0, _jquery2.default)('#testrepairs .td-show-more').click(function () {
35912				/*$('#testrepairs .td-item:hidden').slice(0,4).fadeIn();*/ // Show 4 more
35913				if ((0, _jquery2.default)('#repairsFilterSelect').val() != 'all') {
35914					(0, _jquery2.default)('#testrepairs .td-item:hidden').hasClass((0, _jquery2.default)('#repairsFilterSelect').val()).fadeIn();
35915				} else {
35916					(0, _jquery2.default)('#testrepairs .td-item:hidden').fadeIn();
35917				}
35918				if ((0, _jquery2.default)('#testrepairs .td-item:hidden').length < 1) {
35919					(0, _jquery2.default)('.td-show-more').hide();
35920				}
35921			});
35922		}, 1000);
35923	}
35924
35925	(0, _jquery2.default)('#add-more-image').click(function () {
35926		var counter = 0;
35927		while ((0, _jquery2.default)('#images_' + counter).length) {
35928			counter++;
35929		}
35930		(0, _jquery2.default)('#images_' + (counter - 1)).after('<input type="file" style="line-height:1" id="images_' + counter + '" name="images_' + counter + '" accept="image/*" multiple>');
35931	});
35932
35933	function matchHeight() {
35934		var highestBox = 0;
35935		(0, _jquery2.default)('.matchHeight').each(function () {
35936			if ((0, _jquery2.default)(this).children().height() > highestBox) {
35937				highestBox = (0, _jquery2.default)(this).children().height();
35938			}
35939		});
35940		(0, _jquery2.default)('.matchHeight').height(highestBox);
35941	}
35942	matchHeight();
35943
35944	function matchHeightLiftImg() {
35945		var highestBox = 0;
35946		(0, _jquery2.default)('.matchHeightLiftImg').each(function () {
35947			if ((0, _jquery2.default)(this).children('img').height() > highestBox) {
35948				highestBox = (0, _jquery2.default)(this).children('img').height();
35949			}
35950		});
35951		(0, _jquery2.default)('.matchHeightLiftImg').height(highestBox);
35952	}
35953	matchHeightLiftImg();
35954
35955	setTimeout(function () {
35956		matchHeight();
35957		if ((0, _jquery2.default)('.matchHeightLiftImg').height() == 0) {
35958			matchHeightLiftImg();
35959		}
35960	}, 2000);
35961
35962	(0, _jquery2.default)('img').ready(function () {
35963		matchHeight();
35964		matchHeightLiftImg();
35965	});
35966
35967	(0, _jquery2.default)(window).resize(function () {
35968		matchHeightLiftImg();
35969	});
35970
35971	(0, _jquery2.default)(document).ready(function () {
35972		matchHeight();
35973		matchHeightLiftImg();
35974	});
35975
35976	(0, _jquery2.default)('.TalkNow input[type=text][name=phone]').attr('placeholder', 'puhelinnumerosi');
35977	(0, _jquery2.default)(':input.phone[type=number]').on('mousewheel', function (e) {
35978		e.preventDefault();
35979	});
35980
35981	(0, _jquery2.default)('.TalkNow form button[type=submit]').attr('disabled', true).css('cursor', 'default');
35982
35983	(0, _jquery2.default)('.TalkNow input[type=text][name=phone]').on('input', function () {
35984		if ((0, _jquery2.default)(this).val().length > 0 && _jquery2.default.isNumeric((0, _jquery2.default)(this).val())) {
35985			(0, _jquery2.default)(this).parent().parent().find('.btn').removeAttr('disabled').css('cursor', 'pointer');
35986			(0, _jquery2.default)(this).parent().parent().find('.pop').hide();
35987		} else if ((0, _jquery2.default)(this).val().length > 0 && !_jquery2.default.isNumeric((0, _jquery2.default)(this).val())) {
35988			(0, _jquery2.default)(this).parent().parent().find('.popup').html('Puhelinnumero&nbsp;voi&nbsp;sisältää&nbsp;vain&nbsp;numeroita');
35989			(0, _jquery2.default)(this).parent().parent().find('.btn').attr('disabled', true).css('cursor', 'default');
35990			(0, _jquery2.default)(this).parent().parent().find('.pop').show();
35991		} else {
35992			(0, _jquery2.default)(this).parent().parent().find('.popup').html('Kirjoita&nbsp;puhelinnumerosi&nbsp;numerokenttään ennen&nbsp;lomakkeen&nbsp;lähettämistä');
35993			(0, _jquery2.default)(this).parent().parent().find('.btn').attr('disabled', true).css('cursor', 'default');
35994			(0, _jquery2.default)(this).parent().parent().find('.pop').show();
35995		}
35996	});
35997
35998	// Form placeholders
35999	var $formPlaceholders = (0, _jquery2.default)('.stage-form.md input, .stage-form.md textarea');
36000	$formPlaceholders.each(function () {
36001		if ((0, _jquery2.default)(this).val()) {
36002			(0, _jquery2.default)(this).parent().children('label').addClass('active');
36003		}
36004	});
36005	$formPlaceholders.focusin(function () {
36006		(0, _jquery2.default)(this).parent().children('label').addClass('active');
36007	});
36008	$formPlaceholders.focusout(function () {
36009		if (!(0, _jquery2.default)(this).val()) {
36010			(0, _jquery2.default)(this).parent().children('label').removeClass('active');
36011		}
36012	});
36013
36014	//Car finance calculator
36015	if ((0, _jquery2.default)('.finance_calculator').length > 0) {
36016		_financeCalc2.default.calcFinance();
36017		//var financeToggler = crasToggler($('.show_financial_statement'), $('.finance-popup'));
36018	}
36019
36020	(0, _jquery2.default)('.finance_calculator select').on('change', function () {
36021		_financeCalc2.default.calcFinance();
36022	});
36023
36024	(0, _jquery2.default)('.finance_calculator input[type=number], .finance-popup input[type=number]').on('input', function () {
36025		_financeCalc2.default.calcFinance();
36026	});
36027
36028	//Car card list toggles
36029	(0, _jquery2.default)(".show-less, .show-all").on("click", function () {
36030		var $elem = (0, _jquery2.default)(this);
36031		var openEle = $elem.attr('data-show');
36032		var $openEle = null;
36033		if (typeof openEle !== 'undefined') {
36034			console.log('from data-show');
36035			$openEle = (0, _jquery2.default)('#' + openEle);
36036		} else {
36037			$openEle = $elem.closest('.toggle-element');
36038		}
36039		$openEle.slideToggle();
36040		$elem.children('.show, .hide').toggle();
36041		return false;
36042	});
36043
36044	(0, _jquery2.default)(".toggle-listing").on("click", function () {
36045		var $elem = (0, _jquery2.default)(this);
36046		var $parent = $elem.closest('ul');
36047		$parent.toggleClass('open');
36048		$elem.children('.closed-text, .open-text').slideToggle();
36049	});
36050
36051	// Accept club conditions
36052	(0, _jquery2.default)('.accept-family-conditions').click(function () {
36053		if ((0, _jquery2.default)('#accept-family-conditions').is(':checked')) {
36054			_jquery2.default.get('/stage-ajax/acceptFamilyConditions?id=' + (0, _jquery2.default)(this).data('uuid'));
36055			(0, _jquery2.default)(this).closest('.md-modal').fadeOut('fast').next('.md-overlay').fadeOut('fast');
36056		}
36057	});
36058	// Enable/disable accept button when accept checkbox is checked/unchecked
36059	(0, _jquery2.default)('#accept-family-conditions').change(function () {
36060		(0, _jquery2.default)('.accept-family-conditions').prop('disabled', !(0, _jquery2.default)(this).prop('checked'));
36061	});
36062
36063	//Frontpage
36064	(function () {
36065
36066		(0, _jquery2.default)('a.select-option').click(function (e) {
36067			e.preventDefault();
36068			(0, _jquery2.default)(this).next().slideToggle();
36069		});
36070
36071		(0, _jquery2.default)('.service-locations ul.locations ul li').on('click', 'a', function (e) {
36072			e.preventDefault();
36073			var store = (0, _jquery2.default)(this).data('store');
36074			showClosestLocation = false;
36075			(0, _jquery2.default)('.store.loading-closest').remove();
36076			//$('.service-locations ul.locations ul').slideToggle(200);
36077			(0, _jquery2.default)(this).parent().parent().parent().parent().parent().find('ul.locations ul').slideToggle(200);
36078			(0, _jquery2.default)('.store').css('opacity', 0);
36079			setTimeout(function () {
36080				(0, _jquery2.default)('.store.active').removeClass('active');
36081				(0, _jquery2.default)('.store.' + store).addClass('active');
36082				setTimeout(function () {
36083					(0, _jquery2.default)('.store.' + store).css('opacity', 1);
36084				}, 100);
36085			}, 100);
36086		});
36087	})();
36088
36089	(0, _jquery2.default)('.store.active').css('opacity', 1);
36090	if ((0, _jquery2.default)('.popup-container').length) {
36091		(0, _jquery2.default)('.pop').click(function () {
36092			var $elem = (0, _jquery2.default)(this);
36093			$elem.parent().parent().parent().find('.popup-container span').css('display', 'block');
36094			var popupChars = $elem.parent().parent().parent().find('.popup-container span').text().length;
36095			timeoutDelay = 3000 + popupChars * 50 / 2;
36096			setTimeout(function () {
36097				$elem.parent().parent().parent().find('.popup-container span').css('max-width', '500px');
36098				$elem.parent().parent().parent().find('.popup-container span').css('max-height', '200px');
36099				$elem.parent().parent().parent().find('.popup-container span').css('padding', '4px 6px 3px');
36100			}, 1);
36101			setTimeout(function () {
36102				setTimeout(function () {
36103					$elem.parent().parent().parent().find('.popup-container span').css('max-width', '0');
36104					$elem.parent().parent().parent().find('.popup-container span').css('max-height', '0');
36105					$elem.parent().parent().parent().find('.popup-container span').css('padding', '0 6px 0');
36106				}, 350);
36107				$elem.parent().parent().parent().find('.popup-container span').fadeOut('slow');
36108			}, timeoutDelay);
36109		});
36110
36111		// Open popup also on hover
36112		(0, _jquery2.default)('.pop, .popup-container').hover(function () {
36113			(0, _jquery2.default)('.popup-container').addClass('popup-open');
36114		}, function () {
36115			setTimeout(function () {
36116				if ((0, _jquery2.default)('.pop:hover, .popup-container:hover').length === 0) {
36117					(0, _jquery2.default)('.popup-container').removeClass('popup-open');
36118				}
36119			}, 350);
36120		});
36121	}
36122
36123	(0, _jquery2.default)('a.login').click(function (e) {
36124		e.preventDefault();
36125		(0, _jquery2.default)(this).hide();
36126		(0, _jquery2.default)('.login-form').show();
36127	});
36128
36129	(0, _jquery2.default)('.club-member-info form.modify-user-info input').attr('disabled', 'disabled');
36130
36131	(0, _jquery2.default)('.modify-info').click(function (e) {
36132		e.preventDefault();
36133		(0, _jquery2.default)('.club-member-info form').toggleClass('active');
36134		(0, _jquery2.default)('.club-member-info form input').removeAttr('disabled');
36135		(0, _jquery2.default)(this).hide();
36136	});
36137
36138	(0, _jquery2.default)('.club-member-info form.modify-user-info').submit(function (e) {
36139		e.preventDefault();
36140
36141		var $form = (0, _jquery2.default)(this),
36142		    formData = $form.serialize();
36143
36144		_jquery2.default.ajax({
36145			'url': '/stage-ajax/saveUserInfo',
36146			'data': formData,
36147			'success': function success(data) {
36148				if (typeof data.errors !== "undefined") {
36149					alert(data.errors.message);
36150				} else {
36151					$form.toggleClass('active');
36152					(0, _jquery2.default)('.modify-info').show();
36153					(0, _jquery2.default)('.club-member-info form.modify-user-info input').attr('disabled', 'disabled');
36154				}
36155			},
36156			'complete': function complete(data) {},
36157			'error': function error() {}
36158		});
36159	});
36160
36161	(0, _jquery2.default)('#testdrives').mixItUp();
36162
36163	var $filterSelect = (0, _jquery2.default)('#FilterSelect'),
36164	    $container = (0, _jquery2.default)('#testdrives');
36165	$container.mixItUp();
36166	(0, _jquery2.default)('#FilterSelect').on('change', function () {
36167		(0, _jquery2.default)('#testdrives').mixItUp('filter', this.value);
36168		if ((0, _jquery2.default)('#testdrives .td-item' + (0, _jquery2.default)(this).val()).length < 8) {
36169			(0, _jquery2.default)('.td-show-more').hide();
36170		}
36171	});
36172
36173	(0, _jquery2.default)('#testrepairs').mixItUp();
36174
36175	var $repairsFilterSelect = (0, _jquery2.default)('#repairsFilterSelect'),
36176	    $repairsContainer = (0, _jquery2.default)('#testrepairs');
36177	$repairsContainer.mixItUp();
36178	(0, _jquery2.default)('#repairsFilterSelect').on('change', function () {
36179		(0, _jquery2.default)('#testrepairs').mixItUp('filter', this.value);
36180		if ((0, _jquery2.default)('#testrepairs .td-item' + (0, _jquery2.default)(this).val()).length < 8) {
36181			(0, _jquery2.default)('.td-show-more').hide();
36182		}
36183	});
36184});
36185
36186(0, _jquery2.default)(document).ready(function () {
36187	(0, _jquery2.default)('.matchHeightCampaign').matchHeight();
36188
36189	(0, _jquery2.default)('.campaign-page .timeline .event .text a').click(function (e) {
36190		e.preventDefault();
36191		(0, _jquery2.default)('.campaign-page .timeline .event .text .popup').fadeOut(200);
36192		(0, _jquery2.default)(this).siblings('.popup').fadeIn(200);
36193	});
36194
36195	(0, _jquery2.default)('.popup .modalClose').click(function () {
36196		(0, _jquery2.default)(this).parent().fadeOut(200);
36197	});
36198
36199	(0, _jquery2.default)(document).click(function () {
36200		(0, _jquery2.default)('.campaign-page .timeline .event .text .popup').fadeOut(200);
36201	});
36202
36203	(0, _jquery2.default)('.campaign-page .timeline .event .text .popup, .campaign-page .timeline .event .text a').click(function (e) {
36204		e.stopPropagation();
36205	});
36206
36207	// Expand campaign page brand content box
36208	(0, _jquery2.default)('.campaign-brand-container .read-more').click(function () {
36209		var $self = (0, _jquery2.default)(this);
36210		$self.siblings('.brand-text-container').slideToggle();
36211		$self.parent().toggleClass('active');
36212	});
36213});
36214
36215/* Simple Image Gallery Functions */
36216(0, _jquery2.default)(document).ready(function () {
36217	if ((0, _jquery2.default)('.SIG').length) {
36218		String.prototype.getImgWidth = function () {
36219			var img = new Image();
36220			img.src = this;
36221			return img.width;
36222		};
36223
36224		var SIGModal = '<div class="SIGModal" style="display:none;"><div class="table"><div class="vMid"><div class="SIGModalContainer"><div class="SIGModalClose"></div><div class="SIGModalInnercontainer"><img src="" /><span class="SIGModalCaption"></span></div></div></div></div></div>';
36225		(0, _jquery2.default)('body').append(SIGModal);
36226
36227		(0, _jquery2.default)('.SIGModal, .SIGModalClose').click(function () {
36228			(0, _jquery2.default)('.SIGModal').fadeOut(200, function () {
36229				(0, _jquery2.default)('.SIGModal').find('.SIGModalImg').attr('src', '');
36230				(0, _jquery2.default)('.SIGModal').find('.SIGModalCaption').html('');
36231				(0, _jquery2.default)('.SIGModalContainer').css('max-width', 900);
36232			});
36233		});
36234
36235		(0, _jquery2.default)(".SIGModal .SIGModalContainer").click(function (e) {
36236			e.stopPropagation();
36237		});
36238	}
36239
36240	// Open
36241	var hash = document.location.hash ? document.location.hash : false;
36242	if (hash && (0, _jquery2.default)('.SIG').length) {
36243		var $self = (0, _jquery2.default)(hash);
36244		var url = $self.data('src');
36245		var author = $self.data('author');
36246		var caption = $self.data('caption');
36247		var img_width = $self.data('src').getImgWidth();
36248		(0, _jquery2.default)('.SIGModal').find('.SIGModalContainer img').attr('src', url);
36249		(0, _jquery2.default)('.SIGModal').find('.SIGModalContainer .SIGModalCaption').html(caption + '<div class="SIGModalAuthor">- ' + author + '</div>');
36250		(0, _jquery2.default)('.SIGModalContainer').css('max-width', img_width);
36251		(0, _jquery2.default)('.SIGModal').fadeIn(200);
36252	}
36253
36254	(0, _jquery2.default)('.SIGitem').click(function () {
36255		var $self = (0, _jquery2.default)(this);
36256		var id = $self.prop('id');
36257		var url = $self.data('src');
36258		var author = $self.data('author');
36259		var caption = $self.data('caption');
36260		var img_width = $self.data('src').getImgWidth();
36261		(0, _jquery2.default)('.SIGModal').find('.SIGModalContainer img').attr('src', url);
36262		(0, _jquery2.default)('.SIGModal').find('.SIGModalContainer .SIGModalCaption').html(caption + '<div class="SIGModalAuthor">- ' + author + '</div>');
36263		if (img_width > 0) {
36264			(0, _jquery2.default)('.SIGModalContainer').css('max-width', img_width);
36265		}
36266		(0, _jquery2.default)('.SIGModal').fadeIn(200);
36267	});
36268
36269	(0, _jquery2.default)('.retailer-staff .contact').matchHeight();
36270	(0, _jquery2.default)('.interest-offer .matchHeightOffer').matchHeight();
36271	(0, _jquery2.default)('.SIGitem').matchHeight();
36272});
36273
36274function storeContactEvent(type, phoneNum, callback) {
36275	//	console.log(type,phoneNum);
36276	if (typeof type == 'undefined' || !type) return;
36277	var carUuidEl = (0, _jquery2.default)('section[data-uuid]:first'),
36278	    carUuid = false,
36279	    wtf = false;
36280
36281	if (carUuidEl.length && carUuidEl.attr('data-uuid')) {
36282		carUuid = carUuidEl.attr('data-uuid');
36283		if (carUuidEl.attr('data-wtf')) wtf = carUuidEl.attr('data-wtf');
36284	}
36285
36286	var params = {
36287		lead_type: type,
36288		link: document.location.href
36289	};
36290	if (carUuid) params.car_uuid = carUuid;
36291	if (wtf) params.wtf = wtf;
36292	if (typeof phoneNum != 'undefined' && phoneNum) params.phone = phoneNum;
36293	_jquery2.default.ajax({
36294		url: '/stage-ajax/new_contact/',
36295		type: 'POST',
36296		data: params,
36297		complete: function complete() {
36298			if (typeof callback == 'function') callback();
36299		}
36300	});
36301}
36302
36303function getPhoneNum() {
36304	var phoneNum = (0, _jquery2.default)('#talkNowActivePhone').val();
36305	if (phoneNum) {
36306		storeContactEvent('phone-number-submit', phoneNum);
36307	}
36308}
36309
36310function closePopup(e) {
36311	document.getElementById('cover-page').classList.remove('show');
36312	document.querySelector('.autosalpa-popup').classList.remove('show');
36313}
36314
36315if (document.querySelector('main.campaign-page.autosalpa-sopimus')) {
36316
36317	var animatedTexts = ['Ei suurta ensimmäistä erää', 'Ei huolta auton jälleenmyyntiarvosta', 'Taattu takaisinostohinta', 'Kiinteä kuukausierä', 'Laadukas auto ilman sidottua pääomaa'];
36318	var currentTextElement;
36319	var textAnimationCounter = 1;
36320	var animatedTextHolder;
36321
36322	initializeAnimatedText(animatedTexts);
36323	var textAnimationInterval = setInterval(changeText, 5000);
36324}
36325
36326if (document.querySelector('[data-action="closePopup"]')) {
36327	var closePopupActions = document.querySelectorAll('[data-action="closePopup"]');
36328	for (var i = 0; i < closePopupActions.length; i++) {
36329		closePopupActions[i].addEventListener('click', closePopup);
36330	}
36331}
36332
36333/* Autosalpa Sopimus campaign animated text */
36334function initializeAnimatedText() {
36335	animatedTextHolder = document.createElement('div');
36336	animatedTextHolder.classList.add('animated-text');
36337
36338	var el = document.createElement('p');
36339	el.appendChild(document.createTextNode(animatedTexts[0]));
36340	animatedTextHolder.appendChild(el);
36341
36342	currentTextElement = el;
36343	var headerText = document.querySelector('.campaign-top-bar .header-container');
36344	headerText.insertBefore(animatedTextHolder, headerText.querySelector('span.bottomline'));
36345}
36346
36347function changeText(i) {
36348	if (textAnimationCounter == animatedTexts.length) {
36349		textAnimationCounter = 0;
36350	}
36351
36352	currentTextElement.parentElement.removeChild(currentTextElement);
36353
36354	var el = document.createElement('p');
36355	el.appendChild(document.createTextNode(animatedTexts[textAnimationCounter]));
36356	animatedTextHolder.appendChild(el);
36357
36358	currentTextElement = el;
36359
36360	textAnimationCounter++;
36361}
36362
36363// product page click tracking
36364(0, _jquery2.default)(document).ready(function () {
36365	var path = window.location.pathname.split('/');
36366	var page = path[path.length - 1] === '' ? path[path.length - 1] : path[path.length - 2];
36367	if (document.getElementById('recruitment-form')) {
36368		var initJumpToYearSelects = function initJumpToYearSelects() {
36369			var jumpToYearSelects = document.getElementsByClassName('jump-to-year');
36370			for (var i = 0; i < jumpToYearSelects.length; i++) {
36371				jumpToYearSelects[i].addEventListener('input', function () {
36372					document.getElementById(this.dataset.dateInput).value = this.value + '-01-01';
36373				});
36374			}
36375		};
36376
36377		var experienceId = 0,
36378		    educationId = 0,
36379		    experienceTemplate = document.getElementById('experience').innerHTML,
36380		    educationTemplate = document.getElementById('education').innerHTML;
36381
36382		document.getElementById('add-experience').addEventListener('click', function () {
36383			experienceId++;
36384			var rendered = _mustache2.default.render(experienceTemplate, { 'experienceId': experienceId });
36385			document.getElementById('experience-container').insertAdjacentHTML('beforeend', rendered);
36386			initJumpToYearSelects();
36387		});
36388		document.getElementById('add-education').addEventListener('click', function () {
36389			educationId++;
36390			var rendered = _mustache2.default.render(educationTemplate, { 'educationId': educationId });
36391			document.getElementById('education-container').insertAdjacentHTML('beforeend', rendered);
36392			initJumpToYearSelects();
36393		});
36394
36395		/* remove event for elements above with a neat trick */
36396
36397		document.getElementById('experience-container').addEventListener('click', function (e) {
36398			if (e.target.classList.contains('remove-form-element')) {
36399				e.target.parentElement.remove();
36400			}
36401		});
36402		document.getElementById('education-container').addEventListener('click', function (e) {
36403			if (e.target.classList.contains('remove-form-element')) {
36404				e.target.parentElement.remove();
36405			}
36406		});
36407
36408		initJumpToYearSelects();
36409	}
36410
36411	if ((0, _jquery2.default)('section[data-uuid].carCard').length) {
36412		(0, _jquery2.default)(document).on('submit', '#talkNowActive form', function (e) {
36413			getPhoneNum();
36414		}).on('click', '#talkNowActive .lekanebutton', function (e) {
36415			dataLayer.push({
36416				event: 'GAEvent',
36417				eventCategory: 'CarPage talkNowActive lekanebutton',
36418				eventAction: 'click',
36419				eventLabel: 'talkNowActive lekanebutton - clicked',
36420				nonInteraction: false
36421			});
36422			getPhoneNum();
36423		}).on('click', '.contact-person a', function (e) {
36424			e.preventDefault();
36425			var link = (0, _jquery2.default)(this).attr('data-target') ? (0, _jquery2.default)(this).attr('data-target') : (0, _jquery2.default)(this).text(),
36426			    target = (0, _jquery2.default)(this).attr('href');
36427			var callback = target && target != '#' ? function () {
36428				window.location.href = target;
36429			} : undefined;
36430			storeContactEvent(link, undefined, callback);
36431		});
36432	}
36433});
36434
36435if (document.querySelector('.autosalpa-slideshow')) {
36436	var slideshow = {
36437		init: function init() {
36438			slideshow.prevButton.addEventListener('click', slideshow.prev);
36439			slideshow.nextButton.addEventListener('click', slideshow.next);
36440		},
36441		next: function next() {
36442			if (slideshow.slidePosition === slideshow.slidesCount - 1) {
36443				slideshow.slidePosition = 0;
36444			} else {
36445				slideshow.slidePosition++;
36446			}
36447			slideshow.updateSlidePosition();
36448		},
36449		prev: function prev() {
36450			if (slideshow.slidePosition === 0) {
36451				slideshow.slidePosition = slideshow.slidesCount - 1;
36452			} else {
36453				slideshow.slidePosition--;
36454			}
36455			slideshow.updateSlidePosition();
36456		},
36457		updateSlidePosition: function updateSlidePosition() {
36458			slideshow.reel.style.left = -(slideshow.slidePosition * 100) + '%';
36459			slideshow.caption.innerHTML = slideshow.slidePosition + 1 + ' / ' + slideshow.slidesCount;
36460		},
36461		reel: document.querySelector('.autosalpa-slideshow-reel'),
36462		prevButton: document.querySelector('.autosalpa-slideshow > .controls > .prev'),
36463		nextButton: document.querySelector('.autosalpa-slideshow > .controls > .next'),
36464		caption: document.querySelector('.autosalpa-slideshow > .controls > .cycle-caption'),
36465		slidesCount: document.querySelectorAll('.autosalpa-slideshow-reel > .slide').length,
36466		slidePosition: 0
36467	};
36468	slideshow.init();
36469}
36470
36471window.onload = function () {
36472	// Contact form - hide 'huolto' from subjects dropdown when selected vaihtoautosalpa
36473	if (document.getElementById('contact-request-form')) {
36474		var serviceOption = document.getElementById('subject').querySelector('option[value="huolto"]');
36475		document.getElementById('toimipiste').addEventListener('change', function (event) {
36476			if (event.target.value === '89DfFEhBQyCyKaoB5tBhzQ' || event.target.value === 'b4_wNVyLTtmtWaxiqTaVoA') {
36477				serviceOption.disabled = true;
36478				serviceOption.innerText = 'Huolto (ei saatavilla)';
36479				document.getElementById('subject').value = 'automyynti';
36480			} else {
36481				serviceOption.disabled = false;
36482				serviceOption.innerText = 'Huolto';
36483			}
36484		});
36485	}
36486};
36487(0, _jquery2.default)(document).ready(function () {
36488	// on Request of task https://3.basecamp.com/3360800/buckets/4840992/todos/1551563610
36489	var addAdPixel = function addAdPixel() {
36490		var imgPixel = document.querySelector('img[src=" https://secure.adnxs.com/seg?add=16753212&t=2 "]');
36491		if (imgPixel === null) {
36492			var adPixel = '\n<! - Segment Pixel - 1905-06 Autosalpa Oy Clio on campaign pages retargeting_1x1 - DO NOT MODIFY ->\n<img src = " https://secure.adnxs.com/seg?add=16753212&t=2 " width = " 1 "height =" 1 "/>\n<! - End of Segment Pixel ->';
36493			document.querySelector('footer').innerHTML += adPixel;
36494		}
36495	};
36496
36497	var searchSlug = window.location.search;
36498	if (searchSlug.indexOf('renault') !== -1 || searchSlug.indexOf('clio') !== -1) {
36499		addAdPixel();
36500	}
36501
36502	var filter = document.querySelector('.filters.car-filters');
36503	if (filter !== null) {
36504		filter.addEventListener('click', function () {
36505			var renaultOption = document.querySelector('a[data-filter-option="renault"]');
36506			var clioOption = document.querySelector('a[data-filter-option="clio"]');
36507
36508			[renaultOption, clioOption].forEach(function (div) {
36509				if (div !== null) {
36510					div.addEventListener('click', function () {
36511						addAdPixel();
36512					});
36513				}
36514			});
36515		});
36516	}
36517});
36518
36519var contactMenuButton = document.getElementById('contact-menu-open');
36520
36521if (contactMenuButton) {
36522	var navigationEl = document.getElementById('navigation');
36523
36524	contactMenuButton.addEventListener('click', function (event) {
36525		(0, _jquery2.default)('.navigation-sub-level').show();
36526		(0, _jquery2.default)('.navigation-last-level').show();
36527		navigation.toggle('#navigation', (0, _jquery2.default)('li.navigation a'));
36528		var currentlyActive = navigationEl.getElementsByClassName('active');
36529		for (var _i = 0; _i < currentlyActive.length; _i++) {
36530			currentlyActive[_i].classList.remove('active');
36531		}
36532		if (navigationEl.querySelector('.last')) {
36533			navigationEl.querySelector('.last').classList.remove('last');
36534		}
36535		if (navigationEl.querySelector('.sub')) {
36536			navigationEl.querySelector('.sub').classList.remove('sub');
36537		}
36538
36539		navigationEl.querySelector('a[data-page-class="yhteystiedot"]').click();
36540	});
36541}
36542
36543}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
36544
36545},{"../static/libs/jquery.cookie":147,"./financeCalc":130,"./form-helper.js":131,"./global.js":134,"./libs.js":135,"./megasearch.js":137,"./modules/accordions":138,"./modules/branch-bar":139,"./searches.js":140,"./sopimus/index":142,"babel-runtime/helpers/typeof":15,"jquery":124,"jquery.cycle2":123,"mustache":125}],130:[function(require,module,exports){
36546'use strict';
36547
36548var _jquery = require('jquery');
36549
36550var _jquery2 = _interopRequireDefault(_jquery);
36551
36552function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36553
36554var financeCalculator = function () {
36555    var app = {
36556        $win: (0, _jquery2.default)(window),
36557        $doc: (0, _jquery2.default)(document),
36558        $body: (0, _jquery2.default)('body')
36559    };
36560    app.polaroidMonthlyAmount = function () {
36561        var $li = (0, _jquery2.default)(this);
36562        var price = parseInt((0, _jquery2.default)('.finance_calculator .total_price').text().replace(/[^\d]/g, ''));
36563        var deliveryCosts = parseFloat((0, _jquery2.default)('.finance-delivery-costs .amount').first().text().replace(/,/, '.'));
36564        var ownShare = Math.round(price * 0.1);
36565        var payments = 48;
36566        var monthlyPrice = app.calcFinance(price, ownShare, payments, 0, 0);
36567        $li.find('.monthlyfee .amount').text(monthlyPrice);
36568    };
36569
36570    app.prettyNumber = function (n, decimals) {
36571        decimals = decimals || 0;
36572        var exp = Math.pow(10, decimals);
36573        n = Math.round(n * exp) / exp;
36574        n = n.toString().replace('.', ',');
36575        return n.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
36576    };
36577
36578    app.calcFinance = function (price, ownShare, payments, lastPayment, decimals) {
36579
36580        function parseNumber(num) {
36581            if (typeof num == 'string') {
36582                num = num.replace(/,/, '.').replace(/\s/, '');
36583            }
36584            return parseFloat(num);
36585        }
36586
36587        var doFinanceElements = typeof price == 'undefined';
36588        var price = parseNumber(price || (0, _jquery2.default)('.finance_calculator .total_price').text().replace(/€/g, ''));
36589
36590        var ownShare = parseNumber(ownShare || (0, _jquery2.default)('.finance-own-share').val() || 0);
36591
36592        if (ownShare > price) {
36593            ownShare = Math.max(price - 100, 0);
36594            (0, _jquery2.default)('.finance-own-share').val(ownShare);
36595        }
36596
36597        if (ownShare < 0) {
36598            ownShare = 0;
36599            (0, _jquery2.default)('.finance-own-share').val(ownShare);
36600        }
36601
36602        var payments = parseNumber(payments || (0, _jquery2.default)('.finance-time option:selected').val());
36603        var lastPayment = parseNumber(lastPayment || (0, _jquery2.default)('.finance-last-monthly-amount').val() || 0);
36604
36605        if (lastPayment > price - ownShare) {
36606            lastPayment = Math.max(price - ownShare - 100, 0);
36607            (0, _jquery2.default)('.finance-last-monthly-amount').val(lastPayment);
36608        }
36609
36610        if (lastPayment < 0) {
36611            lastPayment = 0;
36612            (0, _jquery2.default)('.finance-last-monthly-amount').val(lastPayment);
36613        }
36614
36615        if (typeof decimals == 'undefined') {
36616            decimals = 2;
36617        }
36618
36619        var interest = parseFloat((0, _jquery2.default)('.finance-interest .amount').first().text().replace(/,/g, '.')) / 100;
36620        var initialCost = parseFloat((0, _jquery2.default)('.finance-initial-amount .amount').first().text().replace(/,/, '.'));
36621        var monthlyHandling = parseFloat((0, _jquery2.default)('.finance-handling-costs .amount').first().text().replace(/,/, '.'));
36622        var handlingCost = monthlyHandling * payments;
36623        var loanAmount = price - ownShare;
36624        var helper = Math.pow(interest / 12.0 + 1, payments - (lastPayment ? 1 : 0));
36625        var initialAmount = (loanAmount + initialCost) * (helper * (interest / 12.0)) / (helper - 1);
36626
36627        if (lastPayment) {
36628            initialAmount -= lastPayment / payments + lastPayment * interest / payments;
36629        }
36630
36631        var loanRemaining = loanAmount;
36632        var interestCurrent,
36633            interestSum = 0;
36634        var paymentAmount = 0;
36635
36636        var i;
36637        for (i = 0; i < payments; i++) {
36638            interestCurrent = loanRemaining * interest / 12;
36639            if (lastPayment && i == payments - 1) {
36640                paymentAmount = lastPayment - interestCurrent;
36641            } else {
36642                paymentAmount = initialAmount - interestCurrent;
36643            }
36644            loanRemaining -= paymentAmount;
36645        }
36646
36647        var x = loanRemaining / (payments - 1);
36648        loanRemaining = loanAmount + initialCost;
36649        for (i = 0; i < payments; i++) {
36650            interestCurrent = (loanRemaining - x) * interest / 12;
36651            interestSum += interestCurrent;
36652            if (lastPayment && i == payments - 1) {
36653                paymentAmount = lastPayment - interestCurrent;
36654            } else {
36655                paymentAmount = initialAmount - interestCurrent;
36656            }
36657            loanRemaining -= paymentAmount;
36658        }
36659
36660        if (lastPayment) {
36661            initialAmount = initialAmount + loanRemaining / (payments - 1);
36662        }
36663
36664        var monthlyPrice = initialAmount + monthlyHandling;
36665        monthlyPrice = Math.round(monthlyPrice * 100) / 100;
36666        var loanExpenses = interestSum + initialCost + monthlyHandling * payments;
36667        var yearlyInterest = lastPayment ? 2400 * loanExpenses / ((loanAmount + initialCost) * payments) : 2400 * loanExpenses / ((loanAmount + initialCost) * (payments + 1));
36668
36669        if (doFinanceElements) {
36670            (0, _jquery2.default)('.finance-own-share-text .amount').text(app.prettyNumber(ownShare));
36671            (0, _jquery2.default)('.finance-time-text .amount').text(payments);
36672            (0, _jquery2.default)('.finance-loan-cost .amount').text(app.prettyNumber(loanExpenses, 2));
36673            (0, _jquery2.default)('.finance-yearly-interest .amount').text(app.prettyNumber(yearlyInterest, 2));
36674            (0, _jquery2.default)('.finance-loan-total-cost .amount').text(app.prettyNumber(parseFloat(loanExpenses) + parseFloat(price - ownShare), 2));
36675            (0, _jquery2.default)('.finance-total-cost .amount').text(app.prettyNumber(price + loanExpenses, 2));
36676            (0, _jquery2.default)('.finance-monthly-amount .amount').text(app.prettyNumber(monthlyPrice, 2));
36677            (0, _jquery2.default)('.finance-fund-amount .amount').text(app.prettyNumber(price - ownShare, 2));
36678        }
36679
36680        return app.prettyNumber(monthlyPrice, decimals);
36681    };
36682
36683    return app;
36684}(); //Finance calculator
36685
36686
36687module.exports = financeCalculator;
36688
36689},{"jquery":124}],131:[function(require,module,exports){
36690"use strict";
36691
36692},{}
36692],132:[function(require,module,exports){
36693'use strict';
36694
36695exports.__esModule = true;
36696
36697var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
36698
36699var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
36700
36701var _ractive = require('ractive');
36702
36703var _ractive2 = _interopRequireDefault(_ractive);
36704
36705var _fundingCalculator = require('./funding-calculator');
36706
36707var _fundingCalculator2 = _interopRequireDefault(_fundingCalculator);
36708
36709function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36710
36711// Configure Ractive.js debug mode
36712// http://www.ractivejs.org/
36713_ractive2.default.DEBUG = false;
36714
36715var fundingCalculatorUi = function () {
36716  function fundingCalculatorUi() {
36717    (0, _classCallCheck3.default)(this, fundingCalculatorUi);
36718
36719    this.ractiveActive = false;
36720    this.ractiveElement = null;
36721  }
36722
36723  fundingCalculatorUi.prototype.teardown = function teardown() {
36724    var fundingCalculatorUi = this;
36725
36726    // Don't run teardown code if it's already done before
36727    if (!fundingCalculatorUi.ractiveActive) {
36728      return;
36729    }
36730
36731    fundingCalculatorUi.ractiveActive = false;
36732    fundingCalculatorUi.ractiveElement.teardown();
36733  };
36734
36735  /**
36736   * Initialises funding calculator to selected element
36737   *
36738   * @param {dom} element - Dom element to attach calculator
36739   */
36740
36741
36742  fundingCalculatorUi.prototype.init = function init(element) {
36743    var fundingCalculatorUi = this;
36744
36745    //Get options from data-attributes
36746    var fundingCalculatorOptions = false;
36747    try {
36748      if (element.dataset.options) {
36749        fundingCalculatorOptions = JSON.parse(element.dataset.options);
36750      }
36751    } catch (e) {
36752      return;
36753    }
36754
36755    // Don't init if options not available
36756    if (!fundingCalculatorOptions) {
36757      return;
36758    }
36759
36760    // Don't init if it's already done before
36761    if (fundingCalculatorUi.ractiveActive) {
36762      return;
36763    }
36764
36765    fundingCalculatorUi.ractiveActive = true;
36766
36767    // Calculator class
36768    _fundingCalculator2.default.construct(fundingCalculatorOptions.deliveryCosts, // `deliveryCosts`
36769    fundingCalculatorOptions.interest, // `interest` %
36770    fundingCalculatorOptions.baseCost, // `initialCost`
36771    fundingCalculatorOptions.monthlyTrancheCost // `monthlyHandlingCost`
36772    );
36773
36774    /**
36775     * Funding calculator template and initial data
36776     */
36777    fundingCalculatorUi.ractiveElement = new _ractive2.default({
36778      // The `el` option can be a node, an ID, or a CSS selector.
36779      //el: '#funding-calculator',
36780      el: element,
36781
36782      // We could pass in a string, but for the sake of convenience
36783      // we're passing the ID of the `<script>` tag, which holds the template.
36784      template: '#ractive-funding-calculator-template',
36785
36786      // Here we're passing in some initial data
36787      data: {
36788        // If math is uncountable, numbers will be hidden
36789        uncountable: false,
36790
36791        // Helper function for formatting eur prices
36792        parseCurrency: fundingCalculatorUi.toLocaleStringCurrency,
36793
36794        // Helper function for formatting percentage values
36795        parsePercentage: fundingCalculatorUi.toLocaleStringPercentage,
36796
36797        // Sopimusaikavaihtoehdot (kk)
36798        monthlyCategories: fundingCalculatorOptions.months,
36799
36800        // Valittu sopimusaika
36801        activeMonthlyCategory: fundingCalculatorOptions.months[0],
36802
36803        // Käsiraha (defaults to some sum but can be adjusted by customer from the UI)
36804        deposit: fundingCalculatorOptions.deposit ? fundingCalculatorOptions.deposit : '',
36805
36806        // Suurempi viimeinen erä (€)
36807        // Empty string will default to `0` in calculations
36808        // but show as "0 €" at the UI. Using `0` here would be fine,
36809        // but at the UI it would show up just as "0".
36810        lastTranche: 0,
36811
36812        // Maximum amount of last installment as percentage of total price
36813        maxLastInstallmentPercent: fundingCalculatorOptions.maxLastInstallment,
36814
36815        // Calculator on car page will show last installment based on car age
36816        // Calculators on other pages have no such restrictions and can always show it
36817        alwaysShowLastInstallment: fundingCalculatorOptions.alwaysShowLastInstallment || false,
36818
36819        // Käsittelymaksu (€/erä)
36820        monthlyTrancheCost: fundingCalculatorOptions.monthlyTrancheCost,
36821
36822        // Perustamismaksu (€)
36823        baseCost: fundingCalculatorOptions.baseCost,
36824
36825        // Korko (%)
36826        interest: fundingCalculatorOptions.interest,
36827
36828        // Toimituskulut (€)
36829        deliveryCosts: fundingCalculatorOptions.deliveryCosts,
36830
36831        // Kuukausierä (ilman käsittelymaksua)
36832        monthlyTranche: 0,
36833
36834        price: fundingCalculatorOptions.price,
36835
36836        // Rahoitettava osuus
36837        financedAmount: 0,
36838
36839        // KSL:n mukainen luottohinta
36840        creditPrice: 0,
36841
36842        // KSL:n mukaiset luottokustannukset
36843        creditCosts: 0,
36844
36845        // KSL:n mukainen vuosikorko %
36846        // @link https://kulutusluottovertailu.fi/todellinen-vuosikorko/
36847        //
36848        // Kuluttajaluottojen todellisen vuosikoron laskentakaava on
36849        // Oikeusministeriön asetuksen 824/2010 liitteessä ja se
36850        // perustuu EU-direktiiviin:
36851        // http://www.finlex.fi/data/sdliite/liite/6176.pdf
36852        realYearlyInterest: 0,
36853        // Autosalpasopimus
36854        mileageOptions: fundingCalculatorOptions.mileageOptions,
36855        activeMileageOptions: fundingCalculatorOptions.mileageOptions[0],
36856        carName: fundingCalculatorOptions.manufacturer.toUpperCase() + ' ' + fundingCalculatorOptions.model + ' ' + fundingCalculatorOptions.version,
36857        imageLink: fundingCalculatorOptions.image,
36858        carId: fundingCalculatorOptions.id,
36859        emails: fundingCalculatorOptions.emails
36860      },
36861      computed: {
36862        maxLastInstallment: function maxLastInstallment() {
36863          //Maximum amount of last installment in currency (a percentage of total price)
36864          return this.get('maxLastInstallmentPercent') * (parseInt(String(this.get('price')).replace(' ', ''), 10) || 0) / 100;
36865        },
36866        financedAmountLT: function financedAmountLT() {
36867          //LT will add their own baseCost, so remove basecost from the amount that is passed to LT
36868          return this.get('financedAmount') - this.get('baseCost');
36869        }
36870      }
36871    });
36872
36873    // Update model to take into accoun't `currencyinput`'s initial format
36874    // (could be `1 500` while model would stay at `1500` without this)
36875    // http://docs.ractivejs.org/latest/lifecycle-events
36876    fundingCalculatorUi.ractiveElement.on('complete', function () {
36877      fundingCalculatorUi.ractiveElement.updateModel();
36878    });
36879
36880    // The observer will be initialised with ( currentValue, undefined ) unless
36881    // we pass a third `options` argument in which `init` is `false`.
36882    fundingCalculatorUi.ractiveElement.observe('deposit lastTranche activeMonthlyCategory price activeMileageOptions', function (newValue, oldValue, keypath) {
36883      // Get values from the model
36884      var emails = fundingCalculatorUi.ractiveElement.get('emails');
36885      var deposit = fundingCalculatorUi.ractiveElement.get('deposit');
36886      var lastTranche = fundingCalculatorUi.ractiveElement.get('lastTranche');
36887      var activeMonthlyCategory = fundingCalculatorUi.ractiveElement.get('activeMonthlyCategory');
36888      var activeMileageOptions = fundingCalculatorUi.ractiveElement.get('activeMileageOptions');
36889      var price = fundingCalculatorUi.ractiveElement.get('price');
36890      // Ensure we have integers
36891      // `NaN` turns to `0`
36892      // `10` in parseInt is radix
36893      deposit = parseInt(String(deposit).replace(' ', ''), 10) || 0;
36894      activeMonthlyCategory = parseInt(activeMonthlyCategory, 10) || 0;
36895      activeMileageOptions = parseInt(activeMileageOptions, 10) || 0;
36896      price = parseInt(String(price).replace(' ', ''), 10) || 0;
36897
36898      //Price forced to minimum 1000
36899      if (price < 1000) {
36900        price = 1000;
36901        fundingCalculatorUi.ractiveElement.set('price', price);
36902      }
36903
36904      // Empty means `0`
36905      if (lastTranche === '') {
36906        fundingCalculatorUi.ractiveElement.set('lastTranche', 0);
36907      } else {
36908        //Parse amount
36909        lastTranche = parseInt(String(lastTranche).replace(' ', ''), 10) || 0;
36910
36911        var maxValue = Math.round(fundingCalculatorUi.ractiveElement.get('maxLastInstallment'));
36912
36913        if (lastTranche > maxValue) {
36914          lastTranche = maxValue;
36915          fundingCalculatorUi.ractiveElement.set('lastTranche', lastTranche);
36916        }
36917      }
36918      var leasingOptions = fundingCalculatorOptions.leasingOptions;
36919      var leasingOptionsByMonths = leasingOptions[activeMonthlyCategory];
36920      var leasingOption = leasingOptionsByMonths.find(function (element) {
36921        return +element.mileage === activeMileageOptions;
36922      });
36923
36924      var residual_value = +leasingOption.residual_value || 0;
36925      var tyres_price = +leasingOption.tyres_price || 0;
36926      fundingCalculatorUi.ractiveElement.set('residualValue', residual_value);
36927      fundingCalculatorUi.ractiveElement.set('tyresPrice', tyres_price);
36928      var math = _fundingCalculator2.default.calculate({
36929        price: price - residual_value + tyres_price,
36930        deposit: deposit,
36931        paymentMonths: activeMonthlyCategory,
36932        lastPayment: lastTranche
36933      });
36934      /* Output:
36935         fundAmount: 88500
36936        loanExpenses: 7406.701953918012
36937        monthlyTranche: 1598.44
36938        deposit: 1500
36939        lastPayment: 0
36940        paymentMonths: 60
36941        creditPrice: 97406.70195391802
36942        totalLoanCost: 95906.70195391802
36943        yearlyInterest: 3.286283895308107
36944      */
36945
36946      // Math could not return result, sets all the values to `—`
36947      if (!math) {
36948        fundingCalculatorUi.ractiveElement.set('uncountable', true);
36949        return;
36950      }
36951
36952      fundingCalculatorUi.ractiveElement.set('uncountable', false);
36953      fundingCalculatorUi.ractiveElement.set('emails', emails);
36954
36955      fundingCalculatorUi.ractiveElement.set('monthlyTranche', math.monthlyTranche);
36956
36957      fundingCalculatorUi.ractiveElement.set('financedAmount', math.financedAmount);
36958
36959      fundingCalculatorUi.ractiveElement.set('creditPrice', math.creditPrice);
36960
36961      fundingCalculatorUi.ractiveElement.set('creditCosts', math.loanExpenses);
36962
36963      fundingCalculatorUi.ractiveElement.set('realYearlyInterest', math.realYearlyInterest);
36964    });
36965  };
36966
36967  /**
36968   * Parse eur numbers
36969   *
36970   * @param {Number} number - Number to return in Finnish EUR format
36971   *
36972   * @returns {String}
36973   */
36974
36975
36976  fundingCalculatorUi.prototype.toLocaleStringCurrency = function toLocaleStringCurrency(number) {
36977    number = Number(number);
36978
36979    // Stop for falsy (except `0`)
36980    if (!number && number !== 0) {
36981      return '—';
36982    }
36983
36984    return number.toLocaleString('fi-FI', {
36985      style: 'currency',
36986      currency: 'EUR',
36987      currencyDisplay: 'symbol',
36988      minimumFractionDigits: 0,
36989      maximumFractionDigits: 0
36990    });
36991  };
36992
36993  /**
36994   * Parse percentage numbers
36995   *
36996   * @param {Number} number - Number to return in Finnish % format
36997   *
36998   * @returns {String}
36999   */
37000
37001
37002  fundingCalculatorUi.prototype.toLocaleStringPercentage = function toLocaleStringPercentage(number) {
37003    number = Number(number);
37004
37005    // Stop for falsy (except `0`)
37006    if (!number && number !== 0) {
37007      return '—';
37008    }
37009
37010    // Divide. Otherwise `2.95` would print `295 %`
37011    number = number / 100;
37012
37013    return number.toLocaleString('fi-FI', {
37014      style: 'percent',
37015      minimumFractionDigits: 0,
37016      maximumFractionDigits: 2
37017    });
37018  };
37019
37020  return fundingCalculatorUi;
37021}();
37022
37023exports.default = fundingCalculatorUi;
37024
37025},{"./funding-calculator":133,"babel-runtime/helpers/classCallCheck":13,"ractive":126}],133:[function(require,module,exports){
37026'use strict';
37027
37028/**
37029 * Car Funding Calculator
37030 *
37031 * Usage:
37032 *
37033 * var Calculator = new FundingCalculator(
37034 *   100, // deliveryCosts
37035 *   2.9, // interest %  (korko)
37036 *   175, // initialCost (perustamismaksu)
37037 *   9    // monthlyHandlingCost (käsittelymaksu/kk)
37038 * );
37039
37040 * var result = Calculator.calculate({
37041 *   price         : 17800, // Auton hinta
37042 *   deposit       : 1500,  // Käsiraha
37043 *   paymentMonths : 60,    // Maksukuukaudet
37044 *   lastPayment   : 0      // Viimeinen poikkeava erä
37045 * });
37046 *
37047 */
37048
37049/**
37050 * https://www.npmjs.com/package/effective-interest-rate
37051 */
37052
37053var _typeof2 = require('babel-runtime/helpers/typeof');
37054
37055var _typeof3 = _interopRequireDefault(_typeof2);
37056
37057var _keys = require('babel-runtime/core-js/object/keys');
37058
37059var _keys2 = _interopRequireDefault(_keys);
37060
37061var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
37062
37063var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
37064
37065var _effectiveInterestRate = require('effective-interest-rate');
37066
37067var _effectiveInterestRate2 = _interopRequireDefault(_effectiveInterestRate);
37068
37069function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37070
37071/**
37072 * KSL Annual Interest calculator
37073 *
37074 * Math – not even once.
37075 */
37076var kslAnnualInterest = function () {
37077  function kslAnnualInterest() {
37078    (0, _classCallCheck3.default)(this, kslAnnualInterest);
37079  }
37080
37081  /**
37082   * Calculates an effective interest rate with XIRR method.
37083   *
37084   * @param {number} principal - The loan principal amount
37085   * @param {number} duration - The loan duration in months
37086   * @param {number} monthlyPayment - The calculated monthly payment amount
37087   * @param {number} [lastPayment] - The optional bigger last payment amount
37088   * @param {number} [interestGuess] - An initial guess for the annual interest rate, better guess gives better results
37089   * @param {number} [initialPayment] - The amount that is paid off as handling fees
37090   *
37091   * @returns {number} - The approximated annual interest rate
37092   */
37093  kslAnnualInterest.prototype.calculate = function calculate(principal, duration, monthlyPayment) {
37094    var lastPayment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
37095    var interestGuess = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.059;
37096    var initialPayment = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 199;
37097
37098    this.principal = principal;
37099    this.duration = duration;
37100    this.interestGuess = interestGuess;
37101    this.lastPayment = lastPayment;
37102    this.monthlyPayment = monthlyPayment;
37103    this.initialPayment = initialPayment;
37104
37105    var payments = this.generatePayments();
37106
37107    var startDate = this.getStartDate(payments);
37108
37109    return _effectiveInterestRate2.default.withSpecifiedPayments(this.principal, startDate, payments, this.interestGuess);
37110  };
37111
37112  /**
37113   * Generates a payments object in the format required by effective-interest-rate module.
37114   *
37115   * @returns {object} - Payment dates and amounts as key-value pairs.
37116   */
37117
37118
37119  kslAnnualInterest.prototype.generatePayments = function generatePayments() {
37120    var payments = {
37121      '1999-12-01': this.initialPayment
37122    };
37123    for (var i = 0; i < this.duration; i++) {
37124      /**
37125       * TODO: Payment dates always start at 1999-12-01, which might
37126       * lead to some inaccuracy. Refactor this to use real dates, for extra accuracy.
37127       */
37128      var date = ['20', // century
37129      ('0' + Math.floor(i / 12)).substr(-2), // year
37130      '-', ('0' + (i % 12 + 1)).substr(-2), // month
37131      '-01'].join('');
37132
37133      /**
37134       * Assign the monthly payment amount, unless a bigger
37135       * last payment is specified, and it's the last iteration of the loop.
37136       */
37137      var paymentAmount = i < this.duration - 1 || this.lastPayment <= 0 ? this.monthlyPayment : this.lastPayment;
37138
37139      payments[date] = paymentAmount;
37140    }
37141
37142    return payments;
37143  };
37144
37145  /**
37146   * Find out the loan start date.
37147   * @param {object} payments - Payment dates and amounts as key-value pairs
37148   *
37149   * @return {string} - Loan start date in 'YYYY-MM-DD' format
37150   */
37151
37152
37153  kslAnnualInterest.prototype.getStartDate = function getStartDate(payments) {
37154    return (0, _keys2.default)(payments)[0];
37155  };
37156
37157  return kslAnnualInterest;
37158}();
37159
37160var KAI = new kslAnnualInterest();
37161
37162var FundingCalculator = {
37163  /**
37164   * Construct calculator
37165   * Sets fixed parameters needed for calculations.
37166   *
37167   * @param {Number} deliveryCosts - Sum in Euros
37168   * @param {Number} interest - Interest percentage
37169   * @param {Number} initialCost - Sum in Euros
37170   * @param {Number} monthlyHandlingCost - Sum in Euros
37171   */
37172  construct: function construct(deliveryCosts, interest, initialCost, monthlyHandlingCost) {
37173    // Validate
37174    if (isNaN(parseFloat(deliveryCosts)) || isNaN(parseFloat(interest)) || isNaN(parseFloat(initialCost)) || isNaN(parseFloat(monthlyHandlingCost))) {
37175      throw new Error('FundingCalculator: Incorrect initialization data.');
37176    }
37177
37178    // Käsittelykulut (€)
37179    this.deliveryCosts = parseFloat(deliveryCosts);
37180
37181    // Interest (%)
37182    this.interest = parseFloat(interest) / 100;
37183
37184    // Perustamismaksu (€)
37185    this.initialCost = parseFloat(initialCost);
37186
37187    // Käsittelykulut (€/month)
37188    this.monthlyHandlingCost = parseFloat(monthlyHandlingCost);
37189  },
37190
37191  /**
37192   * Validate customer parameters
37193   * @param {Object} params - Parameters for calculations
37194   * @param {float}  params.price - Price
37195   * @param {float}  params.deposit - Deposit
37196   * @param {float}  params.lastPayment - Amount of last installment
37197   * @param {int}    params.paymentMonths - Length of funding
37198   *
37199   * @returns {Object}
37200   */
37201  _validateParams: function _validateParams(params) {
37202    if ((typeof params === 'undefined' ? 'undefined' : (0, _typeof3.default)(params)) !== 'object' || params === null) {
37203      throw new Error('FundingCalculator: Missing calculation data.');
37204    }
37205
37206    // Don't allow missing `price` or `paymentMonths`
37207    if (typeof params.price === 'undefined' || typeof params.paymentMonths === 'undefined') {
37208      throw new Error('FundingCalculator: Missing calculation data.');
37209    }
37210
37211    // Defaults to `0`
37212    if (typeof params.deposit === 'undefined') {
37213      params.deposit = 0;
37214    }
37215
37216    // Defaults to `0`
37217    if (typeof params.lastPayment === 'undefined') {
37218      params.lastPayment = 0;
37219    }
37220
37221    // `deposit` cannot be bigger than final price used for calculations
37222    if (params.deposit > params.price + this.deliveryCosts) {
37223      params.deposit = Math.max(params.price, 0);
37224    }
37225
37226    // `lastPayment` cannot be bigger than `price` without `deposit`
37227    if (params.lastPayment > params.price - params.deposit) {
37228      params.lastPayment = Math.max(params.price - params.deposit, 0);
37229    }
37230
37231    // Don't allow negative values
37232    if (params.price <= 0 || params.paymentMonths <= 0 || params.deposit < 0 || params.lastPayment < 0) {
37233      throw new Error('FundingCalculator: Invalid calculation data.');
37234    }
37235
37236    return {
37237      price: parseFloat(params.price),
37238      paymentMonths: parseInt(params.paymentMonths),
37239      deposit: parseFloat(params.deposit),
37240      lastPayment: parseFloat(params.lastPayment)
37241    };
37242  },
37243
37244  /**
37245   * Calculates the periodic payment for an annuity investment based on constant-amount periodic payments and a constant interest rate.
37246   * @param {float} rate - Interest rate
37247   * @param {int} periods - Number of payments to be made
37248   * @param {float} present - Current value of annuity (elinkorko)
37249   * @param {float} future - Future value remaining after final payment has been made
37250   * @param {int} type - Whether payments are due at the end (0) or beginning (1) of each period
37251   *
37252   * @returns {float} Periodic payment
37253   */
37254  _PMT: function _PMT(rate, periods, present, future, type) {
37255    type = typeof type === 'undefined' ? 0 : type;
37256    if (rate === 0) {
37257      return 0 - (present + future) / periods;
37258    }
37259    var term = Math.pow(1 + rate, periods);
37260    return 0 - (type === 1 ? (future * rate / (term - 1) + present * rate / (1 - 1 / term)) / (1 + rate) : future * rate / (term - 1) + present * rate / (1 - 1 / term));
37261  },
37262
37263  /**
37264   * Calculates the present value of an annuity investment based on constant-amount periodic payments and a constant interest rate.
37265   * @param {float} rate - Interest rate
37266   * @param {int} periods - Number of payments to be made
37267   * @param {float} payment - Payment amount per period
37268   * @param {float} future - Future value remaining after the final payment has been made
37269   * @param {int} type - Whether payments are due at the end (0) or beginning (1) of each period
37270   *
37271   * @returns {float}
37272   */
37273  _PV: function _PV(rate, periods, payment, future, type) {
37274    type = typeof type === 'undefined' ? 0 : type;
37275    if (rate === 0) {
37276      return -payment * periods - future;
37277    } else {
37278      return ((1 - Math.pow(1 + rate, periods)) / rate * payment * (1 + rate * type) - future) / Math.pow(1 + rate, periods);
37279    }
37280  },
37281
37282
37283  /**
37284   * Calculates the annual effective interest rate given the nominal rate and number of compounding periods per year
37285   * @param {float} rate - Interest rate
37286   * @param {int} period - Number of compunding periods per year
37287   *
37288   * @return {float}
37289   */
37290  _EFFECT: function _EFFECT(rate, period) {
37291    return Math.pow(rate / period + 1, period) - 1;
37292  },
37293
37294
37295  /**
37296   * Calculates the residual payment amount (jäännösarvo)
37297   * @param {float} interest - Interest rate
37298   * @param {float} lastPayment - Amount of last payment
37299   *
37300   * @returns {float}
37301   */
37302  _residualPayment: function _residualPayment(interest, lastPayment) {
37303    return 0 - this._PV(interest / 12, 1, lastPayment, 0);
37304  },
37305
37306  /**
37307   * Calculates the monthly payment amount (kuukausierä)
37308   * @param {float} loanAmount - Principal amount (Pääoma)
37309   * @param {float} interest - Interest rate
37310   * @param {int} periods - Number of payments to be made (sopimusaika)
37311   * @param {float} lastPayment - Amount of last payment (Viimeinen isompi erä)
37312   *
37313   * @returns {float}
37314   */
37315  _monthlyPaymentAmount: function _monthlyPaymentAmount(loanAmount, interest, periods, lastPayment) {
37316    return this._PMT(interest / 12, periods - (lastPayment > 0 ? 1 : 0), -loanAmount, this._residualPayment(interest, lastPayment));
37317  },
37318
37319  /**
37320   * Calculates the monthly payment amount with processing fees
37321   * @param {float} monthlyPayment - Monthly payment amount
37322   * @param {float} handlingCost - Monthly handling cost (9€)
37323   *
37324   * @returns {float}
37325   */
37326  _processingFee: function _processingFee(monthlyPayment, handlingCost) {
37327    return monthlyPayment + handlingCost;
37328  },
37329
37330  /**
37331   * Calculates the real loan expenses
37332   * @param {float} monthlyHandlingCost - Recurring handling fees (Käsittelymaksu)
37333   * @param {int} periods - Number of payments to be made (Sopimusaika)
37334   * @param {float} lastPayment - Amount of last payment (Viimeinen isompi erä)
37335   * @param {float} monthlyPayment - Monthly payment amount (Kuukausierä)
37336   *
37337   * @returns {float}
37338   */
37339  _creditPrice: function _creditPrice(monthlyHandlingCost, periods, lastPayment, monthlyPayment) {
37340    return monthlyHandlingCost * periods + monthlyPayment * (periods - (lastPayment > 0 ? 1 : 0)) + lastPayment;
37341  },
37342
37343  /**
37344   * Calculates the monthly payment amount, financed amount, real loan expenses, real loan price and real yearly interest
37345   * Caveats: Real yearly interest is an approximation
37346   * @param {object} params - Customer parameters
37347   *
37348   * @return {object}
37349   */
37350  calculate: function calculate(params) {
37351    try {
37352      params = this._validateParams(params);
37353    } catch (e) {
37354      return false;
37355    }
37356
37357    // Hinta p.l. käsiraha
37358    var loanAmount = params.price - params.deposit;
37359
37360    // Rahoitettava osuus
37361    var financedAmount = params.price + this.initialCost - params.deposit;
37362
37363    // Kuukausierä
37364    var monthlyPaymentAmount = this._monthlyPaymentAmount(financedAmount, this.interest, params.paymentMonths, params.lastPayment);
37365
37366    // KSL:n mukainen vuosikorko % yksinkertaisella kaavalla
37367    // @link https://kulutusluottovertailu.fi/todellinen-vuosikorko/
37368    var interestGuess = this._EFFECT(this.interest, 12) + this.monthlyHandlingCost * 12 / (loanAmount / 2) + this.initialCost / loanAmount;
37369
37370    var KSLInterest = KAI.calculate(financedAmount, params.paymentMonths, monthlyPaymentAmount + this.monthlyHandlingCost, params.lastPayment, interestGuess, this.initialCost);
37371
37372    // KSL:n mukainen luottohinta
37373    var creditPrice = this._creditPrice(this.monthlyHandlingCost, params.paymentMonths, params.lastPayment, monthlyPaymentAmount);
37374
37375    // KSL:n mukaiset luottokustannukset
37376    var loanExpenses = creditPrice - financedAmount;
37377
37378    var totalLoanCost = creditPrice - params.deposit;
37379
37380    return {
37381      creditPrice: creditPrice,
37382      deposit: params.deposit,
37383      financedAmount: financedAmount,
37384      lastPayment: params.lastPayment,
37385      loanExpenses: loanExpenses,
37386      monthlyTranche: monthlyPaymentAmount + this.monthlyHandlingCost,
37387      paymentMonths: params.paymentMonths,
37388      realYearlyInterest: KSLInterest * 100,
37389      totalLoanCost: totalLoanCost
37390    };
37391  }
37392};
37393
37394module.exports = FundingCalculator;
37395
37396},{"babel-runtime/core-js/object/keys":7,"babel-runtime/helpers/classCallCheck":13,"babel-runtime/helpers/typeof":15,"effective-interest-rate":122}],134:[function(require,module,exports){
37397(function (global){
37398'use strict';
37399
37400//Cookies in json form
37401$.cookie.json = true;
37402
37403var $menuSections = $('.menu-sections'),
37404    windowWidth = parseInt($(window).width()),
37405    windowHeight = parseInt($(window).height()),
37406    mobileBreakpoint = 460,
37407    userFilters = $('body').hasClass('car-search') ? 'car' : 'tyre',
37408    currentFilters,
37409    availableFilters,
37410    lazyloadPosition = 0,
37411    resultsCount = 0,
37412    showClosestLocation = true,
37413    locationSuccessful = false,
37414    userLat = '',
37415    userLon = '';
37416
37417// If resize, change windowHeight, Width
37418document.addEventListener('resize', function () {
37419    windowWidth = parseInt($(window).width());
37420    windowHeight = parseInt($(window).height());
37421});
37422
37423if ($('body').hasClass('car-search')) {
37424    var searchPage = 'car';
37425} else if ($('body').hasClass('tyre-search')) {
37426    var searchPage = 'tyre';
37427} else {
37428    var searchPage = false;
37429}
37430
37431//Navigation element variables
37432var $menuSectionParent = $('nav .menu-sections'),
37433    $sectionSelectionItem = $('nav ul.sections li'),
37434    $navigations = $('.navigations'),
37435    $mainNavItem = $('.navigation-main-level li'),
37436    $subNavItem = $('.navigation-sub-level li');
37437
37438$(document).ready(function () {
37439
37440    /*if(document.location.search == '?referrer=autoilves'){
37441        window.history.pushState(null, null, "/" );
37442    }*/
37443
37444    //Autoilves popup
37445    $('.autoilves-popup-container, .autoilves-popup').click(function (e) {
37446        if (e.target != this) return;
37447        $('.autoilves-popup-container').fadeOut(200, function () {
37448            $(this).remove();
37449        });
37450    });
37451
37452    $('.autoilves-popup-container').find('.close').click(function () {
37453        $(this).parents('.autoilves-popup-container').fadeOut(200, function () {
37454            $(this).remove();
37455        });
37456    });
37457
37458    //Cookie notification
37459    var browserCache = localStorage.getItem('browser');
37460
37461    function createCookie(name, value, days) {
37462        "use strict";
37463
37464        var expires = '';
37465        if (days) {
37466            var date = new Date();
37467            date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
37468            expires = "; expires=" + date.toGMTString();
37469        } else {
37470            expires = "";
37471        }
37472        document.cookie = name + "=" + value + expires + "; path=/";
37473    }
37474
37475    function readCookie(name) {
37476        "use strict";
37477
37478        var nameEQ = name + "=";
37479        var ca = document.cookie.split(';');
37480        for (var i = 0; i < ca.length; i++) {
37481            var c = ca[i];
37482            while (c.charAt(0) == ' ') {
37483                c = c.substring(1, c.length);
37484            }if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
37485        }
37486        return null;
37487    }
37488
37489    if ((!browserCache || readCookie('browserN') == 'null') && $.browser != 'undefined') {
37490        var bv_old = false;
37491        var dl_browser = '';
37492        var bv_undefined = false;
37493        var bv = $.browser.version;
37494        var bv_rounded = bv.substring(0, bv.indexOf('.'));
37495        if ($.browser.chrome == true) {
37496            bv_old = bv_rounded < 30 ? true : false;dl_browser = 'https://www.google.com/chrome';
37497        } else if ($.browser.msie == true && navigator.userAgent.match(/iemobile/i) != null) {
37498            bv_old = bv_rounded <= 10 ? true : false;dl_browser = 'http://windows.microsoft.com/fi-fi/internet-explorer/download-ie';
37499        } else if ($.browser.msie == true && navigator.userAgent.match(/iemobile/i) == null) {
37500            bv_old = bv_rounded < 10 ? true : false;dl_browser = 'http://windows.microsoft.com/fi-fi/internet-explorer/download-ie';
37501        } else if ($.browser.mozilla == true && navigator.userAgent.indexOf('Trident') != -1) {
37502            bv_old = bv_rounded < 10 ? true : false;dl_browser = 'http://windows.microsoft.com/fi-fi/internet-explorer/download-ie';
37503        } else if ($.browser.mozilla == true && navigator.userAgent.indexOf('Trident') == -1 && navigator.userAgent.indexOf('Edge') == -1) {
37504            bv_old = bv_rounded < 30 ? true : false;dl_browser = 'https://www.mozilla.org/fi/firefox/new/';
37505        } else if ($.browser.opera == true) {
37506            bv_old = bv_rounded < 30 ? true : false;dl_browser = 'http://www.opera.com/fi';
37507        } else if ($.browser.safari == true) {
37508            bv_old = bv_rounded < 537 || bv_rounded.length == 4 ? true : false;dl_browser = 'http://www.apple.com/support/mac-apps/safari/';
37509        } // Safari 6.1 ->
37510        else {
37511                bv_undefined = true;dl_browser = 'https://www.google.com/chrome';
37512            }
37513
37514        var browser_text = !bv_undefined ? 'Lataa uusin versio selaimestasi <a href="' + dl_browser + '" target="_blank">täältä</a>.' : 'Lataa Google Chromen uusin versio <a href="' + dl_browser + '">täältä</a>.';
37515        if (bv_old == true || bv_undefined == true) {
37516            $('#notification-container').prepend('<div class="browser-info">Selaimesi on vanhentunut tai sitä ei välttämättä tueta, joten kaikki sivun toiminnot eivät mahdollisesti toimi toivotulla tavalla. ' + browser_text + '<span class="close">Sulje</span></div>');
37517        }
37518    }
37519    $('.browser-info span').click(function () {
37520        var $self = $(this);
37521        $self.parent().fadeOut(400, function () {
37522            $self.remove();
37523        });
37524        setTimeout(function () {
37525            $self.parent().remove();
37526        }, 400);
37527        localStorage.setItem('browser', 'browserNotification');
37528        createCookie('browserN', 'browserNotification', 7);
37529    });
37530
37531    if ("geolocation" in navigator) {
37532        var geoFindMe = function geoFindMe() {
37533            function distance(lon1, lat1, lon2, lat2) {
37534                var R = 6371; // Radius of the earth in km
37535                var dLat = (lat2 - lat1).toRad(); // Javascript functions in radians
37536                var dLon = (lon2 - lon1).toRad();
37537                var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
37538                var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
37539                var d = R * c; // Distance in km
37540                return Math.round(d);
37541            }
37542            if (typeof Number.prototype.toRad === "undefined") {
37543                Number.prototype.toRad = function () {
37544                    return this * Math.PI / 180;
37545                };
37546            }
37547
37548            var kouvola = { lon: parseFloat($('.store.kouvola').data('lon')), lat: parseFloat($('.store.kouvola').data('lat')), hasBrandService: $('.store.kouvola').hasClass('brand') };
37549            var kerava = { lon: parseFloat($('.store.kerava').data('lon')), lat: parseFloat($('.store.kerava').data('lat')), hasBrandService: $('.store.kerava').hasClass('brand') };
37550            var kotka = { lon: parseFloat($('.store.kotka').data('lon')), lat: parseFloat($('.store.kotka').data('lat')), hasBrandService: $('.store.kotka').hasClass('brand') };
37551            var porvoo = { lon: parseFloat($('.store.porvoo').data('lon')), lat: parseFloat($('.store.porvoo').data('lat')), hasBrandService: $('.store.porvoo').hasClass('brand') };
37552            var lahti = { lon: parseFloat($('.store.lahti').data('lon')), lat: parseFloat($('.store.lahti').data('lat')), hasBrandService: $('.store.lahti').hasClass('brand') };
37553            var tampere = { lon: parseFloat($('.store.tampere').data('lon')), lat: parseFloat($('.store.tampere').data('lat')), hasBrandService: $('.store.tampere').hasClass('brand') };
37554            var hameenlinna = { lon: parseFloat($('.store.hameenlinna').data('lon')), lat: parseFloat($('.store.hameenlinna').data('lat')), hasBrandService: $('.store.hameenlinna').hasClass('brand') };
37555            var hyvinkaa = { lon: parseFloat($('.store.hyvinkaa').data('lon')), lat: parseFloat($('.store.hyvinkaa').data('lat')), hasBrandService: $('.store.hyvinkaa').hasClass('brand') };
37556            var hameenlinna_visamaki = { lon: parseFloat($('.store.hameenlinna-visamaki').data('lon')), lat: parseFloat($('.store.hameenlinna-visamaki').data('lat')), hasBrandService: $('.store.hameenlinna-visamaki').hasClass('brand') };
37557            var hamina = { lon: parseFloat($('.store.hamina').data('lon')), lat: parseFloat($('.store.hamina').data('lat')), hasBrandService: $('.store.hamina').hasClass('brand') };
37558
37559            function success(position) {
37560                locationSuccessful = true;
37561
37562                if (!$.cookie('userPositionLat') && !$.cookie('userPositionLon')) {
37563                    var lat = position.coords.latitude;
37564                    var lon = position.coords.longitude;
37565                    $.cookie('userPositionLat', position.coords.latitude);
37566                    $.cookie('userPositionLon', position.coords.longitude);
37567                } else {
37568                    var lat = parseFloat($.cookie('userPositionLat'));
37569                    var lon = parseFloat($.cookie('userPositionLon'));
37570                }
37571
37572                userLat = lat;
37573                userLon = lon;
37574
37575                var dist_kouvola = distance(lon, lat, kouvola.lon, kouvola.lat),
37576                    dist_kerava = distance(lon, lat, kerava.lon, kerava.lat),
37577                    dist_kotka = distance(lon, lat, kotka.lon, kotka.lat),
37578                    dist_porvoo = distance(lon, lat, porvoo.lon, porvoo.lat),
37579                    dist_lahti = distance(lon, lat, lahti.lon, lahti.lat),
37580                    dist_tampere = distance(lon, lat, tampere.lon, tampere.lat),
37581                    dist_hameenlinna = distance(lon, lat, hameenlinna.lon, hameenlinna.lat),
37582                    dist_hyvinkaa = distance(lon, lat, hyvinkaa.lon, hyvinkaa.lat),
37583                    dist_hameenlinna_visamaki = distance(lon, lat, hameenlinna_visamaki.lon, hameenlinna_visamaki.lat),
37584                    dist_hamina = distance(lon, lat, hamina.lon, hamina.lat),
37585                    closest = Math.min(dist_kouvola, dist_kerava, dist_kotka, dist_porvoo, dist_lahti, dist_tampere, dist_hameenlinna, dist_hyvinkaa, dist_hameenlinna_visamaki, dist_hamina);
37586
37587                // If there are brand services defined show closest brand service
37588                var brandServiceFound = $(".store.brand").length > 0;
37589                if (brandServiceFound) {
37590                    var brandServiceDists = [];
37591                    if (kouvola.hasBrandService) {
37592                        brandServiceDists.push(dist_kouvola);
37593                    }
37594                    if (kerava.hasBrandService) {
37595                        brandServiceDists.push(dist_kerava);
37596                    }
37597                    if (kotka.hasBrandService) {
37598                        brandServiceDists.push(dist_kotka);
37599                    }
37600                    if (porvoo.hasBrandService) {
37601                        brandServiceDists.push(dist_porvoo);
37602                    }
37603                    if (lahti.hasBrandService) {
37604                        brandServiceDists.push(dist_lahti);
37605                    }
37606                    if (tampere.hasBrandService) {
37607                        brandServiceDists.push(dist_tampere);
37608                    }
37609                    if (hameenlinna.hasBrandService) {
37610                        brandServiceDists.push(dist_hameenlinna);
37611                    }
37612                    if (hyvinkaa.hasBrandService) {
37613                        brandServiceDists.push(dist_hyvinkaa);
37614                    }
37615                    if (hameenlinna_visamaki.hasBrandService) {
37616                        brandServiceDists.push(dist_hameenlinna_visamaki);
37617                    }
37618                    if (hamina.hasBrandService) {
37619                        brandServiceDists.push(dist_hamina);
37620                    }
37621                    closest = Math.min.apply(Math, brandServiceDists);
37622                }
37623
37624                /*console.log('my_coords: '+'lon('+lon+'), lat('+lat+')');
37625                console.log('kouvola: '+dist_kouvola+' km');
37626                console.log('kotka: '+dist_kotka+' km');
37627                console.log('porvoo: '+dist_porvoo+' km');
37628                console.log('kerava: '+dist_kerava+' km');
37629                console.log('lahti: '+dist_lahti+' km');
37630                console.log('tampere: '+dist_tampere+' km');*/
37631
37632                $('.store').find('.loading').remove();
37633                $('.store.loading-closest').remove();
37634                $('p.distance').show();
37635                var locations = {
37636                    kouvola: dist_kouvola,
37637                    kerava: dist_kerava,
37638                    kotka: dist_kotka,
37639                    porvoo: dist_porvoo,
37640                    lahti: dist_lahti,
37641                    tampere: dist_tampere,
37642                    hameenlinna: dist_hameenlinna,
37643                    hyvinkaa: dist_hyvinkaa,
37644                    'hameenlinna-visamaki': dist_hameenlinna_visamaki,
37645                    hamina: dist_hamina
37646                };
37647                $.each(locations, function (i, val) {
37648                    if (showClosestLocation == true) {
37649                        if (val == closest) {
37650                            $('.store.' + i).css('opacity', '1').addClass('active');
37651
37652                            var storeName = $('.store.' + i + ' .store-name').text();
37653
37654                            if (storeName) {
37655                                window.visitorLocation = storeName;
37656                            }
37657                        } else {
37658                            $('.store.' + i).css('opacity', '0').removeClass('active');
37659                        }
37660                    }
37661                    $('.store.' + i).children('p.distance').text(val + ' km');
37662                    $('.store.' + i).children('p.distance').attr('data-dist', val);
37663                });
37664            };
37665
37666            function error() {
37667                // Fail
37668                $('.store').find('.loading').remove();
37669
37670                $('.loading-closest').html('<strong>Sijaintiasi ei voitu paikantaa.</strong>');
37671                setTimeout(function () {
37672                    $('.loading-closest').fadeOut('slow', function () {
37673                        $(this).remove();
37674                        $('.service-locations').each(function () {
37675                            $(this).children('.store').first().css('opacity', 1).addClass('active');
37676                        });
37677                    });
37678                    $('p.distance').hide();
37679                }, 2000);
37680            };
37681
37682            $('.store').children('p.distance').html('<div class="loading"></div>');
37683            $('.service-locations').append('<div class="store active loading-closest" style="opacity:1;"><div class="loading"></div><strong>Haetaan lähintä toimipistettä...</strong></div>');
37684            setTimeout(function () {
37685                if (locationSuccessful == false) {
37686                    $('.loading-closest').html('<strong>Sijaintiasi ei voitu paikantaa.</strong>');
37687                    setTimeout(function () {
37688                        if (locationSuccessful == false) {
37689                            $('.loading-closest').fadeOut('slow', function () {
37690                                $(this).remove();
37691                                $('.service-locations').each(function () {
37692                                    $(this).children('.store').first().css('opacity', 1).addClass('active');
37693                                });
37694                            });
37695                            $('p.distance').hide();
37696                        }
37697                    }, 2000);
37698                }
37699            }, 2000);
37700
37701            if (!$.cookie('userPositionLat') && !$.cookie('userPositionLon')) {
37702                navigator.geolocation.getCurrentPosition(success, error);
37703            } else {
37704                success();
37705            }
37706        };
37707
37708        geoFindMe();
37709    } else {
37710        /* geolocation IS NOT available */
37711    }
37712
37713    if ($('.noNav').length) {
37714        $('.navigations').removeClass('sub');
37715    }
37716});
37717global.$menuSections = $menuSections;
37718global.windowWidth = windowWidth;
37719global.windowHeight = windowHeight;
37720global.mobileBreakpoint = mobileBreakpoint;
37721global.userFilters = userFilters;
37722global.currentFilters = currentFilters;
37723global.availableFilters = availableFilters;
37724global.lazyloadPosition = lazyloadPosition;
37725global.resultsCount = resultsCount;
37726global.showClosestLocation = showClosestLocation;
37727global.locationSuccessful = locationSuccessful;
37728global.userLat = userLat;
37729global.userLon = userLon;
37730global.$menuSectionParent = $menuSectionParent;
37731global.$sectionSelectionItem = $sectionSelectionItem;
37732global.$navigations = $navigations;
37733global.$mainNavItem = $mainNavItem;
37734global.$subNavItem = $subNavItem;
37735global.searchPage = searchPage;
37736
37737}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
37738
37739},{}],135:[function(require,module,exports){
37740"use strict";
37741
37742var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
37743
37744var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
37745
37746var _defineProperty = require("babel-runtime/core-js/object/define-property");
37747
37748var _defineProperty2 = _interopRequireDefault(_defineProperty);
37749
37750var _stringify = require("babel-runtime/core-js/json/stringify");
37751
37752var _stringify2 = _interopRequireDefault(_stringify);
37753
37754var _defineProperties = require("babel-runtime/core-js/object/define-properties");
37755
37756var _defineProperties2 = _interopRequireDefault(_defineProperties);
37757
37758var _typeof2 = require("babel-runtime/helpers/typeof");
37759
37760var _typeof3 = _interopRequireDefault(_typeof2);
37761
37762function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37763
37764/* =============================================================
37765    ios-orientation-change-fix.js v1.0.0
37766    Fixes zoom on rotation bug in iOS.
37767    Script by @scottjehl, rebound by @wilto
37768    https://github.com/scottjehl/iOS-Orientationchange-Fix
37769    MIT / GPLv2 License
37770 * ============================================================= */
37771
37772(function (w) {
37773
37774	// This fix addresses an iOS bug, so return early if the UA claims it's something else.
37775	var ua = navigator.userAgent;
37776	if (!(/iPhone|iPad|iPod/.test(navigator.platform) && /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) && ua.indexOf("AppleWebKit") > -1)) {
37777		return;
37778	}
37779
37780	var doc = w.document;
37781
37782	if (!doc.querySelector) {
37783		return;
37784	}
37785
37786	var meta = doc.querySelector("meta[name=viewport]"),
37787	    initialContent = meta && meta.getAttribute("content"),
37788	    disabledZoom = initialContent + ",maximum-scale=1",
37789	    enabledZoom = initialContent + ",maximum-scale=10",
37790	    enabled = true,
37791	    x,
37792	    y,
37793	    z,
37794	    aig;
37795
37796	if (!meta) {
37797		return;
37798	}
37799
37800	function restoreZoom() {
37801		meta.setAttribute("content", enabledZoom);
37802		enabled = true;
37803	}
37804
37805	function disableZoom() {
37806		meta.setAttribute("content", disabledZoom);
37807		enabled = false;
37808	}
37809
37810	function checkTilt(e) {
37811		aig = e.accelerationIncludingGravity;
37812		x = Math.abs(aig.x);
37813		y = Math.abs(aig.y);
37814		z = Math.abs(aig.z);
37815
37816		// If portrait orientation and in one of the danger zones
37817		if ((!w.orientation || w.orientation === 180) && (x > 7 || (z > 6 && y < 8 || z < 8 && y > 6) && x > 5)) {
37818			if (enabled) {
37819				disableZoom();
37820			}
37821		} else if (!enabled) {
37822			restoreZoom();
37823		}
37824	}
37825
37826	w.addEventListener("orientationchange", restoreZoom, false);
37827	w.addEventListener("devicemotion", checkTilt, false);
37828})(undefined);
37829
37830/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
37831!function (a, b) {
37832	"object" == (typeof module === "undefined" ? "undefined" : (0, _typeof3.default)(module)) && "object" == (0, _typeof3.default)(module.exports) ? module.exports = a.document ? b(a, !0) : function (a) {
37833		if (!a.document) throw new Error("jQuery requires a window with a document");return b(a);
37834	} : b(a);
37835}("undefined" != typeof window ? window : undefined, function (a, b) {
37836	var c = [],
37837	    d = c.slice,
37838	    e = c.concat,
37839	    f = c.push,
37840	    g = c.indexOf,
37841	    h = {},
37842	    i = h.toString,
37843	    j = h.hasOwnProperty,
37844	    k = {},
37845	    l = a.document,
37846	    m = "2.1.4",
37847	    n = function n(a, b) {
37848		return new n.fn.init(a, b);
37849	},
37850	    o = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
37851	    p = /^-ms-/,
37852	    q = /-([\da-z])/gi,
37853	    r = function r(a, b) {
37854		return b.toUpperCase();
37855	};n.fn = n.prototype = { jquery: m, constructor: n, selector: "", length: 0, toArray: function toArray() {
37856			return d.call(this);
37857		}, get: function get(a) {
37858			return null != a ? 0 > a ? this[a + this.length] : this[a] : d.call(this);
37859		}, pushStack: function pushStack(a) {
37860			var b = n.merge(this.constructor(), a);return b.prevObject = this, b.context = this.context, b;
37861		}, each: function each(a, b) {
37862			return n.each(this, a, b);
37863		}, map: function map(a) {
37864			return this.pushStack(n.map(this, function (b, c) {
37865				return a.call(b, c, b);
37866			}));
37867		}, slice: function slice() {
37868			return this.pushStack(d.apply(this, arguments));
37869		}, first: function first() {
37870			return this.eq(0);
37871		}, last: function last() {
37872			return this.eq(-1);
37873		}, eq: function eq(a) {
37874			var b = this.length,
37875			    c = +a + (0 > a ? b : 0);return this.pushStack(c >= 0 && b > c ? [this[c]] : []);
37876		}, end: function end() {
37877			return this.prevObject || this.constructor(null);
37878		}, push: f, sort: c.sort, splice: c.splice }, n.extend = n.fn.extend = function () {
37879		var a,
37880		    b,
37881		    c,
37882		    d,
37883		    e,
37884		    f,
37885		    g = arguments[0] || {},
37886		    h = 1,
37887		    i = arguments.length,
37888		    j = !1;for ("boolean" == typeof g && (j = g, g = arguments[h] || {}, h++), "object" == (typeof g === "undefined" ? "undefined" : (0, _typeof3.default)(g)) || n.isFunction(g) || (g = {}), h === i && (g = this, h--); i > h; h++) {
37889			if (null != (a = arguments[h])) for (b in a) {
37890				c = g[b], d = a[b], g !== d && (j && d && (n.isPlainObject(d) || (e = n.isArray(d))) ? (e ? (e = !1, f = c && n.isArray(c) ? c : []) : f = c && n.isPlainObject(c) ? c : {}, g[b] = n.extend(j, f, d)) : void 0 !== d && (g[b] = d));
37891			}
37892		}return g;
37893	}, n.extend({ expando: "jQuery" + (m + Math.random()).replace(/\D/g, ""), isReady: !0, error: function error(a) {
37894			throw new Error(a);
37895		}, noop: function noop() {}, isFunction: function isFunction(a) {
37896			return "function" === n.type(a);
37897		}, isArray: Array.isArray, isWindow: function isWindow(a) {
37898			return null != a && a === a.window;
37899		}, isNumeric: function isNumeric(a) {
37900			return !n.isArray(a) && a - parseFloat(a) + 1 >= 0;
37901		}, isPlainObject: function isPlainObject(a) {
37902			return "object" !== n.type(a) || a.nodeType || n.isWindow(a) ? !1 : a.constructor && !j.call(a.constructor.prototype, "isPrototypeOf") ? !1 : !0;
37903		}, isEmptyObject: function isEmptyObject(a) {
37904			var b;for (b in a) {
37905				return !1;
37906			}return !0;
37907		}, type: function type(a) {
37908			return null == a ? a + "" : "object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) || "function" == typeof a ? h[i.call(a)] || "object" : typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a);
37909		}, globalEval: function globalEval(a) {
37910			var b,
37911			    c = eval;a = n.trim(a), a && (1 === a.indexOf("use strict") ? (b = l.createElement("script"), b.text = a, l.head.appendChild(b).parentNode.removeChild(b)) : c(a));
37912		}
37912, camelCase: function camelCase(a) {
37913			return a.replace(p, "ms-").replace(q, r);
37914		}, nodeName: function nodeName(a, b) {
37915			return a.nodeName && a.nodeName.toLowerCase() === b.toLowerCase();
37916		}, each: function each(a, b, c) {
37917			var d,
37918			    e = 0,
37919			    f = a.length,
37920			    g = s(a);if (c) {
37921				if (g) {
37922					for (; f > e; e++) {
37923						if (d = b.apply(a[e], c), d === !1) break;
37924					}
37925				} else for (e in a) {
37926					if (d = b.apply(a[e], c), d === !1) break;
37927				}
37928			} else if (g) {
37929				for (; f > e; e++) {
37930					if (d = b.call(a[e], e, a[e]), d === !1) break;
37931				}
37932			} else for (e in a) {
37933				if (d = b.call(a[e], e, a[e]), d === !1) break;
37934			}return a;
37935		}, trim: function trim(a) {
37936			return null == a ? "" : (a + "").replace(o, "");
37937		}, makeArray: function makeArray(a, b) {
37938			var c = b || [];return null != a && (s(Object(a)) ? n.merge(c, "string" == typeof a ? [a] : a) : f.call(c, a)), c;
37939		}, inArray: function inArray(a, b, c) {
37940			return null == b ? -1 : g.call(b, a, c);
37941		}, merge: function merge(a, b) {
37942			for (var c = +b.length, d = 0, e = a.length; c > d; d++) {
37943				a[e++] = b[d];
37944			}return a.length = e, a;
37945		}, grep: function grep(a, b, c) {
37946			for (var d, e = [], f = 0, g = a.length, h = !c; g > f; f++) {
37947				d = !b(a[f], f), d !== h && e.push(a[f]);
37948			}return e;
37949		}, map: function map(a, b, c) {
37950			var d,
37951			    f = 0,
37952			    g = a.length,
37953			    h = s(a),
37954			    i = [];if (h) for (; g > f; f++) {
37955				d = b(a[f], f, c), null != d && i.push(d);
37956			} else for (f in a) {
37957				d = b(a[f], f, c), null != d && i.push(d);
37958			}return e.apply([], i);
37959		}, guid: 1, proxy: function proxy(a, b) {
37960			var c, e, f;return "string" == typeof b && (c = a[b], b = a, a = c), n.isFunction(a) ? (e = d.call(arguments, 2), f = function f() {
37961				return a.apply(b || this, e.concat(d.call(arguments)));
37962			}, f.guid = a.guid = a.guid || n.guid++, f) : void 0;
37963		}, now: Date.now, support: k }), n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (a, b) {
37964		h["[object " + b + "]"] = b.toLowerCase();
37965	});function s(a) {
37966		var b = "length" in a && a.length,
37967		    c = n.type(a);return "function" === c || n.isWindow(a) ? !1 : 1 === a.nodeType && b ? !0 : "array" === c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a;
37968	}var t = function (a) {
37969		var b,
37970		    c,
37971		    d,
37972		    e,
37973		    f,
37974		    g,
37975		    h,
37976		    i,
37977		    j,
37978		    k,
37979		    l,
37980		    m,
37981		    n,
37982		    o,
37983		    p,
37984		    q,
37985		    r,
37986		    s,
37987		    t,
37988		    u = "sizzle" + 1 * new Date(),
37989		    v = a.document,
37990		    w = 0,
37991		    x = 0,
37992		    y = ha(),
37993		    z = ha(),
37994		    A = ha(),
37995		    B = function B(a, b) {
37996			return a === b && (l = !0), 0;
37997		},
37998		    C = 1 << 31,
37999		    D = {}.hasOwnProperty,
38000		    E = [],
38001		    F = E.pop,
38002		    G = E.push,
38003		    H = E.push,
38004		    I = E.slice,
38005		    J = function J(a, b) {
38006			for (var c = 0, d = a.length; d > c; c++) {
38007				if (a[c] === b) return c;
38008			}return -1;
38009		},
38010		    K = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
38011		    L = "[\\x20\\t\\r\\n\\f]",
38012		    M = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
38013		    N = M.replace("w", "w#"),
38014		    O = "\\[" + L + "*(" + M + ")(?:" + L + "*([*^$|!~]?=)" + L + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + N + "))|)" + L + "*\\]",
38015		    P = ":(" + M + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + O + ")*)|.*)\\)|)",
38016		    Q = new RegExp(L + "+", "g"),
38017		    R = new RegExp("^" + L + "+|((?:^|[^\\\\])(?:\\\\.)*)" + L + "+$", "g"),
38018		    S = new RegExp("^" + L + "*," + L + "*"),
38019		    T = new RegExp("^" + L + "*([>+~]|" + L + ")" + L + "*"),
38020		    U = new RegExp("=" + L + "*([^\\]'\"]*?)" + L + "*\\]", "g"),
38021		    V = new RegExp(P),
38022		    W = new RegExp("^" + N + "$"),
38023		    X = { ID: new RegExp("^#(" + M + ")"), CLASS: new RegExp("^\\.(" + M + ")"), TAG: new RegExp("^(" + M.replace("w", "w*") + ")"), ATTR: new RegExp("^" + O), PSEUDO: new RegExp("^" + P), CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + L + "*(even|odd|(([+-]|)(\\d*)n|)" + L + "*(?:([+-]|)" + L + "*(\\d+)|))" + L + "*\\)|)", "i"), bool: new RegExp("^(?:" + K + ")$", "i"), needsContext: new RegExp("^" + L + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + L + "*((?:-\\d)?\\d*)" + L + "*\\)|)(?=[^-]|$)", "i") },
38024		    Y = /^(?:input|select|textarea|button)$/i,
38025		    Z = /^h\d$/i,
38026		    $ = /^[^{]+\{\s*\[native \w/,
38027		    _ = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
38028		    aa = /[+~]/,
38029		    ba = /'|\\/g,
38030		    ca = new RegExp("\\\\([\\da-f]{1,6}" + L + "?|(" + L + ")|.)", "ig"),
38031		    da = function da(a, b, c) {
38032			var d = "0x" + b - 65536;return d !== d || c ? b : 0 > d ? String.fromCharCode(d + 65536) : String.fromCharCode(d >> 10 | 55296, 1023 & d | 56320);
38033		},
38034		    ea = function ea() {
38035			m();
38036		};try {
38037			H.apply(E = I.call(v.childNodes), v.childNodes), E[v.childNodes.length].nodeType;
38038		} catch (fa) {
38039			H = { apply: E.length ? function (a, b) {
38040					G.apply(a, I.call(b));
38041				} : function (a, b) {
38042					var c = a.length,
38043					    d = 0;while (a[c++] = b[d++]) {}a.length = c - 1;
38044				} };
38045		}function ga(a, b, d, e) {
38046			var f, h, j, k, l, o, r, s, w, x;if ((b ? b.ownerDocument || b : v) !== n && m(b), b = b || n, d = d || [], k = b.nodeType, "string" != typeof a || !a || 1 !== k && 9 !== k && 11 !== k) return d;if (!e && p) {
38047				if (11 !== k && (f = _.exec(a))) if (j = f[1]) {
38048					if (9 === k) {
38049						if (h = b.getElementById(j), !h || !h.parentNode) return d;if (h.id === j) return d.push(h), d;
38050					} else if (b.ownerDocument && (h = b.ownerDocument.getElementById(j)) && t(b, h) && h.id === j) return d.push(h), d;
38051				} else {
38052					if (f[2]) return H.apply(d, b.getElementsByTagName(a)), d;if ((j = f[3]) && c.getElementsByClassName) return H.apply(d, b.getElementsByClassName(j)), d;
38053				}if (c.qsa && (!q || !q.test(a))) {
38054					if (s = r = u, w = b, x = 1 !== k && a, 1 === k && "object" !== b.nodeName.toLowerCase()) {
38055						o = g(a), (r = b.getAttribute("id")) ? s = r.replace(ba, "\\$&") : b.setAttribute("id", s), s = "[id='" + s + "'] ", l = o.length;while (l--) {
38056							o[l] = s + ra(o[l]);
38057						}w = aa.test(a) && pa(b.parentNode) || b, x = o.join(",");
38058					}if (x) try {
38059						return H.apply(d, w.querySelectorAll(x)), d;
38060					} catch (y) {} finally {
38061						r || b.removeAttribute("id");
38062					}
38063				}
38064			}return i(a.replace(R, "$1"), b, d, e);
38065		}function ha() {
38066			var a = [];function b(c, e) {
38067				return a.push(c + " ") > d.cacheLength && delete b[a.shift()], b[c + " "] = e;
38068			}return b;
38069		}function ia(a) {
38070			return a[u] = !0, a;
38071		}function ja(a) {
38072			var b = n.createElement("div");try {
38073				return !!a(b);
38074			} catch (c) {
38075				return !1;
38076			} finally {
38077				b.parentNode && b.parentNode.removeChild(b), b = null;
38078			}
38079		}function ka(a, b) {
38080			var c = a.split("|"),
38081			    e = a.length;while (e--) {
38082				d.attrHandle[c[e]] = b;
38083			}
38084		}function la(a, b) {
38085			var c = b && a,
38086			    d = c && 1 === a.nodeType && 1 === b.nodeType && (~b.sourceIndex || C) - (~a.sourceIndex || C);if (d) return d;if (c) while (c = c.nextSibling) {
38087				if (c === b) return -1;
38088			}return a ? 1 : -1;
38089		}function ma(a) {
38090			return function (b) {
38091				var c = b.nodeName.toLowerCase();return "input" === c && b.type === a;
38092			};
38093		}function na(a) {
38094			return function (b) {
38095				var c = b.nodeName.toLowerCase();return ("input" === c || "button" === c) && b.type === a;
38096			};
38097		}function oa(a) {
38098			return ia(function (b) {
38099				return b = +b, ia(function (c, d) {
38100					var e,
38101					    f = a([], c.length, b),
38102					    g = f.length;while (g--) {
38103						c[e = f[g]] && (c[e] = !(d[e] = c[e]));
38104					}
38105				});
38106			});
38107		}function pa(a) {
38108			return a && "undefined" != typeof a.getElementsByTagName && a;
38109		}c = ga.support = {}, f = ga.isXML = function (a) {
38110			var b = a && (a.ownerDocument || a).documentElement;return b ? "HTML" !== b.nodeName : !1;
38111		}, m = ga.setDocument = function (a) {
38112			var b,
38113			    e,
38114			    g = a ? a.ownerDocument || a : v;return g !== n && 9 === g.nodeType && g.documentElement ? (n = g, o = g.documentElement, e = g.defaultView, e && e !== e.top && (e.addEventListener ? e.addEventListener("unload", ea, !1) : e.attachEvent && e.attachEvent("onunload", ea)), p = !f(g), c.attributes = ja(function (a) {
38115				return a.className = "i", !a.getAttribute("className");
38116			}), c.getElementsByTagName = ja(function (a) {
38117				return a.appendChild(g.createComment("")), !a.getElementsByTagName("*").length;
38118			}), c.getElementsByClassName = $.test(g.getElementsByClassName), c.getById = ja(function (a) {
38119				return o.appendChild(a).id = u, !g.getElementsByName || !g.getElementsByName(u).length;
38120			}), c.getById ? (d.find.ID = function (a, b) {
38121				if ("undefined" != typeof b.getElementById && p) {
38122					var c = b.getElementById(a);return c && c.parentNode ? [c] : [];
38123				}
38124			}, d.filter.ID = function (a) {
38125				var b = a.replace(ca, da);return function (a) {
38126					return a.getAttribute("id") === b;
38127				};
38128			}) : (delete d.find.ID, d.filter.ID = function (a) {
38129				var b = a.replace(ca, da);return function (a) {
38130					var c = "undefined" != typeof a.getAttributeNode && a.getAttributeNode("id");return c && c.value === b;
38131				};
38132			}), d.find.TAG = c.getElementsByTagName ? function (a, b) {
38133				return "undefined" != typeof b.getElementsByTagName ? b.getElementsByTagName(a) : c.qsa ? b.querySelectorAll(a) : void 0;
38134			} : function (a, b) {
38135				var c,
38136				    d = [],
38137				    e = 0,
38138				    f = b.getElementsByTagName(a);if ("*" === a) {
38139					while (c = f[e++]) {
38140						1 === c.nodeType && d.push(c);
38141					}return d;
38142				}return f;
38143			}, d.find.CLASS = c.getElementsByClassName && function (a, b) {
38144				return p ? b.getElementsByClassName(a) : void 0;
38145			}, r = [], q = [], (c.qsa = $.test(g.querySelectorAll)) && (ja(function (a) {
38146				o.appendChild(a).innerHTML = "<a id='" + u + "'></a><select id='" + u + "-\f]' msallowcapture=''><option selected=''></option></select>", a.querySelectorAll("[msallowcapture^='']").length && q.push("[*^$]=" + L + "*(?:''|\"\")"), a.querySelectorAll("[selected]").length || q.push("\\[" + L + "*(?:value|" + K + ")"), a.querySelectorAll("[id~=" + u + "-]").length || q.push("~="), a.querySelectorAll(":checked").length || q.push(":checked"), a.querySelectorAll("a#" + u + "+*").length || q.push(".#.+[+~]");
38147			}), ja(function (a) {
38148				var b = g.createElement("input");b.setAttribute("type", "hidden"), a.appendChild(b).setAttribute("name", "D"), a.querySelectorAll("[name=d]").length && q.push("name" + L + "*[*^$|!~]?="), a.querySelectorAll(":enabled").length || q.push(":enabled", ":disabled"), a.querySelectorAll("*,:x"), q.push(",.*:");
38149			})), (c.matchesSelector = $.test(s = o.matches || o.webkitMatchesSelector || o.mozMatchesSelector || o.oMatchesSelector || o.msMatchesSelector)) && ja(function (a) {
38150				c.disconnectedMatch = s.call(a, "div"), s.call(a, "[s!='']:x"), r.push("!=", P);
38151			}), q = q.length && new RegExp(q.join("|")), r = r.length && new RegExp(r.join("|")), b = $.test(o.compareDocumentPosition), t = b || $.test(o.contains) ? function (a, b) {
38152				var c = 9 === a.nodeType ? a.documentElement : a,
38153				    d = b && b.parentNode;return a === d || !(!d || 1 !== d.nodeType || !(c.contains ? c.contains(d) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(d)));
38154			} : function (a, b) {
38155				if (b) while (b = b.parentNode) {
38156					if (b === a) return !0;
38157				}return !1;
38158			}, B = b ? function (a, b) {
38159				if (a === b) return l = !0, 0;var d = !a.compareDocumentPosition - !b.compareDocumentPosition;return d ? d : (d = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1, 1 & d || !c.sortDetached && b.compareDocumentPosition(a) === d ? a === g || a.ownerDocument === v && t(v, a) ? -1 : b === g || b.ownerDocument === v && t(v, b) ? 1 : k ? J(k, a) - J(k, b) : 0 : 4 & d ? -1 : 1);
38160			} : function (a, b) {
38161				if (a === b) return l = !0, 0;var c,
38162				    d = 0,
38163				    e = a.parentNode,
38164				    f = b.parentNode,
38165				    h = [a],
38166				    i = [b];if (!e || !f) return a === g ? -1 : b === g ? 1 : e ? -1 : f ? 1 : k ? J(k, a) - J(k, b) : 0;if (e === f) return la(a, b);c = a;while (c = c.parentNode) {
38167					h.unshift(c);
38168				}c = b;while (c = c.parentNode) {
38169					i.unshift(c);
38170				}while (h[d] === i[d]) {
38171					d++;
38172				}return d ? la(h[d], i[d]) : h[d] === v ? -1 : i[d] === v ? 1 : 0;
38173			}, g) : n;
38174		}, ga.matches = function (a, b) {
38175			return ga(a, null, null, b);
38176		}, ga.matchesSelector = function (a, b) {
38177			if ((a.ownerDocument || a) !== n && m(a), b = b.replace(U, "='$1']"), !(!c.matchesSelector || !p || r && r.test(b) || q && q.test(b))) try {
38178				var d = s.call(a, b);if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType) return d;
38179			} catch (e) {}return ga(b, n, null, [a]).length > 0;
38180		}, ga.contains = function (a, b) {
38181			return (a.ownerDocument || a) !== n && m(a), t(a, b);
38182		}, ga.attr = function (a, b) {
38183			(a.ownerDocument || a) !== n && m(a);var e = d.attrHandle[b.toLowerCase()],
38184			    f = e && D.call(d.attrHandle, b.toLowerCase()) ? e(a, b, !p) : void 0;return void 0 !== f ? f : c.attributes || !p ? a.getAttribute(b) : (f = a.getAttributeNode(b)) && f.specified ? f.value : null;
38185		}, ga.error = function (a) {
38186			throw new Error("Syntax error, unrecognized expression: " + a);
38187		}, ga.uniqueSort = function (a) {
38188			var b,
38189			    d = [],
38190			    e = 0,
38191			    f = 0;if (l = !c.detectDuplicates, k = !c.sortStable && a.slice(0), a.sort(B), l) {
38192				while (b = a[f++]) {
38193					b === a[f] && (e = d.push(f));
38194				}while (e--) {
38195					a.splice(d[e], 1);
38196				}
38197			}return k = null, a;
38198		}, e = ga.getText = function (a) {
38199			var b,
38200			    c = "",
38201			    d = 0,
38202			    f = a.nodeType;if (f) {
38203				if (1 === f || 9 === f || 11 === f) {
38204					if ("string" == typeof a.textContent) return a.textContent;for (a = a.firstChild; a; a = a.nextSibling) {
38205						c += e(a);
38206					}
38207				} else if (3 === f || 4 === f) return a.nodeValue;
38208			} else while (b = a[d++]) {
38209				c += e(b);
38210			}return c;
38211		}, d = ga.selectors = { cacheLength: 50, createPseudo: ia, match: X, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: !0 }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: !0 }, "~": { dir: "previousSibling" } }, preFilter: { ATTR: function ATTR(a) {
38212					return a[1] = a[1].replace(ca, da), a[3] = (a[3] || a[4] || a[5] || "").replace(ca, da), "~=" === a[2] && (a[3] = " " + a[3] + " "), a.slice(0, 4);
38213				}, CHILD: function CHILD(a) {
38214					return a[1] = a[1].toLowerCase(), "nth" === a[1].slice(0, 3) ? (a[3] || ga.error(a[0]), a[4] = +(a[4] ? a[5] + (a[6] || 1) : 2 * ("even" === a[3] || "odd" === a[3])), a[5] = +(a[7] + a[8] || "odd" === a[3])) : a[3] && ga.error(a[0]), a;
38215				}, PSEUDO: function PSEUDO(a) {
38216					var b,
38217					    c = !a[6] && a[2];return X.CHILD.test(a[0]) ? null : (a[3] ? a[2] = a[4] || a[5] || "" : c && V.test(c) && (b = g(c, !0)) && (b = c.indexOf(")", c.length - b) - c.length) && (a[0] = a[0].slice(0, b), a[2] = c.slice(0, b)), a.slice(0, 3));
38218				} }, filter: { TAG: function TAG(a) {
38219					var b = a.replace(ca, da).toLowerCase();return "*" === a ? function () {
38220						return !0;
38221					} : function (a) {
38222						return a.nodeName && a.nodeName.toLowerCase() === b;
38223					};
38224				}, CLASS: function CLASS(a) {
38225					var b = y[a + " "];return b || (b = new RegExp("(^|" + L + ")" + a + "(" + L + "|$)")) && y(a, function (a) {
38226						return b.test("string" == typeof a.className && a.className || "undefined" != typeof a.getAttribute && a.getAttribute("class") || "");
38227					});
38228				}, ATTR: function ATTR(a, b, c) {
38229					return function (d) {
38230						var e = ga.attr(d, a);return null == e ? "!=" === b : b ? (e += "", "=" === b ? e === c : "!=" === b ? e !== c : "^=" === b ? c && 0 === e.indexOf(c) : "*=" === b ? c && e.indexOf(c) > -1 : "$=" === b ? c && e.slice(-c.length) === c : "~=" === b ? (" " + e.replace(Q, " ") + " ").indexOf(c) > -1 : "|=" === b ? e === c || e.slice(0, c.length + 1) === c + "-" : !1) : !0;
38231					};
38232				}, CHILD: function CHILD(a, b, c, d, e) {
38233					var f = "nth" !== a.slice(0, 3),
38234					    g = "last" !== a.slice(-4),
38235					    h = "of-type" === b;return 1 === d && 0 === e ? function (a) {
38236						return !!a.parentNode;
38237					} : function (b, c, i) {
38238						var j,
38239						    k,
38240						    l,
38241						    m,
38242						    n,
38243						    o,
38244						    p = f !== g ? "nextSibling" : "previousSibling",
38245						    q = b.parentNode,
38246						    r = h && b.nodeName.toLowerCase(),
38247						    s = !i && !h;if (q) {
38248							if (f) {
38249								while (p) {
38250									l = b;while (l = l[p]) {
38251										if (h ? l.nodeName.toLowerCase() === r : 1 === l.nodeType) return !1;
38252									}o = p = "only" === a && !o && "nextSibling";
38253								}return !0;
38254							}if (o = [g ? q.firstChild : q.lastChild], g && s) {
38255								k = q[u] || (q[u] = {}), j = k[a] || [], n = j[0] === w && j[1], m = j[0] === w && j[2], l = n && q.childNodes[n];while (l = ++n && l && l[p] || (m = n = 0) || o.pop()) {
38256									if (1 === l.nodeType && ++m && l === b) {
38257										k[a] = [w, n, m];break;
38258									}
38259								}
38260							} else if (s && (j = (b[u] || (b[u] = {}))[a]) && j[0] === w) m = j[1];else while (l = ++n && l && l[p] || (m = n = 0) || o.pop()) {
38261								if ((h ? l.nodeName.toLowerCase() === r : 1 === l.nodeType) && ++m && (s && ((l[u] || (l[u] = {}))[a] = [w, m]), l === b)) break;
38262							}return m -= e, m === d || m % d === 0 && m / d >= 0;
38263						}
38264					};
38265				}, PSEUDO: function PSEUDO(a, b) {
38266					var c,
38267					    e = d.pseudos[a] || d.setFilters[a.toLowerCase()] || ga.error("unsupported pseudo: " + a);return e[u] ? e(b) : e.length > 1 ? (c = [a, a, "", b], d.setFilters.hasOwnProperty(a.toLowerCase()) ? ia(function (a, c) {
38268						var d,
38269						    f = e(a, b),
38270						    g = f.length;while (g--) {
38271							d = J(a, f[g]), a[d] = !(c[d] = f[g]);
38272						}
38273					}) : function (a) {
38274						return e(a, 0, c);
38275					}) : e;
38276				} }, pseudos: { not: ia(function (a) {
38277					var b = [],
38278					    c = [],
38279					    d = h(a.replace(R, "$1"));return d[u] ? ia(function (a, b, c, e) {
38280						var f,
38281						    g = d(a, null, e, []),
38282						    h = a.length;while (h--) {
38283							(f = g[h]) && (a[h] = !(b[h] = f));
38284						}
38285					}) : function (a, e, f) {
38286						return b[0] = a, d(b, null, f, c), b[0] = null, !c.pop();
38287					};
38288				}), has: ia(function (a) {
38289					return function (b) {
38290						return ga(a, b).length > 0;
38291					};
38292				}), contains: ia(function (a) {
38293					return a = a.replace(ca, da), function (b) {
38294						return (b.textContent || b.innerText || e(b)).indexOf(a) > -1;
38295					};
38296				}), lang: ia(function (a) {
38297					return W.test(a || "") || ga.error("unsupported lang: " + a), a = a.replace(ca, da).toLowerCase(), function (b) {
38298						var c;do {
38299							if (c = p ? b.lang : b.getAttribute("xml:lang") || b.getAttribute("lang")) return c = c.toLowerCase(), c === a || 0 === c.indexOf(a + "-");
38300						} while ((b = b.parentNode) && 1 === b.nodeType);return !1;
38301					};
38302				}), target: function target(b) {
38303					var c = a.location && a.location.hash;return c && c.slice(1) === b.id;
38304				}, root: function root(a) {
38305					return a === o;
38306				}, focus: function focus(a) {
38307					return a === n.activeElement && (!n.hasFocus || n.hasFocus()) && !!(a.type || a.href || ~a.tabIndex);
38308				}, enabled: function enabled(a) {
38309					return a.disabled === !1;
38310				}, disabled: function disabled(a) {
38311					return a.disabled === !0;
38312				}, checked: function checked(a) {
38313					var b = a.nodeName.toLowerCase();return "input" === b && !!a.checked || "option" === b && !!a.selected;
38314				}, selected: function selected(a) {
38315					return a.parentNode && a.parentNode.selectedIndex, a.selected === !0;
38316				}, empty: function empty(a) {
38317					for (a = a.firstChild; a; a = a.nextSibling) {
38318						if (a.nodeType < 6) return !1;
38319					}return !0;
38320				}, parent: function parent(a) {
38321					return !d.pseudos.empty(a);
38322				}, header: function header(a) {
38323					return Z.test(a.nodeName);
38324				}
38324, input: function input(a) {
38325					return Y.test(a.nodeName);
38326				}, button: function button(a) {
38327					var b = a.nodeName.toLowerCase();return "input" === b && "button" === a.type || "button" === b;
38328				}, text: function text(a) {
38329					var b;return "input" === a.nodeName.toLowerCase() && "text" === a.type && (null == (b = a.getAttribute("type")) || "text" === b.toLowerCase());
38330				}, first: oa(function () {
38331					return [0];
38332				}), last: oa(function (a, b) {
38333					return [b - 1];
38334				}), eq: oa(function (a, b, c) {
38335					return [0 > c ? c + b : c];
38336				}), even: oa(function (a, b) {
38337					for (var c = 0; b > c; c += 2) {
38338						a.push(c);
38339					}return a;
38340				}), odd: oa(function (a, b) {
38341					for (var c = 1; b > c; c += 2) {
38342						a.push(c);
38343					}return a;
38344				}), lt: oa(function (a, b, c) {
38345					for (var d = 0 > c ? c + b : c; --d >= 0;) {
38346						a.push(d);
38347					}return a;
38348				}), gt: oa(function (a, b, c) {
38349					for (var d = 0 > c ? c + b : c; ++d < b;) {
38350						a.push(d);
38351					}return a;
38352				}) } }, d.pseudos.nth = d.pseudos.eq;for (b in { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }) {
38353			d.pseudos[b] = ma(b);
38354		}for (b in { submit: !0, reset: !0 }) {
38355			d.pseudos[b] = na(b);
38356		}function qa() {}qa.prototype = d.filters = d.pseudos, d.setFilters = new qa(), g = ga.tokenize = function (a, b) {
38357			var c,
38358			    e,
38359			    f,
38360			    g,
38361			    h,
38362			    i,
38363			    j,
38364			    k = z[a + " "];if (k) return b ? 0 : k.slice(0);h = a, i = [], j = d.preFilter;while (h) {
38365				(!c || (e = S.exec(h))) && (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = T.exec(h)) && (c = e.shift(), f.push({ value: c, type: e[0].replace(R, " ") }), h = h.slice(c.length));for (g in d.filter) {
38366					!(e = X[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({ value: c, type: g, matches: e }), h = h.slice(c.length));
38367				}if (!c) break;
38368			}return b ? h.length : h ? ga.error(a) : z(a, i).slice(0);
38369		};function ra(a) {
38370			for (var b = 0, c = a.length, d = ""; c > b; b++) {
38371				d += a[b].value;
38372			}return d;
38373		}function sa(a, b, c) {
38374			var d = b.dir,
38375			    e = c && "parentNode" === d,
38376			    f = x++;return b.first ? function (b, c, f) {
38377				while (b = b[d]) {
38378					if (1 === b.nodeType || e) return a(b, c, f);
38379				}
38380			} : function (b, c, g) {
38381				var h,
38382				    i,
38383				    j = [w, f];if (g) {
38384					while (b = b[d]) {
38385						if ((1 === b.nodeType || e) && a(b, c, g)) return !0;
38386					}
38387				} else while (b = b[d]) {
38388					if (1 === b.nodeType || e) {
38389						if (i = b[u] || (b[u] = {}), (h = i[d]) && h[0] === w && h[1] === f) return j[2] = h[2];if (i[d] = j, j[2] = a(b, c, g)) return !0;
38390					}
38391				}
38392			};
38393		}function ta(a) {
38394			return a.length > 1 ? function (b, c, d) {
38395				var e = a.length;while (e--) {
38396					if (!a[e](b, c, d)) return !1;
38397				}return !0;
38398			} : a[0];
38399		}function ua(a, b, c) {
38400			for (var d = 0, e = b.length; e > d; d++) {
38401				ga(a, b[d], c);
38402			}return c;
38403		}function va(a, b, c, d, e) {
38404			for (var f, g = [], h = 0, i = a.length, j = null != b; i > h; h++) {
38405				(f = a[h]) && (!c || c(f, d, e)) && (g.push(f), j && b.push(h));
38406			}return g;
38407		}function wa(a, b, c, d, e, f) {
38408			return d && !d[u] && (d = wa(d)), e && !e[u] && (e = wa(e, f)), ia(function (f, g, h, i) {
38409				var j,
38410				    k,
38411				    l,
38412				    m = [],
38413				    n = [],
38414				    o = g.length,
38415				    p = f || ua(b || "*", h.nodeType ? [h] : h, []),
38416				    q = !a || !f && b ? p : va(p, m, a, h, i),
38417				    r = c ? e || (f ? a : o || d) ? [] : g : q;if (c && c(q, r, h, i), d) {
38418					j = va(r, n), d(j, [], h, i), k = j.length;while (k--) {
38419						(l = j[k]) && (r[n[k]] = !(q[n[k]] = l));
38420					}
38421				}if (f) {
38422					if (e || a) {
38423						if (e) {
38424							j = [], k = r.length;while (k--) {
38425								(l = r[k]) && j.push(q[k] = l);
38426							}e(null, r = [], j, i);
38427						}k = r.length;while (k--) {
38428							(l = r[k]) && (j = e ? J(f, l) : m[k]) > -1 && (f[j] = !(g[j] = l));
38429						}
38430					}
38431				} else r = va(r === g ? r.splice(o, r.length) : r), e ? e(null, g, r, i) : H.apply(g, r);
38432			});
38433		}function xa(a) {
38434			for (var b, c, e, f = a.length, g = d.relative[a[0].type], h = g || d.relative[" "], i = g ? 1 : 0, k = sa(function (a) {
38435				return a === b;
38436			}, h, !0), l = sa(function (a) {
38437				return J(b, a) > -1;
38438			}, h, !0), m = [function (a, c, d) {
38439				var e = !g && (d || c !== j) || ((b = c).nodeType ? k(a, c, d) : l(a, c, d));return b = null, e;
38440			}]; f > i; i++) {
38441				if (c = d.relative[a[i].type]) m = [sa(ta(m), c)];else {
38442					if (c = d.filter[a[i].type].apply(null, a[i].matches), c[u]) {
38443						for (e = ++i; f > e; e++) {
38444							if (d.relative[a[e].type]) break;
38445						}return wa(i > 1 && ta(m), i > 1 && ra(a.slice(0, i - 1).concat({ value: " " === a[i - 2].type ? "*" : "" })).replace(R, "$1"), c, e > i && xa(a.slice(i, e)), f > e && xa(a = a.slice(e)), f > e && ra(a));
38446					}m.push(c);
38447				}
38448			}return ta(m);
38449		}function ya(a, b) {
38450			var c = b.length > 0,
38451			    e = a.length > 0,
38452			    f = function f(_f, g, h, i, k) {
38453				var l,
38454				    m,
38455				    o,
38456				    p = 0,
38457				    q = "0",
38458				    r = _f && [],
38459				    s = [],
38460				    t = j,
38461				    u = _f || e && d.find.TAG("*", k),
38462				    v = w += null == t ? 1 : Math.random() || .1,
38463				    x = u.length;for (k && (j = g !== n && g); q !== x && null != (l = u[q]); q++) {
38464					if (e && l) {
38465						m = 0;while (o = a[m++]) {
38466							if (o(l, g, h)) {
38467								i.push(l);break;
38468							}
38469						}k && (w = v);
38470					}c && ((l = !o && l) && p--, _f && r.push(l));
38471				}if (p += q, c && q !== p) {
38472					m = 0;while (o = b[m++]) {
38473						o(r, s, g, h);
38474					}if (_f) {
38475						if (p > 0) while (q--) {
38476							r[q] || s[q] || (s[q] = F.call(i));
38477						}
38477s = va(s);
38478					}H.apply(i, s), k && !_f && s.length > 0 && p + b.length > 1 && ga.uniqueSort(i);
38479				}return k && (w = v, j = t), r;
38480			};return c ? ia(f) : f;
38481		}return h = ga.compile = function (a, b) {
38482			var c,
38483			    d = [],
38484			    e = [],
38485			    f = A[a + " "];if (!f) {
38486				b || (b = g(a)), c = b.length;while (c--) {
38487					f = xa(b[c]), f[u] ? d.push(f) : e.push(f);
38488				}f = A(a, ya(e, d)), f.selector = a;
38489			}return f;
38490		}, i = ga.select = function (a, b, e, f) {
38491			var i,
38492			    j,
38493			    k,
38494			    l,
38495			    m,
38496			    n = "function" == typeof a && a,
38497			    o = !f && g(a = n.selector || a);if (e = e || [], 1 === o.length) {
38498				if (j = o[0] = o[0].slice(0), j.length > 2 && "ID" === (k = j[0]).type && c.getById && 9 === b.nodeType && p && d.relative[j[1].type]) {
38499					if (b = (d.find.ID(k.matches[0].replace(ca, da), b) || [])[0], !b) return e;n && (b = b.parentNode), a = a.slice(j.shift().value.length);
38500				}i = X.needsContext.test(a) ? 0 : j.length;while (i--) {
38501					if (k = j[i], d.relative[l = k.type]) break;if ((m = d.find[l]) && (f = m(k.matches[0].replace(ca, da), aa.test(j[0].type) && pa(b.parentNode) || b))) {
38502						if (j.splice(i, 1), a = f.length && ra(j), !a) return H.apply(e, f), e;break;
38503					}
38504				}
38505			}return (n || h(a, o))(f, b, !p, e, aa.test(a) && pa(b.parentNode) || b), e;
38506		}, c.sortStable = u.split("").sort(B).join("") === u, c.detectDuplicates = !!l, m(), c.sortDetached = ja(function (a) {
38507			return 1 & a.compareDocumentPosition(n.createElement("div"));
38508		}), ja(function (a) {
38509			return a.innerHTML = "<a href='#'></a>", "#" === a.firstChild.getAttribute("href");
38510		}) || ka("type|href|height|width", function (a, b, c) {
38511			return c ? void 0 : a.getAttribute(b, "type" === b.toLowerCase() ? 1 : 2);
38512		}), c.attributes && ja(function (a) {
38513			return a.innerHTML = "<input/>", a.firstChild.setAttribute("value", ""), "" === a.firstChild.getAttribute("value");
38514		}) || ka("value", function (a, b, c) {
38515			return c || "input" !== a.nodeName.toLowerCase() ? void 0 : a.defaultValue;
38516		}), ja(function (a) {
38517			return null == a.getAttribute("disabled");
38518		}) || ka(K, function (a, b, c) {
38519			var d;return c ? void 0 : a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null;
38520		}), ga;
38521	}(a);n.find = t, n.expr = t.selectors, n.expr[":"] = n.expr.pseudos, n.unique = t.uniqueSort, n.text = t.getText, n.isXMLDoc = t.isXML, n.contains = t.contains;var u = n.expr.match.needsContext,
38522	    v = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
38523	    w = /^.[^:#\[\.,]*$/;function x(a, b, c) {
38524		if (n.isFunction(b)) return n.grep(a, function (a, d) {
38525			return !!b.call(a, d, a) !== c;
38526		});if (b.nodeType) return n.grep(a, function (a) {
38527			return a === b !== c;
38528		});if ("string" == typeof b) {
38529			if (w.test(b)) return n.filter(b, a, c);b = n.filter(b, a);
38530		}return n.grep(a, function (a) {
38531			return g.call(b, a) >= 0 !== c;
38532		});
38533	}n.filter = function (a, b, c) {
38534		var d = b[0];return c && (a = ":not(" + a + ")"), 1 === b.length && 1 === d.nodeType ? n.find.matchesSelector(d, a) ? [d] : [] : n.find.matches(a, n.grep(b, function (a) {
38535			return 1 === a.nodeType;
38536		}));
38537	}, n.fn.extend({ find: function find(a) {
38538			var b,
38539			    c = this.length,
38540			    d = [],
38541			    e = this;if ("string" != typeof a) return this.pushStack(n(a).filter(function () {
38542				for (b = 0; c > b; b++) {
38543					if (n.contains(e[b], this)) return !0;
38544				}
38545			}));for (b = 0; c > b; b++) {
38546				n.find(a, e[b], d);
38547			}return d = this.pushStack(c > 1 ? n.unique(d) : d), d.selector = this.selector ? this.selector + " " + a : a, d;
38548		}, filter: function filter(a) {
38549			return this.pushStack(x(this, a || [], !1));
38550		}, not: function not(a) {
38551			return this.pushStack(x(this, a || [], !0));
38552		}, is: function is(a) {
38553			return !!x(this, "string" == typeof a && u.test(a) ? n(a) : a || [], !1).length;
38554		} });var y,
38555	    z = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
38556	    A = n.fn.init = function (a, b) {
38557		var c, d;if (!a) return this;if ("string" == typeof a) {
38558			if (c = "<" === a[0] && ">" === a[a.length - 1] && a.length >= 3 ? [null, a, null] : z.exec(a), !c || !c[1] && b) return !b || b.jquery ? (b || y).find(a) : this.constructor(b).find(a);if (c[1]) {
38559				if (b = b instanceof n ? b[0] : b, n.merge(this, n.parseHTML(c[1], b && b.nodeType ? b.ownerDocument || b : l, !0)), v.test(c[1]) && n.isPlainObject(b)) for (c in b) {
38560					n.isFunction(this[c]) ? this[c](b[c]) : this.attr(c, b[c]);
38561				}return this;
38562			}return d = l.getElementById(c[2]), d && d.parentNode && (this.length = 1, this[0] = d), this.context = l, this.selector = a, this;
38563		}return a.nodeType ? (this.context = this[0] = a, this.length = 1, this) : n.isFunction(a) ? "undefined" != typeof y.ready ? y.ready(a) : a(n) : (void 0 !== a.selector && (this.selector = a.selector, this.context = a.context), n.makeArray(a, this));
38564	};A.prototype = n.fn, y = n(l);var B = /^(?:parents|prev(?:Until|All))/,
38565	    C = { children: !0, contents: !0, next: !0, prev: !0 };n.extend({ dir: function dir(a, b, c) {
38566			var d = [],
38567			    e = void 0 !== c;while ((a = a[b]) && 9 !== a.nodeType) {
38568				if (1 === a.nodeType) {
38569					if (e && n(a).is(c)) break;d.push(a);
38570				}
38571			}return d;
38572		}, sibling: function sibling(a, b) {
38573			for (var c = []; a; a = a.nextSibling) {
38574				1 === a.nodeType && a !== b && c.push(a);
38575			}return c;
38576		} }), n.fn.extend({ has: function has(a) {
38577			var b = n(a, this),
38578			    c = b.length;return this.filter(function () {
38579				for (var a = 0; c > a; a++) {
38580					if (n.contains(this, b[a])) return !0;
38581				}
38582			});
38583		}, closest: function closest(a, b) {
38584			for (var c, d = 0, e = this.length, f = [], g = u.test(a) || "string" != typeof a ? n(a, b || this.context) : 0; e > d; d++) {
38585				for (c = this[d]; c && c !== b; c = c.parentNode) {
38586					if (c.nodeType < 11 && (g ? g.index(c) > -1 : 1 === c.nodeType && n.find.matchesSelector(c, a))) {
38587						f.push(c);break;
38588					}
38589				}
38590			}return this.pushStack(f.length > 1 ? n.unique(f) : f);
38591		}, index: function index(a) {
38592			return a ? "string" == typeof a ? g.call(n(a), this[0]) : g.call(this, a.jquery ? a[0] : a) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
38593		}, add: function add(a, b) {
38594			return this.pushStack(n.unique(n.merge(this.get(), n(a, b))));
38595		}, addBack: function addBack(a) {
38596			return this.add(null == a ? this.prevObject : this.prevObject.filter(a));
38597		} });function D(a, b) {
38598		while ((a = a[b]) && 1 !== a.nodeType) {}return a;
38599	}n.each({ parent: function parent(a) {
38600			var b = a.parentNode;return b && 11 !== b.nodeType ? b : null;
38601		}, parents: function parents(a) {
38602			return n.dir(a, "parentNode");
38603		}, parentsUntil: function parentsUntil(a, b, c) {
38604			return n.dir(a, "parentNode", c);
38605		}, next: function next(a) {
38606			return D(a, "nextSibling");
38607		}, prev: function prev(a) {
38608			return D(a, "previousSibling");
38609		}, nextAll: function nextAll(a) {
38610			return n.dir(a, "nextSibling");
38611		}, prevAll: function prevAll(a) {
38612			return n.dir(a, "previousSibling");
38613		}, nextUntil: function nextUntil(a, b, c) {
38614			return n.dir(a, "nextSibling", c);
38615		}, prevUntil: function prevUntil(a, b, c) {
38616			return n.dir(a, "previousSibling", c);
38617		}, siblings: function siblings(a) {
38618			return n.sibling((a.parentNode || {}).firstChild, a);
38619		}, children: function children(a) {
38620			return n.sibling(a.firstChild);
38621		}, contents: function contents(a) {
38622			return a.contentDocument || n.merge([], a.childNodes);
38623		} }, function (a, b) {
38624		n.fn[a] = function (c, d) {
38625			var e = n.map(this, b, c);return "Until" !== a.slice(-5) && (d = c), d && "string" == typeof d && (e = n.filter(d, e)), this.length > 1 && (C[a] || n.unique(e), B.test(a) && e.reverse()), this.pushStack(e);
38626		};
38627	});var E = /\S+/g,
38628	    F = {};function G(a) {
38629		var b = F[a] = {};return n.each(a.match(E) || [], function (a, c) {
38630			b[c] = !0;
38631		}), b;
38632	}n.Callbacks = function (a) {
38633		a = "string" == typeof a ? F[a] || G(a) : n.extend({}, a);var b,
38634		    c,
38635		    d,
38636		    e,
38637		    f,
38638		    g,
38639		    h = [],
38640		    i = !a.once && [],
38641		    j = function j(l) {
38642			for (b = a.memory && l, c = !0, g = e || 0, e = 0, f = h.length, d = !0; h && f > g; g++) {
38643				if (h[g].apply(l[0], l[1]) === !1 && a.stopOnFalse) {
38644					b = !1;break;
38645				}
38646			}d = !1, h && (i ? i.length && j(i.shift()) : b ? h = [] : k.disable());
38647		},
38648		    k = { add: function add() {
38649				if (h) {
38650					var c = h.length;!function g(b) {
38651						n.each(b, function (b, c) {
38652							var d = n.type(c);"function" === d ? a.unique && k.has(c) || h.push(c) : c && c.length && "string" !== d && g(c);
38653						});
38654					}(arguments), d ? f = h.length : b && (e = c, j(b));
38655				}return this;
38656			}, remove: function remove() {
38657				return h && n.each(arguments, function (a, b) {
38658					var c;while ((c = n.inArray(b, h, c)) > -1) {
38659						h.splice(c, 1), d && (f >= c && f--, g >= c && g--);
38660					}
38661				}), this;
38662			}, has: function has(a) {
38663				return a ? n.inArray(a, h) > -1 : !(!h || !h.length);
38664			}, empty: function empty() {
38665				return h = [], f = 0, this;
38666			}, disable: function disable() {
38667				return h = i = b = void 0, this;
38668			}, disabled: function disabled() {
38669				return !h;
38670			}, lock: function lock() {
38671				return i = void 0, b || k.disable(), this;
38672			}, locked: function locked() {
38673				return !i;
38674			}, fireWith: function fireWith(a, b) {
38675				return !h || c && !i || (b = b || [], b = [a, b.slice ? b.slice() : b], d ? i.push(b) : j(b)), this;
38676			}, fire: function fire() {
38677				return k.fireWith(this, arguments), this;
38678			}, fired: function fired() {
38679				return !!c;
38680			} };return k;
38681	}, n.extend({ Deferred: function Deferred(a) {
38682			var b = [["resolve", "done", n.Callbacks("once memory"), "resolved"], ["reject", "fail", n.Callbacks("once memory"), "rejected"], ["notify", "progress", n.Callbacks("memory")]],
38683			    c = "pending",
38684			    d = { state: function state() {
38685					return c;
38686				}, always: function always() {
38687					return e.done(arguments).fail(arguments), this;
38688				}, then: function then() {
38689					var a = arguments;return n.Deferred(function (c) {
38690						n.each(b, function (b, f) {
38691							var g = n.isFunction(a[b]) && a[b];e[f[1]](function () {
38692								var a = g && g.apply(this, arguments);a && n.isFunction(a.promise) ? a.promise().done(c.resolve).fail(c.reject).progress(c.notify) : c[f[0] + "With"](this === d ? c.promise() : this, g ? [a] : arguments);
38693							});
38694						}), a = null;
38695					}).promise();
38696				}, promise: function promise(a) {
38697					return null != a ? n.extend(a, d) : d;
38698				} },
38699			    e = {};return d.pipe = d.then, n.each(b, function (a, f) {
38700				var g = f[2],
38701				    h = f[3];d[f[1]] = g.add, h && g.add(function () {
38702					c = h;
38703				}, b[1 ^ a][2].disable, b[2][2].lock), e[f[0]] = function () {
38704					return e[f[0] + "With"](this === e ? d : this, arguments), this;
38705				}, e[f[0] + "With"] = g.fireWith;
38706			}), d.promise(e), a && a.call(e, e), e;
38707		}, when: function when(a) {
38708			var b = 0,
38709			    c = d.call(arguments),
38710			    e = c.length,
38711			    f = 1 !== e || a && n.isFunction(a.promise) ? e : 0,
38712			    g = 1 === f ? a : n.Deferred(),
38713			    h = function h(a, b, c) {
38714				return function (e) {
38715					b[a] = this, c[a] = arguments.length > 1 ? d.call(arguments) : e, c === i ? g.notifyWith(b, c) : --f || g.resolveWith(b, c);
38716				};
38717			},
38718			    i,
38719			    j,
38720			    k;if (e > 1) for (i = new Array(e), j = new Array(e), k = new Array(e); e > b; b++) {
38721				c[b] && n.isFunction(c[b].promise) ? c[b].promise().done(h(b, k, c)).fail(g.reject).progress(h(b, j, i)) : --f;
38722			}return f || g.resolveWith(k, c), g.promise();
38723		} });var H;
38723n.fn.ready = function (a) {
38724		return n.ready.promise().done(a), this;
38725	}, n.extend({ isReady: !1, readyWait: 1, holdReady: function holdReady(a) {
38726			a ? n.readyWait++ : n.ready(!0);
38727		}, ready: function ready(a) {
38728			(a === !0 ? --n.readyWait : n.isReady) || (n.isReady = !0, a !== !0 && --n.readyWait > 0 || (H.resolveWith(l, [n]), n.fn.triggerHandler && (n(l).triggerHandler("ready"), n(l).off("ready"))));
38729		} });function I() {
38730		l.removeEventListener("DOMContentLoaded", I, !1), a.removeEventListener("load", I, !1), n.ready();
38731	}n.ready.promise = function (b) {
38732		return H || (H = n.Deferred(), "complete" === l.readyState ? setTimeout(n.ready) : (l.addEventListener("DOMContentLoaded", I, !1), a.addEventListener("load", I, !1))), H.promise(b);
38733	}, n.ready.promise();var J = n.access = function (a, b, c, d, e, f, g) {
38734		var h = 0,
38735		    i = a.length,
38736		    j = null == c;if ("object" === n.type(c)) {
38737			e = !0;for (h in c) {
38738				n.access(a, b, h, c[h], !0, f, g);
38739			}
38740		} else if (void 0 !== d && (e = !0, n.isFunction(d) || (g = !0), j && (g ? (b.call(a, d), b = null) : (j = b, b = function b(a, _b, c) {
38741			return j.call(n(a), c);
38742		})), b)) for (; i > h; h++) {
38743			b(a[h], c, g ? d : d.call(a[h], h, b(a[h], c)));
38744		}return e ? a : j ? b.call(a) : i ? b(a[0], c) : f;
38745	};n.acceptData = function (a) {
38746		return 1 === a.nodeType || 9 === a.nodeType || !+a.nodeType;
38747	};function K() {
38748		Object.defineProperty(this.cache = {}, 0, { get: function get() {
38749				return {};
38750			} }), this.expando = n.expando + K.uid++;
38751	}K.uid = 1, K.accepts = n.acceptData, K.prototype = { key: function key(a) {
38752			if (!K.accepts(a)) return 0;var b = {},
38753			    c = a[this.expando];if (!c) {
38754				c = K.uid++;try {
38755					b[this.expando] = { value: c }, (0, _defineProperties2.default)(a, b);
38756				} catch (d) {
38757					b[this.expando] = c, n.extend(a, b);
38758				}
38759			}return this.cache[c] || (this.cache[c] = {}), c;
38760		}, set: function set(a, b, c) {
38761			var d,
38762			    e = this.key(a),
38763			    f = this.cache[e];if ("string" == typeof b) f[b] = c;else if (n.isEmptyObject(f)) n.extend(this.cache[e], b);else for (d in b) {
38764				f[d] = b[d];
38765			}return f;
38766		}, get: function get(a, b) {
38767			var c = this.cache[this.key(a)];return void 0 === b ? c : c[b];
38768		}, access: function access(a, b, c) {
38769			var d;return void 0 === b || b && "string" == typeof b && void 0 === c ? (d = this.get(a, b), void 0 !== d ? d : this.get(a, n.camelCase(b))) : (this.set(a, b, c), void 0 !== c ? c : b);
38770		}, remove: function remove(a, b) {
38771			var c,
38772			    d,
38773			    e,
38774			    f = this.key(a),
38775			    g = this.cache[f];if (void 0 === b) this.cache[f] = {};else {
38776				n.isArray(b) ? d = b.concat(b.map(n.camelCase)) : (e = n.camelCase(b), b in g ? d = [b, e] : (d = e, d = d in g ? [d] : d.match(E) || [])), c = d.length;while (c--) {
38777					delete g[d[c]];
38778				}
38779			}
38780		}, hasData: function hasData(a) {
38781			return !n.isEmptyObject(this.cache[a[this.expando]] || {});
38782		}, discard: function discard(a) {
38783			a[this.expando] && delete this.cache[a[this.expando]];
38784		} };var L = new K(),
38785	    M = new K(),
38786	    N = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
38787	    O = /([A-Z])/g;function P(a, b, c) {
38788		var d;if (void 0 === c && 1 === a.nodeType) if (d = "data-" + b.replace(O, "-$1").toLowerCase(), c = a.getAttribute(d), "string" == typeof c) {
38789			try {
38790				c = "true" === c ? !0 : "false" === c ? !1 : "null" === c ? null : +c + "" === c ? +c : N.test(c) ? n.parseJSON(c) : c;
38791			} catch (e) {}M.set(a, b, c);
38792		} else c = void 0;return c;
38793	}n.extend({ hasData: function hasData(a) {
38794			return M.hasData(a) || L.hasData(a);
38795		}, data: function data(a, b, c) {
38796			return M.access(a, b, c);
38797		}, removeData: function removeData(a, b) {
38798			M.remove(a, b);
38799		}, _data: function _data(a, b, c) {
38800			return L.access(a, b, c);
38801		}, _removeData: function _removeData(a, b) {
38802			L.remove(a, b);
38803		} }), n.fn.extend({ data: function data(a, b) {
38804			var c,
38805			    d,
38806			    e,
38807			    f = this[0],
38808			    g = f && f.attributes;if (void 0 === a) {
38809				if (this.length && (e = M.get(f), 1 === f.nodeType && !L.get(f, "hasDataAttrs"))) {
38810					c = g.length;while (c--) {
38811						g[c] && (d = g[c].name, 0 === d.indexOf("data-") && (d = n.camelCase(d.slice(5)), P(f, d, e[d])));
38812					}L.set(f, "hasDataAttrs", !0);
38813				}return e;
38814			}return "object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) ? this.each(function () {
38815				M.set(this, a);
38816			}) : J(this, function (b) {
38817				var c,
38818				    d = n.camelCase(a);if (f && void 0 === b) {
38819					if (c = M.get(f, a), void 0 !== c) return c;if (c = M.get(f, d), void 0 !== c) return c;if (c = P(f, d, void 0), void 0 !== c) return c;
38820				} else this.each(function () {
38821					var c = M.get(this, d);M.set(this, d, b), -1 !== a.indexOf("-") && void 0 !== c && M.set(this, a, b);
38822				});
38823			}, null, b, arguments.length > 1, null, !0);
38824		}, removeData: function removeData(a) {
38825			return this.each(function () {
38826				M.remove(this, a);
38827			});
38828		} }), n.extend({ queue: function queue(a, b, c) {
38829			var d;return a ? (b = (b || "fx") + "queue", d = L.get(a, b), c && (!d || n.isArray(c) ? d = L.access(a, b, n.makeArray(c)) : d.push(c)), d || []) : void 0;
38830		}, dequeue: function dequeue(a, b) {
38831			b = b || "fx";var c = n.queue(a, b),
38832			    d = c.length,
38833			    e = c.shift(),
38834			    f = n._queueHooks(a, b),
38835			    g = function g() {
38836				n.dequeue(a, b);
38837			};"inprogress" === e && (e = c.shift(), d--), e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire();
38838		}, _queueHooks: function _queueHooks(a, b) {
38839			var c = b + "queueHooks";return L.get(a, c) || L.access(a, c, { empty: n.Callbacks("once memory").add(function () {
38840					L.remove(a, [b + "queue", c]);
38841				}) });
38842		} }), n.fn.extend({ queue: function queue(a, b) {
38843			var c = 2;return "string" != typeof a && (b = a, a = "fx", c--), arguments.length < c ? n.queue(this[0], a) : void 0 === b ? this : this.each(function () {
38844				var c = n.queue(this, a, b);n._queueHooks(this, a), "fx" === a && "inprogress" !== c[0] && n.dequeue(this, a);
38845			});
38846		}, dequeue: function dequeue(a) {
38847			return this.each(function () {
38848				n.dequeue(this, a);
38849			});
38850		}, clearQueue: function clearQueue(a) {
38851			return this.queue(a || "fx", []);
38852		}, promise: function promise(a, b) {
38853			var c,
38854			    d = 1,
38855			    e = n.Deferred(),
38856			    f = this,
38857			    g = this.length,
38858			    h = function h() {
38859				--d || e.resolveWith(f, [f]);
38860			};"string" != typeof a && (b = a, a = void 0), a = a || "fx";while (g--) {
38861				c = L.get(f[g], a + "queueHooks"), c && c.empty && (d++, c.empty.add(h));
38862			}return h(), e.promise(b);
38863		} });var Q = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
38864	    R = ["Top", "Right", "Bottom", "Left"],
38865	    S = function S(a, b) {
38866		return a = b || a, "none" === n.css(a, "display") || !n.contains(a.ownerDocument, a);
38867	},
38868	    T = /^(?:checkbox|radio)$/i;!function () {
38869		var a = l.createDocumentFragment(),
38870		    b = a.appendChild(l.createElement("div")),
38871		    c = l.createElement("input");c.setAttribute("type", "radio"), c.setAttribute("checked", "checked"), c.setAttribute("name", "t"), b.appendChild(c), k.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, b.innerHTML = "<textarea>x</textarea>", k.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue;
38872	}();var U = "undefined";k.focusinBubbles = "onfocusin" in a;var V = /^key/,
38873	    W = /^(?:mouse|pointer|contextmenu)|click/,
38874	    X = /^(?:focusinfocus|focusoutblur)$/,
38875	    Y = /^([^.]*)(?:\.(.+)|)$/;function Z() {
38876		return !0;
38877	}function $() {
38878		return !1;
38879	}function _() {
38880		try {
38881			return l.activeElement;
38882		} catch (a) {}
38883	}n.event = { global: {}, add: function add(a, b, c, d, e) {
38884			var f,
38885			    g,
38886			    h,
38887			    i,
38888			    j,
38889			    k,
38890			    l,
38891			    m,
38892			    o,
38893			    p,
38894			    q,
38895			    r = L.get(a);if (r) {
38896				c.handler && (f = c, c = f.handler, e = f.selector), c.guid || (c.guid = n.guid++), (i = r.events) || (i = r.events = {}), (g = r.handle) || (g = r.handle = function (b) {
38897					return (typeof n === "undefined" ? "undefined" : (0, _typeof3.default)(n)) !== U && n.event.triggered !== b.type ? n.event.dispatch.apply(a, arguments) : void 0;
38898				}), b = (b || "").match(E) || [""], j = b.length;while (j--) {
38899					h = Y.exec(b[j]) || [], o = q = h[1], p = (h[2] || "").split(".").sort(), o && (l = n.event.special[o] || {}, o = (e ? l.delegateType : l.bindType) || o, l = n.event.special[o] || {}, k = n.extend({ type: o, origType: q, data: d, handler: c, guid: c.guid, selector: e, needsContext: e && n.expr.match.needsContext.test(e), namespace: p.join(".") }, f), (m = i[o]) || (m = i[o] = [], m.delegateCount = 0, l.setup && l.setup.call(a, d, p, g) !== !1 || a.addEventListener && a.addEventListener(o, g, !1)), l.add && (l.add.call(a, 
38899k), k.handler.guid || (k.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, k) : m.push(k), n.event.global[o] = !0);
38900				}
38901			}
38902		}, remove: function remove(a, b, c, d, e) {
38903			var f,
38904			    g,
38905			    h,
38906			    i,
38907			    j,
38908			    k,
38909			    l,
38910			    m,
38911			    o,
38912			    p,
38913			    q,
38914			    r = L.hasData(a) && L.get(a);if (r && (i = r.events)) {
38915				b = (b || "").match(E) || [""], j = b.length;while (j--) {
38916					if (h = Y.exec(b[j]) || [], o = q = h[1], p = (h[2] || "").split(".").sort(), o) {
38917						l = n.event.special[o] || {}, o = (d ? l.delegateType : l.bindType) || o, m = i[o] || [], h = h[2] && new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)"), g = f = m.length;while (f--) {
38918							k = m[f], !e && q !== k.origType || c && c.guid !== k.guid || h && !h.test(k.namespace) || d && d !== k.selector && ("**" !== d || !k.selector) || (m.splice(f, 1), k.selector && m.delegateCount--, l.remove && l.remove.call(a, k));
38919						}g && !m.length && (l.teardown && l.teardown.call(a, p, r.handle) !== !1 || n.removeEvent(a, o, r.handle), delete i[o]);
38920					} else for (o in i) {
38921						n.event.remove(a, o + b[j], c, d, !0);
38922					}
38923				}n.isEmptyObject(i) && (delete r.handle, L.remove(a, "events"));
38924			}
38925		}, trigger: function trigger(b, c, d, e) {
38926			var f,
38927			    g,
38928			    h,
38929			    i,
38930			    k,
38931			    m,
38932			    o,
38933			    p = [d || l],
38934			    q = j.call(b, "type") ? b.type : b,
38935			    r = j.call(b, "namespace") ? b.namespace.split(".") : [];if (g = h = d = d || l, 3 !== d.nodeType && 8 !== d.nodeType && !X.test(q + n.event.triggered) && (q.indexOf(".") >= 0 && (r = q.split("."), q = r.shift(), r.sort()), k = q.indexOf(":") < 0 && "on" + q, b = b[n.expando] ? b : new n.Event(q, "object" == (typeof b === "undefined" ? "undefined" : (0, _typeof3.default)(b)) && b), b.isTrigger = e ? 2 : 3, b.namespace = r.join("."), b.namespace_re = b.namespace ? new RegExp("(^|\\.)" + r.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, b.result = void 0, b.target || (b.target = d), c = null == c ? [b] : n.makeArray(c, [b]), o = n.event.special[q] || {}, e || !o.trigger || o.trigger.apply(d, c) !== !1)) {
38936				if (!e && !o.noBubble && !n.isWindow(d)) {
38937					for (i = o.delegateType || q, X.test(i + q) || (g = g.parentNode); g; g = g.parentNode) {
38938						p.push(g), h = g;
38939					}h === (d.ownerDocument || l) && p.push(h.defaultView || h.parentWindow || a);
38940				}f = 0;while ((g = p[f++]) && !b.isPropagationStopped()) {
38941					b.type = f > 1 ? i : o.bindType || q, m = (L.get(g, "events") || {})[b.type] && L.get(g, "handle"), m && m.apply(g, c), m = k && g[k], m && m.apply && n.acceptData(g) && (b.result = m.apply(g, c), b.result === !1 && b.preventDefault());
38942				}return b.type = q, e || b.isDefaultPrevented() || o._default && o._default.apply(p.pop(), c) !== !1 || !n.acceptData(d) || k && n.isFunction(d[q]) && !n.isWindow(d) && (h = d[k], h && (d[k] = null), n.event.triggered = q, d[q](), n.event.triggered = void 0, h && (d[k] = h)), b.result;
38943			}
38944		}, dispatch: function dispatch(a) {
38945			a = n.event.fix(a);var b,
38946			    c,
38947			    e,
38948			    f,
38949			    g,
38950			    h = [],
38951			    i = d.call(arguments),
38952			    j = (L.get(this, "events") || {})[a.type] || [],
38953			    k = n.event.special[a.type] || {};if (i[0] = a, a.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, a) !== !1) {
38954				h = n.event.handlers.call(this, a, j), b = 0;while ((f = h[b++]) && !a.isPropagationStopped()) {
38955					a.currentTarget = f.elem, c = 0;while ((g = f.handlers[c++]) && !a.isImmediatePropagationStopped()) {
38956						(!a.namespace_re || a.namespace_re.test(g.namespace)) && (a.handleObj = g, a.data = g.data, e = ((n.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, i), void 0 !== e && (a.result = e) === !1 && (a.preventDefault(), a.stopPropagation()));
38957					}
38958				}return k.postDispatch && k.postDispatch.call(this, a), a.result;
38959			}
38960		}, handlers: function handlers(a, b) {
38961			var c,
38962			    d,
38963			    e,
38964			    f,
38965			    g = [],
38966			    h = b.delegateCount,
38967			    i = a.target;if (h && i.nodeType && (!a.button || "click" !== a.type)) for (; i !== this; i = i.parentNode || this) {
38968				if (i.disabled !== !0 || "click" !== a.type) {
38969					for (d = [], c = 0; h > c; c++) {
38970						f = b[c], e = f.selector + " ", void 0 === d[e] && (d[e] = f.needsContext ? n(e, this).index(i) >= 0 : n.find(e, this, null, [i]).length), d[e] && d.push(f);
38971					}d.length && g.push({ elem: i, handlers: d });
38972				}
38973			}return h < b.length && g.push({ elem: this, handlers: b.slice(h) }), g;
38974		}, props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}
38974, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function filter(a, b) {
38975				return null == a.which && (a.which = null != b.charCode ? b.charCode : b.keyCode), a;
38976			} }, mouseHooks: { props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function filter(a, b) {
38977				var c,
38978				    d,
38979				    e,
38980				    f = b.button;return null == a.pageX && null != b.clientX && (c = a.target.ownerDocument || l, d = c.documentElement, e = c.body, a.pageX = b.clientX + (d && d.scrollLeft || e && e.scrollLeft || 0) - (d && d.clientLeft || e && e.clientLeft || 0), a.pageY = b.clientY + (d && d.scrollTop || e && e.scrollTop || 0) - (d && d.clientTop || e && e.clientTop || 0)), a.which || void 0 === f || (a.which = 1 & f ? 1 : 2 & f ? 3 : 4 & f ? 2 : 0), a;
38981			} }, fix: function fix(a) {
38982			if (a[n.expando]) return a;var b,
38983			    c,
38984			    d,
38985			    e = a.type,
38986			    f = a,
38987			    g = this.fixHooks[e];g || (this.fixHooks[e] = g = W.test(e) ? this.mouseHooks : V.test(e) ? this.keyHooks : {}), d = g.props ? this.props.concat(g.props) : this.props, a = new n.Event(f), b = d.length;while (b--) {
38988				c = d[b], a[c] = f[c];
38989			}return a.target || (a.target = l), 3 === a.target.nodeType && (a.target = a.target.parentNode), g.filter ? g.filter(a, f) : a;
38990		}, special: { load: { noBubble: !0 }, focus: { trigger: function trigger() {
38991					return this !== _() && this.focus ? (this.focus(), !1) : void 0;
38992				}, delegateType: "focusin" }, blur: { trigger: function trigger() {
38993					return this === _() && this.blur ? (this.blur(), !1) : void 0;
38994				}, delegateType: "focusout" }, click: { trigger: function trigger() {
38995					return "checkbox" === this.type && this.click && n.nodeName(this, "input") ? (this.click(), !1) : void 0;
38996				}, _default: function _default(a) {
38997					return n.nodeName(a.target, "a");
38998				} }, beforeunload: { postDispatch: function postDispatch(a) {
38999					void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result);
39000				} } }, simulate: function simulate(a, b, c, d) {
39001			var e = n.extend(new n.Event(), c, { type: a, isSimulated: !0, originalEvent: {} });d ? n.event.trigger(e, null, b) : n.event.dispatch.call(b, e), e.isDefaultPrevented() && c.preventDefault();
39002		} }, n.removeEvent = function (a, b, c) {
39003		a.removeEventListener && a.removeEventListener(b, c, !1);
39004	}, n.Event = function (a, b) {
39005		return this instanceof n.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.returnValue === !1 ? Z : $) : this.type = a, b && n.extend(this, b), this.timeStamp = a && a.timeStamp || n.now(), void (this[n.expando] = !0)) : new n.Event(a, b);
39006	}, n.Event.prototype = { isDefaultPrevented: $, isPropagationStopped: $, isImmediatePropagationStopped: $, preventDefault: function preventDefault() {
39007			var a = this.originalEvent;this.isDefaultPrevented = Z, a && a.preventDefault && a.preventDefault();
39008		}, stopPropagation: function stopPropagation() {
39009			var a = this.originalEvent;this.isPropagationStopped = Z, a && a.stopPropagation && a.stopPropagation();
39010		}, stopImmediatePropagation: function stopImmediatePropagation() {
39011			var a = this.originalEvent;this.isImmediatePropagationStopped = Z, a && a.stopImmediatePropagation && a.stopImmediatePropagation(), this.stopPropagation();
39012		} }, n.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function (a, b) {
39013		n.event.special[a] = { delegateType: b, bindType: b, handle: function handle(a) {
39014				var c,
39015				    d = this,
39016				    e = a.relatedTarget,
39017				    f = a.handleObj;return (!e || e !== d && !n.contains(d, e)) && (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c;
39018			} };
39019	}), k.focusinBubbles || n.each({ focus: "focusin", blur: "focusout" }, function (a, b) {
39020		var c = function c(a) {
39021			n.event.simulate(b, a.target, n.event.fix(a), !0);
39022		};n.event.special[b] = { setup: function setup() {
39023				var d = this.ownerDocument || this,
39024				    e = L.access(d, b);e || d.addEventListener(a, c, !0), L.access(d, b, (e || 0) + 1);
39025			}, teardown: function teardown() {
39026				var d = this.ownerDocument || this,
39027				    e = L.access(d, b) - 1;e ? L.access(d, b, e) : (d.removeEventListener(a, c, !0), L.remove(d, b));
39028			} };
39029	}), n.fn.extend({ on: function on(a, b, c, d, e) {
39030			var f, g;if ("object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a))) {
39031				"string" != typeof b && (c = c || b, b = void 0);for (g in a) {
39032					this.on(g, b, c, a[g], e);
39033				}return this;
39034			}if (null == c && null == d ? (d = b, c = b = void 0) : null == d && ("string" == typeof b ? (d = c, c = void 0) : (d = c, c = b, b = void 0)), d === !1) d = $;else if (!d) return this;return 1 === e && (f = d, d = function d(a) {
39035				return n().off(a), f.apply(this, arguments);
39036			}, d.guid = f.guid || (f.guid = n.guid++)), this.each(function () {
39037				n.event.add(this, a, d, c, b);
39038			});
39039		}, one: function one(a, b, c, d) {
39040			return this.on(a, b, c, d, 1);
39041		}, off: function off(a, b, c) {
39042			var d, e;if (a && a.preventDefault && a.handleObj) return d = a.handleObj, n(a.delegateTarget).off(d.namespace ? d.origType + "." + d.namespace : d.origType, d.selector, d.handler), this;if ("object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a))) {
39043				for (e in a) {
39044					this.off(e, b, a[e]);
39045				}return this;
39046			}return (b === !1 || "function" == typeof b) && (c = b, b = void 0), c === !1 && (c = $), this.each(function () {
39047				n.event.remove(this, a, c, b);
39048			});
39049		}, trigger: function trigger(a, b) {
39050			return this.each(function () {
39051				n.event.trigger(a, b, this);
39052			});
39053		}, triggerHandler: function triggerHandler(a, b) {
39054			var c = this[0];return c ? n.event.trigger(a, b, c, !0) : void 0;
39055		} });var aa = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
39056	    ba = /<([\w:]+)/,
39057	    ca = /<|&#?\w+;/,
39058	    da = /<(?:script|style|link)/i,
39059	    ea = /checked\s*(?:[^=]|=\s*.checked.)/i,
39060	    fa = /^$|\/(?:java|ecma)script/i,
39061	    ga = /^true\/(.*)/,
39062	    ha = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
39063	    ia = { option: [1, "<select multiple='multiple'>", "</select>"], thead: [1, "<table>", "</table>"], col: [2, "<table><colgroup>", "</colgroup></table>"], tr: [2, "<table><tbody>", "</tbody></table>"], td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], _default: [0, "", ""] };ia.optgroup = ia.option, ia.tbody = ia.tfoot = ia.colgroup = ia.caption = ia.thead, ia.th = ia.td;function ja(a, b) {
39064		return n.nodeName(a, "table") && n.nodeName(11 !== b.nodeType ? b : b.firstChild, "tr") ? a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")) : a;
39065	}function ka(a) {
39066		return a.type = (null !== a.getAttribute("type")) + "/" + a.type, a;
39067	}function la(a) {
39068		var b = ga.exec(a.type);return b ? a.type = b[1] : a.removeAttribute("type"), a;
39069	}function ma(a, b) {
39070		for (var c = 0, d = a.length; d > c; c++) {
39071			L.set(a[c], "globalEval", !b || L.get(b[c], "globalEval"));
39072		}
39073	}function na(a, b) {
39074		var c, d, e, f, g, h, i, j;if (1 === b.nodeType) {
39075			if (L.hasData(a) && (f = L.access(a), g = L.set(b, f), j = f.events)) {
39076				delete g.handle, g.events = {};for (e in j) {
39077					for (c = 0, d = j[e].length; d > c; c++) {
39078						n.event.add(b, e, j[e][c]);
39079					}
39080				}
39081			}M.hasData(a) && (h = M.access(a), i = n.extend({}, h), M.set(b, i));
39082		}
39083	}function oa(a, b) {
39084		var c = a.getElementsByTagName ? a.getElementsByTagName(b || "*") : a.querySelectorAll ? a.querySelectorAll(b || "*") : [];return void 0 === b || b && n.nodeName(a, b) ? n.merge([a], c) : c;
39085	}function pa(a, b) {
39086		var c = b.nodeName.toLowerCase();"input" === c && T.test(a.type) ? b.checked = a.checked : ("input" === c || "textarea" === c) && (b.defaultValue = a.defaultValue);
39087	}n.extend({ clone: function clone(a, b, c) {
39088			var d,
39089			    e,
39090			    f,
39091			    g,
39092			    h = a.cloneNode(!0),
39093			    i = n.contains(a.ownerDocument, a);if (!(k.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || n.isXMLDoc(a))) for (g = oa(h), f = oa(a), d = 0, e = f.length; e > d; d++) {
39094				pa(f[d], g[d]);
39095			}if (b) if (c) for (f = f || oa(a), g = g || oa(h), d = 0, e = f.length; e > d; d++) {
39096				na(f[d], g[d]);
39097			} else na(a, h);return g = oa(h, "script"), g.length > 0 && ma(g, !i && oa(a, "script")), h;
39098		}, buildFragment: function buildFragment(a, b, c, d) {
39099			for (var e, f, g, h, i, j, k = b.createDocumentFragment(), l = [], m = 0, o = a.length; o > m; m++) {
39100				if (e = a[m], e || 0 === e) if ("object" === n.type(e)) n.merge(l, e.nodeType ? [e] : e);else if (ca.test(e)) {
39101					f = f || k.appendChild(b.createElement("div")), g = (ba.exec(e) || ["", ""])[1].toLowerCase(), h = ia[g] || ia._default, f.innerHTML = h[1] + e.replace(aa, "<$1></$2>") + h[2], j = h[0];while (j--) {
39102						f = f.lastChild;
39103					}n.merge(l, f.childNodes), f = k.firstChild, f.textContent = "";
39104				} else l.push(b.createTextNode(e));
39105			}k.textContent = "", m = 0;while (e = l[m++]) {
39106				if ((!d || -1 === n.inArray(e, d)) && (i = n.contains(e.ownerDocument, e), f = oa(k.appendChild(e), "script"), i && ma(f), c)) {
39107					j = 0;while (e = f[j++]) {
39108						fa.test(e.type || "") && c.push(e);
39109					}
39110				}
39111			}return k;
39112		}, cleanData: function cleanData(a) {
39113			for (var b, c, d, e, f = n.event.special, g = 0; void 0 !== (c = a[g]); g++) {
39114				if (n.acceptData(c) && (e = c[L.expando], e && (b = L.cache[e]))) {
39115					if (b.events) for (d in b.events) {
39116						f[d] ? n.event.remove(c, d) : n.removeEvent(c, d, b.handle);
39117					}L.cache[e] && delete L.cache[e];
39118				}delete M.cache[c[M.expando]];
39119			}
39120		} }), n.fn.extend({ text: function text(a) {
39121			return J(this, function (a) {
39122				return void 0 === a ? n.text(this) : this.empty().each(function () {
39123					(1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && (this.textContent = a);
39124				});
39125			}, null, a, arguments.length);
39126		}, append: function append() {
39127			return this.domManip(arguments, function (a) {
39128				if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
39129					var b = ja(this, a);b.appendChild(a);
39130				}
39131			});
39132		}, prepend: function prepend() {
39133			return this.domManip(arguments, function (a) {
39134				if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
39135					var b = ja(this, a);b.insertBefore(a, b.firstChild);
39136				}
39137			});
39138		}, before: function before() {
39139			return this.domManip(arguments, function (a) {
39140				this.parentNode && this.parentNode.insertBefore(a, this);
39141			});
39142		}, after: function after() {
39143			return this.domManip(arguments, function (a) {
39144				this.parentNode && this.parentNode.insertBefore(a, this.nextSibling);
39145			});
39146		}, remove: function remove(a, b) {
39147			for (var c, d = a ? n.filter(a, this) : this, e = 0; null != (c = d[e]); e++) {
39148				b || 1 !== c.nodeType || n.cleanData(oa(c)), c.parentNode && (b && n.contains(c.ownerDocument, c) && ma(oa(c, "script")), c.parentNode.removeChild(c));
39149			}return this;
39150		}, empty: function empty() {
39151			for (var a, b = 0; null != (a = this[b]); b++) {
39152				1 === a.nodeType && (n.cleanData(oa(a, !1)), a.textContent = "");
39153			}return this;
39154		}, clone: function clone(a, b) {
39155			return a = null == a ? !1 : a, b = null == b ? a : b, this.map(function () {
39156				return n.clone(this, a, b);
39157			});
39158		}, html: function html(a) {
39159			return J(this, function (a) {
39160				var b = this[0] || {},
39161				    c = 0,
39162				    d = this.length;if (void 0 === a && 1 === b.nodeType) return b.innerHTML;if ("string" == typeof a && !da.test(a) && !ia[(ba.exec(a) || ["", ""])[1].toLowerCase()]) {
39163					a = a.replace(aa, "<$1></$2>");try {
39164						for (; d > c; c++) {
39165							b = this[c] || {}, 1 === b.nodeType && (n.cleanData(oa(b, !1)), b.innerHTML = a);
39166						}b = 0;
39167					} catch (e) {}
39168				}b && this.empty().append(a);
39169			}, null, a, arguments.length);
39170		}, replaceWith: function replaceWith() {
39171			var a = arguments[0];return this.domManip(arguments, function (b) {
39172				a = this.parentNode, n.cleanData(oa(this)), a && a.replaceChild(b, this);
39173			}
39173), a && (a.length || a.nodeType) ? this : this.remove();
39174		}, detach: function detach(a) {
39175			return this.remove(a, !0);
39176		}, domManip: function domManip(a, b) {
39177			a = e.apply([], a);var c,
39178			    d,
39179			    f,
39180			    g,
39181			    h,
39182			    i,
39183			    j = 0,
39184			    l = this.length,
39185			    m = this,
39186			    o = l - 1,
39187			    p = a[0],
39188			    q = n.isFunction(p);if (q || l > 1 && "string" == typeof p && !k.checkClone && ea.test(p)) return this.each(function (c) {
39189				var d = m.eq(c);q && (a[0] = p.call(this, c, d.html())), d.domManip(a, b);
39190			});if (l && (c = n.buildFragment(a, this[0].ownerDocument, !1, this), d = c.firstChild, 1 === c.childNodes.length && (c = d), d)) {
39191				for (f = n.map(oa(c, "script"), ka), g = f.length; l > j; j++) {
39192					h = c, j !== o && (h = n.clone(h, !0, !0), g && n.merge(f, oa(h, "script"))), b.call(this[j], h, j);
39193				}if (g) for (i = f[f.length - 1].ownerDocument, n.map(f, la), j = 0; g > j; j++) {
39194					h = f[j], fa.test(h.type || "") && !L.access(h, "globalEval") && n.contains(i, h) && (h.src ? n._evalUrl && n._evalUrl(h.src) : n.globalEval(h.textContent.replace(ha, "")));
39195				}
39196			}return this;
39197		} }), n.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (a, b) {
39198		n.fn[a] = function (a) {
39199			for (var c, d = [], e = n(a), g = e.length - 1, h = 0; g >= h; h++) {
39200				c = h === g ? this : this.clone(!0), n(e[h])[b](c), f.apply(d, c.get());
39201			}return this.pushStack(d);
39202		};
39203	});var qa,
39204	    ra = {};function sa(b, c) {
39205		var d,
39206		    e = n(c.createElement(b)).appendTo(c.body),
39207		    f = a.getDefaultComputedStyle && (d = a.getDefaultComputedStyle(e[0])) ? d.display : n.css(e[0], "display");return e.detach(), f;
39208	}function ta(a) {
39209		var b = l,
39210		    c = ra[a];return c || (c = sa(a, b), "none" !== c && c || (qa = (qa || n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement), b = qa[0].contentDocument, b.write(), b.close(), c = sa(a, b), qa.detach()), ra[a] = c), c;
39211	}var ua = /^margin/,
39212	    va = new RegExp("^(" + Q + ")(?!px)[a-z%]+$", "i"),
39213	    wa = function wa(b) {
39214		return b.ownerDocument.defaultView.opener ? b.ownerDocument.defaultView.getComputedStyle(b, null) : a.getComputedStyle(b, null);
39215	};function xa(a, b, c) {
39216		var d,
39217		    e,
39218		    f,
39219		    g,
39220		    h = a.style;return c = c || wa(a), c && (g = c.getPropertyValue(b) || c[b]), c && ("" !== g || n.contains(a.ownerDocument, a) || (g = n.style(a, b)), va.test(g) && ua.test(b) && (d = h.width, e = h.minWidth, f = h.maxWidth, h.minWidth = h.maxWidth = h.width = g, g = c.width, h.width = d, h.minWidth = e, h.maxWidth = f)), void 0 !== g ? g + "" : g;
39221	}function ya(a, b) {
39222		return { get: function get() {
39223				return a() ? void delete this.get : (this.get = b).apply(this, arguments);
39224			} };
39225	}!function () {
39226		var b,
39227		    c,
39228		    d = l.documentElement,
39229		    e = l.createElement("div"),
39230		    f = l.createElement("div");if (f.style) {
39231			var _g = function _g() {
39232				f.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute", f.innerHTML = "", d.appendChild(e);var g = a.getComputedStyle(f, null);b = "1%" !== g.top, c = "4px" === g.width, d.removeChild(e);
39233			};
39234
39235			f.style.backgroundClip = "content-box", f.cloneNode(!0).style.backgroundClip = "", k.clearCloneStyle = "content-box" === f.style.backgroundClip, e.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute", e.appendChild(f);a.getComputedStyle && n.extend(k, { pixelPosition: function pixelPosition() {
39236					return _g(), b;
39237				}, boxSizingReliable: function boxSizingReliable() {
39238					return null == c && _g(), c;
39239				}, reliableMarginRight: function reliableMarginRight() {
39240					var b,
39241					    c = f.appendChild(l.createElement("div"));return c.style.cssText = f.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0", c.style.marginRight = c.style.width = "0", f.style.width = "1px", d.appendChild(e), b = !parseFloat(a.getComputedStyle(c, null).marginRight), d.removeChild(e), f.removeChild(c), b;
39242				} });
39243		}
39244	}(), n.swap = function (a, b, c, d) {
39245		var e,
39246		    f,
39247		    g = {};for (f in b) {
39248			g[f] = a.style[f], a.style[f] = b[f];
39249		}e = c.apply(a, d || []);for (f in b) {
39250			a.style[f] = g[f];
39251		}return e;
39252	};var za = /^(none|table(?!-c[ea]).+)/,
39253	    Aa = new RegExp("^(" + Q + ")(.*)$", "i"),
39254	    Ba = new RegExp("^([+-])=(" + Q + ")", "i"),
39255	    Ca = { position: "absolute", visibility: "hidden", display: "block" },
39256	    Da = { letterSpacing: "0", fontWeight: "400" },
39257	    Ea = ["Webkit", "O", "Moz", "ms"];function Fa(a, b) {
39258		if (b in a) return b;var c = b[0].toUpperCase() + b.slice(1),
39259		    d = b,
39260		    e = Ea.length;while (e--) {
39261			if (b = Ea[e] + c, b in a) return b;
39262		}return d;
39263	}function Ga(a, b, c) {
39264		var d = Aa.exec(b);return d ? Math.max(0, d[1] - (c || 0)) + (d[2] || "px") : b;
39265	}function Ha(a, b, c, d, e) {
39266		for (var f = c === (d ? "border" : "content") ? 4 : "width" === b ? 1 : 0, g = 0; 4 > f; f += 2) {
39267			"margin" === c && (g += n.css(a, c + R[f], !0, e)), d ? ("content" === c && (g -= n.css(a, "padding" + R[f], !0, e)), "margin" !== c && (g -= n.css(a, "border" + R[f] + "Width", !0, e))) : (g += n.css(a, "padding" + R[f], !0, e), "padding" !== c && (g += n.css(a, "border" + R[f] + "Width", !0, e)));
39268		}return g;
39269	}function Ia(a, b, c) {
39270		var d = !0,
39271		    e = "width" === b ? a.offsetWidth : a.offsetHeight,
39272		    f = wa(a),
39273		    g = "border-box" === n.css(a, "boxSizing", !1, f);if (0 >= e || null == e) {
39274			if (e = xa(a, b, f), (0 > e || null == e) && (e = a.style[b]), va.test(e)) return e;d = g && (k.boxSizingReliable() || e === a.style[b]), e = parseFloat(e) || 0;
39275		}return e + Ha(a, b, c || (g ? "border" : "content"), d, f) + "px";
39276	}function Ja(a, b) {
39277		for (var c, d, e, f = [], g = 0, h = a.length; h > g; g++) {
39278			d = a[g], d.style && (f[g] = L.get(d, "olddisplay"), c = d.style.display, b ? (f[g] || "none" !== c || (d.style.display = ""), "" === d.style.display && S(d) && (f[g] = L.access(d, "olddisplay", ta(d.nodeName)))) : (e = S(d), "none" === c && e || L.set(d, "olddisplay", e ? c : n.css(d, "display"))));
39279		}for (g = 0; h > g; g++) {
39280			d = a[g], d.style && (b && "none" !== d.style.display && "" !== d.style.display || (d.style.display = b ? f[g] || "" : "none"));
39281		}return a;
39282	}n.extend({ cssHooks: { opacity: { get: function get(a, b) {
39283					if (b) {
39284						var c = xa(a, "opacity");return "" === c ? "1" : c;
39285					}
39286				} } }, cssNumber: { columnCount: !0, fillOpacity: !0, flexGrow: !0, flexShrink: !0, fontWeight: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, widows: !0, zIndex: !0, zoom: !0 }, cssProps: { "float": "cssFloat" }, style: function style(a, b, c, d) {
39287			if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) {
39288				var e,
39289				    f,
39290				    g,
39291				    h = n.camelCase(b),
39292				    i = a.style;return b = n.cssProps[h] || (n.cssProps[h] = Fa(i, h)), g = n.cssHooks[b] || n.cssHooks[h], void 0 === c ? g && "get" in g && void 0 !== (e = g.get(a, !1, d)) ? e : i[b] : (f = typeof c === "undefined" ? "undefined" : (0, _typeof3.default)(c), "string" === f && (e = Ba.exec(c)) && (c = (e[1] + 1) * e[2] + parseFloat(n.css(a, b)), f = "number"), null != c && c === c && ("number" !== f || n.cssNumber[h] || (c += "px"), k.clearCloneStyle || "" !== c || 0 !== b.indexOf("background") || (i[b] = "inherit"), g && "set" in g && void 0 === (c = g.set(a, c, d)) || (i[b] = c)), void 0);
39293			}
39294		}, css: function css(a, b, c, d) {
39295			var e,
39296			    f,
39297			    g,
39298			    h = n.camelCase(b);return b = n.cssProps[h] || (n.cssProps[h] = Fa(a.style, h)), g = n.cssHooks[b] || n.cssHooks[h], g && "get" in g && (e = g.get(a, !0, c)), void 0 === e && (e = xa(a, b, d)), "normal" === e && b in Da && (e = Da[b]), "" === c || c ? (f = parseFloat(e), c === !0 || n.isNumeric(f) ? f || 0 : e) : e;
39299		} }), n.each(["height", "width"], function (a, b) {
39300		n.cssHooks[b] = { get: function get(a, c, d) {
39301				return c ? za.test(n.css(a, "display")) && 0 === a.offsetWidth ? n.swap(a, Ca, function () {
39302					return Ia(a, b, d);
39303				}) : Ia(a, b, d) : void 0;
39304			}, set: function set(a, c, d) {
39305				var e = d && wa(a);return Ga(a, c, d ? Ha(a, b, d, "border-box" === n.css(a, "boxSizing", !1, e), e) : 0);
39306			} };
39307	}), n.cssHooks.marginRight = ya(k.reliableMarginRight, function (a, b) {
39308		return b ? n.swap(a, { display: "inline-block" }, xa, [a, "marginRight"]) : void 0;
39309	}), n.each({ margin: "", padding: "", border: "Width" }, function (a, b) {
39310		n.cssHooks[a + b] = { expand: function expand(c) {
39311				for (var d = 0, e = {}, f = "string" == typeof c ? c.split(" ") : [c]; 4 > d; d++) {
39312					e[a + R[d] + b] = f[d] || f[d - 2] || f[0];
39313				}return e;
39314			} }, ua.test(a) || (n.cssHooks[a + b].set = Ga);
39315	}), n.fn.extend({ css: function css(a, b) {
39316			return J(this, function (a, b, c) {
39317				var d,
39318				    e,
39319				    f = {},
39320				    g = 0;if (n.isArray(b)) {
39321					for (d = wa(a), e = b.length; e > g; g++) {
39322						f[b[g]] = n.css(a, b[g], !1, d);
39323					}return f;
39324				}return void 0 !== c ? n.style(a, b, c) : n.css(a, b);
39325			}, a, b, arguments.length > 1);
39326		}, show: function show() {
39327			return Ja(this, !0);
39328		}, hide: function hide() {
39329			return Ja(this);
39330		}, toggle: function toggle(a) {
39331			return "boolean" == typeof a ? a ? this.show() : this.hide() : this.each(function () {
39332				S(this) ? n(this).show() : n(this).hide();
39333			});
39334		} });function Ka(a, b, c, d, e) {
39335		return new Ka.prototype.init(a, b, c, d, e);
39336	}n.Tween = Ka, Ka.prototype = { constructor: Ka, init: function init(a, b, c, d, e, f) {
39337			this.elem = a, this.prop = c, this.easing = e || "swing", this.options = b, this.start = this.now = this.cur(), this.end = d, this.unit = f || (n.cssNumber[c] ? "" : "px");
39338		}, cur: function cur() {
39339			var a = Ka.propHooks[this.prop];return a && a.get ? a.get(this) : Ka.propHooks._default.get(this);
39340		}, run: function run(a) {
39341			var b,
39342			    c = Ka.propHooks[this.prop];return this.options.duration ? this.pos = b = n.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : this.pos = b = a, this.now = (this.end 
39342- this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : Ka.propHooks._default.set(this), this;
39343		} }, Ka.prototype.init.prototype = Ka.prototype, Ka.propHooks = { _default: { get: function get(a) {
39344				var b;return null == a.elem[a.prop] || a.elem.style && null != a.elem.style[a.prop] ? (b = n.css(a.elem, a.prop, ""), b && "auto" !== b ? b : 0) : a.elem[a.prop];
39345			}, set: function set(a) {
39346				n.fx.step[a.prop] ? n.fx.step[a.prop](a) : a.elem.style && (null != a.elem.style[n.cssProps[a.prop]] || n.cssHooks[a.prop]) ? n.style(a.elem, a.prop, a.now + a.unit) : a.elem[a.prop] = a.now;
39347			} } }, Ka.propHooks.scrollTop = Ka.propHooks.scrollLeft = { set: function set(a) {
39348			a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now);
39349		} }, n.easing = { linear: function linear(a) {
39350			return a;
39351		}, swing: function swing(a) {
39352			return .5 - Math.cos(a * Math.PI) / 2;
39353		} }, n.fx = Ka.prototype.init, n.fx.step = {};var La,
39354	    Ma,
39355	    Na = /^(?:toggle|show|hide)$/,
39356	    Oa = new RegExp("^(?:([+-])=|)(" + Q + ")([a-z%]*)$", "i"),
39357	    Pa = /queueHooks$/,
39358	    Qa = [Va],
39359	    Ra = { "*": [function (a, b) {
39360			var c = this.createTween(a, b),
39361			    d = c.cur(),
39362			    e = Oa.exec(b),
39363			    f = e && e[3] || (n.cssNumber[a] ? "" : "px"),
39364			    g = (n.cssNumber[a] || "px" !== f && +d) && Oa.exec(n.css(c.elem, a)),
39365			    h = 1,
39366			    i = 20;if (g && g[3] !== f) {
39367				f = f || g[3], e = e || [], g = +d || 1;do {
39368					h = h || ".5", g /= h, n.style(c.elem, a, g + f);
39369				} while (h !== (h = c.cur() / d) && 1 !== h && --i);
39370			}return e && (g = c.start = +g || +d || 0, c.unit = f, c.end = e[1] ? g + (e[1] + 1) * e[2] : +e[2]), c;
39371		}] };function Sa() {
39372		return setTimeout(function () {
39373			La = void 0;
39374		}), La = n.now();
39375	}function Ta(a, b) {
39376		var c,
39377		    d = 0,
39378		    e = { height: a };for (b = b ? 1 : 0; 4 > d; d += 2 - b) {
39379			c = R[d], e["margin" + c] = e["padding" + c] = a;
39380		}return b && (e.opacity = e.width = a), e;
39381	}function Ua(a, b, c) {
39382		for (var d, e = (Ra[b] || []).concat(Ra["*"]), f = 0, g = e.length; g > f; f++) {
39383			if (d = e[f].call(c, b, a)) return d;
39384		}
39385	}function Va(a, b, c) {
39386		var d,
39387		    e,
39388		    f,
39389		    g,
39390		    h,
39391		    i,
39392		    j,
39393		    k,
39394		    l = this,
39395		    m = {},
39396		    o = a.style,
39397		    p = a.nodeType && S(a),
39398		    q = L.get(a, "fxshow");c.queue || (h = n._queueHooks(a, "fx"), null == h.unqueued && (h.unqueued = 0, i = h.empty.fire, h.empty.fire = function () {
39399			h.unqueued || i();
39400		}), h.unqueued++, l.always(function () {
39401			l.always(function () {
39402				h.unqueued--, n.queue(a, "fx").length || h.empty.fire();
39403			});
39404		})), 1 === a.nodeType && ("height" in b || "width" in b) && (c.overflow = [o.overflow, o.overflowX, o.overflowY], j = n.css(a, "display"), k = "none" === j ? L.get(a, "olddisplay") || ta(a.nodeName) : j, "inline" === k && "none" === n.css(a, "float") && (o.display = "inline-block")), c.overflow && (o.overflow = "hidden", l.always(function () {
39405			o.overflow = c.overflow[0], o.overflowX = c.overflow[1], o.overflowY = c.overflow[2];
39406		}));for (d in b) {
39407			if (e = b[d], Na.exec(e)) {
39408				if (delete b[d], f = f || "toggle" === e, e === (p ? "hide" : "show")) {
39409					if ("show" !== e || !q || void 0 === q[d]) continue;p = !0;
39410				}m[d] = q && q[d] || n.style(a, d);
39411			} else j = void 0;
39412		}if (n.isEmptyObject(m)) "inline" === ("none" === j ? ta(a.nodeName) : j) && (o.display = j);else {
39413			q ? "hidden" in q && (p = q.hidden) : q = L.access(a, "fxshow", {}), f && (q.hidden = !p), p ? n(a).show() : l.done(function () {
39414				n(a).hide();
39415			}), l.done(function () {
39416				var b;L.remove(a, "fxshow");for (b in m) {
39417					n.style(a, b, m[b]);
39418				}
39419			});for (d in m) {
39420				g = Ua(p ? q[d] : 0, d, l), d in q || (q[d] = g.start, p && (g.end = g.start, g.start = "width" === d || "height" === d ? 1 : 0));
39421			}
39422		}
39423	}function Wa(a, b) {
39424		var c, d, e, f, g;for (c in a) {
39425			if (d = n.camelCase(c), e = b[d], f = a[c], n.isArray(f) && (e = f[1], f = a[c] = f[0]), c !== d && (a[d] = f, delete a[c]), g = n.cssHooks[d], g && "expand" in g) {
39426				f = g.expand(f), delete a[d];for (c in f) {
39427					c in a || (a[c] = f[c], b[c] = e);
39428				}
39429			} else b[d] = e;
39430		}
39431	}function Xa(a, b, c) {
39432		var d,
39433		    e,
39434		    f = 0,
39435		    g = Qa.length,
39436		    h = n.Deferred().always(function () {
39437			delete i.elem;
39438		}),
39439		    i = function i() {
39440			if (e) return !1;for (var b = La || Sa(), c = Math.max(0, j.startTime + j.duration - b), d = c / j.duration || 0, f = 1 - d, g = 0, i = j.tweens.length; i > g; g++) {
39441				j.tweens[g].run(f);
39442			}return h.notifyWith(a, [j, f, c]), 1 > f && i ? c : (h.resolveWith(a, [j]), !1);
39443		},
39444		    j = h.promise({ elem: a, props: n.extend({}, b), opts: n.extend(!0, { specialEasing: {} }, c), originalProperties: b, originalOptions: c, startTime: La || Sa(), duration: c.duration, tweens: [], createTween: function createTween(b, c) {
39445				var d = n.Tween(a, j.opts, b, c, j.opts.specialEasing[b] || j.opts.easing);return j.tweens.push(d), d;
39446			}, stop: function stop(b) {
39447				var c = 0,
39448				    d = b ? j.tweens.length : 0;if (e) return this;for (e = !0; d > c; c++) {
39449					j.tweens[c].run(1);
39450				}return b ? h.resolveWith(a, [j, b]) : h.rejectWith(a, [j, b]), this;
39451			} }),
39452		    k = j.props;for (Wa(k, j.opts.specialEasing); g > f; f++) {
39453			if (d = Qa[f].call(j, a, k, j.opts)) return d;
39454		}return n.map(k, Ua, j), n.isFunction(j.opts.start) && j.opts.start.call(a, j), n.fx.timer(n.extend(i, { elem: a, anim: j, queue: j.opts.queue })), j.progress(j.opts.progress).done(j.opts.done, j.opts.complete).fail(j.opts.fail).always(j.opts.always);
39455	}n.Animation = n.extend(Xa, { tweener: function tweener(a, b) {
39456			n.isFunction(a) ? (b = a, a = ["*"]) : a = a.split(" ");for (var c, d = 0, e = a.length; e > d; d++) {
39457				c = a[d], Ra[c] = Ra[c] || [], Ra[c].unshift(b);
39458			}
39459		}, prefilter: function prefilter(a, b) {
39460			b ? Qa.unshift(a) : Qa.push(a);
39461		} }), n.speed = function (a, b, c) {
39462		var d = a && "object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) ? n.extend({}, a) : { complete: c || !c && b || n.isFunction(a) && a, duration: a, easing: c && b || b && !n.isFunction(b) && b };return d.duration = n.fx.off ? 0 : "number" == typeof d.duration ? d.duration : d.duration in n.fx.speeds ? n.fx.speeds[d.duration] : n.fx.speeds._default, (null == d.queue || d.queue === !0) && (d.queue = "fx"), d.old = d.complete, d.complete = function () {
39463			n.isFunction(d.old) && d.old.call(this), d.queue && n.dequeue(this, d.queue);
39464		}, d;
39465	}, n.fn.extend({ fadeTo: function fadeTo(a, b, c, d) {
39466			return this.filter(S).css("opacity", 0).show().end().animate({ opacity: b }, a, c, d);
39467		}, animate: function animate(a, b, c, d) {
39468			var e = n.isEmptyObject(a),
39469			    f = n.speed(b, c, d),
39470			    g = function g() {
39471				var b = Xa(this, n.extend({}, a), f);(e || L.get(this, "finish")) && b.stop(!0);
39472			};return g.finish = g, e || f.queue === !1 ? this.each(g) : this.queue(f.queue, g);
39473		}, stop: function stop(a, b, c) {
39474			var d = function d(a) {
39475				var b = a.stop;delete a.stop, b(c);
39476			};return "string" != typeof a && (c = b, b = a, a = void 0), b && a !== !1 && this.queue(a || "fx", []), this.each(function () {
39477				var b = !0,
39478				    e = null != a && a + "queueHooks",
39479				    f = n.timers,
39480				    g = L.get(this);if (e) g[e] && g[e].stop && d(g[e]);else for (e in g) {
39481					g[e] && g[e].stop && Pa.test(e) && d(g[e]);
39482				}for (e = f.length; e--;) {
39483					f[e].elem !== this || null != a && f[e].queue !== a || (f[e].anim.stop(c), b = !1, f.splice(e, 1));
39484				}(b || !c) && n.dequeue(this, a);
39485			});
39486		}, finish: function finish(a) {
39487			return a !== !1 && (a = a || "fx"), this.each(function () {
39488				var b,
39489				    c = L.get(this),
39490				    d = c[a + "queue"],
39491				    e = c[a + "queueHooks"],
39492				    f = n.timers,
39493				    g = d ? d.length : 0;for (c.finish = !0, n.queue(this, a, []), e && e.stop && e.stop.call(this, !0), b = f.length; b--;) {
39494					f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1));
39495				}for (b = 0; g > b; b++) {
39496					d[b] && d[b].finish && d[b].finish.call(this);
39497				}delete c.finish;
39498			});
39499		} }), n.each(["toggle", "show", "hide"], function (a, b) {
39500		var c = n.fn[b];n.fn[b] = function (a, d, e) {
39501			return null == a || "boolean" == typeof a ? c.apply(this, arguments) : this.animate(Ta(b, !0), a, d, e);
39502		};
39503	}), n.each({ slideDown: Ta("show"), slideUp: Ta("hide"), slideToggle: Ta("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function (a, b) {
39504		n.fn[a] = function (a, c, d) {
39505			return this.animate(b, a, c, d);
39506		};
39507	}), n.timers = [], n.fx.tick = function () {
39508		var a,
39509		    b = 0,
39510		    c = n.timers;for (La = n.now(); b < c.length; b++) {
39511			a = c[b], a() || c[b] !== a || c.splice(b--, 1);
39512		}c.length || n.fx.stop(), La = void 0;
39513	}, n.fx.timer = function (a) {
39514		n.timers.push(a), a() ? n.fx.start() : n.timers.pop();
39515	}, n.fx.interval = 13, n.fx.start = function () {
39516		Ma || (Ma = setInterval(n.fx.tick, n.fx.interval));
39517	}, n.fx.stop = function () {
39518		clearInterval(Ma), Ma = null;
39519	}, n.fx.speeds = { slow: 600, fast: 200, _default: 400 }
39519, n.fn.delay = function (a, b) {
39520		return a = n.fx ? n.fx.speeds[a] || a : a, b = b || "fx", this.queue(b, function (b, c) {
39521			var d = setTimeout(b, a);c.stop = function () {
39522				clearTimeout(d);
39523			};
39524		});
39525	}, function () {
39526		var a = l.createElement("input"),
39527		    b = l.createElement("select"),
39528		    c = b.appendChild(l.createElement("option"));a.type = "checkbox", k.checkOn = "" !== a.value, k.optSelected = c.selected, b.disabled = !0, k.optDisabled = !c.disabled, a = l.createElement("input"), a.value = "t", a.type = "radio", k.radioValue = "t" === a.value;
39529	}();var Ya,
39530	    Za,
39531	    $a = n.expr.attrHandle;n.fn.extend({ attr: function attr(a, b) {
39532			return J(this, n.attr, a, b, arguments.length > 1);
39533		}, removeAttr: function removeAttr(a) {
39534			return this.each(function () {
39535				n.removeAttr(this, a);
39536			});
39537		} }), n.extend({ attr: function attr(a, b, c) {
39538			var d,
39539			    e,
39540			    f = a.nodeType;if (a && 3 !== f && 8 !== f && 2 !== f) return (0, _typeof3.default)(a.getAttribute) === U ? n.prop(a, b, c) : (1 === f && n.isXMLDoc(a) || (b = b.toLowerCase(), d = n.attrHooks[b] || (n.expr.match.bool.test(b) ? Za : Ya)), void 0 === c ? d && "get" in d && null !== (e = d.get(a, b)) ? e : (e = n.find.attr(a, b), null == e ? void 0 : e) : null !== c ? d && "set" in d && void 0 !== (e = d.set(a, c, b)) ? e : (a.setAttribute(b, c + ""), c) : void n.removeAttr(a, b));
39541		}, removeAttr: function removeAttr(a, b) {
39542			var c,
39543			    d,
39544			    e = 0,
39545			    f = b && b.match(E);if (f && 1 === a.nodeType) while (c = f[e++]) {
39546				d = n.propFix[c] || c, n.expr.match.bool.test(c) && (a[d] = !1), a.removeAttribute(c);
39547			}
39548		}, attrHooks: { type: { set: function set(a, b) {
39549					if (!k.radioValue && "radio" === b && n.nodeName(a, "input")) {
39550						var c = a.value;return a.setAttribute("type", b), c && (a.value = c), b;
39551					}
39552				} } } }), Za = { set: function set(a, b, c) {
39553			return b === !1 ? n.removeAttr(a, c) : a.setAttribute(c, c), c;
39554		} }, n.each(n.expr.match.bool.source.match(/\w+/g), function (a, b) {
39555		var c = $a[b] || n.find.attr;$a[b] = function (a, b, d) {
39556			var e, f;return d || (f = $a[b], $a[b] = e, e = null != c(a, b, d) ? b.toLowerCase() : null, $a[b] = f), e;
39557		};
39558	});var _a = /^(?:input|select|textarea|button)$/i;n.fn.extend({ prop: function prop(a, b) {
39559			return J(this, n.prop, a, b, arguments.length > 1);
39560		}, removeProp: function removeProp(a) {
39561			return this.each(function () {
39562				delete this[n.propFix[a] || a];
39563			});
39564		} }), n.extend({ propFix: { "for": "htmlFor", "class": "className" }, prop: function prop(a, b, c) {
39565			var d,
39566			    e,
39567			    f,
39568			    g = a.nodeType;if (a && 3 !== g && 8 !== g && 2 !== g) return f = 1 !== g || !n.isXMLDoc(a), f && (b = n.propFix[b] || b, e = n.propHooks[b]), void 0 !== c ? e && "set" in e && void 0 !== (d = e.set(a, c, b)) ? d : a[b] = c : e && "get" in e && null !== (d = e.get(a, b)) ? d : a[b];
39569		}, propHooks: { tabIndex: { get: function get(a) {
39570					return a.hasAttribute("tabindex") || _a.test(a.nodeName) || a.href ? a.tabIndex : -1;
39571				} } } }), k.optSelected || (n.propHooks.selected = { get: function get(a) {
39572			var b = a.parentNode;return b && b.parentNode && b.parentNode.selectedIndex, null;
39573		} }), n.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
39574		n.propFix[this.toLowerCase()] = this;
39575	});var ab = /[\t\r\n\f]/g;n.fn.extend({ addClass: function addClass(a) {
39576			var b,
39577			    c,
39578			    d,
39579			    e,
39580			    f,
39581			    g,
39582			    h = "string" == typeof a && a,
39583			    i = 0,
39584			    j = this.length;if (n.isFunction(a)) return this.each(function (b) {
39585				n(this).addClass(a.call(this, b, this.className));
39586			});if (h) for (b = (a || "").match(E) || []; j > i; i++) {
39587				if (c = this[i], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(ab, " ") : " ")) {
39588					f = 0;while (e = b[f++]) {
39589						d.indexOf(" " + e + " ") < 0 && (d += e + " ");
39590					}g = n.trim(d), c.className !== g && (c.className = g);
39591				}
39592			}return this;
39593		}, removeClass: function removeClass(a) {
39594			var b,
39595			    c,
39596			    d,
39597			    e,
39598			    f,
39599			    g,
39600			    h = 0 === arguments.length || "string" == typeof a && a,
39601			    i = 0,
39602			    j = this.length;if (n.isFunction(a)) return this.each(function (b) {
39603				n(this).removeClass(a.call(this, b, this.className));
39604			});if (h) for (b = (a || "").match(E) || []; j > i; i++) {
39605				if (c = this[i], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(ab, " ") : "")) {
39606					f = 0;while (e = b[f++]) {
39607						while (d.indexOf(" " + e + " ") >= 0) {
39608							d = d.replace(" " + e + " ", " ");
39609						}
39610					}g = a ? n.trim(d) : "", c.className !== g && (c.className = g);
39611				}
39612			}return this;
39613		}, toggleClass: function toggleClass(a, b) {
39614			var c = typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a);return "boolean" == typeof b && "string" === c ? b ? this.addClass(a) : this.removeClass(a) : this.each(n.isFunction(a) ? function (c) {
39615				n(this).toggleClass(a.call(this, c, this.className, b), b);
39616			} : function () {
39617				if ("string" === c) {
39618					var b,
39619					    d = 0,
39620					    e = n(this),
39621					    f = a.match(E) || [];
39621while (b = f[d++]) {
39622						e.hasClass(b) ? e.removeClass(b) : e.addClass(b);
39623					}
39624				} else (c === U || "boolean" === c) && (this.className && L.set(this, "__className__", this.className), this.className = this.className || a === !1 ? "" : L.get(this, "__className__") || "");
39625			});
39626		}, hasClass: function hasClass(a) {
39627			for (var b = " " + a + " ", c = 0, d = this.length; d > c; c++) {
39628				if (1 === this[c].nodeType && (" " + this[c].className + " ").replace(ab, " ").indexOf(b) >= 0) return !0;
39629			}return !1;
39630		} });var bb = /\r/g;n.fn.extend({ val: function val(a) {
39631			var b,
39632			    c,
39633			    d,
39634			    e = this[0];{
39635				if (arguments.length) return d = n.isFunction(a), this.each(function (c) {
39636					var e;1 === this.nodeType && (e = d ? a.call(this, c, n(this).val()) : a, null == e ? e = "" : "number" == typeof e ? e += "" : n.isArray(e) && (e = n.map(e, function (a) {
39637						return null == a ? "" : a + "";
39638					})), b = n.valHooks[this.type] || n.valHooks[this.nodeName.toLowerCase()], b && "set" in b && void 0 !== b.set(this, e, "value") || (this.value = e));
39639				});if (e) return b = n.valHooks[e.type] || n.valHooks[e.nodeName.toLowerCase()], b && "get" in b && void 0 !== (c = b.get(e, "value")) ? c : (c = e.value, "string" == typeof c ? c.replace(bb, "") : null == c ? "" : c);
39640			}
39641		} }), n.extend({ valHooks: { option: { get: function get(a) {
39642					var b = n.find.attr(a, "value");return null != b ? b : n.trim(n.text(a));
39643				} }, select: { get: function get(a) {
39644					for (var b, c, d = a.options, e = a.selectedIndex, f = "select-one" === a.type || 0 > e, g = f ? null : [], h = f ? e + 1 : d.length, i = 0 > e ? h : f ? e : 0; h > i; i++) {
39645						if (c = d[i], !(!c.selected && i !== e || (k.optDisabled ? c.disabled : null !== c.getAttribute("disabled")) || c.parentNode.disabled && n.nodeName(c.parentNode, "optgroup"))) {
39646							if (b = n(c).val(), f) return b;g.push(b);
39647						}
39648					}return g;
39649				}, set: function set(a, b) {
39650					var c,
39651					    d,
39652					    e = a.options,
39653					    f = n.makeArray(b),
39654					    g = e.length;while (g--) {
39655						d = e[g], (d.selected = n.inArray(d.value, f) >= 0) && (c = !0);
39656					}return c || (a.selectedIndex = -1), f;
39657				} } } }), n.each(["radio", "checkbox"], function () {
39658		n.valHooks[this] = { set: function set(a, b) {
39659				return n.isArray(b) ? a.checked = n.inArray(n(a).val(), b) >= 0 : void 0;
39660			} }, k.checkOn || (n.valHooks[this].get = function (a) {
39661			return null === a.getAttribute("value") ? "on" : a.value;
39662		});
39663	}), n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function (a, b) {
39664		n.fn[b] = function (a, c) {
39665			return arguments.length > 0 ? this.on(b, null, a, c) : this.trigger(b);
39666		};
39667	}), n.fn.extend({ hover: function hover(a, b) {
39668			return this.mouseenter(a).mouseleave(b || a);
39669		}, bind: function bind(a, b, c) {
39670			return this.on(a, null, b, c);
39671		}, unbind: function unbind(a, b) {
39672			return this.off(a, null, b);
39673		}, delegate: function delegate(a, b, c, d) {
39674			return this.on(b, a, c, d);
39675		}, undelegate: function undelegate(a, b, c) {
39676			return 1 === arguments.length ? this.off(a, "**") : this.off(b, a || "**", c);
39677		} });var cb = n.now(),
39678	    db = /\?/;n.parseJSON = function (a) {
39679		return JSON.parse(a + "");
39680	}, n.parseXML = function (a) {
39681		var b, c;if (!a || "string" != typeof a) return null;try {
39682			c = new DOMParser(), b = c.parseFromString(a, "text/xml");
39683		} catch (d) {
39684			b = void 0;
39685		}return (!b || b.getElementsByTagName("parsererror").length) && n.error("Invalid XML: " + a), b;
39686	};var eb = /#.*$/,
39687	    fb = /([?&])_=[^&]*/,
39688	    gb = /^(.*?):[ \t]*([^\r\n]*)$/gm,
39689	    hb = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
39690	    ib = /^(?:GET|HEAD)$/,
39691	    jb = /^\/\//,
39692	    kb = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
39693	    lb = {},
39694	    mb = {},
39695	    nb = "*/".concat("*"),
39696	    ob = a.location.href,
39697	    pb = kb.exec(ob.toLowerCase()) || [];function qb(a) {
39698		return function (b, c) {
39699			"string" != typeof b && (c = b, b = "*");var d,
39700			    e = 0,
39701			    f = b.toLowerCase().match(E) || [];if (n.isFunction(c)) while (d = f[e++]) {
39702				"+" === d[0] ? (d = d.slice(1) || "*", (a[d] = a[d] || []).unshift(c)) : (a[d] = a[d] || []).push(c);
39703			}
39704		};
39705	}function rb(a, b, c, d) {
39706		var e = {},
39707		    f = a === mb;function g(h) {
39708			var i;return e[h] = !0, n.each(a[h] || [], function (a, h) {
39709				var j = h(b, c, d);return "string" != typeof j || f || e[j] ? f ? !(i = j) : void 0 : (b.dataTypes.unshift(j), g(j), !1);
39710			}), i;
39711		}return g(b.dataTypes[0]) || !e["*"] && g("*");
39712	}
39712function sb(a, b) {
39713		var c,
39714		    d,
39715		    e = n.ajaxSettings.flatOptions || {};for (c in b) {
39716			void 0 !== b[c] && ((e[c] ? a : d || (d = {}))[c] = b[c]);
39717		}return d && n.extend(!0, a, d), a;
39718	}function tb(a, b, c) {
39719		var d,
39720		    e,
39721		    f,
39722		    g,
39723		    h = a.contents,
39724		    i = a.dataTypes;while ("*" === i[0]) {
39725			i.shift(), void 0 === d && (d = a.mimeType || b.getResponseHeader("Content-Type"));
39726		}if (d) for (e in h) {
39727			if (h[e] && h[e].test(d)) {
39728				i.unshift(e);break;
39729			}
39730		}if (i[0] in c) f = i[0];else {
39731			for (e in c) {
39732				if (!i[0] || a.converters[e + " " + i[0]]) {
39733					f = e;break;
39734				}g || (g = e);
39735			}f = f || g;
39736		}return f ? (f !== i[0] && i.unshift(f), c[f]) : void 0;
39737	}function ub(a, b, c, d) {
39738		var e,
39739		    f,
39740		    g,
39741		    h,
39742		    i,
39743		    j = {},
39744		    k = a.dataTypes.slice();if (k[1]) for (g in a.converters) {
39745			j[g.toLowerCase()] = a.converters[g];
39746		}f = k.shift();while (f) {
39747			if (a.responseFields[f] && (c[a.responseFields[f]] = b), !i && d && a.dataFilter && (b = a.dataFilter(b, a.dataType)), i = f, f = k.shift()) if ("*" === f) f = i;else if ("*" !== i && i !== f) {
39748				if (g = j[i + " " + f] || j["* " + f], !g) for (e in j) {
39749					if (h = e.split(" "), h[1] === f && (g = j[i + " " + h[0]] || j["* " + h[0]])) {
39750						g === !0 ? g = j[e] : j[e] !== !0 && (f = h[0], k.unshift(h[1]));break;
39751					}
39752				}if (g !== !0) if (g && a["throws"]) b = g(b);else try {
39753					b = g(b);
39754				} catch (l) {
39755					return { state: "parsererror", error: g ? l : "No conversion from " + i + " to " + f };
39756				}
39757			}
39758		}return { state: "success", data: b };
39759	}n.extend({ active: 0, lastModified: {}, etag: {}, ajaxSettings: { url: ob, type: "GET", isLocal: hb.test(pb[1]), global: !0, processData: !0, async: !0, contentType: "application/x-www-form-urlencoded; charset=UTF-8", accepts: { "*": nb, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, converters: { "* text": String, "text html": !0, "text json": n.parseJSON, "text xml": n.parseXML }, flatOptions: { url: !0, context: !0 } }, ajaxSetup: function ajaxSetup(a, b) {
39760			return b ? sb(sb(a, n.ajaxSettings), b) : sb(n.ajaxSettings, a);
39761		}, ajaxPrefilter: qb(lb), ajaxTransport: qb(mb), ajax: function ajax(a, b) {
39762			"object" == (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) && (b = a, a = void 0), b = b || {};var c,
39763			    d,
39764			    e,
39765			    f,
39766			    g,
39767			    h,
39768			    i,
39769			    j,
39770			    k = n.ajaxSetup({}, b),
39771			    l = k.context || k,
39772			    m = k.context && (l.nodeType || l.jquery) ? n(l) : n.event,
39773			    o = n.Deferred(),
39774			    p = n.Callbacks("once memory"),
39775			    q = k.statusCode || {},
39776			    r = {},
39777			    s = {},
39778			    t = 0,
39779			    u = "canceled",
39780			    v = { readyState: 0, getResponseHeader: function getResponseHeader(a) {
39781					var b;if (2 === t) {
39782						if (!f) {
39783							f = {};while (b = gb.exec(e)) {
39784								f[b[1].toLowerCase()] = b[2];
39785							}
39786						}b = f[a.toLowerCase()];
39787					}return null == b ? null : b;
39788				}, getAllResponseHeaders: function getAllResponseHeaders() {
39789					return 2 === t ? e : null;
39790				}, setRequestHeader: function setRequestHeader(a, b) {
39791					var c = a.toLowerCase();return t || (a = s[c] = s[c] || a, r[a] = b), this;
39792				}, overrideMimeType: function overrideMimeType(a) {
39793					return t || (k.mimeType = a), this;
39794				}, statusCode: function statusCode(a) {
39795					var b;if (a) if (2 > t) for (b in a) {
39796						q[b] = [q[b], a[b]];
39797					} else v.always(a[v.status]);return this;
39798				}, abort: function abort(a) {
39799					var b = a || u;return c && c.abort(b), x(0, b), this;
39800				} };if (o.promise(v).complete = p.add, v.success = v.done, v.error = v.fail, k.url = ((a || k.url || ob) + "").replace(eb, "").replace(jb, pb[1] + "//"), k.type = b.method || b.type || k.method || k.type, k.dataTypes = n.trim(k.dataType || "*").toLowerCase().match(E) || [""], null == k.crossDomain && (h = kb.exec(k.url.toLowerCase()), k.crossDomain = !(!h || h[1] === pb[1] && h[2] === pb[2] && (h[3] || ("http:" === h[1] ? "80" : "443")) === (pb[3] || ("http:" === pb[1] ? "80" : "443")))
39800), k.data && k.processData && "string" != typeof k.data && (k.data = n.param(k.data, k.traditional)), rb(lb, k, b, v), 2 === t) return v;i = n.event && k.global, i && 0 === n.active++ && n.event.trigger("ajaxStart"), k.type = k.type.toUpperCase(), k.hasContent = !ib.test(k.type), d = k.url, k.hasContent || (k.data && (d = k.url += (db.test(d) ? "&" : "?") + k.data, delete k.data), k.cache === !1 && (k.url = fb.test(d) ? d.replace(fb, "$1_=" + cb++) : d + (db.test(d) ? "&" : "?") + "_=" + cb++)), k.ifModified && (n.lastModified[d] && v.setRequestHeader("If-Modified-Since", n.lastModified[d]), n.etag[d] && v.setRequestHeader("If-None-Match", n.etag[d])), (k.data && k.hasContent && k.contentType !== !1 || b.contentType) && v.setRequestHeader("Content-Type", k.contentType), v.setRequestHeader("Accept", k.dataTypes[0] && k.accepts[k.dataTypes[0]] ? k.accepts[k.dataTypes[0]] + ("*" !== k.dataTypes[0] ? ", " + nb + "; q=0.01" : "") : k.accepts["*"]);for (j in k.headers) {
39801				v.setRequestHeader(j, k.headers[j]);
39802			}if (k.beforeSend && (k.beforeSend.call(l, v, k) === !1 || 2 === t)) return v.abort();u = "abort";for (j in { success: 1, error: 1, complete: 1 }) {
39803				v[j](k[j]);
39804			}if (c = rb(mb, k, b, v)) {
39805				v.readyState = 1, i && m.trigger("ajaxSend", [v, k]), k.async && k.timeout > 0 && (g = setTimeout(function () {
39806					v.abort("timeout");
39807				}, k.timeout));try {
39808					t = 1, c.send(r, x);
39809				} catch (w) {
39810					if (!(2 > t)) throw w;x(-1, w);
39811				}
39812			} else x(-1, "No Transport");function x(a, b, f, h) {
39813				var j,
39814				    r,
39815				    s,
39816				    u,
39817				    w,
39818				    x = b;2 !== t && (t = 2, g && clearTimeout(g), c = void 0, e = h || "", v.readyState = a > 0 ? 4 : 0, j = a >= 200 && 300 > a || 304 === a, f && (u = tb(k, v, f)), u = ub(k, u, v, j), j ? (k.ifModified && (w = v.getResponseHeader("Last-Modified"), w && (n.lastModified[d] = w), w = v.getResponseHeader("etag"), w && (n.etag[d] = w)), 204 === a || "HEAD" === k.type ? x = "nocontent" : 304 === a ? x = "notmodified" : (x = u.state, r = u.data, s = u.error, j = !s)) : (s = x, (a || !x) && (x = "error", 0 > a && (a = 0))), v.status = a, v.statusText = (b || x) + "", j ? o.resolveWith(l, [r, x, v]) : o.rejectWith(l, [v, x, s]), v.statusCode(q), q = void 0, i && m.trigger(j ? "ajaxSuccess" : "ajaxError", [v, k, j ? r : s]), p.fireWith(l, [v, x]), i && (m.trigger("ajaxComplete", [v, k]), --n.active || n.event.trigger("ajaxStop")));
39819			}return v;
39820		}, getJSON: function getJSON(a, b, c) {
39821			return n.get(a, b, c, "json");
39822		}, getScript: function getScript(a, b) {
39823			return n.get(a, void 0, b, "script");
39824		} }), n.each(["get", "post"], function (a, b) {
39825		n[b] = function (a, c, d, e) {
39826			return n.isFunction(c) && (e = e || d, d = c, c = void 0), n.ajax({ url: a, type: b, dataType: e, data: c, success: d });
39827		};
39828	}), n._evalUrl = function (a) {
39829		return n.ajax({ url: a, type: "GET", dataType: "script", async: !1, global: !1, "throws": !0 });
39830	}, n.fn.extend({ wrapAll: function wrapAll(a) {
39831			var b;return n.isFunction(a) ? this.each(function (b) {
39832				n(this).wrapAll(a.call(this, b));
39833			}) : (this[0] && (b = n(a, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && b.insertBefore(this[0]), b.map(function () {
39834				var a = this;while (a.firstElementChild) {
39835					a = a.firstElementChild;
39836				}return a;
39837			}).append(this)), this);
39838		}, wrapInner: function wrapInner(a) {
39839			return this.each(n.isFunction(a) ? function (b) {
39840				n(this).wrapInner(a.call(this, b));
39841			} : function () {
39842				var b = n(this),
39843				    c = b.contents();c.length ? c.wrapAll(a) : b.append(a);
39844			});
39845		}, wrap: function wrap(a) {
39846			var b = n.isFunction(a);return this.each(function (c) {
39847				n(this).wrapAll(b ? a.call(this, c) : a);
39848			});
39849		}, unwrap: function unwrap() {
39850			return this.parent().each(function () {
39851				n.nodeName(this, "body") || n(this).replaceWith(this.childNodes);
39852			}).end();
39853		} }), n.expr.filters.hidden = function (a) {
39854		return a.offsetWidth <= 0 && a.offsetHeight <= 0;
39855	}, n.expr.filters.visible = function (a) {
39856		return !n.expr.filters.hidden(a);
39857	};var vb = /%20/g,
39858	    wb = /\[\]$/,
39859	    xb = /\r?\n/g,
39860	    yb = /^(?:submit|button|image|reset|file)$/i,
39861	    zb = /^(?:input|select|textarea|keygen)/i;function Ab(a, b, c, d) {
39862		var e;if (n.isArray(b)) n.each(b, function (b, e) {
39863			c || wb.test(a) ? d(a, e) : Ab(a + "[" + ("object" == (typeof e === "undefined" ? "undefined" : (0, _typeof3.default)(e)) ? b : "") + "]", e, c, d);
39864		});else if (c || "object" !== n.type(b)) d(a, b);else for (e in b) {
39865			Ab(a + "[" + e + "]", b[e], c, d);
39866		}
39867	}n.param = function (a, b) {
39868		var c,
39869		    d = [],
39870		    e = function e(a, b) {
39871			b = n.isFunction(b) ? b() : null == b ? "" : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b);
39872		};if (void 0 === b && (b = n.ajaxSettings && n.ajaxSettings.traditional), n.isArray(a) || a.jquery && !n.isPlainObject(a)) n.each(a, function () {
39873			e(this.name, this.value);
39874		});else for (c in a) {
39875			Ab(c, a[c], b, e);
39876		}return d.join("&").replace(vb, "+");
39877	}, n.fn.extend({ serialize: function serialize() {
39878			return n.param(this.serializeArray());
39879		}, serializeArray: function serializeArray() {
39880			return this.map(function () {
39881				var a = n.prop(this, "elements");return a ? n.makeArray(a) : this;
39882			}).filter(function () {
39883				var a = this.type;return this.name && !n(this).is(":disabled") && zb.test(this.nodeName) && !yb.test(a) && (this.checked || !T.test(a));
39884			}).map(function (a, b) {
39885				var c = n(this).val();return null == c ? null : n.isArray(c) ? n.map(c, function (a) {
39886					return { name: b.name, value: a.replace(xb, "\r\n") };
39887				}) : { name: b.name, value: c.replace(xb, "\r\n") };
39888			}).get();
39889		} }), n.ajaxSettings.xhr = function () {
39890		try {
39891			return new XMLHttpRequest();
39892		} catch (a) {}
39893	};var Bb = 0,
39894	    Cb = {},
39895	    Db = { 0: 200, 1223: 204 },
39896	    Eb = n.ajaxSettings.xhr();a.attachEvent && a.attachEvent("onunload", function () {
39897		for (var a in Cb) {
39898			Cb[a]();
39899		}
39900	}), k.cors = !!Eb && "withCredentials" in Eb, k.ajax = Eb = !!Eb, n.ajaxTransport(function (a) {
39901		var _b2;return k.cors || Eb && !a.crossDomain ? { send: function send(c, d) {
39902				var e,
39903				    f = a.xhr(),
39904				    g = ++Bb;if (f.open(a.type, a.url, a.async, a.username, a.password), a.xhrFields) for (e in a.xhrFields) {
39905					f[e] = a.xhrFields[e];
39906				}a.mimeType && f.overrideMimeType && f.overrideMimeType(a.mimeType), a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");for (e in c) {
39907					f.setRequestHeader(e, c[e]);
39908				}_b2 = function b(a) {
39909					return function () {
39910						_b2 && (delete Cb[g], _b2 = f.onload = f.onerror = null, "abort" === a ? f.abort() : "error" === a ? d(f.status, f.statusText) : d(Db[f.status] || f.status, f.statusText, "string" == typeof f.responseText ? { text: f.responseText } : void 0, f.getAllResponseHeaders()));
39911					};
39912				}, f.onload = _b2(), f.onerror = _b2("error"), _b2 = Cb[g] = _b2("abort");try {
39913					f.send(a.hasContent && a.data || null);
39914				} catch (h) {
39915					if (_b2) throw h;
39916				}
39917			}, abort: function abort() {
39918				_b2 && _b2();
39919			} } : void 0;
39920	}), n.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function textScript(a) {
39921				return n.globalEval(a), a;
39922			} } }), n.ajaxPrefilter("script", function (a) {
39923		void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = "GET");
39924	}), n.ajaxTransport("script", function (a) {
39925		if (a.crossDomain) {
39926			var b, _c;return { send: function send(d, e) {
39927					b = n("<script>").prop({ async: !0, charset: a.scriptCharset, src: a.url }).on("load error", _c = function c(a) {
39928						b.remove(), _c = null, a && e("error" === a.type ? 404 : 200, a.type);
39929					}), l.head.appendChild(b[0]);
39930				}, abort: function abort() {
39931					_c && _c();
39932				} };
39933		}
39934	});var Fb = [],
39935	    Gb = /(=)\?(?=&|$)|\?\?/;n.ajaxSetup({ jsonp: "callback", jsonpCallback: function jsonpCallback() {
39936			var a = Fb.pop() || n.expando + "_" + cb++;return this[a] = !0, a;
39937		} }), n.ajaxPrefilter("json jsonp", function (b, c, d) {
39938		var e,
39939		    f,
39940		    g,
39941		    h = b.jsonp !== !1 && (Gb.test(b.url) ? "url" : "string" == typeof b.data && !(b.contentType || "").indexOf("application/x-www-form-urlencoded") && Gb.test(b.data) && "data");return h || "jsonp" === b.dataTypes[0] ? (e = b.jsonpCallback = n.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback, h ? b[h] = b[h].replace(Gb, "$1" + e) : b.jsonp !== !1 && (b.url += (db.test(b.url) ? "&" : "?") + b.jsonp + "=" + e), b.converters["script json"] = function () {
39942			return g || n.error(e + " was not called"), g[0];
39943		}, b.dataTypes[0] = "json", f = a[e], a[e] = function () {
39944			g = arguments;
39945		}, d.always(function () {
39946			a[e] = f, b[e] && (b.jsonpCallback = c.jsonpCallback, Fb.push(e)), g && n.isFunction(f) && f(g[0]), g = f = void 0;
39947		}), "script") : void 0;
39948	}), n.parseHTML = function (a, b, c) {
39949		if (!a || "string" != typeof a) return null;"boolean" == typeof b && (c = b, b = !1), b = b || l;var d = v.exec(a),
39950		    e = !c && [];return d ? [b.createElement(d[1])] : (d = n.buildFragment([a], b, e), e && e.length && n(e).remove(), n.merge([], d.childNodes));
39951	};var Hb = n.fn.load;n.fn.load = function (a, b, c) {
39952		if ("string" != typeof a && Hb) return Hb.apply(this, arguments);var d,
39953		    e,
39954		    f,
39955		    g = this,
39956		    h = a.indexOf(" ");return h >= 0 && (d = n.trim(a.slice(h)), a = a.slice(0, h)), n.isFunction(b) ? (c = b, b = void 0) : b && "object" == (typeof b === "undefined" ? "undefined" : (0, _typeof3.default)(b)) && (e = "POST"), g.length > 0 && n.ajax({ url: a, type: e, dataType: "html", data: b }).done(function (a) {
39957			f = arguments, g.html(d ? n("<div>").append(n.parseHTML(a)).find(d) : a);
39958		}).complete(c && function (a, b) {
39959			g.each(c, f || [a.responseText, b, a]);
39960		}), this;
39961	}, n.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (a, b) {
39962		n.fn[b] = function (a) {
39963			return this.on(b, a);
39964		};
39965	}), n.expr.filters.animated = function (a) {
39966		return n.grep(n.timers, function (b) {
39967			return a === b.elem;
39968		}).length;
39969	};var Ib = a.document.documentElement;function Jb(a) {
39970		return n.isWindow(a) ? a : 9 === a.nodeType && a.defaultView;
39971	}n.offset = { setOffset: function setOffset(a, b, c) {
39972			var d,
39973			    e,
39974			    f,
39975			    g,
39976			    h,
39977			    i,
39978			    j,
39979			    k = n.css(a, "position"),
39980			    l = n(a),
39981			    m = {};"static" === k && (a.style.position = "relative"), h = l.offset(), f = n.css(a, "top"), i = n.css(a, "left"), j = ("absolute" === k || "fixed" === k) && (f + i).indexOf("auto") > -1, j ? (d = l.position(), g = d.top, e = d.left) : (g = parseFloat(f) || 0, e = parseFloat(i) || 0), n.isFunction(b) && (b = b.call(a, c, h)), null != b.top && (m.top = b.top - h.top + g), null != b.left && (m.left = b.left - h.left + e), "using" in b ? b.using.call(a, m) : l.css(m);
39982		} }, n.fn.extend({ offset: function offset(a) {
39983			if (arguments.length) return void 0 === a ? this : this.each(function (b) {
39984				n.offset.setOffset(this, a, b);
39985			});var b,
39986			    c,
39987			    d = this[0],
39988			    e = { top: 0, left: 0 },
39989			    f = d && d.ownerDocument;if (f) return b = f.documentElement, n.contains(b, d) ? ((0, _typeof3.default)(d.getBoundingClientRect) !== U && (e = d.getBoundingClientRect()), c = Jb(f), { top: e.top + c.pageYOffset - b.clientTop, left: e.left + c.pageXOffset - b.clientLeft }) : e;
39990		}, position: function position() {
39991			if (this[0]) {
39992				var a,
39993				    b,
39994				    c = this[0],
39995				    d = { top: 0, left: 0 };return "fixed" === n.css(c, "position") ? b = c.getBoundingClientRect() : (a = this.offsetParent(), b = this.offset(), n.nodeName(a[0], "html") || (d = a.offset()), d.top += n.css(a[0], "borderTopWidth", !0), d.left += n.css(a[0], "borderLeftWidth", !0)), { top: b.top - d.top - n.css(c, "marginTop", !0), left: b.left - d.left - n.css(c, "marginLeft", !0) };
39996			}
39997		}, offsetParent: function offsetParent() {
39998			return this.map(function () {
39999				var a = this.offsetParent || Ib;while (a && !n.nodeName(a, "html") && "static" === n.css(a, "position")) {
40000					a = a.offsetParent;
40001				}return a || Ib;
40002			});
40003		} }), n.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (b, c) {
40004		var d = "pageYOffset" === c;n.fn[b] = function (e) {
40005			return J(this, function (b, e, f) {
40006				var g = Jb(b);return void 0 === f ? g ? g[c] : b[e] : void (g ? g.scrollTo(d ? a.pageXOffset : f, d ? f : a.pageYOffset) : b[e] = f);
40007			}, b, e, arguments.length, null);
40008		};
40009	}), n.each(["top", "left"], function (a, b) {
40010		n.cssHooks[b] = ya(k.pixelPosition, function (a, c) {
40011			return c ? (c = xa(a, b), va.test(c) ? n(a).position()[b] + "px" : c) : void 0;
40012		});
40013	}), n.each({ Height: "height", Width: "width" }, function (a, b) {
40014		n.each({ padding: "inner" + a, content: b, "": "outer" + a }, function (c, d) {
40015			n.fn[d] = function (d, e) {
40016				var f = arguments.length && (c || "boolean" != typeof d),
40017				    g = c || (d === !0 || e === !0 ? "margin" : "border");return J(this, function (b, c, d) {
40018					var e;return n.isWindow(b) ? b.document.documentElement["client" + a] : 9 === b.nodeType ? (e = b.documentElement, Math.max(b.body["scroll" + a], e["scroll" + a], b.body["offset" + a], e["offset" + a], e["client" + a])) : void 0 === d ? n.css(b, c, g) : n.style(b, c, d, g);
40019				}, b, f ? d : void 0, f, null);
40020			};
40021		});
40022	}), n.fn.size = function () {
40023		return this.length;
40024	}, n.fn.andSelf = n.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function () {
40025		return n;
40026	});var Kb = a.jQuery,
40027	    Lb = a.$;return n.noConflict = function (b) {
40028		return a.$ === n && (a.$ = Lb), b && a.jQuery === n && (a.jQuery = Kb), n;
40029	}, (typeof b === "undefined" ? "undefined" : (0, _typeof3.default)(b)) === U && (a.jQuery = a.$ = n), n;
40030});
40031
40032(function defineMustache(global, factory) {
40033	if ((typeof exports === "undefined" ? "undefined" : (0, _typeof3.default)(exports)) === "object" && exports && typeof exports.nodeName !== "string") {
40034		factory(exports);
40035	} else if (typeof define === "function" && define.amd) {
40036		define(["exports"], factory);
40037	} else {
40038		global.Mustache = {};factory(Mustache);
40039	}
40040})(undefined, function mustacheFactory(mustache) {
40041	var objectToString = Object.prototype.toString;var isArray = Array.isArray || function isArrayPolyfill(object) {
40042		return objectToString.call(object) === "[object Array]";
40043	};function isFunction(object) {
40044		return typeof object === "function";
40045	}function typeStr(obj) {
40046		return isArray(obj) ? "array" : typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj);
40047	}function escapeRegExp(string) {
40048		return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
40049	}function hasProperty(obj, propName) {
40050		return obj != null && (typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object" && propName in obj;
40051	}var regExpTest = RegExp.prototype.test;function testRegExp(re, string) {
40052		return regExpTest.call(re, string);
40053	}var nonSpaceRe = /\S/;function isWhitespace(string) {
40054		return !testRegExp(nonSpaceRe, string);
40055	}var entityMap = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" };function escapeHtml(string) {
40056		return String(string).replace(/[&<>
vendor: 6,749 bytes, lines 40056-40157
40056"'\/]/g, function fromEntityMap(s) {
40057			return entityMap[s];
40058		});
40059	}var whiteRe = /\s*/;var spaceRe = /\s+/;var equalsRe = /\s*=/;var curlyRe = /\s*\}/;var tagRe = /#|\^|\/|>|\{|&|=|!/;function parseTemplate(template, tags) {
40060		if (!template) return [];var sections = [];var tokens = [];var spaces = [];var hasTag = false;var nonSpace = false;function stripSpace() {
40061			if (hasTag && !nonSpace) {
40062				while (spaces.length) {
40063					delete tokens[spaces.pop()];
40064				}
40065			} else {
40066				spaces = [];
40067			}hasTag = false;nonSpace = false;
40068		}var openingTagRe, closingTagRe, closingCurlyRe;function compileTags(tagsToCompile) {
40069			if (typeof tagsToCompile === "string") tagsToCompile = tagsToCompile.split(spaceRe, 2);if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) throw new Error("Invalid tags: " + tagsToCompile);openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
40070		}compileTags(tags || mustache.tags);var scanner = new Scanner(template);var start, type, value, chr, token, openSection;while (!scanner.eos()) {
40071			start = scanner.pos;value = scanner.scanUntil(openingTagRe);if (value) {
40072				for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
40073					chr = value.charAt(i);if (isWhitespace(chr)) {
40074						spaces.push(tokens.length);
40075					} else {
40076						nonSpace = true;
40077					}tokens.push(["text", chr, start, start + 1]);start += 1;if (chr === "\n") stripSpace();
40078				}
40079			}if (!scanner.scan(openingTagRe)) break;hasTag = true;type = scanner.scan(tagRe) || "name";scanner.scan(whiteRe);if (type === "=") {
40080				value = scanner.scanUntil(equalsRe);scanner.scan(equalsRe);scanner.scanUntil(closingTagRe);
40081			} else if (type === "{") {
40082				value = scanner.scanUntil(closingCurlyRe);scanner.scan(curlyRe);scanner.scanUntil(closingTagRe);type = "&";
40083			} else {
40084				value = scanner.scanUntil(closingTagRe);
40085			}if (!scanner.scan(closingTagRe)) throw new Error("Unclosed tag at " + scanner.pos);token = [type, value, start, scanner.pos];tokens.push(token);if (type === "#" || type === "^") {
40086				sections.push(token);
40087			} else if (type === "/") {
40088				openSection = sections.pop();if (!openSection) throw new Error('Unopened section "' + value + '" at ' + start);if (openSection[1] !== value) throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
40089			} else if (type === "name" || type === "{" || type === "&") {
40090				nonSpace = true;
40091			} else if (type === "=") {
40092				compileTags(value);
40093			}
40094		}openSection = sections.pop();if (openSection) throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);return nestTokens(squashTokens(tokens));
40095	}function squashTokens(tokens) {
40096		var squashedTokens = [];var token, lastToken;for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
40097			token = tokens[i];if (token) {
40098				if (token[0] === "text" && lastToken && lastToken[0] === "text") {
40099					lastToken[1] += token[1];lastToken[3] = token[3];
40100				} else {
40101					squashedTokens.push(token);lastToken = token;
40102				}
40103			}
40104		}return squashedTokens;
40105	}function nestTokens(tokens) {
40106		var nestedTokens = [];var collector = nestedTokens;var sections = [];var token, section;for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
40107			token = tokens[i];switch (token[0]) {case "#":case "^":
40108					collector.push(token);sections.push(token);collector = token[4] = [];break;case "/":
40109					section = sections.pop();section[5] = token[2];collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;break;default:
40110					collector.push(token);}
40111		}return nestedTokens;
40112	}function Scanner(string) {
40113		this.string = string;this.tail = string;this.pos = 0;
40114	}Scanner.prototype.eos = function eos() {
40115		return this.tail === "";
40116	};Scanner.prototype.scan = function scan(re) {
40117		var match = this.tail.match(re);if (!match || match.index !== 0) return "";var string = match[0];this.tail = this.tail.substring(string.length);this.pos += string.length;return string;
40118	};Scanner.prototype.scanUntil = function scanUntil(re) {
40119		var index = this.tail.search(re),
40120		    match;switch (index) {case -1:
40121				match = this.tail;this.tail = "";break;case 0:
40122				match = "";break;default:
40123				match = this.tail.substring(0, index);this.tail = this.tail.substring(index);}this.pos += match.length;return match;
40124	};function Context(view, parentContext) {
40125		this.view = view;this.cache = { ".": this.view };this.parent = parentContext;
40126	}Context.prototype.push = function push(view) {
40127		return new Context(view, this);
40128	};Context.prototype.lookup = function lookup(name) {
40129		var cache = this.cache;var value;if (cache.hasOwnProperty(name)) {
40130			value = cache[name];
40131		} else {
40132			var context = this,
40133			    names,
40134			    index,
40135			    lookupHit = false;while (context) {
40136				if (name.indexOf(".") > 0) {
40137					value = context.view;names = name.split(".");index = 0;while (value != null && index < names.length) {
40138						if (index === names.length - 1) lookupHit = hasProperty(value, names[index]);value = value[names[index++]];
40139					}
40140				} else {
40141					value = context.view[name];lookupHit = hasProperty(context.view, name);
40142				}if (lookupHit) break;context = context.parent;
40143			}cache[name] = value;
40144		}if (isFunction(value)) value = value.call(this.view);return value;
40145	};function Writer() {
40146		this.cache = {};
40147	}Writer.prototype.clearCache = function clearCache() {
40148		this.cache = {};
40149	};Writer.prototype.parse = function parse(template, tags) {
40150		var cache = this.cache;var tokens = cache[template];if (tokens == null) tokens = cache[template] = parseTemplate(template, tags);return tokens;
40151	};Writer.prototype.render = function render(template, view, partials) {
40152		var tokens = this.parse(template);var context = view instanceof Context ? view : new Context(view);return this.renderTokens(tokens, context, partials, template);
40153	};Writer.prototype.renderTokens = function renderTokens(tokens, context, partials, originalTemplate) {
40154		var buffer = "";var token, symbol, value;for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
40155			value = undefined;token = tokens[i];symbol = token[0];if (symbol === "#") value = this.renderSection(token, context, partials, originalTemplate);else if (symbol === "^") value = this.renderInverted(token, context, partials, originalTemplate);else if (symbol === ">") value = this.renderPartial(token, context, partials, originalTemplate);else if (symbol === "&") value = this.unescapedValue(token, context);else if (symbol === "name") value = this.escapedValue(token, context);else if (symbol === "text") value = this.rawValue(token);if (value !== undefined) buffer += value;
40156		}return buffer;
40157	};
40157Writer.prototype.renderSection = function renderSection(token, context, partials, originalTemplate) {
40158		var self = this;var buffer = "";var value = context.lookup(token[1]);function subRender(template) {
40159			return self.render(template, context, partials);
40160		}if (!value) return;if (isArray(value)) {
40161			for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
40162				buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
40163			}
40164		} else if ((typeof value === "undefined" ? "undefined" : (0, _typeof3.default)(value)) === "object" || typeof value === "string" || typeof value === "number") {
40165			buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
40166		} else if (isFunction(value)) {
40167			if (typeof originalTemplate !== "string") throw new Error("Cannot use higher-order sections without the original template");value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);if (value != null) buffer += value;
40168		} else {
40169			buffer += this.renderTokens(token[4], context, partials, originalTemplate);
40170		}return buffer;
40171	};Writer.prototype.renderInverted = function renderInverted(token, context, partials, originalTemplate) {
40172		var value = context.lookup(token[1]);if (!value || isArray(value) && value.length === 0) return this.renderTokens(token[4], context, partials, originalTemplate);
40173	};Writer.prototype.renderPartial = function renderPartial(token, context, partials) {
40174		if (!partials) return;var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];if (value != null) return this.renderTokens(this.parse(value), context, partials, value);
40175	};Writer.prototype.unescapedValue = function unescapedValue(token, context) {
40176		var value = context.lookup(token[1]);if (value != null) return value;
40177	};Writer.prototype.escapedValue = function escapedValue(token, context) {
40178		var value = context.lookup(token[1]);if (value != null) return mustache.escape(value);
40179	};Writer.prototype.rawValue = function rawValue(token) {
40180		return token[1];
40181	};mustache.name = "mustache.js";mustache.version = "2.2.0";mustache.tags = ["{{", "}}"];var defaultWriter = new Writer();mustache.clearCache = function clearCache() {
40182		return defaultWriter.clearCache();
40183	};mustache.parse = function parse(template, tags) {
40184		return defaultWriter.parse(template, tags);
40185	};mustache.render = function render(template, view, partials) {
40186		if (typeof template !== "string") {
40187			throw new TypeError('Invalid template! Template should be a "string" ' + 'but "' + typeStr(template) + '" was given as the first ' + "argument for mustache#render(template, view, partials)");
40188		}return defaultWriter.render(template, view, partials);
40189	};mustache.to_html = function to_html(template, view, partials, send) {
40190		var result = mustache.render(template, view, partials);if (isFunction(send)) {
40191			send(result);
40192		} else {
40193			return result;
40194		}
40195	};mustache.escape = escapeHtml;mustache.Scanner = Scanner;mustache.Context = Context;mustache.Writer = Writer;
40196});
40197/*! jquery.cookie v1.4.1 | MIT */
40198!function (a) {
40199	"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == (typeof exports === "undefined" ? "undefined" : (0, _typeof3.default)(exports)) ? a(require("jquery")) : a(jQuery);
40200}(function (a) {
40201	function b(a) {
40202		return h.raw ? a : encodeURIComponent(a);
40203	}function c(a) {
40204		return h.raw ? a : decodeURIComponent(a);
40205	}function d(a) {
40206		return b(h.json ? (0, _stringify2.default)(a) : String(a));
40207	}function e(a) {
40208		0 === a.indexOf('"') && (a = a.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\"));try {
40209			return a = decodeURIComponent(a.replace(g, " ")), h.json ? JSON.parse(a) : a;
40210		} catch (b) {}
40211	}function f(b, c) {
40212		var d = h.raw ? b : e(b);return a.isFunction(c) ? c(d) : d;
40213	}var g = /\+/g,
40214	    h = a.cookie = function (e, g, i) {
40215		if (void 0 !== g && !a.isFunction(g)) {
40216			if (i = a.extend({}, h.defaults, i), "number" == typeof i.expires) {
40217				var j = i.expires,
40218				    k = i.expires = new Date();k.setTime(+k + 864e5 * j);
40219			}return document.cookie = [b(e), "=", d(g), i.expires ? "; expires=" + i.expires.toUTCString() : "", i.path ? "; path=" + i.path : "", i.domain ? "; domain=" + i.domain : "", i.secure ? "; secure" : ""].join("");
40220		}for (var l = e ? void 0 : {}, m = document.cookie ? document.cookie.split("; ") : [], n = 0, o = m.length; o > n; n++) {
40221			var p = m[n].split("="),
40222			    q = c(p.shift()),
40223			    r = p.join("=");if (e && e === q) {
40224				l = f(r, g);break;
40225			}e || void 0 === (r = f(r)) || (l[q] = r);
40226		}return l;
40227	};h.defaults = {}, a.removeCookie = function (b, c) {
40228		return void 0 === a.cookie(b) ? !1 : (a.cookie(b, "", a.extend({}, c, { expires: -1 })), !a.cookie(b));
40229	};
40230});
40231/*!
40232* jQuery Cycle2; version: 2.1.6 build: 20141007
40233* http://jquery.malsup.com/cycle2/
40234* Copyright (c) 2014 M. Alsup; Dual licensed: MIT/GPL
40235*/
40236!function (a) {
40237	"use strict";
40238	function b(a) {
40239		return (a || "").toLowerCase();
40240	}var c = "2.1.6";a.fn.cycle = function (c) {
40241		var d;return 0 !== this.length || a.isReady ? this.each(function () {
40242			var d,
40243			    e,
40244			    f,
40245			    g,
40246			    h = a(this),
40247			    i = a.fn.cycle.log;if (!h.data("cycle.opts")) {
40248				(h.data("cycle-log") === !1 || c && c.log === !1 || e && e.log === !1) && (i = a.noop), i("--c2 init--"), d = h.data();for (var j in d) {
40249					d.hasOwnProperty(j) && /^cycle[A-Z]+/.test(j) && (g = d[j], f = j.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, b), i(f + ":", g, "(" + (typeof g === "undefined" ? "undefined" : (0, _typeof3.default)(g)) + ")"), d[f] = g);
40250				}e = a.extend({}, a.fn.cycle.defaults, d, c || {}), e.timeoutId = 0, e.paused = e.paused || !1, e.container = h, e._maxZ = e.maxZ, e.API = a.extend({ _container: h }, a.fn.cycle.API), e.API.log = i, e.API.trigger = function (a, b) {
40251					return e.container.trigger(a, b), e.API;
40252				}, h.data("cycle.opts", e), h.data("cycle.API", e.API), e.API.trigger("cycle-bootstrap", [e, e.API]), e.API.addInitialSlides(), e.API.preInitSlideshow(), e.slides.length && e.API.initSlideshow();
40253			}
40254		}) : (d = { s: this.selector, c: this.context }, a.fn.cycle.log("requeuing slideshow (dom not ready)"), a(function () {
40255			a(d.s, d.c).cycle(c);
40256		}), this);
40257	}, a.fn.cycle.API = { opts: function opts() {
40258			return this._container.data("cycle.opts");
40259		}, addInitialSlides: function addInitialSlides() {
40260			var b = this.opts(),
40261			    c = b.slides;b.slideCount = 0, b.slides = a(), c = c.jquery ? c : b.container.find(c), b.random && c.sort(function () {
40262				return Math.random() - .5;
40263			}), b.API.add(c);
40264		}, preInitSlideshow: function preInitSlideshow() {
40265			var b = this.opts();b.API.trigger("cycle-pre-initialize", [b]);var c = a.fn.cycle.transitions[b.fx];c && a.isFunction(c.preInit) && c.preInit(b), b._preInitialized = !0;
40266		}, postInitSlideshow: function postInitSlideshow() {
40267			var b = this.opts();b.API.trigger("cycle-post-initialize", [b]);var c = a.fn.cycle.transitions[b.fx];c && a.isFunction(c.postInit) && c.postInit(b);
40268		}, initSlideshow: function initSlideshow() {
40269			var b,
40270			    c = this.opts(),
40271			    d = c.container;c.API.calcFirstSlide(), "static" == c.container.css("position") && c.container.css("position", "relative"), a(c.slides[c.currSlide]).css({ opacity: 1, display: "block", visibility: "visible" }), c.API.stackSlides(c.slides[c.currSlide], c.slides[c.nextSlide], !c.reverse), c.pauseOnHover && (c.pauseOnHover !== !0 && (d = a(c.pauseOnHover)), d.hover(function () {
40272				c.API.pause(!0);
40273			}, function () {
40274				c.API.resume(!0);
40275			}
vendor: 6,733 bytes, lines 40275-40344
40275)), c.timeout && (b = c.API.getSlideOpts(c.currSlide), c.API.queueTransition(b, b.timeout + c.delay)), c._initialized = !0, c.API.updateView(!0), c.API.trigger("cycle-initialized", [c]), c.API.postInitSlideshow();
40276		}, pause: function pause(b) {
40277			var c = this.opts(),
40278			    d = c.API.getSlideOpts(),
40279			    e = c.hoverPaused || c.paused;b ? c.hoverPaused = !0 : c.paused = !0, e || (c.container.addClass("cycle-paused"), c.API.trigger("cycle-paused", [c]).log("cycle-paused"), d.timeout && (clearTimeout(c.timeoutId), c.timeoutId = 0, c._remainingTimeout -= a.now() - c._lastQueue, (c._remainingTimeout < 0 || isNaN(c._remainingTimeout)) && (c._remainingTimeout = void 0)));
40280		}, resume: function resume(a) {
40281			var b = this.opts(),
40282			    c = !b.hoverPaused && !b.paused;a ? b.hoverPaused = !1 : b.paused = !1, c || (b.container.removeClass("cycle-paused"), 0 === b.slides.filter(":animated").length && b.API.queueTransition(b.API.getSlideOpts(), b._remainingTimeout), b.API.trigger("cycle-resumed", [b, b._remainingTimeout]).log("cycle-resumed"));
40283		}, add: function add(b, c) {
40284			var d,
40285			    e = this.opts(),
40286			    f = e.slideCount,
40287			    g = !1;"string" == a.type(b) && (b = a.trim(b)), a(b).each(function () {
40288				var b,
40289				    d = a(this);c ? e.container.prepend(d) : e.container.append(d), e.slideCount++, b = e.API.buildSlideOpts(d), e.slides = c ? a(d).add(e.slides) : e.slides.add(d), e.API.initSlide(b, d, --e._maxZ), d.data("cycle.opts", b), e.API.trigger("cycle-slide-added", [e, b, d]);
40290			}), e.API.updateView(!0), g = e._preInitialized && 2 > f && e.slideCount >= 1, g && (e._initialized ? e.timeout && (d = e.slides.length, e.nextSlide = e.reverse ? d - 1 : 1, e.timeoutId || e.API.queueTransition(e)) : e.API.initSlideshow());
40291		}, calcFirstSlide: function calcFirstSlide() {
40292			var a,
40293			    b = this.opts();a = parseInt(b.startingSlide || 0, 10), (a >= b.slides.length || 0 > a) && (a = 0), b.currSlide = a, b.reverse ? (b.nextSlide = a - 1, b.nextSlide < 0 && (b.nextSlide = b.slides.length - 1)) : (b.nextSlide = a + 1, b.nextSlide == b.slides.length && (b.nextSlide = 0));
40294		}, calcNextSlide: function calcNextSlide() {
40295			var a,
40296			    b = this.opts();b.reverse ? (a = b.nextSlide - 1 < 0, b.nextSlide = a ? b.slideCount - 1 : b.nextSlide - 1, b.currSlide = a ? 0 : b.nextSlide + 1) : (a = b.nextSlide + 1 == b.slides.length, b.nextSlide = a ? 0 : b.nextSlide + 1, b.currSlide = a ? b.slides.length - 1 : b.nextSlide - 1);
40297		}, calcTx: function calcTx(b, c) {
40298			var d,
40299			    e = b;return e._tempFx ? d = a.fn.cycle.transitions[e._tempFx] : c && e.manualFx && (d = a.fn.cycle.transitions[e.manualFx]), d || (d = a.fn.cycle.transitions[e.fx]), e._tempFx = null, this.opts()._tempFx = null, d || (d = a.fn.cycle.transitions.fade, e.API.log('Transition "' + e.fx + '" not found.  Using fade.')), d;
40300		}, prepareTx: function prepareTx(a, b) {
40301			var c,
40302			    d,
40303			    e,
40304			    f,
40305			    g,
40306			    h = this.opts();return h.slideCount < 2 ? void (h.timeoutId = 0) : (!a || h.busy && !h.manualTrump || (h.API.stopTransition(), h.busy = !1, clearTimeout(h.timeoutId), h.timeoutId = 0), void (h.busy || (0 !== h.timeoutId || a) && (d = h.slides[h.currSlide], e = h.slides[h.nextSlide], f = h.API.getSlideOpts(h.nextSlide), g = h.API.calcTx(f, a), h._tx = g, a && void 0 !== f.manualSpeed && (f.speed = f.manualSpeed), h.nextSlide != h.currSlide && (a || !h.paused && !h.hoverPaused && h.timeout) ? (h.API.trigger("cycle-before", [f, d, e, b]), g.before && g.before(f, d, e, b), c = function c() {
40307				h.busy = !1, h.container.data("cycle.opts") && (g.after && g.after(f, d, e, b), h.API.trigger("cycle-after", [f, d, e, b]), h.API.queueTransition(f), h.API.updateView(!0));
40308			}, h.busy = !0, g.transition ? g.transition(f, d, e, b, c) : h.API.doTransition(f, d, e, b, c), h.API.calcNextSlide(), h.API.updateView()) : h.API.queueTransition(f))));
40309		}, doTransition: function doTransition(b, c, d, e, f) {
40310			var g = b,
40311			    h = a(c),
40312			    i = a(d),
40313			    j = function j() {
40314				i.animate(g.animIn || { opacity: 1 }, g.speed, g.easeIn || g.easing, f);
40315			};i.css(g.cssBefore || {}), h.animate(g.animOut || {}, g.speed, g.easeOut || g.easing, function () {
40316				h.css(g.cssAfter || {}), g.sync || j();
40317			}), g.sync && j();
40318		}, queueTransition: function queueTransition(b, c) {
40319			var d = this.opts(),
40320			    e = void 0 !== c ? c : b.timeout;return 0 === d.nextSlide && 0 === --d.loop ? (d.API.log("terminating; loop=0"), d.timeout = 0, e ? setTimeout(function () {
40321				d.API.trigger("cycle-finished", [d]);
40322			}, e) : d.API.trigger("cycle-finished", [d]), void (d.nextSlide = d.currSlide)) : void 0 !== d.continueAuto && (d.continueAuto === !1 || a.isFunction(d.continueAuto) && d.continueAuto() === !1) ? (d.API.log("terminating automatic transitions"), d.timeout = 0, void (d.timeoutId && clearTimeout(d.timeoutId))) : void (e && (d._lastQueue = a.now(), void 0 === c && (d._remainingTimeout = b.timeout), d.paused || d.hoverPaused || (d.timeoutId = setTimeout(function () {
40323				d.API.prepareTx(!1, !d.reverse);
40324			}, e))));
40325		}, stopTransition: function stopTransition() {
40326			var a = this.opts();a.slides.filter(":animated").length && (a.slides.stop(!1, !0), a.API.trigger("cycle-transition-stopped", [a])), a._tx && a._tx.stopTransition && a._tx.stopTransition(a);
40327		}, advanceSlide: function advanceSlide(a) {
40328			var b = this.opts();return clearTimeout(b.timeoutId), b.timeoutId = 0, b.nextSlide = b.currSlide + a, b.nextSlide < 0 ? b.nextSlide = b.slides.length - 1 : b.nextSlide >= b.slides.length && (b.nextSlide = 0), b.API.prepareTx(!0, a >= 0), !1;
40329		}, buildSlideOpts: function buildSlideOpts(c) {
40330			var d,
40331			    e,
40332			    f = this.opts(),
40333			    g = c.data() || {};for (var h in g) {
40334				g.hasOwnProperty(h) && /^cycle[A-Z]+/.test(h) && (d = g[h], e = h.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, b), f.API.log("[" + (f.slideCount - 1) + "]", e + ":", d, "(" + (typeof d === "undefined" ? "undefined" : (0, _typeof3.default)(d)) + ")"), g[e] = d);
40335			}g = a.extend({}, a.fn.cycle.defaults, f, g), g.slideNum = f.slideCount;try {
40336				delete g.API, delete g.slideCount, delete g.currSlide, delete g.nextSlide, delete g.slides;
40337			} catch (i) {}return g;
40338		}, getSlideOpts: function getSlideOpts(b) {
40339			var c = this.opts();void 0 === b && (b = c.currSlide);var d = c.slides[b],
40340			    e = a(d).data("cycle.opts");return a.extend({}, c, e);
40341		}, initSlide: function initSlide(b, c, d) {
40342			var e = this.opts();c.css(b.slideCss || {}), d > 0 && c.css("zIndex", d), isNaN(b.speed) && (b.speed = a.fx.speeds[b.speed] || a.fx.speeds._default), b.sync || (b.speed = b.speed / 2), c.addClass(e.slideClass);
40343		}, updateView: function updateView(a, b) {
40344			var c = this.opts();if (c._initialized) {
40345				var d = c.API.getSlideOpts(),
40346				    e = c.slides[c.currSlide];!a && b !== !0 && (c.API.trigger("cycle-update-view-before", [c, d, e]), c.updateView < 0) || (c.slideActiveClass && c.slides.removeClass(c.slideActiveClass).eq(c.currSlide).addClass(c.slideActiveClass), a && c.hideNonActive && c.slides.filter(":not(." + c.slideActiveClass + ")").css("visibility", "hidden"), 0 === c.updateView && setTimeout(function () {
40347					c.API.trigger("cycle-update-view", [c, d, e, a]);
40348				}, d.speed / (c.sync ? 2 : 1)), 0 !== c.updateView && c.API.trigger("cycle-update-view", [c, d, e, a]), a && c.API.trigger("cycle-update-view-after", [c, d, e]));
40349			}
40350		}, getComponent: function getComponent(b) {
40351			var c = this.opts(),
40352			    d = c[b];return "string" == typeof d ? /^\s*[\>|\+|~]/.test(d) ? c.container.find(d) : a(d) : d.jquery ? d : a(d);
40353		}, stackSlides: function stackSlides(b, c, d) {
40354			var e = this.opts();b || (b = e.slides[e.currSlide], c = e.slides[e.nextSlide], d = !e.reverse), a(b).css("zIndex", e.maxZ);var f,
40355			    g = e.maxZ - 2,
40356			    h = e.slideCount;if (d) {
40357				for (f = e.currSlide + 1; h > f; f++) {
40358					a(e.slides[f]).css("zIndex", g--);
40359				}for (f = 0; f < e.currSlide; f++) {
40360					a(e.slides[f]).css("zIndex", g--);
40361				}
40362			} else {
40363				for (f = e.currSlide - 1; f >= 0; f--) {
40364					a(e.slides[f]).css("zIndex", g--);
40365				}for (f = h - 1; f > e.currSlide; f--) {
40366					a(e.slides[f]).css("zIndex", g--);
40367				}
40368			}a(c).css("zIndex", e.maxZ - 1);
40369		}, getSlideIndex: function getSlideIndex(a) {
40370			return this.opts().slides.index(a);
40371		} }, a.fn.cycle.log = function () {
40372		window.console && console.log && console.log("[cycle2] " + Array.prototype.join.call(arguments, " "));
40373	}, a.fn.cycle.version = function () {
40374		return "Cycle2: " + c;
40375	}, a.fn.cycle.transitions = { custom: {}, none: { before: function before(a, b, c, d) {
40376				a.API.stackSlides(c, b, d), a.cssBefore = { opacity: 1, visibility: "visible", display: "block" };
40377			} }, fade: { before: function before(b, c, d, e) {
40378				var f = b.API.getSlideOpts(b.nextSlide).slideCss || {};b.API.stackSlides(c, d, e), b.cssBefore = a.extend(f, { opacity: 0, visibility: "visible", display: "block" }), b.animIn = { opacity: 1 }, b.animOut = { opacity: 0 };
40379			} }, fadeout: { before: function before(b, c, d, e) {
40380				var f = b.API.getSlideOpts(b.nextSlide).slideCss || {};b.API.stackSlides(c, d, e), b.cssBefore = a.extend(f, { opacity: 1, visibility: "visible", display: "block" }), b.animOut = { opacity: 0 };
40381			} }, scrollHorz: { before: function before(a, b, c, d) {
40382				a.API.stackSlides(b, c, d);var e = a.container.css("overflow", "hidden").width();a.cssBefore = { left: d ? e : -e, top: 0, opacity: 1, visibility: "visible", display: "block" }, a.cssAfter = { zIndex: a._maxZ - 2, left: 0 }, a.animIn = { left: 0 }, a.animOut = { left: d ? -e : e };
40383			} } }, a.fn.cycle.defaults = { allowWrap: !0, autoSelector: ".cycle-slideshow[data-cycle-auto-init!=false]", delay: 0, easing: null, fx: "fade", hideNonActive: !0, loop: 0, manualFx: void 0, manualSpeed: void 0, manualTrump: !0, maxZ: 100, pauseOnHover: !1, reverse: !1, slideActiveClass: "cycle-slide-active", slideClass: "cycle-slide", slideCss: { position: "absolute", top: 0, left: 0 }, slides: "> img", speed: 500, startingSlide: 0, sync: !0, timeout: 4e3, updateView: 0 }, a(document).ready(function () {
40384		a(a.fn.cycle.defaults.autoSelector).cycle();
40385	});
40386}(jQuery), /*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130913 */
40387function (a) {
40388	"use strict";
40389	function b(b, d) {
40390		var e,
40391		    f,
40392		    g,
40393		    h = d.autoHeight;if ("container" == h) f = a(d.slides[d.currSlide]).outerHeight(), d.container.height(f);else if (d._autoHeightRatio) d.container.height(d.container.width() / d._autoHeightRatio);else if ("calc" === h || "number" == a.type(h) && h >= 0) {
40394			if (g = "calc" === h ? c(b, d) : h >= d.slides.length ? 0 : h, g == d._sentinelIndex) return;d._sentinelIndex = g, d._sentinel && d._sentinel.remove(), e = a(d.slides[g].cloneNode(!0)), e.removeAttr("id name rel").find("[id],[name],[rel]").removeAttr("id n
40394ame rel"), e.css({ position: "static", visibility: "hidden", display: "block" }).prependTo(d.container).addClass("cycle-sentinel cycle-slide").removeClass("cycle-slide-active"), e.find("*").css("visibility", "hidden"), d._sentinel = e;
40395		}
40396	}function c(b, c) {
40397		var d = 0,
40398		    e = -1;return c.slides.each(function (b) {
40399			var c = a(this).height();c > e && (e = c, d = b);
40400		}), d;
40401	}function d(b, c, d, e) {
40402		var f = a(e).outerHeight();c.container.animate({ height: f }, c.autoHeightSpeed, c.autoHeightEasing);
40403	}function e(c, f) {
40404		f._autoHeightOnResize && (a(window).off("resize orientationchange", f._autoHeightOnResize), f._autoHeightOnResize = null), f.container.off("cycle-slide-added cycle-slide-removed", b), f.container.off("cycle-destroyed", e), f.container.off("cycle-before", d), f._sentinel && (f._sentinel.remove(), f._sentinel = null);
40405	}a.extend(a.fn.cycle.defaults, { autoHeight: 0, autoHeightSpeed: 250, autoHeightEasing: null }), a(document).on("cycle-initialized", function (c, f) {
40406		function g() {
40407			b(c, f);
40408		}var h,
40409		    i = f.autoHeight,
40410		    j = a.type(i),
40411		    k = null;("string" === j || "number" === j) && (f.container.on("cycle-slide-added cycle-slide-removed", b), f.container.on("cycle-destroyed", e), "container" == i ? f.container.on("cycle-before", d) : "string" === j && /\d+\:\d+/.test(i) && (h = i.match(/(\d+)\:(\d+)/), h = h[1] / h[2], f._autoHeightRatio = h), "number" !== j && (f._autoHeightOnResize = function () {
40412			clearTimeout(k), k = setTimeout(g, 50);
40413		}, a(window).on("resize orientationchange", f._autoHeightOnResize)), setTimeout(g, 30));
40414	});
40415}(jQuery), /*! caption plugin for Cycle2;  version: 20130306 */
40416function (a) {
40417	"use strict";
40418	a.extend(a.fn.cycle.defaults, { caption: "> .cycle-caption", captionTemplate: "{{slideNum}} / {{slideCount}}", overlay: "> .cycle-overlay", overlayTemplate: "<div>{{title}}</div><div>{{desc}}</div>", captionModule: "caption" }), a(document).on("cycle-update-view", function (b, c, d, e) {
40419		if ("caption" === c.captionModule) {
40420			a.each(["caption", "overlay"], function () {
40421				var a = this,
40422				    b = d[a + "Template"],
40423				    f = c.API.getComponent(a);f.length && b ? (f.html(c.API.tmpl(b, d, c, e)), f.show()) : f.hide();
40424			});
40425		}
40426	}), a(document).on("cycle-destroyed", function (b, c) {
40427		var d;a.each(["caption", "overlay"], function () {
40428			var a = this,
40429			    b = c[a + "Template"];c[a] && b && (d = c.API.getComponent("caption"), d.empty());
40430		});
40431	});
40432}(jQuery), /*! command plugin for Cycle2;  version: 20140415 */
40433function (a) {
40434	"use strict";
40435	var b = a.fn.cycle;a.fn.cycle = function (c) {
40436		var d,
40437		    e,
40438		    f,
40439		    g = a.makeArray(arguments);return "number" == a.type(c) ? this.cycle("goto", c) : "string" == a.type(c) ? this.each(function () {
40440			var h;return d = c, f = a(this).data("cycle.opts"), void 0 === f ? void b.log('slideshow must be initialized before sending commands; "' + d + '" ignored') : (d = "goto" == d ? "jump" : d, e = f.API[d], a.isFunction(e) ? (h = a.makeArray(g), h.shift(), e.apply(f.API, h)) : void b.log("unknown command: ", d));
40441		}) : b.apply(this, arguments);
40442	}, a.extend(a.fn.cycle, b), a.extend(b.API, { next: function next() {
40443			var a = this.opts();if (!a.busy || a.manualTrump) {
40444				var b = a.reverse ? -1 : 1;a.allowWrap === !1 && a.currSlide + b >= a.slideCount || (a.API.advanceSlide(b), a.API.trigger("cycle-next", [a]).log("cycle-next"));
40445			}
40446		}, prev: function prev() {
40447			var a = this.opts();if (!a.busy || a.manualTrump) {
40448				var b = a.reverse ? 1 : -1;a.allowWrap === !1 && a.currSlide + b < 0 || (a.API.advanceSlide(b), a.API.trigger("cycle-prev", [a]).log("cycle-prev"));
40449			}
40450		}, destroy: function destroy() {
40451			this.stop();var b = this.opts(),
40452			    c = a.isFunction(a._data) ? a._data : a.noop;clearTimeout(b.timeoutId), b.timeoutId = 0, b.API.stop(), b.API.trigger("cycle-destroyed", [b]).log("cycle-destroyed"), b.container.removeData(), c(b.container[0], "parsedAttrs", !1), b.retainStylesOnDestroy || (b.container.removeAttr("style"), b.slides.removeAttr("style"), b.slides.removeClass(b.slideActiveClass)), b.slides.each(function () {
40453				var d = a(this);d.removeData(), d.removeClass(b.slideClass), c(this, "parsedAttrs", !1);
40454			});
40455		}, jump: function jump(a, b) {
40456			var c,
40457			    d = this.opts();if (!d.busy || d.manualTrump) {
40458				var e = parseInt(a, 10);if (isNaN(e) || 0 > e || e >
40458= d.slides.length) return void d.API.log("goto: invalid slide index: " + e);if (e == d.currSlide) return void d.API.log("goto: skipping, already on slide", e);d.nextSlide = e, clearTimeout(d.timeoutId), d.timeoutId = 0, d.API.log("goto: ", e, " (zero-index)"), c = d.currSlide < d.nextSlide, d._tempFx = b, d.API.prepareTx(!0, c);
40459			}
40460		}, stop: function stop() {
40461			var b = this.opts(),
40462			    c = b.container;clearTimeout(b.timeoutId), b.timeoutId = 0, b.API.stopTransition(), b.pauseOnHover && (b.pauseOnHover !== !0 && (c = a(b.pauseOnHover)), c.off("mouseenter mouseleave")), b.API.trigger("cycle-stopped", [b]).log("cycle-stopped");
40463		}, reinit: function reinit() {
40464			var a = this.opts();a.API.destroy(), a.container.cycle();
40465		}, remove: function remove(b) {
40466			for (var c, d, e = this.opts(), f = [], g = 1, h = 0; h < e.slides.length; h++) {
40467				c = e.slides[h], h == b ? d = c : (f.push(c), a(c).data("cycle.opts").slideNum = g, g++);
40468			}d && (e.slides = a(f), e.slideCount--, a(d).remove(), b == e.currSlide ? e.API.advanceSlide(1) : b < e.currSlide ? e.currSlide-- : e.currSlide++, e.API.trigger("cycle-slide-removed", [e, b, d]).log("cycle-slide-removed"), e.API.updateView());
40469		} }), a(document).on("click.cycle", "[data-cycle-cmd]", function (b) {
40470		b.preventDefault();var c = a(this),
40471		    d = c.data("cycle-cmd"),
40472		    e = c.data("cycle-context") || ".cycle-slideshow";a(e).cycle(d, c.data("cycle-arg"));
40473	});
40474}(jQuery), /*! hash plugin for Cycle2;  version: 20130905 */
40475function (a) {
40476	"use strict";
40477	function b(b, c) {
40478		var d;return b._hashFence ? void (b._hashFence = !1) : (d = window.location.hash.substring(1), void b.slides.each(function (e) {
40479			if (a(this).data("cycle-hash") == d) {
40480				if (c === !0) b.startingSlide = e;else {
40481					var f = b.currSlide < e;b.nextSlide = e, b.API.prepareTx(!0, f);
40482				}return !1;
40483			}
40484		}));
40485	}a(document).on("cycle-pre-initialize", function (c, d) {
40486		b(d, !0), d._onHashChange = function () {
40487			b(d, !1);
40488		}, a(window).on("hashchange", d._onHashChange);
40489	}), a(document).on("cycle-update-view", function (a, b, c) {
40490		c.hash && "#" + c.hash != window.location.hash && (b._hashFence = !0, window.location.hash = c.hash);
40491	}), a(document).on("cycle-destroyed", function (b, c) {
40492		c._onHashChange && a(window).off("hashchange", c._onHashChange);
40493	});
40494}(jQuery), /*! loader plugin for Cycle2;  version: 20131121 */
40495function (a) {
40496	"use strict";
40497	a.extend(a.fn.cycle.defaults, { loader: !1 }), a(document).on("cycle-bootstrap", function (b, c) {
40498		function d(b, d) {
40499			function f(b) {
40500				var f;"wait" == c.loader ? (h.push(b), 0 === j && (h.sort(g), e.apply(c.API, [h, d]), c.container.removeClass("cycle-loading"))) : (f = a(c.slides[c.currSlide]), e.apply(c.API, [b, d]), f.show(), c.container.removeClass("cycle-loading"));
40501			}function g(a, b) {
40502				return a.data("index") - b.data("index");
40503			}var h = [];if ("string" == a.type(b)) b = a.trim(b);else if ("array" === a.type(b)) for (var i = 0; i < b.length; i++) {
40504				b[i] = a(b[i])[0];
40505			}b = a(b);var j = b.length;j && (b.css("visibility", "hidden").appendTo("body").each(function (b) {
40506				function g() {
40507					0 === --i && (--j, f(k));
40508				}var i = 0,
40509				    k = a(this),
40510				    l = k.is("img") ? k : k.find("img");return k.data("index", b), l = l.filter(":not(.cycle-loader-ignore)").filter(':not([src=""])'), l.length ? (i = l.length, void l.each(function () {
40511					this.complete ? g() : a(this).load(function () {
40512						g();
40513					}).on("error", function () {
40514						0 === --i && (c.API.log("slide skipped; img not loaded:", this.src), 0 === --j && "wait" == c.loader && e.apply(c.API, [h, d]));
40515					});
40516				})) : (--j, void h.push(k));
40517			}), j && c.container.addClass("cycle-loading"));
40518		}var e;c.loader && (e = c.API.add, c.API.add = d);
40519	});
40520}(jQuery), /*! pager plugin for Cycle2;  version: 20140415 */
40521function (a) {
40522	"use strict";
40523	function b(b, c, d) {
40524		var e,
40525		    f = b.API.getComponent("pager");f.each(function () {
40526			var f = a(this);if (c.pagerTemplate) {
40527				var g = b.API.tmpl(c.pagerTemplate, c, b, d[0]);e = a(g).appendTo(f);
40528			} else e = f.children().eq(b.slideCount - 1);e.on(b.pagerEvent, function (a) {
40529				b.pagerEventBubble || a.preventDefault(), b.API.page(f, a.currentTarget);
40530			});
40531		});
40532	}function c(a, b) {
40533		var c = this.opts();if (!c.busy || c.manualTrump) {
40534			var d = a.children().index(b),
40535			    e = d,
40536			    f = c.currSlide < e;c.currSlide != e && (c.nextSlide = e, c._tempFx = c.pagerFx, c.API.prepareTx(!0, f), c.API.trigger("cycle-pager-activated", [c, a, b]));
40537		}
40538	}a.extend(a.fn.cycle.defaults, { pager: "> .cycle-pager", pagerActiveClass: "cycle-pager-active", pagerEvent: "click.cycle", pagerEventBubble: void 0, pagerTemplate: "<span>&bull;</span>" }), a(document).on("cycle-bootstrap", function (a, c, d) {
40539		d.buildPagerLink = b;
40540	}), a(document).on("cycle-slide-added", function (a, b, d, e) {
40541		b.pager && (b.API.buildPagerLink(b, d, e), b.API.page = c);
40542	}), a(document).on("cycle-slide-removed", function (b, c, d) {
40543		if (c.pager) {
40544			var e = c.API.getComponent("pager");e.each(function () {
40545				var b = a(this);a(b.children()[d]).remove();
40546			});
40547		}
40548	}), a(document).on("cycle-update-view", function (b, c) {
40549		var d;c.pager && (d = c.API.getComponent("pager"), d.each(function () {
40550			a(this).children().removeClass(c.pagerActiveClass).eq(c.currSlide).addClass(c.pagerActiveClass);
40551		}));
40552	}), a(document).on("cycle-destroyed", function (a, b) {
40553		var c = b.API.getComponent("pager");c && (c.children().off(b.pagerEvent), b.pagerTemplate && c.empty());
40554	});
40555}(jQuery), /*! prevnext plugin for Cycle2;  version: 20140408 */
40556function (a) {
40557	"use strict";
40558	a.extend(a.fn.cycle.defaults, { next: "> .cycle-next", nextEvent: "click.cycle", disabledClass: "disabled", prev: "> .cycle-prev", prevEvent: "click.cycle", swipe: !1 }), a(document).on("cycle-initialized", function (a, b) {
40559		if (b.API.getComponent("next").on(b.nextEvent, function (a) {
40560			a.preventDefault(), b.API.next();
40561		}), b.API.getComponent("prev").on(b.prevEvent, function (a) {
40562			a.preventDefault(), b.API.prev();
40563		}), b.swipe) {
40564			var c = b.swipeVert ? "swipeUp.cycle" : "swipeLeft.cycle swipeleft.cycle",
40565			    d = b.swipeVert ? "swipeDown.cycle" : "swipeRight.cycle swiperight.cycle";b.container.on(c, function () {
40566				b._tempFx = b.swipeFx, b.API.next();
40567			}), b.container.on(d, function () {
40568				b._tempFx = b.swipeFx, b.API.prev();
40569			});
40570		}
40571	}), a(document).on("cycle-update-view", function (a, b) {
40572		if (!b.allowWrap) {
40573			var c = b.disabledClass,
40574			    d = b.API.getComponent("next"),
40575			    e = b.API.getComponent("prev"),
40576			    f = b._prevBoundry || 0,
40577			    g = void 0 !== b._nextBoundry ? b._nextBoundry : b.slideCount - 1;b.currSlide == g ? d.addClass(c).prop("disabled", !0) : d.removeClass(c).prop("disabled", !1), b.currSlide === f ? e.addClass(c).prop("disabled", !0) : e.removeClass(c).prop("disabled", !1);
40578		}
40579	}), a(document).on("cycle-destroyed", function (a, b) {
40580		b.API.getComponent("prev").off(b.nextEvent), b.API.getComponent("next").off(b.prevEvent), b.container.off("swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle");
40581	});
40582}(jQuery), /*! progressive loader plugin for Cycle2;  version: 20130315 */
40583function (a) {
40584	"use strict";
40585	a.extend(a.fn.cycle.defaults, { progressive: !1 }), a(document).on("cycle-pre-initialize", function (b, c) {
40586		if (c.progressive) {
40587			var d,
40588			    e,
40589			    f = c.API,
40590			    g = f.next,
40591			    h = f.prev,
40592			    i = f.prepareTx,
40593			    j = a.type(c.progressive);if ("array" == j) d = c.progressive;else if (a.isFunction(c.progressive)) d = c.progressive(c);else if ("string" == j) {
40594				if (e = a(c.progressive), d = a.trim(e.html()), !d) return;if (/^(\[)/.test(d)) try {
40595					d = a.parseJSON(d);
40596				} catch (k) {
40597					return void f.log("error parsing progressive slides", k);
40598				} else d = d.split(new RegExp(e.data("cycle-split") || "\n")), d[d.length - 1] || d.pop();
40599			}i && (f.prepareTx = function (a, b) {
40600				var e, f;return a || 0 === d.length ? void i.apply(c.API, [a, b]) : void (b && c.currSlide == c.slideCount - 1 ? (f = d[0], d = d.slice(1), c.container.one("cycle-slide-added", function (a, b) {
40601					setTimeout(function () {
40602						b.API.advanceSlide(1);
40603					}, 50);
40604				}), c.API.add(f)) : b || 0 !== c.currSlide ? i.apply(c.API, [a, b]) : (e = d.length - 1, f = d[e], d = d.slice(0, e), c.container.one("cycle-slide-added", function (a, b) {
40605					setTimeout(function () {
40606						b.currSlide = 1, b.API.advanceSlide(-1);
40607					}, 50);
40608				}), c.API.add(f, !0)));
40609			}), g && (f.next = function () {
40610				var a = this.opts();if (d.length && a.currSlide == a.slideCount - 1) {
40611					var b = d[0];d = d.slice(1), a.container.one("cycle-slide-added", function (a, b) {
40612						g.apply(b.API), b.container.removeClass("cycle-loading");
40613					}), a.container.addClass("cycle-loading"), a.API.add(b);
40614				} else g.apply(a.API);
40615			}), h && (f.prev = function () {
40616				var a = this.opts();if (d.length && 0 === a.currSlide) {
40617					var b = d.length - 1,
40618					    c = d[b];d = d.slice(0, b), a.container.one("cycle-slide-added", function (a, b) {
40619						b.currSlide = 1, b.API.advanceSlide(-1), b.container.removeClass("cycle-loading");
40620					}), a.container.addClass("cycle-loading"), a.API.add(c, !0);
40621				} else h.apply(a.API);
40622			});
40623		}
40624	});
40625}(jQuery), /*! tmpl plugin for Cycle2;  version: 20121227 */
40626function (a) {
40627	"use strict";
40628	a.extend(a.fn.cycle.defaults, { tmplRegex: "{{((.)?.*?)}}" }), a.extend(a.fn.cycle.API, { tmpl: function tmpl(b, c) {
40629			var d = new RegExp(c.tmplRegex || a.fn.cycle.defaults.tmplRegex, "g"),
40630			    e = a.makeArray(arguments);return e.shift(), b.replace(d, function (b, c) {
40631				var d,
40632				    f,
40633				    g,
40634				    h,
40635				    i = c.split(".");for (d = 0; d < e.length; d++) {
40636					if (g = e[d]) {
40637						if (i.length > 1) for (h = g, f = 0; f < i.length; f++) {
40638							g = h, h = h[i[f]] || c;
40639						} else h = g[c];if (a.isFunction(h)) return h.apply(g, e);if (void 0 !== h && null !== h && h != c) return h;
40640					}
40641				}return c;
40642			});
40643		} });
40644}(jQuery);
40645
40646/*! swipe plugin for Cycle2;  version: 20121120 */
40647(function ($) {
40648	"use strict";
40649
40650	// this script adds support for touch events.  the logic is lifted from jQuery Mobile.
40651	// if you have jQuery Mobile installed, you do NOT need this script
40652
40653	var supportTouch = 'ontouchend' in document;
40654
40655	$.event.special.swipe = $.event.special.swipe || {
40656		scrollSupressionThreshold: 10, // More than this horizontal displacement, and we will suppress scrolling.
40657		durationThreshold: 1000, // More time than this, and it isn't a swipe.
40658		horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this.
40659		verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this.
40660
40661		setup: function setup() {
40662			var $this = $(this);
40663
40664			$this.bind('touchstart', function (event) {
40665				var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event;
40666				var stop,
40667				    start = {
40668					time: new Date().getTime(),
40669					coords: [data.pageX, data.pageY],
40670					origin: $(event.target)
40671				};
40672
40673				function moveHandler(event) {
40674					if (!start) return;
40675
40676					var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event;
40677
40678					stop = {
40679						time: new Date().getTime(),
40680						coords: [data.pageX, data.pageY]
40681					};
40682
40683					// prevent scrolling
40684					if (Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.scrollSupressionThreshold) {
40685						event.preventDefault();
40686					}
40687				}
40688
40689				$this.bind('touchmove', moveHandler).one('touchend', function (event) {
40690					$this.unbind('touchmove', moveHandler);
40691
40692					if (start && stop) {
40693						if (stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs(start.coords[1] - stop.coords[1]) < $.event.special.swipe.verticalDistanceThreshold) {
40694
40695							start.origin.trigger("swipe").trigger(start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight");
40696						}
40697					}
40698					start = stop = undefined;
40699				});
40700			});
40701		}
40702	};
40703
40704	$.event.special.swipeleft = $.event.special.swipeleft || {
40705		setup: function setup() {
40706			$(this).bind('swipe', $.noop);
40707		}
40708	};
40709	$.event.special.swiperight = $.event.special.swiperight || $.event.special.swipeleft;
40710})(jQuery);
40711/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20141007 */
40712!function (a) {
40713	"use strict";
40714	a(document).on("cycle-bootstrap", function (a, b, c) {
40715		"carousel" === b.fx && (c.getSlideIndex = function (a) {
40716			var b = this.opts()._carouselWrap.children(),
40717			    c = b.index(a);return c % b.length;
40718		}, c.next = function () {
40719			var a = b.reverse ? -1 : 1;b.allowWrap === !1 && b.currSlide + a > b.slideCount - b.carouselVisible || (b.API.advanceSlide(a), b.API.trigger("cycle-next", [b]).log("cycle-next"));
40720		});
40721	}), a.fn.cycle.transitions.carousel = { preInit: function preInit(b) {
40722			b.hideNonActive = !1, b.container.on("cycle-destroyed", a.proxy(this.onDestroy, b.API)), b.API.stopTransition = this.stopTransition;for (var c = 0; c < b.startingSlide; c++) {
40723				b.container.append(b.slides[0]);
40724			}
40725		}, postInit: function postInit(b) {
40726			var c,
40727			    d,
40728			    e,
40729			    f,
40730			    g = b.carouselVertical;b.carouselVisible && b.carouselVisible > b.slideCount && (b.carouselVisible = b.slideCount - 1);var h = b.carouselVisible || b.slides.length,
40731			    i = { display: g ? "block" : "inline-block", position: "static" };if (b.container.css({ position: "relative", overflow: "hidden" }), b.slides.css(i), b._currSlide = b.currSlide, f = a('<div class="cycle-carousel-wrap"></div>').prependTo(b.container).css({ margin: 0, padding: 0, top: 0, left: 0, position: "absolute" }).append(b.slides), b._carouselWrap = f, g || f.css("white-space", "nowrap"), b.allowWrap !== !1) {
40732				for (d = 0; d < (void 0 === b.carouselVisible ? 2 : 1); d++) {
40733					for (c = 0; c < b.slideCount; c++) {
40734						f.append(b.slides[c].cloneNode(!0));
40735					}for (c = b.slideCount; c--;) {
40736						f.prepend(b.slides[c].cloneNode(!0));
40737					}
40738				}f.find(".cycle-slide-active").removeClass("cycle-slide-active"), b.slides.eq(b.startingSlide).addClass("cycle-slide-active");
40739			}b.pager && b.allowWrap === !1 && (e = b.slideCount - h, a(b.pager).children().filter(":gt(" + e + ")").hide()), b._nextBoundry = b.slideCount - b.carouselVisible, this.prepareDimensions(b);
40740		}, prepareDimensions: function prepareDimensions(b) {
40741			var c,
40742			    d,
40743			    e,
40744			    f,
40745			    g = b.carouselVertical,
40746			    h = b.carouselVisible || b.slides.length;if (b.carouselFluid && b.carouselVisible ? b._carouselResizeThrottle || this.fluidSlides(b) : b.carouselVisible && b.carouselSlideDimension ? (c = h * b.carouselSlideDimension, b.container[g ? "height" : "width"](c)) : b.carouselVisible && (c = h * a(b.slides[0])[g ? "outerHeight" : "outerWidth"](!0), b.container[g ? "height" : "width"](c)), d = b.carouselOff
40746set || 0, b.allowWrap !== !1) if (b.carouselSlideDimension) d -= (b.slideCount + b.currSlide) * b.carouselSlideDimension;else for (e = b._carouselWrap.children(), f = 0; f < b.slideCount + b.currSlide; f++) {
40747				d -= a(e[f])[g ? "outerHeight" : "outerWidth"](!0);
40748			}b._carouselWrap.css(g ? "top" : "left", d);
40749		}, fluidSlides: function fluidSlides(b) {
40750			function c() {
40751				clearTimeout(e), e = setTimeout(d, 20);
40752			}function d() {
40753				b._carouselWrap.stop(!1, !0);var a = b.container.width() / b.carouselVisible;a = Math.ceil(a - g), b._carouselWrap.children().width(a), b._sentinel && b._sentinel.width(a), h(b);
40754			}var e,
40755			    f = b.slides.eq(0),
40756			    g = f.outerWidth() - f.width(),
40757			    h = this.prepareDimensions;a(window).on("resize", c), b._carouselResizeThrottle = c, d();
40758		}, transition: function transition(b, c, d, e, f) {
40759			var g,
40760			    h = {},
40761			    i = b.nextSlide - b.currSlide,
40762			    j = b.carouselVertical,
40763			    k = b.speed;if (b.allowWrap === !1) {
40764				e = i > 0;var l = b._currSlide,
40765				    m = b.slideCount - b.carouselVisible;i > 0 && b.nextSlide > m && l == m ? i = 0 : i > 0 && b.nextSlide > m ? i = b.nextSlide - l - (b.nextSlide - m) : 0 > i && b.currSlide > m && b.nextSlide > m ? i = 0 : 0 > i && b.currSlide > m ? i += b.currSlide - m : l = b.currSlide, g = this.getScroll(b, j, l, i), b.API.opts()._currSlide = b.nextSlide > m ? m : b.nextSlide;
40766			} else e && 0 === b.nextSlide ? (g = this.getDim(b, b.currSlide, j), f = this.genCallback(b, e, j, f)) : e || b.nextSlide != b.slideCount - 1 ? g = this.getScroll(b, j, b.currSlide, i) : (g = this.getDim(b, b.currSlide, j), f = this.genCallback(b, e, j, f));h[j ? "top" : "left"] = e ? "-=" + g : "+=" + g, b.throttleSpeed && (k = g / a(b.slides[0])[j ? "height" : "width"]() * b.speed), b._carouselWrap.animate(h, k, b.easing, f);
40767		}, getDim: function getDim(b, c, d) {
40768			var e = a(b.slides[c]);return e[d ? "outerHeight" : "outerWidth"](!0);
40769		}, getScroll: function getScroll(a, b, c, d) {
40770			var e,
40771			    f = 0;if (d > 0) for (e = c; c + d > e; e++) {
40772				f += this.getDim(a, e, b);
40773			} else for (e = c; e > c + d; e--) {
40774				f += this.getDim(a, e, b);
40775			}return f;
40776		}, genCallback: function genCallback(b, c, d, e) {
40777			return function () {
40778				var c = a(b.slides[b.nextSlide]).position(),
40779				    f = 0 - c[d ? "top" : "left"] + (b.carouselOffset || 0);b._carouselWrap.css(b.carouselVertical ? "top" : "left", f), e();
40780			};
40781		}, stopTransition: function stopTransition() {
40782			var a = this.opts();a.slides.stop(!1, !0), a._carouselWrap.stop(!1, !0);
40783		}, onDestroy: function onDestroy() {
40784			var b = this.opts();b._carouselResizeThrottle && a(window).off("resize", b._carouselResizeThrottle), b.slides.prependTo(b.container), b._carouselWrap.remove();
40785		} };
40786}(jQuery);
40787/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
40788jQuery.migrateMute === void 0 && (jQuery.migrateMute = !0), function (e, t, n) {
40789	function r(n) {
40790		var r = t.console;i[n] || (i[n] = !0, e.migrateWarnings.push(n), r && r.warn && !e.migrateMute && (r.warn("JQMIGRATE: " + n), e.migrateTrace && r.trace && r.trace()));
40791	}function a(t, a, i, o) {
40792		if (_defineProperty2.default) try {
40793			return (0, _defineProperty2.default)(t, a, { configurable: !0, enumerable: !0, get: function get() {
40794					return r(o), i;
40795				}, set: function set(e) {
40796					r(o), i = e;
40797				} }), n;
40798		} catch (s) {}e._definePropertyBroken = !0, t[a] = i;
40799	}var i = {};e.migrateWarnings = [], !e.migrateMute && t.console && t.console.log && t.console.log("JQMIGRATE: Logging is active"), e.migrateTrace === n && (e.migrateTrace = !0), e.migrateReset = function () {
40800		i = {}, e.migrateWarnings.length = 0;
40801	}, "BackCompat" === document.compatMode && r("jQuery is not compatible with Quirks Mode");var o = e("<input/>", { size: 1 }).attr("size") && e.attrFn,
40802	    s = e.attr,
40803	    u = e.attrHooks.value && e.attrHooks.value.get || function () {
40804		return null;
40805	},
40806	    c = e.attrHooks.value && e.attrHooks.value.set || function () {
40807		return n;
40808	},
40809	    l = /^(?:input|button)$/i,
40810	    d = /^[238]$/,
40811	    p = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
40812	    f = /^(?:checked|selected)$/i;a(e, "attrFn", o || {}, "jQuery.attrFn is deprecated"), e.attr = function (t, a, i, u) {
40813		var c = a.toLowerCase(),
40814		    g = t && t.nodeType;return u && (4 > s.length && r("jQuery.fn.attr( props, pass ) is deprecated"), t && !d.test(g) && (
40814o ? a in o : e.isFunction(e.fn[a]))) ? e(t)[a](i) : ("type" === a && i !== n && l.test(t.nodeName) && t.parentNode && r("Can't change the 'type' of an input or button in IE 6/7/8"), !e.attrHooks[c] && p.test(c) && (e.attrHooks[c] = { get: function get(t, r) {
40815				var a,
40816				    i = e.prop(t, r);return i === !0 || "boolean" != typeof i && (a = t.getAttributeNode(r)) && a.nodeValue !== !1 ? r.toLowerCase() : n;
40817			}, set: function set(t, n, r) {
40818				var a;return n === !1 ? e.removeAttr(t, r) : (a = e.propFix[r] || r, a in t && (t[a] = !0), t.setAttribute(r, r.toLowerCase())), r;
40819			} }, f.test(c) && r("jQuery.fn.attr('" + c + "') may use property instead of attribute")), s.call(e, t, a, i));
40820	}, e.attrHooks.value = { get: function get(e, t) {
40821			var n = (e.nodeName || "").toLowerCase();return "button" === n ? u.apply(this, arguments) : ("input" !== n && "option" !== n && r("jQuery.fn.attr('value') no longer gets properties"), t in e ? e.value : null);
40822		}, set: function set(e, t) {
40823			var a = (e.nodeName || "").toLowerCase();return "button" === a ? c.apply(this, arguments) : ("input" !== a && "option" !== a && r("jQuery.fn.attr('value', val) no longer sets properties"), e.value = t, n);
40824		} };var g,
40825	    h,
40826	    v = e.fn.init,
40827	    m = e.parseJSON,
40828	    y = /^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init = function (t, n, a) {
40829		var i;return t && "string" == typeof t && !e.isPlainObject(n) && (i = y.exec(e.trim(t))) && i[0] && ("<" !== t.charAt(0) && r("$(html) HTML strings must start with '<' character"), i[3] && r("$(html) HTML text after last tag is ignored"), "#" === i[0].charAt(0) && (r("HTML string cannot start with a '#' character"), e.error("JQMIGRATE: Invalid selector string (XSS)")), n && n.context && (n = n.context), e.parseHTML) ? v.call(this, e.parseHTML(i[2], n, !0), n, a) : v.apply(this, arguments);
40830	}, e.fn.init.prototype = e.fn, e.parseJSON = function (e) {
40831		return e || null === e ? m.apply(this, arguments) : (r("jQuery.parseJSON requires a valid JSON string"), null);
40832	}, e.uaMatch = function (e) {
40833		e = e.toLowerCase();var t = /(chrome)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/.exec(e) || 0 > e.indexOf("compatible") && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e) || [];return { browser: t[1] || "", version: t[2] || "0" };
40834	}, e.browser || (g = e.uaMatch(navigator.userAgent), h = {}, g.browser && (h[g.browser] = !0, h.version = g.version), h.chrome ? h.webkit = !0 : h.webkit && (h.safari = !0), e.browser = h), a(e, "browser", e.browser, "jQuery.browser is deprecated"), e.sub = function () {
40835		function t(e, n) {
40836			return new t.fn.init(e, n);
40837		}e.extend(!0, t, this), t.superclass = this, t.fn = t.prototype = this(), t.fn.constructor = t, t.sub = this.sub, t.fn.init = function (r, a) {
40838			return a && a instanceof e && !(a instanceof t) && (a = t(a)), e.fn.init.call(this, r, a, n);
40839		}, t.fn.init.prototype = t.fn;var n = t(document);return r("jQuery.sub() is deprecated"), t;
40840	}, e.ajaxSetup({ converters: { "text json": e.parseJSON } });var b = e.fn.data;e.fn.data = function (t) {
40841		var a,
40842		    i,
40843		    o = this[0];return !o || "events" !== t || 1 !== arguments.length || (a = e.data(o, t), i = e._data(o, t), a !== n && a !== i || i === n) ? b.apply(this, arguments) : (r("Use of jQuery.fn.data('events') is deprecated"), i);
40844	};var j = /\/(java|ecma)script/i,
40845	    w = e.fn.andSelf || e.fn.addBack;e.fn.andSelf = function () {
40846		return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"), w.apply(this, arguments);
40847	}, e.clean || (e.clean = function (t, a, i, o) {
40848		a = a || document, a = !a.nodeType && a[0] || a, a = a.ownerDocument || a, r("jQuery.clean() is deprecated");var s,
40849		    u,
40850		    c,
40851		    l,
40852		    d = [];if (e.merge(d, e.buildFragment(t, a).childNodes), i) for (c = function c(e) {
40853			return !e.type || j.test(e.type) ? o ? o.push(e.parentNode ? e.parentNode.removeChild(e) : e) : i.appendChild(e) : n;
40854		}, s = 0; null != (u = d[s]); s++) {
40855			e.nodeName(u, "script") && c(u) || (i.appendChild(u), u.getElementsByTagName !== n && (l = e.grep(e.merge([], u.getElementsByTagName("script")), c), d.splice.apply(d, [s + 1, 0].concat(l)), s += l.length));
40856		}return d;
40857	});var Q = e.event.add,
40858	    x = e.event.remove,
40859	    k = e.event.trigger,
40860	    N = e.fn.toggle,
40861	    T = e.fn.live,
40862	    M = e.fn.die,
40863	    S = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
40864	    C = RegExp("\\b(?:" + S + ")\\b"),
40865	    H = /(?:^|\s)hover(\.\S+|)\b/,
40866	    A = function A(t) {
40867		return "string" != typeof t || e.event.special.hover ? t : (H.test(t) && r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"), t && t.replace(H, "mouseenter$1 mouseleave$1"));
40868	};e.event.props && "attrChange" !== e.event.props[0] && e.event.props.unshift("attrChange", "attrName", "relatedNode", "srcElement"), e.event.dispatch && a(e.event, "handle", e.event.dispatch, "jQuery.event.handle is undocumented and deprecated"), e.event.add = function (e, t, n, a, i) {
40869		e !== document && C.test(t) && r("AJAX events should be attached to document: " + t), Q.call(this, e, A(t || ""), n, a, i);
40870	}, e.event.remove = function (e, t, n, r, a) {
40871		x.call(this, e, A(t) || "", n, r, a);
40872	}, e.fn.error = function () {
40873		var e = Array.prototype.slice.call(arguments, 0);return r("jQuery.fn.error() is deprecated"), e.splice(0, 0, "error"), arguments.length ? this.bind.apply(this, e) : (this.triggerHandler.apply(this, e), this);
40874	}, e.fn.toggle = function (t, n) {
40875		if (!e.isFunction(t) || !e.isFunction(n)) return N.apply(this, arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a = arguments,
40876		    i = t.guid || e.guid++,
40877		    o = 0,
40878		    s = function s(n) {
40879			var r = (e._data(this, "lastToggle" + t.guid) || 0) % o;return e._data(this, "lastToggle" + t.guid, r + 1), n.preventDefault(), a[r].apply(this, arguments) || !1;
40880		};for (s.guid = i; a.length > o;) {
40881			a[o++].guid = i;
40882		}return this.click(s);
40883	}, e.fn.live = function (t, n, a) {
40884		return r("jQuery.fn.live() is deprecated"), T ? T.apply(this, arguments) : (e(this.context).on(t, this.selector, n, a), this);
40885	}, e.fn.die = function (t, n) {
40886		return r("jQuery.fn.die() is deprecated"), M ? M.apply(this, arguments) : (e(this.context).off(t, this.selector || "**", n), this);
40887	}, e.event.trigger = function (e, t, n, a) {
40888		return n || C.test(e) || r("Global events are undocumented and deprecated"), k.call(this, e, t, n || document, a);
40889	}, e.each(S.split("|"), function (t, n) {
40890		e.event.special[n] = { setup: function setup() {
40891				var t = this;return t !== document && (e.event.add(document, n + "." + e.guid, function () {
40892					e.event.trigger(n, null, t, !0);
40893				}), e._data(this, n, e.guid++)), !1;
40894			}, teardown: function teardown() {
40895				return this !== document && e.event.remove(document, n + "." + e._data(this, n)), !1;
40896			} };
40897	});
40898}(jQuery, window);
40899/**!
40900 * MixItUp v2.1.9
40901 *
40902 * @copyright Copyright 2015 KunkaLabs Limited.
40903 * @author    KunkaLabs Limited.
40904 * @link      https://mixitup.kunkalabs.com
40905 *
40906 * @license   Commercial use requires a commercial license.
40907 *            https://mixitup.kunkalabs.com/licenses/
40908 *
40909 *            Non-commercial use permitted under terms of CC-BY-NC license.
40910 *            http://creativecommons.org/licenses/by-nc/3.0/
40911 */
40912
40913(function ($, undf) {
40914
40915	/**
40916  * MixItUp Constructor Function
40917  * @constructor
40918  * @extends jQuery
40919  */
40920
40921	$.MixItUp = function () {
40922		var self = this;
40923
40924		self._execAction('_constructor', 0);
40925
40926		$.extend(self, {
40927
40928			/* Public Properties
40929   ---------------------------------------------------------------------- */
40930
40931			selectors: {
40932				target: '.mix',
40933				filter: '.filter',
40934				sort: '.sort'
40935			},
40936
40937			animation: {
40938				enable: true,
40939				effects: 'fade scale',
40940				duration: 600,
40941				easing: 'ease',
40942				perspectiveDistance: '3000',
40943				perspectiveOrigin: '50% 50%',
40944				queue: true,
40945				queueLimit: 1,
40946				animateChangeLayout: false,
40947				animateResizeContainer: true,
40948				animateResizeTargets: false,
40949				staggerSequence: false,
40950				reverseOut: false
40951			},
40952
40953			callbacks: {
40954				onMixLoad: false,
40955				onMixStart: false,
40956				onMixBusy: false,
40957				onMixEnd: false,
40958				onMixFail: false,
40959				_user: false
40960			},
40961
40962			controls: {
40963				enable: true,
40964				live: false,
40965				toggleFilterButtons: false,
40966				toggleLogic: 'or',
40967				activeClass: 'active'
40968			},
40969
40970			layout: {
40971				display: 'inline-block',
40972				containerClass: '',
40973				containerClassFail: 'fail'
40974			},
40975
40976			load: {
40977				filter: 'all',
40978				sort: false
40979			},
40980
40981			/* Private Properties
40982   ---------------------------------------------------------------------- */
40983
40984			_$body: null,
40985			_$container: null,
40986			_$targets: null,
40987			_$parent: null,
40988			_$sortButtons: null,
40989			_$filterButtons: null,
40990
40991			_suckMode: false,
40992			_mixing: false,
40993			_sorting: false,
40994			_clicking: false,
40995			_loading: true,
40996			_changingLayout: false,
40997			_changingClass: false,
40998			_changingDisplay: false,
40999
41000			_origOrder: [],
41001			_startOrder: [],
41002			_newOrder: [],
41003			_activeFilter: null,
41004			_toggleArray: [],
41005			_toggleString: '',
41006			_activeSort: 'default:asc',
41007			_newSort: null,
41008			_startHeight: null,
41009			_newHeight: null,
41010			_incPadding: true,
41011			_newDisplay: null,
41012			_newClass: null,
41013			_targetsBound: 0,
41014			_targetsDone: 0,
41015			_queue: [],
41016
41017			_$show: $(),
41018			_$hide: $()
41019		});
41020
41021		self._execAction('_constructor', 1);
41022	};
41023
41024	/**
41025  * MixItUp Prototype
41026  * @override
41027  */
41028
41029	$.MixItUp.prototype = {
41030		constructor: $.MixItUp,
41031
41032		/* Static Properties
41033  ---------------------------------------------------------------------- */
41034
41035		_instances: {},
41036		_handled: {
41037			_filter: {},
41038			_sort: {}
41039		},
41040		_bound: {
41041			_filter: {},
41042			_sort: {}
41043		},
41044		_actions: {},
41045		_filters: {},
41046
41047		/* Static Methods
41048  ---------------------------------------------------------------------- */
41049
41050		/**
41051   * Extend
41052   * @since 2.1.0
41053   * @param {object} new properties/methods
41054   * @extends {object} prototype
41055   */
41056
41057		extend: function extend(extension) {
41058			for (var key in extension) {
41059				$.MixItUp.prototype[key] = extension[key];
41060			}
41061		},
41062
41063		/**
41064   * Add Action
41065   * @since 2.1.0
41066   * @param {string} hook name
41067   * @param {string} namespace
41068   * @param {function} function to execute
41069   * @param {number} priority
41070   * @extends {object} $.MixItUp.prototype._actions
41071   */
41072
41073		addAction: function addAction(hook, name, func, priority) {
41074			$.MixItUp.prototype._addHook('_actions', hook, name, func, priority);
41075		},
41076
41077		/**
41078   * Add Filter
41079   * @since 2.1.0
41080   * @param {string} hook name
41081   * @param {string} namespace
41082   * @param {function} function to execute
41083   * @param {number} priority
41084   * @extends {object} $.MixItUp.prototype._filters
41085   */
41086
41087		addFilter: function addFilter(hook, name, func, priority) {
41088			$.MixItUp.prototype._addHook('_filters', hook, name, func, priority);
41089		},
41090
41091		/**
41092   * Add Hook
41093   * @since 2.1.0
41094   * @param {string} type of hook
41095   * @param {string} hook name
41096   * @param {function} function to execute
41097   * @param {number} priority
41098   * @extends {object} $.MixItUp.prototype._filters
41099   */
41100
41101		_addHook: function _addHook(type, hook, name, func, priority) {
41102			var collection = $.MixItUp.prototype[type],
41103			    obj = {};
41104
41105			priority = priority === 1 || priority === 'post' ? 'post' : 'pre';
41106
41107			obj[hook] = {};
41108			obj[hook][priority] = {};
41109			obj[hook][priority][name] = func;
41110
41111			$.extend(true, collection, obj);
41112		},
41113
41114		/* Private Methods
41115  ---------------------------------------------------------------------- */
41116
41117		/**
41118   * Initialise
41119   * @since 2.0.0
41120   * @param {object} domNode
41121   * @param {object} config
41122   */
41123
41124		_init: function _init(domNode, config) {
41125			var self = this;
41126
41127			self._execAction('_init', 0, arguments);
41128
41129			config && $.extend(true, self, config);
41130
41131			self._$body = $('body');
41132			self._domNode = domNode;
41133			self._$container = $(domNode);
41134			self._$container.addClass(self.layout.containerClass);
41135			self._id = domNode.id;
41136
41137			self._platformDetect();
41138
41139			self._brake = self._getPrefixedCSS('transition', 'none');
41140
41141			self._refresh(true);
41142
41143			self._$parent = self._$targets.parent().length ? self._$targets.parent() : self._$container;
41144
41145			if (self.load.sort) {
41146				self._newSort = self._parseSort(self.load.sort);
41147				self._newSortString = self.load.sort;
41148				self._activeSort = self.load.sort;
41149				self._sort();
41150				self._printSort();
41151			}
41152
41153			self._activeFilter = self.load.filter === 'all' ? self.selectors.target : self.load.filter === 'none' ? '' : self.load.filter;
41154
41155			self.controls.enable && self._bindHandlers();
41156
41157			if (self.controls.toggleFilterButtons) {
41158				self._buildToggleArray();
41159
41160				for (var i = 0; i < self._toggleArray.length; i++) {
41161					self._updateControls({ filter: self._toggleArray[i], sort: self._activeSort }, true);
41162				};
41163			} else if (self.controls.enable) {
41164				self._updateControls({ filter: self._activeFilter, sort: self._activeSort });
41165			}
41166
41167			self._filter();
41168
41169			self._init = true;
41170
41171			self._$container.data('mixItUp', self);
41172
41173			self._execAction('_init', 1, arguments);
41174
41175			self._buildState();
41176
41177			self._$targets.css(self._brake);
41178
41179			self._goMix(self.animation.enable);
41180		},
41181
41182		/**
41183   * Platform Detect
41184   * @since 2.0.0
41185   */
41186
41187		_platformDetect: function _platformDetect() {
41188			var self = this,
41189			    vendorsTrans = ['Webkit', 'Moz', 'O', 'ms'],
41190			    vendorsRAF = ['webkit', 'moz'],
41191			    chrome = window.navigator.appVersion.match(/Chrome\/(\d+)\./) || false,
41192			    ff = typeof InstallTrigger !== 'undefined',
41193			    prefix = function prefix(el) {
41194				for (var i = 0; i < vendorsTrans.length; i++) {
41195					if (vendorsTrans[i] + 'Transition' in el.style) {
41196						return {
41197							prefix: '-' + vendorsTrans[i].toLowerCase() + '-',
41198							vendor: vendorsTrans[i]
41199						};
41200					};
41201				};
41202				return 'transition' in el.style ? '' : false;
41203			},
41204			    transPrefix = prefix(self._domNode);
41205
41206			self._execAction('_platformDetect', 0);
41207
41208			self._chrome = chrome ? parseInt(chrome[1], 10) : false;
41209			self._ff = ff ? parseInt(window.navigator.userAgent.match(/rv:([^)]+)\)/)[1]) : false;
41210			self._prefix = transPrefix.prefix;
41211			self._vendor = transPrefix.vendor;
41212			self._suckMode = window.atob && self._prefix ? false : true;
41213
41214			self._suckMode && (self.animation.enable = false);
41215			self._ff && self._ff <= 4 && (self.animation.enable = false);
41216
41217			/* Polyfills
41218   ---------------------------------------------------------------------- */
41219
41220			/**
41221    * window.requestAnimationFrame
41222    */
41223
41224			for (var x = 0; x < vendorsRAF.length && !window.requestAnimationFrame; x++) {
41225				window.requestAnimationFrame = window[vendorsRAF[x] + 'RequestAnimationFrame'];
41226			}
41227
41228			/**
41229    * Object.getPrototypeOf
41230    */
41231
41232			if (typeof _getPrototypeOf2.default !== 'function') {
41233				if ((0, _typeof3.default)('test'.__proto__) === 'object') {
41234					Object.getPrototypeOf = function (object) {
41235						return object.__proto__;
41236					};
41237				} else {
41238					Object.getPrototypeOf = function (object) {
41239						return object.constructor.prototype;
41240					};
41241				}
41242			}
41243
41244			/**
41245    * Element.nextElementSibling
41246    */
41247
41248			if (self._domNode.nextElementSibling === undf) {
41249				Object.defineProperty(Element.prototype, 'nextElementSibling', {
41250					get: function get() {
41251						var el = this.nextSibling;
41252
41253						while (el) {
41254							if (el.nodeType === 1) {
41255								return el;
41256							}
41257							el = el.nextSibling;
41258						}
41259						return null;
41260					}
41261				});
41262			}
41263
41264			self._execAction('_platformDetect', 1);
41265		},
41266
41267		/**
41268   * Refresh
41269   * @since 2.0.0
41270   * @param {boolean} init
41271   * @param {boolean} force
41272   */
41273
41274		_refresh: function _refresh(init, force) {
41275			var self = this;
41276
41277			self._execAction('_refresh', 0, arguments);
41278
41279			self._$targets = self._$container.find(self.selectors.target);
41280
41281			for (var i = 0; i < self._$targets.length; i++) {
41282				var target = self._$targets[i];
41283
41284				if (target.dataset === undf || force) {
41285
41286					target.dataset = {};
41287
41288					for (var j = 0; j < target.attributes.length; j++) {
41289
41290						var attr = target.attributes[j],
41291						    name = attr.name,
41292						    val = attr.value;
41293
41294						if (name.indexOf('data-') > -1) {
41295							var dataName = self._helpers._camelCase(name.substring(5, name.length));
41296							target.dataset[dataName] = val;
41297						}
41298					}
41299				}
41300
41301				if (target.mixParent === undf) {
41302					target.mixParent = self._id;
41303				}
41304			}
41305
41306			if (self._$targets.length && init || !self._origOrder.length && self._$targets.length) {
41307				self._origOrder = [];
41308
41309				for (var i = 0; i < self._$targets.length; i++) {
41310					var target = self._$targets[i];
41311
41312					self._origOrder.push(target);
41313				}
41314			}
41315
41316			self._execAction('_refresh', 1, arguments);
41317		},
41318
41319		/**
41320   * Bind Handlers
41321   * @since 2.0.0
41322   */
41323
41324		_bindHandlers: function _bindHandlers() {
41325			var self = this,
41326			    filters = $.MixItUp.prototype._bound._filter,
41327			    sorts = $.MixItUp.prototype._bound._sort;
41328
41329			self._execAction('_bindHandlers', 0);
41330
41331			if (self.controls.live) {
41332				self._$body.on('click.mixItUp.' + self._id, self.selectors.sort, function () {
41333					self._processClick($(this), 'sort');
41334				}).on('click.mixItUp.' + self._id, self.selectors.filter, function () {
41335					self._processClick($(this), 'filter');
41336				});
41337			} else {
41338				self._$sortButtons = $(self.selectors.sort);
41339				self._$filterButtons = $(self.selectors.filter);
41340
41341				self._$sortButtons.on('click.mixItUp.' + self._id, function () {
41342					self._processClick($(this), 'sort');
41343				});
41344
41345				self._$filterButtons.on('click.mixItUp.' + self._id, function () {
41346					self._processClick($(this), 'filter');
41347				});
41348			}
41349
41350			filters[self.selectors.filter] = filters[self.selectors.filter] === undf ? 1 : filters[self.selectors.filter] + 1;
41351			sorts[self.selectors.sort] = sorts[self.selectors.sort] === undf ? 1 : sorts[self.selectors.sort] + 1;
41352
41353			self._execAction('_bindHandlers', 1);
41354		},
41355
41356		/**
41357   * Process Click
41358   * @since 2.0.0
41359   * @param {object} $button
41360   * @param {string} type
41361   */
41362
41363		_processClick: function _processClick($button, type) {
41364			var self = this,
41365			    trackClick = function trackClick($button, type, off) {
41366				var proto = $.MixItUp.prototype;
41367
41368				proto._handled['_' + type][self.selectors[type]] = proto._handled['_' + type][self.selectors[type]] === undf ? 1 : proto._handled['_' + type][self.selectors[type]] + 1;
41369
41370				if (proto._handled['_' + type][self.selectors[type]] === proto._bound['_' + type][self.selectors[type]]
41370) {
41371					$button[(off ? 'remove' : 'add') + 'Class'](self.controls.activeClass);
41372					delete proto._handled['_' + type][self.selectors[type]];
41373				}
41374			};
41375
41376			self._execAction('_processClick', 0, arguments);
41377
41378			if (!self._mixing || self.animation.queue && self._queue.length < self.animation.queueLimit) {
41379				self._clicking = true;
41380
41381				if (type === 'sort') {
41382					var sort = $button.attr('data-sort');
41383
41384					if (!$button.hasClass(self.controls.activeClass) || sort.indexOf('random') > -1) {
41385						$(self.selectors.sort).removeClass(self.controls.activeClass);
41386						trackClick($button, type);
41387						self.sort(sort);
41388					}
41389				}
41390
41391				if (type === 'filter') {
41392					var filter = $button.attr('data-filter'),
41393					    ndx,
41394					    seperator = self.controls.toggleLogic === 'or' ? ',' : '';
41395
41396					if (!self.controls.toggleFilterButtons) {
41397						if (!$button.hasClass(self.controls.activeClass)) {
41398							$(self.selectors.filter).removeClass(self.controls.activeClass);
41399							trackClick($button, type);
41400							self.filter(filter);
41401						}
41402					} else {
41403						self._buildToggleArray();
41404
41405						if (!$button.hasClass(self.controls.activeClass)) {
41406							trackClick($button, type);
41407
41408							self._toggleArray.push(filter);
41409						} else {
41410							trackClick($button, type, true);
41411							ndx = self._toggleArray.indexOf(filter);
41412							self._toggleArray.splice(ndx, 1);
41413						}
41414
41415						self._toggleArray = $.grep(self._toggleArray, function (n) {
41416							return n;
41417						});
41418
41419						self._toggleString = self._toggleArray.join(seperator);
41420
41421						self.filter(self._toggleString);
41422					}
41423				}
41424
41425				self._execAction('_processClick', 1, arguments);
41426			} else {
41427				if (typeof self.callbacks.onMixBusy === 'function') {
41428					self.callbacks.onMixBusy.call(self._domNode, self._state, self);
41429				}
41430				self._execAction('_processClickBusy', 1, arguments);
41431			}
41432		},
41433
41434		/**
41435   * Build Toggle Array
41436   * @since 2.0.0
41437   */
41438
41439		_buildToggleArray: function _buildToggleArray() {
41440			var self = this,
41441			    activeFilter = self._activeFilter.replace(/\s/g, '');
41442
41443			self._execAction('_buildToggleArray', 0, arguments);
41444
41445			if (self.controls.toggleLogic === 'or') {
41446				self._toggleArray = activeFilter.split(',');
41447			} else {
41448				self._toggleArray = activeFilter.split('.');
41449
41450				!self._toggleArray[0] && self._toggleArray.shift();
41451
41452				for (var i = 0, filter; filter = self._toggleArray[i]; i++) {
41453					self._toggleArray[i] = '.' + filter;
41454				}
41455			}
41456
41457			self._execAction('_buildToggleArray', 1, arguments);
41458		},
41459
41460		/**
41461   * Update Controls
41462   * @since 2.0.0
41463   * @param {object} command
41464   * @param {boolean} multi
41465   */
41466
41467		_updateControls: function _updateControls(command, multi) {
41468			var self = this,
41469			    output = {
41470				filter: command.filter,
41471				sort: command.sort
41472			},
41473			    update = function update($el, filter) {
41474				try {
41475					multi && type === 'filter' && !(output.filter === 'none' || output.f
41475ilter === '') ? $el.filter(filter).addClass(self.controls.activeClass) : $el.removeClass(self.controls.activeClass).filter(filter).addClass(self.controls.activeClass);
41476				} catch (e) {}
41477			},
41478			    type = 'filter',
41479			    $el = null;
41480
41481			self._execAction('_updateControls', 0, arguments);
41482
41483			command.filter === undf && (output.filter = self._activeFilter);
41484			command.sort === undf && (output.sort = self._activeSort);
41485			output.filter === self.selectors.target && (output.filter = 'all');
41486
41487			for (var i = 0; i < 2; i++) {
41488				$el = self.controls.live ? $(self.selectors[type]) : self['_$' + type + 'Buttons'];
41489				$el && update($el, '[data-' + type + '="' + output[type] + '"]');
41490				type = 'sort';
41491			}
41492
41493			self._execAction('_updateControls', 1, arguments);
41494		},
41495
41496		/**
41497   * Filter (private)
41498   * @since 2.0.0
41499   */
41500
41501		_filter: function _filter() {
41502			var self = this;
41503
41504			self._execAction('_filter', 0);
41505
41506			for (var i = 0; i < self._$targets.length; i++) {
41507				var $target = $(self._$targets[i]);
41508
41509				if ($target.is(self._activeFilter)) {
41510					self._$show = self._$show.add($target);
41511				} else {
41512					self._$hide = self._$hide.add($target);
41513				}
41514			}
41515
41516			self._execAction('_filter', 1);
41517		},
41518
41519		/**
41520   * Sort (private)
41521   * @since 2.0.0
41522   */
41523
41524		_sort: function _sort() {
41525			var self = this,
41526			    arrayShuffle = function arrayShuffle(oldArray) {
41527				var newArray = oldArray.slice(),
41528				    len = newArray.length,
41529				    i = len;
41530
41531				while (i--) {
41532					var p = parseInt(Math.random() * len);
41533					var t = newArray[i];
41534					newArray[i] = newArray[p];
41535					newArray[p] = t;
41536				};
41537				return newArray;
41538			};
41539
41540			self._execAction('_sort', 0);
41541
41542			self._startOrder = [];
41543
41544			for (var i = 0; i < self._$targets.length; i++) {
41545				var target = self._$targets[i];
41546
41547				self._startOrder.push(target);
41548			}
41549
41550			switch (self._newSort[0].sortBy) {
41551				case 'default':
41552					self._newOrder = self._origOrder;
41553					break;
41554				case 'random':
41555					self._newOrder = arrayShuffle(self._startOrder);
41556					break;
41557				case 'custom':
41558					self._newOrder = self._newSort[0].order;
41559					break;
41560				default:
41561					self._newOrder = self._startOrder.concat().sort(function (a, b) {
41562						return self._compare(a, b);
41563					});
41564			}
41565
41566			self._execAction('_sort', 1);
41567		},
41568
41569		/**
41570   * Compare Algorithm
41571   * @since 2.0.0
41572   * @param {string|number} a
41573   * @param {string|number} b
41574   * @param {number} depth (recursion)
41575   * @return {number}
41576   */
41577
41578		_compare: function _compare(a, b, depth) {
41579			depth = depth ? depth : 0;
41580
41581			var self = this,
41582			    order = self._newSort[depth].order,
41583			    getData = function getData(el) {
41584				return el.dataset[self._newSort[depth].sortBy] || 0;
41585			},
41586			    attrA = isNaN(getData(a) * 1) ? getData(a).toLowerCase() : getData(a) * 1,
41587			    attrB = isNaN(getData(b) * 1) ? getData(b).toLowerCase() : getData(b) * 1;
41588
41589			if (attrA < attrB) return order === 'asc' ? -1 : 1;
41590			if (attrA > attrB) return order === 'asc' ? 1 : -1;
41591			if (attrA === attrB && self._newSort.length > depth + 1) return self._compare(a, b, depth + 1);
41592
41593			return 0;
41594		},
41595
41596		/**
41597   * Print Sort
41598   * @since 2.0.0
41599   * @param {boolean} reset
41600   */
41601
41602		_printSort: function _printSort(reset) {
41603			var self = this,
41604			    order = reset ? self._startOrder : self._newOrder,
41605			    targets = self._$parent[0].querySelectorAll(self.selectors.target),
41606			    nextSibling = targets.length ? targets[targets.length - 1].nextElementSibling : null,
41607			    frag = document.createDocumentFragment();
41608
41609			self._execAction('_printSort', 0, arguments);
41610
41611			for (var i = 0; i < targets.length; i++) {
41612				var target = targets[i],
41613				    whiteSpace = target.nextSibling;
41614
41615				if (target.style.position === 'absolute') continue;
41616
41617				if (whiteSpace && whiteSpace.nodeName === '#text') {
41618					self._$parent[0].removeChild(whiteSpace);
41619				}
41620
41621				self._$parent[0].removeChild(target);
41622			}
41623
41624			for (var i = 0; i < order.length; i++) {
41625				var el = order[i];
41626
41627				if (self._newSort[0].sortBy === 'default' && self._newSort[0].order === 'desc' && !reset) {
41628					var firstChild = frag.firstChild;
41629					frag.insertBefore(el, firstChild);
41630					frag.insertBefore(document.createTextNode(' '), el);
41631				} else {
41632					frag.appendChild(el);
41633					frag.appendChild(document.createTextNode(' '));
41634				}
41635			}
41636
41637			nextSibling ? self._$parent[0].insertBefore(frag, nextSibling) : self._$parent[0].appendChild(frag);
41638
41639			self._execAction('_printSort', 1, arguments);
41640		},
41641
41642		/**
41643   * Parse Sort
41644   * @since 2.0.0
41645   * @param {string} sortString
41646   * @return {array} newSort
41647   */
41648
41649		_parseSort: function _parseSort(sortString) {
41650			var self = this,
41651			    rules = typeof sortString === 'string' ? sortString.split(' ') : [sortString],
41652			    newSort = [];
41653
41654			for (var i = 0; i < rules.length; i++) {
41655				var rule = typeof sortString === 'string' ? rules[i].split(':') : ['custom', rules[i]],
41656				    ruleObj = {
41657					sortBy: self._helpers._camelCase(rule[0]),
41658					order: rule[1] || 'asc'
41659				};
41660
41661				newSort.push(ruleObj);
41662
41663				if (ruleObj.sortBy === 'default' || ruleObj.sortBy === 'random') break;
41664			}
41665
41666			return self._execFilter('_parseSort', newSort, arguments);
41667		},
41668
41669		/**
41670   * Parse Effects
41671   * @since 2.0.0
41672   * @return {object} effects
41673   */
41674
41675		_parseEffects: function _parseEffects() {
41676			var self = this,
41677			    effects = {
41678				opacity: '',
41679				transformIn: '',
41680				transformOut: '',
41681				filter: ''
41682			},
41683			    parse = function parse(effect, extract, reverse) {
41684				if (self.animation.effects.indexOf(effect) > -1) {
41685					if (extract) {
41686						var propIndex = self.animation.effects.indexOf(effect + '(');
41687						if (propIndex > -1) {
41688							var str = self.animation.effects.substring(propIndex),
41689							    match = /\(([^)]+)\)/.exec(str),
41690							    val = match[1];
41691
41692							return { val: val };
41693						}
41694					}
41695					return true;
41696				} else {
41697					return false;
41698				}
41699			},
41700			    negate = function negate(value, invert) {
41701				if (invert) {
41702					return value.charAt(0) === '-' ? value.substr(1, value.length) : '-' + value;
41703				} else {
41704					return value;
41705				}
41706			},
41707			    buildTransform = function buildTransform(key, invert) {
41708				var transforms = [['scale', '.01'], ['translateX', '20px'], ['translateY', '20px'], ['translateZ', '20px'], ['rotateX', '90deg'], ['rotateY', '90deg'], ['rotateZ', '180deg']];
41709
41710				for (var i = 0; i < transforms.length; i++) {
41711					var prop = transforms[i][0],
41712					    def = transforms[i][1],
41713					    inverted = invert && prop !== 'scale';
41714
41715					effects[key] += parse(prop) ? prop + '(' + negate(parse(prop, true).val || def, inverted) + ') ' : '';
41716				}
41717			};
41718
41719			effects.opacity = parse('fade') ? parse('fade', true).val || '0' : '1';
41720
41721			buildTransform('transformIn');
41722
41723			self.animation.reverseOut ? buildTransform('transformOut', true) : effects.transformOut = effects.transformIn;
41724
41725			effects.transition = {};
41726
41727			effects.transition = self._getPrefixedCSS('transition', 'all ' + self.animation.duration + 'ms ' + self.animation.easing + ', opacity ' + self.animation.duration + 'ms linear');
41728
41729			self.animation.stagger = parse('stagger') ? true : false;
41730			self.animation.staggerDuration = parseInt(parse('stagger') ? parse('stagger', true).val ? parse('stagger', true).val : 100 : 100);
41731
41732			return self._execFilter('_parseEffects', effects);
41733		},
41734
41735		/**
41736   * Build State
41737   * @since 2.0.0
41738   * @param {boolean} future
41739   * @return {object} futureState
41740   */
41741
41742		_buildState: function _buildState(future) {
41743			var self = this,
41744			    state = {};
41745
41746			self._execAction('_buildState', 0);
41747
41748			state = {
41749				activeFilter: self._activeFilter === '' ? 'none' : self._activeFilter,
41750				activeSort: future && self._newSortString ? self._newSortString : self._activeSort,
41751				fail: !self._$show.length && self._activeFilter !== '',
41752				$targets: self._$targets,
41753				$show: self._$show,
41754				$hide: self._$hide,
41755				totalTargets: self._$targets.length,
41756				totalShow: self._$show.length,
41757				totalHide: self._$hide.length,
41758				display: future && self._newDisplay ? self._newDisplay : self.layout.display
41759			};
41760
41761			if (future) {
41762				return self._execFilter('_buildState', state);
41763			} else {
41764				self._state = state;
41765
41766				self._execAction('_buildState', 1);
41767			}
41768		},
41769
41770		/**
41771   * Go Mix
41772   * @since 2.0.0
41773   * @param {boolean} animate
41774   */
41775
41776		_goMix: function _goMix(animate) {
41777			var self = this,
41778			    phase1 = function phase1() {
41779				if (self._chrome && self._chrome === 31) {
41780					chromeFix(self._$parent[0]);
41781				}
41782
41783				self._setInter();
41784
41785				phase2();
41786			},
41787			    phase2 = function phase2() {
41788				var scrollTop = window.pageYOffset,
41789				    scrollLeft = window.pageXOffset,
41790				    docHeight = document.documentElement.scrollHeight;
41791
41792				self._getInterMixData();
41793
41794				self._setFinal();
41795
41796				self._getFinalMixData();
41797
41798				window.pageYOffset !== scrollTop && window.scrollTo(scrollLeft, scrollTop);
41799
41800				self._prepTargets();
41801
41802				if (window.requestAnimationFrame) {
41803					requestAnimationFrame(phase3);
41804				} else {
41805					setTimeout(function () {
41806						phase3();
41807					}, 20);
41808				}
41809			},
41810			    phase3 = function phase3() {
41811				self._animateTargets();
41812
41813				if (self._targetsBound === 0) {
41814					self._cleanUp();
41815				}
41816			},
41817			    chromeFix = function chromeFix(grid) {
41818				var parent = grid.parentElement,
41819				    placeholder = document.createElement('div'),
41820				    frag = document.createDocumentFragment();
41821
41822				parent.insertBefore(placeholder, grid);
41823				frag.appendChild(grid);
41824				parent.replaceChild(grid, placeholder);
41825			},
41826			    futureState = self._buildState(true);
41827
41828			self._execAction('_goMix', 0, arguments);
41829
41830			!self.animation.duration && (animate = false);
41831
41832			self._mixing = true;
41833
41834			self._$container.removeClass(self.layout.containerClassFail);
41835
41836			if (typeof self.callbacks.onMixStart === 'function') {
41837				self.callbacks.onMixStart.call(self._domNode, self._state, futureState, self);
41838			}
41839
41840			self._$container.trigger('mixStart', [self._state, futureState, self]);
41841
41842			self._getOrigMixData();
41843
41844			if (animate && !self._suckMode) {
41845
41846				window.requestAnimationFrame ? requestAnimationFrame(phase1) : phase1();
41847			} else {
41848				self._cleanUp();
41849			}
41850
41851			self._execAction('_goMix', 1, arguments);
41852		},
41853
41854		/**
41855   * Get Target Data
41856   * @since 2.0.0
41857   */
41858
41859		_getTargetData: function _getTargetData(el, stage) {
41860			var self = this,
41861			    elStyle;
41862
41863			el.dataset[stage + 'PosX'] = el.offsetLeft;
41864			el.dataset[stage + 'PosY'] = el.offsetTop;
41865
41866			if (self.animation.animateResizeTargets) {
41867				elStyle = !self._suckMode ? window.getComputedStyle(el) : {
41868					marginBottom: '',
41869					marginRight: ''
41870				};
41871
41872				el.dataset[stage + 'MarginBottom'] = parseInt(elStyle.marginBottom);
41873				el.dataset[stage + 'MarginRight'] = parseInt(elStyle.marginRight);
41874				el.dataset[stage + 'Width'] = el.offsetWidth;
41875				el.dataset[stage + 'Height'] = el.offsetHeight;
41876			}
41877		},
41878
41879		/**
41880   * Get Original Mix Data
41881   * @since 2.0.0
41882   */
41883
41884		_getOrigMixData: function _getOrigMixData() {
41885			var self = this,
41886			    parentStyle = !self._suckMode ? window.getComputedStyle(self._$parent[0]) : { boxSizing: '' },
41887			    parentBS = parentStyle.boxSizing || parentStyle[self._vendor + 'BoxSizing'];
41888
41889			self._incPadding = parentBS === 'border-box';
41890
41891			self._execAction('_getOrigMixData', 0);
41892
41893			!self._suckMode && (self.effects = self._parseEffects());
41894
41895			self._$toHide = self._$hide.filter(':visible');
41896			self._$toShow = self._$show.filter(':hidden');
41897			self._$pre = self._$targets.filter(':visible');
41898
41899			self._startHeight = self._incPadding ? self._$parent.outerHeight() : self._$parent.height();
41900
41901			for (var i = 0; i < self._$pre.length; i++) {
41902				var el = self._$pre[i];
41903
41904				self._getTargetData(el, 'orig');
41905			}
41906
41907			self._execAction('_getOrigMixData', 1);
41908		},
41909
41910		/**
41911   * Set Intermediate Positions
41912   * @since 2.0.0
41913   */
41914
41915		_setInter: function _setInter() {
41916			var self = this;
41917
41918			self._execAction('_setInter', 0);
41919
41920			if (self._changingLayout && self.animation.animateChangeLayout) {
41921				self._$toShow.css('display', self._newDisplay);
41922
41923				if (self._changingClass) {
41924					self._$container.removeClass(self.layout.containerClass).addClass(self._newClass);
41925				}
41926			} else {
41927				self._$toShow.css('display', self.layout.display);
41928			}
41929
41930			self._execAction('_setInter', 1);
41931		},
41932
41933		/**
41934   * Get Intermediate Mix Data
41935   * @since 2.0.0
41936   */
41937
41938		_getInterMixData: function _getInterMixData() {
41939			var self = this;
41940
41941			self._execAction('_getInterMixData', 0);
41942
41943			for (var i = 0; i < self._$toShow.length; i++) {
41944				var el = self._$toShow[i];
41945
41946				self._getTargetData(el, 'inter');
41947			}
41948
41949			for (var i = 0; i < self._$pre.length; i++) {
41950				var el = self._$pre[i];
41951
41952				self._getTargetData(el, 'inter');
41953			}
41954
41955			self._execAction('_getInterMixData', 1);
41956		},
41957
41958		/**
41959   * Set Final Positions
41960   * @since 2.0.0
41961   */
41962
41963		_setFinal: function _setFinal() {
41964			var self = this;
41965
41966			self._execAction('_setFinal', 0);
41967
41968			self._sorting && self._printSort();
41969
41970			self._$toHide.removeStyle('display');
41971
41972			if (self._changingLayout && self.animation.animateChangeLayout) {
41973				self._$pre.css('display', self._newDisplay);
41974			}
41975
41976			self._execAction('_setFinal', 1);
41977		},
41978
41979		/**
41980   * Get Final Mix Data
41981   * @since 2.0.0
41982   */
41983
41984		_getFinalMixData: function _getFinalMixData() {
41985			var self = this;
41986
41987			self._execAction('_getFinalMixData', 0);
41988
41989			for (var i = 0; i < self._$toShow.length; i++) {
41990				var el = self._$toShow[i];
41991
41992				self._getTargetData(el, 'final');
41993			}
41994
41995			for (var i = 0; i < self._$pre.length; i++) {
41996				var el = self._$pre[i];
41997
41998				self._getTargetData(el, 'final');
41999			}
42000
42001			self._newHeight = self._incPadding ? self._$parent.outerHeight() : self._$parent.height();
42002
42003			self._sorting && self._printSort(true);
42004
42005			self._$toShow.removeStyle('display');
42006
42007			self._$pre.css('display', self.layout.display);
42008
42009			if (self._changingClass && self.animation.animateChangeLayout) {
42010				self._$container.removeClass(self._newClass).addClass(self.layout.containerClass);
42011			}
42012
42013			self._execAction('_getFinalMixData', 1);
42014		},
42015
42016		/**
42017   * Prepare Targets
42018   * @since 2.0.0
42019   */
42020
42021		_prepTargets: function _prepTargets() {
42022			var self = this,
42023			    transformCSS = {
42024				_in: self._getPrefixedCSS('transform', self.effects.transformIn),
42025				_out: self._getPrefixedCSS('transform', self.effects.transformOut)
42026			};
42027
42028			self._execAction('_prepTargets', 0);
42029
42030			if (self.animation.animateResizeContainer) {
42031				self._$parent.css('height', self._startHeight + 'px');
42032			}
42033
42034			for (var i = 0; i < self._$toShow.length; i++) {
42035				var el = self._$toShow[i],
42036				    $el = $(el);
42037
42038				el.style.opacity = self.effects.opacity;
42039				el.style.display = self._changingLayout && self.animation.animateChangeLayout ? self._newDisplay : self.layout.display;
42040
42041				$el.css(transformCSS._in);
42042
42043				if (self.animation.animateResizeTargets) {
42044					el.style.width = el.dataset.finalWidth + 'px';
42045					el.style.height = el.dataset.finalHeight + 'px';
42046					el.style.marginRight = -(el.dataset.finalWidth - el.dataset.interWidth) + el.dataset.finalMarginRight * 1 + 'px';
42047					el.style.marginBottom = -(el.dataset.finalHeight - el.dataset.interHeight) + el.dataset.finalMarginBottom * 1 + 'px';
42048				}
42049			}
42050
42051			for (var i = 0; i < self._$pre.length; i++) {
42052				var el = self._$pre[i],
42053				    $el = $(el),
42054				    translate = {
42055					x: el.dataset.origPosX - el.dataset.interPosX,
42056					y: el.dataset.origPosY - el.dataset.interPosY
42057				},
42058				    transformCSS = self._getPrefixedCSS('transform', 'translate(' + translate.x + 'px,' + translate.y + 'px)');
42059
42060				$el.css(transformCSS);
42061
42062				if (self.animation.animateResizeTargets) {
42063					el.style.width = el.dataset.origWidth + 'px';
42064					el.style.height = el.dataset.origHeight + 'px';
42065
42066					if (el.dataset.origWidth - el.dataset.finalWidth) {
42067						el.style.marginRight = -(el.dataset.origWidth - el.dataset.interWidth) + el.dataset.origMarginRight * 1 + 'px';
42068					}
42069
42070					if (el.dataset.origHeight - el.dataset.finalHeight) {
42071						el.style.marginBottom = -(el.dataset.origHeight - el.dataset.interHeight) + el.dataset.origMarginBottom * 1 + 'px';
42072					}
42073				}
42074			}
42075
42076			self._execAction('_prepTargets', 1);
42077		},
42078
42079		/**
42080   * Animate Targets
42081   * @since 2.0.0
42082   */
42083
42084		_animateTargets: function _animateTargets() {
42085			var self = this;
42086
42087			self._execAction('_animateTargets', 0);
42088
42089			self._targetsDone = 0;
42090			self._targetsBound = 0;
42091
42092			self._$parent.css(self._getPrefixedCSS('perspective', self.animation.perspectiveDistance + 'px')).css(self._getPrefixedCSS('perspective-origin', self.animation.perspectiveOrigin));
42093
42094			if (self.animation.animateResizeContainer) {
42095				self._$parent.css(self._getPrefixedCSS('transition', 'height ' + self.animation.duration + 'ms ease')).css('height', self._newHeight + 'px');
42096			}
42097
42098			for (var i = 0; i < self._$toShow.length; i++) {
42099				var el = self._$toShow[i],
42100				    $el = $(el),
42101				    translate = {
42102					x: el.dataset.finalPosX - el.dataset.interPosX,
42103					y: el.dataset.finalPosY - el.dataset.interPosY
42104				},
42105				    delay = self._getDelay(i),
42106				    toShowCSS = {};
42107
42108				el.style.opacity = '';
42109
42110				for (var j = 0; j < 2; j++) {
42111					var a = j === 0 ? a = self._prefix : '';
42112
42113					if (self._ff && self._ff <= 20) {
42114						toShowCSS[a + 'transition-property'] = 'all';
42115						toShowCSS[a + 'transition-timing-function'] = self.animation.easing + 'ms';
42116						toShowCSS[a + 'transition-duration'] = self.animation.duration + 'ms';
42117					}
42118
42119					toShowCSS[a + 'transition-delay'] = delay + 'ms';
42120					toShowCSS[a + 'transform'] = 'translate(' + translate.x + 'px,' + translate.y + 'px)';
42121				}
42122
42123				if (self.effects.transform || self.effects.opacity) {
42124					self._bindTargetDone($el);
42125				}
42126
42127				self._ff && self._ff <= 20 ? $el.css(toShowCSS) : $el.css(self.effects.transition).css(toShowCSS);
42128			}
42129
42130			for (var i = 0; i < self._$pre.length; i++) {
42131				var el = self._$pre[i],
42132				    $el = $(el),
42133				    translate = {
42134					x: el.dataset.finalPosX - el.dataset.interPosX,
42135					y: el.dataset.finalPosY - el.dataset.interPosY
42136				},
42137				    delay = self._getDelay(i);
42138
42139				if (!(el.dataset.finalPosX === el.dataset.origPosX && el.dataset.finalPosY === el.dataset.origPosY)) {
42140					self._bindTargetDone($el);
42141				}
42142
42143				$el.css(self._getPrefixedCSS('transition', 'all ' + self.animation.duration + 'ms ' + self.animation.easing + ' ' + delay + 'ms'));
42144				$el.css(self._getPrefixedCSS('transform', 'translate(' + translate.x + 'px,' + translate.y + 'px)'));
42145
42146				if (self.animation.animateResizeTargets) {
42147					if (el.dataset.origWidth - el.dataset.finalWidth && el.dataset.finalWidth * 1) {
42148						el.style.width = el.dataset.finalWidth + 'px';
42149						el.style.marginRight = -(el.dataset.finalWidth - el.dataset.interWidth) + el.dataset.finalMarginRight * 1 + 'px';
42150					}
42151
42152					if (el.dataset.origHeight - el.dataset.finalHeight && el.dataset.finalHeight * 1) {
42153						el.style.height = el.dataset.finalHeight + 'px';
42154						el.style.marginBottom = -(el.dataset.finalHeight - el.dataset.interHeight) + el.dataset.finalMarginBottom * 1 + 'px';
42155					}
42156				}
42157			}
42158
42159			if (self._changingClass) {
42160				self._$container.removeClass(self.layout.containerClass).addClass(self._newClass);
42161			}
42162
42163			for (var i = 0; i < self._$toHide.length; i++) {
42164				var el = self._$toHide[i],
42165				    $el = $(el),
42166				    delay = self._getDelay(i),
42167				    toHideCSS = {};
42168
42169				for (var j = 0; j < 2; j++) {
42170					var a = j === 0 ? a = self._prefix : '';
42171
42172					toHideCSS[a + 'transition-delay'] = delay + 'ms';
42173					toHideCSS[a + 'transform'] = self.effects.transformOut;
42174					toHideCSS.opacity = self.effects.opacity;
42175				}
42176
42177				$el.css(self.effects.transition).css(toHideCSS);
42178
42179				if (self.effects.transform || self.effects.opacity) {
42180					self._bindTargetDone($el);
42181				};
42182			}
42183
42184			self._execAction('_animateTargets', 1);
42185		},
42186
42187		/**
42188   * Bind Targets TransitionEnd
42189   * @since 2.0.0
42190   * @param {object} $el
42191   */
42192
42193		_bindTargetDone: function _bindTargetDone($el) {
42194			var self = this,
42195			    el = $el[0];
42196
42197			self._execAction('_bindTargetDone', 0, arguments);
42198
42199			if (!el.dataset.bound) {
42200
42201				el.dataset.bound = true;
42202				self._targetsBound++;
42203
42204				$el.on('webkitTransitionEnd.mixItUp transitionend.mixItUp', function (e) {
42205					if ((e.originalEvent.propertyName.indexOf('transform') > -1 || e.originalEvent.propertyName.indexOf('opacity') > -1) && $(e.originalEvent.target).is(self.selectors.target)) {
42206						$el.off('.mixItUp');
42207						delete el.dataset.bound;
42208						self._targetDone();
42209					}
42210				});
42211			}
42212
42213			self._execAction('_bindTargetDone', 1, arguments);
42214		},
42215
42216		/**
42217   * Target Done
42218   * @since 2.0.0
42219   */
42220
42221		_targetDone: function _targetDone() {
42222			var self = this;
42223
42224			self._execAction('_targetDone', 0);
42225
42226			self._targetsDone++;
42227
42228			self._targetsDone === self._targetsBound && self._cleanUp();
42229
42230			self._execAction('_targetDone', 1);
42231		},
42232
42233		/**
42234   * Clean Up
42235   * @since 2.0.0
42236   */
42237
42238		_cleanUp: function _cleanUp() {
42239			var self = this,
42240			    targetStyles = self.animation.animateResizeTargets ? 'transform opacity width height margin-bottom margin-right' : 'transform opacity',
42241			    unBrake = function unBrake() {
42242				self._$targets.removeStyle('transition', self._prefix);
42243			};
42244
42245			self._execAction('_cleanUp', 0);
42246
42247			!self._changingLayout ? self._$show.css('display', self.layout.display) : self._$show.css('display', self._newDisplay);
42248
42249			self._$targets.css(self._brake);
42250
42251			self._$targets.removeStyle(targetStyles, self._prefix).removeAttr('data-inter-pos-x data-inter-pos-y data-final-pos-x data-final-pos-y data-orig-pos-x data-orig-pos-y data-orig-height data-orig-width data-final-height data-final-width data-inter-width data-inter-height data-orig-margin-right data-orig-margin-bottom data-inter-margin-right data-inter-margin-bottom data-final-margin-right data-final-margin-bottom');
42252
42253			self._$hide.removeStyle('display');
42254
42255			self._$parent.removeStyle('height transition perspective-distance perspective perspective-origin-x perspective-origin-y perspective-origin perspectiveOrigin', self._prefix);
42256
42257			if (self._sorting) {
42258				self._printSort();
42259				self._activeSort = self._newSortString;
42260				self._sorting = false;
42261			}
42262
42263			if (self._changingLayout) {
42264				if (self._changingDisplay) {
42265					self.layout.display = self._newDisplay;
42266					self._changingDisplay = false;
42267				}
42268
42269				if (self._changingClass) {
42270					self._$parent.removeClass(self.layout.containerClass).addClass(self._newClass);
42271					self.layout.containerClass = self._newClass;
42272					self._changingClass = false;
42273				}
42274
42275				self._changingLayout = false;
42276			}
42277
42278			self._refresh();
42279
42280			self._buildState();
42281
42282			if (self._state.fail) {
42283				self._$container.addClass(self.layout.containerClassFail);
42284			}
42285
42286			self._$show = $();
42287			self._$hide = $();
42288
42289			if (window.requestAnimationFrame) {
42290				requestAnimationFrame(unBrake);
42291			}
42292
42293			self._mixing = false;
42294
42295			if (typeof self.callbacks._user === 'function') {
42296				self.callbacks._user.call(self._domNode, self._state, self);
42297			}
42298
42299			if (typeof self.callbacks.onMixEnd === 'function') {
42300				self.callbacks.onMixEnd.call(self._domNode, self._state, self);
42301			}
42302
42303			self._$container.trigger('mixEnd', [self._state, self]);
42304
42305			if (self._state.fail) {
42306				typeof self.callbacks.onMixFail === 'function' && self.callbacks.onMixFail.call(self._domNode, self._state, self);
42307				self._$container.trigger('mixFail', [self._state, self]);
42308			}
42309
42310			if (self._loading) {
42311				typeof self.callbacks.onMixLoad === 'function' && self.callbacks.onMixLoad.call(self._domNode, self._state, self);
42312				self._$container.trigger('mixLoad', [self._state, self]);
42313			}
42314
42315			if (self._queue.length) {
42316				self._execAction('_queue', 0);
42317
42318				self.multiMix(self._queue[0][0], self._queue[0][1], self._queue[0][2]);
42319				self._queue.splice(0, 1);
42320			}
42321
42322			self._execAction('_cleanUp', 1);
42323
42324			self._loading = false;
42325		},
42326
42327		/**
42328   * Get Prefixed CSS
42329   * @since 2.0.0
42330   * @param {string} property
42331   * @param {string} value
42332   * @param {boolean} prefixValue
42333   * @return {object} styles
42334   */
42335
42336		_getPrefixedCSS: function _getPrefixedCSS(property, value, prefixValue) {
42337			var self = this,
42338			    styles = {},
42339			    prefix = '',
42340			    i = -1;
42341
42342			for (i = 0; i < 2; i++) {
42343				prefix = i === 0 ? self._prefix : '';
42344				prefixValue ? styles[prefix + property] = prefix + value : styles[prefix + property] = value;
42345			}
42346
42347			return self._execFilter('_getPrefixedCSS', styles, arguments);
42348		},
42349
42350		/**
42351   * Get Delay
42352   * @since 2.0.0
42353   * @param {number} i
42354   * @return {number} delay
42355   */
42356
42357		_getDelay: function _getDelay(i) {
42358			var self = this,
42359			    n = typeof self.animation.staggerSequence === 'function' ? self.animation.staggerSequence.call(self._domNode, i, self._state) : i,
42360			    delay = self.animation.stagger ? n * self.animation.staggerDuration : 0;
42361
42362			return self._execFilter('_getDelay', delay, arguments);
42363		},
42364
42365		/**
42366   * Parse MultiMix Arguments
42367   * @since 2.0.0
42368   * @param {array} args
42369   * @return {object} output
42370   */
42371
42372		_parseMultiMixArgs: function _parseMultiMixArgs(args) {
42373			var self = this,
42374			    output = {
42375				command: null,
42376				animate: self.animation.enable,
42377				callback: null
42378			};
42379
42380			for (var i = 0; i < args.length; i++) {
42381				var arg = args[i];
42382
42383				if (arg !== null) {
42384					if ((typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg)) === 'object' || typeof arg === 'string') {
42385						output.command = arg;
42386					} else if (typeof arg === 'boolean') {
42387						output.animate = arg;
42388					} else if (typeof arg === 'function') {
42389						output.callback = arg;
42390					}
42391				}
42392			}
42393
42394			return self._execFilter('_parseMultiMixArgs', output, arguments);
42395		},
42396
42397		/**
42398   * Parse Insert Arguments
42399   * @since 2.0.0
42400   * @param {array} args
42401   * @return {object} output
42402   */
42403
42404		_parseInsertArgs: function _parseInsertArgs(args) {
42405			var self = this,
42406			    output = {
42407				index: 0,
42408				$object: $(),
42409				multiMix: { filter: self._state.activeFilter },
42410				callback: null
42411			};
42412
42413			for (var i = 0; i < args.length; i++) {
42414				var arg = args[i];
42415
42416				if (typeof arg === 'number') {
42417					output.index = arg;
42418				} else if ((typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg)) === 'object' && arg instanceof $) {
42419					output.$object = arg;
42420				} else if ((typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg)) === 'object' && self._helpers._isElement(arg)) {
42421					output.$object = $(arg);
42422				} else if ((typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg)) === 'object' && arg !== null) {
42423					output.multiMix = arg;
42424				} else if (typeof arg === 'boolean' && !arg) {
42425					output.multiMix = false;
42426				} else if (typeof arg === 'function') {
42427					output.callback = arg;
42428				}
42429			}
42430
42431			return self._execFilter('_parseInsertArgs', output, arguments);
42432		},
42433
42434		/**
42435   * Execute Action
42436   * @since 2.0.0
42437   * @param {string} methodName
42438   * @param {boolean} isPost
42439   * @param {array} args
42440   */
42441
42442		_execAction: function _execAction(methodName, isPost, args) {
42443			var self = this,
42444			    context = isPost ? 'post' : 'pre';
42445
42446			if (!self._actions.isEmptyObject && self._actions.hasOwnProperty(methodName)) {
42447				for (var key in self._actions[methodName][context]) {
42448					self._actions[methodName][context][key].call(self, args);
42449				}
42450			}
42451		},
42452
42453		/**
42454   * Execute Filter
42455   * @since 2.0.0
42456   * @param {string} methodName
42457   * @param {mixed} value
42458   * @return {mixed} value
42459   */
42460
42461		_execFilter: function _execFilter(methodName, value, args) {
42462			var self = this;
42463
42464			if (!self._filters.isEmptyObject && self._filters.hasOwnProperty(methodName)) {
42465				for (var key in self._filters[methodName]) {
42466					return self._filters[methodName][key].call(self, args);
42467				}
42468			} else {
42469				return value;
42470			}
42471		},
42472
42473		/* Helpers
42474  ---------------------------------------------------------------------- */
42475
42476		_helpers: {
42477
42478			/**
42479    * CamelCase
42480    * @since 2.0.0
42481    * @param {string}
42482    * @return {string}
42483    */
42484
42485			_camelCase: function _camelCase(string) {
42486				return string.replace(/-([a-z])/g, function (g) {
42487					return g[1].toUpperCase();
42488				});
42489			},
42490
42491			/**
42492    * Is Element
42493    * @since 2.1.3
42494    * @param {object} element to test
42495    * @return {boolean}
42496    */
42497
42498			_isElement: function _isElement(el) {
42499				if (window.HTMLElement) {
42500					return el instanceof HTMLElement;
42501				} else {
42502					return el !== null && el.nodeType === 1 && el.nodeName === 'string';
42503				}
42504			}
42505		},
42506
42507		/* Public Methods
42508  ---------------------------------------------------------------------- */
42509
42510		/**
42511   * Is Mixing
42512   * @since 2.0.0
42513   * @return {boolean}
42514   */
42515
42516		isMixing: function isMixing() {
42517			var self = this;
42518
42519			return self._execFilter('isMixing', self._mixing);
42520		},
42521
42522		/**
42523   * Filter (public)
42524   * @since 2.0.0
42525   * @param {array} arguments
42526   */
42527
42528		filter: function filter() {
42529			var self = this,
42530			    args = self._parseMultiMixArgs(arguments);
42531
42532			self._clicking && (self._toggleString = '');
42533
42534			self.multiMix({ filter: args.command }, args.animate, args.callback);
42535		},
42536
42537		/**
42538   * Sort (public)
42539   * @since 2.0.0
42540   * @param {array} arguments
42541   */
42542
42543		sort: function sort() {
42544			var self = this,
42545			    args = self._parseMultiMixArgs(arguments);
42546
42547			self.multiMix({ sort: args.command }, args.animate, args.callback);
42548		},
42549
42550		/**
42551   * Change Layout (public)
42552   * @since 2.0.0
42553   * @param {array} arguments
42554   */
42555
42556		changeLayout: function changeLayout() {
42557			var self = this,
42558			    args = self._parseMultiMixArgs(arguments);
42559
42560			self.multiMix({ changeLayout: args.command }, args.animate, args.callback);
42561		},
42562
42563		/**
42564   * MultiMix
42565   * @since 2.0.0
42566   * @param {array} arguments
42567   */
42568
42569		multiMix: function multiMix() {
42570			var self = this,
42571			    args = self._parseMultiMixArgs(arguments);
42572
42573			self._execAction('multiMix', 0, arguments);
42574
42575			if (!self._mixing) {
42576				if (self.controls.enable && !self._clicking) {
42577					self.controls.toggleFilterButtons && self._buildToggleArray();
42578					self._updateControls(args.command, self.controls.toggleFilterButtons);
42579				}
42580
42581				self._queue.length < 2 && (self._clicking = false);
42582
42583				delete self.callbacks._user;
42584				if (args.callback) self.callbacks._user = args.callback;
42585
42586				var sort = args.command.sort,
42587				    filter = args.command.filter,
42588				    changeLayout = args.command.changeLayout;
42589
42590				self._refresh();
42591
42592				if (sort) {
42593					self._newSort = self._parseSort(sort);
42594					self._newSortString = sort;
42595
42596					self._sorting = true;
42597					self._sort();
42598				}
42599
42600				if (filter !== undf) {
42601					filter = filter === 'all' ? self.selectors.target : filter;
42602
42603					self._activeFilter = filter;
42604				}
42605
42606				self._filter();
42607
42608				if (changeLayout) {
42609					self._newDisplay = typeof changeLayout === 'string' ? changeLayout : changeLayout.display || self.layout.display;
42610					self._newClass = changeLayout.containerClass || '';
42611
42612					if (self._newDisplay !== self.layout.display || self._newClass !== self.layout.containerClass) {
42613						self._changingLayout = true;
42614
42615						self._changingClass = self._newClass !== self.layout.containerClass;
42616						self._changingDisplay = self._newDisplay !== self.layout.display;
42617					}
42618				}
42619
42620				self._$targets.css(self._brake);
42621
42622				self._goMix(args.animate ^ self.animation.enable ? args.animate : self.animation.enable);
42623
42624				self._execAction('multiMix', 1, arguments);
42625			} else {
42626				if (self.animation.queue && self._queue.length < self.animation.queueLimit) {
42627					self._queue.push(arguments);
42628
42629					self.controls.enable && !self._clicking && self._updateControls(args.command);
42630
42631					self._execAction('multiMixQueue', 1, arguments);
42632				} else {
42633					if (typeof self.callbacks.onMixBusy === 'function') {
42634						self.callbacks.onMixBusy.call(self._domNode, self._state, self);
42635					}
42636					self._$container.trigger('mixBusy', [self._state, self]);
42637
42638					self._execAction('multiMixBusy', 1, arguments);
42639				}
42640			}
42641		},
42642
42643		/**
42644   * Insert
42645   * @since 2.0.0
42646   * @param {array} arguments
42647   */
42648
42649		insert: function insert() {
42650			var self = this,
42651			    args = self._parseInsertArgs(arguments),
42652			    callback = typeof args.callback === 'function' ? args.callback : null,
42653			    frag = document.createDocumentFragment(),
42654			    target = function () {
42655				self._refresh();
42656
42657				if (self._$targets.length) {
42658					return args.index < self._$targets.length || !self._$targets.length ? self._$targets[args.index] : self._$targets[self._$targets.length - 1].nextElementSibling;
42659				} else {
42660					return self._$parent[0].children[0];
42661				}
42662			}();
42663
42664			self._execAction('insert', 0, arguments);
42665
42666			if (args.$object) {
42667				for (var i = 0; i < args.$object.length; i++) {
42668					var el = args.$object[i];
42669
42670					frag.appendChild(el);
42671					frag.appendChild(document.createTextNode(' '));
42672				}
42673
42674				self._$parent[0].insertBefore(frag, target);
42675			}
42676
42677			self._execAction('insert', 1, arguments);
42678
42679			if ((0, _typeof3.default)(args.multiMix) === 'object') {
42680				self.multiMix(args.multiMix, callback);
42681			}
42682		},
42683
42684		/**
42685   * Prepend
42686   * @since 2.0.0
42687   * @param {array} arguments
42688   */
42689
42690		prepend: function prepend() {
42691			var self = this,
42692			    args = self._parseInsertArgs(arguments);
42693
42694			self.insert(0, args.$object, args.multiMix, args.callback);
42695		},
42696
42697		/**
42698   * Append
42699   * @since 2.0.0
42700   * @param {array} arguments
42701   */
42702
42703		append: function append() {
42704			var self = this,
42705			    args = self._parseInsertArgs(arguments);
42706
42707			self.insert(self._state.totalTargets, args.$object, args.multiMix, args.callback);
42708		},
42709
42710		/**
42711   * Get Option
42712   * @since 2.0.0
42713   * @param {string} string
42714   * @return {mixed} value
42715   */
42716
42717		getOption: function getOption(string) {
42718			var self = this,
42719			    getProperty = function getProperty(obj, prop) {
42720				var parts = prop.split('.'),
42721				    last = parts.pop(),
42722				    l = parts.length,
42723				    i = 1,
42724				    current = parts[0] || prop;
42725
42726				while ((obj = obj[current]) && i < l) {
42727					current = parts[i];
42728					i++;
42729				}
42730
42731				if (obj !== undf) {
42732					return obj[last] !== undf ? obj[last] : obj;
42733				}
42734			};
42735
42736			return string ? self._execFilter('getOption', getProperty(self, string), arguments) : self;
42737		},
42738
42739		/**
42740   * Set Options
42741   * @since 2.0.0
42742   * @param {object} config
42743   */
42744
42745		setOptions: function setOptions(config) {
42746			var self = this;
42747
42748			self._execAction('setOptions', 0, arguments);
42749
42750			(typeof config === "undefined" ? "undefined" : (0, _typeof3.default)(config)) === 'object' && $.extend(true, self, config);
42751
42752			self._execAction('setOptions', 1, arguments);
42753		},
42754
42755		/**
42756   * Get State
42757   * @since 2.0.0
42758   * @return {object} state
42759   */
42760
42761		getState: function getState() {
42762			var self = this;
42763
42764			return self._execFilter('getState', self._state, self);
42765		},
42766
42767		/**
42768   * Force Refresh
42769   * @since 2.1.2
42770   */
42771
42772		forceRefresh: function forceRefresh() {
42773			var self = this;
42774
42775			self._refresh(false, true);
42776		},
42777
42778		/**
42779   * Destroy
42780   * @since 2.0.0
42781   * @param {boolean} hideAll
42782   */
42783
42784		destroy: function destroy(hideAll) {
42785			var self = this,
42786			    filters = $.MixItUp.prototype._bound._filter,
42787			    sorts = $.MixItUp.prototype._bound._sort;
42788
42789			self._execAction('destroy', 0, arguments);
42790
42791			self._$body.add($(self.selectors.sort)).add($(self.selectors.filter)).off('.mixItUp');
42792
42793			for (var i = 0; i < self._$targets.length; i++) {
42794				var target = self._$targets[i];
42795
42796				hideAll && (target.style.display = '');
42797
42798				delete target.mixParent;
42799			}
42800
42801			self._execAction('destroy', 1, arguments);
42802
42803			if (filters[self.selectors.filter] && filters[self.selectors.filter] > 1) {
42804				filters[self.selectors.filter]--;
42805			} else if (filters[self.selectors.filter] === 1) {
42806				delete filters[self.selectors.filter];
42807			}
42808
42809			if (sorts[self.selectors.sort] && sorts[self.selectors.sort] > 1) {
42810				sorts[self.selectors.sort]--;
42811			} else if (sorts[self.selectors.sort] === 1) {
42812				delete sorts[self.selectors.sort];
42813			}
42814
42815			delete $.MixItUp.prototype._instances[self._id];
42816		}
42817
42818	};
42819
42820	/* jQuery Methods
42821 ---------------------------------------------------------------------- */
42822
42823	/**
42824  * jQuery .mixItUp() method
42825  * @since 2.0.0
42826  * @extends $.fn
42827  */
42828
42829	$.fn.mixItUp = function () {
42830		var args = arguments,
42831		    dataReturn = [],
42832		    eachReturn,
42833		    _instantiate = function _instantiate(domNode, settings) {
42834			var instance = new $.MixItUp(),
42835			    rand = function rand() {
42836				return ('00000' + (Math.random() * 16777216 << 0).toString(16)).substr(-6).toUpperCase();
42837			};
42838
42839			instance._execAction('_instantiate', 0, arguments);
42840
42841			domNode.id = !domNode.id ? 'MixItUp' + rand() : domNode.id;
42842
42843			if (!instance._instances[domNode.id]) {
42844				instance._instances[domNode.id] = instance;
42845				instance._init(domNode, settings);
42846			}
42847
42848			instance._execAction('_instantiate', 1, arguments);
42849		};
42850
42851		eachReturn = this.each(function () {
42852			if (args && typeof args[0] === 'string') {
42853				var instance = $.MixItUp.prototype._instances[this.id];
42854				if (args[0] === 'isLoaded') {
42855					dataReturn.push(instance ? true : false);
42856				} else {
42857					var data = instance[args[0]](args[1], args[2], args[3]);
42858					if (data !== undf) dataReturn.push(data);
42859				}
42860			} else {
42861				_instantiate(this, args[0]);
42862			}
42863		});
42864
42865		if (dataReturn.length) {
42866			return dataReturn.length > 1 ? dataReturn : dataReturn[0];
42867		} else {
42868			return eachReturn;
42869		}
42870	};
42871
42872	/**
42873  * jQuery .removeStyle() method
42874  * @since 2.0.0
42875  * @extends $.fn
42876  */
42877
42878	$.fn.removeStyle = function (style, prefix) {
42879		prefix = prefix ? prefix : '';
42880
42881		return this.each(function () {
42882			var el = this,
42883			    styles = style.split(' ');
42884
42885			for (var i = 0; i < styles.length; i++) {
42886				for (var j = 0; j < 4; j++) {
42887					switch (j) {
42888						case 0:
42889							var prop = styles[i];
42890							break;
42891						case 1:
42892							var prop = $.MixItUp.prototype._helpers._camelCase(prop);
42893							break;
42894						case 2:
42895							var prop = prefix + styles[i];
42896							break;
42897						case 3:
42898							var prop = $.MixItUp.prototype._helpers._camelCase(prefix + styles[i]);
42899					}
42900
42901					if (el.style[prop] !== undf && typeof el.style[prop] !== 'unknown' && el.style[prop].length > 0) {
42902						el.style[prop] = '';
42903					}
42904
42905					if (!prefix && j === 1) break;
42906				}
42907			}
42908
42909			if (el.attributes && el.attributes.style && el.attributes.style !== undf && el.attributes.style.value === '') {
42910				el.attributes.removeNamedItem('style');
42911			}
42912		});
42913	};
42914})(jQuery);
42915/*! Lazy Load 1.9.7 - MIT license - Copyright 2010-2015 Mika Tuupola */
42916!function (a, b, c, d) {
42917	var e = a(b);a.fn.lazyload = function (f) {
42918		function g() {
42919			var b = 0;i.each(function () {
42920				var c = a(this);if (!j.skip_invisible || c.is(":visible")) if (a.abovethetop(this, j) || a.leftofbegin(this, j)) ;else if (a.belowthefold(this, j) || a.rightoffold(this, j)) {
42921					if (++b >
42921 j.failure_limit) return !1;
42922				} else c.trigger("appear"), b = 0;
42923			});
42924		}var h,
42925		    i = this,
42926		    j = { threshold: 0, failure_limit: 0, event: "scroll", effect: "show", container: b, data_attribute: "original", skip_invisible: !1, appear: null, load: null, placeholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" };return f && (d !== f.failurelimit && (f.failure_limit = f.failurelimit, delete f.failurelimit), d !== f.effectspeed && (f.effect_speed = f.effectspeed, delete f.effectspeed), a.extend(j, f)), h = j.container === d || j.container === b ? e : a(j.container), 0 === j.event.indexOf("scroll") && h.bind(j.event, function () {
42927			return g();
42928		}), this.each(function () {
42929			var b = this,
42930			    c = a(b);b.loaded = !1, (c.attr("src") === d || c.attr("src") === !1) && c.is("img") && c.attr("src", j.placeholder), c.one("appear", function () {
42931				if (!this.loaded) {
42932					if (j.appear) {
42933						var d = i.length;j.appear.call(b, d, j);
42934					}a("<img />").bind("load", function () {
42935						var d = c.attr("data-" + j.data_attribute);c.hide(), c.is("img") ? c.attr("src", d) : c.css("background-image", "url('" + d + "')"), c[j.effect](j.effect_speed), b.loaded = !0;var e = a.grep(i, function (a) {
42936							return !a.loaded;
42937						});if (i = a(e), j.load) {
42938							var f = i.length;j.load.call(b, f, j);
42939						}
42940					}).attr("src", c.attr("data-" + j.data_attribute));
42941				}
42942			}), 0 !== j.event.indexOf("scroll") && c.bind(j.event, function () {
42943				b.loaded || c.trigger("appear");
42944			});
42945		}), e.bind("resize", function () {
42946			g();
42947		}), /(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion) && e.bind("pageshow", function (b) {
42948			b.originalEvent && b.originalEvent.persisted && i.each(function () {
42949				a(this).trigger("appear");
42950			});
42951		}), a(c).ready(function () {
42952			g();
42953		}), this;
42954	}, a.belowthefold = function (c, f) {
42955		var g;return g = f.container === d || f.container === b ? (b.innerHeight ? b.innerHeight : e.height()) + e.scrollTop() : a(f.container).offset().top + a(f.container).height(), g <= a(c).offset().top - f.threshold;
42956	}, a.rightoffold = function (c, f) {
42957		var g;return g = f.container === d || f.container === b ? e.width() + e.scrollLeft() : a(f.container).offset().left + a(f.container).width(), g <= a(c).offset().left - f.threshold;
42958	}, a.abovethetop = function (c, f) {
42959		var g;return g = f.container === d || f.container === b ? e.scrollTop() : a(f.container).offset().top, g >= a(c).offset().top + f.threshold + a(c).height();
42960	}, a.leftofbegin = function (c, f) {
42961		var g;return g = f.container === d || f.container === b ? e.scrollLeft() : a(f.container).offset().left, g >= a(c).offset().left + f.threshold + a(c).width();
42962	}, a.inviewport = function (b, c) {
42963		return !(a.rightoffold(b, c) || a.leftofbegin(b, c) || a.belowthefold(b, c) || a.abovethetop(b, c));
42964	}, a.extend(a.expr[":"], { "below-the-fold": function belowTheFold(b) {
42965			return a.belowthefold(b, { threshold: 0 });
42966		}, "above-the-top": function aboveTheTop(b) {
42967			return !a.belowthefold(b, { threshold: 0 });
42968		}, "right-of-screen": function rightOfScreen(b) {
42969			return a.rightoffold(b, { threshold: 0 });
42970		}, "left-of-screen": function leftOfScreen(b) {
42971			return !a.rightoffold(b, { threshold: 0 });
42972		}, "in-viewport": function inViewport(b) {
42973			return a.inviewport(b, { threshold: 0 });
42974		}, "above-the-fold": function aboveTheFold(b) {
42975			return !a.belowthefold(b, { threshold: 0 });
42976		}, "right-of-fold": function rightOfFold(b) {
42977			return a.rightoffold(b, { threshold: 0 });
42978		}, "left-of-fold": function leftOfFold(b) {
42979			return !a.rightoffold(b, { threshold: 0 });
42980		} });
42981}(jQuery, window, document);
42982
42983},{"babel-runtime/core-js/json/stringify":2,"babel-runtime/core-js/object/define-properties":4,"babel-runtime/core-js/object/define-property":5,"babel-runtime/core-js/object/get-prototype-of":6,"babel-runtime/helpers/typeof":15,"jquery":124}],136:[function(require,module,exports){
42984'use strict';
42985
42986var _jquery = require('jquery');
42987
42988var _jquery2 = _interopRequireDefault(_jquery);
42989
42990function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42991
42992var ajax = {
42993  /**
42994   * Send http request to stage
42995   * @param {object} settings   - Settings object
42996   * @example
42997   * {
42998   *  url: 'vehicleSearch',
42999   *  data: { test: 'testValue' },
43000   *  method: 'POST',
43001   *  callback: function(response, statusCode, statusMessage) {
43002   *    // Do sth
43003   *  }
43004   * }
43005   */
43006  ajaxRequest: function ajaxRequest() {
43007    var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
43008
43009    var self = this;
43010
43011    if (!settings.hasOwnProperty('target')) {
43012      throw new Error('Ajax-request needs target property!');
43013    }
43014
43015    settings.method = !settings.hasOwnProperty('method') ? 'GET' : settings.method;
43016    settings.data = !settings.hasOwnProperty('data') ? {} : settings.data;
43017    settings.callback = !settings.hasOwnProperty('callback') ? null : settings.callback;
43018    settings.target = '/stage-ajax/' + settings.target;
43019    settings.async = !settings.hasOwnProperty('async') ? settings.async : true;
43020    settings.data['stage-language'] = !settings.data.hasOwnProperty('stage-language') ? 'fi' : settings.data['stage-language'];
43021
43022    _jquery2.default.ajax({
43023      url: settings.target,
43024      method: settings.method,
43025      data: settings.data,
43026      dataType: 'json',
43027      async: settings.async,
43028      success: function success(responseData, responseStatus, xhr) {
43029        if (xhr.status !== 200) {
43030          console.warn('Response status was not 200 (in this case it is: ' + responseData.status + ')');
43031          console.log(responseData);
43032        }
43033
43034        if (typeof settings.callback === 'function') {
43035          settings.callback(responseData, responseStatus, xhr);
43036        }
43037      },
43038      error: function error(response, responseStatus, responseMessage) {
43039        // Refresh new token
43040        self._getStageToken();
43041        settings.callback(response, responseStatus, responseMessage);
43042      }
43043    });
43044  },
43045
43046  _getStageToken: function _getStageToken() {
43047    if (document.getElementById('ajax-token')) {
43048      _jquery2.default.ajax({
43049        url: '/stage-ajax/getStageToken',
43050        data: { 'stage-language': 'fi' },
43051        method: 'GET',
43052        success: function success(response) {
43053          // Add new token to body hidden input
43054          document.getElementById('ajax-token').value = response.token;
43055        }
43056      });
43057    }
43058  }
43059};
43060module.exports = ajax;
43061
43062},{"jquery":124}],137:[function(require,module,exports){
43063(function (global){
43064'use strict';
43065
43066var _from = require('babel-runtime/core-js/array/from');
43067
43068var _from2 = _interopRequireDefault(_from);
43069
43070function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43071
43072global.megasearch = function () {
43073	var module = {};
43074
43075	//Search variables
43076	var $search = $('#megasearch form'),
43077	    $input = $('.search-input'),
43078	    $close = $('span.search-close'),
43079	    isOpen = false,
43080	    isAnimating = false;
43081
43082	module.search = function (searchTerms) {
43083
43084		var $results = $('#megasearch .results'),
43085		    results;
43086
43087		if (typeof searchTerms !== 'undefined' && searchTerms !== null && /\S/.test(searchTerms)) {
43088			$.cookie('megasearchTerms', searchTerms, { expires: 1, path: '/' });
43089			var terms = searchTerms.replace(/\,/g, ' ').replace(/  /g, ' ');
43090			var terms = terms.match(/ /g) ? terms.split(' ') : [terms],
43091			    search = {
43092				terms: [],
43093				fullSearch: searchTerms
43094			};
43095
43096			for (var i = 0; i < terms.length; i++) {
43097				if (terms[i] != ' ' && terms[i] != '') {
43098					search.terms.push(terms[i]);
43099				}
43100			}
43101
43102			$results.html('<div class="loader"/>');
43103
43104			if (locationSuccessful) {
43105				search.userLocation = [userLat, userLon];
43106			}
43107
43108			var template;
43109			$.ajax({
43110				url: '/stage-ajax/megasearch?stage-language=fi&v=20',
43111				data: search,
43112				success: function success(data) {
43113					results = data ? data.results : false;
43114					template = data ? data.template : false;
43115					window.history.pushState('forward', null, './#megasearch');
43116				},
43117				complete: function complete() {
43118					var rendered = Mustache.render(template, results);
43119					$results.html(rendered);
43120					if ($results.find('.used-cars .show-all-cars').length) {
43121						var allUsedCarsUrl = $results.find('.used-cars .show-all-cars').attr('href').split('?')[0];
43122						$results.find('.used-cars .show-all-cars').attr('href', allUsedCarsUrl + '?type[]=used&megasearch[]=' + search.terms.join(' '));
43123						$results.find('.used-cars .h6 a').attr('href', allUsedCarsUrl + '?type[]=used&megasearch[]=' + search.terms.join(' '));
43124					}
43125					if ($results.find('.stock-cars .show-all-cars').length) {
43126						var allUsedCarsUrl = $results.find('.stock-cars .show-all-cars').attr('href').split('?')[0];
43127						$results.find('.stock-cars .show-all-cars').attr('href', allUsedCarsUrl + '?type[]=stock&megasearch[]=' + search.terms.join(' '));
43128						$results.find('.stock-cars .h6 a').attr('href', allUsedCarsUrl + '?type[]=stock&megasearch[]=' + search.terms.join(' '));
43129					}
43130					if ($results.find('.new-cars .show-all-cars').length) {
43131						var allUsedCarsUrl = $results.find('.new-cars .show-all-cars').attr('href').split('?')[0];
43132						$results.find('.new-cars .show-all-cars').attr('href', allUsedCarsUrl + '?type[]=new&megasearch[]=' + search.terms.join(' '));
43133						$results.find('.new-cars .h6 a').attr('href', allUsedCarsUrl + '?type[]=new&megasearch[]=' + search.terms.join(' '));
43134					}
43135				},
43136				error: function error(e) {
43137					console.log('ERROR! Megasearch failed!');
43138					console.log(e);
43139				}
43140			});
43141		} else {
43142			$results.empty();
43143		}
43144	};
43145
43146	return module;
43147}();
43148
43149//megasearch events
43150(function () {
43151	var searchTimer;
43152	$('#megasearch form').on('keyup', 'input', function (e) {
43153		clearTimeout(searchTimer);
43154
43155		var keyCode = e.keyCode || e.which,
43156		    val = $(this).val();
43157
43158		searchTimer = setTimeout(function () {
43159			megasearch.search(val);
43160		}, 1000);
43161	}).submit(function (e) {
43162		e.preventDefault();
43163	});
43164
43165	$('#megasearch a.close').click(function (e) {
43166		e.preventDefault();
43167		navigation.toggle('#megasearch', $('li.megasearch a'));
43168		$('html').css('overflow', 'auto');
43169	});
43170
43171	$(document).keyup(function (e) {
43172		if (e.keyCode == 27 && $('#megasearch').hasClass('active')) {
43173			//escape
43174			navigation.toggle('#megasearch', $('li.megasearch a'));
43175			$('html').css('overflow', 'auto');
43176		}
43177	});
43178
43179	var testdrives = (0, _from2.default)(document.querySelectorAll('.hero .testdrivesQ'));
43180
43181	if (testdrives.length) {
43182		testdrives.sort(function () {
43183			return Math.random() - 0.5;
43184		});
43185		testdrives.forEach(function (el, i) {
43186			if (i === 0) {
43187				el.classList.remove('hidden');
43188			}
43189		});
43190	}
43191})();
43192
43193}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
43194
43195},{"babel-runtime/core-js/array/from":1}],138:[function(require,module,exports){
43196'use strict';
43197
43198var accordions = {
43199    init: function init() {
43200        var accordionContainers = document.getElementsByClassName('read-more-accordion');
43201        if (accordionContainers.length > 0) {
43202            for (var i = 0; i < accordionContainers.length; i++) {
43203                accordionContainers[i].querySelector('.read-more-accordion-button').addEventListener('click', function (event) {
43204                    event.stopPropagation();
43205                    event.target.parentElement.querySelector('.read-more-accordion-content').classList.toggle('show');
43206                });
43207            }
43208            return true;
43209        } else return false;
43210    }
43211};
43212
43213module.exports = accordions;
43214
43215},{}],139:[function(require,module,exports){
43216'use strict';
43217
43218var _stringify = require('babel-runtime/core-js/json/stringify');
43219
43220var _stringify2 = _interopRequireDefault(_stringify);
43221
43222function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43223
43224var branchBar = {
43225  _minifiedClass: 'branch-bar--minified',
43226  _hiddenClass: 'branch-bar--hidden',
43227  _storageSettings: null,
43228  _folderId: null,
43229  _settingsKey: null,
43230  _dom: {
43231    bar: null,
43232    toggles: null,
43233    pageSelects: null
43234  },
43235  _isLocalStorageEnabled: function _isLocalStorageEnabled() {
43236    var test = 'branch-bar-test';
43237
43238    try {
43239      localStorage.setItem(test, test);
43240      localStorage.removeItem(test);
43241      return true;
43242    } catch (e) {
43243      return false;
43244    }
43245  },
43246  _isMinified: function _isMinified() {
43247    return this._dom.bar.className.split(' ').indexOf(this._minifiedClass) >= 0;
43248  },
43249  _getSettings: function _getSettings() {
43250    var settings = null;
43251
43252    if (!this._isLocalStorageEnabled()) {
43253      return null;
43254    }
43255    this._folderId = this._dom.bar.getAttribute('data-folder-id');
43256    this._settingsKey = 'branch-bar--' + this._folderId;
43257    if (this._settingsKey) {
43258      try {
43259        settings = JSON.parse(localStorage.getItem(this._settingsKey));
43260        return settings;
43261      } catch (e) {
43262        return null;
43263      }
43264    }
43265
43266    return settings;
43267  },
43268  _updateSettings: function _updateSettings() {
43269    if (!this._isLocalStorageEnabled()) {
43270      return false;
43271    }
43272
43273    if (!this._storageSettings) {
43274      this._storageSettings = {};
43275    }
43276
43277    this._storageSettings.minified = this._isMinified();
43278
43279    try {
43280      localStorage.setItem(this._settingsKey, (0, _stringify2.default)(this._storageSettings));
43281      return true;
43282    } catch (e) {
43283      return false;
43284    }
43285  },
43286  _toggleMinified: function _toggleMinified() {
43287    if (this._isMinified()) {
43288      var reg = new RegExp('(\\s|^)' + this._minifiedClass + '(\\s|$)');
43289      this._dom.bar.className = this._dom.bar.className.replace(reg, ' ');
43290    } else {
43291      this._dom.bar.className += ' ' + this._minifiedClass;
43292    }
43293  },
43294  _initToggles: function _initToggles() {
43295    var self = this;
43296
43297    this._dom.toggles = this._dom.bar.getElementsByClassName('js-branch-bar__toggle');
43298
43299    for (var i = 0, l = this._dom.toggles.length; i < l; i++) {
43300      this._dom.toggles[i].addEventListener('click', function () {
43301        self._toggleMinified();
43302        self._updateSettings();
43303      }, false);
43304    }
43305  },
43306  _initPageSelects: function _initPageSelects() {
43307    this._dom.pageSelects = this._dom.bar.getElementsByClassName('js-branch-bar__page-select');
43308
43309    for (var i = 0, l = this._dom.pageSelects.length; i < l; i++) {
43310      this._dom.pageSelects[i].addEventListener('change', function (e) {
43311        var val = e.target.value;
43312
43313        if (val) {
43314          window.location.href = val;
43315        }
43316      }, false);
43317    }
43318  },
43319  _showBar: function _showBar() {
43320    var reg = new RegExp('(\\s|^)' + this._hiddenClass + '(\\s|$)');
43321    var self = this;
43322
43323    self._dom.bar.className = self._dom.bar.className.replace(reg, ' ');
43324  },
43325  init: function init() {
43326    this._dom.bar = document.getElementById('js-branch-bar'); // Assumes only one bar per page
43327
43328    if (this._dom.bar) {
43329      this._storageSettings = this._getSettings();
43330
43331      // If user left the bar open
43332      if (this._storageSettings && !this._storageSettings.minified) {
43333        this._toggleMinified();
43334      }
43335
43336      this._initToggles();
43337      this._initPageSelects();
43338
43339      this._showBar();
43340    }
43341  }
43342};
43343
43344module.exports = branchBar;
43345
43346},{"babel-runtime/core-js/json/stringify":2}],140:[function(require,module,exports){
43347(function (global){
43348'use strict';
43349
43350var _typeof2 = require('babel-runtime/helpers/typeof');
43351
43352var _typeof3 = _interopRequireDefault(_typeof2);
43353
43354var _mustache = require('mustache');
43355
43356var _mustache2 = _interopRequireDefault(_mustache);
43357
43358function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43359
43360global.search = function () {
43361	var module = {},
43362	    searchType = $('main .search').data('search-type'),
43363	    $form = $('.filters form'),
43364	    $page = $('.page.main'),
43365	    $currentFilters = $('.currentFilters'),
43366	    resultsTemplate = $('#resultsTemplate').html(),
43367	    filtersTemplate = $('#currentFiltersTemplate').html(),
43368	    listTemplate = $('#listTemplate').html(),
43369	    locationTemplate = $('#locationTemplate').html(),
43370	    ajaxTimer;
43371
43372	//Parse mustache templates
43373	_mustache2.default.parse(resultsTemplate);
43374	_mustache2.default.parse(listTemplate);
43375	_mustache2.default.parse(filtersTemplate);
43376
43377	//Just so that you can get the currentfilters easily by typing carsearch.currentFilters() into console
43378	module.logFilters = function () {
43379		console.log(currentFilters);
43380	};
43381
43382	// Update URL, renderFilters, get and not reload when is mobile
43383	module.reRender = function () {
43384		if (windowWidth > mobileBreakpoint || searchPage) {
43385			search.updateUrl();
43386			search.renderFilters();
43387			search.get();
43388		}
43389	};
43390
43391	//Add new car, used car, stock car option to filter object
43392	//Filter carlist afterwards
43393	module.categories = function (carCategories) {
43394		currentFilters.type = carCategories;
43395
43396		if (searchPage == userFilters) {
43397			search.reRender();
43398		} else if (windowWidth > mobileBreakpoint) {
43399			var searchParemeters = search.createUrl(currentFilters);
43400			var resultsUrl = userFilters == 'car' ? '/fi/autot/autohaku/?' : '/fi/renkaat/rengashaku/?';
43401			window.location = resultsUrl + searchParemeters;
43402		}
43403
43404		if (currentFilters.type.indexOf('used') !== -1) {
43405			$('.special-contracts').addClass('active');
43406		} else {
43407			$('.special-contracts').removeClass('active');
43408		}
43409	};
43410
43411	//For Volvo Selekt and Autosalpa Contract checkboxes
43412	module.checkbox = function (key, val) {
43413		currentFilters[key] = val;
43414		search.reRender();
43415	};
43416
43417	//For min - max filters
43418	module.minMax = function (minKey, minVal, maxKey, maxVal) {
43419		currentFilters[minKey] = minVal;
43420		currentFilters[maxKey] = maxVal;
43421		search.reRender();
43422	};
43423
43424	//For dropdown filters
43425	module.dropdown = function (key, val) {
43426		currentFilters[key] = val;
43427		search.reRender();
43428	};
43429
43430	//Sort the cars
43431	module.sort = function (sort) {
43432		currentFilters.sortBy = sort;
43433		search.reRender();
43434	};
43435
43436	//Here we choose what the action will be depending on what the user clicked
43437	module.filter = function (data, categoryName) {
43438		//Define the filter set
43439		currentFilters = userFilters == 'car' ? window.currentCarFilters : window.currentTyreFilters;
43440		availableFilters = userFilters == 'car' ? window.carFilters : window.tyreFilters;
43441
43442		//Define the selected filter
43443		var category = data.filterCategory,
43444		    option = data.filterOption,
43445		    name = data.filterName,
43446		    extra = data.filterExtra,
43447		    next = data.filterNext;
43448		//If not on the first filter page we will add the filter to our filters object and filter the carlist
43449		if ($page.data('number') != 'one') {
43450
43451			if (category == 'model' && userFilters == 'car') {
43452				if (typeof currentFilters.model[extra] !== "undefined") {
43453					currentFilters.model[extra].push(option);
43454				} else {
43455					currentFilters.model[extra] = [option];
43456				}
43457			} else if ($.inArray(option, currentFilters[category]) == -1) {
43458				currentFilters[category].push(option);
43459			}
43460			//Add filters to dom
43461			if (searchPage) {
43462				search.reRender();
43463			}
43464		}
43465
43466		//If you are on the first page, aka category choosing the getFilters function will happen and nothing else
43467		//If we are not on the last page of the filter trail we will simply get the next set of filters.
43468		//If on the last page filter list will go on the first page. To allow the client to choose new filters.
43469		if (windowWidth <= mobileBreakpoint) {
43470			if (next === 'reset' || extra) {
43471				search.reset();
43472			} else {
43473				search.getFilters(data, categoryName);
43474			}
43475		} else if (next !== 'reset') {
43476			search.getFilters(data, categoryName);
43477		} else if (searchPage == userFilters) {
43478			search.reset();
43479		} else {
43480			var searchParemeters = search.createUrl(currentFilters);
43481			var resultsUrl = userFilters == 'car' ? '/fi/autot/autohaku/?' : '/fi/renkaat/rengashaku/?';
43482			window.location = resultsUrl + searchParemeters;
43483		}
43484	};
43485
43486	//Get the next filters
43487	module.getFilters = function (data, categoryName) {
43488
43489		var next = data.filterNext,
43490		    category = data.filterCategory,
43491		    option = data.filterOption,
43492		    name = data.filterName,
43493		    extra = data.filterExtra;
43494
43495		var results = {
43496			'options': [],
43497			'name': categoryName
43498		};
43499
43500		var filters = next == 'model' && userFilters == 'car' ? availableFilters['model'][option] : availableFilters[category];
43501
43502		if (category === 'location') {
43503
43504			results.options = {
43505				autosalpa: [],
43506				vaihtoautosalpa: []
43507			};
43508
43509			for (var f in filters) {
43510				var locationFilter = {
43511					option: filters[f],
43512					name: filters[f] === 'Hämeenlinna' ? filters[f] + ' Ruununmylly' : filters[f],
43513					category: category,
43514					extra: '',
43515					next: 'reset'
43516				};
43517
43518				/*
43519     * Separation on Autosalpa and Vaihtoautosalpa. I'm sorry.
43520     */
43521				if (locationFilter.hasOwnProperty('name') && (locationFilter.name === 'Hamina' || locationFilter.name === 'Hämeenlinna Visamäki')) {
43522					results.options.vaihtoautosalpa.push(locationFilter);
43523				} else {
43524					results.options.autosalpa.push(locationFilter);
43525				}
43526			}
43527
43528			//Get filters and render them on to the next page.
43529			if (typeof locationTemplate === 'undefined') {
43530				locationTemplate = '';
43531			}
43532			var rendered = _mustache2.default.render(locationTemplate, results);
43533		} else {
43534			for (var _f in filters) {
43535				var typeObj = (0, _typeof3.default)(filters[_f]) === "object",
43536				    newFilter = {
43537					'option': typeObj ? filters[_f].value : filters[_f],
43538					'name': typeObj ? filters[_f].name : filters[_f],
43539					'category': typeObj ? filters[_f].category : category,
43540					'extra': option,
43541					'next': category == 'manufacturer' && userFilters == 'car' && typeof option == "undefined" ? 'model' : 'reset'
43542				};
43543
43544				if (typeof newFilter.extra != "undefined" && newFilter.next == 'reset') {
43545					newFilter.category = 'model';
43546				}
43547
43548				results.options.push(newFilter);
43549			}
43550
43551			//Get filters and render them on to the next page.
43552			if (typeof listTemplate === 'undefined') {
43553				listTemplate = '';
43554			}
43555			var rendered = _mustache2.default.render(listTemplate, results);
43556		}
43557
43558		//Define the next page and render results on that page
43559		$page = $page.next();
43560		$page.html(rendered);
43561
43562		//Sometimes the scroll stays at the bottom when the navigation moves to the next page
43563		$('#navigation .content').animate({ scrollTop: 0 }, 1);
43564
43565		//Add css class to form in order to know what part we want to show.
43566		$form.attr('class', $page.data('number'));
43567
43568		//Add events to new filters
43569		$page.find('li:not(.back)').on('click', 'a', function (e) {
43570			e.preventDefault();
43571			search.filter($(this).data(), $(this).text());
43572		});
43573		$page.find('.back').click(function (e) {
43574			e.preventDefault();
43575			search.reset('back');
43576		});
43577
43578		$('.section-title .close').click(function (e) {
43579			e.preventDefault();
43580			navigation.toggle('#navigation', $(this));
43581		});
43582	};
43583
43584	var filtersVisible;
43585	function collapseFilters() {
43586		if ($('.currentFilters .list .filter').length > 5) {
43587			$('.currentFilters .list .filter').slice(5).fadeOut();
43588			$('.currentFilters .list .filter').eq(4).after('<span href="#" class="show-filters">...</span>');
43589			filtersVisible = false;
43590		} else {
43591			$('.currentFilters .list .show-filters').remove();
43592		}
43593	}
43594
43595	module.renderFilters = function () {
43596		currentFilters = userFilters == 'car' ? window.currentCarFilters : window.currentTyreFilters;
43597		availableFilters = userFilters == 'car' ? window.carFilters : window.tyreFilters;
43598		currentFilters.sortBy = $('select[name=sort]').val();
43599
43600		if (currentFilters.manufacturer.indexOf('nissan') != -1 && currentFilters.manufacturer.indexOf('opel') == -1) {
43601			$('#link_nissan').show();
43602			$('#link_opel').hide();
43603			$('#link_nissan_opel').hide();
43604		} else if (currentFilters.manufacturer.indexOf('opel') != -1 && currentFilters.manufacturer.indexOf('nissan') == -1) {
43605			$('#link_opel').show();
43606			$('#link_nissan').hide();
43607			$('#link_nissan_opel').hide();
43608		} else if (currentFilters.manufacturer.indexOf('nissan') != -1 && currentFilters.manufacturer.indexOf('opel') != -1) {
43609			$('#link_nissan_opel').show();
43610			$('#link_nissan').hide();
43611			$('#link_opel').hide();
43612		} else {
43613			$('#link_nissan').hide();
43614			$('#link_opel').hide();
43615			$('#link_nissan_opel').hide();
43616		}
43617
43618		if (currentFilters.type.indexOf('used') !== -1) {
43619			$('.special-contracts').addClass('active');
43620		} else {
43621			$('.special-contracts').removeClass('active');
43622		}
43623
43624		var price = '',
43625		    kilometrage = '',
43626		    year = '',
43627		    size = '',
43628		    height = '',
43629		    width = '';
43630
43631		//Modify dom to show filters above car list
43632		//view object for mustache
43633		var view = {
43634			filters: []
43635		};
43636
43637		//Go through all the car filters and put them in the view object
43638		$.each(currentFilters, function (category, filters) {
43639			//Get the models from the manufacturers array.
43640			if ((typeof filters === 'undefined' ? 'undefined' : (0, _typeof3.default)(filters)) !== "object") {
43641
43642				var add = false;
43643
43644				var stringFilter = {
43645					'option': filters,
43646					'category': '',
43647					'index': 1,
43648					'name': ''
43649				};
43650
43651				switch (category) {
43652					case 'priceMin':
43653						price += filters != 0 && filters != 'Min' ? filters + ' €' : '';
43654						break;
43655					case 'priceMax':
43656						price += filters != 0 && filters != 'Max' ? ' - ' + filters + ' €' : '';
43657						stringFilter.name = price;
43658						stringFilter.category = 'price';
43659						break;
43660					case 'yearMin':
43661						year += filters != 0 && filters != 'Min' ? filters : '';
43662						break;
43663					case 'yearMax':
43664						year += filters != 0 && filters != 'Max' ? ' - ' + filters : '';
43665						stringFilter.name = year;
43666						stringFilter.category = 'year';
43667						break;
43668					case 'kilometrageMin':
43669						kilometrage += filters != 0 && filters != 'Min' ? filters + ' km' : '';
43670						break;
43671					case 'kilometrageMax':
43672						kilometrage += filters != 0 && filters != 'Max' ? ' - ' + filters + ' km' : '';
43673						stringFilter.name = kilometrage;
43674						stringFilter.category = 'kilometrage';
43675						break;
43676					case 'size':
43677						size += filters != 0 && filters != 'Valitse' ? filters : '';
43678						stringFilter.name = size;
43679						stringFilter.category = 'size';
43680						break;
43681					case 'height':
43682						height += filters != 0 && filters != 'Valitse' ? filters : '';
43683						stringFilter.name = height;
43684						stringFilter.category = 'height';
43685						break;
43686					case 'width':
43687						width += filters != 0 && filters != 'Valitse' ? filters : '';
43688						stringFilter.name = width;
43689						stringFilter.category = 'width';
43690						break;
43691					case 'volvoselekt':
43692						stringFilter.name = filters != 0 ? 'Volvo Selekt' : '';
43693						stringFilter.category = 'volvoselekt';
43694						if (filters != 0) {
43695							$('.volvo-selekt input').prop('checked', 1);
43696						}
43697						break;
43698					case 'autosalpa_contract':
43699						stringFilter.name = filters != 0 ? 'Autosalpa Sopimus' : '';
43700						stringFilter.category = 'autosalpa_contract';
43701						if (filters != 0) {
43702							$('.autosalpa-contract input').prop('checked', 1);
43703						}
43704						break;
43705					case 'autosalpa_warranty':
43706						stringFilter.name = filters != 0 ? 'Autosalpa Takuu' : '';
43707						stringFilter.category = 'autosalpa_warranty';
43708						if (filters != 0) {
43709							$('.autosalpa-warranty input').prop('checked', 1);
43710						}
43711					default:
43712				}
43713
43714				if (stringFilter.name != '') {
43715					view.filters.push(stringFilter);
43716				}
43717			} else if (category == 'model' && userFilters == 'car') {
43718				for (var f in filters) {
43719					var manufacturer = f;
43720					var models = filters[f];
43721					for (var m in models) {
43722						var model = {
43723							'name': manufacturer + ' ' + models[m],
43724							'option': models[m],
43725							'category': category,
43726							'index': manufacturer
43727						};
43728						view.filters.push(model);
43729					}
43730				}
43731			} else {
43732				for (var _f2 in filters) {
43733					var filterTypeObj = (0, _typeof3.default)(filters[_f2]) === "object",
43734					    categoryIsArray = $.isArray(availableFilters[category]);
43735
43736					var filterIndex = filters[_f2];
43737
43738					//Category is not an array, filter is an object
43739					if (!categoryIsArray && filterTypeObj && $.inArray(filters[_f2].name, availableFilters[category][_f2].name) !== -1 && category != 'vehicle_type') {
43740						var name = filters[_f2].name;
43741					}
43742					//Category is an array, filter is not an object
43743					else if (categoryIsArray && !filterTypeObj && $.inArray(filters[_f2], availableFilters[category]) !== -1 && category != 'vehicle_type') {
43744							var name = filters[_f2];
43745						}
43746						//Category is not an array, filter is not an objcet
43747						else if (!categoryIsArray && !filterTypeObj && filters[_f2] == availableFilters[category][filterIndex].value && category != 'vehicle_type') {
43748								var name = availableFilters[category][filterIndex].name;
43749							}
43750							//Category is an array, filter is an object
43751							else if (categoryIsArray && filterTypeObj && $.inArray(filters[_f2].name, availableFilters[category][_f2].name) !== -1 || category == 'vehicle_type') {
43752									var name = availableFilters[category][filterIndex].name;
43753								}
43754								//This happens only on type
43755								else {
43756										console.log(availableFilters[category]);
43757										var name = availableFilters[category][filterIndex].name;
43758									}
43759
43760					var filter = {
43761						'name': name,
43762						'option': filterTypeObj ? filters[_f2].option : filters[_f2],
43763						'category': category,
43764						'index': _f2
43765					};
43766
43767					view.filters.push(filter);
43768				}
43769			}
43770		});
43771
43772		//Render on the page
43773		if (typeof filtersTemplate === 'undefined') {
43774			filtersTemplate = '';
43775		}
43776		var rendered = _mustache2.default.render(filtersTemplate, view);
43777		$currentFilters.find('.list').html(rendered);
43778
43779		if ($('.currentFilters .list .filter').length > 5 && filtersVisible != true) {
43780			collapseFilters();
43781		}
43782
43783		$('.currentFilters .list .show-filters').click(function () {
43784			if (filtersVisible == false || filtersVisible == 'undefined') {
43785				$('.currentFilters .list .filter').fadeIn();
43786				$(this).fadeOut();
43787				$(this).remove();
43788				filtersVisible = true;
43789			}
43790		});
43791
43792		//Update carlisting new cars based on new filters
43793		//search.get();
43794
43795		//Click event for deleting the filter
43796		$('.currentFilters a').click(function (e) {
43797			search.removeFilter($(this).data('filter-index'), $(this).data('filter-category'), $(this).data('filter-option'));
43798		});
43799	};
43800
43801	module.createUrl = function () {
43802		var serialize = function serialize(obj, prefix) {
43803			var str = [];
43804			for (var p in obj) {
43805				if (obj.hasOwnProperty(p)) {
43806					var k = prefix ? prefix + "[" + p + "]" : p,
43807					    v = obj[p];
43808					if (v != "") {
43809						str.push((typeof v === 'undefined' ? 'undefined' : (0, _typeof3.default)(v)) == "object" ? serialize(v, k) : encodeURIComponent(k) + "=" + encodeURIComponent(v));
43810					}
43811				}
43812			}
43813			return str.join("&");
43814		};
43815		return serialize(currentFilters);
43816	};
43817
43818	module.updateUrl = function (action) {
43819		currentFilters.scrollTop = $('body').scrollTop();
43820		currentFilters.results = $('.search .results .car').length;
43821		window.history.pushState(currentFilters, "Search", '?' + search.createUrl(currentFilters));
43822		var currentState = window.history.state;
43823	};
43824
43825	module.removeFilter = function (index, category, option) {
43826
43827		var numbers = false;
43828
43829		switch (category) {
43830			case 'price':
43831				currentFilters.priceMin = 0;
43832				currentFilters.priceMax = 0;
43833				numbers = true;
43834				$('.price select').prop('selectedIndex', 0);
43835				break;
43836			case 'year':
43837				currentFilters.yearMin = 0;
43838				currentFilters.yearMax = 0;
43839				numbers = true;
43840				$('.year select').prop('selectedIndex', 0);
43841				break;
43842			case 'kilometrage':
43843				currentFilters.kilometrageMin = 0;
43844				currentFilters.kilometrageMax = 0;
43845				numbers = true;
43846				$('.kilometrage select').prop('selectedIndex', 0);
43847				break;
43848			case 'size':
43849				currentFilters.size = 0;
43850				numbers = true;
43851				$('.size select').prop('selectedIndex', 0);
43852				break;
43853			case 'height':
43854				currentFilters.height = 0;
43855				numbers = true;
43856				$('.height select').prop('selectedIndex', 0);
43857				break;
43858			case 'width':
43859				currentFilters.width = 0;
43860				numbers = true;
43861				$('.width select').prop('selectedIndex', 0);
43862				break;
43863			case 'volvoselekt':
43864				currentFilters.volvoselekt = 0;
43865				$('.volvo-selekt input').prop('checked', 0);
43866				break;
43867			case 'autosalpa_contract':
43868				currentFilters.autosalpa_contract = 0;
43869				$('.autosalpa-contract input').prop('checked', 0);
43870				break;
43871			case 'autosalpa_warranty':
43872				currentFilters.autosalpa_warranty = 0;
43873				$('.autosalpa-warranty input').prop('checked', 0);
43874			default:
43875		}
43876
43877		if (!numbers) {
43878			if ($.isArray(currentFilters[category])) {
43879
43880				var indx = parseInt(index);
43881				currentFilters[category].splice(indx, 1);
43882
43883				if (category == 'type') {
43884					$('.car_category a').each(function (i, cat) {
43885						var $this = $(this);
43886						if ($.inArray($this.data('category'), currentFilters.type) == -1) {
43887							$this.removeClass('active');
43888						}
43889					});
43890				}
43891
43892				if (category == 'manufacturer' && currentFilters.model && typeof currentFilters.model !== "undefined") {
43893					delete currentFilters['model'][option];
43894				}
43895			} else if (category == 'model') {
43896				var models = currentFilters[category][index];
43897				var modelIndex = 0;
43898				for (var i = 0; i < models.length; i++) {
43899					if (option == models[i]) {
43900						modelIndex = i;
43901					}
43902				}
43903				currentFilters[category][index].splice(modelIndex, 1);
43904			} else {
43905				delete currentFilters[category][index];
43906			}
43907		}
43908
43909		//Render current filters, renderFilters function will update car listing
43910		search.updateUrl();
43911		search.renderFilters();
43912		search.get();
43913	};
43914
43915	//Get cars or tyres and render them on the page.
43916	module.get = function (lazyload) {
43917		clearTimeout(ajaxTimer);
43918		ajaxTimer = setTimeout(function () {
43919
43920			var $results = $('main .search .results'),
43921			    url = $('main .search').data('action'),
43922			    results;
43923			var offset = 25;
43924			var startOffset = lazyload ? offset : 0;
43925			currentFilters.offset = lazyload && currentFilters.offset ? currentFilters.offset + offset : startOffset;
43926
43927			if (resultsCount > 10 && lazyloadPosition < resultsCount) {
43928				$('.loader').addClass('active');
43929			}
43930
43931			$.ajax({
43932				url: url + '?stage-language=fi',
43933				data: currentFilters,
43934				success: function success(data) {
43935					results = data;
43936					resultsCount = results.count;
43937					$('span.search-results-amount').text(results.count);
43938
43939					//append pixel if applicable
43940					$('.pixel').remove();
43941					if (typeof data.pixel !== "undefined" && data.pixel && data.pixel.length) {
43942						$('.currentFilters .sort').after('<img class="pixel" src="' + data.pixel + '" width="1" height="1" />');
43943					}
43944
43945					//append custom content
43946					$('.customContent').remove();
43947					if (typeof data.custom_content !== "undefined" && data.custom_content && data.custom_content.length) {
43948						$('.currentFilters .sort').after('<div class="customContent grid-full"></div>');
43949						$.each(data.custom_content, function (i, el) {
43950							$('.customContent').append(el.text);
43951						});
43952					}
43953
43954					//set h1-title, meta title and meta description
43955					var h1Arr = [],
43956					    titleArr = [],
43957					    pageDescription = []; /* = $('meta[name=description]').attr("content"); */
43958
43959					if (window.currentCarFilters.manufacturer.length) {
43960						h1Arr.push(window.carFilters.manufacturer[window.currentCarFilters.manufacturer[0]].name);
43961					}
43962
43963					if (window.currentCarFilters.type.length) {
43964						h1Arr.push(window.carFilters.type[window.currentCarFilters.type[0]].name);
43965					}
43966					if (window.currentCarFilters.location.length) {
43967						h1Arr.push(window.currentCarFilters.location[0]);
43968					}
43969					if (window.currentCarFilters.megasearch.length) {
43970						h1Arr.push(window.currentCarFilters.megasearch[0]);
43971					}
43972
43973					var h1Str = h1Arr.join(' ');
43974
43975					if ($('body').hasClass('car-search')) {
43976						$('.search > h1:first-child').text("Tulokset: " + h1Str);
43977						$('meta[name=description]').attr("content", h1Str);
43978						document.title = h1Str;
43979					}
43980				},
43981				complete: function complete() {
43982					if (typeof resultsTemplate === 'undefined') {
43983						resultsTemplate = '';
43984					}
43985					var rendered = _mustache2.default.render(resultsTemplate, results);
43986
43987					if (lazyload) {
43988						$results.append(rendered);
43989					} else {
43990						$results.html(rendered);
43991					}
43992
43993					$('.loader').removeClass('active');
43994					search.updateUrl();
43995					if ($('.search .results .car').length >= parseInt(resultsCount)) {
43996						$('.search .show-more').addClass('disabled');
43997					} else {
43998						$('.search .show-more').removeClass('disabled');
43999					}
44000					$('.car > a').on('click', function (e) {
44001						search.updateUrl('scrollTop');
44002					});
44003				},
44004				error: function error(e) {
44005					console.error(e);
44006				}
44007			});
44008		}, 50);
44009	};
44010
44011	//Reset search to first page
44012	module.reset = function (action) {
44013
44014		if (action == 'back' && $('.car-filters form').hasClass('three')) {
44015
44016			$('.car-filters form').removeClass('three');
44017			$('.car-filters form').addClass('two');
44018			$page = $('.page.main').next();
44019		} else {
44020
44021			$('.filters form').attr('class', '');
44022			$('.filters .page:not(.main)').empty();
44023			$page = $('.page.main');
44024
44025			//This happens on the tablet version
44026			if (windowWidth >= 640 && windowWidth <= 1280) {
44027				navigation.toggle('#navigation', $('li.navigation a.active'));
44028			}
44029		}
44030	};
44031
44032	module.init = function () {
44033		currentFilters = $('body').hasClass('car-search') ? window.currentCarFilters : window.currentTyreFilters;
44034		availableFilters = $('body').hasClass('car-search') ? window.carFilters : window.tyreFilters;
44035
44036		if (typeof searchPage !== "undefined" && searchPage && searchPage !== '') {
44037
44038			search.renderFilters();
44039
44040			if (userFilters == 'tyre') {
44041
44042				$('.filters.tyre-filters').addClass('active');
44043				$navigations.addClass('sub');
44044				$('.navigation-last-level').hide();
44045				$navigations.addClass('show-tyres');
44046			} else if (userFilters == 'car') {
44047
44048				$('.navigation-sub-level').hide();
44049				$('.navigation-last-level').hide();
44050				$('.filters.car-filters').addClass('active');
44051				$navigations.addClass('sub');
44052			}
44053
44054			$('.search .show-more').click(function (e) {
44055				var eventPosition = parseInt($('footer').offset().top) - 450;
44056				var scrollBottom = parseInt($(window).scrollTop()) + parseInt(windowHeight);
44057				if (scrollBottom > eventPosition && !$(this).hasClass('disabled')) {
44058					search.get(true);
44059				}
44060			});
44061		}
44062		$('.page.main li').on('click', 'a', function (e) {
44063			e.preventDefault();
44064			search.filter($(this).data(), $(this).text());
44065		});
44066
44067		$('.car_category').on('click', 'a', function (e) {
44068			e.preventDefault();
44069			var carCategories = [];
44070			$(this).toggleClass('active');
44071
44072			$('.car_category a.active').each(function () {
44073				carCategories.push($(this).data('category'));
44074			});
44075
44076			search.categories(carCategories);
44077		});
44078
44079		$('.car > a').on('click', function (e) {
44080			search.updateUrl('scrollTop');
44081		});
44082
44083		if (window.history.state) {
44084			$('body').scrollTop(window.history.state.scrollTop);console.log('check!');
44085		}
44086
44087		//Car search range filters
44088		$('.filters .range.year select').change(function () {
44089			var min = $('select[name=yearMin]'),
44090			    max = $('select[name=yearMax]');
44091			search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());
44092		});
44093		$('.filters .range.kilometrage select').change(function () {
44094			var min = $('select[name=kilometrageMin]'),
44095			    max = $('select[name=kilometrageMax]');
44096			search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());
44097		});
44098
44099		//Tyre search range filters
44100		$('.filters .range.width select').change(function () {
44101			/*var min = $('select[name=widthMin]'),
44102   	max = $('select[name=widthMax]');
44103   	search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());*/
44104			var dropdown = $('select[name=width]');
44105			search.dropdown(dropdown.attr('name'), dropdown.val());
44106		});
44107		$('.filters .range.height select').change(function () {
44108			/*var min = $('select[name=heightMin]'),
44109   	max = $('select[name=heightMax]');
44110   	search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());*/
44111			var dropdown = $('select[name=height]');
44112			search.dropdown(dropdown.attr('name'), dropdown.val());
44113		});
44114		$('.filters .range.size select').change(function () {
44115			/*var min = $('select[name=sizeMin]'),
44116   	max = $('select[name=sizeMax]');
44117   	search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());*/
44118			var dropdown = $('select[name=size]');
44119			search.dropdown(dropdown.attr('name'), dropdown.val());
44120		});
44121
44122		//For both
44123		$('.filters.car-filters .range.price select').change(function () {
44124			var min = $('.car-filters select[name=priceMin]'),
44125			    max = $('.car-filters select[name=priceMax]');
44126			search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());
44127		});
44128
44129		$('.filters.tyre-filters .range.price select').change(function () {
44130			var min = $('.tyre-filters select[name=priceMin]'),
44131			    max = $('.tyre-filters select[name=priceMax]');
44132			search.minMax(min.attr('name'), min.val(), max.attr('name'), max.val());
44133		});
44134
44135		$('select[name=sort]').change(function () {
44136			currentFilters.results = 10;
44137			search.sort($(this).val());
44138		});
44139
44140		$('.search-cars').click(function (e) {
44141			e.preventDefault();
44142			if (searchPage == userFilters) {
44143				search.reRender();
44144				search.reset('search');
44145				if (windowWidth <= 640) {
44146					$menuSections.removeClass('active');
44147					$sectionSelectionItem.find('.active').removeClass('active');
44148					$('#navigation').removeClass('active');
44149					document.documentElement.style.overflow = 'initial';
44150				}
44151			} else {
44152				var searchParemeters = search.createUrl(currentFilters);
44153				var resultsUrl = userFilters == 'car' ? '/fi/autot/autohaku/?' : '/fi/renkaat/rengashaku/?';
44154				window.location = resultsUrl + searchParemeters;
44155			}
44156		});
44157
44158		$('.search-tyres').click(function (e) {
44159			e.preventDefault();
44160
44161			if (searchPage == userFilters) {
44162				search.reset('search');
44163			} else {
44164				var searchParemeters = search.createUrl(currentFilters);
44165				var resultsUrl = userFilters == 'car' ? '/fi/autot/autohaku/?' : '/fi/renkaat/rengashaku/?';
44166				window.location = resultsUrl + searchParemeters;
44167			}
44168		});
44169
44170		$('.addFilters').click(function (e) {
44171			navigation.toggle('#navigation', $('li.navigation a'));
44172		});
44173
44174		$('.section-title .close').click(function (e) {
44175			e.preventDefault();
44176			navigation.toggle('#navigation', $(this));
44177		});
44178
44179		$('.volvo-selekt input').change(function () {
44180			if ($('.volvo-selekt input:checked').length > 0) {
44181				search.checkbox($(this).attr('name'), $(this).val());
44182			} else {
44183				search.removeFilter(1, 'volvoselekt', 1);
44184			}
44185		});
44186
44187		$('.autosalpa-contract input').change(function () {
44188			if ($('.autosalpa-contract input:checked').length > 0) {
44189				search.checkbox($(this).attr('name'), $(this).val());
44190			} else {
44191				search.removeFilter(1, 'autosalpa_contract', 1);
44192			}
44193		});
44194
44195		$('.autosalpa-warranty input').change(function () {
44196			if ($('.autosalpa-warranty input:checked').length > 0) {
44197				search.checkbox($(this).attr('name'), $(this).val());
44198			} else {
44199				search.removeFilter(1, 'autosalpa_warranty', 1);
44200			}
44201		});
44202	};
44203
44204	return module;
44205}();
44206
44207}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
44208
44209},{"babel-runtime/helpers/typeof":15,"mustache":125}],141:[function(require,module,exports){
44210'use strict';
44211
44212var _jquery = require('jquery');
44213
44214var _jquery2 = _interopRequireDefault(_jquery);
44215
44216function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44217
44218window.$ = _jquery2.default;
44219
44220(0, _jquery2.default)('.dropdown-menu').hide();
44221
44222(0, _jquery2.default)('body').on('click touchstart', '.dropdown', function (event) {
44223  if (event.handled === false) return;
44224  event.stopPropagation();
44225  event.preventDefault();
44226  event.handled = true;
44227  (0, _jquery2.default)(this).attr('tabindex', 1).focus();
44228  (0, _jquery2.default)(this).toggleClass('active');
44229  (0, _jquery2.default)(this).find('.dropdown-menu').slideToggle(300);
44230});
44231(0, _jquery2.default)('.dropdown').focusout(function () {
44232  (0, _jquery2.default)(this).removeClass('active');
44233  (0, _jquery2.default)(this).find('.dropdown-menu').slideUp(300);
44234});
44235(0, _jquery2.default)('.dropdown .dropdown-menu li').click(function () {
44236  (0, _jquery2.default)(this).parents('.dropdown').find('.select span').first().text((0, _jquery2.default)(this).text());
44237  (0, _jquery2.default)(this).parents('.dropdown').find('input').attr('value', (0, _jquery2.default)(this).attr('id'));
44238});
44239
44240},{"jquery":124}],142:[function(require,module,exports){
44241'use strict';
44242
44243var _regenerator = require('babel-runtime/regenerator');
44244
44245var _regenerator2 = _interopRequireDefault(_regenerator);
44246
44247var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
44248
44249var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
44250
44251var _fundingCalculatorUi = require('../funding-calculator-ui');
44252
44253var _fundingCalculatorUi2 = _interopRequireDefault(_fundingCalculatorUi);
44254
44255var _jquery = require('jquery');
44256
44257var _jquery2 = _interopRequireDefault(_jquery);
44258
44259var _sopimusSearchSlider = require('./sopimus-search-slider');
44260
44261var _sopimusSearchSlider2 = _interopRequireDefault(_sopimusSearchSlider);
44262
44263var _sopimusSearchDropdownlist = require('./sopimus-search-dropdownlist');
44264
44265var _sopimusSearchDropdownlist2 = _interopRequireDefault(_sopimusSearchDropdownlist);
44266
44267require('./dropdownlist');
44268
44269var _modal = require('./modal');
44270
44271var _modal2 = _interopRequireDefault(_modal);
44272
44273function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44274
44275var sopimusDiv = document.querySelector('.sopimus');
44276
44277(0, _jquery2.default)(document).ready((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
44278  var modal, slider, dropdownlist, search, slug, lease, mileage, deposit;
44279  return _regenerator2.default.wrap(function _callee$(_context) {
44280    while (1) {
44281      switch (_context.prev = _context.next) {
44282        case 0:
44283          if (sopimusDiv) {
44284            // Modal trigger
44285            modal = document.getElementById('modal');
44286            slider = document.querySelectorAll('.search-slider');
44287            dropdownlist = document.querySelectorAll('.dropdown');
44288
44289            if (modal) {
44290              console.log('Huuray Autosalpasopimus');
44291              //Init funding calculators
44292              (0, _jquery2.default)('.funding-calculator-container').each(function (i, item) {
44293                var fcu = new _fundingCalculatorUi2.default();
44294                fcu.init(item);
44295              });
44296              window.searchOptions = {
44297                min: false,
44298                max: false,
44299                mileage: false,
44300                months: false,
44301                make: false
44302              };
44303              if (slider.length > 0) {
44304                _sopimusSearchSlider2.default.init();
44305              }
44306              if (dropdownlist.length > 0) {
44307                _sopimusSearchDropdownlist2.default.init();
44308              }
44309            }
44310          }
44311          if (document.getElementById('modal')) (0, _modal2.default)();
44312          search = window.location.search;
44313          slug = {};
44314
44315          if (search) search.substring(1).split('&').forEach(function (pair) {
44316            var pairValue = pair.split('=');
44317            slug[pairValue[0]] = pairValue[1];
44318          });
44319          if (search) console.log(slug);
44320          lease = document.querySelector('input[name=\'{{activeMonthlyCategory}}\'][value=\'' + slug.leasingOptions + '\']');
44321
44322          if (lease) lease.click();
44323
44324          mileage = document.querySelector('input[name=\'{{activeMileageOptions}}\'][value=\'' + slug.mileageOptions + '\']');
44325
44326          if (mileage) mileage.click();
44327
44328          if (slug.deposit) {
44329            deposit = document.querySelector('.sopimus-deposit');
44330
44331            deposit.value = slug.deposit;
44332          }
44333          (0, _jquery2.default)('.nav-burger').click(function () {
44334            (0, _jquery2.default)(this).toggleClass('open');
44335            (0, _jquery2.default)('.nav-items').toggleClass('open');
44336          });
44337
44338        case 12:
44339        case 'end':
44340          return _context.stop();
44341      }
44342    }
44343  }, _callee, undefined);
44344})));
44345
44346},{"../funding-calculator-ui":132,"./dropdownlist":141,"./modal":143,"./sopimus-search-dropdownlist":145,"./sopimus-search-slider":146,"babel-runtime/helpers/asyncToGenerator":12,"babel-runtime/regenerator":16,"jquery":124}],143:[function(require,module,exports){
44347(function (global){
44348'use strict';
44349
44350exports.__esModule = true;
44351
44352var _values = require('babel-runtime/core-js/object/values');
44353
44354var _values2 = _interopRequireDefault(_values);
44355
44356var _stringify = require('babel-runtime/core-js/json/stringify');
44357
44358var _stringify2 = _interopRequireDefault(_stringify);
44359
44360var _extends2 = require('babel-runtime/helpers/extends');
44361
44362var _extends3 = _interopRequireDefault(_extends2);
44363
44364exports.default = function () {
44365  var sopimusDiv = document.querySelector('.sopimus');
44366  var modalWrapper = document.querySelector('.modal-wrapper');
44367  var sopimusCarButtons = document.querySelectorAll('.sopimus-car-button');
44368  var modal = document.getElementById('modal');
44369  var mainCampaignPage = document.querySelector('main.campaign-page.submodules');
44370  var currentTopPosition = void 0;
44371  if (modalWrapper) {
44372    // fix body scroll
44373    window.addEventListener('scroll', function (event) {
44374      global.topPosition = this.scrollY;
44375    }, false);
44376
44377    if (sopimusDiv) {
44378      if (modal) {
44379        addEventListenerInput();
44380        // fcc = fundingCalculatorContainter
44381        var fcc = document.querySelector('.funding-calculator-container');
44382
44383        sopimusCarButtons.forEach(function (button) {
44384          return button.addEventListener('click', function (event) {
44385            // Show modal when clicking button
44386            modalWrapper.classList.remove('hide');
44387            fixMainPosition();
44388
44389            // Passing data of selected car into modal
44390            var data = (0, _extends3.default)({}, event.target.previousElementSibling.dataset);
44391
44392            var dataCar = data.car;
44393            var dataLeasing = data.leasing;
44394            var dataMileage = data.mileage;
44395            fcc.dataset.options = (0, _stringify2.default)((0, _extends3.default)({}, JSON.parse(fcc.dataset.options), JSON.parse(dataCar), {
44396              leasingOptions: JSON.parse(dataLeasing),
44397              mileageOptions: JSON.parse(dataMileage)
44398            }));
44399
44400            //Reset funding calculators
44401            (0, _jquery2.default)('.funding-calculator-container').each(function (i, item) {
44402              var fcu = new _fundingCalculatorUi2.default();
44403              fcu.init(item);
44404            });
44405
44406            var baseURL = window.location.pathname;
44407            var car_id = document.querySelector('input[name="carId"]').value;
44408            window.history.pushState('car modal', car_id, baseURL + '?car_id=' + car_id);
44409            addEventListenerInput();
44410            var contactButton = document.querySelector('.sopimus-monthly-button').children[0];
44411            contactButton.addEventListener('click', function () {
44412              return window.location.replace('https://www.autosalpa.fi/fi/yhteydenottopyynto/');
44413            });
44414          });
44415        });
44416
44417        // Close modal if clicking outside modal
44418        modalWrapper.addEventListener('click', function (event) {
44419          if (event.target === modalWrapper) closeModalAndResetUrl();
44420        });
44421
44422        // Close modal if clicking close button
44423        var closeModalButtons = document.querySelectorAll('.close-modal-button');
44424        closeModalButtons.forEach(function (closeModalButton) {
44425          return closeModalButton.addEventListener('click', function (event) {
44426            closeModalAndResetUrl();
44427          });
44428        });
44429      }
44430    }
44431    formSubmiting();
44432  }
44433  function fixMainPosition() {
44434    mainCampaignPage.style.top = -global.topPosition + 'px';
44435    mainCampaignPage.style.position = 'fixed';
44436    mainCampaignPage.style.zIndex = 1000;
44437    mainCampaignPage.style.width = '100%';
44438    currentTopPosition = global.topPosition;
44439  }
44440  function removeFixMainPosition() {
44441    window.scrollTo(0, currentTopPosition);
44442    if (mainCampaignPage.style.position === 'fixed') {
44443      mainCampaignPage.style.position = '';
44444      mainCampaignPage.style.top = 0 + 'px';
44445      mainCampaignPage.style.zIndex = 1;
44446    }
44447  }
44448  function closeModalAndResetUrl() {
44449    var baseURL = window.location.pathname;
44450    if (window.location.search !== '') window.history.pushState('car modal', '', baseURL);
44451
44452    modalWrapper.classList.add('hide');
44453    removeFixMainPosition();
44454  }
44455  function addEventListenerInput() {
44456    var car_id = document.querySelector('input[name="carId"]').value;
44457    var baseURL = window.location.pathname;
44458    var depositInput = document.querySelector('.sopimus-deposit');
44459    var radioInputs = document.querySelectorAll('input[type="radio"]');
44460
44461    // Polyfill IE NodeList ForEach
44462    if (window.NodeList && !NodeList.prototype.forEach) {
44463      NodeList.prototype.forEach = Array.prototype.forEach;
44464    }
44465    // Radio input url modify
44466    radioInputs.forEach(function (radioInput) {
44467      radioInput.addEventListener('click', function () {
44468        return changeUrl();
44469      });
44470    });
44471    depositInput.addEventListener('change', function () {
44472      return changeUrl();
44473    });
44474    function changeUrl() {
44475      var leasingOptions = document.querySelector('input[name="{{activeMonthlyCategory}}"]:checked').value;
44476      var mileageOptions = document.querySelector('input[name="{{activeMileageOptions}}"]:checked').value;
44477      var deposit = document.querySelector('.sopimus-deposit').value;
44478      window.history.pushState('car modal', car_id, baseURL + '?car_id=' + car_id + '&leasingOptions=' + leasingOptions + '&mileageOptions=' + mileageOptions + '&deposit=' + deposit);
44479    }
44480    formSubmiting();
44481  }
44482  function formSubmiting() {
44483    var form = document.querySelector('form');
44484    var formData = (0, _values2.default)(form).reduce(function (obj, field) {
44485      obj[field.name] = field.value;
44486      return obj;
44487    }, {});
44488    (0, _jquery2.default)('form.sopimus-form').off().on('submit', function (event) {
44489      event.preventDefault();
44490
44491      var alertBox = '<div id="alert-box">\n            <div class="alert alert-success alert-dismissible fade show" role="alert">\n              <strong>S\xE4hk\xF6posti l\xE4hetetty!</strong>\n              <button type="button" class="close" data-dismiss="alert" aria-label="Close">\n                <span aria-hidden="true">x</span>\n              </button>\n            </div>\n          </div>';
44492      (0, _jquery2.default)('.sopimus').append(alertBox);
44493      _ajax2.default.ajaxRequest({
44494        target: 'sopimusSendEmail',
44495        method: 'POST',
44496        data: formData,
44497        callback: function callback(response) {
44498          if (response.status === 200) {
44499            (0, _jquery2.default)('#alert-box').fadeTo(4000, 0, function () {
44500              return (0, _jquery2.default)('#alert-box').remove();
44501            });
44502            (0, _jquery2.default)('.close').click(function () {
44503              return (0, _jquery2.default)('#alert-box').remove();
44504            });
44505            var baseURL = window.location.pathname;
44506            if (window.location.search !== '') window.history.pushState('car modal', '', baseURL);
44507            closeModalAndResetUrl();
44508          }
44509        }
44510      });
44511    });
44512  }
44513};
44514
44515var _fundingCalculatorUi = require('../funding-calculator-ui');
44516
44517var _fundingCalculatorUi2 = _interopRequireDefault(_fundingCalculatorUi);
44518
44519var _ajax = require('../libs/ajax');
44520
44521var _ajax2 = _interopRequireDefault(_ajax);
44522
44523var _jquery = require('jquery');
44524
44525var _jquery2 = _interopRequireDefault(_jquery);
44526
44527function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44528
44529}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
44530
44531},{"../funding-calculator-ui":132,"../libs/ajax":136,"babel-runtime/core-js/json/stringify":2,"babel-runtime/core-js/object/values":8,"babel-runtime/helpers/extends":14,"jquery":124}],144:[function(require,module,exports){
44532'use strict';
44533
44534exports.__esModule = true;
44535
44536var _stringify = require('babel-runtime/core-js/json/stringify');
44537
44538var _stringify2 = _interopRequireDefault(_stringify);
44539
44540var _extends2 = require('babel-runtime/helpers/extends');
44541
44542var _extends3 = _interopRequireDefault(_extends2);
44543
44544var _keys = require('babel-runtime/core-js/object/keys');
44545
44546var _keys2 = _interopRequireDefault(_keys);
44547
44548var _mustache = require('mustache');
44549
44550var _mustache2 = _interopRequireDefault(_mustache);
44551
44552var _ajax = require('../libs/ajax');
44553
44554var _ajax2 = _interopRequireDefault(_ajax);
44555
44556var _modal = require('./modal');
44557
44558var _modal2 = _interopRequireDefault(_modal);
44559
44560var _sopimusAjaxSearchCar = require('./sopimus-ajax-search-car');
44561
44562var _sopimusAjaxSearchCar2 = _interopRequireDefault(_sopimusAjaxSearchCar);
44563
44564function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44565
44566exports.default = function (searchOptions) {
44567  _ajax2.default.ajaxRequest({
44568    target: 'getCarsByOptions',
44569    method: 'POST',
44570    data: searchOptions,
44571    callback: function callback(response) {
44572      console.log('getCarsByOptions', response);
44573      console.log('getCarsByOptions[cars]', response['cars']);
44574      var sopimusCarsTemplate = document.getElementById('sopimusCarsResult').innerHTML;
44575      var resultCarsDiv = document.querySelector('.sopimus-result-cars').children[0];
44576      var ulPagination = document.getElementById('pagination');
44577
44578      resultCarsDiv.innerHTML = '';
44579      ulPagination.innerHTML = '';
44580      if ((0, _keys2.default)(response).length === 0) {
44581        resultCarsDiv.innerHTML = '<h3>Autoja ei löytynyt valitsemillasi ehdoilla</h3>';
44582      } else {
44583        (function () {
44584          for (var x = 1; x <= response.totalPages; x++) {
44585            ulPagination.innerHTML += '<li><a data-page-number="' + x + '" class="sopimus-pagination" href="?page=' + x + '">' + x + '</a></li>';
44586          }
44587          var sopimusPagination = document.getElementsByClassName('sopimus-pagination');
44588          if (sopimusPagination) {
44589            var _loop = function _loop(i) {
44590              sopimusPagination[i].addEventListener('click', function (element) {
44591                element.preventDefault();
44592                var pageNumber = sopimusPagination[i].dataset.pageNumber;
44593                window.searchOptions.page = pageNumber;
44594
44595                (0, _sopimusAjaxSearchCar2.default)(window.searchOptions);
44596              });
44597            };
44598
44599            for (var i = 0; i < sopimusPagination.length; i++) {
44600              _loop(i);
44601            }
44602          }
44603          response['cars'].forEach(function (car) {
44604            var leasing = response.leasing;
44605            var leasingOptions = {};
44606            var mileageOptions = [];
44607            leasing.forEach(function (option) {
44608              if (car.car_id === option.car_id) {
44609                if (!leasingOptions[option.leasing_period]) {
44610                  leasingOptions[option.leasing_period] = [{
44611                    mileage: option.mileage,
44612                    residual_value: option.residual_value,
44613                    tyres_price: option.tyres_price
44614                  }];
44615                } else {
44616                  leasingOptions[option.leasing_period].push({
44617                    mileage: option.mileage,
44618                    residual_value: option.residual_value,
44619                    tyres_price: option.tyres_price
44620                  });
44621                }
44622
44623                if (mileageOptions.indexOf(option.mileage) < 0) {
44624                  mileageOptions.push(option.mileage);
44625                }
44626              }
44627            });
44628
44629            // Let first value is minMonthlyTranche then compare with another
44630            var minMonthlyTranche = leasing[0].calculated_monthly_price;
44631            leasing.forEach(function (option) {
44632              if (car.car_id === option.car_id) option.calculated_monthly_price > minMonthlyTranche ? '' : minMonthlyTranche = option.calculated_monthly_price;
44633            });
44634            var renderData = (0, _extends3.default)({}, car, {
44635              car: (0, _stringify2.default)(car),
44636              leasingOptions: (0, _stringify2.default)(leasingOptions),
44637              mileageOptions: (0, _stringify2.default)(mileageOptions),
44638              image: car.image,
44639              minMonthlyTranche: minMonthlyTranche
44640            });
44641            resultCarsDiv.innerHTML += _mustache2.default.render(sopimusCarsTemplate, renderData);
44642            (0, _modal2.default)();
44643          });
44644        })();
44645      }
44646    }
44647  });
44648};
44649
44650},{"../libs/ajax":136,"./modal":143,"./sopimus-ajax-search-car":144,"babel-runtime/core-js/json/stringify":2,"babel-runtime/core-js/object/keys":7,"babel-runtime/helpers/extends":14,"mustache":125}],145:[function(require,module,exports){
44651'use strict';
44652
44653var _jquery = require('jquery');
44654
44655var _jquery2 = _interopRequireDefault(_jquery);
44656
44657var _sopimusAjaxSearchCar = require('./sopimus-ajax-search-car');
44658
44659var _sopimusAjaxSearchCar2 = _interopRequireDefault(_sopimusAjaxSearchCar);
44660
44661function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44662
44663var searchDropDownList = {
44664  init: function init() {
44665    (0, _jquery2.default)('body').on('click', '.dropdown', function (event) {
44666      var _this = this;
44667
44668      (0, _jquery2.default)(this).find('li').click(function () {
44669        var value = (0, _jquery2.default)(_this).find('input').attr('value');
44670        var id = (0, _jquery2.default)(_this).find('input').attr('id');
44671        if (window.searchOptions[id] !== value) {
44672          if (value.indexOf('null') !== -1) {
44673            (0, _jquery2.default)(_this).find('input').attr('value', false);
44674            window.searchOptions[id] = false;
44675            (0, _sopimusAjaxSearchCar2.default)(window.searchOptions);
44676          } else {
44677            window.searchOptions[id] = value;
44678            (0, _sopimusAjaxSearchCar2.default)(window.searchOptions);
44679          }
44680        }
44681      });
44682    });
44683  }
44684};
44685module.exports = searchDropDownList;
44686
44687},{"./sopimus-ajax-search-car":144,"jquery":124}],146:[function(require,module,exports){
44688'use strict';
44689
44690var _extends2 = require('babel-runtime/helpers/extends');
44691
44692var _extends3 = _interopRequireDefault(_extends2);
44693
44694var _jquery = require('jquery');
44695
44696var _jquery2 = _interopRequireDefault(_jquery);
44697
44698var _sopimusAjaxSearchCar = require('./sopimus-ajax-search-car');
44699
44700var _sopimusAjaxSearchCar2 = _interopRequireDefault(_sopimusAjaxSearchCar);
44701
44702var _bootstrapSlider = require('bootstrap-slider');
44703
44704var _bootstrapSlider2 = _interopRequireDefault(_bootstrapSlider);
44705
44706var _ajax = require('../libs/ajax');
44707
44708var _ajax2 = _interopRequireDefault(_ajax);
44709
44710function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44711
44712var searchSlider = {
44713  init: function init() {
44714    _ajax2.default.ajaxRequest({
44715      target: 'getPriceRange',
44716      callback: function callback(data) {
44717        var originalVal = void 0;
44718        (0, _jquery2.default)('#price-range').slider({
44719          min: data.min,
44720          max: data.max,
44721          tooltip_split: true,
44722          tooltip_position: 'bottom',
44723          value: [data.min, data.max]
44724        });
44725        (0, _jquery2.default)('.tooltip-main').hide();
44726        window.searchOptions.min = data.min;
44727        window.searchOptions.max = data.max;
44728        console.log('window.searchOptions ', window.searchOptions);
44729
44730        (0, _sopimusAjaxSearchCar2.default)(window.searchOptions);
44731
44732        (0, _jquery2.default)('#price-range').slider().on('slideStart', function (ev) {
44733          originalVal = (0, _jquery2.default)('#price-range').data('slider').getValue();
44734        });
44735        var searchOptions = {};
44736        (0, _jquery2.default)('#price-range').slider().on('slideStop', function (ev) {
44737          var newVal = (0, _jquery2.default)('#price-range').data('slider').getValue();
44738          // If change value
44739          if (originalVal != newVal) {
44740            searchOptions.min = (0, _jquery2.default)('#price-range').val().split(',')[0];
44741            searchOptions.max = (0, _jquery2.default)('#price-range').val().split(',')[1];
44742            window.searchOptions = (0, _extends3.default)({}, window.searchOptions, searchOptions);
44743            (0, _sopimusAjaxSearchCar2.default)(window.searchOptions);
44744          }
44745        });
44746      }
44747    });
44748  }
44749};
44750module.exports = searchSlider;
44751
44752},{"../libs/ajax":136,"./sopimus-ajax-search-car":144,"babel-runtime/helpers/extends":14,"bootstrap-slider":17,"jquery":124}],147:[function(require,module,exports){
44753"use strict";
44754
44755var _stringify = require("babel-runtime/core-js/json/stringify");
44756
44757var _stringify2 = _interopRequireDefault(_stringify);
44758
44759var _typeof2 = require("babel-runtime/helpers/typeof");
44760
44761var _typeof3 = _interopRequireDefault(_typeof2);
44762
44763function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44764
44765/*! jquery.cookie v1.4.1 | MIT */
44766!function (a) {
44767  "function" == typeof define && define.amd ? define(["jquery"], a) : "object" == (typeof exports === "undefined" ? "undefined" : (0, _typeof3.default)(exports)) ? a(require("jquery")) : a(jQuery);
44768}(function (a) {
44769  function b(a) {
44770    return h.raw ? a : encodeURIComponent(a);
44771  }function c(a) {
44772    return h.raw ? a : decodeURIComponent(a);
44773  }function d(a) {
44774    return b(h.json ? (0, _stringify2.default)(a) : String(a));
44775  }function e(a) {
44776    0 === a.indexOf('"') && (a = a.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\"));try {
44777      return a = decodeURIComponent(a.replace(g, " ")), h.json ? JSON.parse(a) : a;
44778    } catch (b) {}
44779  }function f(b, c) {
44780    var d = h.raw ? b : e(b);return a.isFunction(c) ? c(d) : d;
44781  }var g = /\+/g,
44782      h = a.cookie = function (e, g, i) {
44783    if (void 0 !== g && !a.isFunction(g)) {
44784      if (i = a.extend({}, h.defaults, i), "number" == typeof i.expires) {
44785        var j = i.expires,
44786            k = i.expires = new Date();k.setTime(+k + 864e5 * j);
44787      }return document.cookie = [b(e), "=", d(g), i.expires ? "; expires=" + i.expires.toUTCString() : "", i.path ? "; path=" + i.path : "", i.domain ? "; domain=" + i.domain : "", i.secure ? "; secure" : ""].join("");
44788    }for (var l = e ? void 0 : {}, m = document.cookie ? document.cookie.split("; ") : [], n = 0, o = m.length; o > n; n++) {
44789      var p = m[n].split("="),
44790          q = c(p.shift()),
44791          r = p.join("=");if (e && e === q) {
44792        l = f(r, g);break;
44793      }e || void 0 === (r = f(r)) || (l[q] = r);
44794    }return l;
44795  };h.defaults = {}, a.removeCookie = function (b, c) {
44796    return void 0 === a.cookie(b) ? !1 : (a.cookie(b, "", a.extend({}, c, { expires: -1 })), !a.cookie(b));
44797  };
44798});
44799
44800},{"babel-runtime/core-js/json/stringify":2,"babel-runtime/helpers/typeof":15,"jquery":124}]},{},[129])
44801
44802//# sourceMappingURL=autosalpa.js.map

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.