PageSourceSearch

https://www.univale.com/js/materialize.js

js univale.com collected 2026-10-03 02:41:00 UTC 377,232 bytes, 10,020 lines download raw bytes

vendor: 4,310 bytes, lines 1-129
1/*!
2 * Materialize v0.100.2 (http://materializecss.com)
3 * Copyright 2014-2017 Materialize
4 * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5 */
6var _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; }; }();
7
8function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
10// Check for jQuery.
11if (typeof jQuery === 'undefined') {
12  // Check if require is a defined function.
13  if (typeof require === 'function') {
14    jQuery = $ = require('jquery');
15    // Else use the dollar sign alias.
16  } else {
17    jQuery = $;
18  }
19}
20; /*
21  * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
22  * Open source under the BSD License.
23  * Copyright © 2008 George McGinley Smith
24  * All rights reserved.
25  * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
26  */
27
28(function (factory) {
29  if (typeof define === "function" && define.amd) {
30    define(['jquery'], function ($) {
31      return factory($);
32    });
33  } else if (typeof module === "object" && typeof module.exports === "object") {
34    exports = factory(require('jquery'));
35  } else {
36    factory(jQuery);
37  }
38})(function ($) {
39
40  // Preserve the original jQuery "swing" easing as "jswing"
41  $.easing['jswing'] = $.easing['swing'];
42
43  var pow = Math.pow,
44      sqrt = Math.sqrt,
45      sin = Math.sin,
46      cos = Math.cos,
47      PI = Math.PI,
48      c1 = 1.70158,
49      c2 = c1 * 1.525,
50      c3 = c1 + 1,
51      c4 = 2 * PI / 3,
52      c5 = 2 * PI / 4.5;
53
54  // x is the fraction of animation progress, in the range 0..1
55  function bounceOut(x) {
56    var n1 = 7.5625,
57        d1 = 2.75;
58    if (x < 1 / d1) {
59      return n1 * x * x;
60    } else if (x < 2 / d1) {
61      return n1 * (x -= 1.5 / d1) * x + .75;
62    } else if (x < 2.5 / d1) {
63      return n1 * (x -= 2.25 / d1) * x + .9375;
64    } else {
65      return n1 * (x -= 2.625 / d1) * x + .984375;
66    }
67  }
68
69  $.extend($.easing, {
70    def: 'easeOutQuad',
71    swing: function (x) {
72      return $.easing[$.easing.def](x);
73    },
74    easeInQuad: function (x) {
75      return x * x;
76    },
77    easeOutQuad: function (x) {
78      return 1 - (1 - x) * (1 - x);
79    },
80    easeInOutQuad: function (x) {
81      return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
82    },
83    easeInCubic: function (x) {
84      return x * x * x;
85    },
86    easeOutCubic: function (x) {
87      return 1 - pow(1 - x, 3);
88    },
89    easeInOutCubic: function (x) {
90      return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
91    },
92    easeInQuart: function (x) {
93      return x * x * x * x;
94    },
95    easeOutQuart: function (x) {
96      return 1 - pow(1 - x, 4);
97    },
98    easeInOutQuart: function (x) {
99      return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
100    },
101    easeInQuint: function (x) {
102      return x * x * x * x * x;
103    },
104    easeOutQuint: function (x) {
105      return 1 - pow(1 - x, 5);
106    },
107    easeInOutQuint: function (x) {
108      return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
109    },
110    easeInSine: function (x) {
111      return 1 - cos(x * PI / 2);
112    },
113    easeOutSine: function (x) {
114      return sin(x * PI / 2);
115    },
116    easeInOutSine: function (x) {
117      return -(cos(PI * x) - 1) / 2;
118    },
119    easeInExpo: function (x) {
120      return x === 0 ? 0 : pow(2, 10 * x - 10);
121    },
122    easeOutExpo: function (x) {
123      return x === 1 ? 1 : 1 - pow(2, -10 * x);
124    },
125    easeInOutExpo: function (x) {
126      return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
127    },
128    easeInCirc: function (x) {
129      return 1 - sqrt(1 - pow(x, 2));
130    },
131    easeOutCirc: function (x) {
132      return sqrt(1 - pow(x - 1, 2));
133    },
134    easeInOutCirc: function (x) {
135      return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
136    },
137    easeInElastic: function (x) {
138      return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
139    },
140    easeOutElastic: function (x) {
141      return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
142    },
143    easeInOutElastic: function (x) {
144      return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;
145    },
146    easeInBack: function (x) {
147      return c3 * x * x * x - c1 * x * x;
148    },
149    easeOutBack: function (x) {
150      return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
151    },
152    easeInOutBack: function (x) {
153      return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
154    },
155    easeInBounce: function (x) {
156      return 1 - bounceOut(1 - x);
157    },
158    easeOutBounce: bounceOut,
159    easeInOutBounce: function (x) {
160      return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
161    }
162  });
163});; // Custom Easing
164jQuery.extend(jQuery.easing, {
165  easeInOutMaterial: function (x, t, b, c, d) {
166    if ((t /= d / 2) < 1) return c / 2 * t * t + b;
167    return c / 4 * ((t -= 2) * t * t + 2) + b;
168  }
169});; /*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
170/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
171/*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
172jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
173  function t(e) {
174    var t = e.length,
175        a = r.type(e);return "function" === a || r.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === a || 0 === t || "number" == typeof t && t > 0 && t - 1 in e;
176  }if (!e.jQuery) {
177    var r = function (e, t) {
178      return new r.fn.init(e, t);
179    };r.isWindow = function (e) {
180      return null != e && e == e.window;
181    }, r.type = function (e) {
182      return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e;
183    }, r.isArray = Array.isArray || function (e) {
184      return "array" === r.type(e);
185    }, r.isPlainObject = function (e) {
186      var t;if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e)) return !1;try {
187        if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf")) return !1;
188      } catch (a) {
189        return !1;
190      }for (t in e) {}return void 0 === t || o.call(e, t);
191    }, r.each = function (e, r, a) {
192      var n,
193          o = 0,
194          i = e.length,
195          s = t(e);if (a) {
196        if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) {} else for (o in e) {
197          if (n = r.apply(e[o], a), n === !1) break;
198        }
199      } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) {} else for (o in e) {
200        if (n = r.call(e[o], o, e[o]), n === !1) break;
201      }return e;
202    }, r.data = function (e, t, n) {
203      if (void 0 === n) {
204        var o = e[r.expando],
205            i = o && a[o];if (void 0 === t) return i;if (i && t in i) return i[t];
206      } else if (void 0 !== t) {
207        var o = e[r.expando] || (e[r.expando] = ++r.uuid);return a[o] = a[o] || {}, a[o][t] = n, n;
208      }
209    }, r.removeData = function (e, t) {
210      var n = e[r.expando],
211          o = n && a[n];o && r.each(t, function (e, t) {
212        delete o[t];
213      });
214    }, r.extend = function () {
215      var e,
216          t,
217          a,
218          n,
219          o,
220          i,
221          s = arguments[0] || {},
222          l = 1,
223          u = arguments.length,
224          c = !1;for ("boolean" == typeof s && (c = s, s = arguments[l] || {}, l++), "object" != typeof s && "function" !== r.type(s) && (s = {}), l === u && (s = this, l--); u > l; l++) {
225        if (null != (o = arguments[l])) for (n in o) {
226          e = s[n], a = o[n], s !== a && (c && a && (r.isPlainObject(a) || (t = r.isArray(a))) ? (t ? (t = !1, i = e && r.isArray(e) ? e : []) : i = e && r.isPlainObject(e) ? e : {}, s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a));
227        }
228      }return s;
229    }, r.queue = function (e, a, n) {
230      function o(e, r) {
231        var a = r || [];return null != e && (t(Object(e)) ? !function (e, t) {
232          for (var r = +t.length, a = 0, n = e.length; r > a;) {
233            e[n++] = t[a++];
234          }if (r !== r) for (; void 0 !== t[a];) {
235            e[n++] = t[a++];
236          }return e.length = n, e;
237        }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a;
238      }if (e) {
239        a = (a || "fx") + "queue";var i = r.data(e, a);return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || [];
240      }
241    }, r.dequeue = function (e, t) {
242      r.each(e.nodeType ? [e] : e, function (e, a) {
243        t = t || "fx";var n = r.queue(a, t),
244            o = n.shift();"inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () {
245          r.dequeue(a, t);
246        }));
247      });
248    }, r.fn = r.prototype = { init: function (e) {
249        if (e.nodeType) return this[0] = e, this;throw new Error("Not a DOM node.");
250      }, offset: function () {
251        var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 };return { top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) };
252      }, position: function () {
253        function e() {
254          for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
255            e = e.offsetParent;
256          }return e || document;
257        }var t = this[0],
258            e = e.apply(t),
259            a = this.offset(),
260            n = /^(?:body|html)$/i.test(e.nodeName) ? { top: 0, left: 0 } : r(e).offset();return a.top -= parseFloat(t.style.marginTop) || 0, a.left -= parseFloat(t.style.marginLeft) || 0, e.style && (n.top += parseFloat(e.style.borderTopWidth) || 0, n.left += parseFloat(e.style.borderLeftWidth) || 0), { top: a.top - n.top, left: a.left - n.left };
261      } };var a = {};r.expando = "velocity" + new Date().getTime(), r.uuid = 0;for (var n = {}, o = n.hasOwnProperty, i = n.toString, s = "Boolean Number String Function Array Date RegExp Object Error".split(" "), l = 0; l < s.length; l++) {
262      n["[object " + s[l] + "]"] = s[l].toLowerCase();
263    }r.fn.init.prototype = r.fn, e.Velocity = { Utilities: r };
264  }
265}(window), function (e) {
266  "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
267}(function () {
268  return function (e, t, r, a) {
269    function n(e) {
270      for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
271        var n = e[t];n && a.push(n);
272      }return a;
273    }function o(e) {
274      return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]), e;
275    }function i(e) {
276      var t = f.data(e, "velocity");return null === t ? a : t;
277    }function s(e) {
278      return function (t) {
279        return Math.round(t * e) * (1 / e);
280      };
281    }function l(e, r, a, n) {
282      function o(e, t) {
283        return 1 - 3 * t + 3 * e;
284      }function i(e, t) {
285        return 3 * t - 6 * e;
286      }function s(e) {
287        return 3 * e;
288      }function l(e, t, r) {
289        return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
290      }function u(e, t, r) {
291        return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
292      }function c(t, r) {
293        for (var n = 0; m > n; ++n) {
294          var o = u(r, e, a);if (0 === o) return r;var i = l(r, e, a) - t;r -= i / o;
295        }return r;
296      }function p() {
297        for (var t = 0; b > t; ++t) {
298          w[t] = l(t * x, e, a);
299        }
300      }function f(t, r, n) {
301        var o,
302            i,
303            s = 0;do {
304          i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i;
305        } while (Math.abs(o) >
vendor: 9,813 bytes, lines 305-440
305 h && ++s < v);return i;
306      }function d(t) {
307        for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
308          r += x;
309        }--n;var i = (t - w[n]) / (w[n + 1] - w[n]),
310            s = r + i * x,
311            l = u(s, e, a);return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
312      }function g() {
313        V = !0, (e != r || a != n) && p();
314      }var m = 4,
315          y = .001,
316          h = 1e-7,
317          v = 10,
318          b = 11,
319          x = 1 / (b - 1),
320          S = "Float32Array" in t;if (4 !== arguments.length) return !1;for (var P = 0; 4 > P; ++P) {
321        if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P])) return !1;
322      }e = Math.min(e, 1), a = Math.min(a, 1), e = Math.max(e, 0), a = Math.max(a, 0);var w = S ? new Float32Array(b) : new Array(b),
323          V = !1,
324          C = function (t) {
325        return V || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
326      };C.getControlPoints = function () {
327        return [{ x: e, y: r }, { x: a, y: n }];
328      };var T = "generateBezier(" + [e, r, a, n] + ")";return C.toString = function () {
329        return T;
330      }, C;
331    }function u(e, t) {
332      var r = e;return m.isString(e) ? b.Easings[e] || (r = !1) : r = m.isArray(e) && 1 === e.length ? s.apply(null, e) : m.isArray(e) && 2 === e.length ? x.apply(null, e.concat([t])) : m.isArray(e) && 4 === e.length ? l.apply(null, e) : !1, r === !1 && (r = b.Easings[b.defaults.easing] ? b.defaults.easing : v), r;
333    }function c(e) {
334      if (e) {
335        var t = new Date().getTime(),
336            r = b.State.calls.length;r > 1e4 && (b.State.calls = n(b.State.calls));for (var o = 0; r > o; o++) {
337          if (b.State.calls[o]) {
338            var s = b.State.calls[o],
339                l = s[0],
340                u = s[2],
341                d = s[3],
342                g = !!d,
343                y = null;d || (d = b.State.calls[o][3] = t - 16);for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
344              var P = l[v],
345                  V = P.element;if (i(V)) {
346                var C = !1;if (u.display !== a && null !== u.display && "none" !== u.display) {
347                  if ("flex" === u.display) {
348                    var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];f.each(T, function (e, t) {
349                      S.setPropertyValue(V, "display", t);
350                    });
351                  }S.setPropertyValue(V, "display", u.display);
352                }u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility);for (var k in P) {
353                  if ("element" !== k) {
354                    var A,
355                        F = P[k],
356                        j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing;if (1 === h) A = F.endValue;else {
357                      var E = F.endValue - F.startValue;if (A = F.startValue + E * j(h, u, E), !g && A === F.currentValue) continue;
358                    }if (F.currentValue = A, "tween" === k) y = A;else {
359                      if (S.Hooks.registered[k]) {
360                        var H = S.Hooks.getRoot(k),
361                            N = i(V).rootPropertyValueCache[H];N && (F.rootPropertyValue = N);
362                      }var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData);S.Hooks.registered[k] && (i(V).rootPropertyValueCache[H] = S.Normalizations.registered[H] ? S.Normalizations.registered[H]("extract", null, L[1]) : L[1]), "transform" === L[0] && (C = !0);
363                    }
364                  }
365                }u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && S.flushTransformCache(V);
366              }
367            }u.display !== a && "none" !== u.display && (b.State.calls[o][2].display = !1), u.visibility !== a && "hidden" !== u.visibility && (b.State.calls[o][2].visibility = !1), u.progress && u.progress.call(s[1], s[1], h, Math.max(0, d + u.duration - t), d, y), 1 === h && p(o);
368          }
369        }
370      }b.State.isTicking && w(c);
371    }function p(e, t) {
372      if (!b.State.calls[e]) return !1;for (var r = b.State.calls[e][0], n = b.State.calls[e][1], o = b.State.calls[e][2], s = b.State.calls[e][4], l = !1, u = 0, c = r.length; c > u; u++) {
373        var p = r[u].element;if (t || o.loop || ("none" === o.display && S.setPropertyValue(p, "display", o.display), "hidden" === o.visibility && S.setPropertyValue(p, "visibility", o.visibility)), o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityQueueEntryFlag/i.test(f.queue(p)[1])) && i(p)) {
374          i(p).isAnimating = !1, i(p).rootPropertyValueCache = {};var d = !1;f.each(S.Lists.transforms3D, function (e, t) {
375            var r = /^scale/.test(t) ? 1 : 0,
376                n = i(p).transformCache[t];i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformCache[t]);
377          }), o.mobileHA && (d = !0, delete i(p).transformCache.translate3d), d && S.flushTransformCache(p), S.Values.removeClass(p, "velocity-animating");
378        }if (!t && o.complete && !o.loop && u === c - 1) try {
379          o.complete.call(n, n);
380        } catch (g) {
381          setTimeout(function () {
382            throw g;
383          }, 1);
384        }s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
385          /^rotate/.test(e) && 360 === parseFloat(t.endValue) && (t.endValue = 0, t.startValue = 360), /^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0, t.startValue = 100);
386        }), b(p, "reverse", { loop: !0, delay: o.delay })), o.queue !== !1 && f.dequeue(p, o.queue);
387      }b.State.calls[e] = !1;for (var m = 0, y = b.State.calls.length; y > m; m++) {
388        if (b.State.calls[m] !== !1) {
389          l = !0;break;
390        }
391      }l === !1 && (b.State.isTicking = !1, delete b.State.calls, b.State.calls = []);
392    }var f,
393        d = function () {
394      if (r.documentMode) return r.documentMode;for (var e = 7; e > 4; e--) {
395        var t = r.createElement("div");if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e;
396      }return a;
397    }(),
398        g = function () {
399      var e = 0;return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
400        var r,
401            a = new Date().getTime();return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function () {
402          t(a + r);
403        }, r);
404      };
405    }(),
406        m = { isString: function (e) {
407        return "string" == typeof e;
408      }, isArray: Array.isArray || function (e) {
409        return "[object Array]" === Object.prototype.toString.call(e);
410      }, isFunction: function (e) {
411        return "[object Function]" === Object.prototype.toString.call(e);
412      }, isNode: function (e) {
413        return e && e.nodeType;
414      }, isNodeList: function (e) {
415        return "object" == typeof e && /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e)) && e.length !== a && (0 === e.length || "object" == typeof e[0] && e[0].nodeType > 0);
416      }, isWrapped: function (e) {
417        return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
418      }, isSVG: function (e) {
419        return t.SVGElement && e instanceof t.SVGElement;
420      }, isEmptyObject: function (e) {
421        for (var t in e) {
422          return !1;
423        }return !0;
424      } },
425        y = !1;if (e.fn && e.fn.jquery ? (f = e, y = !0) : f = t.Velocity.Utilities, 8 >= d && !y) throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if (7 >= d) return void (jQuery.fn.velocity = jQuery.fn.animate);var h = 400,
426        v = "swing",
427        b = { State: { isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isAndroid: /Android/i.test(navigator.userAgent), isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), isChrome: t.chrome, isFirefox: /Firefox/i.test(navigator.userAgent), prefixElement: r.createElement("div"), prefixMatches: {}, scrollAnchor: null, scrollPropertyLeft: null, scrollPropertyTop: null, isTicking: !1, calls: [] }, CSS: {}, Utilities: f, Redirects: {}, Easings: {}, Promise: t.Promise, defaults: { queue: "", duration: h, easing: v, begin: a, complete: a, progress: a, display: a, visibility: a, loop: !1, delay: !1, mobileHA: !0, _cacheValues: !0 }, init: function (e) {
428        f.data(e, "velocity", { isSVG: m.isSVG(e), isAnimating: !1, computedStyle: null, tweensContainer: null, rootPropertyValueCache: {}, transformCache: {} });
429      }, hook: null, mock: !1, version: { major: 1, minor: 2, patch: 2 }, debug: !1 };t.pageYOffset !== a ? (b.State.scrollAnchor = t, b.State.scrollPropertyLeft = "pageXOffset", b.State.scrollPropertyTop = "pageYOffset") : (b.State.scrollAnchor = r.documentElement || r.body.parentNode || r.body, b.State.scrollPropertyLeft = "scrollLeft", b.State.scrollPropertyTop = "scrollTop");var x = function () {
430      function e(e) {
431        return -e.tension * e.x - e.friction * e.v;
432      }function t(t, r, a) {
433        var n = { x: t.x + a.dx * r, v: t.v + a.dv * r, tension: t.tension, friction: t.friction };return { dx: n.v, dv: e(n) };
434      }function r(r, a) {
435        var n = { dx: r.v, dv: e(r) },
436            o = t(r, .5 * a, n),
437            i = t(r, .5 * a, o),
438            s = t(r, a, i),
439            l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx),
440            u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);
440return r.x = r.x + l * a, r.v = r.v + u * a, r;
441      }return function a(e, t, n) {
442        var o,
443            i,
444            s,
445            l = { x: -1, v: 0, tension: null, friction: null },
446            u = [0],
447            c = 0,
448            p = 1e-4,
449            f = .016;for (e = parseFloat(e) || 500, t = parseFloat(t) || 20, n = n || null, l.tension = e, l.friction = t, o = null !== n, o ? (c = a(e, t), i = c / n * f) : i = f; s = r(s || l, i), u.push(1 + s.x), c += 16, Math.abs(s.x) > p && Math.abs(s.v) > p;) {}return o ? function (e) {
450          return u[e * (u.length - 1) | 0];
451        } : c;
452      };
453    }();b.Easings = { linear: function (e) {
454        return e;
455      }, swing: function (e) {
456        return .5 - Math.cos(e * Math.PI) / 2;
457      }, spring: function (e) {
458        return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
459      } }, f.each([["ease", [.25, .1, .25, 1]], ["ease-in", [.42, 0, 1, 1]], ["ease-out", [0, 0, .58, 1]], ["ease-in-out", [.42, 0, .58, 1]], ["easeInSine", [.47, 0, .745, .715]], ["easeOutSine", [.39, .575, .565, 1]], ["easeInOutSine", [.445, .05, .55, .95]], ["easeInQuad", [.55, .085, .68, .53]], ["easeOutQuad", [.25, .46, .45, .94]], ["easeInOutQuad", [.455, .03, .515, .955]], ["easeInCubic", [.55, .055, .675, .19]], ["easeOutCubic", [.215, .61, .355, 1]], ["easeInOutCubic", [.645, .045, .355, 1]], ["easeInQuart", [.895, .03, .685, .22]], ["easeOutQuart", [.165, .84, .44, 1]], ["easeInOutQuart", [.77, 0, .175, 1]], ["easeInQuint", [.755, .05, .855, .06]], ["easeOutQuint", [.23, 1, .32, 1]], ["easeInOutQuint", [.86, 0, .07, 1]], ["easeInExpo", [.95, .05, .795, .035]], ["easeOutExpo", [.19, 1, .22, 1]], ["easeInOutExpo", [1, 0, 0, 1]], ["easeInCirc", [.6, .04, .98, .335]], ["easeOutCirc", [.075, .82, .165, 1]], ["easeInOutCirc", [.785, .135, .15, .86]]], function (e, t) {
460      b.Easings[t[0]] = l.apply(null, t[1]);
461    });var S = b.CSS = { RegEx: { isHex: /^#([A-f\d]{3}){1,2}$/i, valueUnwrap: /^[A-z]+\((.*)\)$/i, wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi }, Lists: { colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"] }, Hooks: { templates: { textShadow: ["Color X Y Blur", "black 0px 0px 0px"], boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], clip: ["Top Right Bottom Left", "0px 0px 0px 0px"], backgroundPosition: ["X Y", "0% 0%"], transformOrigin: ["X Y Z", "50% 50% 0px"], perspectiveOrigin: ["X Y", "50% 50%"] }, registered: {}, register: function () {
462          for (var e = 0; e < S.Lists.colors.length; e++) {
463            var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1";S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
464          }var r, a, n;if (d) for (r in S.Hooks.templates) {
465            a = S.Hooks.templates[r], n = a[0].split(" ");var o = a[1].match(S.RegEx.valueSplit);"Color" === n[0] && (n.push(n.shift()), o.push(o.shift()), S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
466          }for (r in S.Hooks.templates) {
467            a = S.Hooks.templates[r], n = a[0].split(" ");for (var e in n) {
468              var i = r + n[e],
469                  s = e;S.Hooks.registered[i] = [r, s];
470            }
471          }
472        }, getRoot: function (e) {
473          var t = S.Hooks.registered[e];return t ? t[0] : e;
474        }, cleanRootPropertyValue: function (e, t) {
475          return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]), S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]), t;
476        }, extractValue: function (e, t) {
477          var r = S.Hooks.registered[e];if (r) {
478            var a = r[0],
479                n = r[1];return t = S.Hooks.cleanRootPropertyValue(a, t), t.toString().match(S.RegEx.valueSplit)[n];
480          }return t;
481        }, injectValue: function (e, t, r) {
482          var a = S.Hooks.registered[e];if (a) {
483            var n,
484                o,
485                i = a[0],
486                s = a[1];return r = S.Hooks.cleanRootPropertyValue(i, r), n = r.toString().match(S.RegEx.valueSplit), n[s] = t, o = n.join(" ");
487          }return r;
488        } }, Normalizations: { registered: { clip: function (e, t, r) {
vendor: 24,306 bytes, lines 489-751
489            switch (e) {case "name":
490                return "clip";case "extract":
491                var a;return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a;case "inject":
492                return "rect(" + r + ")";}
493          }, blur: function (e, t, r) {
494            switch (e) {case "name":
495                return b.State.isFirefox ? "filter" : "-webkit-filter";case "extract":
496                var a = parseFloat(r);if (!a && 0 !== a) {
497                  var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i);a = n ? n[1] : 0;
498                }return a;case "inject":
499                return parseFloat(r) ? "blur(" + r + ")" : "none";}
500          }, opacity: function (e, t, r) {
501            if (8 >= d) switch (e) {case "name":
502                return "filter";case "extract":
503                var a = r.toString().match(/alpha\(opacity=(.*)\)/i);return r = a ? a[1] / 100 : 1;case "inject":
504                return t.style.zoom = 1, parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";} else switch (e) {case "name":
505                return "opacity";case "extract":
506                return r;case "inject":
507                return r;}
508          } }, register: function () {
509          9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D));for (var e = 0; e < S.Lists.transformsBase.length; e++) {
510            !function () {
511              var t = S.Lists.transformsBase[e];S.Normalizations.registered[t] = function (e, r, n) {
512                switch (e) {case "name":
513                    return "transform";case "extract":
514                    return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, "");case "inject":
515                    var o = !1;switch (t.substr(0, t.length - 1)) {case "translate":
516                        o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);break;case "scal":case "scale":
517                        b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n);break;case "skew":
518                        o = !/(deg|\d)$/i.test(n);break;case "rotate":
519                        o = !/(deg|\d)$/i.test(n);}return o || (i(r).transformCache[t] = "(" + n + ")"), i(r).transformCache[t];}
520              };
521            }();
522          }for (var e = 0; e < S.Lists.colors.length; e++) {
523            !function () {
524              var t = S.Lists.colors[e];S.Normalizations.registered[t] = function (e, r, n) {
525                switch (e) {case "name":
526                    return t;case "extract":
527                    var o;if (S.RegEx.wrappedValueAlreadyExtracted.test(n)) o = n;else {
528                      var i,
529                          s = { black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", red: "rgb(255, 0, 0)", white: "rgb(255, 255, 255)" };/^[A-z]+$/i.test(n) ? i = s[n] !== a ? s[n] : s.black : S.RegEx.isHex.test(n) ? i = "rgb(" + S.Values.hexToRgb(n).join(" ") + ")" : /^rgba?\(/i.test(n) || (i = s.black), o = (i || n).toString().match(S.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ");
530                    }return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o;case "inject":
531                    return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"), (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";}
532              };
533            }();
534          }
535        } }, Names: { camelCase: function (e) {
536          return e.replace(/-(\w)/g, function (e, t) {
537            return t.toUpperCase();
538          });
539        }, SVGAttribute: function (e) {
540          var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e);
541        }, prefixCheck: function (e) {
542          if (b.State.prefixMatches[e]) return [b.State.prefixMatches[e], !0];for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
543            var n;if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
544              return e.toUpperCase();
545            }), m.isString(b.State.prefixElement.style[n])) return b.State.prefixMatches[e] = n, [n, !0];
546          }return [e, !1];
547        } }, Values: { hexToRgb: function (e) {
548          var t,
549              r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
550              a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return e = e.replace(r, function (e, t, r, a) {
551            return t + t + r + r + a + a;
552          }), t = a.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
553        }, isCSSNullValue: function (e) {
554          return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
555        }, getUnitType: function (e) {
556          return (/^(rotate|skew)/i.test(e) ? "deg" : /(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e) ? "" : "px"
557          );
558        }, getDisplayType: function (e) {
559          var t = e && e.tagName.toString().toLowerCase();return (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block"
560          );
561        }, addClass: function (e, t) {
562          e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
563        }, removeClass: function (e, t) {
564          e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
565        } }, getPropertyValue: function (e, r, n, o) {
566        function s(e, r) {
567          function n() {
568            u && S.setPropertyValue(e, "display", "none");
569          }var l = 0;if (8 >= d) l = f.css(e, r);else {
570            var u = !1;if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0, S.setPropertyValue(e, "display", S.Values.getDisplayType(e))), !o) {
571              if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
572                var c = e.offsetHeight - (parseFloat(S.getPropertyValue(e, "borderTopWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderBottomWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingTop")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingBottom")) || 0);return n(), c;
573              }if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
574                var p = e.offsetWidth - (parseFloat(S.getPropertyValue(e, "borderLeftWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderRightWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingLeft")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingRight")) || 0);return n(), p;
575              }
576            }var g;g = i(e) === a ? t.getComputedStyle(e, null) : i(e).computedStyle ? i(e).computedStyle : i(e).computedStyle = t.getComputedStyle(e, null), "borderColor" === r && (r = "borderTopColor"), l = 9 === d && "filter" === r ? g.getPropertyValue(r) : g[r], ("" === l || null === l) && (l = e.style[r]), n();
577          }if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
578            var m = s(e, "position");("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
579          }return l;
580        }var l;if (S.Hooks.registered[r]) {
581          var u = r,
582              c = S.Hooks.getRoot(u);n === a && (n = S.getPropertyValue(e, S.Names.prefixCheck(c)[0])), S.Normalizations.registered[c] && (n = S.Normalizations.registered[c]("extract", e, n)), l = S.Hooks.extractValue(u, n);
583        } else if (S.Normalizations.registered[r]) {
584          var p, g;p = S.Normalizations.registered[r]("name", e), "transform" !== p && (g = s(e, S.Names.prefixCheck(p)[0]), S.Values.isCSSNullValue(g) && S.Hooks.templates[r] && (g = S.Hooks.templates[r][1])), l = S.Normalizations.registered[r]("extract", e, g);
585        }if (!/^[\d-]/.test(l)) if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
586          if (/^(height|width)$/i.test(r)) try {
587            l = e.getBBox()[r];
588          } catch (m) {
589            l = 0;
590          } else l = e.getAttribute(r);
591        } else l = s(e, S.Names.prefixCheck(r)[0]);return S.Values.isCSSNullValue(l) && (l = 0), b.debug >= 2 && console.log("Get " + r + ": " + l), l;
592      }, setPropertyValue: function (e, r, a, n, o) {
593        var s = r;if ("scroll" === r) o.container ? o.container["scroll" + o.direction] = a : "Left" === o.direction ? t.scrollTo(a, o.alternateValue) : t.scrollTo(o.alternateValue, a);else if (S.Normalizations.registered[r] && "transform" === S.Normalizations.registered[r]("name", e)) S.Normalizations.registered[r]("inject", e, a), s = "transform", a = i(e).transformCache[r];else {
594          if (S.Hooks.registered[r]) {
595            var l = r,
596                u = S.Hooks.getRoot(r);n = n || S.getPropertyValue(e, u), a = S.Hooks.injectValue(l, a, n), r = u;
597          }if (S.Normalizations.registered[r] && (a = S.Normalizations.registered[r]("inject", e, a), r = S.Normalizations.registered[r]("name", e)), s = S.Names.prefixCheck(r)[0], 8 >= d) try {
598            e.style[s] = a;
599          } catch (c) {
600            b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
601          } else i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a;b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
602        }return [s, a];
603      }, flushTransformCache: function (e) {
604        function t(t) {
605          return parseFloat(S.getPropertyValue(e, t));
606        }var r = "";if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
607          var a = { translate: [t("translateX"), t("translateY")], skewX: [t("skewX")], skewY: [t("skewY")], scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")], rotate: [t("rotateZ"), 0, 0] };f.each(i(e).transformCache, function (e) {
608            /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), a[e] && (r += e + "(" + a[e].join(" ") + ") ", delete a[e]);
609          });
610        } else {
611          var n, o;f.each(i(e).transformCache, function (t) {
612            return n = i(e).transformCache[t], "transformPerspective" === t ? (o = n, !0) : (9 === d && "rotateZ" === t && (t = "rotate"), void (r += t + n + " "));
613          }), o && (r = "perspective" + o + " " + r);
614        }S.setPropertyValue(e, "transform", r);
615      } };S.Hooks.register(), S.Normalizations.register(), b.hook = function (e, t, r) {
616      var n = a;return e = o(e), f.each(e, function (e, o) {
617        if (i(o) === a && b.init(o), r === a) n === a && (n = b.CSS.getPropertyValue(o, t));else {
618          var s = b.CSS.setPropertyValue(o, t, r);"transform" === s[0] && b.CSS.flushTransformCache(o), n = s;
619        }
620      }), n;
621    };var P = function () {
622      function e() {
623        return s ? k.promise || null : l;
624      }function n() {
625        function e(e) {
626          function p(e, t) {
627            var r = a,
628                n = a,
629                i = a;return m.isArray(e) ? (r = e[0], !m.isArray(e[1]) && /^[\d-]/.test(e[1]) || m.isFunction(e[1]) || S.RegEx.isHex.test(e[1]) ? i = e[1] : (m.isString(e[1]) && !S.RegEx.isHex.test(e[1]) || m.isArray(e[1])) && (n = t ? e[1] : u(e[1], s.duration), e[2] !== a && (i = e[2]))) : r = e, t || (n = n || s.easing), m.isFunction(r) && (r = r.call(o, V, w)), m.isFunction(i) && (i = i.call(o, V, w)), [r || 0, n, i];
630          }function d(e, t) {
631            var r, a;return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
632              return r = e, "";
633            }), r || (r = S.Values.getUnitType(e)), [a, r];
634          }function h() {
635            var e = { myParent: o.parentNode || r.body, position: S.getPropertyValue(o, "position"), fontSize: S.getPropertyValue(o, "fontSize") },
636                a = e.position === L.lastPosition && e.myParent === L.lastParent,
637                n = e.fontSize === L.lastFontSize;L.lastParent = e.myParent, L.lastPosition = e.position, L.lastFontSize = e.fontSize;var s = 100,
638                l = {};if (n && a) l.emToPx = L.lastEmToPx, l.percentToPxWidth = L.lastPercentToPxWidth, l.percentToPxHeight = L.lastPercentToPxHeight;else {
639              var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div");b.init(u), e.myParent.appendChild(u), f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
640                b.CSS.setPropertyValue(u, t, "hidden");
641              }), b.CSS.setPropertyValue(u, "position", e.position), b.CSS.setPropertyValue(u, "fontSize", e.fontSize), b.CSS.setPropertyValue(u, "boxSizing", "content-box"), f.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (e, t) {
642                b.CSS.setPropertyValue(u, t, s + "%");
643              }), b.CSS.setPropertyValue(u, "paddingLeft", s + "em"), l.percentToPxWidth = L.lastPercentToPxWidth = (parseFloat(S.getPropertyValue(u, "width", null, !0)) || 1) / s, l.percentToPxHeight = L.lastPercentToPxHeight = (parseFloat(S.getPropertyValue(u, "height", null, !0)) || 1) / s, l.emToPx = L.lastEmToPx = (parseFloat(S.getPropertyValue(u, "paddingLeft")) || 1) / s, e.myParent.removeChild(u);
644            }return null === L.remToPx && (L.remToPx = parseFloat(S.getPropertyValue(r.body, "fontSize")) || 16), null === L.vwToPx && (L.vwToPx = parseFloat(t.innerWidth) / 100, L.vhToPx = parseFloat(t.innerHeight) / 100), l.remToPx = L.remToPx, l.vwToPx = L.vwToPx, l.vhToPx = L.vhToPx, b.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), o), l;
645          }if (s.begin && 0 === V) try {
646            s.begin.call(g, g);
647          } catch (x) {
648            setTimeout(function () {
649              throw x;
650            }, 1);
651          }if ("scroll" === A) {
652            var P,
653                C,
654                T,
655                F = /^x$/i.test(s.axis) ? "Left" : "Top",
656                j = parseFloat(s.offset) || 0;s.container ? m.isWrapped(s.container) || m.isNode(s.container) ? (s.container = s.container[0] || s.container, P = s.container["scroll" + F], T = P + f(o).position()[F.toLowerCase()] + j) : s.container = null : (P = b.State.scrollAnchor[b.State["scrollProperty" + F]], C = b.State.scrollAnchor[b.State["scrollProperty" + ("Left" === F ? "Top" : "Left")]], T = f(o).offset()[F.toLowerCase()] + j), l = { scroll: { rootPropertyValue: !1, startValue: P, currentValue: P, endValue: T, unitType: "", easing: s.easing, scrollData: { container: s.container, direction: F, alternateValue: C } }, element: o }, b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
657          } else if ("reverse" === A) {
658            if (!i(o).tweensContainer) return void f.dequeue(o, s.queue);"none" === i(o).opts.display && (i(o).opts.display = "auto"), "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"), i(o).opts.loop = !1, i(o).opts.begin = null, i(o).opts.complete = null, v.easing || delete s.easing, v.duration || delete s.duration, s = f.extend({}, i(o).opts, s);var E = f.extend(!0, {}, i(o).tweensContainer);for (var H in E) {
659              if ("element" !== H) {
660                var N = E[H].startValue;E[H].startValue = E[H].currentValue = E[H].endValue, E[H].endValue = N, m.isEmptyObject(v) || (E[H].easing = s.easing), b.debug && console.log("reverse tweensContainer (" + H + "): " + JSON.stringify(E[H]), o);
661              }
662            }l = E;
663          } else if ("start" === A) {
664            var E;i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer), f.each(y, function (e, t) {
665              if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
666                var r = p(t, !0),
667                    n = r[0],
668                    o = r[1],
669                    i = r[2];if (S.RegEx.isHex.test(n)) {
670                  for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
671                    var f = [l[c]];o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f;
672                  }delete y[e];
673                }
674              }
675            });for (var z in y) {
676              var O = p(y[z]),
677                  q = O[0],
678                  $ = O[1],
679                  M = O[2];z = S.Names.camelCase(z);var I = S.Hooks.getRoot(z),
680                  B = !1;if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
681                (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !M && 0 !== q && (M = 0), s._cacheValues && E && E[z] ? (M === a && (M = E[z].endValue + E[z].unitType), B = i(o).rootPropertyValueCache[I]) : S.Hooks.registered[z] ? M === a ? (B = S.getPropertyValue(o, I), M = S.getPropertyValue(o, z, B)) : B = S.Hooks.templates[I][1] : M === a && (M = S.getPropertyValue(o, z));var W,
682                    G,
683                    Y,
684                    D = !1;if (W = d(z, M), M = W[0], Y = W[1], W = d(z, q), q = W[0].replace(/^([+-\/*])=/, function (e, t) {
685                  return D = t, "";
686                }), G = W[1], M = parseFloat(M) || 0, q = parseFloat(q) || 0, "%" === G && (/^(fontSize|lineHeight)$/.test(z) ? (q /= 100, G = "em") : /^scale/.test(z) ? (q /= 100, G = "") : /(Red|Green|Blue)$/i.test(z) && (q = q / 100 * 255, G = "")), /[\/*]/.test(D)) G = Y;else if (Y !== G && 0 !== M) if (0 === q) G = Y;else {
687                  n = n || h();var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y";switch (Y) {case "%":
688                      M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight;break;case "px":
689                      break;default:
690                      M *= n[Y + "ToPx"];}switch (G) {case "%":
691                      M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight);break;case "px":
692                      break;default:
693                      M *= 1 / n[G + "ToPx"];}
694                }switch (D) {case "+":
695                    q = M + q;break;case "-":
696                    q = M - q;break;case "*":
697                    q = M * q;break;case "/":
698                    q = M / q;}l[z] = { rootPropertyValue: B, startValue: M, currentValue: M, endValue: q, unitType: G, easing: $ }, b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
699              } else b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
700            }l.element = o;
701          }l.element && (S.Values.addClass(o, "velocity-animating"), R.push(l), "" === s.queue && (i(o).tweensContainer = l, i(o).opts = s), i(o).isAnimating = !0, V === w - 1 ? (b.State.calls.push([R, g, s, null, k.resolver]), b.State.isTicking === !1 && (b.State.isTicking = !0, c())) : V++);
702        }var n,
703            o = this,
704            s = f.extend({}, b.defaults, v),
705            l = {};switch (i(o) === a && b.init(o), parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
706          b.velocityQueueEntryFlag = !0, i(o).delayTimer = { setTimeout: setTimeout(e, parseFloat(s.delay)), next: e };
707        }), s.duration.toString().toLowerCase()) {case "fast":
708            s.duration = 200;break;case "normal":
709            s.duration = h;break;case "slow":
710            s.duration = 600;break;default:
711            s.duration = parseFloat(s.duration) || 1;}b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parseFloat(b.mock) || 1, s.delay *= parseFloat(b.mock) || 1)), s.easing = u(s.easing, s.duration), s.begin && !m.isFunction(s.begin) && (s.begin = null), s.progress && !m.isFunction(s.progress) && (s.progress = null), s.complete && !m.isFunction(s.complete) && (s.complete = null), s.display !== a && null !== s.display && (s.display = s.display.toString().toLowerCase(), "auto" === s.display && (s.display = b.CSS.Values.getDisplayType(o))), s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.toString().toLowerCase()), s.mobileHA = s.mobileHA && b.State.isMobile && !b.State.isGingerbread, s.queue === !1 ? s.delay ? setTimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) {
712          return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityQueueEntryFlag = !0, void e(t));
713        }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
714      }var s,
715          l,
716          d,
717          g,
718          y,
719          v,
720          x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties));if (m.isWrapped(this) ? (s = !1, d = 0, g = this, l = this) : (s = !0, d = 1, g = x ? arguments[0].elements || arguments[0].e : arguments[0]), g = o(g)) {
721        x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]);var w = g.length,
722            V = 0;if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
723          var C = d + 1;v = {};for (var T = C; T < arguments.length; T++) {
724            m.isArray(arguments[T]) || !/^(fast|normal|slow)$/i.test(arguments[T]) && !/^\d/.test(arguments[T]) ? m.isString(arguments[T]) || m.isArray(arguments[T]) ? v.easing = arguments[T] : m.isFunction(arguments[T]) && (v.complete = arguments[T]) : v.duration = arguments[T];
725          }
726        }var k = { promise: null, resolver: null, rejecter: null };s && b.Promise && (k.promise = new b.Promise(function (e, t) {
727          k.resolver = e, k.rejecter = t;
728        }));var A;switch (y) {case "scroll":
729            A = "scroll";break;case "reverse":
730            A = "reverse";break;case "finish":case "stop":
731            f.each(g, function (e, t) {
732              i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout), i(t).delayTimer.next && i(t).delayTimer.next(), delete i(t).delayTimer);
733            });var F = [];return f.each(b.State.calls, function (e, t) {
734              t && f.each(t[1], function (r, n) {
735                var o = v === a ? "" : v;return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
736                  a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
737                    m.isFunction(t) && t(null, !0);
738                  }), f.queue(a, m.isString(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
739                    t.endValue = t.currentValue;
740                  }), F.push(e)) : "finish" === y && (t[2].duration = 1));
741                }) : !0;
742              });
743            }), "stop" === y && (f.each(F, function (e, t) {
744              p(t, !0);
745            }), k.promise && k.resolver(g)), e();default:
746            if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
747              if (m.isString(y) && b.Redirects[y]) {
748                var j = f.extend({}, v),
749                    E = j.duration,
750                    H = j.delay || 0;return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) {
751                  parseFloat(j.stagger) ? j.delay = H + parseFloat(j.stagger) * e : m.isFunction(j.stagger) && (j.delay = H + j.stagger.call(t, e, w)), j.drag && (j.duration = parseFloat(E) || (/^(callout|transition)/.test(y) ? 1e3 : h), j.duration = Math.max(j.duration * (j.backwards ? 1 
751- e / w : (e + 1) / w), .75 * j.duration, 200)), b.Redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a);
752                }), e();
753              }var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting.";return k.promise ? k.rejecter(new Error(N)) : console.log(N), e();
754            }A = "start";}var L = { lastParent: null, lastPosition: null, lastFontSize: null, lastPercentToPxWidth: null, lastPercentToPxHeight: null, lastEmToPx: null, remToPx: null, vwToPx: null, vhToPx: null },
755            R = [];f.each(g, function (e, t) {
756          m.isNode(t) && n.call(t);
757        });var z,
758            j = f.extend({}, b.defaults, v);if (j.loop = parseInt(j.loop), z = 2 * j.loop - 1, j.loop) for (var O = 0; z > O; O++) {
759          var q = { delay: j.delay, progress: j.progress };O === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), P(g, "reverse", q);
760        }return e();
761      }
762    };b = f.extend(P, b), b.animate = P;var w = t.requestAnimationFrame || g;return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
763      r.hidden ? (w = function (e) {
764        return setTimeout(function () {
765          e(!0);
766        }, 16);
767      }, c()) : w = t.requestAnimationFrame || g;
768    }), e.Velocity = b, e !== t && (e.fn.velocity = P, e.fn.velocity.defaults = b.defaults), f.each(["Down", "Up"], function (e, t) {
769      b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
770        var l = f.extend({}, r),
771            u = l.begin,
772            c = l.complete,
773            p = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" },
774            d = {};l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function () {
775          u && u.call(i, i);for (var r in p) {
776            d[r] = e.style[r];var a = b.CSS.getPropertyValue(e, r);p[r] = "Down" === t ? [a, 0] : [0, a];
777          }d.overflow = e.style.overflow, e.style.overflow = "hidden";
778        }, l.complete = function () {
779          for (var t in d) {
780            e.style[t] = d[t];
781          }c && c.call(i, i), s && s.resolver(i);
782        }, b(e, p, l);
783      };
784    }), f.each(["In", "Out"], function (e, t) {
785      b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
786        var l = f.extend({}, r),
787            u = { opacity: "In" === t ? 1 : 0 },
788            c = l.complete;l.complete = n !== o - 1 ? l.begin = null : function () {
789          c && c.call(i, i), s && s.resolver(i);
790        }, l.display === a && (l.display = "In" === t ? "auto" : "none"), b(this, u, l);
791      };
792    }), b;
793  }(window.jQuery || window.Zepto || window, window, document);
794}));
795;!function (a, b, c, d) {
796  "use strict";
797  function k(a, b, c) {
798    return setTimeout(q(a, c), b);
799  }function l(a, b, c) {
800    return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
801  }function m(a, b, c) {
802    var e;if (a) if (a.forEach) a.forEach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) {
803      b.call(c, a[e], e, a), e++;
804    } else for (e in a) {
805      a.hasOwnProperty(e) && b.call(c, a[e], e, a);
806    }
807  }function n(a, b, c) {
808    for (var e = Object.keys(b), f = 0; f < e.length;) {
809      (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
810    }return a;
811  }function o(a, b) {
812    return n(a, b, !0);
813  }function p(a, b, c) {
814    var e,
815        d = b.prototype;e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
816  }function q(a, b) {
817    return function () {
818      return a.apply(b, arguments);
819    };
820  }function r(a, b) {
821    return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
822  }function s(a, b) {
823    return a === d ? b : a;
824  }function t(a, b, c) {
825    m(x(b), function (b) {
826      a.addEventListener(b, c, !1);
827    });
828  }function u(a, b, c) {
829    m(x(b), function (b) {
830      a.removeEventListener(b, c, !1);
831    });
832  }function v(a, b) {
833    for (; a;) {
834      if (a == b) return !0;a = a.parentNode;
835    }return !1;
836  }function w(a, b) {
837    return a.indexOf(b) > -1;
838  }function x(a) {
839    return a.trim().split(/\s+/g);
840  }function y(a, b, c) {
841    if (a.indexOf && !c) return a.indexOf(b);for (var d = 0; d < a.length;) {
842      if (c && a[d][c] == b || !c && a[d] === b) return d;d++;
843    }return -1;
844  }function z(a) {
845    return Array.prototype.slice.call(a, 0);
846  }function A(a, b, c) {
847    for (var d = [], e = [], f = 0; f < a.length;) {
848      var g = b ? a[f][b] : a[f];y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
849    }return c && (d = b ? d.sort(function (a, c) {
850      return a[b] > c[b];
851    }) : d.sort()), d;
852  }function B(a, b) {
853    for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
854      if (c = e[h], f = c ? c + g : b, f in a) return f;h++;
855    }return d;
856  }function D() {
857    return C++;
858  }function E(a) {
859    var b = a.ownerDocument;return b.defaultView || b.parentWindow;
860  }function ab(a, b) {
861    var c = this;this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
862      r(a.options.enable, [a]) && c.handler(b);
863    }, this.init();
864  }function bb(a) {
865    var b,
866        c = a.options.inputClass;return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
867  }function cb(a, b, c) {
868    var d = c.pointers.length,
869        e = c.changedPointers.length,
870        f = b & O && 0 === d - e,
871        g = b & (Q | R) && 0 === d - e;c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c;
872  }function db(a, b) {
873    var c = a.session,
874        d = b.pointers,
875        e = d.length;c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);var f = c.firstInput,
876        g = c.firstMultiple,
877        h = g ? g.center : f.center,
878        i = b.center = hb(d);b.timeStamp = j(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetDirection = jb(b.deltaX, b.deltaY), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b);var k = a.element;v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
879  }function eb(a, b) {
880    var c = b.center,
881        d = a.offsetDelta || {},
882        e = a.prevDelta || {},
883        f = a.prevInput || {};(b.eventType === O || f.eventType === Q) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
884  }function fb(a, b) {
885    var f,
886        g,
887        h,
888        j,
889        c = a.lastInterval || b,
890        e = b.timeStamp - c.timeStamp;if (b.eventType != R && (e > N || c.velocity === d)) {
891      var k = c.deltaX - b.deltaX,
892          l = c.deltaY - b.deltaY,
893          m = ib(e, k, l);g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
894    } else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction;b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
895  }function gb(a) {
896    for (var b = [], c = 0; c < a.pointers.length;) {
897      b[c] = { clientX: h(a.pointers[c].clientX), clientY: h(a.pointers[c].clientY) }, c++;
898    }return { timeStamp: j(), pointers: b, center: hb(b), deltaX: a.deltaX, deltaY: a.deltaY };
899  }function hb(a) {
900    var b = a.length;if (1 === b) return { x: h(a[0].clientX), y: h(a[0].clientY) };for (var c = 0, d = 0, e = 0; b > e;) {
901      c += a[e].clientX, d += a[e].clientY, e++;
902    }return { x: h(c / b), y: h(d / b) };
903  }function ib(a, b, c) {
904    return { x: b / a || 0, y: c / a || 0 };
905  }function jb(a, b) {
906    return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
907  }function kb(a, b, c) {
908    c || (c = $);var d = b[c[0]] - a[c[0]],
909        e = b[c[1]] - a[c[1]];return Math.sqrt(d * d + e * e);
910  }function lb(a, b, c) {
911    c || (c = $);var d = b[c[0]] - a[c[0]],
912        e = b[c[1]] - a[c[1]];return 180 * Math.atan2(e, d) / Math.PI;
913  }function mb(a, b) {
914    return lb(b[1], b[0], _) - lb(a[1], a[0], _);
915  }function nb(a, b) {
916    return kb(b[0], b[1], _) / kb(a[0], a[1], _);
917  }function rb() {
918    this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
919  }function wb() {
920    this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
921  }function Ab() {
922    this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
923  }function Bb(a, b) {
924    var c = z(a.touches),
925        d = z(a.changedTouches);return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
926  }function Eb() {
927    this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
928  }function Fb(a, b) {
929    var c = z(a.touches),
930        d = this.targetIds;if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];var e,
931        f,
932        g = z(a.changedTouches),
933        h = [],
934        i = this.target;if (f = c.filter(function (a) {
935      return v(a.target, i);
936    }), b === O) for (e = 0; e < f.length;) {
937      d[f[e].identifier] = !0, e++;
938    }for (e = 0; e < g.length;) {
939      d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
940    }return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
941  }function Gb() {
942    ab.apply(this, arguments);var a = q(this.handler, this);this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
943  }function Pb(a, b) {
944    this.manager = a, this.set(b);
945  }function Qb(a) {
946    if (w(a, Mb)) return Mb;var b = w(a, Nb),
947        c = w(a, Ob);return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
948  }function Yb(a) {
949    this.id = D(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = Rb, this.simultaneous = {}, this.requireFail = [];
950  }function Zb(a) {
951    return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
952  }
vendor: 6,759 bytes, lines 952-1080
952function $b(a) {
953    return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
954  }function _b(a, b) {
955    var c = b.manager;return c ? c.get(a) : a;
956  }function ac() {
957    Yb.apply(this, arguments);
958  }function bc() {
959    ac.apply(this, arguments), this.pX = null, this.pY = null;
960  }function cc() {
961    ac.apply(this, arguments);
962  }function dc() {
963    Yb.apply(this, arguments), this._timer = null, this._input = null;
964  }function ec() {
965    ac.apply(this, arguments);
966  }function fc() {
967    ac.apply(this, arguments);
968  }function gc() {
969    Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
970  }function hc(a, b) {
971    return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
972  }function kc(a, b) {
973    b = b || {}, this.options = o(b, hc.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchAction = new Pb(this, this.options.touchAction), lc(this, !0), m(b.recognizers, function (a) {
974      var b = this.add(new a[0](a[1]));a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
975    }, this);
976  }function lc(a, b) {
977    var c = a.element;m(a.options.cssProps, function (a, d) {
978      c.style[B(c.style, d)] = b ? a : "";
979    });
980  }function mc(a, c) {
981    var d = b.createEvent("Event");d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
982  }var e = ["", "webkit", "moz", "MS", "ms", "o"],
983      f = b.createElement("div"),
984      g = "function",
985      h = Math.round,
986      i = Math.abs,
987      j = Date.now,
988      C = 1,
989      F = /mobile|tablet|ip(ad|hone|od)|android/i,
990      G = "ontouchstart" in a,
991      H = B(a, "PointerEvent") !== d,
992      I = G && F.test(navigator.userAgent),
993      J = "touch",
994      K = "pen",
995      L = "mouse",
996      M = "kinect",
997      N = 25,
998      O = 1,
999      P = 2,
1000      Q = 4,
1001      R = 8,
1002      S = 1,
1003      T = 2,
1004      U = 4,
1005      V = 8,
1006      W = 16,
1007      X = T | U,
1008      Y = V | W,
1009      Z = X | Y,
1010      $ = ["x", "y"],
1011      _ = ["clientX", "clientY"];ab.prototype = { handler: function () {}, init: function () {
1012      this.evEl && t(this.element, this.evEl, this.domHandler), this.evTarget && t(this.target, this.evTarget, this.domHandler), this.evWin && t(E(this.element), this.evWin, this.domHandler);
1013    }, destroy: function () {
1014      this.evEl && u(this.element, this.evEl, this.domHandler), this.evTarget && u(this.target, this.evTarget, this.domHandler), this.evWin && u(E(this.element), this.evWin, this.domHandler);
1015    } };var ob = { mousedown: O, mousemove: P, mouseup: Q },
1016      pb = "mousedown",
1017      qb = "mousemove mouseup";p(rb, ab, { handler: function (a) {
1018      var b = ob[a.type];b & O && 0 === a.button && (this.pressed = !0), b & P && 1 !== a.which && (b = Q), this.pressed && this.allow && (b & Q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: L, srcEvent: a }));
1019    } });var sb = { pointerdown: O, pointermove: P, pointerup: Q, pointercancel: R, pointerout: R },
1020      tb = { 2: J, 3: K, 4: L, 5: M },
1021      ub = "pointerdown",
1022      vb = "pointermove pointerup pointercancel";a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, { handler: function (a) {
1023      var b = this.store,
1024          c = !1,
1025          d = a.type.toLowerCase().replace("ms", ""),
1026          e = sb[d],
1027          f = tb[a.pointerType] || a.pointerType,
1028          g = f == J,
1029          h = y(b, a.pointerId, "pointerId");e & O && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Q | R) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1));
1030    } });var xb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
1031      yb = "touchstart",
1032      zb = "touchstart touchmove touchend touchcancel";p(Ab, ab, { handler: function (a) {
1033      var b = xb[a.type];if (b === O && (this.started = !0), this.started) {
1034        var c = Bb.call(this, a, b);b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
1035      }
1036    } });var Cb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
1037      Db = "touchstart touchmove touchend touchcancel";p(Eb, ab, { handler: function (a) {
1038      var b = Cb[a.type],
1039          c = Fb.call(this, a, b);c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
1040    } }), p(Gb, ab, { handler: function (a, b, c) {
1041      var d = c.pointerType == J,
1042          e = c.pointerType == L;if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
1043    }, destroy: function () {
1044      this.touch.destroy(), this.mouse.destroy();
1045    } });var Hb = B(f.style, "touchAction"),
1046      Ib = Hb !== d,
1047      Jb = "compute",
1048      Kb = "auto",
1049      Lb = "manipulation",
1050      Mb = "none",
1051      Nb = "pan-x",
1052      Ob = "pan-y";Pb.prototype = { set: function (a) {
1053      a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
1054    }, update: function () {
1055      this.set(this.manager.options.touchAction);
1056    }, compute: function () {
1057      var a = [];return m(this.manager.recognizers, function (b) {
1058        r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
1059      }), Qb(a.join(" "));
1060    }, preventDefaults: function (a) {
1061      if (!Ib) {
1062        var b = a.srcEvent,
1063            c = a.offsetDirection;if (this.manager.session.prevented) return b.preventDefault(), void 0;var d = this.actions,
1064            e = w(d, Mb),
1065            f = w(d, Ob),
1066            g = w(d, Nb);return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
1067      }
1068    }, preventSrc: function (a) {
1069      this.manager.session.prevented = !0, a.preventDefault();
1070    } };var Rb = 1,
1071      Sb = 2,
1072      Tb = 4,
1073      Ub = 8,
1074      Vb = Ub,
1075      Wb = 16,
1076      Xb = 32;Yb.prototype = { defaults: {}, set: function (a) {
1077      return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
1078    }, recognizeWith: function (a) {
1079      if (l(a, "recognizeWith", this)) return this;var b = this.simultaneous;return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
1080    }, dropRecognizeWith: function (a) {
1081      return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
1082    }, requireFailure: function (a) {
1083      if (l(a, "requireFailure", this)) return this;var b = this.requireFail;return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
1084    }, dropRequireFailure: function (a) {
1085      if (l(a, "dropRequireFailure", this)) return this;a = _b(a, this);var b = y(this.requireFail, a);return b > -1 && this.requireFail.splice(b, 1), this;
1086    }, hasRequireFailures: function () {
1087      return this.requireFail.length > 0;
1088    }, canRecognizeWith: function (a) {
1089      return !!this.simultaneous[a.id];
1090    }, emit: function (a) {
1091      function d(d) {
1092        b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
1093      }var b = this,
1094          c = this.state;Ub > c && d(!0), d(), c >= Ub && d(!0);
1095    }, tryEmit: function (a) {
1096      return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
1097    }, canEmit: function () {
1098      for (var a = 0; a < this.requireFail.length;) {
1099        if (!(this.requireFail[a].state & (Xb | Rb))) return !1;a++;
1100      }return !0;
1101    }, recognize: function (a) {
1102      var b = n({}, a);return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb), this.state = this.process(b), this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b), void 0) : (this.reset(), this.state = Xb, void 0);
1103    }, process: function () {}, getTouchAction: function () {}, reset: function () {} }, p(ac, Yb, { defaults: { pointers: 1 }, attrTest: function (a) {
1104      var b = this.options.pointers;return 0 === b || a.pointers.length === b;
1105    }, process: function (a) {
1106      var b = this.state,
1107          c = a.eventType,
1108          d = b & (Sb | Tb),
1109          e = this.attrTest(a);return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
1110    } }), p(bc, ac, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: Z }, getTouchAction: function () {
1111      var a = this.options.direction,
1112          b = [];return a & X && b.push(Ob), a & Y && b.push(Nb), b;
1113    }, directionTest: function (a) {
1114      var b = this.options,
1115          c = !0,
1116          d = a.distance,
1117          e = a.direction,
1118          f = a.deltaX,
1119          g = a.deltaY;return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction;
1120    }, attrTest: function (a) {
1121      return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
1122    }, emit: function (a) {
1123      this.pX = a.deltaX, this.pY = a.deltaY;var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
1124    } }), p(cc, ac, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () {
1125      return [Mb];
1126    }, attrTest: function (a) {
1127      return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
1128    }, emit: function (a) {
1129      if (this._super.emit.call(this, a), 1 !== a.scale) {
1130        var b = a.scale < 1 ? "in" : "out";this.manager.emit(this.options.event + b, a);
1131      }
1132    } }), p(dc, Yb, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () {
1133      return [Kb];
1134    }, process: function (a) {
1135      var b = this.options,
1136          c = a.pointers.length === b.pointers,
1137          d = a.distance < b.threshold,
1138          e = a.deltaTime > b.time;if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset();else if (a.eventType & O) this.reset(), this._timer = k(function () {
1139        this.state = Vb, this.tryEmit();
1140      }, b.time, this);else if (a.eventType & Q) return Vb;return Xb;
1141    }, reset: function () {
1142      clearTimeout(this._timer);
1143    }, emit: function (a) {
1144      this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(), this.manager.emit(this.options.event, this._input)));
1145    } }), p(ec, ac, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () {
1146      return [Mb];
1147    }, attrTest: function (a) {
1148      return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
1149    } }), p(fc, ac, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: X | Y, pointers: 1 }, getTouchAction: function () {
1150      return bc.prototype.getTouchAction.call(this);
1151    }, attrTest: function (a) {
1152      var c,
1153          b = this.options.direction;return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY), this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
1154    }, emit: function (a) {
1155      var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
1156    } }), p(gc, Yb, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () {
1157      return [Lb];
1158    }, process: function (a) {
1159      var b = this.options,
1160          c = a.pointers.length === b.pointers,
1161          d = a.distance < b.threshold,
1162          e = a.deltaTime < b.time;if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout();if (d && e && c) {
1163        if (a.eventType != Q) return this.failTimeout();var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
1164            g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;
1164this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;var h = this.count % b.taps;if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
1165          this.state = Vb, this.tryEmit();
1166        }, b.interval, this), Sb) : Vb;
1167      }return Xb;
1168    }, failTimeout: function () {
1169      return this._timer = k(function () {
1170        this.state = Xb;
1171      }, this.options.interval, this), Xb;
1172    }, reset: function () {
1173      clearTimeout(this._timer);
1174    }, emit: function () {
1175      this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
1176    } }), hc.VERSION = "2.0.4", hc.defaults = { domEvents: !1, touchAction: Jb, enable: !0, inputTarget: null, inputClass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: X }], [bc, { direction: X }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssProps: { userSelect: "default", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } };var ic = 1,
1177      jc = 2;kc.prototype = { set: function (a) {
1178      return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
1179    }, stop: function (a) {
1180      this.session.stopped = a ? jc : ic;
1181    }, recognize: function (a) {
1182      var b = this.session;if (!b.stopped) {
1183        this.touchAction.preventDefaults(a);var c,
1184            d = this.recognizers,
1185            e = b.curRecognizer;(!e || e && e.state & Vb) && (e = b.curRecognizer = null);for (var f = 0; f < d.length;) {
1186          c = d[f], b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c), f++;
1187        }
1188      }
1189    }, get: function (a) {
1190      if (a instanceof Yb) return a;for (var b = this.recognizers, c = 0; c < b.length; c++) {
1191        if (b[c].options.event == a) return b[c];
1192      }return null;
1193    }, add: function (a) {
1194      if (l(a, "add", this)) return this;var b = this.get(a.options.event);return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
1195    }, remove: function (a) {
1196      if (l(a, "remove", this)) return this;var b = this.recognizers;return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
1197    }, on: function (a, b) {
1198      var c = this.handlers;return m(x(a), function (a) {
1199        c[a] = c[a] || [], c[a].push(b);
1200      }), this;
1201    }, off: function (a, b) {
1202      var c = this.handlers;return m(x(a), function (a) {
1203        b ? c[a].splice(y(c[a], b), 1) : delete c[a];
1204      }), this;
1205    }, emit: function (a, b) {
1206      this.options.domEvents && mc(a, b);var c = this.handlers[a] && this.handlers[a].slice();if (c && c.length) {
1207        b.type = a, b.preventDefault = function () {
1208          b.srcEvent.preventDefault();
1209        };for (var d = 0; d < c.length;) {
1210          c[d](b), d++;
1211        }
1212      }
1213    }, destroy: function () {
1214      this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
1215    } }, n(hc, { INPUT_START: O, INPUT_MOVE: P, INPUT_END: Q, INPUT_CANCEL: R, STATE_POSSIBLE: Rb, STATE_BEGAN: Sb, STATE_CHANGED: Tb, STATE_ENDED: Ub, STATE_RECOGNIZED: Vb, STATE_CANCELLED: Wb, STATE_FAILED: Xb, DIRECTION_NONE: S, DIRECTION_LEFT: T, DIRECTION_RIGHT: U, DIRECTION_UP: V, DIRECTION_DOWN: W, DIRECTION_HORIZONTAL: X, DIRECTION_VERTICAL: Y, DIRECTION_ALL: Z, Manager: kc, Input: ab, TouchAction: Pb, TouchInput: Eb, MouseInput: rb, PointerEventInput: wb, TouchMouseInput: Gb, SingleTouchInput: Ab, Recognizer: Yb, AttrRecognizer: ac, Tap: gc, Pan: bc, Swipe: fc, Pinch: cc, Rotate: ec, Press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindFn: q, prefixed: B }), typeof define == g && define.amd ? define(function () {
1216    return hc;
1217  }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
1218}(window, document, "Hammer");;(function (factory) {
1219  if (typeof define === 'function' && define.amd) {
1220    define(['jquery', 'hammerjs'], factory);
1221  } else if (typeof exports === 'object') {
1222    factory(require('jquery'), require('hammerjs'));
1223  } else {
1224    factory(jQuery, Hammer);
1225  }
1226})(function ($, Hammer) {
1227  function hammerify(el, options) {
1228    var $el = $(el);
1229    if (!$el.data("hammer")) {
1230      $el.data("hammer", new Hammer($el[0], options));
1231    }
1232  }
1233
1234  $.fn.hammer = function (options) {
1235    return this.each(function () {
1236      hammerify(this, options);
1237    });
1238  };
1239
1240  // extend the emit method to also trigger jQuery events
1241  Hammer.Manager.prototype.emit = function (originalEmit) {
1242    return function (type, data) {
1243      originalEmit.call(this, type, data);
1244      $(this.element).trigger({
1245        type: type,
1246        gesture: data
1247      });
1248    };
1249  }(Hammer.Manager.prototype.emit);
1250});
1251; // Required for Meteor package, the use of window prevents export by Meteor
1252(function (window) {
1253  if (window.Package) {
1254    Materialize = {};
1255  } else {
1256    window.Materialize = {};
1257  }
1258})(window);
1259
1260if (typeof exports !== 'undefined' && !exports.nodeType) {
1261  if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
1262    exports = module.exports = Materialize;
1263  }
1264  exports.default = Materialize;
1265}
1266
1267/*
1268 * raf.js
1269 * https://github.com/ngryman/raf.js
1270 *
1271 * original requestAnimationFrame polyfill by Erik Möller
1272 * inspired from paul_irish gist and post
1273 *
1274 * Copyright (c) 2013 ngryman
1275 * Licensed under the MIT license.
1276 */
1277(function (window) {
1278  var lastTime = 0,
1279      vendors = ['webkit', 'moz'],
1280      requestAnimationFrame = window.requestAnimationFrame,
1281      cancelAnimationFrame = window.cancelAnimationFrame,
1282      i = vendors.length;
1283
1284  // try to un-prefix existing raf
1285  while (--i >= 0 && !requestAnimationFrame) {
1286    requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
1287    cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
1288  }
1289
1290  // polyfill with setTimeout fallback
1291  // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
1292  if (!requestAnimationFrame || !cancelAnimationFrame) {
1293    requestAnimationFrame = function (callback) {
1294      var now = +Date.now(),
1295          nextTime = Math.max(lastTime + 16, now);
1296      return setTimeout(function () {
1297        callback(lastTime = nextTime);
1298      }, nextTime - now);
1299    };
1300
1301    cancelAnimationFrame = clearTimeout;
1302  }
1303
1304  // export to window
1305  window.requestAnimationFrame = requestAnimationFrame;
1306  window.cancelAnimationFrame = cancelAnimationFrame;
1307})(window);
1308
1309/**
1310 * Generate approximated selector string for a jQuery object
1311 * @param {jQuery} obj  jQuery object to be parsed
1312 * @returns {string}
1313 */
1314Materialize.objectSelectorString = function (obj) {
1315  var tagStr = obj.prop('tagName') || '';
1316  var idStr = obj.attr('id') || '';
1317  var classStr = obj.attr('class') || '';
1318  return (tagStr + idStr + classStr).replace(/\s/g, '');
1319};
1320
1321// Unique Random ID
1322Materialize.guid = function () {
1323  function s4() {
1324    return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
1325  }
1326  return function () {
1327    return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
1328  };
1329}();
1330
1331/**
1332 * Escapes hash from special characters
1333 * @param {string} hash  String returned from this.hash
1334 * @returns {string}
1335 */
1336Materialize.escapeHash = function (hash) {
1337  return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
1338};
1339
1340Materialize.elementOrParentIsFixed = function (element) {
1341  var $element = $(element);
1342  var $checkElements = $element.add($element.parents());
1343  var isFixed = false;
1344  $checkElements.each(function () {
1345    if ($(this).css("position") === "fixed") {
1346      isFixed = true;
1347      return false;
1348    }
1349  });
1350  return isFixed;
1351};
1352
1353/**
1354 * Get time in ms
1355 * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1356 * @type {function}
1357 * @return {number}
1358 */
1359var getTime = Date.now || function () {
1360  return new Date().getTime();
1361};
1362
1363/**
1364 * Returns a function, that, when invoked, will only be triggered at most once
1365 * during a given window of time. Normally, the throttled function will run
1366 * as much as it can, without ever going more than once per `wait` duration;
1367 * but if you'd like to disable the execution on the leading edge, pass
1368 * `{leading: false}`. To disable execution on the trailing edge, ditto.
1369 * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1370 * @param {function} func
1371 * @param {number} wait
1372 * @param {Object=} options
1373 * @returns {Function}
1374 */
1375Materialize.throttle = function (func, wait, options) {
1376  var context, args, result;
1377  var timeout = null;
1378  var previous = 0;
1379  options || (options = {});
1380  var later = function () {
1381    previous = options.leading === false ? 0 : getTime();
1382    timeout = null;
1383    result = func.apply(context, args);
1384    context = args = null;
1385  };
1386  return function () {
1387    var now = getTime();
1388    if (!previous && options.leading === false) previous = now;
1389    var remaining = wait - (now - previous);
1390    context = this;
1391    args = arguments;
1392    if (remaining <= 0) {
1393      clearTimeout(timeout);
1394      timeout = null;
1395      previous = now;
1396      result = func.apply(context, args);
1397      context = args = null;
1398    } else if (!timeout && options.trailing !== false) {
1399      timeout = setTimeout(later, remaining);
1400    }
1401    return result;
1402  };
1403};
1404
1405// Velocity has conflicts when loaded with jQuery, this will check for it
1406// First, check if in noConflict mode
1407var Vel;
1408if (jQuery) {
1409  Vel = jQuery.Velocity;
1410} else if ($) {
1411  Vel = $.Velocity;
1412} else {
1413  Vel = Velocity;
1414}
1415
1416if (Vel) {
1417  Materialize.Vel = Vel;
1418} else {
1419  Materialize.Vel = Velocity;
1420}
1421;(function ($) {
1422  $.fn.collapsible = function (options, methodParam) {
1423    var defaults = {
1424      accordion: undefined,
1425      onOpen: undefined,
1426      onClose: undefined
1427    };
1428
1429    var methodName = options;
1430    options = $.extend(defaults, options);
1431
1432    return this.each(function () {
1433
1434      var $this = $(this);
1435
1436      var $panel_headers = $(this).find('> li > .collapsible-header');
1437
1438      var collapsible_type = $this.data("collapsible");
1439
1440      /****************
1441      Helper Functions
1442      ****************/
1443
1444      // Accordion Open
1445      function accordionOpen(object) {
1446        $panel_headers = $this.find('> li > .collapsible-header');
1447        if (object.hasClass('active')) {
1448          object.parent().addClass('active');
1449        } else {
1450          object.parent().removeClass('active');
1451        }
1452        if (object.parent().hasClass('active')) {
1453          object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1454              $(this).css('height', '');
1455            } });
1456        } else {
1457          object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1458              $(this).css('height', '');
1459            } });
1460        }
1461
1462        $panel_headers.not(object).removeClass('active').parent().removeClass('active');
1463
1464        // Close previously open accordion elements.
1465        $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
1466          if ($(this).is(':visible')) {
1467            $(this).slideUp({
1468              duration: 350,
1469              easing: "easeOutQuart",
1470              queue: false,
1471              complete: function () {
1472                $(this).css('height', '');
1473                execCallbacks($(this).siblings('.collapsible-header'));
1474              }
1475            });
1476          }
1477        });
1478      }
1479
1480      // Expandable Open
1481      function expandableOpen(object) {
1482        if (object.hasClass('active')) {
1483          object.parent().addClass('active');
1484        } else {
1485          object.parent().removeClass('active');
1486        }
1487        if (object.parent().hasClass('active')) {
1488          object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1489              $(this).css('height', '');
1490            } });
1491        } else {
1492          object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1493              $(this).css('height', '');
1494            } });
1495        }
1496      }
1497
1498      // Open collapsible. object: .collapsible-header
1499      function collapsibleOpen(object, noToggle) {
1500        if (!noToggle) {
1501          object.toggleClass('active');
1502        }
1503
1504        if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
1505          // Handle Accordion
1506          accordionOpen(object);
1507        } else {
1508          // Handle Expandables
1509          expandableOpen(object);
1510        }
1511
1512        execCallbacks(object);
1513      }
1514
1515      // Handle callbacks
1516      function execCallbacks(object) {
1517        if (object.hasClass('active')) {
1518          if (typeof options.onOpen === "function") {
1519            options.onOpen.call(this, object.parent());
1520          }
1521        } else {
1522          if (typeof options.onClose === "function") {
1523            options.onClose.call(this, object.parent());
1524          }
1525        }
1526      }
1527
1528      /**
1529       * Check if object is children of panel header
1530       * @param  {Object}  object Jquery object
1531       * @return {Boolean} true if it is children
1532       */
1533      function isChildrenOfPanelHeader(object) {
1534
1535        var panelHeader = getPanelHeader(object);
1536
1537        return panelHeader.length > 0;
1538      }
1539
1540      /**
1541       * Get panel header from a children element
1542       * @param  {Object} object Jquery object
1543       * @return {Object} panel header object
1544       */
1545      function getPanelHeader(object) {
1546
1547        return object.closest('li > .collapsible-header');
1548      }
1549
1550      // Turn off any existing event handlers
1551      function removeEventHandlers() {
1552        $this.off('click.collapse', '> li > .collapsible-header');
1553      }
1554
1555      /*****  End Helper Functions  *****/
1556
1557      // Methods
1558      if (methodName === 'destroy') {
1559        removeEventHandlers();
1560        return;
1561      } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
1562        var $curr_header = $panel_headers.eq(methodParam);
1563        if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
1564          collapsibleOpen($curr_header);
1565        }
1566        return;
1567      }
1568
1569      removeEventHandlers();
1570
1571      // Add click handler to only direct collapsible header children
1572      $this.on('click.collapse', '> li > .collapsible-header', function (e) {
1573        var element = $(e.target);
1574
1575        if (isChildrenOfPanelHeader(element)) {
1576          element = getPanelHeader(element);
1577        }
1578
1579        collapsibleOpen(element);
1580      });
1581
1582      // Open first active
1583      if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
1584        // Handle Accordion
1585        collapsibleOpen($panel_headers.filter('.active').first(), true);
1586      } else {
1587        // Handle Expandables
1588        $panel_headers.filter('.active').each(function () {
1589          collapsibleOpen($(this), true);
1590        });
1591      }
1592    });
1593  };
1594
1595  $(document).ready(function () {
1596    $('.collapsible').collapsible();
1597  });
1598})(jQuery);;(function ($) {
1599
1600  // Add posibility to scroll to selected option
1601  // usefull for select for example
1602  $.fn.scrollTo = function (elem) {
1603    $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
1604    return this;
1605  };
1606
1607  $.fn.dropdown = function (options) {
1608    var defaults = {
1609      inDuration: 300,
1610      outDuration: 225,
1611      constrainWidth: true, // Constrains width of dropdown to the activator
1612      hover: false,
1613      gutter: 0, // Spacing from edge
1614      belowOrigin: false,
1615      alignment: 'left',
1616      stopPropagation: false
1617    };
1618
1619    // Open dropdown.
1620    if (options === "open") {
1621      this.each(function () {
1622        $(this).trigger('open');
1623      });
1624      return false;
1625    }
1626
1627    // Close dropdown.
1628    if (options === "close") {
1629      this.each(function () {
1630        $(this).trigger('close');
1631      });
1632      return false;
1633    }
1634
1635    this.each(function () {
1636      var origin = $(this);
1637      var curr_options = $.extend({}, defaults, options);
1638      var isFocused = false;
1639
1640      // Dropdown menu
1641      var activates = $("#" + origin.attr('data-activates'));
1642
1643      function updateOptions() {
1644        if (origin.data('induration') !== undefined) curr_options.inDuration = origin.data('induration');
1645        if (origin.data('outduration') !== undefined) curr_options.outDuration = origin.data('outduration');
1646        if (origin.data('constrainwidth') !== undefined) curr_options.constrainWidth = origin.data('constrainwidth');
1647        if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover');
1648        if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter');
1649        if (origin.data('beloworigin') !== undefined) curr_options.belowOrigin = origin.data('beloworigin');
1650        if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment');
1651        if (origin.data('stoppropagation') !== undefined) curr_options.stopPropagation = origin.data('stoppropagation');
1652      }
1653
1654      updateOptions();
1655
1656      // Attach dropdown to its activator
1657      origin.after(activates);
1658
1659      /*
1660        Helper function to position and resize dropdown.
1661        Used in hover and click handler.
1662      */
1663      function placeDropdown(eventType) {
1664        // Check for simultaneous focus and click events.
1665        if (eventType === 'focus') {
1666          isFocused = true;
1667        }
1668
1669        // Check html data attributes
1670        updateOptions();
1671
1672        // Set Dropdown state
1673        activates.addClass('active');
1674        origin.addClass('active');
1675
1676        var originWidth = origin[0].getBoundingClientRect().width;
1677
1678        // Constrain width
1679        if (curr_options.constrainWidth === true) {
1680          activates.css('width', originWidth);
1681        } else {
1682          activates.css('white-space', 'nowrap');
1683        }
1684
1685        // Offscreen detection
1686        var windowHeight = window.innerHeight;
1687        var originHeight = origin.innerHeight();
1688        var offsetLeft = origin.offset().left;
1689        var offsetTop = origin.offset().top - $(window).scrollTop();
1690        var currAlignment = curr_options.alignment;
1691        var gutterSpacing = 0;
1692        var leftPosition = 0;
1693
1694        // Below Origin
1695        var verticalOffset = 0;
1696        if (curr_options.belowOrigin === true) {
1697          verticalOffset = originHeight;
1698        }
1699
1700        // Check for scrolling positioned container.
1701        var scrollYOffset = 0;
1702        var scrollXOffset = 0;
1703        var wrapper = origin.parent();
1704        if (!wrapper.is('body')) {
1705          if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
1706            scrollYOffset = wrapper[0].scrollTop;
1707          }
1708          if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
1709            scrollXOffset = wrapper[0].scrollLeft;
1710          }
1711        }
1712
1713        if (offsetLeft + activates.innerWidth() > $(window).width()) {
1714          // Dropdown goes past screen on right, force right alignment
1715          currAlignment = 'right';
1716        } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
1717          // Dropdown goes past screen on left, force left alignment
1718          currAlignment = 'left';
1719        }
1720        // Vertical bottom offscreen detection
1721        if (offsetTop + activates.innerHeight() > windowHeight) {
1722          // If going upwards still goes offscreen, just crop height of dropdown.
1723          if (offsetTop + originHeight - activates.innerHeight() < 0) {
1724            var adjustedHeight = windowHeight - offsetTop - verticalOffset;
1725            activates.css('max-height', adjustedHeight);
1726          } else {
1727            // Flow upwards.
1728            if (!verticalOffset) {
1729              verticalOffset += originHeight;
1730            }
1731            verticalOffset -= activates.innerHeight();
1732          }
1733        }
1734
1735        // Handle edge alignment
1736        if (currAlignment === 'left') {
1737          gutterSpacing = curr_options.gutter;
1738          leftPosition = origin.position().left + gutterSpacing;
1739        } else if (currAlignment === 'right') {
1740          // Material icons fix
1741          activates.stop(true, true).css({
1742            opacity: 0,
1743            left: 0
1744          });
1745
1746          var offsetRight = origin.position().left + originWidth - activates.width();
1747          gutterSpacing = -curr_options.gutter;
1748          leftPosition = offsetRight + gutterSpacing;
1749        }
1750
1751        // Position dropdown
1752        activates.css({
1753          position: 'absolute',
1754          top: origin.position().top + verticalOffset + scrollYOffset,
1755          left: leftPosition + scrollXOffset
1756        });
1757
1758        // Show dropdown
1759        activates.slideDown({
1760          queue: false,
1761          duration: curr_options.inDuration,
1762          easing: 'easeOutCubic',
1763          complete: function () {
1764            $(this).css('height', '');
1765          }
1766        }).animate({ opacity: 1 }, { queue: false, duration: curr_options.inDuration, easing: 'easeOutSine' });
1767
1768        // Add click close handler to document
1769        setTimeout(function () {
1770          $(document).on('click.' + activates.attr('id'), function (e) {
1771            hideDropdown();
1772            $(document).off('click.' + activates.attr('id'));
1773          });
1774        }, 0);
1775      }
1776
1777      function hideDropdown() {
1778        // Check for simultaneous focus and click events.
1779        isFocused = false;
1780        activates.fadeOut(curr_options.outDuration);
1781        activates.removeClass('active');
1782        origin.removeClass('active');
1783        $(document).off('click.' + activates.attr('id'));
1784        setTimeout(function () {
1785          activates.css('max-height', '');
1786        }, curr_options.outDuration);
1787      }
1788
1789      // Hover
1790      if (curr_options.hover) {
1791        var open = false;
1792        origin.off('click.' + origin.attr('id'));
1793        // Hover handler to show dropdown
1794        origin.on('mouseenter', function (e) {
1795          // Mouse over
1796          if (open === false) {
1797            placeDropdown();
1798            open = true;
1799          }
1800        });
1801        origin.on('mouseleave', function (e) {
1802          // If hover on origin then to something other than dropdown content, then close
1803          var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
1804          if (!$(toEl).closest('.dropdown-content').is(activates)) {
1805            activates.stop(true, true);
1806            hideDropdown();
1807            open = false;
1808          }
1809        });
1810
1811        activates.on('mouseleave', function (e) {
1812          // Mouse out
1813          var toEl = e.toElement || e.relatedTarget;
1814          if (!$(toEl).closest('.dropdown-button').is(origin)) {
1815            activates.stop(true, true);
1816            hideDropdown();
1817            open = false;
1818          }
1819        });
1820
1821        // Click
1822      } else {
1823        // Click handler to show dropdown
1824        origin.off('click.' + origin.attr('id'));
1825        origin.on('click.' + origin.attr('id'), function (e) {
1826          if (!isFocused) {
1827            if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
1828              e.preventDefault(); // Prevents button click from moving window
1829              if (curr_options.stopPropagation) {
1830                e.stopPropagation();
1831              }
1832              placeDropdown('click');
1833            }
1834            // If origin is clicked and menu is open, close menu
1835            else if (origin.hasClass('active')) {
1836                hideDropdown();
1837                $(document).off('click.' + activates.attr('id'));
1838              }
1839          }
1840        });
1841      } // End else
1842
1843      // Listen to open and close event - useful for select component
1844      origin.on('open', function (e, eventType) {
1845        placeDropdown(eventType);
1846      });
1847      origin.on('close', hideDropdown);
1848    });
1849  }; // End dropdown plugin
1850
1851  $(document).ready(function () {
1852    $('.dropdown-button').dropdown();
1853  });
1854})(jQuery);
1855;(function ($, Vel) {
1856  'use strict';
1857
1858  var _defaults = {
1859    opacity: 0.5,
1860    inDuration: 250,
1861    outDuration: 250,
1862    ready: undefined,
1863    complete: undefined,
1864    dismissible: true,
1865    startingTop: '4%',
1866    endingTop: '10%'
1867  };
1868
1869  /**
1870   * @class
1871   *
1872   */
1873
1874  var Modal = function () {
1875    /**
1876     * Construct Modal instance and set up overlay
1877     * @constructor
1878     * @param {jQuery} $el
1879     * @param {Object} options
1880     */
1881    function Modal($el, options) {
1882      _classCallCheck(this, Modal);
1883
1884      // If exists, destroy and reinitialize
1885      if (!!$el[0].M_Modal) {
1886        $el[0].M_Modal.destroy();
1887      }
1888
1889      /**
1890       * The jQuery element
1891       * @type {jQuery}
1892       */
1893      this.$el = $el;
1894
1895      /**
1896       * Options for the modal
1897       * @member Modal#options
1898       * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
1899       * @prop {Number} [inDuration=250] - Length in ms of enter transition
1900       * @prop {Number} [outDuration=250] - Length in ms of exit transition
1901       * @prop {Function} ready - Callback function called when modal is finished entering
1902       * @prop {Function} complete - Callback function called when modal is finished exiting
1903       * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
1904       * @prop {String} [startingTop='4%'] - startingTop
1905       * @prop {String} [endingTop='10%'] - endingTop
1906       */
1907      this.options = $.extend({}, Modal.defaults, options);
1908
1909      /**
1910       * Describes open/close state of modal
1911       * @type {Boolean}
1912       */
1913      this.isOpen = false;
1914
1915      this.$el[0].M_Modal = this;
1916      this.id = $el.attr('id');
1917      this.openingTrigger = undefined;
1918      this.$overlay = $('<div class="modal-overlay"></div>');
1919
1920      Modal._increment++;
1921      Modal._count++;
1922      this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
1923      this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
1924      this.setupEventHandlers();
1925    }
1926
1927    _createClass(Modal, [{
1928      key: 'getInstance',
1929
1930
1931      /**
1932       * Get Instance
1933       */
1934      value: function getInstance() {
1935        return this;
1936      }
1937
1938      /**
1939       * Teardown component
1940       */
1941
1942    }, {
1943      key: 'destroy',
1944      value: function destroy() {
1945        this.removeEventHandlers();
1946        this.$el[0].removeAttribute('style');
1947        if (!!this.$overlay[0].parentNode) {
1948          this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
1949        }
1950        this.$el[0].M_Modal = undefined;
1951        Modal._count--;
1952      }
1953
1954      /**
1955       * Setup Event Handlers
1956       */
1957
1958    }, {
1959      key: 'setupEventHandlers',
1960      value: function setupEventHandlers() {
1961        this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
1962        this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
1963
1964        if (Modal._count === 1) {
1965          document.body.addEventListener('click', this.handleTriggerClick);
1966        }
1967        this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
1968        this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
1969      }
1970
1971      /**
1972       * Remove Event Handlers
1973       */
1974
1975    }, {
1976      key: 'removeEventHandlers',
1977      value: function removeEventHandlers() {
1978        if (Modal._count === 0) {
1979          document.body.removeEventListener('click', this.handleTriggerClick);
1980        }
1981        this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
1982        this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
1983      }
1984
1985      /**
1986       * Handle Trigger Click
1987       * @param {Event} e
1988       */
1989
1990    }, {
1991      key: 'handleTriggerClick',
1992      value: function handleTriggerClick(e) {
1993        var $trigger = $(e.target).closest('.modal-trigger');
1994        if (e.target && $trigger.length) {
1995          var modalId = $trigger[0].getAttribute('href');
1996          if (modalId) {
1997            modalId = modalId.slice(1);
1998          } else {
1999            modalId = $trigger[0].getAttribute('data-target');
2000          }
2001          var modalInstance = document.getElementById(modalId).M_Modal;
2002          if (modalInstance) {
2003            modalInstance.open($trigger);
2004          }
2005          e.preventDefault();
2006        }
2007      }
2008
2009      /**
2010       * Handle Overlay Click
2011       */
2012
2013    }, {
2014      key: 'handleOverlayClick',
2015      value: function handleOverlayClick() {
2016        if (this.options.dismissible) {
2017          this.close();
2018        }
2019      }
2020
2021      /**
2022       * Handle Modal Close Click
2023       * @param {Event} e
2024       */
2025
2026    }, {
2027      key: 'handleModalCloseClick',
2028      value: function handleModalCloseClick(e) {
2029        var $closeTrigger = $(e.target).closest('.modal-close');
2030        if (e.target && $closeTrigger.length) {
2031          this.close();
2032        }
2033      }
2034
2035      /**
2036       * Handle Keydown
2037       * @param {Event} e
2038       */
2039
2040    }, {
2041      key: 'handleKeydown',
2042      value: function handleKeydown(e) {
2043        // ESC key
2044        if (e.keyCode === 27 && this.options.dismissible) {
2045          this.close();
2046        }
2047      }
2048
2049      /**
2050       * Animate in modal
2051       */
2052
2053    }, {
2054      key: 'animateIn',
2055      value: function animateIn() {
2056        var _this = this;
2057
2058        // Set initial styles
2059        $.extend(this.$el[0].style, {
2060          display: 'block',
2061          opacity: 0
2062        });
2063        $.extend(this.$overlay[0].style, {
2064          display: 'block',
2065          opacity: 0
2066        });
2067
2068        // Animate overlay
2069        Vel(this.$overlay[0], { opacity: this.options.opacity }, { duration: this.options.inDuration, queue: false, ease: 'easeOutCubic' });
2070
2071        // Define modal animation options
2072        var enterVelocityOptions = {
2073          duration: this.options.inDuration,
2074          queue: false,
2075          ease: 'easeOutCubic',
2076          // Handle modal ready callback
2077          complete: function () {
2078            if (typeof _this.options.ready === 'function') {
2079              _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
2080            }
2081          }
2082        };
2083
2084        // Bottom sheet animation
2085        if (this.$el[0].classList.contains('bottom-sheet')) {
2086          Vel(this.$el[0], { bottom: 0, opacity: 1 }, enterVelocityOptions);
2087
2088          // Normal modal animation
2089        } else {
2090          Vel.hook(this.$el[0], 'scaleX', 0.7);
2091          this.$el[0].style.top = this.options.startingTop;
2092          Vel(this.$el[0], { top: this.options.endingTop, opacity: 1, scaleX: 1 }, enterVelocityOptions);
2093        }
2094      }
2095
2096      /**
2097       * Animate out modal
2098       */
2099
2100    }, {
2101      key: 'animateOut',
2102      value: function animateOut() {
2103        var _this2 = this;
2104
2105        // Animate overlay
2106        Vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuart' });
2107
2108        // Define modal animation options
2109        var exitVelocityOptions = {
2110          duration: this.options.outDuration,
2111          queue: false,
2112          ease: 'easeOutCubic',
2113          // Handle modal ready callback
2114          complete: function () {
2115            _this2.$el[0].style.display = 'none';
2116            // Call complete callback
2117            if (typeof _this2.options.complete === 'function') {
2118              _this2.options.complete.call(_this2, _this2.$el);
2119            }
2120            _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
2121          }
2122        };
2123
2124        // Bottom sheet animation
2125        if (this.$el[0].classList.contains('bottom-sheet')) {
2126          Vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
2127
2128          // Normal modal animation
2129        } else {
2130          Vel(this.$el[0], { top: this.options.startingTop, opacity: 0, scaleX: 0.7 }, exitVelocityOptions);
2131        }
2132      }
2133
2134      /**
2135       * Open Modal
2136       * @param {jQuery} [$trigger]
2137       */
2138
2139    }, {
2140      key: 'open',
2141      value: function open($trigger) {
2142        if (this.isOpen) {
2143          return;
2144        }
2145
2146        this.isOpen = true;
2147        var body = document.body;
2148        body.style.overflow = 'hidden';
2149        this.$el[0].classList.add('open');
2150        body.appendChild(this.$overlay[0]);
2151
2152        // Set opening trigger, undefined indicates modal was opened by javascript
2153        this.openingTrigger = !!$trigger ? $trigger : undefined;
2154
2155        if (this.options.dismissible) {
2156          this.handleKeydownBound = this.handleKeydown.bind(this);
2157          document.addEventListener('keydown', this.handleKeydownBound);
2158        }
2159
2160        this.animateIn();
2161
2162        return this;
2163      }
2164
2165      /**
2166       * Close Modal
2167       */
2168
2169    }, {
2170      key: 'close',
2171      value: function close() {
2172        if (!this.isOpen) {
2173          return;
2174        }
2175
2176        this.isOpen = false;
2177        this.$el[0].classList.remove('open');
2178        document.body.style.overflow = '';
2179
2180        if (this.options.dismissible) {
2181          document.removeEventListener('keydown', this.handleKeydownBound);
2182        }
2183
2184        this.animateOut();
2185
2186        return this;
2187      }
2188    }], [{
2189      key: 'init',
2190      value: function init($els, options) {
2191        var arr = [];
2192        $els.each(function () {
2193          arr.push(new Modal($(this), options));
2194        });
2195        return arr;
2196      }
2197    }, {
2198      key: 'defaults',
2199      get: function () {
2200        return _defaults;
2201      }
2202    }]);
2203
2204    return Modal;
2205  }();
2206
2207  /**
2208   * @static
2209   * @memberof Modal
2210   */
2211
2212
2213  Modal._increment = 0;
2214
2215  /**
2216   * @static
2217   * @memberof Modal
2218   */
2219  Modal._count = 0;
2220
2221  Materialize.Modal = Modal;
2222
2223  $.fn.modal = function (methodOrOptions) {
2224    // Call plugin method if valid method name is passed in
2225    if (Modal.prototype[methodOrOptions]) {
2226      // Getter methods
2227      if (methodOrOptions.slice(0, 3) === 'get') {
2228        return this.first()[0].M_Modal[methodOrOptions]();
2229
2230        // Void methods
2231      } else {
2232        return this.each(function () {
2233          this.M_Modal[methodOrOptions]();
2234        });
2235      }
2236
2237      // Initialize plugin if options or no argument is passed in
2238    } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
2239      Modal.init(this, arguments[0]);
2240      return this;
2241
2242      // Return error if an unrecognized  method name is passed in
2243    } else {
2244      $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
2245    }
2246  };
2247})(jQuery, Materialize.Vel);
2248;(function ($) {
2249
2250  $.fn.materialbox = function () {
2251
2252    return this.each(function () {
2253
2254      if ($(this).hasClass('initialized')) {
2255        return;
2256      }
2257
2258      $(this).addClass('initialized');
2259
2260      var overlayActive = false;
2261      var doneAnimating = true;
2262      var inDuration = 275;
2263      var outDuration = 200;
2264      var origin = $(this);
2265      var placeholder = $('<div></div>').addClass('material-placeholder');
2266      var originalWidth = 0;
2267      var originalHeight = 0;
2268      var ancestorsChanged;
2269      var ancestor;
2270      var originInlineStyles = origin.attr('style');
2271      origin.wrap(placeholder);
2272
2273      // Start click handler
2274      origin.on('click', function () {
2275        var placeholder = origin.parent('.material-placeholder');
2276        var windowWidth = window.innerWidth;
2277        var windowHeight = window.innerHeight;
2278        var originalWidth = origin.width();
2279        var originalHeight = origin.height();
2280
2281        // If already modal, return to original
2282        if (doneAnimating === false) {
2283          returnToOriginal();
2284          return false;
2285        } else if (overlayActive && doneAnimating === true) {
2286          returnToOriginal();
2287          return false;
2288        }
2289
2290        // Set states
2291        doneAnimating = false;
2292        origin.addClass('active');
2293        overlayActive = true;
2294
2295        // Set positioning for placeholder
2296        placeholder.css({
2297          width: placeholder[0].getBoundingClientRect().width,
2298          height: placeholder[0].getBoundingClientRect().height,
2299          position: 'relative',
2300          top: 0,
2301          left: 0
2302        });
2303
2304        // Find ancestor with overflow: hidden; and remove it
2305        ancestorsChanged = undefined;
2306        ancestor = placeholder[0].parentNode;
2307        var count = 0;
2308        while (ancestor !== null && !$(ancestor).is(document)) {
2309          var curr = $(ancestor);
2310          if (curr.css('overflow') !== 'visible') {
2311            curr.css('overflow', 'visible');
2312            if (ancestorsChanged === undefined) {
2313              ancestorsChanged = curr;
2314            } else {
2315              ancestorsChanged = ancestorsChanged.add(curr);
2316            }
2317          }
2318          ancestor = ancestor.parentNode;
2319        }
2320
2321        // Set css on origin
2322        origin.css({
2323          position: 'absolute',
2324          'z-index': 1000,
2325          'will-change': 'left, top, width, height'
2326        }).data('width', originalWidth).data('height', originalHeight);
2327
2328        // Add overlay
2329        var overlay = $('<div id="materialbox-overlay"></div>').css({
2330          opacity: 0
2331        }).click(function () {
2332          if (doneAnimating === true) returnToOriginal();
2333        });
2334
2335        // Put before in origin image to preserve z-index layering.
2336        origin.before(overlay);
2337
2338        // Set dimensions if needed
2339        var overlayOffset = overlay[0].getBoundingClientRect();
2340        overlay.css({
2341          width: windowWidth,
2342          height: windowHeight,
2343          left: -1 * overlayOffset.left,
2344          top: -1 * overlayOffset.top
2345        });
2346
2347        // Animate Overlay
2348        overlay.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
2349
2350        // Add and animate caption if it exists
2351        if (origin.data('caption') !== "") {
2352          var $photo_caption = $('<div class="materialbox-caption"></div>');
2353          $photo_caption.text(origin.data('caption'));
2354          $('body').append($photo_caption);
2355          $photo_caption.css({ "display": "inline" });
2356          $photo_caption.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
2357        }
2358
2359        // Resize Image
2360        var ratio = 0;
2361        var widthPercent = originalWidth / windowWidth;
2362        var heightPercent = originalHeight / windowHeight;
2363        var newWidth = 0;
2364        var newHeight = 0;
2365
2366        if (widthPercent > heightPercent) {
2367          ratio = originalHeight / originalWidth;
2368          newWidth = windowWidth * 0.9;
2369          newHeight = windowWidth * 0.9 * ratio;
2370        } else {
2371          ratio = originalWidth / originalHeight;
2372          newWidth = windowHeight * 0.9 * ratio;
2373          newHeight = windowHeight * 0.9;
2374        }
2375
2376        // Animate image + set z-index
2377        if (origin.hasClass('responsive-img')) {
2378          origin.velocity({ 'max-width': newWidth, 'width': originalWidth }, { duration: 0, queue: false,
2379            complete: function () {
2380              origin.css({ left: 0, top: 0 }).velocity({
2381                height: newHeight,
2382                width: newWidth,
2383                left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
2384                top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
2385              }, {
2386                duration: inDuration,
2387                queue: false,
2388                easing: 'easeOutQuad',
2389                complete: function () {
2390                  doneAnimating = true;
2391                }
2392              });
2393            } // End Complete
2394          }); // End Velocity
2395        } else {
2396          origin.css('left', 0).css('top', 0).velocity({
2397            height: newHeight,
2398            width: newWidth,
2399            left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
2400            top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
2401          }, {
2402            duration: inDuration,
2403            queue: false,
2404            easing: 'easeOutQuad',
2405            complete: function () {
2406              doneAnimating = true;
2407            }
2408          }); // End Velocity
2409        }
2410
2411        // Handle Exit triggers
2412        $(window).on('scroll.materialbox', function () {
2413          if (overlayActive) {
2414            returnToOriginal();
2415          }
2416        });
2417
2418        $(window).on('resize.materialbox', function () {
2419          if (overlayActive) {
2420            returnToOriginal();
2421          }
2422        });
2423
2424        $(document).on('keyup.materialbox', function (e) {
2425          // ESC key
2426          if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
2427            returnToOriginal();
2428          }
2429        });
2430      }); // End click handler
2431
2432
2433      // This function returns the modaled image to the original spot
2434      function returnToOriginal() {
2435
2436        doneAnimating = false;
2437
2438        var placeholder = origin.parent('.material-placeholder');
2439        var windowWidth = window.innerWidth;
2440        var windowHeight = window.innerHeight;
2441        var originalWidth = origin.data('width');
2442        var originalHeight = origin.data('height');
2443
2444        origin.velocity("stop", true);
2445        $('#materialbox-overlay').velocity("stop", true);
2446        $('.materialbox-caption').velocity("stop", true);
2447
2448        // disable exit handlers
2449        $(window).off('scroll.materialbox');
2450        $(document).off('keyup.materialbox');
2451        $(window).off('resize.materialbox');
2452
2453        $('#materialbox-overlay').velocity({ opacity: 0 }, {
2454          duration: outDuration, // Delay prevents animation overlapping
2455          queue: false, easing: 'easeOutQuad',
2456          complete: function () {
2457            // Remove Overlay
2458            overlayActive = false;
2459            $(this).remove();
2460          }
2461        });
2462
2463        // Resize Image
2464        origin.velocity({
2465          width: originalWidth,
2466          height: originalHeight,
2467          left: 0,
2468          top: 0
2469        }, {
2470          duration: outDuration,
2471          queue: false, easing: 'easeOutQuad',
2472          complete: function () {
2473            placeholder.css({
2474              height: '',
2475              width: '',
2476              position: '',
2477              top: '',
2478              left: ''
2479            });
2480
2481            origin.removeAttr('style');
2482            origin.attr('style', originInlineStyles);
2483
2484            // Remove class
2485            origin.removeClass('active');
2486            doneAnimating = true;
2487
2488            // Remove overflow overrides on ancestors
2489            if (ancestorsChanged) {
2490              ancestorsChanged.css('overflow', '');
2491            }
2492          }
2493        });
2494
2495        // Remove Caption + reset css settings on image
2496        $('.materialbox-caption').velocity({ opacity: 0 }, {
2497          duration: outDuration, // Delay prevents animation overlapping
2498          queue: false, easing: 'easeOutQuad',
2499          complete: function () {
2500            $(this).remove();
2501          }
2502        });
2503      }
2504    });
2505  };
2506
2507  $(document).ready(function () {
2508    $('.materialboxed').materialbox();
2509  });
2510})(jQuery);
2511;(function ($) {
2512
2513  $.fn.parallax = function () {
2514    var window_width = $(window).width();
2515    // Parallax Scripts
2516    return this.each(function (i) {
2517      var $this = $(this);
2518      $this.addClass('parallax');
2519
2520      function updateParallax(initial) {
2521        var container_height;
2522        if (window_width < 601) {
2523          container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
2524        } else {
2525          container_height = $this.height() > 0 ? $this.height() : 500;
2526        }
2527        var $img = $this.children("img").first();
2528        var img_height = $img.height();
2529        var parallax_dist = img_height - container_height;
2530        var bottom = $this.offset().top + container_height;
2531        var top = $this.offset().top;
2532        var scrollTop = $(window).scrollTop();
2533        var windowHeight = window.innerHeight;
2534        var windowBottom = scrollTop + windowHeight;
2535        var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
2536        var parallax = Math.round(parallax_dist * percentScrolled);
2537
2538        if (initial) {
2539          $img.css('display', 'block');
2540        }
2541        if (bottom > scrollTop && top < scrollTop + windowHeight) {
2542          $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
2543        }
2544      }
2545
2546      // Wait for image load
2547      $this.children("img").one("load", function () {
2548        updateParallax(true);
2549      }).each(function () {
2550        if (this.complete) $(this).trigger("load");
2551      });
2552
2553      $(window).scroll(function () {
2554        window_width = $(window).width();
2555        updateParallax(false);
2556      });
2557
2558      $(window).resize(function () {
2559        window_width = $(window).width();
2560        updateParallax(false);
2561      });
2562    });
2563  };
2564})(jQuery);
2565;(function ($) {
2566
2567  var methods = {
2568    init: function (options) {
2569      var defaults = {
2570        onShow: null,
2571        swipeable: false,
2572        responsiveThreshold: Infinity // breakpoint for swipeable
2573      };
2574      options = $.extend(defaults, options);
2575      var namespace = Materialize.objectSelectorString($(this));
2576
2577      return this.each(function (i) {
2578
2579        var uniqueNamespace = namespace + i;
2580
2581        // For each set of tabs, we want to keep track of
2582        // which tab is active and its associated content
2583        var $this = $(this),
2584            window_width = $(window).width();
2585
2586        var $active,
2587            $content,
2588            $links = $this.find('li.tab a'),
2589            $tabs_width = $this.width(),
2590            $tabs_content = $(),
2591            $tabs_wrapper,
2592            $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
2593            $indicator,
2594            index = 0,
2595            prev_index = 0,
2596            clicked = false,
2597            clickedTimeout,
2598            transition = 300;
2599
2600        // Finds right attribute for indicator based on active tab.
2601        // el: jQuery Object
2602        var calcRightPos = function (el) {
2603          return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
2604        };
2605
2606        // Finds left attribute for indicator based on active tab.
2607        // el: jQuery Object
2608        var calcLeftPos = function (el) {
2609          return Math.floor(el.position().left + $this.scrollLeft());
2610        };
2611
2612        // Animates Indicator to active tab.
2613        // prev_index: Number
2614        var animateIndicator = function (prev_index) {
2615          if (index - prev_index >= 0) {
2616            $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
2617            $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
2618          } else {
2619            $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
2620            $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
2621          }
2622        };
2623
2624        // Change swipeable according to responsive threshold
2625        if (options.swipeable) {
2626          if (window_width > options.responsiveThreshold) {
2627            options.swipeable = false;
2628          }
2629        }
2630
2631        // If the location.hash matches one of the links, use that as the active tab.
2632        $active = $($links.filter('[href="' + location.hash + '"]'));
2633
2634        // If no match is found, use the first link or any with class 'active' as the initial active tab.
2635        if ($active.length === 0) {
2636          $active = $(this).find('li.tab a.active').first();
2637        }
2638        if ($active.length === 0) {
2639          $active = $(this).find('li.tab a').first();
2640        }
2641
2642        $active.addClass('active');
2643        index = $links.index($active);
2644        if (index < 0) {
2645          index = 0;
2646        }
2647
2648        if ($active[0] !== undefined) {
2649          $content = $($active[0].hash);
2650          $content.addClass('active');
2651        }
2652
2653        // append indicator then set indicator width to tab width
2654        if (!$this.find('.indicator').length) {
2655          $this.append('<li class="indicator"></li>');
2656        }
2657        $indicator = $this.find('.indicator');
2658
2659        // we make sure that the indicator is at the end of the tabs
2660        $this.append($indicator);
2661
2662        if ($this.is(":visible")) {
2663          // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
2664          // $indicator.css({"left": index * $tab_width});
2665          setTimeout(function () {
2666            $indicator.css({ "right": calcRightPos($active) });
2667            $indicator.css({ "left": calcLeftPos($active) });
2668          }, 0);
2669        }
2670        $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
2671          $tabs_width = $this.width();
2672          $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
2673          if (index < 0) {
2674            index = 0;
2675          }
2676          if ($tab_width !== 0 && $tabs_width !== 0) {
2677            $indicator.css({ "right": calcRightPos($active) });
2678            $indicator.css({ "left": calcLeftPos($active) });
2679          }
2680        });
2681
2682        // Initialize Tabs Content.
2683        if (options.swipeable) {
2684          // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
2685          $links.each(function () {
2686            var $curr_content = $(Materialize.escapeHash(this.hash));
2687            $curr_content.addClass('carousel-item');
2688            $tabs_content = $tabs_content.add($curr_content);
2689          });
2690          $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
2691          $tabs_content.css('display', '');
2692          $('.tabs-content.carousel').carousel({
2693            fullWidth: true,
2694            noWrap: true,
2695            onCycleTo: function (item) {
2696              if (!clicked) {
2697                var prev_index = index;
2698                index = $tabs_wrapper.index(item);
2699                $active.removeClass('active');
2700                $active = $links.eq(index);
2701                $active.addClass('active');
2702                animateIndicator(prev_index);
2703                if (typeof options.onShow === "function") {
2704                  options.onShow.call($this[0], $content);
2705                }
2706              }
2707            }
2708          });
2709        } else {
2710          // Hide the remaining content
2711          $links.not($active).each(function () {
2712            $(Materialize.escapeHash(this.hash)).hide();
2713          });
2714        }
2715
2716        // Bind the click event handler
2717        $this.off('click.tabs').on('click.tabs', 'a', function (e) {
2718          if ($(this).parent().hasClass('disabled')) {
2719            e.preventDefault();
2720            return;
2721          }
2722
2723          // Act as regular link if target attribute is specified.
2724          if (!!$(this).attr("target")) {
2725            return;
2726          }
2727
2728          clicked = true;
2729          $tabs_width = $this.width();
2730          $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
2731
2732          // Make the old tab inactive.
2733          $active.removeClass('active');
2734          var $oldContent = $content;
2735
2736          // Update the variables with the new link and content
2737          $active = $(this);
2738          $content = $(Materialize.escapeHash(this.hash));
2739          $links = $this.find('li.tab a');
2740          var activeRect = $active.position();
2741
2742          // Make the tab active.
2743          $active.addClass('active');
2744          prev_index = index;
2745          index = $links.index($(this));
2746          if (index < 0) {
2747            index = 0;
2748          }
2749          // Change url to current tab
2750          // window.location.hash = $active.attr('href');
2751
2752          // Swap content
2753          if (options.swipeable) {
2754            if ($tabs_content.length) {
2755              $tabs_content.carousel('set', index, function () {
2756                if (typeof options.onShow === "function") {
2757                  options.onShow.call($this[0], $content);
2758                }
2759              });
2760            }
2761          } else {
2762            if ($content !== undefined) {
2763              $content.show();
2764              $content.addClass('active');
2765              if (typeof options.onShow === "function") {
2766                options.onShow.call(this, $content);
2767              }
2768            }
2769
2770            if ($oldContent !== undefined && !$oldContent.is($content)) {
2771              $oldContent.hide();
2772              $oldContent.removeClass('active');
2773            }
2774          }
2775
2776          // Reset clicked state
2777          clickedTimeout = setTimeout(function () {
2778            clicked = false;
2779          }, transition);
2780
2781          // Update indicator
2782          animateIndicator(prev_index);
2783
2784          // Prevent the anchor's default click action
2785          e.preventDefault();
2786        });
2787      });
2788    },
2789    select_tab: function (id) {
2790      this.find('a[href="#' + id + '"]').trigger('click');
2791    }
2792  };
2793
2794  $.fn.tabs = function (methodOrOptions) {
2795    if (methods[methodOrOptions]) {
2796      return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
2797    } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
2798      // Default to "init"
2799      return methods.init.apply(this, arguments);
2800    } else {
2801      $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
2802    }
2803  };
2804
2805  $(document).ready(function () {
2806    $('ul.tabs').tabs();
2807  });
2808})(jQuery);
2809;(function ($) {
2810  $.fn.tooltip = function (options) {
2811    var timeout = null,
2812        margin = 5;
2813
2814    // Defaults
2815    var defaults = {
2816      delay: 350,
2817      tooltip: '',
2818      position: 'bottom',
2819      html: false
2820    };
2821
2822    // Remove tooltip from the activator
2823    if (options === "remove") {
2824      this.each(function () {
2825        $('#' + $(this).attr('data-tooltip-id')).remove();
2826        $(this).removeAttr('data-tooltip-id');
2827        $(this).off('mouseenter.tooltip mouseleave.tooltip');
2828      });
2829      return false;
2830    }
2831
2832    options = $.extend(defaults, options);
2833
2834    return this.each(function () {
2835      var tooltipId = Materialize.guid();
2836      var origin = $(this);
2837
2838      // Destroy old tooltip
2839      if (origin.attr('data-tooltip-id')) {
2840        $('#' + origin.attr('data-tooltip-id')).remove();
2841      }
2842
2843      origin.attr('data-tooltip-id', tooltipId);
2844
2845      // Get attributes.
2846      var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
2847      var setAttributes = function () {
2848        allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
2849        tooltipDelay = origin.attr('data-delay');
2850        tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
2851        tooltipPosition = origin.attr('data-position');
2852        tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
2853        tooltipText = origin.attr('data-tooltip');
2854        tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
2855      };
2856      setAttributes();
2857
2858      var renderTooltipEl = function () {
2859        var tooltip = $('<div class="material-tooltip"></div>');
2860
2861        // Create Text span
2862        if (allowHtml) {
2863          tooltipText = $('<span></span>').html(tooltipText);
2864        } else {
2865          tooltipText = $('<span></span>').text(tooltipText);
2866        }
2867
2868        // Create tooltip
2869        tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
2870
2871        // Create backdrop
2872        backdrop = $('<div class="backdrop"></div>');
2873        backdrop.appendTo(tooltip);
2874        return tooltip;
2875      };
2876      tooltipEl = renderTooltipEl();
2877
2878      // Destroy previously binded events
2879      origin.off('mouseenter.tooltip mouseleave.tooltip');
2880      // Mouse In
2881      var started = false,
2882          timeoutRef;
2883      origin.on({ 'mouseenter.tooltip': function (e) {
2884          var showTooltip = function () {
2885            setAttributes();
2886            started = true;
2887            tooltipEl.velocity('stop');
2888            backdrop.velocity('stop');
2889            tooltipEl.css({ visibility: 'visible', left: '0px', top: '0px' });
2890
2891            // Tooltip positioning
2892            var originWidth = origin.outerWidth();
2893            var originHeight = origin.outerHeight();
2894            var tooltipHeight = tooltipEl.outerHeight();
2895            var tooltipWidth = tooltipEl.outerWidth();
2896            var tooltipVerticalMovement = '0px';
2897            var tooltipHorizontalMovement = '0px';
2898            var backdropOffsetWidth = backdrop[0].offsetWidth;
2899            var backdropOffsetHeight = backdrop[0].offsetHeight;
2900            var scaleXFactor = 8;
2901            var scaleYFactor = 8;
2902            var scaleFactor = 0;
2903            var targetTop, targetLeft, newCoordinates;
2904
2905            if (tooltipPosition === "top") {
2906              // Top Position
2907              targetTop = origin.offset().top - tooltipHeight - margin;
2908              targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
2909              newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2910              tooltipVerticalMovement = '-10px';
2911              backdrop.css({
2912                bottom: 0,
2913                left: 0,
2914                borderRadius: '14px 14px 0 0',
2915                transformOrigin: '50% 100%',
2916                marginTop: tooltipHeight,
2917                marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
2918              });
2919            }
2920            // Left Position
2921            else if (tooltipPosition === "left") {
2922                targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
2923                targetLeft = origin.offset().left - tooltipWidth - margin;
2924                newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2925
2926                tooltipHorizontalMovement = '-10px';
2927                backdrop.css({
2928                  top: '-7px',
2929                  right: 0,
2930                  width: '14px',
2931                  height: '14px',
2932                  borderRadius: '14px 0 0 14px',
2933                  transformOrigin: '95% 50%',
2934                  marginTop: tooltipHeight / 2,
2935                  marginLeft: tooltipWidth
2936                });
2937              }
2938              // Right Position
2939              else if (tooltipPosition === "right") {
2940                  targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
2941                  targetLeft = origin.offset().left + originWidth + margin;
2942                  newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2943
2944                  tooltipHorizontalMovement = '+10px';
2945                  backdrop.css({
2946                    top: '-7px',
2947                    left: 0,
2948                    width: '14px',
2949                    height: '14px',
2950                    borderRadius: '0 14px 14px 0',
2951                    transformOrigin: '5% 50%',
2952                    marginTop: tooltipHeight / 2,
2953                    marginLeft: '0px'
2954                  });
2955                } else {
2956                  // Bottom Position
2957                  targetTop = origin.offset().top + origin.outerHeight() + margin;
2958                  targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
2959                  newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2960                  tooltipVerticalMovement = '+10px';
2961                  backdrop.css({
2962                    top: 0,
2963                    left: 0,
2964                    marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
2965                  });
2966                }
2967
2968            // Set tooptip css placement
2969            tooltipEl.css({
2970              top: newCoordinates.y,
2971              left: newCoordinates.x
2972            });
2973
2974            // Calculate Scale to fill
2975            scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
2976            scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
2977            scaleFactor = Math.max(scaleXFactor, scaleYFactor);
2978
2979            tooltipEl.velocity({ translateY: tooltipVerticalMovement, translateX: tooltipHorizontalMovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false });
2980            backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scaleX: scaleFactor, scaleY: scaleFactor }, { duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad' });
2981          };
2982
2983          timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
2984
2985          // Mouse Out
2986        },
2987        'mouseleave.tooltip': function () {
2988          // Reset State
2989          started = false;
2990          clearTimeout(timeoutRef);
2991
2992          // Animate back
2993          setTimeout(function () {
2994            if (started !== true) {
2995              tooltipEl.velocity({
2996                opacity: 0, translateY: 0, translateX: 0 }, { duration: 225, queue: false });
2997              backdrop.velocity({ opacity: 0, scaleX: 1, scaleY: 1 }, {
2998                duration: 225,
2999                queue: false,
3000                complete: function () {
3001                  backdrop.css({ visibility: 'hidden' });
3002                  tooltipEl.css({ visibility: 'hidden' });
3003                  started = false;
3004                }
3005              });
3006            }
3007          }, 225);
3008        }
3009      });
3010    });
3011  };
3012
3013  var repositionWithinScreen = function (x, y, width, height) {
3014    var newX = x;
3015    var newY = y;
3016
3017    if (newX < 0) {
3018      newX = 4;
3019    } else if (newX + width > window.innerWidth) {
3020      newX -= newX + width - window.innerWidth;
3021    }
3022
3023    if (newY < 0) {
3024      newY = 4;
3025    } else if (newY + height > window.innerHeight + $(window).scrollTop) {
3026      newY -= newY + height - window.innerHeight;
3027    }
3028
3029    return { x: newX, y: newY };
3030  };
3031
3032  $(document).ready(function () {
3033    $('.tooltipped').tooltip();
3034  });
3035})(jQuery);
3036; /*!
3037  * Waves v0.6.4
3038  * http://fian.my.id/Waves
3039  *
3040  * Copyright 2014 Alfiana E. Sibuea and other contributors
3041  * Released under the MIT license
3042  * https://github.com/fians/Waves/blob/master/LICENSE
3043  */
3044
3045;(function (window) {
3046  'use strict';
3047
3048  var Waves = Waves || {};
3049  var $$ = document.querySelectorAll.bind(document);
3050
3051  // Find exact position of element
3052  function isWindow(obj) {
3053    return obj !== null && obj === obj.window;
3054  }
3055
3056  function getWindow(elem) {
3057    return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
3058  }
3059
3060  function offset(elem) {
3061    var docElem,
3062        win,
3063        box = { top: 0, left: 0 },
3064        doc = elem && elem.ownerDocument;
3065
3066    docElem = doc.documentElement;
3067
3068    if (typeof elem.getBoundingClientRect !== typeof undefined) {
3069      box = elem.getBoundingClientRect();
3070    }
3071    win = getWindow(doc);
3072    return {
3073      top: box.top + win.pageYOffset - docElem.clientTop,
3074      left: box.left + win.pageXOffset - docElem.clientLeft
3075    };
3076  }
3077
3078  function convertStyle(obj) {
3079    var style = '';
3080
3081    for (var a in obj) {
3082      if (obj.hasOwnProperty(a)) {
3083        style += a + ':' + obj[a] + ';';
3084      }
3085    }
3086
3087    return style;
3088  }
3089
3090  var Effect = {
3091
3092    // Effect delay
3093    duration: 750,
3094
3095    show: function (e, element) {
3096
3097      // Disable right click
3098      if (e.button === 2) {
3099        return false;
3100      }
3101
3102      var el = element || this;
3103
3104      // Create ripple
3105      var ripple = document.createElement('div');
3106      ripple.className = 'waves-ripple';
3107      el.appendChild(ripple);
3108
3109      // Get click coordinate and element witdh
3110      var pos = offset(el);
3111      var relativeY = e.pageY - pos.top;
3112      var relativeX = e.pageX - pos.left;
3113      var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
3114
3115      // Support for touch devices
3116      if ('touches' in e) {
3117        relativeY = e.touches[0].pageY - pos.top;
3118        relativeX = e.touches[0].pageX - pos.left;
3119      }
3120
3121      // Attach data to element
3122      ripple.setAttribute('data-hold', Date.now());
3123      ripple.setAttribute('data-scale', scale);
3124      ripple.setAttribute('data-x', relativeX);
3125      ripple.setAttribute('data-y', relativeY);
3126
3127      // Set ripple position
3128      var rippleStyle = {
3129        'top': relativeY + 'px',
3130        'left': relativeX + 'px'
3131      };
3132
3133      ripple.className = ripple.className + ' waves-notransition';
3134      ripple.setAttribute('style', convertStyle(rippleStyle));
3135      ripple.className = ripple.className.replace('waves-notransition', '');
3136
3137      // Scale the ripple
3138      rippleStyle['-webkit-transform'] = scale;
3139      rippleStyle['-moz-transform'] = scale;
3140      rippleStyle['-ms-transform'] = scale;
vendor: 17,532 bytes, lines 3141-3740
3141      rippleStyle['-o-transform'] = scale;
3142      rippleStyle.transform = scale;
3143      rippleStyle.opacity = '1';
3144
3145      rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
3146      rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
3147      rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
3148      rippleStyle['transition-duration'] = Effect.duration + 'ms';
3149
3150      rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3151      rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3152      rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3153      rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3154
3155      ripple.setAttribute('style', convertStyle(rippleStyle));
3156    },
3157
3158    hide: function (e) {
3159      TouchHandler.touchup(e);
3160
3161      var el = this;
3162      var width = el.clientWidth * 1.4;
3163
3164      // Get first ripple
3165      var ripple = null;
3166      var ripples = el.getElementsByClassName('waves-ripple');
3167      if (ripples.length > 0) {
3168        ripple = ripples[ripples.length - 1];
3169      } else {
3170        return false;
3171      }
3172
3173      var relativeX = ripple.getAttribute('data-x');
3174      var relativeY = ripple.getAttribute('data-y');
3175      var scale = ripple.getAttribute('data-scale');
3176
3177      // Get delay beetween mousedown and mouse leave
3178      var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
3179      var delay = 350 - diff;
3180
3181      if (delay < 0) {
3182        delay = 0;
3183      }
3184
3185      // Fade out ripple after delay
3186      setTimeout(function () {
3187        var style = {
3188          'top': relativeY + 'px',
3189          'left': relativeX + 'px',
3190          'opacity': '0',
3191
3192          // Duration
3193          '-webkit-transition-duration': Effect.duration + 'ms',
3194          '-moz-transition-duration': Effect.duration + 'ms',
3195          '-o-transition-duration': Effect.duration + 'ms',
3196          'transition-duration': Effect.duration + 'ms',
3197          '-webkit-transform': scale,
3198          '-moz-transform': scale,
3199          '-ms-transform': scale,
3200          '-o-transform': scale,
3201          'transform': scale
3202        };
3203
3204        ripple.setAttribute('style', convertStyle(style));
3205
3206        setTimeout(function () {
3207          try {
3208            el.removeChild(ripple);
3209          } catch (e) {
3210            return false;
3211          }
3212        }, Effect.duration);
3213      }, delay);
3214    },
3215
3216    // Little hack to make <input> can perform waves effect
3217    wrapInput: function (elements) {
3218      for (var a = 0; a < elements.length; a++) {
3219        var el = elements[a];
3220
3221        if (el.tagName.toLowerCase() === 'input') {
3222          var parent = el.parentNode;
3223
3224          // If input already have parent just pass through
3225          if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
3226            continue;
3227          }
3228
3229          // Put element class and style to the specified parent
3230          var wrapper = document.createElement('i');
3231          wrapper.className = el.className + ' waves-input-wrapper';
3232
3233          var elementStyle = el.getAttribute('style');
3234
3235          if (!elementStyle) {
3236            elementStyle = '';
3237          }
3238
3239          wrapper.setAttribute('style', elementStyle);
3240
3241          el.className = 'waves-button-input';
3242          el.removeAttribute('style');
3243
3244          // Put element as child
3245          parent.replaceChild(wrapper, el);
3246          wrapper.appendChild(el);
3247        }
3248      }
3249    }
3250  };
3251
3252  /**
3253   * Disable mousedown event for 500ms during and after touch
3254   */
3255  var TouchHandler = {
3256    /* uses an integer rather than bool so there's no issues with
3257     * needing to clear timeouts if another touch event occurred
3258     * within the 500ms. Cannot mouseup between touchstart and
3259     * touchend, nor in the 500ms after touchend. */
3260    touches: 0,
3261    allowEvent: function (e) {
3262      var allow = true;
3263
3264      if (e.type === 'touchstart') {
3265        TouchHandler.touches += 1; //push
3266      } else if (e.type === 'touchend' || e.type === 'touchcancel') {
3267        setTimeout(function () {
3268          if (TouchHandler.touches > 0) {
3269            TouchHandler.touches -= 1; //pop after 500ms
3270          }
3271        }, 500);
3272      } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
3273        allow = false;
3274      }
3275
3276      return allow;
3277    },
3278    touchup: function (e) {
3279      TouchHandler.allowEvent(e);
3280    }
3281  };
3282
3283  /**
3284   * Delegated click handler for .waves-effect element.
3285   * returns null when .waves-effect element not in "click tree"
3286   */
3287  function getWavesEffectElement(e) {
3288    if (TouchHandler.allowEvent(e) === false) {
3289      return null;
3290    }
3291
3292    var element = null;
3293    var target = e.target || e.srcElement;
3294
3295    while (target.parentNode !== null) {
3296      if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
3297        element = target;
3298        break;
3299      }
3300      target = target.parentNode;
3301    }
3302    return element;
3303  }
3304
3305  /**
3306   * Bubble the click and show effect if .waves-effect elem was found
3307   */
3308  function showEffect(e) {
3309    var element = getWavesEffectElement(e);
3310
3311    if (element !== null) {
3312      Effect.show(e, element);
3313
3314      if ('ontouchstart' in window) {
3315        element.addEventListener('touchend', Effect.hide, false);
3316        element.addEventListener('touchcancel', Effect.hide, false);
3317      }
3318
3319      element.addEventListener('mouseup', Effect.hide, false);
3320      element.addEventListener('mouseleave', Effect.hide, false);
3321      element.addEventListener('dragend', Effect.hide, false);
3322    }
3323  }
3324
3325  Waves.displayEffect = function (options) {
3326    options = options || {};
3327
3328    if ('duration' in options) {
3329      Effect.duration = options.duration;
3330    }
3331
3332    //Wrap input inside <i> tag
3333    Effect.wrapInput($$('.waves-effect'));
3334
3335    if ('ontouchstart' in window) {
3336      document.body.addEventListener('touchstart', showEffect, false);
3337    }
3338
3339    document.body.addEventListener('mousedown', showEffect, false);
3340  };
3341
3342  /**
3343   * Attach Waves to an input element (or any element which doesn't
3344   * bubble mouseup/mousedown events).
3345   *   Intended to be used with dynamically loaded forms/inputs, or
3346   * where the user doesn't want a delegated click handler.
3347   */
3348  Waves.attach = function (element) {
3349    //FUTURE: automatically add waves classes and allow users
3350    // to specify them with an options param? Eg. light/classic/button
3351    if (element.tagName.toLowerCase() === 'input') {
3352      Effect.wrapInput([element]);
3353      element = element.parentNode;
3354    }
3355
3356    if ('ontouchstart' in window) {
3357      element.addEventListener('touchstart', showEffect, false);
3358    }
3359
3360    element.addEventListener('mousedown', showEffect, false);
3361  };
3362
3363  window.Waves = Waves;
3364
3365  document.addEventListener('DOMContentLoaded', function () {
3366    Waves.displayEffect();
3367  }, false);
3368})(window);
3369;(function ($, Vel) {
3370  'use strict';
3371
3372  var _defaults = {
3373    displayLength: Infinity,
3374    inDuration: 300,
3375    outDuration: 375,
3376    className: undefined,
3377    completeCallback: undefined,
3378    activationPercent: 0.8
3379  };
3380
3381  var Toast = function () {
3382    function Toast(message, displayLength, className, completeCallback) {
3383      _classCallCheck(this, Toast);
3384
3385      if (!message) {
3386        return;
3387      }
3388
3389      /**
3390       * Options for the toast
3391       * @member Toast#options
3392       */
3393      this.options = {
3394        displayLength: displayLength,
3395        className: className,
3396        completeCallback: completeCallback
3397      };
3398
3399      this.options = $.extend({}, Toast.defaults, this.options);
3400      this.message = message;
3401
3402      /**
3403       * Describes current pan state toast
3404       * @type {Boolean}
3405       */
3406      this.panning = false;
3407
3408      /**
3409       * Time remaining until toast is removed
3410       */
3411      this.timeRemaining = this.options.displayLength;
3412
3413      if (Toast._toasts.length === 0) {
3414        Toast._createContainer();
3415      }
3416
3417      // Create new toast
3418      Toast._toasts.push(this);
3419      var toastElement = this.createToast();
3420      toastElement.M_Toast = this;
3421      this.el = toastElement;
3422      this._animateIn();
3423      this.setTimer();
3424    }
3425
3426    _createClass(Toast, [{
3427      key: 'createToast',
3428
3429
3430      /**
3431       * Create toast and append it to toast container
3432       */
3433      value: function createToast() {
3434        var toast = document.createElement('div');
3435        toast.classList.add('toast');
3436
3437        // Add custom classes onto toast
3438        if (this.options.className) {
3439          var classes = this.options.className.split(' ');
3440          var i = void 0,
3441              count = void 0;
3442          for (i = 0, count = classes.length; i < count; i++) {
3443            toast.classList.add(classes[i]);
3444          }
3445        }
3446
3447        // Set content
3448        if (typeof HTMLElement === 'object' ? this.message instanceof HTMLElement : this.message && typeof this.message === 'object' && this.message !== null && this.message.nodeType === 1 && typeof this.message.nodeName === 'string') {
3449          toast.appendChild(this.message);
3450
3451          // Check if it is jQuery object
3452        } else if (this.message instanceof jQuery) {
3453          $(toast).append(this.message);
3454
3455          // Insert as text;
3456        } else {
3457          toast.innerHTML = this.message;
3458        }
3459
3460        // Append toasft
3461        Toast._container.appendChild(toast);
3462        return toast;
3463      }
3464
3465      /**
3466       * Animate in toast
3467       */
3468
3469    }, {
3470      key: '_animateIn',
3471      value: function _animateIn() {
3472        // Animate toast in
3473        Vel(this.el, { top: 0, opacity: 1 }, {
3474          duration: 300,
3475          easing: 'easeOutCubic',
3476          queue: false
3477        });
3478      }
3479
3480      /**
3481       * Create setInterval which automatically removes toast when timeRemaining >= 0
3482       * has been reached
3483       */
3484
3485    }, {
3486      key: 'setTimer',
3487      value: function setTimer() {
3488        var _this3 = this;
3489
3490        if (this.timeRemaining !== Infinity) {
3491          this.counterInterval = setInterval(function () {
3492            // If toast is not being dragged, decrease its time remaining
3493            if (!_this3.panning) {
3494              _this3.timeRemaining -= 20;
3495            }
3496
3497            // Animate toast out
3498            if (_this3.timeRemaining <= 0) {
3499              _this3.remove();
3500            }
3501          }, 20);
3502        }
3503      }
3504
3505      /**
3506       * Dismiss toast with animation
3507       */
3508
3509    }, {
3510      key: 'remove',
3511      value: function remove() {
3512        var _this4 = this;
3513
3514        window.clearInterval(this.counterInterval);
3515        var activationDistance = this.el.offsetWidth * this.options.activationPercent;
3516
3517        if (this.wasSwiped) {
3518          this.el.style.transition = 'transform .05s, opacity .05s';
3519          this.el.style.transform = 'translateX(' + activationDistance + 'px)';
3520          this.el.style.opacity = 0;
3521        }
3522
3523        Vel(this.el, { opacity: 0, marginTop: '-40px' }, {
3524          duration: this.options.outDuration,
3525          easing: 'easeOutExpo',
3526          queue: false,
3527          complete: function () {
3528            // Call the optional callback
3529            if (typeof _this4.options.completeCallback === 'function') {
3530              _this4.options.completeCallback();
3531            }
3532            // Remove toast from DOM
3533            _this4.el.parentNode.removeChild(_this4.el);
3534            Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
3535            if (Toast._toasts.length === 0) {
3536              Toast._removeContainer();
3537            }
3538          }
3539        });
3540      }
3541    }], [{
3542      key: '_createContainer',
3543
3544
3545      /**
3546       * Append toast container and add event handlers
3547       */
3548      value: function _createContainer() {
3549        var container = document.createElement('div');
3550        container.setAttribute('id', 'toast-container');
3551
3552        // Add event handler
3553        container.addEventListener('touchstart', Toast._onDragStart);
3554        container.addEventListener('touchmove', Toast._onDragMove);
3555        container.addEventListener('touchend', Toast._onDragEnd);
3556
3557        container.addEventListener('mousedown', Toast._onDragStart);
3558        document.addEventListener('mousemove', Toast._onDragMove);
3559        document.addEventListener('mouseup', Toast._onDragEnd);
3560
3561        document.body.appendChild(container);
3562        Toast._container = container;
3563      }
3564
3565      /**
3566       * Remove toast container and event handlers
3567       */
3568
3569    }, {
3570      key: '_removeContainer',
3571      value: function _removeContainer() {
3572        // Add event handler
3573        document.removeEventListener('mousemove', Toast._onDragMove);
3574        document.removeEventListener('mouseup', Toast._onDragEnd);
3575
3576        Toast._container.parentNode.removeChild(Toast._container);
3577        Toast._container = null;
3578      }
3579
3580      /**
3581       * Begin drag handler
3582       * @param {Event} e
3583       */
3584
3585    }, {
3586      key: '_onDragStart',
3587      value: function _onDragStart(e) {
3588        if (e.target && $(e.target).closest('.toast').length) {
3589          var $toast = $(e.target).closest('.toast');
3590          var toast = $toast[0].M_Toast;
3591          toast.panning = true;
3592          Toast._draggedToast = toast;
3593          toast.el.classList.add('panning');
3594          toast.el.style.transition = '';
3595          toast.startingXPos = Toast._xPos(e);
3596          toast.time = Date.now();
3597          toast.xPos = Toast._xPos(e);
3598        }
3599      }
3600
3601      /**
3602       * Drag move handler
3603       * @param {Event} e
3604       */
3605
3606    }, {
3607      key: '_onDragMove',
3608      value: function _onDragMove(e) {
3609        if (!!Toast._draggedToast) {
3610          e.preventDefault();
3611          var toast = Toast._draggedToast;
3612          toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
3613          toast.xPos = Toast._xPos(e);
3614          toast.velocityX = toast.deltaX / (Date.now() - toast.time);
3615          toast.time = Date.now();
3616
3617          var totalDeltaX = toast.xPos - toast.startingXPos;
3618          var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
3619          toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
3620          toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
3621        }
3622      }
3623
3624      /**
3625       * End drag handler
3626       * @param {Event} e
3627       */
3628
3629    }, {
3630      key: '_onDragEnd',
3631      value: function _onDragEnd(e) {
3632        if (!!Toast._draggedToast) {
3633          var toast = Toast._draggedToast;
3634          toast.panning = false;
3635          toast.el.classList.remove('panning');
3636
3637          var totalDeltaX = toast.xPos - toast.startingXPos;
3638          var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
3639          var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
3640
3641          // Remove toast
3642          if (shouldBeDismissed) {
3643            toast.wasSwiped = true;
3644            toast.remove();
3645
3646            // Animate toast back to original position
3647          } else {
3648            toast.el.style.transition = 'transform .2s, opacity .2s';
3649            toast.el.style.transform = '';
3650            toast.el.style.opacity = '';
3651          }
3652          Toast._draggedToast = null;
3653        }
3654      }
3655
3656      /**
3657       * Get x position of mouse or touch event
3658       * @param {Event} e
3659       */
3660
3661    }, {
3662      key: '_xPos',
3663      value: function _xPos(e) {
3664        if (e.targetTouches && e.targetTouches.length >= 1) {
3665          return e.targetTouches[0].clientX;
3666        }
3667        // mouse event
3668        return e.clientX;
3669      }
3670
3671      /**
3672       * Remove all toasts
3673       */
3674
3675    }, {
3676      key: 'removeAll',
3677      value: function removeAll() {
3678        for (var toastIndex in Toast._toasts) {
3679          Toast._toasts[toastIndex].remove();
3680        }
3681      }
3682    }, {
3683      key: 'defaults',
3684      get: function () {
3685        return _defaults;
3686      }
3687    }]);
3688
3689    return Toast;
3690  }();
3691
3692  /**
3693   * @static
3694   * @memberof Toast
3695   * @type {Array.<Toast>}
3696   */
3697
3698
3699  Toast._toasts = [];
3700
3701  /**
3702   * @static
3703   * @memberof Toast
3704   */
3705  Toast._container = null;
3706
3707  /**
3708   * @static
3709   * @memberof Toast
3710   * @type {Toast}
3711   */
3712  Toast._draggedToast = null;
3713
3714  Materialize.Toast = Toast;
3715  Materialize.toast = function (message, displayLength, className, completeCallback) {
3716    return new Toast(message, displayLength, className, completeCallback);
3717  };
3718})(jQuery, Materialize.Vel);
3719;(function ($) {
3720
3721  var methods = {
3722    init: function (options) {
3723      var defaults = {
3724        menuWidth: 300,
3725        edge: 'left',
3726        closeOnClick: false,
3727        draggable: true,
3728        onOpen: null,
3729        onClose: null
3730      };
3731      options = $.extend(defaults, options);
3732
3733      $(this).each(function () {
3734        var $this = $(this);
3735        var menuId = $this.attr('data-activates');
3736        var menu = $("#" + menuId);
3737
3738        // Set to width
3739        if (options.menuWidth != 300) {
3740          menu.css('width', options.menuWidth);
3741        }
3742
3743        // Add Touch Area
3744        var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
3745        if (options.draggable) {
3746          // Regenerate dragTarget
3747          if ($dragTarget.length) {
3748            $dragTarget.remove();
3749          }
3750
3751          $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
3752          $('body').append($dragTarget);
3753        } else {
3754          $dragTarget = $();
3755        }
3756
3757        if (options.edge == 'left') {
3758          menu.css('transform', 'translateX(-100%)');
3759          $dragTarget.css({ 'left': 0 }); // Add Touch Area
3760        } else {
3761          menu.addClass('right-aligned') // Change text-alignment to right
3762          .css('transform', 'translateX(100%)');
3763          $dragTarget.css({ 'right': 0 }); // Add Touch Area
3764        }
3765
3766        // If fixed sidenav, bring menu out
3767        if (menu.hasClass('fixed')) {
3768          if (window.innerWidth > 992) {
3769            menu.css('transform', 'translateX(0)');
3770          }
3771        }
3772
3773        // Window resize to reset on large screens fixed
3774        if (menu.hasClass('fixed')) {
3775          $(window).resize(function () {
3776            if (window.innerWidth > 992) {
3777              // Close menu if window is resized bigger than 992 and user has fixed sidenav
3778              if ($('#sidenav-overlay').length !== 0 && menuOut) {
3779                removeMenu(true);
3780              } else {
3781                // menu.removeAttr('style');
3782                menu.css('transform', 'translateX(0%)');
3783                // menu.css('width', options.menuWidth);
3784              }
3785            } else if (menuOut === false) {
3786              if (options.edge === 'left') {
3787                menu.css('transform', 'translateX(-100%)');
3788              } else {
3789                menu.css('transform', 'translateX(100%)');
3790              }
3791            }
3792          });
3793        }
3794
3795        // if closeOnClick, then add close event for all a tags in side sideNav
3796        if (options.closeOnClick === true) {
3797          menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
3798            if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
3799              removeMenu();
3800            }
3801          });
3802        }
3803
3804        var removeMenu = function (restoreNav) {
3805          panning = false;
3806          menuOut = false;
3807          // Reenable scrolling
3808          $('body').css({
3809            overflow: '',
3810            width: ''
3811          });
3812
3813          $('#sidenav-overlay').velocity({ opacity: 0 }, { duration: 200,
3814            queue: false, easing: 'easeOutQuad',
3815            complete: function () {
3816              $(this).remove();
3817            } });
3818          if (options.edge === 'left') {
3819            // Reset phantom div
3820            $dragTarget.css({ width: '', right: '', left: '0' });
3821            menu.velocity({ 'translateX': '-100%' }, { duration: 200,
3822              queue: false,
3823              easing: 'easeOutCubic',
3824              complete: function () {
3825                if (restoreNav === true) {
3826                  // Restore Fixed sidenav
3827                  menu.removeAttr('style');
3828                  menu.css('width', options.menuWidth);
3829                }
3830              }
3831
3832            });
3833          } else {
3834            // Reset phantom div
3835            $dragTarget.css({ width: '', right: '0', left: '' });
3836            menu.velocity({ 'translateX': '100%' }, { duration: 200,
3837              queue: false,
3838              easing: 'easeOutCubic',
3839              complete: function () {
3840                if (restoreNav === true) {
3841                  // Restore Fixed sidenav
3842                  menu.removeAttr('style');
3843                  menu.css('width', options.menuWidth);
3844                }
3845              }
3846            });
3847          }
3848
3849          // Callback
3850          if (typeof options.onClose === 'function') {
3851            options.onClose.call(this, menu);
3852          }
3853        };
3854
3855        // Touch Event
3856        var panning = false;
3857        var menuOut = false;
3858
3859        if (options.draggable) {
3860          $dragTarget.on('click', function () {
3861            if (menuOut) {
3862              removeMenu();
3863            }
3864          });
3865
3866          $dragTarget.hammer({
3867            prevent_default: false
3868          }).on('pan', function (e) {
3869
3870            if (e.gesture.pointerType == "touch") {
3871
3872              var direction = e.gesture.direction;
3873              var x = e.gesture.center.x;
3874              var y = e.gesture.center.y;
3875              var velocityX = e.gesture.velocityX;
3876
3877              // Vertical scroll bugfix
3878              if (x === 0 && y === 0) {
3879                return;
3880              }
3881
3882              // Disable Scrolling
3883              var $body = $('body');
3884              var $overlay = $('#sidenav-overlay');
3885              var oldWidth = $body.innerWidth();
3886              $body.css('overflow', 'hidden');
3887              $body.width(oldWidth);
3888
3889              // If overlay does not exist, create one and if it is clicked, close menu
3890              if ($overlay.length === 0) {
3891                $overlay = $('<div id="sidenav-overlay"></div>');
3892                $overlay.css('opacity', 0).click(function () {
3893                  removeMenu();
3894                });
3895
3896                // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
3897                if (typeof options.onOpen === 'function') {
3898                  options.onOpen.call(this, menu);
3899                }
3900
3901                $('body').append($overlay);
3902              }
3903
3904              // Keep within boundaries
3905              if (options.edge === 'left') {
3906                if (x > options.menuWidth) {
3907                  x = options.menuWidth;
3908                } else if (x < 0) {
3909                  x = 0;
3910                }
3911              }
3912
3913              if (options.edge === 'left') {
3914                // Left Direction
3915                if (x < options.menuWidth / 2) {
3916                  menuOut = false;
3917                }
3918                // Right Direction
3919                else if (x >= options.menuWidth / 2) {
3920                    menuOut = true;
3921                  }
3922                menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
3923              } else {
3924                // Left Direction
3925                if (x < window.innerWidth - options.menuWidth / 2) {
3926                  menuOut = true;
3927                }
3928                // Right Direction
3929                else if (x >= window.innerWidth - options.menuWidth / 2) {
3930                    menuOut = false;
3931                  }
3932                var rightPos = x - options.menuWidth / 2;
3933                if (rightPos < 0) {
3934                  rightPos = 0;
3935                }
3936
3937                menu.css('transform', 'translateX(' + rightPos + 'px)');
3938              }
3939
3940              // Percentage overlay
3941              var overlayPerc;
3942              if (options.edge === 'left') {
3943                overlayPerc = x / options.menuWidth;
3944                $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
3945              } else {
3946                overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
3947                $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
3948              }
3949            }
3950          }).on('panend', function (e) {
3951
3952            if (e.gesture.pointerType == "touch") {
3953              var $overlay = $('#sidenav-overlay');
3954              var velocityX = e.gesture.velocityX;
3955              var x = e.gesture.center.x;
3956              var leftPos = x - options.menuWidth;
3957              var rightPos = x - options.menuWidth / 2;
3958              if (leftPos > 0) {
3959                leftPos = 0;
3960              }
3961              if (rightPos < 0) {
3962                rightPos = 0;
3963              }
3964              panning = false;
3965
3966              if (options.edge === 'left') {
3967                // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
3968                if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
3969                  // Return menu to open
3970                  if (leftPos !== 0) {
3971                    menu.velocity({ 'translateX': [0, leftPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
3972                  }
3973
3974                  $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
3975                  $dragTarget.css({ width: '50%', right: 0, left: '' });
3976                  menuOut = true;
3977                } else if (!menuOut || velocityX > 0.3) {
3978                  // Enable Scrolling
3979                  $('body').css({
3980                    overflow: '',
3981                    width: ''
3982                  });
3983                  // Slide menu closed
3984                  menu.velocity({ 'translateX': [-1 * options.menuWidth - 10, leftPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
3985                  $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
3986                    complete: function () {
3987                      // Run 'onClose' when sidenav is closed via touch/swipe if applicable
3988                      if (typeof options.onClose === 'function') {
3989                        options.onClose.call(this, menu);
3990                      }
3991
3992                      $(this).remove();
3993                    } });
3994                  $dragTarget.css({ width: '10px', right: '', left: 0 });
3995                }
3996              } else {
3997                if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
3998                  // Return menu to open
3999                  if (rightPos !== 0) {
4000                    menu.velocity({ 'translateX': [0, rightPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4001                  }
4002
4003                  $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
4004                  $dragTarget.css({ width: '50%', right: '', left: 0 });
4005                  menuOut = true;
4006                } else if (!menuOut || velocityX < -0.3) {
4007                  // Enable Scrolling
4008                  $('body').css({
4009                    overflow: '',
4010                    width: ''
4011                  });
4012
4013                  // Slide menu closed
4014                  menu.velocity({ 'translateX': [options.menuWidth + 10, rightPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
4015                  $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
4016                    complete: function () {
4017                      // Run 'onClose' when sidenav is closed via touch/swipe if applicable
4018                      if (typeof options.onClose === 'function') {
4019                        options.onClose.call(this, menu);
4020                      }
4021
4022                      $(this).remove();
4023                    } });
4024                  $dragTarget.css({ width: '10px', right: 0, left: '' });
4025                }
4026              }
4027            }
4028          });
4029        }
4030
4031        $this.off('click.sidenav').on('click.sidenav', function () {
4032          if (menuOut === true) {
4033            menuOut = false;
4034            panning = false;
4035            removeMenu();
4036          } else {
4037
4038            // Disable Scrolling
4039            var $body = $('body');
4040            var $overlay = $('<div id="sidenav-overlay"></div>');
4041            var oldWidth = $body.innerWidth();
4042            $body.css('overflow', 'hidden');
4043            $body.width(oldWidth);
4044
4045            // Push current drag target on top of DOM tree
4046            $('body').append($dragTarget);
4047
4048            if (options.edge === 'left') {
4049              $dragTarget.css({ width: '50%', right: 0, left: '' });
4050              menu.velocity({ 'translateX': [0, -1 * options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4051            } else {
4052              $dragTarget.css({ width: '50%', right: '', left: 0 });
4053              menu.velocity({ 'translateX': [0, options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4054            }
4055
4056            // Overlay close on click
4057            $overlay.css('opacity', 0).click(function () {
4058              menuOut = false;
4059              panning = false;
4060              removeMenu();
4061              $overlay.velocity({ opacity: 0 }, { duration: 300, queue: false, easing: 'easeOutQuad',
4062                complete: function () {
4063                  $(this).remove();
4064                }
4065              });
4066            });
4067
4068            // Append body
4069            $('body').append($overlay);
4070            $overlay.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeOutQuad',
4071              complete: function () {
4072                menuOut = true;
4073                panning = false;
4074              }
4075            });
4076
4077            // Callback
4078            if (typeof options.onOpen === 'function') {
4079              options.onOpen.call(this, menu);
4080            }
4081          }
4082
4083          return false;
4084        });
4085      });
4086    },
4087    destroy: function () {
4088      var $overlay = $('#sidenav-overlay');
4089      var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
4090      $overlay.trigger('click');
4091      $dragTarget.remove();
4092      $(this).off('click');
4093      $overlay.remove();
4094    },
4095    show: function () {
4096      this.trigger('click');
4097    },
4098    hide: function () {
4099      $('#sidenav-overlay').trigger('click');
4100    }
4101  };
4102
4103  $.fn.sideNav = function (methodOrOptions) {
4104    if (methods[methodOrOptions]) {
4105      return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
4106    } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
4107      // Default to "init"
4108      return methods.init.apply(this, arguments);
4109    } else {
4110      $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
4111    }
4112  }; // Plugin end
4113})(jQuery);
4114; /**
4115  * Extend jquery with a scrollspy plugin.
4116  * This watches the window scroll and fires events when elements are scrolled into viewport.
4117  *
4118  * throttle() and getTime() taken from Underscore.js
4119  * https://github.com/jashkenas/underscore
4120  *
4121  * @author Copyright 2013 John Smart
4122  * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
4123  * @see https://github.com/thesmart
4124  * @version 0.1.2
4125  */
4126(function ($) {
4127
4128  var jWindow = $(window);
4129  var elements = [];
4130  var elementsInView = [];
4131  var isSpying = false;
4132  var ticks = 0;
4133  var unique_id = 1;
4134  var offset = {
4135    top: 0,
4136    right: 0,
4137    bottom: 0,
4138    left: 0
4139
4140    /**
4141     * Find elements that are within the boundary
4142     * @param {number} top
4143     * @param {number} right
4144     * @param {number} bottom
4145     * @param {number} left
4146     * @return {jQuery}		A collection of elements
4147     */
4148  };function findElements(top, right, bottom, left) {
4149    var hits = $();
4150    $.each(elements, function (i, element) {
4151      if (element.height() > 0) {
4152        var elTop = element.offset().top,
4153            elLeft = element.offset().left,
4154            elRight = elLeft + element.width(),
4155            elBottom = elTop + element.height();
4156
4157        var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
4158
4159        if (isIntersect) {
4160          hits.push(element);
4161        }
4162      }
4163    });
4164
4165    return hits;
4166  }
4167
4168  /**
4169   * Called when the user scrolls the window
4170   */
4171  function onScroll(scrollOffset) {
4172    // unique tick id
4173    ++ticks;
4174
4175    // viewport rectangle
4176    var top = jWindow.scrollTop(),
4177        left = jWindow.scrollLeft(),
4178        right = left + jWindow.width(),
4179        bottom = top + jWindow.height();
4180
4181    // determine which elements are in view
4182    var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
4183    $.each(intersections, function (i, element) {
4184
4185      var lastTick = element.data('scrollSpy:ticks');
4186      if (typeof lastTick != 'number') {
4187        // entered into view
4188        element.triggerHandler('scrollSpy:enter');
4189      }
4190
4191      // update tick id
4192      element.data('scrollSpy:ticks', ticks);
4193    });
4194
4195    // determine which elements are no longer in view
4196    $.each(elementsInView, function (i, element) {
4197      var lastTick = element.data('scrollSpy:ticks');
4198      if (typeof lastTick == 'number' && lastTick !== ticks) {
4199        // exited from view
4200        element.triggerHandler('scrollSpy:exit');
4201        element.data('scrollSpy:ticks', null);
4202      }
4203    });
4204
4205    // remember elements in view for next tick
4206    elementsInView = intersections;
4207  }
4208
4209  /**
4210   * Called when window is resized
4211  */
4212  function onWinSize() {
4213    jWindow.trigger('scrollSpy:winSize');
4214  }
4215
4216  /**
4217   * Enables ScrollSpy using a selector
4218   * @param {jQuery|string} selector  The elements collection, or a selector
4219   * @param {Object=} options	Optional.
4220         throttle : number -> scrollspy throttling. Default: 100 ms
4221         offsetTop : number -> offset from top. Default: 0
4222         offsetRight : number -> offset from right. Default: 0
4223         offsetBottom : number -> offset from bottom. Default: 0
4224         offsetLeft : number -> offset from left. Default: 0
4225  			activeClass : string -> Class name to be added to the active link. Default: active
4226   * @returns {jQuery}
4227   */
4228  $.scrollSpy = function (selector, options) {
4229    var defaults = {
4230      throttle: 100,
4231      scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
4232      activeClass: 'active',
4233      getActiveElement: function (id) {
4234        return 'a[href="#' + id + '"]';
4235      }
4236    };
4237    options = $.extend(defaults, options);
4238
4239    var visible = [];
4240    selector = $(selector);
4241    selector.each(function (i, element) {
4242      elements.push($(element));
4243      $(element).data("scrollSpy:id", i);
4244      // Smooth scroll to section
4245      $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
4246        e.preventDefault();
4247        var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
4248        $('html, body').animate({ scrollTop: offset - options.scrollOffset }, { duration: 400, queue: false, easing: 'easeOutCubic' });
4249      });
4250    });
4251
4252    offset.top = options.offsetTop || 0;
4253    offset.right = options.offsetRight || 0;
4254    offset.bottom = options.offsetBottom || 0;
4255    offset.left = options.offsetLeft || 0;
4256
4257    var throttledScroll = Materialize.throttle(function () {
4258      onScroll(options.scrollOffset);
4259    }, options.throttle || 100);
4260    var readyScroll = function () {
4261      $(document).ready(throttledScroll);
4262    };
4263
4264    if (!isSpying) {
4265      jWindow.on('scroll', readyScroll);
4266      jWindow.on('resize', readyScroll);
4267      isSpying = true;
4268    }
4269
4270    // perform a scan once, after current execution context, and after dom is ready
4271    setTimeout(readyScroll, 0);
4272
4273    selector.on('scrollSpy:enter', function () {
4274      visible = $.grep(visible, function (value) {
4275        return value.height() != 0;
4276      });
4277
4278      var $this = $(this);
4279
4280      if (visible[0]) {
4281        $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
4282        if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
4283          visible.unshift($(this));
4284        } else {
4285          visible.push($(this));
4286        }
4287      } else {
4288        visible.push($(this));
4289      }
4290
4291      $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
4292    });
4293    selector.on('scrollSpy:exit', function () {
4294      visible = $.grep(visible, function (value) {
4295        return value.height() != 0;
4296      });
4297
4298      if (visible[0]) {
4299        $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
4300        var $this = $(this);
4301        visible = $.grep(visible, function (value) {
4302          return value.attr('id') != $this.attr('id');
4303        });
4304        if (visible[0]) {
4305          // Check if empty
4306          $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
4307        }
4308      }
4309    });
4310
4311    return selector;
4312  };
4313
4314  /**
4315   * Listen for window resize events
4316   * @param {Object=} options						Optional. Set { throttle: number } to change throttling. Default: 100 ms
4317   * @returns {jQuery}		$(window)
4318   */
4319  $.winSizeSpy = function (options) {
4320    $.winSizeSpy = function () {
4321      return jWindow;
4322    }; // lock from multiple calls
4323    options = options || {
4324      throttle: 100
4325    };
4326    return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
4327  };
4328
4329  /**
4330   * Enables ScrollSpy on a collection of elements
4331   * e.g. $('.scrollSpy').scrollSpy()
4332   * @param {Object=} options	Optional.
4333  										throttle : number -> scrollspy throttling. Default: 100 ms
4334  										offsetTop : number -> offset from top. Default: 0
4335  										offsetRight : number -> offset from right. Default: 0
4336  										offsetBottom : number -> offset from bottom. Default: 0
4337  										offsetLeft : number -> offset from left. Default: 0
4338   * @returns {jQuery}
4339   */
4340  $.fn.scrollSpy = function (options) {
4341    return $.scrollSpy($(this), options);
4342  };
4343})(jQuery);
4344;(function ($) {
4345  $(document).ready(function () {
4346
4347    // Function to update labels of text fields
4348    Materialize.updateTextFields = function () {
4349      var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
4350      $(input_selector).each(function (index, element) {
4351        var $this = $(this);
4352        if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
4353          $this.siblings('label').addClass('active');
4354        } else if ($(element)[0].validity) {
4355          $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
4356        } else {
4357          $this.siblings('label').removeClass('active');
4358        }
4359      });
4360    };
4361
4362    // Text based inputs
4363    var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
4364
4365    // Add active if form auto complete
4366    $(document).on('change', input_selector, function () {
4367      if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
4368        $(this).siblings('label').addClass('active');
4369      }
4370      validate_field($(this));
4371    });
4372
4373    // Add active if input element has been pre-populated on document ready
4374    $(document).ready(function () {
4375      Materialize.updateTextFields();
4376    });
4377
4378    // HTML DOM FORM RESET handling
4379    $(document).on('reset', function (e) {
4380      var formReset = $(e.target);
4381      if (formReset.is('form')) {
4382        formReset.find(input_selector).removeClass('valid').removeClass('invalid');
4383        formReset.find(input_selector).each(function () {
4384          if ($(this).attr('value') === '') {
4385            $(this).siblings('label').removeClass('active');
4386          }
4387        });
4388
4389        // Reset select
4390        formReset.find('select.initialized').each(function () {
4391          var reset_text = formReset.find('option[selected]').text();
4392          formReset.siblings('input.select-dropdown').val(reset_text);
4393        });
4394      }
4395    });
4396
4397    // Add active when element has focus
4398    $(document).on('focus', input_selector, function () {
4399      $(this).siblings('label, .prefix').addClass('active');
4400    });
4401
4402    $(document).on('blur', input_selector, function () {
4403      var $inputElement = $(this);
4404      var selector = ".prefix";
4405
4406      if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
4407        selector += ", label";
4408      }
4409
4410      $inputElement.siblings(selector).removeClass('active');
4411
4412      validate_field($inputElement);
4413    });
4414
4415    window.validate_field = function (object) {
4416      var hasLength = object.attr('data-length') !== undefined;
4417      var lenAttr = parseInt(object.attr('data-length'));
4418      var len = object.val().length;
4419
4420      if (object.val().length === 0 && object[0].validity.badInput === false && !
4420object.is(':required')) {
4421        if (object.hasClass('validate')) {
4422          object.removeClass('valid');
4423          object.removeClass('invalid');
4424        }
4425      } else {
4426        if (object.hasClass('validate')) {
4427          // Check for character counter attributes
4428          if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
4429            object.removeClass('invalid');
4430            object.addClass('valid');
4431          } else {
4432            object.removeClass('valid');
4433            object.addClass('invalid');
4434          }
4435        }
4436      }
4437    };
4438
4439    // Radio and Checkbox focus class
4440    var radio_checkbox = 'input[type=radio], input[type=checkbox]';
4441    $(document).on('keyup.radio', radio_checkbox, function (e) {
4442      // TAB, check if tabbing to radio or checkbox.
4443      if (e.which === 9) {
4444        $(this).addClass('tabbed');
4445        var $this = $(this);
4446        $this.one('blur', function (e) {
4447
4448          $(this).removeClass('tabbed');
4449        });
4450        return;
4451      }
4452    });
4453
4454    // Textarea Auto Resize
4455    var hiddenDiv = $('.hiddendiv').first();
4456    if (!hiddenDiv.length) {
4457      hiddenDiv = $('<div class="hiddendiv common"></div>');
4458      $('body').append(hiddenDiv);
4459    }
4460    var text_area_selector = '.materialize-textarea';
4461
4462    function textareaAutoResize($textarea) {
4463      // Set font properties of hiddenDiv
4464
4465      var fontFamily = $textarea.css('font-family');
4466      var fontSize = $textarea.css('font-size');
4467      var lineHeight = $textarea.css('line-height');
4468      var padding = $textarea.css('padding');
4469
4470      if (fontSize) {
4471        hiddenDiv.css('font-size', fontSize);
4472      }
4473      if (fontFamily) {
4474        hiddenDiv.css('font-family', fontFamily);
4475      }
4476      if (lineHeight) {
4477        hiddenDiv.css('line-height', lineHeight);
4478      }
4479      if (padding) {
4480        hiddenDiv.css('padding', padding);
4481      }
4482
4483      // Set original-height, if none
4484      if (!$textarea.data('original-height')) {
4485        $textarea.data('original-height', $textarea.height());
4486      }
4487
4488      if ($textarea.attr('wrap') === 'off') {
4489        hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
4490      }
4491
4492      hiddenDiv.text($textarea.val() + '\n');
4493      var content = hiddenDiv.html().replace(/\n/g, '<br>');
4494      hiddenDiv.html(content);
4495
4496      // When textarea is hidden, width goes crazy.
4497      // Approximate with half of window size
4498
4499      if ($textarea.is(':visible')) {
4500        hiddenDiv.css('width', $textarea.width());
4501      } else {
4502        hiddenDiv.css('width', $(window).width() / 2);
4503      }
4504
4505      /**
4506       * Resize if the new height is greater than the
4507       * original height of the textarea
4508       */
4509      if ($textarea.data('original-height') <= hiddenDiv.height()) {
4510        $textarea.css('height', hiddenDiv.height());
4511      } else if ($textarea.val().length < $textarea.data('previous-length')) {
4512        /**
4513         * In case the new height is less than original height, it
4514         * means the textarea has less text than before
4515         * So we set the height to the original one
4516         */
4517        $textarea.css('height', $textarea.data('original-height'));
4518      }
4519      $textarea.data('previous-length', $textarea.val().length);
4520    }
4521
4522    $(text_area_selector).each(function () {
4523      var $textarea = $(this);
4524      /**
4525       * Instead of resizing textarea on document load,
4526       * store the original height and the original length
4527       */
4528      $textarea.data('original-height', $textarea.height());
4529      $textarea.data('previous-length', $textarea.val().length);
4530    });
4531
4532    $('body').on('keyup keydown autoresize', text_area_selector, function () {
4533      textareaAutoResize($(this));
4534    });
4535
4536    // File Input Path
4537    $(document).on('change', '.file-field input[type="file"]', function () {
4538      var file_field = $(this).closest('.file-field');
4539      var path_input = file_field.find('input.file-path');
4540      var files = $(this)[0].files;
4541      var file_names = [];
4542      for (var i = 0; i < files.length; i++) {
4543        file_names.push(files[i].name);
4544      }
4545      path_input.val(file_names.join(", "));
4546      path_input.trigger('change');
4547    });
4548
4549    /****************
4550    *  Range Input  *
4551    ****************/
4552
4553    var range_type = 'input[type=range]';
4554    var range_mousedown = false;
4555    var left;
4556
4557    $(range_type).each(function () {
4558      var thumb = $('<span class="thumb"><span class="value"></span></span>');
4559      $(this).after(thumb);
4560    });
4561
4562    var showRangeBubble = function (thumb) {
4563      var paddingLeft = parseInt(thumb.parent().css('padding-left'));
4564      var marginLeft = -7 + paddingLeft + 'px';
4565      thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginLeft: marginLeft }, { duration: 300, easing: 'easeOutExpo' });
4566    };
4567
4568    var calcRangeOffset = function (range) {
4569      var width = range.width() - 15;
4570      var max = parseFloat(range.attr('max'));
4571      var min = parseFloat(range.attr('min'));
4572      var percent = (parseFloat(range.val()) - min) / (max - min);
4573      return percent * width;
4574    };
4575
4576    var range_wrapper = '.range-field';
4577    $(document).on('change', range_type, function (e) {
4578      var thumb = $(this).siblings('.thumb');
4579      thumb.find('.value').html($(this).val());
4580
4581      if (!thumb.hasClass('active')) {
4582        showRangeBubble(thumb);
4583      }
4584
4585      var offsetLeft = calcRangeOffset($(this));
4586      thumb.addClass('active').css('left', offsetLeft);
4587    });
4588
4589    $(document).on('mousedown touchstart', range_type, function (e) {
4590      var thumb = $(this).siblings('.thumb');
4591
4592      // If thumb indicator does not exist yet, create it
4593      if (thumb.length <= 0) {
4594        thumb = $('<span class="thumb"><span class="value"></span></span>');
4595        $(this).after(thumb);
4596      }
4597
4598      // Set indicator value
4599      thumb.find('.value').html($(this).val());
4600
4601      range_mousedown = true;
4602      $(this).addClass('active');
4603
4604      if (!thumb.hasClass('active')) {
4605        showRangeBubble(thumb);
4606      }
4607
4608      if (e.type !== 'input') {
4609        var offsetLeft = calcRangeOffset($(this));
4610        thumb.addClass('active').css('left', offsetLeft);
4611      }
4612    });
4613
4614    $(document).on('mouseup touchend', range_wrapper, function () {
4615      range_mousedown = false;
4616      $(this).removeClass('active');
4617    });
4618
4619    $(document).on('input mousemove touchmove', range_wrapper, function (e) {
4620      var thumb = $(this).children('.thumb');
4621      var left;
4622      var input = $(this).find(range_type);
4623
4624      if (range_mousedown) {
4625        if (!thumb.hasClass('active')) {
4626          showRangeBubble(thumb);
4627        }
4628
4629        var offsetLeft = calcRangeOffset(input);
4630        thumb.addClass('active').css('left', offsetLeft);
4631        thumb.find('.value').html(thumb.siblings(range_type).val());
4632      }
4633    });
4634
4635    $(document).on('mouseout touchleave', range_wrapper, function () {
4636      if (!range_mousedown) {
4637
4638        var thumb = $(this).children('.thumb');
4639        var paddingLeft = parseInt($(this).css('padding-left'));
4640        var marginLeft = 7 + paddingLeft + 'px';
4641
4642        if (thumb.hasClass('active')) {
4643          thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: marginLeft }, { duration: 100 });
4644        }
4645        thumb.removeClass('active');
4646      }
4647    });
4648
4649    /**************************
4650     * Auto complete plugin  *
4651     *************************/
4652    $.fn.autocomplete = function (options) {
4653      // Defaults
4654      var defaults = {
4655        data: {},
4656        limit: Infinity,
4657        onAutocomplete: null,
4658        minLength: 1
4659      };
4660
4661      options = $.extend(defaults, options);
4662
4663      return this.each(function () {
4664        var $input = $(this);
4665        var data = options.data,
4666            count = 0,
4667            activeIndex = -1,
4668            oldVal,
4669            $inputDiv = $input.closest('.input-field'); // Div to append on
4670
4671        // Check if data isn't empty
4672        if (!$.isEmptyObject(data)) {
4673          var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
4674          var $oldAutocomplete;
4675
4676          // Append autocomplete element.
4677          // Prevent double structure init.
4678          if ($inputDiv.length) {
4679            $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
4680            if (!$oldAutocomplete.length) {
4681              $inputDiv.append($autocomplete); // Set ul in body
4682            }
4683          } else {
4684            $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
4685            if (!$oldAutocomplete.length) {
4686              $input.after($autocomplete);
4687            }
4688          }
4689          if ($oldAutocomplete.length) {
4690            $autocomplete = $oldAutocomplete;
4691          }
4692
4693          // Highlight partial match.
4694          var highlight = function (string, $el) {
4695            var img = $el.find('img');
4696            var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
4697                matchEnd = matchStart + string.length - 1,
4698                beforeMatch = $el.text().slice(0, matchStart),
4699                matchText = $el.text().slice(matchStart, matchEnd + 1),
4700                afterMatch = $el.text().slice(matchEnd + 1);
4701            $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
4702            if (img.length) {
4703              $el.prepend(img);
4704            }
4705          };
4706
4707          // Reset current element position
4708          var resetCurrentElement = function () {
4709            activeIndex = -1;
4710            $autocomplete.find('.active').removeClass('active');
4711          };
4712
4713          // Remove autocomplete elements
4714          var removeAutocomplete = function () {
4715            $autocomplete.empty();
4716            resetCurrentElement();
4717            oldVal = undefined;
4718          };
4719
4720          $input.off('blur.autocomplete').on('blur.autocomplete', function () {
4721            removeAutocomplete();
4722          });
4723
4724          // Perform search
4725          $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
4726            // Reset count.
4727            count = 0;
4728            var val = $input.val().toLowerCase();
4729
4730            // Don't capture enter or arrow key usage.
4731            if (e.which === 13 || e.which === 38 || e.which === 40) {
4732              return;
4733            }
4734
4735            // Check if the input isn't empty
4736            if (oldVal !== val) {
4737              removeAutocomplete();
4738
4739              if (val.length >= options.minLength) {
4740                for (var key in data) {
4741                  if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
4742                    // Break if past limit
4743                    if (count >= options.limit) {
4744                      break;
4745                    }
4746
4747                    var autocompleteOption = $('<li></li>');
4748                    if (!!data[key]) {
4749                      autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
4750                    } else {
4751                      autocompleteOption.append('<span>' + key + '</span>');
4752                    }
4753
4754                    $autocomplete.append(autocompleteOption);
4755                    highlight(val, autocompleteOption);
4756                    count++;
4757                  }
4758                }
4759              }
4760            }
4761
4762            // Update oldVal
4763            oldVal = val;
4764          });
4765
4766          $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
4767            // Arrow keys and enter key usage
4768            var keyCode = e.which,
4769                liElement,
4770                numItems = $autocomplete.children('li').length,
4771                $active = $autocomplete.children('.active').first();
4772
4773            // select element on Enter
4774            if (keyCode === 13 && activeIndex >= 0) {
4775              liElement = $autocomplete.children('li').eq(activeIndex);
4776              if (liElement.length) {
4777                liElement.trigger('mousedown.autocomplete');
4778                e.preventDefault();
4779              }
4780              return;
4781            }
4782
4783            // Capture up and down key
4784            if (keyCode === 38 || keyCode === 40) {
4785              e.preventDefault();
4786
4787              if (keyCode === 38 && activeIndex > 0) {
4788                activeIndex--;
4789              }
4790
4791              if (keyCode === 40 && activeIndex < numItems - 1) {
4792                activeIndex++;
4793              }
4794
4795              $active.removeClass('active');
4796              if (activeIndex >= 0) {
4797                $autocomplete.children('li').eq(activeIndex).addClass('active');
4798              }
4799            }
4800          });
4801
4802          // Set input value
4803          $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
4804            var text = $(this).text().trim();
4805            $input.val(text);
4806            $input.trigger('change');
4807            removeAutocomplete();
4808
4809            // Handle onAutocomplete callback.
4810            if (typeof options.onAutocomplete === "function") {
4811              options.onAutocomplete.call(this, text);
4812            }
4813          });
4814
4815          // Empty data
4816        } else {
4817          $input.off('keyup.autocomplete focus.autocomplete');
4818        }
4819      });
4820    };
4821  }); // End of $(document).ready
4822
4823  /*******************
4824   *  Select Plugin  *
4825   ******************/
4826  $.fn.material_select = function (callback) {
4827    $(this).each(function () {
4828      var $select = $(this);
4829
4830      if ($select.hasClass('browser-default')) {
4831        return; // Continue to next (return false breaks out of entire loop)
4832      }
4833
4834      var multiple = $select.attr('multiple') ? true : false,
4835          lastID = $select.attr('data-select-id'); // Tear down structure if Select needs to be rebuilt
4836
4837      if (lastID) {
4838        $select.parent().find('span.caret').remove();
4839        $select.parent().find('input').remove();
4840
4841        $select.unwrap();
4842        $('ul#select-options-' + lastID).remove();
4843      }
4844
4845      // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
4846      if (callback === 'destroy') {
4847        $select.removeAttr('data-select-id').removeClass('initialized');
4848        $(window).off('click.select');
4849        return;
4850      }
4851
4852      var uniqueID = Materialize.guid();
4853      $select.attr('data-select-id', uniqueID);
4854      var wrapper = $('<div class="select-wrapper"></div>');
4855      wrapper.addClass($select.attr('class'));
4856      if ($select.is(':disabled')) wrapper.addClass('disabled');
4857      var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
4858          selectChildren = $select.children('option, optgroup'),
4859          valuesSelected = [],
4860          optionsHover = false;
4861
4862      var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
4863
4864      // Function that renders and appends the option taking into
4865      // account type and possible image icon.
4866      var appendOptionWithIcon = function (select, option, type) {
4867        // Add disabled attr if disabled
4868        var disabledClass = option.is(':disabled') ? 'disabled ' : '';
4869        var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
4870        var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
4871
4872        // add icons
4873        var icon_url = option.data('icon');
4874        var classes = option.attr('class');
4875        if (!!icon_url) {
4876          var classString = '';
4877          if (!!classes) classString = ' class="' + classes + '"';
4878
4879          // Check for multiple type.
4880          options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
4881          return true;
4882        }
4883
4884        // Check for multiple type.
4885        options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
4886      };
4887
4888      /* Create dropdown structure. */
4889      if (selectChildren.length) {
4890        selectChildren.each(function () {
4891          if ($(this).is('option')) {
4892            // Direct descendant option.
4893            if (multiple) {
4894              appendOptionWithIcon($select, $(this), 'multiple');
4895            } else {
4896              appendOptionWithIcon($select, $(this));
4897            }
4898          } else if ($(this).is('optgroup')) {
4899            // Optgroup.
4900            var selectOptions = $(this).children('option');
4901            options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
4902
4903            selectOptions.each(function () {
4904              appendOptionWithIcon($select, $(this), 'optgroup-option');
4905            });
4906          }
4907        });
4908      }
4909
4910      options.find('li:not(.optgroup)').each(function (i) {
4911        $(this).click(function (e) {
4912          // Check if option element is disabled
4913          if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
4914            var selected = true;
4915
4916            if (multiple) {
4917              $('input[type="checkbox"]', this).prop('checked', function (i, v) {
4918                return !v;
4919              });
4920              selected = toggleEntryFromArray(valuesSelected, i, $select);
4921              $newSelect.trigger('focus');
4922            } else {
4923              options.find('li').removeClass('active');
4924              $(this).toggleClass('active');
4925              $newSelect.val($(this).text());
4926            }
4927
4928            activateOption(options, $(this));
4929            $select.find('option').eq(i).prop('selected', selected);
4930            // Trigger onchange() event
4931            $select.trigger('change');
4932            if (typeof callback !== 'undefined') callback();
4933          }
4934
4935          e.stopPropagation();
4936        });
4937      });
4938
4939      // Wrap Elements
4940      $select.wrap(wrapper);
4941      // Add Select Display Element
4942      var dropdownIcon = $('<span class="caret">&#9660;</span>');
4943
4944      // escape double quotes
4945      var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
4946
4947      var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + s
4947anitizedLabelHtml + '"/>');
4948      $select.before($newSelect);
4949      $newSelect.before(dropdownIcon);
4950
4951      $newSelect.after(options);
4952      // Check if section element is disabled
4953      if (!$select.is(':disabled')) {
4954        $newSelect.dropdown({ 'hover': false });
4955      }
4956
4957      // Copy tabindex
4958      if ($select.attr('tabindex')) {
4959        $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
4960      }
4961
4962      $select.addClass('initialized');
4963
4964      $newSelect.on({
4965        'focus': function () {
4966          if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
4967            $('input.select-dropdown').trigger('close');
4968            $(window).off('click.select');
4969          }
4970          if (!options.is(':visible')) {
4971            $(this).trigger('open', ['focus']);
4972            var label = $(this).val();
4973            if (multiple && label.indexOf(',') >= 0) {
4974              label = label.split(',')[0];
4975            }
4976
4977            var selectedOption = options.find('li').filter(function () {
4978              return $(this).text().toLowerCase() === label.toLowerCase();
4979            })[0];
4980            activateOption(options, selectedOption, true);
4981
4982            $(window).off('click.select').on('click.select', function () {
4983              multiple && (optionsHover || $newSelect.trigger('close'));
4984              $(window).off('click.select');
4985            });
4986          }
4987        },
4988        'click': function (e) {
4989          e.stopPropagation();
4990        }
4991      });
4992
4993      $newSelect.on('blur', function () {
4994        if (!multiple) {
4995          $(this).trigger('close');
4996          $(window).off('click.select');
4997        }
4998        options.find('li.selected').removeClass('selected');
4999      });
5000
5001      options.hover(function () {
5002        optionsHover = true;
5003      }, function () {
5004        optionsHover = false;
5005      });
5006
5007      // Add initial multiple selections.
5008      if (multiple) {
5009        $select.find("option:selected:not(:disabled)").each(function () {
5010          var index = this.index;
5011
5012          toggleEntryFromArray(valuesSelected, index, $select);
5013          options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
5014        });
5015      }
5016
5017      /**
5018       * Make option as selected and scroll to selected position
5019       * @param {jQuery} collection  Select options jQuery element
5020       * @param {Element} newOption  element of the new option
5021       * @param {Boolean} firstActivation  If on first activation of select
5022       */
5023      var activateOption = function (collection, newOption, firstActivation) {
5024        if (newOption) {
5025          collection.find('li.selected').removeClass('selected');
5026          var option = $(newOption);
5027          option.addClass('selected');
5028          if (!multiple || !!firstActivation) {
5029            options.scrollTo(option);
5030          }
5031        }
5032      };
5033
5034      // Allow user to search by typing
5035      // this array is cleared after 1 second
5036      var filterQuery = [],
5037          onKeyDown = function (e) {
5038        // TAB - switch to another input
5039        if (e.which == 9) {
5040          $newSelect.trigger('close');
5041          return;
5042        }
5043
5044        // ARROW DOWN WHEN SELECT IS CLOSED - open select options
5045        if (e.which == 40 && !options.is(':visible')) {
5046          $newSelect.trigger('open');
5047          return;
5048        }
5049
5050        // ENTER WHEN SELECT IS CLOSED - submit form
5051        if (e.which == 13 && !options.is(':visible')) {
5052          return;
5053        }
5054
5055        e.preventDefault();
5056
5057        // CASE WHEN USER TYPE LETTERS
5058        var letter = String.fromCharCode(e.which).toLowerCase(),
5059            nonLetters = [9, 13, 27, 38, 40];
5060        if (letter && nonLetters.indexOf(e.which) === -1) {
5061          filterQuery.push(letter);
5062
5063          var string = filterQuery.join(''),
5064              newOption = options.find('li').filter(function () {
5065            return $(this).text().toLowerCase().indexOf(string) === 0;
5066          })[0];
5067
5068          if (newOption) {
5069            activateOption(options, newOption);
5070          }
5071        }
5072
5073        // ENTER - select option and close when select options are opened
5074        if (e.which == 13) {
5075          var activeOption = options.find('li.selected:not(.disabled)')[0];
5076          if (activeOption) {
5077            $(activeOption).trigger('click');
5078            if (!multiple) {
5079              $newSelect.trigger('close');
5080            }
5081          }
5082        }
5083
5084        // ARROW DOWN - move to next not disabled option
5085        if (e.which == 40) {
5086          if (options.find('li.selected').length) {
5087            newOption = options.find('li.selected').next('li:not(.disabled)')[0];
5088          } else {
5089            newOption = options.find('li:not(.disabled)')[0];
5090          }
5091          activateOption(options, newOption);
5092        }
5093
5094        // ESC - close options
5095        if (e.which == 27) {
5096          $newSelect.trigger('close');
5097        }
5098
5099        // ARROW UP - move to previous not disabled option
5100        if (e.which == 38) {
5101          newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
5102          if (newOption) activateOption(options, newOption);
5103        }
5104
5105        // Automaticaly clean filter query so user can search again by starting letters
5106        setTimeout(function () {
5107          filterQuery = [];
5108        }, 1000);
5109      };
5110
5111      $newSelect.on('keydown', onKeyDown);
5112    });
5113
5114    function toggleEntryFromArray(entriesArray, entryIndex, select) {
5115      var index = entriesArray.indexOf(entryIndex),
5116          notAdded = index === -1;
5117
5118      if (notAdded) {
5119        entriesArray.push(entryIndex);
5120      } else {
5121        entriesArray.splice(index, 1);
5122      }
5123
5124      select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
5125
5126      // use notAdded instead of true (to detect if the option is selected or not)
5127      select.find('option').eq(entryIndex).prop('selected', notAdded);
5128      setValueToInput(entriesArray, select);
5129
5130      return notAdded;
5131    }
5132
5133    function setValueToInput(entriesArray, select) {
5134      var value = '';
5135
5136      for (var i = 0, count = entriesArray.length; i < count; i++) {
5137        var text = select.find('option').eq(entriesArray[i]).text();
5138
5139        i === 0 ? value += text : value += ', ' + text;
5140      }
5141
5142      if (value === '') {
5143        value = select.find('option:disabled').eq(0).text();
5144      }
5145
5146      select.siblings('input.select-dropdown').val(value);
5147    }
5148  };
5149})(jQuery);
5150;(function ($) {
5151
5152  var methods = {
5153
5154    init: function (options) {
5155      var defaults = {
5156        indicators: true,
5157        transition: 500,
5158        interval: 6000
5159      };
5160      options = $.extend(defaults, options);
5161
5162      return this.each(function () {
5163
5164        // For each slider, we want to keep track of
5165        // which slide is active and its associated content
5166        var $this = $(this);
5167        var $slider = $this.find('ul.slides').first();
5168        var $slides = $slider.find('> li');
5169        var $active_index = $slider.find('.active').index();
5170        var $active, $indicators, $interval;
5171        if ($active_index != -1) {
5172          $active = $slides.eq($active_index);
5173        }
5174
5175        // Transitions the caption depending on alignment
5176        function captionTransition(caption, duration) {
5177          if (caption.hasClass("center-align")) {
5178            caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });
5179          } else if (caption.hasClass("right-align")) {
5180            caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });
5181          } else if (caption.hasClass("left-align")) {
5182            caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });
5183          }
5184        }
5185
5186        // This function will transition the slide to any index of the next slide
5187        function moveToSlide(index) {
5188          // Wrap around indices.
5189          if (index >= $slides.length) index = 0;else if (index < 0) index = $slides.length - 1;
5190
5191          $active_index = $slider.find('.active').index();
5192
5193          // Only do if index changes
5194          if ($active_index != index) {
5195            $active = $slides.eq($active_index);
5196            $caption = $active.find('.caption');
5197
5198            $active.removeClass('active');
5199            $active.velocity({ opacity: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad',
5200              complete: function () {
5201                $slides.not('.active').velocity({ opacity: 0, translateX: 0, translateY: 0 }, { duration: 0, queue: false });
5202              } });
5203            captionTransition($caption, options.transition);
5204
5205            // Update indicators
5206            if (options.indicators) {
5207              $indicators.eq($active_index).removeClass('active');
5208            }
5209
5210            $slides.eq(index).velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5211            $slides.eq(index).find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad' });
5212            $slides.eq(index).addClass('active');
5213
5214            // Update indicators
5215            if (options.indicators) {
5216              $indicators.eq(index).addClass('active');
5217            }
5218          }
5219        }
5220
5221        // Set height of slider
5222        // If fullscreen, do nothing
5223        if (!$this.hasClass('fullscreen')) {
5224          if (options.indicators) {
5225            // Add height if indicators are present
5226            $this.height(options.height + 40);
5227          } else {
5228            $this.height(options.height);
5229          }
5230          $slider.height(options.height);
5231        }
5232
5233        // Set initial positions of captions
5234        $slides.find('.caption').each(function () {
5235          captionTransition($(this), 0);
5236        });
5237
5238        // Move img src into background-image
5239        $slides.find('img').each(function () {
5240          var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
5241          if ($(this).attr('src') !== placeholderBase64) {
5242            $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
5243            $(this).attr('src', placeholderBase64);
5244          }
5245        });
5246
5247        // dynamically add indicators
5248        if (options.indicators) {
5249          $indicators = $('<ul class="indicators"></ul>');
5250          $slides.each(function (index) {
5251            var $indicator = $('<li class="indicator-item"></li>');
5252
5253            // Handle clicks on indicators
5254            $indicator.click(function () {
5255              var $parent = $slider.parent();
5256              var curr_index = $parent.find($(this)).index();
5257              moveToSlide(curr_index);
5258
5259              // reset interval
5260              clearInterval($interval);
5261              $interval = setInterval(function () {
5262                $active_index = $slider.find('.active').index();
5263                if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5264                else $active_index += 1;
5265
5266                moveToSlide($active_index);
5267              }, options.transition + options.interval);
5268            });
5269            $indicators.append($indicator);
5270          });
5271          $this.append($indicators);
5272          $indicators = $this.find('ul.indicators').find('li.indicator-item');
5273        }
5274
5275        if ($active) {
5276          $active.show();
5277        } else {
5278          $slides.first().addClass('active').velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5279
5280          $active_index = 0;
5281          $active = $slides.eq($active_index);
5282
5283          // Update indicators
5284          if (options.indicators) {
5285            $indicators.eq($active_index).addClass('active');
5286          }
5287        }
5288
5289        // Adjust height to current slide
5290        $active.find('img').each(function () {
5291          $active.find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5292        });
5293
5294        // auto scroll
5295        $interval = setInterval(function () {
5296          $active_index = $slider.find('.active').index();
5297          moveToSlide($active_index + 1);
5298        }, options.transition + options.interval);
5299
5300        // HammerJS, Swipe navigation
5301
5302        // Touch Event
5303        var panning = false;
5304        var swipeLeft = false;
5305        var swipeRight = false;
5306
5307        $this.hammer({
5308          prevent_default: false
5309        }).on('pan', function (e) {
5310          if (e.gesture.pointerType === "touch") {
5311
5312            // reset interval
5313            clearInterval($interval);
5314
5315            var direction = e.gesture.direction;
5316            var x = e.gesture.deltaX;
5317            var velocityX = e.gesture.velocityX;
5318            var velocityY = e.gesture.velocityY;
5319
5320            $curr_slide = $slider.find('.active');
5321            if (Math.abs(velocityX) > Math.abs(velocityY)) {
5322              $curr_slide.velocity({ translateX: x
5323              }, { duration: 50, queue: false, easing: 'easeOutQuad' });
5324            }
5325
5326            // Swipe Left
5327            if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
5328              swipeRight = true;
5329            }
5330            // Swipe Right
5331            else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
5332                swipeLeft = true;
5333              }
5334
5335            // Make Slide Behind active slide visible
5336            var next_slide;
5337            if (swipeLeft) {
5338              next_slide = $curr_slide.next();
5339              if (next_slide.length === 0) {
5340                next_slide = $slides.first();
5341              }
5342              next_slide.velocity({ opacity: 1
5343              }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5344            }
5345            if (swipeRight) {
5346              next_slide = $curr_slide.prev();
5347              if (next_slide.length === 0) {
5348                next_slide = $slides.last();
5349              }
5350              next_slide.velocity({ opacity: 1
5351              }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5352            }
5353          }
5354        }).on('panend', function (e) {
5355          if (e.gesture.pointerType === "touch") {
5356
5357            $curr_slide = $slider.find('.active');
5358            panning = false;
5359            curr_index = $slider.find('.active').index();
5360
5361            if (!swipeRight && !swipeLeft || $slides.length <= 1) {
5362              // Return to original spot
5363              $curr_slide.velocity({ translateX: 0
5364              }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5365            } else if (swipeLeft) {
5366              moveToSlide(curr_index + 1);
5367              $curr_slide.velocity({ translateX: -1 * $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
5368                complete: function () {
5369                  $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
5370                } });
5371            } else if (swipeRight) {
5372              moveToSlide(curr_index - 1);
5373              $curr_slide.velocity({ translateX: $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
5374                complete: function () {
5375                  $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
5376                } });
5377            }
5378            swipeLeft = false;
5379            swipeRight = false;
5380
5381            // Restart interval
5382            clearInterval($interval);
5383            $interval = setInterval(function () {
5384              $active_index = $slider.find('.active').index();
5385              if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5386              else $active_index += 1;
5387
5388              moveToSlide($active_index);
5389            }, options.transition + options.interval);
5390          }
5391        });
5392
5393        $this.on('sliderPause', function () {
5394          clearInterval($interval);
5395        });
5396
5397        $this.on('sliderStart', function () {
5398          clearInterval($interval);
5399          $interval = setInterval(function () {
5400            $active_index = $slider.find('.active').index();
5401            if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5402            else $active_index += 1;
5403
5404            moveToSlide($active_index);
5405          }, options.transition + options.interval);
5406        });
5407
5408        $this.on('sliderNext', function () {
5409          $active_index = $slider.find('.active').index();
5410          moveToSlide($active_index + 1);
5411        });
5412
5413        $this.on('sliderPrev', function () {
5414          $active_index = $slider.find('.active').index();
5415          moveToSlide($active_index - 1);
5416        });
5417      });
5418    },
5419    pause: function () {
5420      $(this).trigger('sliderPause');
5421    },
5422    start: function () {
5423      $(this).trigger('sliderStart');
5424    },
5425    next: function () {
5426      $(this).trigger('sliderNext');
5427    },
5428    prev: function () {
5429      $(this).trigger('sliderPrev');
5430    }
5431  };
5432
5433  $.fn.slider = function (methodOrOptions) {
5434    if (methods[methodOrOptions]) {
5435      return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
5436    } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
5437      // Default to "init"
5438      return methods.init.apply(this, arguments);
5439    } else {
5440      $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
5441    }
5442  }; // Plugin end
5443})(jQuery);
5444;(function ($) {
5445  $(document).ready(function () {
5446
5447    $(document).on('click.card', '.card', function (e) {
5448      if ($(this).find('> .card-reveal').length) {
5449        var $card = $(e.target).closest('.card');
5450        if ($card.data('initialOverflow') === undefined) {
5451          $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
5452        }
5453        if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) {
5454          // Make Reveal animate down and display none
5455          $(this).find('.card-reveal').velocity({ translateY: 0 }, {
5456            duration: 225,
5457            queue: false,
5458            easing: 'easeInOutQuad',
5459            complete: function () {
5460              $(this).css({ display: 'none' });
5461              $card.css('overflow', $card.data('initialOverflow'));
5462            }
5463          });
5464        } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
5465          $card.css('overflow', 'hidden');
5466          $(this).find('.card-reveal').css({ display: 'block' }).velocity("stop", false).velocity({ translateY: '-100%' }, { duration: 300, queue: false, easing: 'easeInOutQuad' });
5467        }
5468      }
5469    });
5470  });
5471})(jQuery);
5472;(function ($) {
5473  var materialChipsDefaults = {
5474    data: [],
5475    placeholder: '',
5476    secondaryPlaceholder: '',
5477    autocompleteOptions: {}
5478  };
5479
5480  $(document).ready(function () {
5481    // Handle removal of static chips.
5482    $(document).on('click', '.chip .close', function (e) {
5483      var $chips = $(this).closest('.chips');
5484      if ($chips.attr('data-initialized')) {
5485        return;
5486      }
5487      $(this).closest('.chip').remove();
5488    });
5489  });
5490
5491  $.fn.material_chip = function (options) {
5492    var self = this;
5493    this.$el = $(this);
5494    this.$document = $(document);
5495    this.SELS = {
5496      CHIPS: '.chips',
5497      CHIP: '.chip',
5498      INPUT: 'input',
5499      DELETE: '.material-icons',
5500      SELECTED_CHIP: '.selected'
5501    };
5502
5503    if ('data' === options) {
5504      return this.$el.data('chips');
5505    }
5506
5507    var curr_options = $.extend({}, materialChipsDefaults, options);
5508    self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
5509
5510    // Initialize
5511    this.init = function () {
5512      var i = 0;
5513      var chips;
5514      self.$el.each(function () {
5515        var $chips = $(this);
5516        var chipId = Materialize.guid();
5517        self.chipId = chipId;
5518
5519        if (!curr_options.data || !(curr_options.data instanceof Array)) {
5520          curr_options.data = [];
5521        }
5522        $chips.data('chips', curr_options.data);
5523        $chips.attr('data-index', i);
5524        $chips.attr('data-initialized', true);
5525
5526        if (!$chips.hasClass(self.SELS.CHIPS)) {
5527          $chips.addClass('chips');
5528        }
5529
5530        self.chips($chips, chipId);
5531        i++;
5532      });
5533    };
5534
5535    this.handleEvents = function () {
5536      var SELS = self.SELS;
5537
5538      self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
5539        $(e.target).find(SELS.INPUT).focus();
5540      });
5541
5542      self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
5543        var $chip = $(e.target);
5544        if ($chip.length) {
5545          var wasSelected = $chip.hasClass('selected');
5546          var $chips = $chip.closest(SELS.CHIPS);
5547          $(SELS.CHIP).removeClass('selected');
5548
5549          if (!wasSelected) {
5550            self.selectChip($chip.index(), $chips);
5551          }
5552        }
5553      });
5554
5555      self.$document.off('keydown.chips').on('keydown.chips', function (e) {
5556        if ($(e.target).is('input, textarea')) {
5557          return;
5558        }
5559
5560        // delete
5561        var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
5562        var $chips = $chip.closest(SELS.CHIPS);
5563        var length = $chip.siblings(SELS.CHIP).length;
5564        var index;
5565
5566        if (!$chip.length) {
5567          return;
5568        }
5569
5570        if (e.which === 8 || e.which === 46) {
5571          e.preventDefault();
5572
5573          index = $chip.index();
5574          self.deleteChip(index, $chips);
5575
5576          var selectIndex = null;
5577          if (index + 1 < length) {
5578            selectIndex = index;
5579          } else if (index === length || index + 1 === length) {
5580            selectIndex = length - 1;
5581          }
5582
5583          if (selectIndex < 0) selectIndex = null;
5584
5585          if (null !== selectIndex) {
5586            self.selectChip(selectIndex, $chips);
5587          }
5588          if (!length) $chips.find('input').focus();
5589
5590          // left
5591        } else if (e.which === 37) {
5592          index = $chip.index() - 1;
5593          if (index < 0) {
5594            return;
5595          }
5596          $(SELS.CHIP).removeClass('selected');
5597          self.selectChip(index, $chips);
5598
5599          // right
5600        } else if (e.which === 39) {
5601          index = $chip.index() + 1;
5602          $(SELS.CHIP).removeClass('selected');
5603          if (index > length) {
5604            $chips.find('input').focus();
5605            return;
5606          }
5607          self.selectChip(index, $chips);
5608        }
5609      });
5610
5611      self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5612        var $currChips = $(e.target).closest(SELS.CHIPS);
5613        $currChips.addClass('focus');
5614        $currChips.siblings('label, .prefix').addClass('active');
5615        $(SELS.CHIP).removeClass('selected');
5616      });
5617
5618      self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5619        var $currChips = $(e.target).closest(SELS.CHIPS);
5620        $currChips.removeClass('focus');
5621
5622        // Remove active if empty
5623        if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
5624          $currChips.siblings('label').removeClass('active');
5625        }
5626        $currChips.siblings('.prefix').removeClass('active');
5627      });
5628
5629      self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5630        var $target = $(e.target);
5631        var $chips = $target.closest(SELS.CHIPS);
5632        var chipsLength = $chips.children(SELS.CHIP).length;
5633
5634        // enter
5635        if (13 === e.which) {
5636          // Override enter if autocompleting.
5637          if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
5638            return;
5639          }
5640
5641          e.preventDefault();
5642          self.addChip({ tag: $target.val() }, $chips);
5643          $target.val('');
5644          return;
5645        }
5646
5647        // delete or left
5648        if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
5649          e.preventDefault();
5650          self.selectChip(chipsLength - 1, $chips);
5651          $target.blur();
5652          return;
5653        }
5654      });
5655
5656      // Click on delete icon in chip.
5657      self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
5658        var $target = $(e.target);
5659        var $chips = $target.closest(SELS.CHIPS);
5660        var $chip = $target.closest(SELS.CHIP);
5661        e.stopPropagation();
5662        self.deleteChip($chip.index(), $chips);
5663        $chips.find('input').focus();
5664      });
5665    };
5666
5667    this.chips = function ($chips, chipId) {
5668      $chips.empty();
5669      $chips.data('chips').forEach(function (elem) {
5670        $chips.append(self.renderChip(elem));
5671      });
5672      $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
5673      self.setPlaceholder($chips);
5674
5675      // Set for attribute for label
5676      var label = $chips.next('label');
5677      if (label.length) {
5678        label.attr('for', chipId);
5679
5680        if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
5681          label.addClass('active');
5682        }
5683      }
5684
5685      // Setup autocomplete if needed.
5686      var input = $('#' + chipId);
5687      if (self.hasAutocomplete) {
5688        curr_options.autocompleteOptions.onAutocomplete = function (val) {
5689          self.addChip({ tag: val }, $chips);
5690          input.val('');
5691          input.focus();
5692        };
5693        input.autocomplete(curr_options.autocompleteOptions);
5694      }
5695    };
5696
5697    /**
5698     * Render chip jQuery element.
5699     * @param {Object} elem
5700     * @return {jQuery}
5701     */
5702    this.renderChip = function (elem) {
5703      if (!elem.tag) return;
5704
5705      var $renderedChip = $('<div class="chip"></div>');
5706      $renderedChip.text(elem.tag);
5707      if (elem.image) {
5708        $renderedChip.prepend($('<img />').attr('src', elem.image));
5709      }
5710      $renderedChip.append($('<i class="material-icons close">close</i>'));
5711      return $renderedChip;
5712    };
5713
5714    this.setPlaceholder = function ($chips) {
5715      if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
5716        $chips.find('input').prop('placeholder', curr_options.placeholder);
5717      } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
5718        $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
5719      }
5720    };
5721
5722    this.isValid = function ($chips, elem) {
5723      var chips = $chips.data('chips');
5724      var exists = false;
5725      for (var i = 0; i < chips.length; i++) {
5726        if (chips[i].tag === elem.tag) {
5727          exists = true;
5728          return;
5729        }
5730      }
5731      return '' !== elem.tag && !exists;
5732    };
5733
5734    this.addChip = function (elem, $chips) {
5735      if (!self.isValid($chips, elem)) {
5736        return;
5737      }
5738      var $renderedChip = self.renderChip(elem);
5739      var newData = [];
5740      var oldData = $chips.data('chips');
5741      for (var i = 0; i < oldData.length; i++) {
5742        newData.push(oldData[i]);
5743      }
5744      newData.push(elem);
5745
5746      $chips.data('chips', newData);
5747      $renderedChip.insertBefore($chips.find('input'));
5748      $chips.trigger('chip.add', elem);
5749      self.setPlaceholder($chips);
5750    };
5751
5752    this.deleteChip = function (chipIndex, $chips) {
5753      var chip = $chips.data('chips')[chipIndex];
5754      $chips.find('.chip').eq(chipIndex).remove();
5755
5756      var newData = [];
5757      var oldData = $chips.data('chips');
5758      for (var i = 0; i < oldData.length; i++) {
5759        if (i !== chipIndex) {
5760          newData.push(oldData[i]);
5761        }
5762      }
5763
5764      $chips.data('chips', newData);
5765      $chips.trigger('chip.delete', chip);
5766      self.setPlaceholder($chips);
5767    };
5768
5769    this.selectChip = function (chipIndex, $chips) {
5770      var $chip = $chips.find('.chip').eq(chipIndex);
5771      if ($chip && false === $chip.hasClass('selected')) {
5772        $chip.addClass('selected');
5773        $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
5774      }
5775    };
5776
5777    this.getChipsElement = function (index, $chips) {
5778      return $chips.eq(index);
5779    };
5780
5781    // init
5782    this.init();
5783
5784    this.handleEvents();
5785  };
5786})(jQuery);
5787;(function ($) {
5788  $.fn.pushpin = function (options) {
5789    // Defaults
5790    var defaults = {
5791      top: 0,
5792      bottom: Infinity,
5793      offset: 0
5794    };
5795
5796    // Remove pushpin event and classes
5797    if (options === "remove") {
5798      this.each(function () {
5799        if (id = $(this).data('pushpin-id')) {
5800          $(window).off('scroll.' + id);
5801          $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
5802        }
5803      });
5804      return false;
5805    }
5806
5807    options = $.extend(defaults, options);
5808
5809    $index = 0;
5810    return this.each(function () {
5811      var $uniqueId = Materialize.guid(),
5812          $this = $(this),
5813          $original_offset = $(this).offset().top;
5814
5815      function removePinClasses(object) {
5816        object.removeClass('pin-top');
5817        object.removeClass('pinned');
5818        object.removeClass('pin-bottom');
5819      }
5820
5821      function updateElements(objects, scrolled) {
5822        objects.each(function () {
5823          // Add position fixed (because its between top and bottom)
5824          if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
5825            removePinClasses($(this));
5826            $(this).css('top', options.offset);
5827            $(this).addClass('pinned');
5828          }
5829
5830          // Add pin-top (when scrolled position is above top)
5831          if (scrolled < options.top && !$(this).hasClass('pin-top')) {
5832            removePinClasses($(this));
5833            $(this).css('top', 0);
5834            $(this).addClass('pin-top');
5835          }
5836
5837          // Add pin-bottom (when scrolled position is below bottom)
5838          if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
5839            removePinClasses($(this));
5840            $(this).addClass('pin-bottom');
5841            $(this).css('top', options.bottom - $original_offset);
5842          }
5843        });
5844      }
5845
5846      $(this).data('pushpin-id', $uniqueId);
5847      updateElements($this, $(window).scrollTop());
5848      $(window).on('scroll.' + $uniqueId, function () {
5849        var $scrolled = $(window).scrollTop() + options.offset;
5850        updateElements($this, $scrolled);
5851      });
5852    });
5853  };
5854})(jQuery);;(function ($) {
5855  $(document).ready(function () {
5856
5857    // jQuery reverse
5858    $.fn.reverse = [].reverse;
5859
5860    // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
5861    $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
5862      var $this = $(this);
5863      openFABMenu($this);
5864    });
5865    $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
5866      var $this = $(this);
5867      closeFABMenu($this);
5868    });
5869
5870    // Toggle-on-click behaviour.
5871    $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
5872      var $this = $(this);
5873      var $menu = $this.parent();
5874      if ($menu.hasClass('active')) {
5875        closeFABMenu($menu);
5876      } else {
5877        openFABMenu($menu);
5878      }
5879    });
5880
5881    // Toolbar transition behaviour.
5882    $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
5883      var $this = $(this);
5884      var $menu = $this.parent();
5885      FABtoToolbar($menu);
5886    });
5887  });
5888
5889  $.fn.extend({
5890    openFAB: function () {
5891      openFABMenu($(this));
5892    },
5893    closeFAB: function () {
5894      closeFABMenu($(this));
5895    },
5896    openToolbar: function () {
5897      FABtoToolbar($(this));
5898    },
5899    closeToolbar: function () {
5900      toolbarToFAB($(this));
5901    }
5902  });
5903
5904  var openFABMenu = function (btn) {
5905    var $this = btn;
5906    if ($this.hasClass('active') === false) {
5907
5908      // Get direction option
5909      var horizontal = $this.hasClass('horizontal');
5910      var offsetY, offsetX;
5911
5912      if (horizontal === true) {
5913        offsetX = 40;
5914      } else {
5915        offsetY = 40;
5916      }
5917
5918      $this.addClass('active');
5919      $this.find('ul .btn-floating').velocity({ scaleY: ".4", scaleX: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 0 });
5920
5921      var time = 0;
5922      $this.find('ul .btn-floating').reverse().each(function () {
5923        $(this).velocity({ opacity: "1", scaleX: "1", scaleY: "1", translateY: "0", translateX: '0' }, { duration: 80, delay: time });
5924        time += 40;
5925      });
5926    }
5927  };
5928
5929  var closeFABMenu = function (btn) {
5930    var $this = btn;
5931    // Get direction option
5932    var horizontal = $this.hasClass('horizontal');
5933    var offsetY, offsetX;
5934
5935    if (horizontal === true) {
5936      offsetX = 40;
5937    } else {
5938      offsetY = 40;
5939    }
5940
5941    $this.removeClass('active');
5942    var time = 0;
5943    $this.find('ul .btn-floating').velocity("stop", true);
5944    $this.find('ul .btn-floating').velocity({ opacity: "0", scaleX: ".4", scaleY: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 80 });
5945  };
5946
5947  /**
5948   * Transform FAB into toolbar
5949   * @param  {Object}  object jQuery object
5950   */
5951  var FABtoToolbar = function (btn) {
5952    if (btn.attr('data-open') === "true") {
5953      return;
5954    }
5955
5956    var offsetX, offsetY, scaleFactor;
5957    var windowWidth = window.innerWidth;
5958    var windowHeight = window.innerHeight;
5959    var btnRect = btn[0].getBoundingClientRect();
5960    var anchor = btn.find('> a').first();
5961    var menu = btn.find('> ul').first();
5962    var backdrop = $('<div class="fab-backdrop"></div>');
5963    var fabColor = anchor.css('background-color');
5964    anchor.append(backdrop);
5965
5966    offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
5967    offsetY = windowHeight - btnRect.bottom;
5968    scaleFactor = windowWidth / backdrop.width();
5969    btn.attr('data-origin-bottom', btnRect.bottom);
5970    btn.attr('data-origin-left', btnRect.left);
5971    btn.attr('data-origin-width', btnRect.width);
5972
5973    // Set initial state
5974    btn.addClass('active');
5975    btn.attr('data-open', true);
5976    btn.css({
5977      'text-align': 'center',
5978      width: '100%',
5979      bottom: 0,
5980      left: 0,
5981      transform: 'translateX(' + offsetX + 'px)',
5982      transition: 'none'
5983    });
5984    anchor.css({
5985      transform: 'translateY(' + -offsetY + 'px)',
5986      transition: 'none'
5987    });
5988    backdrop.css({
5989      'background-color': fabColor
5990    });
5991
5992    setTimeout(function () {
5993      btn.css({
5994        transform: '',
5995        transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
5996      });
5997      anchor.css({
5998        overflow: 'visible',
5999        transform: '',
6000        transition: 'transform .2s'
6001      });
6002
6003      setTimeout(function () {
6004        btn.css({
6005          overflow: 'hidden',
6006          'background-color': fabColor
6007        });
6008        backdrop.css({
6009          transform: 'scale(' + scaleFactor + ')',
6010          transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
6011        });
6012        menu.find('> li > a').css({
6013          opacity: 1
6014        });
6015
6016        // Scroll to close.
6017        $(window).on('scroll.fabToolbarClose', function () {
6018          toolbarToFAB(btn);
6019          $(window).off('scroll.fabToolbarClose');
6020          $(document).off('click.fabToolbarClose');
6021        });
6022
6023        $(document).on('click.fabToolbarClose', function (e) {
6024          if (!$(e.target).closest(menu).length) {
6025            toolbarToFAB(btn);
6026            $(window).off('scroll.fabToolbarClose');
6027            $(document).off('click.fabToolbarClose');
6028          }
6029        });
6030      }, 100);
6031    }, 0);
6032  };
6033
6034  /**
6035   * Transform toolbar back into FAB
6036   * @param  {Object}  object jQuery object
6037   */
6038  var toolbarToFAB = function (btn) {
6039    if (btn.attr('data-open') !== "true") {
6040      return;
6041    }
6042
6043    var offsetX, offsetY, scaleFactor;
6044    var windowWidth = window.innerWidth;
6045    var windowHeight = window.innerHeight;
6046    var btnWidth = btn.attr('data-origin-width');
6047    var btnBottom = btn.attr('data-origin-bottom');
6048    var btnLeft = btn.attr('data-origin-left');
6049    var anchor = btn.find('> .btn-floating').first();
6050    var menu = btn.find('> ul').first();
6051    var backdrop = btn.find('.fab-backdrop');
6052    var fabColor = anchor.css('background-color');
6053
6054    offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
6055    offsetY = windowHeight - btnBottom;
6056    scaleFactor = windowWidth / backdrop.width();
6057
6058    // Hide backdrop
6059    btn.removeClass('active');
6060    btn.attr('data-open', false);
6061    btn.css({
6062      'background-color': 'transparent',
6063      transition: 'none'
6064    });
6065    anchor.css({
6066      transition: 'none'
6067    });
6068    backdrop.css({
6069      transform: 'scale(0)',
6070      'background-color': fabColor
6071    });
6072    menu.find('> li > a').css({
6073      opacity: ''
6074    });
6075
6076    setTimeout(function () {
6077      backdrop.remove();
6078
6079      // Set initial state.
6080      btn.css({
6081        'text-align': '',
6082        width: '',
6083        bottom: '',
6084        left: '',
6085        overflow: '',
6086        'background-color': '',
6087        transform: 'translate3d(' + -offsetX + 'px,0,0)'
6088      });
6089      anchor.css({
6090        overflow: '',
6091        transform: 'translate3d(0,' + offsetY + 'px,0)'
6092      });
6093
6094      setTimeout(function () {
6095        btn.css({
6096          transform: 'translate3d(0,0,0)',
6097          transition: 'transform .2s'
6098        });
6099        anchor.css({
6100          transform: 'translate3d(0,0,0)',
6101          transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
6102        });
6103      }, 20);
6104    }, 200);
6105  };
6106})(jQuery);
6107;(function ($) {
6108  // Image transition function
6109  Materialize.fadeInImage = function (selectorOrEl) {
6110    var element;
6111    if (typeof selectorOrEl === 'string') {
6112      element = $(selectorOrEl);
6113    } else if (typeof selectorOrEl === 'object') {
6114      element = selectorOrEl;
6115    } else {
6116      return;
6117    }
6118    element.css({ opacity: 0 });
6119    $(element).velocity({ opacity: 1 }, {
6120      duration: 650,
6121      queue: false,
6122      easing: 'easeOutSine'
6123    });
6124    $(element).velocity({ opacity: 1 }, {
6125      duration: 1300,
6126      queue: false,
6127      easing: 'swing',
6128      step: function (now, fx) {
6129        fx.start = 100;
6130        var grayscale_setting = now / 100;
6131        var brightness_setting = 150 - (100 - now) / 1.75;
6132
6133        if (brightness_setting < 100) {
6134          brightness_setting = 100;
6135        }
6136        if (now >= 0) {
6137          $(this).css({
6138            "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
6139            "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
6140          });
6141        }
6142      }
6143    });
6144  };
6145
6146  // Horizontal staggered list
6147  Materialize.showStaggeredList = function (selectorOrEl) {
6148    var element;
6149    if (typeof selectorOrEl === 'string') {
6150      element = $(selectorOrEl);
6151    } else if (typeof selectorOrEl === 'object') {
6152      element = selectorOrEl;
6153    } else {
6154      return;
6155    }
6156    var time = 0;
6157    element.find('li').velocity({ translateX: "-100px" }, { duration: 0 });
6158
6159    element.find('li').each(function () {
6160      $(this).velocity({ opacity: "1", translateX: "0" }, { duration: 800, delay: time, easing: [60, 10] });
6161      time += 120;
6162    });
6163  };
6164
6165  $(document).ready(function () {
6166    // Hardcoded .staggered-list scrollFire
6167    // var staggeredListOptions = [];
6168    // $('ul.staggered-list').each(function (i) {
6169
6170    //   var label = 'scrollFire-' + i;
6171    //   $(this).addClass(label);
6172    //   staggeredListOptions.push(
6173    //     {selector: 'ul.staggered-list.' + label,
6174    //      offset: 200,
6175    //      callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
6176    // });
6177    // scrollFire(staggeredListOptions);
6178
6179    // HammerJS, Swipe navigation
6180
6181    // Touch Event
6182    var swipeLeft = false;
6183    var swipeRight = false;
6184
6185    // Dismissible Collections
6186    $('.dismissable').each(function () {
6187      $(this).hammer({
6188        prevent_default: false
6189      }).on('pan', function (e) {
6190        if (e.gesture.pointerType === "touch") {
6191          var $this = $(this);
6192          var direction = e.gesture.direction;
6193          var x = e.gesture.deltaX;
6194          var velocityX = e.gesture.velocityX;
6195
6196          $this.velocity({ translateX: x
6197          }, { duration: 50, queue: false, easing: 'easeOutQuad' });
6198
6199          // Swipe Left
6200          if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
6201            swipeLeft = true;
6202          }
6203
6204          // Swipe Right
6205          if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
6206            swipeRight = true;
6207          }
6208        }
6209      }).on('panend', function (e) {
6210        // Reset if collection is moved back into original position
6211        if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
6212          swipeRight = false;
6213          swipeLeft = false;
6214        }
6215
6216        if (e.gesture.pointerType === "touch") {
6217          var $this = $(this);
6218          if (swipeLeft || swipeRight) {
6219            var fullWidth;
6220            if (swipeLeft) {
6221              fullWidth = $this.innerWidth();
6222            } else {
6223              fullWidth = -1 * $this.innerWidth();
6224            }
6225
6226            $this.velocity({ translateX: fullWidth
6227            }, { duration: 100, queue: false, easing: 'easeOutQuad', complete: function () {
6228                $this.css('border', 'none');
6229                $this.velocity({ height: 0, padding: 0
6230                }, { duration: 200, queue: false, easing: 'easeOutQuad', complete: function () {
6231                    $this.remove();
6232                  }
6233                });
6234              }
6235            });
6236          } else {
6237            $this.velocity({ translateX: 0
6238            }, { duration: 100, queue: false, easing: 'easeOutQuad' });
6239          }
6240          swipeLeft = false;
6241          swipeRight = false;
6242        }
6243      });
6244    });
6245
6246    // time = 0
6247    // // Vertical Staggered list
6248    // $('ul.staggered-list.vertical li').velocity(
6249    //     { translateY: "100px"},
6250    //     { duration: 0 });
6251
6252    // $('ul.staggered-list.vertical li').each(function() {
6253    //   $(this).velocity(
6254    //     { opacity: "1", translateY: "0"},
6255    //     { duration: 800, delay: time, easing: [60, 25] });
6256    //   time += 120;
6257    // });
6258
6259    // // Fade in and Scale
6260    // $('.fade-in.scale').velocity(
6261    //     { scaleX: .4, scaleY: .4, translateX: -600},
6262    //     { duration: 0});
6263    // $('.fade-in').each(function() {
6264    //   $(this).velocity(
6265    //     { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
6266    //     { duration: 800, easing: [60, 10] });
6267    // });
6268  });
6269})(jQuery);
6270;(function ($) {
6271
6272  var scrollFireEventsHandled = false;
6273
6274  // Input: Array of JSON objects {selector, offset, callback}
6275  Materialize.scrollFire = function (options) {
6276    var onScroll = function () {
6277      var windowScroll = window.pageYOffset + window.innerHeight;
6278
6279      for (var i = 0; i < options.length; i++) {
6280        // Get options from each line
6281        var value = options[i];
6282        var selector = value.selector,
6283            offset = value.offset,
6284            callback = value.callback;
6285
6286        var currentElement = document.querySelector(selector);
6287        if (currentElement !== null) {
6288          var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
6289
6290          if (windowScroll > elementOffset + offset) {
6291            if (value.done !== true) {
6292              if (typeof callback === 'function') {
6293                callback.call(this, currentElement);
6294              } else if (typeof callback === 'string') {
6295                var callbackFunc = new Function(callback);
6296                callbackFunc(currentElement);
6297              }
6298              value.done = true;
6299            }
6300          }
6301        }
6302      }
6303    };
6304
6305    var throttledScroll = Materialize.throttle(function () {
6306      onScroll();
6307    }, options.throttle || 100);
6308
6309    if (!scrollFireEventsHandled) {
6310      window.addEventListener("scroll", throttledScroll);
6311      window.addEventListener("resize", throttledScroll);
6312      scrollFireEventsHandled = true;
6313    }
6314
6315    // perform a scan once, after current execution context, and after dom is ready
6316    setTimeout(throttledScroll, 0);
6317  };
6318})(jQuery);
6319; /*!
6320  * pickadate.js v3.5.0, 2014/04/13
6321  * By Amsul, http://amsul.ca
6322  * Hosted on http://amsul.github.io/pickadate.js
6323  * Licensed under MIT
6324  */
6325
6326(function (factory) {
6327
6328  Materialize.Picker = factory(jQuery);
6329})(function ($) {
6330
6331  var $window = $(window);
6332  var $document = $(document);
6333  var $html = $(document.documentElement);
6334
6335  /**
6336   * The picker constructor that creates a blank picker.
6337   */
6338  function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
6339
6340    // If there’s no element, return the picker constructor.
6341    if (!ELEMENT) return PickerConstructor;
6342
6343    var IS_DEFAULT_THEME = false,
6344
6345
6346    // The state of the picker.
6347    STATE = {
6348      id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
6349    },
6350
6351
6352    // Merge the defaults and options passed.
6353    SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},
6354
6355
6356    // Merge the default classes with the settings classes.
6357    CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),
6358
6359
6360    // The element node wrapper into a jQuery object.
6361    $ELEMENT = $(ELEMENT),
6362
6363
6364    // Pseudo picker constructor.
6365    PickerInstance = function () {
6366      return this.start();
6367    },
6368
6369
6370    // The picker prototype.
6371    P = PickerInstance.prototype = {
6372
6373      constructor: PickerInstance,
6374
6375      $node: $ELEMENT,
6376
6377      /**
6378       * Initialize everything
6379       */
6380      start: function () {
6381
6382        // If it’s already started, do nothing.
6383        if (STATE && STATE.start) return P;
6384
6385        // Update the picker states.
6386        STATE.methods = {};
6387        STATE.start = true;
6388        STATE.open = false;
6389        STATE.type = ELEMENT.type;
6390
6391        // Confirm focus state, convert into text input to remove UA stylings,
6392        // and set as readonly to prevent keyboard popup.
6393        ELEMENT.autofocus = ELEMENT == getActiveElement();
6394        ELEMENT.readOnly = !SETTINGS.editable;
6395        ELEMENT.id = ELEMENT.id || STATE.id;
6396        if (ELEMENT.type != 'text') {
6397          ELEMENT.type = 'text';
6398        }
6399
6400        // Create a new picker component with the settings.
6401        P.component = new COMPONENT(P, SETTINGS);
6402
6403        // Create the picker root with a holder and then prepare it.
6404        P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
6405        prepareElementRoot();
6406
6407        // If there’s a format for the hidden input element, create the element.
6408        if (SETTINGS.formatSubmit) {
6409          prepareElementHidden();
6410        }
6411
6412        // Prepare the input element.
6413        prepareElement();
6414
6415        // Insert the root as specified in the settings.
6416        if (SETTINGS.container) $(SETTINGS.container).append(P.$root);else $ELEMENT.before(P.$root);
6417
6418        // Bind the default component and settings events.
6419        P.on({
6420          start: P.component.onStart,
6421          render: P.component.onRender,
6422          stop: P.component.onStop,
6423          open: P.component.onOpen,
6424          close: P.component.onClose,
6425          set: P.component.onSet
6426        }).on({
6427          start: SETTINGS.onStart,
6428          render: SETTINGS.onRender,
6429          stop: SETTINGS.onStop,
6430          open: SETTINGS.onOpen,
6431          close: SETTINGS.onClose,
6432          set: SETTINGS.onSet
6433        });
6434
6435        // Once we’re all set, check the theme in use.
6436        IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]);
6437
6438        // If the element has autofocus, open the picker.
6439        if (ELEMENT.autofocus) {
6440          P.open();
6441        }
6442
6443        // Trigger queued the “start” and “render” events.
6444        return P.trigger('start').trigger('render');
6445      }, //start
6446
6447
6448      /**
6449       * Render a new picker
6450       */
6451      render: function (entireComponent) {
6452
6453        // Insert a new component holder in the root or box.
6454        if (entireComponent) P.$root.html(createWrappedComponent());else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open));
6455
6456        // Trigger the queued “render” events.
6457        return P.trigger('render');
6458      }, //render
6459
6460
6461      /**
6462       * Destroy everything
6463       */
6464      stop: function () {
6465
6466        // If it’s already stopped, do nothing.
6467        if (!STATE.start) return P;
6468
6469        // Then close the picker.
6470        P.close();
6471
6472        // Remove the hidden field.
6473        if (P._hidden) {
6474          P._hidden.parentNode.removeChild(P._hidden);
6475        }
6476
6477        // Remove the root.
6478        P.$root.remove();
6479
6480        // Remove the input class, remove the stored data, and unbind
6481        // the events (after a tick for IE - see `P.close`).
6482        $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
6483        setTimeout(function () {
6484          $ELEMENT.off('.' + STATE.id);
6485        }, 0);
6486
6487        // Restore the element state
6488        ELEMENT.type = STATE.type;
6489        ELEMENT.readOnly = false;
6490
6491        // Trigger the queued “stop” events.
6492        P.trigger('stop');
6493
6494        // Reset the picker states.
6495        STATE.methods = {};
6496        STATE.start = false;
6497
6498        return P;
6499      }, //stop
6500
6501
6502      /**
6503       * Open up the picker
6504       */
6505      open: function (dontGiveFocus) {
6506
6507        // If it’s already open, do nothing.
6508        if (STATE.open) return P;
6509
6510        // Add the “active” class.
6511        $ELEMENT.addClass(CLASSES.active);
6512        aria(ELEMENT, 'expanded', true);
6513
6514        // * A Firefox bug, when `html` has `overflow:hidden`, results in
6515        //   killing transitions :(. So add the “opened” state on the next tick.
6516        //   Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
6517        setTimeout(function () {
6518
6519          // Add the “opened” class to the picker root.
6520          P.$root.addClass(CLASSES.opened);
6521          aria(P.$root[0], 'hidden', false);
6522        }, 0);
6523
6524        // If we have to give focus, bind the element and doc events.
6525        if (dontGiveFocus !== false) {
6526
6527          // Set it as open.
6528          STATE.open = true;
6529
6530          // Prevent the page from scrolling.
6531          if (IS_DEFAULT_THEME) {
6532            $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
6533          }
6534
6535          // Pass focus to the root element’s jQuery object.
6536          // * Workaround for iOS8 to bring the picker’s root into view.
6537          P.$root.eq(0).focus();
6538
6539          // Bind the document events.
6540          $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
6541
6542            var target = event.target;
6543
6544            // If the target of the event is not the element, close the picker picker.
6545            // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
6546            //   Also, for Firefox, a click on an `option` element bubbles up directly
6547            //   to the doc. So make sure the target wasn't the doc.
6548            // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
6549            //   which causes the picker to unexpectedly close when right-clicking it. So make
6550            //   sure the event wasn’t a right-click.
6551            if (target != ELEMENT && target != document && event.which != 3) {
6552
6553              // If the target was the holder that covers the screen,
6554              // keep the element focused to maintain tabindex.
6555              P.close(target === P.$root.children()[0]);
6556            }
6557          }).on('keydown.' + STATE.id, function (event) {
6558
6559            var
6560            // Get the keycode.
6561            keycode = event.keyCode,
6562
6563
6564            // Translate that to a selection change.
6565            keycodeToMove = P.component.key[keycode],
6566
6567
6568            // Grab the target.
6569            target = event.target;
6570
6571            // On escape, close the picker and give focus.
6572            if (keycode == 27) {
6573              P.close(true);
6574            }
6575
6576            // Check if there is a key movement or “enter” keypress on the element.
6577            else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
6578
6579                // Prevent the default action to stop page movement.
6580                event.preventDefault();
6581
6582                // Trigger the key movement action.
6583                if (keycodeToMove) {
6584                  PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
6585                }
6586
6587                // On “enter”, if the highlighted item isn’t disabled, set the value and close.
6588                else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
6589                    P.set('select', P.component.item.highlight);
6590                    if (SETTINGS.closeOnSelect) {
6591                      P.close(true);
6592                    }
6593                  }
6594              }
6595
6596              // If the target is within the root and “enter” is pressed,
6597              // prevent the default action and trigger a click on the target instead.
6598              else if ($.contains(P.$root[0], target) && keycode == 13) {
6599                  event.preventDefault();
6600                  target.click();
6601                }
6602          });
6603        }
6604
6605        // Trigger the queued “open” events.
6606        return P.trigger('open');
6607      }, //open
6608
6609
6610      /**
6611       * Close the picker
6612       */
6613      close: function (giveFocus) {
6614
6615        // If we need to give focus, do it before changing states.
6616        if (giveFocus) {
6617          // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
6618          // The focus is triggered *after* the close has completed - causing it
6619          // to open again. So unbind and rebind the event at the next tick.
6620          P.$root.off('focus.toOpen').eq(0).focus();
6621          setTimeout(function () {
6622            P.$root.on('focus.toOpen', handleFocusToOpenEvent);
6623          }, 0);
6624        }
6625
6626        // Remove the “active” class.
6627        $ELEMENT.removeClass(CLASSES.active);
6628        aria(ELEMENT, 'expanded', false);
6629
6630        // * A Firefox bug, when `html` has `overflow:hidden`, results in
6631        //   killing transitions :(. So remove the “opened” state on the next tick.
6632        //   Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
6633        setTimeout(function () {
6634
6635          // Remove the “opened” and “focused” class from the picker root.
6636          P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
6637          aria(P.$root[0], 'hidden', true);
6638        }, 0);
6639
6640        // If it’s already closed, do nothing more.
6641        if (!STATE.open) return P;
6642
6643        // Set it as closed.
6644        STATE.open = false;
6645
6646        // Allow the page to scroll.
6647        if (IS_DEFAULT_THEME) {
6648          $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
6649        }
6650
6651        // Unbind the document events.
6652        $document.off('.' + STATE.id);
6653
6654        // Trigger the queued “close” events.
6655        return P.trigger('close');
6656      }, //close
6657
6658
6659      /**
6660       * Clear the values
6661       */
6662      clear: function (options) {
6663        return P.set('clear', null, options);
6664      }, //clear
6665
6666
6667      /**
6668       * Set something
6669       */
6670      set: function (thing, value, options) {
6671
6672        var thingItem,
6673            thingValue,
6674            thingIsObject = $.isPlainObject(thing),
6675            thingObject = thingIsObject ? thing : {};
6676
6677        // Make sure we have usable options.
6678        options = thingIsObject && $.isPlainObject(value) ? value : options || {};
6679
6680        if (thing) {
6681
6682          // If the thing isn’t an object, make it one.
6683          if (!thingIsObject) {
6684            thingObject[thing] = value;
6685          }
6686
6687          // Go through the things of items to set.
6688          for (thingItem in thingObject) {
6689
6690            // Grab the value of the thing.
6691            thingValue = thingObject[thingItem];
6692
6693            // First, if the item exists and there’s a value, set it.
6694            if (thingItem in P.component.item) {
6695              if (thingValue === undefined) thingValue = null;
6696              P.component.set(thingItem, thingValue, options);
6697            }
6698
6699            // Then, check to update the element value and broadcast a change.
6700            if (thingItem == 'select' || thingItem == 'clear') {
6701              $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
6702            }
6703          }
6704
6705          // Render a new picker.
6706          P.render();
6707        }
6708
6709        // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
6710        return options.muted ? P : P.trigger('set', thingObject);
6711      }, //set
6712
6713
6714      /**
6715       * Get something
6716       */
6717      get: function (thing, format) {
6718
6719        // Make sure there’s something to get.
6720        thing = thing || 'value';
6721
6722        // If a picker state exists, return that.
6723        if (STATE[thing] != null) {
6724          return STATE[thing];
6725        }
6726
6727        // Return the submission value, if that.
6728        if (thing == 'valueSubmit') {
6729          if (P._hidden) {
6730            return P._hidden.value;
6731          }
6732          thing = 'value';
6733        }
6734
6735        // Return the value, if that.
6736        if (thing == 'value') {
6737          return ELEMENT.value;
6738        }
6739
6740        // Check if a component item exists, return that.
6741        if (thing in P.component.item) {
6742          if (typeof format == 'string') {
6743            var thingValue = P.component.get(thing);
6744            return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
6745          }
6746          return P.component.get(thing);
6747        }
6748      }, //get
6749
6750
6751      /**
6752       * Bind events on the things.
6753       */
6754      on: function (thing, method, internal) {
6755
6756        var thingName,
6757            thingMethod,
6758            thingIsObject = $.isPlainObject(thing),
6759            thingObject = thingIsObject ? thing : {};
6760
6761        if (thing) {
6762
6763          // If the thing isn’t an object, make it one.
6764          if (!thingIsObject) {
6765            thingObject[thing] = method;
6766          }
6767
6768          // Go through the things to bind to.
6769          for (thingName in thingObject) {
6770
6771            // Grab the method of the thing.
6772            thingMethod = thingObject[thingName];
6773
6774            // If it was an internal binding, prefix it.
6775            if (internal) {
6776              thingName = '_' + thingName;
6777            }
6778
6779            // Make sure the thing methods collection exists.
6780            STATE.methods[thingName] = STATE.methods[thingName] || [];
6781
6782            // Add the method to the relative method collection.
6783            STATE.methods[thingName].push(thingMethod);
6784          }
6785        }
6786
6787        return P;
6788      }, //on
6789
6790
6791      /**
6792       * Unbind events on the things.
6793       */
6794      off: function () {
6795        var i,
6796            thingName,
6797            names = arguments;
6798        for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
6799          thingName = names[i];
6800          if (thingName in STATE.methods) {
6801            delete STATE.methods[thingName];
6802          }
6803        }
6804        return P;
6805      },
6806
6807      /**
6808       * Fire off method events.
6809       */
6810      trigger: function (name, data) {
6811        var _trigger = function (name) {
6812          var methodList = STATE.methods[name];
6813          if (methodList) {
6814            methodList.map(function (method) {
6815              PickerConstructor._.trigger(method, P, [data]);
6816            });
6817          }
6818        };
6819        _trigger('_' + name);
6820        _trigger(name);
6821        return P;
6822      }
6822 //trigger
6823      //PickerInstance.prototype
6824
6825
6826      /**
6827       * Wrap the picker holder components together.
6828       */
6829    };function createWrappedComponent() {
6830
6831      // Create a picker wrapper holder
6832      return PickerConstructor._.node('div',
6833
6834      // Create a picker wrapper node
6835      PickerConstructor._.node('div',
6836
6837      // Create a picker frame
6838      PickerConstructor._.node('div',
6839
6840      // Create a picker box node
6841      PickerConstructor._.node('div',
6842
6843      // Create the components nodes.
6844      P.component.nodes(STATE.open),
6845
6846      // The picker box class
6847      CLASSES.box),
6848
6849      // Picker wrap class
6850      CLASSES.wrap),
6851
6852      // Picker frame class
6853      CLASSES.frame),
6854
6855      // Picker holder class
6856      CLASSES.holder); //endreturn
6857    } //createWrappedComponent
6858
6859
6860    /**
6861     * Prepare the input element with all bindings.
6862     */
6863    function prepareElement() {
6864
6865      $ELEMENT.
6866
6867      // Store the picker data by component name.
6868      data(NAME, P).
6869
6870      // Add the “input” class name.
6871      addClass(CLASSES.input).
6872
6873      // Remove the tabindex.
6874      attr('tabindex', -1).
6875
6876      // If there’s a `data-value`, update the value of the element.
6877      val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value);
6878
6879      // Only bind keydown events if the element isn’t editable.
6880      if (!SETTINGS.editable) {
6881
6882        $ELEMENT.
6883
6884        // On focus/click, focus onto the root to open it up.
6885        on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
6886          event.preventDefault();
6887          P.$root.eq(0).focus();
6888        }).
6889
6890        // Handle keyboard event based on the picker being opened or not.
6891        on('keydown.' + STATE.id, handleKeydownEvent);
6892      }
6893
6894      // Update the aria attributes.
6895      aria(ELEMENT, {
6896        haspopup: true,
6897        expanded: false,
6898        readonly: false,
6899        owns: ELEMENT.id + '_root'
6900      });
6901    }
6902
6903    /**
6904     * Prepare the root picker element with all bindings.
6905     */
6906    function prepareElementRoot() {
6907
6908      P.$root.on({
6909
6910        // For iOS8.
6911        keydown: handleKeydownEvent,
6912
6913        // When something within the root is focused, stop from bubbling
6914        // to the doc and remove the “focused” state from the root.
6915        focusin: function (event) {
6916          P.$root.removeClass(CLASSES.focused);
6917          event.stopPropagation();
6918        },
6919
6920        // When something within the root holder is clicked, stop it
6921        // from bubbling to the doc.
6922        'mousedown click': function (event) {
6923
6924          var target = event.target;
6925
6926          // Make sure the target isn’t the root holder so it can bubble up.
6927          if (target != P.$root.children()[0]) {
6928
6929            event.stopPropagation();
6930
6931            // * For mousedown events, cancel the default action in order to
6932            //   prevent cases where focus is shifted onto external elements
6933            //   when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
6934            //   Also, for Firefox, don’t prevent action on the `option` element.
6935            if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
6936
6937              event.preventDefault();
6938
6939              // Re-focus onto the root so that users can click away
6940              // from elements focused within the picker.
6941              P.$root.eq(0).focus();
6942            }
6943          }
6944        }
6945      }).
6946
6947      // Add/remove the “target” class on focus and blur.
6948      on({
6949        focus: function () {
6950          $ELEMENT.addClass(CLASSES.target);
6951        },
6952        blur: function () {
6953          $ELEMENT.removeClass(CLASSES.target);
6954        }
6955      }).
6956
6957      // Open the picker and adjust the root “focused” state
6958      on('focus.toOpen', handleFocusToOpenEvent).
6959
6960      // If there’s a click on an actionable element, carry out the actions.
6961      on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
6962
6963        var $target = $(this),
6964            targetData = $target.data(),
6965            targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),
6966
6967
6968        // * For IE, non-focusable elements can be active elements as well
6969        //   (http://stackoverflow.com/a/2684561).
6970        activeElement = getActiveElement();
6971        activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement;
6972
6973        // If it’s disabled or nothing inside is actively focused, re-focus the element.
6974        if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
6975          P.$root.eq(0).focus();
6976        }
6977
6978        // If something is superficially changed, update the `highlight` based on the `nav`.
6979        if (!targetDisabled && targetData.nav) {
6980          P.set('highlight', P.component.item.highlight, { nav: targetData.nav });
6981        }
6982
6983        // If something is picked, set `select` then close with focus.
6984        else if (!targetDisabled && 'pick' in targetData) {
6985            P.set('select', targetData.pick);
6986            if (SETTINGS.closeOnSelect) {
6987              P.close(true);
6988            }
6989          }
6990
6991          // If a “clear” button is pressed, empty the values and close with focus.
6992          else if (targetData.clear) {
6993              P.clear();
6994              if (SETTINGS.closeOnSelect) {
6995                P.close(true);
6996              }
6997            } else if (targetData.close) {
6998              P.close(true);
6999            }
7000      }); //P.$root
7001
7002      aria(P.$root[0], 'hidden', true);
7003    }
7004
7005    /**
7006     * Prepare the hidden input element along with all bindings.
7007     */
7008    function prepareElementHidden() {
7009
7010      var name;
7011
7012      if (SETTINGS.hiddenName === true) {
7013        name = ELEMENT.name;
7014        ELEMENT.name = '';
7015      } else {
7016        name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
7017        name = name[0] + ELEMENT.name + name[1];
7018      }
7019
7020      P._hidden = $('<input ' + 'type=hidden ' +
7021
7022      // Create the name using the original input’s with a prefix and suffix.
7023      'name="' + name + '"' + (
7024
7025      // If the element has a value, set the hidden value as well.
7026      $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
7027
7028      $ELEMENT.
7029
7030      // If the value changes, update the hidden input with the correct format.
7031      on('change.' + STATE.id, function () {
7032        P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
7033      });
7034
7035      // Insert the hidden input as specified in the settings.
7036      if (SETTINGS.container) $(SETTINGS.container).append(P._hidden);else $ELEMENT.before(P._hidden);
7037    }
7038
7039    // For iOS8.
7040    function handleKeydownEvent(event) {
7041
7042      var keycode = event.keyCode,
7043
7044
7045      // Check if one of the delete keys was pressed.
7046      isKeycodeDelete = /^(8|46)$/.test(keycode);
7047
7048      // For some reason IE clears the input value on “escape”.
7049      if (keycode == 27) {
7050        P.close();
7051        return false;
7052      }
7053
7054      // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
7055      if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
7056
7057        // Prevent it from moving the page and bubbling to doc.
7058        event.preventDefault();
7059        event.stopPropagation();
7060
7061        // If `delete` was pressed, clear the values and close the picker.
7062        // Otherwise open the picker.
7063        if (isKeycodeDelete) {
7064          P.clear().close();
7065        } else {
7066          P.open();
7067        }
7068      }
7069    }
7070
7071    // Separated for IE
7072    function handleFocusToOpenEvent(event) {
7073
7074      // Stop the event from propagating to the doc.
7075      event.stopPropagation();
7076
7077      // If it’s a focus event, add the “focused” class to the root.
7078      if (event.type == 'focus') {
7079        P.$root.addClass(CLASSES.focused);
7080      }
7081
7082      // And then finally open the picker.
7083      P.open();
7084    }
7085
7086    // Return a new picker instance.
7087    return new PickerInstance();
7088  } //PickerConstructor
7089
7090
7091  /**
7092   * The default classes and prefix to use for the HTML classes.
7093   */
7094  PickerConstructor.klasses = function (prefix) {
7095    prefix = prefix || 'picker';
7096    return {
7097
7098      picker: prefix,
7099      opened: prefix + '--opened',
7100      focused: prefix + '--focused',
7101
7102      input: prefix + '__input',
7103      active: prefix + '__input--active',
7104      target: prefix + '__input--target',
7105
7106      holder: prefix + '__holder',
7107
7108      frame: prefix + '__frame',
7109      wrap: prefix + '__wrap',
7110
7111      box: prefix + '__box'
7112    };
7113  }; //PickerConstructor.klasses
7114
7115
7116  /**
7117   * Check if the default theme is being used.
7118   */
7119  function isUsingDefaultTheme(element) {
7120
7121    var theme,
7122        prop = 'position';
7123
7124    // For IE.
7125    if (element.currentStyle) {
7126      theme = element.currentStyle[prop];
7127    }
7128
7129    // For normal browsers.
7130    else if (window.getComputedStyle) {
7131        theme = getComputedStyle(element)[prop];
7132      }
7133
7134    return theme == 'fixed';
7135  }
7136
7137  /**
7138   * Get the width of the browser’s scrollbar.
7139   * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
7140   */
7141  function getScrollbarWidth() {
7142
7143    if ($html.height() <= $window.height()) {
7144      return 0;
7145    }
7146
7147    var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body');
7148
7149    // Get the width without scrollbars.
7150    var widthWithoutScroll = $outer[0].offsetWidth;
7151
7152    // Force adding scrollbars.
7153    $outer.css('overflow', 'scroll');
7154
7155    // Add the inner div.
7156    var $inner = $('<div style="width:100%" />').appendTo($outer);
7157
7158    // Get the width with scrollbars.
7159    var widthWithScroll = $inner[0].offsetWidth;
7160
7161    // Remove the divs.
7162    $outer.remove();
7163
7164    // Return the difference between the widths.
7165    return widthWithoutScroll - widthWithScroll;
7166  }
7167
7168  /**
7169   * PickerConstructor helper methods.
7170   */
7171  PickerConstructor._ = {
7172
7173    /**
7174     * Create a group of nodes. Expects:
7175     * `
7176        {
7177            min:    {Integer},
7178            max:    {Integer},
7179            i:      {Integer},
7180            node:   {String},
7181            item:   {Function}
7182        }
7183     * `
7184     */
7185    group: function (groupObject) {
7186
7187      var
7188      // Scope for the looped object
7189      loopObjectScope,
7190
7191
7192      // Create the nodes list
7193      nodesList = '',
7194
7195
7196      // The counter starts from the `min`
7197      counter = PickerConstructor._.trigger(groupObject.min, groupObject);
7198
7199      // Loop from the `min` to `max`, incrementing by `i`
7200      for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
7201
7202        // Trigger the `item` function within scope of the object
7203        loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]);
7204
7205        // Splice the subgroup and create nodes out of the sub nodes
7206        nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
7207        loopObjectScope[1], // the classes
7208        loopObjectScope[2] // the attributes
7209        );
7210      }
7211
7212      // Return the list of nodes
7213      return nodesList;
7214    }, //group
7215
7216
7217    /**
7218     * Create a dom node string
7219     */
7220    node: function (wrapper, item, klass, attribute) {
7221
7222      // If the item is false-y, just return an empty string
7223      if (!item) return '';
7224
7225      // If the item is an array, do a join
7226      item = $.isArray(item) ? item.join('') : item;
7227
7228      // Check for the class
7229      klass = klass ? ' class="' + klass + '"' : '';
7230
7231      // Check for any attributes
7232      attribute = attribute ? ' ' + attribute : '';
7233
7234      // Return the wrapped item
7235      return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
7236    }, //node
7237
7238
7239    /**
7240     * Lead numbers below 10 with a zero.
7241     */
7242    lead: function (number) {
7243      return (number < 10 ? '0' : '') + number;
7244    },
7245
7246    /**
7247     * Trigger a function otherwise return the value.
7248     */
7249    trigger: function (callback, scope, args) {
7250      return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
7251    },
7252
7253    /**
7254     * If the second character is a digit, length is 2 otherwise 1.
7255     */
7256    digits: function (string) {
7257      return (/\d/.test(string[1]) ? 2 : 1
7258      );
7259    },
7260
7261    /**
7262     * Tell if something is a date object.
7263     */
7264    isDate: function (value) {
7265      return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
7266    },
7267
7268    /**
7269     * Tell if something is an integer.
7270     */
7271    isInteger: function (value) {
7272      return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
7273    },
7274
7275    /**
7276     * Create ARIA attribute strings.
7277     */
7278    ariaAttr: ariaAttr //PickerConstructor._
7279
7280
7281    /**
7282     * Extend the picker with a component and defaults.
7283     */
7284  };PickerConstructor.extend = function (name, Component) {
7285
7286    // Extend jQuery.
7287    $.fn[name] = function (options, action) {
7288
7289      // Grab the component data.
7290      var componentData = this.data(name);
7291
7292      // If the picker is requested, return the data object.
7293      if (options == 'picker') {
7294        return componentData;
7295      }
7296
7297      // If the component data exists and `options` is a string, carry out the action.
7298      if (componentData && typeof options == 'string') {
7299        return PickerConstructor._.trigger(componentData[options], componentData, [action]);
7300      }
7301
7302      // Otherwise go through each matched element and if the component
7303      // doesn’t exist, create a new picker using `this` element
7304      // and merging the defaults and options with a deep copy.
7305      return this.each(function () {
7306        var $this = $(this);
7307        if (!$this.data(name)) {
7308          new PickerConstructor(this, name, Component, options);
7309        }
7310      });
7311    };
7312
7313    // Set the defaults.
7314    $.fn[name].defaults = Component.defaults;
7315  }; //PickerConstructor.extend
7316
7317
7318  function aria(element, attribute, value) {
7319    if ($.isPlainObject(attribute)) {
7320      for (var key in attribute) {
7321        ariaSet(element, key, attribute[key]);
7322      }
7323    } else {
7324      ariaSet(element, attribute, value);
7325    }
7326  }
7327  function ariaSet(element, attribute, value) {
7328    element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
7329  }
7330  function ariaAttr(attribute, data) {
7331    if (!$.isPlainObject(attribute)) {
7332      attribute = { attribute: data };
7333    }
7334    data = '';
7335    for (var key in attribute) {
7336      var attr = (key == 'role' ? '' : 'aria-') + key,
7337          attrVal = attribute[key];
7338      data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
7339    }
7340    return data;
7341  }
7342
7343  // IE8 bug throws an error for activeElements within iframes.
7344  function getActiveElement() {
7345    try {
7346      return document.activeElement;
7347    } catch (err) {}
7348  }
7349
7350  // Expose the picker constructor.
7351  return PickerConstructor;
7352});
7353; /*!
7354  * Date picker for pickadate.js v3.5.0
7355  * http://amsul.github.io/pickadate.js/date.htm
7356  */
7357
7358(function (factory) {
7359  factory(Materialize.Picker, jQuery);
7360})(function (Picker, $) {
7361
7362  /**
7363   * Globals and constants
7364   */
7365  var DAYS_IN_WEEK = 7,
7366      WEEKS_IN_CALENDAR = 6,
7367      _ = Picker._;
7368
7369  /**
7370   * The date picker constructor
7371   */
7372  function DatePicker(picker, settings) {
7373
7374    var calendar = this,
7375        element = picker.$node[0],
7376        elementValue = element.value,
7377        elementDataValue = picker.$node.data('value'),
7378        valueString = elementDataValue || elementValue,
7379        formatString = elementDataValue ? settings.formatSubmit : settings.format,
7380        isRTL = function () {
7381
7382      return element.currentStyle ?
7383
7384      // For IE.
7385      element.currentStyle.direction == 'rtl' :
7386
7387      // For normal browsers.
7388      getComputedStyle(picker.$root[0]).direction == 'rtl';
7389    };
7390
7391    calendar.settings = settings;
7392    calendar.$node = picker.$node;
7393
7394    // The queue of methods that will be used to build item objects.
7395    calendar.queue = {
7396      min: 'measure create',
7397      max: 'measure create',
7398      now: 'now create',
7399      select: 'parse create validate',
7400      highlight: 'parse navigate create validate',
7401      view: 'parse create validate viewset',
7402      disable: 'deactivate',
7403      enable: 'activate'
7404
7405      // The component's item object.
7406    };calendar.item = {};
7407
7408    calendar.item.clear = null;
7409    calendar.item.disable = (settings.disable || []).slice(0);
7410    calendar.item.enable = -function (collectionDisabled) {
7411      return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
7412    }(calendar.item.disable);
7413
7414    calendar.set('min', settings.min).set('max', settings.max).set('now');
7415
7416    // When there’s a value, set the `select`, which in turn
7417    // also sets the `highlight` and `view`.
7418    if (valueString) {
7419      calendar.set('select', valueString, { format: formatString });
7420    }
7421
7422    // If there’s no value, default to highlighting “today”.
7423    else {
7424        calendar.set('select', null).set('highlight', calendar.item.now);
7425      }
7426
7427    // The keycode to movement mapping.
7428    calendar.key = {
7429      40: 7, // Down
7430      38: -7, // Up
7431      39: function () {
7432        return isRTL() ? -1 : 1;
7433      }, // Right
7434      37: function () {
7435        return isRTL() ? 1 : -1;
7436      }, // Left
7437      go: function (timeChange) {
7438        var highlightedObject = calendar.item.highlight,
7439            targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
7440        calendar.set('highlight', targetDate, { interval: timeChange });
7441        this.render();
7442      }
7443
7444      // Bind some picker events.
7445    };picker.on('render', function () {
7446      picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
7447        var value = this.value;
7448        if (value) {
7449          picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
7450          picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
7451        }
7452      });
7453      picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
7454        var value = this.value;
7455        if (value) {
7456          picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
7457          picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
7458        }
7459      });
7460    }, 1).on('open', function () {
7461      var includeToday = '';
7462      if (calendar.disabled(calendar.get('now'))) {
7463        includeToday = ':not(.' + settings.klass.buttonToday + ')';
7464      }
7465      picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
7466    }, 1).on('close', function () {
7467      picker.$root.find('button, select').attr('disabled', true);
7468    }, 1);
7469  } //DatePicker
7470
7471
7472  /**
7473   * Set a datepicker item object.
7474   */
7475  DatePicker.prototype.set = function (type, value, options) {
7476
7477    var calendar = this,
7478        calendarItem = calendar.item;
7479
7480    // If the value is `null` just set it immediately.
7481    if (value === null) {
7482      if (type == 'clear') type = 'select';
7483      calendarItem[type] = value;
7484      return calendar;
7485    }
7486
7487    // Otherwise go through the queue of methods, and invoke the functions.
7488    // Update this as the time unit, and set the final value as this item.
7489    // * In the case of `enable`, keep the queue but set `disable` instead.
7490    //   And in the case of `flip`, keep the queue but set `enable` instead.
7491    calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
7492      value = calendar[method](type, value, options);
7493      return value;
7494    }).pop();
7495
7496    // Check if we need to cascade through more updates.
7497    if (type == 'select') {
7498      calendar.set('highlight', calendarItem.select, options);
7499    } else if (type == 'highlight') {
7500      calendar.set('view', calendarItem.highlight, options);
7501    } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
7502      if (calendarItem.select && calendar.disabled(calendarItem.select)) {
7503        calendar.set('select', calendarItem.select, options);
7504      }
7505      if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
7506        calendar.set('highlight', calendarItem.highlight, options);
7507      }
7508    }
7509
7510    return calendar;
7511  }; //DatePicker.prototype.set
7512
7513
7514  /**
7515   * Get a datepicker item object.
7516   */
7517  DatePicker.prototype.get = function (type) {
7518    return this.item[type];
7519  }; //DatePicker.prototype.get
7520
7521
7522  /**
7523   * Create a picker date object.
7524   */
7525  DatePicker.prototype.create = function (type, value, options) {
7526
7527    var isInfiniteValue,
7528        calendar = this;
7529
7530    // If there’s no value, use the type as the value.
7531    value = value === undefined ? type : value;
7532
7533    // If it’s infinity, update the value.
7534    if (value == -Infinity || value == Infinity) {
7535      isInfiniteValue = value;
7536    }
7537
7538    // If it’s an object, use the native date object.
7539    else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
7540        value = value.obj;
7541      }
7542
7543      // If it’s an array, convert it into a date and make sure
7544      // that it’s a valid date – otherwise default to today.
7545      else if ($.isArray(value)) {
7546          value = new Date(value[0], value[1], value[2]);
7547          value = _.isDate(value) ? value : calendar.create().obj;
7548        }
7549
7550        // If it’s a number or date object, make a normalized date.
7551        else if (_.isInteger(value) || _.isDate(value)) {
7552            value = calendar.normalize(new Date(value), options);
7553          }
7554
7555          // If it’s a literal true or any other case, set it to now.
7556          else /*if ( value === true )*/{
7557              value = calendar.now(type, value, options);
7558            }
7559
7560    // Return the compiled object.
7561    return {
7562      year: isInfiniteValue || value.getFullYear(),
7563      month: isInfiniteValue || value.getMonth(),
7564      date: isInfiniteValue || value.getDate(),
7565      day: isInfiniteValue || value.getDay(),
7566      obj: isInfiniteValue || value,
7567      pick: isInfiniteValue || value.getTime()
7568    };
7569  }; //DatePicker.prototype.create
7570
7571
7572  /**
7573   * Create a range limit object using an array, date object,
7574   * literal “true”, or integer relative to another time.
7575   */
7576  DatePicker.prototype.createRange = function (from, to) {
7577
7578    var calendar = this,
7579        createDate = function (date) {
7580      if (date === true || $.isArray(date) || _.isDate(date)) {
7581        return calendar.create(date);
7582      }
7583      return date;
7584    };
7585
7586    // Create objects if possible.
7587    if (!_.isInteger(from)) {
7588      from = createDate(from);
7589    }
7590    if (!_.isInteger(to)) {
7591      to = createDate(to);
7592    }
7593
7594    // Create relative dates.
7595    if (_.isInteger(from) && $.isPlainObject(to)) {
7596      from = [to.year, to.month, to.date + from];
7597    } else if (_.isInteger(to) && $.isPlainObject(from)) {
7598      to = [from.year, from.month, from.date + to];
7599    }
7600
7601    return {
7602      from: createDate(from),
7603      to: createDate(to)
7604    };
7605  }; //DatePicker.prototype.createRange
7606
7607
7608  /**
7609   * Check if a date unit falls within a date range object.
7610   */
7611  DatePicker.prototype.withinRange = function (range, dateUnit) {
7612    range = this.createRange(range.from, range.to);
7613    return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
7614  };
7615
7616  /**
7617   * Check if two date range objects overlap.
7618   */
7619  DatePicker.prototype.overlapRanges = function (one, two) {
7620
7621    var calendar = this;
7622
7623    // Convert the ranges into comparable dates.
7624    one = calendar.createRange(one.from, one.to);
7625    two = calendar.createRange(two.from, two.to);
7626
7627    return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
7628  };
7629
7630  /**
7631   * Get the date today.
7632   */
7633  DatePicker.prototype.now = function (type, value, options) {
7634    value = new Date();
7635    if (options && options.rel) {
7636      value.setDate(value.getDate() + options.rel);
7637    }
7638    return this.normalize(value, options);
7639  };
7640
7641  /**
7642   * Navigate to next/prev month.
7643   */
7644  DatePicker.prototype.navigate = function (type, value, options) {
7645
7646    var targetDateObject,
7647        targetYear,
7648        targetMonth,
7649        targetDate,
7650        isTargetArray = $.isArray(value),
7651        isTargetObject = $.isPlainObject(value),
7652        viewsetObject = this.item.view; /*,
7653                                        safety = 100*/
7654
7655    if (isTargetArray || isTargetObject) {
7656
7657      if (isTargetObject) {
7658        targetYear = value.year;
7659        targetMonth = value.month;
7660        targetDate = value.date;
7661      } else {
7662        targetYear = +value[0];
7663        targetMonth = +value[1];
7664        targetDate = +value[2];
7665      }
7666
7667      // If we’re navigating months but the view is in a different
7668      // month, navigate to the view’s year and month.
7669      if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
7670        targetYear = viewsetObject.year;
7671        targetMonth = viewsetObject.month;
7672      }
7673
7674      // Figure out the expected target year and month.
7675      targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
7676      targetYear = targetDateObject.getFullYear();
7677      targetMonth = targetDateObject.getMonth();
7678
7679      // If the month we’re going to doesn’t have enough days,
7680      // keep decreasing the date until we reach the month’s last date.
7681      while ( /*safety &&*/new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
7682        targetDate -= 1;
7683        /*safety -= 1
7684        if ( !safety ) {
7685            throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
7686        }*/
7687      }
7688
7689      value = [targetYear, targetMonth, targetDate];
7690    }
7691
7692    return value;
7693  }; //DatePicker.prototype.navigate
7694
7695
7696  /**
7697   * Normalize a date by setting the hours to midnight.
7698   */
7699  DatePicker.prototype.normalize = function (value /*, options*/) {
7700    value.setHours(0, 0, 0, 0);
7701    return value;
7702  };
7703
7704  /**
7705   * Measure the range of dates.
7706   */
7707  DatePicker.prototype.measure = function (type, value /*, options*/) {
7708
7709    var calendar = this;
7710
7711    // If it’s anything false-y, remove the limits.
7712    if (!value) {
7713      value = type == 'min' ? -Infinity : Infinity;
7714    }
7715
7716    // If it’s a string, parse it.
7717    else if (typeof value == 'string') {
7718        value = calendar.parse(type, value);
7719      }
7720
7721      // If it's an integer, get a date relative to today.
7722      else if (_.isInteger(value)) {
7723          value = calendar.now(type, value, { rel: value });
7724        }
7725
7726    return value;
7727  }; ///DatePicker.prototype.measure
7728
7729
7730  /**
7731   * Create a viewset object based on navigation.
7732   */
7733  DatePicker.prototype.viewset = function (type, dateObject /*, options*/) {
7734    return this.create([dateObject.year, dateObject.month, 1]);
7735  };
7736
7737  /**
7738   * Validate a date as enabled and shift if needed.
7739   */
7740  DatePicker.prototype.validate = function (type, dateObject, options) {
7741
7742    var calendar = this,
7743
7744
7745    // Keep a reference to the original date.
7746    originalDateObject = dateObject,
7747
7748
7749    // Make sure we have an interval.
7750    interval = options && options.interval ? options.interval : 1,
7751
7752
7753    // Check if the calendar enabled dates are inverted.
7754    isFlippedBase = calendar.item.enable === -1,
7755
7756
7757    // Check if we have any enabled dates after/before now.
7758    hasEnabledBeforeTarget,
7759        hasEnabledAfterTarget,
7760
7761
7762    // The min & max limits.
7763    minLimitObject = calendar.item.min,
7764        maxLimitObject = calendar.item.max,
7765
7766
7767    // Check if we’ve reached the limit during shifting.
7768    reachedMin,
7769        reachedMax,
7770
7771
7772    // Check if the calendar is inverted and at least one weekday is enabled.
7773    hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
7774
7775      // If there’s a date, check where it is relative to the target.
7776      if ($.isArray(value)) {
7777        var dateTime = calendar.create(value).pick;
7778        if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true;else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true;
7779      }
7780
7781      // Return only integers for enabled weekdays.
7782      return _.isInteger(value);
7783    }).length; /*,
7784               safety = 100*/
7785
7786    // Cases to validate for:
7787    // [1] Not inverted and date disabled.
7788    // [2] Inverted and some dates enabled.
7789    // [3] Not inverted and out of range.
7790    //
7791    // Cases to **not** validate for:
7792    // • Navigating months.
7793    // • Not inverted and date enabled.
7794    // • Inverted and all dates disabled.
7795    // • ..and anything else.
7796    if (!options || !options.nav) if (
7797    /* 1 */!isFlippedBase && calendar.disabled(dateObject) ||
7798    /* 2 */isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) ||
7799    /* 3 */!isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
7800
7801      // When inverted, flip the direction if there aren’t any enabled weekdays
7802      // and there are no enabled dates in the direction of the interval.
7803      if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
7804        interval *= -1;
7805      }
7806
7807      // Keep looping until we reach an enabled date.
7808      while ( /*safety &&*/calendar.disabled(dateObject)) {
7809
7810        /*safety -= 1
7811        if ( !safety ) {
7812            throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
7813        }*/
7814
7815        // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
7816        if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
7817          dateObject = originalDateObject;
7818          interval = interval > 0 ? 1 : -1;
7819        }
7820
7821        // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
7822        if (dateObject.pick <= minLimitObject.pick) {
7823          reachedMin = true;
7824          interval = 1;
7825          dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
7826        } else if (dateObject.pick >= maxLimitObject.pick) {
7827          reachedMax = true;
7828          interval = -1;
7829          dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
7830        }
7831
7832        // If we’ve reached both limits, just break out of the loop.
7833        if (reachedMin && reachedMax) {
7834          break;
7835        }
7836
7837        // Finally, create the shifted date using the interval and keep looping.
7838        dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
7839      }
7840    } //endif
7841
7842
7843    // Return the date object settled on.
7844    return dateObject;
7845  }; //DatePicker.prototype.validate
7846
7847
7848  /**
7849   * Check if a date is disabled.
7850   */
7851  DatePicker.prototype.disabled = function (dateToVerify) {
7852
7853    var calendar = this,
7854
7855
7856    // Filter through the disabled dates to check if this is one.
7857    isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
7858
7859      // If the date is a number, match the weekday with 0index and `firstDay` check.
7860      if (_.isInteger(dateToDisable)) {
7861        return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
7862      }
7863
7864      // If it’s an array or a native JS date, create and match the exact date.
7865      if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
7866        return dateToVerify.pick === calendar.create(dateToDisable).pick;
7867      }
7868
7869      // If it’s an object, match a date within the “from” and “to” range.
7870      if ($.isPlainObject(dateToDisable)) {
7871        return calendar.withinRange(dateToDisable, dateToVerify);
7872      }
7873    });
7874
7875    // If this date matches a disabled date, confirm it’s not inverted.
7876    isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
7877      return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
7878    }).length;
7879
7880    // Check the calendar “enabled” flag and respectively flip the
7881    // disabled state. Then also check if it’s beyond the min/max limits.
7882    return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
7883  }; //DatePicker.prototype.disabled
7884
7885
7886  /**
7887   * Parse a string into a usable type.
7888   */
7889  DatePicker.prototype.parse = function (type, value, options) {
7890
7891    var calendar = this,
7892        parsingObject = {};
7893
7894    // If it’s already parsed, we’re good.
7895    if (!value || typeof value != 'string') {
7896      return value;
7897    }
7898
7899    // We need a `.format` to parse the value with.
7900    if (!(options && options.format)) {
7901      options = options || {};
7902      options.format = calendar.settings.format;
7903    }
7904
7905    // Convert the format into an array and then map through it.
7906    calendar.formats.toArray(options.format).map(function (label) {
7907
7908      var
7909      // Grab the formatting label.
7910      formattingLabel = calendar.formats[label],
7911
7912
7913      // The format length is from the formatting label function or the
7914      // label length without the escaping exclamation (!) mark.
7915      formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length;
7916
7917      // If there's a format label, split the value up to the format length.
7918      // Then add it to the parsing object with appropriate label.
7919      if (formattingLabel) {
7920        parsingObject[label] = value.substr(0, formatLength);
7921      }
7922
7923      // Update the value as the substring from format length to end.
7924      value = value.substr(formatLength);
7925    });
7926
7927    // Compensate for month 0index.
7928    return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
7929  }; //DatePicker.prototype.parse
7930
7931
7932  /**
7933   * Various formats to display the object in.
7934   */
7935  DatePicker.prototype.formats = function () {
7936
7937    // Return the length of the first word in a collection.
7938    function getWordLengthFromCollection(string, collection, dateObject) {
7939
7940      // Grab the first word from the string.
7941      var word = string.match(/\w+/)[0];
7942
7943      // If there's no month index, add it to the date object
7944      if (!dateObject.mm && !dateObject.m) {
7945        dateObject.m = collection.indexOf(word) + 1;
7946      }
7947
7948      // Return the length of the word.
7949      return word.length;
7950    }
7951
7952    // Get the length of the first word in a string.
7953    function getFirstWordLength(string) {
7954      return string.match(/\w+/)[0].length;
7955    }
7956
7957    return {
7958
7959      d: function (string, dateObject) {
7960
7961        // If there's string, then get the digits length.
7962        // Otherwise return the selected date.
7963        return string ? _.digits(string) : dateObject.date;
7964      },
7965      dd: function (string, dateObject) {
7966
7967        // If there's a string, then the length is always 2.
7968        // Otherwise return the selected date with a leading zero.
7969        return string ? 2 : _.lead(dateObject.date);
7970      },
7971      ddd: function (string, dateObject) {
7972
7973        // If there's a string, then get the length of the first word.
7974        // Otherwise return the short selected weekday.
7975        return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
7976      },
7977      dddd: function (string, dateObject) {
7978
7979        // If there's a string, then get the length of the first word.
7980        // Otherwise return the full selected weekday.
7981        return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
7982      },
7983      m: function (string, dateObject) {
7984
7985        // If there's a string, then get the length of the digits
7986        // Otherwise return the selected month with 0index compensation.
7987        return string ? _.digits(string) : dateObject.month + 1;
7988      },
7989      mm: function (string, dateObject) {
7990
7991        // If there's a string, then the length is always 2.
7992        // Otherwise return the selected month with 0index and leading zero.
7993        return string ? 2 : _.lead(dateObject.month + 1);
7994      },
7995      mmm: function (string, dateObject) {
7996
7997        var collection = this.settings.monthsShort;
7998
7999        // If there's a string, get length of the relevant month from the short
8000        // months collection. Otherwise return the selected month from that c
8000ollection.
8001        return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
8002      },
8003      mmmm: function (string, dateObject) {
8004
8005        var collection = this.settings.monthsFull;
8006
8007        // If there's a string, get length of the relevant month from the full
8008        // months collection. Otherwise return the selected month from that collection.
8009        return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
8010      },
8011      yy: function (string, dateObject) {
8012
8013        // If there's a string, then the length is always 2.
8014        // Otherwise return the selected year by slicing out the first 2 digits.
8015        return string ? 2 : ('' + dateObject.year).slice(2);
8016      },
8017      yyyy: function (string, dateObject) {
8018
8019        // If there's a string, then the length is always 4.
8020        // Otherwise return the selected year.
8021        return string ? 4 : dateObject.year;
8022      },
8023
8024      // Create an array by splitting the formatting string passed.
8025      toArray: function (formatString) {
8026        return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
8027      },
8028
8029      // Format an object into a string using the formatting options.
8030      toString: function (formatString, itemObject) {
8031        var calendar = this;
8032        return calendar.formats.toArray(formatString).map(function (label) {
8033          return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
8034        }).join('');
8035      }
8036    };
8037  }(); //DatePicker.prototype.formats
8038
8039
8040  /**
8041   * Check if two date units are the exact.
8042   */
8043  DatePicker.prototype.isDateExact = function (one, two) {
8044
8045    var calendar = this;
8046
8047    // When we’re working with weekdays, do a direct comparison.
8048    if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
8049      return one === two;
8050    }
8051
8052    // When we’re working with date representations, compare the “pick” value.
8053    if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
8054      return calendar.create(one).pick === calendar.create(two).pick;
8055    }
8056
8057    // When we’re working with range objects, compare the “from” and “to”.
8058    if ($.isPlainObject(one) && $.isPlainObject(two)) {
8059      return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
8060    }
8061
8062    return false;
8063  };
8064
8065  /**
8066   * Check if two date units overlap.
8067   */
8068  DatePicker.prototype.isDateOverlap = function (one, two) {
8069
8070    var calendar = this,
8071        firstDay = calendar.settings.firstDay ? 1 : 0;
8072
8073    // When we’re working with a weekday index, compare the days.
8074    if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
8075      one = one % 7 + firstDay;
8076      return one === calendar.create(two).day + 1;
8077    }
8078    if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
8079      two = two % 7 + firstDay;
8080      return two === calendar.create(one).day + 1;
8081    }
8082
8083    // When we’re working with range objects, check if the ranges overlap.
8084    if ($.isPlainObject(one) && $.isPlainObject(two)) {
8085      return calendar.overlapRanges(one, two);
8086    }
8087
8088    return false;
8089  };
8090
8091  /**
8092   * Flip the “enabled” state.
8093   */
8094  DatePicker.prototype.flipEnable = function (val) {
8095    var itemObject = this.item;
8096    itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
8097  };
8098
8099  /**
8100   * Mark a collection of dates as “disabled”.
8101   */
8102  DatePicker.prototype.deactivate = function (type, datesToDisable) {
8103
8104    var calendar = this,
8105        disabledItems = calendar.item.disable.slice(0);
8106
8107    // If we’re flipping, that’s all we need to do.
8108    if (datesToDisable == 'flip') {
8109      calendar.flipEnable();
8110    } else if (datesToDisable === false) {
8111      calendar.flipEnable(1);
8112      disabledItems = [];
8113    } else if (datesToDisable === true) {
8114      calendar.flipEnable(-1);
8115      disabledItems = [];
8116    }
8117
8118    // Otherwise go through the dates to disable.
8119    else {
8120
8121        datesToDisable.map(function (unitToDisable) {
8122
8123          var matchFound;
8124
8125          // When we have disabled items, check for matches.
8126          // If something is matched, immediately break out.
8127          for (var index = 0; index < disabledItems.length; index += 1) {
8128            if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
8129              matchFound = true;
8130              break;
8131            }
8132          }
8133
8134          // If nothing was found, add the validated unit to the collection.
8135          if (!matchFound) {
8136            if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
8137              disabledItems.push(unitToDisable);
8138            }
8139          }
8140        });
8141      }
8142
8143    // Return the updated collection.
8144    return disabledItems;
8145  }; //DatePicker.prototype.deactivate
8146
8147
8148  /**
8149   * Mark a collection of dates as “enabled”.
8150   */
8151  DatePicker.prototype.activate = function (type, datesToEnable) {
8152
8153    var calendar = this,
8154        disabledItems = calendar.item.disable,
8155        disabledItemsCount = disabledItems.length;
8156
8157    // If we’re flipping, that’s all we need to do.
8158    if (datesToEnable == 'flip') {
8159      calendar.flipEnable();
8160    } else if (datesToEnable === true) {
8161      calendar.flipEnable(1);
8162      disabledItems = [];
8163    } else if (datesToEnable === false) {
8164      calendar.flipEnable(-1);
8165      disabledItems = [];
8166    }
8167
8168    // Otherwise go through the disabled dates.
8169    else {
8170
8171        datesToEnable.map(function (unitToEnable) {
8172
8173          var matchFound, disabledUnit, index, isExactRange;
8174
8175          // Go through the disabled items and try to find a match.
8176          for (index = 0; index < disabledItemsCount; index += 1) {
8177
8178            disabledUnit = disabledItems[index];
8179
8180            // When an exact match is found, remove it from the collection.
8181            if (calendar.isDateExact(disabledUnit, unitToEnable)) {
8182              matchFound = disabledItems[index] = null;
8183              isExactRange = true;
8184              break;
8185            }
8186
8187            // When an overlapped match is found, add the “inverted” state to it.
8188            else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
8189                if ($.isPlainObject(unitToEnable)) {
8190                  unitToEnable.inverted = true;
8191                  matchFound = unitToEnable;
8192                } else if ($.isArray(unitToEnable)) {
8193                  matchFound = unitToEnable;
8194                  if (!matchFound[3]) matchFound.push('inverted');
8195                } else if (_.isDate(unitToEnable)) {
8196                  matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
8197                }
8198                break;
8199              }
8200          }
8201
8202          // If a match was found, remove a previous duplicate entry.
8203          if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
8204            if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
8205              disabledItems[index] = null;
8206              break;
8207            }
8208          }
8209
8210          // In the event that we’re dealing with an exact range of dates,
8211          // make sure there are no “inverted” dates because of it.
8212          if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
8213            if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
8214              disabledItems[index] = null;
8215              break;
8216            }
8217          }
8218
8219          // If something is still matched, add it into the collection.
8220          if (matchFound) {
8221            disabledItems.push(matchFound);
8222          }
8223        });
8224      }
8225
8226    // Return the updated collection.
8227    return disabledItems.filter(function (val) {
8228      return val != null;
8229    });
8230  }; //DatePicker.prototype.activate
8231
8232
8233  /**
8234   * Create a string for the nodes in the picker.
8235   */
8236  DatePicker.prototype.nodes = function (isOpen) {
8237
8238    var calendar = this,
8239        settings = calendar.settings,
8240        calendarItem = calendar.item,
8241        nowObject = calendarItem.now,
8242        selectedObject = calendarItem.select,
8243        highlightedObject = calendarItem.highlight,
8244        viewsetObject = calendarItem.view,
8245        disabledCollection = calendarItem.disable,
8246        minLimitObject = calendarItem.min,
8247        maxLimitObject = calendarItem.max,
8248
8249
8250    // Create the calendar table head using a copy of weekday labels collection.
8251    // * We do a copy so we don't mutate the original array.
8252    tableHead = function (collection, fullCollection) {
8253
8254      // If the first day should be Monday, move Sunday to the end.
8255      if (settings.firstDay) {
8256        collection.push(collection.shift());
8257        fullCollection.push(fullCollection.shift());
8258      }
8259
8260      // Create and return the table head group.
8261      return _.node('thead', _.node('tr', _.group({
8262        min: 0,
8263        max: DAYS_IN_WEEK - 1,
8264        i: 1,
8265        node: 'th',
8266        item: function (counter) {
8267          return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
8268        }
8269      }))); //endreturn
8270
8271      // Materialize modified
8272    }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0)),
8273        //tableHead
8274
8275
8276    // Create the nav for next/prev month.
8277    createMonthNav = function (next) {
8278
8279      // Otherwise, return the created month tag.
8280      return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + (
8281
8282      // If the focused month is outside the range, disabled the button.
8283      next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month || !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ? ' ' + settings.klass.navDisabled : ''), 'data-nav=' + (next || -1) + ' ' + _.ariaAttr({
8284        role: 'button',
8285        controls: calendar.$node[0].id + '_table'
8286      }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'); //endreturn
8287    },
8288        //createMonthNav
8289
8290
8291    // Create the month label.
8292    //Materialize modified
8293    createMonthLabel = function (override) {
8294
8295      var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
8296
8297      // Materialize modified
8298      if (override == "short_months") {
8299        monthsCollection = settings.monthsShort;
8300      }
8301
8302      // If there are months to select, add a dropdown menu.
8303      if (settings.selectMonths && override == undefined) {
8304
8305        return _.node('select', _.group({
8306          min: 0,
8307          max: 11,
8308          i: 1,
8309          node: 'option',
8310          item: function (loopedMonth) {
8311
8312            return [
8313
8314            // The looped month and no classes.
8315            monthsCollection[loopedMonth], 0,
8316
8317            // Set the value and selected index.
8318            'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
8319          }
8320        }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
8321      }
8322
8323      // Materialize modified
8324      if (override == "short_months") if (selectedObject != null) return monthsCollection[selectedObject.month];else return monthsCollection[viewsetObject.month];
8325
8326      // If there's a need for a month selector
8327      return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
8328    },
8329        //createMonthLabel
8330
8331
8332    // Create the year label.
8333    // Materialize modified
8334    createYearLabel = function (override) {
8335
8336      var focusedYear = viewsetObject.year,
8337
8338
8339      // If years selector is set to a literal "true", set it to 5. Otherwise
8340      // divide in half to get half before and half after focused year.
8341      numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2);
8342
8343      // If there are years to select, add a dropdown menu.
8344      if (numberYears) {
8345
8346        var minYear = minLimitObject.year,
8347            maxYear = maxLimitObject.year,
8348            lowestYear = focusedYear - numberYears,
8349            highestYear = focusedYear + numberYears;
8350
8351        // If the min year is greater than the lowest year, increase the highest year
8352        // by the difference and set the lowest year to the min year.
8353        if (minYear > lowestYear) {
8354          highestYear += minYear - lowestYear;
8355          lowestYear = minYear;
8356        }
8357
8358        // If the max year is less than the highest year, decrease the lowest year
8359        // by the lower of the two: available and needed years. Then set the
8360        // highest year to the max year.
8361        if (maxYear < highestYear) {
8362
8363          var availableYears = lowestYear - minYear,
8364              neededYears = highestYear - maxYear;
8365
8366          lowestYear -= availableYears > neededYears ? neededYears : availableYears;
8367          highestYear = maxYear;
8368        }
8369
8370        if (settings.selectYears && override == undefined) {
8371          return _.node('select', _.group({
8372            min: lowestYear,
8373            max: highestYear,
8374            i: 1,
8375            node: 'option',
8376            item: function (loopedYear) {
8377              return [
8378
8379              // The looped year and no classes.
8380              loopedYear, 0,
8381
8382              // Set the value and selected index.
8383              'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
8384            }
8385          }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelYearSelect + '"');
8386        }
8387      }
8388
8389      // Materialize modified
8390      if (override === 'raw' && selectedObject != null) {
8391        return _.node('div', selectedObject.year);
8392      }
8393
8394      // Otherwise just return the year focused
8395      return _.node('div', focusedYear, settings.klass.year);
8396    }; //createYearLabel
8397
8398
8399    // Materialize modified
8400    createDayLabel = function () {
8401      if (selectedObject != null) return selectedObject.date;else return nowObject.date;
8402    };
8403    createWeekdayLabel = function () {
8404      var display_day;
8405
8406      if (selectedObject != null) display_day = selectedObject.day;else display_day = nowObject.day;
8407      var weekday = settings.weekdaysShort[display_day];
8408      return weekday;
8409    };
8410
8411    // Create and return the entire calendar.
8412
8413    return _.node(
8414    // Date presentation View
8415    'div', _.node(
8416    // Div for Year
8417    'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node(
8418    // Div for short Month
8419    'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node(
8420    // Div for Day
8421    'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) +
8422    // Calendar container
8423    _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
8424      min: 0,
8425      max: WEEKS_IN_CALENDAR - 1,
8426      i: 1,
8427      node: 'tr',
8428      item: function (rowCounter) {
8429
8430        // If Monday is the first day and the month starts on Sunday, shift the date back a week.
8431        var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
8432
8433        return [_.group({
8434          min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
8435          max: function () {
8436            return this.min + DAYS_IN_WEEK - 1;
8437          },
8438          i: 1,
8439          node: 'td',
8440          item: function (targetDate) {
8441
8442            // Convert the time date from a relative date to a target date.
8443            targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
8444
8445            var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
8446                isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
8447                isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
8448                formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
8449
8450            return [_.node('div', targetDate.date, function (klasses) {
8451
8452              // Add the `infocus` or `outfocus` classes based on month in view.
8453              klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus);
8454
8455              // Add the `today` class if needed.
8456              if (nowObject.pick == targetDate.pick) {
8457                klasses.push(settings.klass.now);
8458              }
8459
8460              // Add the `selected` class if something's selected and the time matches.
8461              if (isSelected) {
8462                klasses.push(settings.klass.selected);
8463              }
8464
8465              // Add the `highlighted` class if something's highlighted and the time matches.
8466              if (isHighlighted) {
8467                klasses.push(settings.klass.highlighted);
8468              }
8469
8470              // Add the `disabled` class if something's disabled and the object matches.
8471              if (isDisabled) {
8472                klasses.push(settings.klass.disabled);
8473              }
8474
8475              return klasses.join(' ');
8476            }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
8477              role: 'gridcell',
8478              label: formattedDate,
8479              selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
8480              activedescendant: isHighlighted ? true : null,
8481              disabled: isDisabled ? true : null
8482            }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({ role: 'presentation' })]; //endreturn
8483          }
8484        })]; //endreturn
8485      }
8486    })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
8487      role: 'grid',
8488      controls: calendar.$node[0].id,
8489      readonly: true
8490    })), settings.klass.calendar_container) // end calendar
8491
8492    +
8493
8494    // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
8495    _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-
8495pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })), settings.klass.footer), 'picker__container__wrapper'); //endreturn
8496  }; //DatePicker.prototype.nodes
8497
8498
8499  /**
8500   * The date picker defaults.
8501   */
8502  DatePicker.defaults = function (prefix) {
8503
8504    return {
8505
8506      // The title label to use for the month nav buttons
8507      labelMonthNext: 'Next month',
8508      labelMonthPrev: 'Previous month',
8509
8510      // The title label to use for the dropdown selectors
8511      labelMonthSelect: 'Select a month',
8512      labelYearSelect: 'Select a year',
8513
8514      // Months and weekdays
8515      monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
8516      monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
8517      weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
8518      weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
8519
8520      // Materialize modified
8521      weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
8522
8523      // Today and clear
8524      today: 'Today',
8525      clear: 'Clear',
8526      close: 'Ok',
8527
8528      // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
8529      closeOnSelect: false,
8530
8531      // The format to show on the `input` element
8532      format: 'd mmmm, yyyy',
8533
8534      // Classes
8535      klass: {
8536
8537        table: prefix + 'table',
8538
8539        header: prefix + 'header',
8540
8541        // Materialize Added klasses
8542        date_display: prefix + 'date-display',
8543        day_display: prefix + 'day-display',
8544        month_display: prefix + 'month-display',
8545        year_display: prefix + 'year-display',
8546        calendar_container: prefix + 'calendar-container',
8547        // end
8548
8549
8550        navPrev: prefix + 'nav--prev',
8551        navNext: prefix + 'nav--next',
8552        navDisabled: prefix + 'nav--disabled',
8553
8554        month: prefix + 'month',
8555        year: prefix + 'year',
8556
8557        selectMonth: prefix + 'select--month',
8558        selectYear: prefix + 'select--year',
8559
8560        weekdays: prefix + 'weekday',
8561
8562        day: prefix + 'day',
8563        disabled: prefix + 'day--disabled',
8564        selected: prefix + 'day--selected',
8565        highlighted: prefix + 'day--highlighted',
8566        now: prefix + 'day--today',
8567        infocus: prefix + 'day--infocus',
8568        outfocus: prefix + 'day--outfocus',
8569
8570        footer: prefix + 'footer',
8571
8572        buttonClear: prefix + 'button--clear',
8573        buttonToday: prefix + 'button--today',
8574        buttonClose: prefix + 'button--close'
8575      }
8576    };
8577  }(Picker.klasses().picker + '__');
8578
8579  /**
8580   * Extend the picker to add the date picker.
8581   */
8582  Picker.extend('pickadate', DatePicker);
8583});
8584; /*!
8585  * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
8586  * Copyright 2014 Wang Shenwei.
8587  * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
8588  *
8589  * Further modified
8590  * Copyright 2015 Ching Yaw Hao.
8591  */
8592
8593(function ($) {
8594  var $win = $(window),
8595      $doc = $(document);
8596
8597  // Can I use inline svg ?
8598  var svgNS = 'http://www.w3.org/2000/svg',
8599      svgSupported = 'SVGAngle' in window && function () {
8600    var supported,
8601        el = document.createElement('div');
8602    el.innerHTML = '<svg/>';
8603    supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
8604    el.innerHTML = '';
8605    return supported;
8606  }();
8607
8608  // Can I use transition ?
8609  var transitionSupported = function () {
8610    var style = document.createElement('div').style;
8611    return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
8612  }();
8613
8614  // Listen touch events in touch screen device, instead of mouse events in desktop.
8615  var touchSupported = 'ontouchstart' in window,
8616      mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : ''),
8617      mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : ''),
8618      mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : '');
8619
8620  // Vibrate the device if supported
8621  var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
8622
8623  function createSvgElement(name) {
8624    return document.createElementNS(svgNS, name);
8625  }
8626
8627  function leadingZero(num) {
8628    return (num < 10 ? '0' : '') + num;
8629  }
8630
8631  // Get a unique id
8632  var idCounter = 0;
8633  function uniqueId(prefix) {
8634    var id = ++idCounter + '';
8635    return prefix ? prefix + id : id;
8636  }
8637
8638  // Clock size
8639  var dialRadius = 135,
8640      outerRadius = 105,
8641
8642  // innerRadius = 80 on 12 hour clock
8643  innerRadius = 70,
8644      tickRadius = 20,
8645      diameter = dialRadius * 2,
8646      duration = transitionSupported ? 350 : 1;
8647
8648  // Popover template
8649  var tpl = ['<div class="clockpicker picker">', '<div class="picker__holder">', '<div class="picker__frame">', '<div class="picker__wrap">', '<div class="picker__box">', '<div class="picker__date-display">', '<div class="clockpicker-display">', '<div class="clockpicker-display-column">', '<span class="clockpicker-span-hours text-primary"></span>', ':', '<span class="clockpicker-span-minutes"></span>', '</div>', '<div class="clockpicker-display-column clockpicker-display-am-pm">', '<div class="clockpicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="picker__container__wrapper">', '<div class="picker__calendar-container">', '<div class="clockpicker-plate">', '<div class="clockpicker-canvas"></div>', '<div class="clockpicker-dial clockpicker-hours"></div>', '<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>', '</div>', '<div class="clockpicker-am-pm-block">', '</div>', '</div>', '<div class="picker__footer">', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
8650
8651  // ClockPicker
8652  function ClockPicker(element, options) {
8653    var popover = $(tpl),
8654        plate = popover.find('.clockpicker-plate'),
8655        holder = popover.find('.picker__holder'),
8656        hoursView = popover.find('.clockpicker-hours'),
8657        minutesView = popover.find('.clockpicker-minutes'),
8658        amPmBlock = popover.find('.clockpicker-am-pm-block'),
8659        isInput = element.prop('tagName') === 'INPUT',
8660        input = isInput ? element : element.find('input'),
8661        label = $("label[for=" + input.attr("id") + "]"),
8662        self = this;
8663
8664    this.id = uniqueId('cp');
8665    this.element = element;
8666    this.holder = holder;
8667    this.options = options;
8668    this.isAppended = false;
8669    this.isShown = false;
8670    this.currentView = 'hours';
8671    this.isInput = isInput;
8672    this.input = input;
8673    this.label = label;
8674    this.popover = popover;
8675    this.plate = plate;
8676    this.hoursView = hoursView;
8677    this.minutesView = minutesView;
8678    this.amPmBlock = amPmBlock;
8679    this.spanHours = popover.find('.clockpicker-span-hours');
8680    this.spanMinutes = popover.find('.clockpicker-span-minutes');
8681    this.spanAmPm = popover.find('.clockpicker-span-am-pm');
8682    this.footer = popover.find('.picker__footer');
8683    this.amOrPm = "PM";
8684
8685    // Setup for for 12 hour clock if option is selected
8686    if (options.twelvehour) {
8687      if (!options.ampmclickable) {
8688        this.spanAmPm.empty();
8689        $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
8690        $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
8691      } else {
8692        this.spanAmPm.empty();
8693        $('<div id="click-am">AM</div>').on("click", function () {
8694          self.spanAmPm.children('#click-am').addClass("text-primary");
8695          self.spanAmPm.children('#click-pm').removeClass("text-primary");
8696          self.amOrPm = "AM";
8697        }).appendTo(this.spanAmPm);
8698        $('<div id="click-pm">PM</div>').on("click", function () {
8699          self.spanAmPm.children('#click-pm').addClass("text-primary");
8700          self.spanAmPm.children('#click-am').removeClass("text-primary");
8701          self.amOrPm = 'PM';
8702        }).appendTo(this.spanAmPm);
8703      }
8704    }
8705
8706    // Add buttons to footer
8707    $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
8708    $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
8709    $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
8710
8711    this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
8712    this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
8713
8714    // Show or toggle
8715    input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
8716
8717    // Build ticks
vendor: 6,913 bytes, lines 8718-8924
8718    var tickTpl = $('<div class="clockpicker-tick"></div>'),
8719        i,
8720        tick,
8721        radian,
8722        radius;
8723
8724    // Hours view
8725    if (options.twelvehour) {
8726      for (i = 1; i < 13; i += 1) {
8727        tick = tickTpl.clone();
8728        radian = i / 6 * Math.PI;
8729        radius = outerRadius;
8730        tick.css({
8731          left: dialRadius + Math.sin(radian) * radius - tickRadius,
8732          top: dialRadius - Math.cos(radian) * radius - tickRadius
8733        });
8734        tick.html(i === 0 ? '00' : i);
8735        hoursView.append(tick);
8736        tick.on(mousedownEvent, mousedown);
8737      }
8738    } else {
8739      for (i = 0; i < 24; i += 1) {
8740        tick = tickTpl.clone();
8741        radian = i / 6 * Math.PI;
8742        var inner = i > 0 && i < 13;
8743        radius = inner ? innerRadius : outerRadius;
8744        tick.css({
8745          left: dialRadius + Math.sin(radian) * radius - tickRadius,
8746          top: dialRadius - Math.cos(radian) * radius - tickRadius
8747        });
8748        tick.html(i === 0 ? '00' : i);
8749        hoursView.append(tick);
8750        tick.on(mousedownEvent, mousedown);
8751      }
8752    }
8753
8754    // Minutes view
8755    for (i = 0; i < 60; i += 5) {
8756      tick = tickTpl.clone();
8757      radian = i / 30 * Math.PI;
8758      tick.css({
8759        left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
8760        top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
8761      });
8762      tick.html(leadingZero(i));
8763      minutesView.append(tick);
8764      tick.on(mousedownEvent, mousedown);
8765    }
8766
8767    // Clicking on minutes view space
8768    plate.on(mousedownEvent, function (e) {
8769      if ($(e.target).closest('.clockpicker-tick').length === 0) {
8770        mousedown(e, true);
8771      }
8772    });
8773
8774    // Mousedown or touchstart
8775    function mousedown(e, space) {
8776      var offset = plate.offset(),
8777          isTouch = /^touch/.test(e.type),
8778          x0 = offset.left + dialRadius,
8779          y0 = offset.top + dialRadius,
8780          dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
8781          dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
8782          z = Math.sqrt(dx * dx + dy * dy),
8783          moved = false;
8784
8785      // When clicking on minutes view space, check the mouse position
8786      if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
8787        return;
8788      }
8789      e.preventDefault();
8790
8791      // Set cursor style of body after 200ms
8792      var movingTimer = setTimeout(function () {
8793        self.popover.addClass('clockpicker-moving');
8794      }, 200);
8795
8796      // Clock
8797      self.setHand(dx, dy, !space, true);
8798
8799      // Mousemove on document
8800      $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
8801        e.preventDefault();
8802        var isTouch = /^touch/.test(e.type),
8803            x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
8804            y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
8805        if (!moved && x === dx && y === dy) {
8806          // Clicking in chrome on windows will trigger a mousemove event
8807          return;
8808        }
8809        moved = true;
8810        self.setHand(x, y, false, true);
8811      });
8812
8813      // Mouseup on document
8814      $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
8815        $doc.off(mouseupEvent);
8816        e.preventDefault();
8817        var isTouch = /^touch/.test(e.type),
8818            x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
8819            y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
8820        if ((space || moved) && x === dx && y === dy) {
8821          self.setHand(x, y);
8822        }
8823
8824        if (self.currentView === 'hours') {
8825          self.toggleView('minutes', duration / 2);
8826        } else if (options.autoclose) {
8827          self.minutesView.addClass('clockpicker-dial-out');
8828          setTimeout(function () {
8829            self.done();
8830          }, duration / 2);
8831        }
8832        plate.prepend(canvas);
8833
8834        // Reset cursor style of body
8835        clearTimeout(movingTimer);
8836        self.popover.removeClass('clockpicker-moving');
8837
8838        // Unbind mousemove event
8839        $doc.off(mousemoveEvent);
8840      });
8841    }
8842
8843    if (svgSupported) {
8844      // Draw clock hands and others
8845      var canvas = popover.find('.clockpicker-canvas'),
8846          svg = createSvgElement('svg');
8847      svg.setAttribute('class', 'clockpicker-svg');
8848      svg.setAttribute('width', diameter);
8849      svg.setAttribute('height', diameter);
8850      var g = createSvgElement('g');
8851      g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
8852      var bearing = createSvgElement('circle');
8853      bearing.setAttribute('class', 'clockpicker-canvas-bearing');
8854      bearing.setAttribute('cx', 0);
8855      bearing.setAttribute('cy', 0);
8856      bearing.setAttribute('r', 4);
8857      var hand = createSvgElement('line');
8858      hand.setAttribute('x1', 0);
8859      hand.setAttribute('y1', 0);
8860      var bg = createSvgElement('circle');
8861      bg.setAttribute('class', 'clockpicker-canvas-bg');
8862      bg.setAttribute('r', tickRadius);
8863      g.appendChild(hand);
8864      g.appendChild(bg);
8865      g.appendChild(bearing);
8866      svg.appendChild(g);
8867      canvas.append(svg);
8868
8869      this.hand = hand;
8870      this.bg = bg;
8871      this.bearing = bearing;
8872      this.g = g;
8873      this.canvas = canvas;
8874    }
8875
8876    raiseCallback(this.options.init);
8877  }
8878
8879  function raiseCallback(callbackFunction) {
8880    if (callbackFunction && typeof callbackFunction === "function") callbackFunction();
8881  }
8882
8883  // Default options
8884  ClockPicker.DEFAULTS = {
8885    'default': '', // default time, 'now' or '13:14' e.g.
8886    fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
8887    donetext: 'Ok', // done button text
8888    cleartext: 'Clear',
8889    canceltext: 'Cancel',
8890    autoclose: false, // auto close when minute is selected
8891    ampmclickable: true, // set am/pm button on itself
8892    darktheme: false, // set to dark theme
8893    twelvehour: true, // change to 12 hour AM/PM clock from 24 hour
8894    vibrate: true // vibrate the device when dragging clock hand
8895  };
8896
8897  // Show or hide popover
8898  ClockPicker.prototype.toggle = function () {
8899    this[this.isShown ? 'hide' : 'show']();
8900  };
8901
8902  // Set popover position
8903  ClockPicker.prototype.locate = function () {
8904    var element = this.element,
8905        popover = this.popover,
8906        offset = element.offset(),
8907        width = element.outerWidth(),
8908        height = element.outerHeight(),
8909        align = this.options.align,
8910        self = this;
8911
8912    popover.show();
8913  };
8914
8915  // Show popover
8916  ClockPicker.prototype.show = function (e) {
8917    // Not show again
8918    if (this.isShown) {
8919      return;
8920    }
8921    raiseCallback(this.options.beforeShow);
8922    $(':input').each(function () {
8923      $(this).attr('tabindex', -1);
8924    });
8925    var self = this;
8926    // Initialize
8927    this.input.blur();
8928    this.popover.addClass('picker--opened');
8929    this.input.addClass('picker__input picker__input--active');
8930    $(document.body).css('overflow', 'hidden');
8931    // Get the time
8932    var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
8933    if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
8934      if (value[1].indexOf("AM") > 0) {
8935        this.amOrPm = 'AM';
8936      } else {
8937        this.amOrPm = 'PM';
8938      }
8939      value[1] = value[1].replace("AM", "").replace("PM", "");
8940    }
8941    if (value[0] === 'now') {
8942      var now = new Date(+new Date() + this.options.fromnow);
8943      value = [now.getHours(), now.getMinutes()];
8944      if (this.options.twelvehour) {
8945        this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
8946      }
8947    }
8948    this.hours = +value[0] || 0;
8949    this.minutes = +value[1] || 0;
8950    this.spanHours.html(this.hours);
8951    this.spanMinutes.html(leadingZero(this.minutes));
8952    if (!this.isAppended) {
8953
8954      // Append popover to input by default
8955      var containerEl = document.querySelector(this.options.container);
8956      if (this.options.container && containerEl) {
8957        containerEl.appendChild(this.popover[0]);
8958      } else {
8959        this.popover.insertAfter(this.input);
8960      }
8961
8962      if (this.options.twelvehour) {
8963        if (this.amOrPm === 'PM') {
8964          this.spanAmPm.children('#click-pm').addClass("text-primary");
8965          this.spanAmPm.children('#click-am').removeClass("text-primary");
8966        } else {
8967          this.spanAmPm.children('#click-am').addClass("text-primary");
8968          this.spanAmPm.children('#click-pm').removeClass("text-primary");
8969        }
8970      }
8971      // Reset position when resize
8972      $win.on('resize.clockpicker' + this.id, function () {
8973        if (self.isShown) {
8974          self.locate();
8975        }
8976      });
8977      this.isAppended = true;
8978    }
8979    // Toggle to hours view
8980    this.toggleView('hours');
8981    // Set position
8982    this.locate();
8983    this.isShown = true;
8984    // Hide when clicking or tabbing on any element except the clock and input
8985    $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
8986      var target = $(e.target);
8987      if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
8988        self.hide();
8989      }
8990    });
8991    // Hide when ESC is pressed
8992    $doc.on('keyup.clockpicker.' + this.id, function (e) {
8993      if (e.keyCode === 27) {
8994        self.hide();
8995      }
8996    });
8997    raiseCallback(this.options.afterShow);
8998  };
8999  // Hide popover
9000  ClockPicker.prototype.hide = function () {
9001    raiseCallback(this.options.beforeHide);
9002    this.input.removeClass('picker__input picker__input--active');
9003    this.popover.removeClass('picker--opened');
9004    $(document.body).css('overflow', 'visible');
9005    this.isShown = false;
9006    $(':input').each(function (index) {
9007      $(this).attr('tabindex', index + 1);
9008    });
9009    // Unbinding events on document
9010    $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
9011    $doc.off('keyup.clockpicker.' + this.id);
9012    this.popover.hide();
9013    raiseCallback(this.options.afterHide);
9014  };
9015  // Toggle to hours or minutes view
9016  ClockPicker.prototype.toggleView = function (view, delay) {
9017    var raiseAfterHourSelect = false;
9018    if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
9019      raiseCallback(this.options.beforeHourSelect);
9020      raiseAfterHourSelect = true;
9021    }
9022    var isHours = view === 'hours',
9023        nextView = isHours ? this.hoursView : this.minutesView,
9024        hideView = isHours ? this.minutesView : this.hoursView;
9025    this.currentView = view;
9026
9027    this.spanHours.toggleClass('text-primary', isHours);
9028    this.spanMinutes.toggleClass('text-primary', !isHours);
9029
9030    // Let's make transitions
9031    hideView.addClass('clockpicker-dial-out');
9032    nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
9033
9034    // Reset clock hand
9035    this.resetClock(delay);
9036
9037    // After transitions ended
9038    clearTimeout(this.toggleViewTimer);
9039    this.toggleViewTimer = setTimeout(function () {
9040      hideView.css('visibility', 'hidden');
9041    }, duration);
9042
9043    if (raiseAfterHourSelect) {
9044      raiseCallback(this.options.afterHourSelect);
9045    }
9046  };
9047
9048  // Reset clock hand
9049  ClockPicker.prototype.resetClock = function (delay) {
9050    var view = this.currentView,
9051        value = this[view],
9052        isHours = view === 'hours',
9053        unit = Math.PI / (isHours ? 6 : 30),
9054        radian = value * unit,
9055        radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
9056        x = Math.sin(radian) * radius,
9057        y = -Math.cos(radian) * radius,
9058        self = this;
9059
9060    if (svgSupported && delay) {
9061      self.canvas.addClass('clockpicker-canvas-out');
9062      setTimeout(function () {
9063        self.canvas.removeClass('clockpicker-canvas-out');
9064        self.setHand(x, y);
9065      }, delay);
9066    } else this.setHand(x, y);
9067  };
9068
9069  // Set clock hand to (x, y)
9070  ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
9071    var radian = Math.atan2(x, -y),
9072        isHours = this.currentView === 'hours',
9073        unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
9074        z = Math.sqrt(x * x + y * y),
9075        options = this.options,
9076        inner = isHours && z < (outerRadius + innerRadius) / 2,
9077        radius = inner ? innerRadius : outerRadius,
9078        value;
9079
9080    if (options.twelvehour) {
9081      radius = outerRadius;
9082    }
9083
9084    // Radian should in range [0, 2PI]
9085    if (radian < 0) {
9086      radian = Math.PI * 2 + radian;
9087    }
9088
9089    // Get the round value
9090    value = Math.round(radian / unit);
9091
9092    // Get the round radian
9093    radian = value * unit;
9094
9095    // Correct the hours or minutes
9096    if (options.twelvehour) {
9097      if (isHours) {
9098        if (value === 0) value = 12;
9099      } else {
9100        if (roundBy5) value *= 5;
9101        if (value === 60) value = 0;
9102      }
9103    } else {
9104      if (isHours) {
9105        if (value === 12) value = 0;
9106        value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
9107      } else {
9108        if (roundBy5) value *= 5;
9109        if (value === 60) value = 0;
9110      }
9111    }
9112
9113    // Once hours or minutes changed, vibrate the device
9114    if (this[this.currentView] !== value) {
9115      if (vibrate && this.options.vibrate) {
9116        // Do not vibrate too frequently
9117        if (!this.vibrateTimer) {
9118          navigator[vibrate](10);
9119          this.vibrateTimer = setTimeout($.proxy(function () {
9120            this.vibrateTimer = null;
9121          }, this), 100);
9122        }
9123      }
9124    }
9125
9126    this[this.currentView] = value;
9127    if (isHours) {
9128      this['spanHours'].html(value);
9129    } else {
9130      this['spanMinutes'].html(leadingZero(value));
9131    }
9132
9133    // If svg is not supported, just add an active class to the tick
9134    if (!svgSupported) {
9135      this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
9136        var tick = $(this);
9137        tick.toggleClass('active', value === +tick.html());
9138      });
9139      return;
9140    }
9141
9142    // Set clock hand and others' position
9143    var cx1 = Math.sin(radian) * (radius - tickRadius),
9144        cy1 = -Math.cos(radian) * (radius - tickRadius),
9145        cx2 = Math.sin(radian) * radius,
9146        cy2 = -Math.cos(radian) * radius;
9147    this.hand.setAttribute('x2', cx1);
9148    this.hand.setAttribute('y2', cy1);
9149    this.bg.setAttribute('cx', cx2);
9150    this.bg.setAttribute('cy', cy2);
9151  };
9152
9153  // Hours and minutes are selected
9154  ClockPicker.prototype.done = function () {
9155    raiseCallback(this.options.beforeDone);
9156    this.hide();
9157    this.label.addClass('active');
9158
9159    var last = this.input.prop('value'),
9160        value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
9161    if (this.options.twelvehour) {
9162      value = value + this.amOrPm;
9163    }
9164
9165    this.input.prop('value', value);
9166    if (value !== last) {
9167      this.input.triggerHandler('change');
9168      if (!this.isInput) {
9169        this.element.trigger('change');
9170      }
9171    }
9172
9173    if (this.options.autoclose) this.input.trigger('blur');
9174
9175    raiseCallback(this.options.afterDone);
9176  };
9177
9178  // Clear input field
9179  ClockPicker.prototype.clear = function () {
9180    this.hide();
9181    this.label.removeClass('active');
9182
9183    var last = this.input.prop('value'),
9184        value = '';
9185
9186    this.input.prop('value', value);
9187    if (value !== last) {
9188      this.input.triggerHandler('change');
9189      if (!this.isInput) {
9190        this.element.trigger('change');
9191      }
9192    }
9193
9194    if (this.options.autoclose) {
9195      this.input.trigger('blur');
9196    }
9197  };
9198
9199  // Remove clockpicker from input
9200  ClockPicker.prototype.remove = function () {
9201    this.element.removeData('clockpicker');
9202    this.input.off('focus.clockpicker click.clockpicker');
9203    if (this.isShown) {
9204      this.hide();
9205    }
9206    if (this.isAppended) {
9207      $win.off('resize.clockpicker' + this.id);
9208      this.popover.remove();
9209    }
9210  };
9211
9212  // Extends $.fn.clockpicker
9213  $.fn.pickatime = function (option) {
9214    var args = Array.prototype.slice.call(arguments, 1);
9215    return this.each(function () {
9216      var $this = $(this),
9217          data = $this.data('clockpicker');
9218      if (!data) {
9219        var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
9220        $this.data('clockpicker', new ClockPicker($this, options));
9221      } else {
9222        // Manual operatsions. show, hide, remove, e.g.
9223        if (typeof data[option] === 'function') {
9224          data[option].apply(data, args);
9225        }
9226      }
9227    });
9228  };
9229})(jQuery);
9230;(function ($) {
9231
9232  $.fn.characterCounter = function () {
9233    return this.each(function () {
9234      var $input = $(this);
9235      var $counterElement = $input.parent().find('span[class="character-counter"]');
9236
9237      // character counter has already been added appended to the parent container
9238      if ($counterElement.length) {
9239        return;
9240      }
9241
9242      var itHasLengthAttribute = $input.attr('data-length') !== undefined;
9243
9244      if (itHasLengthAttribute) {
9245        $input.on('input', updateCounter);
9246        $input.on('focus', updateCounter);
9247        $input.on('blur', removeCounterElement);
9248
9249        addCounterElement($input);
9250      }
9251    });
9252  };
9253
9254  function updateCounter() {
9255    var maxLength = +$(this).attr('data-length'),
9256        actualLength = +$(this).val().length,
9257        isValidLength = actualLength <= maxLength;
9258
9259    $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
9260
9261    addInputStyle(isValidLength, $(this));
9262  }
9263
9264  function addCounterElement($input) {
9265    var $counterElement = $input.parent().find('span[class="character-counter"]');
9266
9267    if ($counterElement.length) {
9268      return;
9269    }
9270
9271    $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
9272
9273    $input.parent().append($counterElement);
9274  }
9275
9276  function removeCounterElement() {
9277    $(this).parent().find('span[class="character-counter"]').html('');
9278  }
9279
9280  function addInputStyle(isValidLength, $input) {
9281    var inputHasInvalidClass = $input.hasClass('invalid');
9282    if (isValidLength && inputHasInvalidClass) {
9283      $input.removeClass('invalid');
9284    } else if (!isValidLength && !inputHasInvalidClass) {
9285      $input.removeClass('valid');
9286      $input.addClass('invalid');
9287    }
9288  }
9289
9290  $(document).ready(function () {
9291    $('input, textarea').characterCounter();
9292  });
9293})(jQuery);
9294;(function ($) {
9295
9296  var methods = {
9297
9298    init: function (options) {
9299      var defaults = {
9300        duration: 200, // ms
9301        dist: -100, // zoom scale TODO: make this more intuitive as an option
9302        shift: 0, // spacing for center image
9303        padding: 0, // Padding between non center items
9304        fullWidth: false, // Change to full width styles
9305        indicators: false, // Toggle indicators
9306        noWrap: false, // Don't wrap around and cycle through items.
9307        onCycleTo: null // Callback for when a new slide is cycled to.
9308      };
9309      options = $.extend(defaults, options);
9310      var namespace = Materialize.objectSelectorString($(this));
9311
9312      return this.each(function (i) {
9313
9314        var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
9315        var $indicators = $('<ul class="indicators"></ul>');
9316        var scrollingTimeout = null;
9317        var oneTimeCallback = null;
9318
9319        // Initialize
9320        var view = $(this);
9321        var hasMultipleSlides = view.find('.carousel-item').length > 1;
9322        var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
9323        var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
9324        var uniqueNamespace = view.attr('data-namespace') || namespace + i;
9325        view.attr('data-namespace', uniqueNamespace);
9326
9327        // Options
9328        var setCarouselHeight = function (imageOnly) {
9329          var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
9330          var firstImage = firstSlide.find('img').first();
9331          if (firstImage.length) {
9332            if (firstImage[0].complete) {
9333              // If image won't trigger the load event
9334              var imageHeight = firstImage.height();
9335              if (imageHeight > 0) {
9336                view.css('height', firstImage.height());
9337              } else {
9338                // If image still has no height, use the natural dimensions to calculate
9339                var naturalWidth = firstImage[0].naturalWidth;
9340                var naturalHeight = firstImage[0].naturalHeight;
9341                var adjustedHeight = view.width() / naturalWidth * naturalHeight;
9342                view.css('height', adjustedHeight);
9343              }
9344            } else {
9345              // Get height when image is loaded normally
9346              firstImage.on('load', function () {
9347                view.css('height', $(this).height());
9348              });
9349            }
9350          } else if (!imageOnly) {
9351            var slideHeight = firstSlide.height();
9352            view.css('height', slideHeight);
9353          }
9354        };
9355
9356        if (options.fullWidth) {
9357          options.dist = 0;
9358          setCarouselHeight();
9359
9360          // Offset fixed items when indicators.
9361          if (showIndicators) {
9362            view.find('.carousel-fixed-item').addClass('with-indicators');
9363          }
9364        }
9365
9366        // Don't double initialize.
9367        if (view.hasClass('initialized')) {
9368          // Recalculate variables
9369          $(window).trigger('resize');
9370
9371          // Redraw carousel.
9372          view.trigger('carouselNext', [0.000001]);
9373          return true;
9374        }
9375
9376        view.addClass('initialized');
9377        pressed = false;
9378        offset = target = 0;
9379        images = [];
9380        item_width = view.find('.carousel-item').first().innerWidth();
9381        item_height = view.find('.carousel-item').first().innerHeight();
9382        dim = item_width * 2 + options.padding;
9383
9384        view.find('.carousel-item').each(function (i) {
9385          images.push($(this)[0]);
9386          if (showIndicators) {
9387            var $indicator = $('<li class="indicator-item"></li>');
9388
9389            // Add active to first by default.
9390            if (i === 0) {
9391              $indicator.addClass('active');
9392            }
9393
9394            // Handle clicks on indicators.
9395            $indicator.click(function (e) {
9396              e.stopPropagation();
9397
9398              var index = $(this).index();
9399              cycleTo(index);
9400            });
9401            $indicators.append($indicator);
9402          }
9403        });
9404
9405        if (showIndicators) {
9406          view.append($indicators);
9407        }
9408        count = images.length;
9409
9410        function setupEvents() {
9411          if (typeof window.ontouchstart !== 'undefined') {
9412            view.on('touchstart.carousel', tap);
9413            view.on('touchmove.carousel', drag);
9414            view.on('touchend.carousel', release);
9415          }
9416          view.on('mousedown.carousel', tap);
9417          view.on('mousemove.carousel', drag);
9418          view.on('mouseup.carousel', release);
9419          view.on('mouseleave.carousel', release);
9420          view.on('click.carousel', click);
9421        }
9422
9423        function xpos(e) {
9424          // touch event
9425          if (e.targetTouches && e.targetTouches.length >= 1) {
9426            return e.targetTouches[0].clientX;
9427          }
9428
9429          // mouse event
9430          return e.clientX;
9431        }
9432
9433        function ypos(e) {
9434          // touch event
9435          if (e.targetTouches && e.targetTouches.length >= 1) {
9436            return e.targetTouches[0].clientY;
9437          }
9438
9439          // mouse event
9440          return e.clientY;
9441        }
9442
9443        function wrap(x) {
9444          return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
9445        }
9446
9447        function scroll(x) {
9448          // Track scrolling state
9449          scrolling = true;
9450          if (!view.hasClass('scrolling')) {
9451            view.addClass('scrolling');
9452          }
9453          if (scrollingTimeout != null) {
9454            window.clearTimeout(scrollingTimeout);
9455          }
9456          scrollingTimeout = window.setTimeout(function () {
9457            scrolling = false;
9458            view.removeClass('scrolling');
9459          }, options.duration);
9460
9461          // Start actual scroll
9462          var i, half, delta, dir, tween, el, alignment, xTranslation;
9463          var lastCenter = center;
9464
9465          offset = typeof x === 'number' ? x : offset;
9466          center = Math.floor((offset + dim / 2) / dim);
9467          delta = offset - center * dim;
9468          dir = delta < 0 ? 1 : -1;
9469          tween = -dir * delta * 2 / dim;
9470          half = count >> 1;
9471
9472          if (!options.fullWidth) {
9473            alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
9474            alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
9475          } else {
9476            alignment = 'translateX(0)';
9477          }
9478
9479          // Set indicator active
9480          if (showIndicators) {
9481            var diff = center % count;
9482            var activeIndicator = $indicators.find('.indicator-item.active');
9483            if (activeIndicator.index() !== diff) {
9484              activeIndicator.removeClass('active');
9485              $indicators.find('.indicator-item').eq(diff).addClass('active');
9486            }
9487          }
9488
9489          // center
9490          // Don't show wrapped items.
9491          if (!noWrap || center >= 0 && center < count) {
9492            el = images[wrap(center)];
9493
9494            // Add active class to center item.
9495            if (!$(el).hasClass('active')) {
9496              view.find('.carousel-item').removeClass('active');
9497              $(el).addClass('active');
9498            }
9499            el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
9500            el.style.zIndex = 0;
9501            if (options.fullWidth) {
9502              tweenedOpacity = 1;
9503            } else {
9504              tweenedOpacity = 1 - 0.2 * tween;
9505            }
9506            el.style.opacity = tweenedOpacity;
9507            el.style.display = 'block';
9508          }
9509
9510          for (i = 1; i <= half; ++i) {
9511            // right side
9512            if (options.fullWidth) {
9513              zTranslation = options.dist;
9514              tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
9515            } else {
9516              zTranslation = options.dist * (i * 2 + tween * dir);
9517              tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
9518            }
9519            // Don't show wrapped items.
9520            if (!noWrap || center + i < count) {
9521              el = images[wrap(center + i)];
9522              el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
9523              el.style.zIndex = -i;
9524              el.style.opacity = tweenedOpacity;
9525              el.style.display = 'block';
9526            }
9527
9528            // left side
9529            if (options.fullWidth) {
9530              zTranslation = options.dist;
9531              tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
9532            } else {
9533              zTranslation = options.dist * (i * 2 - tween * dir);
9534              tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
9535            }
9536            // Don't show wrapped items.
9537            if (!noWrap || center - i >= 0) {
9538              el = images[wrap(center - i)];
9539              el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
9540              el.style.zIndex = -i;
9541              el.style.opacity = tweenedOpacity;
9542              el.style.display = 'block';
9543            }
9544          }
9545
9546          // center
9547          // Don't show wrapped items.
9548          if (!noWrap || center >= 0 && center < count) {
9549            el = images[wrap(center)];
9550            el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
9551            el.style.zIndex = 0;
9552            if (options.fullWidth) {
9553              tweenedOpacity = 1;
9554            } else {
9555              tweenedOpacity = 1 - 0.2 * tween;
9556            }
9557            el.style.opacity = tweenedOpacity;
9558            el.style.display = 'block';
9559          }
9560
9561          // onCycleTo callback
9562          if (lastCenter !== center && typeof options.onCycleTo === "function") {
9563            var $curr_item = view.find('.carousel-item').eq(wrap(center));
9564            options.onCycleTo.call(this, $curr_item, dragged);
9565          }
9566
9567          // One time callback
9568          if (typeof oneTimeCallback === "function") {
9569            oneTimeCallback.call(this, $curr_item, dragged);
9570            oneTimeCallback = null;
9571          }
9572        }
9573
9574        function track() {
9575          var now, elapsed, delta, v;
9576
9577          now = Date.now();
9578          elapsed = now - timestamp;
9579          timestamp = now;
9580          delta = offset - frame;
9581          frame = offset;
9582
9583          v = 1000 * delta / (1 + elapsed);
9584          velocity = 0.8 * v + 0.2 * velocity;
9585        }
9586
9587        function autoScroll() {
9588          var elapsed, delta;
9589
9590          if (amplitude) {
9591            elapsed = Date.now() - timestamp;
9592            delta = amplitude * Math.exp(-elapsed / options.duration);
9593            if (delta > 2 || delta < -2) {
9594              scroll(target - delta);
9595              requestAnimationFrame(autoScroll);
9596            } else {
9597              scroll(target);
9598            }
9599          }
9600        }
9601
9602        function click(e) {
9603          // Disable clicks if carousel was dragged.
9604          if (dragged) {
9605            e.preventDefault();
9606            e.stopPropagation();
9607            return false;
9608          } else if (!options.fullWidth) {
9609            var clickedIndex = $(e.target).closest('.carousel-item').index();
9610            var diff = wrap(center) - clickedIndex;
9611
9612            // Disable clicks if carousel was shifted by click
9613            if (diff !== 0) {
9614              e.preventDefault();
9615              e.stopPropagation();
9616            }
9617            cycleTo(clickedIndex);
9618          }
9619        }
9620
9621        function cycleTo(n) {
9622          var diff = center % count - n;
9623
9624          // Account for wraparound.
9625          if (!noWrap) {
9626            if (diff < 0) {
9627              if (Math.abs(diff + count) < Math.abs(diff)) {
9628                diff += count;
9629              }
9630            } else if (diff > 0) {
9631              if (Math.abs(diff - count) < diff) {
9632                diff -= count;
9633              }
9634            }
9635          }
9636
9637          // Call prev or next accordingly.
9638          if (diff < 0) {
9639            view.trigger('carouselNext', [Math.abs(diff)]);
9640          } else if (diff > 0) {
9641            view.trigger('carouselPrev', [diff]);
9642          }
9643        }
9644
9645        function tap(e) {
9646          // Fixes firefox draggable image bug
9647          if (e.type === 'mousedown' && $(e.target).is('img')) {
9648            e.preventDefault();
9649          }
9650          pressed = true;
9651          dragged = false;
9652          vertical_dragged = false;
9653          reference = xpos(e);
9654          referenceY = ypos(e);
9655
9656          velocity = amplitude = 0;
9657          frame = offset;
9658          timestamp = Date.now();
9659          clearInterval(ticker);
9660          ticker = setInterval(track, 100);
9661        }
9662
9663        function drag(e) {
9664          var x, delta, deltaY;
9665          if (pressed) {
9666            x = xpos(e);
9667            y = ypos(e);
9668            delta = reference - x;
9669            deltaY = Math.abs(referenceY - y);
9670            if (deltaY < 30 && !vertical_dragged) {
9671              // If vertical scrolling don't allow dragging.
9672              if (delta > 2 || delta < -2) {
9673                dragged = true;
9674                reference = x;
9675                scroll(offset + delta);
9676              }
9677            } else if (dragged) {
9678              // If dragging don't allow vertical scroll.
9679              e.preventDefault();
9680              e.stopPropagation();
9681              return false;
9682            } else {
9683              // Vertical scrolling.
9684              vertical_dragged = true;
9685            }
9686          }
9687
9688          if (dragged) {
9689            // If dragging don't allow vertical scroll.
9690            e.preventDefault();
9691            e.stopPropagation();
9692            return false;
9693          }
9694        }
9695
9696        function release(e) {
9697          if (pressed) {
9698            pressed = false;
9699          } else {
9700            return;
9701          }
9702
9703          clearInterval(ticker);
9704          target = offset;
9705          if (velocity > 10 || velocity < -10) {
9706            amplitude = 0.9 * velocity;
9707            target = offset + amplitude;
9708          }
9709          target = Math.round(target / dim) * dim;
9710
9711          // No wrap of items.
9712          if (noWrap) {
9713            if (target >= dim * (count - 1)) {
9714              target = dim * (count - 1);
9715            } else if (target < 0) {
9716              target = 0;
9717            }
9718          }
9719          amplitude = target - offset;
9720          timestamp = Date.now();
9721          requestAnimationFrame(autoScroll);
9722
9723          if (dragged) {
9724            e.preventDefault();
9725            e.stopPropagation();
9726          }
9727          return false;
9728        }
9729
9730        xform = 'transform';
9731        ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
9732          var e = prefix + 'Transform';
9733          if (typeof document.body.style[e] !== 'undefined') {
9734            xform = e;
9735            return false;
9736          }
9737          return true;
9738        });
9739
9740        var throttledResize = Materialize.throttle(function () {
9741          if (options.fullWidth) {
9742            item_width = view.find('.carousel-item').first().innerWidth();
9743            var imageHeight = view.find('.carousel-item.active').height();
9744            dim = item_width * 2 + options.padding;
9745            offset = center * 2 * item_width;
9746            target = offset;
9747            setCarouselHeight(true);
9748          } else {
9749            scroll();
9750          }
9751        }, 200);
9752        $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
9753
9754        setupEvents();
9755        scroll(offset);
9756
9757        $(this).on('carouselNext', function (e, n, callback) {
9758          if (n === undefined) {
9759            n = 1;
9760          }
9761          if (typeof callback === "function") {
9762            oneTimeCallback = callback;
9763          }
9764
9765          target = dim * Math.round(offset / dim) + dim * n;
9766          if (offset !== target) {
9767            amplitude = target - offset;
9768            timestamp = Date.now();
9769            requestAnimationFrame(autoScroll);
9770          }
9771        });
9772
9773        $(this).on('carouselPrev', function (e, n, callback) {
9774          if (n === undefined) {
9775            n = 1;
9776          }
9777          if (typeof callback === "function") {
9778            oneTimeCallback = callback;
9779          }
9780
9781          target = dim * Math.round(offset / dim) - dim * n;
9782          if (offset !== target) {
9783            amplitude = target - offset;
9784            timestamp = Date.now();
9785            requestAnimationFrame(autoScroll);
9786          }
9787        });
9788
9789        $(this).on('carouselSet', function (e, n, callback) {
9790          if (n === undefined) {
9791            n = 0;
9792          }
9793          if (typeof callback === "function") {
9794            oneTimeCallback = callback;
9795          }
9796
9797          cycleTo(n);
9798        });
9799      });
9800    },
9801    next: function (n, callback) {
9802      $(this).trigger('carouselNext', [n, callback]);
9803    },
9804    prev: function (n, callback) {
9805      $(this).trigger('carouselPrev', [n, callback]);
9806    },
9807    set: function (n, callback) {
9808      $(this).trigger('carouselSet', [n, callback]);
9809    },
9810    destroy: function () {
9811      var uniqueNamespace = $(this).attr('data-namespace');
9812      $(this).removeAttr('data-namespace');
9813      $(this).removeClass('initialized');
9814      $(this).find('.indicators').remove();
9815
9816      // Remove event handlers
9817      $(this).off('carouselNext carouselPrev carouselSet');
9818      $(window).off('resize.carousel-' + uniqueNamespace);
9819      if (typeof window.ontouchstart !== 'undefined') {
9820        $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
9821      }
9822      $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
9823    }
9824  };
9825
9826  $.fn.carousel = function (methodOrOptions) {
9827    if (methods[methodOrOptions]) {
9828      return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
9829    } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
9830      // Default to "init"
9831      return methods.init.apply(this, arguments);
9832    } else {
9833      $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
9834    }
9835  }; // Plugin end
9836})(jQuery);
9837;(function ($) {
9838
9839  var methods = {
9840    init: function (options) {
9841      return this.each(function () {
9842        var origin = $('#' + $(this).attr('data-activates'));
9843        var screen = $('body');
9844
9845        // Creating tap target
9846        var tapTargetEl = $(this);
9847        var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
9848        var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
9849        var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
9850        var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
9851
9852        // Creating wrapper
9853        if (!tapTargetWrapper.length) {
9854          tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
9855        }
9856
9857        // Creating content
9858        if (!tapTargetContentEl.length) {
9859          tapTargetContentEl = $('<div class="tap-target-content"></div>');
9860          tapTargetEl.append(tapTargetContentEl);
9861        }
9862
9863        // Creating foreground wave
9864        if (!tapTargetWave.length) {
9865          tapTargetWave = $('<div class="tap-target-wave"></div>');
9866
9867          // Creating origin
9868          if (!tapTargetOriginEl.length) {
9869            tapTargetOriginEl = origin.clone(true, true);
9870            tapTargetOriginEl.addClass('tap-target-origin');
9871            tapTargetOriginEl.removeAttr('id');
9872            tapTargetOriginEl.removeAttr('style');
9873            tapTargetWave.append(tapTargetOriginEl);
9874          }
9875
9876          tapTargetWrapper.append(tapTargetWave);
9877        }
9878
9879        // Open
9880        var openTapTarget = function () {
9881          if (tapTargetWrapper.is('.open')) {
9882            return;
9883          }
9884
9885          // Adding open class
9886          tapTargetWrapper.addClass('open');
9887
9888          setTimeout(function () {
9889            tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
9890              closeTapTarget();
9891              tapTargetOriginEl.off('click.tapTarget');
9892            });
9893
9894            $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
9895              closeTapTarget();
9896              $(document).off('click.tapTarget');
9897            });
9898
9899            var throttledCalc = Materialize.throttle(function () {
9900              calculateTapTarget();
9901            }, 200);
9902            $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
9903          }, 0);
9904        };
9905
9906        // Close
9907        var closeTapTarget = function () {
9908          if (!tapTargetWrapper.is('.open')) {
9909            return;
9910          }
9911
9912          tapTargetWrapper.removeClass('open');
9913          tapTargetOriginEl.off('click.tapTarget');
9914          $(document).off('click.tapTarget');
9915          $(window).off('resize.tapTarget');
9916        };
9917
9918        // Pre calculate
9919        var calculateTapTarget = function () {
9920          // Element or parent is fixed position?
9921          var isFixed = origin.css('position') === 'fixed';
9922          if (!isFixed) {
9923            var parents = origin.parents();
9924            for (var i = 0; i < parents.length; i++) {
9925              isFixed = $(parents[i]).css('position') == 'fixed';
9926              if (isFixed) {
9927                break;
9928              }
9929            }
9930          }
9931
9932          // Calculating origin
9933          var originWidth = origin.outerWidth();
9934          var originHeight = origin.outerHeight();
9935          var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
9936          var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
9937
9938          // Calculating screen
9939          var windowWidth = $(window).width();
9940          var windowHeight = $(window).height();
9941          var centerX = windowWidth / 2;
9942          var centerY = windowHeight / 2;
9943          var isLeft = originLeft <= centerX;
9944          var isRight = originLeft > centerX;
9945          var isTop = originTop <= centerY;
9946          var isBottom = originTop > centerY;
9947          var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
9948          var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
9949
9950          // Calculating tap target
9951          var tapTargetWidth = tapTargetEl.outerWidth();
9952          var tapTargetHeight = tapTargetEl.outerHeight();
9953          var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
9954          var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
9955          var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
9956
9957          // Calculating content
9958          var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
9959          var tapTargetTextHeight = tapTargetHeight / 2;
9960          var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
9961          var tapTargetTextBottom = 0;
9962          var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
9963          var tapTargetTextRight = 0;
9964          var tapTargetTextPadding = originWidth;
9965          var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
9966
9967          // Calculating wave
9968          var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
9969          var tapTargetWaveHeight = tapTargetWaveWidth;
9970          var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
9971          var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
9972
9973          // Setting tap target
9974          var tapTargetWrapperCssObj = {};
9975          tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
9976          tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
9977          tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
9978          tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
9979          tapTargetWrapperCssObj.position = tapTargetPosition;
9980          tapTargetWrapper.css(tapTargetWrapperCssObj);
9981
9982          // Setting content
9983          tapTargetContentEl.css({
9984            width: tapTargetTextWidth,
9985            height: tapTargetTextHeight,
9986            top: tapTargetTextTop,
9987            right: tapTargetTextRight,
9988            bottom: tapTargetTextBottom,
9989            left: tapTargetTextLeft,
9990            padding: tapTargetTextPadding,
9991            verticalAlign: tapTargetTextAlign
9992          });
9993
9994          // Setting wave
9995          tapTargetWave.css({
9996            top: tapTargetWaveTop,
9997            left: tapTargetWaveLeft,
9998            width: tapTargetWaveWidth,
9999            height: tapTargetWaveHeight
10000          });
10001        };
10002
10003        if (options == 'open') {
10004          calculateTapTarget();
10005          openTapTarget();
10006        }
10007
10008        if (options == 'close') closeTapTarget();
10009      });
10010    },
10011    open: function () {},
10012    close: function () {}
10013  };
10014
10015  $.fn.tapTarget = function (methodOrOptions) {
10016    if (methods[methodOrOptions] || typeof methodOrOptions === 'object') return methods.init.apply(this, arguments);
10017
10018    $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
10019  };
10020})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.