XCloner – Backup and Restore - Version 4.2.13

Version Description

= 3.0.3 = Please check changelog!

Download this release

Release Info

Developer watchful
Plugin Icon 128x128 XCloner – Backup and Restore
Version 4.2.13
Comparing to
See all releases

Code changes from version 4.2.12 to 4.2.13

README.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.xcloner.com
4
  Tags: backup, database backup, cloud backup, WordPress backup, WordPress migration
5
  Requires at least: 3.0.1
6
  Requires PHP: 7.1
7
- Tested up to: 5.4
8
- Stable tag: 4.2.12
9
 
10
  XCloner is a backup plugin that allows you to safely back up and restore your WordPress sites. You can send site backups to SFTP, Dropbox, Amazon, Google Drive, Backblaze and other locations.
11
 
@@ -116,7 +116,14 @@ Of course, schedules can be adjusted accordingly to how often you update your si
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
119
  = 4.2.12 =
 
120
  * Google Drive authorization fix
121
 
122
  = 4.2.11 =
4
  Tags: backup, database backup, cloud backup, WordPress backup, WordPress migration
5
  Requires at least: 3.0.1
6
  Requires PHP: 7.1
7
+ Tested up to: 5.5
8
+ Stable tag: 4.2.13
9
 
10
  XCloner is a backup plugin that allows you to safely back up and restore your WordPress sites. You can send site backups to SFTP, Dropbox, Amazon, Google Drive, Backblaze and other locations.
11
 
116
 
117
  == Changelog ==
118
 
119
+ + 4.2.13 =
120
+
121
+ * conflict fix bootstrap modal display
122
+ * exploit fix on restore API
123
+ * WP 5.5 compatibility check and update
124
+
125
  = 4.2.12 =
126
+
127
  * Google Drive authorization fix
128
 
129
  = 4.2.11 =
admin/js/materialize.min.js CHANGED
@@ -3,4 +3,12372 @@
3
  * Copyright 2014-2017 Materialize
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
  */
6
- var _get=function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in s)return s.value;var a=s.get;return void 0!==a?a.call(n):void 0},_createClass=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}();function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}window.cash=function(){var i,o=document,a=window,t=Array.prototype,r=t.slice,n=t.filter,s=t.push,e=function(){},h=function(t){return typeof t==typeof e&&t.call},d=function(t){return"string"==typeof t},l=/^#[\w-]*$/,u=/^\.[\w-]*$/,c=/<.+>/,p=/^\w+$/;function v(t,e){e=e||o;var i=u.test(t)?e.getElementsByClassName(t.slice(1)):p.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return i}function f(t){if(!i){var e=(i=o.implementation.createHTMLDocument(null)).createElement("base");e.href=o.location.href,i.head.appendChild(e)}return i.body.innerHTML=t,i.body.childNodes}function m(t){"loading"!==o.readyState?t():o.addEventListener("DOMContentLoaded",t)}function g(t,e){if(!t)return this;if(t.cash&&t!==a)return t;var i,n=t,s=0;if(d(t))n=l.test(t)?o.getElementById(t.slice(1)):c.test(t)?f(t):v(t,e);else if(h(t))return m(t),this;if(!n)return this;if(n.nodeType||n===a)this[0]=n,this.length=1;else for(i=this.length=n.length;s<i;s++)this[s]=n[s];return this}function _(t,e){return new g(t,e)}var y=_.fn=_.prototype=g.prototype={cash:!0,length:0,push:s,splice:t.splice,map:t.map,init:g};function k(t,e){for(var i=t.length,n=0;n<i&&!1!==e.call(t[n],t[n],n,t);n++);}function b(t,e){var i=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!i&&i.call(t,e)}function w(e){return d(e)?b:e.cash?function(t){return e.is(t)}:function(t,e){return t===e}}function C(t){return _(r.call(t).filter(function(t,e,i){return i.indexOf(t)===e}))}Object.defineProperty(y,"constructor",{value:_}),_.parseHTML=f,_.noop=e,_.isFunction=h,_.isString=d,_.extend=y.extend=function(t){t=t||{};var e=r.call(arguments),i=e.length,n=1;for(1===e.length&&(t=this,n=0);n<i;n++)if(e[n])for(var s in e[n])e[n].hasOwnProperty(s)&&(t[s]=e[n][s]);return t},_.extend({merge:function(t,e){for(var i=+e.length,n=t.length,s=0;s<i;n++,s++)t[n]=e[s];return t.length=n,t},each:k,matches:b,unique:C,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var E=_.uid="_cash"+Date.now();function M(t){return t[E]=t[E]||{}}function O(t,e,i){return M(t)[e]=i}function x(t,e){var i=M(t);return void 0===i[e]&&(i[e]=t.dataset?t.dataset[e]:_(t).attr("data-"+e)),i[e]}y.extend({data:function(e,i){if(d(e))return void 0===i?x(this[0],e):this.each(function(t){return O(t,e,i)});for(var t in e)this.data(t,e[t]);return this},removeData:function(s){return this.each(function(t){return i=s,void((n=M(e=t))?delete n[i]:e.dataset?delete e.dataset[i]:_(e).removeAttr("data-"+name));var e,i,n})}});var L=/\S+/g;function T(t){return d(t)&&t.match(L)}function $(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function B(t,e,i){t.classList?t.classList.add(e):i.indexOf(" "+e+" ")&&(t.className+=" "+e)}function D(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"")}y.extend({addClass:function(t){var n=T(t);return n?this.each(function(e){var i=" "+e.className+" ";k(n,function(t){B(e,t,i)})}):this},attr:function(e,i){if(e){if(d(e))return void 0===i?this[0]?this[0].getAttribute?this[0].getAttribute(e):this[0][e]:void 0:this.each(function(t){t.setAttribute?t.setAttribute(e,i):t[e]=i});for(var t in e)this.attr(t,e[t]);return this}},hasClass:function(t){var e=!1,i=T(t);return i&&i.length&&this.each(function(t){return!(e=$(t,i[0]))}),e},prop:function(e,i){if(d(e))return void 0===i?this[0][e]:this.each(function(t){t[e]=i});for(var t in e)this.prop(t,e[t]);return this},removeAttr:function(e){return this.each(function(t){t.removeAttribute?t.removeAttribute(e):delete t[e]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var i=T(t);return i?this.each(function(e){k(i,function(t){D(e,t)})}):this},removeProp:function(e){return this.each(function(t){delete t[e]})},toggleClass:function(t,e){if(void 0!==e)return this[e?"addClass":"removeClass"](t);var n=T(t);return n?this.each(function(e){var i=" "+e.className+" ";k(n,function(t){$(e,t)?D(e,t):B(e,t,i)})}):this}}),y.extend({add:function(t,e){return C(_.merge(this,_(t,e)))},each:function(t){return k(this,t),this},eq:function(t){return _(this.get(t))},filter:function(e){if(!e)return this;var i=h(e)?e:w(e);return _(n.call(this,function(t){return i(t,e)}))},first:function(){return this.eq(0)},get:function(t){return void 0===t?r.call(this):t<0?this[t+this.length]:this[t]},index:function(t){var e=t?_(t)[0]:this[0],i=t?this:_(e).parent().children();return r.call(i).indexOf(e)},last:function(){return this.eq(-1)}});var S,I,A,R,H,P,W=(H=/(?:^\w|[A-Z]|\b\w)/g,P=/[\s-_]+/g,function(t){return t.replace(H,function(t,e){return t[0===e?"toLowerCase":"toUpperCase"]()}).replace(P,"")}),j=(S={},I=document,A=I.createElement("div"),R=A.style,function(e){if(e=W(e),S[e])return S[e];var t=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+["webkit","moz","ms","o"].join(t+" ")+t).split(" ");return k(i,function(t){if(t in R)return S[t]=e=S[e]=t,!1}),S[e]});function F(t,e){return parseInt(a.getComputedStyle(t[0],null)[e],10)||0}function q(e,i,t){var n,s=x(e,"_cashEvents"),o=s&&s[i];o&&(t?(e.removeEventListener(i,t),0<=(n=o.indexOf(t))&&o.splice(n,1)):(k(o,function(t){e.removeEventListener(i,t)}),o=[]))}function N(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function z(t){var e,i,n,s=t.type;if(!s)return null;switch(s.toLowerCase()){case"select-one":return 0<=(n=(i=t).selectedIndex)?i.options[n].value:null;case"select-multiple":return e=[],k(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null;case"radio":case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function V(e,i,n){var t=d(i);t||!i.length?k(e,t?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",i)}:function(t,e){return function(t,e,i){if(i){var n=t.childNodes[0];t.insertBefore(e,n)}else t.appendChild(e)}(t,0===e?i:i.cloneNode(!0),n)}):k(i,function(t){return V(e,t,n)})}_.prefixedProp=j,_.camelCase=W,y.extend({css:function(e,i){if(d(e))return e=j(e),1<arguments.length?this.each(function(t){return t.style[e]=i}):a.getComputedStyle(this[0])[e];for(var t in e)this.css(t,e[t]);return this}}),k(["Width","Height"],function(e){var t=e.toLowerCase();y[t]=function(){return this[0].getBoundingClientRect()[t]},y["inner"+e]=function(){return this[0]["client"+e]},y["outer"+e]=function(t){return this[0]["offset"+e]+(t?F(this,"margin"+("Width"===e?"Left":"Top"))+F(this,"margin"+("Width"===e?"Right":"Bottom")):0)}}),y.extend({off:function(e,i){return this.each(function(t){return q(t,e,i)})},on:function(a,i,r,l){var n;if(!d(a)){for(var t in a)this.on(t,i,a[t]);return this}return h(i)&&(r=i,i=null),"ready"===a?(m(r),this):(i&&(n=r,r=function(t){for(var e=t.target;!b(e,i);){if(e===this||null===e)return e=!1;e=e.parentNode}e&&n.call(e,t)}),this.each(function(t){var e,i,n,s,o=r;l&&(o=function(){r.apply(this,arguments),q(t,a,o)}),i=a,n=o,(s=x(e=t,"_cashEvents")||O(e,"_cashEvents",{}))[i]=s[i]||[],s[i].push(n),e.addEventListener(i,n)}))},one:function(t,e,i){return this.on(t,e,i,!0)},ready:m,trigger:function(t,e){if(document.createEvent){var i=document.createEvent("HTMLEvents");return i.initEvent(t,!0,!1),i=this.extend(i,e),this.each(function(t){return t.dispatchEvent(i)})}}}),y.extend({serialize:function(){var s="";return k(this[0].elements||this,function(t){if(!t.disabled&&"FIELDSET"!==t.tagName){var e=t.name;switch(t.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var i=z(t);null!==i&&k(i,function(t){s+=N(e,t)});break;default:var n=z(t);null!==n&&(s+=N(e,n))}}}),s.substr(1)},val:function(e){return void 0===e?z(this[0]):this.each(function(t){return t.value=e})}}),y.extend({after:function(t){return _(t).insertAfter(this),this},append:function(t){return V(this,t),this},appendTo:function(t){return V(_(t),this),this},before:function(t){return _(t).insertBefore(this),this},clone:function(){return _(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var s=this;return _(t).each(function(t,e){var i=t.parentNode,n=t.nextSibling;s.each(function(t){i.insertBefore(0===e?t:t.cloneNode(!0),n)})}),this},insertBefore:function(t){var s=this;return _(t).each(function(e,i){var n=e.parentNode;s.each(function(t){n.insertBefore(0===i?t:t.cloneNode(!0),e)})}),this},prepend:function(t){return V(this,t,!0),this},prependTo:function(t){return V(_(t),this,!0),this},remove:function(){return this.each(function(t){if(t.parentNode)return t.parentNode.removeChild(t)})},text:function(e){return void 0===e?this[0].textContent:this.each(function(t){return t.textContent=e})}});var X=o.documentElement;return y.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+a.pageYOffset-X.clientTop,left:t.left+a.pageXOffset-X.clientLeft}},offsetParent:function(){return _(this[0].offsetParent)}}),y.extend({children:function(e){var i=[];return this.each(function(t){s.apply(i,t.children)}),i=C(i),e?i.filter(function(t){return b(t,e)}):i},closest:function(t){return!t||this.length<1?_():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(e){if(!e)return!1;var i=!1,n=w(e);return this.each(function(t){return!(i=n(t,e))}),i},find:function(e){if(!e||e.nodeType)return _(e&&this.has(e).length?e:null);var i=[];return this.each(function(t){s.apply(i,v(e,t))}),C(i)},has:function(e){var t=d(e)?function(t){return 0!==v(e,t).length}:function(t){return t.contains(e)};return this.filter(t)},next:function(){return _(this[0].nextElementSibling)},not:function(e){if(!e)return this;var i=w(e);return this.filter(function(t){return!i(t,e)})},parent:function(){var e=[];return this.each(function(t){t&&t.parentNode&&e.push(t.parentNode)}),C(e)},parents:function(e){var i,n=[];return this.each(function(t){for(i=t;i&&i.parentNode&&i!==o.body.parentNode;)i=i.parentNode,(!e||e&&b(i,e))&&n.push(i)}),C(n)},prev:function(){return _(this[0].previousElementSibling)},siblings:function(t){var e=this.parent().children(t),i=this[0];return e.filter(function(t){return t!==i})}}),_}();var Component=function(){function s(t,e,i){_classCallCheck(this,s),e instanceof Element||console.error(Error(e+" is not an HTML Element"));var n=t.getInstance(e);n&&n.destroy(),this.el=e,this.$el=cash(e)}return _createClass(s,null,[{key:"init",value:function(t,e,i){var n=null;if(e instanceof Element)n=new t(e,i);else if(e&&(e.jquery||e.cash||e instanceof NodeList)){for(var s=[],o=0;o<e.length;o++)s.push(new t(e[o],i));n=s}return n}}]),s}();!function(t){t.Package?M={}:t.M={},M.jQueryLoaded=!!t.jQuery}(window),"function"==typeof define&&define.amd?define("M",[],function(){return M}):"undefined"==typeof exports||exports.nodeType||("undefined"!=typeof module&&!module.nodeType&&module.exports&&(exports=module.exports=M),exports.default=M),M.version="1.0.0",M.keys={TAB:9,ENTER:13,ESC:27,ARROW_UP:38,ARROW_DOWN:40},M.tabPressed=!1,M.keyDown=!1;var docHandleKeydown=function(t){M.keyDown=!0,t.which!==M.keys.TAB&&t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ARROW_UP||(M.tabPressed=!0)},docHandleKeyup=function(t){M.keyDown=!1,t.which!==M.keys.TAB&&t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ARROW_UP||(M.tabPressed=!1)},docHandleFocus=function(t){M.keyDown&&document.body.classList.add("keyboard-focused")},docHandleBlur=function(t){document.body.classList.remove("keyboard-focused")};document.addEventListener("keydown",docHandleKeydown,!0),document.addEventListener("keyup",docHandleKeyup,!0),document.addEventListener("focus",docHandleFocus,!0),document.addEventListener("blur",docHandleBlur,!0),M.initializeJqueryWrapper=function(n,s,o){jQuery.fn[s]=function(e){if(n.prototype[e]){var i=Array.prototype.slice.call(arguments,1);if("get"===e.slice(0,3)){var t=this.first()[0][o];return t[e].apply(t,i)}return this.each(function(){var t=this[o];t[e].apply(t,i)})}if("object"==typeof e||!e)return n.init(this,e),this;jQuery.error("Method "+e+" does not exist on jQuery."+s)}},M.AutoInit=function(t){var e=t||document.body,i={Autocomplete:e.querySelectorAll(".autocomplete:not(.no-autoinit)"),Carousel:e.querySelectorAll(".carousel:not(.no-autoinit)"),Chips:e.querySelectorAll(".chips:not(.no-autoinit)"),Collapsible:e.querySelectorAll(".collapsible:not(.no-autoinit)"),Datepicker:e.querySelectorAll(".datepicker:not(.no-autoinit)"),Dropdown:e.querySelectorAll(".dropdown-trigger:not(.no-autoinit)"),Materialbox:e.querySelectorAll(".materialboxed:not(.no-autoinit)"),Modal:e.querySelectorAll(".modal:not(.no-autoinit)"),Parallax:e.querySelectorAll(".parallax:not(.no-autoinit)"),Pushpin:e.querySelectorAll(".pushpin:not(.no-autoinit)"),ScrollSpy:e.querySelectorAll(".scrollspy:not(.no-autoinit)"),FormSelect:e.querySelectorAll("select:not(.no-autoinit)"),Sidenav:e.querySelectorAll(".sidenav:not(.no-autoinit)"),Tabs:e.querySelectorAll(".tabs:not(.no-autoinit)"),TapTarget:e.querySelectorAll(".tap-target:not(.no-autoinit)"),Timepicker:e.querySelectorAll(".timepicker:not(.no-autoinit)"),Tooltip:e.querySelectorAll(".tooltipped:not(.no-autoinit)"),FloatingActionButton:e.querySelectorAll(".fixed-action-btn:not(.no-autoinit)")};for(var n in i){M[n].init(i[n])}},M.objectSelectorString=function(t){return((t.prop("tagName")||"")+(t.attr("id")||"")+(t.attr("class")||"")).replace(/\s/g,"")},M.guid=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}(),M.escapeHash=function(t){return t.replace(/(:|\.|\[|\]|,|=|\/)/g,"\\$1")},M.elementOrParentIsFixed=function(t){var e=$(t),i=e.add(e.parents()),n=!1;return i.each(function(){if("fixed"===$(this).css("position"))return!(n=!0)}),n},M.checkWithinContainer=function(t,e,i){var n={top:!1,right:!1,bottom:!1,left:!1},s=t.getBoundingClientRect(),o=t===document.body?Math.max(s.bottom,window.innerHeight):s.bottom,a=t.scrollLeft,r=t.scrollTop,l=e.left-a,h=e.top-r;return(l<s.left+i||l<i)&&(n.left=!0),(l+e.width>s.right-i||l+e.width>window.innerWidth-i)&&(n.right=!0),(h<s.top+i||h<i)&&(n.top=!0),(h+e.height>o-i||h+e.height>window.innerHeight-i)&&(n.bottom=!0),n},M.checkPossibleAlignments=function(t,e,i,n){var s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},o="visible"===getComputedStyle(e).overflow,a=e.getBoundingClientRect(),r=Math.min(a.height,window.innerHeight),l=Math.min(a.width,window.innerWidth),h=t.getBoundingClientRect(),d=e.scrollLeft,u=e.scrollTop,c=i.left-d,p=i.top-u,v=i.top+h.height-u;return s.spaceOnRight=o?window.innerWidth-(h.left+i.width):l-(c+i.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=o?h.right-i.width:c-i.width+h.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=o?window.innerHeight-(h.top+i.height+n):r-(p+i.height+n),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=o?h.bottom-(i.height+n):v-(i.height-n),s.spaceOnTop<0&&(s.bottom=!1),s},M.getOverflowParent=function(t){return null==t?null:t===document.body||"visible"!==getComputedStyle(t).overflow?t:M.getOverflowParent(t.parentElement)},M.getIdFromTrigger=function(t){var e=t.getAttribute("data-target");return e||(e=(e=t.getAttribute("href"))?e.slice(1):""),e},M.getDocumentScrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},M.getDocumentScrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};var getTime=Date.now||function(){return(new Date).getTime()};M.throttle=function(i,n,s){var o=void 0,a=void 0,r=void 0,l=null,h=0;s||(s={});var d=function(){h=!1===s.leading?0:getTime(),l=null,r=i.apply(o,a),o=a=null};return function(){var t=getTime();h||!1!==s.leading||(h=t);var e=n-(t-h);return o=this,a=arguments,e<=0?(clearTimeout(l),l=null,h=t,r=i.apply(o,a),o=a=null):l||!1===s.trailing||(l=setTimeout(d,e)),r}};var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,i){if(i.get||i.set)throw new TypeError("ES3 does not support getters and setters.");t!=Array.prototype&&t!=Object.prototype&&(t[e]=i.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.symbolCounter_=0,$jscomp.Symbol=function(t){return $jscomp.SYMBOL_PREFIX+(t||"")+$jscomp.symbolCounter_++},$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype(function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}})},$jscomp.iteratorPrototype=function(t){return $jscomp.initSymbolIterator(),(t={next:t})[$jscomp.global.Symbol.iterator]=function(){return this},t},$jscomp.array=$jscomp.array||{},$jscomp.iteratorFromArray=function(e,i){$jscomp.initSymbolIterator(),e instanceof String&&(e+="");var n=0,s={next:function(){if(n<e.length){var t=n++;return{value:i(t,e[t]),done:!1}}return s.next=function(){return{done:!0,value:void 0}},s.next()}};return s[Symbol.iterator]=function(){return s},s},$jscomp.polyfill=function(t,e,i,n){if(e){for(i=$jscomp.global,t=t.split("."),n=0;n<t.length-1;n++){var s=t[n];s in i||(i[s]={}),i=i[s]}(e=e(n=i[t=t[t.length-1]]))!=n&&null!=e&&$jscomp.defineProperty(i,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Array.prototype.keys",function(t){return t||function(){return $jscomp.iteratorFromArray(this,function(t){return t})}},"es6-impl","es3");var $jscomp$this=this;M.anime=function(){function s(t){if(!B.col(t))try{return document.querySelectorAll(t)}catch(t){}}function b(t,e){for(var i=t.length,n=2<=arguments.length?e:void 0,s=[],o=0;o<i;o++)if(o in t){var a=t[o];e.call(n,a,o,t)&&s.push(a)}return s}function d(t){return t.reduce(function(t,e){return t.concat(B.arr(e)?d(e):e)},[])}function o(t){return B.arr(t)?t:(B.str(t)&&(t=s(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function a(t,e){return t.some(function(t){return t===e})}function r(t){var e,i={};for(e in t)i[e]=t[e];return i}function u(t,e){var i,n=r(t);for(i in t)n[i]=e.hasOwnProperty(i)?e[i]:t[i];return n}function c(t,e){var i,n=r(t);for(i in e)n[i]=B.und(t[i])?e[i]:t[i];return n}function l(t){if(t=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t))return t[2]}function h(t,e){return B.fnc(t)?t(e.target,e.id,e.total):t}function w(t,e){if(e in t.style)return getComputedStyle(t).getPropertyValue(e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function p(t,e){return B.dom(t)&&a($,e)?"transform":B.dom(t)&&(t.getAttribute(e)||B.svg(t)&&t[e])?"attribute":B.dom(t)&&"transform"!==e&&w(t,e)?"css":null!=t[e]?"object":void 0}function v(t,e){switch(p(t,e)){case"transform":return function(t,i){var e,n=-1<(e=i).indexOf("translate")||"perspective"===e?"px":-1<e.indexOf("rotate")||-1<e.indexOf("skew")?"deg":void 0,n=-1<i.indexOf("scale")?1:0+n;if(!(t=t.style.transform))return n;for(var s=[],o=[],a=[],r=/(\w+)\((.+?)\)/g;s=r.exec(t);)o.push(s[1]),a.push(s[2]);return(t=b(a,function(t,e){return o[e]===i})).length?t[0]:n}(t,e);case"css":return w(t,e);case"attribute":return t.getAttribute(e)}return t[e]||0}function f(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var n=l(t)||0;switch(e=parseFloat(e),t=parseFloat(t.replace(i[0],"")),i[0][0]){case"+":return e+t+n;case"-":return e-t+n;case"*":return e*t+n}}function m(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function i(t){t=t.points;for(var e,i=0,n=0;n<t.numberOfItems;n++){var s=t.getItem(n);0<n&&(i+=m(e,s)),e=s}return i}function g(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return 2*Math.PI*t.getAttribute("r");case"rect":return 2*t.getAttribute("width")+2*t.getAttribute("height");case"line":return m({x:t.getAttribute("x1"),y:t.getAttribute("y1")},{x:t.getAttribute("x2"),y:t.getAttribute("y2")});case"polyline":return i(t);case"polygon":var e=t.points;return i(t)+m(e.getItem(e.numberOfItems-1),e.getItem(0))}}function C(e,i){function t(t){return t=void 0===t?0:t,e.el.getPointAtLength(1<=i+t?i+t:0)}var n=t(),s=t(-1),o=t(1);switch(e.property){case"x":return n.x;case"y":return n.y;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}function _(t,e){var i,n=/-?\d*\.?\d+/g;if(i=B.pth(t)?t.totalLength:t,B.col(i))if(B.rgb(i)){var s=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);i=s?"rgba("+s[1]+",1)":i}else i=B.hex(i)?function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n});var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);t=parseInt(e[1],16);var i=parseInt(e[2],16),e=parseInt(e[3],16);return"rgba("+t+","+i+","+e+",1)"}(i):B.hsl(i)?function(t){function e(t,e,i){return i<0&&(i+=1),1<i&&--i,i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}var i=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);t=parseInt(i[1])/360;var n=parseInt(i[2])/100,s=parseInt(i[3])/100,i=i[4]||1;if(0==n)s=n=t=s;else{var o=s<.5?s*(1+n):s+n-s*n,a=2*s-o,s=e(a,o,t+1/3),n=e(a,o,t);t=e(a,o,t-1/3)}return"rgba("+255*s+","+255*n+","+255*t+","+i+")"}(i):void 0;else s=(s=l(i))?i.substr(0,i.length-s.length):i,i=e&&!/\s/g.test(i)?s+e:s;return{original:i+="",numbers:i.match(n)?i.match(n).map(Number):[0],strings:B.str(t)||e?i.split(n):[]}}function y(t){return b(t=t?d(B.arr(t)?t.map(o):o(t)):[],function(t,e,i){return i.indexOf(t)===e})}function k(t,i){var e=r(i);if(B.arr(t)){var n=t.length;2!==n||B.obj(t[0])?B.fnc(i.duration)||(e.duration=i.duration/n):t={value:t}}return o(t).map(function(t,e){return e=e?0:i.delay,t=B.obj(t)&&!B.pth(t)?t:{value:t},B.und(t.delay)&&(t.delay=e),t}).map(function(t){return c(t,e)})}function E(o,a){var r;return o.tweens.map(function(t){var e=(t=function(t,e){var i,n={};for(i in t){var s=h(t[i],e);B.arr(s)&&1===(s=s.map(function(t){return h(t,e)})).length&&(s=s[0]),n[i]=s}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(t,a)).value,i=v(a.target,o.name),n=r?r.to.original:i,n=B.arr(e)?e[0]:n,s=f(B.arr(e)?e[1]:e,n),i=l(s)||l(n)||l(i);return t.from=_(n,i),t.to=_(s,i),t.start=r?r.end:o.offset,t.end=t.start+t.delay+t.duration,t.easing=function(t){return B.arr(t)?D.apply(this,t):S[t]}(t.easing),t.elasticity=(1e3-Math.min(Math.max(t.elasticity,1),999))/1e3,t.isPath=B.pth(e),t.isColor=B.col(t.from.original),t.isColor&&(t.round=1),r=t})}function M(e,t,i,n){var s="delay"===e;return t.length?(s?Math.min:Math.max).apply(Math,t.map(function(t){return t[e]})):s?n.delay:i.offset+n.delay+n.duration}function n(t){var e,i,n,s,o=u(L,t),a=u(T,t),r=(i=t.targets,(n=y(i)).map(function(t,e){return{target:t,id:e,total:n.length}})),l=[],h=c(o,a);for(e in t)h.hasOwnProperty(e)||"targets"===e||l.push({name:e,offset:h.offset,tweens:k(t[e],a)});return s=l,t=b(d(r.map(function(n){return s.map(function(t){var e=p(n.target,t.name);if(e){var i=E(t,n);t={type:e,property:t.name,animatable:n,tweens:i,duration:i[i.length-1].end,delay:i[0].delay}}else t=void 0;return t})})),function(t){return!B.und(t)}),c(o,{children:[],animatables:r,animations:t,duration:M("duration",t,o,a),delay:M("delay",t,o,a)})}function O(t){function d(){return window.Promise&&new Promise(function(t){return _=t})}function u(t){return k.reversed?k.duration-t:t}function c(e){for(var t=0,i={},n=k.animations,s=n.length;t<s;){var o=n[t],a=o.animatable,r=o.tweens,l=r.length-1,h=r[l];l&&(h=b(r,function(t){return e<t.end})[0]||h);for(var r=Math.min(Math.max(e-h.start-h.delay,0),h.duration)/h.duration,d=isNaN(r)?1:h.easing(r,h.elasticity),r=h.to.strings,u=h.round,l=[],c=void 0,c=h.to.numbers.length,p=0;p<c;p++){var v=void 0,v=h.to.numbers[p],f=h.from.numbers[p],v=h.isPath?C(h.value,d*v):f+d*(v-f);u&&(h.isColor&&2<p||(v=Math.round(v*u)/u)),l.push(v)}if(h=r.length)for(c=r[0],d=0;d<h;d++)u=r[d+1],p=l[d],isNaN(p)||(c=u?c+(p+u):c+(p+" "));else c=l[0];I[o.type](a.target,o.property,c,i,a.id),o.currentValue=c,t++}if(t=Object.keys(i).length)for(n=0;n<t;n++)x||(x=w(document.body,"transform")?"transform":"-webkit-transform"),k.animatables[n].target.style[x]=i[n].join(" ");k.currentTime=e,k.progress=e/k.duration*100}function p(t){k[t]&&k[t](k)}function v(){k.remaining&&!0!==k.remaining&&k.remaining--}function e(t){var e=k.duration,i=k.offset,n=i+k.delay,s=k.currentTime,o=k.reversed,a=u(t);if(k.children.length){var r=k.children,l=r.length;if(a>=k.currentTime)for(var h=0;h<l;h++)r[h].seek(a);else for(;l--;)r[l].seek(a)}(n<=a||!e)&&(k.began||(k.began=!0,p("begin")),p("run")),i<a&&a<e?c(a):(a<=i&&0!==s&&(c(0),o&&v()),(e<=a&&s!==e||!e)&&(c(e),o||v())),p("update"),e<=t&&(k.remaining?(m=f,"alternate"===k.direction&&(k.reversed=!k.reversed)):(k.pause(),k.completed||(k.completed=!0,p("complete"),"Promise"in window&&(_(),y=d()))),g=0)}t=void 0===t?{}:t;var f,m,g=0,_=null,y=d(),k=n(t);return k.reset=function(){var t=k.direction,e=k.loop;for(k.currentTime=0,k.progress=0,k.paused=!0,k.began=!1,k.completed=!1,k.reversed="reverse"===t,k.remaining="alternate"===t&&1===e?2:e,c(0),t=k.children.length;t--;)k.children[t].reset()},k.tick=function(t){f=t,m||(m=f),e((g+f-m)*O.speed)},k.seek=function(t){e(u(t))},k.pause=function(){var t=A.indexOf(k);-1<t&&A.splice(t,1),k.paused=!0},k.play=function(){k.paused&&(k.paused=!1,m=0,g=u(k.currentTime),A.push(k),R||H())},k.reverse=function(){k.reversed=!k.reversed,m=0,g=u(k.currentTime)},k.restart=function(){k.pause(),k.reset(),k.play()},k.finished=y,k.reset(),k.autoplay&&k.play(),k}var x,L={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},T={duration:1e3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},$="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),B={arr:function(t){return Array.isArray(t)},obj:function(t){return-1<Object.prototype.toString.call(t).indexOf("Object")},pth:function(t){return B.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},dom:function(t){return t.nodeType||B.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return B.hex(t)||B.rgb(t)||B.hsl(t)}},D=function(){function u(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}return function(a,r,l,h){if(0<=a&&a<=1&&0<=l&&l<=1){var d=new Float32Array(11);if(a!==r||l!==h)for(var t=0;t<11;++t)d[t]=u(.1*t,a,l);return function(t){if(a===r&&l===h)return t;if(0===t)return 0;if(1===t)return 1;for(var e=0,i=1;10!==i&&d[i]<=t;++i)e+=.1;var i=e+(t-d[--i])/(d[i+1]-d[i])*.1,n=3*(1-3*l+3*a)*i*i+2*(3*l-6*a)*i+3*a;if(.001<=n){for(e=0;e<4&&0!=(n=3*(1-3*l+3*a)*i*i+2*(3*l-6*a)*i+3*a);++e)var s=u(i,a,l)-t,i=i-s/n;t=i}else if(0===n)t=i;else{for(var i=e,e=e+.1,o=0;0<(n=u(s=i+(e-i)/2,a,l)-t)?e=s:i=s,1e-7<Math.abs(n)&&++o<10;);t=s}return u(t,r,h)}}}}(),S=function(){function i(t,e){return 0===t||1===t?t:-Math.pow(2,10*(t-1))*Math.sin(2*(t-1-e/(2*Math.PI)*Math.asin(1))*Math.PI/e)}var t,n="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],i],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(t,e){return 1-i(1-t,e)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(t,e){return t<.5?i(2*t,e)/2:1-i(-2*t+2,e)/2}]},s={linear:D(.25,.25,.75,.75)},o={};for(t in e)o.type=t,e[o.type].forEach(function(i){return function(t,e){s["ease"+i.type+n[e]]=B.fnc(t)?t:D.apply($jscomp$this,t)}}(o)),o={type:o.type};return s}(),I={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,n,s){n[s]||(n[s]=[]),n[s].push(e+"("+i+")")}},A=[],R=0,H=function(){function n(){R=requestAnimationFrame(t)}function t(t){var e=A.length;if(e){for(var i=0;i<e;)A[i]&&A[i].tick(t),i++;n()}else cancelAnimationFrame(R),R=0}return n}();return O.version="2.2.0",O.speed=1,O.running=A,O.remove=function(t){t=y(t);for(var e=A.length;e--;)for(var i=A[e],n=i.animations,s=n.length;s--;)a(t,n[s].animatable.target)&&(n.splice(s,1),n.length||i.pause())},O.getValue=v,O.path=function(t,e){var i=B.str(t)?s(t)[0]:t,n=e||100;return function(t){return{el:i,property:t,totalLength:g(i)*(n/100)}}},O.setDashoffset=function(t){var e=g(t);return t.setAttribute("stroke-dasharray",e),e},O.bezier=D,O.easings=S,O.timeline=function(n){var s=O(n);return s.pause(),s.duration=0,s.add=function(t){return s.children.forEach(function(t){t.began=!0,t.completed=!0}),o(t).forEach(function(t){var e=c(t,u(T,n||{}));e.targets=e.targets||n.targets,t=s.duration;var i=e.offset;e.autoplay=!1,e.direction=s.direction,e.offset=B.und(i)?t:f(i,t),s.began=!0,s.completed=!0,s.seek(e.offset),(e=O(e)).began=!0,e.completed=!0,e.duration>t&&(s.duration=e.duration),s.children.push(e)}),s.seek(0),s.reset(),s.autoplay&&s.restart(),s},s},O.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t},O}(),function(r,l){"use strict";var e={accordion:!0,onOpenStart:void 0,onOpenEnd:void 0,onCloseStart:void 0,onCloseEnd:void 0,inDuration:300,outDuration:300},t=function(t){function s(t,e){_classCallCheck(this,s);var i=_possibleConstructorReturn(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,s,t,e));(i.el.M_Collapsible=i).options=r.extend({},s.defaults,e),i.$headers=i.$el.children("li").children(".collapsible-header"),i.$headers.attr("tabindex",0),i._setupEventHandlers();var n=i.$el.children("li.active").children(".collapsible-body");return i.options.accordion?n.first().css("display","block"):n.css("display","block"),i}return _inherits(s,Component),_createClass(s,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Collapsible=void 0}},{key:"_setupEventHandlers",value:function(){var e=this;this._handleCollapsibleClickBound=this._handleCollapsibleClick.bind(this),this._handleCollapsibleKeydownBound=this._handleCollapsibleKeydown.bind(this),this.el.addEventListener("click",this._handleCollapsibleClickBound),this.$headers.each(function(t){t.addEventListener("keydown",e._handleCollapsibleKeydownBound)})}},{key:"_removeEventHandlers",value:function(){var e=this;this.el.removeEventListener("click",this._handleCollapsibleClickBound),this.$headers.each(function(t){t.removeEventListener("keydown",e._handleCollapsibleKeydownBound)})}},{key:"_handleCollapsibleClick",value:function(t){var e=r(t.target).closest(".collapsible-header");if(t.target&&e.length){var i=e.closest(".collapsible");if(i[0]===this.el){var n=e.closest("li"),s=i.children("li"),o=n[0].classList.contains("active"),a=s.index(n);o?this.close(a):this.open(a)}}}},{key:"_handleCollapsibleKeydown",value:function(t){13===t.keyCode&&this._handleCollapsibleClickBound(t)}},{key:"_animateIn",value:function(t){var e=this,i=this.$el.children("li").eq(t);if(i.length){var n=i.children(".collapsible-body");l.remove(n[0]),n.css({display:"block",overflow:"hidden",height:0,paddingTop:"",paddingBottom:""});var s=n.css("padding-top"),o=n.css("padding-bottom"),a=n[0].scrollHeight;n.css({paddingTop:0,paddingBottom:0}),l({targets:n[0],height:a,paddingTop:s,paddingBottom:o,duration:this.options.inDuration,easing:"easeInOutCubic",complete:function(t){n.css({overflow:"",paddingTop:"",paddingBottom:"",height:""}),"function"==typeof e.options.onOpenEnd&&e.options.onOpenEnd.call(e,i[0])}})}}},{key:"_animateOut",value:function(t){var e=this,i=this.$el.children("li").eq(t);if(i.length){var n=i.children(".collapsible-body");l.remove(n[0]),n.css("overflow","hidden"),l({targets:n[0],height:0,paddingTop:0,paddingBottom:0,duration:this.options.outDuration,easing:"easeInOutCubic",complete:function(){n.css({height:"",overflow:"",padding:"",display:""}),"function"==typeof e.options.onCloseEnd&&e.options.onCloseEnd.call(e,i[0])}})}}},{key:"open",value:function(t){var i=this,e=this.$el.children("li").eq(t);if(e.length&&!e[0].classList.contains("active")){if("function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,e[0]),this.options.accordion){var n=this.$el.children("li");this.$el.children("li.active").each(function(t){var e=n.index(r(t));i.close(e)})}e[0].classList.add("active"),this._animateIn(t)}}},{key:"close",value:function(t){var e=this.$el.children("li").eq(t);e.length&&e[0].classList.contains("active")&&("function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,e[0]),e[0].classList.remove("active"),this._animateOut(t))}}],[{key:"init",value:function(t,e){return _get(s.__proto__||Object.getPrototypeOf(s),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Collapsible}},{key:"defaults",get:function(){return e}}]),s}();M.Collapsible=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"collapsible","M_Collapsible")}(cash,M.anime),function(h,i){"use strict";var e={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!0,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return i.el.M_Dropdown=i,n._dropdowns.push(i),i.id=M.getIdFromTrigger(t),i.dropdownEl=document.getElementById(i.id),i.$dropdownEl=h(i.dropdownEl),i.options=h.extend({},n.defaults,e),i.isOpen=!1,i.isScrollable=!1,i.isTouchMoving=!1,i.focusedIndex=-1,i.filterQuery=[],i.options.container?h(i.options.container).append(i.dropdownEl):i.$el.after(i.dropdownEl),i._makeDropdownFocusable(),i._resetFilterQueryBound=i._resetFilterQuery.bind(i),i._handleDocumentClickBound=i._handleDocumentClick.bind(i),i._handleDocumentTouchmoveBound=i._handleDocumentTouchmove.bind(i),i._handleDropdownClickBound=i._handleDropdownClick.bind(i),i._handleDropdownKeydownBound=i._handleDropdownKeydown.bind(i),i._handleTriggerKeydownBound=i._handleTriggerKeydown.bind(i),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._resetDropdownStyles(),this._removeEventHandlers(),n._dropdowns.splice(n._dropdowns.indexOf(this),1),this.el.M_Dropdown=void 0}},{key:"_setupEventHandlers",value:function(){this.el.addEventListener("keydown",this._handleTriggerKeydownBound),this.dropdownEl.addEventListener("click",this._handleDropdownClickBound),this.options.hover?(this._handleMouseEnterBound=this._handleMouseEnter.bind(this),this.el.addEventListener("mouseenter",this._handleMouseEnterBound),this._handleMouseLeaveBound=this._handleMouseLeave.bind(this),this.el.addEventListener("mouseleave",this._handleMouseLeaveBound),this.dropdownEl.addEventListener("mouseleave",this._handleMouseLeaveBound)):(this._handleClickBound=this._handleClick.bind(this),this.el.addEventListener("click",this._handleClickBound))}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("keydown",this._handleTriggerKeydownBound),this.dropdownEl.removeEventListener("click",this._handleDropdownClickBound),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnterBound),this.el.removeEventListener("mouseleave",this._handleMouseLeaveBound),this.dropdownEl.removeEventListener("mouseleave",this._handleMouseLeaveBound)):this.el.removeEventListener("click",this._handleClickBound)}},{key:"_setupTemporaryEventHandlers",value:function(){document.body.addEventListener("click",this._handleDocumentClickBound,!0),document.body.addEventListener("touchend",this._handleDocumentClickBound),document.body.addEventListener("touchmove",this._handleDocumentTouchmoveBound),this.dropdownEl.addEventListener("keydown",this._handleDropdownKeydownBound)}},{key:"_removeTemporaryEventHandlers",value:function(){document.body.removeEventListener("click",this._handleDocumentClickBound,!0),document.body.removeEventListener("touchend",this._handleDocumentClickBound),document.body.removeEventListener("touchmove",this._handleDocumentTouchmoveBound),this.dropdownEl.removeEventListener("keydown",this._handleDropdownKeydownBound)}},{key:"_handleClick",value:function(t){t.preventDefault(),this.open()}},{key:"_handleMouseEnter",value:function(){this.open()}},{key:"_handleMouseLeave",value:function(t){var e=t.toElement||t.relatedTarget,i=!!h(e).closest(".dropdown-content").length,n=!1,s=h(e).closest(".dropdown-trigger");s.length&&s[0].M_Dropdown&&s[0].M_Dropdown.isOpen&&(n=!0),n||i||this.close()}},{key:"_handleDocumentClick",value:function(t){var e=this,i=h(t.target);this.options.closeOnClick&&i.closest(".dropdown-content").length&&!this.isTouchMoving?setTimeout(function(){e.close()},0):!i.closest(".dropdown-trigger").length&&i.closest(".dropdown-content").length||setTimeout(function(){e.close()},0),this.isTouchMoving=!1}},{key:"_handleTriggerKeydown",value:function(t){t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ENTER||this.isOpen||(t.preventDefault(),this.open())}},{key:"_handleDocumentTouchmove",value:function(t){h(t.target).closest(".dropdown-content").length&&(this.isTouchMoving=!0)}},{key:"_handleDropdownClick",value:function(t){if("function"==typeof this.options.onItemClick){var e=h(t.target).closest("li")[0];this.options.onItemClick.call(this,e)}}},{key:"_handleDropdownKeydown",value:function(t){if(t.which===M.keys.TAB)t.preventDefault(),this.close();else if(t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ARROW_UP||!this.isOpen)if(t.which===M.keys.ENTER&&this.isOpen){var e=this.dropdownEl.children[this.focusedIndex],i=h(e).find("a, button").first();i.length?i[0].click():e&&e.click()}else t.which===M.keys.ESC&&this.isOpen&&(t.preventDefault(),this.close());else{t.preventDefault();var n=t.which===M.keys.ARROW_DOWN?1:-1,s=this.focusedIndex,o=!1;do{if(s+=n,this.dropdownEl.children[s]&&-1!==this.dropdownEl.children[s].tabIndex){o=!0;break}}while(s<this.dropdownEl.children.length&&0<=s);o&&(this.focusedIndex=s,this._focusFocusedItem())}var a=String.fromCharCode(t.which).toLowerCase();if(a&&-1===[9,13,27,38,40].indexOf(t.which)){this.filterQuery.push(a);var r=this.filterQuery.join(""),l=h(this.dropdownEl).find("li").filter(function(t){return 0===h(t).text().toLowerCase().indexOf(r)})[0];l&&(this.focusedIndex=h(l).index(),this._focusFocusedItem())}this.filterTimeout=setTimeout(this._resetFilterQueryBound,1e3)}},{key:"_resetFilterQuery",value:function(){this.filterQuery=[]}},{key:"_resetDropdownStyles",value:function(){this.$dropdownEl.css({display:"",width:"",height:"",left:"",top:"","transform-origin":"",transform:"",opacity:""})}},{key:"_makeDropdownFocusable",value:function(){this.dropdownEl.tabIndex=0,h(this.dropdownEl).children().each(function(t){t.getAttribute("tabindex")||t.setAttribute("tabindex",0)})}},{key:"_focusFocusedItem",value:function(){0<=this.focusedIndex&&this.focusedIndex<this.dropdownEl.children.length&&this.options.autoFocus&&this.dropdownEl.children[this.focusedIndex].focus()}},{key:"_getDropdownPosition",value:function(){this.el.offsetParent.getBoundingClientRect();var t=this.el.getBoundingClientRect(),e=this.dropdownEl.getBoundingClientRect(),i=e.height,n=e.width,s=t.left-e.left,o=t.top-e.top,a={left:s,top:o,height:i,width:n},r=this.dropdownEl.offsetParent?this.dropdownEl.offsetParent:this.dropdownEl.parentNode,l=M.checkPossibleAlignments(this.el,r,a,this.options.coverTrigger?0:t.height),h="top",d=this.options.alignment;if(o+=this.options.coverTrigger?0:t.height,this.isScrollable=!1,l.top||(l.bottom?h="bottom":(this.isScrollable=!0,l.spaceOnTop>l.spaceOnBottom?(h="bottom",i+=l.spaceOnTop,o-=l.spaceOnTop):i+=l.spaceOnBottom)),!l[d]){var u="left"===d?"right":"left";l[u]?d=u:l.spaceOnLeft>l.spaceOnRight?(d="right",n+=l.spaceOnLeft,s-=l.spaceOnLeft):(d="left",n+=l.spaceOnRight)}return"bottom"===h&&(o=o-e.height+(this.options.coverTrigger?t.height:0)),"right"===d&&(s=s-e.width+t.width),{x:s,y:o,verticalAlignment:h,horizontalAlignment:d,height:i,width:n}}},{key:"_animateIn",value:function(){var e=this;i.remove(this.dropdownEl),i({targets:this.dropdownEl,opacity:{value:[0,1],easing:"easeOutQuad"},scaleX:[.3,1],scaleY:[.3,1],duration:this.options.inDuration,easing:"easeOutQuint",complete:function(t){e.options.autoFocus&&e.dropdownEl.focus(),"function"==typeof e.options.onOpenEnd&&e.options.onOpenEnd.call(e,e.el)}})}},{key:"_animateOut",value:function(){var e=this;i.remove(this.dropdownEl),i({targets:this.dropdownEl,opacity:{value:0,easing:"easeOutQuint"},scaleX:.3,scaleY:.3,duration:this.options.outDuration,easing:"easeOutQuint",complete:function(t){e._resetDropdownStyles(),"function"==typeof e.options.onCloseEnd&&e.options.onCloseEnd.call(e,e.el)}})}},{key:"_placeDropdown",value:function(){var t=this.options.constrainWidth?this.el.getBoundingClientRect().width:this.dropdownEl.getBoundingClientRect().width;this.dropdownEl.style.width=t+"px";var e=this._getDropdownPosition();this.dropdownEl.style.left=e.x+"px",this.dropdownEl.style.top=e.y+"px",this.dropdownEl.style.height=e.height+"px",this.dropdownEl.style.width=e.width+"px",this.dropdownEl.style.transformOrigin=("left"===e.horizontalAlignment?"0":"100%")+" "+("top"===e.verticalAlignment?"0":"100%")}},{key:"open",value:function(){this.isOpen||(this.isOpen=!0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el),this._resetDropdownStyles(),this.dropdownEl.style.display="block",this._placeDropdown(),this._animateIn(),this._setupTemporaryEventHandlers())}},{key:"close",value:function(){this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),this._animateOut(),this._removeTemporaryEventHandlers(),this.options.autoFocus&&this.el.focus())}},{key:"recalculateDimensions",value:function(){this.isOpen&&(this.$dropdownEl.css({width:"",height:"",left:"",top:"","transform-origin":""}),this._placeDropdown())}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Dropdown}},{key:"defaults",get:function(){return e}}]),n}();t._dropdowns=[],M.Dropdown=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"dropdown","M_Dropdown")}(cash,M.anime),function(s,i){"use strict";var e={opacity:.5,inDuration:250,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0,dismissible:!0,startingTop:"4%",endingTop:"10%"},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Modal=i).options=s.extend({},n.defaults,e),i.isOpen=!1,i.id=i.$el.attr("id"),i._openingTrigger=void 0,i.$overlay=s('<div class="modal-overlay"></div>'),i.el.tabIndex=0,i._nthModalOpened=0,n._count++,i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){n._count--,this._removeEventHandlers(),this.el.removeAttribute("style"),this.$overlay.remove(),this.el.M_Modal=void 0}},{key:"_setupEventHandlers",value:function(){this._handleOverlayClickBound=this._handleOverlayClick.bind(this),this._handleModalCloseClickBound=this._handleModalCloseClick.bind(this),1===n._count&&document.body.addEventListener("click",this._handleTriggerClick),this.$overlay[0].addEventListener("click",this._handleOverlayClickBound),this.el.addEventListener("click",this._handleModalCloseClickBound)}},{key:"_removeEventHandlers",value:function(){0===n._count&&document.body.removeEventListener("click",this._handleTriggerClick),this.$overlay[0].removeEventListener("click",this._handleOverlayClickBound),this.el.removeEventListener("click",this._handleModalCloseClickBound)}},{key:"_handleTriggerClick",value:function(t){var e=s(t.target).closest(".modal-trigger");if(e.length){var i=M.getIdFromTrigger(e[0]),n=document.getElementById(i).M_Modal;n&&n.open(e),t.preventDefault()}}},{key:"_handleOverlayClick",value:function(){this.options.dismissible&&this.close()}},{key:"_handleModalCloseClick",value:function(t){s(t.target).closest(".modal-close").length&&this.close()}},{key:"_handleKeydown",value:function(t){27===t.keyCode&&this.options.dismissible&&this.close()}},{key:"_handleFocus",value:function(t){this.el.contains(t.target)||this._nthModalOpened!==n._modalsOpen||this.el.focus()}},{key:"_animateIn",value:function(){var t=this;s.extend(this.el.style,{display:"block",opacity:0}),s.extend(this.$overlay[0].style,{display:"block",opacity:0}),i({targets:this.$overlay[0],opacity:this.options.opacity,duration:this.options.inDuration,easing:"easeOutQuad"});var e={targets:this.el,duration:this.options.inDuration,easing:"easeOutCubic",complete:function(){"function"==typeof t.options.onOpenEnd&&t.options.onOpenEnd.call(t,t.el,t._openingTrigger)}};this.el.classList.contains("bottom-sheet")?s.extend(e,{bottom:0,opacity:1}):s.extend(e,{top:[this.options.startingTop,this.options.endingTop],opacity:1,scaleX:[.8,1],scaleY:[.8,1]}),i(e)}},{key:"_animateOut",value:function(){var t=this;i({targets:this.$overlay[0],opacity:0,duration:this.options.outDuration,easing:"easeOutQuart"});var e={targets:this.el,duration:this.options.outDuration,easing:"easeOutCubic",complete:function(){t.el.style.display="none",t.$overlay.remove(),"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t,t.el)}};this.el.classList.contains("bottom-sheet")?s.extend(e,{bottom:"-100%",opacity:0}):s.extend(e,{top:[this.options.endingTop,this.options.startingTop],opacity:0,scaleX:.8,scaleY:.8}),i(e)}},{key:"open",value:function(t){if(!this.isOpen)return this.isOpen=!0,n._modalsOpen++,this._nthModalOpened=n._modalsOpen,this.$overlay[0].style.zIndex=1e3+2*n._modalsOpen,this.el.style.zIndex=1e3+2*n._modalsOpen+1,this._openingTrigger=t?t[0]:void 0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el,this._openingTrigger),this.options.preventScrolling&&(document.body.style.overflow="hidden"),this.el.classList.add("open"),this.el.insertAdjacentElement("afterend",this.$overlay[0]),this.options.dismissible&&(this._handleKeydownBound=this._handleKeydown.bind(this),this._handleFocusBound=this._handleFocus.bind(this),document.addEventListener("keydown",this._handleKeydownBound),document.addEventListener("focus",this._handleFocusBound,!0)),i.remove(this.el),i.remove(this.$overlay[0]),this._animateIn(),this.el.focus(),this}},{key:"close",value:function(){if(this.isOpen)return this.isOpen=!1,n._modalsOpen--,this._nthModalOpened=0,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),this.el.classList.remove("open"),0===n._modalsOpen&&(document.body.style.overflow=""),this.options.dismissible&&(document.removeEventListener("keydown",this._handleKeydownBound),document.removeEventListener("focus",this._handleFocusBound,!0)),i.remove(this.el),i.remove(this.$overlay[0]),this._animateOut(),this}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Modal}},{key:"defaults",get:function(){return e}}]),n}();t._modalsOpen=0,t._count=0,M.Modal=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"modal","M_Modal")}(cash,M.anime),function(o,a){"use strict";var e={inDuration:275,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Materialbox=i).options=o.extend({},n.defaults,e),i.overlayActive=!1,i.doneAnimating=!0,i.placeholder=o("<div></div>").addClass("material-placeholder"),i.originalWidth=0,i.originalHeight=0,i.originInlineStyles=i.$el.attr("style"),i.caption=i.el.getAttribute("data-caption")||"",i.$el.before(i.placeholder),i.placeholder.append(i.$el),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Materialbox=void 0,o(this.placeholder).after(this.el).remove(),this.$el.removeAttr("style")}},{key:"_setupEventHandlers",value:function(){this._handleMaterialboxClickBound=this._handleMaterialboxClick.bind(this),this.el.addEventListener("click",this._handleMaterialboxClickBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleMaterialboxClickBound)}},{key:"_handleMaterialboxClick",value:function(t){!1===this.doneAnimating||this.overlayActive&&this.doneAnimating?this.close():this.open()}},{key:"_handleWindowScroll",value:function(){this.overlayActive&&this.close()}},{key:"_handleWindowResize",value:function(){this.overlayActive&&this.close()}},{key:"_handleWindowEscape",value:function(t){27===t.keyCode&&this.doneAnimating&&this.overlayActive&&this.close()}},{key:"_makeAncestorsOverflowVisible",value:function(){this.ancestorsChanged=o();for(var t=this.placeholder[0].parentNode;null!==t&&!o(t).is(document);){var e=o(t);"visible"!==e.css("overflow")&&(e.css("overflow","visible"),void 0===this.ancestorsChanged?this.ancestorsChanged=e:this.ancestorsChanged=this.ancestorsChanged.add(e)),t=t.parentNode}}},{key:"_animateImageIn",value:function(){var t=this,e={targets:this.el,height:[this.originalHeight,this.newHeight],width:[this.originalWidth,this.newWidth],left:M.getDocumentScrollLeft()+this.windowWidth/2-this.placeholder.offset().left-this.newWidth/2,top:M.getDocumentScrollTop()+this.windowHeight/2-this.placeholder.offset().top-this.newHeight/2,duration:this.options.inDuration,easing:"easeOutQuad",complete:function(){t.doneAnimating=!0,"function"==typeof t.options.onOpenEnd&&t.options.onOpenEnd.call(t,t.el)}};this.maxWidth=this.$el.css("max-width"),this.maxHeight=this.$el.css("max-height"),"none"!==this.maxWidth&&(e.maxWidth=this.newWidth),"none"!==this.maxHeight&&(e.maxHeight=this.newHeight),a(e)}},{key:"_animateImageOut",value:function(){var t=this,e={targets:this.el,width:this.originalWidth,height:this.originalHeight,left:0,top:0,duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){t.placeholder.css({height:"",width:"",position:"",top:"",left:""}),t.attrWidth&&t.$el.attr("width",t.attrWidth),t.attrHeight&&t.$el.attr("height",t.attrHeight),t.$el.removeAttr("style"),t.originInlineStyles&&t.$el.attr("style",t.originInlineStyles),t.$el.removeClass("active"),t.doneAnimating=!0,t.ancestorsChanged.length&&t.ancestorsChanged.css("overflow",""),"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t,t.el)}};a(e)}},{key:"_updateVars",value:function(){this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight,this.caption=this.el.getAttribute("data-caption")||""}},{key:"open",value:function(){var t=this;this._updateVars(),this.originalWidth=this.el.getBoundingClientRect().width,this.originalHeight=this.el.getBoundingClientRect().height,this.doneAnimating=!1,this.$el.addClass("active"),this.overlayActive=!0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el),this.placeholder.css({width:this.placeholder[0].getBoundingClientRect().width+"px",height:this.placeholder[0].getBoundingClientRect().height+"px",position:"relative",top:0,left:0}),this._makeAncestorsOverflowVisible(),this.$el.css({position:"absolute","z-index":1e3,"will-change":"left, top, width, height"}),this.attrWidth=this.$el.attr("width"),this.attrHeight=this.$el.attr("height"),this.attrWidth&&(this.$el.css("width",this.attrWidth+"px"),this.$el.removeAttr("width")),this.attrHeight&&(this.$el.css("width",this.attrHeight+"px"),this.$el.removeAttr("height")),this.$overlay=o('<div id="materialbox-overlay"></div>').css({opacity:0}).one("click",function(){t.doneAnimating&&t.close()}),this.$el.before(this.$overlay);var e=this.$overlay[0].getBoundingClientRect();this.$overlay.css({width:this.windowWidth+"px",height:this.windowHeight+"px",left:-1*e.left+"px",top:-1*e.top+"px"}),a.remove(this.el),a.remove(this.$overlay[0]),a({targets:this.$overlay[0],opacity:1,duration:this.options.inDuration,easing:"easeOutQuad"}),""!==this.caption&&(this.$photocaption&&a.remove(this.$photoCaption[0]),this.$photoCaption=o('<div class="materialbox-caption"></div>'),this.$photoCaption.text(this.caption),o("body").append(this.$photoCaption),this.$photoCaption.css({display:"inline"}),a({targets:this.$photoCaption[0],opacity:1,duration:this.options.inDuration,easing:"easeOutQuad"}));var i=0,n=this.originalWidth/this.windowWidth,s=this.originalHeight/this.windowHeight;this.newWidth=0,this.newHeight=0,s<n?(i=this.originalHeight/this.originalWidth,this.newWidth=.9*this.windowWidth,this.newHeight=.9*this.windowWidth*i):(i=this.originalWidth/this.originalHeight,this.newWidth=.9*this.windowHeight*i,this.newHeight=.9*this.windowHeight),this._animateImageIn(),this._handleWindowScrollBound=this._handleWindowScroll.bind(this),this._handleWindowResizeBound=this._handleWindowResize.bind(this),this._handleWindowEscapeBound=this._handleWindowEscape.bind(this),window.addEventListener("scroll",this._handleWindowScrollBound),window.addEventListener("resize",this._handleWindowResizeBound),window.addEventListener("keyup",this._handleWindowEscapeBound)}},{key:"close",value:function(){var t=this;this._updateVars(),this.doneAnimating=!1,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),a.remove(this.el),a.remove(this.$overlay[0]),""!==this.caption&&a.remove(this.$photoCaption[0]),window.removeEventListener("scroll",this._handleWindowScrollBound),window.removeEventListener("resize",this._handleWindowResizeBound),window.removeEventListener("keyup",this._handleWindowEscapeBound),a({targets:this.$overlay[0],opacity:0,duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){t.overlayActive=!1,t.$overlay.remove()}}),this._animateImageOut(),""!==this.caption&&a({targets:this.$photoCaption[0],opacity:0,duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){t.$photoCaption.remove()}})}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Materialbox}},{key:"defaults",get:function(){return e}}]),n}();M.Materialbox=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"materialbox","M_Materialbox")}(cash,M.anime),function(s){"use strict";var e={responsiveThreshold:0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Parallax=i).options=s.extend({},n.defaults,e),i._enabled=window.innerWidth>i.options.responsiveThreshold,i.$img=i.$el.find("img").first(),i.$img.each(function(){this.complete&&s(this).trigger("load")}),i._updateParallax(),i._setupEventHandlers(),i._setupStyles(),n._parallaxes.push(i),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){n._parallaxes.splice(n._parallaxes.indexOf(this),1),this.$img[0].style.transform="",this._removeEventHandlers(),this.$el[0].M_Parallax=void 0}},{key:"_setupEventHandlers",value:function(){this._handleImageLoadBound=this._handleImageLoad.bind(this),this.$img[0].addEventListener("load",this._handleImageLoadBound),0===n._parallaxes.length&&(n._handleScrollThrottled=M.throttle(n._handleScroll,5),window.addEventListener("scroll",n._handleScrollThrottled),n._handleWindowResizeThrottled=M.throttle(n._handleWindowResize,5),window.addEventListener("resize",n._handleWindowResizeThrottled))}},{key:"_removeEventHandlers",value:function(){this.$img[0].removeEventListener("load",this._handleImageLoadBound),0===n._parallaxes.length&&(window.removeEventListener("scroll",n._handleScrollThrottled),window.removeEventListener("resize",n._handleWindowResizeThrottled))}},{key:"_setupStyles",value:function(){this.$img[0].style.opacity=1}},{key:"_handleImageLoad",value:function(){this._updateParallax()}},{key:"_updateParallax",value:function(){var t=0<this.$el.height()?this.el.parentNode.offsetHeight:500,e=this.$img[0].offsetHeight-t,i=this.$el.offset().top+t,n=this.$el.offset().top,s=M.getDocumentScrollTop(),o=window.innerHeight,a=e*((s+o-n)/(t+o));this._enabled?s<i&&n<s+o&&(this.$img[0].style.transform="translate3D(-50%, "+a+"px, 0)"):this.$img[0].style.transform=""}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Parallax}},{key:"_handleScroll",value:function(){for(var t=0;t<n._parallaxes.length;t++){var e=n._parallaxes[t];e._updateParallax.call(e)}}},{key:"_handleWindowResize",value:function(){for(var t=0;t<n._parallaxes.length;t++){var e=n._parallaxes[t];e._enabled=window.innerWidth>e.options.responsiveThreshold}}},{key:"defaults",get:function(){return e}}]),n}();t._parallaxes=[],M.Parallax=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"parallax","M_Parallax")}(cash),function(a,s){"use strict";var e={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Tabs=i).options=a.extend({},n.defaults,e),i.$tabLinks=i.$el.children("li.tab").children("a"),i.index=0,i._setupActiveTabLink(),i.options.swipeable?i._setupSwipeableTabs():i._setupNormalTabs(),i._setTabsAndTabWidth(),i._createIndicator(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._indicator.parentNode.removeChild(this._indicator),this.options.swipeable?this._teardownSwipeableTabs():this._teardownNormalTabs(),this.$el[0].M_Tabs=void 0}},{key:"_setupEventHandlers",value:function(){this._handleWindowResizeBound=this._handleWindowResize.bind(this),window.addEventListener("resize",this._handleWindowResizeBound),this._handleTabClickBound=this._handleTabClick.bind(this),this.el.addEventListener("click",this._handleTabClickBound)}},{key:"_removeEventHandlers",value:function(){window.removeEventListener("resize",this._handleWindowResizeBound),this.el.removeEventListener("click",this._handleTabClickBound)}},{key:"_handleWindowResize",value:function(){this._setTabsAndTabWidth(),0!==this.tabWidth&&0!==this.tabsWidth&&(this._indicator.style.left=this._calcLeftPos(this.$activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this.$activeTabLink)+"px")}},{key:"_handleTabClick",value:function(t){var e=this,i=a(t.target).closest("li.tab"),n=a(t.target).closest("a");if(n.length&&n.parent().hasClass("tab"))if(i.hasClass("disabled"))t.preventDefault();else if(!n.attr("target")){this.$activeTabLink.removeClass("active");var s=this.$content;this.$activeTabLink=n,this.$content=a(M.escapeHash(n[0].hash)),this.$tabLinks=this.$el.children("li.tab").children("a"),this.$activeTabLink.addClass("active");var o=this.index;this.index=Math.max(this.$tabLinks.index(n),0),this.options.swipeable?this._tabsCarousel&&this._tabsCarousel.set(this.index,function(){"function"==typeof e.options.onShow&&e.options.onShow.call(e,e.$content[0])}):this.$content.length&&(this.$content[0].style.display="block",this.$content.addClass("active"),"function"==typeof this.options.onShow&&this.options.onShow.call(this,this.$content[0]),s.length&&!s.is(this.$content)&&(s[0].style.display="none",s.removeClass("active"))),this._setTabsAndTabWidth(),this._animateIndicator(o),t.preventDefault()}}},{key:"_createIndicator",value:function(){var t=this,e=document.createElement("li");e.classList.add("indicator"),this.el.appendChild(e),this._indicator=e,setTimeout(function(){t._indicator.style.left=t._calcLeftPos(t.$activeTabLink)+"px",t._indicator.style.right=t._calcRightPos(t.$activeTabLink)+"px"},0)}},{key:"_setupActiveTabLink",value:function(){this.$activeTabLink=a(this.$tabLinks.filter('[href="'+location.hash+'"]')),0===this.$activeTabLink.length&&(this.$activeTabLink=this.$el.children("li.tab").children("a.active").first()),0===this.$activeTabLink.length&&(this.$activeTabLink=this.$el.children("li.tab").children("a").first()),this.$tabLinks.removeClass("active"),this.$activeTabLink[0].classList.add("active"),this.index=Math.max(this.$tabLinks.index(this.$activeTabLink),0),this.$activeTabLink.length&&(this.$content=a(M.escapeHash(this.$activeTabLink[0].hash)),this.$content.addClass("active"))}},{key:"_setupSwipeableTabs",value:function(){var i=this;window.innerWidth>this.options.responsiveThreshold&&(this.options.swipeable=!1);var n=a();this.$tabLinks.each(function(t){var e=a(M.escapeHash(t.hash));e.addClass("carousel-item"),n=n.add(e)});var t=a('<div class="tabs-content carousel carousel-slider"></div>');n.first().before(t),t.append(n),n[0].style.display="";var e=this.$activeTabLink.closest(".tab").index();this._tabsCarousel=M.Carousel.init(t[0],{fullWidth:!0,noWrap:!0,onCycleTo:function(t){var e=i.index;i.index=a(t).index(),i.$activeTabLink.removeClass("active"),i.$activeTabLink=i.$tabLinks.eq(i.index),i.$activeTabLink.addClass("active"),i._animateIndicator(e),"function"==typeof i.options.onShow&&i.options.onShow.call(i,i.$content[0])}}),this._tabsCarousel.set(e)}},{key:"_teardownSwipeableTabs",value:function(){var t=this._tabsCarousel.$el;this._tabsCarousel.destroy(),t.after(t.children()),t.remove()}},{key:"_setupNormalTabs",value:function(){this.$tabLinks.not(this.$activeTabLink).each(function(t){if(t.hash){var e=a(M.escapeHash(t.hash));e.length&&(e[0].style.display="none")}})}},{key:"_teardownNormalTabs",value:function(){this.$tabLinks.each(function(t){if(t.hash){var e=a(M.escapeHash(t.hash));e.length&&(e[0].style.display="")}})}},{key:"_setTabsAndTabWidth",value:function(){this.tabsWidth=this.$el.width(),this.tabWidth=Math.max(this.tabsWidth,this.el.scrollWidth)/this.$tabLinks.length}},{key:"_calcRightPos",value:function(t){return Math.ceil(this.tabsWidth-t.position().left-t[0].getBoundingClientRect().width)}},{key:"_calcLeftPos",value:function(t){return Math.floor(t.position().left)}},{key:"updateTabIndicator",value:function(){this._setTabsAndTabWidth(),this._animateIndicator(this.index)}},{key:"_animateIndicator",value:function(t){var e=0,i=0;0<=this.index-t?e=90:i=90;var n={targets:this._indicator,left:{value:this._calcLeftPos(this.$activeTabLink),delay:e},right:{value:this._calcRightPos(this.$activeTabLink),delay:i},duration:this.options.duration,easing:"easeOutQuad"};s.remove(this._indicator),s(n)}},{key:"select",value:function(t){var e=this.$tabLinks.filter('[href="#'+t+'"]');e.length&&e.trigger("click")}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Tabs}},{key:"defaults",get:function(){return e}}]),n}();M.Tabs=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"tabs","M_Tabs")}(cash,M.anime),function(d,e){"use strict";var i={exitDelay:200,enterDelay:0,html:null,margin:5,inDuration:250,outDuration:200,position:"bottom",transitionMovement:10},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Tooltip=i).options=d.extend({},n.defaults,e),i.isOpen=!1,i.isHovered=!1,i.isFocused=!1,i._appendTooltipEl(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){d(this.tooltipEl).remove(),this._removeEventHandlers(),this.el.M_Tooltip=void 0}},{key:"_appendTooltipEl",value:function(){var t=document.createElement("div");t.classList.add("material-tooltip"),this.tooltipEl=t;var e=document.createElement("div");e.classList.add("tooltip-content"),e.innerHTML=this.options.html,t.appendChild(e),document.body.appendChild(t)}},{key:"_updateTooltipContent",value:function(){this.tooltipEl.querySelector(".tooltip-content").innerHTML=this.options.html}},{key:"_setupEventHandlers",value:function(){this._handleMouseEnterBound=this._handleMouseEnter.bind(this),this._handleMouseLeaveBound=this._handleMouseLeave.bind(this),this._handleFocusBound=this._handleFocus.bind(this),this._handleBlurBound=this._handleBlur.bind(this),this.el.addEventListener("mouseenter",this._handleMouseEnterBound),this.el.addEventListener("mouseleave",this._handleMouseLeaveBound),this.el.addEventListener("focus",this._handleFocusBound,!0),this.el.addEventListener("blur",this._handleBlurBound,!0)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("mouseenter",this._handleMouseEnterBound),this.el.removeEventListener("mouseleave",this._handleMouseLeaveBound),this.el.removeEventListener("focus",this._handleFocusBound,!0),this.el.removeEventListener("blur",this._handleBlurBound,!0)}},{key:"open",value:function(t){this.isOpen||(t=void 0===t||void 0,this.isOpen=!0,this.options=d.extend({},this.options,this._getAttributeOptions()),this._updateTooltipContent(),this._setEnterDelayTimeout(t))}},{key:"close",value:function(){this.isOpen&&(this.isHovered=!1,this.isFocused=!1,this.isOpen=!1,this._setExitDelayTimeout())}},{key:"_setExitDelayTimeout",value:function(){var t=this;clearTimeout(this._exitDelayTimeout),this._exitDelayTimeout=setTimeout(function(){t.isHovered||t.isFocused||t._animateOut()},this.options.exitDelay)}},{key:"_setEnterDelayTimeout",value:function(t){var e=this;clearTimeout(this._enterDelayTimeout),this._enterDelayTimeout=setTimeout(function(){(e.isHovered||e.isFocused||t)&&e._animateIn()},this.options.enterDelay)}},{key:"_positionTooltip",value:function(){var t,e=this.el,i=this.tooltipEl,n=e.offsetHeight,s=e.offsetWidth,o=i.offsetHeight,a=i.offsetWidth,r=this.options.margin,l=void 0,h=void 0;this.xMovement=0,this.yMovement=0,l=e.getBoundingClientRect().top+M.getDocumentScrollTop(),h=e.getBoundingClientRect().left+M.getDocumentScrollLeft(),"top"===this.options.position?(l+=-o-r,h+=s/2-a/2,this.yMovement=-this.options.transitionMovement):"right"===this.options.position?(l+=n/2-o/2,h+=s+r,this.xMovement=this.options.transitionMovement):"left"===this.options.position?(l+=n/2-o/2,h+=-a-r,this.xMovement=-this.options.transitionMovement):(l+=n+r,h+=s/2-a/2,this.yMovement=this.options.transitionMovement),t=this._repositionWithinScreen(h,l,a,o),d(i).css({top:t.y+"px",left:t.x+"px"})}},{key:"_repositionWithinScreen",value:function(t,e,i,n){var s=M.getDocumentScrollLeft(),o=M.getDocumentScrollTop(),a=t-s,r=e-o,l={left:a,top:r,width:i,height:n},h=this.options.margin+this.options.transitionMovement,d=M.checkWithinContainer(document.body,l,h);return d.left?a=h:d.right&&(a-=a+i-window.innerWidth),d.top?r=h:d.bottom&&(r-=r+n-window.innerHeight),{x:a+s,y:r+o}}},{key:"_animateIn",value:function(){this._positionTooltip(),this.tooltipEl.style.visibility="visible",e.remove(this.tooltipEl),e({targets:this.tooltipEl,opacity:1,translateX:this.xMovement,translateY:this.yMovement,duration:this.options.inDuration,easing:"easeOutCubic"})}},{key:"_animateOut",value:function(){e.remove(this.tooltipEl),e({targets:this.tooltipEl,opacity:0,translateX:0,translateY:0,duration:this.options.outDuration,easing:"easeOutCubic"})}},{key:"_handleMouseEnter",value:function(){this.isHovered=!0,this.isFocused=!1,this.open(!1)}},{key:"_handleMouseLeave",value:function(){this.isHovered=!1,this.isFocused=!1,this.close()}},{key:"_handleFocus",value:function(){M.tabPressed&&(this.isFocused=!0,this.open(!1))}},{key:"_handleBlur",value:function(){this.isFocused=!1,this.close()}},{key:"_getAttributeOptions",value:function(){var t={},e=this.el.getAttribute("data-tooltip"),i=this.el.getAttribute("data-position");return e&&(t.html=e),i&&(t.position=i),t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Tooltip}},{key:"defaults",get:function(){return i}}]),n}();M.Tooltip=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"tooltip","M_Tooltip")}(cash,M.anime),function(i){"use strict";var t=t||{},e=document.querySelectorAll.bind(document);function m(t){var e="";for(var i in t)t.hasOwnProperty(i)&&(e+=i+":"+t[i]+";");return e}var g={duration:750,show:function(t,e){if(2===t.button)return!1;var i=e||this,n=document.createElement("div");n.className="waves-ripple",i.appendChild(n);var s,o,a,r,l,h,d,u=(h={top:0,left:0},d=(s=i)&&s.ownerDocument,o=d.documentElement,void 0!==s.getBoundingClientRect&&(h=s.getBoundingClientRect()),a=null!==(l=r=d)&&l===l.window?r:9===r.nodeType&&r.defaultView,{top:h.top+a.pageYOffset-o.clientTop,left:h.left+a.pageXOffset-o.clientLeft}),c=t.pageY-u.top,p=t.pageX-u.left,v="scale("+i.clientWidth/100*10+")";"touches"in t&&(c=t.touches[0].pageY-u.top,p=t.touches[0].pageX-u.left),n.setAttribute("data-hold",Date.now()),n.setAttribute("data-scale",v),n.setAttribute("data-x",p),n.setAttribute("data-y",c);var f={top:c+"px",left:p+"px"};n.className=n.className+" waves-notransition",n.setAttribute("style",m(f)),n.className=n.className.replace("waves-notransition",""),f["-webkit-transform"]=v,f["-moz-transform"]=v,f["-ms-transform"]=v,f["-o-transform"]=v,f.transform=v,f.opacity="1",f["-webkit-transition-duration"]=g.duration+"ms",f["-moz-transition-duration"]=g.duration+"ms",f["-o-transition-duration"]=g.duration+"ms",f["transition-duration"]=g.duration+"ms",f["-webkit-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["-moz-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["-o-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",n.setAttribute("style",m(f))},hide:function(t){l.touchup(t);var e=this,i=(e.clientWidth,null),n=e.getElementsByClassName("waves-ripple");if(!(0<n.length))return!1;var s=(i=n[n.length-1]).getAttribute("data-x"),o=i.getAttribute("data-y"),a=i.getAttribute("data-scale"),r=350-(Date.now()-Number(i.getAttribute("data-hold")));r<0&&(r=0),setTimeout(function(){var t={top:o+"px",left:s+"px",opacity:"0","-webkit-transition-duration":g.duration+"ms","-moz-transition-duration":g.duration+"ms","-o-transition-duration":g.duration+"ms","transition-duration":g.duration+"ms","-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,"-o-transform":a,transform:a};i.setAttribute("style",m(t)),setTimeout(function(){try{e.removeChild(i)}catch(t){return!1}},g.duration)},r)},wrapInput:function(t){for(var e=0;e<t.length;e++){var i=t[e];if("input"===i.tagName.toLowerCase()){var n=i.parentNode;if("i"===n.tagName.toLowerCase()&&-1!==n.className.indexOf("waves-effect"))continue;var s=document.createElement("i");s.className=i.className+" waves-input-wrapper";var o=i.getAttribute("style");o||(o=""),s.setAttribute("style",o),i.className="waves-button-input",i.removeAttribute("style"),n.replaceChild(s,i),s.appendChild(i)}}}},l={touches:0,allowEvent:function(t){var e=!0;return"touchstart"===t.type?l.touches+=1:"touchend"===t.type||"touchcancel"===t.type?setTimeout(function(){0<l.touches&&(l.touches-=1)},500):"mousedown"===t.type&&0<l.touches&&(e=!1),e},touchup:function(t){l.allowEvent(t)}};function n(t){var e=function(t){if(!1===l.allowEvent(t))return null;for(var e=null,i=t.target||t.srcElement;null!==i.parentNode;){if(!(i instanceof SVGElement)&&-1!==i.className.indexOf("waves-effect")){e=i;break}i=i.parentNode}return e}(t);null!==e&&(g.show(t,e),"ontouchstart"in i&&(e.addEventListener("touchend",g.hide,!1),e.addEventListener("touchcancel",g.hide,!1)),e.addEventListener("mouseup",g.hide,!1),e.addEventListener("mouseleave",g.hide,!1),e.addEventListener("dragend",g.hide,!1))}t.displayEffect=function(t){"duration"in(t=t||{})&&(g.duration=t.duration),g.wrapInput(e(".waves-effect")),"ontouchstart"in i&&document.body.addEventListener("touchstart",n,!1),document.body.addEventListener("mousedown",n,!1)},t.attach=function(t){"input"===t.tagName.toLowerCase()&&(g.wrapInput([t]),t=t.parentNode),"ontouchstart"in i&&t.addEventListener("touchstart",n,!1),t.addEventListener("mousedown",n,!1)},i.Waves=t,document.addEventListener("DOMContentLoaded",function(){t.displayEffect()},!1)}(window),function(i,n){"use strict";var t={html:"",displayLength:4e3,inDuration:300,outDuration:375,classes:"",completeCallback:null,activationPercent:.8},e=function(){function s(t){_classCallCheck(this,s),this.options=i.extend({},s.defaults,t),this.message=this.options.html,this.panning=!1,this.timeRemaining=this.options.displayLength,0===s._toasts.length&&s._createContainer(),s._toasts.push(this);var e=this._createToast();(e.M_Toast=this).el=e,this.$el=i(e),this._animateIn(),this._setTimer()}return _createClass(s,[{key:"_createToast",value:function(){var t=document.createElement("div");return t.classList.add("toast"),this.options.classes.length&&i(t).addClass(this.options.classes),("object"==typeof HTMLElement?this.message instanceof HTMLElement:this.message&&"object"==typeof this.message&&null!==this.message&&1===this.message.nodeType&&"string"==typeof this.message.nodeName)?t.appendChild(this.message):this.message.jquery?i(t).append(this.message[0]):t.innerHTML=this.message,s._container.appendChild(t),t}},{key:"_animateIn",value:function(){n({targets:this.el,top:0,opacity:1,duration:this.options.inDuration,easing:"easeOutCubic"})}},{key:"_setTimer",value:function(){var t=this;this.timeRemaining!==1/0&&(this.counterInterval=setInterval(function(){t.panning||(t.timeRemaining-=20),t.timeRemaining<=0&&t.dismiss()},20))}},{key:"dismiss",value:function(){var t=this;window.clearInterval(this.counterInterval);var e=this.el.offsetWidth*this.options.activationPercent;this.wasSwiped&&(this.el.style.transition="transform .05s, opacity .05s",this.el.style.transform="translateX("+e+"px)",this.el.style.opacity=0),n({targets:this.el,opacity:0,marginTop:-40,duration:this.options.outDuration,easing:"easeOutExpo",complete:function(){"function"==typeof t.options.completeCallback&&t.options.completeCallback(),t.$el.remove(),s._toasts.splice(s._toasts.indexOf(t),1),0===s._toasts.length&&s._removeContainer()}})}}],[{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Toast}},{key:"_createContainer",value:function(){var t=document.createElement("div");t.setAttribute("id","toast-container"),t.addEventListener("touchstart",s._onDragStart),t.addEventListener("touchmove",s._onDragMove),t.addEventListener("touchend",s._onDragEnd),t.addEventListener("mousedown",s._onDragStart),document.addEventListener("mousemove",s._onDragMove),document.addEventListener("mouseup",s._onDragEnd),document.body.appendChild(t),s._container=t}},{key:"_removeContainer",value:function(){document.removeEventListener("mousemove",s._onDragMove),document.removeEventListener("mouseup",s._onDragEnd),i(s._container).remove(),s._container=null}},{key:"_onDragStart",value:function(t){if(t.target&&i(t.target).closest(".toast").length){var e=i(t.target).closest(".toast")[0].M_Toast;e.panning=!0,(s._draggedToast=e).el.classList.add("panning"),e.el.style.transition="",e.startingXPos=s._xPos(t),e.time=Date.now(),e.xPos=s._xPos(t)}}},{key:"_onDragMove",value:function(t){if(s._draggedToast){t.preventDefault();var e=s._draggedToast;e.deltaX=Math.abs(e.xPos-s._xPos(t)),e.xPos=s._xPos(t),e.velocityX=e.deltaX/(Date.now()-e.time),e.time=Date.now();var i=e.xPos-e.startingXPos,n=e.el.offsetWidth*e.options.activationPercent;e.el.style.transform="translateX("+i+"px)",e.el.style.opacity=1-Math.abs(i/n)}}},{key:"_onDragEnd",value:function(){if(s._draggedToast){var t=s._draggedToast;t.panning=!1,t.el.classList.remove("panning");var e=t.xPos-t.startingXPos,i=t.el.offsetWidth*t.options.activationPercent;Math.abs(e)>i||1<t.velocityX?(t.wasSwiped=!0,t.dismiss()):(t.el.style.transition="transform .2s, opacity .2s",t.el.style.transform="",t.el.style.opacity=""),s._draggedToast=null}}},{key:"_xPos",value:function(t){return t.targetTouches&&1<=t.targetTouches.length?t.targetTouches[0].clientX:t.clientX}},{key:"dismissAll",value:function(){for(var t in s._toasts)s._toasts[t].dismiss()}},{key:"defaults",get:function(){return t}}]),s}();e._toasts=[],e._container=null,e._draggedToast=null,M.Toast=e,M.toast=function(t){return new e(t)}}(cash,M.anime),function(s,o){"use strict";var e={edge:"left",draggable:!0,inDuration:250,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Sidenav=i).id=i.$el.attr("id"),i.options=s.extend({},n.defaults,e),i.isOpen=!1,i.isFixed=i.el.classList.contains("sidenav-fixed"),i.isDragged=!1,i.lastWindowWidth=window.innerWidth,i.lastWindowHeight=window.innerHeight,i._createOverlay(),i._createDragTarget(),i._setupEventHandlers(),i._setupClasses(),i._setupFixed(),n._sidenavs.push(i),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._enableBodyScrolling(),this._overlay.parentNode.removeChild(this._overlay),this.dragTarget.parentNode.removeChild(this.dragTarget),this.el.M_Sidenav=void 0,this.el.style.transform="";var t=n._sidenavs.indexOf(this);0<=t&&n._sidenavs.splice(t,1)}},{key:"_createOverlay",value:function(){var t=document.createElement("div");this._closeBound=this.close.bind(this),t.classList.add("sidenav-overlay"),t.addEventListener("click",this._closeBound),document.body.appendChild(t),this._overlay=t}},{key:"_setupEventHandlers",value:function(){0===n._sidenavs.length&&document.body.addEventListener("click",this._handleTriggerClick),this._handleDragTargetDragBound=this._handleDragTargetDrag.bind(this),this._handleDragTargetReleaseBound=this._handleDragTargetRelease.bind(this),this._handleCloseDragBound=this._handleCloseDrag.bind(this),this._handleCloseReleaseBound=this._handleCloseRelease.bind(this),this._handleCloseTriggerClickBound=this._handleCloseTriggerClick.bind(this),this.dragTarget.addEventListener("touchmove",this._handleDragTargetDragBound),this.dragTarget.addEventListener("touchend",this._handleDragTargetReleaseBound),this._overlay.addEventListener("touchmove",this._handleCloseDragBound),this._overlay.addEventListener("touchend",this._handleCloseReleaseBound),this.el.addEventListener("touchmove",this._handleCloseDragBound),this.el.addEventListener("touchend",this._handleCloseReleaseBound),this.el.addEventListener("click",this._handleCloseTriggerClickBound),this.isFixed&&(this._handleWindowResizeBound=this._handleWindowResize.bind(this),window.addEventListener("resize",this._handleWindowResizeBound))}},{key:"_removeEventHandlers",value:function(){1===n._sidenavs.length&&document.body.removeEventListener("click",this._handleTriggerClick),this.dragTarget.removeEventListener("touchmove",this._handleDragTargetDragBound),this.dragTarget.removeEventListener("touchend",this._handleDragTargetReleaseBound),this._overlay.removeEventListener("touchmove",this._handleCloseDragBound),this._overlay.removeEventListener("touchend",this._handleCloseReleaseBound),this.el.removeEventListener("touchmove",this._handleCloseDragBound),this.el.removeEventListener("touchend",this._handleCloseReleaseBound),this.el.removeEventListener("click",this._handleCloseTriggerClickBound),this.isFixed&&window.removeEventListener("resize",this._handleWindowResizeBound)}},{key:"_handleTriggerClick",value:function(t){var e=s(t.target).closest(".sidenav-trigger");if(t.target&&e.length){var i=M.getIdFromTrigger(e[0]),n=document.getElementById(i).M_Sidenav;n&&n.open(e),t.preventDefault()}}},{key:"_startDrag",value:function(t){var e=t.targetTouches[0].clientX;this.isDragged=!0,this._startingXpos=e,this._xPos=this._startingXpos,this._time=Date.now(),this._width=this.el.getBoundingClientRect().width,this._overlay.style.display="block",this._initialScrollTop=this.isOpen?this.el.scrollTop:M.getDocumentScrollTop(),this._verticallyScrolling=!1,o.remove(this.el),o.remove(this._overlay)}},{key:"_dragMoveUpdate",value:function(t){var e=t.targetTouches[0].clientX,i=this.isOpen?this.el.scrollTop:M.getDocumentScrollTop();this.deltaX=Math.abs(this._xPos-e),this._xPos=e,this.velocityX=this.deltaX/(Date.now()-this._time),this._time=Date.now(),this._initialScrollTop!==i&&(this._verticallyScrolling=!0)}},{key:"_handleDragTargetDrag",value:function(t){if(this.options.draggable&&!this._isCurrentlyFixed()&&!this._verticallyScrolling){this.isDragged||this._startDrag(t),this._dragMoveUpdate(t);var e=this._xPos-this._startingXpos,i=0<e?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge===i&&(e=0);var n=e,s="translateX(-100%)";"right"===this.options.edge&&(s="translateX(100%)",n=-n),this.percentOpen=Math.min(1,e/this._width),this.el.style.transform=s+" translateX("+n+"px)",this._overlay.style.opacity=this.percentOpen}}},{key:"_handleDragTargetRelease",value:function(){this.isDragged&&(.2<this.percentOpen?this.open():this._animateOut(),this.isDragged=!1,this._verticallyScrolling=!1)}},{key:"_handleCloseDrag",value:function(t){if(this.isOpen){if(!this.options.draggable||this._isCurrentlyFixed()||this._verticallyScrolling)return;this.isDragged||this._startDrag(t),this._dragMoveUpdate(t);var e=this._xPos-this._startingXpos,i=0<e?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge!==i&&(e=0);var n=-e;"right"===this.options.edge&&(n=-n),this.percentOpen=Math.min(1,1-e/this._width),this.el.style.transform="translateX("+n+"px)",this._overlay.style.opacity=this.percentOpen}}},{key:"_handleCloseRelease",value:function(){this.isOpen&&this.isDragged&&(.8<this.percentOpen?this._animateIn():this.close(),this.isDragged=!1,this._verticallyScrolling=!1)}},{key:"_handleCloseTriggerClick",value:function(t){s(t.target).closest(".sidenav-close").length&&!this._isCurrentlyFixed()&&this.close()}},{key:"_handleWindowResize",value:function(){this.lastWindowWidth!==window.innerWidth&&(992<window.innerWidth?this.open():this.close()),this.lastWindowWidth=window.innerWidth,this.lastWindowHeight=window.innerHeight}},{key:"_setupClasses",value:function(){"right"===this.options.edge&&(this.el.classList.add("right-aligned"),this.dragTarget.classList.add("right-aligned"))}},{key:"_removeClasses",value:function(){this.el.classList.remove("right-aligned"),this.dragTarget.classList.remove("right-aligned")}},{key:"_setupFixed",value:function(){this._isCurrentlyFixed()&&this.open()}},{key:"_isCurrentlyFixed",value:function(){return this.isFixed&&992<window.innerWidth}},{key:"_createDragTarget",value:function(){var t=document.createElement("div");t.classList.add("drag-target"),document.body.appendChild(t),this.dragTarget=t}},{key:"_preventBodyScrolling",value:function(){document.body.style.overflow="hidden"}},{key:"_enableBodyScrolling",value:function(){document.body.style.overflow=""}},{key:"open",value:function(){!0!==this.isOpen&&(this.isOpen=!0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el),this._isCurrentlyFixed()?(o.remove(this.el),o({targets:this.el,translateX:0,duration:0,easing:"easeOutQuad"}),this._enableBodyScrolling(),this._overlay.style.display="none"):(this.options.preventScrolling&&this._preventBodyScrolling(),this.isDragged&&1==this.percentOpen||this._animateIn()))}},{key:"close",value:function(){if(!1!==this.isOpen)if(this.isOpen=!1,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),this._isCurrentlyFixed()){var t="left"===this.options.edge?"-105%":"105%";this.el.style.transform="translateX("+t+")"}else this._enableBodyScrolling(),this.isDragged&&0==this.percentOpen?this._overlay.style.display="none":this._animateOut()}},{key:"_animateIn",value:function(){this._animateSidenavIn(),this._animateOverlayIn()}},{key:"_animateSidenavIn",value:function(){var t=this,e="left"===this.options.edge?-1:1;this.isDragged&&(e="left"===this.options.edge?e+this.percentOpen:e-this.percentOpen),o.remove(this.el),o({targets:this.el,translateX:[100*e+"%",0],duration:this.options.inDuration,easing:"easeOutQuad",complete:function(){"function"==typeof t.options.onOpenEnd&&t.options.onOpenEnd.call(t,t.el)}})}},{key:"_animateOverlayIn",value:function(){var t=0;this.isDragged?t=this.percentOpen:s(this._overlay).css({display:"block"}),o.remove(this._overlay),o({targets:this._overlay,opacity:[t,1],duration:this.options.inDuration,easing:"easeOutQuad"})}},{key:"_animateOut",value:function(){this._animateSidenavOut(),this._animateOverlayOut()}},{key:"_animateSidenavOut",value:function(){var t=this,e="left"===this.options.edge?-1:1,i=0;this.isDragged&&(i="left"===this.options.edge?e+this.percentOpen:e-this.percentOpen),o.remove(this.el),o({targets:this.el,translateX:[100*i+"%",105*e+"%"],duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t,t.el)}})}},{key:"_animateOverlayOut",value:function(){var t=this;o.remove(this._overlay),o({targets:this._overlay,opacity:0,duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){s(t._overlay).css("display","none")}})}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Sidenav}},{key:"defaults",get:function(){return e}}]),n}();t._sidenavs=[],M.Sidenav=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"sidenav","M_Sidenav")}(cash,M.anime),function(o,a){"use strict";var e={throttle:100,scrollOffset:200,activeClass:"active",getActiveElement:function(t){return'a[href="#'+t+'"]'}},t=function(t){function c(t,e){_classCallCheck(this,c);var i=_possibleConstructorReturn(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,c,t,e));return(i.el.M_ScrollSpy=i).options=o.extend({},c.defaults,e),c._elements.push(i),c._count++,c._increment++,i.tickId=-1,i.id=c._increment,i._setupEventHandlers(),i._handleWindowScroll(),i}return _inherits(c,Component),_createClass(c,[{key:"destroy",value:function(){c._elements.splice(c._elements.indexOf(this),1),c._elementsInView.splice(c._elementsInView.indexOf(this),1),c._visibleElements.splice(c._visibleElements.indexOf(this.$el),1),c._count--,this._removeEventHandlers(),o(this.options.getActiveElement(this.$el.attr("id"))).removeClass(this.options.activeClass),this.el.M_ScrollSpy=void 0}},{key:"_setupEventHandlers",value:function(){var t=M.throttle(this._handleWindowScroll,200);this._handleThrottledResizeBound=t.bind(this),this._handleWindowScrollBound=this._handleWindowScroll.bind(this),1===c._count&&(window.addEventListener("scroll",this._handleWindowScrollBound),window.addEventListener("resize",this._handleThrottledResizeBound),document.body.addEventListener("click",this._handleTriggerClick))}},{key:"_removeEventHandlers",value:function(){0===c._count&&(window.removeEventListener("scroll",this._handleWindowScrollBound),window.removeEventListener("resize",this._handleThrottledResizeBound),document.body.removeEventListener("click",this._handleTriggerClick))}},{key:"_handleTriggerClick",value:function(t){for(var e=o(t.target),i=c._elements.length-1;0<=i;i--){var n=c._elements[i];if(e.is('a[href="#'+n.$el.attr("id")+'"]')){t.preventDefault();var s=n.$el.offset().top+1;a({targets:[document.documentElement,document.body],scrollTop:s-n.options.scrollOffset,duration:400,easing:"easeOutCubic"});break}}}},{key:"_handleWindowScroll",value:function(){c._ticks++;for(var t=M.getDocumentScrollTop(),e=M.getDocumentScrollLeft(),i=e+window.innerWidth,n=t+window.innerHeight,s=c._findElements(t,i,n,e),o=0;o<s.length;o++){var a=s[o];a.tickId<0&&a._enter(),a.tickId=c._ticks}for(var r=0;r<c._elementsInView.length;r++){var l=c._elementsInView[r],h=l.tickId;0<=h&&h!==c._ticks&&(l._exit(),l.tickId=-1)}c._elementsInView=s}},{key:"_enter",value:function(){(c._visibleElements=c._visibleElements.filter(function(t){return 0!=t.height()}))[0]?(o(this.options.getActiveElement(c._visibleElements[0].attr("id"))).removeClass(this.options.activeClass),c._visibleElements[0][0].M_ScrollSpy&&this.id<c._visibleElements[0][0].M_ScrollSpy.id?c._visibleElements.unshift(this.$el):c._visibleElements.push(this.$el)):c._visibleElements.push(this.$el),o(this.options.getActiveElement(c._visibleElements[0].attr("id"))).addClass(this.options.activeClass)}},{key:"_exit",value:function(){var e=this;(c._visibleElements=c._visibleElements.filter(function(t){return 0!=t.height()}))[0]&&(o(this.options.getActiveElement(c._visibleElements[0].attr("id"))).removeClass(this.options.activeClass),(c._visibleElements=c._visibleElements.filter(function(t){return t.attr("id")!=e.$el.attr("id")}))[0]&&o(this.options.getActiveElement(c._visibleElements[0].attr("id"))).addClass(this.options.activeClass))}}],[{key:"init",value:function(t,e){return _get(c.__proto__||Object.getPrototypeOf(c),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_ScrollSpy}},{key:"_findElements",value:function(t,e,i,n){for(var s=[],o=0;o<c._elements.length;o++){var a=c._elements[o],r=t+a.options.scrollOffset||200;if(0<a.$el.height()){var l=a.$el.offset().top,h=a.$el.offset().left,d=h+a.$el.width(),u=l+a.$el.height();!(e<h||d<n||i<l||u<r)&&s.push(a)}}return s}},{key:"defaults",get:function(){return e}}]),c}();t._elements=[],t._elementsInView=[],t._visibleElements=[],t._count=0,t._increment=0,t._ticks=0,M.ScrollSpy=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"scrollSpy","M_ScrollSpy")}(cash,M.anime),function(h){"use strict";var e={data:{},limit:1/0,onAutocomplete:null,minLength:1,sortFunction:function(t,e,i){return t.indexOf(i)-e.indexOf(i)}},t=function(t){function s(t,e){_classCallCheck(this,s);var i=_possibleConstructorReturn(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,s,t,e));return(i.el.M_Autocomplete=i).options=h.extend({},s.defaults,e),i.isOpen=!1,i.count=0,i.activeIndex=-1,i.oldVal,i.$inputField=i.$el.closest(".input-field"),i.$active=h(),i._mousedown=!1,i._setupDropdown(),i._setupEventHandlers(),i}return _inherits(s,Component),_createClass(s,[{key:"destroy",value:function(){this._removeEventHandlers(),this._removeDropdown(),this.el.M_Autocomplete=void 0}},{key:"_setupEventHandlers",value:function(){this._handleInputBlurBound=this._handleInputBlur.bind(this),this._handleInputKeyupAndFocusBound=this._handleInputKeyupAndFocus.bind(this),this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),this._handleContainerMousedownAndTouchstartBound=this._handleContainerMousedownAndTouchstart.bind(this),this._handleContainerMouseupAndTouchendBound=this._handleContainerMouseupAndTouchend.bind(this),this.el.addEventListener("blur",this._handleInputBlurBound),this.el.addEventListener("keyup",this._handleInputKeyupAndFocusBound),this.el.addEventListener("focus",this._handleInputKeyupAndFocusBound),this.el.addEventListener("keydown",this._handleInputKeydownBound),this.el.addEventListener("click",this._handleInputClickBound),this.container.addEventListener("mousedown",this._handleContainerMousedownAndTouchstartBound),this.container.addEventListener("mouseup",this._handleContainerMouseupAndTouchendBound),void 0!==window.ontouchstart&&(this.container.addEventListener("touchstart",this._handleContainerMousedownAndTouchstartBound),this.container.addEventListener("touchend",this._handleContainerMouseupAndTouchendBound))}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("blur",this._handleInputBlurBound),this.el.removeEventListener("keyup",this._handleInputKeyupAndFocusBound),this.el.removeEventListener("focus",this._handleInputKeyupAndFocusBound),this.el.removeEventListener("keydown",this._handleInputKeydownBound),this.el.removeEventListener("click",this._handleInputClickBound),this.container.removeEventListener("mousedown",this._handleContainerMousedownAndTouchstartBound),this.container.removeEventListener("mouseup",this._handleContainerMouseupAndTouchendBound),void 0!==window.ontouchstart&&(this.container.removeEventListener("touchstart",this._handleContainerMousedownAndTouchstartBound),this.container.removeEventListener("touchend",this._handleContainerMouseupAndTouchendBound))}},{key:"_setupDropdown",value:function(){var e=this;this.container=document.createElement("ul"),this.container.id="autocomplete-options-"+M.guid(),h(this.container).addClass("autocomplete-content dropdown-content"),this.$inputField.append(this.container),this.el.setAttribute("data-target",this.container.id),this.dropdown=M.Dropdown.init(this.el,{autoFocus:!1,closeOnClick:!1,coverTrigger:!1,onItemClick:function(t){e.selectOption(h(t))}}),this.el.removeEventListener("click",this.dropdown._handleClickBound)}},{key:"_removeDropdown",value:function(){this.container.parentNode.removeChild(this.container)}},{key:"_handleInputBlur",value:function(){this._mousedown||(this.close(),this._resetAutocomplete())}},{key:"_handleInputKeyupAndFocus",value:function(t){"keyup"===t.type&&(s._keydown=!1),this.count=0;var e=this.el.value.toLowerCase();13!==t.keyCode&&38!==t.keyCode&&40!==t.keyCode&&(this.oldVal===e||!M.tabPressed&&"focus"===t.type||this.open(),this.oldVal=e)}},{key:"_handleInputKeydown",value:function(t){s._keydown=!0;var e=t.keyCode,i=void 0,n=h(this.container).children("li").length;e===M.keys.ENTER&&0<=this.activeIndex?(i=h(this.container).children("li").eq(this.activeIndex)).length&&(this.selectOption(i),t.preventDefault()):e!==M.keys.ARROW_UP&&e!==M.keys.ARROW_DOWN||(t.preventDefault(),e===M.keys.ARROW_UP&&0<this.activeIndex&&this.activeIndex--,e===M.keys.ARROW_DOWN&&this.activeIndex<n-1&&this.activeIndex++,this.$active.removeClass("active"),0<=this.activeIndex&&(this.$active=h(this.container).children("li").eq(this.activeIndex),this.$active.addClass("active")))}},{key:"_handleInputClick",value:function(t){this.open()}},{key:"_handleContainerMousedownAndTouchstart",value:function(t){this._mousedown=!0}},{key:"_handleContainerMouseupAndTouchend",value:function(t){this._mousedown=!1}},{key:"_highlight",value:function(t,e){var i=e.find("img"),n=e.text().toLowerCase().indexOf(""+t.toLowerCase()),s=n+t.length-1,o=e.text().slice(0,n),a=e.text().slice(n,s+1),r=e.text().slice(s+1);e.html("<span>"+o+"<span class='highlight'>"+a+"</span>"+r+"</span>"),i.length&&e.prepend(i)}},{key:"_resetCurrentElement",value:function(){this.activeIndex=-1,this.$active.removeClass("active")}},{key:"_resetAutocomplete",value:function(){h(this.container).empty(),this._resetCurrentElement(),this.oldVal=null,this.isOpen=!1,this._mousedown=!1}},{key:"selectOption",value:function(t){var e=t.text().trim();this.el.value=e,this.$el.trigger("change"),this._resetAutocomplete(),this.close(),"function"==typeof this.options.onAutocomplete&&this.options.onAutocomplete.call(this,e)}},{key:"_renderDropdown",value:function(t,i){var n=this;this._resetAutocomplete();var e=[];for(var s in t)if(t.hasOwnProperty(s)&&-1!==s.toLowerCase().indexOf(i)){if(this.count>=this.options.limit)break;var o={data:t[s],key:s};e.push(o),this.count++}if(this.options.sortFunction){e.sort(function(t,e){return n.options.sortFunction(t.key.toLowerCase(),e.key.toLowerCase(),i.toLowerCase())})}for(var a=0;a<e.length;a++){var r=e[a],l=h("<li></li>");r.data?l.append('<img src="'+r.data+'" class="right circle"><span>'+r.key+"</span>"):l.append("<span>"+r.key+"</span>"),h(this.container).append(l),this._highlight(i,l)}}},{key:"open",value:function(){var t=this.el.value.toLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this.isOpen=!0,this._renderDropdown(this.options.data,t)),this.dropdown.isOpen?this.dropdown.recalculateDimensions():this.dropdown.open()}},{key:"close",value:function(){this.dropdown.close()}},{key:"updateData",value:function(t){var e=this.el.value.toLowerCase();this.options.data=t,this.isOpen&&this._renderDropdown(t,e)}}],[{key:"init",value:function(t,e){return _get(s.__proto__||Object.getPrototypeOf(s),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Autocomplete}},{key:"defaults",get:function(){return e}}]),s}();t._keydown=!1,M.Autocomplete=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"autocomplete","M_Autocomplete")}(cash),function(d){M.updateTextFields=function(){d("input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea").each(function(t,e){var i=d(this);0<t.value.length||d(t).is(":focus")||t.autofocus||null!==i.attr("placeholder")?i.siblings("label").addClass("active"):t.validity?i.siblings("label").toggleClass("active",!0===t.validity.badInput):i.siblings("label").removeClass("active")})},M.validate_field=function(t){var e=null!==t.attr("data-length"),i=parseInt(t.attr("data-length")),n=t[0].value.length;0!==n||!1!==t[0].validity.badInput||t.is(":required")?t.hasClass("validate")&&(t.is(":valid")&&e&&n<=i||t.is(":valid")&&!e?(t.removeClass("invalid"),t.addClass("valid")):(t.removeClass("valid"),t.addClass("invalid"))):t.hasClass("validate")&&(t.removeClass("valid"),t.removeClass("invalid"))},M.textareaAutoResize=function(t){if(t instanceof Element&&(t=d(t)),t.length){var e=d(".hiddendiv").first();e.length||(e=d('<div class="hiddendiv common"></div>'),d("body").append(e));var i=t.css("font-family"),n=t.css("font-size"),s=t.css("line-height"),o=t.css("padding-top"),a=t.css("padding-right"),r=t.css("padding-bottom"),l=t.css("padding-left");n&&e.css("font-size",n),i&&e.css("font-family",i),s&&e.css("line-height",s),o&&e.css("padding-top",o),a&&e.css("padding-right",a),r&&e.css("padding-bottom",r),l&&e.css("padding-left",l),t.data("original-height")||t.data("original-height",t.height()),"off"===t.attr("wrap")&&e.css("overflow-wrap","normal").css("white-space","pre"),e.text(t[0].value+"\n");var h=e.html().replace(/\n/g,"<br>");e.html(h),0<t[0].offsetWidth&&0<t[0].offsetHeight?e.css("width",t.width()+"px"):e.css("width",window.innerWidth/2+"px"),t.data("original-height")<=e.innerHeight()?t.css("height",e.innerHeight()+"px"):t[0].value.length<t.data("previous-length")&&t.css("height",t.data("original-height")+"px"),t.data("previous-length",t[0].value.length)}else console.error("No textarea element found")},d(document).ready(function(){var n="input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea";d(document).on("change",n,function(){0===this.value.length&&null===d(this).attr("placeholder")||d(this).siblings("label").addClass("active"),M.validate_field(d(this))}),d(document).ready(function(){M.updateTextFields()}),d(document).on("reset",function(t){var e=d(t.target);e.is("form")&&(e.find(n).removeClass("valid").removeClass("invalid"),e.find(n).each(function(t){this.value.length&&d(this).siblings("label").removeClass("active")}),setTimeout(function(){e.find("select").each(function(){this.M_FormSelect&&d(this).trigger("change")})},0))}),document.addEventListener("focus",function(t){d(t.target).is(n)&&d(t.target).siblings("label, .prefix").addClass("active")},!0),document.addEventListener("blur",function(t){var e=d(t.target);if(e.is(n)){var i=".prefix";0===e[0].value.length&&!0!==e[0].validity.badInput&&null===e.attr("placeholder")&&(i+=", label"),e.siblings(i).removeClass("active"),M.validate_field(e)}},!0);d(document).on("keyup","input[type=radio], input[type=checkbox]",function(t){if(t.which===M.keys.TAB)return d(this).addClass("tabbed"),void d(this).one("blur",function(t){d(this).removeClass("tabbed")})});var t=".materialize-textarea";d(t).each(function(){var t=d(this);t.data("original-height",t.height()),t.data("previous-length",this.value.length),M.textareaAutoResize(t)}),d(document).on("keyup",t,function(){M.textareaAutoResize(d(this))}),d(document).on("keydown",t,function(){M.textareaAutoResize(d(this))}),d(document).on("change",'.file-field input[type="file"]',function(){for(var t=d(this).closest(".file-field").find("input.file-path"),e=d(this)[0].files,i=[],n=0;n<e.length;n++)i.push(e[n].name);t[0].value=i.join(", "),t.trigger("change")})})}(cash),function(s,o){"use strict";var e={indicators:!0,height:400,duration:500,interval:6e3},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Slider=i).options=s.extend({},n.defaults,e),i.$slider=i.$el.find(".slides"),i.$slides=i.$slider.children("li"),i.activeIndex=i.$slides.filter(function(t){return s(t).hasClass("active")}).first().index(),-1!=i.activeIndex&&(i.$active=i.$slides.eq(i.activeIndex)),i._setSliderHeight(),i.$slides.find(".caption").each(function(t){i._animateCaptionIn(t,0)}),i.$slides.find("img").each(function(t){var e="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";s(t).attr("src")!==e&&(s(t).css("background-image",'url("'+s(t).attr("src")+'")'),s(t).attr("src",e))}),i._setupIndicators(),i.$active?i.$active.css("display","block"):(i.$slides.first().addClass("active"),o({targets:i.$slides.first()[0],opacity:1,duration:i.options.duration,easing:"easeOutQuad"}),i.activeIndex=0,i.$active=i.$slides.eq(i.activeIndex),i.options.indicators&&i.$indicators.eq(i.activeIndex).addClass("active")),i.$active.find("img").each(function(t){o({targets:i.$active.find(".caption")[0],opacity:1,translateX:0,translateY:0,duration:i.options.duration,easing:"easeOutQuad"})}),i._setupEventHandlers(),i.start(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this.pause(),this._removeIndicators(),this._removeEventHandlers(),this.el.M_Slider=void 0}},{key:"_setupEventHandlers",value:function(){var e=this;this._handleIntervalBound=this._handleInterval.bind(this),this._handleIndicatorClickBound=this._handleIndicatorClick.bind(this),this.options.indicators&&this.$indicators.each(function(t){t.addEventListener("click",e._handleIndicatorClickBound)})}},{key:"_removeEventHandlers",value:function(){var e=this;this.options.indicators&&this.$indicators.each(function(t){t.removeEventListener("click",e._handleIndicatorClickBound)})}},{key:"_handleIndicatorClick",value:function(t){var e=s(t.target).index();this.set(e)}},{key:"_handleInterval",value:function(){var t=this.$slider.find(".active").index();this.$slides.length===t+1?t=0:t+=1,this.set(t)}},{key:"_animateCaptionIn",value:function(t,e){var i={targets:t,opacity:0,duration:e,easing:"easeOutQuad"};s(t).hasClass("center-align")?i.translateY=-100:s(t).hasClass("right-align")?i.translateX=100:s(t).hasClass("left-align")&&(i.translateX=-100),o(i)}},{key:"_setSliderHeight",value:function(){this.$el.hasClass("fullscreen")||(this.options.indicators?this.$el.css("height",this.options.height+40+"px"):this.$el.css("height",this.options.height+"px"),this.$slider.css("height",this.options.height+"px"))}},{key:"_setupIndicators",value:function(){var n=this;this.options.indicators&&(this.$indicators=s('<ul class="indicators"></ul>'),this.$slides.each(function(t,e){var i=s('<li class="indicator-item"></li>');n.$indicators.append(i[0])}),this.$el.append(this.$indicators[0]),this.$indicators=this.$indicators.children("li.indicator-item"))}},{key:"_removeIndicators",value:function(){this.$el.find("ul.indicators").remove()}},{key:"set",value:function(t){var e=this;if(t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.activeIndex!=t){this.$active=this.$slides.eq(this.activeIndex);var i=this.$active.find(".caption");this.$active.removeClass("active"),o({targets:this.$active[0],opacity:0,duration:this.options.duration,easing:"easeOutQuad",complete:function(){e.$slides.not(".active").each(function(t){o({targets:t,opacity:0,translateX:0,translateY:0,duration:0,easing:"easeOutQuad"})})}}),this._animateCaptionIn(i[0],this.options.duration),this.options.indicators&&(this.$indicators.eq(this.activeIndex).removeClass("active"),this.$indicators.eq(t).addClass("active")),o({targets:this.$slides.eq(t)[0],opacity:1,duration:this.options.duration,easing:"easeOutQuad"}),o({targets:this.$slides.eq(t).find(".caption")[0],opacity:1,translateX:0,translateY:0,duration:this.options.duration,delay:this.options.duration,easing:"easeOutQuad"}),this.$slides.eq(t).addClass("active"),this.activeIndex=t,this.start()}}},{key:"pause",value:function(){clearInterval(this.interval)}},{key:"start",value:function(){clearInterval(this.interval),this.interval=setInterval(this._handleIntervalBound,this.options.duration+this.options.interval)}},{key:"next",value:function(){var t=this.activeIndex+1;t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.set(t)}},{key:"prev",value:function(){var t=this.activeIndex-1;t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.set(t)}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Slider}},{key:"defaults",get:function(){return e}}]),n}();M.Slider=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"slider","M_Slider")}(cash,M.anime),function(n,s){n(document).on("click",".card",function(t){if(n(this).children(".card-reveal").length){var i=n(t.target).closest(".card");void 0===i.data("initialOverflow")&&i.data("initialOverflow",void 0===i.css("overflow")?"":i.css("overflow"));var e=n(this).find(".card-reveal");n(t.target).is(n(".card-reveal .card-title"))||n(t.target).is(n(".card-reveal .card-title i"))?s({targets:e[0],translateY:0,duration:225,easing:"easeInOutQuad",complete:function(t){var e=t.animatables[0].target;n(e).css({display:"none"}),i.css("overflow",i.data("initialOverflow"))}}):(n(t.target).is(n(".card .activator"))||n(t.target).is(n(".card .activator i")))&&(i.css("overflow","hidden"),e.css({display:"block"}),s({targets:e[0],translateY:"-100%",duration:300,easing:"easeInOutQuad"}))}})}(cash,M.anime),function(h){"use strict";var e={data:[],placeholder:"",secondaryPlaceholder:"",autocompleteOptions:{},limit:1/0,onChipAdd:null,onChipSelect:null,onChipDelete:null},t=function(t){function l(t,e){_classCallCheck(this,l);var i=_possibleConstructorReturn(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,l,t,e));return(i.el.M_Chips=i).options=h.extend({},l.defaults,e),i.$el.addClass("chips input-field"),i.chipsData=[],i.$chips=h(),i._setupInput(),i.hasAutocomplete=0<Object.keys(i.options.autocompleteOptions).length,i.$input.attr("id")||i.$input.attr("id",M.guid()),i.options.data.length&&(i.chipsData=i.options.data,i._renderChips(i.chipsData)),i.hasAutocomplete&&i._setupAutocomplete(),i._setPlaceholder(),i._setupLabel(),i._setupEventHandlers(),i}return _inherits(l,Component),_createClass(l,[{key:"getData",value:function(){return this.chipsData}},{key:"destroy",value:function(){this._removeEventHandlers(),this.$chips.remove(),this.el.M_Chips=void 0}},{key:"_setupEventHandlers",value:function(){this._handleChipClickBound=this._handleChipClick.bind(this),this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputFocusBound=this._handleInputFocus.bind(this),this._handleInputBlurBound=this._handleInputBlur.bind(this),this.el.addEventListener("click",this._handleChipClickBound),document.addEventListener("keydown",l._handleChipsKeydown),document.addEventListener("keyup",l._handleChipsKeyup),this.el.addEventListener("blur",l._handleChipsBlur,!0),this.$input[0].addEventListener("focus",this._handleInputFocusBound),this.$input[0].addEventListener("blur",this._handleInputBlurBound),this.$input[0].addEventListener("keydown",this._handleInputKeydownBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleChipClickBound),document.removeEventListener("keydown",l._handleChipsKeydown),document.removeEventListener("keyup",l._handleChipsKeyup),this.el.removeEventListener("blur",l._handleChipsBlur,!0),this.$input[0].removeEventListener("focus",this._handleInputFocusBound),this.$input[0].removeEventListener("blur",this._handleInputBlurBound),this.$input[0].removeEventListener("keydown",this._handleInputKeydownBound)}},{key:"_handleChipClick",value:function(t){var e=h(t.target).closest(".chip"),i=h(t.target).is(".close");if(e.length){var n=e.index();i?(this.deleteChip(n),this.$input[0].focus()):this.selectChip(n)}else this.$input[0].focus()}},{key:"_handleInputFocus",value:function(){this.$el.addClass("focus")}},{key:"_handleInputBlur",value:function(){this.$el.removeClass("focus")}},{key:"_handleInputKeydown",value:function(t){if(l._keydown=!0,13===t.keyCode){if(this.hasAutocomplete&&this.autocomplete&&this.autocomplete.isOpen)return;t.preventDefault(),this.addChip({tag:this.$input[0].value}),this.$input[0].value=""}else 8!==t.keyCode&&37!==t.keyCode||""!==this.$input[0].value||!this.chipsData.length||(t.preventDefault(),this.selectChip(this.chipsData.length-1))}},{key:"_renderChip",value:function(t){if(t.tag){var e=document.createElement("div"),i=document.createElement("i");if(e.classList.add("chip"),e.textContent=t.tag,e.setAttribute("tabindex",0),h(i).addClass("material-icons close"),i.textContent="close",t.image){var n=document.createElement("img");n.setAttribute("src",t.image),e.insertBefore(n,e.firstChild)}return e.appendChild(i),e}}},{key:"_renderChips",value:function(){this.$chips.remove();for(var t=0;t<this.chipsData.length;t++){var e=this._renderChip(this.chipsData[t]);this.$el.append(e),this.$chips.add(e)}this.$el.append(this.$input[0])}},{key:"_setupAutocomplete",value:function(){var e=this;this.options.autocompleteOptions.onAutocomplete=function(t){e.addChip({tag:t}),e.$input[0].value="",e.$input[0].focus()},this.autocomplete=M.Autocomplete.init(this.$input[0],this.options.autocompleteOptions)}},{key:"_setupInput",value:function(){this.$input=this.$el.find("input"),this.$input.length||(this.$input=h("<input></input>"),this.$el.append(this.$input)),this.$input.addClass("input")}},{key:"_setupLabel",value:function(){this.$label=this.$el.find("label"),this.$label.length&&this.$label.setAttribute("for",this.$input.attr("id"))}},{key:"_setPlaceholder",value:function(){void 0!==this.chipsData&&!this.chipsData.length&&this.options.placeholder?h(this.$input).prop("placeholder",this.options.placeholder):(void 0===this.chipsData||this.chipsData.length)&&this.options.secondaryPlaceholder&&h(this.$input).prop("placeholder",this.options.secondaryPlaceholder)}},{key:"_isValid",value:function(t){if(t.hasOwnProperty("tag")&&""!==t.tag){for(var e=!1,i=0;i<this.chipsData.length;i++)if(this.chipsData[i].tag===t.tag){e=!0;break}return!e}return!1}},{key:"addChip",value:function(t){if(this._isValid(t)&&!(this.chipsData.length>=this.options.limit)){var e=this._renderChip(t);this.$chips.add(e),this.chipsData.push(t),h(this.$input).before(e),this._setPlaceholder(),"function"==typeof this.options.onChipAdd&&this.options.onChipAdd.call(this,this.$el,e)}}},{key:"deleteChip",value:function(t){var e=this.$chips.eq(t);this.$chips.eq(t).remove(),this.$chips=this.$chips.filter(function(t){return 0<=h(t).index()}),this.chipsData.splice(t,1),this._setPlaceholder(),"function"==typeof this.options.onChipDelete&&this.options.onChipDelete.call(this,this.$el,e[0])}},{key:"selectChip",value:function(t){var e=this.$chips.eq(t);(this._selectedChip=e)[0].focus(),"function"==typeof this.options.onChipSelect&&this.options.onChipSelect.call(this,this.$el,e[0])}}],[{key:"init",value:function(t,e){return _get(l.__proto__||Object.getPrototypeOf(l),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Chips}},{key:"_handleChipsKeydown",value:function(t){l._keydown=!0;var e=h(t.target).closest(".chips"),i=t.target&&e.length;if(!h(t.target).is("input, textarea")&&i){var n=e[0].M_Chips;if(8===t.keyCode||46===t.keyCode){t.preventDefault();var s=n.chipsData.length;if(n._selectedChip){var o=n._selectedChip.index();n.deleteChip(o),n._selectedChip=null,s=Math.max(o-1,0)}n.chipsData.length&&n.selectChip(s)}else if(37===t.keyCode){if(n._selectedChip){var a=n._selectedChip.index()-1;if(a<0)return;n.selectChip(a)}}else if(39===t.keyCode&&n._selectedChip){var r=n._selectedChip.index()+1;r>=n.chipsData.length?n.$input[0].focus():n.selectChip(r)}}}},{key:"_handleChipsKeyup",value:function(t){l._keydown=!1}},{key:"_handleChipsBlur",value:function(t){l._keydown||(h(t.target).closest(".chips")[0].M_Chips._selectedChip=null)}},{key:"defaults",get:function(){return e}}]),l}();t._keydown=!1,M.Chips=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"chips","M_Chips"),h(document).ready(function(){h(document.body).on("click",".chip .close",function(){var t=h(this).closest(".chips");t.length&&t[0].M_Chips||h(this).closest(".chip").remove()})})}(cash),function(s){"use strict";var e={top:0,bottom:1/0,offset:0,onPositionChange:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Pushpin=i).options=s.extend({},n.defaults,e),i.originalOffset=i.el.offsetTop,n._pushpins.push(i),i._setupEventHandlers(),i._updatePosition(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this.el.style.top=null,this._removePinClasses(),this._removeEventHandlers();var t=n._pushpins.indexOf(this);n._pushpins.splice(t,1)}},{key:"_setupEventHandlers",value:function(){document.addEventListener("scroll",n._updateElements)}},{key:"_removeEventHandlers",value:function(){document.removeEventListener("scroll",n._updateElements)}},{key:"_updatePosition",value:function(){var t=M.getDocumentScrollTop()+this.options.offset;this.options.top<=t&&this.options.bottom>=t&&!this.el.classList.contains("pinned")&&(this._removePinClasses(),this.el.style.top=this.options.offset+"px",this.el.classList.add("pinned"),"function"==typeof this.options.onPositionChange&&this.options.onPositionChange.call(this,"pinned")),t<this.options.top&&!this.el.classList.contains("pin-top")&&(this._removePinClasses(),this.el.style.top=0,this.el.classList.add("pin-top"),"function"==typeof this.options.onPositionChange&&this.options.onPositionChange.call(this,"pin-top")),t>this.options.bottom&&!this.el.classList.contains("pin-bottom")&&(this._removePinClasses(),this.el.classList.add("pin-bottom"),this.el.style.top=this.options.bottom-this.originalOffset+"px","function"==typeof this.options.onPositionChange&&this.options.onPositionChange.call(this,"pin-bottom"))}},{key:"_removePinClasses",value:function(){this.el.classList.remove("pin-top"),this.el.classList.remove("pinned"),this.el.classList.remove("pin-bottom")}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Pushpin}},{key:"_updateElements",value:function(){for(var t in n._pushpins){n._pushpins[t]._updatePosition()}}},{key:"defaults",get:function(){return e}}]),n}();t._pushpins=[],M.Pushpin=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"pushpin","M_Pushpin")}(cash),function(r,s){"use strict";var e={direction:"top",hoverEnabled:!0,toolbarEnabled:!1};r.fn.reverse=[].reverse;var t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_FloatingActionButton=i).options=r.extend({},n.defaults,e),i.isOpen=!1,i.$anchor=i.$el.children("a").first(),i.$menu=i.$el.children("ul").first(),i.$floatingBtns=i.$el.find("ul .btn-floating"),i.$floatingBtnsReverse=i.$el.find("ul .btn-floating").reverse(),i.offsetY=0,i.offsetX=0,i.$el.addClass("direction-"+i.options.direction),"top"===i.options.direction?i.offsetY=40:"right"===i.options.direction?i.offsetX=-40:"bottom"===i.options.direction?i.offsetY=-40:i.offsetX=40,i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_FloatingActionButton=void 0}},{key:"_setupEventHandlers",value:function(){this._handleFABClickBound=this._handleFABClick.bind(this),this._handleOpenBound=this.open.bind(this),this._handleCloseBound=this.close.bind(this),this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.addEventListener("mouseenter",this._handleOpenBound),this.el.addEventListener("mouseleave",this._handleCloseBound)):this.el.addEventListener("click",this._handleFABClickBound)}},{key:"_removeEventHandlers",value:function(){this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.removeEventListener("mouseenter",this._handleOpenBound),this.el.removeEventListener("mouseleave",this._handleCloseBound)):this.el.removeEventListener("click",this._handleFABClickBound)}},{key:"_handleFABClick",value:function(){this.isOpen?this.close():this.open()}},{key:"_handleDocumentClick",value:function(t){r(t.target).closest(this.$menu).length||this.close()}},{key:"open",value:function(){this.isOpen||(this.options.toolbarEnabled?this._animateInToolbar():this._animateInFAB(),this.isOpen=!0)}},{key:"close",value:function(){this.isOpen&&(this.options.toolbarEnabled?(window.removeEventListener("scroll",this._handleCloseBound,!0),document.body.removeEventListener("click",this._handleDocumentClickBound,!0),this._animateOutToolbar()):this._animateOutFAB(),this.isOpen=!1)}},{key:"_animateInFAB",value:function(){var e=this;this.$el.addClass("active");var i=0;this.$floatingBtnsReverse.each(function(t){s({targets:t,opacity:1,scale:[.4,1],translateY:[e.offsetY,0],translateX:[e.offsetX,0],duration:275,delay:i,easing:"easeInOutQuad"}),i+=40})}},{key:"_animateOutFAB",value:function(){var e=this;this.$floatingBtnsReverse.each(function(t){s.remove(t),s({targets:t,opacity:0,scale:.4,translateY:e.offsetY,translateX:e.offsetX,duration:175,easing:"easeOutQuad",complete:function(){e.$el.removeClass("active")}})})}},{key:"_animateInToolbar",value:function(){var t,e=this,i=window.innerWidth,n=window.innerHeight,s=this.el.getBoundingClientRect(),o=r('<div class="fab-backdrop"></div>'),a=this.$anchor.css("background-color");this.$anchor.append(o),this.offsetX=s.left-i/2+s.width/2,this.offsetY=n-s.bottom,t=i/o[0].clientWidth,this.btnBottom=s.bottom,this.btnLeft=s.left,this.btnWidth=s.width,this.$el.addClass("active"),this.$el.css({"text-align":"center",width:"100%",bottom:0,left:0,transform:"translateX("+this.offsetX+"px)",transition:"none"}),this.$anchor.css({transform:"translateY("+-this.offsetY+"px)",transition:"none"}),o.css({"background-color":a}),setTimeout(function(){e.$el.css({transform:"",transition:"transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s"}),e.$anchor.css({overflow:"visible",transform:"",transition:"transform .2s"}),setTimeout(function(){e.$el.css({overflow:"hidden","background-color":a}),o.css({transform:"scale("+t+")",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"}),e.$menu.children("li").children("a").css({opacity:1}),e._handleDocumentClickBound=e._handleDocumentClick.bind(e),window.addEventListener("scroll",e._handleCloseBound,!0),document.body.addEventListener("click",e._handleDocumentClickBound,!0)},100)},0)}},{key:"_animateOutToolbar",value:function(){var t=this,e=window.innerWidth,i=window.innerHeight,n=this.$el.find(".fab-backdrop"),s=this.$anchor.css("background-color");this.offsetX=this.btnLeft-e/2+this.btnWidth/2,this.offsetY=i-this.btnBottom,this.$el.removeClass("active"),this.$el.css({"background-color":"transparent",transition:"none"}),this.$anchor.css({transition:"none"}),n.css({transform:"scale(0)","background-color":s}),this.$menu.children("li").children("a").css({opacity:""}),setTimeout(function(){n.remove(),t.$el.css({"text-align":"",width:"",bottom:"",left:"",overflow:"","background-color":"",transform:"translate3d("+-t.offsetX+"px,0,0)"}),t.$anchor.css({overflow:"",transform:"translate3d(0,"+t.offsetY+"px,0)"}),setTimeout(function(){t.$el.css({transform:"translate3d(0,0,0)",transition:"transform .2s"}),t.$anchor.css({transform:"translate3d(0,0,0)",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"})},20)},200)}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_FloatingActionButton}},{key:"defaults",get:function(){return e}}]),n}();M.FloatingActionButton=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"floatingActionButton","M_FloatingActionButton")}(cash,M.anime),function(g){"use strict";var e={autoClose:!1,format:"mmm dd, yyyy",parse:null,defaultDate:null,setDefaultDate:!1,disableWeekends:!1,disableDayFn:null,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,container:null,showClearBtn:!1,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",previousMonth:"‹",nextMonth:"›",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysAbbrev:["S","M","T","W","T","F","S"]},events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null},t=function(t){function B(t,e){_classCallCheck(this,B);var i=_possibleConstructorReturn(this,(B.__proto__||Object.getPrototypeOf(B)).call(this,B,t,e));(i.el.M_Datepicker=i).options=g.extend({},B.defaults,e),e&&e.hasOwnProperty("i18n")&&"object"==typeof e.i18n&&(i.options.i18n=g.extend({},B.defaults.i18n,e.i18n)),i.options.minDate&&i.options.minDate.setHours(0,0,0,0),i.options.maxDate&&i.options.maxDate.setHours(0,0,0,0),i.id=M.guid(),i._setupVariables(),i._insertHTMLIntoDOM(),i._setupModal(),i._setupEventHandlers(),i.options.defaultDate||(i.options.defaultDate=new Date(Date.parse(i.el.value)));var n=i.options.defaultDate;return B._isDate(n)?i.options.setDefaultDate?(i.setDate(n,!0),i.setInputValue()):i.gotoDate(n):i.gotoDate(new Date),i.isOpen=!1,i}return _inherits(B,Component),_createClass(B,[{key:"destroy",value:function(){this._removeEventHandlers(),this.modal.destroy(),g(this.modalEl).remove(),this.destroySelects(),this.el.M_Datepicker=void 0}},{key:"destroySelects",value:function(){var t=this.calendarEl.querySelector(".orig-select-year");t&&M.FormSelect.getInstance(t).destroy();var e=this.calendarEl.querySelector(".orig-select-month");e&&M.FormSelect.getInstance(e).destroy()}},{key:"_insertHTMLIntoDOM",value:function(){this.options.showClearBtn&&(g(this.clearBtn).css({visibility:""}),this.clearBtn.innerHTML=this.options.i18n.clear),this.doneBtn.innerHTML=this.options.i18n.done,this.cancelBtn.innerHTML=this.options.i18n.cancel,this.options.container?this.$modalEl.appendTo(this.options.container):this.$modalEl.insertBefore(this.el)}},{key:"_setupModal",value:function(){var t=this;this.modalEl.id="modal-"+this.id,this.modal=M.Modal.init(this.modalEl,{onCloseEnd:function(){t.isOpen=!1}})}},{key:"toString",value:function(t){var e=this;return t=t||this.options.format,B._isDate(this.date)?t.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g).map(function(t){return e.formats[t]?e.formats[t]():t}).join(""):""}},{key:"setDate",value:function(t,e){if(!t)return this.date=null,this._renderDateDisplay(),this.draw();if("string"==typeof t&&(t=new Date(Date.parse(t))),B._isDate(t)){var i=this.options.minDate,n=this.options.maxDate;B._isDate(i)&&t<i?t=i:B._isDate(n)&&n<t&&(t=n),this.date=new Date(t.getTime()),this._renderDateDisplay(),B._setToStartOfDay(this.date),this.gotoDate(this.date),e||"function"!=typeof this.options.onSelect||this.options.onSelect.call(this,this.date)}}},{key:"setInputValue",value:function(){this.el.value=this.toString(),this.$el.trigger("change",{firedBy:this})}},{key:"_renderDateDisplay",value:function(){var t=B._isDate(this.date)?this.date:new Date,e=this.options.i18n,i=e.weekdaysShort[t.getDay()],n=e.monthsShort[t.getMonth()],s=t.getDate();this.yearTextEl.innerHTML=t.getFullYear(),this.dateTextEl.innerHTML=i+", "+n+" "+s}},{key:"gotoDate",value:function(t){var e=!0;if(B._isDate(t)){if(this.calendars){var i=new Date(this.calendars[0].year,this.calendars[0].month,1),n=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),s=t.getTime();n.setMonth(n.getMonth()+1),n.setDate(n.getDate()-1),e=s<i.getTime()||n.getTime()<s}e&&(this.calendars=[{month:t.getMonth(),year:t.getFullYear()}]),this.adjustCalendars()}}},{key:"adjustCalendars",value:function(){this.calendars[0]=this.adjustCalendar(this.calendars[0]),this.draw()}},{key:"adjustCalendar",value:function(t){return t.month<0&&(t.year-=Math.ceil(Math.abs(t.month)/12),t.month+=12),11<t.month&&(t.year+=Math.floor(Math.abs(t.month)/12),t.month-=12),t}},{key:"nextMonth",value:function(){this.calendars[0].month++,this.adjustCalendars()}},{key:"prevMonth",value:function(){this.calendars[0].month--,this.adjustCalendars()}},{key:"render",value:function(t,e,i){var n=this.options,s=new Date,o=B._getDaysInMonth(t,e),a=new Date(t,e,1).getDay(),r=[],l=[];B._setToStartOfDay(s),0<n.firstDay&&(a-=n.firstDay)<0&&(a+=7);for(var h=0===e?11:e-1,d=11===e?0:e+1,u=0===e?t-1:t,c=11===e?t+1:t,p=B._getDaysInMonth(u,h),v=o+a,f=v;7<f;)f-=7;v+=7-f;for(var m=!1,g=0,_=0;g<v;g++){var y=new Date(t,e,g-a+1),k=!!B._isDate(this.date)&&B._compareDates(y,this.date),b=B._compareDates(y,s),w=-1!==n.events.indexOf(y.toDateString()),C=g<a||o+a<=g,E=g-a+1,M=e,O=t,x=n.startRange&&B._compareDates(n.startRange,y),L=n.endRange&&B._compareDates(n.endRange,y),T=n.startRange&&n.endRange&&n.startRange<y&&y<n.endRange;C&&(g<a?(E=p+E,M=h,O=u):(E-=o,M=d,O=c));var $={day:E,month:M,year:O,hasEvent:w,isSelected:k,isToday:b,isDisabled:n.minDate&&y<n.minDate||n.maxDate&&y>n.maxDate||n.disableWeekends&&B._isWeekend(y)||n.disableDayFn&&n.disableDayFn(y),isEmpty:C,isStartRange:x,isEndRange:L,isInRange:T,showDaysInNextAndPreviousMonths:n.showDaysInNextAndPreviousMonths};l.push(this.renderDay($)),7==++_&&(r.push(this.renderRow(l,n.isRTL,m)),_=0,m=!(l=[]))}return this.renderTable(n,r,i)}},{key:"renderDay",value:function(t){var e=[],i="false";if(t.isEmpty){if(!t.showDaysInNextAndPreviousMonths)return'<td class="is-empty"></td>';e.push("is-outside-current-month"),e.push("is-selection-disabled")}return t.isDisabled&&e.push("is-disabled"),t.isToday&&e.push("is-today"),t.isSelected&&(e.push("is-selected"),i="true"),t.hasEvent&&e.push("has-event"),t.isInRange&&e.push("is-inrange"),t.isStartRange&&e.push("is-startrange"),t.isEndRange&&e.push("is-endrange"),'<td data-day="'+t.day+'" class="'+e.join(" ")+'" aria-selected="'+i+'"><button class="datepicker-day-button" type="button" data-year="'+t.year+'" data-month="'+t.month+'" data-day="'+t.day+'">'+t.day+"</button></td>"}},{key:"renderRow",value:function(t,e,i){return'<tr class="datepicker-row'+(i?" is-selected":"")+'">'+(e?t.reverse():t).join("")+"</tr>"}},{key:"renderTable",value:function(t,e,i){return'<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="'+i+'">'+this.renderHead(t)+this.renderBody(e)+"</table></div>"}},{key:"renderHead",value:function(t){var e=void 0,i=[];for(e=0;e<7;e++)i.push('<th scope="col"><abbr title="'+this.renderDayName(t,e)+'">'+this.renderDayName(t,e,!0)+"</abbr></th>");return"<thead><tr>"+(t.isRTL?i.reverse():i).join("")+"</tr></thead>"}},{key:"renderBody",value:function(t){return"<tbody>"+t.join("")+"</tbody>"}},{key:"renderTitle",value:function(t,e,i,n,s,o){var a,r,l=void 0,h=void 0,d=void 0,u=this.options,c=i===u.minYear,p=i===u.maxYear,v='<div id="'+o+'" class="datepicker-controls" role="heading" aria-live="assertive">',f=!0,m=!0;for(d=[],l=0;l<12;l++)d.push('<option value="'+(i===s?l-e:12+l-e)+'"'+(l===n?' selected="selected"':"")+(c&&l<u.minMonth||p&&l>u.maxMonth?'disabled="disabled"':"")+">"+u.i18n.months[l]+"</option>");for(a='<select class="datepicker-select orig-select-month" tabindex="-1">'+d.join("")+"</select>",g.isArray(u.yearRange)?(l=u.yearRange[0],h=u.yearRange[1]+1):(l=i-u.yearRange,h=1+i+u.yearRange),d=[];l<h&&l<=u.maxYear;l++)l>=u.minYear&&d.push('<option value="'+l+'" '+(l===i?'selected="selected"':"")+">"+l+"</option>");r='<select class="datepicker-select orig-select-year" tabindex="-1">'+d.join("")+"</select>";v+='<button class="month-prev'+(f?"":" is-disabled")+'" type="button"><svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>',v+='<div class="selects-container">',u.showMonthAfterYear?v+=r+a:v+=a+r,v+="</div>",c&&(0===n||u.minMonth>=n)&&(f=!1),p&&(11===n||u.maxMonth<=n)&&(m=!1);return(v+='<button class="month-next'+(m?"":" is-disabled")+'" type="button"><svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>')+"</div>"}},{key:"draw",value:function(t){if(this.isOpen||t){var e,i=this.options,n=i.minYear,s=i.maxYear,o=i.minMonth,a=i.maxMonth,r="";this._y<=n&&(this._y=n,!isNaN(o)&&this._m<o&&(this._m=o)),this._y>=s&&(this._y=s,!isNaN(a)&&this._m>a&&(this._m=a)),e="datepicker-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var l=0;l<1;l++)this._renderDateDisplay(),r+=this.renderTitle(this,l,this.calendars[l].year,this.calendars[l].month,this.calendars[0].year,e)+this.render(this.calendars[l].year,this.calendars[l].month,e);this.destroySelects(),this.calendarEl.innerHTML=r;var h=this.calendarEl.querySelector(".orig-select-year"),d=this.calendarEl.querySelector(".orig-select-month");M.FormSelect.init(h,{classes:"select-year",dropdownOptions:{container:document.body,constrainWidth:!1}}),M.FormSelect.init(d,{classes:"select-month",dropdownOptions:{container:document.body,constrainWidth:!1}}),h.addEventListener("change",this._handleYearChange.bind(this)),d.addEventListener("change",this._handleMonthChange.bind(this)),"function"==typeof this.options.onDraw&&this.options.onDraw(this)}}},{key:"_setupEventHandlers",value:function(){this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),this._handleInputChangeBound=this._handleInputChange.bind(this),this._handleCalendarClickBound=this._handleCalendarClick.bind(this),this._finishSelectionBound=this._finishSelection.bind(this),this._handleMonthChange=this._handleMonthChange.bind(this),this._closeBound=this.close.bind(this),this.el.addEventListener("click",this._handleInputClickBound),this.el.addEventListener("keydown",this._handleInputKeydownBound),this.el.addEventListener("change",this._handleInputChangeBound),this.calendarEl.addEventListener("click",this._handleCalendarClickBound),this.doneBtn.addEventListener("click",this._finishSelectionBound),this.cancelBtn.addEventListener("click",this._closeBound),this.options.showClearBtn&&(this._handleClearClickBound=this._handleClearClick.bind(this),this.clearBtn.addEventListener("click",this._handleClearClickBound))}},{key:"_setupVariables",value:function(){var e=this;this.$modalEl=g(B._template),this.modalEl=this.$modalEl[0],this.calendarEl=this.modalEl.querySelector(".datepicker-calendar"),this.yearTextEl=this.modalEl.querySelector(".year-text"),this.dateTextEl=this.modalEl.querySelector(".date-text"),this.options.showClearBtn&&(this.clearBtn=this.modalEl.querySelector(".datepicker-clear")),this.doneBtn=this.modalEl.querySelector(".datepicker-done"),this.cancelBtn=this.modalEl.querySelector(".datepicker-cancel"),this.formats={d:function(){return e.date.getDate()},dd:function(){var t=e.date.getDate();return(t<10?"0":"")+t},ddd:function(){return e.options.i18n.weekdaysShort[e.date.getDay()]},dddd:function(){return e.options.i18n.weekdays[e.date.getDay()]},m:function(){return e.date.getMonth()+1},mm:function(){var t=e.date.getMonth()+1;return(t<10?"0":"")+t},mmm:function(){return e.options.i18n.monthsShort[e.date.getMonth()]},mmmm:function(){return e.options.i18n.months[e.date.getMonth()]},yy:function(){return(""+e.date.getFullYear()).slice(2)},yyyy:function(){return e.date.getFullYear()}}}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleInputClickBound),this.el.removeEventListener("keydown",this._handleInputKeydownBound),this.el.removeEventListener("change",this._handleInputChangeBound),this.calendarEl.removeEventListener("click",this._handleCalendarClickBound)}},{key:"_handleInputClick",value:function(){this.open()}},{key:"_handleInputKeydown",value:function(t){t.which===M.keys.ENTER&&(t.preventDefault(),this.open())}},{key:"_handleCalendarClick",value:function(t){if(this.isOpen){var e=g(t.target);e.hasClass("is-disabled")||(!e.hasClass("datepicker-day-button")||e.hasClass("is-empty")||e.parent().hasClass("is-disabled")?e.closest(".month-prev").length?this.prevMonth():e.closest(".month-next").length&&this.nextMonth():(this.setDate(new Date(t.target.getAttribute("data-year"),t.target.getAttribute("data-month"),t.target.getAttribute("data-day"))),this.options.autoClose&&this._finishSelection()))}}},{key:"_handleClearClick",value:function(){this.date=null,this.setInputValue(),this.close()}},{key:"_handleMonthChange",value:function(t){this.gotoMonth(t.target.value)}},{key:"_handleYearChange",value:function(t){this.gotoYear(t.target.value)}},{key:"gotoMonth",value:function(t){isNaN(t)||(this.calendars[0].month=parseInt(t,10),this.adjustCalendars())}},{key:"gotoYear",value:function(t){isNaN(t)||(this.calendars[0].year=parseInt(t,10),this.adjustCalendars())}},{key:"_handleInputChange",value:function(t){var e=void 0;t.firedBy!==this&&(e=this.options.parse?this.options.parse(this.el.value,this.options.format):new Date(Date.parse(this.el.value)),B._isDate(e)&&this.setDate(e))}},{key:"renderDayName",value:function(t,e,i){for(e+=t.firstDay;7<=e;)e-=7;return i?t.i18n.weekdaysAbbrev[e]:t.i18n.weekdays[e]}},{key:"_finishSelection",value:function(){this.setInputValue(),this.close()}},{key:"open",value:function(){if(!this.isOpen)return this.isOpen=!0,"function"==typeof this.options.onOpen&&this.options.onOpen.call(this),this.draw(),this.modal.open(),this}},{key:"close",value:function(){if(this.isOpen)return this.isOpen=!1,"function"==typeof this.options.onClose&&this.options.onClose.call(this),this.modal.close(),this}}],[{key:"init",value:function(t,e){return _get(B.__proto__||Object.getPrototypeOf(B),"init",this).call(this,this,t,e)}},{key:"_isDate",value:function(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())}},{key:"_isWeekend",value:function(t){var e=t.getDay();return 0===e||6===e}},{key:"_setToStartOfDay",value:function(t){B._isDate(t)&&t.setHours(0,0,0,0)}},{key:"_getDaysInMonth",value:function(t,e){return[31,B._isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}},{key:"_isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"_compareDates",value:function(t,e){return t.getTime()===e.getTime()}},{key:"_setToStartOfDay",value:function(t){B._isDate(t)&&t.setHours(0,0,0,0)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Datepicker}},{key:"defaults",get:function(){return e}}]),B}();t._template=['<div class= "modal datepicker-modal">','<div class="modal-content datepicker-container">','<div class="datepicker-date-display">','<span class="year-text"></span>','<span class="date-text"></span>',"</div>",'<div class="datepicker-calendar-container">','<div class="datepicker-calendar"></div>','<div class="datepicker-footer">','<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>','<div class="confirmation-btns">','<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>','<button class="btn-flat datepicker-done waves-effect" type="button"></button>',"</div>","</div>","</div>","</div>","</div>"].join(""),M.Datepicker=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"datepicker","M_Datepicker")}(cash),function(h){"use strict";var e={dialRadius:135,outerRadius:105,innerRadius:70,tickRadius:20,duration:350,container:null,defaultTime:"now",fromNow:0,showClearBtn:!1,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok"},autoClose:!1,twelveHour:!0,vibrate:!0,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onSelect:null},t=function(t){function f(t,e){_classCallCheck(this,f);var i=_possibleConstructorReturn(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,f,t,e));return(i.el.M_Timepicker=i).options=h.extend({},f.defaults,e),i.id=M.guid(),i._insertHTMLIntoDOM(),i._setupModal(),i._setupVariables(),i._setupEventHandlers(),i._clockSetup(),i._pickerSetup(),i}return _inherits(f,Component),_createClass(f,[{key:"destroy",value:function(){this._removeEventHandlers(),this.modal.destroy(),h(this.modalEl).remove(),this.el.M_Timepicker=void 0}},{key:"_setupEventHandlers",value:function(){this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),this._handleClockClickStartBound=this._handleClockClickStart.bind(this),this._handleDocumentClickMoveBound=this._handleDocumentClickMove.bind(this),this._handleDocumentClickEndBound=this._handleDocumentClickEnd.bind(this),this.el.addEventListener("click",this._handleInputClickBound),this.el.addEventListener("keydown",this._handleInputKeydownBound),this.plate.addEventListener("mousedown",this._handleClockClickStartBound),this.plate.addEventListener("touchstart",this._handleClockClickStartBound),h(this.spanHours).on("click",this.showView.bind(this,"hours")),h(this.spanMinutes).on("click",this.showView.bind(this,"minutes"))}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleInputClickBound),this.el.removeEventListener("keydown",this._handleInputKeydownBound)}},{key:"_handleInputClick",value:function(){this.open()}},{key:"_handleInputKeydown",value:function(t){t.which===M.keys.ENTER&&(t.preventDefault(),this.open())}},{key:"_handleClockClickStart",value:function(t){t.preventDefault();var e=this.plate.getBoundingClientRect(),i=e.left,n=e.top;this.x0=i+this.options.dialRadius,this.y0=n+this.options.dialRadius,this.moved=!1;var s=f._Pos(t);this.dx=s.x-this.x0,this.dy=s.y-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("mousemove",this._handleDocumentClickMoveBound),document.addEventListener("touchmove",this._handleDocumentClickMoveBound),document.addEventListener("mouseup",this._handleDocumentClickEndBound),document.addEventListener("touchend",this._handleDocumentClickEndBound)}},{key:"_handleDocumentClickMove",value:function(t){t.preventDefault();var e=f._Pos(t),i=e.x-this.x0,n=e.y-this.y0;this.moved=!0,this.setHand(i,n,!1,!0)}},{key:"_handleDocumentClickEnd",value:function(t){var e=this;t.preventDefault(),document.removeEventListener("mouseup",this._handleDocumentClickEndBound),document.removeEventListener("touchend",this._handleDocumentClickEndBound);var i=f._Pos(t),n=i.x-this.x0,s=i.y-this.y0;this.moved&&n===this.dx&&s===this.dy&&this.setHand(n,s),"hours"===this.currentView?this.showView("minutes",this.options.duration/2):this.options.autoClose&&(h(this.minutesView).addClass("timepicker-dial-out"),setTimeout(function(){e.done()},this.options.duration/2)),"function"==typeof this.options.onSelect&&this.options.onSelect.call(this,this.hours,this.minutes),document.removeEventListener("mousemove",this._handleDocumentClickMoveBound),document.removeEventListener("touchmove",this._handleDocumentClickMoveBound)}},{key:"_insertHTMLIntoDOM",value:function(){this.$modalEl=h(f._template),this.modalEl=this.$modalEl[0],this.modalEl.id="modal-"+this.id;var t=document.querySelector(this.options.container);this.options.container&&t?this.$modalEl.appendTo(t):this.$modalEl.insertBefore(this.el)}},{key:"_setupModal",value:function(){var t=this;this.modal=M.Modal.init(this.modalEl,{onOpenStart:this.options.onOpenStart,onOpenEnd:this.options.onOpenEnd,onCloseStart:this.options.onCloseStart,onCloseEnd:function(){"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t),t.isOpen=!1}})}},{key:"_setupVariables",value:function(){this.currentView="hours",this.vibrate=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,this._canvas=this.modalEl.querySelector(".timepicker-canvas"),this.plate=this.modalEl.querySelector(".timepicker-plate"),this.hoursView=this.modalEl.querySelector(".timepicker-hours"),this.minutesView=this.modalEl.querySelector(".timepicker-minutes"),this.spanHours=this.modalEl.querySelector(".timepicker-span-hours"),this.spanMinutes=this.modalEl.querySelector(".timepicker-span-minutes"),this.spanAmPm=this.modalEl.querySelector(".timepicker-span-am-pm"),this.footer=this.modalEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}},{key:"_pickerSetup",value:function(){var t=h('<button class="btn-flat timepicker-clear waves-effect" style="visibility: hidden;" type="button" tabindex="'+(this.options.twelveHour?"3":"1")+'">'+this.options.i18n.clear+"</button>").appendTo(this.footer).on("click",this.clear.bind(this));this.options.showClearBtn&&t.css({visibility:""});var e=h('<div class="confirmation-btns"></div>');h('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="'+(this.options.twelveHour?"3":"1")+'">'+this.options.i18n.cancel+"</button>").appendTo(e).on("click",this.close.bind(this)),h('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="'+(this.options.twelveHour?"3":"1")+'">'+this.options.i18n.done+"</button>").appendTo(e).on("click",this.done.bind(this)),e.appendTo(this.footer)}},{key:"_clockSetup",value:function(){this.options.twelveHour&&(this.$amBtn=h('<div class="am-btn">AM</div>'),this.$pmBtn=h('<div class="pm-btn">PM</div>'),this.$amBtn.on("click",this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm),this.$pmBtn.on("click",this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm)),this._buildHoursView(),this._buildMinutesView(),this._buildSVGClock()}},{key:"_buildSVGClock",value:function(){var t=this.options.dialRadius,e=this.options.tickRadius,i=2*t,n=f._createSVGEl("svg");n.setAttribute("class","timepicker-svg"),n.setAttribute("width",i),n.setAttribute("height",i);var s=f._createSVGEl("g");s.setAttribute("transform","translate("+t+","+t+")");var o=f._createSVGEl("circle");o.setAttribute("class","timepicker-canvas-bearing"),o.setAttribute("cx",0),o.setAttribute("cy",0),o.setAttribute("r",4);var a=f._createSVGEl("line");a.setAttribute("x1",0),a.setAttribute("y1",0);var r=f._createSVGEl("circle");r.setAttribute("class","timepicker-canvas-bg"),r.setAttribute("r",e),s.appendChild(a),s.appendChild(r),s.appendChild(o),n.appendChild(s),this._canvas.appendChild(n),this.hand=a,this.bg=r,this.bearing=o,this.g=s}},{key:"_buildHoursView",value:function(){var t=h('<div class="timepicker-tick"></div>');if(this.options.twelveHour)for(var e=1;e<13;e+=1){var i=t.clone(),n=e/6*Math.PI,s=this.options.outerRadius;i.css({left:this.options.dialRadius+Math.sin(n)*s-this.options.tickRadius+"px",top:this.options.dialRadius-Math.cos(n)*s-this.options.tickRadius+"px"}),i.html(0===e?"00":e),this.hoursView.appendChild(i[0])}else for(var o=0;o<24;o+=1){var a=t.clone(),r=o/6*Math.PI,l=0<o&&o<13?this.options.innerRadius:this.options.outerRadius;a.css({left:this.options.dialRadius+Math.sin(r)*l-this.options.tickRadius+"px",top:this.options.dialRadius-Math.cos(r)*l-this.options.tickRadius+"px"}),a.html(0===o?"00":o),this.hoursView.appendChild(a[0])}}},{key:"_buildMinutesView",value:function(){for(var t=h('<div class="timepicker-tick"></div>'),e=0;e<60;e+=5){var i=t.clone(),n=e/30*Math.PI;i.css({left:this.options.dialRadius+Math.sin(n)*this.options.outerRadius-this.options.tickRadius+"px",top:this.options.dialRadius-Math.cos(n)*this.options.outerRadius-this.options.tickRadius+"px"}),i.html(f._addLeadingZero(e)),this.minutesView.appendChild(i[0])}}},{key:"_handleAmPmClick",value:function(t){var e=h(t.target);this.amOrPm=e.hasClass("am-btn")?"AM":"PM",this._updateAmPmView()}},{key:"_updateAmPmView",value:function(){this.options.twelveHour&&(this.$amBtn.toggleClass("text-primary","AM"===this.amOrPm),this.$pmBtn.toggleClass("text-primary","PM"===this.amOrPm))}},{key:"_updateTimeFromInput",value:function(){var t=((this.el.value||this.options.defaultTime||"")+"").split(":");if(this.options.twelveHour&&void 0!==t[1]&&(0<t[1].toUpperCase().indexOf("AM")?this.amOrPm="AM":this.amOrPm="PM",t[1]=t[1].replace("AM","").replace("PM","")),"now"===t[0]){var e=new Date(+new Date+this.options.fromNow);t=[e.getHours(),e.getMinutes()],this.options.twelveHour&&(this.amOrPm=12<=t[0]&&t[0]<24?"PM":"AM")}this.hours=+t[0]||0,this.minutes=+t[1]||0,this.spanHours.innerHTML=this.hours,this.spanMinutes.innerHTML=f._addLeadingZero(this.minutes),this._updateAmPmView()}},{key:"showView",value:function(t,e){"minutes"===t&&h(this.hoursView).css("visibility");var i="hours"===t,n=i?this.hoursView:this.minutesView,s=i?this.minutesView:this.hoursView;this.currentView=t,h(this.spanHours).toggleClass("text-primary",i),h(this.spanMinutes).toggleClass("text-primary",!i),s.classList.add("timepicker-dial-out"),h(n).css("visibility","visible").removeClass("timepicker-dial-out"),this.resetClock(e),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(function(){h(s).css("visibility","hidden")},this.options.duration)}},{key:"resetClock",value:function(t){var e=this.currentView,i=this[e],n="hours"===e,s=i*(Math.PI/(n?6:30)),o=n&&0<i&&i<13?this.options.innerRadius:this.options.outerRadius,a=Math.sin(s)*o,r=-Math.cos(s)*o,l=this;t?(h(this.canvas).addClass("timepicker-canvas-out"),setTimeout(function(){h(l.canvas).removeClass("timepicker-canvas-out"),l.setHand(a,r)},t)):this.setHand(a,r)}},{key:"setHand",value:function(t,e,i){var n=this,s=Math.atan2(t,-e),o="hours"===this.currentView,a=Math.PI/(o||i?6:30),r=Math.sqrt(t*t+e*e),l=o&&r<(this.options.outerRadius+this.options.innerRadius)/2,h=l?this.options.innerRadius:this.options.outerRadius;this.options.twelveHour&&(h=this.options.outerRadius),s<0&&(s=2*Math.PI+s);var d=Math.round(s/a);s=d*a,this.options.twelveHour?o?0===d&&(d=12):(i&&(d*=5),60===d&&(d=0)):o?(12===d&&(d=0),d=l?0===d?12:d:0===d?0:d+12):(i&&(d*=5),60===d&&(d=0)),this[this.currentView]!==d&&this.vibrate&&this.options.vibrate&&(this.vibrateTimer||(navigator[this.vibrate](10),this.vibrateTimer=setTimeout(function(){n.vibrateTimer=null},100))),this[this.currentView]=d,o?this.spanHours.innerHTML=d:this.spanMinutes.innerHTML=f._addLeadingZero(d);var u=Math.sin(s)*(h-this.options.tickRadius),c=-Math.cos(s)*(h-this.options.tickRadius),p=Math.sin(s)*h,v=-Math.cos(s)*h;this.hand.setAttribute("x2",u),this.hand.setAttribute("y2",c),this.bg.setAttribute("cx",p),this.bg.setAttribute("cy",v)}},{key:"open",value:function(){this.isOpen||(this.isOpen=!0,this._updateTimeFromInput(),this.showView("hours"),this.modal.open())}},{key:"close",value:function(){this.isOpen&&(this.isOpen=!1,this.modal.close())}},{key:"done",value:function(t,e){var i=this.el.value,n=e?"":f._addLeadingZero(this.hours)+":"+f._addLeadingZero(this.minutes);this.time=n,!e&&this.options.twelveHour&&(n=n+" "+this.amOrPm),(this.el.value=n)!==i&&this.$el.trigger("change"),this.close(),this.el.focus()}},{key:"clear",value:function(){this.done(null,!0)}}],[{key:"init",value:function(t,e){return _get(f.__proto__||Object.getPrototypeOf(f),"init",this).call(this,this,t,e)}},{key:"_addLeadingZero",value:function(t){return(t<10?"0":"")+t}},{key:"_createSVGEl",value:function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}},{key:"_Pos",value:function(t){return t.targetTouches&&1<=t.targetTouches.length?{x:t.targetTouches[0].clientX,y:t.targetTouches[0].clientY}:{x:t.clientX,y:t.clientY}}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Timepicker}},{key:"defaults",get:function(){return e}}]),f}();t._template=['<div class= "modal timepicker-modal">','<div class="modal-content timepicker-container">','<div class="timepicker-digital-display">','<div class="timepicker-text-container">','<div class="timepicker-display-column">','<span class="timepicker-span-hours text-primary"></span>',":",'<span class="timepicker-span-minutes"></span>',"</div>",'<div class="timepicker-display-column timepicker-display-am-pm">','<div class="timepicker-span-am-pm"></div>',"</div>","</div>","</div>",'<div class="timepicker-analog-display">','<div class="timepicker-plate">','<div class="timepicker-canvas"></div>','<div class="timepicker-dial timepicker-hours"></div>','<div class="timepicker-dial timepicker-minutes timepicker-dial-out"></div>',"</div>",'<div class="timepicker-footer"></div>',"</div>","</div>","</div>"].join(""),M.Timepicker=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"timepicker","M_Timepicker")}(cash),function(s){"use strict";var e={},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_CharacterCounter=i).options=s.extend({},n.defaults,e),i.isInvalid=!1,i.isValidLength=!1,i._setupCounter(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.CharacterCounter=void 0,this._removeCounter()}},{key:"_setupEventHandlers",value:function(){this._handleUpdateCounterBound=this.updateCounter.bind(this),this.el.addEventListener("focus",this._handleUpdateCounterBound,!0),this.el.addEventListener("input",this._handleUpdateCounterBound,!0)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("focus",this._handleUpdateCounterBound,!0),this.el.removeEventListener("input",this._handleUpdateCounterBound,!0)}},{key:"_setupCounter",value:function(){this.counterEl=document.createElement("span"),s(this.counterEl).addClass("character-counter").css({float:"right","font-size":"12px",height:1}),this.$el.parent().append(this.counterEl)}},{key:"_removeCounter",value:function(){s(this.counterEl).remove()}},{key:"updateCounter",value:function(){var t=+this.$el.attr("data-length"),e=this.el.value.length;this.isValidLength=e<=t;var i=e;t&&(i+="/"+t,this._validateInput()),s(this.counterEl).html(i)}},{key:"_validateInput",value:function(){this.isValidLength&&this.isInvalid?(this.isInvalid=!1,this.$el.removeClass("invalid")):this.isValidLength||this.isInvalid||(this.isInvalid=!0,this.$el.removeClass("valid"),this.$el.addClass("invalid"))}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_CharacterCounter}},{key:"defaults",get:function(){return e}}]),n}();M.CharacterCounter=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"characterCounter","M_CharacterCounter")}(cash),function(b){"use strict";var e={duration:200,dist:-100,shift:0,padding:0,numVisible:5,fullWidth:!1,indicators:!1,noWrap:!1,onCycleTo:null},t=function(t){function i(t,e){_classCallCheck(this,i);var n=_possibleConstructorReturn(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,i,t,e));return(n.el.M_Carousel=n).options=b.extend({},i.defaults,e),n.hasMultipleSlides=1<n.$el.find(".carousel-item").length,n.showIndicators=n.options.indicators&&n.hasMultipleSlides,n.noWrap=n.options.noWrap||!n.hasMultipleSlides,n.pressed=!1,n.dragged=!1,n.offset=n.target=0,n.images=[],n.itemWidth=n.$el.find(".carousel-item").first().innerWidth(),n.itemHeight=n.$el.find(".carousel-item").first().innerHeight(),n.dim=2*n.itemWidth+n.options.padding||1,n._autoScrollBound=n._autoScroll.bind(n),n._trackBound=n._track.bind(n),n.options.fullWidth&&(n.options.dist=0,n._setCarouselHeight(),n.showIndicators&&n.$el.find(".carousel-fixed-item").addClass("with-indicators")),n.$indicators=b('<ul class="indicators"></ul>'),n.$el.find(".carousel-item").each(function(t,e){if(n.images.push(t),n.showIndicators){var i=b('<li class="indicator-item"></li>');0===e&&i[0].classList.add("active"),n.$indicators.append(i)}}),n.showIndicators&&n.$el.append(n.$indicators),n.count=n.images.length,n.options.numVisible=Math.min(n.count,n.options.numVisible),n.xform="transform",["webkit","Moz","O","ms"].every(function(t){var e=t+"Transform";return void 0===document.body.style[e]||(n.xform=e,!1)}),n._setupEventHandlers(),n._scroll(n.offset),n}return _inherits(i,Component),_createClass(i,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Carousel=void 0}},{key:"_setupEventHandlers",value:function(){var i=this;this._handleCarouselTapBound=this._handleCarouselTap.bind(this),this._handleCarouselDragBound=this._handleCarouselDrag.bind(this),this._handleCarouselReleaseBound=this._handleCarouselRelease.bind(this),this._handleCarouselClickBound=this._handleCarouselClick.bind(this),void 0!==window.ontouchstart&&(this.el.addEventListener("touchstart",this._handleCarouselTapBound),this.el.addEventListener("touchmove",this._handleCarouselDragBound),this.el.addEventListener("touchend",this._handleCarouselReleaseBound)),this.el.addEventListener("mousedown",this._handleCarouselTapBound),this.el.addEventListener("mousemove",this._handleCarouselDragBound),this.el.addEventListener("mouseup",this._handleCarouselReleaseBound),this.el.addEventListener("mouseleave",this._handleCarouselReleaseBound),this.el.addEventListener("click",this._handleCarouselClickBound),this.showIndicators&&this.$indicators&&(this._handleIndicatorClickBound=this._handleIndicatorClick.bind(this),this.$indicators.find(".indicator-item").each(function(t,e){t.addEventListener("click",i._handleIndicatorClickBound)}));var t=M.throttle(this._handleResize,200);this._handleThrottledResizeBound=t.bind(this),window.addEventListener("resize",this._handleThrottledResizeBound)}},{key:"_removeEventHandlers",value:function(){var i=this;void 0!==window.ontouchstart&&(this.el.removeEventListener("touchstart",this._handleCarouselTapBound),this.el.removeEventListener("touchmove",this._handleCarouselDragBound),this.el.removeEventListener("touchend",this._handleCarouselReleaseBound)),this.el.removeEventListener("mousedown",this._handleCarouselTapBound),this.el.removeEventListener("mousemove",this._handleCarouselDragBound),this.el.removeEventListener("mouseup",this._handleCarouselReleaseBound),this.el.removeEventListener("mouseleave",this._handleCarouselReleaseBound),this.el.removeEventListener("click",this._handleCarouselClickBound),this.showIndicators&&this.$indicators&&this.$indicators.find(".indicator-item").each(function(t,e){t.removeEventListener("click",i._handleIndicatorClickBound)}),window.removeEventListener("resize",this._handleThrottledResizeBound)}},{key:"_handleCarouselTap",value:function(t){"mousedown"===t.type&&b(t.target).is("img")&&t.preventDefault(),this.pressed=!0,this.dragged=!1,this.verticalDragged=!1,this.reference=this._xpos(t),this.referenceY=this._ypos(t),this.velocity=this.amplitude=0,this.frame=this.offset,this.timestamp=Date.now(),clearInterval(this.ticker),this.ticker=setInterval(this._trackBound,100)}},{key:"_handleCarouselDrag",value:function(t){var e=void 0,i=void 0,n=void 0;if(this.pressed)if(e=this._xpos(t),i=this._ypos(t),n=this.reference-e,Math.abs(this.referenceY-i)<30&&!this.verticalDragged)(2<n||n<-2)&&(this.dragged=!0,this.reference=e,this._scroll(this.offset+n));else{if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1;this.verticalDragged=!0}if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1}},{key:"_handleCarouselRelease",value:function(t){if(this.pressed)return this.pressed=!1,clearInterval(this.ticker),this.target=this.offset,(10<this.velocity||this.velocity<-10)&&(this.amplitude=.9*this.velocity,this.target=this.offset+this.amplitude),this.target=Math.round(this.target/this.dim)*this.dim,this.noWrap&&(this.target>=this.dim*(this.count-1)?this.target=this.dim*(this.count-1):this.target<0&&(this.target=0)),this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScrollBound),this.dragged&&(t.preventDefault(),t.stopPropagation()),!1}},{key:"_handleCarouselClick",value:function(t){if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1;if(!this.options.fullWidth){var e=b(t.target).closest(".carousel-item").index();0!==this._wrap(this.center)-e&&(t.preventDefault(),t.stopPropagation()),this._cycleTo(e)}}},{key:"_handleIndicatorClick",value:function(t){t.stopPropagation();var e=b(t.target).closest(".indicator-item");e.length&&this._cycleTo(e.index())}},{key:"_handleResize",value:function(t){this.options.fullWidth?(this.itemWidth=this.$el.find(".carousel-item").first().innerWidth(),this.imageHeight=this.$el.find(".carousel-item.active").height(),this.dim=2*this.itemWidth+this.options.padding,this.offset=2*this.center*this.itemWidth,this.target=this.offset,this._setCarouselHeight(!0)):this._scroll()}},{key:"_setCarouselHeight",value:function(t){var i=this,e=this.$el.find(".carousel-item.active").length?this.$el.find(".carousel-item.active").first():this.$el.find(".carousel-item").first(),n=e.find("img").first();if(n.length)if(n[0].complete){var s=n.height();if(0<s)this.$el.css("height",s+"px");else{var o=n[0].naturalWidth,a=n[0].naturalHeight,r=this.$el.width()/o*a;this.$el.css("height",r+"px")}}else n.one("load",function(t,e){i.$el.css("height",t.offsetHeight+"px")});else if(!t){var l=e.height();this.$el.css("height",l+"px")}}},{key:"_xpos",value:function(t){return t.targetTouches&&1<=t.targetTouches.length?t.targetTouches[0].clientX:t.clientX}},{key:"_ypos",value:function(t){return t.targetTouches&&1<=t.targetTouches.length?t.targetTouches[0].clientY:t.clientY}},{key:"_wrap",value:function(t){return t>=this.count?t%this.count:t<0?this._wrap(this.count+t%this.count):t}},{key:"_track",value:function(){var t,e,i,n;e=(t=Date.now())-this.timestamp,this.timestamp=t,i=this.offset-this.frame,this.frame=this.offset,n=1e3*i/(1+e),this.velocity=.8*n+.2*this.velocity}},{key:"_autoScroll",value:function(){var t=void 0,e=void 0;this.amplitude&&(t=Date.now()-this.timestamp,2<(e=this.amplitude*Math.exp(-t/this.options.duration))||e<-2?(this._scroll(this.target-e),requestAnimationFrame(this._autoScrollBound)):this._scroll(this.target))}},{key:"_scroll",value:function(t){var e=this;this.$el.hasClass("scrolling")||this.el.classList.add("scrolling"),null!=this.scrollingTimeout&&window.clearTimeout(this.scrollingTimeout),this.scrollingTimeout=window.setTimeout(function(){e.$el.removeClass("scrolling")},this.options.duration);var i,n,s,o,a=void 0,r=void 0,l=void 0,h=void 0,d=void 0,u=void 0,c=this.center,p=1/this.options.numVisible;if(this.offset="number"==typeof t?t:this.offset,this.center=Math.floor((this.offset+this.dim/2)/this.dim),o=-(s=(n=this.offset-this.center*this.dim)<0?1:-1)*n*2/this.dim,i=this.count>>1,this.options.fullWidth?(l="translateX(0)",u=1):(l="translateX("+(this.el.clientWidth-this.itemWidth)/2+"px) ",l+="translateY("+(this.el.clientHeight-this.itemHeight)/2+"px)",u=1-p*o),this.showIndicators){var v=this.center%this.count,f=this.$indicators.find(".indicator-item.active");f.index()!==v&&(f.removeClass("active"),this.$indicators.find(".indicator-item").eq(v)[0].classList.add("active"))}if(!this.noWrap||0<=this.center&&this.center<this.count){r=this.images[this._wrap(this.center)],b(r).hasClass("active")||(this.$el.find(".carousel-item").removeClass("active"),r.classList.add("active"));var m=l+" translateX("+-n/2+"px) translateX("+s*this.options.shift*o*a+"px) translateZ("+this.options.dist*o+"px)";this._updateItemStyle(r,u,0,m)}for(a=1;a<=i;++a){if(this.options.fullWidth?(h=this.options.dist,d=a===i&&n<0?1-o:1):(h=this.options.dist*(2*a+o*s),d=1-p*(2*a+o*s)),!this.noWrap||this.center+a<this.count){r=this.images[this._wrap(this.center+a)];var g=l+" translateX("+(this.options.shift+(this.dim*a-n)/2)+"px) translateZ("+h+"px)";this._updateItemStyle(r,d,-a,g)}if(this.options.fullWidth?(h=this.options.dist,d=a===i&&0<n?1-o:1):(h=this.options.dist*(2*a-o*s),d=1-p*(2*a-o*s)),!this.noWrap||0<=this.center-a){r=this.images[this._wrap(this.center-a)];var _=l+" translateX("+(-this.options.shift+(-this.dim*a-n)/2)+"px) translateZ("+h+"px)";this._updateItemStyle(r,d,-a,_)}}if(!this.noWrap||0<=this.center&&this.center<this.count){r=this.images[this._wrap(this.center)];var y=l+" translateX("+-n/2+"px) translateX("+s*this.options.shift*o+"px) translateZ("+this.options.dist*o+"px)";this._updateItemStyle(r,u,0,y)}var k=this.$el.find(".carousel-item").eq(this._wrap(this.center));c!==this.center&&"function"==typeof this.options.onCycleTo&&this.options.onCycleTo.call(this,k[0],this.dragged),"function"==typeof this.oneTimeCallback&&(this.oneTimeCallback.call(this,k[0],this.dragged),this.oneTimeCallback=null)}},{key:"_updateItemStyle",value:function(t,e,i,n){t.style[this.xform]=n,t.style.zIndex=i,t.style.opacity=e,t.style.visibility="visible"}},{key:"_cycleTo",value:function(t,e){var i=this.center%this.count-t;this.noWrap||(i<0?Math.abs(i+this.count)<Math.abs(i)&&(i+=this.count):0<i&&Math.abs(i-this.count)<i&&(i-=this.count)),this.target=this.dim*Math.round(this.offset/this.dim),i<0?this.target+=this.dim*Math.abs(i):0<i&&(this.target-=this.dim*i),"function"==typeof e&&(this.oneTimeCallback=e),this.offset!==this.target&&(this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScrollBound))}},{key:"next",value:function(t){(void 0===t||isNaN(t))&&(t=1);var e=this.center+t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}},{key:"prev",value:function(t){(void 0===t||isNaN(t))&&(t=1);var e=this.center-t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}},{key:"set",value:function(t,e){if((void 0===t||isNaN(t))&&(t=0),t>this.count||t<0){if(this.noWrap)return;t=this._wrap(t)}this._cycleTo(t,e)}}],[{key:"init",value:function(t,e){return _get(i.__proto__||Object.getPrototypeOf(i),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Carousel}},{key:"defaults",get:function(){return e}}]),i}();M.Carousel=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"carousel","M_Carousel")}(cash),function(S){"use strict";var e={onOpen:void 0,onClose:void 0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_TapTarget=i).options=S.extend({},n.defaults,e),i.isOpen=!1,i.$origin=S("#"+i.$el.attr("data-target")),i._setup(),i._calculatePositioning(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.TapTarget=void 0}},{key:"_setupEventHandlers",value:function(){this._handleDocumentClickBound=this._handleDocumentClick.bind(this),this._handleTargetClickBound=this._handleTargetClick.bind(this),this._handleOriginClickBound=this._handleOriginClick.bind(this),this.el.addEventListener("click",this._handleTargetClickBound),this.originEl.addEventListener("click",this._handleOriginClickBound);var t=M.throttle(this._handleResize,200);this._handleThrottledResizeBound=t.bind(this),window.addEventListener("resize",this._handleThrottledResizeBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleTargetClickBound),this.originEl.removeEventListener("click",this._handleOriginClickBound),window.removeEventListener("resize",this._handleThrottledResizeBound)}},{key:"_handleTargetClick",value:function(t){this.open()}},{key:"_handleOriginClick",value:function(t){this.close()}},{key:"_handleResize",value:function(t){this._calculatePositioning()}},{key:"_handleDocumentClick",value:function(t){S(t.target).closest(".tap-target-wrapper").length||(this.close(),t.preventDefault(),t.stopPropagation())}},{key:"_setup",value:function(){this.wrapper=this.$el.parent()[0],this.waveEl=S(this.wrapper).find(".tap-target-wave")[0],this.originEl=S(this.wrapper).find(".tap-target-origin")[0],this.contentEl=this.$el.find(".tap-target-content")[0],S(this.wrapper).hasClass(".tap-target-wrapper")||(this.wrapper=document.createElement("div"),this.wrapper.classList.add("tap-target-wrapper"),this.$el.before(S(this.wrapper)),this.wrapper.append(this.el)),this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.classList.add("tap-target-content"),this.$el.append(this.contentEl)),this.waveEl||(this.waveEl=document.createElement("div"),this.waveEl.classList.add("tap-target-wave"),this.originEl||(this.originEl=this.$origin.clone(!0,!0),this.originEl.addClass("tap-target-origin"),this.originEl.removeAttr("id"),this.originEl.removeAttr("style"),this.originEl=this.originEl[0],this.waveEl.append(this.originEl)),this.wrapper.append(this.waveEl))}},{key:"_calculatePositioning",value:function(){var t="fixed"===this.$origin.css("position");if(!t)for(var e=this.$origin.parents(),i=0;i<e.length&&!(t="fixed"==S(e[i]).css("position"));i++);var n=this.$origin.outerWidth(),s=this.$origin.outerHeight(),o=t?this.$origin.offset().top-M.getDocumentScrollTop():this.$origin.offset().top,a=t?this.$origin.offset().left-M.getDocumentScrollLeft():this.$origin.offset().left,r=window.innerWidth,l=window.innerHeight,h=r/2,d=l/2,u=a<=h,c=h<a,p=o<=d,v=d<o,f=.25*r<=a&&a<=.75*r,m=this.$el.outerWidth(),g=this.$el.outerHeight(),_=o+s/2-g/2,y=a+n/2-m/2,k=t?"fixed":"absolute",b=f?m:m/2+n,w=g/2,C=p?g/2:0,E=u&&!f?m/2-n:0,O=n,x=v?"bottom":"top",L=2*n,T=L,$=g/2-T/2,B=m/2-L/2,D={};D.top=p?_+"px":"",D.right=c?r-y-m+"px":"",D.bottom=v?l-_-g+"px":"",D.left=u?y+"px":"",D.position=k,S(this.wrapper).css(D),S(this.contentEl).css({width:b+"px",height:w+"px",top:C+"px",right:"0px",bottom:"0px",left:E+"px",padding:O+"px",verticalAlign:x}),S(this.waveEl).css({top:$+"px",left:B+"px",width:L+"px",height:T+"px"})}},{key:"open",value:function(){this.isOpen||("function"==typeof this.options.onOpen&&this.options.onOpen.call(this,this.$origin[0]),this.isOpen=!0,this.wrapper.classList.add("open"),document.body.addEventListener("click",this._handleDocumentClickBound,!0),document.body.addEventListener("touchend",this._handleDocumentClickBound))}},{key:"close",value:function(){this.isOpen&&("function"==typeof this.options.onClose&&this.options.onClose.call(this,this.$origin[0]),this.isOpen=!1,this.wrapper.classList.remove("open"),document.body.removeEventListener("click",this._handleDocumentClickBound,!0),document.body.removeEventListener("touchend",this._handleDocumentClickBound))}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_TapTarget}},{key:"defaults",get:function(){return e}}]),n}();M.TapTarget=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"tapTarget","M_TapTarget")}(cash),function(d){"use strict";var e={classes:"",dropdownOptions:{}},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return i.$el.hasClass("browser-default")?_possibleConstructorReturn(i):((i.el.M_FormSelect=i).options=d.extend({},n.defaults,e),i.isMultiple=i.$el.prop("multiple"),i.el.tabIndex=-1,i._keysSelected={},i._valueDict={},i._setupDropdown(),i._setupEventHandlers(),i)}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._removeDropdown(),this.el.M_FormSelect=void 0}},{key:"_setupEventHandlers",value:function(){var e=this;this._handleSelectChangeBound=this._handleSelectChange.bind(this),this._handleOptionClickBound=this._handleOptionClick.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),d(this.dropdownOptions).find("li:not(.optgroup)").each(function(t){t.addEventListener("click",e._handleOptionClickBound)}),this.el.addEventListener("change",this._handleSelectChangeBound),this.input.addEventListener("click",this._handleInputClickBound)}},{key:"_removeEventHandlers",value:function(){var e=this;d(this.dropdownOptions).find("li:not(.optgroup)").each(function(t){t.removeEventListener("click",e._handleOptionClickBound)}),this.el.removeEventListener("change",this._handleSelectChangeBound),this.input.removeEventListener("click",this._handleInputClickBound)}},{key:"_handleSelectChange",value:function(t){this._setValueToInput()}},{key:"_handleOptionClick",value:function(t){t.preventDefault();var e=d(t.target).closest("li")[0],i=e.id;if(!d(e).hasClass("disabled")&&!d(e).hasClass("optgroup")&&i.length){var n=!0;if(this.isMultiple){var s=d(this.dropdownOptions).find("li.disabled.selected");s.length&&(s.removeClass("selected"),s.find('input[type="checkbox"]').prop("checked",!1),this._toggleEntryFromArray(s[0].id)),n=this._toggleEntryFromArray(i)}else d(this.dropdownOptions).find("li").removeClass("selected"),d(e).toggleClass("selected",n);d(this._valueDict[i].el).prop("selected")!==n&&(d(this._valueDict[i].el).prop("selected",n),this.$el.trigger("change"))}t.stopPropagation()}},{key:"_handleInputClick",value:function(){this.dropdown&&this.dropdown.isOpen&&(this._setValueToInput(),this._setSelectedStates())}},{key:"_setupDropdown",value:function(){var n=this;this.wrapper=document.createElement("div"),d(this.wrapper).addClass("select-wrapper "+this.options.classes),this.$el.before(d(this.wrapper)),this.wrapper.appendChild(this.el),this.el.disabled&&this.wrapper.classList.add("disabled"),this.$selectOptions=this.$el.children("option, optgroup"),this.dropdownOptions=document.createElement("ul"),this.dropdownOptions.id="select-options-"+M.guid(),d(this.dropdownOptions).addClass("dropdown-content select-dropdown "+(this.isMultiple?"multiple-select-dropdown":"")),this.$selectOptions.length&&this.$selectOptions.each(function(t){if(d(t).is("option")){var e=void 0;e=n.isMultiple?n._appendOptionWithIcon(n.$el,t,"multiple"):n._appendOptionWithIcon(n.$el,t),n._addOptionToValueDict(t,e)}else if(d(t).is("optgroup")){var i=d(t).children("option");d(n.dropdownOptions).append(d('<li class="optgroup"><span>'+t.getAttribute("label")+"</span></li>")[0]),i.each(function(t){var e=n._appendOptionWithIcon(n.$el,t,"optgroup-option");n._addOptionToValueDict(t,e)})}}),this.$el.after(this.dropdownOptions),this.input=document.createElement("input"),d(this.input).addClass("select-dropdown dropdown-trigger"),this.input.setAttribute("type","text"),this.input.setAttribute("readonly","true"),this.input.setAttribute("data-target",this.dropdownOptions.id),this.el.disabled&&d(this.input).prop("disabled","true"),this.$el.before(this.input),this._setValueToInput();var t=d('<svg class="caret" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');if(this.$el.before(t[0]),!this.el.disabled){var e=d.extend({},this.options.dropdownOptions);e.onOpenEnd=function(t){var e=d(n.dropdownOptions).find(".selected").first();if(e.length&&(M.keyDown=!0,n.dropdown.focusedIndex=e.index(),n.dropdown._focusFocusedItem(),M.keyDown=!1,n.dropdown.isScrollable)){var i=e[0].getBoundingClientRect().top-n.dropdownOptions.getBoundingClientRect().top;i-=n.dropdownOptions.clientHeight/2,n.dropdownOptions.scrollTop=i}},this.isMultiple&&(e.closeOnClick=!1),this.dropdown=M.Dropdown.init(this.input,e)}this._setSelectedStates()}},{key:"_addOptionToValueDict",value:function(t,e){var i=Object.keys(this._valueDict).length,n=this.dropdownOptions.id+i,s={};e.id=n,s.el=t,s.optionEl=e,this._valueDict[n]=s}},{key:"_removeDropdown",value:function(){d(this.wrapper).find(".caret").remove(),d(this.input).remove(),d(this.dropdownOptions).remove(),d(this.wrapper).before(this.$el),d(this.wrapper).remove()}},{key:"_appendOptionWithIcon",value:function(t,e,i){var n=e.disabled?"disabled ":"",s="optgroup-option"===i?"optgroup-option ":"",o=this.isMultiple?'<label><input type="checkbox"'+n+'"/><span>'+e.innerHTML+"</span></label>":e.innerHTML,a=d("<li></li>"),r=d("<span></span>");r.html(o),a.addClass(n+" "+s),a.append(r);var l=e.getAttribute("data-icon");if(l){var h=d('<img alt="" src="'+l+'">');a.prepend(h)}return d(this.dropdownOptions).append(a[0]),a[0]}},{key:"_toggleEntryFromArray",value:function(t){var e=!this._keysSelected.hasOwnProperty(t),i=d(this._valueDict[t].optionEl);return e?this._keysSelected[t]=!0:delete this._keysSelected[t],i.toggleClass("selected",e),i.find('input[type="checkbox"]').prop("checked",e),i.prop("selected",e),e}},{key:"_setValueToInput",value:function(){var i=[];if(this.$el.find("option").each(function(t){if(d(t).prop("selected")){var e=d(t).text();i.push(e)}}),!i.length){var t=this.$el.find("option:disabled").eq(0);t.length&&""===t[0].value&&i.push(t.text())}this.input.value=i.join(", ")}},{key:"_setSelectedStates",value:function(){for(var t in this._keysSelected={},this._valueDict){var e=this._valueDict[t],i=d(e.el).prop("selected");d(e.optionEl).find('input[type="checkbox"]').prop("checked",i),i?(this._activateOption(d(this.dropdownOptions),d(e.optionEl)),this._keysSelected[t]=!0):d(e.optionEl).removeClass("selected")}}},{key:"_activateOption",value:function(t,e){e&&(this.isMultiple||t.find("li.selected").removeClass("selected"),d(e).addClass("selected"))}},{key:"getSelectedValues",value:function(){var t=[];for(var e in this._keysSelected)t.push(this._valueDict[e].el.value);return t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_FormSelect}},{key:"defaults",get:function(){return e}}]),n}();M.FormSelect=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"formSelect","M_FormSelect")}(cash),function(s,e){"use strict";var i={},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Range=i).options=s.extend({},n.defaults,e),i._mousedown=!1,i._setupThumb(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._removeThumb(),this.el.M_Range=void 0}},{key:"_setupEventHandlers",value:function(){this._handleRangeChangeBound=this._handleRangeChange.bind(this),this._handleRangeMousedownTouchstartBound=this._handleRangeMousedownTouchstart.bind(this),this._handleRangeInputMousemoveTouchmoveBound=this._handleRangeInputMousemoveTouchmove.bind(this),this._handleRangeMouseupTouchendBound=this._handleRangeMouseupTouchend.bind(this),this._handleRangeBlurMouseoutTouchleaveBound=this._handleRangeBlurMouseoutTouchleave.bind(this),this.el.addEventListener("change",this._handleRangeChangeBound),this.el.addEventListener("mousedown",this._handleRangeMousedownTouchstartBound),this.el.addEventListener("touchstart",this._handleRangeMousedownTouchstartBound),this.el.addEventListener("input",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("mousemove",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("touchmove",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("mouseup",this._handleRangeMouseupTouchendBound),this.el.addEventListener("touchend",this._handleRangeMouseupTouchendBound),this.el.addEventListener("blur",this._handleRangeBlurMouseoutTouchleaveBound),this.el.addEventListener("mouseout",this._handleRangeBlurMouseoutTouchleaveBound),this.el.addEventListener("touchleave",this._handleRangeBlurMouseoutTouchleaveBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("change",this._handleRangeChangeBound),this.el.removeEventListener("mousedown",this._handleRangeMousedownTouchstartBound),this.el.removeEventListener("touchstart",this._handleRangeMousedownTouchstartBound),this.el.removeEventListener("input",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("mousemove",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("touchmove",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("mouseup",this._handleRangeMouseupTouchendBound),this.el.removeEventListener("touchend",this._handleRangeMouseupTouchendBound),this.el.removeEventListener("blur",this._handleRangeBlurMouseoutTouchleaveBound),this.el.removeEventListener("mouseout",this._handleRangeBlurMouseoutTouchleaveBound),this.el.removeEventListener("touchleave",this._handleRangeBlurMouseoutTouchleaveBound)}},{key:"_handleRangeChange",value:function(){s(this.value).html(this.$el.val()),s(this.thumb).hasClass("active")||this._showRangeBubble();var t=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",t+"px")}},{key:"_handleRangeMousedownTouchstart",value:function(t){if(s(this.value).html(this.$el.val()),this._mousedown=!0,this.$el.addClass("active"),s(this.thumb).hasClass("active")||this._showRangeBubble(),"input"!==t.type){var e=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",e+"px")}}},{key:"_handleRangeInputMousemoveTouchmove",value:function(){if(this._mousedown){s(this.thumb).hasClass("active")||this._showRangeBubble();var t=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",t+"px"),s(this.value).html(this.$el.val())}}},{key:"_handleRangeMouseupTouchend",value:function(){this._mousedown=!1,this.$el.removeClass("active")}},{key:"_handleRangeBlurMouseoutTouchleave",value:function(){if(!this._mousedown){var t=7+parseInt(this.$el.css("padding-left"))+"px";s(this.thumb).hasClass("active")&&(e.remove(this.thumb),e({targets:this.thumb,height:0,width:0,top:10,easing:"easeOutQuad",marginLeft:t,duration:100})),s(this.thumb).removeClass("active")}}},{key:"_setupThumb",value:function(){this.thumb=document.createElement("span"),this.value=document.createElement("span"),s(this.thumb).addClass("thumb"),s(this.value).addClass("value"),s(this.thumb).append(this.value),this.$el.after(this.thumb)}},{key:"_removeThumb",value:function(){s(this.thumb).remove()}},{key:"_showRangeBubble",value:function(){var t=-7+parseInt(s(this.thumb).parent().css("padding-left"))+"px";e.remove(this.thumb),e({targets:this.thumb,height:30,width:30,top:-30,marginLeft:t,duration:300,easing:"easeOutQuint"})}},{key:"_calcRangeOffset",value:function(){var t=this.$el.width()-15,e=parseFloat(this.$el.attr("max"))||100,i=parseFloat(this.$el.attr("min"))||0;return(parseFloat(this.$el.val())-i)/(e-i)*t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Range}},{key:"defaults",get:function(){return i}}]),n}();M.Range=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"range","M_Range"),t.init(s("input[type=range]"))}(cash,M.anime);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Copyright 2014-2017 Materialize
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
  */
6
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
7
+
8
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9
+
10
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
11
+
12
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
13
+
14
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
+
16
+ /*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */
17
+ (function (factory) {
18
+ window.cash = factory();
19
+ })(function () {
20
+ var doc = document,
21
+ win = window,
22
+ ArrayProto = Array.prototype,
23
+ slice = ArrayProto.slice,
24
+ filter = ArrayProto.filter,
25
+ push = ArrayProto.push;
26
+
27
+ var noop = function () {},
28
+ isFunction = function (item) {
29
+ // @see https://crbug.com/568448
30
+ return typeof item === typeof noop && item.call;
31
+ },
32
+ isString = function (item) {
33
+ return typeof item === typeof "";
34
+ };
35
+
36
+ var idMatch = /^#[\w-]*$/,
37
+ classMatch = /^\.[\w-]*$/,
38
+ htmlMatch = /<.+>/,
39
+ singlet = /^\w+$/;
40
+
41
+ function find(selector, context) {
42
+ context = context || doc;
43
+ var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector);
44
+ return elems;
45
+ }
46
+
47
+ var frag;
48
+ function parseHTML(str) {
49
+ if (!frag) {
50
+ frag = doc.implementation.createHTMLDocument(null);
51
+ var base = frag.createElement("base");
52
+ base.href = doc.location.href;
53
+ frag.head.appendChild(base);
54
+ }
55
+
56
+ frag.body.innerHTML = str;
57
+
58
+ return frag.body.childNodes;
59
+ }
60
+
61
+ function onReady(fn) {
62
+ if (doc.readyState !== "loading") {
63
+ fn();
64
+ } else {
65
+ doc.addEventListener("DOMContentLoaded", fn);
66
+ }
67
+ }
68
+
69
+ function Init(selector, context) {
70
+ if (!selector) {
71
+ return this;
72
+ }
73
+
74
+ // If already a cash collection, don't do any further processing
75
+ if (selector.cash && selector !== win) {
76
+ return selector;
77
+ }
78
+
79
+ var elems = selector,
80
+ i = 0,
81
+ length;
82
+
83
+ if (isString(selector)) {
84
+ elems = idMatch.test(selector) ?
85
+ // If an ID use the faster getElementById check
86
+ doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ?
87
+ // If HTML, parse it into real elements
88
+ parseHTML(selector) :
89
+ // else use `find`
90
+ find(selector, context);
91
+
92
+ // If function, use as shortcut for DOM ready
93
+ } else if (isFunction(selector)) {
94
+ onReady(selector);return this;
95
+ }
96
+
97
+ if (!elems) {
98
+ return this;
99
+ }
100
+
101
+ // If a single DOM element is passed in or received via ID, return the single element
102
+ if (elems.nodeType || elems === win) {
103
+ this[0] = elems;
104
+ this.length = 1;
105
+ } else {
106
+ // Treat like an array and loop through each item.
107
+ length = this.length = elems.length;
108
+ for (; i < length; i++) {
109
+ this[i] = elems[i];
110
+ }
111
+ }
112
+
113
+ return this;
114
+ }
115
+
116
+ function cash(selector, context) {
117
+ return new Init(selector, context);
118
+ }
119
+
120
+ var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line
121
+ cash: true,
122
+ length: 0,
123
+ push: push,
124
+ splice: ArrayProto.splice,
125
+ map: ArrayProto.map,
126
+ init: Init
127
+ };
128
+
129
+ Object.defineProperty(fn, "constructor", { value: cash });
130
+
131
+ cash.parseHTML = parseHTML;
132
+ cash.noop = noop;
133
+ cash.isFunction = isFunction;
134
+ cash.isString = isString;
135
+
136
+ cash.extend = fn.extend = function (target) {
137
+ target = target || {};
138
+
139
+ var args = slice.call(arguments),
140
+ length = args.length,
141
+ i = 1;
142
+
143
+ if (args.length === 1) {
144
+ target = this;
145
+ i = 0;
146
+ }
147
+
148
+ for (; i < length; i++) {
149
+ if (!args[i]) {
150
+ continue;
151
+ }
152
+ for (var key in args[i]) {
153
+ if (args[i].hasOwnProperty(key)) {
154
+ target[key] = args[i][key];
155
+ }
156
+ }
157
+ }
158
+
159
+ return target;
160
+ };
161
+
162
+ function each(collection, callback) {
163
+ var l = collection.length,
164
+ i = 0;
165
+
166
+ for (; i < l; i++) {
167
+ if (callback.call(collection[i], collection[i], i, collection) === false) {
168
+ break;
169
+ }
170
+ }
171
+ }
172
+
173
+ function matches(el, selector) {
174
+ var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector);
175
+ return !!m && m.call(el, selector);
176
+ }
177
+
178
+ function getCompareFunction(selector) {
179
+ return (
180
+ /* Use browser's `matches` function if string */
181
+ isString(selector) ? matches :
182
+ /* Match a cash element */
183
+ selector.cash ? function (el) {
184
+ return selector.is(el);
185
+ } :
186
+ /* Direct comparison */
187
+ function (el, selector) {
188
+ return el === selector;
189
+ }
190
+ );
191
+ }
192
+
193
+ function unique(collection) {
194
+ return cash(slice.call(collection).filter(function (item, index, self) {
195
+ return self.indexOf(item) === index;
196
+ }));
197
+ }
198
+
199
+ cash.extend({
200
+ merge: function (first, second) {
201
+ var len = +second.length,
202
+ i = first.length,
203
+ j = 0;
204
+
205
+ for (; j < len; i++, j++) {
206
+ first[i] = second[j];
207
+ }
208
+
209
+ first.length = i;
210
+ return first;
211
+ },
212
+
213
+ each: each,
214
+ matches: matches,
215
+ unique: unique,
216
+ isArray: Array.isArray,
217
+ isNumeric: function (n) {
218
+ return !isNaN(parseFloat(n)) && isFinite(n);
219
+ }
220
+
221
+ });
222
+
223
+ var uid = cash.uid = "_cash" + Date.now();
224
+
225
+ function getDataCache(node) {
226
+ return node[uid] = node[uid] || {};
227
+ }
228
+
229
+ function setData(node, key, value) {
230
+ return getDataCache(node)[key] = value;
231
+ }
232
+
233
+ function getData(node, key) {
234
+ var c = getDataCache(node);
235
+ if (c[key] === undefined) {
236
+ c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key);
237
+ }
238
+ return c[key];
239
+ }
240
+
241
+ function removeData(node, key) {
242
+ var c = getDataCache(node);
243
+ if (c) {
244
+ delete c[key];
245
+ } else if (node.dataset) {
246
+ delete node.dataset[key];
247
+ } else {
248
+ cash(node).removeAttr("data-" + name);
249
+ }
250
+ }
251
+
252
+ fn.extend({
253
+ data: function (name, value) {
254
+ if (isString(name)) {
255
+ return value === undefined ? getData(this[0], name) : this.each(function (v) {
256
+ return setData(v, name, value);
257
+ });
258
+ }
259
+
260
+ for (var key in name) {
261
+ this.data(key, name[key]);
262
+ }
263
+
264
+ return this;
265
+ },
266
+
267
+ removeData: function (key) {
268
+ return this.each(function (v) {
269
+ return removeData(v, key);
270
+ });
271
+ }
272
+
273
+ });
274
+
275
+ var notWhiteMatch = /\S+/g;
276
+
277
+ function getClasses(c) {
278
+ return isString(c) && c.match(notWhiteMatch);
279
+ }
280
+
281
+ function hasClass(v, c) {
282
+ return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className);
283
+ }
284
+
285
+ function addClass(v, c, spacedName) {
286
+ if (v.classList) {
287
+ v.classList.add(c);
288
+ } else if (spacedName.indexOf(" " + c + " ")) {
289
+ v.className += " " + c;
290
+ }
291
+ }
292
+
293
+ function removeClass(v, c) {
294
+ if (v.classList) {
295
+ v.classList.remove(c);
296
+ } else {
297
+ v.className = v.className.replace(c, "");
298
+ }
299
+ }
300
+
301
+ fn.extend({
302
+ addClass: function (c) {
303
+ var classes = getClasses(c);
304
+
305
+ return classes ? this.each(function (v) {
306
+ var spacedName = " " + v.className + " ";
307
+ each(classes, function (c) {
308
+ addClass(v, c, spacedName);
309
+ });
310
+ }) : this;
311
+ },
312
+
313
+ attr: function (name, value) {
314
+ if (!name) {
315
+ return undefined;
316
+ }
317
+
318
+ if (isString(name)) {
319
+ if (value === undefined) {
320
+ return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined;
321
+ }
322
+
323
+ return this.each(function (v) {
324
+ if (v.setAttribute) {
325
+ v.setAttribute(name, value);
326
+ } else {
327
+ v[name] = value;
328
+ }
329
+ });
330
+ }
331
+
332
+ for (var key in name) {
333
+ this.attr(key, name[key]);
334
+ }
335
+
336
+ return this;
337
+ },
338
+
339
+ hasClass: function (c) {
340
+ var check = false,
341
+ classes = getClasses(c);
342
+ if (classes && classes.length) {
343
+ this.each(function (v) {
344
+ check = hasClass(v, classes[0]);
345
+ return !check;
346
+ });
347
+ }
348
+ return check;
349
+ },
350
+
351
+ prop: function (name, value) {
352
+ if (isString(name)) {
353
+ return value === undefined ? this[0][name] : this.each(function (v) {
354
+ v[name] = value;
355
+ });
356
+ }
357
+
358
+ for (var key in name) {
359
+ this.prop(key, name[key]);
360
+ }
361
+
362
+ return this;
363
+ },
364
+
365
+ removeAttr: function (name) {
366
+ return this.each(function (v) {
367
+ if (v.removeAttribute) {
368
+ v.removeAttribute(name);
369
+ } else {
370
+ delete v[name];
371
+ }
372
+ });
373
+ },
374
+
375
+ removeClass: function (c) {
376
+ if (!arguments.length) {
377
+ return this.attr("class", "");
378
+ }
379
+ var classes = getClasses(c);
380
+ return classes ? this.each(function (v) {
381
+ each(classes, function (c) {
382
+ removeClass(v, c);
383
+ });
384
+ }) : this;
385
+ },
386
+
387
+ removeProp: function (name) {
388
+ return this.each(function (v) {
389
+ delete v[name];
390
+ });
391
+ },
392
+
393
+ toggleClass: function (c, state) {
394
+ if (state !== undefined) {
395
+ return this[state ? "addClass" : "removeClass"](c);
396
+ }
397
+ var classes = getClasses(c);
398
+ return classes ? this.each(function (v) {
399
+ var spacedName = " " + v.className + " ";
400
+ each(classes, function (c) {
401
+ if (hasClass(v, c)) {
402
+ removeClass(v, c);
403
+ } else {
404
+ addClass(v, c, spacedName);
405
+ }
406
+ });
407
+ }) : this;
408
+ } });
409
+
410
+ fn.extend({
411
+ add: function (selector, context) {
412
+ return unique(cash.merge(this, cash(selector, context)));
413
+ },
414
+
415
+ each: function (callback) {
416
+ each(this, callback);
417
+ return this;
418
+ },
419
+
420
+ eq: function (index) {
421
+ return cash(this.get(index));
422
+ },
423
+
424
+ filter: function (selector) {
425
+ if (!selector) {
426
+ return this;
427
+ }
428
+
429
+ var comparator = isFunction(selector) ? selector : getCompareFunction(selector);
430
+
431
+ return cash(filter.call(this, function (e) {
432
+ return comparator(e, selector);
433
+ }));
434
+ },
435
+
436
+ first: function () {
437
+ return this.eq(0);
438
+ },
439
+
440
+ get: function (index) {
441
+ if (index === undefined) {
442
+ return slice.call(this);
443
+ }
444
+ return index < 0 ? this[index + this.length] : this[index];
445
+ },
446
+
447
+ index: function (elem) {
448
+ var child = elem ? cash(elem)[0] : this[0],
449
+ collection = elem ? this : cash(child).parent().children();
450
+ return slice.call(collection).indexOf(child);
451
+ },
452
+
453
+ last: function () {
454
+ return this.eq(-1);
455
+ }
456
+
457
+ });
458
+
459
+ var camelCase = function () {
460
+ var camelRegex = /(?:^\w|[A-Z]|\b\w)/g,
461
+ whiteSpace = /[\s-_]+/g;
462
+ return function (str) {
463
+ return str.replace(camelRegex, function (letter, index) {
464
+ return letter[index === 0 ? "toLowerCase" : "toUpperCase"]();
465
+ }).replace(whiteSpace, "");
466
+ };
467
+ }();
468
+
469
+ var getPrefixedProp = function () {
470
+ var cache = {},
471
+ doc = document,
472
+ div = doc.createElement("div"),
473
+ style = div.style;
474
+
475
+ return function (prop) {
476
+ prop = camelCase(prop);
477
+ if (cache[prop]) {
478
+ return cache[prop];
479
+ }
480
+
481
+ var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
482
+ prefixes = ["webkit", "moz", "ms", "o"],
483
+ props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" ");
484
+
485
+ each(props, function (p) {
486
+ if (p in style) {
487
+ cache[p] = prop = cache[prop] = p;
488
+ return false;
489
+ }
490
+ });
491
+
492
+ return cache[prop];
493
+ };
494
+ }();
495
+
496
+ cash.prefixedProp = getPrefixedProp;
497
+ cash.camelCase = camelCase;
498
+
499
+ fn.extend({
500
+ css: function (prop, value) {
501
+ if (isString(prop)) {
502
+ prop = getPrefixedProp(prop);
503
+ return arguments.length > 1 ? this.each(function (v) {
504
+ return v.style[prop] = value;
505
+ }) : win.getComputedStyle(this[0])[prop];
506
+ }
507
+
508
+ for (var key in prop) {
509
+ this.css(key, prop[key]);
510
+ }
511
+
512
+ return this;
513
+ }
514
+
515
+ });
516
+
517
+ function compute(el, prop) {
518
+ return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0;
519
+ }
520
+
521
+ each(["Width", "Height"], function (v) {
522
+ var lower = v.toLowerCase();
523
+
524
+ fn[lower] = function () {
525
+ return this[0].getBoundingClientRect()[lower];
526
+ };
527
+
528
+ fn["inner" + v] = function () {
529
+ return this[0]["client" + v];
530
+ };
531
+
532
+ fn["outer" + v] = function (margins) {
533
+ return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0);
534
+ };
535
+ });
536
+
537
+ function registerEvent(node, eventName, callback) {
538
+ var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {});
539
+ eventCache[eventName] = eventCache[eventName] || [];
540
+ eventCache[eventName].push(callback);
541
+ node.addEventListener(eventName, callback);
542
+ }
543
+
544
+ function removeEvent(node, eventName, callback) {
545
+ var events = getData(node, "_cashEvents"),
546
+ eventCache = events && events[eventName],
547
+ index;
548
+
549
+ if (!eventCache) {
550
+ return;
551
+ }
552
+
553
+ if (callback) {
554
+ node.removeEventListener(eventName, callback);
555
+ index = eventCache.indexOf(callback);
556
+ if (index >= 0) {
557
+ eventCache.splice(index, 1);
558
+ }
559
+ } else {
560
+ each(eventCache, function (event) {
561
+ node.removeEventListener(eventName, event);
562
+ });
563
+ eventCache = [];
564
+ }
565
+ }
566
+
567
+ fn.extend({
568
+ off: function (eventName, callback) {
569
+ return this.each(function (v) {
570
+ return removeEvent(v, eventName, callback);
571
+ });
572
+ },
573
+
574
+ on: function (eventName, delegate, callback, runOnce) {
575
+ // jshint ignore:line
576
+ var originalCallback;
577
+ if (!isString(eventName)) {
578
+ for (var key in eventName) {
579
+ this.on(key, delegate, eventName[key]);
580
+ }
581
+ return this;
582
+ }
583
+
584
+ if (isFunction(delegate)) {
585
+ callback = delegate;
586
+ delegate = null;
587
+ }
588
+
589
+ if (eventName === "ready") {
590
+ onReady(callback);
591
+ return this;
592
+ }
593
+
594
+ if (delegate) {
595
+ originalCallback = callback;
596
+ callback = function (e) {
597
+ var t = e.target;
598
+ while (!matches(t, delegate)) {
599
+ if (t === this || t === null) {
600
+ return t = false;
601
+ }
602
+
603
+ t = t.parentNode;
604
+ }
605
+
606
+ if (t) {
607
+ originalCallback.call(t, e);
608
+ }
609
+ };
610
+ }
611
+
612
+ return this.each(function (v) {
613
+ var finalCallback = callback;
614
+ if (runOnce) {
615
+ finalCallback = function () {
616
+ callback.apply(this, arguments);
617
+ removeEvent(v, eventName, finalCallback);
618
+ };
619
+ }
620
+ registerEvent(v, eventName, finalCallback);
621
+ });
622
+ },
623
+
624
+ one: function (eventName, delegate, callback) {
625
+ return this.on(eventName, delegate, callback, true);
626
+ },
627
+
628
+ ready: onReady,
629
+
630
+ /**
631
+ * Modified
632
+ * Triggers browser event
633
+ * @param String eventName
634
+ * @param Object data - Add properties to event object
635
+ */
636
+ trigger: function (eventName, data) {
637
+ if (document.createEvent) {
638
+ var evt = document.createEvent('HTMLEvents');
639
+ evt.initEvent(eventName, true, false);
640
+ evt = this.extend(evt, data);
641
+ return this.each(function (v) {
642
+ return v.dispatchEvent(evt);
643
+ });
644
+ }
645
+ }
646
+
647
+ });
648
+
649
+ function encode(name, value) {
650
+ return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+");
651
+ }
652
+
653
+ function getSelectMultiple_(el) {
654
+ var values = [];
655
+ each(el.options, function (o) {
656
+ if (o.selected) {
657
+ values.push(o.value);
658
+ }
659
+ });
660
+ return values.length ? values : null;
661
+ }
662
+
663
+ function getSelectSingle_(el) {
664
+ var selectedIndex = el.selectedIndex;
665
+ return selectedIndex >= 0 ? el.options[selectedIndex].value : null;
666
+ }
667
+
668
+ function getValue(el) {
669
+ var type = el.type;
670
+ if (!type) {
671
+ return null;
672
+ }
673
+ switch (type.toLowerCase()) {
674
+ case "select-one":
675
+ return getSelectSingle_(el);
676
+ case "select-multiple":
677
+ return getSelectMultiple_(el);
678
+ case "radio":
679
+ return el.checked ? el.value : null;
680
+ case "checkbox":
681
+ return el.checked ? el.value : null;
682
+ default:
683
+ return el.value ? el.value : null;
684
+ }
685
+ }
686
+
687
+ fn.extend({
688
+ serialize: function () {
689
+ var query = "";
690
+
691
+ each(this[0].elements || this, function (el) {
692
+ if (el.disabled || el.tagName === "FIELDSET") {
693
+ return;
694
+ }
695
+ var name = el.name;
696
+ switch (el.type.toLowerCase()) {
697
+ case "file":
698
+ case "reset":
699
+ case "submit":
700
+ case "button":
701
+ break;
702
+ case "select-multiple":
703
+ var values = getValue(el);
704
+ if (values !== null) {
705
+ each(values, function (value) {
706
+ query += encode(name, value);
707
+ });
708
+ }
709
+ break;
710
+ default:
711
+ var value = getValue(el);
712
+ if (value !== null) {
713
+ query += encode(name, value);
714
+ }
715
+ }
716
+ });
717
+
718
+ return query.substr(1);
719
+ },
720
+
721
+ val: function (value) {
722
+ if (value === undefined) {
723
+ return getValue(this[0]);
724
+ }
725
+
726
+ return this.each(function (v) {
727
+ return v.value = value;
728
+ });
729
+ }
730
+
731
+ });
732
+
733
+ function insertElement(el, child, prepend) {
734
+ if (prepend) {
735
+ var first = el.childNodes[0];
736
+ el.insertBefore(child, first);
737
+ } else {
738
+ el.appendChild(child);
739
+ }
740
+ }
741
+
742
+ function insertContent(parent, child, prepend) {
743
+ var str = isString(child);
744
+
745
+ if (!str && child.length) {
746
+ each(child, function (v) {
747
+ return insertContent(parent, v, prepend);
748
+ });
749
+ return;
750
+ }
751
+
752
+ each(parent, str ? function (v) {
753
+ return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child);
754
+ } : function (v, i) {
755
+ return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend);
756
+ });
757
+ }
758
+
759
+ fn.extend({
760
+ after: function (selector) {
761
+ cash(selector).insertAfter(this);
762
+ return this;
763
+ },
764
+
765
+ append: function (content) {
766
+ insertContent(this, content);
767
+ return this;
768
+ },
769
+
770
+ appendTo: function (parent) {
771
+ insertContent(cash(parent), this);
772
+ return this;
773
+ },
774
+
775
+ before: function (selector) {
776
+ cash(selector).insertBefore(this);
777
+ return this;
778
+ },
779
+
780
+ clone: function () {
781
+ return cash(this.map(function (v) {
782
+ return v.cloneNode(true);
783
+ }));
784
+ },
785
+
786
+ empty: function () {
787
+ this.html("");
788
+ return this;
789
+ },
790
+
791
+ html: function (content) {
792
+ if (content === undefined) {
793
+ return this[0].innerHTML;
794
+ }
795
+ var source = content.nodeType ? content[0].outerHTML : content;
796
+ return this.each(function (v) {
797
+ return v.innerHTML = source;
798
+ });
799
+ },
800
+
801
+ insertAfter: function (selector) {
802
+ var _this = this;
803
+
804
+ cash(selector).each(function (el, i) {
805
+ var parent = el.parentNode,
806
+ sibling = el.nextSibling;
807
+ _this.each(function (v) {
808
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling);
809
+ });
810
+ });
811
+
812
+ return this;
813
+ },
814
+
815
+ insertBefore: function (selector) {
816
+ var _this2 = this;
817
+ cash(selector).each(function (el, i) {
818
+ var parent = el.parentNode;
819
+ _this2.each(function (v) {
820
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), el);
821
+ });
822
+ });
823
+ return this;
824
+ },
825
+
826
+ prepend: function (content) {
827
+ insertContent(this, content, true);
828
+ return this;
829
+ },
830
+
831
+ prependTo: function (parent) {
832
+ insertContent(cash(parent), this, true);
833
+ return this;
834
+ },
835
+
836
+ remove: function () {
837
+ return this.each(function (v) {
838
+ if (!!v.parentNode) {
839
+ return v.parentNode.removeChild(v);
840
+ }
841
+ });
842
+ },
843
+
844
+ text: function (content) {
845
+ if (content === undefined) {
846
+ return this[0].textContent;
847
+ }
848
+ return this.each(function (v) {
849
+ return v.textContent = content;
850
+ });
851
+ }
852
+
853
+ });
854
+
855
+ var docEl = doc.documentElement;
856
+
857
+ fn.extend({
858
+ position: function () {
859
+ var el = this[0];
860
+ return {
861
+ left: el.offsetLeft,
862
+ top: el.offsetTop
863
+ };
864
+ },
865
+
866
+ offset: function () {
867
+ var rect = this[0].getBoundingClientRect();
868
+ return {
869
+ top: rect.top + win.pageYOffset - docEl.clientTop,
870
+ left: rect.left + win.pageXOffset - docEl.clientLeft
871
+ };
872
+ },
873
+
874
+ offsetParent: function () {
875
+ return cash(this[0].offsetParent);
876
+ }
877
+
878
+ });
879
+
880
+ fn.extend({
881
+ children: function (selector) {
882
+ var elems = [];
883
+ this.each(function (el) {
884
+ push.apply(elems, el.children);
885
+ });
886
+ elems = unique(elems);
887
+
888
+ return !selector ? elems : elems.filter(function (v) {
889
+ return matches(v, selector);
890
+ });
891
+ },
892
+
893
+ closest: function (selector) {
894
+ if (!selector || this.length < 1) {
895
+ return cash();
896
+ }
897
+ if (this.is(selector)) {
898
+ return this.filter(selector);
899
+ }
900
+ return this.parent().closest(selector);
901
+ },
902
+
903
+ is: function (selector) {
904
+ if (!selector) {
905
+ return false;
906
+ }
907
+
908
+ var match = false,
909
+ comparator = getCompareFunction(selector);
910
+
911
+ this.each(function (el) {
912
+ match = comparator(el, selector);
913
+ return !match;
914
+ });
915
+
916
+ return match;
917
+ },
918
+
919
+ find: function (selector) {
920
+ if (!selector || selector.nodeType) {
921
+ return cash(selector && this.has(selector).length ? selector : null);
922
+ }
923
+
924
+ var elems = [];
925
+ this.each(function (el) {
926
+ push.apply(elems, find(selector, el));
927
+ });
928
+
929
+ return unique(elems);
930
+ },
931
+
932
+ has: function (selector) {
933
+ var comparator = isString(selector) ? function (el) {
934
+ return find(selector, el).length !== 0;
935
+ } : function (el) {
936
+ return el.contains(selector);
937
+ };
938
+
939
+ return this.filter(comparator);
940
+ },
941
+
942
+ next: function () {
943
+ return cash(this[0].nextElementSibling);
944
+ },
945
+
946
+ not: function (selector) {
947
+ if (!selector) {
948
+ return this;
949
+ }
950
+
951
+ var comparator = getCompareFunction(selector);
952
+
953
+ return this.filter(function (el) {
954
+ return !comparator(el, selector);
955
+ });
956
+ },
957
+
958
+ parent: function () {
959
+ var result = [];
960
+
961
+ this.each(function (item) {
962
+ if (item && item.parentNode) {
963
+ result.push(item.parentNode);
964
+ }
965
+ });
966
+
967
+ return unique(result);
968
+ },
969
+
970
+ parents: function (selector) {
971
+ var last,
972
+ result = [];
973
+
974
+ this.each(function (item) {
975
+ last = item;
976
+
977
+ while (last && last.parentNode && last !== doc.body.parentNode) {
978
+ last = last.parentNode;
979
+
980
+ if (!selector || selector && matches(last, selector)) {
981
+ result.push(last);
982
+ }
983
+ }
984
+ });
985
+
986
+ return unique(result);
987
+ },
988
+
989
+ prev: function () {
990
+ return cash(this[0].previousElementSibling);
991
+ },
992
+
993
+ siblings: function (selector) {
994
+ var collection = this.parent().children(selector),
995
+ el = this[0];
996
+
997
+ return collection.filter(function (i) {
998
+ return i !== el;
999
+ });
1000
+ }
1001
+
1002
+ });
1003
+
1004
+ return cash;
1005
+ });
1006
+ ;
1007
+ var Component = function () {
1008
+ /**
1009
+ * Generic constructor for all components
1010
+ * @constructor
1011
+ * @param {Element} el
1012
+ * @param {Object} options
1013
+ */
1014
+ function Component(classDef, el, options) {
1015
+ _classCallCheck(this, Component);
1016
+
1017
+ // Display error if el is valid HTML Element
1018
+ if (!(el instanceof Element)) {
1019
+ console.error(Error(el + ' is not an HTML Element'));
1020
+ }
1021
+
1022
+ // If exists, destroy and reinitialize in child
1023
+ var ins = classDef.getInstance(el);
1024
+ if (!!ins) {
1025
+ ins.destroy();
1026
+ }
1027
+
1028
+ this.el = el;
1029
+ this.$el = cash(el);
1030
+ }
1031
+
1032
+ /**
1033
+ * Initializes components
1034
+ * @param {class} classDef
1035
+ * @param {Element | NodeList | jQuery} els
1036
+ * @param {Object} options
1037
+ */
1038
+
1039
+
1040
+ _createClass(Component, null, [{
1041
+ key: "init",
1042
+ value: function init(classDef, els, options) {
1043
+ var instances = null;
1044
+ if (els instanceof Element) {
1045
+ instances = new classDef(els, options);
1046
+ } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) {
1047
+ var instancesArr = [];
1048
+ for (var i = 0; i < els.length; i++) {
1049
+ instancesArr.push(new classDef(els[i], options));
1050
+ }
1051
+ instances = instancesArr;
1052
+ }
1053
+
1054
+ return instances;
1055
+ }
1056
+ }]);
1057
+
1058
+ return Component;
1059
+ }();
1060
+
1061
+ ; // Required for Meteor package, the use of window prevents export by Meteor
1062
+ (function (window) {
1063
+ if (window.Package) {
1064
+ M = {};
1065
+ } else {
1066
+ window.M = {};
1067
+ }
1068
+
1069
+ // Check for jQuery
1070
+ M.jQueryLoaded = !!window.jQuery;
1071
+ })(window);
1072
+
1073
+ // AMD
1074
+ if (typeof define === 'function' && define.amd) {
1075
+ define('M', [], function () {
1076
+ return M;
1077
+ });
1078
+
1079
+ // Common JS
1080
+ } else if (typeof exports !== 'undefined' && !exports.nodeType) {
1081
+ if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
1082
+ exports = module.exports = M;
1083
+ }
1084
+ exports.default = M;
1085
+ }
1086
+
1087
+ M.version = '1.0.0';
1088
+
1089
+ M.keys = {
1090
+ TAB: 9,
1091
+ ENTER: 13,
1092
+ ESC: 27,
1093
+ ARROW_UP: 38,
1094
+ ARROW_DOWN: 40
1095
+ };
1096
+
1097
+ /**
1098
+ * TabPress Keydown handler
1099
+ */
1100
+ M.tabPressed = false;
1101
+ M.keyDown = false;
1102
+ var docHandleKeydown = function (e) {
1103
+ M.keyDown = true;
1104
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1105
+ M.tabPressed = true;
1106
+ }
1107
+ };
1108
+ var docHandleKeyup = function (e) {
1109
+ M.keyDown = false;
1110
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1111
+ M.tabPressed = false;
1112
+ }
1113
+ };
1114
+ var docHandleFocus = function (e) {
1115
+ if (M.keyDown) {
1116
+ document.body.classList.add('keyboard-focused');
1117
+ }
1118
+ };
1119
+ var docHandleBlur = function (e) {
1120
+ document.body.classList.remove('keyboard-focused');
1121
+ };
1122
+ document.addEventListener('keydown', docHandleKeydown, true);
1123
+ document.addEventListener('keyup', docHandleKeyup, true);
1124
+ document.addEventListener('focus', docHandleFocus, true);
1125
+ document.addEventListener('blur', docHandleBlur, true);
1126
+
1127
+ /**
1128
+ * Initialize jQuery wrapper for plugin
1129
+ * @param {Class} plugin javascript class
1130
+ * @param {string} pluginName jQuery plugin name
1131
+ * @param {string} classRef Class reference name
1132
+ */
1133
+ M.initializeJqueryWrapper = function (plugin, pluginName, classRef) {
1134
+ jQuery.fn[pluginName] = function (methodOrOptions) {
1135
+ // Call plugin method if valid method name is passed in
1136
+ if (plugin.prototype[methodOrOptions]) {
1137
+ var params = Array.prototype.slice.call(arguments, 1);
1138
+
1139
+ // Getter methods
1140
+ if (methodOrOptions.slice(0, 3) === 'get') {
1141
+ var instance = this.first()[0][classRef];
1142
+ return instance[methodOrOptions].apply(instance, params);
1143
+ }
1144
+
1145
+ // Void methods
1146
+ return this.each(function () {
1147
+ var instance = this[classRef];
1148
+ instance[methodOrOptions].apply(instance, params);
1149
+ });
1150
+
1151
+ // Initialize plugin if options or no argument is passed in
1152
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
1153
+ plugin.init(this, arguments[0]);
1154
+ return this;
1155
+ }
1156
+
1157
+ // Return error if an unrecognized method name is passed in
1158
+ jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName);
1159
+ };
1160
+ };
1161
+
1162
+ /**
1163
+ * Automatically initialize components
1164
+ * @param {Element} context DOM Element to search within for components
1165
+ */
1166
+ M.AutoInit = function (context) {
1167
+ // Use document.body if no context is given
1168
+ var root = !!context ? context : document.body;
1169
+
1170
+ var registry = {
1171
+ Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'),
1172
+ Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'),
1173
+ Chips: root.querySelectorAll('.chips:not(.no-autoinit)'),
1174
+ Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'),
1175
+ Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'),
1176
+ Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'),
1177
+ Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'),
1178
+ Modal: root.querySelectorAll('.modal:not(.no-autoinit)'),
1179
+ Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'),
1180
+ Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'),
1181
+ ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'),
1182
+ FormSelect: root.querySelectorAll('select:not(.no-autoinit)'),
1183
+ Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'),
1184
+ Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'),
1185
+ TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'),
1186
+ Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'),
1187
+ Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'),
1188
+ FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)')
1189
+ };
1190
+
1191
+ for (var pluginName in registry) {
1192
+ var plugin = M[pluginName];
1193
+ plugin.init(registry[pluginName]);
1194
+ }
1195
+ };
1196
+
1197
+ /**
1198
+ * Generate approximated selector string for a jQuery object
1199
+ * @param {jQuery} obj jQuery object to be parsed
1200
+ * @returns {string}
1201
+ */
1202
+ M.objectSelectorString = function (obj) {
1203
+ var tagStr = obj.prop('tagName') || '';
1204
+ var idStr = obj.attr('id') || '';
1205
+ var classStr = obj.attr('class') || '';
1206
+ return (tagStr + idStr + classStr).replace(/\s/g, '');
1207
+ };
1208
+
1209
+ // Unique Random ID
1210
+ M.guid = function () {
1211
+ function s4() {
1212
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
1213
+ }
1214
+ return function () {
1215
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
1216
+ };
1217
+ }();
1218
+
1219
+ /**
1220
+ * Escapes hash from special characters
1221
+ * @param {string} hash String returned from this.hash
1222
+ * @returns {string}
1223
+ */
1224
+ M.escapeHash = function (hash) {
1225
+ return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1');
1226
+ };
1227
+
1228
+ M.elementOrParentIsFixed = function (element) {
1229
+ var $element = $(element);
1230
+ var $checkElements = $element.add($element.parents());
1231
+ var isFixed = false;
1232
+ $checkElements.each(function () {
1233
+ if ($(this).css('position') === 'fixed') {
1234
+ isFixed = true;
1235
+ return false;
1236
+ }
1237
+ });
1238
+ return isFixed;
1239
+ };
1240
+
1241
+ /**
1242
+ * @typedef {Object} Edges
1243
+ * @property {Boolean} top If the top edge was exceeded
1244
+ * @property {Boolean} right If the right edge was exceeded
1245
+ * @property {Boolean} bottom If the bottom edge was exceeded
1246
+ * @property {Boolean} left If the left edge was exceeded
1247
+ */
1248
+
1249
+ /**
1250
+ * @typedef {Object} Bounding
1251
+ * @property {Number} left left offset coordinate
1252
+ * @property {Number} top top offset coordinate
1253
+ * @property {Number} width
1254
+ * @property {Number} height
1255
+ */
1256
+
1257
+ /**
1258
+ * Escapes hash from special characters
1259
+ * @param {Element} container Container element that acts as the boundary
1260
+ * @param {Bounding} bounding element bounding that is being checked
1261
+ * @param {Number} offset offset from edge that counts as exceeding
1262
+ * @returns {Edges}
1263
+ */
1264
+ M.checkWithinContainer = function (container, bounding, offset) {
1265
+ var edges = {
1266
+ top: false,
1267
+ right: false,
1268
+ bottom: false,
1269
+ left: false
1270
+ };
1271
+
1272
+ var containerRect = container.getBoundingClientRect();
1273
+ // If body element is smaller than viewport, use viewport height instead.
1274
+ var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom;
1275
+
1276
+ var scrollLeft = container.scrollLeft;
1277
+ var scrollTop = container.scrollTop;
1278
+
1279
+ var scrolledX = bounding.left - scrollLeft;
1280
+ var scrolledY = bounding.top - scrollTop;
1281
+
1282
+ // Check for container and viewport for each edge
1283
+ if (scrolledX < containerRect.left + offset || scrolledX < offset) {
1284
+ edges.left = true;
1285
+ }
1286
+
1287
+ if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) {
1288
+ edges.right = true;
1289
+ }
1290
+
1291
+ if (scrolledY < containerRect.top + offset || scrolledY < offset) {
1292
+ edges.top = true;
1293
+ }
1294
+
1295
+ if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) {
1296
+ edges.bottom = true;
1297
+ }
1298
+
1299
+ return edges;
1300
+ };
1301
+
1302
+ M.checkPossibleAlignments = function (el, container, bounding, offset) {
1303
+ var canAlign = {
1304
+ top: true,
1305
+ right: true,
1306
+ bottom: true,
1307
+ left: true,
1308
+ spaceOnTop: null,
1309
+ spaceOnRight: null,
1310
+ spaceOnBottom: null,
1311
+ spaceOnLeft: null
1312
+ };
1313
+
1314
+ var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible';
1315
+ var containerRect = container.getBoundingClientRect();
1316
+ var containerHeight = Math.min(containerRect.height, window.innerHeight);
1317
+ var containerWidth = Math.min(containerRect.width, window.innerWidth);
1318
+ var elOffsetRect = el.getBoundingClientRect();
1319
+
1320
+ var scrollLeft = container.scrollLeft;
1321
+ var scrollTop = container.scrollTop;
1322
+
1323
+ var scrolledX = bounding.left - scrollLeft;
1324
+ var scrolledYTopEdge = bounding.top - scrollTop;
1325
+ var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop;
1326
+
1327
+ // Check for container and viewport for left
1328
+ canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width);
1329
+ if (canAlign.spaceOnRight < 0) {
1330
+ canAlign.left = false;
1331
+ }
1332
+
1333
+ // Check for container and viewport for Right
1334
+ canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width;
1335
+ if (canAlign.spaceOnLeft < 0) {
1336
+ canAlign.right = false;
1337
+ }
1338
+
1339
+ // Check for container and viewport for Top
1340
+ canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset);
1341
+ if (canAlign.spaceOnBottom < 0) {
1342
+ canAlign.top = false;
1343
+ }
1344
+
1345
+ // Check for container and viewport for Bottom
1346
+ canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset);
1347
+ if (canAlign.spaceOnTop < 0) {
1348
+ canAlign.bottom = false;
1349
+ }
1350
+
1351
+ return canAlign;
1352
+ };
1353
+
1354
+ M.getOverflowParent = function (element) {
1355
+ if (element == null) {
1356
+ return null;
1357
+ }
1358
+
1359
+ if (element === document.body || getComputedStyle(element).overflow !== 'visible') {
1360
+ return element;
1361
+ }
1362
+
1363
+ return M.getOverflowParent(element.parentElement);
1364
+ };
1365
+
1366
+ /**
1367
+ * Gets id of component from a trigger
1368
+ * @param {Element} trigger trigger
1369
+ * @returns {string}
1370
+ */
1371
+ M.getIdFromTrigger = function (trigger) {
1372
+ var id = trigger.getAttribute('data-target');
1373
+ if (!id) {
1374
+ id = trigger.getAttribute('href');
1375
+ if (id) {
1376
+ id = id.slice(1);
1377
+ } else {
1378
+ id = '';
1379
+ }
1380
+ }
1381
+ return id;
1382
+ };
1383
+
1384
+ /**
1385
+ * Multi browser support for document scroll top
1386
+ * @returns {Number}
1387
+ */
1388
+ M.getDocumentScrollTop = function () {
1389
+ return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
1390
+ };
1391
+
1392
+ /**
1393
+ * Multi browser support for document scroll left
1394
+ * @returns {Number}
1395
+ */
1396
+ M.getDocumentScrollLeft = function () {
1397
+ return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
1398
+ };
1399
+
1400
+ /**
1401
+ * @typedef {Object} Edges
1402
+ * @property {Boolean} top If the top edge was exceeded
1403
+ * @property {Boolean} right If the right edge was exceeded
1404
+ * @property {Boolean} bottom If the bottom edge was exceeded
1405
+ * @property {Boolean} left If the left edge was exceeded
1406
+ */
1407
+
1408
+ /**
1409
+ * @typedef {Object} Bounding
1410
+ * @property {Number} left left offset coordinate
1411
+ * @property {Number} top top offset coordinate
1412
+ * @property {Number} width
1413
+ * @property {Number} height
1414
+ */
1415
+
1416
+ /**
1417
+ * Get time in ms
1418
+ * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1419
+ * @type {function}
1420
+ * @return {number}
1421
+ */
1422
+ var getTime = Date.now || function () {
1423
+ return new Date().getTime();
1424
+ };
1425
+
1426
+ /**
1427
+ * Returns a function, that, when invoked, will only be triggered at most once
1428
+ * during a given window of time. Normally, the throttled function will run
1429
+ * as much as it can, without ever going more than once per `wait` duration;
1430
+ * but if you'd like to disable the execution on the leading edge, pass
1431
+ * `{leading: false}`. To disable execution on the trailing edge, ditto.
1432
+ * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1433
+ * @param {function} func
1434
+ * @param {number} wait
1435
+ * @param {Object=} options
1436
+ * @returns {Function}
1437
+ */
1438
+ M.throttle = function (func, wait, options) {
1439
+ var context = void 0,
1440
+ args = void 0,
1441
+ result = void 0;
1442
+ var timeout = null;
1443
+ var previous = 0;
1444
+ options || (options = {});
1445
+ var later = function () {
1446
+ previous = options.leading === false ? 0 : getTime();
1447
+ timeout = null;
1448
+ result = func.apply(context, args);
1449
+ context = args = null;
1450
+ };
1451
+ return function () {
1452
+ var now = getTime();
1453
+ if (!previous && options.leading === false) previous = now;
1454
+ var remaining = wait - (now - previous);
1455
+ context = this;
1456
+ args = arguments;
1457
+ if (remaining <= 0) {
1458
+ clearTimeout(timeout);
1459
+ timeout = null;
1460
+ previous = now;
1461
+ result = func.apply(context, args);
1462
+ context = args = null;
1463
+ } else if (!timeout && options.trailing !== false) {
1464
+ timeout = setTimeout(later, remaining);
1465
+ }
1466
+ return result;
1467
+ };
1468
+ };
1469
+ ; /*
1470
+ v2.2.0
1471
+ 2017 Julian Garnier
1472
+ Released under the MIT license
1473
+ */
1474
+ var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) {
1475
+ if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value);
1476
+ };$jscomp.getGlobal = function (e) {
1477
+ return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e;
1478
+ };$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_";
1479
+ $jscomp.initSymbol = function () {
1480
+ $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol);
1481
+ };$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) {
1482
+ return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++;
1483
+ };
1484
+ $jscomp.initSymbolIterator = function () {
1485
+ $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () {
1486
+ return $jscomp.arrayIterator(this);
1487
+ } });$jscomp.initSymbolIterator = function () {};
1488
+ };$jscomp.arrayIterator = function (e) {
1489
+ var r = 0;return $jscomp.iteratorPrototype(function () {
1490
+ return r < e.length ? { done: !1, value: e[r++] } : { done: !0 };
1491
+ });
1492
+ };
1493
+ $jscomp.iteratorPrototype = function (e) {
1494
+ $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () {
1495
+ return this;
1496
+ };return e;
1497
+ };$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) {
1498
+ $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0,
1499
+ m = { next: function () {
1500
+ if (p < e.length) {
1501
+ var u = p++;return { value: r(u, e[u]), done: !1 };
1502
+ }m.next = function () {
1503
+ return { done: !0, value: void 0 };
1504
+ };return m.next();
1505
+ } };m[Symbol.iterator] = function () {
1506
+ return m;
1507
+ };return m;
1508
+ };
1509
+ $jscomp.polyfill = function (e, r, p, m) {
1510
+ if (r) {
1511
+ p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) {
1512
+ var u = e[m];u in p || (p[u] = {});p = p[u];
1513
+ }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r });
1514
+ }
1515
+ };$jscomp.polyfill("Array.prototype.keys", function (e) {
1516
+ return e ? e : function () {
1517
+ return $jscomp.iteratorFromArray(this, function (e) {
1518
+ return e;
1519
+ });
1520
+ };
1521
+ }, "es6-impl", "es3");var $jscomp$this = this;
1522
+ (function (r) {
1523
+ M.anime = r();
1524
+ })(function () {
1525
+ function e(a) {
1526
+ if (!h.col(a)) try {
1527
+ return document.querySelectorAll(a);
1528
+ } catch (c) {}
1529
+ }function r(a, c) {
1530
+ for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) {
1531
+ if (n in a) {
1532
+ var k = a[n];c.call(b, k, n, a) && f.push(k);
1533
+ }
1534
+ }return f;
1535
+ }function p(a) {
1536
+ return a.reduce(function (a, d) {
1537
+ return a.concat(h.arr(d) ? p(d) : d);
1538
+ }, []);
1539
+ }function m(a) {
1540
+ if (h.arr(a)) return a;
1541
+ h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a];
1542
+ }function u(a, c) {
1543
+ return a.some(function (a) {
1544
+ return a === c;
1545
+ });
1546
+ }function C(a) {
1547
+ var c = {},
1548
+ d;for (d in a) {
1549
+ c[d] = a[d];
1550
+ }return c;
1551
+ }function D(a, c) {
1552
+ var d = C(a),
1553
+ b;for (b in a) {
1554
+ d[b] = c.hasOwnProperty(b) ? c[b] : a[b];
1555
+ }return d;
1556
+ }function z(a, c) {
1557
+ var d = C(a),
1558
+ b;for (b in c) {
1559
+ d[b] = h.und(a[b]) ? c[b] : a[b];
1560
+ }return d;
1561
+ }function T(a) {
1562
+ a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) {
1563
+ return c + c + d + d + k + k;
1564
+ });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
1565
+ a = parseInt(c[1], 16);var d = parseInt(c[2], 16),
1566
+ c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)";
1567
+ }function U(a) {
1568
+ function c(a, c, b) {
1569
+ 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a;
1570
+ }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100,
1571
+ f = parseInt(d[3]) / 100,
1572
+ d = d[4] || 1;if (0 == b) f = b = a = f;else {
1573
+ var n = .5 > f ? f * (1 + b) : f + b - f * b,
1574
+ k = 2 * f - n,
1575
+ f = c(k, n, a + 1 / 3),
1576
+ b = c(k, n, a);a = c(k, n, a - 1 / 3);
1577
+ }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")";
1578
+ }function y(a) {
1579
+ if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2];
1580
+ }function V(a) {
1581
+ if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg";
1582
+ }function I(a, c) {
1583
+ return h.fnc(a) ? a(c.target, c.id, c.total) : a;
1584
+ }function E(a, c) {
1585
+ if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0";
1586
+ }function J(a, c) {
1587
+ if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object";
1588
+ }function X(a, c) {
1589
+ var d = V(c),
1590
+ d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) {
1591
+ f.push(b[1]), n.push(b[2]);
1592
+ }a = r(n, function (a, b) {
1593
+ return f[b] === c;
1594
+ });return a.length ? a[0] : d;
1595
+ }function K(a, c) {
1596
+ switch (J(a, c)) {case "transform":
1597
+ return X(a, c);case "css":
1598
+ return E(a, c);case "attribute":
1599
+ return a.getAttribute(c);}return a[c] || 0;
1600
+ }function L(a, c) {
1601
+ var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+":
1602
+ return c + a + b;case "-":
1603
+ return c - a + b;case "*":
1604
+ return c * a + b;}
1605
+ }function F(a, c) {
1606
+ return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2));
1607
+ }function M(a) {
1608
+ a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) {
1609
+ var f = a.getItem(b);0 < b && (c += F(d, f));d = f;
1610
+ }return c;
1611
+ }function N(a) {
1612
+ if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle":
1613
+ return 2 * Math.PI * a.getAttribute("r");case "rect":
1614
+ return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line":
1615
+ return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline":
1616
+ return M(a);case "polygon":
1617
+ var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));}
1618
+ }function Y(a, c) {
1619
+ function d(b) {
1620
+ b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0);
1621
+ }var b = d(),
1622
+ f = d(-1),
1623
+ n = d(1);switch (a.property) {case "x":
1624
+ return b.x;case "y":
1625
+ return b.y;
1626
+ case "angle":
1627
+ return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;}
1628
+ }function O(a, c) {
1629
+ var d = /-?\d*\.?\d+/g,
1630
+ b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) {
1631
+ if (h.rgb(b)) {
1632
+ var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b;
1633
+ } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0;
1634
+ } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] };
1635
+ }function P(a) {
1636
+ a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) {
1637
+ return b.indexOf(a) === d;
1638
+ });
1639
+ }function Z(a) {
1640
+ var c = P(a);return c.map(function (a, b) {
1641
+ return { target: a, id: b, total: c.length };
1642
+ });
1643
+ }function aa(a, c) {
1644
+ var d = C(c);if (h.arr(a)) {
1645
+ var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a };
1646
+ }return m(a).map(function (a, b) {
1647
+ b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a;
1648
+ }).map(function (a) {
1649
+ return z(a, d);
1650
+ });
1651
+ }function ba(a, c) {
1652
+ var d = {},
1653
+ b;for (b in a) {
1654
+ var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) {
1655
+ return I(a, c);
1656
+ }), 1 === f.length && (f = f[0]));d[b] = f;
1657
+ }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d;
1658
+ }function ca(a) {
1659
+ return h.arr(a) ? A.apply(this, a) : Q[a];
1660
+ }function da(a, c) {
1661
+ var d;return a.tweens.map(function (b) {
1662
+ b = ba(b, c);var f = b.value,
1663
+ e = K(c.target, a.name),
1664
+ k = d ? d.to.original : e,
1665
+ k = h.arr(f) ? f[0] : k,
1666
+ w = L(h.arr(f) ? f[1] : f, k),
1667
+ e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b;
1668
+ });
1669
+ }function ea(a, c) {
1670
+ return r(p(a.map(function (a) {
1671
+ return c.map(function (b) {
1672
+ var c = J(a.target, b.name);if (c) {
1673
+ var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay };
1674
+ } else b = void 0;return b;
1675
+ });
1676
+ })), function (a) {
1677
+ return !h.und(a);
1678
+ });
1679
+ }function R(a, c, d, b) {
1680
+ var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) {
1681
+ return b[a];
1682
+ })) : f ? b.delay : d.offset + b.delay + b.duration;
1683
+ }function fa(a) {
1684
+ var c = D(ga, a),
1685
+ d = D(S, a),
1686
+ b = Z(a.targets),
1687
+ f = [],
1688
+ e = z(c, d),
1689
+ k;for (k in a) {
1690
+ e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) });
1691
+ }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) });
1692
+ }function q(a) {
1693
+ function c() {
1694
+ return window.Promise && new Promise(function (a) {
1695
+ return p = a;
1696
+ });
1697
+ }function d(a) {
1698
+ return g.reversed ? g.duration - a : a;
1699
+ }function b(a) {
1700
+ for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) {
1701
+ var e = d[b],
1702
+ k = e.animatable,
1703
+ h = e.tweens,
1704
+ n = h.length - 1,
1705
+ l = h[n];n && (l = r(h, function (b) {
1706
+ return a < b.end;
1707
+ })[0] || l);for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) {
1708
+ var x = void 0,
1709
+ x = l.to.numbers[t],
1710
+ q = l.from.numbers[t],
1711
+ x = l.isPath ? Y(l.value, w * x) : q + w * (x - q);p && (l.isColor && 2 < t || (x = Math.round(x * p) / p));n.push(x);
1712
+ }if (l = h.length) for (m = h[0], w = 0; w < l; w++) {
1713
+ p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " "));
1714
+ } else m = n[0];ha[e.type](k.target, e.property, m, c, k.id);e.currentValue = m;b++;
1715
+ }if (b = Object.keys(c).length) for (d = 0; d < b; d++) {
1716
+ H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" ");
1717
+ }g.currentTime = a;g.progress = a / g.duration * 100;
1718
+ }function f(a) {
1719
+ if (g[a]) g[a](g);
1720
+ }function e() {
1721
+ g.remaining && !0 !== g.remaining && g.remaining--;
1722
+ }function k(a) {
1723
+ var k = g.duration,
1724
+ n = g.offset,
1725
+ w = n + g.delay,
1726
+ r = g.currentTime,
1727
+ x = g.reversed,
1728
+ q = d(a);if (g.children.length) {
1729
+ var u = g.children,
1730
+ v = u.length;
1731
+ if (q >= g.currentTime) for (var G = 0; G < v; G++) {
1732
+ u[G].seek(q);
1733
+ } else for (; v--;) {
1734
+ u[v].seek(q);
1735
+ }
1736
+ }if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run");if (q > n && q < k) b(q);else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e();f("update");a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0);
1737
+ }a = void 0 === a ? {} : a;var h,
1738
+ t,
1739
+ l = 0,
1740
+ p = null,
1741
+ m = c(),
1742
+ g = fa(a);g.reset = function () {
1743
+ var a = g.direction,
1744
+ c = g.loop;g.currentTime = 0;g.progress = 0;g.paused = !0;g.began = !1;g.completed = !1;g.reversed = "reverse" === a;g.remaining = "alternate" === a && 1 === c ? 2 : c;b(0);for (a = g.children.length; a--;) {
1745
+ g.children[a].reset();
1746
+ }
1747
+ };g.tick = function (a) {
1748
+ h = a;t || (t = h);k((l + h - t) * q.speed);
1749
+ };g.seek = function (a) {
1750
+ k(d(a));
1751
+ };g.pause = function () {
1752
+ var a = v.indexOf(g);-1 < a && v.splice(a, 1);g.paused = !0;
1753
+ };g.play = function () {
1754
+ g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia());
1755
+ };g.reverse = function () {
1756
+ g.reversed = !g.reversed;t = 0;l = d(g.currentTime);
1757
+ };g.restart = function () {
1758
+ g.pause();
1759
+ g.reset();g.play();
1760
+ };g.finished = m;g.reset();g.autoplay && g.play();return g;
1761
+ }var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 },
1762
+ S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 },
1763
+ W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),
1764
+ H,
1765
+ h = { arr: function (a) {
1766
+ return Array.isArray(a);
1767
+ }, obj: function (a) {
1768
+ return -1 < Object.prototype.toString.call(a).indexOf("Object");
1769
+ },
1770
+ pth: function (a) {
1771
+ return h.obj(a) && a.hasOwnProperty("totalLength");
1772
+ }, svg: function (a) {
1773
+ return a instanceof SVGElement;
1774
+ }, dom: function (a) {
1775
+ return a.nodeType || h.svg(a);
1776
+ }, str: function (a) {
1777
+ return "string" === typeof a;
1778
+ }, fnc: function (a) {
1779
+ return "function" === typeof a;
1780
+ }, und: function (a) {
1781
+ return "undefined" === typeof a;
1782
+ }, hex: function (a) {
1783
+ return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)
1784
+ );
1785
+ }, rgb: function (a) {
1786
+ return (/^rgb/.test(a)
1787
+ );
1788
+ }, hsl: function (a) {
1789
+ return (/^hsl/.test(a)
1790
+ );
1791
+ }, col: function (a) {
1792
+ return h.hex(a) || h.rgb(a) || h.hsl(a);
1793
+ } },
1794
+ A = function () {
1795
+ function a(a, d, b) {
1796
+ return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a;
1797
+ }return function (c, d, b, f) {
1798
+ if (0 <= c && 1 >= c && 0 <= b && 1 >= b) {
1799
+ var e = new Float32Array(11);if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) {
1800
+ e[k] = a(.1 * k, c, b);
1801
+ }return function (k) {
1802
+ if (c === d && b === f) return k;if (0 === k) return 0;if (1 === k) return 1;for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) {
1803
+ h += .1;
1804
+ }--l;var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1,
1805
+ n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (.001 <= n) {
1806
+ for (h = 0; 4 > h; ++h) {
1807
+ n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (0 === n) break;var m = a(l, c, b) - k,
1808
+ l = l - m / n;
1809
+ }k = l;
1810
+ } else if (0 === n) k = l;else {
1811
+ var l = h,
1812
+ h = h + .1,
1813
+ g = 0;do {
1814
+ m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m;
1815
+ } while (1e-7 < Math.abs(n) && 10 > ++g);k = m;
1816
+ }return a(k, d, f);
1817
+ };
1818
+ }
1819
+ };
1820
+ }(),
1821
+ Q = function () {
1822
+ function a(a, b) {
1823
+ return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b);
1824
+ }var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),
1825
+ d = { In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) {
1826
+ return 1 - a(1 - b, c);
1827
+ }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) {
1828
+ return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2;
1829
+ }] },
1830
+ b = { linear: A(.25, .25, .75, .75) },
1831
+ f = {},
1832
+ e;for (e in d) {
1833
+ f.type = e, d[f.type].forEach(function (a) {
1834
+ return function (d, f) {
1835
+ b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d);
1836
+ };
1837
+ }(f)), f = { type: f.type };
1838
+ }return b;
1839
+ }(),
1840
+ ha = { css: function (a, c, d) {
1841
+ return a.style[c] = d;
1842
+ }, attribute: function (a, c, d) {
1843
+ return a.setAttribute(c, d);
1844
+ }, object: function (a, c, d) {
1845
+ return a[c] = d;
1846
+ }, transform: function (a, c, d, b, f) {
1847
+ b[f] || (b[f] = []);b[f].push(c + "(" + d + ")");
1848
+ } },
1849
+ v = [],
1850
+ B = 0,
1851
+ ia = function () {
1852
+ function a() {
1853
+ B = requestAnimationFrame(c);
1854
+ }function c(c) {
1855
+ var b = v.length;if (b) {
1856
+ for (var d = 0; d < b;) {
1857
+ v[d] && v[d].tick(c), d++;
1858
+ }a();
1859
+ } else cancelAnimationFrame(B), B = 0;
1860
+ }return a;
1861
+ }();q.version = "2.2.0";q.speed = 1;q.running = v;q.remove = function (a) {
1862
+ a = P(a);for (var c = v.length; c--;) {
1863
+ for (var d = v[c], b = d.animations, f = b.length; f--;) {
1864
+ u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause());
1865
+ }
1866
+ }
1867
+ };q.getValue = K;q.path = function (a, c) {
1868
+ var d = h.str(a) ? e(a)[0] : a,
1869
+ b = c || 100;return function (a) {
1870
+ return { el: d, property: a, totalLength: N(d) * (b / 100) };
1871
+ };
1872
+ };q.setDashoffset = function (a) {
1873
+ var c = N(a);a.setAttribute("stroke-dasharray", c);return c;
1874
+ };q.bezier = A;q.easings = Q;q.timeline = function (a) {
1875
+ var c = q(a);c.pause();c.duration = 0;c.add = function (d) {
1876
+ c.children.forEach(function (a) {
1877
+ a.began = !0;a.completed = !0;
1878
+ });m(d).forEach(function (b) {
1879
+ var d = z(b, D(S, a || {}));d.targets = d.targets || a.targets;b = c.duration;var e = d.offset;d.autoplay = !1;d.direction = c.direction;d.offset = h.und(e) ? b : L(e, b);c.began = !0;c.completed = !0;c.seek(d.offset);d = q(d);d.began = !0;d.completed = !0;d.duration > b && (c.duration = d.duration);c.children.push(d);
1880
+ });c.seek(0);c.reset();c.autoplay && c.restart();return c;
1881
+ };return c;
1882
+ };q.random = function (a, c) {
1883
+ return Math.floor(Math.random() * (c - a + 1)) + a;
1884
+ };return q;
1885
+ });
1886
+ ;(function ($, anim) {
1887
+ 'use strict';
1888
+
1889
+ var _defaults = {
1890
+ accordion: true,
1891
+ onOpenStart: undefined,
1892
+ onOpenEnd: undefined,
1893
+ onCloseStart: undefined,
1894
+ onCloseEnd: undefined,
1895
+ inDuration: 300,
1896
+ outDuration: 300
1897
+ };
1898
+
1899
+ /**
1900
+ * @class
1901
+ *
1902
+ */
1903
+
1904
+ var Collapsible = function (_Component) {
1905
+ _inherits(Collapsible, _Component);
1906
+
1907
+ /**
1908
+ * Construct Collapsible instance
1909
+ * @constructor
1910
+ * @param {Element} el
1911
+ * @param {Object} options
1912
+ */
1913
+ function Collapsible(el, options) {
1914
+ _classCallCheck(this, Collapsible);
1915
+
1916
+ var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options));
1917
+
1918
+ _this3.el.M_Collapsible = _this3;
1919
+
1920
+ /**
1921
+ * Options for the collapsible
1922
+ * @member Collapsible#options
1923
+ * @prop {Boolean} [accordion=false] - Type of the collapsible
1924
+ * @prop {Function} onOpenStart - Callback function called before collapsible is opened
1925
+ * @prop {Function} onOpenEnd - Callback function called after collapsible is opened
1926
+ * @prop {Function} onCloseStart - Callback function called before collapsible is closed
1927
+ * @prop {Function} onCloseEnd - Callback function called after collapsible is closed
1928
+ * @prop {Number} inDuration - Transition in duration in milliseconds.
1929
+ * @prop {Number} outDuration - Transition duration in milliseconds.
1930
+ */
1931
+ _this3.options = $.extend({}, Collapsible.defaults, options);
1932
+
1933
+ // Setup tab indices
1934
+ _this3.$headers = _this3.$el.children('li').children('.collapsible-header');
1935
+ _this3.$headers.attr('tabindex', 0);
1936
+
1937
+ _this3._setupEventHandlers();
1938
+
1939
+ // Open first active
1940
+ var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body');
1941
+ if (_this3.options.accordion) {
1942
+ // Handle Accordion
1943
+ $activeBodies.first().css('display', 'block');
1944
+ } else {
1945
+ // Handle Expandables
1946
+ $activeBodies.css('display', 'block');
1947
+ }
1948
+ return _this3;
1949
+ }
1950
+
1951
+ _createClass(Collapsible, [{
1952
+ key: "destroy",
1953
+
1954
+
1955
+ /**
1956
+ * Teardown component
1957
+ */
1958
+ value: function destroy() {
1959
+ this._removeEventHandlers();
1960
+ this.el.M_Collapsible = undefined;
1961
+ }
1962
+
1963
+ /**
1964
+ * Setup Event Handlers
1965
+ */
1966
+
1967
+ }, {
1968
+ key: "_setupEventHandlers",
1969
+ value: function _setupEventHandlers() {
1970
+ var _this4 = this;
1971
+
1972
+ this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this);
1973
+ this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this);
1974
+ this.el.addEventListener('click', this._handleCollapsibleClickBound);
1975
+ this.$headers.each(function (header) {
1976
+ header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound);
1977
+ });
1978
+ }
1979
+
1980
+ /**
1981
+ * Remove Event Handlers
1982
+ */
1983
+
1984
+ }, {
1985
+ key: "_removeEventHandlers",
1986
+ value: function _removeEventHandlers() {
1987
+ var _this5 = this;
1988
+
1989
+ this.el.removeEventListener('click', this._handleCollapsibleClickBound);
1990
+ this.$headers.each(function (header) {
1991
+ header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound);
1992
+ });
1993
+ }
1994
+
1995
+ /**
1996
+ * Handle Collapsible Click
1997
+ * @param {Event} e
1998
+ */
1999
+
2000
+ }, {
2001
+ key: "_handleCollapsibleClick",
2002
+ value: function _handleCollapsibleClick(e) {
2003
+ var $header = $(e.target).closest('.collapsible-header');
2004
+ if (e.target && $header.length) {
2005
+ var $collapsible = $header.closest('.collapsible');
2006
+ if ($collapsible[0] === this.el) {
2007
+ var $collapsibleLi = $header.closest('li');
2008
+ var $collapsibleLis = $collapsible.children('li');
2009
+ var isActive = $collapsibleLi[0].classList.contains('active');
2010
+ var index = $collapsibleLis.index($collapsibleLi);
2011
+
2012
+ if (isActive) {
2013
+ this.close(index);
2014
+ } else {
2015
+ this.open(index);
2016
+ }
2017
+ }
2018
+ }
2019
+ }
2020
+
2021
+ /**
2022
+ * Handle Collapsible Keydown
2023
+ * @param {Event} e
2024
+ */
2025
+
2026
+ }, {
2027
+ key: "_handleCollapsibleKeydown",
2028
+ value: function _handleCollapsibleKeydown(e) {
2029
+ if (e.keyCode === 13) {
2030
+ this._handleCollapsibleClickBound(e);
2031
+ }
2032
+ }
2033
+
2034
+ /**
2035
+ * Animate in collapsible slide
2036
+ * @param {Number} index - 0th index of slide
2037
+ */
2038
+
2039
+ }, {
2040
+ key: "_animateIn",
2041
+ value: function _animateIn(index) {
2042
+ var _this6 = this;
2043
+
2044
+ var $collapsibleLi = this.$el.children('li').eq(index);
2045
+ if ($collapsibleLi.length) {
2046
+ var $body = $collapsibleLi.children('.collapsible-body');
2047
+
2048
+ anim.remove($body[0]);
2049
+ $body.css({
2050
+ display: 'block',
2051
+ overflow: 'hidden',
2052
+ height: 0,
2053
+ paddingTop: '',
2054
+ paddingBottom: ''
2055
+ });
2056
+
2057
+ var pTop = $body.css('padding-top');
2058
+ var pBottom = $body.css('padding-bottom');
2059
+ var finalHeight = $body[0].scrollHeight;
2060
+ $body.css({
2061
+ paddingTop: 0,
2062
+ paddingBottom: 0
2063
+ });
2064
+
2065
+ anim({
2066
+ targets: $body[0],
2067
+ height: finalHeight,
2068
+ paddingTop: pTop,
2069
+ paddingBottom: pBottom,
2070
+ duration: this.options.inDuration,
2071
+ easing: 'easeInOutCubic',
2072
+ complete: function (anim) {
2073
+ $body.css({
2074
+ overflow: '',
2075
+ paddingTop: '',
2076
+ paddingBottom: '',
2077
+ height: ''
2078
+ });
2079
+
2080
+ // onOpenEnd callback
2081
+ if (typeof _this6.options.onOpenEnd === 'function') {
2082
+ _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]);
2083
+ }
2084
+ }
2085
+ });
2086
+ }
2087
+ }
2088
+
2089
+ /**
2090
+ * Animate out collapsible slide
2091
+ * @param {Number} index - 0th index of slide to open
2092
+ */
2093
+
2094
+ }, {
2095
+ key: "_animateOut",
2096
+ value: function _animateOut(index) {
2097
+ var _this7 = this;
2098
+
2099
+ var $collapsibleLi = this.$el.children('li').eq(index);
2100
+ if ($collapsibleLi.length) {
2101
+ var $body = $collapsibleLi.children('.collapsible-body');
2102
+ anim.remove($body[0]);
2103
+ $body.css('overflow', 'hidden');
2104
+ anim({
2105
+ targets: $body[0],
2106
+ height: 0,
2107
+ paddingTop: 0,
2108
+ paddingBottom: 0,
2109
+ duration: this.options.outDuration,
2110
+ easing: 'easeInOutCubic',
2111
+ complete: function () {
2112
+ $body.css({
2113
+ height: '',
2114
+ overflow: '',
2115
+ padding: '',
2116
+ display: ''
2117
+ });
2118
+
2119
+ // onCloseEnd callback
2120
+ if (typeof _this7.options.onCloseEnd === 'function') {
2121
+ _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]);
2122
+ }
2123
+ }
2124
+ });
2125
+ }
2126
+ }
2127
+
2128
+ /**
2129
+ * Open Collapsible
2130
+ * @param {Number} index - 0th index of slide
2131
+ */
2132
+
2133
+ }, {
2134
+ key: "open",
2135
+ value: function open(index) {
2136
+ var _this8 = this;
2137
+
2138
+ var $collapsibleLi = this.$el.children('li').eq(index);
2139
+ if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
2140
+ // onOpenStart callback
2141
+ if (typeof this.options.onOpenStart === 'function') {
2142
+ this.options.onOpenStart.call(this, $collapsibleLi[0]);
2143
+ }
2144
+
2145
+ // Handle accordion behavior
2146
+ if (this.options.accordion) {
2147
+ var $collapsibleLis = this.$el.children('li');
2148
+ var $activeLis = this.$el.children('li.active');
2149
+ $activeLis.each(function (el) {
2150
+ var index = $collapsibleLis.index($(el));
2151
+ _this8.close(index);
2152
+ });
2153
+ }
2154
+
2155
+ // Animate in
2156
+ $collapsibleLi[0].classList.add('active');
2157
+ this._animateIn(index);
2158
+ }
2159
+ }
2160
+
2161
+ /**
2162
+ * Close Collapsible
2163
+ * @param {Number} index - 0th index of slide
2164
+ */
2165
+
2166
+ }, {
2167
+ key: "close",
2168
+ value: function close(index) {
2169
+ var $collapsibleLi = this.$el.children('li').eq(index);
2170
+ if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) {
2171
+ // onCloseStart callback
2172
+ if (typeof this.options.onCloseStart === 'function') {
2173
+ this.options.onCloseStart.call(this, $collapsibleLi[0]);
2174
+ }
2175
+
2176
+ // Animate out
2177
+ $collapsibleLi[0].classList.remove('active');
2178
+ this._animateOut(index);
2179
+ }
2180
+ }
2181
+ }], [{
2182
+ key: "init",
2183
+ value: function init(els, options) {
2184
+ return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options);
2185
+ }
2186
+
2187
+ /**
2188
+ * Get Instance
2189
+ */
2190
+
2191
+ }, {
2192
+ key: "getInstance",
2193
+ value: function getInstance(el) {
2194
+ var domElem = !!el.jquery ? el[0] : el;
2195
+ return domElem.M_Collapsible;
2196
+ }
2197
+ }, {
2198
+ key: "defaults",
2199
+ get: function () {
2200
+ return _defaults;
2201
+ }
2202
+ }]);
2203
+
2204
+ return Collapsible;
2205
+ }(Component);
2206
+
2207
+ M.Collapsible = Collapsible;
2208
+
2209
+ if (M.jQueryLoaded) {
2210
+ M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible');
2211
+ }
2212
+ })(cash, M.anime);
2213
+ ;(function ($, anim) {
2214
+ 'use strict';
2215
+
2216
+ var _defaults = {
2217
+ alignment: 'left',
2218
+ autoFocus: true,
2219
+ constrainWidth: true,
2220
+ container: null,
2221
+ coverTrigger: true,
2222
+ closeOnClick: true,
2223
+ hover: false,
2224
+ inDuration: 150,
2225
+ outDuration: 250,
2226
+ onOpenStart: null,
2227
+ onOpenEnd: null,
2228
+ onCloseStart: null,
2229
+ onCloseEnd: null,
2230
+ onItemClick: null
2231
+ };
2232
+
2233
+ /**
2234
+ * @class
2235
+ */
2236
+
2237
+ var Dropdown = function (_Component2) {
2238
+ _inherits(Dropdown, _Component2);
2239
+
2240
+ function Dropdown(el, options) {
2241
+ _classCallCheck(this, Dropdown);
2242
+
2243
+ var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options));
2244
+
2245
+ _this9.el.M_Dropdown = _this9;
2246
+ Dropdown._dropdowns.push(_this9);
2247
+
2248
+ _this9.id = M.getIdFromTrigger(el);
2249
+ _this9.dropdownEl = document.getElementById(_this9.id);
2250
+ _this9.$dropdownEl = $(_this9.dropdownEl);
2251
+
2252
+ /**
2253
+ * Options for the dropdown
2254
+ * @member Dropdown#options
2255
+ * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to
2256
+ * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard
2257
+ * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button
2258
+ * @prop {Element} container - Container element to attach dropdown to (optional)
2259
+ * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger
2260
+ * @prop {Boolean} [closeOnClick=true] - Close on click of dropdown item
2261
+ * @prop {Boolean} [hover=false] - Open dropdown on hover
2262
+ * @prop {Number} [inDuration=150] - Duration of open animation in ms
2263
+ * @prop {Number} [outDuration=250] - Duration of close animation in ms
2264
+ * @prop {Function} onOpenStart - Function called when dropdown starts opening
2265
+ * @prop {Function} onOpenEnd - Function called when dropdown finishes opening
2266
+ * @prop {Function} onCloseStart - Function called when dropdown starts closing
2267
+ * @prop {Function} onCloseEnd - Function called when dropdown finishes closing
2268
+ */
2269
+ _this9.options = $.extend({}, Dropdown.defaults, options);
2270
+
2271
+ /**
2272
+ * Describes open/close state of dropdown
2273
+ * @type {Boolean}
2274
+ */
2275
+ _this9.isOpen = false;
2276
+
2277
+ /**
2278
+ * Describes if dropdown content is scrollable
2279
+ * @type {Boolean}
2280
+ */
2281
+ _this9.isScrollable = false;
2282
+
2283
+ /**
2284
+ * Describes if touch moving on dropdown content
2285
+ * @type {Boolean}
2286
+ */
2287
+ _this9.isTouchMoving = false;
2288
+
2289
+ _this9.focusedIndex = -1;
2290
+ _this9.filterQuery = [];
2291
+
2292
+ // Move dropdown-content after dropdown-trigger
2293
+ if (!!_this9.options.container) {
2294
+ $(_this9.options.container).append(_this9.dropdownEl);
2295
+ } else {
2296
+ _this9.$el.after(_this9.dropdownEl);
2297
+ }
2298
+
2299
+ _this9._makeDropdownFocusable();
2300
+ _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9);
2301
+ _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9);
2302
+ _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9);
2303
+ _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9);
2304
+ _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9);
2305
+ _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9);
2306
+ _this9._setupEventHandlers();
2307
+ return _this9;
2308
+ }
2309
+
2310
+ _createClass(Dropdown, [{
2311
+ key: "destroy",
2312
+
2313
+
2314
+ /**
2315
+ * Teardown component
2316
+ */
2317
+ value: function destroy() {
2318
+ this._resetDropdownStyles();
2319
+ this._removeEventHandlers();
2320
+ Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1);
2321
+ this.el.M_Dropdown = undefined;
2322
+ }
2323
+
2324
+ /**
2325
+ * Setup Event Handlers
2326
+ */
2327
+
2328
+ }, {
2329
+ key: "_setupEventHandlers",
2330
+ value: function _setupEventHandlers() {
2331
+ // Trigger keydown handler
2332
+ this.el.addEventListener('keydown', this._handleTriggerKeydownBound);
2333
+
2334
+ // Item click handler
2335
+ this.dropdownEl.addEventListener('click', this._handleDropdownClickBound);
2336
+
2337
+ // Hover event handlers
2338
+ if (this.options.hover) {
2339
+ this._handleMouseEnterBound = this._handleMouseEnter.bind(this);
2340
+ this.el.addEventListener('mouseenter', this._handleMouseEnterBound);
2341
+ this._handleMouseLeaveBound = this._handleMouseLeave.bind(this);
2342
+ this.el.addEventListener('mouseleave', this._handleMouseLeaveBound);
2343
+ this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound);
2344
+
2345
+ // Click event handlers
2346
+ } else {
2347
+ this._handleClickBound = this._handleClick.bind(this);
2348
+ this.el.addEventListener('click', this._handleClickBound);
2349
+ }
2350
+ }
2351
+
2352
+ /**
2353
+ * Remove Event Handlers
2354
+ */
2355
+
2356
+ }, {
2357
+ key: "_removeEventHandlers",
2358
+ value: function _removeEventHandlers() {
2359
+ this.el.removeEventListener('keydown', this._handleTriggerKeydownBound);
2360
+ this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound);
2361
+
2362
+ if (this.options.hover) {
2363
+ this.el.removeEventListener('mouseenter', this._handleMouseEnterBound);
2364
+ this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2365
+ this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2366
+ } else {
2367
+ this.el.removeEventListener('click', this._handleClickBound);
2368
+ }
2369
+ }
2370
+ }, {
2371
+ key: "_setupTemporaryEventHandlers",
2372
+ value: function _setupTemporaryEventHandlers() {
2373
+ // Use capture phase event handler to prevent click
2374
+ document.body.addEventListener('click', this._handleDocumentClickBound, true);
2375
+ document.body.addEventListener('touchend', this._handleDocumentClickBound);
2376
+ document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound);
2377
+ this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound);
2378
+ }
2379
+ }, {
2380
+ key: "_removeTemporaryEventHandlers",
2381
+ value: function _removeTemporaryEventHandlers() {
2382
+ // Use capture phase event handler to prevent click
2383
+ document.body.removeEventListener('click', this._handleDocumentClickBound, true);
2384
+ document.body.removeEventListener('touchend', this._handleDocumentClickBound);
2385
+ document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound);
2386
+ this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound);
2387
+ }
2388
+ }, {
2389
+ key: "_handleClick",
2390
+ value: function _handleClick(e) {
2391
+ e.preventDefault();
2392
+ this.open();
2393
+ }
2394
+ }, {
2395
+ key: "_handleMouseEnter",
2396
+ value: function _handleMouseEnter() {
2397
+ this.open();
2398
+ }
2399
+ }, {
2400
+ key: "_handleMouseLeave",
2401
+ value: function _handleMouseLeave(e) {
2402
+ var toEl = e.toElement || e.relatedTarget;
2403
+ var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length;
2404
+ var leaveToActiveDropdownTrigger = false;
2405
+
2406
+ var $closestTrigger = $(toEl).closest('.dropdown-trigger');
2407
+ if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) {
2408
+ leaveToActiveDropdownTrigger = true;
2409
+ }
2410
+
2411
+ // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content
2412
+ if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) {
2413
+ this.close();
2414
+ }
2415
+ }
2416
+ }, {
2417
+ key: "_handleDocumentClick",
2418
+ value: function _handleDocumentClick(e) {
2419
+ var _this10 = this;
2420
+
2421
+ var $target = $(e.target);
2422
+ if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) {
2423
+ // isTouchMoving to check if scrolling on mobile.
2424
+ setTimeout(function () {
2425
+ _this10.close();
2426
+ }, 0);
2427
+ } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) {
2428
+ setTimeout(function () {
2429
+ _this10.close();
2430
+ }, 0);
2431
+ }
2432
+ this.isTouchMoving = false;
2433
+ }
2434
+ }, {
2435
+ key: "_handleTriggerKeydown",
2436
+ value: function _handleTriggerKeydown(e) {
2437
+ // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown
2438
+ if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) {
2439
+ e.preventDefault();
2440
+ this.open();
2441
+ }
2442
+ }
2443
+
2444
+ /**
2445
+ * Handle Document Touchmove
2446
+ * @param {Event} e
2447
+ */
2448
+
2449
+ }, {
2450
+ key: "_handleDocumentTouchmove",
2451
+ value: function _handleDocumentTouchmove(e) {
2452
+ var $target = $(e.target);
2453
+ if ($target.closest('.dropdown-content').length) {
2454
+ this.isTouchMoving = true;
2455
+ }
2456
+ }
2457
+
2458
+ /**
2459
+ * Handle Dropdown Click
2460
+ * @param {Event} e
2461
+ */
2462
+
2463
+ }, {
2464
+ key: "_handleDropdownClick",
2465
+ value: function _handleDropdownClick(e) {
2466
+ // onItemClick callback
2467
+ if (typeof this.options.onItemClick === 'function') {
2468
+ var itemEl = $(e.target).closest('li')[0];
2469
+ this.options.onItemClick.call(this, itemEl);
2470
+ }
2471
+ }
2472
+
2473
+ /**
2474
+ * Handle Dropdown Keydown
2475
+ * @param {Event} e
2476
+ */
2477
+
2478
+ }, {
2479
+ key: "_handleDropdownKeydown",
2480
+ value: function _handleDropdownKeydown(e) {
2481
+ if (e.which === M.keys.TAB) {
2482
+ e.preventDefault();
2483
+ this.close();
2484
+
2485
+ // Navigate down dropdown list
2486
+ } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) {
2487
+ e.preventDefault();
2488
+ var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1;
2489
+ var newFocusedIndex = this.focusedIndex;
2490
+ var foundNewIndex = false;
2491
+ do {
2492
+ newFocusedIndex = newFocusedIndex + direction;
2493
+
2494
+ if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) {
2495
+ foundNewIndex = true;
2496
+ break;
2497
+ }
2498
+ } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0);
2499
+
2500
+ if (foundNewIndex) {
2501
+ this.focusedIndex = newFocusedIndex;
2502
+ this._focusFocusedItem();
2503
+ }
2504
+
2505
+ // ENTER selects choice on focused item
2506
+ } else if (e.which === M.keys.ENTER && this.isOpen) {
2507
+ // Search for <a> and <button>
2508
+ var focusedElement = this.dropdownEl.children[this.focusedIndex];
2509
+ var $activatableElement = $(focusedElement).find('a, button').first();
2510
+
2511
+ // Click a or button tag if exists, otherwise click li tag
2512
+ if (!!$activatableElement.length) {
2513
+ $activatableElement[0].click();
2514
+ } else if (!!focusedElement) {
2515
+ focusedElement.click();
2516
+ }
2517
+
2518
+ // Close dropdown on ESC
2519
+ } else if (e.which === M.keys.ESC && this.isOpen) {
2520
+ e.preventDefault();
2521
+ this.close();
2522
+ }
2523
+
2524
+ // CASE WHEN USER TYPE LETTERS
2525
+ var letter = String.fromCharCode(e.which).toLowerCase(),
2526
+ nonLetters = [9, 13, 27, 38, 40];
2527
+ if (letter && nonLetters.indexOf(e.which) === -1) {
2528
+ this.filterQuery.push(letter);
2529
+
2530
+ var string = this.filterQuery.join(''),
2531
+ newOptionEl = $(this.dropdownEl).find('li').filter(function (el) {
2532
+ return $(el).text().toLowerCase().indexOf(string) === 0;
2533
+ })[0];
2534
+
2535
+ if (newOptionEl) {
2536
+ this.focusedIndex = $(newOptionEl).index();
2537
+ this._focusFocusedItem();
2538
+ }
2539
+ }
2540
+
2541
+ this.filterTimeout = setTimeout(this._resetFilterQueryBound, 1000);
2542
+ }
2543
+
2544
+ /**
2545
+ * Setup dropdown
2546
+ */
2547
+
2548
+ }, {
2549
+ key: "_resetFilterQuery",
2550
+ value: function _resetFilterQuery() {
2551
+ this.filterQuery = [];
2552
+ }
2553
+ }, {
2554
+ key: "_resetDropdownStyles",
2555
+ value: function _resetDropdownStyles() {
2556
+ this.$dropdownEl.css({
2557
+ display: '',
2558
+ width: '',
2559
+ height: '',
2560
+ left: '',
2561
+ top: '',
2562
+ 'transform-origin': '',
2563
+ transform: '',
2564
+ opacity: ''
2565
+ });
2566
+ }
2567
+ }, {
2568
+ key: "_makeDropdownFocusable",
2569
+ value: function _makeDropdownFocusable() {
2570
+ // Needed for arrow key navigation
2571
+ this.dropdownEl.tabIndex = 0;
2572
+
2573
+ // Only set tabindex if it hasn't been set by user
2574
+ $(this.dropdownEl).children().each(function (el) {
2575
+ if (!el.getAttribute('tabindex')) {
2576
+ el.setAttribute('tabindex', 0);
2577
+ }
2578
+ });
2579
+ }
2580
+ }, {
2581
+ key: "_focusFocusedItem",
2582
+ value: function _focusFocusedItem() {
2583
+ if (this.focusedIndex >= 0 && this.focusedIndex < this.dropdownEl.children.length && this.options.autoFocus) {
2584
+ this.dropdownEl.children[this.focusedIndex].focus();
2585
+ }
2586
+ }
2587
+ }, {
2588
+ key: "_getDropdownPosition",
2589
+ value: function _getDropdownPosition() {
2590
+ var offsetParentBRect = this.el.offsetParent.getBoundingClientRect();
2591
+ var triggerBRect = this.el.getBoundingClientRect();
2592
+ var dropdownBRect = this.dropdownEl.getBoundingClientRect();
2593
+
2594
+ var idealHeight = dropdownBRect.height;
2595
+ var idealWidth = dropdownBRect.width;
2596
+ var idealXPos = triggerBRect.left - dropdownBRect.left;
2597
+ var idealYPos = triggerBRect.top - dropdownBRect.top;
2598
+
2599
+ var dropdownBounds = {
2600
+ left: idealXPos,
2601
+ top: idealYPos,
2602
+ height: idealHeight,
2603
+ width: idealWidth
2604
+ };
2605
+
2606
+ // Countainer here will be closest ancestor with overflow: hidden
2607
+ var closestOverflowParent = !!this.dropdownEl.offsetParent ? this.dropdownEl.offsetParent : this.dropdownEl.parentNode;
2608
+
2609
+ var alignments = M.checkPossibleAlignments(this.el, closestOverflowParent, dropdownBounds, this.options.coverTrigger ? 0 : triggerBRect.height);
2610
+
2611
+ var verticalAlignment = 'top';
2612
+ var horizontalAlignment = this.options.alignment;
2613
+ idealYPos += this.options.coverTrigger ? 0 : triggerBRect.height;
2614
+
2615
+ // Reset isScrollable
2616
+ this.isScrollable = false;
2617
+
2618
+ if (!alignments.top) {
2619
+ if (alignments.bottom) {
2620
+ verticalAlignment = 'bottom';
2621
+ } else {
2622
+ this.isScrollable = true;
2623
+
2624
+ // Determine which side has most space and cutoff at correct height
2625
+ if (alignments.spaceOnTop > alignments.spaceOnBottom) {
2626
+ verticalAlignment = 'bottom';
2627
+ idealHeight += alignments.spaceOnTop;
2628
+ idealYPos -= alignments.spaceOnTop;
2629
+ } else {
2630
+ idealHeight += alignments.spaceOnBottom;
2631
+ }
2632
+ }
2633
+ }
2634
+
2635
+ // If preferred horizontal alignment is possible
2636
+ if (!alignments[horizontalAlignment]) {
2637
+ var oppositeAlignment = horizontalAlignment === 'left' ? 'right' : 'left';
2638
+ if (alignments[oppositeAlignment]) {
2639
+ horizontalAlignment = oppositeAlignment;
2640
+ } else {
2641
+ // Determine which side has most space and cutoff at correct height
2642
+ if (alignments.spaceOnLeft > alignments.spaceOnRight) {
2643
+ horizontalAlignment = 'right';
2644
+ idealWidth += alignments.spaceOnLeft;
2645
+ idealXPos -= alignments.spaceOnLeft;
2646
+ } else {
2647
+ horizontalAlignment = 'left';
2648
+ idealWidth += alignments.spaceOnRight;
2649
+ }
2650
+ }
2651
+ }
2652
+
2653
+ if (verticalAlignment === 'bottom') {
2654
+ idealYPos = idealYPos - dropdownBRect.height + (this.options.coverTrigger ? triggerBRect.height : 0);
2655
+ }
2656
+ if (horizontalAlignment === 'right') {
2657
+ idealXPos = idealXPos - dropdownBRect.width + triggerBRect.width;
2658
+ }
2659
+ return {
2660
+ x: idealXPos,
2661
+ y: idealYPos,
2662
+ verticalAlignment: verticalAlignment,
2663
+ horizontalAlignment: horizontalAlignment,
2664
+ height: idealHeight,
2665
+ width: idealWidth
2666
+ };
2667
+ }
2668
+
2669
+ /**
2670
+ * Animate in dropdown
2671
+ */
2672
+
2673
+ }, {
2674
+ key: "_animateIn",
2675
+ value: function _animateIn() {
2676
+ var _this11 = this;
2677
+
2678
+ anim.remove(this.dropdownEl);
2679
+ anim({
2680
+ targets: this.dropdownEl,
2681
+ opacity: {
2682
+ value: [0, 1],
2683
+ easing: 'easeOutQuad'
2684
+ },
2685
+ scaleX: [0.3, 1],
2686
+ scaleY: [0.3, 1],
2687
+ duration: this.options.inDuration,
2688
+ easing: 'easeOutQuint',
2689
+ complete: function (anim) {
2690
+ if (_this11.options.autoFocus) {
2691
+ _this11.dropdownEl.focus();
2692
+ }
2693
+
2694
+ // onOpenEnd callback
2695
+ if (typeof _this11.options.onOpenEnd === 'function') {
2696
+ _this11.options.onOpenEnd.call(_this11, _this11.el);
2697
+ }
2698
+ }
2699
+ });
2700
+ }
2701
+
2702
+ /**
2703
+ * Animate out dropdown
2704
+ */
2705
+
2706
+ }, {
2707
+ key: "_animateOut",
2708
+ value: function _animateOut() {
2709
+ var _this12 = this;
2710
+
2711
+ anim.remove(this.dropdownEl);
2712
+ anim({
2713
+ targets: this.dropdownEl,
2714
+ opacity: {
2715
+ value: 0,
2716
+ easing: 'easeOutQuint'
2717
+ },
2718
+ scaleX: 0.3,
2719
+ scaleY: 0.3,
2720
+ duration: this.options.outDuration,
2721
+ easing: 'easeOutQuint',
2722
+ complete: function (anim) {
2723
+ _this12._resetDropdownStyles();
2724
+
2725
+ // onCloseEnd callback
2726
+ if (typeof _this12.options.onCloseEnd === 'function') {
2727
+ _this12.options.onCloseEnd.call(_this12, _this12.el);
2728
+ }
2729
+ }
2730
+ });
2731
+ }
2732
+
2733
+ /**
2734
+ * Place dropdown
2735
+ */
2736
+
2737
+ }, {
2738
+ key: "_placeDropdown",
2739
+ value: function _placeDropdown() {
2740
+ // Set width before calculating positionInfo
2741
+ var idealWidth = this.options.constrainWidth ? this.el.getBoundingClientRect().width : this.dropdownEl.getBoundingClientRect().width;
2742
+ this.dropdownEl.style.width = idealWidth + 'px';
2743
+
2744
+ var positionInfo = this._getDropdownPosition();
2745
+ this.dropdownEl.style.left = positionInfo.x + 'px';
2746
+ this.dropdownEl.style.top = positionInfo.y + 'px';
2747
+ this.dropdownEl.style.height = positionInfo.height + 'px';
2748
+ this.dropdownEl.style.width = positionInfo.width + 'px';
2749
+ this.dropdownEl.style.transformOrigin = (positionInfo.horizontalAlignment === 'left' ? '0' : '100%') + " " + (positionInfo.verticalAlignment === 'top' ? '0' : '100%');
2750
+ }
2751
+
2752
+ /**
2753
+ * Open Dropdown
2754
+ */
2755
+
2756
+ }, {
2757
+ key: "open",
2758
+ value: function open() {
2759
+ if (this.isOpen) {
2760
+ return;
2761
+ }
2762
+ this.isOpen = true;
2763
+
2764
+ // onOpenStart callback
2765
+ if (typeof this.options.onOpenStart === 'function') {
2766
+ this.options.onOpenStart.call(this, this.el);
2767
+ }
2768
+
2769
+ // Reset styles
2770
+ this._resetDropdownStyles();
2771
+ this.dropdownEl.style.display = 'block';
2772
+
2773
+ this._placeDropdown();
2774
+ this._animateIn();
2775
+ this._setupTemporaryEventHandlers();
2776
+ }
2777
+
2778
+ /**
2779
+ * Close Dropdown
2780
+ */
2781
+
2782
+ }, {
2783
+ key: "close",
2784
+ value: function close() {
2785
+ if (!this.isOpen) {
2786
+ return;
2787
+ }
2788
+ this.isOpen = false;
2789
+ this.focusedIndex = -1;
2790
+
2791
+ // onCloseStart callback
2792
+ if (typeof this.options.onCloseStart === 'function') {
2793
+ this.options.onCloseStart.call(this, this.el);
2794
+ }
2795
+
2796
+ this._animateOut();
2797
+ this._removeTemporaryEventHandlers();
2798
+
2799
+ if (this.options.autoFocus) {
2800
+ this.el.focus();
2801
+ }
2802
+ }
2803
+
2804
+ /**
2805
+ * Recalculate dimensions
2806
+ */
2807
+
2808
+ }, {
2809
+ key: "recalculateDimensions",
2810
+ value: function recalculateDimensions() {
2811
+ if (this.isOpen) {
2812
+ this.$dropdownEl.css({
2813
+ width: '',
2814
+ height: '',
2815
+ left: '',
2816
+ top: '',
2817
+ 'transform-origin': ''
2818
+ });
2819
+ this._placeDropdown();
2820
+ }
2821
+ }
2822
+ }], [{
2823
+ key: "init",
2824
+ value: function init(els, options) {
2825
+ return _get(Dropdown.__proto__ || Object.getPrototypeOf(Dropdown), "init", this).call(this, this, els, options);
2826
+ }
2827
+
2828
+ /**
2829
+ * Get Instance
2830
+ */
2831
+
2832
+ }, {
2833
+ key: "getInstance",
2834
+ value: function getInstance(el) {
2835
+ var domElem = !!el.jquery ? el[0] : el;
2836
+ return domElem.M_Dropdown;
2837
+ }
2838
+ }, {
2839
+ key: "defaults",
2840
+ get: function () {
2841
+ return _defaults;
2842
+ }
2843
+ }]);
2844
+
2845
+ return Dropdown;
2846
+ }(Component);
2847
+
2848
+ /**
2849
+ * @static
2850
+ * @memberof Dropdown
2851
+ */
2852
+
2853
+
2854
+ Dropdown._dropdowns = [];
2855
+
2856
+ M.Dropdown = Dropdown;
2857
+
2858
+ if (M.jQueryLoaded) {
2859
+ M.initializeJqueryWrapper(Dropdown, 'dropdown', 'M_Dropdown');
2860
+ }
2861
+ })(cash, M.anime);
2862
+ ;(function ($, anim) {
2863
+ 'use strict';
2864
+
2865
+ var _defaults = {
2866
+ opacity: 0.5,
2867
+ inDuration: 250,
2868
+ outDuration: 250,
2869
+ onOpenStart: null,
2870
+ onOpenEnd: null,
2871
+ onCloseStart: null,
2872
+ onCloseEnd: null,
2873
+ preventScrolling: true,
2874
+ dismissible: true,
2875
+ startingTop: '4%',
2876
+ endingTop: '10%'
2877
+ };
2878
+
2879
+ /**
2880
+ * @class
2881
+ *
2882
+ */
2883
+
2884
+ var Modal = function (_Component3) {
2885
+ _inherits(Modal, _Component3);
2886
+
2887
+ /**
2888
+ * Construct Modal instance and set up overlay
2889
+ * @constructor
2890
+ * @param {Element} el
2891
+ * @param {Object} options
2892
+ */
2893
+ function Modal(el, options) {
2894
+ _classCallCheck(this, Modal);
2895
+
2896
+ var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
2897
+
2898
+ _this13.el.M_Modal = _this13;
2899
+
2900
+ /**
2901
+ * Options for the modal
2902
+ * @member Modal#options
2903
+ * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
2904
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
2905
+ * @prop {Number} [outDuration=250] - Length in ms of exit transition
2906
+ * @prop {Function} onOpenStart - Callback function called before modal is opened
2907
+ * @prop {Function} onOpenEnd - Callback function called after modal is opened
2908
+ * @prop {Function} onCloseStart - Callback function called before modal is closed
2909
+ * @prop {Function} onCloseEnd - Callback function called after modal is closed
2910
+ * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
2911
+ * @prop {String} [startingTop='4%'] - startingTop
2912
+ * @prop {String} [endingTop='10%'] - endingTop
2913
+ */
2914
+ _this13.options = $.extend({}, Modal.defaults, options);
2915
+
2916
+ /**
2917
+ * Describes open/close state of modal
2918
+ * @type {Boolean}
2919
+ */
2920
+ _this13.isOpen = false;
2921
+
2922
+ _this13.id = _this13.$el.attr('id');
2923
+ _this13._openingTrigger = undefined;
2924
+ _this13.$overlay = $('<div class="modal-overlay"></div>');
2925
+ _this13.el.tabIndex = 0;
2926
+ _this13._nthModalOpened = 0;
2927
+
2928
+ Modal._count++;
2929
+ _this13._setupEventHandlers();
2930
+ return _this13;
2931
+ }
2932
+
2933
+ _createClass(Modal, [{
2934
+ key: "destroy",
2935
+
2936
+
2937
+ /**
2938
+ * Teardown component
2939
+ */
2940
+ value: function destroy() {
2941
+ Modal._count--;
2942
+ this._removeEventHandlers();
2943
+ this.el.removeAttribute('style');
2944
+ this.$overlay.remove();
2945
+ this.el.M_Modal = undefined;
2946
+ }
2947
+
2948
+ /**
2949
+ * Setup Event Handlers
2950
+ */
2951
+
2952
+ }, {
2953
+ key: "_setupEventHandlers",
2954
+ value: function _setupEventHandlers() {
2955
+ this._handleOverlayClickBound = this._handleOverlayClick.bind(this);
2956
+ this._handleModalCloseClickBound = this._handleModalCloseClick.bind(this);
2957
+
2958
+ if (Modal._count === 1) {
2959
+ document.body.addEventListener('click', this._handleTriggerClick);
2960
+ }
2961
+ this.$overlay[0].addEventListener('click', this._handleOverlayClickBound);
2962
+ this.el.addEventListener('click', this._handleModalCloseClickBound);
2963
+ }
2964
+
2965
+ /**
2966
+ * Remove Event Handlers
2967
+ */
2968
+
2969
+ }, {
2970
+ key: "_removeEventHandlers",
2971
+ value: function _removeEventHandlers() {
2972
+ if (Modal._count === 0) {
2973
+ document.body.removeEventListener('click', this._handleTriggerClick);
2974
+ }
2975
+ this.$overlay[0].removeEventListener('click', this._handleOverlayClickBound);
2976
+ this.el.removeEventListener('click', this._handleModalCloseClickBound);
2977
+ }
2978
+
2979
+ /**
2980
+ * Handle Trigger Click
2981
+ * @param {Event} e
2982
+ */
2983
+
2984
+ }, {
2985
+ key: "_handleTriggerClick",
2986
+ value: function _handleTriggerClick(e) {
2987
+ var $trigger = $(e.target).closest('.modal-trigger');
2988
+ if ($trigger.length) {
2989
+ var modalId = M.getIdFromTrigger($trigger[0]);
2990
+ var modalInstance = document.getElementById(modalId).M_Modal;
2991
+ if (modalInstance) {
2992
+ modalInstance.open($trigger);
2993
+ }
2994
+ e.preventDefault();
2995
+ }
2996
+ }
2997
+
2998
+ /**
2999
+ * Handle Overlay Click
3000
+ */
3001
+
3002
+ }, {
3003
+ key: "_handleOverlayClick",
3004
+ value: function _handleOverlayClick() {
3005
+ if (this.options.dismissible) {
3006
+ this.close();
3007
+ }
3008
+ }
3009
+
3010
+ /**
3011
+ * Handle Modal Close Click
3012
+ * @param {Event} e
3013
+ */
3014
+
3015
+ }, {
3016
+ key: "_handleModalCloseClick",
3017
+ value: function _handleModalCloseClick(e) {
3018
+ var $closeTrigger = $(e.target).closest('.modal-close');
3019
+ if ($closeTrigger.length) {
3020
+ this.close();
3021
+ }
3022
+ }
3023
+
3024
+ /**
3025
+ * Handle Keydown
3026
+ * @param {Event} e
3027
+ */
3028
+
3029
+ }, {
3030
+ key: "_handleKeydown",
3031
+ value: function _handleKeydown(e) {
3032
+ // ESC key
3033
+ if (e.keyCode === 27 && this.options.dismissible) {
3034
+ this.close();
3035
+ }
3036
+ }
3037
+
3038
+ /**
3039
+ * Handle Focus
3040
+ * @param {Event} e
3041
+ */
3042
+
3043
+ }, {
3044
+ key: "_handleFocus",
3045
+ value: function _handleFocus(e) {
3046
+ // Only trap focus if this modal is the last model opened (prevents loops in nested modals).
3047
+ if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
3048
+ this.el.focus();
3049
+ }
3050
+ }
3051
+
3052
+ /**
3053
+ * Animate in modal
3054
+ */
3055
+
3056
+ }, {
3057
+ key: "_animateIn",
3058
+ value: function _animateIn() {
3059
+ var _this14 = this;
3060
+
3061
+ // Set initial styles
3062
+ $.extend(this.el.style, {
3063
+ display: 'block',
3064
+ opacity: 0
3065
+ });
3066
+ $.extend(this.$overlay[0].style, {
3067
+ display: 'block',
3068
+ opacity: 0
3069
+ });
3070
+
3071
+ // Animate overlay
3072
+ anim({
3073
+ targets: this.$overlay[0],
3074
+ opacity: this.options.opacity,
3075
+ duration: this.options.inDuration,
3076
+ easing: 'easeOutQuad'
3077
+ });
3078
+
3079
+ // Define modal animation options
3080
+ var enterAnimOptions = {
3081
+ targets: this.el,
3082
+ duration: this.options.inDuration,
3083
+ easing: 'easeOutCubic',
3084
+ // Handle modal onOpenEnd callback
3085
+ complete: function () {
3086
+ if (typeof _this14.options.onOpenEnd === 'function') {
3087
+ _this14.options.onOpenEnd.call(_this14, _this14.el, _this14._openingTrigger);
3088
+ }
3089
+ }
3090
+ };
3091
+
3092
+ // Bottom sheet animation
3093
+ if (this.el.classList.contains('bottom-sheet')) {
3094
+ $.extend(enterAnimOptions, {
3095
+ bottom: 0,
3096
+ opacity: 1
3097
+ });
3098
+ anim(enterAnimOptions);
3099
+
3100
+ // Normal modal animation
3101
+ } else {
3102
+ $.extend(enterAnimOptions, {
3103
+ top: [this.options.startingTop, this.options.endingTop],
3104
+ opacity: 1,
3105
+ scaleX: [0.8, 1],
3106
+ scaleY: [0.8, 1]
3107
+ });
3108
+ anim(enterAnimOptions);
3109
+ }
3110
+ }
3111
+
3112
+ /**
3113
+ * Animate out modal
3114
+ */
3115
+
3116
+ }, {
3117
+ key: "_animateOut",
3118
+ value: function _animateOut() {
3119
+ var _this15 = this;
3120
+
3121
+ // Animate overlay
3122
+ anim({
3123
+ targets: this.$overlay[0],
3124
+ opacity: 0,
3125
+ duration: this.options.outDuration,
3126
+ easing: 'easeOutQuart'
3127
+ });
3128
+
3129
+ // Define modal animation options
3130
+ var exitAnimOptions = {
3131
+ targets: this.el,
3132
+ duration: this.options.outDuration,
3133
+ easing: 'easeOutCubic',
3134
+ // Handle modal ready callback
3135
+ complete: function () {
3136
+ _this15.el.style.display = 'none';
3137
+ _this15.$overlay.remove();
3138
+
3139
+ // Call onCloseEnd callback
3140
+ if (typeof _this15.options.onCloseEnd === 'function') {
3141
+ _this15.options.onCloseEnd.call(_this15, _this15.el);
3142
+ }
3143
+ }
3144
+ };
3145
+
3146
+ // Bottom sheet animation
3147
+ if (this.el.classList.contains('bottom-sheet')) {
3148
+ $.extend(exitAnimOptions, {
3149
+ bottom: '-100%',
3150
+ opacity: 0
3151
+ });
3152
+ anim(exitAnimOptions);
3153
+
3154
+ // Normal modal animation
3155
+ } else {
3156
+ $.extend(exitAnimOptions, {
3157
+ top: [this.options.endingTop, this.options.startingTop],
3158
+ opacity: 0,
3159
+ scaleX: 0.8,
3160
+ scaleY: 0.8
3161
+ });
3162
+ anim(exitAnimOptions);
3163
+ }
3164
+ }
3165
+
3166
+ /**
3167
+ * Open Modal
3168
+ * @param {cash} [$trigger]
3169
+ */
3170
+
3171
+ }, {
3172
+ key: "open",
3173
+ value: function open($trigger) {
3174
+ if (this.isOpen) {
3175
+ return;
3176
+ }
3177
+
3178
+ this.isOpen = true;
3179
+ Modal._modalsOpen++;
3180
+ this._nthModalOpened = Modal._modalsOpen;
3181
+
3182
+ // Set Z-Index based on number of currently open modals
3183
+ this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
3184
+ this.el.style.zIndex = 1000 + Modal._modalsOpen * 2 + 1;
3185
+
3186
+ // Set opening trigger, undefined indicates modal was opened by javascript
3187
+ this._openingTrigger = !!$trigger ? $trigger[0] : undefined;
3188
+
3189
+ // onOpenStart callback
3190
+ if (typeof this.options.onOpenStart === 'function') {
3191
+ this.options.onOpenStart.call(this, this.el, this._openingTrigger);
3192
+ }
3193
+
3194
+ if (this.options.preventScrolling) {
3195
+ document.body.style.overflow = 'hidden';
3196
+ }
3197
+
3198
+ this.el.classList.add('open');
3199
+ this.el.insertAdjacentElement('afterend', this.$overlay[0]);
3200
+
3201
+ if (this.options.dismissible) {
3202
+ this._handleKeydownBound = this._handleKeydown.bind(this);
3203
+ this._handleFocusBound = this._handleFocus.bind(this);
3204
+ document.addEventListener('keydown', this._handleKeydownBound);
3205
+ document.addEventListener('focus', this._handleFocusBound, true);
3206
+ }
3207
+
3208
+ anim.remove(this.el);
3209
+ anim.remove(this.$overlay[0]);
3210
+ this._animateIn();
3211
+
3212
+ // Focus modal
3213
+ this.el.focus();
3214
+
3215
+ return this;
3216
+ }
3217
+
3218
+ /**
3219
+ * Close Modal
3220
+ */
3221
+
3222
+ }, {
3223
+ key: "close",
3224
+ value: function close() {
3225
+ if (!this.isOpen) {
3226
+ return;
3227
+ }
3228
+
3229
+ this.isOpen = false;
3230
+ Modal._modalsOpen--;
3231
+ this._nthModalOpened = 0;
3232
+
3233
+ // Call onCloseStart callback
3234
+ if (typeof this.options.onCloseStart === 'function') {
3235
+ this.options.onCloseStart.call(this, this.el);
3236
+ }
3237
+
3238
+ this.el.classList.remove('open');
3239
+
3240
+ // Enable body scrolling only if there are no more modals open.
3241
+ if (Modal._modalsOpen === 0) {
3242
+ document.body.style.overflow = '';
3243
+ }
3244
+
3245
+ if (this.options.dismissible) {
3246
+ document.removeEventListener('keydown', this._handleKeydownBound);
3247
+ document.removeEventListener('focus', this._handleFocusBound, true);
3248
+ }
3249
+
3250
+ anim.remove(this.el);
3251
+ anim.remove(this.$overlay[0]);
3252
+ this._animateOut();
3253
+ return this;
3254
+ }
3255
+ }], [{
3256
+ key: "init",
3257
+ value: function init(els, options) {
3258
+ return _get(Modal.__proto__ || Object.getPrototypeOf(Modal), "init", this).call(this, this, els, options);
3259
+ }
3260
+
3261
+ /**
3262
+ * Get Instance
3263
+ */
3264
+
3265
+ }, {
3266
+ key: "getInstance",
3267
+ value: function getInstance(el) {
3268
+ var domElem = !!el.jquery ? el[0] : el;
3269
+ return domElem.M_Modal;
3270
+ }
3271
+ }, {
3272
+ key: "defaults",
3273
+ get: function () {
3274
+ return _defaults;
3275
+ }
3276
+ }]);
3277
+
3278
+ return Modal;
3279
+ }(Component);
3280
+
3281
+ /**
3282
+ * @static
3283
+ * @memberof Modal
3284
+ */
3285
+
3286
+
3287
+ Modal._modalsOpen = 0;
3288
+
3289
+ /**
3290
+ * @static
3291
+ * @memberof Modal
3292
+ */
3293
+ Modal._count = 0;
3294
+
3295
+ M.Modal = Modal;
3296
+
3297
+ if (M.jQueryLoaded) {
3298
+ M.initializeJqueryWrapper(Modal, 'modal', 'M_Modal');
3299
+ }
3300
+ })(cash, M.anime);
3301
+ ;(function ($, anim) {
3302
+ 'use strict';
3303
+
3304
+ var _defaults = {
3305
+ inDuration: 275,
3306
+ outDuration: 200,
3307
+ onOpenStart: null,
3308
+ onOpenEnd: null,
3309
+ onCloseStart: null,
3310
+ onCloseEnd: null
3311
+ };
3312
+
3313
+ /**
3314
+ * @class
3315
+ *
3316
+ */
3317
+
3318
+ var Materialbox = function (_Component4) {
3319
+ _inherits(Materialbox, _Component4);
3320
+
3321
+ /**
3322
+ * Construct Materialbox instance
3323
+ * @constructor
3324
+ * @param {Element} el
3325
+ * @param {Object} options
3326
+ */
3327
+ function Materialbox(el, options) {
3328
+ _classCallCheck(this, Materialbox);
3329
+
3330
+ var _this16 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
3331
+
3332
+ _this16.el.M_Materialbox = _this16;
3333
+
3334
+ /**
3335
+ * Options for the modal
3336
+ * @member Materialbox#options
3337
+ * @prop {Number} [inDuration=275] - Length in ms of enter transition
3338
+ * @prop {Number} [outDuration=200] - Length in ms of exit transition
3339
+ * @prop {Function} onOpenStart - Callback function called before materialbox is opened
3340
+ * @prop {Function} onOpenEnd - Callback function called after materialbox is opened
3341
+ * @prop {Function} onCloseStart - Callback function called before materialbox is closed
3342
+ * @prop {Function} onCloseEnd - Callback function called after materialbox is closed
3343
+ */
3344
+ _this16.options = $.extend({}, Materialbox.defaults, options);
3345
+
3346
+ _this16.overlayActive = false;
3347
+ _this16.doneAnimating = true;
3348
+ _this16.placeholder = $('<div></div>').addClass('material-placeholder');
3349
+ _this16.originalWidth = 0;
3350
+ _this16.originalHeight = 0;
3351
+ _this16.originInlineStyles = _this16.$el.attr('style');
3352
+ _this16.caption = _this16.el.getAttribute('data-caption') || '';
3353
+
3354
+ // Wrap
3355
+ _this16.$el.before(_this16.placeholder);
3356
+ _this16.placeholder.append(_this16.$el);
3357
+
3358
+ _this16._setupEventHandlers();
3359
+ return _this16;
3360
+ }
3361
+
3362
+ _createClass(Materialbox, [{
3363
+ key: "destroy",
3364
+
3365
+
3366
+ /**
3367
+ * Teardown component
3368
+ */
3369
+ value: function destroy() {
3370
+ this._removeEventHandlers();
3371
+ this.el.M_Materialbox = undefined;
3372
+
3373
+ // Unwrap image
3374
+ $(this.placeholder).after(this.el).remove();
3375
+
3376
+ this.$el.removeAttr('style');
3377
+ }
3378
+
3379
+ /**
3380
+ * Setup Event Handlers
3381
+ */
3382
+
3383
+ }, {
3384
+ key: "_setupEventHandlers",
3385
+ value: function _setupEventHandlers() {
3386
+ this._handleMaterialboxClickBound = this._handleMaterialboxClick.bind(this);
3387
+ this.el.addEventListener('click', this._handleMaterialboxClickBound);
3388
+ }
3389
+
3390
+ /**
3391
+ * Remove Event Handlers
3392
+ */
3393
+
3394
+ }, {
3395
+ key: "_removeEventHandlers",
3396
+ value: function _removeEventHandlers() {
3397
+ this.el.removeEventListener('click', this._handleMaterialboxClickBound);
3398
+ }
3399
+
3400
+ /**
3401
+ * Handle Materialbox Click
3402
+ * @param {Event} e
3403
+ */
3404
+
3405
+ }, {
3406
+ key: "_handleMaterialboxClick",
3407
+ value: function _handleMaterialboxClick(e) {
3408
+ // If already modal, return to original
3409
+ if (this.doneAnimating === false || this.overlayActive && this.doneAnimating) {
3410
+ this.close();
3411
+ } else {
3412
+ this.open();
3413
+ }
3414
+ }
3415
+
3416
+ /**
3417
+ * Handle Window Scroll
3418
+ */
3419
+
3420
+ }, {
3421
+ key: "_handleWindowScroll",
3422
+ value: function _handleWindowScroll() {
3423
+ if (this.overlayActive) {
3424
+ this.close();
3425
+ }
3426
+ }
3427
+
3428
+ /**
3429
+ * Handle Window Resize
3430
+ */
3431
+
3432
+ }, {
3433
+ key: "_handleWindowResize",
3434
+ value: function _handleWindowResize() {
3435
+ if (this.overlayActive) {
3436
+ this.close();
3437
+ }
3438
+ }
3439
+
3440
+ /**
3441
+ * Handle Window Resize
3442
+ * @param {Event} e
3443
+ */
3444
+
3445
+ }, {
3446
+ key: "_handleWindowEscape",
3447
+ value: function _handleWindowEscape(e) {
3448
+ // ESC key
3449
+ if (e.keyCode === 27 && this.doneAnimating && this.overlayActive) {
3450
+ this.close();
3451
+ }
3452
+ }
3453
+
3454
+ /**
3455
+ * Find ancestors with overflow: hidden; and make visible
3456
+ */
3457
+
3458
+ }, {
3459
+ key: "_makeAncestorsOverflowVisible",
3460
+ value: function _makeAncestorsOverflowVisible() {
3461
+ this.ancestorsChanged = $();
3462
+ var ancestor = this.placeholder[0].parentNode;
3463
+ while (ancestor !== null && !$(ancestor).is(document)) {
3464
+ var curr = $(ancestor);
3465
+ if (curr.css('overflow') !== 'visible') {
3466
+ curr.css('overflow', 'visible');
3467
+ if (this.ancestorsChanged === undefined) {
3468
+ this.ancestorsChanged = curr;
3469
+ } else {
3470
+ this.ancestorsChanged = this.ancestorsChanged.add(curr);
3471
+ }
3472
+ }
3473
+ ancestor = ancestor.parentNode;
3474
+ }
3475
+ }
3476
+
3477
+ /**
3478
+ * Animate image in
3479
+ */
3480
+
3481
+ }, {
3482
+ key: "_animateImageIn",
3483
+ value: function _animateImageIn() {
3484
+ var _this17 = this;
3485
+
3486
+ var animOptions = {
3487
+ targets: this.el,
3488
+ height: [this.originalHeight, this.newHeight],
3489
+ width: [this.originalWidth, this.newWidth],
3490
+ left: M.getDocumentScrollLeft() + this.windowWidth / 2 - this.placeholder.offset().left - this.newWidth / 2,
3491
+ top: M.getDocumentScrollTop() + this.windowHeight / 2 - this.placeholder.offset().top - this.newHeight / 2,
3492
+ duration: this.options.inDuration,
3493
+ easing: 'easeOutQuad',
3494
+ complete: function () {
3495
+ _this17.doneAnimating = true;
3496
+
3497
+ // onOpenEnd callback
3498
+ if (typeof _this17.options.onOpenEnd === 'function') {
3499
+ _this17.options.onOpenEnd.call(_this17, _this17.el);
3500
+ }
3501
+ }
3502
+ };
3503
+
3504
+ // Override max-width or max-height if needed
3505
+ this.maxWidth = this.$el.css('max-width');
3506
+ this.maxHeight = this.$el.css('max-height');
3507
+ if (this.maxWidth !== 'none') {
3508
+ animOptions.maxWidth = this.newWidth;
3509
+ }
3510
+ if (this.maxHeight !== 'none') {
3511
+ animOptions.maxHeight = this.newHeight;
3512
+ }
3513
+
3514
+ anim(animOptions);
3515
+ }
3516
+
3517
+ /**
3518
+ * Animate image out
3519
+ */
3520
+
3521
+ }, {
3522
+ key: "_animateImageOut",
3523
+ value: function _animateImageOut() {
3524
+ var _this18 = this;
3525
+
3526
+ var animOptions = {
3527
+ targets: this.el,
3528
+ width: this.originalWidth,
3529
+ height: this.originalHeight,
3530
+ left: 0,
3531
+ top: 0,
3532
+ duration: this.options.outDuration,
3533
+ easing: 'easeOutQuad',
3534
+ complete: function () {
3535
+ _this18.placeholder.css({
3536
+ height: '',
3537
+ width: '',
3538
+ position: '',
3539
+ top: '',
3540
+ left: ''
3541
+ });
3542
+
3543
+ // Revert to width or height attribute
3544
+ if (_this18.attrWidth) {
3545
+ _this18.$el.attr('width', _this18.attrWidth);
3546
+ }
3547
+ if (_this18.attrHeight) {
3548
+ _this18.$el.attr('height', _this18.attrHeight);
3549
+ }
3550
+
3551
+ _this18.$el.removeAttr('style');
3552
+ _this18.originInlineStyles && _this18.$el.attr('style', _this18.originInlineStyles);
3553
+
3554
+ // Remove class
3555
+ _this18.$el.removeClass('active');
3556
+ _this18.doneAnimating = true;
3557
+
3558
+ // Remove overflow overrides on ancestors
3559
+ if (_this18.ancestorsChanged.length) {
3560
+ _this18.ancestorsChanged.css('overflow', '');
3561
+ }
3562
+
3563
+ // onCloseEnd callback
3564
+ if (typeof _this18.options.onCloseEnd === 'function') {
3565
+ _this18.options.onCloseEnd.call(_this18, _this18.el);
3566
+ }
3567
+ }
3568
+ };
3569
+
3570
+ anim(animOptions);
3571
+ }
3572
+
3573
+ /**
3574
+ * Update open and close vars
3575
+ */
3576
+
3577
+ }, {
3578
+ key: "_updateVars",
3579
+ value: function _updateVars() {
3580
+ this.windowWidth = window.innerWidth;
3581
+ this.windowHeight = window.innerHeight;
3582
+ this.caption = this.el.getAttribute('data-caption') || '';
3583
+ }
3584
+
3585
+ /**
3586
+ * Open Materialbox
3587
+ */
3588
+
3589
+ }, {
3590
+ key: "open",
3591
+ value: function open() {
3592
+ var _this19 = this;
3593
+
3594
+ this._updateVars();
3595
+ this.originalWidth = this.el.getBoundingClientRect().width;
3596
+ this.originalHeight = this.el.getBoundingClientRect().height;
3597
+
3598
+ // Set states
3599
+ this.doneAnimating = false;
3600
+ this.$el.addClass('active');
3601
+ this.overlayActive = true;
3602
+
3603
+ // onOpenStart callback
3604
+ if (typeof this.options.onOpenStart === 'function') {
3605
+ this.options.onOpenStart.call(this, this.el);
3606
+ }
3607
+
3608
+ // Set positioning for placeholder
3609
+ this.placeholder.css({
3610
+ width: this.placeholder[0].getBoundingClientRect().width + 'px',
3611
+ height: this.placeholder[0].getBoundingClientRect().height + 'px',
3612
+ position: 'relative',
3613
+ top: 0,
3614
+ left: 0
3615
+ });
3616
+
3617
+ this._makeAncestorsOverflowVisible();
3618
+
3619
+ // Set css on origin
3620
+ this.$el.css({
3621
+ position: 'absolute',
3622
+ 'z-index': 1000,
3623
+ 'will-change': 'left, top, width, height'
3624
+ });
3625
+
3626
+ // Change from width or height attribute to css
3627
+ this.attrWidth = this.$el.attr('width');
3628
+ this.attrHeight = this.$el.attr('height');
3629
+ if (this.attrWidth) {
3630
+ this.$el.css('width', this.attrWidth + 'px');
3631
+ this.$el.removeAttr('width');
3632
+ }
3633
+ if (this.attrHeight) {
3634
+ this.$el.css('width', this.attrHeight + 'px');
3635
+ this.$el.removeAttr('height');
3636
+ }
3637
+
3638
+ // Add overlay
3639
+ this.$overlay = $('<div id="materialbox-overlay"></div>').css({
3640
+ opacity: 0
3641
+ }).one('click', function () {
3642
+ if (_this19.doneAnimating) {
3643
+ _this19.close();
3644
+ }
3645
+ });
3646
+
3647
+ // Put before in origin image to preserve z-index layering.
3648
+ this.$el.before(this.$overlay);
3649
+
3650
+ // Set dimensions if needed
3651
+ var overlayOffset = this.$overlay[0].getBoundingClientRect();
3652
+ this.$overlay.css({
3653
+ width: this.windowWidth + 'px',
3654
+ height: this.windowHeight + 'px',
3655
+ left: -1 * overlayOffset.left + 'px',
3656
+ top: -1 * overlayOffset.top + 'px'
3657
+ });
3658
+
3659
+ anim.remove(this.el);
3660
+ anim.remove(this.$overlay[0]);
3661
+
3662
+ // Animate Overlay
3663
+ anim({
3664
+ targets: this.$overlay[0],
3665
+ opacity: 1,
3666
+ duration: this.options.inDuration,
3667
+ easing: 'easeOutQuad'
3668
+ });
3669
+
3670
+ // Add and animate caption if it exists
3671
+ if (this.caption !== '') {
3672
+ if (this.$photocaption) {
3673
+ anim.remove(this.$photoCaption[0]);
3674
+ }
3675
+ this.$photoCaption = $('<div class="materialbox-caption"></div>');
3676
+ this.$photoCaption.text(this.caption);
3677
+ $('body').append(this.$photoCaption);
3678
+ this.$photoCaption.css({ display: 'inline' });
3679
+
3680
+ anim({
3681
+ targets: this.$photoCaption[0],
3682
+ opacity: 1,
3683
+ duration: this.options.inDuration,
3684
+ easing: 'easeOutQuad'
3685
+ });
3686
+ }
3687
+
3688
+ // Resize Image
3689
+ var ratio = 0;
3690
+ var widthPercent = this.originalWidth / this.windowWidth;
3691
+ var heightPercent = this.originalHeight / this.windowHeight;
3692
+ this.newWidth = 0;
3693
+ this.newHeight = 0;
3694
+
3695
+ if (widthPercent > heightPercent) {
3696
+ ratio = this.originalHeight / this.originalWidth;
3697
+ this.newWidth = this.windowWidth * 0.9;
3698
+ this.newHeight = this.windowWidth * 0.9 * ratio;
3699
+ } else {
3700
+ ratio = this.originalWidth / this.originalHeight;
3701
+ this.newWidth = this.windowHeight * 0.9 * ratio;
3702
+ this.newHeight = this.windowHeight * 0.9;
3703
+ }
3704
+
3705
+ this._animateImageIn();
3706
+
3707
+ // Handle Exit triggers
3708
+ this._handleWindowScrollBound = this._handleWindowScroll.bind(this);
3709
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
3710
+ this._handleWindowEscapeBound = this._handleWindowEscape.bind(this);
3711
+
3712
+ window.addEventListener('scroll', this._handleWindowScrollBound);
3713
+ window.addEventListener('resize', this._handleWindowResizeBound);
3714
+ window.addEventListener('keyup', this._handleWindowEscapeBound);
3715
+ }
3716
+
3717
+ /**
3718
+ * Close Materialbox
3719
+ */
3720
+
3721
+ }, {
3722
+ key: "close",
3723
+ value: function close() {
3724
+ var _this20 = this;
3725
+
3726
+ this._updateVars();
3727
+ this.doneAnimating = false;
3728
+
3729
+ // onCloseStart callback
3730
+ if (typeof this.options.onCloseStart === 'function') {
3731
+ this.options.onCloseStart.call(this, this.el);
3732
+ }
3733
+
3734
+ anim.remove(this.el);
3735
+ anim.remove(this.$overlay[0]);
3736
+
3737
+ if (this.caption !== '') {
3738
+ anim.remove(this.$photoCaption[0]);
3739
+ }
3740
+
3741
+ // disable exit handlers
3742
+ window.removeEventListener('scroll', this._handleWindowScrollBound);
3743
+ window.removeEventListener('resize', this._handleWindowResizeBound);
3744
+ window.removeEventListener('keyup', this._handleWindowEscapeBound);
3745
+
3746
+ anim({
3747
+ targets: this.$overlay[0],
3748
+ opacity: 0,
3749
+ duration: this.options.outDuration,
3750
+ easing: 'easeOutQuad',
3751
+ complete: function () {
3752
+ _this20.overlayActive = false;
3753
+ _this20.$overlay.remove();
3754
+ }
3755
+ });
3756
+
3757
+ this._animateImageOut();
3758
+
3759
+ // Remove Caption + reset css settings on image
3760
+ if (this.caption !== '') {
3761
+ anim({
3762
+ targets: this.$photoCaption[0],
3763
+ opacity: 0,
3764
+ duration: this.options.outDuration,
3765
+ easing: 'easeOutQuad',
3766
+ complete: function () {
3767
+ _this20.$photoCaption.remove();
3768
+ }
3769
+ });
3770
+ }
3771
+ }
3772
+ }], [{
3773
+ key: "init",
3774
+ value: function init(els, options) {
3775
+ return _get(Materialbox.__proto__ || Object.getPrototypeOf(Materialbox), "init", this).call(this, this, els, options);
3776
+ }
3777
+
3778
+ /**
3779
+ * Get Instance
3780
+ */
3781
+
3782
+ }, {
3783
+ key: "getInstance",
3784
+ value: function getInstance(el) {
3785
+ var domElem = !!el.jquery ? el[0] : el;
3786
+ return domElem.M_Materialbox;
3787
+ }
3788
+ }, {
3789
+ key: "defaults",
3790
+ get: function () {
3791
+ return _defaults;
3792
+ }
3793
+ }]);
3794
+
3795
+ return Materialbox;
3796
+ }(Component);
3797
+
3798
+ M.Materialbox = Materialbox;
3799
+
3800
+ if (M.jQueryLoaded) {
3801
+ M.initializeJqueryWrapper(Materialbox, 'materialbox', 'M_Materialbox');
3802
+ }
3803
+ })(cash, M.anime);
3804
+ ;(function ($) {
3805
+ 'use strict';
3806
+
3807
+ var _defaults = {
3808
+ responsiveThreshold: 0 // breakpoint for swipeable
3809
+ };
3810
+
3811
+ var Parallax = function (_Component5) {
3812
+ _inherits(Parallax, _Component5);
3813
+
3814
+ function Parallax(el, options) {
3815
+ _classCallCheck(this, Parallax);
3816
+
3817
+ var _this21 = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
3818
+
3819
+ _this21.el.M_Parallax = _this21;
3820
+
3821
+ /**
3822
+ * Options for the Parallax
3823
+ * @member Parallax#options
3824
+ * @prop {Number} responsiveThreshold
3825
+ */
3826
+ _this21.options = $.extend({}, Parallax.defaults, options);
3827
+ _this21._enabled = window.innerWidth > _this21.options.responsiveThreshold;
3828
+
3829
+ _this21.$img = _this21.$el.find('img').first();
3830
+ _this21.$img.each(function () {
3831
+ var el = this;
3832
+ if (el.complete) $(el).trigger('load');
3833
+ });
3834
+
3835
+ _this21._updateParallax();
3836
+ _this21._setupEventHandlers();
3837
+ _this21._setupStyles();
3838
+
3839
+ Parallax._parallaxes.push(_this21);
3840
+ return _this21;
3841
+ }
3842
+
3843
+ _createClass(Parallax, [{
3844
+ key: "destroy",
3845
+
3846
+
3847
+ /**
3848
+ * Teardown component
3849
+ */
3850
+ value: function destroy() {
3851
+ Parallax._parallaxes.splice(Parallax._parallaxes.indexOf(this), 1);
3852
+ this.$img[0].style.transform = '';
3853
+ this._removeEventHandlers();
3854
+
3855
+ this.$el[0].M_Parallax = undefined;
3856
+ }
3857
+ }, {
3858
+ key: "_setupEventHandlers",
3859
+ value: function _setupEventHandlers() {
3860
+ this._handleImageLoadBound = this._handleImageLoad.bind(this);
3861
+ this.$img[0].addEventListener('load', this._handleImageLoadBound);
3862
+
3863
+ if (Parallax._parallaxes.length === 0) {
3864
+ Parallax._handleScrollThrottled = M.throttle(Parallax._handleScroll, 5);
3865
+ window.addEventListener('scroll', Parallax._handleScrollThrottled);
3866
+
3867
+ Parallax._handleWindowResizeThrottled = M.throttle(Parallax._handleWindowResize, 5);
3868
+ window.addEventListener('resize', Parallax._handleWindowResizeThrottled);
3869
+ }
3870
+ }
3871
+ }, {
3872
+ key: "_removeEventHandlers",
3873
+ value: function _removeEventHandlers() {
3874
+ this.$img[0].removeEventListener('load', this._handleImageLoadBound);
3875
+
3876
+ if (Parallax._parallaxes.length === 0) {
3877
+ window.removeEventListener('scroll', Parallax._handleScrollThrottled);
3878
+ window.removeEventListener('resize', Parallax._handleWindowResizeThrottled);
3879
+ }
3880
+ }
3881
+ }, {
3882
+ key: "_setupStyles",
3883
+ value: function _setupStyles() {
3884
+ this.$img[0].style.opacity = 1;
3885
+ }
3886
+ }, {
3887
+ key: "_handleImageLoad",
3888
+ value: function _handleImageLoad() {
3889
+ this._updateParallax();
3890
+ }
3891
+ }, {
3892
+ key: "_updateParallax",
3893
+ value: function _updateParallax() {
3894
+ var containerHeight = this.$el.height() > 0 ? this.el.parentNode.offsetHeight : 500;
3895
+ var imgHeight = this.$img[0].offsetHeight;
3896
+ var parallaxDist = imgHeight - containerHeight;
3897
+ var bottom = this.$el.offset().top + containerHeight;
3898
+ var top = this.$el.offset().top;
3899
+ var scrollTop = M.getDocumentScrollTop();
3900
+ var windowHeight = window.innerHeight;
3901
+ var windowBottom = scrollTop + windowHeight;
3902
+ var percentScrolled = (windowBottom - top) / (containerHeight + windowHeight);
3903
+ var parallax = parallaxDist * percentScrolled;
3904
+
3905
+ if (!this._enabled) {
3906
+ this.$img[0].style.transform = '';
3907
+ } else if (bottom > scrollTop && top < scrollTop + windowHeight) {
3908
+ this.$img[0].style.transform = "translate3D(-50%, " + parallax + "px, 0)";
3909
+ }
3910
+ }
3911
+ }], [{
3912
+ key: "init",
3913
+ value: function init(els, options) {
3914
+ return _get(Parallax.__proto__ || Object.getPrototypeOf(Parallax), "init", this).call(this, this, els, options);
3915
+ }
3916
+
3917
+ /**
3918
+ * Get Instance
3919
+ */
3920
+
3921
+ }, {
3922
+ key: "getInstance",
3923
+ value: function getInstance(el) {
3924
+ var domElem = !!el.jquery ? el[0] : el;
3925
+ return domElem.M_Parallax;
3926
+ }
3927
+ }, {
3928
+ key: "_handleScroll",
3929
+ value: function _handleScroll() {
3930
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
3931
+ var parallaxInstance = Parallax._parallaxes[i];
3932
+ parallaxInstance._updateParallax.call(parallaxInstance);
3933
+ }
3934
+ }
3935
+ }, {
3936
+ key: "_handleWindowResize",
3937
+ value: function _handleWindowResize() {
3938
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
3939
+ var parallaxInstance = Parallax._parallaxes[i];
3940
+ parallaxInstance._enabled = window.innerWidth > parallaxInstance.options.responsiveThreshold;
3941
+ }
3942
+ }
3943
+ }, {
3944
+ key: "defaults",
3945
+ get: function () {
3946
+ return _defaults;
3947
+ }
3948
+ }]);
3949
+
3950
+ return Parallax;
3951
+ }(Component);
3952
+
3953
+ /**
3954
+ * @static
3955
+ * @memberof Parallax
3956
+ */
3957
+
3958
+
3959
+ Parallax._parallaxes = [];
3960
+
3961
+ M.Parallax = Parallax;
3962
+
3963
+ if (M.jQueryLoaded) {
3964
+ M.initializeJqueryWrapper(Parallax, 'parallax', 'M_Parallax');
3965
+ }
3966
+ })(cash);
3967
+ ;(function ($, anim) {
3968
+ 'use strict';
3969
+
3970
+ var _defaults = {
3971
+ duration: 300,
3972
+ onShow: null,
3973
+ swipeable: false,
3974
+ responsiveThreshold: Infinity // breakpoint for swipeable
3975
+ };
3976
+
3977
+ /**
3978
+ * @class
3979
+ *
3980
+ */
3981
+
3982
+ var Tabs = function (_Component6) {
3983
+ _inherits(Tabs, _Component6);
3984
+
3985
+ /**
3986
+ * Construct Tabs instance
3987
+ * @constructor
3988
+ * @param {Element} el
3989
+ * @param {Object} options
3990
+ */
3991
+ function Tabs(el, options) {
3992
+ _classCallCheck(this, Tabs);
3993
+
3994
+ var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
3995
+
3996
+ _this22.el.M_Tabs = _this22;
3997
+
3998
+ /**
3999
+ * Options for the Tabs
4000
+ * @member Tabs#options
4001
+ * @prop {Number} duration
4002
+ * @prop {Function} onShow
4003
+ * @prop {Boolean} swipeable
4004
+ * @prop {Number} responsiveThreshold
4005
+ */
4006
+ _this22.options = $.extend({}, Tabs.defaults, options);
4007
+
4008
+ // Setup
4009
+ _this22.$tabLinks = _this22.$el.children('li.tab').children('a');
4010
+ _this22.index = 0;
4011
+ _this22._setupActiveTabLink();
4012
+
4013
+ // Setup tabs content
4014
+ if (_this22.options.swipeable) {
4015
+ _this22._setupSwipeableTabs();
4016
+ } else {
4017
+ _this22._setupNormalTabs();
4018
+ }
4019
+
4020
+ // Setup tabs indicator after content to ensure accurate widths
4021
+ _this22._setTabsAndTabWidth();
4022
+ _this22._createIndicator();
4023
+
4024
+ _this22._setupEventHandlers();
4025
+ return _this22;
4026
+ }
4027
+
4028
+ _createClass(Tabs, [{
4029
+ key: "destroy",
4030
+
4031
+
4032
+ /**
4033
+ * Teardown component
4034
+ */
4035
+ value: function destroy() {
4036
+ this._removeEventHandlers();
4037
+ this._indicator.parentNode.removeChild(this._indicator);
4038
+
4039
+ if (this.options.swipeable) {
4040
+ this._teardownSwipeableTabs();
4041
+ } else {
4042
+ this._teardownNormalTabs();
4043
+ }
4044
+
4045
+ this.$el[0].M_Tabs = undefined;
4046
+ }
4047
+
4048
+ /**
4049
+ * Setup Event Handlers
4050
+ */
4051
+
4052
+ }, {
4053
+ key: "_setupEventHandlers",
4054
+ value: function _setupEventHandlers() {
4055
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
4056
+ window.addEventListener('resize', this._handleWindowResizeBound);
4057
+
4058
+ this._handleTabClickBound = this._handleTabClick.bind(this);
4059
+ this.el.addEventListener('click', this._handleTabClickBound);
4060
+ }
4061
+
4062
+ /**
4063
+ * Remove Event Handlers
4064
+ */
4065
+
4066
+ }, {
4067
+ key: "_removeEventHandlers",
4068
+ value: function _removeEventHandlers() {
4069
+ window.removeEventListener('resize', this._handleWindowResizeBound);
4070
+ this.el.removeEventListener('click', this._handleTabClickBound);
4071
+ }
4072
+
4073
+ /**
4074
+ * Handle window Resize
4075
+ */
4076
+
4077
+ }, {
4078
+ key: "_handleWindowResize",
4079
+ value: function _handleWindowResize() {
4080
+ this._setTabsAndTabWidth();
4081
+
4082
+ if (this.tabWidth !== 0 && this.tabsWidth !== 0) {
4083
+ this._indicator.style.left = this._calcLeftPos(this.$activeTabLink) + 'px';
4084
+ this._indicator.style.right = this._calcRightPos(this.$activeTabLink) + 'px';
4085
+ }
4086
+ }
4087
+
4088
+ /**
4089
+ * Handle tab click
4090
+ * @param {Event} e
4091
+ */
4092
+
4093
+ }, {
4094
+ key: "_handleTabClick",
4095
+ value: function _handleTabClick(e) {
4096
+ var _this23 = this;
4097
+
4098
+ var tab = $(e.target).closest('li.tab');
4099
+ var tabLink = $(e.target).closest('a');
4100
+
4101
+ // Handle click on tab link only
4102
+ if (!tabLink.length || !tabLink.parent().hasClass('tab')) {
4103
+ return;
4104
+ }
4105
+
4106
+ if (tab.hasClass('disabled')) {
4107
+ e.preventDefault();
4108
+ return;
4109
+ }
4110
+
4111
+ // Act as regular link if target attribute is specified.
4112
+ if (!!tabLink.attr('target')) {
4113
+ return;
4114
+ }
4115
+
4116
+ // Make the old tab inactive.
4117
+ this.$activeTabLink.removeClass('active');
4118
+ var $oldContent = this.$content;
4119
+
4120
+ // Update the variables with the new link and content
4121
+ this.$activeTabLink = tabLink;
4122
+ this.$content = $(M.escapeHash(tabLink[0].hash));
4123
+ this.$tabLinks = this.$el.children('li.tab').children('a');
4124
+
4125
+ // Make the tab active.
4126
+ this.$activeTabLink.addClass('active');
4127
+ var prevIndex = this.index;
4128
+ this.index = Math.max(this.$tabLinks.index(tabLink), 0);
4129
+
4130
+ // Swap content
4131
+ if (this.options.swipeable) {
4132
+ if (this._tabsCarousel) {
4133
+ this._tabsCarousel.set(this.index, function () {
4134
+ if (typeof _this23.options.onShow === 'function') {
4135
+ _this23.options.onShow.call(_this23, _this23.$content[0]);
4136
+ }
4137
+ });
4138
+ }
4139
+ } else {
4140
+ if (this.$content.length) {
4141
+ this.$content[0].style.display = 'block';
4142
+ this.$content.addClass('active');
4143
+ if (typeof this.options.onShow === 'function') {
4144
+ this.options.onShow.call(this, this.$content[0]);
4145
+ }
4146
+
4147
+ if ($oldContent.length && !$oldContent.is(this.$content)) {
4148
+ $oldContent[0].style.display = 'none';
4149
+ $oldContent.removeClass('active');
4150
+ }
4151
+ }
4152
+ }
4153
+
4154
+ // Update widths after content is swapped (scrollbar bugfix)
4155
+ this._setTabsAndTabWidth();
4156
+
4157
+ // Update indicator
4158
+ this._animateIndicator(prevIndex);
4159
+
4160
+ // Prevent the anchor's default click action
4161
+ e.preventDefault();
4162
+ }
4163
+
4164
+ /**
4165
+ * Generate elements for tab indicator.
4166
+ */
4167
+
4168
+ }, {
4169
+ key: "_createIndicator",
4170
+ value: function _createIndicator() {
4171
+ var _this24 = this;
4172
+
4173
+ var indicator = document.createElement('li');
4174
+ indicator.classList.add('indicator');
4175
+
4176
+ this.el.appendChild(indicator);
4177
+ this._indicator = indicator;
4178
+
4179
+ setTimeout(function () {
4180
+ _this24._indicator.style.left = _this24._calcLeftPos(_this24.$activeTabLink) + 'px';
4181
+ _this24._indicator.style.right = _this24._calcRightPos(_this24.$activeTabLink) + 'px';
4182
+ }, 0);
4183
+ }
4184
+
4185
+ /**
4186
+ * Setup first active tab link.
4187
+ */
4188
+
4189
+ }, {
4190
+ key: "_setupActiveTabLink",
4191
+ value: function _setupActiveTabLink() {
4192
+ // If the location.hash matches one of the links, use that as the active tab.
4193
+ this.$activeTabLink = $(this.$tabLinks.filter('[href="' + location.hash + '"]'));
4194
+
4195
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
4196
+ if (this.$activeTabLink.length === 0) {
4197
+ this.$activeTabLink = this.$el.children('li.tab').children('a.active').first();
4198
+ }
4199
+ if (this.$activeTabLink.length === 0) {
4200
+ this.$activeTabLink = this.$el.children('li.tab').children('a').first();
4201
+ }
4202
+
4203
+ this.$tabLinks.removeClass('active');
4204
+ this.$activeTabLink[0].classList.add('active');
4205
+
4206
+ this.index = Math.max(this.$tabLinks.index(this.$activeTabLink), 0);
4207
+
4208
+ if (this.$activeTabLink.length) {
4209
+ this.$content = $(M.escapeHash(this.$activeTabLink[0].hash));
4210
+ this.$content.addClass('active');
4211
+ }
4212
+ }
4213
+
4214
+ /**
4215
+ * Setup swipeable tabs
4216
+ */
4217
+
4218
+ }, {
4219
+ key: "_setupSwipeableTabs",
4220
+ value: function _setupSwipeableTabs() {
4221
+ var _this25 = this;
4222
+
4223
+ // Change swipeable according to responsive threshold
4224
+ if (window.innerWidth > this.options.responsiveThreshold) {
4225
+ this.options.swipeable = false;
4226
+ }
4227
+
4228
+ var $tabsContent = $();
4229
+ this.$tabLinks.each(function (link) {
4230
+ var $currContent = $(M.escapeHash(link.hash));
4231
+ $currContent.addClass('carousel-item');
4232
+ $tabsContent = $tabsContent.add($currContent);
4233
+ });
4234
+
4235
+ var $tabsWrapper = $('<div class="tabs-content carousel carousel-slider"></div>');
4236
+ $tabsContent.first().before($tabsWrapper);
4237
+ $tabsWrapper.append($tabsContent);
4238
+ $tabsContent[0].style.display = '';
4239
+
4240
+ // Keep active tab index to set initial carousel slide
4241
+ var activeTabIndex = this.$activeTabLink.closest('.tab').index();
4242
+
4243
+ this._tabsCarousel = M.Carousel.init($tabsWrapper[0], {
4244
+ fullWidth: true,
4245
+ noWrap: true,
4246
+ onCycleTo: function (item) {
4247
+ var prevIndex = _this25.index;
4248
+ _this25.index = $(item).index();
4249
+ _this25.$activeTabLink.removeClass('active');
4250
+ _this25.$activeTabLink = _this25.$tabLinks.eq(_this25.index);
4251
+ _this25.$activeTabLink.addClass('active');
4252
+ _this25._animateIndicator(prevIndex);
4253
+ if (typeof _this25.options.onShow === 'function') {
4254
+ _this25.options.onShow.call(_this25, _this25.$content[0]);
4255
+ }
4256
+ }
4257
+ });
4258
+
4259
+ // Set initial carousel slide to active tab
4260
+ this._tabsCarousel.set(activeTabIndex);
4261
+ }
4262
+
4263
+ /**
4264
+ * Teardown normal tabs.
4265
+ */
4266
+
4267
+ }, {
4268
+ key: "_teardownSwipeableTabs",
4269
+ value: function _teardownSwipeableTabs() {
4270
+ var $tabsWrapper = this._tabsCarousel.$el;
4271
+ this._tabsCarousel.destroy();
4272
+
4273
+ // Unwrap
4274
+ $tabsWrapper.after($tabsWrapper.children());
4275
+ $tabsWrapper.remove();
4276
+ }
4277
+
4278
+ /**
4279
+ * Setup normal tabs.
4280
+ */
4281
+
4282
+ }, {
4283
+ key: "_setupNormalTabs",
4284
+ value: function _setupNormalTabs() {
4285
+ // Hide Tabs Content
4286
+ this.$tabLinks.not(this.$activeTabLink).each(function (link) {
4287
+ if (!!link.hash) {
4288
+ var $currContent = $(M.escapeHash(link.hash));
4289
+ if ($currContent.length) {
4290
+ $currContent[0].style.display = 'none';
4291
+ }
4292
+ }
4293
+ });
4294
+ }
4295
+
4296
+ /**
4297
+ * Teardown normal tabs.
4298
+ */
4299
+
4300
+ }, {
4301
+ key: "_teardownNormalTabs",
4302
+ value: function _teardownNormalTabs() {
4303
+ // show Tabs Content
4304
+ this.$tabLinks.each(function (link) {
4305
+ if (!!link.hash) {
4306
+ var $currContent = $(M.escapeHash(link.hash));
4307
+ if ($currContent.length) {
4308
+ $currContent[0].style.display = '';
4309
+ }
4310
+ }
4311
+ });
4312
+ }
4313
+
4314
+ /**
4315
+ * set tabs and tab width
4316
+ */
4317
+
4318
+ }, {
4319
+ key: "_setTabsAndTabWidth",
4320
+ value: function _setTabsAndTabWidth() {
4321
+ this.tabsWidth = this.$el.width();
4322
+ this.tabWidth = Math.max(this.tabsWidth, this.el.scrollWidth) / this.$tabLinks.length;
4323
+ }
4324
+
4325
+ /**
4326
+ * Finds right attribute for indicator based on active tab.
4327
+ * @param {cash} el
4328
+ */
4329
+
4330
+ }, {
4331
+ key: "_calcRightPos",
4332
+ value: function _calcRightPos(el) {
4333
+ return Math.ceil(this.tabsWidth - el.position().left - el[0].getBoundingClientRect().width);
4334
+ }
4335
+
4336
+ /**
4337
+ * Finds left attribute for indicator based on active tab.
4338
+ * @param {cash} el
4339
+ */
4340
+
4341
+ }, {
4342
+ key: "_calcLeftPos",
4343
+ value: function _calcLeftPos(el) {
4344
+ return Math.floor(el.position().left);
4345
+ }
4346
+ }, {
4347
+ key: "updateTabIndicator",
4348
+ value: function updateTabIndicator() {
4349
+ this._setTabsAndTabWidth();
4350
+ this._animateIndicator(this.index);
4351
+ }
4352
+
4353
+ /**
4354
+ * Animates Indicator to active tab.
4355
+ * @param {Number} prevIndex
4356
+ */
4357
+
4358
+ }, {
4359
+ key: "_animateIndicator",
4360
+ value: function _animateIndicator(prevIndex) {
4361
+ var leftDelay = 0,
4362
+ rightDelay = 0;
4363
+
4364
+ if (this.index - prevIndex >= 0) {
4365
+ leftDelay = 90;
4366
+ } else {
4367
+ rightDelay = 90;
4368
+ }
4369
+
4370
+ // Animate
4371
+ var animOptions = {
4372
+ targets: this._indicator,
4373
+ left: {
4374
+ value: this._calcLeftPos(this.$activeTabLink),
4375
+ delay: leftDelay
4376
+ },
4377
+ right: {
4378
+ value: this._calcRightPos(this.$activeTabLink),
4379
+ delay: rightDelay
4380
+ },
4381
+ duration: this.options.duration,
4382
+ easing: 'easeOutQuad'
4383
+ };
4384
+ anim.remove(this._indicator);
4385
+ anim(animOptions);
4386
+ }
4387
+
4388
+ /**
4389
+ * Select tab.
4390
+ * @param {String} tabId
4391
+ */
4392
+
4393
+ }, {
4394
+ key: "select",
4395
+ value: function select(tabId) {
4396
+ var tab = this.$tabLinks.filter('[href="#' + tabId + '"]');
4397
+ if (tab.length) {
4398
+ tab.trigger('click');
4399
+ }
4400
+ }
4401
+ }], [{
4402
+ key: "init",
4403
+ value: function init(els, options) {
4404
+ return _get(Tabs.__proto__ || Object.getPrototypeOf(Tabs), "init", this).call(this, this, els, options);
4405
+ }
4406
+
4407
+ /**
4408
+ * Get Instance
4409
+ */
4410
+
4411
+ }, {
4412
+ key: "getInstance",
4413
+ value: function getInstance(el) {
4414
+ var domElem = !!el.jquery ? el[0] : el;
4415
+ return domElem.M_Tabs;
4416
+ }
4417
+ }, {
4418
+ key: "defaults",
4419
+ get: function () {
4420
+ return _defaults;
4421
+ }
4422
+ }]);
4423
+
4424
+ return Tabs;
4425
+ }(Component);
4426
+
4427
+ M.Tabs = Tabs;
4428
+
4429
+ if (M.jQueryLoaded) {
4430
+ M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');
4431
+ }
4432
+ })(cash, M.anime);
4433
+ ;(function ($, anim) {
4434
+ 'use strict';
4435
+
4436
+ var _defaults = {
4437
+ exitDelay: 200,
4438
+ enterDelay: 0,
4439
+ html: null,
4440
+ margin: 5,
4441
+ inDuration: 250,
4442
+ outDuration: 200,
4443
+ position: 'bottom',
4444
+ transitionMovement: 10
4445
+ };
4446
+
4447
+ /**
4448
+ * @class
4449
+ *
4450
+ */
4451
+
4452
+ var Tooltip = function (_Component7) {
4453
+ _inherits(Tooltip, _Component7);
4454
+
4455
+ /**
4456
+ * Construct Tooltip instance
4457
+ * @constructor
4458
+ * @param {Element} el
4459
+ * @param {Object} options
4460
+ */
4461
+ function Tooltip(el, options) {
4462
+ _classCallCheck(this, Tooltip);
4463
+
4464
+ var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
4465
+
4466
+ _this26.el.M_Tooltip = _this26;
4467
+ _this26.options = $.extend({}, Tooltip.defaults, options);
4468
+
4469
+ _this26.isOpen = false;
4470
+ _this26.isHovered = false;
4471
+ _this26.isFocused = false;
4472
+ _this26._appendTooltipEl();
4473
+ _this26._setupEventHandlers();
4474
+ return _this26;
4475
+ }
4476
+
4477
+ _createClass(Tooltip, [{
4478
+ key: "destroy",
4479
+
4480
+
4481
+ /**
4482
+ * Teardown component
4483
+ */
4484
+ value: function destroy() {
4485
+ $(this.tooltipEl).remove();
4486
+ this._removeEventHandlers();
4487
+ this.el.M_Tooltip = undefined;
4488
+ }
4489
+ }, {
4490
+ key: "_appendTooltipEl",
4491
+ value: function _appendTooltipEl() {
4492
+ var tooltipEl = document.createElement('div');
4493
+ tooltipEl.classList.add('material-tooltip');
4494
+ this.tooltipEl = tooltipEl;
4495
+
4496
+ var tooltipContentEl = document.createElement('div');
4497
+ tooltipContentEl.classList.add('tooltip-content');
4498
+ tooltipContentEl.innerHTML = this.options.html;
4499
+ tooltipEl.appendChild(tooltipContentEl);
4500
+ document.body.appendChild(tooltipEl);
4501
+ }
4502
+ }, {
4503
+ key: "_updateTooltipContent",
4504
+ value: function _updateTooltipContent() {
4505
+ this.tooltipEl.querySelector('.tooltip-content').innerHTML = this.options.html;
4506
+ }
4507
+ }, {
4508
+ key: "_setupEventHandlers",
4509
+ value: function _setupEventHandlers() {
4510
+ this._handleMouseEnterBound = this._handleMouseEnter.bind(this);
4511
+ this._handleMouseLeaveBound = this._handleMouseLeave.bind(this);
4512
+ this._handleFocusBound = this._handleFocus.bind(this);
4513
+ this._handleBlurBound = this._handleBlur.bind(this);
4514
+ this.el.addEventListener('mouseenter', this._handleMouseEnterBound);
4515
+ this.el.addEventListener('mouseleave', this._handleMouseLeaveBound);
4516
+ this.el.addEventListener('focus', this._handleFocusBound, true);
4517
+ this.el.addEventListener('blur', this._handleBlurBound, true);
4518
+ }
4519
+ }, {
4520
+ key: "_removeEventHandlers",
4521
+ value: function _removeEventHandlers() {
4522
+ this.el.removeEventListener('mouseenter', this._handleMouseEnterBound);
4523
+ this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound);
4524
+ this.el.removeEventListener('focus', this._handleFocusBound, true);
4525
+ this.el.removeEventListener('blur', this._handleBlurBound, true);
4526
+ }
4527
+ }, {
4528
+ key: "open",
4529
+ value: function open(isManual) {
4530
+ if (this.isOpen) {
4531
+ return;
4532
+ }
4533
+ isManual = isManual === undefined ? true : undefined; // Default value true
4534
+ this.isOpen = true;
4535
+ // Update tooltip content with HTML attribute options
4536
+ this.options = $.extend({}, this.options, this._getAttributeOptions());
4537
+ this._updateTooltipContent();
4538
+ this._setEnterDelayTimeout(isManual);
4539
+ }
4540
+ }, {
4541
+ key: "close",
4542
+ value: function close() {
4543
+ if (!this.isOpen) {
4544
+ return;
4545
+ }
4546
+
4547
+ this.isHovered = false;
4548
+ this.isFocused = false;
4549
+ this.isOpen = false;
4550
+ this._setExitDelayTimeout();
4551
+ }
4552
+
4553
+ /**
4554
+ * Create timeout which delays when the tooltip closes
4555
+ */
4556
+
4557
+ }, {
4558
+ key: "_setExitDelayTimeout",
4559
+ value: function _setExitDelayTimeout() {
4560
+ var _this27 = this;
4561
+
4562
+ clearTimeout(this._exitDelayTimeout);
4563
+
4564
+ this._exitDelayTimeout = setTimeout(function () {
4565
+ if (_this27.isHovered || _this27.isFocused) {
4566
+ return;
4567
+ }
4568
+
4569
+ _this27._animateOut();
4570
+ }, this.options.exitDelay);
4571
+ }
4572
+
4573
+ /**
4574
+ * Create timeout which delays when the toast closes
4575
+ */
4576
+
4577
+ }, {
4578
+ key: "_setEnterDelayTimeout",
4579
+ value: function _setEnterDelayTimeout(isManual) {
4580
+ var _this28 = this;
4581
+
4582
+ clearTimeout(this._enterDelayTimeout);
4583
+
4584
+ this._enterDelayTimeout = setTimeout(function () {
4585
+ if (!_this28.isHovered && !_this28.isFocused && !isManual) {
4586
+ return;
4587
+ }
4588
+
4589
+ _this28._animateIn();
4590
+ }, this.options.enterDelay);
4591
+ }
4592
+ }, {
4593
+ key: "_positionTooltip",
4594
+ value: function _positionTooltip() {
4595
+ var origin = this.el,
4596
+ tooltip = this.tooltipEl,
4597
+ originHeight = origin.offsetHeight,
4598
+ originWidth = origin.offsetWidth,
4599
+ tooltipHeight = tooltip.offsetHeight,
4600
+ tooltipWidth = tooltip.offsetWidth,
4601
+ newCoordinates = void 0,
4602
+ margin = this.options.margin,
4603
+ targetTop = void 0,
4604
+ targetLeft = void 0;
4605
+
4606
+ this.xMovement = 0, this.yMovement = 0;
4607
+
4608
+ targetTop = origin.getBoundingClientRect().top + M.getDocumentScrollTop();
4609
+ targetLeft = origin.getBoundingClientRect().left + M.getDocumentScrollLeft();
4610
+
4611
+ if (this.options.position === 'top') {
4612
+ targetTop += -tooltipHeight - margin;
4613
+ targetLeft += originWidth / 2 - tooltipWidth / 2;
4614
+ this.yMovement = -this.options.transitionMovement;
4615
+ } else if (this.options.position === 'right') {
4616
+ targetTop += originHeight / 2 - tooltipHeight / 2;
4617
+ targetLeft += originWidth + margin;
4618
+ this.xMovement = this.options.transitionMovement;
4619
+ } else if (this.options.position === 'left') {
4620
+ targetTop += originHeight / 2 - tooltipHeight / 2;
4621
+ targetLeft += -tooltipWidth - margin;
4622
+ this.xMovement = -this.options.transitionMovement;
4623
+ } else {
4624
+ targetTop += originHeight + margin;
4625
+ targetLeft += originWidth / 2 - tooltipWidth / 2;
4626
+ this.yMovement = this.options.transitionMovement;
4627
+ }
4628
+
4629
+ newCoordinates = this._repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
4630
+ $(tooltip).css({
4631
+ top: newCoordinates.y + 'px',
4632
+ left: newCoordinates.x + 'px'
4633
+ });
4634
+ }
4635
+ }, {
4636
+ key: "_repositionWithinScreen",
4637
+ value: function _repositionWithinScreen(x, y, width, height) {
4638
+ var scrollLeft = M.getDocumentScrollLeft();
4639
+ var scrollTop = M.getDocumentScrollTop();
4640
+ var newX = x - scrollLeft;
4641
+ var newY = y - scrollTop;
4642
+
4643
+ var bounding = {
4644
+ left: newX,
4645
+ top: newY,
4646
+ width: width,
4647
+ height: height
4648
+ };
4649
+
4650
+ var offset = this.options.margin + this.options.transitionMovement;
4651
+ var edges = M.checkWithinContainer(document.body, bounding, offset);
4652
+
4653
+ if (edges.left) {
4654
+ newX = offset;
4655
+ } else if (edges.right) {
4656
+ newX -= newX + width - window.innerWidth;
4657
+ }
4658
+
4659
+ if (edges.top) {
4660
+ newY = offset;
4661
+ } else if (edges.bottom) {
4662
+ newY -= newY + height - window.innerHeight;
4663
+ }
4664
+
4665
+ return {
4666
+ x: newX + scrollLeft,
4667
+ y: newY + scrollTop
4668
+ };
4669
+ }
4670
+ }, {
4671
+ key: "_animateIn",
4672
+ value: function _animateIn() {
4673
+ this._positionTooltip();
4674
+ this.tooltipEl.style.visibility = 'visible';
4675
+ anim.remove(this.tooltipEl);
4676
+ anim({
4677
+ targets: this.tooltipEl,
4678
+ opacity: 1,
4679
+ translateX: this.xMovement,
4680
+ translateY: this.yMovement,
4681
+ duration: this.options.inDuration,
4682
+ easing: 'easeOutCubic'
4683
+ });
4684
+ }
4685
+ }, {
4686
+ key: "_animateOut",
4687
+ value: function _animateOut() {
4688
+ anim.remove(this.tooltipEl);
4689
+ anim({
4690
+ targets: this.tooltipEl,
4691
+ opacity: 0,
4692
+ translateX: 0,
4693
+ translateY: 0,
4694
+ duration: this.options.outDuration,
4695
+ easing: 'easeOutCubic'
4696
+ });
4697
+ }
4698
+ }, {
4699
+ key: "_handleMouseEnter",
4700
+ value: function _handleMouseEnter() {
4701
+ this.isHovered = true;
4702
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4703
+ this.open(false);
4704
+ }
4705
+ }, {
4706
+ key: "_handleMouseLeave",
4707
+ value: function _handleMouseLeave() {
4708
+ this.isHovered = false;
4709
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4710
+ this.close();
4711
+ }
4712
+ }, {
4713
+ key: "_handleFocus",
4714
+ value: function _handleFocus() {
4715
+ if (M.tabPressed) {
4716
+ this.isFocused = true;
4717
+ this.open(false);
4718
+ }
4719
+ }
4720
+ }, {
4721
+ key: "_handleBlur",
4722
+ value: function _handleBlur() {
4723
+ this.isFocused = false;
4724
+ this.close();
4725
+ }
4726
+ }, {
4727
+ key: "_getAttributeOptions",
4728
+ value: function _getAttributeOptions() {
4729
+ var attributeOptions = {};
4730
+ var tooltipTextOption = this.el.getAttribute('data-tooltip');
4731
+ var positionOption = this.el.getAttribute('data-position');
4732
+
4733
+ if (tooltipTextOption) {
4734
+ attributeOptions.html = tooltipTextOption;
4735
+ }
4736
+
4737
+ if (positionOption) {
4738
+ attributeOptions.position = positionOption;
4739
+ }
4740
+ return attributeOptions;
4741
+ }
4742
+ }], [{
4743
+ key: "init",
4744
+ value: function init(els, options) {
4745
+ return _get(Tooltip.__proto__ || Object.getPrototypeOf(Tooltip), "init", this).call(this, this, els, options);
4746
+ }
4747
+
4748
+ /**
4749
+ * Get Instance
4750
+ */
4751
+
4752
+ }, {
4753
+ key: "getInstance",
4754
+ value: function getInstance(el) {
4755
+ var domElem = !!el.jquery ? el[0] : el;
4756
+ return domElem.M_Tooltip;
4757
+ }
4758
+ }, {
4759
+ key: "defaults",
4760
+ get: function () {
4761
+ return _defaults;
4762
+ }
4763
+ }]);
4764
+
4765
+ return Tooltip;
4766
+ }(Component);
4767
+
4768
+ M.Tooltip = Tooltip;
4769
+
4770
+ if (M.jQueryLoaded) {
4771
+ M.initializeJqueryWrapper(Tooltip, 'tooltip', 'M_Tooltip');
4772
+ }
4773
+ })(cash, M.anime);
4774
+ ; /*!
4775
+ * Waves v0.6.4
4776
+ * http://fian.my.id/Waves
4777
+ *
4778
+ * Copyright 2014 Alfiana E. Sibuea and other contributors
4779
+ * Released under the MIT license
4780
+ * https://github.com/fians/Waves/blob/master/LICENSE
4781
+ */
4782
+
4783
+ ;(function (window) {
4784
+ 'use strict';
4785
+
4786
+ var Waves = Waves || {};
4787
+ var $$ = document.querySelectorAll.bind(document);
4788
+
4789
+ // Find exact position of element
4790
+ function isWindow(obj) {
4791
+ return obj !== null && obj === obj.window;
4792
+ }
4793
+
4794
+ function getWindow(elem) {
4795
+ return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
4796
+ }
4797
+
4798
+ function offset(elem) {
4799
+ var docElem,
4800
+ win,
4801
+ box = { top: 0, left: 0 },
4802
+ doc = elem && elem.ownerDocument;
4803
+
4804
+ docElem = doc.documentElement;
4805
+
4806
+ if (typeof elem.getBoundingClientRect !== typeof undefined) {
4807
+ box = elem.getBoundingClientRect();
4808
+ }
4809
+ win = getWindow(doc);
4810
+ return {
4811
+ top: box.top + win.pageYOffset - docElem.clientTop,
4812
+ left: box.left + win.pageXOffset - docElem.clientLeft
4813
+ };
4814
+ }
4815
+
4816
+ function convertStyle(obj) {
4817
+ var style = '';
4818
+
4819
+ for (var a in obj) {
4820
+ if (obj.hasOwnProperty(a)) {
4821
+ style += a + ':' + obj[a] + ';';
4822
+ }
4823
+ }
4824
+
4825
+ return style;
4826
+ }
4827
+
4828
+ var Effect = {
4829
+
4830
+ // Effect delay
4831
+ duration: 750,
4832
+
4833
+ show: function (e, element) {
4834
+
4835
+ // Disable right click
4836
+ if (e.button === 2) {
4837
+ return false;
4838
+ }
4839
+
4840
+ var el = element || this;
4841
+
4842
+ // Create ripple
4843
+ var ripple = document.createElement('div');
4844
+ ripple.className = 'waves-ripple';
4845
+ el.appendChild(ripple);
4846
+
4847
+ // Get click coordinate and element witdh
4848
+ var pos = offset(el);
4849
+ var relativeY = e.pageY - pos.top;
4850
+ var relativeX = e.pageX - pos.left;
4851
+ var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
4852
+
4853
+ // Support for touch devices
4854
+ if ('touches' in e) {
4855
+ relativeY = e.touches[0].pageY - pos.top;
4856
+ relativeX = e.touches[0].pageX - pos.left;
4857
+ }
4858
+
4859
+ // Attach data to element
4860
+ ripple.setAttribute('data-hold', Date.now());
4861
+ ripple.setAttribute('data-scale', scale);
4862
+ ripple.setAttribute('data-x', relativeX);
4863
+ ripple.setAttribute('data-y', relativeY);
4864
+
4865
+ // Set ripple position
4866
+ var rippleStyle = {
4867
+ 'top': relativeY + 'px',
4868
+ 'left': relativeX + 'px'
4869
+ };
4870
+
4871
+ ripple.className = ripple.className + ' waves-notransition';
4872
+ ripple.setAttribute('style', convertStyle(rippleStyle));
4873
+ ripple.className = ripple.className.replace('waves-notransition', '');
4874
+
4875
+ // Scale the ripple
4876
+ rippleStyle['-webkit-transform'] = scale;
4877
+ rippleStyle['-moz-transform'] = scale;
4878
+ rippleStyle['-ms-transform'] = scale;
4879
+ rippleStyle['-o-transform'] = scale;
4880
+ rippleStyle.transform = scale;
4881
+ rippleStyle.opacity = '1';
4882
+
4883
+ rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
4884
+ rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
4885
+ rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
4886
+ rippleStyle['transition-duration'] = Effect.duration + 'ms';
4887
+
4888
+ rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
4889
+ rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
4890
+ rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
4891
+ rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
4892
+
4893
+ ripple.setAttribute('style', convertStyle(rippleStyle));
4894
+ },
4895
+
4896
+ hide: function (e) {
4897
+ TouchHandler.touchup(e);
4898
+
4899
+ var el = this;
4900
+ var width = el.clientWidth * 1.4;
4901
+
4902
+ // Get first ripple
4903
+ var ripple = null;
4904
+ var ripples = el.getElementsByClassName('waves-ripple');
4905
+ if (ripples.length > 0) {
4906
+ ripple = ripples[ripples.length - 1];
4907
+ } else {
4908
+ return false;
4909
+ }
4910
+
4911
+ var relativeX = ripple.getAttribute('data-x');
4912
+ var relativeY = ripple.getAttribute('data-y');
4913
+ var scale = ripple.getAttribute('data-scale');
4914
+
4915
+ // Get delay beetween mousedown and mouse leave
4916
+ var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
4917
+ var delay = 350 - diff;
4918
+
4919
+ if (delay < 0) {
4920
+ delay = 0;
4921
+ }
4922
+
4923
+ // Fade out ripple after delay
4924
+ setTimeout(function () {
4925
+ var style = {
4926
+ 'top': relativeY + 'px',
4927
+ 'left': relativeX + 'px',
4928
+ 'opacity': '0',
4929
+
4930
+ // Duration
4931
+ '-webkit-transition-duration': Effect.duration + 'ms',
4932
+ '-moz-transition-duration': Effect.duration + 'ms',
4933
+ '-o-transition-duration': Effect.duration + 'ms',
4934
+ 'transition-duration': Effect.duration + 'ms',
4935
+ '-webkit-transform': scale,
4936
+ '-moz-transform': scale,
4937
+ '-ms-transform': scale,
4938
+ '-o-transform': scale,
4939
+ 'transform': scale
4940
+ };
4941
+
4942
+ ripple.setAttribute('style', convertStyle(style));
4943
+
4944
+ setTimeout(function () {
4945
+ try {
4946
+ el.removeChild(ripple);
4947
+ } catch (e) {
4948
+ return false;
4949
+ }
4950
+ }, Effect.duration);
4951
+ }, delay);
4952
+ },
4953
+
4954
+ // Little hack to make <input> can perform waves effect
4955
+ wrapInput: function (elements) {
4956
+ for (var a = 0; a < elements.length; a++) {
4957
+ var el = elements[a];
4958
+
4959
+ if (el.tagName.toLowerCase() === 'input') {
4960
+ var parent = el.parentNode;
4961
+
4962
+ // If input already have parent just pass through
4963
+ if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
4964
+ continue;
4965
+ }
4966
+
4967
+ // Put element class and style to the specified parent
4968
+ var wrapper = document.createElement('i');
4969
+ wrapper.className = el.className + ' waves-input-wrapper';
4970
+
4971
+ var elementStyle = el.getAttribute('style');
4972
+
4973
+ if (!elementStyle) {
4974
+ elementStyle = '';
4975
+ }
4976
+
4977
+ wrapper.setAttribute('style', elementStyle);
4978
+
4979
+ el.className = 'waves-button-input';
4980
+ el.removeAttribute('style');
4981
+
4982
+ // Put element as child
4983
+ parent.replaceChild(wrapper, el);
4984
+ wrapper.appendChild(el);
4985
+ }
4986
+ }
4987
+ }
4988
+ };
4989
+
4990
+ /**
4991
+ * Disable mousedown event for 500ms during and after touch
4992
+ */
4993
+ var TouchHandler = {
4994
+ /* uses an integer rather than bool so there's no issues with
4995
+ * needing to clear timeouts if another touch event occurred
4996
+ * within the 500ms. Cannot mouseup between touchstart and
4997
+ * touchend, nor in the 500ms after touchend. */
4998
+ touches: 0,
4999
+ allowEvent: function (e) {
5000
+ var allow = true;
5001
+
5002
+ if (e.type === 'touchstart') {
5003
+ TouchHandler.touches += 1; //push
5004
+ } else if (e.type === 'touchend' || e.type === 'touchcancel') {
5005
+ setTimeout(function () {
5006
+ if (TouchHandler.touches > 0) {
5007
+ TouchHandler.touches -= 1; //pop after 500ms
5008
+ }
5009
+ }, 500);
5010
+ } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
5011
+ allow = false;
5012
+ }
5013
+
5014
+ return allow;
5015
+ },
5016
+ touchup: function (e) {
5017
+ TouchHandler.allowEvent(e);
5018
+ }
5019
+ };
5020
+
5021
+ /**
5022
+ * Delegated click handler for .waves-effect element.
5023
+ * returns null when .waves-effect element not in "click tree"
5024
+ */
5025
+ function getWavesEffectElement(e) {
5026
+ if (TouchHandler.allowEvent(e) === false) {
5027
+ return null;
5028
+ }
5029
+
5030
+ var element = null;
5031
+ var target = e.target || e.srcElement;
5032
+
5033
+ while (target.parentNode !== null) {
5034
+ if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
5035
+ element = target;
5036
+ break;
5037
+ }
5038
+ target = target.parentNode;
5039
+ }
5040
+ return element;
5041
+ }
5042
+
5043
+ /**
5044
+ * Bubble the click and show effect if .waves-effect elem was found
5045
+ */
5046
+ function showEffect(e) {
5047
+ var element = getWavesEffectElement(e);
5048
+
5049
+ if (element !== null) {
5050
+ Effect.show(e, element);
5051
+
5052
+ if ('ontouchstart' in window) {
5053
+ element.addEventListener('touchend', Effect.hide, false);
5054
+ element.addEventListener('touchcancel', Effect.hide, false);
5055
+ }
5056
+
5057
+ element.addEventListener('mouseup', Effect.hide, false);
5058
+ element.addEventListener('mouseleave', Effect.hide, false);
5059
+ element.addEventListener('dragend', Effect.hide, false);
5060
+ }
5061
+ }
5062
+
5063
+ Waves.displayEffect = function (options) {
5064
+ options = options || {};
5065
+
5066
+ if ('duration' in options) {
5067
+ Effect.duration = options.duration;
5068
+ }
5069
+
5070
+ //Wrap input inside <i> tag
5071
+ Effect.wrapInput($$('.waves-effect'));
5072
+
5073
+ if ('ontouchstart' in window) {
5074
+ document.body.addEventListener('touchstart', showEffect, false);
5075
+ }
5076
+
5077
+ document.body.addEventListener('mousedown', showEffect, false);
5078
+ };
5079
+
5080
+ /**
5081
+ * Attach Waves to an input element (or any element which doesn't
5082
+ * bubble mouseup/mousedown events).
5083
+ * Intended to be used with dynamically loaded forms/inputs, or
5084
+ * where the user doesn't want a delegated click handler.
5085
+ */
5086
+ Waves.attach = function (element) {
5087
+ //FUTURE: automatically add waves classes and allow users
5088
+ // to specify them with an options param? Eg. light/classic/button
5089
+ if (element.tagName.toLowerCase() === 'input') {
5090
+ Effect.wrapInput([element]);
5091
+ element = element.parentNode;
5092
+ }
5093
+
5094
+ if ('ontouchstart' in window) {
5095
+ element.addEventListener('touchstart', showEffect, false);
5096
+ }
5097
+
5098
+ element.addEventListener('mousedown', showEffect, false);
5099
+ };
5100
+
5101
+ window.Waves = Waves;
5102
+
5103
+ document.addEventListener('DOMContentLoaded', function () {
5104
+ Waves.displayEffect();
5105
+ }, false);
5106
+ })(window);
5107
+ ;(function ($, anim) {
5108
+ 'use strict';
5109
+
5110
+ var _defaults = {
5111
+ html: '',
5112
+ displayLength: 4000,
5113
+ inDuration: 300,
5114
+ outDuration: 375,
5115
+ classes: '',
5116
+ completeCallback: null,
5117
+ activationPercent: 0.8
5118
+ };
5119
+
5120
+ var Toast = function () {
5121
+ function Toast(options) {
5122
+ _classCallCheck(this, Toast);
5123
+
5124
+ /**
5125
+ * Options for the toast
5126
+ * @member Toast#options
5127
+ */
5128
+ this.options = $.extend({}, Toast.defaults, options);
5129
+ this.message = this.options.html;
5130
+
5131
+ /**
5132
+ * Describes current pan state toast
5133
+ * @type {Boolean}
5134
+ */
5135
+ this.panning = false;
5136
+
5137
+ /**
5138
+ * Time remaining until toast is removed
5139
+ */
5140
+ this.timeRemaining = this.options.displayLength;
5141
+
5142
+ if (Toast._toasts.length === 0) {
5143
+ Toast._createContainer();
5144
+ }
5145
+
5146
+ // Create new toast
5147
+ Toast._toasts.push(this);
5148
+ var toastElement = this._createToast();
5149
+ toastElement.M_Toast = this;
5150
+ this.el = toastElement;
5151
+ this.$el = $(toastElement);
5152
+ this._animateIn();
5153
+ this._setTimer();
5154
+ }
5155
+
5156
+ _createClass(Toast, [{
5157
+ key: "_createToast",
5158
+
5159
+
5160
+ /**
5161
+ * Create toast and append it to toast container
5162
+ */
5163
+ value: function _createToast() {
5164
+ var toast = document.createElement('div');
5165
+ toast.classList.add('toast');
5166
+
5167
+ // Add custom classes onto toast
5168
+ if (!!this.options.classes.length) {
5169
+ $(toast).addClass(this.options.classes);
5170
+ }
5171
+
5172
+ // Set content
5173
+ 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') {
5174
+ toast.appendChild(this.message);
5175
+
5176
+ // Check if it is jQuery object
5177
+ } else if (!!this.message.jquery) {
5178
+ $(toast).append(this.message[0]);
5179
+
5180
+ // Insert as html;
5181
+ } else {
5182
+ toast.innerHTML = this.message;
5183
+ }
5184
+
5185
+ // Append toasft
5186
+ Toast._container.appendChild(toast);
5187
+ return toast;
5188
+ }
5189
+
5190
+ /**
5191
+ * Animate in toast
5192
+ */
5193
+
5194
+ }, {
5195
+ key: "_animateIn",
5196
+ value: function _animateIn() {
5197
+ // Animate toast in
5198
+ anim({
5199
+ targets: this.el,
5200
+ top: 0,
5201
+ opacity: 1,
5202
+ duration: this.options.inDuration,
5203
+ easing: 'easeOutCubic'
5204
+ });
5205
+ }
5206
+
5207
+ /**
5208
+ * Create setInterval which automatically removes toast when timeRemaining >= 0
5209
+ * has been reached
5210
+ */
5211
+
5212
+ }, {
5213
+ key: "_setTimer",
5214
+ value: function _setTimer() {
5215
+ var _this29 = this;
5216
+
5217
+ if (this.timeRemaining !== Infinity) {
5218
+ this.counterInterval = setInterval(function () {
5219
+ // If toast is not being dragged, decrease its time remaining
5220
+ if (!_this29.panning) {
5221
+ _this29.timeRemaining -= 20;
5222
+ }
5223
+
5224
+ // Animate toast out
5225
+ if (_this29.timeRemaining <= 0) {
5226
+ _this29.dismiss();
5227
+ }
5228
+ }, 20);
5229
+ }
5230
+ }
5231
+
5232
+ /**
5233
+ * Dismiss toast with animation
5234
+ */
5235
+
5236
+ }, {
5237
+ key: "dismiss",
5238
+ value: function dismiss() {
5239
+ var _this30 = this;
5240
+
5241
+ window.clearInterval(this.counterInterval);
5242
+ var activationDistance = this.el.offsetWidth * this.options.activationPercent;
5243
+
5244
+ if (this.wasSwiped) {
5245
+ this.el.style.transition = 'transform .05s, opacity .05s';
5246
+ this.el.style.transform = "translateX(" + activationDistance + "px)";
5247
+ this.el.style.opacity = 0;
5248
+ }
5249
+
5250
+ anim({
5251
+ targets: this.el,
5252
+ opacity: 0,
5253
+ marginTop: -40,
5254
+ duration: this.options.outDuration,
5255
+ easing: 'easeOutExpo',
5256
+ complete: function () {
5257
+ // Call the optional callback
5258
+ if (typeof _this30.options.completeCallback === 'function') {
5259
+ _this30.options.completeCallback();
5260
+ }
5261
+ // Remove toast from DOM
5262
+ _this30.$el.remove();
5263
+ Toast._toasts.splice(Toast._toasts.indexOf(_this30), 1);
5264
+ if (Toast._toasts.length === 0) {
5265
+ Toast._removeContainer();
5266
+ }
5267
+ }
5268
+ });
5269
+ }
5270
+ }], [{
5271
+ key: "getInstance",
5272
+
5273
+
5274
+ /**
5275
+ * Get Instance
5276
+ */
5277
+ value: function getInstance(el) {
5278
+ var domElem = !!el.jquery ? el[0] : el;
5279
+ return domElem.M_Toast;
5280
+ }
5281
+
5282
+ /**
5283
+ * Append toast container and add event handlers
5284
+ */
5285
+
5286
+ }, {
5287
+ key: "_createContainer",
5288
+ value: function _createContainer() {
5289
+ var container = document.createElement('div');
5290
+ container.setAttribute('id', 'toast-container');
5291
+
5292
+ // Add event handler
5293
+ container.addEventListener('touchstart', Toast._onDragStart);
5294
+ container.addEventListener('touchmove', Toast._onDragMove);
5295
+ container.addEventListener('touchend', Toast._onDragEnd);
5296
+
5297
+ container.addEventListener('mousedown', Toast._onDragStart);
5298
+ document.addEventListener('mousemove', Toast._onDragMove);
5299
+ document.addEventListener('mouseup', Toast._onDragEnd);
5300
+
5301
+ document.body.appendChild(container);
5302
+ Toast._container = container;
5303
+ }
5304
+
5305
+ /**
5306
+ * Remove toast container and event handlers
5307
+ */
5308
+
5309
+ }, {
5310
+ key: "_removeContainer",
5311
+ value: function _removeContainer() {
5312
+ // Add event handler
5313
+ document.removeEventListener('mousemove', Toast._onDragMove);
5314
+ document.removeEventListener('mouseup', Toast._onDragEnd);
5315
+
5316
+ $(Toast._container).remove();
5317
+ Toast._container = null;
5318
+ }
5319
+
5320
+ /**
5321
+ * Begin drag handler
5322
+ * @param {Event} e
5323
+ */
5324
+
5325
+ }, {
5326
+ key: "_onDragStart",
5327
+ value: function _onDragStart(e) {
5328
+ if (e.target && $(e.target).closest('.toast').length) {
5329
+ var $toast = $(e.target).closest('.toast');
5330
+ var toast = $toast[0].M_Toast;
5331
+ toast.panning = true;
5332
+ Toast._draggedToast = toast;
5333
+ toast.el.classList.add('panning');
5334
+ toast.el.style.transition = '';
5335
+ toast.startingXPos = Toast._xPos(e);
5336
+ toast.time = Date.now();
5337
+ toast.xPos = Toast._xPos(e);
5338
+ }
5339
+ }
5340
+
5341
+ /**
5342
+ * Drag move handler
5343
+ * @param {Event} e
5344
+ */
5345
+
5346
+ }, {
5347
+ key: "_onDragMove",
5348
+ value: function _onDragMove(e) {
5349
+ if (!!Toast._draggedToast) {
5350
+ e.preventDefault();
5351
+ var toast = Toast._draggedToast;
5352
+ toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
5353
+ toast.xPos = Toast._xPos(e);
5354
+ toast.velocityX = toast.deltaX / (Date.now() - toast.time);
5355
+ toast.time = Date.now();
5356
+
5357
+ var totalDeltaX = toast.xPos - toast.startingXPos;
5358
+ var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
5359
+ toast.el.style.transform = "translateX(" + totalDeltaX + "px)";
5360
+ toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
5361
+ }
5362
+ }
5363
+
5364
+ /**
5365
+ * End drag handler
5366
+ */
5367
+
5368
+ }, {
5369
+ key: "_onDragEnd",
5370
+ value: function _onDragEnd() {
5371
+ if (!!Toast._draggedToast) {
5372
+ var toast = Toast._draggedToast;
5373
+ toast.panning = false;
5374
+ toast.el.classList.remove('panning');
5375
+
5376
+ var totalDeltaX = toast.xPos - toast.startingXPos;
5377
+ var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
5378
+ var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
5379
+
5380
+ // Remove toast
5381
+ if (shouldBeDismissed) {
5382
+ toast.wasSwiped = true;
5383
+ toast.dismiss();
5384
+
5385
+ // Animate toast back to original position
5386
+ } else {
5387
+ toast.el.style.transition = 'transform .2s, opacity .2s';
5388
+ toast.el.style.transform = '';
5389
+ toast.el.style.opacity = '';
5390
+ }
5391
+ Toast._draggedToast = null;
5392
+ }
5393
+ }
5394
+
5395
+ /**
5396
+ * Get x position of mouse or touch event
5397
+ * @param {Event} e
5398
+ */
5399
+
5400
+ }, {
5401
+ key: "_xPos",
5402
+ value: function _xPos(e) {
5403
+ if (e.targetTouches && e.targetTouches.length >= 1) {
5404
+ return e.targetTouches[0].clientX;
5405
+ }
5406
+ // mouse event
5407
+ return e.clientX;
5408
+ }
5409
+
5410
+ /**
5411
+ * Remove all toasts
5412
+ */
5413
+
5414
+ }, {
5415
+ key: "dismissAll",
5416
+ value: function dismissAll() {
5417
+ for (var toastIndex in Toast._toasts) {
5418
+ Toast._toasts[toastIndex].dismiss();
5419
+ }
5420
+ }
5421
+ }, {
5422
+ key: "defaults",
5423
+ get: function () {
5424
+ return _defaults;
5425
+ }
5426
+ }]);
5427
+
5428
+ return Toast;
5429
+ }();
5430
+
5431
+ /**
5432
+ * @static
5433
+ * @memberof Toast
5434
+ * @type {Array.<Toast>}
5435
+ */
5436
+
5437
+
5438
+ Toast._toasts = [];
5439
+
5440
+ /**
5441
+ * @static
5442
+ * @memberof Toast
5443
+ */
5444
+ Toast._container = null;
5445
+
5446
+ /**
5447
+ * @static
5448
+ * @memberof Toast
5449
+ * @type {Toast}
5450
+ */
5451
+ Toast._draggedToast = null;
5452
+
5453
+ M.Toast = Toast;
5454
+ M.toast = function (options) {
5455
+ return new Toast(options);
5456
+ };
5457
+ })(cash, M.anime);
5458
+ ;(function ($, anim) {
5459
+ 'use strict';
5460
+
5461
+ var _defaults = {
5462
+ edge: 'left',
5463
+ draggable: true,
5464
+ inDuration: 250,
5465
+ outDuration: 200,
5466
+ onOpenStart: null,
5467
+ onOpenEnd: null,
5468
+ onCloseStart: null,
5469
+ onCloseEnd: null,
5470
+ preventScrolling: true
5471
+ };
5472
+
5473
+ /**
5474
+ * @class
5475
+ */
5476
+
5477
+ var Sidenav = function (_Component8) {
5478
+ _inherits(Sidenav, _Component8);
5479
+
5480
+ /**
5481
+ * Construct Sidenav instance and set up overlay
5482
+ * @constructor
5483
+ * @param {Element} el
5484
+ * @param {Object} options
5485
+ */
5486
+ function Sidenav(el, options) {
5487
+ _classCallCheck(this, Sidenav);
5488
+
5489
+ var _this31 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
5490
+
5491
+ _this31.el.M_Sidenav = _this31;
5492
+ _this31.id = _this31.$el.attr('id');
5493
+
5494
+ /**
5495
+ * Options for the Sidenav
5496
+ * @member Sidenav#options
5497
+ * @prop {String} [edge='left'] - Side of screen on which Sidenav appears
5498
+ * @prop {Boolean} [draggable=true] - Allow swipe gestures to open/close Sidenav
5499
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
5500
+ * @prop {Number} [outDuration=200] - Length in ms of exit transition
5501
+ * @prop {Function} onOpenStart - Function called when sidenav starts entering
5502
+ * @prop {Function} onOpenEnd - Function called when sidenav finishes entering
5503
+ * @prop {Function} onCloseStart - Function called when sidenav starts exiting
5504
+ * @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
5505
+ */
5506
+ _this31.options = $.extend({}, Sidenav.defaults, options);
5507
+
5508
+ /**
5509
+ * Describes open/close state of Sidenav
5510
+ * @type {Boolean}
5511
+ */
5512
+ _this31.isOpen = false;
5513
+
5514
+ /**
5515
+ * Describes if Sidenav is fixed
5516
+ * @type {Boolean}
5517
+ */
5518
+ _this31.isFixed = _this31.el.classList.contains('sidenav-fixed');
5519
+
5520
+ /**
5521
+ * Describes if Sidenav is being draggeed
5522
+ * @type {Boolean}
5523
+ */
5524
+ _this31.isDragged = false;
5525
+
5526
+ // Window size variables for window resize checks
5527
+ _this31.lastWindowWidth = window.innerWidth;
5528
+ _this31.lastWindowHeight = window.innerHeight;
5529
+
5530
+ _this31._createOverlay();
5531
+ _this31._createDragTarget();
5532
+ _this31._setupEventHandlers();
5533
+ _this31._setupClasses();
5534
+ _this31._setupFixed();
5535
+
5536
+ Sidenav._sidenavs.push(_this31);
5537
+ return _this31;
5538
+ }
5539
+
5540
+ _createClass(Sidenav, [{
5541
+ key: "destroy",
5542
+
5543
+
5544
+ /**
5545
+ * Teardown component
5546
+ */
5547
+ value: function destroy() {
5548
+ this._removeEventHandlers();
5549
+ this._enableBodyScrolling();
5550
+ this._overlay.parentNode.removeChild(this._overlay);
5551
+ this.dragTarget.parentNode.removeChild(this.dragTarget);
5552
+ this.el.M_Sidenav = undefined;
5553
+ this.el.style.transform = '';
5554
+
5555
+ var index = Sidenav._sidenavs.indexOf(this);
5556
+ if (index >= 0) {
5557
+ Sidenav._sidenavs.splice(index, 1);
5558
+ }
5559
+ }
5560
+ }, {
5561
+ key: "_createOverlay",
5562
+ value: function _createOverlay() {
5563
+ var overlay = document.createElement('div');
5564
+ this._closeBound = this.close.bind(this);
5565
+ overlay.classList.add('sidenav-overlay');
5566
+
5567
+ overlay.addEventListener('click', this._closeBound);
5568
+
5569
+ document.body.appendChild(overlay);
5570
+ this._overlay = overlay;
5571
+ }
5572
+ }, {
5573
+ key: "_setupEventHandlers",
5574
+ value: function _setupEventHandlers() {
5575
+ if (Sidenav._sidenavs.length === 0) {
5576
+ document.body.addEventListener('click', this._handleTriggerClick);
5577
+ }
5578
+
5579
+ this._handleDragTargetDragBound = this._handleDragTargetDrag.bind(this);
5580
+ this._handleDragTargetReleaseBound = this._handleDragTargetRelease.bind(this);
5581
+ this._handleCloseDragBound = this._handleCloseDrag.bind(this);
5582
+ this._handleCloseReleaseBound = this._handleCloseRelease.bind(this);
5583
+ this._handleCloseTriggerClickBound = this._handleCloseTriggerClick.bind(this);
5584
+
5585
+ this.dragTarget.addEventListener('touchmove', this._handleDragTargetDragBound);
5586
+ this.dragTarget.addEventListener('touchend', this._handleDragTargetReleaseBound);
5587
+ this._overlay.addEventListener('touchmove', this._handleCloseDragBound);
5588
+ this._overlay.addEventListener('touchend', this._handleCloseReleaseBound);
5589
+ this.el.addEventListener('touchmove', this._handleCloseDragBound);
5590
+ this.el.addEventListener('touchend', this._handleCloseReleaseBound);
5591
+ this.el.addEventListener('click', this._handleCloseTriggerClickBound);
5592
+
5593
+ // Add resize for side nav fixed
5594
+ if (this.isFixed) {
5595
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
5596
+ window.addEventListener('resize', this._handleWindowResizeBound);
5597
+ }
5598
+ }
5599
+ }, {
5600
+ key: "_removeEventHandlers",
5601
+ value: function _removeEventHandlers() {
5602
+ if (Sidenav._sidenavs.length === 1) {
5603
+ document.body.removeEventListener('click', this._handleTriggerClick);
5604
+ }
5605
+
5606
+ this.dragTarget.removeEventListener('touchmove', this._handleDragTargetDragBound);
5607
+ this.dragTarget.removeEventListener('touchend', this._handleDragTargetReleaseBound);
5608
+ this._overlay.removeEventListener('touchmove', this._handleCloseDragBound);
5609
+ this._overlay.removeEventListener('touchend', this._handleCloseReleaseBound);
5610
+ this.el.removeEventListener('touchmove', this._handleCloseDragBound);
5611
+ this.el.removeEventListener('touchend', this._handleCloseReleaseBound);
5612
+ this.el.removeEventListener('click', this._handleCloseTriggerClickBound);
5613
+
5614
+ // Remove resize for side nav fixed
5615
+ if (this.isFixed) {
5616
+ window.removeEventListener('resize', this._handleWindowResizeBound);
5617
+ }
5618
+ }
5619
+
5620
+ /**
5621
+ * Handle Trigger Click
5622
+ * @param {Event} e
5623
+ */
5624
+
5625
+ }, {
5626
+ key: "_handleTriggerClick",
5627
+ value: function _handleTriggerClick(e) {
5628
+ var $trigger = $(e.target).closest('.sidenav-trigger');
5629
+ if (e.target && $trigger.length) {
5630
+ var sidenavId = M.getIdFromTrigger($trigger[0]);
5631
+
5632
+ var sidenavInstance = document.getElementById(sidenavId).M_Sidenav;
5633
+ if (sidenavInstance) {
5634
+ sidenavInstance.open($trigger);
5635
+ }
5636
+ e.preventDefault();
5637
+ }
5638
+ }
5639
+
5640
+ /**
5641
+ * Set variables needed at the beggining of drag
5642
+ * and stop any current transition.
5643
+ * @param {Event} e
5644
+ */
5645
+
5646
+ }, {
5647
+ key: "_startDrag",
5648
+ value: function _startDrag(e) {
5649
+ var clientX = e.targetTouches[0].clientX;
5650
+ this.isDragged = true;
5651
+ this._startingXpos = clientX;
5652
+ this._xPos = this._startingXpos;
5653
+ this._time = Date.now();
5654
+ this._width = this.el.getBoundingClientRect().width;
5655
+ this._overlay.style.display = 'block';
5656
+ this._initialScrollTop = this.isOpen ? this.el.scrollTop : M.getDocumentScrollTop();
5657
+ this._verticallyScrolling = false;
5658
+ anim.remove(this.el);
5659
+ anim.remove(this._overlay);
5660
+ }
5661
+
5662
+ /**
5663
+ * Set variables needed at each drag move update tick
5664
+ * @param {Event} e
5665
+ */
5666
+
5667
+ }, {
5668
+ key: "_dragMoveUpdate",
5669
+ value: function _dragMoveUpdate(e) {
5670
+ var clientX = e.targetTouches[0].clientX;
5671
+ var currentScrollTop = this.isOpen ? this.el.scrollTop : M.getDocumentScrollTop();
5672
+ this.deltaX = Math.abs(this._xPos - clientX);
5673
+ this._xPos = clientX;
5674
+ this.velocityX = this.deltaX / (Date.now() - this._time);
5675
+ this._time = Date.now();
5676
+ if (this._initialScrollTop !== currentScrollTop) {
5677
+ this._verticallyScrolling = true;
5678
+ }
5679
+ }
5680
+
5681
+ /**
5682
+ * Handles Dragging of Sidenav
5683
+ * @param {Event} e
5684
+ */
5685
+
5686
+ }, {
5687
+ key: "_handleDragTargetDrag",
5688
+ value: function _handleDragTargetDrag(e) {
5689
+ // Check if draggable
5690
+ if (!this.options.draggable || this._isCurrentlyFixed() || this._verticallyScrolling) {
5691
+ return;
5692
+ }
5693
+
5694
+ // If not being dragged, set initial drag start variables
5695
+ if (!this.isDragged) {
5696
+ this._startDrag(e);
5697
+ }
5698
+
5699
+ // Run touchmove updates
5700
+ this._dragMoveUpdate(e);
5701
+
5702
+ // Calculate raw deltaX
5703
+ var totalDeltaX = this._xPos - this._startingXpos;
5704
+
5705
+ // dragDirection is the attempted user drag direction
5706
+ var dragDirection = totalDeltaX > 0 ? 'right' : 'left';
5707
+
5708
+ // Don't allow totalDeltaX to exceed Sidenav width or be dragged in the opposite direction
5709
+ totalDeltaX = Math.min(this._width, Math.abs(totalDeltaX));
5710
+ if (this.options.edge === dragDirection) {
5711
+ totalDeltaX = 0;
5712
+ }
5713
+
5714
+ /**
5715
+ * transformX is the drag displacement
5716
+ * transformPrefix is the initial transform placement
5717
+ * Invert values if Sidenav is right edge
5718
+ */
5719
+ var transformX = totalDeltaX;
5720
+ var transformPrefix = 'translateX(-100%)';
5721
+ if (this.options.edge === 'right') {
5722
+ transformPrefix = 'translateX(100%)';
5723
+ transformX = -transformX;
5724
+ }
5725
+
5726
+ // Calculate open/close percentage of sidenav, with open = 1 and close = 0
5727
+ this.percentOpen = Math.min(1, totalDeltaX / this._width);
5728
+
5729
+ // Set transform and opacity styles
5730
+ this.el.style.transform = transformPrefix + " translateX(" + transformX + "px)";
5731
+ this._overlay.style.opacity = this.percentOpen;
5732
+ }
5733
+
5734
+ /**
5735
+ * Handle Drag Target Release
5736
+ */
5737
+
5738
+ }, {
5739
+ key: "_handleDragTargetRelease",
5740
+ value: function _handleDragTargetRelease() {
5741
+ if (this.isDragged) {
5742
+ if (this.percentOpen > 0.2) {
5743
+ this.open();
5744
+ } else {
5745
+ this._animateOut();
5746
+ }
5747
+
5748
+ this.isDragged = false;
5749
+ this._verticallyScrolling = false;
5750
+ }
5751
+ }
5752
+
5753
+ /**
5754
+ * Handle Close Drag
5755
+ * @param {Event} e
5756
+ */
5757
+
5758
+ }, {
5759
+ key: "_handleCloseDrag",
5760
+ value: function _handleCloseDrag(e) {
5761
+ if (this.isOpen) {
5762
+ // Check if draggable
5763
+ if (!this.options.draggable || this._isCurrentlyFixed() || this._verticallyScrolling) {
5764
+ return;
5765
+ }
5766
+
5767
+ // If not being dragged, set initial drag start variables
5768
+ if (!this.isDragged) {
5769
+ this._startDrag(e);
5770
+ }
5771
+
5772
+ // Run touchmove updates
5773
+ this._dragMoveUpdate(e);
5774
+
5775
+ // Calculate raw deltaX
5776
+ var totalDeltaX = this._xPos - this._startingXpos;
5777
+
5778
+ // dragDirection is the attempted user drag direction
5779
+ var dragDirection = totalDeltaX > 0 ? 'right' : 'left';
5780
+
5781
+ // Don't allow totalDeltaX to exceed Sidenav width or be dragged in the opposite direction
5782
+ totalDeltaX = Math.min(this._width, Math.abs(totalDeltaX));
5783
+ if (this.options.edge !== dragDirection) {
5784
+ totalDeltaX = 0;
5785
+ }
5786
+
5787
+ var transformX = -totalDeltaX;
5788
+ if (this.options.edge === 'right') {
5789
+ transformX = -transformX;
5790
+ }
5791
+
5792
+ // Calculate open/close percentage of sidenav, with open = 1 and close = 0
5793
+ this.percentOpen = Math.min(1, 1 - totalDeltaX / this._width);
5794
+
5795
+ // Set transform and opacity styles
5796
+ this.el.style.transform = "translateX(" + transformX + "px)";
5797
+ this._overlay.style.opacity = this.percentOpen;
5798
+ }
5799
+ }
5800
+
5801
+ /**
5802
+ * Handle Close Release
5803
+ */
5804
+
5805
+ }, {
5806
+ key: "_handleCloseRelease",
5807
+ value: function _handleCloseRelease() {
5808
+ if (this.isOpen && this.isDragged) {
5809
+ if (this.percentOpen > 0.8) {
5810
+ this._animateIn();
5811
+ } else {
5812
+ this.close();
5813
+ }
5814
+
5815
+ this.isDragged = false;
5816
+ this._verticallyScrolling = false;
5817
+ }
5818
+ }
5819
+
5820
+ /**
5821
+ * Handles closing of Sidenav when element with class .sidenav-close
5822
+ */
5823
+
5824
+ }, {
5825
+ key: "_handleCloseTriggerClick",
5826
+ value: function _handleCloseTriggerClick(e) {
5827
+ var $closeTrigger = $(e.target).closest('.sidenav-close');
5828
+ if ($closeTrigger.length && !this._isCurrentlyFixed()) {
5829
+ this.close();
5830
+ }
5831
+ }
5832
+
5833
+ /**
5834
+ * Handle Window Resize
5835
+ */
5836
+
5837
+ }, {
5838
+ key: "_handleWindowResize",
5839
+ value: function _handleWindowResize() {
5840
+ // Only handle horizontal resizes
5841
+ if (this.lastWindowWidth !== window.innerWidth) {
5842
+ if (window.innerWidth > 992) {
5843
+ this.open();
5844
+ } else {
5845
+ this.close();
5846
+ }
5847
+ }
5848
+
5849
+ this.lastWindowWidth = window.innerWidth;
5850
+ this.lastWindowHeight = window.innerHeight;
5851
+ }
5852
+ }, {
5853
+ key: "_setupClasses",
5854
+ value: function _setupClasses() {
5855
+ if (this.options.edge === 'right') {
5856
+ this.el.classList.add('right-aligned');
5857
+ this.dragTarget.classList.add('right-aligned');
5858
+ }
5859
+ }
5860
+ }, {
5861
+ key: "_removeClasses",
5862
+ value: function _removeClasses() {
5863
+ this.el.classList.remove('right-aligned');
5864
+ this.dragTarget.classList.remove('right-aligned');
5865
+ }
5866
+ }, {
5867
+ key: "_setupFixed",
5868
+ value: function _setupFixed() {
5869
+ if (this._isCurrentlyFixed()) {
5870
+ this.open();
5871
+ }
5872
+ }
5873
+ }, {
5874
+ key: "_isCurrentlyFixed",
5875
+ value: function _isCurrentlyFixed() {
5876
+ return this.isFixed && window.innerWidth > 992;
5877
+ }
5878
+ }, {
5879
+ key: "_createDragTarget",
5880
+ value: function _createDragTarget() {
5881
+ var dragTarget = document.createElement('div');
5882
+ dragTarget.classList.add('drag-target');
5883
+ document.body.appendChild(dragTarget);
5884
+ this.dragTarget = dragTarget;
5885
+ }
5886
+ }, {
5887
+ key: "_preventBodyScrolling",
5888
+ value: function _preventBodyScrolling() {
5889
+ var body = document.body;
5890
+ body.style.overflow = 'hidden';
5891
+ }
5892
+ }, {
5893
+ key: "_enableBodyScrolling",
5894
+ value: function _enableBodyScrolling() {
5895
+ var body = document.body;
5896
+ body.style.overflow = '';
5897
+ }
5898
+ }, {
5899
+ key: "open",
5900
+ value: function open() {
5901
+ if (this.isOpen === true) {
5902
+ return;
5903
+ }
5904
+
5905
+ this.isOpen = true;
5906
+
5907
+ // Run onOpenStart callback
5908
+ if (typeof this.options.onOpenStart === 'function') {
5909
+ this.options.onOpenStart.call(this, this.el);
5910
+ }
5911
+
5912
+ // Handle fixed Sidenav
5913
+ if (this._isCurrentlyFixed()) {
5914
+ anim.remove(this.el);
5915
+ anim({
5916
+ targets: this.el,
5917
+ translateX: 0,
5918
+ duration: 0,
5919
+ easing: 'easeOutQuad'
5920
+ });
5921
+ this._enableBodyScrolling();
5922
+ this._overlay.style.display = 'none';
5923
+
5924
+ // Handle non-fixed Sidenav
5925
+ } else {
5926
+ if (this.options.preventScrolling) {
5927
+ this._preventBodyScrolling();
5928
+ }
5929
+
5930
+ if (!this.isDragged || this.percentOpen != 1) {
5931
+ this._animateIn();
5932
+ }
5933
+ }
5934
+ }
5935
+ }, {
5936
+ key: "close",
5937
+ value: function close() {
5938
+ if (this.isOpen === false) {
5939
+ return;
5940
+ }
5941
+
5942
+ this.isOpen = false;
5943
+
5944
+ // Run onCloseStart callback
5945
+ if (typeof this.options.onCloseStart === 'function') {
5946
+ this.options.onCloseStart.call(this, this.el);
5947
+ }
5948
+
5949
+ // Handle fixed Sidenav
5950
+ if (this._isCurrentlyFixed()) {
5951
+ var transformX = this.options.edge === 'left' ? '-105%' : '105%';
5952
+ this.el.style.transform = "translateX(" + transformX + ")";
5953
+
5954
+ // Handle non-fixed Sidenav
5955
+ } else {
5956
+ this._enableBodyScrolling();
5957
+
5958
+ if (!this.isDragged || this.percentOpen != 0) {
5959
+ this._animateOut();
5960
+ } else {
5961
+ this._overlay.style.display = 'none';
5962
+ }
5963
+ }
5964
+ }
5965
+ }, {
5966
+ key: "_animateIn",
5967
+ value: function _animateIn() {
5968
+ this._animateSidenavIn();
5969
+ this._animateOverlayIn();
5970
+ }
5971
+ }, {
5972
+ key: "_animateSidenavIn",
5973
+ value: function _animateSidenavIn() {
5974
+ var _this32 = this;
5975
+
5976
+ var slideOutPercent = this.options.edge === 'left' ? -1 : 1;
5977
+ if (this.isDragged) {
5978
+ slideOutPercent = this.options.edge === 'left' ? slideOutPercent + this.percentOpen : slideOutPercent - this.percentOpen;
5979
+ }
5980
+
5981
+ anim.remove(this.el);
5982
+ anim({
5983
+ targets: this.el,
5984
+ translateX: [slideOutPercent * 100 + "%", 0],
5985
+ duration: this.options.inDuration,
5986
+ easing: 'easeOutQuad',
5987
+ complete: function () {
5988
+ // Run onOpenEnd callback
5989
+ if (typeof _this32.options.onOpenEnd === 'function') {
5990
+ _this32.options.onOpenEnd.call(_this32, _this32.el);
5991
+ }
5992
+ }
5993
+ });
5994
+ }
5995
+ }, {
5996
+ key: "_animateOverlayIn",
5997
+ value: function _animateOverlayIn() {
5998
+ var start = 0;
5999
+ if (this.isDragged) {
6000
+ start = this.percentOpen;
6001
+ } else {
6002
+ $(this._overlay).css({
6003
+ display: 'block'
6004
+ });
6005
+ }
6006
+
6007
+ anim.remove(this._overlay);
6008
+ anim({
6009
+ targets: this._overlay,
6010
+ opacity: [start, 1],
6011
+ duration: this.options.inDuration,
6012
+ easing: 'easeOutQuad'
6013
+ });
6014
+ }
6015
+ }, {
6016
+ key: "_animateOut",
6017
+ value: function _animateOut() {
6018
+ this._animateSidenavOut();
6019
+ this._animateOverlayOut();
6020
+ }
6021
+ }, {
6022
+ key: "_animateSidenavOut",
6023
+ value: function _animateSidenavOut() {
6024
+ var _this33 = this;
6025
+
6026
+ var endPercent = this.options.edge === 'left' ? -1 : 1;
6027
+ var slideOutPercent = 0;
6028
+ if (this.isDragged) {
6029
+ slideOutPercent = this.options.edge === 'left' ? endPercent + this.percentOpen : endPercent - this.percentOpen;
6030
+ }
6031
+
6032
+ anim.remove(this.el);
6033
+ anim({
6034
+ targets: this.el,
6035
+ translateX: [slideOutPercent * 100 + "%", endPercent * 105 + "%"],
6036
+ duration: this.options.outDuration,
6037
+ easing: 'easeOutQuad',
6038
+ complete: function () {
6039
+ // Run onOpenEnd callback
6040
+ if (typeof _this33.options.onCloseEnd === 'function') {
6041
+ _this33.options.onCloseEnd.call(_this33, _this33.el);
6042
+ }
6043
+ }
6044
+ });
6045
+ }
6046
+ }, {
6047
+ key: "_animateOverlayOut",
6048
+ value: function _animateOverlayOut() {
6049
+ var _this34 = this;
6050
+
6051
+ anim.remove(this._overlay);
6052
+ anim({
6053
+ targets: this._overlay,
6054
+ opacity: 0,
6055
+ duration: this.options.outDuration,
6056
+ easing: 'easeOutQuad',
6057
+ complete: function () {
6058
+ $(_this34._overlay).css('display', 'none');
6059
+ }
6060
+ });
6061
+ }
6062
+ }], [{
6063
+ key: "init",
6064
+ value: function init(els, options) {
6065
+ return _get(Sidenav.__proto__ || Object.getPrototypeOf(Sidenav), "init", this).call(this, this, els, options);
6066
+ }
6067
+
6068
+ /**
6069
+ * Get Instance
6070
+ */
6071
+
6072
+ }, {
6073
+ key: "getInstance",
6074
+ value: function getInstance(el) {
6075
+ var domElem = !!el.jquery ? el[0] : el;
6076
+ return domElem.M_Sidenav;
6077
+ }
6078
+ }, {
6079
+ key: "defaults",
6080
+ get: function () {
6081
+ return _defaults;
6082
+ }
6083
+ }]);
6084
+
6085
+ return Sidenav;
6086
+ }(Component);
6087
+
6088
+ /**
6089
+ * @static
6090
+ * @memberof Sidenav
6091
+ * @type {Array.<Sidenav>}
6092
+ */
6093
+
6094
+
6095
+ Sidenav._sidenavs = [];
6096
+
6097
+ M.Sidenav = Sidenav;
6098
+
6099
+ if (M.jQueryLoaded) {
6100
+ M.initializeJqueryWrapper(Sidenav, 'sidenav', 'M_Sidenav');
6101
+ }
6102
+ })(cash, M.anime);
6103
+ ;(function ($, anim) {
6104
+ 'use strict';
6105
+
6106
+ var _defaults = {
6107
+ throttle: 100,
6108
+ scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
6109
+ activeClass: 'active',
6110
+ getActiveElement: function (id) {
6111
+ return 'a[href="#' + id + '"]';
6112
+ }
6113
+ };
6114
+
6115
+ /**
6116
+ * @class
6117
+ *
6118
+ */
6119
+
6120
+ var ScrollSpy = function (_Component9) {
6121
+ _inherits(ScrollSpy, _Component9);
6122
+
6123
+ /**
6124
+ * Construct ScrollSpy instance
6125
+ * @constructor
6126
+ * @param {Element} el
6127
+ * @param {Object} options
6128
+ */
6129
+ function ScrollSpy(el, options) {
6130
+ _classCallCheck(this, ScrollSpy);
6131
+
6132
+ var _this35 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
6133
+
6134
+ _this35.el.M_ScrollSpy = _this35;
6135
+
6136
+ /**
6137
+ * Options for the modal
6138
+ * @member Modal#options
6139
+ * @prop {Number} [throttle=100] - Throttle of scroll handler
6140
+ * @prop {Number} [scrollOffset=200] - Offset for centering element when scrolled to
6141
+ * @prop {String} [activeClass='active'] - Class applied to active elements
6142
+ * @prop {Function} [getActiveElement] - Used to find active element
6143
+ */
6144
+ _this35.options = $.extend({}, ScrollSpy.defaults, options);
6145
+
6146
+ // setup
6147
+ ScrollSpy._elements.push(_this35);
6148
+ ScrollSpy._count++;
6149
+ ScrollSpy._increment++;
6150
+ _this35.tickId = -1;
6151
+ _this35.id = ScrollSpy._increment;
6152
+ _this35._setupEventHandlers();
6153
+ _this35._handleWindowScroll();
6154
+ return _this35;
6155
+ }
6156
+
6157
+ _createClass(ScrollSpy, [{
6158
+ key: "destroy",
6159
+
6160
+
6161
+ /**
6162
+ * Teardown component
6163
+ */
6164
+ value: function destroy() {
6165
+ ScrollSpy._elements.splice(ScrollSpy._elements.indexOf(this), 1);
6166
+ ScrollSpy._elementsInView.splice(ScrollSpy._elementsInView.indexOf(this), 1);
6167
+ ScrollSpy._visibleElements.splice(ScrollSpy._visibleElements.indexOf(this.$el), 1);
6168
+ ScrollSpy._count--;
6169
+ this._removeEventHandlers();
6170
+ $(this.options.getActiveElement(this.$el.attr('id'))).removeClass(this.options.activeClass);
6171
+ this.el.M_ScrollSpy = undefined;
6172
+ }
6173
+
6174
+ /**
6175
+ * Setup Event Handlers
6176
+ */
6177
+
6178
+ }, {
6179
+ key: "_setupEventHandlers",
6180
+ value: function _setupEventHandlers() {
6181
+ var throttledResize = M.throttle(this._handleWindowScroll, 200);
6182
+ this._handleThrottledResizeBound = throttledResize.bind(this);
6183
+ this._handleWindowScrollBound = this._handleWindowScroll.bind(this);
6184
+ if (ScrollSpy._count === 1) {
6185
+ window.addEventListener('scroll', this._handleWindowScrollBound);
6186
+ window.addEventListener('resize', this._handleThrottledResizeBound);
6187
+ document.body.addEventListener('click', this._handleTriggerClick);
6188
+ }
6189
+ }
6190
+
6191
+ /**
6192
+ * Remove Event Handlers
6193
+ */
6194
+
6195
+ }, {
6196
+ key: "_removeEventHandlers",
6197
+ value: function _removeEventHandlers() {
6198
+ if (ScrollSpy._count === 0) {
6199
+ window.removeEventListener('scroll', this._handleWindowScrollBound);
6200
+ window.removeEventListener('resize', this._handleThrottledResizeBound);
6201
+ document.body.removeEventListener('click', this._handleTriggerClick);
6202
+ }
6203
+ }
6204
+
6205
+ /**
6206
+ * Handle Trigger Click
6207
+ * @param {Event} e
6208
+ */
6209
+
6210
+ }, {
6211
+ key: "_handleTriggerClick",
6212
+ value: function _handleTriggerClick(e) {
6213
+ var $trigger = $(e.target);
6214
+ for (var i = ScrollSpy._elements.length - 1; i >= 0; i--) {
6215
+ var scrollspy = ScrollSpy._elements[i];
6216
+ if ($trigger.is('a[href="#' + scrollspy.$el.attr('id') + '"]')) {
6217
+ e.preventDefault();
6218
+ var offset = scrollspy.$el.offset().top + 1;
6219
+
6220
+ anim({
6221
+ targets: [document.documentElement, document.body],
6222
+ scrollTop: offset - scrollspy.options.scrollOffset,
6223
+ duration: 400,
6224
+ easing: 'easeOutCubic'
6225
+ });
6226
+ break;
6227
+ }
6228
+ }
6229
+ }
6230
+
6231
+ /**
6232
+ * Handle Window Scroll
6233
+ */
6234
+
6235
+ }, {
6236
+ key: "_handleWindowScroll",
6237
+ value: function _handleWindowScroll() {
6238
+ // unique tick id
6239
+ ScrollSpy._ticks++;
6240
+
6241
+ // viewport rectangle
6242
+ var top = M.getDocumentScrollTop(),
6243
+ left = M.getDocumentScrollLeft(),
6244
+ right = left + window.innerWidth,
6245
+ bottom = top + window.innerHeight;
6246
+
6247
+ // determine which elements are in view
6248
+ var intersections = ScrollSpy._findElements(top, right, bottom, left);
6249
+ for (var i = 0; i < intersections.length; i++) {
6250
+ var scrollspy = intersections[i];
6251
+ var lastTick = scrollspy.tickId;
6252
+ if (lastTick < 0) {
6253
+ // entered into view
6254
+ scrollspy._enter();
6255
+ }
6256
+
6257
+ // update tick id
6258
+ scrollspy.tickId = ScrollSpy._ticks;
6259
+ }
6260
+
6261
+ for (var _i = 0; _i < ScrollSpy._elementsInView.length; _i++) {
6262
+ var _scrollspy = ScrollSpy._elementsInView[_i];
6263
+ var _lastTick = _scrollspy.tickId;
6264
+ if (_lastTick >= 0 && _lastTick !== ScrollSpy._ticks) {
6265
+ // exited from view
6266
+ _scrollspy._exit();
6267
+ _scrollspy.tickId = -1;
6268
+ }
6269
+ }
6270
+
6271
+ // remember elements in view for next tick
6272
+ ScrollSpy._elementsInView = intersections;
6273
+ }
6274
+
6275
+ /**
6276
+ * Find elements that are within the boundary
6277
+ * @param {number} top
6278
+ * @param {number} right
6279
+ * @param {number} bottom
6280
+ * @param {number} left
6281
+ * @return {Array.<ScrollSpy>} A collection of elements
6282
+ */
6283
+
6284
+ }, {
6285
+ key: "_enter",
6286
+ value: function _enter() {
6287
+ ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (value) {
6288
+ return value.height() != 0;
6289
+ });
6290
+
6291
+ if (ScrollSpy._visibleElements[0]) {
6292
+ $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).removeClass(this.options.activeClass);
6293
+ if (ScrollSpy._visibleElements[0][0].M_ScrollSpy && this.id < ScrollSpy._visibleElements[0][0].M_ScrollSpy.id) {
6294
+ ScrollSpy._visibleElements.unshift(this.$el);
6295
+ } else {
6296
+ ScrollSpy._visibleElements.push(this.$el);
6297
+ }
6298
+ } else {
6299
+ ScrollSpy._visibleElements.push(this.$el);
6300
+ }
6301
+
6302
+ $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).addClass(this.options.activeClass);
6303
+ }
6304
+ }, {
6305
+ key: "_exit",
6306
+ value: function _exit() {
6307
+ var _this36 = this;
6308
+
6309
+ ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (value) {
6310
+ return value.height() != 0;
6311
+ });
6312
+
6313
+ if (ScrollSpy._visibleElements[0]) {
6314
+ $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).removeClass(this.options.activeClass);
6315
+
6316
+ ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (el) {
6317
+ return el.attr('id') != _this36.$el.attr('id');
6318
+ });
6319
+ if (ScrollSpy._visibleElements[0]) {
6320
+ // Check if empty
6321
+ $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).addClass(this.options.activeClass);
6322
+ }
6323
+ }
6324
+ }
6325
+ }], [{
6326
+ key: "init",
6327
+ value: function init(els, options) {
6328
+ return _get(ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy), "init", this).call(this, this, els, options);
6329
+ }
6330
+
6331
+ /**
6332
+ * Get Instance
6333
+ */
6334
+
6335
+ }, {
6336
+ key: "getInstance",
6337
+ value: function getInstance(el) {
6338
+ var domElem = !!el.jquery ? el[0] : el;
6339
+ return domElem.M_ScrollSpy;
6340
+ }
6341
+ }, {
6342
+ key: "_findElements",
6343
+ value: function _findElements(top, right, bottom, left) {
6344
+ var hits = [];
6345
+ for (var i = 0; i < ScrollSpy._elements.length; i++) {
6346
+ var scrollspy = ScrollSpy._elements[i];
6347
+ var currTop = top + scrollspy.options.scrollOffset || 200;
6348
+
6349
+ if (scrollspy.$el.height() > 0) {
6350
+ var elTop = scrollspy.$el.offset().top,
6351
+ elLeft = scrollspy.$el.offset().left,
6352
+ elRight = elLeft + scrollspy.$el.width(),
6353
+ elBottom = elTop + scrollspy.$el.height();
6354
+
6355
+ var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < currTop);
6356
+
6357
+ if (isIntersect) {
6358
+ hits.push(scrollspy);
6359
+ }
6360
+ }
6361
+ }
6362
+ return hits;
6363
+ }
6364
+ }, {
6365
+ key: "defaults",
6366
+ get: function () {
6367
+ return _defaults;
6368
+ }
6369
+ }]);
6370
+
6371
+ return ScrollSpy;
6372
+ }(Component);
6373
+
6374
+ /**
6375
+ * @static
6376
+ * @memberof ScrollSpy
6377
+ * @type {Array.<ScrollSpy>}
6378
+ */
6379
+
6380
+
6381
+ ScrollSpy._elements = [];
6382
+
6383
+ /**
6384
+ * @static
6385
+ * @memberof ScrollSpy
6386
+ * @type {Array.<ScrollSpy>}
6387
+ */
6388
+ ScrollSpy._elementsInView = [];
6389
+
6390
+ /**
6391
+ * @static
6392
+ * @memberof ScrollSpy
6393
+ * @type {Array.<cash>}
6394
+ */
6395
+ ScrollSpy._visibleElements = [];
6396
+
6397
+ /**
6398
+ * @static
6399
+ * @memberof ScrollSpy
6400
+ */
6401
+ ScrollSpy._count = 0;
6402
+
6403
+ /**
6404
+ * @static
6405
+ * @memberof ScrollSpy
6406
+ */
6407
+ ScrollSpy._increment = 0;
6408
+
6409
+ /**
6410
+ * @static
6411
+ * @memberof ScrollSpy
6412
+ */
6413
+ ScrollSpy._ticks = 0;
6414
+
6415
+ M.ScrollSpy = ScrollSpy;
6416
+
6417
+ if (M.jQueryLoaded) {
6418
+ M.initializeJqueryWrapper(ScrollSpy, 'scrollSpy', 'M_ScrollSpy');
6419
+ }
6420
+ })(cash, M.anime);
6421
+ ;(function ($) {
6422
+ 'use strict';
6423
+
6424
+ var _defaults = {
6425
+ data: {}, // Autocomplete data set
6426
+ limit: Infinity, // Limit of results the autocomplete shows
6427
+ onAutocomplete: null, // Callback for when autocompleted
6428
+ minLength: 1, // Min characters before autocomplete starts
6429
+ sortFunction: function (a, b, inputString) {
6430
+ // Sort function for sorting autocomplete results
6431
+ return a.indexOf(inputString) - b.indexOf(inputString);
6432
+ }
6433
+ };
6434
+
6435
+ /**
6436
+ * @class
6437
+ *
6438
+ */
6439
+
6440
+ var Autocomplete = function (_Component10) {
6441
+ _inherits(Autocomplete, _Component10);
6442
+
6443
+ /**
6444
+ * Construct Autocomplete instance
6445
+ * @constructor
6446
+ * @param {Element} el
6447
+ * @param {Object} options
6448
+ */
6449
+ function Autocomplete(el, options) {
6450
+ _classCallCheck(this, Autocomplete);
6451
+
6452
+ var _this37 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options));
6453
+
6454
+ _this37.el.M_Autocomplete = _this37;
6455
+
6456
+ /**
6457
+ * Options for the autocomplete
6458
+ * @member Autocomplete#options
6459
+ * @prop {Number} duration
6460
+ * @prop {Number} dist
6461
+ * @prop {number} shift
6462
+ * @prop {number} padding
6463
+ * @prop {Boolean} fullWidth
6464
+ * @prop {Boolean} indicators
6465
+ * @prop {Boolean} noWrap
6466
+ * @prop {Function} onCycleTo
6467
+ */
6468
+ _this37.options = $.extend({}, Autocomplete.defaults, options);
6469
+
6470
+ // Setup
6471
+ _this37.isOpen = false;
6472
+ _this37.count = 0;
6473
+ _this37.activeIndex = -1;
6474
+ _this37.oldVal;
6475
+ _this37.$inputField = _this37.$el.closest('.input-field');
6476
+ _this37.$active = $();
6477
+ _this37._mousedown = false;
6478
+ _this37._setupDropdown();
6479
+
6480
+ _this37._setupEventHandlers();
6481
+ return _this37;
6482
+ }
6483
+
6484
+ _createClass(Autocomplete, [{
6485
+ key: "destroy",
6486
+
6487
+
6488
+ /**
6489
+ * Teardown component
6490
+ */
6491
+ value: function destroy() {
6492
+ this._removeEventHandlers();
6493
+ this._removeDropdown();
6494
+ this.el.M_Autocomplete = undefined;
6495
+ }
6496
+
6497
+ /**
6498
+ * Setup Event Handlers
6499
+ */
6500
+
6501
+ }, {
6502
+ key: "_setupEventHandlers",
6503
+ value: function _setupEventHandlers() {
6504
+ this._handleInputBlurBound = this._handleInputBlur.bind(this);
6505
+ this._handleInputKeyupAndFocusBound = this._handleInputKeyupAndFocus.bind(this);
6506
+ this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
6507
+ this._handleInputClickBound = this._handleInputClick.bind(this);
6508
+ this._handleContainerMousedownAndTouchstartBound = this._handleContainerMousedownAndTouchstart.bind(this);
6509
+ this._handleContainerMouseupAndTouchendBound = this._handleContainerMouseupAndTouchend.bind(this);
6510
+
6511
+ this.el.addEventListener('blur', this._handleInputBlurBound);
6512
+ this.el.addEventListener('keyup', this._handleInputKeyupAndFocusBound);
6513
+ this.el.addEventListener('focus', this._handleInputKeyupAndFocusBound);
6514
+ this.el.addEventListener('keydown', this._handleInputKeydownBound);
6515
+ this.el.addEventListener('click', this._handleInputClickBound);
6516
+ this.container.addEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6517
+ this.container.addEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6518
+
6519
+ if (typeof window.ontouchstart !== 'undefined') {
6520
+ this.container.addEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6521
+ this.container.addEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6522
+ }
6523
+ }
6524
+
6525
+ /**
6526
+ * Remove Event Handlers
6527
+ */
6528
+
6529
+ }, {
6530
+ key: "_removeEventHandlers",
6531
+ value: function _removeEventHandlers() {
6532
+ this.el.removeEventListener('blur', this._handleInputBlurBound);
6533
+ this.el.removeEventListener('keyup', this._handleInputKeyupAndFocusBound);
6534
+ this.el.removeEventListener('focus', this._handleInputKeyupAndFocusBound);
6535
+ this.el.removeEventListener('keydown', this._handleInputKeydownBound);
6536
+ this.el.removeEventListener('click', this._handleInputClickBound);
6537
+ this.container.removeEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6538
+ this.container.removeEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6539
+
6540
+ if (typeof window.ontouchstart !== 'undefined') {
6541
+ this.container.removeEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6542
+ this.container.removeEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6543
+ }
6544
+ }
6545
+
6546
+ /**
6547
+ * Setup dropdown
6548
+ */
6549
+
6550
+ }, {
6551
+ key: "_setupDropdown",
6552
+ value: function _setupDropdown() {
6553
+ var _this38 = this;
6554
+
6555
+ this.container = document.createElement('ul');
6556
+ this.container.id = "autocomplete-options-" + M.guid();
6557
+ $(this.container).addClass('autocomplete-content dropdown-content');
6558
+ this.$inputField.append(this.container);
6559
+ this.el.setAttribute('data-target', this.container.id);
6560
+
6561
+ this.dropdown = M.Dropdown.init(this.el, {
6562
+ autoFocus: false,
6563
+ closeOnClick: false,
6564
+ coverTrigger: false,
6565
+ onItemClick: function (itemEl) {
6566
+ _this38.selectOption($(itemEl));
6567
+ }
6568
+ });
6569
+
6570
+ // Sketchy removal of dropdown click handler
6571
+ this.el.removeEventListener('click', this.dropdown._handleClickBound);
6572
+ }
6573
+
6574
+ /**
6575
+ * Remove dropdown
6576
+ */
6577
+
6578
+ }, {
6579
+ key: "_removeDropdown",
6580
+ value: function _removeDropdown() {
6581
+ this.container.parentNode.removeChild(this.container);
6582
+ }
6583
+
6584
+ /**
6585
+ * Handle Input Blur
6586
+ */
6587
+
6588
+ }, {
6589
+ key: "_handleInputBlur",
6590
+ value: function _handleInputBlur() {
6591
+ if (!this._mousedown) {
6592
+ this.close();
6593
+ this._resetAutocomplete();
6594
+ }
6595
+ }
6596
+
6597
+ /**
6598
+ * Handle Input Keyup and Focus
6599
+ * @param {Event} e
6600
+ */
6601
+
6602
+ }, {
6603
+ key: "_handleInputKeyupAndFocus",
6604
+ value: function _handleInputKeyupAndFocus(e) {
6605
+ if (e.type === 'keyup') {
6606
+ Autocomplete._keydown = false;
6607
+ }
6608
+
6609
+ this.count = 0;
6610
+ var val = this.el.value.toLowerCase();
6611
+
6612
+ // Don't capture enter or arrow key usage.
6613
+ if (e.keyCode === 13 || e.keyCode === 38 || e.keyCode === 40) {
6614
+ return;
6615
+ }
6616
+
6617
+ // Check if the input isn't empty
6618
+ // Check if focus triggered by tab
6619
+ if (this.oldVal !== val && (M.tabPressed || e.type !== 'focus')) {
6620
+ this.open();
6621
+ }
6622
+
6623
+ // Update oldVal
6624
+ this.oldVal = val;
6625
+ }
6626
+
6627
+ /**
6628
+ * Handle Input Keydown
6629
+ * @param {Event} e
6630
+ */
6631
+
6632
+ }, {
6633
+ key: "_handleInputKeydown",
6634
+ value: function _handleInputKeydown(e) {
6635
+ Autocomplete._keydown = true;
6636
+
6637
+ // Arrow keys and enter key usage
6638
+ var keyCode = e.keyCode,
6639
+ liElement = void 0,
6640
+ numItems = $(this.container).children('li').length;
6641
+
6642
+ // select element on Enter
6643
+ if (keyCode === M.keys.ENTER && this.activeIndex >= 0) {
6644
+ liElement = $(this.container).children('li').eq(this.activeIndex);
6645
+ if (liElement.length) {
6646
+ this.selectOption(liElement);
6647
+ e.preventDefault();
6648
+ }
6649
+ return;
6650
+ }
6651
+
6652
+ // Capture up and down key
6653
+ if (keyCode === M.keys.ARROW_UP || keyCode === M.keys.ARROW_DOWN) {
6654
+ e.preventDefault();
6655
+
6656
+ if (keyCode === M.keys.ARROW_UP && this.activeIndex > 0) {
6657
+ this.activeIndex--;
6658
+ }
6659
+
6660
+ if (keyCode === M.keys.ARROW_DOWN && this.activeIndex < numItems - 1) {
6661
+ this.activeIndex++;
6662
+ }
6663
+
6664
+ this.$active.removeClass('active');
6665
+ if (this.activeIndex >= 0) {
6666
+ this.$active = $(this.container).children('li').eq(this.activeIndex);
6667
+ this.$active.addClass('active');
6668
+ }
6669
+ }
6670
+ }
6671
+
6672
+ /**
6673
+ * Handle Input Click
6674
+ * @param {Event} e
6675
+ */
6676
+
6677
+ }, {
6678
+ key: "_handleInputClick",
6679
+ value: function _handleInputClick(e) {
6680
+ this.open();
6681
+ }
6682
+
6683
+ /**
6684
+ * Handle Container Mousedown and Touchstart
6685
+ * @param {Event} e
6686
+ */
6687
+
6688
+ }, {
6689
+ key: "_handleContainerMousedownAndTouchstart",
6690
+ value: function _handleContainerMousedownAndTouchstart(e) {
6691
+ this._mousedown = true;
6692
+ }
6693
+
6694
+ /**
6695
+ * Handle Container Mouseup and Touchend
6696
+ * @param {Event} e
6697
+ */
6698
+
6699
+ }, {
6700
+ key: "_handleContainerMouseupAndTouchend",
6701
+ value: function _handleContainerMouseupAndTouchend(e) {
6702
+ this._mousedown = false;
6703
+ }
6704
+
6705
+ /**
6706
+ * Highlight partial match
6707
+ */
6708
+
6709
+ }, {
6710
+ key: "_highlight",
6711
+ value: function _highlight(string, $el) {
6712
+ var img = $el.find('img');
6713
+ var matchStart = $el.text().toLowerCase().indexOf('' + string.toLowerCase() + ''),
6714
+ matchEnd = matchStart + string.length - 1,
6715
+ beforeMatch = $el.text().slice(0, matchStart),
6716
+ matchText = $el.text().slice(matchStart, matchEnd + 1),
6717
+ afterMatch = $el.text().slice(matchEnd + 1);
6718
+ $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
6719
+ if (img.length) {
6720
+ $el.prepend(img);
6721
+ }
6722
+ }
6723
+
6724
+ /**
6725
+ * Reset current element position
6726
+ */
6727
+
6728
+ }, {
6729
+ key: "_resetCurrentElement",
6730
+ value: function _resetCurrentElement() {
6731
+ this.activeIndex = -1;
6732
+ this.$active.removeClass('active');
6733
+ }
6734
+
6735
+ /**
6736
+ * Reset autocomplete elements
6737
+ */
6738
+
6739
+ }, {
6740
+ key: "_resetAutocomplete",
6741
+ value: function _resetAutocomplete() {
6742
+ $(this.container).empty();
6743
+ this._resetCurrentElement();
6744
+ this.oldVal = null;
6745
+ this.isOpen = false;
6746
+ this._mousedown = false;
6747
+ }
6748
+
6749
+ /**
6750
+ * Select autocomplete option
6751
+ * @param {Element} el Autocomplete option list item element
6752
+ */
6753
+
6754
+ }, {
6755
+ key: "selectOption",
6756
+ value: function selectOption(el) {
6757
+ var text = el.text().trim();
6758
+ this.el.value = text;
6759
+ this.$el.trigger('change');
6760
+ this._resetAutocomplete();
6761
+ this.close();
6762
+
6763
+ // Handle onAutocomplete callback.
6764
+ if (typeof this.options.onAutocomplete === 'function') {
6765
+ this.options.onAutocomplete.call(this, text);
6766
+ }
6767
+ }
6768
+
6769
+ /**
6770
+ * Render dropdown content
6771
+ * @param {Object} data data set
6772
+ * @param {String} val current input value
6773
+ */
6774
+
6775
+ }, {
6776
+ key: "_renderDropdown",
6777
+ value: function _renderDropdown(data, val) {
6778
+ var _this39 = this;
6779
+
6780
+ this._resetAutocomplete();
6781
+
6782
+ var matchingData = [];
6783
+
6784
+ // Gather all matching data
6785
+ for (var key in data) {
6786
+ if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
6787
+ // Break if past limit
6788
+ if (this.count >= this.options.limit) {
6789
+ break;
6790
+ }
6791
+
6792
+ var entry = {
6793
+ data: data[key],
6794
+ key: key
6795
+ };
6796
+ matchingData.push(entry);
6797
+
6798
+ this.count++;
6799
+ }
6800
+ }
6801
+
6802
+ // Sort
6803
+ if (this.options.sortFunction) {
6804
+ var sortFunctionBound = function (a, b) {
6805
+ return _this39.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6806
+ };
6807
+ matchingData.sort(sortFunctionBound);
6808
+ }
6809
+
6810
+ // Render
6811
+ for (var i = 0; i < matchingData.length; i++) {
6812
+ var _entry = matchingData[i];
6813
+ var $autocompleteOption = $('<li></li>');
6814
+ if (!!_entry.data) {
6815
+ $autocompleteOption.append("<img src=\"" + _entry.data + "\" class=\"right circle\"><span>" + _entry.key + "</span>");
6816
+ } else {
6817
+ $autocompleteOption.append('<span>' + _entry.key + '</span>');
6818
+ }
6819
+
6820
+ $(this.container).append($autocompleteOption);
6821
+ this._highlight(val, $autocompleteOption);
6822
+ }
6823
+ }
6824
+
6825
+ /**
6826
+ * Open Autocomplete Dropdown
6827
+ */
6828
+
6829
+ }, {
6830
+ key: "open",
6831
+ value: function open() {
6832
+ var val = this.el.value.toLowerCase();
6833
+
6834
+ this._resetAutocomplete();
6835
+
6836
+ if (val.length >= this.options.minLength) {
6837
+ this.isOpen = true;
6838
+ this._renderDropdown(this.options.data, val);
6839
+ }
6840
+
6841
+ // Open dropdown
6842
+ if (!this.dropdown.isOpen) {
6843
+ this.dropdown.open();
6844
+ } else {
6845
+ // Recalculate dropdown when its already open
6846
+ this.dropdown.recalculateDimensions();
6847
+ }
6848
+ }
6849
+
6850
+ /**
6851
+ * Close Autocomplete Dropdown
6852
+ */
6853
+
6854
+ }, {
6855
+ key: "close",
6856
+ value: function close() {
6857
+ this.dropdown.close();
6858
+ }
6859
+
6860
+ /**
6861
+ * Update Data
6862
+ * @param {Object} data
6863
+ */
6864
+
6865
+ }, {
6866
+ key: "updateData",
6867
+ value: function updateData(data) {
6868
+ var val = this.el.value.toLowerCase();
6869
+ this.options.data = data;
6870
+
6871
+ if (this.isOpen) {
6872
+ this._renderDropdown(data, val);
6873
+ }
6874
+ }
6875
+ }], [{
6876
+ key: "init",
6877
+ value: function init(els, options) {
6878
+ return _get(Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete), "init", this).call(this, this, els, options);
6879
+ }
6880
+
6881
+ /**
6882
+ * Get Instance
6883
+ */
6884
+
6885
+ }, {
6886
+ key: "getInstance",
6887
+ value: function getInstance(el) {
6888
+ var domElem = !!el.jquery ? el[0] : el;
6889
+ return domElem.M_Autocomplete;
6890
+ }
6891
+ }, {
6892
+ key: "defaults",
6893
+ get: function () {
6894
+ return _defaults;
6895
+ }
6896
+ }]);
6897
+
6898
+ return Autocomplete;
6899
+ }(Component);
6900
+
6901
+ /**
6902
+ * @static
6903
+ * @memberof Autocomplete
6904
+ */
6905
+
6906
+
6907
+ Autocomplete._keydown = false;
6908
+
6909
+ M.Autocomplete = Autocomplete;
6910
+
6911
+ if (M.jQueryLoaded) {
6912
+ M.initializeJqueryWrapper(Autocomplete, 'autocomplete', 'M_Autocomplete');
6913
+ }
6914
+ })(cash);
6915
+ ;(function ($) {
6916
+ // Function to update labels of text fields
6917
+ M.updateTextFields = function () {
6918
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea';
6919
+ $(input_selector).each(function (element, index) {
6920
+ var $this = $(this);
6921
+ if (element.value.length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== null) {
6922
+ $this.siblings('label').addClass('active');
6923
+ } else if (element.validity) {
6924
+ $this.siblings('label').toggleClass('active', element.validity.badInput === true);
6925
+ } else {
6926
+ $this.siblings('label').removeClass('active');
6927
+ }
6928
+ });
6929
+ };
6930
+
6931
+ M.validate_field = function (object) {
6932
+ var hasLength = object.attr('data-length') !== null;
6933
+ var lenAttr = parseInt(object.attr('data-length'));
6934
+ var len = object[0].value.length;
6935
+
6936
+ if (len === 0 && object[0].validity.badInput === false && !object.is(':required')) {
6937
+ if (object.hasClass('validate')) {
6938
+ object.removeClass('valid');
6939
+ object.removeClass('invalid');
6940
+ }
6941
+ } else {
6942
+ if (object.hasClass('validate')) {
6943
+ // Check for character counter attributes
6944
+ if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
6945
+ object.removeClass('invalid');
6946
+ object.addClass('valid');
6947
+ } else {
6948
+ object.removeClass('valid');
6949
+ object.addClass('invalid');
6950
+ }
6951
+ }
6952
+ }
6953
+ };
6954
+
6955
+ M.textareaAutoResize = function ($textarea) {
6956
+ // Wrap if native element
6957
+ if ($textarea instanceof Element) {
6958
+ $textarea = $($textarea);
6959
+ }
6960
+
6961
+ if (!$textarea.length) {
6962
+ console.error('No textarea element found');
6963
+ return;
6964
+ }
6965
+
6966
+ // Textarea Auto Resize
6967
+ var hiddenDiv = $('.hiddendiv').first();
6968
+ if (!hiddenDiv.length) {
6969
+ hiddenDiv = $('<div class="hiddendiv common"></div>');
6970
+ $('body').append(hiddenDiv);
6971
+ }
6972
+
6973
+ // Set font properties of hiddenDiv
6974
+ var fontFamily = $textarea.css('font-family');
6975
+ var fontSize = $textarea.css('font-size');
6976
+ var lineHeight = $textarea.css('line-height');
6977
+
6978
+ // Firefox can't handle padding shorthand.
6979
+ var paddingTop = $textarea.css('padding-top');
6980
+ var paddingRight = $textarea.css('padding-right');
6981
+ var paddingBottom = $textarea.css('padding-bottom');
6982
+ var paddingLeft = $textarea.css('padding-left');
6983
+
6984
+ if (fontSize) {
6985
+ hiddenDiv.css('font-size', fontSize);
6986
+ }
6987
+ if (fontFamily) {
6988
+ hiddenDiv.css('font-family', fontFamily);
6989
+ }
6990
+ if (lineHeight) {
6991
+ hiddenDiv.css('line-height', lineHeight);
6992
+ }
6993
+ if (paddingTop) {
6994
+ hiddenDiv.css('padding-top', paddingTop);
6995
+ }
6996
+ if (paddingRight) {
6997
+ hiddenDiv.css('padding-right', paddingRight);
6998
+ }
6999
+ if (paddingBottom) {
7000
+ hiddenDiv.css('padding-bottom', paddingBottom);
7001
+ }
7002
+ if (paddingLeft) {
7003
+ hiddenDiv.css('padding-left', paddingLeft);
7004
+ }
7005
+
7006
+ // Set original-height, if none
7007
+ if (!$textarea.data('original-height')) {
7008
+ $textarea.data('original-height', $textarea.height());
7009
+ }
7010
+
7011
+ if ($textarea.attr('wrap') === 'off') {
7012
+ hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
7013
+ }
7014
+
7015
+ hiddenDiv.text($textarea[0].value + '\n');
7016
+ var content = hiddenDiv.html().replace(/\n/g, '<br>');
7017
+ hiddenDiv.html(content);
7018
+
7019
+ // When textarea is hidden, width goes crazy.
7020
+ // Approximate with half of window size
7021
+
7022
+ if ($textarea[0].offsetWidth > 0 && $textarea[0].offsetHeight > 0) {
7023
+ hiddenDiv.css('width', $textarea.width() + 'px');
7024
+ } else {
7025
+ hiddenDiv.css('width', window.innerWidth / 2 + 'px');
7026
+ }
7027
+
7028
+ /**
7029
+ * Resize if the new height is greater than the
7030
+ * original height of the textarea
7031
+ */
7032
+ if ($textarea.data('original-height') <= hiddenDiv.innerHeight()) {
7033
+ $textarea.css('height', hiddenDiv.innerHeight() + 'px');
7034
+ } else if ($textarea[0].value.length < $textarea.data('previous-length')) {
7035
+ /**
7036
+ * In case the new height is less than original height, it
7037
+ * means the textarea has less text than before
7038
+ * So we set the height to the original one
7039
+ */
7040
+ $textarea.css('height', $textarea.data('original-height') + 'px');
7041
+ }
7042
+ $textarea.data('previous-length', $textarea[0].value.length);
7043
+ };
7044
+
7045
+ $(document).ready(function () {
7046
+ // Text based inputs
7047
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea';
7048
+
7049
+ // Add active if form auto complete
7050
+ $(document).on('change', input_selector, function () {
7051
+ if (this.value.length !== 0 || $(this).attr('placeholder') !== null) {
7052
+ $(this).siblings('label').addClass('active');
7053
+ }
7054
+ M.validate_field($(this));
7055
+ });
7056
+
7057
+ // Add active if input element has been pre-populated on document ready
7058
+ $(document).ready(function () {
7059
+ M.updateTextFields();
7060
+ });
7061
+
7062
+ // HTML DOM FORM RESET handling
7063
+ $(document).on('reset', function (e) {
7064
+ var formReset = $(e.target);
7065
+ if (formReset.is('form')) {
7066
+ formReset.find(input_selector).removeClass('valid').removeClass('invalid');
7067
+ formReset.find(input_selector).each(function (e) {
7068
+ if (this.value.length) {
7069
+ $(this).siblings('label').removeClass('active');
7070
+ }
7071
+ });
7072
+
7073
+ // Reset select (after native reset)
7074
+ setTimeout(function () {
7075
+ formReset.find('select').each(function () {
7076
+ // check if initialized
7077
+ if (this.M_FormSelect) {
7078
+ $(this).trigger('change');
7079
+ }
7080
+ });
7081
+ }, 0);
7082
+ }
7083
+ });
7084
+
7085
+ /**
7086
+ * Add active when element has focus
7087
+ * @param {Event} e
7088
+ */
7089
+ document.addEventListener('focus', function (e) {
7090
+ if ($(e.target).is(input_selector)) {
7091
+ $(e.target).siblings('label, .prefix').addClass('active');
7092
+ }
7093
+ }, true);
7094
+
7095
+ /**
7096
+ * Remove active when element is blurred
7097
+ * @param {Event} e
7098
+ */
7099
+ document.addEventListener('blur', function (e) {
7100
+ var $inputElement = $(e.target);
7101
+ if ($inputElement.is(input_selector)) {
7102
+ var selector = '.prefix';
7103
+
7104
+ if ($inputElement[0].value.length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === null) {
7105
+ selector += ', label';
7106
+ }
7107
+ $inputElement.siblings(selector).removeClass('active');
7108
+ M.validate_field($inputElement);
7109
+ }
7110
+ }, true);
7111
+
7112
+ // Radio and Checkbox focus class
7113
+ var radio_checkbox = 'input[type=radio], input[type=checkbox]';
7114
+ $(document).on('keyup', radio_checkbox, function (e) {
7115
+ // TAB, check if tabbing to radio or checkbox.
7116
+ if (e.which === M.keys.TAB) {
7117
+ $(this).addClass('tabbed');
7118
+ var $this = $(this);
7119
+ $this.one('blur', function (e) {
7120
+ $(this).removeClass('tabbed');
7121
+ });
7122
+ return;
7123
+ }
7124
+ });
7125
+
7126
+ var text_area_selector = '.materialize-textarea';
7127
+ $(text_area_selector).each(function () {
7128
+ var $textarea = $(this);
7129
+ /**
7130
+ * Resize textarea on document load after storing
7131
+ * the original height and the original length
7132
+ */
7133
+ $textarea.data('original-height', $textarea.height());
7134
+ $textarea.data('previous-length', this.value.length);
7135
+ M.textareaAutoResize($textarea);
7136
+ });
7137
+
7138
+ $(document).on('keyup', text_area_selector, function () {
7139
+ M.textareaAutoResize($(this));
7140
+ });
7141
+ $(document).on('keydown', text_area_selector, function () {
7142
+ M.textareaAutoResize($(this));
7143
+ });
7144
+
7145
+ // File Input Path
7146
+ $(document).on('change', '.file-field input[type="file"]', function () {
7147
+ var file_field = $(this).closest('.file-field');
7148
+ var path_input = file_field.find('input.file-path');
7149
+ var files = $(this)[0].files;
7150
+ var file_names = [];
7151
+ for (var i = 0; i < files.length; i++) {
7152
+ file_names.push(files[i].name);
7153
+ }
7154
+ path_input[0].value = file_names.join(', ');
7155
+ path_input.trigger('change');
7156
+ });
7157
+ }); // End of $(document).ready
7158
+ })(cash);
7159
+ ;(function ($, anim) {
7160
+ 'use strict';
7161
+
7162
+ var _defaults = {
7163
+ indicators: true,
7164
+ height: 400,
7165
+ duration: 500,
7166
+ interval: 6000
7167
+ };
7168
+
7169
+ /**
7170
+ * @class
7171
+ *
7172
+ */
7173
+
7174
+ var Slider = function (_Component11) {
7175
+ _inherits(Slider, _Component11);
7176
+
7177
+ /**
7178
+ * Construct Slider instance and set up overlay
7179
+ * @constructor
7180
+ * @param {Element} el
7181
+ * @param {Object} options
7182
+ */
7183
+ function Slider(el, options) {
7184
+ _classCallCheck(this, Slider);
7185
+
7186
+ var _this40 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
7187
+
7188
+ _this40.el.M_Slider = _this40;
7189
+
7190
+ /**
7191
+ * Options for the modal
7192
+ * @member Slider#options
7193
+ * @prop {Boolean} [indicators=true] - Show indicators
7194
+ * @prop {Number} [height=400] - height of slider
7195
+ * @prop {Number} [duration=500] - Length in ms of slide transition
7196
+ * @prop {Number} [interval=6000] - Length in ms of slide interval
7197
+ */
7198
+ _this40.options = $.extend({}, Slider.defaults, options);
7199
+
7200
+ // setup
7201
+ _this40.$slider = _this40.$el.find('.slides');
7202
+ _this40.$slides = _this40.$slider.children('li');
7203
+ _this40.activeIndex = _this40.$slides.filter(function (item) {
7204
+ return $(item).hasClass('active');
7205
+ }).first().index();
7206
+ if (_this40.activeIndex != -1) {
7207
+ _this40.$active = _this40.$slides.eq(_this40.activeIndex);
7208
+ }
7209
+
7210
+ _this40._setSliderHeight();
7211
+
7212
+ // Set initial positions of captions
7213
+ _this40.$slides.find('.caption').each(function (el) {
7214
+ _this40._animateCaptionIn(el, 0);
7215
+ });
7216
+
7217
+ // Move img src into background-image
7218
+ _this40.$slides.find('img').each(function (el) {
7219
+ var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
7220
+ if ($(el).attr('src') !== placeholderBase64) {
7221
+ $(el).css('background-image', 'url("' + $(el).attr('src') + '")');
7222
+ $(el).attr('src', placeholderBase64);
7223
+ }
7224
+ });
7225
+
7226
+ _this40._setupIndicators();
7227
+
7228
+ // Show active slide
7229
+ if (_this40.$active) {
7230
+ _this40.$active.css('display', 'block');
7231
+ } else {
7232
+ _this40.$slides.first().addClass('active');
7233
+ anim({
7234
+ targets: _this40.$slides.first()[0],
7235
+ opacity: 1,
7236
+ duration: _this40.options.duration,
7237
+ easing: 'easeOutQuad'
7238
+ });
7239
+
7240
+ _this40.activeIndex = 0;
7241
+ _this40.$active = _this40.$slides.eq(_this40.activeIndex);
7242
+
7243
+ // Update indicators
7244
+ if (_this40.options.indicators) {
7245
+ _this40.$indicators.eq(_this40.activeIndex).addClass('active');
7246
+ }
7247
+ }
7248
+
7249
+ // Adjust height to current slide
7250
+ _this40.$active.find('img').each(function (el) {
7251
+ anim({
7252
+ targets: _this40.$active.find('.caption')[0],
7253
+ opacity: 1,
7254
+ translateX: 0,
7255
+ translateY: 0,
7256
+ duration: _this40.options.duration,
7257
+ easing: 'easeOutQuad'
7258
+ });
7259
+ });
7260
+
7261
+ _this40._setupEventHandlers();
7262
+
7263
+ // auto scroll
7264
+ _this40.start();
7265
+ return _this40;
7266
+ }
7267
+
7268
+ _createClass(Slider, [{
7269
+ key: "destroy",
7270
+
7271
+
7272
+ /**
7273
+ * Teardown component
7274
+ */
7275
+ value: function destroy() {
7276
+ this.pause();
7277
+ this._removeIndicators();
7278
+ this._removeEventHandlers();
7279
+ this.el.M_Slider = undefined;
7280
+ }
7281
+
7282
+ /**
7283
+ * Setup Event Handlers
7284
+ */
7285
+
7286
+ }, {
7287
+ key: "_setupEventHandlers",
7288
+ value: function _setupEventHandlers() {
7289
+ var _this41 = this;
7290
+
7291
+ this._handleIntervalBound = this._handleInterval.bind(this);
7292
+ this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
7293
+
7294
+ if (this.options.indicators) {
7295
+ this.$indicators.each(function (el) {
7296
+ el.addEventListener('click', _this41._handleIndicatorClickBound);
7297
+ });
7298
+ }
7299
+ }
7300
+
7301
+ /**
7302
+ * Remove Event Handlers
7303
+ */
7304
+
7305
+ }, {
7306
+ key: "_removeEventHandlers",
7307
+ value: function _removeEventHandlers() {
7308
+ var _this42 = this;
7309
+
7310
+ if (this.options.indicators) {
7311
+ this.$indicators.each(function (el) {
7312
+ el.removeEventListener('click', _this42._handleIndicatorClickBound);
7313
+ });
7314
+ }
7315
+ }
7316
+
7317
+ /**
7318
+ * Handle indicator click
7319
+ * @param {Event} e
7320
+ */
7321
+
7322
+ }, {
7323
+ key: "_handleIndicatorClick",
7324
+ value: function _handleIndicatorClick(e) {
7325
+ var currIndex = $(e.target).index();
7326
+ this.set(currIndex);
7327
+ }
7328
+
7329
+ /**
7330
+ * Handle Interval
7331
+ */
7332
+
7333
+ }, {
7334
+ key: "_handleInterval",
7335
+ value: function _handleInterval() {
7336
+ var newActiveIndex = this.$slider.find('.active').index();
7337
+ if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
7338
+ // loop to start
7339
+ else newActiveIndex += 1;
7340
+
7341
+ this.set(newActiveIndex);
7342
+ }
7343
+
7344
+ /**
7345
+ * Animate in caption
7346
+ * @param {Element} caption
7347
+ * @param {Number} duration
7348
+ */
7349
+
7350
+ }, {
7351
+ key: "_animateCaptionIn",
7352
+ value: function _animateCaptionIn(caption, duration) {
7353
+ var animOptions = {
7354
+ targets: caption,
7355
+ opacity: 0,
7356
+ duration: duration,
7357
+ easing: 'easeOutQuad'
7358
+ };
7359
+
7360
+ if ($(caption).hasClass('center-align')) {
7361
+ animOptions.translateY = -100;
7362
+ } else if ($(caption).hasClass('right-align')) {
7363
+ animOptions.translateX = 100;
7364
+ } else if ($(caption).hasClass('left-align')) {
7365
+ animOptions.translateX = -100;
7366
+ }
7367
+
7368
+ anim(animOptions);
7369
+ }
7370
+
7371
+ /**
7372
+ * Set height of slider
7373
+ */
7374
+
7375
+ }, {
7376
+ key: "_setSliderHeight",
7377
+ value: function _setSliderHeight() {
7378
+ // If fullscreen, do nothing
7379
+ if (!this.$el.hasClass('fullscreen')) {
7380
+ if (this.options.indicators) {
7381
+ // Add height if indicators are present
7382
+ this.$el.css('height', this.options.height + 40 + 'px');
7383
+ } else {
7384
+ this.$el.css('height', this.options.height + 'px');
7385
+ }
7386
+ this.$slider.css('height', this.options.height + 'px');
7387
+ }
7388
+ }
7389
+
7390
+ /**
7391
+ * Setup indicators
7392
+ */
7393
+
7394
+ }, {
7395
+ key: "_setupIndicators",
7396
+ value: function _setupIndicators() {
7397
+ var _this43 = this;
7398
+
7399
+ if (this.options.indicators) {
7400
+ this.$indicators = $('<ul class="indicators"></ul>');
7401
+ this.$slides.each(function (el, index) {
7402
+ var $indicator = $('<li class="indicator-item"></li>');
7403
+ _this43.$indicators.append($indicator[0]);
7404
+ });
7405
+ this.$el.append(this.$indicators[0]);
7406
+ this.$indicators = this.$indicators.children('li.indicator-item');
7407
+ }
7408
+ }
7409
+
7410
+ /**
7411
+ * Remove indicators
7412
+ */
7413
+
7414
+ }, {
7415
+ key: "_removeIndicators",
7416
+ value: function _removeIndicators() {
7417
+ this.$el.find('ul.indicators').remove();
7418
+ }
7419
+
7420
+ /**
7421
+ * Cycle to nth item
7422
+ * @param {Number} index
7423
+ */
7424
+
7425
+ }, {
7426
+ key: "set",
7427
+ value: function set(index) {
7428
+ var _this44 = this;
7429
+
7430
+ // Wrap around indices.
7431
+ if (index >= this.$slides.length) index = 0;else if (index < 0) index = this.$slides.length - 1;
7432
+
7433
+ // Only do if index changes
7434
+ if (this.activeIndex != index) {
7435
+ this.$active = this.$slides.eq(this.activeIndex);
7436
+ var $caption = this.$active.find('.caption');
7437
+ this.$active.removeClass('active');
7438
+
7439
+ anim({
7440
+ targets: this.$active[0],
7441
+ opacity: 0,
7442
+ duration: this.options.duration,
7443
+ easing: 'easeOutQuad',
7444
+ complete: function () {
7445
+ _this44.$slides.not('.active').each(function (el) {
7446
+ anim({
7447
+ targets: el,
7448
+ opacity: 0,
7449
+ translateX: 0,
7450
+ translateY: 0,
7451
+ duration: 0,
7452
+ easing: 'easeOutQuad'
7453
+ });
7454
+ });
7455
+ }
7456
+ });
7457
+
7458
+ this._animateCaptionIn($caption[0], this.options.duration);
7459
+
7460
+ // Update indicators
7461
+ if (this.options.indicators) {
7462
+ this.$indicators.eq(this.activeIndex).removeClass('active');
7463
+ this.$indicators.eq(index).addClass('active');
7464
+ }
7465
+
7466
+ anim({
7467
+ targets: this.$slides.eq(index)[0],
7468
+ opacity: 1,
7469
+ duration: this.options.duration,
7470
+ easing: 'easeOutQuad'
7471
+ });
7472
+
7473
+ anim({
7474
+ targets: this.$slides.eq(index).find('.caption')[0],
7475
+ opacity: 1,
7476
+ translateX: 0,
7477
+ translateY: 0,
7478
+ duration: this.options.duration,
7479
+ delay: this.options.duration,
7480
+ easing: 'easeOutQuad'
7481
+ });
7482
+
7483
+ this.$slides.eq(index).addClass('active');
7484
+ this.activeIndex = index;
7485
+
7486
+ // Reset interval
7487
+ this.start();
7488
+ }
7489
+ }
7490
+
7491
+ /**
7492
+ * Pause slider interval
7493
+ */
7494
+
7495
+ }, {
7496
+ key: "pause",
7497
+ value: function pause() {
7498
+ clearInterval(this.interval);
7499
+ }
7500
+
7501
+ /**
7502
+ * Start slider interval
7503
+ */
7504
+
7505
+ }, {
7506
+ key: "start",
7507
+ value: function start() {
7508
+ clearInterval(this.interval);
7509
+ this.interval = setInterval(this._handleIntervalBound, this.options.duration + this.options.interval);
7510
+ }
7511
+
7512
+ /**
7513
+ * Move to next slide
7514
+ */
7515
+
7516
+ }, {
7517
+ key: "next",
7518
+ value: function next() {
7519
+ var newIndex = this.activeIndex + 1;
7520
+
7521
+ // Wrap around indices.
7522
+ if (newIndex >= this.$slides.length) newIndex = 0;else if (newIndex < 0) newIndex = this.$slides.length - 1;
7523
+
7524
+ this.set(newIndex);
7525
+ }
7526
+
7527
+ /**
7528
+ * Move to previous slide
7529
+ */
7530
+
7531
+ }, {
7532
+ key: "prev",
7533
+ value: function prev() {
7534
+ var newIndex = this.activeIndex - 1;
7535
+
7536
+ // Wrap around indices.
7537
+ if (newIndex >= this.$slides.length) newIndex = 0;else if (newIndex < 0) newIndex = this.$slides.length - 1;
7538
+
7539
+ this.set(newIndex);
7540
+ }
7541
+ }], [{
7542
+ key: "init",
7543
+ value: function init(els, options) {
7544
+ return _get(Slider.__proto__ || Object.getPrototypeOf(Slider), "init", this).call(this, this, els, options);
7545
+ }
7546
+
7547
+ /**
7548
+ * Get Instance
7549
+ */
7550
+
7551
+ }, {
7552
+ key: "getInstance",
7553
+ value: function getInstance(el) {
7554
+ var domElem = !!el.jquery ? el[0] : el;
7555
+ return domElem.M_Slider;
7556
+ }
7557
+ }, {
7558
+ key: "defaults",
7559
+ get: function () {
7560
+ return _defaults;
7561
+ }
7562
+ }]);
7563
+
7564
+ return Slider;
7565
+ }(Component);
7566
+
7567
+ M.Slider = Slider;
7568
+
7569
+ if (M.jQueryLoaded) {
7570
+ M.initializeJqueryWrapper(Slider, 'slider', 'M_Slider');
7571
+ }
7572
+ })(cash, M.anime);
7573
+ ;(function ($, anim) {
7574
+ $(document).on('click', '.card', function (e) {
7575
+ if ($(this).children('.card-reveal').length) {
7576
+ var $card = $(e.target).closest('.card');
7577
+ if ($card.data('initialOverflow') === undefined) {
7578
+ $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
7579
+ }
7580
+ var $cardReveal = $(this).find('.card-reveal');
7581
+ if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) {
7582
+ // Make Reveal animate down and display none
7583
+ anim({
7584
+ targets: $cardReveal[0],
7585
+ translateY: 0,
7586
+ duration: 225,
7587
+ easing: 'easeInOutQuad',
7588
+ complete: function (anim) {
7589
+ var el = anim.animatables[0].target;
7590
+ $(el).css({ display: 'none' });
7591
+ $card.css('overflow', $card.data('initialOverflow'));
7592
+ }
7593
+ });
7594
+ } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
7595
+ $card.css('overflow', 'hidden');
7596
+ $cardReveal.css({ display: 'block' });
7597
+ anim({
7598
+ targets: $cardReveal[0],
7599
+ translateY: '-100%',
7600
+ duration: 300,
7601
+ easing: 'easeInOutQuad'
7602
+ });
7603
+ }
7604
+ }
7605
+ });
7606
+ })(cash, M.anime);
7607
+ ;(function ($) {
7608
+ 'use strict';
7609
+
7610
+ var _defaults = {
7611
+ data: [],
7612
+ placeholder: '',
7613
+ secondaryPlaceholder: '',
7614
+ autocompleteOptions: {},
7615
+ limit: Infinity,
7616
+ onChipAdd: null,
7617
+ onChipSelect: null,
7618
+ onChipDelete: null
7619
+ };
7620
+
7621
+ /**
7622
+ * @typedef {Object} chip
7623
+ * @property {String} tag chip tag string
7624
+ * @property {String} [image] chip avatar image string
7625
+ */
7626
+
7627
+ /**
7628
+ * @class
7629
+ *
7630
+ */
7631
+
7632
+ var Chips = function (_Component12) {
7633
+ _inherits(Chips, _Component12);
7634
+
7635
+ /**
7636
+ * Construct Chips instance and set up overlay
7637
+ * @constructor
7638
+ * @param {Element} el
7639
+ * @param {Object} options
7640
+ */
7641
+ function Chips(el, options) {
7642
+ _classCallCheck(this, Chips);
7643
+
7644
+ var _this45 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
7645
+
7646
+ _this45.el.M_Chips = _this45;
7647
+
7648
+ /**
7649
+ * Options for the modal
7650
+ * @member Chips#options
7651
+ * @prop {Array} data
7652
+ * @prop {String} placeholder
7653
+ * @prop {String} secondaryPlaceholder
7654
+ * @prop {Object} autocompleteOptions
7655
+ */
7656
+ _this45.options = $.extend({}, Chips.defaults, options);
7657
+
7658
+ _this45.$el.addClass('chips input-field');
7659
+ _this45.chipsData = [];
7660
+ _this45.$chips = $();
7661
+ _this45._setupInput();
7662
+ _this45.hasAutocomplete = Object.keys(_this45.options.autocompleteOptions).length > 0;
7663
+
7664
+ // Set input id
7665
+ if (!_this45.$input.attr('id')) {
7666
+ _this45.$input.attr('id', M.guid());
7667
+ }
7668
+
7669
+ // Render initial chips
7670
+ if (_this45.options.data.length) {
7671
+ _this45.chipsData = _this45.options.data;
7672
+ _this45._renderChips(_this45.chipsData);
7673
+ }
7674
+
7675
+ // Setup autocomplete if needed
7676
+ if (_this45.hasAutocomplete) {
7677
+ _this45._setupAutocomplete();
7678
+ }
7679
+
7680
+ _this45._setPlaceholder();
7681
+ _this45._setupLabel();
7682
+ _this45._setupEventHandlers();
7683
+ return _this45;
7684
+ }
7685
+
7686
+ _createClass(Chips, [{
7687
+ key: "getData",
7688
+
7689
+
7690
+ /**
7691
+ * Get Chips Data
7692
+ */
7693
+ value: function getData() {
7694
+ return this.chipsData;
7695
+ }
7696
+
7697
+ /**
7698
+ * Teardown component
7699
+ */
7700
+
7701
+ }, {
7702
+ key: "destroy",
7703
+ value: function destroy() {
7704
+ this._removeEventHandlers();
7705
+ this.$chips.remove();
7706
+ this.el.M_Chips = undefined;
7707
+ }
7708
+
7709
+ /**
7710
+ * Setup Event Handlers
7711
+ */
7712
+
7713
+ }, {
7714
+ key: "_setupEventHandlers",
7715
+ value: function _setupEventHandlers() {
7716
+ this._handleChipClickBound = this._handleChipClick.bind(this);
7717
+ this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
7718
+ this._handleInputFocusBound = this._handleInputFocus.bind(this);
7719
+ this._handleInputBlurBound = this._handleInputBlur.bind(this);
7720
+
7721
+ this.el.addEventListener('click', this._handleChipClickBound);
7722
+ document.addEventListener('keydown', Chips._handleChipsKeydown);
7723
+ document.addEventListener('keyup', Chips._handleChipsKeyup);
7724
+ this.el.addEventListener('blur', Chips._handleChipsBlur, true);
7725
+ this.$input[0].addEventListener('focus', this._handleInputFocusBound);
7726
+ this.$input[0].addEventListener('blur', this._handleInputBlurBound);
7727
+ this.$input[0].addEventListener('keydown', this._handleInputKeydownBound);
7728
+ }
7729
+
7730
+ /**
7731
+ * Remove Event Handlers
7732
+ */
7733
+
7734
+ }, {
7735
+ key: "_removeEventHandlers",
7736
+ value: function _removeEventHandlers() {
7737
+ this.el.removeEventListener('click', this._handleChipClickBound);
7738
+ document.removeEventListener('keydown', Chips._handleChipsKeydown);
7739
+ document.removeEventListener('keyup', Chips._handleChipsKeyup);
7740
+ this.el.removeEventListener('blur', Chips._handleChipsBlur, true);
7741
+ this.$input[0].removeEventListener('focus', this._handleInputFocusBound);
7742
+ this.$input[0].removeEventListener('blur', this._handleInputBlurBound);
7743
+ this.$input[0].removeEventListener('keydown', this._handleInputKeydownBound);
7744
+ }
7745
+
7746
+ /**
7747
+ * Handle Chip Click
7748
+ * @param {Event} e
7749
+ */
7750
+
7751
+ }, {
7752
+ key: "_handleChipClick",
7753
+ value: function _handleChipClick(e) {
7754
+ var $chip = $(e.target).closest('.chip');
7755
+ var clickedClose = $(e.target).is('.close');
7756
+ if ($chip.length) {
7757
+ var index = $chip.index();
7758
+ if (clickedClose) {
7759
+ // delete chip
7760
+ this.deleteChip(index);
7761
+ this.$input[0].focus();
7762
+ } else {
7763
+ // select chip
7764
+ this.selectChip(index);
7765
+ }
7766
+
7767
+ // Default handle click to focus on input
7768
+ } else {
7769
+ this.$input[0].focus();
7770
+ }
7771
+ }
7772
+
7773
+ /**
7774
+ * Handle Chips Keydown
7775
+ * @param {Event} e
7776
+ */
7777
+
7778
+ }, {
7779
+ key: "_handleInputFocus",
7780
+
7781
+
7782
+ /**
7783
+ * Handle Input Focus
7784
+ */
7785
+ value: function _handleInputFocus() {
7786
+ this.$el.addClass('focus');
7787
+ }
7788
+
7789
+ /**
7790
+ * Handle Input Blur
7791
+ */
7792
+
7793
+ }, {
7794
+ key: "_handleInputBlur",
7795
+ value: function _handleInputBlur() {
7796
+ this.$el.removeClass('focus');
7797
+ }
7798
+
7799
+ /**
7800
+ * Handle Input Keydown
7801
+ * @param {Event} e
7802
+ */
7803
+
7804
+ }, {
7805
+ key: "_handleInputKeydown",
7806
+ value: function _handleInputKeydown(e) {
7807
+ Chips._keydown = true;
7808
+
7809
+ // enter
7810
+ if (e.keyCode === 13) {
7811
+ // Override enter if autocompleting.
7812
+ if (this.hasAutocomplete && this.autocomplete && this.autocomplete.isOpen) {
7813
+ return;
7814
+ }
7815
+
7816
+ e.preventDefault();
7817
+ this.addChip({
7818
+ tag: this.$input[0].value
7819
+ });
7820
+ this.$input[0].value = '';
7821
+
7822
+ // delete or left
7823
+ } else if ((e.keyCode === 8 || e.keyCode === 37) && this.$input[0].value === '' && this.chipsData.length) {
7824
+ e.preventDefault();
7825
+ this.selectChip(this.chipsData.length - 1);
7826
+ }
7827
+ }
7828
+
7829
+ /**
7830
+ * Render Chip
7831
+ * @param {chip} chip
7832
+ * @return {Element}
7833
+ */
7834
+
7835
+ }, {
7836
+ key: "_renderChip",
7837
+ value: function _renderChip(chip) {
7838
+ if (!chip.tag) {
7839
+ return;
7840
+ }
7841
+
7842
+ var renderedChip = document.createElement('div');
7843
+ var closeIcon = document.createElement('i');
7844
+ renderedChip.classList.add('chip');
7845
+ renderedChip.textContent = chip.tag;
7846
+ renderedChip.setAttribute('tabindex', 0);
7847
+ $(closeIcon).addClass('material-icons close');
7848
+ closeIcon.textContent = 'close';
7849
+
7850
+ // attach image if needed
7851
+ if (chip.image) {
7852
+ var img = document.createElement('img');
7853
+ img.setAttribute('src', chip.image);
7854
+ renderedChip.insertBefore(img, renderedChip.firstChild);
7855
+ }
7856
+
7857
+ renderedChip.appendChild(closeIcon);
7858
+ return renderedChip;
7859
+ }
7860
+
7861
+ /**
7862
+ * Render Chips
7863
+ */
7864
+
7865
+ }, {
7866
+ key: "_renderChips",
7867
+ value: function _renderChips() {
7868
+ this.$chips.remove();
7869
+ for (var i = 0; i < this.chipsData.length; i++) {
7870
+ var chipEl = this._renderChip(this.chipsData[i]);
7871
+ this.$el.append(chipEl);
7872
+ this.$chips.add(chipEl);
7873
+ }
7874
+
7875
+ // move input to end
7876
+ this.$el.append(this.$input[0]);
7877
+ }
7878
+
7879
+ /**
7880
+ * Setup Autocomplete
7881
+ */
7882
+
7883
+ }, {
7884
+ key: "_setupAutocomplete",
7885
+ value: function _setupAutocomplete() {
7886
+ var _this46 = this;
7887
+
7888
+ this.options.autocompleteOptions.onAutocomplete = function (val) {
7889
+ _this46.addChip({
7890
+ tag: val
7891
+ });
7892
+ _this46.$input[0].value = '';
7893
+ _this46.$input[0].focus();
7894
+ };
7895
+
7896
+ this.autocomplete = M.Autocomplete.init(this.$input[0], this.options.autocompleteOptions);
7897
+ }
7898
+
7899
+ /**
7900
+ * Setup Input
7901
+ */
7902
+
7903
+ }, {
7904
+ key: "_setupInput",
7905
+ value: function _setupInput() {
7906
+ this.$input = this.$el.find('input');
7907
+ if (!this.$input.length) {
7908
+ this.$input = $('<input></input>');
7909
+ this.$el.append(this.$input);
7910
+ }
7911
+
7912
+ this.$input.addClass('input');
7913
+ }
7914
+
7915
+ /**
7916
+ * Setup Label
7917
+ */
7918
+
7919
+ }, {
7920
+ key: "_setupLabel",
7921
+ value: function _setupLabel() {
7922
+ this.$label = this.$el.find('label');
7923
+ if (this.$label.length) {
7924
+ this.$label.setAttribute('for', this.$input.attr('id'));
7925
+ }
7926
+ }
7927
+
7928
+ /**
7929
+ * Set placeholder
7930
+ */
7931
+
7932
+ }, {
7933
+ key: "_setPlaceholder",
7934
+ value: function _setPlaceholder() {
7935
+ if (this.chipsData !== undefined && !this.chipsData.length && this.options.placeholder) {
7936
+ $(this.$input).prop('placeholder', this.options.placeholder);
7937
+ } else if ((this.chipsData === undefined || !!this.chipsData.length) && this.options.secondaryPlaceholder) {
7938
+ $(this.$input).prop('placeholder', this.options.secondaryPlaceholder);
7939
+ }
7940
+ }
7941
+
7942
+ /**
7943
+ * Check if chip is valid
7944
+ * @param {chip} chip
7945
+ */
7946
+
7947
+ }, {
7948
+ key: "_isValid",
7949
+ value: function _isValid(chip) {
7950
+ if (chip.hasOwnProperty('tag') && chip.tag !== '') {
7951
+ var exists = false;
7952
+ for (var i = 0; i < this.chipsData.length; i++) {
7953
+ if (this.chipsData[i].tag === chip.tag) {
7954
+ exists = true;
7955
+ break;
7956
+ }
7957
+ }
7958
+ return !exists;
7959
+ }
7960
+
7961
+ return false;
7962
+ }
7963
+
7964
+ /**
7965
+ * Add chip
7966
+ * @param {chip} chip
7967
+ */
7968
+
7969
+ }, {
7970
+ key: "addChip",
7971
+ value: function addChip(chip) {
7972
+ if (!this._isValid(chip) || this.chipsData.length >= this.options.limit) {
7973
+ return;
7974
+ }
7975
+
7976
+ var renderedChip = this._renderChip(chip);
7977
+ this.$chips.add(renderedChip);
7978
+ this.chipsData.push(chip);
7979
+ $(this.$input).before(renderedChip);
7980
+ this._setPlaceholder();
7981
+
7982
+ // fire chipAdd callback
7983
+ if (typeof this.options.onChipAdd === 'function') {
7984
+ this.options.onChipAdd.call(this, this.$el, renderedChip);
7985
+ }
7986
+ }
7987
+
7988
+ /**
7989
+ * Delete chip
7990
+ * @param {Number} chip
7991
+ */
7992
+
7993
+ }, {
7994
+ key: "deleteChip",
7995
+ value: function deleteChip(chipIndex) {
7996
+ var $chip = this.$chips.eq(chipIndex);
7997
+ this.$chips.eq(chipIndex).remove();
7998
+ this.$chips = this.$chips.filter(function (el) {
7999
+ return $(el).index() >= 0;
8000
+ });
8001
+ this.chipsData.splice(chipIndex, 1);
8002
+ this._setPlaceholder();
8003
+
8004
+ // fire chipDelete callback
8005
+ if (typeof this.options.onChipDelete === 'function') {
8006
+ this.options.onChipDelete.call(this, this.$el, $chip[0]);
8007
+ }
8008
+ }
8009
+
8010
+ /**
8011
+ * Select chip
8012
+ * @param {Number} chip
8013
+ */
8014
+
8015
+ }, {
8016
+ key: "selectChip",
8017
+ value: function selectChip(chipIndex) {
8018
+ var $chip = this.$chips.eq(chipIndex);
8019
+ this._selectedChip = $chip;
8020
+ $chip[0].focus();
8021
+
8022
+ // fire chipSelect callback
8023
+ if (typeof this.options.onChipSelect === 'function') {
8024
+ this.options.onChipSelect.call(this, this.$el, $chip[0]);
8025
+ }
8026
+ }
8027
+ }], [{
8028
+ key: "init",
8029
+ value: function init(els, options) {
8030
+ return _get(Chips.__proto__ || Object.getPrototypeOf(Chips), "init", this).call(this, this, els, options);
8031
+ }
8032
+
8033
+ /**
8034
+ * Get Instance
8035
+ */
8036
+
8037
+ }, {
8038
+ key: "getInstance",
8039
+ value: function getInstance(el) {
8040
+ var domElem = !!el.jquery ? el[0] : el;
8041
+ return domElem.M_Chips;
8042
+ }
8043
+ }, {
8044
+ key: "_handleChipsKeydown",
8045
+ value: function _handleChipsKeydown(e) {
8046
+ Chips._keydown = true;
8047
+
8048
+ var $chips = $(e.target).closest('.chips');
8049
+ var chipsKeydown = e.target && $chips.length;
8050
+
8051
+ // Don't handle keydown inputs on input and textarea
8052
+ if ($(e.target).is('input, textarea') || !chipsKeydown) {
8053
+ return;
8054
+ }
8055
+
8056
+ var currChips = $chips[0].M_Chips;
8057
+
8058
+ // backspace and delete
8059
+ if (e.keyCode === 8 || e.keyCode === 46) {
8060
+ e.preventDefault();
8061
+
8062
+ var selectIndex = currChips.chipsData.length;
8063
+ if (currChips._selectedChip) {
8064
+ var index = currChips._selectedChip.index();
8065
+ currChips.deleteChip(index);
8066
+ currChips._selectedChip = null;
8067
+
8068
+ // Make sure selectIndex doesn't go negative
8069
+ selectIndex = Math.max(index - 1, 0);
8070
+ }
8071
+
8072
+ if (currChips.chipsData.length) {
8073
+ currChips.selectChip(selectIndex);
8074
+ }
8075
+
8076
+ // left arrow key
8077
+ } else if (e.keyCode === 37) {
8078
+ if (currChips._selectedChip) {
8079
+ var _selectIndex = currChips._selectedChip.index() - 1;
8080
+ if (_selectIndex < 0) {
8081
+ return;
8082
+ }
8083
+ currChips.selectChip(_selectIndex);
8084
+ }
8085
+
8086
+ // right arrow key
8087
+ } else if (e.keyCode === 39) {
8088
+ if (currChips._selectedChip) {
8089
+ var _selectIndex2 = currChips._selectedChip.index() + 1;
8090
+
8091
+ if (_selectIndex2 >= currChips.chipsData.length) {
8092
+ currChips.$input[0].focus();
8093
+ } else {
8094
+ currChips.selectChip(_selectIndex2);
8095
+ }
8096
+ }
8097
+ }
8098
+ }
8099
+
8100
+ /**
8101
+ * Handle Chips Keyup
8102
+ * @param {Event} e
8103
+ */
8104
+
8105
+ }, {
8106
+ key: "_handleChipsKeyup",
8107
+ value: function _handleChipsKeyup(e) {
8108
+ Chips._keydown = false;
8109
+ }
8110
+
8111
+ /**
8112
+ * Handle Chips Blur
8113
+ * @param {Event} e
8114
+ */
8115
+
8116
+ }, {
8117
+ key: "_handleChipsBlur",
8118
+ value: function _handleChipsBlur(e) {
8119
+ if (!Chips._keydown) {
8120
+ var $chips = $(e.target).closest('.chips');
8121
+ var currChips = $chips[0].M_Chips;
8122
+
8123
+ currChips._selectedChip = null;
8124
+ }
8125
+ }
8126
+ }, {
8127
+ key: "defaults",
8128
+ get: function () {
8129
+ return _defaults;
8130
+ }
8131
+ }]);
8132
+
8133
+ return Chips;
8134
+ }(Component);
8135
+
8136
+ /**
8137
+ * @static
8138
+ * @memberof Chips
8139
+ */
8140
+
8141
+
8142
+ Chips._keydown = false;
8143
+
8144
+ M.Chips = Chips;
8145
+
8146
+ if (M.jQueryLoaded) {
8147
+ M.initializeJqueryWrapper(Chips, 'chips', 'M_Chips');
8148
+ }
8149
+
8150
+ $(document).ready(function () {
8151
+ // Handle removal of static chips.
8152
+ $(document.body).on('click', '.chip .close', function () {
8153
+ var $chips = $(this).closest('.chips');
8154
+ if ($chips.length && $chips[0].M_Chips) {
8155
+ return;
8156
+ }
8157
+ $(this).closest('.chip').remove();
8158
+ });
8159
+ });
8160
+ })(cash);
8161
+ ;(function ($) {
8162
+ 'use strict';
8163
+
8164
+ var _defaults = {
8165
+ top: 0,
8166
+ bottom: Infinity,
8167
+ offset: 0,
8168
+ onPositionChange: null
8169
+ };
8170
+
8171
+ /**
8172
+ * @class
8173
+ *
8174
+ */
8175
+
8176
+ var Pushpin = function (_Component13) {
8177
+ _inherits(Pushpin, _Component13);
8178
+
8179
+ /**
8180
+ * Construct Pushpin instance
8181
+ * @constructor
8182
+ * @param {Element} el
8183
+ * @param {Object} options
8184
+ */
8185
+ function Pushpin(el, options) {
8186
+ _classCallCheck(this, Pushpin);
8187
+
8188
+ var _this47 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
8189
+
8190
+ _this47.el.M_Pushpin = _this47;
8191
+
8192
+ /**
8193
+ * Options for the modal
8194
+ * @member Pushpin#options
8195
+ */
8196
+ _this47.options = $.extend({}, Pushpin.defaults, options);
8197
+
8198
+ _this47.originalOffset = _this47.el.offsetTop;
8199
+ Pushpin._pushpins.push(_this47);
8200
+ _this47._setupEventHandlers();
8201
+ _this47._updatePosition();
8202
+ return _this47;
8203
+ }
8204
+
8205
+ _createClass(Pushpin, [{
8206
+ key: "destroy",
8207
+
8208
+
8209
+ /**
8210
+ * Teardown component
8211
+ */
8212
+ value: function destroy() {
8213
+ this.el.style.top = null;
8214
+ this._removePinClasses();
8215
+ this._removeEventHandlers();
8216
+
8217
+ // Remove pushpin Inst
8218
+ var index = Pushpin._pushpins.indexOf(this);
8219
+ Pushpin._pushpins.splice(index, 1);
8220
+ }
8221
+ }, {
8222
+ key: "_setupEventHandlers",
8223
+ value: function _setupEventHandlers() {
8224
+ document.addEventListener('scroll', Pushpin._updateElements);
8225
+ }
8226
+ }, {
8227
+ key: "_removeEventHandlers",
8228
+ value: function _removeEventHandlers() {
8229
+ document.removeEventListener('scroll', Pushpin._updateElements);
8230
+ }
8231
+ }, {
8232
+ key: "_updatePosition",
8233
+ value: function _updatePosition() {
8234
+ var scrolled = M.getDocumentScrollTop() + this.options.offset;
8235
+
8236
+ if (this.options.top <= scrolled && this.options.bottom >= scrolled && !this.el.classList.contains('pinned')) {
8237
+ this._removePinClasses();
8238
+ this.el.style.top = this.options.offset + "px";
8239
+ this.el.classList.add('pinned');
8240
+
8241
+ // onPositionChange callback
8242
+ if (typeof this.options.onPositionChange === 'function') {
8243
+ this.options.onPositionChange.call(this, 'pinned');
8244
+ }
8245
+ }
8246
+
8247
+ // Add pin-top (when scrolled position is above top)
8248
+ if (scrolled < this.options.top && !this.el.classList.contains('pin-top')) {
8249
+ this._removePinClasses();
8250
+ this.el.style.top = 0;
8251
+ this.el.classList.add('pin-top');
8252
+
8253
+ // onPositionChange callback
8254
+ if (typeof this.options.onPositionChange === 'function') {
8255
+ this.options.onPositionChange.call(this, 'pin-top');
8256
+ }
8257
+ }
8258
+
8259
+ // Add pin-bottom (when scrolled position is below bottom)
8260
+ if (scrolled > this.options.bottom && !this.el.classList.contains('pin-bottom')) {
8261
+ this._removePinClasses();
8262
+ this.el.classList.add('pin-bottom');
8263
+ this.el.style.top = this.options.bottom - this.originalOffset + "px";
8264
+
8265
+ // onPositionChange callback
8266
+ if (typeof this.options.onPositionChange === 'function') {
8267
+ this.options.onPositionChange.call(this, 'pin-bottom');
8268
+ }
8269
+ }
8270
+ }
8271
+ }, {
8272
+ key: "_removePinClasses",
8273
+ value: function _removePinClasses() {
8274
+ // IE 11 bug (can't remove multiple classes in one line)
8275
+ this.el.classList.remove('pin-top');
8276
+ this.el.classList.remove('pinned');
8277
+ this.el.classList.remove('pin-bottom');
8278
+ }
8279
+ }], [{
8280
+ key: "init",
8281
+ value: function init(els, options) {
8282
+ return _get(Pushpin.__proto__ || Object.getPrototypeOf(Pushpin), "init", this).call(this, this, els, options);
8283
+ }
8284
+
8285
+ /**
8286
+ * Get Instance
8287
+ */
8288
+
8289
+ }, {
8290
+ key: "getInstance",
8291
+ value: function getInstance(el) {
8292
+ var domElem = !!el.jquery ? el[0] : el;
8293
+ return domElem.M_Pushpin;
8294
+ }
8295
+ }, {
8296
+ key: "_updateElements",
8297
+ value: function _updateElements() {
8298
+ for (var elIndex in Pushpin._pushpins) {
8299
+ var pInstance = Pushpin._pushpins[elIndex];
8300
+ pInstance._updatePosition();
8301
+ }
8302
+ }
8303
+ }, {
8304
+ key: "defaults",
8305
+ get: function () {
8306
+ return _defaults;
8307
+ }
8308
+ }]);
8309
+
8310
+ return Pushpin;
8311
+ }(Component);
8312
+
8313
+ /**
8314
+ * @static
8315
+ * @memberof Pushpin
8316
+ */
8317
+
8318
+
8319
+ Pushpin._pushpins = [];
8320
+
8321
+ M.Pushpin = Pushpin;
8322
+
8323
+ if (M.jQueryLoaded) {
8324
+ M.initializeJqueryWrapper(Pushpin, 'pushpin', 'M_Pushpin');
8325
+ }
8326
+ })(cash);
8327
+ ;(function ($, anim) {
8328
+ 'use strict';
8329
+
8330
+ var _defaults = {
8331
+ direction: 'top',
8332
+ hoverEnabled: true,
8333
+ toolbarEnabled: false
8334
+ };
8335
+
8336
+ $.fn.reverse = [].reverse;
8337
+
8338
+ /**
8339
+ * @class
8340
+ *
8341
+ */
8342
+
8343
+ var FloatingActionButton = function (_Component14) {
8344
+ _inherits(FloatingActionButton, _Component14);
8345
+
8346
+ /**
8347
+ * Construct FloatingActionButton instance
8348
+ * @constructor
8349
+ * @param {Element} el
8350
+ * @param {Object} options
8351
+ */
8352
+ function FloatingActionButton(el, options) {
8353
+ _classCallCheck(this, FloatingActionButton);
8354
+
8355
+ var _this48 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options));
8356
+
8357
+ _this48.el.M_FloatingActionButton = _this48;
8358
+
8359
+ /**
8360
+ * Options for the fab
8361
+ * @member FloatingActionButton#options
8362
+ * @prop {Boolean} [direction] - Direction fab menu opens
8363
+ * @prop {Boolean} [hoverEnabled=true] - Enable hover vs click
8364
+ * @prop {Boolean} [toolbarEnabled=false] - Enable toolbar transition
8365
+ */
8366
+ _this48.options = $.extend({}, FloatingActionButton.defaults, options);
8367
+
8368
+ _this48.isOpen = false;
8369
+ _this48.$anchor = _this48.$el.children('a').first();
8370
+ _this48.$menu = _this48.$el.children('ul').first();
8371
+ _this48.$floatingBtns = _this48.$el.find('ul .btn-floating');
8372
+ _this48.$floatingBtnsReverse = _this48.$el.find('ul .btn-floating').reverse();
8373
+ _this48.offsetY = 0;
8374
+ _this48.offsetX = 0;
8375
+
8376
+ _this48.$el.addClass("direction-" + _this48.options.direction);
8377
+ if (_this48.options.direction === 'top') {
8378
+ _this48.offsetY = 40;
8379
+ } else if (_this48.options.direction === 'right') {
8380
+ _this48.offsetX = -40;
8381
+ } else if (_this48.options.direction === 'bottom') {
8382
+ _this48.offsetY = -40;
8383
+ } else {
8384
+ _this48.offsetX = 40;
8385
+ }
8386
+ _this48._setupEventHandlers();
8387
+ return _this48;
8388
+ }
8389
+
8390
+ _createClass(FloatingActionButton, [{
8391
+ key: "destroy",
8392
+
8393
+
8394
+ /**
8395
+ * Teardown component
8396
+ */
8397
+ value: function destroy() {
8398
+ this._removeEventHandlers();
8399
+ this.el.M_FloatingActionButton = undefined;
8400
+ }
8401
+
8402
+ /**
8403
+ * Setup Event Handlers
8404
+ */
8405
+
8406
+ }, {
8407
+ key: "_setupEventHandlers",
8408
+ value: function _setupEventHandlers() {
8409
+ this._handleFABClickBound = this._handleFABClick.bind(this);
8410
+ this._handleOpenBound = this.open.bind(this);
8411
+ this._handleCloseBound = this.close.bind(this);
8412
+
8413
+ if (this.options.hoverEnabled && !this.options.toolbarEnabled) {
8414
+ this.el.addEventListener('mouseenter', this._handleOpenBound);
8415
+ this.el.addEventListener('mouseleave', this._handleCloseBound);
8416
+ } else {
8417
+ this.el.addEventListener('click', this._handleFABClickBound);
8418
+ }
8419
+ }
8420
+
8421
+ /**
8422
+ * Remove Event Handlers
8423
+ */
8424
+
8425
+ }, {
8426
+ key: "_removeEventHandlers",
8427
+ value: function _removeEventHandlers() {
8428
+ if (this.options.hoverEnabled && !this.options.toolbarEnabled) {
8429
+ this.el.removeEventListener('mouseenter', this._handleOpenBound);
8430
+ this.el.removeEventListener('mouseleave', this._handleCloseBound);
8431
+ } else {
8432
+ this.el.removeEventListener('click', this._handleFABClickBound);
8433
+ }
8434
+ }
8435
+
8436
+ /**
8437
+ * Handle FAB Click
8438
+ */
8439
+
8440
+ }, {
8441
+ key: "_handleFABClick",
8442
+ value: function _handleFABClick() {
8443
+ if (this.isOpen) {
8444
+ this.close();
8445
+ } else {
8446
+ this.open();
8447
+ }
8448
+ }
8449
+
8450
+ /**
8451
+ * Handle Document Click
8452
+ * @param {Event} e
8453
+ */
8454
+
8455
+ }, {
8456
+ key: "_handleDocumentClick",
8457
+ value: function _handleDocumentClick(e) {
8458
+ if (!$(e.target).closest(this.$menu).length) {
8459
+ this.close();
8460
+ }
8461
+ }
8462
+
8463
+ /**
8464
+ * Open FAB
8465
+ */
8466
+
8467
+ }, {
8468
+ key: "open",
8469
+ value: function open() {
8470
+ if (this.isOpen) {
8471
+ return;
8472
+ }
8473
+
8474
+ if (this.options.toolbarEnabled) {
8475
+ this._animateInToolbar();
8476
+ } else {
8477
+ this._animateInFAB();
8478
+ }
8479
+ this.isOpen = true;
8480
+ }
8481
+
8482
+ /**
8483
+ * Close FAB
8484
+ */
8485
+
8486
+ }, {
8487
+ key: "close",
8488
+ value: function close() {
8489
+ if (!this.isOpen) {
8490
+ return;
8491
+ }
8492
+
8493
+ if (this.options.toolbarEnabled) {
8494
+ window.removeEventListener('scroll', this._handleCloseBound, true);
8495
+ document.body.removeEventListener('click', this._handleDocumentClickBound, true);
8496
+ this._animateOutToolbar();
8497
+ } else {
8498
+ this._animateOutFAB();
8499
+ }
8500
+ this.isOpen = false;
8501
+ }
8502
+
8503
+ /**
8504
+ * Classic FAB Menu open
8505
+ */
8506
+
8507
+ }, {
8508
+ key: "_animateInFAB",
8509
+ value: function _animateInFAB() {
8510
+ var _this49 = this;
8511
+
8512
+ this.$el.addClass('active');
8513
+
8514
+ var time = 0;
8515
+ this.$floatingBtnsReverse.each(function (el) {
8516
+ anim({
8517
+ targets: el,
8518
+ opacity: 1,
8519
+ scale: [0.4, 1],
8520
+ translateY: [_this49.offsetY, 0],
8521
+ translateX: [_this49.offsetX, 0],
8522
+ duration: 275,
8523
+ delay: time,
8524
+ easing: 'easeInOutQuad'
8525
+ });
8526
+ time += 40;
8527
+ });
8528
+ }
8529
+
8530
+ /**
8531
+ * Classic FAB Menu close
8532
+ */
8533
+
8534
+ }, {
8535
+ key: "_animateOutFAB",
8536
+ value: function _animateOutFAB() {
8537
+ var _this50 = this;
8538
+
8539
+ this.$floatingBtnsReverse.each(function (el) {
8540
+ anim.remove(el);
8541
+ anim({
8542
+ targets: el,
8543
+ opacity: 0,
8544
+ scale: 0.4,
8545
+ translateY: _this50.offsetY,
8546
+ translateX: _this50.offsetX,
8547
+ duration: 175,
8548
+ easing: 'easeOutQuad',
8549
+ complete: function () {
8550
+ _this50.$el.removeClass('active');
8551
+ }
8552
+ });
8553
+ });
8554
+ }
8555
+
8556
+ /**
8557
+ * Toolbar transition Menu open
8558
+ */
8559
+
8560
+ }, {
8561
+ key: "_animateInToolbar",
8562
+ value: function _animateInToolbar() {
8563
+ var _this51 = this;
8564
+
8565
+ var scaleFactor = void 0;
8566
+ var windowWidth = window.innerWidth;
8567
+ var windowHeight = window.innerHeight;
8568
+ var btnRect = this.el.getBoundingClientRect();
8569
+ var backdrop = $('<div class="fab-backdrop"></div>');
8570
+ var fabColor = this.$anchor.css('background-color');
8571
+ this.$anchor.append(backdrop);
8572
+
8573
+ this.offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
8574
+ this.offsetY = windowHeight - btnRect.bottom;
8575
+ scaleFactor = windowWidth / backdrop[0].clientWidth;
8576
+ this.btnBottom = btnRect.bottom;
8577
+ this.btnLeft = btnRect.left;
8578
+ this.btnWidth = btnRect.width;
8579
+
8580
+ // Set initial state
8581
+ this.$el.addClass('active');
8582
+ this.$el.css({
8583
+ 'text-align': 'center',
8584
+ width: '100%',
8585
+ bottom: 0,
8586
+ left: 0,
8587
+ transform: 'translateX(' + this.offsetX + 'px)',
8588
+ transition: 'none'
8589
+ });
8590
+ this.$anchor.css({
8591
+ transform: 'translateY(' + -this.offsetY + 'px)',
8592
+ transition: 'none'
8593
+ });
8594
+ backdrop.css({
8595
+ 'background-color': fabColor
8596
+ });
8597
+
8598
+ setTimeout(function () {
8599
+ _this51.$el.css({
8600
+ transform: '',
8601
+ transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
8602
+ });
8603
+ _this51.$anchor.css({
8604
+ overflow: 'visible',
8605
+ transform: '',
8606
+ transition: 'transform .2s'
8607
+ });
8608
+
8609
+ setTimeout(function () {
8610
+ _this51.$el.css({
8611
+ overflow: 'hidden',
8612
+ 'background-color': fabColor
8613
+ });
8614
+ backdrop.css({
8615
+ transform: 'scale(' + scaleFactor + ')',
8616
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8617
+ });
8618
+ _this51.$menu.children('li').children('a').css({
8619
+ opacity: 1
8620
+ });
8621
+
8622
+ // Scroll to close.
8623
+ _this51._handleDocumentClickBound = _this51._handleDocumentClick.bind(_this51);
8624
+ window.addEventListener('scroll', _this51._handleCloseBound, true);
8625
+ document.body.addEventListener('click', _this51._handleDocumentClickBound, true);
8626
+ }, 100);
8627
+ }, 0);
8628
+ }
8629
+
8630
+ /**
8631
+ * Toolbar transition Menu close
8632
+ */
8633
+
8634
+ }, {
8635
+ key: "_animateOutToolbar",
8636
+ value: function _animateOutToolbar() {
8637
+ var _this52 = this;
8638
+
8639
+ var windowWidth = window.innerWidth;
8640
+ var windowHeight = window.innerHeight;
8641
+ var backdrop = this.$el.find('.fab-backdrop');
8642
+ var fabColor = this.$anchor.css('background-color');
8643
+
8644
+ this.offsetX = this.btnLeft - windowWidth / 2 + this.btnWidth / 2;
8645
+ this.offsetY = windowHeight - this.btnBottom;
8646
+
8647
+ // Hide backdrop
8648
+ this.$el.removeClass('active');
8649
+ this.$el.css({
8650
+ 'background-color': 'transparent',
8651
+ transition: 'none'
8652
+ });
8653
+ this.$anchor.css({
8654
+ transition: 'none'
8655
+ });
8656
+ backdrop.css({
8657
+ transform: 'scale(0)',
8658
+ 'background-color': fabColor
8659
+ });
8660
+ this.$menu.children('li').children('a').css({
8661
+ opacity: ''
8662
+ });
8663
+
8664
+ setTimeout(function () {
8665
+ backdrop.remove();
8666
+
8667
+ // Set initial state.
8668
+ _this52.$el.css({
8669
+ 'text-align': '',
8670
+ width: '',
8671
+ bottom: '',
8672
+ left: '',
8673
+ overflow: '',
8674
+ 'background-color': '',
8675
+ transform: 'translate3d(' + -_this52.offsetX + 'px,0,0)'
8676
+ });
8677
+ _this52.$anchor.css({
8678
+ overflow: '',
8679
+ transform: 'translate3d(0,' + _this52.offsetY + 'px,0)'
8680
+ });
8681
+
8682
+ setTimeout(function () {
8683
+ _this52.$el.css({
8684
+ transform: 'translate3d(0,0,0)',
8685
+ transition: 'transform .2s'
8686
+ });
8687
+ _this52.$anchor.css({
8688
+ transform: 'translate3d(0,0,0)',
8689
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8690
+ });
8691
+ }, 20);
8692
+ }, 200);
8693
+ }
8694
+ }], [{
8695
+ key: "init",
8696
+ value: function init(els, options) {
8697
+ return _get(FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton), "init", this).call(this, this, els, options);
8698
+ }
8699
+
8700
+ /**
8701
+ * Get Instance
8702
+ */
8703
+
8704
+ }, {
8705
+ key: "getInstance",
8706
+ value: function getInstance(el) {
8707
+ var domElem = !!el.jquery ? el[0] : el;
8708
+ return domElem.M_FloatingActionButton;
8709
+ }
8710
+ }, {
8711
+ key: "defaults",
8712
+ get: function () {
8713
+ return _defaults;
8714
+ }
8715
+ }]);
8716
+
8717
+ return FloatingActionButton;
8718
+ }(Component);
8719
+
8720
+ M.FloatingActionButton = FloatingActionButton;
8721
+
8722
+ if (M.jQueryLoaded) {
8723
+ M.initializeJqueryWrapper(FloatingActionButton, 'floatingActionButton', 'M_FloatingActionButton');
8724
+ }
8725
+ })(cash, M.anime);
8726
+ ;(function ($) {
8727
+ 'use strict';
8728
+
8729
+ var _defaults = {
8730
+ // Close when date is selected
8731
+ autoClose: false,
8732
+
8733
+ // the default output format for the input field value
8734
+ format: 'mmm dd, yyyy',
8735
+
8736
+ // Used to create date object from current input string
8737
+ parse: null,
8738
+
8739
+ // The initial date to view when first opened
8740
+ defaultDate: null,
8741
+
8742
+ // Make the `defaultDate` the initial selected value
8743
+ setDefaultDate: false,
8744
+
8745
+ disableWeekends: false,
8746
+
8747
+ disableDayFn: null,
8748
+
8749
+ // First day of week (0: Sunday, 1: Monday etc)
8750
+ firstDay: 0,
8751
+
8752
+ // The earliest date that can be selected
8753
+ minDate: null,
8754
+ // Thelatest date that can be selected
8755
+ maxDate: null,
8756
+
8757
+ // Number of years either side, or array of upper/lower range
8758
+ yearRange: 10,
8759
+
8760
+ // used internally (don't config outside)
8761
+ minYear: 0,
8762
+ maxYear: 9999,
8763
+ minMonth: undefined,
8764
+ maxMonth: undefined,
8765
+
8766
+ startRange: null,
8767
+ endRange: null,
8768
+
8769
+ isRTL: false,
8770
+
8771
+ // Render the month after year in the calendar title
8772
+ showMonthAfterYear: false,
8773
+
8774
+ // Render days of the calendar grid that fall in the next or previous month
8775
+ showDaysInNextAndPreviousMonths: false,
8776
+
8777
+ // Specify a DOM element to render the calendar in
8778
+ container: null,
8779
+
8780
+ // Show clear button
8781
+ showClearBtn: false,
8782
+
8783
+ // internationalization
8784
+ i18n: {
8785
+ cancel: 'Cancel',
8786
+ clear: 'Clear',
8787
+ done: 'Ok',
8788
+ previousMonth: '‹',
8789
+ nextMonth: '›',
8790
+ months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
8791
+ monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
8792
+ weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
8793
+ weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
8794
+ weekdaysAbbrev: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
8795
+ },
8796
+
8797
+ // events array
8798
+ events: [],
8799
+
8800
+ // callback function
8801
+ onSelect: null,
8802
+ onOpen: null,
8803
+ onClose: null,
8804
+ onDraw: null
8805
+ };
8806
+
8807
+ /**
8808
+ * @class
8809
+ *
8810
+ */
8811
+
8812
+ var Datepicker = function (_Component15) {
8813
+ _inherits(Datepicker, _Component15);
8814
+
8815
+ /**
8816
+ * Construct Datepicker instance and set up overlay
8817
+ * @constructor
8818
+ * @param {Element} el
8819
+ * @param {Object} options
8820
+ */
8821
+ function Datepicker(el, options) {
8822
+ _classCallCheck(this, Datepicker);
8823
+
8824
+ var _this53 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options));
8825
+
8826
+ _this53.el.M_Datepicker = _this53;
8827
+
8828
+ _this53.options = $.extend({}, Datepicker.defaults, options);
8829
+
8830
+ // make sure i18n defaults are not lost when only few i18n option properties are passed
8831
+ if (!!options && options.hasOwnProperty('i18n') && typeof options.i18n === 'object') {
8832
+ _this53.options.i18n = $.extend({}, Datepicker.defaults.i18n, options.i18n);
8833
+ }
8834
+
8835
+ // Remove time component from minDate and maxDate options
8836
+ if (_this53.options.minDate) _this53.options.minDate.setHours(0, 0, 0, 0);
8837
+ if (_this53.options.maxDate) _this53.options.maxDate.setHours(0, 0, 0, 0);
8838
+
8839
+ _this53.id = M.guid();
8840
+
8841
+ _this53._setupVariables();
8842
+ _this53._insertHTMLIntoDOM();
8843
+ _this53._setupModal();
8844
+
8845
+ _this53._setupEventHandlers();
8846
+
8847
+ if (!_this53.options.defaultDate) {
8848
+ _this53.options.defaultDate = new Date(Date.parse(_this53.el.value));
8849
+ }
8850
+
8851
+ var defDate = _this53.options.defaultDate;
8852
+ if (Datepicker._isDate(defDate)) {
8853
+ if (_this53.options.setDefaultDate) {
8854
+ _this53.setDate(defDate, true);
8855
+ _this53.setInputValue();
8856
+ } else {
8857
+ _this53.gotoDate(defDate);
8858
+ }
8859
+ } else {
8860
+ _this53.gotoDate(new Date());
8861
+ }
8862
+
8863
+ /**
8864
+ * Describes open/close state of datepicker
8865
+ * @type {Boolean}
8866
+ */
8867
+ _this53.isOpen = false;
8868
+ return _this53;
8869
+ }
8870
+
8871
+ _createClass(Datepicker, [{
8872
+ key: "destroy",
8873
+
8874
+
8875
+ /**
8876
+ * Teardown component
8877
+ */
8878
+ value: function destroy() {
8879
+ this._removeEventHandlers();
8880
+ this.modal.destroy();
8881
+ $(this.modalEl).remove();
8882
+ this.destroySelects();
8883
+ this.el.M_Datepicker = undefined;
8884
+ }
8885
+ }, {
8886
+ key: "destroySelects",
8887
+ value: function destroySelects() {
8888
+ var oldYearSelect = this.calendarEl.querySelector('.orig-select-year');
8889
+ if (oldYearSelect) {
8890
+ M.FormSelect.getInstance(oldYearSelect).destroy();
8891
+ }
8892
+ var oldMonthSelect = this.calendarEl.querySelector('.orig-select-month');
8893
+ if (oldMonthSelect) {
8894
+ M.FormSelect.getInstance(oldMonthSelect).destroy();
8895
+ }
8896
+ }
8897
+ }, {
8898
+ key: "_insertHTMLIntoDOM",
8899
+ value: function _insertHTMLIntoDOM() {
8900
+ if (this.options.showClearBtn) {
8901
+ $(this.clearBtn).css({ visibility: '' });
8902
+ this.clearBtn.innerHTML = this.options.i18n.clear;
8903
+ }
8904
+
8905
+ this.doneBtn.innerHTML = this.options.i18n.done;
8906
+ this.cancelBtn.innerHTML = this.options.i18n.cancel;
8907
+
8908
+ if (this.options.container) {
8909
+ this.$modalEl.appendTo(this.options.container);
8910
+ } else {
8911
+ this.$modalEl.insertBefore(this.el);
8912
+ }
8913
+ }
8914
+ }, {
8915
+ key: "_setupModal",
8916
+ value: function _setupModal() {
8917
+ var _this54 = this;
8918
+
8919
+ this.modalEl.id = 'modal-' + this.id;
8920
+ this.modal = M.Modal.init(this.modalEl, {
8921
+ onCloseEnd: function () {
8922
+ _this54.isOpen = false;
8923
+ }
8924
+ });
8925
+ }
8926
+ }, {
8927
+ key: "toString",
8928
+ value: function toString(format) {
8929
+ var _this55 = this;
8930
+
8931
+ format = format || this.options.format;
8932
+ if (!Datepicker._isDate(this.date)) {
8933
+ return '';
8934
+ }
8935
+
8936
+ var formatArray = format.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
8937
+ var formattedDate = formatArray.map(function (label) {
8938
+ if (_this55.formats[label]) {
8939
+ return _this55.formats[label]();
8940
+ }
8941
+
8942
+ return label;
8943
+ }).join('');
8944
+ return formattedDate;
8945
+ }
8946
+ }, {
8947
+ key: "setDate",
8948
+ value: function setDate(date, preventOnSelect) {
8949
+ if (!date) {
8950
+ this.date = null;
8951
+ this._renderDateDisplay();
8952
+ return this.draw();
8953
+ }
8954
+ if (typeof date === 'string') {
8955
+ date = new Date(Date.parse(date));
8956
+ }
8957
+ if (!Datepicker._isDate(date)) {
8958
+ return;
8959
+ }
8960
+
8961
+ var min = this.options.minDate,
8962
+ max = this.options.maxDate;
8963
+
8964
+ if (Datepicker._isDate(min) && date < min) {
8965
+ date = min;
8966
+ } else if (Datepicker._isDate(max) && date > max) {
8967
+ date = max;
8968
+ }
8969
+
8970
+ this.date = new Date(date.getTime());
8971
+
8972
+ this._renderDateDisplay();
8973
+
8974
+ Datepicker._setToStartOfDay(this.date);
8975
+ this.gotoDate(this.date);
8976
+
8977
+ if (!preventOnSelect && typeof this.options.onSelect === 'function') {
8978
+ this.options.onSelect.call(this, this.date);
8979
+ }
8980
+ }
8981
+ }, {
8982
+ key: "setInputValue",
8983
+ value: function setInputValue() {
8984
+ this.el.value = this.toString();
8985
+ this.$el.trigger('change', { firedBy: this });
8986
+ }
8987
+ }, {
8988
+ key: "_renderDateDisplay",
8989
+ value: function _renderDateDisplay() {
8990
+ var displayDate = Datepicker._isDate(this.date) ? this.date : new Date();
8991
+ var i18n = this.options.i18n;
8992
+ var day = i18n.weekdaysShort[displayDate.getDay()];
8993
+ var month = i18n.monthsShort[displayDate.getMonth()];
8994
+ var date = displayDate.getDate();
8995
+ this.yearTextEl.innerHTML = displayDate.getFullYear();
8996
+ this.dateTextEl.innerHTML = day + ", " + month + " " + date;
8997
+ }
8998
+
8999
+ /**
9000
+ * change view to a specific date
9001
+ */
9002
+
9003
+ }, {
9004
+ key: "gotoDate",
9005
+ value: function gotoDate(date) {
9006
+ var newCalendar = true;
9007
+
9008
+ if (!Datepicker._isDate(date)) {
9009
+ return;
9010
+ }
9011
+
9012
+ if (this.calendars) {
9013
+ var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1),
9014
+ lastVisibleDate = new Date(this.calendars[this.calendars.length - 1].year, this.calendars[this.calendars.length - 1].month, 1),
9015
+ visibleDate = date.getTime();
9016
+ // get the end of the month
9017
+ lastVisibleDate.setMonth(lastVisibleDate.getMonth() + 1);
9018
+ lastVisibleDate.setDate(lastVisibleDate.getDate() - 1);
9019
+ newCalendar = visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate;
9020
+ }
9021
+
9022
+ if (newCalendar) {
9023
+ this.calendars = [{
9024
+ month: date.getMonth(),
9025
+ year: date.getFullYear()
9026
+ }];
9027
+ }
9028
+
9029
+ this.adjustCalendars();
9030
+ }
9031
+ }, {
9032
+ key: "adjustCalendars",
9033
+ value: function adjustCalendars() {
9034
+ this.calendars[0] = this.adjustCalendar(this.calendars[0]);
9035
+ this.draw();
9036
+ }
9037
+ }, {
9038
+ key: "adjustCalendar",
9039
+ value: function adjustCalendar(calendar) {
9040
+ if (calendar.month < 0) {
9041
+ calendar.year -= Math.ceil(Math.abs(calendar.month) / 12);
9042
+ calendar.month += 12;
9043
+ }
9044
+ if (calendar.month > 11) {
9045
+ calendar.year += Math.floor(Math.abs(calendar.month) / 12);
9046
+ calendar.month -= 12;
9047
+ }
9048
+ return calendar;
9049
+ }
9050
+ }, {
9051
+ key: "nextMonth",
9052
+ value: function nextMonth() {
9053
+ this.calendars[0].month++;
9054
+ this.adjustCalendars();
9055
+ }
9056
+ }, {
9057
+ key: "prevMonth",
9058
+ value: function prevMonth() {
9059
+ this.calendars[0].month--;
9060
+ this.adjustCalendars();
9061
+ }
9062
+ }, {
9063
+ key: "render",
9064
+ value: function render(year, month, randId) {
9065
+ var opts = this.options,
9066
+ now = new Date(),
9067
+ days = Datepicker._getDaysInMonth(year, month),
9068
+ before = new Date(year, month, 1).getDay(),
9069
+ data = [],
9070
+ row = [];
9071
+ Datepicker._setToStartOfDay(now);
9072
+ if (opts.firstDay > 0) {
9073
+ before -= opts.firstDay;
9074
+ if (before < 0) {
9075
+ before += 7;
9076
+ }
9077
+ }
9078
+ var previousMonth = month === 0 ? 11 : month - 1,
9079
+ nextMonth = month === 11 ? 0 : month + 1,
9080
+ yearOfPreviousMonth = month === 0 ? year - 1 : year,
9081
+ yearOfNextMonth = month === 11 ? year + 1 : year,
9082
+ daysInPreviousMonth = Datepicker._getDaysInMonth(yearOfPreviousMonth, previousMonth);
9083
+ var cells = days + before,
9084
+ after = cells;
9085
+ while (after > 7) {
9086
+ after -= 7;
9087
+ }
9088
+ cells += 7 - after;
9089
+ var isWeekSelected = false;
9090
+ for (var i = 0, r = 0; i < cells; i++) {
9091
+ var day = new Date(year, month, 1 + (i - before)),
9092
+ isSelected = Datepicker._isDate(this.date) ? Datepicker._compareDates(day, this.date) : false,
9093
+ isToday = Datepicker._compareDates(day, now),
9094
+ hasEvent = opts.events.indexOf(day.toDateString()) !== -1 ? true : false,
9095
+ isEmpty = i < before || i >= days + before,
9096
+ dayNumber = 1 + (i - before),
9097
+ monthNumber = month,
9098
+ yearNumber = year,
9099
+ isStartRange = opts.startRange && Datepicker._compareDates(opts.startRange, day),
9100
+ isEndRange = opts.endRange && Datepicker._compareDates(opts.endRange, day),
9101
+ isInRange = opts.startRange && opts.endRange && opts.startRange < day && day < opts.endRange,
9102
+ isDisabled = opts.minDate && day < opts.minDate || opts.maxDate && day > opts.maxDate || opts.disableWeekends && Datepicker._isWeekend(day) || opts.disableDayFn && opts.disableDayFn(day);
9103
+
9104
+ if (isEmpty) {
9105
+ if (i < before) {
9106
+ dayNumber = daysInPreviousMonth + dayNumber;
9107
+ monthNumber = previousMonth;
9108
+ yearNumber = yearOfPreviousMonth;
9109
+ } else {
9110
+ dayNumber = dayNumber - days;
9111
+ monthNumber = nextMonth;
9112
+ yearNumber = yearOfNextMonth;
9113
+ }
9114
+ }
9115
+
9116
+ var dayConfig = {
9117
+ day: dayNumber,
9118
+ month: monthNumber,
9119
+ year: yearNumber,
9120
+ hasEvent: hasEvent,
9121
+ isSelected: isSelected,
9122
+ isToday: isToday,
9123
+ isDisabled: isDisabled,
9124
+ isEmpty: isEmpty,
9125
+ isStartRange: isStartRange,
9126
+ isEndRange: isEndRange,
9127
+ isInRange: isInRange,
9128
+ showDaysInNextAndPreviousMonths: opts.showDaysInNextAndPreviousMonths
9129
+ };
9130
+
9131
+ row.push(this.renderDay(dayConfig));
9132
+
9133
+ if (++r === 7) {
9134
+ data.push(this.renderRow(row, opts.isRTL, isWeekSelected));
9135
+ row = [];
9136
+ r = 0;
9137
+ isWeekSelected = false;
9138
+ }
9139
+ }
9140
+ return this.renderTable(opts, data, randId);
9141
+ }
9142
+ }, {
9143
+ key: "renderDay",
9144
+ value: function renderDay(opts) {
9145
+ var arr = [];
9146
+ var ariaSelected = 'false';
9147
+ if (opts.isEmpty) {
9148
+ if (opts.showDaysInNextAndPreviousMonths) {
9149
+ arr.push('is-outside-current-month');
9150
+ arr.push('is-selection-disabled');
9151
+ } else {
9152
+ return '<td class="is-empty"></td>';
9153
+ }
9154
+ }
9155
+ if (opts.isDisabled) {
9156
+ arr.push('is-disabled');
9157
+ }
9158
+
9159
+ if (opts.isToday) {
9160
+ arr.push('is-today');
9161
+ }
9162
+ if (opts.isSelected) {
9163
+ arr.push('is-selected');
9164
+ ariaSelected = 'true';
9165
+ }
9166
+ if (opts.hasEvent) {
9167
+ arr.push('has-event');
9168
+ }
9169
+ if (opts.isInRange) {
9170
+ arr.push('is-inrange');
9171
+ }
9172
+ if (opts.isStartRange) {
9173
+ arr.push('is-startrange');
9174
+ }
9175
+ if (opts.isEndRange) {
9176
+ arr.push('is-endrange');
9177
+ }
9178
+ return "<td data-day=\"" + opts.day + "\" class=\"" + arr.join(' ') + "\" aria-selected=\"" + ariaSelected + "\">" + ("<button class=\"datepicker-day-button\" type=\"button\" data-year=\"" + opts.year + "\" data-month=\"" + opts.month + "\" data-day=\"" + opts.day + "\">" + opts.day + "</button>") + '</td>';
9179
+ }
9180
+ }, {
9181
+ key: "renderRow",
9182
+ value: function renderRow(days, isRTL, isRowSelected) {
9183
+ return '<tr class="datepicker-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
9184
+ }
9185
+ }, {
9186
+ key: "renderTable",
9187
+ value: function renderTable(opts, data, randId) {
9188
+ return '<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="' + randId + '">' + this.renderHead(opts) + this.renderBody(data) + '</table></div>';
9189
+ }
9190
+ }, {
9191
+ key: "renderHead",
9192
+ value: function renderHead(opts) {
9193
+ var i = void 0,
9194
+ arr = [];
9195
+ for (i = 0; i < 7; i++) {
9196
+ arr.push("<th scope=\"col\"><abbr title=\"" + this.renderDayName(opts, i) + "\">" + this.renderDayName(opts, i, true) + "</abbr></th>");
9197
+ }
9198
+ return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>';
9199
+ }
9200
+ }, {
9201
+ key: "renderBody",
9202
+ value: function renderBody(rows) {
9203
+ return '<tbody>' + rows.join('') + '</tbody>';
9204
+ }
9205
+ }, {
9206
+ key: "renderTitle",
9207
+ value: function renderTitle(instance, c, year, month, refYear, randId) {
9208
+ var i = void 0,
9209
+ j = void 0,
9210
+ arr = void 0,
9211
+ opts = this.options,
9212
+ isMinYear = year === opts.minYear,
9213
+ isMaxYear = year === opts.maxYear,
9214
+ html = '<div id="' + randId + '" class="datepicker-controls" role="heading" aria-live="assertive">',
9215
+ monthHtml = void 0,
9216
+ yearHtml = void 0,
9217
+ prev = true,
9218
+ next = true;
9219
+
9220
+ for (arr = [], i = 0; i < 12; i++) {
9221
+ arr.push('<option value="' + (year === refYear ? i - c : 12 + i - c) + '"' + (i === month ? ' selected="selected"' : '') + (isMinYear && i < opts.minMonth || isMaxYear && i > opts.maxMonth ? 'disabled="disabled"' : '') + '>' + opts.i18n.months[i] + '</option>');
9222
+ }
9223
+
9224
+ monthHtml = '<select class="datepicker-select orig-select-month" tabindex="-1">' + arr.join('') + '</select>';
9225
+
9226
+ if ($.isArray(opts.yearRange)) {
9227
+ i = opts.yearRange[0];
9228
+ j = opts.yearRange[1] + 1;
9229
+ } else {
9230
+ i = year - opts.yearRange;
9231
+ j = 1 + year + opts.yearRange;
9232
+ }
9233
+
9234
+ for (arr = []; i < j && i <= opts.maxYear; i++) {
9235
+ if (i >= opts.minYear) {
9236
+ arr.push("<option value=\"" + i + "\" " + (i === year ? 'selected="selected"' : '') + ">" + i + "</option>");
9237
+ }
9238
+ }
9239
+
9240
+ yearHtml = "<select class=\"datepicker-select orig-select-year\" tabindex=\"-1\">" + arr.join('') + "</select>";
9241
+
9242
+ var leftArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>';
9243
+ html += "<button class=\"month-prev" + (prev ? '' : ' is-disabled') + "\" type=\"button\">" + leftArrow + "</button>";
9244
+
9245
+ html += '<div class="selects-container">';
9246
+ if (opts.showMonthAfterYear) {
9247
+ html += yearHtml + monthHtml;
9248
+ } else {
9249
+ html += monthHtml + yearHtml;
9250
+ }
9251
+ html += '</div>';
9252
+
9253
+ if (isMinYear && (month === 0 || opts.minMonth >= month)) {
9254
+ prev = false;
9255
+ }
9256
+
9257
+ if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
9258
+ next = false;
9259
+ }
9260
+
9261
+ var rightArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg>';
9262
+ html += "<button class=\"month-next" + (next ? '' : ' is-disabled') + "\" type=\"button\">" + rightArrow + "</button>";
9263
+
9264
+ return html += '</div>';
9265
+ }
9266
+
9267
+ /**
9268
+ * refresh the HTML
9269
+ */
9270
+
9271
+ }, {
9272
+ key: "draw",
9273
+ value: function draw(force) {
9274
+ if (!this.isOpen && !force) {
9275
+ return;
9276
+ }
9277
+ var opts = this.options,
9278
+ minYear = opts.minYear,
9279
+ maxYear = opts.maxYear,
9280
+ minMonth = opts.minMonth,
9281
+ maxMonth = opts.maxMonth,
9282
+ html = '',
9283
+ randId = void 0;
9284
+
9285
+ if (this._y <= minYear) {
9286
+ this._y = minYear;
9287
+ if (!isNaN(minMonth) && this._m < minMonth) {
9288
+ this._m = minMonth;
9289
+ }
9290
+ }
9291
+ if (this._y >= maxYear) {
9292
+ this._y = maxYear;
9293
+ if (!isNaN(maxMonth) && this._m > maxMonth) {
9294
+ this._m = maxMonth;
9295
+ }
9296
+ }
9297
+
9298
+ randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
9299
+
9300
+ for (var c = 0; c < 1; c++) {
9301
+ this._renderDateDisplay();
9302
+ html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId);
9303
+ }
9304
+
9305
+ this.destroySelects();
9306
+
9307
+ this.calendarEl.innerHTML = html;
9308
+
9309
+ // Init Materialize Select
9310
+ var yearSelect = this.calendarEl.querySelector('.orig-select-year');
9311
+ var monthSelect = this.calendarEl.querySelector('.orig-select-month');
9312
+ M.FormSelect.init(yearSelect, {
9313
+ classes: 'select-year',
9314
+ dropdownOptions: { container: document.body, constrainWidth: false }
9315
+ });
9316
+ M.FormSelect.init(monthSelect, {
9317
+ classes: 'select-month',
9318
+ dropdownOptions: { container: document.body, constrainWidth: false }
9319
+ });
9320
+
9321
+ // Add change handlers for select
9322
+ yearSelect.addEventListener('change', this._handleYearChange.bind(this));
9323
+ monthSelect.addEventListener('change', this._handleMonthChange.bind(this));
9324
+
9325
+ if (typeof this.options.onDraw === 'function') {
9326
+ this.options.onDraw(this);
9327
+ }
9328
+ }
9329
+
9330
+ /**
9331
+ * Setup Event Handlers
9332
+ */
9333
+
9334
+ }, {
9335
+ key: "_setupEventHandlers",
9336
+ value: function _setupEventHandlers() {
9337
+ this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
9338
+ this._handleInputClickBound = this._handleInputClick.bind(this);
9339
+ this._handleInputChangeBound = this._handleInputChange.bind(this);
9340
+ this._handleCalendarClickBound = this._handleCalendarClick.bind(this);
9341
+ this._finishSelectionBound = this._finishSelection.bind(this);
9342
+ this._handleMonthChange = this._handleMonthChange.bind(this);
9343
+ this._closeBound = this.close.bind(this);
9344
+
9345
+ this.el.addEventListener('click', this._handleInputClickBound);
9346
+ this.el.addEventListener('keydown', this._handleInputKeydownBound);
9347
+ this.el.addEventListener('change', this._handleInputChangeBound);
9348
+ this.calendarEl.addEventListener('click', this._handleCalendarClickBound);
9349
+ this.doneBtn.addEventListener('click', this._finishSelectionBound);
9350
+ this.cancelBtn.addEventListener('click', this._closeBound);
9351
+
9352
+ if (this.options.showClearBtn) {
9353
+ this._handleClearClickBound = this._handleClearClick.bind(this);
9354
+ this.clearBtn.addEventListener('click', this._handleClearClickBound);
9355
+ }
9356
+ }
9357
+ }, {
9358
+ key: "_setupVariables",
9359
+ value: function _setupVariables() {
9360
+ var _this56 = this;
9361
+
9362
+ this.$modalEl = $(Datepicker._template);
9363
+ this.modalEl = this.$modalEl[0];
9364
+
9365
+ this.calendarEl = this.modalEl.querySelector('.datepicker-calendar');
9366
+
9367
+ this.yearTextEl = this.modalEl.querySelector('.year-text');
9368
+ this.dateTextEl = this.modalEl.querySelector('.date-text');
9369
+ if (this.options.showClearBtn) {
9370
+ this.clearBtn = this.modalEl.querySelector('.datepicker-clear');
9371
+ }
9372
+ this.doneBtn = this.modalEl.querySelector('.datepicker-done');
9373
+ this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel');
9374
+
9375
+ this.formats = {
9376
+ d: function () {
9377
+ return _this56.date.getDate();
9378
+ },
9379
+ dd: function () {
9380
+ var d = _this56.date.getDate();
9381
+ return (d < 10 ? '0' : '') + d;
9382
+ },
9383
+ ddd: function () {
9384
+ return _this56.options.i18n.weekdaysShort[_this56.date.getDay()];
9385
+ },
9386
+ dddd: function () {
9387
+ return _this56.options.i18n.weekdays[_this56.date.getDay()];
9388
+ },
9389
+ m: function () {
9390
+ return _this56.date.getMonth() + 1;
9391
+ },
9392
+ mm: function () {
9393
+ var m = _this56.date.getMonth() + 1;
9394
+ return (m < 10 ? '0' : '') + m;
9395
+ },
9396
+ mmm: function () {
9397
+ return _this56.options.i18n.monthsShort[_this56.date.getMonth()];
9398
+ },
9399
+ mmmm: function () {
9400
+ return _this56.options.i18n.months[_this56.date.getMonth()];
9401
+ },
9402
+ yy: function () {
9403
+ return ('' + _this56.date.getFullYear()).slice(2);
9404
+ },
9405
+ yyyy: function () {
9406
+ return _this56.date.getFullYear();
9407
+ }
9408
+ };
9409
+ }
9410
+
9411
+ /**
9412
+ * Remove Event Handlers
9413
+ */
9414
+
9415
+ }, {
9416
+ key: "_removeEventHandlers",
9417
+ value: function _removeEventHandlers() {
9418
+ this.el.removeEventListener('click', this._handleInputClickBound);
9419
+ this.el.removeEventListener('keydown', this._handleInputKeydownBound);
9420
+ this.el.removeEventListener('change', this._handleInputChangeBound);
9421
+ this.calendarEl.removeEventListener('click', this._handleCalendarClickBound);
9422
+ }
9423
+ }, {
9424
+ key: "_handleInputClick",
9425
+ value: function _handleInputClick() {
9426
+ this.open();
9427
+ }
9428
+ }, {
9429
+ key: "_handleInputKeydown",
9430
+ value: function _handleInputKeydown(e) {
9431
+ if (e.which === M.keys.ENTER) {
9432
+ e.preventDefault();
9433
+ this.open();
9434
+ }
9435
+ }
9436
+ }, {
9437
+ key: "_handleCalendarClick",
9438
+ value: function _handleCalendarClick(e) {
9439
+ if (!this.isOpen) {
9440
+ return;
9441
+ }
9442
+
9443
+ var $target = $(e.target);
9444
+ if (!$target.hasClass('is-disabled')) {
9445
+ if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) {
9446
+ this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day')));
9447
+ if (this.options.autoClose) {
9448
+ this._finishSelection();
9449
+ }
9450
+ } else if ($target.closest('.month-prev').length) {
9451
+ this.prevMonth();
9452
+ } else if ($target.closest('.month-next').length) {
9453
+ this.nextMonth();
9454
+ }
9455
+ }
9456
+ }
9457
+ }, {
9458
+ key: "_handleClearClick",
9459
+ value: function _handleClearClick() {
9460
+ this.date = null;
9461
+ this.setInputValue();
9462
+ this.close();
9463
+ }
9464
+ }, {
9465
+ key: "_handleMonthChange",
9466
+ value: function _handleMonthChange(e) {
9467
+ this.gotoMonth(e.target.value);
9468
+ }
9469
+ }, {
9470
+ key: "_handleYearChange",
9471
+ value: function _handleYearChange(e) {
9472
+ this.gotoYear(e.target.value);
9473
+ }
9474
+
9475
+ /**
9476
+ * change view to a specific month (zero-index, e.g. 0: January)
9477
+ */
9478
+
9479
+ }, {
9480
+ key: "gotoMonth",
9481
+ value: function gotoMonth(month) {
9482
+ if (!isNaN(month)) {
9483
+ this.calendars[0].month = parseInt(month, 10);
9484
+ this.adjustCalendars();
9485
+ }
9486
+ }
9487
+
9488
+ /**
9489
+ * change view to a specific full year (e.g. "2012")
9490
+ */
9491
+
9492
+ }, {
9493
+ key: "gotoYear",
9494
+ value: function gotoYear(year) {
9495
+ if (!isNaN(year)) {
9496
+ this.calendars[0].year = parseInt(year, 10);
9497
+ this.adjustCalendars();
9498
+ }
9499
+ }
9500
+ }, {
9501
+ key: "_handleInputChange",
9502
+ value: function _handleInputChange(e) {
9503
+ var date = void 0;
9504
+
9505
+ // Prevent change event from being fired when triggered by the plugin
9506
+ if (e.firedBy === this) {
9507
+ return;
9508
+ }
9509
+ if (this.options.parse) {
9510
+ date = this.options.parse(this.el.value, this.options.format);
9511
+ } else {
9512
+ date = new Date(Date.parse(this.el.value));
9513
+ }
9514
+
9515
+ if (Datepicker._isDate(date)) {
9516
+ this.setDate(date);
9517
+ }
9518
+ }
9519
+ }, {
9520
+ key: "renderDayName",
9521
+ value: function renderDayName(opts, day, abbr) {
9522
+ day += opts.firstDay;
9523
+ while (day >= 7) {
9524
+ day -= 7;
9525
+ }
9526
+ return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day];
9527
+ }
9528
+
9529
+ /**
9530
+ * Set input value to the selected date and close Datepicker
9531
+ */
9532
+
9533
+ }, {
9534
+ key: "_finishSelection",
9535
+ value: function _finishSelection() {
9536
+ this.setInputValue();
9537
+ this.close();
9538
+ }
9539
+
9540
+ /**
9541
+ * Open Datepicker
9542
+ */
9543
+
9544
+ }, {
9545
+ key: "open",
9546
+ value: function open() {
9547
+ if (this.isOpen) {
9548
+ return;
9549
+ }
9550
+
9551
+ this.isOpen = true;
9552
+ if (typeof this.options.onOpen === 'function') {
9553
+ this.options.onOpen.call(this);
9554
+ }
9555
+ this.draw();
9556
+ this.modal.open();
9557
+ return this;
9558
+ }
9559
+
9560
+ /**
9561
+ * Close Datepicker
9562
+ */
9563
+
9564
+ }, {
9565
+ key: "close",
9566
+ value: function close() {
9567
+ if (!this.isOpen) {
9568
+ return;
9569
+ }
9570
+
9571
+ this.isOpen = false;
9572
+ if (typeof this.options.onClose === 'function') {
9573
+ this.options.onClose.call(this);
9574
+ }
9575
+ this.modal.close();
9576
+ return this;
9577
+ }
9578
+ }], [{
9579
+ key: "init",
9580
+ value: function init(els, options) {
9581
+ return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options);
9582
+ }
9583
+ }, {
9584
+ key: "_isDate",
9585
+ value: function _isDate(obj) {
9586
+ return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime())
9587
+ );
9588
+ }
9589
+ }, {
9590
+ key: "_isWeekend",
9591
+ value: function _isWeekend(date) {
9592
+ var day = date.getDay();
9593
+ return day === 0 || day === 6;
9594
+ }
9595
+ }, {
9596
+ key: "_setToStartOfDay",
9597
+ value: function _setToStartOfDay(date) {
9598
+ if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0);
9599
+ }
9600
+ }, {
9601
+ key: "_getDaysInMonth",
9602
+ value: function _getDaysInMonth(year, month) {
9603
+ return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
9604
+ }
9605
+ }, {
9606
+ key: "_isLeapYear",
9607
+ value: function _isLeapYear(year) {
9608
+ // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
9609
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
9610
+ }
9611
+ }, {
9612
+ key: "_compareDates",
9613
+ value: function _compareDates(a, b) {
9614
+ // weak date comparison (use setToStartOfDay(date) to ensure correct result)
9615
+ return a.getTime() === b.getTime();
9616
+ }
9617
+ }, {
9618
+ key: "_setToStartOfDay",
9619
+ value: function _setToStartOfDay(date) {
9620
+ if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0);
9621
+ }
9622
+
9623
+ /**
9624
+ * Get Instance
9625
+ */
9626
+
9627
+ }, {
9628
+ key: "getInstance",
9629
+ value: function getInstance(el) {
9630
+ var domElem = !!el.jquery ? el[0] : el;
9631
+ return domElem.M_Datepicker;
9632
+ }
9633
+ }, {
9634
+ key: "defaults",
9635
+ get: function () {
9636
+ return _defaults;
9637
+ }
9638
+ }]);
9639
+
9640
+ return Datepicker;
9641
+ }(Component);
9642
+
9643
+ Datepicker._template = ['<div class= "modal datepicker-modal">', '<div class="modal-content datepicker-container">', '<div class="datepicker-date-display">', '<span class="year-text"></span>', '<span class="date-text"></span>', '</div>', '<div class="datepicker-calendar-container">', '<div class="datepicker-calendar"></div>', '<div class="datepicker-footer">', '<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>', '<div class="confirmation-btns">', '<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>', '<button class="btn-flat datepicker-done waves-effect" type="button"></button>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
9644
+
9645
+ M.Datepicker = Datepicker;
9646
+
9647
+ if (M.jQueryLoaded) {
9648
+ M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker');
9649
+ }
9650
+ })(cash);
9651
+ ;(function ($) {
9652
+ 'use strict';
9653
+
9654
+ var _defaults = {
9655
+ dialRadius: 135,
9656
+ outerRadius: 105,
9657
+ innerRadius: 70,
9658
+ tickRadius: 20,
9659
+ duration: 350,
9660
+ container: null,
9661
+ defaultTime: 'now', // default time, 'now' or '13:14' e.g.
9662
+ fromNow: 0, // Millisecond offset from the defaultTime
9663
+ showClearBtn: false,
9664
+
9665
+ // internationalization
9666
+ i18n: {
9667
+ cancel: 'Cancel',
9668
+ clear: 'Clear',
9669
+ done: 'Ok'
9670
+ },
9671
+
9672
+ autoClose: false, // auto close when minute is selected
9673
+ twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
9674
+ vibrate: true, // vibrate the device when dragging clock hand
9675
+
9676
+ // Callbacks
9677
+ onOpenStart: null,
9678
+ onOpenEnd: null,
9679
+ onCloseStart: null,
9680
+ onCloseEnd: null,
9681
+ onSelect: null
9682
+ };
9683
+
9684
+ /**
9685
+ * @class
9686
+ *
9687
+ */
9688
+
9689
+ var Timepicker = function (_Component16) {
9690
+ _inherits(Timepicker, _Component16);
9691
+
9692
+ function Timepicker(el, options) {
9693
+ _classCallCheck(this, Timepicker);
9694
+
9695
+ var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
9696
+
9697
+ _this57.el.M_Timepicker = _this57;
9698
+
9699
+ _this57.options = $.extend({}, Timepicker.defaults, options);
9700
+
9701
+ _this57.id = M.guid();
9702
+ _this57._insertHTMLIntoDOM();
9703
+ _this57._setupModal();
9704
+ _this57._setupVariables();
9705
+ _this57._setupEventHandlers();
9706
+
9707
+ _this57._clockSetup();
9708
+ _this57._pickerSetup();
9709
+ return _this57;
9710
+ }
9711
+
9712
+ _createClass(Timepicker, [{
9713
+ key: "destroy",
9714
+
9715
+
9716
+ /**
9717
+ * Teardown component
9718
+ */
9719
+ value: function destroy() {
9720
+ this._removeEventHandlers();
9721
+ this.modal.destroy();
9722
+ $(this.modalEl).remove();
9723
+ this.el.M_Timepicker = undefined;
9724
+ }
9725
+
9726
+ /**
9727
+ * Setup Event Handlers
9728
+ */
9729
+
9730
+ }, {
9731
+ key: "_setupEventHandlers",
9732
+ value: function _setupEventHandlers() {
9733
+ this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
9734
+ this._handleInputClickBound = this._handleInputClick.bind(this);
9735
+ this._handleClockClickStartBound = this._handleClockClickStart.bind(this);
9736
+ this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this);
9737
+ this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this);
9738
+
9739
+ this.el.addEventListener('click', this._handleInputClickBound);
9740
+ this.el.addEventListener('keydown', this._handleInputKeydownBound);
9741
+ this.plate.addEventListener('mousedown', this._handleClockClickStartBound);
9742
+ this.plate.addEventListener('touchstart', this._handleClockClickStartBound);
9743
+
9744
+ $(this.spanHours).on('click', this.showView.bind(this, 'hours'));
9745
+ $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes'));
9746
+ }
9747
+ }, {
9748
+ key: "_removeEventHandlers",
9749
+ value: function _removeEventHandlers() {
9750
+ this.el.removeEventListener('click', this._handleInputClickBound);
9751
+ this.el.removeEventListener('keydown', this._handleInputKeydownBound);
9752
+ }
9753
+ }, {
9754
+ key: "_handleInputClick",
9755
+ value: function _handleInputClick() {
9756
+ this.open();
9757
+ }
9758
+ }, {
9759
+ key: "_handleInputKeydown",
9760
+ value: function _handleInputKeydown(e) {
9761
+ if (e.which === M.keys.ENTER) {
9762
+ e.preventDefault();
9763
+ this.open();
9764
+ }
9765
+ }
9766
+ }, {
9767
+ key: "_handleClockClickStart",
9768
+ value: function _handleClockClickStart(e) {
9769
+ e.preventDefault();
9770
+ var clockPlateBR = this.plate.getBoundingClientRect();
9771
+ var offset = { x: clockPlateBR.left, y: clockPlateBR.top };
9772
+
9773
+ this.x0 = offset.x + this.options.dialRadius;
9774
+ this.y0 = offset.y + this.options.dialRadius;
9775
+ this.moved = false;
9776
+ var clickPos = Timepicker._Pos(e);
9777
+ this.dx = clickPos.x - this.x0;
9778
+ this.dy = clickPos.y - this.y0;
9779
+
9780
+ // Set clock hands
9781
+ this.setHand(this.dx, this.dy, false);
9782
+
9783
+ // Mousemove on document
9784
+ document.addEventListener('mousemove', this._handleDocumentClickMoveBound);
9785
+ document.addEventListener('touchmove', this._handleDocumentClickMoveBound);
9786
+
9787
+ // Mouseup on document
9788
+ document.addEventListener('mouseup', this._handleDocumentClickEndBound);
9789
+ document.addEventListener('touchend', this._handleDocumentClickEndBound);
9790
+ }
9791
+ }, {
9792
+ key: "_handleDocumentClickMove",
9793
+ value: function _handleDocumentClickMove(e) {
9794
+ e.preventDefault();
9795
+ var clickPos = Timepicker._Pos(e);
9796
+ var x = clickPos.x - this.x0;
9797
+ var y = clickPos.y - this.y0;
9798
+ this.moved = true;
9799
+ this.setHand(x, y, false, true);
9800
+ }
9801
+ }, {
9802
+ key: "_handleDocumentClickEnd",
9803
+ value: function _handleDocumentClickEnd(e) {
9804
+ var _this58 = this;
9805
+
9806
+ e.preventDefault();
9807
+ document.removeEventListener('mouseup', this._handleDocumentClickEndBound);
9808
+ document.removeEventListener('touchend', this._handleDocumentClickEndBound);
9809
+ var clickPos = Timepicker._Pos(e);
9810
+ var x = clickPos.x - this.x0;
9811
+ var y = clickPos.y - this.y0;
9812
+ if (this.moved && x === this.dx && y === this.dy) {
9813
+ this.setHand(x, y);
9814
+ }
9815
+
9816
+ if (this.currentView === 'hours') {
9817
+ this.showView('minutes', this.options.duration / 2);
9818
+ } else if (this.options.autoClose) {
9819
+ $(this.minutesView).addClass('timepicker-dial-out');
9820
+ setTimeout(function () {
9821
+ _this58.done();
9822
+ }, this.options.duration / 2);
9823
+ }
9824
+
9825
+ if (typeof this.options.onSelect === 'function') {
9826
+ this.options.onSelect.call(this, this.hours, this.minutes);
9827
+ }
9828
+
9829
+ // Unbind mousemove event
9830
+ document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
9831
+ document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
9832
+ }
9833
+ }, {
9834
+ key: "_insertHTMLIntoDOM",
9835
+ value: function _insertHTMLIntoDOM() {
9836
+ this.$modalEl = $(Timepicker._template);
9837
+ this.modalEl = this.$modalEl[0];
9838
+ this.modalEl.id = 'modal-' + this.id;
9839
+
9840
+ // Append popover to input by default
9841
+ var containerEl = document.querySelector(this.options.container);
9842
+ if (this.options.container && !!containerEl) {
9843
+ this.$modalEl.appendTo(containerEl);
9844
+ } else {
9845
+ this.$modalEl.insertBefore(this.el);
9846
+ }
9847
+ }
9848
+ }, {
9849
+ key: "_setupModal",
9850
+ value: function _setupModal() {
9851
+ var _this59 = this;
9852
+
9853
+ this.modal = M.Modal.init(this.modalEl, {
9854
+ onOpenStart: this.options.onOpenStart,
9855
+ onOpenEnd: this.options.onOpenEnd,
9856
+ onCloseStart: this.options.onCloseStart,
9857
+ onCloseEnd: function () {
9858
+ if (typeof _this59.options.onCloseEnd === 'function') {
9859
+ _this59.options.onCloseEnd.call(_this59);
9860
+ }
9861
+ _this59.isOpen = false;
9862
+ }
9863
+ });
9864
+ }
9865
+ }, {
9866
+ key: "_setupVariables",
9867
+ value: function _setupVariables() {
9868
+ this.currentView = 'hours';
9869
+ this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
9870
+
9871
+ this._canvas = this.modalEl.querySelector('.timepicker-canvas');
9872
+ this.plate = this.modalEl.querySelector('.timepicker-plate');
9873
+
9874
+ this.hoursView = this.modalEl.querySelector('.timepicker-hours');
9875
+ this.minutesView = this.modalEl.querySelector('.timepicker-minutes');
9876
+ this.spanHours = this.modalEl.querySelector('.timepicker-span-hours');
9877
+ this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes');
9878
+ this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm');
9879
+ this.footer = this.modalEl.querySelector('.timepicker-footer');
9880
+ this.amOrPm = 'PM';
9881
+ }
9882
+ }, {
9883
+ key: "_pickerSetup",
9884
+ value: function _pickerSetup() {
9885
+ var $clearBtn = $("<button class=\"btn-flat timepicker-clear waves-effect\" style=\"visibility: hidden;\" type=\"button\" tabindex=\"" + (this.options.twelveHour ? '3' : '1') + "\">" + this.options.i18n.clear + "</button>").appendTo(this.footer).on('click', this.clear.bind(this));
9886
+ if (this.options.showClearBtn) {
9887
+ $clearBtn.css({ visibility: '' });
9888
+ }
9889
+
9890
+ var confirmationBtnsContainer = $('<div class="confirmation-btns"></div>');
9891
+ $('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.cancel + '</button>').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this));
9892
+ $('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.done + '</button>').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this));
9893
+ confirmationBtnsContainer.appendTo(this.footer);
9894
+ }
9895
+ }, {
9896
+ key: "_clockSetup",
9897
+ value: function _clockSetup() {
9898
+ if (this.options.twelveHour) {
9899
+ this.$amBtn = $('<div class="am-btn">AM</div>');
9900
+ this.$pmBtn = $('<div class="pm-btn">PM</div>');
9901
+ this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
9902
+ this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
9903
+ }
9904
+
9905
+ this._buildHoursView();
9906
+ this._buildMinutesView();
9907
+ this._buildSVGClock();
9908
+ }
9909
+ }, {
9910
+ key: "_buildSVGClock",
9911
+ value: function _buildSVGClock() {
9912
+ // Draw clock hands and others
9913
+ var dialRadius = this.options.dialRadius;
9914
+ var tickRadius = this.options.tickRadius;
9915
+ var diameter = dialRadius * 2;
9916
+
9917
+ var svg = Timepicker._createSVGEl('svg');
9918
+ svg.setAttribute('class', 'timepicker-svg');
9919
+ svg.setAttribute('width', diameter);
9920
+ svg.setAttribute('height', diameter);
9921
+ var g = Timepicker._createSVGEl('g');
9922
+ g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
9923
+ var bearing = Timepicker._createSVGEl('circle');
9924
+ bearing.setAttribute('class', 'timepicker-canvas-bearing');
9925
+ bearing.setAttribute('cx', 0);
9926
+ bearing.setAttribute('cy', 0);
9927
+ bearing.setAttribute('r', 4);
9928
+ var hand = Timepicker._createSVGEl('line');
9929
+ hand.setAttribute('x1', 0);
9930
+ hand.setAttribute('y1', 0);
9931
+ var bg = Timepicker._createSVGEl('circle');
9932
+ bg.setAttribute('class', 'timepicker-canvas-bg');
9933
+ bg.setAttribute('r', tickRadius);
9934
+ g.appendChild(hand);
9935
+ g.appendChild(bg);
9936
+ g.appendChild(bearing);
9937
+ svg.appendChild(g);
9938
+ this._canvas.appendChild(svg);
9939
+
9940
+ this.hand = hand;
9941
+ this.bg = bg;
9942
+ this.bearing = bearing;
9943
+ this.g = g;
9944
+ }
9945
+ }, {
9946
+ key: "_buildHoursView",
9947
+ value: function _buildHoursView() {
9948
+ var $tick = $('<div class="timepicker-tick"></div>');
9949
+ // Hours view
9950
+ if (this.options.twelveHour) {
9951
+ for (var i = 1; i < 13; i += 1) {
9952
+ var tick = $tick.clone();
9953
+ var radian = i / 6 * Math.PI;
9954
+ var radius = this.options.outerRadius;
9955
+ tick.css({
9956
+ left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px',
9957
+ top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px'
9958
+ });
9959
+ tick.html(i === 0 ? '00' : i);
9960
+ this.hoursView.appendChild(tick[0]);
9961
+ // tick.on(mousedownEvent, mousedown);
9962
+ }
9963
+ } else {
9964
+ for (var _i2 = 0; _i2 < 24; _i2 += 1) {
9965
+ var _tick = $tick.clone();
9966
+ var _radian = _i2 / 6 * Math.PI;
9967
+ var inner = _i2 > 0 && _i2 < 13;
9968
+ var _radius = inner ? this.options.innerRadius : this.options.outerRadius;
9969
+ _tick.css({
9970
+ left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px',
9971
+ top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px'
9972
+ });
9973
+ _tick.html(_i2 === 0 ? '00' : _i2);
9974
+ this.hoursView.appendChild(_tick[0]);
9975
+ // tick.on(mousedownEvent, mousedown);
9976
+ }
9977
+ }
9978
+ }
9979
+ }, {
9980
+ key: "_buildMinutesView",
9981
+ value: function _buildMinutesView() {
9982
+ var $tick = $('<div class="timepicker-tick"></div>');
9983
+ // Minutes view
9984
+ for (var i = 0; i < 60; i += 5) {
9985
+ var tick = $tick.clone();
9986
+ var radian = i / 30 * Math.PI;
9987
+ tick.css({
9988
+ left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px',
9989
+ top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px'
9990
+ });
9991
+ tick.html(Timepicker._addLeadingZero(i));
9992
+ this.minutesView.appendChild(tick[0]);
9993
+ }
9994
+ }
9995
+ }, {
9996
+ key: "_handleAmPmClick",
9997
+ value: function _handleAmPmClick(e) {
9998
+ var $btnClicked = $(e.target);
9999
+ this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM';
10000
+ this._updateAmPmView();
10001
+ }
10002
+ }, {
10003
+ key: "_updateAmPmView",
10004
+ value: function _updateAmPmView() {
10005
+ if (this.options.twelveHour) {
10006
+ this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM');
10007
+ this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM');
10008
+ }
10009
+ }
10010
+ }, {
10011
+ key: "_updateTimeFromInput",
10012
+ value: function _updateTimeFromInput() {
10013
+ // Get the time
10014
+ var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
10015
+ if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
10016
+ if (value[1].toUpperCase().indexOf('AM') > 0) {
10017
+ this.amOrPm = 'AM';
10018
+ } else {
10019
+ this.amOrPm = 'PM';
10020
+ }
10021
+ value[1] = value[1].replace('AM', '').replace('PM', '');
10022
+ }
10023
+ if (value[0] === 'now') {
10024
+ var now = new Date(+new Date() + this.options.fromNow);
10025
+ value = [now.getHours(), now.getMinutes()];
10026
+ if (this.options.twelveHour) {
10027
+ this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
10028
+ }
10029
+ }
10030
+ this.hours = +value[0] || 0;
10031
+ this.minutes = +value[1] || 0;
10032
+ this.spanHours.innerHTML = this.hours;
10033
+ this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes);
10034
+
10035
+ this._updateAmPmView();
10036
+ }
10037
+ }, {
10038
+ key: "showView",
10039
+ value: function showView(view, delay) {
10040
+ if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') {
10041
+ // raiseCallback(this.options.beforeHourSelect);
10042
+ }
10043
+ var isHours = view === 'hours',
10044
+ nextView = isHours ? this.hoursView : this.minutesView,
10045
+ hideView = isHours ? this.minutesView : this.hoursView;
10046
+ this.currentView = view;
10047
+
10048
+ $(this.spanHours).toggleClass('text-primary', isHours);
10049
+ $(this.spanMinutes).toggleClass('text-primary', !isHours);
10050
+
10051
+ // Transition view
10052
+ hideView.classList.add('timepicker-dial-out');
10053
+ $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out');
10054
+
10055
+ // Reset clock hand
10056
+ this.resetClock(delay);
10057
+
10058
+ // After transitions ended
10059
+ clearTimeout(this.toggleViewTimer);
10060
+ this.toggleViewTimer = setTimeout(function () {
10061
+ $(hideView).css('visibility', 'hidden');
10062
+ }, this.options.duration);
10063
+ }
10064
+ }, {
10065
+ key: "resetClock",
10066
+ value: function resetClock(delay) {
10067
+ var view = this.currentView,
10068
+ value = this[view],
10069
+ isHours = view === 'hours',
10070
+ unit = Math.PI / (isHours ? 6 : 30),
10071
+ radian = value * unit,
10072
+ radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius,
10073
+ x = Math.sin(radian) * radius,
10074
+ y = -Math.cos(radian) * radius,
10075
+ self = this;
10076
+
10077
+ if (delay) {
10078
+ $(this.canvas).addClass('timepicker-canvas-out');
10079
+ setTimeout(function () {
10080
+ $(self.canvas).removeClass('timepicker-canvas-out');
10081
+ self.setHand(x, y);
10082
+ }, delay);
10083
+ } else {
10084
+ this.setHand(x, y);
10085
+ }
10086
+ }
10087
+ }, {
10088
+ key: "setHand",
10089
+ value: function setHand(x, y, roundBy5) {
10090
+ var _this60 = this;
10091
+
10092
+ var radian = Math.atan2(x, -y),
10093
+ isHours = this.currentView === 'hours',
10094
+ unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
10095
+ z = Math.sqrt(x * x + y * y),
10096
+ inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2,
10097
+ radius = inner ? this.options.innerRadius : this.options.outerRadius;
10098
+
10099
+ if (this.options.twelveHour) {
10100
+ radius = this.options.outerRadius;
10101
+ }
10102
+
10103
+ // Radian should in range [0, 2PI]
10104
+ if (radian < 0) {
10105
+ radian = Math.PI * 2 + radian;
10106
+ }
10107
+
10108
+ // Get the round value
10109
+ var value = Math.round(radian / unit);
10110
+
10111
+ // Get the round radian
10112
+ radian = value * unit;
10113
+
10114
+ // Correct the hours or minutes
10115
+ if (this.options.twelveHour) {
10116
+ if (isHours) {
10117
+ if (value === 0) value = 12;
10118
+ } else {
10119
+ if (roundBy5) value *= 5;
10120
+ if (value === 60) value = 0;
10121
+ }
10122
+ } else {
10123
+ if (isHours) {
10124
+ if (value === 12) {
10125
+ value = 0;
10126
+ }
10127
+ value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
10128
+ } else {
10129
+ if (roundBy5) {
10130
+ value *= 5;
10131
+ }
10132
+ if (value === 60) {
10133
+ value = 0;
10134
+ }
10135
+ }
10136
+ }
10137
+
10138
+ // Once hours or minutes changed, vibrate the device
10139
+ if (this[this.currentView] !== value) {
10140
+ if (this.vibrate && this.options.vibrate) {
10141
+ // Do not vibrate too frequently
10142
+ if (!this.vibrateTimer) {
10143
+ navigator[this.vibrate](10);
10144
+ this.vibrateTimer = setTimeout(function () {
10145
+ _this60.vibrateTimer = null;
10146
+ }, 100);
10147
+ }
10148
+ }
10149
+ }
10150
+
10151
+ this[this.currentView] = value;
10152
+ if (isHours) {
10153
+ this['spanHours'].innerHTML = value;
10154
+ } else {
10155
+ this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value);
10156
+ }
10157
+
10158
+ // Set clock hand and others' position
10159
+ var cx1 = Math.sin(radian) * (radius - this.options.tickRadius),
10160
+ cy1 = -Math.cos(radian) * (radius - this.options.tickRadius),
10161
+ cx2 = Math.sin(radian) * radius,
10162
+ cy2 = -Math.cos(radian) * radius;
10163
+ this.hand.setAttribute('x2', cx1);
10164
+ this.hand.setAttribute('y2', cy1);
10165
+ this.bg.setAttribute('cx', cx2);
10166
+ this.bg.setAttribute('cy', cy2);
10167
+ }
10168
+ }, {
10169
+ key: "open",
10170
+ value: function open() {
10171
+ if (this.isOpen) {
10172
+ return;
10173
+ }
10174
+
10175
+ this.isOpen = true;
10176
+ this._updateTimeFromInput();
10177
+ this.showView('hours');
10178
+
10179
+ this.modal.open();
10180
+ }
10181
+ }, {
10182
+ key: "close",
10183
+ value: function close() {
10184
+ if (!this.isOpen) {
10185
+ return;
10186
+ }
10187
+
10188
+ this.isOpen = false;
10189
+ this.modal.close();
10190
+ }
10191
+
10192
+ /**
10193
+ * Finish timepicker selection.
10194
+ */
10195
+
10196
+ }, {
10197
+ key: "done",
10198
+ value: function done(e, clearValue) {
10199
+ // Set input value
10200
+ var last = this.el.value;
10201
+ var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes);
10202
+ this.time = value;
10203
+ if (!clearValue && this.options.twelveHour) {
10204
+ value = value + " " + this.amOrPm;
10205
+ }
10206
+ this.el.value = value;
10207
+
10208
+ // Trigger change event
10209
+ if (value !== last) {
10210
+ this.$el.trigger('change');
10211
+ }
10212
+
10213
+ this.close();
10214
+ this.el.focus();
10215
+ }
10216
+ }, {
10217
+ key: "clear",
10218
+ value: function clear() {
10219
+ this.done(null, true);
10220
+ }
10221
+ }], [{
10222
+ key: "init",
10223
+ value: function init(els, options) {
10224
+ return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options);
10225
+ }
10226
+ }, {
10227
+ key: "_addLeadingZero",
10228
+ value: function _addLeadingZero(num) {
10229
+ return (num < 10 ? '0' : '') + num;
10230
+ }
10231
+ }, {
10232
+ key: "_createSVGEl",
10233
+ value: function _createSVGEl(name) {
10234
+ var svgNS = 'http://www.w3.org/2000/svg';
10235
+ return document.createElementNS(svgNS, name);
10236
+ }
10237
+
10238
+ /**
10239
+ * @typedef {Object} Point
10240
+ * @property {number} x The X Coordinate
10241
+ * @property {number} y The Y Coordinate
10242
+ */
10243
+
10244
+ /**
10245
+ * Get x position of mouse or touch event
10246
+ * @param {Event} e
10247
+ * @return {Point} x and y location
10248
+ */
10249
+
10250
+ }, {
10251
+ key: "_Pos",
10252
+ value: function _Pos(e) {
10253
+ if (e.targetTouches && e.targetTouches.length >= 1) {
10254
+ return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY };
10255
+ }
10256
+ // mouse event
10257
+ return { x: e.clientX, y: e.clientY };
10258
+ }
10259
+
10260
+ /**
10261
+ * Get Instance
10262
+ */
10263
+
10264
+ }, {
10265
+ key: "getInstance",
10266
+ value: function getInstance(el) {
10267
+ var domElem = !!el.jquery ? el[0] : el;
10268
+ return domElem.M_Timepicker;
10269
+ }
10270
+ }, {
10271
+ key: "defaults",
10272
+ get: function () {
10273
+ return _defaults;
10274
+ }
10275
+ }]);
10276
+
10277
+ return Timepicker;
10278
+ }(Component);
10279
+
10280
+ Timepicker._template = ['<div class= "modal timepicker-modal">', '<div class="modal-content timepicker-container">', '<div class="timepicker-digital-display">', '<div class="timepicker-text-container">', '<div class="timepicker-display-column">', '<span class="timepicker-span-hours text-primary"></span>', ':', '<span class="timepicker-span-minutes"></span>', '</div>', '<div class="timepicker-display-column timepicker-display-am-pm">', '<div class="timepicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="timepicker-analog-display">', '<div class="timepicker-plate">', '<div class="timepicker-canvas"></div>', '<div class="timepicker-dial timepicker-hours"></div>', '<div class="timepicker-dial timepicker-minutes timepicker-dial-out"></div>', '</div>', '<div class="timepicker-footer"></div>', '</div>', '</div>', '</div>'].join('');
10281
+
10282
+ M.Timepicker = Timepicker;
10283
+
10284
+ if (M.jQueryLoaded) {
10285
+ M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker');
10286
+ }
10287
+ })(cash);
10288
+ ;(function ($) {
10289
+ 'use strict';
10290
+
10291
+ var _defaults = {};
10292
+
10293
+ /**
10294
+ * @class
10295
+ *
10296
+ */
10297
+
10298
+ var CharacterCounter = function (_Component17) {
10299
+ _inherits(CharacterCounter, _Component17);
10300
+
10301
+ /**
10302
+ * Construct CharacterCounter instance
10303
+ * @constructor
10304
+ * @param {Element} el
10305
+ * @param {Object} options
10306
+ */
10307
+ function CharacterCounter(el, options) {
10308
+ _classCallCheck(this, CharacterCounter);
10309
+
10310
+ var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options));
10311
+
10312
+ _this61.el.M_CharacterCounter = _this61;
10313
+
10314
+ /**
10315
+ * Options for the character counter
10316
+ */
10317
+ _this61.options = $.extend({}, CharacterCounter.defaults, options);
10318
+
10319
+ _this61.isInvalid = false;
10320
+ _this61.isValidLength = false;
10321
+ _this61._setupCounter();
10322
+ _this61._setupEventHandlers();
10323
+ return _this61;
10324
+ }
10325
+
10326
+ _createClass(CharacterCounter, [{
10327
+ key: "destroy",
10328
+
10329
+
10330
+ /**
10331
+ * Teardown component
10332
+ */
10333
+ value: function destroy() {
10334
+ this._removeEventHandlers();
10335
+ this.el.CharacterCounter = undefined;
10336
+ this._removeCounter();
10337
+ }
10338
+
10339
+ /**
10340
+ * Setup Event Handlers
10341
+ */
10342
+
10343
+ }, {
10344
+ key: "_setupEventHandlers",
10345
+ value: function _setupEventHandlers() {
10346
+ this._handleUpdateCounterBound = this.updateCounter.bind(this);
10347
+
10348
+ this.el.addEventListener('focus', this._handleUpdateCounterBound, true);
10349
+ this.el.addEventListener('input', this._handleUpdateCounterBound, true);
10350
+ }
10351
+
10352
+ /**
10353
+ * Remove Event Handlers
10354
+ */
10355
+
10356
+ }, {
10357
+ key: "_removeEventHandlers",
10358
+ value: function _removeEventHandlers() {
10359
+ this.el.removeEventListener('focus', this._handleUpdateCounterBound, true);
10360
+ this.el.removeEventListener('input', this._handleUpdateCounterBound, true);
10361
+ }
10362
+
10363
+ /**
10364
+ * Setup counter element
10365
+ */
10366
+
10367
+ }, {
10368
+ key: "_setupCounter",
10369
+ value: function _setupCounter() {
10370
+ this.counterEl = document.createElement('span');
10371
+ $(this.counterEl).addClass('character-counter').css({
10372
+ float: 'right',
10373
+ 'font-size': '12px',
10374
+ height: 1
10375
+ });
10376
+
10377
+ this.$el.parent().append(this.counterEl);
10378
+ }
10379
+
10380
+ /**
10381
+ * Remove counter element
10382
+ */
10383
+
10384
+ }, {
10385
+ key: "_removeCounter",
10386
+ value: function _removeCounter() {
10387
+ $(this.counterEl).remove();
10388
+ }
10389
+
10390
+ /**
10391
+ * Update counter
10392
+ */
10393
+
10394
+ }, {
10395
+ key: "updateCounter",
10396
+ value: function updateCounter() {
10397
+ var maxLength = +this.$el.attr('data-length'),
10398
+ actualLength = this.el.value.length;
10399
+ this.isValidLength = actualLength <= maxLength;
10400
+ var counterString = actualLength;
10401
+
10402
+ if (maxLength) {
10403
+ counterString += '/' + maxLength;
10404
+ this._validateInput();
10405
+ }
10406
+
10407
+ $(this.counterEl).html(counterString);
10408
+ }
10409
+
10410
+ /**
10411
+ * Add validation classes
10412
+ */
10413
+
10414
+ }, {
10415
+ key: "_validateInput",
10416
+ value: function _validateInput() {
10417
+ if (this.isValidLength && this.isInvalid) {
10418
+ this.isInvalid = false;
10419
+ this.$el.removeClass('invalid');
10420
+ } else if (!this.isValidLength && !this.isInvalid) {
10421
+ this.isInvalid = true;
10422
+ this.$el.removeClass('valid');
10423
+ this.$el.addClass('invalid');
10424
+ }
10425
+ }
10426
+ }], [{
10427
+ key: "init",
10428
+ value: function init(els, options) {
10429
+ return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options);
10430
+ }
10431
+
10432
+ /**
10433
+ * Get Instance
10434
+ */
10435
+
10436
+ }, {
10437
+ key: "getInstance",
10438
+ value: function getInstance(el) {
10439
+ var domElem = !!el.jquery ? el[0] : el;
10440
+ return domElem.M_CharacterCounter;
10441
+ }
10442
+ }, {
10443
+ key: "defaults",
10444
+ get: function () {
10445
+ return _defaults;
10446
+ }
10447
+ }]);
10448
+
10449
+ return CharacterCounter;
10450
+ }(Component);
10451
+
10452
+ M.CharacterCounter = CharacterCounter;
10453
+
10454
+ if (M.jQueryLoaded) {
10455
+ M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter');
10456
+ }
10457
+ })(cash);
10458
+ ;(function ($) {
10459
+ 'use strict';
10460
+
10461
+ var _defaults = {
10462
+ duration: 200, // ms
10463
+ dist: -100, // zoom scale TODO: make this more intuitive as an option
10464
+ shift: 0, // spacing for center image
10465
+ padding: 0, // Padding between non center items
10466
+ numVisible: 5, // Number of visible items in carousel
10467
+ fullWidth: false, // Change to full width styles
10468
+ indicators: false, // Toggle indicators
10469
+ noWrap: false, // Don't wrap around and cycle through items.
10470
+ onCycleTo: null // Callback for when a new slide is cycled to.
10471
+ };
10472
+
10473
+ /**
10474
+ * @class
10475
+ *
10476
+ */
10477
+
10478
+ var Carousel = function (_Component18) {
10479
+ _inherits(Carousel, _Component18);
10480
+
10481
+ /**
10482
+ * Construct Carousel instance
10483
+ * @constructor
10484
+ * @param {Element} el
10485
+ * @param {Object} options
10486
+ */
10487
+ function Carousel(el, options) {
10488
+ _classCallCheck(this, Carousel);
10489
+
10490
+ var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options));
10491
+
10492
+ _this62.el.M_Carousel = _this62;
10493
+
10494
+ /**
10495
+ * Options for the carousel
10496
+ * @member Carousel#options
10497
+ * @prop {Number} duration
10498
+ * @prop {Number} dist
10499
+ * @prop {Number} shift
10500
+ * @prop {Number} padding
10501
+ * @prop {Number} numVisible
10502
+ * @prop {Boolean} fullWidth
10503
+ * @prop {Boolean} indicators
10504
+ * @prop {Boolean} noWrap
10505
+ * @prop {Function} onCycleTo
10506
+ */
10507
+ _this62.options = $.extend({}, Carousel.defaults, options);
10508
+
10509
+ // Setup
10510
+ _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1;
10511
+ _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides;
10512
+ _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides;
10513
+ _this62.pressed = false;
10514
+ _this62.dragged = false;
10515
+ _this62.offset = _this62.target = 0;
10516
+ _this62.images = [];
10517
+ _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth();
10518
+ _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight();
10519
+ _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions.
10520
+ _this62._autoScrollBound = _this62._autoScroll.bind(_this62);
10521
+ _this62._trackBound = _this62._track.bind(_this62);
10522
+
10523
+ // Full Width carousel setup
10524
+ if (_this62.options.fullWidth) {
10525
+ _this62.options.dist = 0;
10526
+ _this62._setCarouselHeight();
10527
+
10528
+ // Offset fixed items when indicators.
10529
+ if (_this62.showIndicators) {
10530
+ _this62.$el.find('.carousel-fixed-item').addClass('with-indicators');
10531
+ }
10532
+ }
10533
+
10534
+ // Iterate through slides
10535
+ _this62.$indicators = $('<ul class="indicators"></ul>');
10536
+ _this62.$el.find('.carousel-item').each(function (el, i) {
10537
+ _this62.images.push(el);
10538
+ if (_this62.showIndicators) {
10539
+ var $indicator = $('<li class="indicator-item"></li>');
10540
+
10541
+ // Add active to first by default.
10542
+ if (i === 0) {
10543
+ $indicator[0].classList.add('active');
10544
+ }
10545
+
10546
+ _this62.$indicators.append($indicator);
10547
+ }
10548
+ });
10549
+ if (_this62.showIndicators) {
10550
+ _this62.$el.append(_this62.$indicators);
10551
+ }
10552
+ _this62.count = _this62.images.length;
10553
+
10554
+ // Cap numVisible at count
10555
+ _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible);
10556
+
10557
+ // Setup cross browser string
10558
+ _this62.xform = 'transform';
10559
+ ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
10560
+ var e = prefix + 'Transform';
10561
+ if (typeof document.body.style[e] !== 'undefined') {
10562
+ _this62.xform = e;
10563
+ return false;
10564
+ }
10565
+ return true;
10566
+ });
10567
+
10568
+ _this62._setupEventHandlers();
10569
+ _this62._scroll(_this62.offset);
10570
+ return _this62;
10571
+ }
10572
+
10573
+ _createClass(Carousel, [{
10574
+ key: "destroy",
10575
+
10576
+
10577
+ /**
10578
+ * Teardown component
10579
+ */
10580
+ value: function destroy() {
10581
+ this._removeEventHandlers();
10582
+ this.el.M_Carousel = undefined;
10583
+ }
10584
+
10585
+ /**
10586
+ * Setup Event Handlers
10587
+ */
10588
+
10589
+ }, {
10590
+ key: "_setupEventHandlers",
10591
+ value: function _setupEventHandlers() {
10592
+ var _this63 = this;
10593
+
10594
+ this._handleCarouselTapBound = this._handleCarouselTap.bind(this);
10595
+ this._handleCarouselDragBound = this._handleCarouselDrag.bind(this);
10596
+ this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this);
10597
+ this._handleCarouselClickBound = this._handleCarouselClick.bind(this);
10598
+
10599
+ if (typeof window.ontouchstart !== 'undefined') {
10600
+ this.el.addEventListener('touchstart', this._handleCarouselTapBound);
10601
+ this.el.addEventListener('touchmove', this._handleCarouselDragBound);
10602
+ this.el.addEventListener('touchend', this._handleCarouselReleaseBound);
10603
+ }
10604
+
10605
+ this.el.addEventListener('mousedown', this._handleCarouselTapBound);
10606
+ this.el.addEventListener('mousemove', this._handleCarouselDragBound);
10607
+ this.el.addEventListener('mouseup', this._handleCarouselReleaseBound);
10608
+ this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound);
10609
+ this.el.addEventListener('click', this._handleCarouselClickBound);
10610
+
10611
+ if (this.showIndicators && this.$indicators) {
10612
+ this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
10613
+ this.$indicators.find('.indicator-item').each(function (el, i) {
10614
+ el.addEventListener('click', _this63._handleIndicatorClickBound);
10615
+ });
10616
+ }
10617
+
10618
+ // Resize
10619
+ var throttledResize = M.throttle(this._handleResize, 200);
10620
+ this._handleThrottledResizeBound = throttledResize.bind(this);
10621
+
10622
+ window.addEventListener('resize', this._handleThrottledResizeBound);
10623
+ }
10624
+
10625
+ /**
10626
+ * Remove Event Handlers
10627
+ */
10628
+
10629
+ }, {
10630
+ key: "_removeEventHandlers",
10631
+ value: function _removeEventHandlers() {
10632
+ var _this64 = this;
10633
+
10634
+ if (typeof window.ontouchstart !== 'undefined') {
10635
+ this.el.removeEventListener('touchstart', this._handleCarouselTapBound);
10636
+ this.el.removeEventListener('touchmove', this._handleCarouselDragBound);
10637
+ this.el.removeEventListener('touchend', this._handleCarouselReleaseBound);
10638
+ }
10639
+ this.el.removeEventListener('mousedown', this._handleCarouselTapBound);
10640
+ this.el.removeEventListener('mousemove', this._handleCarouselDragBound);
10641
+ this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound);
10642
+ this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound);
10643
+ this.el.removeEventListener('click', this._handleCarouselClickBound);
10644
+
10645
+ if (this.showIndicators && this.$indicators) {
10646
+ this.$indicators.find('.indicator-item').each(function (el, i) {
10647
+ el.removeEventListener('click', _this64._handleIndicatorClickBound);
10648
+ });
10649
+ }
10650
+
10651
+ window.removeEventListener('resize', this._handleThrottledResizeBound);
10652
+ }
10653
+
10654
+ /**
10655
+ * Handle Carousel Tap
10656
+ * @param {Event} e
10657
+ */
10658
+
10659
+ }, {
10660
+ key: "_handleCarouselTap",
10661
+ value: function _handleCarouselTap(e) {
10662
+ // Fixes firefox draggable image bug
10663
+ if (e.type === 'mousedown' && $(e.target).is('img')) {
10664
+ e.preventDefault();
10665
+ }
10666
+ this.pressed = true;
10667
+ this.dragged = false;
10668
+ this.verticalDragged = false;
10669
+ this.reference = this._xpos(e);
10670
+ this.referenceY = this._ypos(e);
10671
+
10672
+ this.velocity = this.amplitude = 0;
10673
+ this.frame = this.offset;
10674
+ this.timestamp = Date.now();
10675
+ clearInterval(this.ticker);
10676
+ this.ticker = setInterval(this._trackBound, 100);
10677
+ }
10678
+
10679
+ /**
10680
+ * Handle Carousel Drag
10681
+ * @param {Event} e
10682
+ */
10683
+
10684
+ }, {
10685
+ key: "_handleCarouselDrag",
10686
+ value: function _handleCarouselDrag(e) {
10687
+ var x = void 0,
10688
+ y = void 0,
10689
+ delta = void 0,
10690
+ deltaY = void 0;
10691
+ if (this.pressed) {
10692
+ x = this._xpos(e);
10693
+ y = this._ypos(e);
10694
+ delta = this.reference - x;
10695
+ deltaY = Math.abs(this.referenceY - y);
10696
+ if (deltaY < 30 && !this.verticalDragged) {
10697
+ // If vertical scrolling don't allow dragging.
10698
+ if (delta > 2 || delta < -2) {
10699
+ this.dragged = true;
10700
+ this.reference = x;
10701
+ this._scroll(this.offset + delta);
10702
+ }
10703
+ } else if (this.dragged) {
10704
+ // If dragging don't allow vertical scroll.
10705
+ e.preventDefault();
10706
+ e.stopPropagation();
10707
+ return false;
10708
+ } else {
10709
+ // Vertical scrolling.
10710
+ this.verticalDragged = true;
10711
+ }
10712
+ }
10713
+
10714
+ if (this.dragged) {
10715
+ // If dragging don't allow vertical scroll.
10716
+ e.preventDefault();
10717
+ e.stopPropagation();
10718
+ return false;
10719
+ }
10720
+ }
10721
+
10722
+ /**
10723
+ * Handle Carousel Release
10724
+ * @param {Event} e
10725
+ */
10726
+
10727
+ }, {
10728
+ key: "_handleCarouselRelease",
10729
+ value: function _handleCarouselRelease(e) {
10730
+ if (this.pressed) {
10731
+ this.pressed = false;
10732
+ } else {
10733
+ return;
10734
+ }
10735
+
10736
+ clearInterval(this.ticker);
10737
+ this.target = this.offset;
10738
+ if (this.velocity > 10 || this.velocity < -10) {
10739
+ this.amplitude = 0.9 * this.velocity;
10740
+ this.target = this.offset + this.amplitude;
10741
+ }
10742
+ this.target = Math.round(this.target / this.dim) * this.dim;
10743
+
10744
+ // No wrap of items.
10745
+ if (this.noWrap) {
10746
+ if (this.target >= this.dim * (this.count - 1)) {
10747
+ this.target = this.dim * (this.count - 1);
10748
+ } else if (this.target < 0) {
10749
+ this.target = 0;
10750
+ }
10751
+ }
10752
+ this.amplitude = this.target - this.offset;
10753
+ this.timestamp = Date.now();
10754
+ requestAnimationFrame(this._autoScrollBound);
10755
+
10756
+ if (this.dragged) {
10757
+ e.preventDefault();
10758
+ e.stopPropagation();
10759
+ }
10760
+ return false;
10761
+ }
10762
+
10763
+ /**
10764
+ * Handle Carousel CLick
10765
+ * @param {Event} e
10766
+ */
10767
+
10768
+ }, {
10769
+ key: "_handleCarouselClick",
10770
+ value: function _handleCarouselClick(e) {
10771
+ // Disable clicks if carousel was dragged.
10772
+ if (this.dragged) {
10773
+ e.preventDefault();
10774
+ e.stopPropagation();
10775
+ return false;
10776
+ } else if (!this.options.fullWidth) {
10777
+ var clickedIndex = $(e.target).closest('.carousel-item').index();
10778
+ var diff = this._wrap(this.center) - clickedIndex;
10779
+
10780
+ // Disable clicks if carousel was shifted by click
10781
+ if (diff !== 0) {
10782
+ e.preventDefault();
10783
+ e.stopPropagation();
10784
+ }
10785
+ this._cycleTo(clickedIndex);
10786
+ }
10787
+ }
10788
+
10789
+ /**
10790
+ * Handle Indicator CLick
10791
+ * @param {Event} e
10792
+ */
10793
+
10794
+ }, {
10795
+ key: "_handleIndicatorClick",
10796
+ value: function _handleIndicatorClick(e) {
10797
+ e.stopPropagation();
10798
+
10799
+ var indicator = $(e.target).closest('.indicator-item');
10800
+ if (indicator.length) {
10801
+ this._cycleTo(indicator.index());
10802
+ }
10803
+ }
10804
+
10805
+ /**
10806
+ * Handle Throttle Resize
10807
+ * @param {Event} e
10808
+ */
10809
+
10810
+ }, {
10811
+ key: "_handleResize",
10812
+ value: function _handleResize(e) {
10813
+ if (this.options.fullWidth) {
10814
+ this.itemWidth = this.$el.find('.carousel-item').first().innerWidth();
10815
+ this.imageHeight = this.$el.find('.carousel-item.active').height();
10816
+ this.dim = this.itemWidth * 2 + this.options.padding;
10817
+ this.offset = this.center * 2 * this.itemWidth;
10818
+ this.target = this.offset;
10819
+ this._setCarouselHeight(true);
10820
+ } else {
10821
+ this._scroll();
10822
+ }
10823
+ }
10824
+
10825
+ /**
10826
+ * Set carousel height based on first slide
10827
+ * @param {Booleam} imageOnly - true for image slides
10828
+ */
10829
+
10830
+ }, {
10831
+ key: "_setCarouselHeight",
10832
+ value: function _setCarouselHeight(imageOnly) {
10833
+ var _this65 = this;
10834
+
10835
+ var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first();
10836
+ var firstImage = firstSlide.find('img').first();
10837
+ if (firstImage.length) {
10838
+ if (firstImage[0].complete) {
10839
+ // If image won't trigger the load event
10840
+ var imageHeight = firstImage.height();
10841
+ if (imageHeight > 0) {
10842
+ this.$el.css('height', imageHeight + 'px');
10843
+ } else {
10844
+ // If image still has no height, use the natural dimensions to calculate
10845
+ var naturalWidth = firstImage[0].naturalWidth;
10846
+ var naturalHeight = firstImage[0].naturalHeight;
10847
+ var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight;
10848
+ this.$el.css('height', adjustedHeight + 'px');
10849
+ }
10850
+ } else {
10851
+ // Get height when image is loaded normally
10852
+ firstImage.one('load', function (el, i) {
10853
+ _this65.$el.css('height', el.offsetHeight + 'px');
10854
+ });
10855
+ }
10856
+ } else if (!imageOnly) {
10857
+ var slideHeight = firstSlide.height();
10858
+ this.$el.css('height', slideHeight + 'px');
10859
+ }
10860
+ }
10861
+
10862
+ /**
10863
+ * Get x position from event
10864
+ * @param {Event} e
10865
+ */
10866
+
10867
+ }, {
10868
+ key: "_xpos",
10869
+ value: function _xpos(e) {
10870
+ // touch event
10871
+ if (e.targetTouches && e.targetTouches.length >= 1) {
10872
+ return e.targetTouches[0].clientX;
10873
+ }
10874
+
10875
+ // mouse event
10876
+ return e.clientX;
10877
+ }
10878
+
10879
+ /**
10880
+ * Get y position from event
10881
+ * @param {Event} e
10882
+ */
10883
+
10884
+ }, {
10885
+ key: "_ypos",
10886
+ value: function _ypos(e) {
10887
+ // touch event
10888
+ if (e.targetTouches && e.targetTouches.length >= 1) {
10889
+ return e.targetTouches[0].clientY;
10890
+ }
10891
+
10892
+ // mouse event
10893
+ return e.clientY;
10894
+ }
10895
+
10896
+ /**
10897
+ * Wrap index
10898
+ * @param {Number} x
10899
+ */
10900
+
10901
+ }, {
10902
+ key: "_wrap",
10903
+ value: function _wrap(x) {
10904
+ return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x;
10905
+ }
10906
+
10907
+ /**
10908
+ * Tracks scrolling information
10909
+ */
10910
+
10911
+ }, {
10912
+ key: "_track",
10913
+ value: function _track() {
10914
+ var now = void 0,
10915
+ elapsed = void 0,
10916
+ delta = void 0,
10917
+ v = void 0;
10918
+
10919
+ now = Date.now();
10920
+ elapsed = now - this.timestamp;
10921
+ this.timestamp = now;
10922
+ delta = this.offset - this.frame;
10923
+ this.frame = this.offset;
10924
+
10925
+ v = 1000 * delta / (1 + elapsed);
10926
+ this.velocity = 0.8 * v + 0.2 * this.velocity;
10927
+ }
10928
+
10929
+ /**
10930
+ * Auto scrolls to nearest carousel item.
10931
+ */
10932
+
10933
+ }, {
10934
+ key: "_autoScroll",
10935
+ value: function _autoScroll() {
10936
+ var elapsed = void 0,
10937
+ delta = void 0;
10938
+
10939
+ if (this.amplitude) {
10940
+ elapsed = Date.now() - this.timestamp;
10941
+ delta = this.amplitude * Math.exp(-elapsed / this.options.duration);
10942
+ if (delta > 2 || delta < -2) {
10943
+ this._scroll(this.target - delta);
10944
+ requestAnimationFrame(this._autoScrollBound);
10945
+ } else {
10946
+ this._scroll(this.target);
10947
+ }
10948
+ }
10949
+ }
10950
+
10951
+ /**
10952
+ * Scroll to target
10953
+ * @param {Number} x
10954
+ */
10955
+
10956
+ }, {
10957
+ key: "_scroll",
10958
+ value: function _scroll(x) {
10959
+ var _this66 = this;
10960
+
10961
+ // Track scrolling state
10962
+ if (!this.$el.hasClass('scrolling')) {
10963
+ this.el.classList.add('scrolling');
10964
+ }
10965
+ if (this.scrollingTimeout != null) {
10966
+ window.clearTimeout(this.scrollingTimeout);
10967
+ }
10968
+ this.scrollingTimeout = window.setTimeout(function () {
10969
+ _this66.$el.removeClass('scrolling');
10970
+ }, this.options.duration);
10971
+
10972
+ // Start actual scroll
10973
+ var i = void 0,
10974
+ half = void 0,
10975
+ delta = void 0,
10976
+ dir = void 0,
10977
+ tween = void 0,
10978
+ el = void 0,
10979
+ alignment = void 0,
10980
+ zTranslation = void 0,
10981
+ tweenedOpacity = void 0,
10982
+ centerTweenedOpacity = void 0;
10983
+ var lastCenter = this.center;
10984
+ var numVisibleOffset = 1 / this.options.numVisible;
10985
+
10986
+ this.offset = typeof x === 'number' ? x : this.offset;
10987
+ this.center = Math.floor((this.offset + this.dim / 2) / this.dim);
10988
+ delta = this.offset - this.center * this.dim;
10989
+ dir = delta < 0 ? 1 : -1;
10990
+ tween = -dir * delta * 2 / this.dim;
10991
+ half = this.count >> 1;
10992
+
10993
+ if (this.options.fullWidth) {
10994
+ alignment = 'translateX(0)';
10995
+ centerTweenedOpacity = 1;
10996
+ } else {
10997
+ alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) ';
10998
+ alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)';
10999
+ centerTweenedOpacity = 1 - numVisibleOffset * tween;
11000
+ }
11001
+
11002
+ // Set indicator active
11003
+ if (this.showIndicators) {
11004
+ var diff = this.center % this.count;
11005
+ var activeIndicator = this.$indicators.find('.indicator-item.active');
11006
+ if (activeIndicator.index() !== diff) {
11007
+ activeIndicator.removeClass('active');
11008
+ this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active');
11009
+ }
11010
+ }
11011
+
11012
+ // center
11013
+ // Don't show wrapped items.
11014
+ if (!this.noWrap || this.center >= 0 && this.center < this.count) {
11015
+ el = this.images[this._wrap(this.center)];
11016
+
11017
+ // Add active class to center item.
11018
+ if (!$(el).hasClass('active')) {
11019
+ this.$el.find('.carousel-item').removeClass('active');
11020
+ el.classList.add('active');
11021
+ }
11022
+ var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)";
11023
+ this._updateItemStyle(el, centerTweenedOpacity, 0, transformString);
11024
+ }
11025
+
11026
+ for (i = 1; i <= half; ++i) {
11027
+ // right side
11028
+ if (this.options.fullWidth) {
11029
+ zTranslation = this.options.dist;
11030
+ tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
11031
+ } else {
11032
+ zTranslation = this.options.dist * (i * 2 + tween * dir);
11033
+ tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir);
11034
+ }
11035
+ // Don't show wrapped items.
11036
+ if (!this.noWrap || this.center + i < this.count) {
11037
+ el = this.images[this._wrap(this.center + i)];
11038
+ var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
11039
+ this._updateItemStyle(el, tweenedOpacity, -i, _transformString);
11040
+ }
11041
+
11042
+ // left side
11043
+ if (this.options.fullWidth) {
11044
+ zTranslation = this.options.dist;
11045
+ tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
11046
+ } else {
11047
+ zTranslation = this.options.dist * (i * 2 - tween * dir);
11048
+ tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir);
11049
+ }
11050
+ // Don't show wrapped items.
11051
+ if (!this.noWrap || this.center - i >= 0) {
11052
+ el = this.images[this._wrap(this.center - i)];
11053
+ var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
11054
+ this._updateItemStyle(el, tweenedOpacity, -i, _transformString2);
11055
+ }
11056
+ }
11057
+
11058
+ // center
11059
+ // Don't show wrapped items.
11060
+ if (!this.noWrap || this.center >= 0 && this.center < this.count) {
11061
+ el = this.images[this._wrap(this.center)];
11062
+ var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)";
11063
+ this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3);
11064
+ }
11065
+
11066
+ // onCycleTo callback
11067
+ var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center));
11068
+ if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') {
11069
+ this.options.onCycleTo.call(this, $currItem[0], this.dragged);
11070
+ }
11071
+
11072
+ // One time callback
11073
+ if (typeof this.oneTimeCallback === 'function') {
11074
+ this.oneTimeCallback.call(this, $currItem[0], this.dragged);
11075
+ this.oneTimeCallback = null;
11076
+ }
11077
+ }
11078
+
11079
+ /**
11080
+ * Cycle to target
11081
+ * @param {Element} el
11082
+ * @param {Number} opacity
11083
+ * @param {Number} zIndex
11084
+ * @param {String} transform
11085
+ */
11086
+
11087
+ }, {
11088
+ key: "_updateItemStyle",
11089
+ value: function _updateItemStyle(el, opacity, zIndex, transform) {
11090
+ el.style[this.xform] = transform;
11091
+ el.style.zIndex = zIndex;
11092
+ el.style.opacity = opacity;
11093
+ el.style.visibility = 'visible';
11094
+ }
11095
+
11096
+ /**
11097
+ * Cycle to target
11098
+ * @param {Number} n
11099
+ * @param {Function} callback
11100
+ */
11101
+
11102
+ }, {
11103
+ key: "_cycleTo",
11104
+ value: function _cycleTo(n, callback) {
11105
+ var diff = this.center % this.count - n;
11106
+
11107
+ // Account for wraparound.
11108
+ if (!this.noWrap) {
11109
+ if (diff < 0) {
11110
+ if (Math.abs(diff + this.count) < Math.abs(diff)) {
11111
+ diff += this.count;
11112
+ }
11113
+ } else if (diff > 0) {
11114
+ if (Math.abs(diff - this.count) < diff) {
11115
+ diff -= this.count;
11116
+ }
11117
+ }
11118
+ }
11119
+
11120
+ this.target = this.dim * Math.round(this.offset / this.dim);
11121
+ // Next
11122
+ if (diff < 0) {
11123
+ this.target += this.dim * Math.abs(diff);
11124
+
11125
+ // Prev
11126
+ } else if (diff > 0) {
11127
+ this.target -= this.dim * diff;
11128
+ }
11129
+
11130
+ // Set one time callback
11131
+ if (typeof callback === 'function') {
11132
+ this.oneTimeCallback = callback;
11133
+ }
11134
+
11135
+ // Scroll
11136
+ if (this.offset !== this.target) {
11137
+ this.amplitude = this.target - this.offset;
11138
+ this.timestamp = Date.now();
11139
+ requestAnimationFrame(this._autoScrollBound);
11140
+ }
11141
+ }
11142
+
11143
+ /**
11144
+ * Cycle to next item
11145
+ * @param {Number} [n]
11146
+ */
11147
+
11148
+ }, {
11149
+ key: "next",
11150
+ value: function next(n) {
11151
+ if (n === undefined || isNaN(n)) {
11152
+ n = 1;
11153
+ }
11154
+
11155
+ var index = this.center + n;
11156
+ if (index >= this.count || index < 0) {
11157
+ if (this.noWrap) {
11158
+ return;
11159
+ }
11160
+
11161
+ index = this._wrap(index);
11162
+ }
11163
+ this._cycleTo(index);
11164
+ }
11165
+
11166
+ /**
11167
+ * Cycle to previous item
11168
+ * @param {Number} [n]
11169
+ */
11170
+
11171
+ }, {
11172
+ key: "prev",
11173
+ value: function prev(n) {
11174
+ if (n === undefined || isNaN(n)) {
11175
+ n = 1;
11176
+ }
11177
+
11178
+ var index = this.center - n;
11179
+ if (index >= this.count || index < 0) {
11180
+ if (this.noWrap) {
11181
+ return;
11182
+ }
11183
+
11184
+ index = this._wrap(index);
11185
+ }
11186
+
11187
+ this._cycleTo(index);
11188
+ }
11189
+
11190
+ /**
11191
+ * Cycle to nth item
11192
+ * @param {Number} [n]
11193
+ * @param {Function} callback
11194
+ */
11195
+
11196
+ }, {
11197
+ key: "set",
11198
+ value: function set(n, callback) {
11199
+ if (n === undefined || isNaN(n)) {
11200
+ n = 0;
11201
+ }
11202
+
11203
+ if (n > this.count || n < 0) {
11204
+ if (this.noWrap) {
11205
+ return;
11206
+ }
11207
+
11208
+ n = this._wrap(n);
11209
+ }
11210
+
11211
+ this._cycleTo(n, callback);
11212
+ }
11213
+ }], [{
11214
+ key: "init",
11215
+ value: function init(els, options) {
11216
+ return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options);
11217
+ }
11218
+
11219
+ /**
11220
+ * Get Instance
11221
+ */
11222
+
11223
+ }, {
11224
+ key: "getInstance",
11225
+ value: function getInstance(el) {
11226
+ var domElem = !!el.jquery ? el[0] : el;
11227
+ return domElem.M_Carousel;
11228
+ }
11229
+ }, {
11230
+ key: "defaults",
11231
+ get: function () {
11232
+ return _defaults;
11233
+ }
11234
+ }]);
11235
+
11236
+ return Carousel;
11237
+ }(Component);
11238
+
11239
+ M.Carousel = Carousel;
11240
+
11241
+ if (M.jQueryLoaded) {
11242
+ M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel');
11243
+ }
11244
+ })(cash);
11245
+ ;(function ($) {
11246
+ 'use strict';
11247
+
11248
+ var _defaults = {
11249
+ onOpen: undefined,
11250
+ onClose: undefined
11251
+ };
11252
+
11253
+ /**
11254
+ * @class
11255
+ *
11256
+ */
11257
+
11258
+ var TapTarget = function (_Component19) {
11259
+ _inherits(TapTarget, _Component19);
11260
+
11261
+ /**
11262
+ * Construct TapTarget instance
11263
+ * @constructor
11264
+ * @param {Element} el
11265
+ * @param {Object} options
11266
+ */
11267
+ function TapTarget(el, options) {
11268
+ _classCallCheck(this, TapTarget);
11269
+
11270
+ var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
11271
+
11272
+ _this67.el.M_TapTarget = _this67;
11273
+
11274
+ /**
11275
+ * Options for the select
11276
+ * @member TapTarget#options
11277
+ * @prop {Function} onOpen - Callback function called when feature discovery is opened
11278
+ * @prop {Function} onClose - Callback function called when feature discovery is closed
11279
+ */
11280
+ _this67.options = $.extend({}, TapTarget.defaults, options);
11281
+
11282
+ _this67.isOpen = false;
11283
+
11284
+ // setup
11285
+ _this67.$origin = $('#' + _this67.$el.attr('data-target'));
11286
+ _this67._setup();
11287
+
11288
+ _this67._calculatePositioning();
11289
+ _this67._setupEventHandlers();
11290
+ return _this67;
11291
+ }
11292
+
11293
+ _createClass(TapTarget, [{
11294
+ key: "destroy",
11295
+
11296
+
11297
+ /**
11298
+ * Teardown component
11299
+ */
11300
+ value: function destroy() {
11301
+ this._removeEventHandlers();
11302
+ this.el.TapTarget = undefined;
11303
+ }
11304
+
11305
+ /**
11306
+ * Setup Event Handlers
11307
+ */
11308
+
11309
+ }, {
11310
+ key: "_setupEventHandlers",
11311
+ value: function _setupEventHandlers() {
11312
+ this._handleDocumentClickBound = this._handleDocumentClick.bind(this);
11313
+ this._handleTargetClickBound = this._handleTargetClick.bind(this);
11314
+ this._handleOriginClickBound = this._handleOriginClick.bind(this);
11315
+
11316
+ this.el.addEventListener('click', this._handleTargetClickBound);
11317
+ this.originEl.addEventListener('click', this._handleOriginClickBound);
11318
+
11319
+ // Resize
11320
+ var throttledResize = M.throttle(this._handleResize, 200);
11321
+ this._handleThrottledResizeBound = throttledResize.bind(this);
11322
+
11323
+ window.addEventListener('resize', this._handleThrottledResizeBound);
11324
+ }
11325
+
11326
+ /**
11327
+ * Remove Event Handlers
11328
+ */
11329
+
11330
+ }, {
11331
+ key: "_removeEventHandlers",
11332
+ value: function _removeEventHandlers() {
11333
+ this.el.removeEventListener('click', this._handleTargetClickBound);
11334
+ this.originEl.removeEventListener('click', this._handleOriginClickBound);
11335
+ window.removeEventListener('resize', this._handleThrottledResizeBound);
11336
+ }
11337
+
11338
+ /**
11339
+ * Handle Target Click
11340
+ * @param {Event} e
11341
+ */
11342
+
11343
+ }, {
11344
+ key: "_handleTargetClick",
11345
+ value: function _handleTargetClick(e) {
11346
+ this.open();
11347
+ }
11348
+
11349
+ /**
11350
+ * Handle Origin Click
11351
+ * @param {Event} e
11352
+ */
11353
+
11354
+ }, {
11355
+ key: "_handleOriginClick",
11356
+ value: function _handleOriginClick(e) {
11357
+ this.close();
11358
+ }
11359
+
11360
+ /**
11361
+ * Handle Resize
11362
+ * @param {Event} e
11363
+ */
11364
+
11365
+ }, {
11366
+ key: "_handleResize",
11367
+ value: function _handleResize(e) {
11368
+ this._calculatePositioning();
11369
+ }
11370
+
11371
+ /**
11372
+ * Handle Resize
11373
+ * @param {Event} e
11374
+ */
11375
+
11376
+ }, {
11377
+ key: "_handleDocumentClick",
11378
+ value: function _handleDocumentClick(e) {
11379
+ if (!$(e.target).closest('.tap-target-wrapper').length) {
11380
+ this.close();
11381
+ e.preventDefault();
11382
+ e.stopPropagation();
11383
+ }
11384
+ }
11385
+
11386
+ /**
11387
+ * Setup Tap Target
11388
+ */
11389
+
11390
+ }, {
11391
+ key: "_setup",
11392
+ value: function _setup() {
11393
+ // Creating tap target
11394
+ this.wrapper = this.$el.parent()[0];
11395
+ this.waveEl = $(this.wrapper).find('.tap-target-wave')[0];
11396
+ this.originEl = $(this.wrapper).find('.tap-target-origin')[0];
11397
+ this.contentEl = this.$el.find('.tap-target-content')[0];
11398
+
11399
+ // Creating wrapper
11400
+ if (!$(this.wrapper).hasClass('.tap-target-wrapper')) {
11401
+ this.wrapper = document.createElement('div');
11402
+ this.wrapper.classList.add('tap-target-wrapper');
11403
+ this.$el.before($(this.wrapper));
11404
+ this.wrapper.append(this.el);
11405
+ }
11406
+
11407
+ // Creating content
11408
+ if (!this.contentEl) {
11409
+ this.contentEl = document.createElement('div');
11410
+ this.contentEl.classList.add('tap-target-content');
11411
+ this.$el.append(this.contentEl);
11412
+ }
11413
+
11414
+ // Creating foreground wave
11415
+ if (!this.waveEl) {
11416
+ this.waveEl = document.createElement('div');
11417
+ this.waveEl.classList.add('tap-target-wave');
11418
+
11419
+ // Creating origin
11420
+ if (!this.originEl) {
11421
+ this.originEl = this.$origin.clone(true, true);
11422
+ this.originEl.addClass('tap-target-origin');
11423
+ this.originEl.removeAttr('id');
11424
+ this.originEl.removeAttr('style');
11425
+ this.originEl = this.originEl[0];
11426
+ this.waveEl.append(this.originEl);
11427
+ }
11428
+
11429
+ this.wrapper.append(this.waveEl);
11430
+ }
11431
+ }
11432
+
11433
+ /**
11434
+ * Calculate positioning
11435
+ */
11436
+
11437
+ }, {
11438
+ key: "_calculatePositioning",
11439
+ value: function _calculatePositioning() {
11440
+ // Element or parent is fixed position?
11441
+ var isFixed = this.$origin.css('position') === 'fixed';
11442
+ if (!isFixed) {
11443
+ var parents = this.$origin.parents();
11444
+ for (var i = 0; i < parents.length; i++) {
11445
+ isFixed = $(parents[i]).css('position') == 'fixed';
11446
+ if (isFixed) {
11447
+ break;
11448
+ }
11449
+ }
11450
+ }
11451
+
11452
+ // Calculating origin
11453
+ var originWidth = this.$origin.outerWidth();
11454
+ var originHeight = this.$origin.outerHeight();
11455
+ var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top;
11456
+ var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left;
11457
+
11458
+ // Calculating screen
11459
+ var windowWidth = window.innerWidth;
11460
+ var windowHeight = window.innerHeight;
11461
+ var centerX = windowWidth / 2;
11462
+ var centerY = windowHeight / 2;
11463
+ var isLeft = originLeft <= centerX;
11464
+ var isRight = originLeft > centerX;
11465
+ var isTop = originTop <= centerY;
11466
+ var isBottom = originTop > centerY;
11467
+ var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
11468
+
11469
+ // Calculating tap target
11470
+ var tapTargetWidth = this.$el.outerWidth();
11471
+ var tapTargetHeight = this.$el.outerHeight();
11472
+ var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
11473
+ var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
11474
+ var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
11475
+
11476
+ // Calculating content
11477
+ var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
11478
+ var tapTargetTextHeight = tapTargetHeight / 2;
11479
+ var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
11480
+ var tapTargetTextBottom = 0;
11481
+ var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
11482
+ var tapTargetTextRight = 0;
11483
+ var tapTargetTextPadding = originWidth;
11484
+ var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
11485
+
11486
+ // Calculating wave
11487
+ var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
11488
+ var tapTargetWaveHeight = tapTargetWaveWidth;
11489
+ var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
11490
+ var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
11491
+
11492
+ // Setting tap target
11493
+ var tapTargetWrapperCssObj = {};
11494
+ tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : '';
11495
+ tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : '';
11496
+ tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : '';
11497
+ tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : '';
11498
+ tapTargetWrapperCssObj.position = tapTargetPosition;
11499
+ $(this.wrapper).css(tapTargetWrapperCssObj);
11500
+
11501
+ // Setting content
11502
+ $(this.contentEl).css({
11503
+ width: tapTargetTextWidth + 'px',
11504
+ height: tapTargetTextHeight + 'px',
11505
+ top: tapTargetTextTop + 'px',
11506
+ right: tapTargetTextRight + 'px',
11507
+ bottom: tapTargetTextBottom + 'px',
11508
+ left: tapTargetTextLeft + 'px',
11509
+ padding: tapTargetTextPadding + 'px',
11510
+ verticalAlign: tapTargetTextAlign
11511
+ });
11512
+
11513
+ // Setting wave
11514
+ $(this.waveEl).css({
11515
+ top: tapTargetWaveTop + 'px',
11516
+ left: tapTargetWaveLeft + 'px',
11517
+ width: tapTargetWaveWidth + 'px',
11518
+ height: tapTargetWaveHeight + 'px'
11519
+ });
11520
+ }
11521
+
11522
+ /**
11523
+ * Open TapTarget
11524
+ */
11525
+
11526
+ }, {
11527
+ key: "open",
11528
+ value: function open() {
11529
+ if (this.isOpen) {
11530
+ return;
11531
+ }
11532
+
11533
+ // onOpen callback
11534
+ if (typeof this.options.onOpen === 'function') {
11535
+ this.options.onOpen.call(this, this.$origin[0]);
11536
+ }
11537
+
11538
+ this.isOpen = true;
11539
+ this.wrapper.classList.add('open');
11540
+
11541
+ document.body.addEventListener('click', this._handleDocumentClickBound, true);
11542
+ document.body.addEventListener('touchend', this._handleDocumentClickBound);
11543
+ }
11544
+
11545
+ /**
11546
+ * Close Tap Target
11547
+ */
11548
+
11549
+ }, {
11550
+ key: "close",
11551
+ value: function close() {
11552
+ if (!this.isOpen) {
11553
+ return;
11554
+ }
11555
+
11556
+ // onClose callback
11557
+ if (typeof this.options.onClose === 'function') {
11558
+ this.options.onClose.call(this, this.$origin[0]);
11559
+ }
11560
+
11561
+ this.isOpen = false;
11562
+ this.wrapper.classList.remove('open');
11563
+
11564
+ document.body.removeEventListener('click', this._handleDocumentClickBound, true);
11565
+ document.body.removeEventListener('touchend', this._handleDocumentClickBound);
11566
+ }
11567
+ }], [{
11568
+ key: "init",
11569
+ value: function init(els, options) {
11570
+ return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options);
11571
+ }
11572
+
11573
+ /**
11574
+ * Get Instance
11575
+ */
11576
+
11577
+ }, {
11578
+ key: "getInstance",
11579
+ value: function getInstance(el) {
11580
+ var domElem = !!el.jquery ? el[0] : el;
11581
+ return domElem.M_TapTarget;
11582
+ }
11583
+ }, {
11584
+ key: "defaults",
11585
+ get: function () {
11586
+ return _defaults;
11587
+ }
11588
+ }]);
11589
+
11590
+ return TapTarget;
11591
+ }(Component);
11592
+
11593
+ M.TapTarget = TapTarget;
11594
+
11595
+ if (M.jQueryLoaded) {
11596
+ M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget');
11597
+ }
11598
+ })(cash);
11599
+ ;(function ($) {
11600
+ 'use strict';
11601
+
11602
+ var _defaults = {
11603
+ classes: '',
11604
+ dropdownOptions: {}
11605
+ };
11606
+
11607
+ /**
11608
+ * @class
11609
+ *
11610
+ */
11611
+
11612
+ var FormSelect = function (_Component20) {
11613
+ _inherits(FormSelect, _Component20);
11614
+
11615
+ /**
11616
+ * Construct FormSelect instance
11617
+ * @constructor
11618
+ * @param {Element} el
11619
+ * @param {Object} options
11620
+ */
11621
+ function FormSelect(el, options) {
11622
+ _classCallCheck(this, FormSelect);
11623
+
11624
+ // Don't init if browser default version
11625
+ var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options));
11626
+
11627
+ if (_this68.$el.hasClass('browser-default')) {
11628
+ return _possibleConstructorReturn(_this68);
11629
+ }
11630
+
11631
+ _this68.el.M_FormSelect = _this68;
11632
+
11633
+ /**
11634
+ * Options for the select
11635
+ * @member FormSelect#options
11636
+ */
11637
+ _this68.options = $.extend({}, FormSelect.defaults, options);
11638
+
11639
+ _this68.isMultiple = _this68.$el.prop('multiple');
11640
+
11641
+ // Setup
11642
+ _this68.el.tabIndex = -1;
11643
+ _this68._keysSelected = {};
11644
+ _this68._valueDict = {}; // Maps key to original and generated option element.
11645
+ _this68._setupDropdown();
11646
+
11647
+ _this68._setupEventHandlers();
11648
+ return _this68;
11649
+ }
11650
+
11651
+ _createClass(FormSelect, [{
11652
+ key: "destroy",
11653
+
11654
+
11655
+ /**
11656
+ * Teardown component
11657
+ */
11658
+ value: function destroy() {
11659
+ this._removeEventHandlers();
11660
+ this._removeDropdown();
11661
+ this.el.M_FormSelect = undefined;
11662
+ }
11663
+
11664
+ /**
11665
+ * Setup Event Handlers
11666
+ */
11667
+
11668
+ }, {
11669
+ key: "_setupEventHandlers",
11670
+ value: function _setupEventHandlers() {
11671
+ var _this69 = this;
11672
+
11673
+ this._handleSelectChangeBound = this._handleSelectChange.bind(this);
11674
+ this._handleOptionClickBound = this._handleOptionClick.bind(this);
11675
+ this._handleInputClickBound = this._handleInputClick.bind(this);
11676
+
11677
+ $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11678
+ el.addEventListener('click', _this69._handleOptionClickBound);
11679
+ });
11680
+ this.el.addEventListener('change', this._handleSelectChangeBound);
11681
+ this.input.addEventListener('click', this._handleInputClickBound);
11682
+ }
11683
+
11684
+ /**
11685
+ * Remove Event Handlers
11686
+ */
11687
+
11688
+ }, {
11689
+ key: "_removeEventHandlers",
11690
+ value: function _removeEventHandlers() {
11691
+ var _this70 = this;
11692
+
11693
+ $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11694
+ el.removeEventListener('click', _this70._handleOptionClickBound);
11695
+ });
11696
+ this.el.removeEventListener('change', this._handleSelectChangeBound);
11697
+ this.input.removeEventListener('click', this._handleInputClickBound);
11698
+ }
11699
+
11700
+ /**
11701
+ * Handle Select Change
11702
+ * @param {Event} e
11703
+ */
11704
+
11705
+ }, {
11706
+ key: "_handleSelectChange",
11707
+ value: function _handleSelectChange(e) {
11708
+ this._setValueToInput();
11709
+ }
11710
+
11711
+ /**
11712
+ * Handle Option Click
11713
+ * @param {Event} e
11714
+ */
11715
+
11716
+ }, {
11717
+ key: "_handleOptionClick",
11718
+ value: function _handleOptionClick(e) {
11719
+ e.preventDefault();
11720
+ var option = $(e.target).closest('li')[0];
11721
+ var key = option.id;
11722
+ if (!$(option).hasClass('disabled') && !$(option).hasClass('optgroup') && key.length) {
11723
+ var selected = true;
11724
+
11725
+ if (this.isMultiple) {
11726
+ // Deselect placeholder option if still selected.
11727
+ var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected');
11728
+ if (placeholderOption.length) {
11729
+ placeholderOption.removeClass('selected');
11730
+ placeholderOption.find('input[type="checkbox"]').prop('checked', false);
11731
+ this._toggleEntryFromArray(placeholderOption[0].id);
11732
+ }
11733
+ selected = this._toggleEntryFromArray(key);
11734
+ } else {
11735
+ $(this.dropdownOptions).find('li').removeClass('selected');
11736
+ $(option).toggleClass('selected', selected);
11737
+ }
11738
+
11739
+ // Set selected on original select option
11740
+ // Only trigger if selected state changed
11741
+ var prevSelected = $(this._valueDict[key].el).prop('selected');
11742
+ if (prevSelected !== selected) {
11743
+ $(this._valueDict[key].el).prop('selected', selected);
11744
+ this.$el.trigger('change');
11745
+ }
11746
+ }
11747
+
11748
+ e.stopPropagation();
11749
+ }
11750
+
11751
+ /**
11752
+ * Handle Input Click
11753
+ */
11754
+
11755
+ }, {
11756
+ key: "_handleInputClick",
11757
+ value: function _handleInputClick() {
11758
+ if (this.dropdown && this.dropdown.isOpen) {
11759
+ this._setValueToInput();
11760
+ this._setSelectedStates();
11761
+ }
11762
+ }
11763
+
11764
+ /**
11765
+ * Setup dropdown
11766
+ */
11767
+
11768
+ }, {
11769
+ key: "_setupDropdown",
11770
+ value: function _setupDropdown() {
11771
+ var _this71 = this;
11772
+
11773
+ this.wrapper = document.createElement('div');
11774
+ $(this.wrapper).addClass('select-wrapper ' + this.options.classes);
11775
+ this.$el.before($(this.wrapper));
11776
+ this.wrapper.appendChild(this.el);
11777
+
11778
+ if (this.el.disabled) {
11779
+ this.wrapper.classList.add('disabled');
11780
+ }
11781
+
11782
+ // Create dropdown
11783
+ this.$selectOptions = this.$el.children('option, optgroup');
11784
+ this.dropdownOptions = document.createElement('ul');
11785
+ this.dropdownOptions.id = "select-options-" + M.guid();
11786
+ $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : ''));
11787
+
11788
+ // Create dropdown structure.
11789
+ if (this.$selectOptions.length) {
11790
+ this.$selectOptions.each(function (el) {
11791
+ if ($(el).is('option')) {
11792
+ // Direct descendant option.
11793
+ var optionEl = void 0;
11794
+ if (_this71.isMultiple) {
11795
+ optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple');
11796
+ } else {
11797
+ optionEl = _this71._appendOptionWithIcon(_this71.$el, el);
11798
+ }
11799
+
11800
+ _this71._addOptionToValueDict(el, optionEl);
11801
+ } else if ($(el).is('optgroup')) {
11802
+ // Optgroup.
11803
+ var selectOptions = $(el).children('option');
11804
+ $(_this71.dropdownOptions).append($('<li class="optgroup"><span>' + el.getAttribute('label') + '</span></li>')[0]);
11805
+
11806
+ selectOptions.each(function (el) {
11807
+ var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option');
11808
+ _this71._addOptionToValueDict(el, optionEl);
11809
+ });
11810
+ }
11811
+ });
11812
+ }
11813
+
11814
+ this.$el.after(this.dropdownOptions);
11815
+
11816
+ // Add input dropdown
11817
+ this.input = document.createElement('input');
11818
+ $(this.input).addClass('select-dropdown dropdown-trigger');
11819
+ this.input.setAttribute('type', 'text');
11820
+ this.input.setAttribute('readonly', 'true');
11821
+ this.input.setAttribute('data-target', this.dropdownOptions.id);
11822
+ if (this.el.disabled) {
11823
+ $(this.input).prop('disabled', 'true');
11824
+ }
11825
+
11826
+ this.$el.before(this.input);
11827
+ this._setValueToInput();
11828
+
11829
+ // Add caret
11830
+ var dropdownIcon = $('<svg class="caret" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
11831
+ this.$el.before(dropdownIcon[0]);
11832
+
11833
+ // Initialize dropdown
11834
+ if (!this.el.disabled) {
11835
+ var dropdownOptions = $.extend({}, this.options.dropdownOptions);
11836
+
11837
+ // Add callback for centering selected option when dropdown content is scrollable
11838
+ dropdownOptions.onOpenEnd = function (el) {
11839
+ var selectedOption = $(_this71.dropdownOptions).find('.selected').first();
11840
+
11841
+ if (selectedOption.length) {
11842
+ // Focus selected option in dropdown
11843
+ M.keyDown = true;
11844
+ _this71.dropdown.focusedIndex = selectedOption.index();
11845
+ _this71.dropdown._focusFocusedItem();
11846
+ M.keyDown = false;
11847
+
11848
+ // Handle scrolling to selected option
11849
+ if (_this71.dropdown.isScrollable) {
11850
+ var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option
11851
+ scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown
11852
+ _this71.dropdownOptions.scrollTop = scrollOffset;
11853
+ }
11854
+ }
11855
+ };
11856
+
11857
+ if (this.isMultiple) {
11858
+ dropdownOptions.closeOnClick = false;
11859
+ }
11860
+ this.dropdown = M.Dropdown.init(this.input, dropdownOptions);
11861
+ }
11862
+
11863
+ // Add initial selections
11864
+ this._setSelectedStates();
11865
+ }
11866
+
11867
+ /**
11868
+ * Add option to value dict
11869
+ * @param {Element} el original option element
11870
+ * @param {Element} optionEl generated option element
11871
+ */
11872
+
11873
+ }, {
11874
+ key: "_addOptionToValueDict",
11875
+ value: function _addOptionToValueDict(el, optionEl) {
11876
+ var index = Object.keys(this._valueDict).length;
11877
+ var key = this.dropdownOptions.id + index;
11878
+ var obj = {};
11879
+ optionEl.id = key;
11880
+
11881
+ obj.el = el;
11882
+ obj.optionEl = optionEl;
11883
+ this._valueDict[key] = obj;
11884
+ }
11885
+
11886
+ /**
11887
+ * Remove dropdown
11888
+ */
11889
+
11890
+ }, {
11891
+ key: "_removeDropdown",
11892
+ value: function _removeDropdown() {
11893
+ $(this.wrapper).find('.caret').remove();
11894
+ $(this.input).remove();
11895
+ $(this.dropdownOptions).remove();
11896
+ $(this.wrapper).before(this.$el);
11897
+ $(this.wrapper).remove();
11898
+ }
11899
+
11900
+ /**
11901
+ * Setup dropdown
11902
+ * @param {Element} select select element
11903
+ * @param {Element} option option element from select
11904
+ * @param {String} type
11905
+ * @return {Element} option element added
11906
+ */
11907
+
11908
+ }, {
11909
+ key: "_appendOptionWithIcon",
11910
+ value: function _appendOptionWithIcon(select, option, type) {
11911
+ // Add disabled attr if disabled
11912
+ var disabledClass = option.disabled ? 'disabled ' : '';
11913
+ var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
11914
+ var multipleCheckbox = this.isMultiple ? "<label><input type=\"checkbox\"" + disabledClass + "\"/><span>" + option.innerHTML + "</span></label>" : option.innerHTML;
11915
+ var liEl = $('<li></li>');
11916
+ var spanEl = $('<span></span>');
11917
+ spanEl.html(multipleCheckbox);
11918
+ liEl.addClass(disabledClass + " " + optgroupClass);
11919
+ liEl.append(spanEl);
11920
+
11921
+ // add icons
11922
+ var iconUrl = option.getAttribute('data-icon');
11923
+ if (!!iconUrl) {
11924
+ var imgEl = $("<img alt=\"\" src=\"" + iconUrl + "\">");
11925
+ liEl.prepend(imgEl);
11926
+ }
11927
+
11928
+ // Check for multiple type.
11929
+ $(this.dropdownOptions).append(liEl[0]);
11930
+ return liEl[0];
11931
+ }
11932
+
11933
+ /**
11934
+ * Toggle entry from option
11935
+ * @param {String} key Option key
11936
+ * @return {Boolean} if entry was added or removed
11937
+ */
11938
+
11939
+ }, {
11940
+ key: "_toggleEntryFromArray",
11941
+ value: function _toggleEntryFromArray(key) {
11942
+ var notAdded = !this._keysSelected.hasOwnProperty(key);
11943
+ var $optionLi = $(this._valueDict[key].optionEl);
11944
+
11945
+ if (notAdded) {
11946
+ this._keysSelected[key] = true;
11947
+ } else {
11948
+ delete this._keysSelected[key];
11949
+ }
11950
+
11951
+ $optionLi.toggleClass('selected', notAdded);
11952
+
11953
+ // Set checkbox checked value
11954
+ $optionLi.find('input[type="checkbox"]').prop('checked', notAdded);
11955
+
11956
+ // use notAdded instead of true (to detect if the option is selected or not)
11957
+ $optionLi.prop('selected', notAdded);
11958
+
11959
+ return notAdded;
11960
+ }
11961
+
11962
+ /**
11963
+ * Set text value to input
11964
+ */
11965
+
11966
+ }, {
11967
+ key: "_setValueToInput",
11968
+ value: function _setValueToInput() {
11969
+ var values = [];
11970
+ var options = this.$el.find('option');
11971
+
11972
+ options.each(function (el) {
11973
+ if ($(el).prop('selected')) {
11974
+ var text = $(el).text();
11975
+ values.push(text);
11976
+ }
11977
+ });
11978
+
11979
+ if (!values.length) {
11980
+ var firstDisabled = this.$el.find('option:disabled').eq(0);
11981
+ if (firstDisabled.length && firstDisabled[0].value === '') {
11982
+ values.push(firstDisabled.text());
11983
+ }
11984
+ }
11985
+
11986
+ this.input.value = values.join(', ');
11987
+ }
11988
+
11989
+ /**
11990
+ * Set selected state of dropdown to match actual select element
11991
+ */
11992
+
11993
+ }, {
11994
+ key: "_setSelectedStates",
11995
+ value: function _setSelectedStates() {
11996
+ this._keysSelected = {};
11997
+
11998
+ for (var key in this._valueDict) {
11999
+ var option = this._valueDict[key];
12000
+ var optionIsSelected = $(option.el).prop('selected');
12001
+ $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected);
12002
+ if (optionIsSelected) {
12003
+ this._activateOption($(this.dropdownOptions), $(option.optionEl));
12004
+ this._keysSelected[key] = true;
12005
+ } else {
12006
+ $(option.optionEl).removeClass('selected');
12007
+ }
12008
+ }
12009
+ }
12010
+
12011
+ /**
12012
+ * Make option as selected and scroll to selected position
12013
+ * @param {jQuery} collection Select options jQuery element
12014
+ * @param {Element} newOption element of the new option
12015
+ */
12016
+
12017
+ }, {
12018
+ key: "_activateOption",
12019
+ value: function _activateOption(collection, newOption) {
12020
+ if (newOption) {
12021
+ if (!this.isMultiple) {
12022
+ collection.find('li.selected').removeClass('selected');
12023
+ }
12024
+ var option = $(newOption);
12025
+ option.addClass('selected');
12026
+ }
12027
+ }
12028
+
12029
+ /**
12030
+ * Get Selected Values
12031
+ * @return {Array} Array of selected values
12032
+ */
12033
+
12034
+ }, {
12035
+ key: "getSelectedValues",
12036
+ value: function getSelectedValues() {
12037
+ var selectedValues = [];
12038
+ for (var key in this._keysSelected) {
12039
+ selectedValues.push(this._valueDict[key].el.value);
12040
+ }
12041
+ return selectedValues;
12042
+ }
12043
+ }], [{
12044
+ key: "init",
12045
+ value: function init(els, options) {
12046
+ return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options);
12047
+ }
12048
+
12049
+ /**
12050
+ * Get Instance
12051
+ */
12052
+
12053
+ }, {
12054
+ key: "getInstance",
12055
+ value: function getInstance(el) {
12056
+ var domElem = !!el.jquery ? el[0] : el;
12057
+ return domElem.M_FormSelect;
12058
+ }
12059
+ }, {
12060
+ key: "defaults",
12061
+ get: function () {
12062
+ return _defaults;
12063
+ }
12064
+ }]);
12065
+
12066
+ return FormSelect;
12067
+ }(Component);
12068
+
12069
+ M.FormSelect = FormSelect;
12070
+
12071
+ if (M.jQueryLoaded) {
12072
+ M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect');
12073
+ }
12074
+ })(cash);
12075
+ ;(function ($, anim) {
12076
+ 'use strict';
12077
+
12078
+ var _defaults = {};
12079
+
12080
+ /**
12081
+ * @class
12082
+ *
12083
+ */
12084
+
12085
+ var Range = function (_Component21) {
12086
+ _inherits(Range, _Component21);
12087
+
12088
+ /**
12089
+ * Construct Range instance
12090
+ * @constructor
12091
+ * @param {Element} el
12092
+ * @param {Object} options
12093
+ */
12094
+ function Range(el, options) {
12095
+ _classCallCheck(this, Range);
12096
+
12097
+ var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
12098
+
12099
+ _this72.el.M_Range = _this72;
12100
+
12101
+ /**
12102
+ * Options for the range
12103
+ * @member Range#options
12104
+ */
12105
+ _this72.options = $.extend({}, Range.defaults, options);
12106
+
12107
+ _this72._mousedown = false;
12108
+
12109
+ // Setup
12110
+ _this72._setupThumb();
12111
+
12112
+ _this72._setupEventHandlers();
12113
+ return _this72;
12114
+ }
12115
+
12116
+ _createClass(Range, [{
12117
+ key: "destroy",
12118
+
12119
+
12120
+ /**
12121
+ * Teardown component
12122
+ */
12123
+ value: function destroy() {
12124
+ this._removeEventHandlers();
12125
+ this._removeThumb();
12126
+ this.el.M_Range = undefined;
12127
+ }
12128
+
12129
+ /**
12130
+ * Setup Event Handlers
12131
+ */
12132
+
12133
+ }, {
12134
+ key: "_setupEventHandlers",
12135
+ value: function _setupEventHandlers() {
12136
+ this._handleRangeChangeBound = this._handleRangeChange.bind(this);
12137
+ this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
12138
+ this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
12139
+ this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
12140
+ this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
12141
+
12142
+ this.el.addEventListener('change', this._handleRangeChangeBound);
12143
+
12144
+ this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12145
+ this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
12146
+
12147
+ this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
12148
+ this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
12149
+ this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
12150
+
12151
+ this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound);
12152
+ this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound);
12153
+
12154
+ this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
12155
+ this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
12156
+ this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
12157
+ }
12158
+
12159
+ /**
12160
+ * Remove Event Handlers
12161
+ */
12162
+
12163
+ }, {
12164
+ key: "_removeEventHandlers",
12165
+ value: function _removeEventHandlers() {
12166
+ this.el.removeEventListener('change', this._handleRangeChangeBound);
12167
+
12168
+ this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12169
+ this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
12170
+
12171
+ this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
12172
+ this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
12173
+ this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
12174
+
12175
+ this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound);
12176
+ this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound);
12177
+
12178
+ this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
12179
+ this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
12180
+ this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
12181
+ }
12182
+
12183
+ /**
12184
+ * Handle Range Change
12185
+ * @param {Event} e
12186
+ */
12187
+
12188
+ }, {
12189
+ key: "_handleRangeChange",
12190
+ value: function _handleRangeChange() {
12191
+ $(this.value).html(this.$el.val());
12192
+
12193
+ if (!$(this.thumb).hasClass('active')) {
12194
+ this._showRangeBubble();
12195
+ }
12196
+
12197
+ var offsetLeft = this._calcRangeOffset();
12198
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
12199
+ }
12200
+
12201
+ /**
12202
+ * Handle Range Mousedown and Touchstart
12203
+ * @param {Event} e
12204
+ */
12205
+
12206
+ }, {
12207
+ key: "_handleRangeMousedownTouchstart",
12208
+ value: function _handleRangeMousedownTouchstart(e) {
12209
+ // Set indicator value
12210
+ $(this.value).html(this.$el.val());
12211
+
12212
+ this._mousedown = true;
12213
+ this.$el.addClass('active');
12214
+
12215
+ if (!$(this.thumb).hasClass('active')) {
12216
+ this._showRangeBubble();
12217
+ }
12218
+
12219
+ if (e.type !== 'input') {
12220
+ var offsetLeft = this._calcRangeOffset();
12221
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
12222
+ }
12223
+ }
12224
+
12225
+ /**
12226
+ * Handle Range Input, Mousemove and Touchmove
12227
+ */
12228
+
12229
+ }, {
12230
+ key: "_handleRangeInputMousemoveTouchmove",
12231
+ value: function _handleRangeInputMousemoveTouchmove() {
12232
+ if (this._mousedown) {
12233
+ if (!$(this.thumb).hasClass('active')) {
12234
+ this._showRangeBubble();
12235
+ }
12236
+
12237
+ var offsetLeft = this._calcRangeOffset();
12238
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
12239
+ $(this.value).html(this.$el.val());
12240
+ }
12241
+ }
12242
+
12243
+ /**
12244
+ * Handle Range Mouseup and Touchend
12245
+ */
12246
+
12247
+ }, {
12248
+ key: "_handleRangeMouseupTouchend",
12249
+ value: function _handleRangeMouseupTouchend() {
12250
+ this._mousedown = false;
12251
+ this.$el.removeClass('active');
12252
+ }
12253
+
12254
+ /**
12255
+ * Handle Range Blur, Mouseout and Touchleave
12256
+ */
12257
+
12258
+ }, {
12259
+ key: "_handleRangeBlurMouseoutTouchleave",
12260
+ value: function _handleRangeBlurMouseoutTouchleave() {
12261
+ if (!this._mousedown) {
12262
+ var paddingLeft = parseInt(this.$el.css('padding-left'));
12263
+ var marginLeft = 7 + paddingLeft + 'px';
12264
+
12265
+ if ($(this.thumb).hasClass('active')) {
12266
+ anim.remove(this.thumb);
12267
+ anim({
12268
+ targets: this.thumb,
12269
+ height: 0,
12270
+ width: 0,
12271
+ top: 10,
12272
+ easing: 'easeOutQuad',
12273
+ marginLeft: marginLeft,
12274
+ duration: 100
12275
+ });
12276
+ }
12277
+ $(this.thumb).removeClass('active');
12278
+ }
12279
+ }
12280
+
12281
+ /**
12282
+ * Setup dropdown
12283
+ */
12284
+
12285
+ }, {
12286
+ key: "_setupThumb",
12287
+ value: function _setupThumb() {
12288
+ this.thumb = document.createElement('span');
12289
+ this.value = document.createElement('span');
12290
+ $(this.thumb).addClass('thumb');
12291
+ $(this.value).addClass('value');
12292
+ $(this.thumb).append(this.value);
12293
+ this.$el.after(this.thumb);
12294
+ }
12295
+
12296
+ /**
12297
+ * Remove dropdown
12298
+ */
12299
+
12300
+ }, {
12301
+ key: "_removeThumb",
12302
+ value: function _removeThumb() {
12303
+ $(this.thumb).remove();
12304
+ }
12305
+
12306
+ /**
12307
+ * morph thumb into bubble
12308
+ */
12309
+
12310
+ }, {
12311
+ key: "_showRangeBubble",
12312
+ value: function _showRangeBubble() {
12313
+ var paddingLeft = parseInt($(this.thumb).parent().css('padding-left'));
12314
+ var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number?
12315
+ anim.remove(this.thumb);
12316
+ anim({
12317
+ targets: this.thumb,
12318
+ height: 30,
12319
+ width: 30,
12320
+ top: -30,
12321
+ marginLeft: marginLeft,
12322
+ duration: 300,
12323
+ easing: 'easeOutQuint'
12324
+ });
12325
+ }
12326
+
12327
+ /**
12328
+ * Calculate the offset of the thumb
12329
+ * @return {Number} offset in pixels
12330
+ */
12331
+
12332
+ }, {
12333
+ key: "_calcRangeOffset",
12334
+ value: function _calcRangeOffset() {
12335
+ var width = this.$el.width() - 15;
12336
+ var max = parseFloat(this.$el.attr('max')) || 100; // Range default max
12337
+ var min = parseFloat(this.$el.attr('min')) || 0; // Range default min
12338
+ var percent = (parseFloat(this.$el.val()) - min) / (max - min);
12339
+ return percent * width;
12340
+ }
12341
+ }], [{
12342
+ key: "init",
12343
+ value: function init(els, options) {
12344
+ return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options);
12345
+ }
12346
+
12347
+ /**
12348
+ * Get Instance
12349
+ */
12350
+
12351
+ }, {
12352
+ key: "getInstance",
12353
+ value: function getInstance(el) {
12354
+ var domElem = !!el.jquery ? el[0] : el;
12355
+ return domElem.M_Range;
12356
+ }
12357
+ }, {
12358
+ key: "defaults",
12359
+ get: function () {
12360
+ return _defaults;
12361
+ }
12362
+ }]);
12363
+
12364
+ return Range;
12365
+ }(Component);
12366
+
12367
+ M.Range = Range;
12368
+
12369
+ if (M.jQueryLoaded) {
12370
+ M.initializeJqueryWrapper(Range, 'range', 'M_Range');
12371
+ }
12372
+
12373
+ Range.init($('input[type=range]'));
12374
+ })(cash, M.anime);
admin/js/xcloner-admin.js CHANGED
@@ -1,123 +1,126 @@
1
- (function ($) {
2
- 'use strict';
3
-
4
- jQuery(document).ready(function () {
5
 
6
- jQuery('.tooltipped').tooltip();
7
- jQuery('.collapsible').collapsible();
 
 
8
 
9
- jQuery("span.shorten_string").click(function () {
10
- jQuery(this).toggleClass("full");
11
- doShortText(jQuery(this));
12
- })
13
 
14
- jQuery("span.shorten_string").each(function () {
15
- doShortText(jQuery(this));
16
- })
17
 
18
- jQuery("#xcloner_regex_exclude").on("focus", function () {
19
- jQuery("ul.xcloner_regex_exclude_limit li").fadeIn();
20
- })
 
21
 
22
- jQuery(".regex_pattern").on("click", function () {
23
- jQuery(this).select();
24
- })
25
 
26
- jQuery(".btn.system_info_toggle").on("click", function () {
27
- jQuery(".additional_system_info").toggle();
28
- })
29
 
30
- jQuery("a.download-logger").on("click", function (e) {
31
- var xcloner_manage_backups = new Xcloner_Manage_Backups();
 
32
 
33
- var hash = jQuery(this).attr('href');
34
- var id = hash.substr(1)
 
35
 
36
- if (id) {
37
- xcloner_manage_backups.download_backup_by_name(id);
38
- }
39
 
40
- e.preventDefault();
41
- })
42
 
43
- jQuery(".nav-tab-wrapper.content li").on("click", function (e) {
44
- jQuery(".nav-tab-wrapper li a").removeClass("nav-tab-active");
45
- jQuery(this).find('a').addClass("nav-tab-active");
46
- jQuery(".nav-tab-wrapper-content .tab-content").removeClass('active');
47
- jQuery(".nav-tab-wrapper-content " + jQuery(this).find('a').attr('href')).addClass('active');
48
 
49
- e.preventDefault();
 
50
 
51
- location.hash = jQuery(this).find('a').attr('href') + "_hash";
 
 
 
 
 
 
52
 
53
- })
54
 
55
- var hash = window.location.hash;
56
- if (hash) {
57
- next_tab(hash.replace("_hash", ""));
58
- }
59
- })
60
 
 
 
 
 
 
61
  })(jQuery);
62
 
63
-
64
  //jQuery( document ).ajaxError(function(err, request) {
65
  //show_ajax_error("dd", "dd12", request)
66
  //});
67
 
68
  function next_tab(hash) {
69
- jQuery(".nav-tab-wrapper").find("li a[href='" + hash + "']").trigger('click');
70
- location.hash = hash;
 
 
71
  }
72
 
73
  function doShortText(elem) {
74
- if (elem.hasClass("full")) {
75
- elem.text(elem.attr("data-text"));
76
- return;
77
- }
78
- var text = elem.text()
79
- var text_lenght = text.length;
80
- var first = text.substr(0, 10);
81
- var last = text.substr(text_lenght - 20, text_lenght);
82
-
83
- elem.attr("data-text", text).text(first + "..." + last);
84
  }
85
 
86
  /** global: xcloner_backup */
87
  function show_ajax_error(title, msg, json) {
 
88
 
89
- //var json = jQuery.parseJSON( body )
90
-
91
- if (typeof xcloner_backup !== 'undefined') {
92
- xcloner_backup.cancel_backup();
93
- }
94
 
95
- if (json.responseText) {
96
- msg = msg + ": " + json.responseText;
97
- }
98
 
99
- jQuery("#error_modal .title").text(title);
100
- jQuery("#error_modal .msg").text(msg);
101
 
102
- if (json.status) {
103
- jQuery("#error_modal .status").text(json.status + " " + json.statusText);
104
- }
105
 
106
- jQuery("#error_modal .body").text(JSON.stringify(json));
107
- var error_modal = jQuery("#error_modal").modal();
108
- error_modal.modal('open');
109
  }
110
 
111
  var ID = function () {
112
- // Math.random should be unique because of its seeding algorithm.
113
- // Convert it to base 36 (numbers + letters), and grab the first 9 characters
114
- // after the decimal.
115
- return '_' + Math.random().toString(36).substr(2, 9);
116
  };
117
 
118
-
119
  var getUrlParam = function (name) {
120
- return (location.search.split(name + '=')[1] || '').split('&')[0];
121
- }
122
-
123
-
1
+ var error_modal;
 
 
 
2
 
3
+ document.addEventListener("DOMContentLoaded", function () {
4
+ var Modalelem = document.querySelector("#error_modal");
5
+ error_modal = M.Modal.init(Modalelem);
6
+ });
7
 
8
+ (function ($) {
9
+ "use strict";
 
 
10
 
11
+ jQuery(document).ready(function () {
12
+ jQuery(".tooltipped").tooltip();
13
+ jQuery(".collapsible").collapsible();
14
 
15
+ jQuery("span.shorten_string").click(function () {
16
+ jQuery(this).toggleClass("full");
17
+ doShortText(jQuery(this));
18
+ });
19
 
20
+ jQuery("span.shorten_string").each(function () {
21
+ doShortText(jQuery(this));
22
+ });
23
 
24
+ jQuery("#xcloner_regex_exclude").on("focus", function () {
25
+ jQuery("ul.xcloner_regex_exclude_limit li").fadeIn();
26
+ });
27
 
28
+ jQuery(".regex_pattern").on("click", function () {
29
+ jQuery(this).select();
30
+ });
31
 
32
+ jQuery(".btn.system_info_toggle").on("click", function () {
33
+ jQuery(".additional_system_info").toggle();
34
+ });
35
 
36
+ jQuery("a.download-logger").on("click", function (e) {
37
+ var xcloner_manage_backups = new Xcloner_Manage_Backups();
 
38
 
39
+ var hash = jQuery(this).attr("href");
40
+ var id = hash.substr(1);
41
 
42
+ if (id) {
43
+ xcloner_manage_backups.download_backup_by_name(id);
44
+ }
 
 
45
 
46
+ e.preventDefault();
47
+ });
48
 
49
+ jQuery(".nav-tab-wrapper.content li").on("click", function (e) {
50
+ jQuery(".nav-tab-wrapper li a").removeClass("nav-tab-active");
51
+ jQuery(this).find("a").addClass("nav-tab-active");
52
+ jQuery(".nav-tab-wrapper-content .tab-content").removeClass("active");
53
+ jQuery(
54
+ ".nav-tab-wrapper-content " + jQuery(this).find("a").attr("href")
55
+ ).addClass("active");
56
 
57
+ e.preventDefault();
58
 
59
+ location.hash = jQuery(this).find("a").attr("href") + "_hash";
60
+ });
 
 
 
61
 
62
+ var hash = window.location.hash;
63
+ if (hash) {
64
+ next_tab(hash.replace("_hash", ""));
65
+ }
66
+ });
67
  })(jQuery);
68
 
 
69
  //jQuery( document ).ajaxError(function(err, request) {
70
  //show_ajax_error("dd", "dd12", request)
71
  //});
72
 
73
  function next_tab(hash) {
74
+ jQuery(".nav-tab-wrapper")
75
+ .find("li a[href='" + hash + "']")
76
+ .trigger("click");
77
+ location.hash = hash;
78
  }
79
 
80
  function doShortText(elem) {
81
+ if (elem.hasClass("full")) {
82
+ elem.text(elem.attr("data-text"));
83
+ return;
84
+ }
85
+ var text = elem.text();
86
+ var text_lenght = text.length;
87
+ var first = text.substr(0, 10);
88
+ var last = text.substr(text_lenght - 20, text_lenght);
89
+
90
+ elem.attr("data-text", text).text(first + "..." + last);
91
  }
92
 
93
  /** global: xcloner_backup */
94
  function show_ajax_error(title, msg, json) {
95
+ //var json = jQuery.parseJSON( body )
96
 
97
+ if (typeof xcloner_backup !== "undefined") {
98
+ xcloner_backup.cancel_backup();
99
+ }
 
 
100
 
101
+ if (json.responseText) {
102
+ msg = msg + ": " + json.responseText;
103
+ }
104
 
105
+ jQuery("#error_modal .title").text(title);
106
+ jQuery("#error_modal .msg").text(msg);
107
 
108
+ if (json.status) {
109
+ jQuery("#error_modal .status").text(json.status + " " + json.statusText);
110
+ }
111
 
112
+ jQuery("#error_modal .body").text(JSON.stringify(json));
113
+ //var error_modal = jQuery("#error_modal").modal();
114
+ error_modal.open();
115
  }
116
 
117
  var ID = function () {
118
+ // Math.random should be unique because of its seeding algorithm.
119
+ // Convert it to base 36 (numbers + letters), and grab the first 9 characters
120
+ // after the decimal.
121
+ return "_" + Math.random().toString(36).substr(2, 9);
122
  };
123
 
 
124
  var getUrlParam = function (name) {
125
+ return (location.search.split(name + "=")[1] || "").split("&")[0];
126
+ };
 
 
admin/js/xcloner-manage-backups-class.js CHANGED
@@ -1,629 +1,638 @@
1
  /** global: ajaxurl */
2
  /** global: Materialize */
3
- var dataTable = "";
4
-
5
- class Xcloner_Manage_Backups {
6
- constructor() {
7
- this.file_counter = 0;
8
- this.storage_selection = "";
9
- this.dataTable = "";
10
- //this.edit_modal = jQuery('.modal').modal();
11
-
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- download_backup_by_name(id) {
15
- window.open(ajaxurl + "?action=download_backup_by_name&name=" + id);
16
- return false;
17
- }
18
 
19
- delete_backup_by_name(id, elem, dataTable) {
20
- var $this = this;
21
-
22
- if (id) {
23
- jQuery.ajax({
24
- url: ajaxurl,
25
- method: "post",
26
- data: {
27
- action: "delete_backup_by_name",
28
- name: id,
29
- storage_selection: this.storage_selection,
30
- },
31
- success: function (response) {
32
- if (response.finished) {
33
- dataTable.row(jQuery(elem).parents("tr")).remove().draw();
34
- } else {
35
- alert("There was an error deleting the file");
36
- }
37
- },
38
- dataType: "json",
39
- });
40
- }
41
  }
 
42
 
43
- list_backup_content_callback(backup_file, start = 0, part = 0) {
44
- var $this = this;
45
-
46
- if (backup_file) {
47
- jQuery.ajax({
48
- url: ajaxurl,
49
- method: "post",
50
- data: {
51
- action: "list_backup_files",
52
- file: backup_file,
53
- start: start,
54
- part: part,
55
- },
56
- success: function (response) {
57
- if (response.error) {
58
- jQuery("#backup_cotent_modal .files-list")
59
- .addClass("error")
60
- .prepend(response.message);
61
- jQuery("#backup_cotent_modal .progress > div")
62
- .addClass("determinate")
63
- .removeClass(".indeterminate")
64
- .css("width", "100%");
65
- return;
66
- }
67
-
68
- var files_text = [];
69
-
70
- for (var i in response.files) {
71
- if (response.total_size !== undefined) {
72
- var percent =
73
- parseInt(response.start * 100) /
74
- parseInt(response.total_size);
75
- //jQuery("#backup_cotent_modal .progress .determinate").css('width', percent + "%")
76
- }
77
-
78
- $this.file_counter++;
79
-
80
- files_text[i] =
81
- "<li>" +
82
- ($this.file_counter +
83
- ". <span title='" +
84
- response.files[i].mtime +
85
- "'>" +
86
- response.files[i].path +
87
- "</span> (" +
88
- response.files[i].size +
89
- " bytes)") +
90
- "</li>";
91
- }
92
-
93
- jQuery("#backup_cotent_modal .modal-content .files-list").prepend(
94
- files_text.reverse().join("\n")
95
- );
96
-
97
- if (
98
- !response.finished &&
99
- jQuery("#backup_cotent_modal").is(":visible")
100
- ) {
101
- $this.list_backup_content_callback(
102
- backup_file,
103
- response.start,
104
- response.part
105
- );
106
- } else {
107
- jQuery("#backup_cotent_modal .progress > div")
108
- .addClass("determinate")
109
- .removeClass(".indeterminate")
110
- .css("width", "100%");
111
- }
112
- },
113
- error: function (xhr, textStatus, error) {
114
  jQuery("#backup_cotent_modal .files-list")
115
  .addClass("error")
116
- .prepend(textStatus + error);
117
- },
118
- dataType: "json",
119
- });
120
- }
121
- }
 
122
 
123
- list_backup_content(backup_file) {
124
- this.file_counter = 0;
125
- jQuery("#backup_cotent_modal .modal-content .files-list")
126
- .text("")
127
- .removeClass("error");
128
- jQuery("#backup_cotent_modal .modal-content .backup-name").text(
129
- backup_file
130
- );
131
- jQuery("#backup_cotent_modal").modal("open");
132
- jQuery("#backup_cotent_modal .progress > div")
133
- .removeClass("determinate")
134
- .addClass("indeterminate");
135
-
136
- this.list_backup_content_callback(backup_file);
137
- }
138
 
139
- backup_encryption_callback(backup_file, start = 0, part = 0, iv = 0) {
140
- var $this = this;
141
-
142
- if (backup_file) {
143
- jQuery.ajax({
144
- url: ajaxurl,
145
- method: "post",
146
- data: {
147
- action: "backup_encryption",
148
- file: backup_file,
149
- start: start,
150
- part: part,
151
- iv: iv,
152
- },
153
- success: function (response) {
154
  if (response.total_size !== undefined) {
155
- jQuery("#backup_encryption_modal .progress > div")
156
- .removeClass("indeterminate")
157
- .addClass("determinate");
158
  var percent =
159
  parseInt(response.start * 100) / parseInt(response.total_size);
160
- jQuery("#backup_encryption_modal .progress .determinate").css(
161
- "width",
162
- parseInt(percent) + "%"
163
- );
164
- jQuery(
165
- "#backup_encryption_modal .modal-content .files-list"
166
- ).text(
167
- "Encrypting " +
168
- response.processing_file +
169
- " " +
170
- parseInt(percent) +
171
- "%"
172
- );
173
  }
174
 
175
- if (response.error) {
176
- jQuery("#backup_encryption_modal .notice").show();
177
- jQuery("#backup_encryption_modal .files-list")
178
- .addClass("error")
179
- .prepend(response.message + " ");
180
- jQuery("#backup_encryption_modal .progress > div")
181
- .addClass("determinate")
182
- .removeClass("indeterminate")
183
- .css("width", "100%");
184
- return;
185
- }
 
 
 
186
 
187
- if (
188
- !response.finished &&
189
- jQuery("#backup_encryption_modal").is(":visible")
190
- ) {
191
- $this.backup_encryption_callback(
192
- backup_file,
193
- response.start,
194
- response.part,
195
- response.iv
196
- );
197
- } else {
198
- jQuery("#backup_encryption_modal .progress > div")
199
- .addClass("determinate")
200
- .removeClass("indeterminate")
201
- .css("width", "100%");
202
- jQuery(
203
- "#backup_encryption_modal .modal-content .files-list"
204
- ).text("Done Encrypting.");
205
- dataTable.ajax.reload();
206
- }
207
- },
208
- error: function (xhr, textStatus, error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  jQuery("#backup_encryption_modal .files-list")
210
  .addClass("error")
211
- .prepend(textStatus + error);
212
- },
213
- dataType: "json",
214
- });
215
- }
216
- }
 
217
 
218
- backup_encryption(backup_file, start = 0) {
219
- this.file_counter = 0;
220
-
221
- jQuery("#backup_encryption_modal .modal-content .backup-name").text(
222
- backup_file
223
- );
224
- jQuery("#backup_encryption_modal").modal("open");
225
- jQuery("#backup_encryption_modal .progress > div");
226
- jQuery("#backup_encryption_modal .notice").show();
227
-
228
- jQuery("#backup_encryption_modal a.btn").attr(
229
- "onclick",
230
- "var xcloner_manage_backups = new Xcloner_Manage_Backups();xcloner_manage_backups.backup_encryption('" +
231
- backup_file +
232
- "', true)"
233
- );
234
- jQuery("#backup_encryption_modal .modal-content .files-list")
235
- .text("")
236
- .removeClass("error");
237
-
238
- if (start) {
239
- jQuery("#backup_encryption_modal .notice").hide();
240
- this.backup_encryption_callback(backup_file);
241
- }
 
 
 
 
242
  }
 
243
 
244
- backup_decryption_callback(backup_file, start = 0, part = 0, iv = 0) {
245
- var $this = this;
246
-
247
- var decryption_key = jQuery(
248
- "#backup_decryption_modal #decryption_key"
249
- ).val();
250
-
251
- if (backup_file) {
252
- jQuery.ajax({
253
- url: ajaxurl,
254
- method: "post",
255
- data: {
256
- action: "backup_decryption",
257
- file: backup_file,
258
- start: start,
259
- part: part,
260
- iv: iv,
261
- decryption_key: decryption_key,
262
- },
263
- success: function (response) {
264
- if (!response.start) {
265
- response.start = 0;
266
- }
267
- if (response.total_size !== undefined) {
268
- jQuery("#backup_decryption_modal .progress > div")
269
- .removeClass("indeterminate")
270
- .addClass("determinate");
271
- var percent =
272
- parseInt(response.start * 100) / parseInt(response.total_size);
273
- jQuery("#backup_decryption_modal .progress .determinate").css(
274
- "width",
275
- parseInt(percent) + "%"
276
- );
277
- jQuery(
278
- "#backup_decryption_modal .modal-content .files-list"
279
- ).text(
280
- "Decrypting " +
281
- response.processing_file +
282
- " " +
283
- parseInt(percent) +
284
- "%"
285
- );
286
- }
287
 
288
- if (response.error) {
289
- jQuery("#backup_decryption_modal .files-list")
290
- .addClass("error")
291
- .prepend(response.message + " ");
292
- jQuery("#backup_decryption_modal .progress > div")
293
- .addClass("determinate")
294
- .removeClass("indeterminate")
295
- .css("width", "100%");
296
- jQuery("#backup_decryption_modal .notice").show();
297
- return;
298
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
300
- if (
301
- !response.finished &&
302
- jQuery("#backup_decryption_modal").is(":visible")
303
- ) {
304
- $this.backup_decryption_callback(
305
- backup_file,
306
- response.start,
307
- response.part,
308
- response.iv
309
- );
310
- } else {
311
- jQuery("#backup_decryption_modal .progress > div")
312
- .addClass("determinate")
313
- .removeClass("indeterminate")
314
- .css("width", "100%");
315
- jQuery(
316
- "#backup_decryption_modal .modal-content .files-list"
317
- ).text("Done Decrypting.");
318
- dataTable.ajax.reload();
319
- }
320
- },
321
- error: function (xhr, textStatus, error) {
322
  jQuery("#backup_decryption_modal .files-list")
323
  .addClass("error")
324
- .prepend(textStatus + error);
325
- },
326
- dataType: "json",
327
- });
328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  }
 
330
 
331
- backup_decryption(backup_file, start = 0) {
332
- this.file_counter = 0;
333
-
334
- jQuery("#backup_decryption_modal .modal-content .backup-name").text(
335
- backup_file
336
- );
337
- jQuery("#backup_decryption_modal").modal("open");
338
- jQuery("#backup_decryption_modal .progress > div");
339
- jQuery("#backup_decryption_modal .notice").show();
340
-
341
- jQuery("#backup_decryption_modal a.btn").attr(
342
- "onclick",
343
- "var xcloner_manage_backups = new Xcloner_Manage_Backups();xcloner_manage_backups.backup_decryption('" +
344
- backup_file +
345
- "', true)"
346
- );
347
- jQuery("#backup_decryption_modal .modal-content .files-list")
348
- .text("")
349
- .removeClass("error");
350
-
351
- if (start) {
352
- jQuery("#backup_decryption_modal .notice").hide();
353
- this.backup_decryption_callback(backup_file);
354
- }
355
  }
 
356
 
357
- cloud_upload(backup_file, delete_after_transfer) {
358
-
359
- delete_after_transfer = delete_after_transfer || 0;
360
-
361
- jQuery("#remote_storage_modal").find(".backup_name").text(backup_file);
362
- jQuery("#remote_storage_modal")
363
- .find("input.backup_name")
364
- .val(backup_file);
365
- M.updateTextFields();
366
- jQuery(".col select").formSelect();
367
- jQuery("#remote_storage_modal").modal("open");
368
- jQuery("#remote_storage_modal .status").hide();
369
-
370
- jQuery(".remote-storage-form")
371
- .off("submit")
372
- .on("submit", function () {
373
- jQuery("#remote_storage_modal .status").show();
374
- jQuery("#remote_storage_modal .status .progress .indeterminate")
375
- .removeClass("determinate")
376
- .css("width", "0%");
377
- jQuery("#remote_storage_modal .status-text")
378
- .removeClass("error")
379
- .text("");
380
-
381
- var storage_type = jQuery("#remote_storage_modal select").val();
382
-
383
- if (backup_file) {
384
- jQuery.ajax({
385
- url: ajaxurl,
386
- method: "post",
387
- data: {
388
- action: "upload_backup_to_remote",
389
- file: backup_file,
390
- storage_type: storage_type,
391
- delete_after_transfer: delete_after_transfer
392
- },
393
- success: function (response) {
394
- if (response.error) {
395
- jQuery("#remote_storage_modal .status-text")
396
- .addClass("error")
397
- .text(response.message);
398
- } else {
399
- jQuery("#remote_storage_modal .status-text")
400
- .removeClass("error")
401
- .text("done");
402
- }
403
-
404
- jQuery("#remote_storage_modal .status .progress .indeterminate")
405
- .addClass("determinate")
406
- .css("width", "100%");
407
- },
408
- error: function (xhr, textStatus, error) {
409
  jQuery("#remote_storage_modal .status-text")
410
  .addClass("error")
411
- .text(textStatus + error);
412
- },
413
- dataType: "json",
414
- });
415
- }
416
-
417
- return false;
418
- });
419
- }
420
 
421
- copy_remote_to_local(backup_file) {
422
- jQuery("#local_storage_upload_modal").modal("open");
423
- jQuery("#local_storage_upload_modal .modal-content .backup-name").text(
424
- backup_file
425
- );
426
- jQuery("#local_storage_upload_modal .status-text")
427
- .removeClass("error")
428
- .text("");
429
- jQuery("#local_storage_upload_modal .status .progress .indeterminate")
430
- .removeClass("determinate")
431
- .css("width", "0%");
432
-
433
- if (backup_file) {
434
- jQuery.ajax({
435
- url: ajaxurl,
436
- method: "post",
437
- data: {
438
- action: "copy_backup_remote_to_local",
439
- file: backup_file,
440
- storage_type: this.storage_selection,
441
- },
442
- success: function (response) {
443
- if (response.error) {
444
- jQuery("#local_storage_upload_modal .status-text")
445
  .addClass("error")
446
- .text(response.message);
447
- } else {
448
- jQuery("#local_storage_upload_modal .status-text")
449
- .removeClass("error")
450
- .text("done");
451
- }
452
 
453
- jQuery(
454
- "#local_storage_upload_modal .status .progress .indeterminate"
455
- )
456
- .addClass("determinate")
457
- .css("width", "100%");
458
- },
459
- error: function (xhr, textStatus, error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  jQuery("#local_storage_upload_modal .status-text")
461
  .addClass("error")
462
- .text(textStatus + error);
463
- },
464
- dataType: "json",
465
- });
466
- }
467
- }
468
 
469
- //end class
 
 
 
 
 
 
 
 
 
 
 
470
  }
471
 
472
- jQuery(document).ready(function () {
473
- var xcloner_manage_backups = new Xcloner_Manage_Backups();
474
-
475
- xcloner_manage_backups.storage_selection = getUrlParam("storage_selection");
476
-
477
- dataTable = jQuery("#manage_backups").DataTable({
478
- responsive: true,
479
- bFilter: true,
480
- order: [[2, "desc"]],
481
- buttons: ["selectAll", "selectNone"],
482
- language: {
483
- emptyTable: "No backups available",
484
- buttons: {
485
- selectAll: "Select all items",
486
- selectNone: "Select none",
487
- },
488
- },
489
- columnDefs: [{ targets: "no-sort", orderable: false }],
490
- columns: [
491
- { width: "1%" },
492
- { width: "25%" },
493
- { width: "5%" },
494
- { width: "5%" },
495
- { width: "9%" },
496
- ],
497
- oLanguage: {
498
- sSearch: "",
499
- sSearchPlaceholder: "Search Backups",
500
- },
501
- ajax: {
502
- url:
503
- ajaxurl +
504
- "?action=get_manage_backups_list&storage_selection=" +
505
- xcloner_manage_backups.storage_selection,
506
- },
507
- fnDrawCallback: function (oSettings) {
508
- jQuery("a.expand-multipart").on("click", function () {
509
- jQuery(this).parent().find("ul.multipart").toggle();
510
- jQuery(this).parent().find("a.expand-multipart.remove").toggle();
511
- jQuery(this).parent().find("a.expand-multipart.add").toggle();
512
- });
513
 
514
- jQuery(this)
515
- .off("click", ".delete")
516
- .on("click", ".delete", function (e) {
517
- var hash = jQuery(this).attr("href");
518
- var id = hash.substr(1);
519
- var data = "";
520
-
521
- if (show_delete_alert) {
522
- if (confirm("Are you sure you want to delete it?")) {
523
- xcloner_manage_backups.delete_backup_by_name(
524
- id,
525
- this,
526
- dataTable
527
- );
528
- }
529
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  xcloner_manage_backups.delete_backup_by_name(id, this, dataTable);
531
  }
 
 
 
532
 
533
- e.preventDefault();
534
- });
535
 
536
- jQuery(this)
537
- .off("click", ".download")
538
- .on("click", ".download", function (e) {
539
- var hash = jQuery(this).attr("href");
540
- var id = hash.substr(1);
541
- xcloner_manage_backups.download_backup_by_name(id);
542
- e.preventDefault();
543
- });
544
 
545
- jQuery(this)
546
- .off("click", ".cloud-upload")
547
- .on("click", ".cloud-upload", function (e) {
548
- var hash = jQuery(this).attr("href");
549
- var id = hash.substr(1);
550
- xcloner_manage_backups.cloud_upload(id);
551
- e.preventDefault();
552
- });
553
 
554
- jQuery(this)
555
- .off("click", ".copy-remote-to-local")
556
- .on("click", ".copy-remote-to-local", function (e) {
557
- var hash = jQuery(this).attr("href");
558
- var id = hash.substr(1);
559
- xcloner_manage_backups.copy_remote_to_local(id);
560
- e.preventDefault();
561
- });
562
 
563
- jQuery(this)
564
- .off("click", ".list-backup-content")
565
- .on("click", ".list-backup-content", function (e) {
566
- var hash = jQuery(this).attr("href");
567
- var id = hash.substr(1);
568
- xcloner_manage_backups.list_backup_content(id);
569
- e.preventDefault();
570
- });
571
 
572
- jQuery(this)
573
- .off("click", ".backup-encryption")
574
- .on("click", ".backup-encryption", function (e) {
575
- var hash = jQuery(this).attr("href");
576
- var id = hash.substr(1);
577
- xcloner_manage_backups.backup_encryption(id);
578
- e.preventDefault();
579
- });
580
 
581
- jQuery(this)
582
- .off("click", ".backup-decryption")
583
- .on("click", ".backup-decryption", function (e) {
584
- var hash = jQuery(this).attr("href");
585
- var id = hash.substr(1);
586
- xcloner_manage_backups.backup_decryption(id);
587
- e.preventDefault();
588
- });
589
- },
590
- });
591
-
592
- jQuery("#select_all").click(function () {
593
- jQuery("input:checkbox").prop("checked", this.checked);
594
- });
595
-
596
- jQuery(".delete-all").click(function () {
597
- if (confirm("Are you sure you want to delete selected items?")) {
598
- show_delete_alert = 0;
599
- jQuery("input:checkbox").each(function () {
600
- if (jQuery(this).is(":checked")) {
601
- jQuery(this)
602
- .parent()
603
- .parent()
604
- .parent()
605
- .parent()
606
- .find(".delete")
607
- .trigger("click");
608
- }
609
  });
610
- show_delete_alert = 1;
611
- }
612
- });
613
 
614
- jQuery("#remote_storage_modal").modal();
615
- jQuery("#local_storage_upload_modal").modal();
 
616
 
617
- jQuery("#storage_selection").on("change", function () {
618
- window.location =
619
- window.location.href.split("&storage_selection")[0] +
620
- "&storage_selection=" +
621
- jQuery(this).val();
622
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
 
624
- jQuery(".modal").on("hide", function () {
625
- alert("ok");
626
- });
 
 
 
627
 
628
- var show_delete_alert = 1;
 
629
  });
 
 
 
1
  /** global: ajaxurl */
2
  /** global: Materialize */
3
+ var dataTable = "";
4
+
5
+ var backup_cotent_modal;
6
+ var backup_encryption_modal;
7
+ var backup_decryption_modal;
8
+ var remote_storage_modal;
9
+ var local_storage_upload_modal;
10
+
11
+ document.addEventListener("DOMContentLoaded", function () {
12
+ var Modalelem = document.querySelector("#backup_cotent_modal");
13
+ backup_cotent_modal = M.Modal.init(Modalelem);
14
+
15
+ var Modalelem = document.querySelector("#backup_encryption_modal");
16
+ backup_encryption_modal = M.Modal.init(Modalelem);
17
+
18
+ var Modalelem = document.querySelector("#backup_decryption_modal");
19
+ backup_decryption_modal = M.Modal.init(Modalelem);
20
+
21
+ var Modalelem = document.querySelector("#remote_storage_modal");
22
+ remote_storage_modal = M.Modal.init(Modalelem);
23
+
24
+ var Modalelem = document.querySelector("#local_storage_upload_modal");
25
+ local_storage_upload_modal = M.Modal.init(Modalelem);
26
+
27
+ });
28
+
29
+ class Xcloner_Manage_Backups {
30
+ constructor() {
31
+ this.file_counter = 0;
32
+ this.storage_selection = "";
33
+ this.dataTable = "";
34
+ //this.edit_modal = jQuery('.modal').modal();
35
+ }
36
 
37
+ download_backup_by_name(id) {
38
+ window.open(ajaxurl + "?action=download_backup_by_name&name=" + id);
39
+ return false;
40
+ }
41
 
42
+ delete_backup_by_name(id, elem, dataTable) {
43
+ var $this = this;
44
+
45
+ if (id) {
46
+ jQuery.ajax({
47
+ url: ajaxurl,
48
+ method: "post",
49
+ data: {
50
+ action: "delete_backup_by_name",
51
+ name: id,
52
+ storage_selection: this.storage_selection,
53
+ },
54
+ success: function (response) {
55
+ if (response.finished) {
56
+ dataTable.row(jQuery(elem).parents("tr")).remove().draw();
57
+ } else {
58
+ alert("There was an error deleting the file");
59
+ }
60
+ },
61
+ dataType: "json",
62
+ });
 
63
  }
64
+ }
65
 
66
+ list_backup_content_callback(backup_file, start = 0, part = 0) {
67
+ var $this = this;
68
+
69
+ if (backup_file) {
70
+ jQuery.ajax({
71
+ url: ajaxurl,
72
+ method: "post",
73
+ data: {
74
+ action: "list_backup_files",
75
+ file: backup_file,
76
+ start: start,
77
+ part: part,
78
+ },
79
+ success: function (response) {
80
+ if (response.error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  jQuery("#backup_cotent_modal .files-list")
82
  .addClass("error")
83
+ .prepend(response.message);
84
+ jQuery("#backup_cotent_modal .progress > div")
85
+ .addClass("determinate")
86
+ .removeClass(".indeterminate")
87
+ .css("width", "100%");
88
+ return;
89
+ }
90
 
91
+ var files_text = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ for (var i in response.files) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  if (response.total_size !== undefined) {
 
 
 
95
  var percent =
96
  parseInt(response.start * 100) / parseInt(response.total_size);
97
+ //jQuery("#backup_cotent_modal .progress .determinate").css('width', percent + "%")
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
 
100
+ $this.file_counter++;
101
+
102
+ files_text[i] =
103
+ "<li>" +
104
+ ($this.file_counter +
105
+ ". <span title='" +
106
+ response.files[i].mtime +
107
+ "'>" +
108
+ response.files[i].path +
109
+ "</span> (" +
110
+ response.files[i].size +
111
+ " bytes)") +
112
+ "</li>";
113
+ }
114
 
115
+ jQuery("#backup_cotent_modal .modal-content .files-list").prepend(
116
+ files_text.reverse().join("\n")
117
+ );
118
+
119
+ if (
120
+ !response.finished &&
121
+ jQuery("#backup_cotent_modal").is(":visible")
122
+ ) {
123
+ $this.list_backup_content_callback(
124
+ backup_file,
125
+ response.start,
126
+ response.part
127
+ );
128
+ } else {
129
+ jQuery("#backup_cotent_modal .progress > div")
130
+ .addClass("determinate")
131
+ .removeClass(".indeterminate")
132
+ .css("width", "100%");
133
+ }
134
+ },
135
+ error: function (xhr, textStatus, error) {
136
+ jQuery("#backup_cotent_modal .files-list")
137
+ .addClass("error")
138
+ .prepend(textStatus + error);
139
+ },
140
+ dataType: "json",
141
+ });
142
+ }
143
+ }
144
+
145
+ list_backup_content(backup_file) {
146
+ this.file_counter = 0;
147
+ jQuery("#backup_cotent_modal .modal-content .files-list")
148
+ .text("")
149
+ .removeClass("error");
150
+ jQuery("#backup_cotent_modal .modal-content .backup-name").text(
151
+ backup_file
152
+ );
153
+ backup_cotent_modal.open();
154
+ jQuery("#backup_cotent_modal .progress > div")
155
+ .removeClass("determinate")
156
+ .addClass("indeterminate");
157
+
158
+ this.list_backup_content_callback(backup_file);
159
+ }
160
+
161
+ backup_encryption_callback(backup_file, start = 0, part = 0, iv = 0) {
162
+ var $this = this;
163
+
164
+ if (backup_file) {
165
+ jQuery.ajax({
166
+ url: ajaxurl,
167
+ method: "post",
168
+ data: {
169
+ action: "backup_encryption",
170
+ file: backup_file,
171
+ start: start,
172
+ part: part,
173
+ iv: iv,
174
+ },
175
+ success: function (response) {
176
+ if (response.total_size !== undefined) {
177
+ jQuery("#backup_encryption_modal .progress > div")
178
+ .removeClass("indeterminate")
179
+ .addClass("determinate");
180
+ var percent =
181
+ parseInt(response.start * 100) / parseInt(response.total_size);
182
+ jQuery("#backup_encryption_modal .progress .determinate").css(
183
+ "width",
184
+ parseInt(percent) + "%"
185
+ );
186
+ jQuery("#backup_encryption_modal .modal-content .files-list").text(
187
+ "Encrypting " +
188
+ response.processing_file +
189
+ " " +
190
+ parseInt(percent) +
191
+ "%"
192
+ );
193
+ }
194
+
195
+ if (response.error) {
196
+ jQuery("#backup_encryption_modal .notice").show();
197
  jQuery("#backup_encryption_modal .files-list")
198
  .addClass("error")
199
+ .prepend(response.message + " ");
200
+ jQuery("#backup_encryption_modal .progress > div")
201
+ .addClass("determinate")
202
+ .removeClass("indeterminate")
203
+ .css("width", "100%");
204
+ return;
205
+ }
206
 
207
+ if (
208
+ !response.finished &&
209
+ jQuery("#backup_encryption_modal").is(":visible")
210
+ ) {
211
+ $this.backup_encryption_callback(
212
+ backup_file,
213
+ response.start,
214
+ response.part,
215
+ response.iv
216
+ );
217
+ } else {
218
+ jQuery("#backup_encryption_modal .progress > div")
219
+ .addClass("determinate")
220
+ .removeClass("indeterminate")
221
+ .css("width", "100%");
222
+ jQuery("#backup_encryption_modal .modal-content .files-list").text(
223
+ "Done Encrypting."
224
+ );
225
+ dataTable.ajax.reload();
226
+ }
227
+ },
228
+ error: function (xhr, textStatus, error) {
229
+ jQuery("#backup_encryption_modal .files-list")
230
+ .addClass("error")
231
+ .prepend(textStatus + error);
232
+ },
233
+ dataType: "json",
234
+ });
235
  }
236
+ }
237
 
238
+ backup_encryption(backup_file, start = 0) {
239
+ this.file_counter = 0;
240
+
241
+ jQuery("#backup_encryption_modal .modal-content .backup-name").text(
242
+ backup_file
243
+ );
244
+ backup_encryption_modal.open();
245
+ jQuery("#backup_encryption_modal .progress > div");
246
+ jQuery("#backup_encryption_modal .notice").show();
247
+
248
+ jQuery("#backup_encryption_modal a.btn").attr(
249
+ "onclick",
250
+ "var xcloner_manage_backups = new Xcloner_Manage_Backups();xcloner_manage_backups.backup_encryption('" +
251
+ backup_file +
252
+ "', true)"
253
+ );
254
+ jQuery("#backup_encryption_modal .modal-content .files-list")
255
+ .text("")
256
+ .removeClass("error");
257
+
258
+ if (start) {
259
+ jQuery("#backup_encryption_modal .notice").hide();
260
+ this.backup_encryption_callback(backup_file);
261
+ }
262
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ backup_decryption_callback(backup_file, start = 0, part = 0, iv = 0) {
265
+ var $this = this;
266
+
267
+ var decryption_key = jQuery(
268
+ "#backup_decryption_modal #decryption_key"
269
+ ).val();
270
+
271
+ if (backup_file) {
272
+ jQuery.ajax({
273
+ url: ajaxurl,
274
+ method: "post",
275
+ data: {
276
+ action: "backup_decryption",
277
+ file: backup_file,
278
+ start: start,
279
+ part: part,
280
+ iv: iv,
281
+ decryption_key: decryption_key,
282
+ },
283
+ success: function (response) {
284
+ if (!response.start) {
285
+ response.start = 0;
286
+ }
287
+ if (response.total_size !== undefined) {
288
+ jQuery("#backup_decryption_modal .progress > div")
289
+ .removeClass("indeterminate")
290
+ .addClass("determinate");
291
+ var percent =
292
+ parseInt(response.start * 100) / parseInt(response.total_size);
293
+ jQuery("#backup_decryption_modal .progress .determinate").css(
294
+ "width",
295
+ parseInt(percent) + "%"
296
+ );
297
+ jQuery("#backup_decryption_modal .modal-content .files-list").text(
298
+ "Decrypting " +
299
+ response.processing_file +
300
+ " " +
301
+ parseInt(percent) +
302
+ "%"
303
+ );
304
+ }
305
 
306
+ if (response.error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  jQuery("#backup_decryption_modal .files-list")
308
  .addClass("error")
309
+ .prepend(response.message + " ");
310
+ jQuery("#backup_decryption_modal .progress > div")
311
+ .addClass("determinate")
312
+ .removeClass("indeterminate")
313
+ .css("width", "100%");
314
+ jQuery("#backup_decryption_modal .notice").show();
315
+ return;
316
+ }
317
+
318
+ if (
319
+ !response.finished &&
320
+ jQuery("#backup_decryption_modal").is(":visible")
321
+ ) {
322
+ $this.backup_decryption_callback(
323
+ backup_file,
324
+ response.start,
325
+ response.part,
326
+ response.iv
327
+ );
328
+ } else {
329
+ jQuery("#backup_decryption_modal .progress > div")
330
+ .addClass("determinate")
331
+ .removeClass("indeterminate")
332
+ .css("width", "100%");
333
+ jQuery("#backup_decryption_modal .modal-content .files-list").text(
334
+ "Done Decrypting."
335
+ );
336
+ dataTable.ajax.reload();
337
+ }
338
+ },
339
+ error: function (xhr, textStatus, error) {
340
+ jQuery("#backup_decryption_modal .files-list")
341
+ .addClass("error")
342
+ .prepend(textStatus + error);
343
+ },
344
+ dataType: "json",
345
+ });
346
  }
347
+ }
348
 
349
+ backup_decryption(backup_file, start = 0) {
350
+ this.file_counter = 0;
351
+
352
+ jQuery("#backup_decryption_modal .modal-content .backup-name").text(
353
+ backup_file
354
+ );
355
+ backup_decryption_modal.open();
356
+ jQuery("#backup_decryption_modal .progress > div");
357
+ jQuery("#backup_decryption_modal .notice").show();
358
+
359
+ jQuery("#backup_decryption_modal a.btn").attr(
360
+ "onclick",
361
+ "var xcloner_manage_backups = new Xcloner_Manage_Backups();xcloner_manage_backups.backup_decryption('" +
362
+ backup_file +
363
+ "', true)"
364
+ );
365
+ jQuery("#backup_decryption_modal .modal-content .files-list")
366
+ .text("")
367
+ .removeClass("error");
368
+
369
+ if (start) {
370
+ jQuery("#backup_decryption_modal .notice").hide();
371
+ this.backup_decryption_callback(backup_file);
 
372
  }
373
+ }
374
 
375
+ cloud_upload(backup_file, delete_after_transfer) {
376
+ delete_after_transfer = delete_after_transfer || 0;
377
+
378
+ jQuery("#remote_storage_modal").find(".backup_name").text(backup_file);
379
+ jQuery("#remote_storage_modal").find("input.backup_name").val(backup_file);
380
+ M.updateTextFields();
381
+ jQuery(".col select").formSelect();
382
+ remote_storage_modal.open();
383
+ jQuery("#remote_storage_modal .status").hide();
384
+
385
+ jQuery(".remote-storage-form")
386
+ .off("submit")
387
+ .on("submit", function () {
388
+ jQuery("#remote_storage_modal .status").show();
389
+ jQuery("#remote_storage_modal .status .progress .indeterminate")
390
+ .removeClass("determinate")
391
+ .css("width", "0%");
392
+ jQuery("#remote_storage_modal .status-text")
393
+ .removeClass("error")
394
+ .text("");
395
+
396
+ var storage_type = jQuery("#remote_storage_modal select").val();
397
+
398
+ if (backup_file) {
399
+ jQuery.ajax({
400
+ url: ajaxurl,
401
+ method: "post",
402
+ data: {
403
+ action: "upload_backup_to_remote",
404
+ file: backup_file,
405
+ storage_type: storage_type,
406
+ delete_after_transfer: delete_after_transfer,
407
+ },
408
+ success: function (response) {
409
+ if (response.error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  jQuery("#remote_storage_modal .status-text")
411
  .addClass("error")
412
+ .text(response.message);
413
+ } else {
414
+ jQuery("#remote_storage_modal .status-text")
415
+ .removeClass("error")
416
+ .text("done");
417
+ }
 
 
 
418
 
419
+ jQuery("#remote_storage_modal .status .progress .indeterminate")
420
+ .addClass("determinate")
421
+ .css("width", "100%");
422
+ },
423
+ error: function (xhr, textStatus, error) {
424
+ jQuery("#remote_storage_modal .status-text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  .addClass("error")
426
+ .text(textStatus + error);
427
+ },
428
+ dataType: "json",
429
+ });
430
+ }
 
431
 
432
+ return false;
433
+ });
434
+ }
435
+
436
+ copy_remote_to_local(backup_file) {
437
+ local_storage_upload_modal.open();
438
+ jQuery("#local_storage_upload_modal .modal-content .backup-name").text(
439
+ backup_file
440
+ );
441
+ jQuery("#local_storage_upload_modal .status-text")
442
+ .removeClass("error")
443
+ .text("");
444
+ jQuery("#local_storage_upload_modal .status .progress .indeterminate")
445
+ .removeClass("determinate")
446
+ .css("width", "0%");
447
+
448
+ if (backup_file) {
449
+ jQuery.ajax({
450
+ url: ajaxurl,
451
+ method: "post",
452
+ data: {
453
+ action: "copy_backup_remote_to_local",
454
+ file: backup_file,
455
+ storage_type: this.storage_selection,
456
+ },
457
+ success: function (response) {
458
+ if (response.error) {
459
  jQuery("#local_storage_upload_modal .status-text")
460
  .addClass("error")
461
+ .text(response.message);
462
+ } else {
463
+ jQuery("#local_storage_upload_modal .status-text")
464
+ .removeClass("error")
465
+ .text("done");
466
+ }
467
 
468
+ jQuery("#local_storage_upload_modal .status .progress .indeterminate")
469
+ .addClass("determinate")
470
+ .css("width", "100%");
471
+ },
472
+ error: function (xhr, textStatus, error) {
473
+ jQuery("#local_storage_upload_modal .status-text")
474
+ .addClass("error")
475
+ .text(textStatus + error);
476
+ },
477
+ dataType: "json",
478
+ });
479
+ }
480
  }
481
 
482
+ //end class
483
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
 
485
+ jQuery(document).ready(function () {
486
+ var xcloner_manage_backups = new Xcloner_Manage_Backups();
487
+
488
+ xcloner_manage_backups.storage_selection = getUrlParam("storage_selection");
489
+
490
+ dataTable = jQuery("#manage_backups").DataTable({
491
+ responsive: true,
492
+ bFilter: true,
493
+ order: [[2, "desc"]],
494
+ buttons: ["selectAll", "selectNone"],
495
+ language: {
496
+ emptyTable: "No backups available",
497
+ buttons: {
498
+ selectAll: "Select all items",
499
+ selectNone: "Select none",
500
+ },
501
+ },
502
+ columnDefs: [{ targets: "no-sort", orderable: false }],
503
+ columns: [
504
+ { width: "1%" },
505
+ { width: "25%" },
506
+ { width: "5%" },
507
+ { width: "5%" },
508
+ { width: "9%" },
509
+ ],
510
+ oLanguage: {
511
+ sSearch: "",
512
+ sSearchPlaceholder: "Search Backups",
513
+ },
514
+ ajax: {
515
+ url:
516
+ ajaxurl +
517
+ "?action=get_manage_backups_list&storage_selection=" +
518
+ xcloner_manage_backups.storage_selection,
519
+ },
520
+ fnDrawCallback: function (oSettings) {
521
+ jQuery("a.expand-multipart").on("click", function () {
522
+ jQuery(this).parent().find("ul.multipart").toggle();
523
+ jQuery(this).parent().find("a.expand-multipart.remove").toggle();
524
+ jQuery(this).parent().find("a.expand-multipart.add").toggle();
525
+ });
526
+
527
+ jQuery(this)
528
+ .off("click", ".delete")
529
+ .on("click", ".delete", function (e) {
530
+ var hash = jQuery(this).attr("href");
531
+ var id = hash.substr(1);
532
+ var data = "";
533
+
534
+ if (show_delete_alert) {
535
+ if (confirm("Are you sure you want to delete it?")) {
536
  xcloner_manage_backups.delete_backup_by_name(id, this, dataTable);
537
  }
538
+ } else {
539
+ xcloner_manage_backups.delete_backup_by_name(id, this, dataTable);
540
+ }
541
 
542
+ e.preventDefault();
543
+ });
544
 
545
+ jQuery(this)
546
+ .off("click", ".download")
547
+ .on("click", ".download", function (e) {
548
+ var hash = jQuery(this).attr("href");
549
+ var id = hash.substr(1);
550
+ xcloner_manage_backups.download_backup_by_name(id);
551
+ e.preventDefault();
552
+ });
553
 
554
+ jQuery(this)
555
+ .off("click", ".cloud-upload")
556
+ .on("click", ".cloud-upload", function (e) {
557
+ var hash = jQuery(this).attr("href");
558
+ var id = hash.substr(1);
559
+ xcloner_manage_backups.cloud_upload(id);
560
+ e.preventDefault();
561
+ });
562
 
563
+ jQuery(this)
564
+ .off("click", ".copy-remote-to-local")
565
+ .on("click", ".copy-remote-to-local", function (e) {
566
+ var hash = jQuery(this).attr("href");
567
+ var id = hash.substr(1);
568
+ xcloner_manage_backups.copy_remote_to_local(id);
569
+ e.preventDefault();
570
+ });
571
 
572
+ jQuery(this)
573
+ .off("click", ".list-backup-content")
574
+ .on("click", ".list-backup-content", function (e) {
575
+ var hash = jQuery(this).attr("href");
576
+ var id = hash.substr(1);
577
+ xcloner_manage_backups.list_backup_content(id);
578
+ e.preventDefault();
579
+ });
580
 
581
+ jQuery(this)
582
+ .off("click", ".backup-encryption")
583
+ .on("click", ".backup-encryption", function (e) {
584
+ var hash = jQuery(this).attr("href");
585
+ var id = hash.substr(1);
586
+ xcloner_manage_backups.backup_encryption(id);
587
+ e.preventDefault();
588
+ });
589
 
590
+ jQuery(this)
591
+ .off("click", ".backup-decryption")
592
+ .on("click", ".backup-decryption", function (e) {
593
+ var hash = jQuery(this).attr("href");
594
+ var id = hash.substr(1);
595
+ xcloner_manage_backups.backup_decryption(id);
596
+ e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  });
598
+ },
599
+ });
 
600
 
601
+ jQuery("#select_all").click(function () {
602
+ jQuery("input:checkbox").prop("checked", this.checked);
603
+ });
604
 
605
+ jQuery(".delete-all").click(function () {
606
+ if (confirm("Are you sure you want to delete selected items?")) {
607
+ show_delete_alert = 0;
608
+ jQuery("input:checkbox").each(function () {
609
+ if (jQuery(this).is(":checked")) {
610
+ jQuery(this)
611
+ .parent()
612
+ .parent()
613
+ .parent()
614
+ .parent()
615
+ .find(".delete")
616
+ .trigger("click");
617
+ }
618
+ });
619
+ show_delete_alert = 1;
620
+ }
621
+ });
622
+
623
+ //jQuery("#remote_storage_modal").modal();
624
+ //jQuery("#local_storage_upload_modal").modal();
625
 
626
+ jQuery("#storage_selection").on("change", function () {
627
+ window.location =
628
+ window.location.href.split("&storage_selection")[0] +
629
+ "&storage_selection=" +
630
+ jQuery(this).val();
631
+ });
632
 
633
+ jQuery(".modal").on("hide", function () {
634
+ alert("ok");
635
  });
636
+
637
+ var show_delete_alert = 1;
638
+ });
admin/js/xcloner-restore-class.js CHANGED
@@ -729,7 +729,7 @@ class Xcloner_Restore{
729
  this.file_counter = 0
730
  jQuery("#backup_cotent_modal .modal-content .files-list").text("").removeClass("error");
731
  jQuery("#backup_cotent_modal .modal-content .backup-name").text(backup_file);
732
- jQuery("#backup_cotent_modal").modal('open');
733
  jQuery("#backup_cotent_modal .progress > div").removeClass('determinate').addClass("indeterminate");
734
 
735
  //this.list_backup_content_callback(backup_file)
729
  this.file_counter = 0
730
  jQuery("#backup_cotent_modal .modal-content .files-list").text("").removeClass("error");
731
  jQuery("#backup_cotent_modal .modal-content .backup-name").text(backup_file);
732
+ backup_cotent_modal.open();
733
  jQuery("#backup_cotent_modal .progress > div").removeClass('determinate').addClass("indeterminate");
734
 
735
  //this.list_backup_content_callback(backup_file)
admin/js/xcloner-scheduler-class.js CHANGED
@@ -2,10 +2,19 @@
2
  /** global: Materialize */
3
  /** global: dataTable */
4
 
 
 
 
 
 
 
 
5
  jQuery(document).ready(function () {
 
6
  class Xcloner_Scheduler {
7
  constructor() {
8
- this.edit_modal = jQuery(".modal").modal();
 
9
  }
10
 
11
  get_form_params() {}
@@ -118,7 +127,7 @@ jQuery(document).ready(function () {
118
 
119
  M.updateTextFields();
120
 
121
- this.edit_modal.modal("open");
122
  }
123
 
124
  save_schedule(form, dataTable) {
@@ -143,7 +152,7 @@ jQuery(document).ready(function () {
143
  return;
144
  }
145
 
146
- $this.edit_modal.modal("close");
147
  //location.reload();
148
  dataTable.ajax.reload();
149
  });
2
  /** global: Materialize */
3
  /** global: dataTable */
4
 
5
+ var edit_schedule_modal_instance;
6
+
7
+ document.addEventListener('DOMContentLoaded', function() {
8
+ var Modalelem = document.querySelector('#edit_schedule');
9
+ edit_schedule_modal_instance = M.Modal.init(Modalelem);
10
+ });
11
+
12
  jQuery(document).ready(function () {
13
+
14
  class Xcloner_Scheduler {
15
  constructor() {
16
+ this.edit_modal = jQuery("#edit_schedule");
17
+
18
  }
19
 
20
  get_form_params() {}
127
 
128
  M.updateTextFields();
129
 
130
+ edit_schedule_modal_instance.open();
131
  }
132
 
133
  save_schedule(form, dataTable) {
152
  return;
153
  }
154
 
155
+ edit_schedule_modal_instance.close();
156
  //location.reload();
157
  dataTable.ajax.reload();
158
  });
admin/partials/xcloner_generate_backups_page.php CHANGED
@@ -117,7 +117,7 @@ $tab = 1;
117
 
118
  <div class="row">
119
  <div class="input-field col s12 m10 l6">
120
- <i class="material-icons prefix">cloud_upload</i>
121
  <select name="schedule_storage" id="schedule_storage" class="schedule_storage validate" >
122
  <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option>
123
  <?php foreach ($available_storages as $storage => $text): ?>
@@ -319,7 +319,7 @@ $tab = 1;
319
  <?php if (sizeof($available_storages)): ?>
320
  <a href="#" class="cloud-upload"
321
  title="<?php echo __("Send Backup To Remote Storage", 'xcloner-backup-and-restore') ?>"><i
322
- class="material-icons">cloud_upload</i></a>
323
  <?php endif ?>
324
  <a href="#" class="download"
325
  title="<?php echo __("Download Backup", 'xcloner-backup-and-restore') ?>"><i
117
 
118
  <div class="row">
119
  <div class="input-field col s12 m10 l6">
120
+ <i class="material-icons prefix">swap_horiz</i>
121
  <select name="schedule_storage" id="schedule_storage" class="schedule_storage validate" >
122
  <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option>
123
  <?php foreach ($available_storages as $storage => $text): ?>
319
  <?php if (sizeof($available_storages)): ?>
320
  <a href="#" class="cloud-upload"
321
  title="<?php echo __("Send Backup To Remote Storage", 'xcloner-backup-and-restore') ?>"><i
322
+ class="material-icons">swap_horiz</i></a>
323
  <?php endif ?>
324
  <a href="#" class="download"
325
  title="<?php echo __("Download Backup", 'xcloner-backup-and-restore') ?>"><i
includes/class-xcloner.php CHANGED
@@ -115,7 +115,7 @@ class Xcloner extends watchfulli\XClonerCore\Xcloner
115
  $this->log_php_errors();
116
 
117
  $this->plugin_name = 'xcloner';
118
- $this->version = '4.2.1';
119
 
120
  $this->load_dependencies();
121
  $this->set_locale();
@@ -771,7 +771,7 @@ class Xcloner extends watchfulli\XClonerCore\Xcloner
771
  */
772
  public function restore_backup()
773
  {
774
- $this->check_access();
775
 
776
  define("XCLONER_PLUGIN_ACCESS", 1);
777
  include_once(dirname(__DIR__).DS."restore".DS."xcloner_restore.php");
115
  $this->log_php_errors();
116
 
117
  $this->plugin_name = 'xcloner';
118
+ $this->version = '4.2.13';
119
 
120
  $this->load_dependencies();
121
  $this->set_locale();
771
  */
772
  public function restore_backup()
773
  {
774
+ $this->xcloner_api->check_access();
775
 
776
  define("XCLONER_PLUGIN_ACCESS", 1);
777
  include_once(dirname(__DIR__).DS."restore".DS."xcloner_restore.php");
vendor/watchfulli/xcloner-core/src/Xcloner_Api.php CHANGED
@@ -111,10 +111,10 @@ class Xcloner_Api
111
  /**
112
  * Checks API access
113
  */
114
- private function check_access()
115
  {
116
  if (function_exists('current_user_can') && !current_user_can('manage_options')) {
117
- $this->send_response(json_encode("Not allowed access here!"));
118
  }
119
  }
120
 
@@ -1097,7 +1097,7 @@ class Xcloner_Api
1097
  'Send Backup To Remote Storage',
1098
  'xcloner-backup-and-restore'
1099
  ) ?>"><i
1100
- class="material-icons">cloud_upload</i></a>
1101
  <?php endif ?>
1102
  <?php
1103
  $basename = $file_info['basename'];
@@ -1127,7 +1127,7 @@ class Xcloner_Api
1127
  </a>
1128
  <?php if ($storage_selection and !$file_exists_on_local_storage): ?>
1129
  <a href="#<?php echo $file_info['basename']; ?>" class="copy-remote-to-local"
1130
- title="<?php echo __('Push Backup To Local Storage', 'xcloner-backup-and-restore') ?>"><i
1131
  class="material-icons">file_upload</i></a>
1132
  <?php endif ?>
1133
 
111
  /**
112
  * Checks API access
113
  */
114
+ public function check_access()
115
  {
116
  if (function_exists('current_user_can') && !current_user_can('manage_options')) {
117
+ $this->send_response(json_encode("Access not allowed!"));
118
  }
119
  }
120
 
1097
  'Send Backup To Remote Storage',
1098
  'xcloner-backup-and-restore'
1099
  ) ?>"><i
1100
+ class="material-icons">swap_horiz</i></a>
1101
  <?php endif ?>
1102
  <?php
1103
  $basename = $file_info['basename'];
1127
  </a>
1128
  <?php if ($storage_selection and !$file_exists_on_local_storage): ?>
1129
  <a href="#<?php echo $file_info['basename']; ?>" class="copy-remote-to-local"
1130
+ title="<?php echo __('Transfer a copy of the remote backup to local storage.', 'xcloner-backup-and-restore') ?>"><i
1131
  class="material-icons">file_upload</i></a>
1132
  <?php endif ?>
1133
 
xcloner.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: XCloner - Site Backup and Restore
16
  * Plugin URI: https://xcloner.com/
17
  * Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
18
- * Version: 4.2.12
19
  * Author: watchful
20
  * Author URI: https://watchful.net/
21
  * License: GPL-2.0+
@@ -129,7 +129,7 @@ if (php_sapi_name() == "cli") {
129
  *
130
  * --profile=<profile>
131
  * : backup profile name or id
132
- *
133
  * @when before_wp_load
134
  */
135
  function ($args, $assoc_args) {
15
  * Plugin Name: XCloner - Site Backup and Restore
16
  * Plugin URI: https://xcloner.com/
17
  * Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
18
+ * Version: 4.2.13
19
  * Author: watchful
20
  * Author URI: https://watchful.net/
21
  * License: GPL-2.0+
129
  *
130
  * --profile=<profile>
131
  * : backup profile name or id
132
+ *
133
  * @when before_wp_load
134
  */
135
  function ($args, $assoc_args) {