theme.bundle.js (543967B)
1 /******/ (function(modules) { // webpackBootstrap 2 /******/ // The module cache 3 /******/ var installedModules = {}; 4 /******/ 5 /******/ // The require function 6 /******/ function __webpack_require__(moduleId) { 7 /******/ 8 /******/ // Check if module is in cache 9 /******/ if(installedModules[moduleId]) { 10 /******/ return installedModules[moduleId].exports; 11 /******/ } 12 /******/ // Create a new module (and put it into the cache) 13 /******/ var module = installedModules[moduleId] = { 14 /******/ i: moduleId, 15 /******/ l: false, 16 /******/ exports: {} 17 /******/ }; 18 /******/ 19 /******/ // Execute the module function 20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 /******/ 22 /******/ // Flag the module as loaded 23 /******/ module.l = true; 24 /******/ 25 /******/ // Return the exports of the module 26 /******/ return module.exports; 27 /******/ } 28 /******/ 29 /******/ 30 /******/ // expose the modules object (__webpack_modules__) 31 /******/ __webpack_require__.m = modules; 32 /******/ 33 /******/ // expose the module cache 34 /******/ __webpack_require__.c = installedModules; 35 /******/ 36 /******/ // define getter function for harmony exports 37 /******/ __webpack_require__.d = function(exports, name, getter) { 38 /******/ if(!__webpack_require__.o(exports, name)) { 39 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40 /******/ } 41 /******/ }; 42 /******/ 43 /******/ // define __esModule on exports 44 /******/ __webpack_require__.r = function(exports) { 45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47 /******/ } 48 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 49 /******/ }; 50 /******/ 51 /******/ // create a fake namespace object 52 /******/ // mode & 1: value is a module id, require it 53 /******/ // mode & 2: merge all properties of value into the ns 54 /******/ // mode & 4: return value when already ns object 55 /******/ // mode & 8|1: behave like require 56 /******/ __webpack_require__.t = function(value, mode) { 57 /******/ if(mode & 1) value = __webpack_require__(value); 58 /******/ if(mode & 8) return value; 59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60 /******/ var ns = Object.create(null); 61 /******/ __webpack_require__.r(ns); 62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64 /******/ return ns; 65 /******/ }; 66 /******/ 67 /******/ // getDefaultExport function for compatibility with non-harmony modules 68 /******/ __webpack_require__.n = function(module) { 69 /******/ var getter = module && module.__esModule ? 70 /******/ function getDefault() { return module['default']; } : 71 /******/ function getModuleExports() { return module; }; 72 /******/ __webpack_require__.d(getter, 'a', getter); 73 /******/ return getter; 74 /******/ }; 75 /******/ 76 /******/ // Object.prototype.hasOwnProperty.call 77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78 /******/ 79 /******/ // __webpack_public_path__ 80 /******/ __webpack_require__.p = "/"; 81 /******/ 82 /******/ 83 /******/ // Load entry module and return exports 84 /******/ return __webpack_require__(__webpack_require__.s = 1); 85 /******/ }) 86 /************************************************************************/ 87 /******/ ({ 88 89 /***/ "../assets/js/drop_menu_selection.js": 90 /*!*******************************************!*\ 91 !*** ../assets/js/drop_menu_selection.js ***! 92 \*******************************************/ 93 /*! no static exports found */ 94 /***/ (function(module, exports) { 95 96 /* global jQuery */ 97 (function ($) { 98 // tap event 99 if (!$.event.special.tap) { 100 $.event.special.tap = { 101 setup: function setup(data, namespaces) { 102 var $elem = $(this); 103 $elem.bind('touchstart', $.event.special.tap.handler).bind('touchmove', $.event.special.tap.handler).bind('touchend', $.event.special.tap.handler); 104 }, 105 teardown: function teardown(namespaces) { 106 var $elem = $(this); 107 $elem.unbind('touchstart', $.event.special.tap.handler).unbind('touchmove', $.event.special.tap.handler).unbind('touchend', $.event.special.tap.handler); 108 }, 109 handler: function handler(event) { 110 var $elem = $(this), 111 handleObj = event.handleObj, 112 result; 113 $elem.data(event.type, 1); 114 115 if (event.type === 'touchend' && !$elem.data('touchmove')) { 116 event.type = 'tap'; 117 result = handleObj.handler.call(this, event); 118 } else if ($elem.data('touchend')) { 119 $elem.removeData('touchstart touchmove touchend'); 120 } 121 122 return result; 123 } 124 }; 125 } 126 127 function deselectItems($menu) { 128 $menu.find('[data-selected-item]').each(function () { 129 var $item = $(this); 130 $item.removeAttr('data-selected-item'); 131 var $submenu = $menu.children('ul'); 132 133 if ($menu.is('.mobile-menu')) { 134 $submenu.slideDown(); 135 } 136 }); 137 } 138 139 function clearSelectionWhenTapOutside($this, $menu) { 140 $('body').off('tap.navigation-clear-selection'); 141 $(window).off('scroll.navigation-clear-selection'); 142 143 if ($this.is($menu) || $.contains($menu[0], this)) { 144 return; 145 } 146 147 clearMenuHovers($menu); 148 } 149 150 function selectItem($menu, $item) { 151 deselectItems($menu); 152 $item.attr('data-selected-item', true); 153 clearMenuHovers($menu, $item); 154 $item.addClass('hover'); 155 setOpenReverseClass($menu, $item); 156 $('body').on('tap.navigation-clear-selection', '*', function () { 157 var $this = jQuery(this); 158 clearSelectionWhenTapOutside($this, $menu); 159 }); 160 $(window).on('scroll.navigation-clear-selection', function () { 161 var $this = jQuery(this); 162 clearSelectionWhenTapOutside($this, $menu); 163 }); 164 } 165 166 function isSelectedItem($item) { 167 return $item.is('[data-selected-item]'); 168 } 169 170 function containsSelectedItem($item) { 171 return $item.find('[data-selected-item]').length > 0 || $item.is('[data-selected-item]'); 172 } 173 174 function clearMenuHovers($menu, except) { 175 $menu.find('li.hover').each(function () { 176 if (except && containsSelectedItem($(this))) { 177 return; 178 } 179 180 $(this).removeClass('hover'); 181 }); 182 } 183 184 function getItemLevel($menu, $item) { 185 return $item.parentsUntil('ul.dorpdown-menu').filter('li').length; 186 } 187 188 function setOpenReverseClass($menu, $item) { 189 // level 0 - not in dropdown 190 if (getItemLevel($menu, $item) > 0) { 191 var $submenu = $item.children('ul'); 192 var subItemDoesNotFit = $submenu.length && $item.offset().left + $item.width() + 300 > window.innerWidth; 193 var parentsAreReversed = $submenu.length && $item.closest('.open-reverse').length; 194 195 if (subItemDoesNotFit || parentsAreReversed) { 196 $submenu.addClass('open-reverse'); 197 } else { 198 if ($submenu.length) { 199 $submenu.removeClass('open-reverse'); 200 } 201 } 202 } 203 } 204 205 $('ul.dropdown-menu').each(function () { 206 var $menu = $(this); 207 208 if ($menu.hasClass('mobile-menu')) { 209 var $mobileToggler = $('<a href="#" data-menu-toggler="">Menu</a>'); 210 $menu.before($mobileToggler); // mobile 211 212 $mobileToggler.click(function () { 213 if ($mobileToggler.hasClass('opened')) { 214 $menu.slideUp(300, function () { 215 $menu.css('display', ''); 216 }); 217 $menu.removeClass('mobile-menu'); 218 $mobileToggler.removeClass('opened'); 219 } else { 220 $mobileToggler.addClass('opened'); 221 $menu.slideDown(); 222 $menu.addClass('mobile-menu'); 223 clearMenuHovers($menu); 224 deselectItems($menu); 225 } 226 }); 227 } 228 229 var $currentSelectedItem = $(""); // on tablet 230 231 $menu.on('tap.navigation', 'li.menu-item > a, li.page_item > a', function (event) { 232 var $link = $(this); 233 var $item = $link.parent(); 234 var $submenu = $item.children('ul'); 235 236 if ($submenu.length) { 237 if (isSelectedItem($item)) { 238 var href = $link.attr('href'); // do nothing if nothing 239 240 if (href.indexOf('#') === 0) { 241 var anchor = href.replace('#', '').trim(); 242 243 if (!anchor || !$('#' + anchor).length) { 244 return; 245 } 246 } 247 248 deselectItems($menu); 249 } else { 250 selectItem($menu, $item); 251 event.preventDefault(); 252 event.stopPropagation(); 253 } 254 } else { 255 event.stopPropagation(); 256 deselectItems($menu); 257 } 258 }); 259 $menu.on('mouseover.navigation', 'li', function () { 260 $menu.find('li.hover').removeClass('hover'); 261 setOpenReverseClass($menu, $(this)); 262 }); 263 addMenuScrollSpy($menu); 264 }); 265 266 function addMenuScrollSpy(startFrom) { 267 var $menu = startFrom; 268 269 if ($.fn.scrollSpy) { 270 $menu.find('a').scrollSpy({ 271 onChange: function onChange() { 272 $menu.find('.current-menu-item,.current_page_item').removeClass('current-menu-item current_page_item'); 273 $(this).closest('li').addClass('current-menu-item'); 274 }, 275 onLeave: function onLeave() { 276 $(this).closest('li').removeClass('current-menu-item current_page_item'); 277 }, 278 smoothScrollAnchor: true, 279 offset: function offset() { 280 var $fixed = $('.navigation-bar.fixto-fixed'); 281 282 if ($fixed.length) { 283 return $fixed[0].getBoundingClientRect().height; 284 } 285 286 return 0; 287 } 288 }); 289 } 290 291 $(window).trigger('smoothscroll.update'); 292 } 293 294 $(function () { 295 if (window.wp && window.wp.customize) { 296 jQuery('.offcanvas_menu').find('li > ul').eq(0).each(function () { 297 jQuery(this).show(); 298 jQuery(this).parent().addClass('open'); 299 }); 300 window.wp.customize.selectiveRefresh.bind('render-partials-response', function (response) { 301 var menuKeys = Object.getOwnPropertyNames(response.contents).filter(function (key) { 302 return key.indexOf('nav_menu_instance[') !== -1; 303 }); 304 305 if (menuKeys.length) { 306 setTimeout(function () { 307 $('ul.dropdown-menu').each(function () { 308 addMenuScrollSpy($(this)); 309 }); 310 }, 1000); 311 } 312 }); 313 } 314 }); 315 })(jQuery); 316 317 /***/ }), 318 319 /***/ "../assets/js/kube.js": 320 /*!****************************!*\ 321 !*** ../assets/js/kube.js ***! 322 \****************************/ 323 /*! no static exports found */ 324 /***/ (function(module, exports) { 325 326 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } 327 328 function _typeof(obj) { 329 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { 330 _typeof = function _typeof(obj) { 331 return _typeof2(obj); 332 }; 333 } else { 334 _typeof = function _typeof(obj) { 335 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 336 }; 337 } 338 339 return _typeof(obj); 340 } 341 342 (function ($) { 343 /* 344 Kube. CSS & JS Framework 345 Version 6.5.2 346 Updated: February 2, 2017 347 http://imperavi.com/kube/ 348 Copyright (c) 2009-2017, Imperavi LLC. 349 License: MIT 350 */ 351 if (typeof jQuery === 'undefined') { 352 throw new Error('Kube\'s requires jQuery'); 353 } 354 355 ; 356 357 (function ($) { 358 var version = $.fn.jquery.split('.'); 359 360 if (version[0] == 1 && version[1] < 8) { 361 throw new Error('Kube\'s requires at least jQuery v1.8'); 362 } 363 })(jQuery); 364 365 ; 366 367 (function () { 368 // Inherits 369 Function.prototype.inherits = function (parent) { 370 var F = function F() {}; 371 372 F.prototype = parent.prototype; 373 var f = new F(); 374 375 for (var prop in this.prototype) { 376 f[prop] = this.prototype[prop]; 377 } 378 379 this.prototype = f; 380 this.prototype.super = parent.prototype; 381 }; // Core Class 382 383 384 var Kube = function Kube(element, options) { 385 options = _typeof(options) === 'object' ? options : {}; 386 this.$element = $(element); 387 this.opts = $.extend(true, this.defaults, $.fn[this.namespace].options, this.$element.data(), options); 388 this.$target = typeof this.opts.target === 'string' ? $(this.opts.target) : null; 389 }; // Core Functionality 390 391 392 Kube.prototype = { 393 getInstance: function getInstance() { 394 return this.$element.data('fn.' + this.namespace); 395 }, 396 hasTarget: function hasTarget() { 397 return !(this.$target === null); 398 }, 399 callback: function callback(type) { 400 var args = [].slice.call(arguments).splice(1); // on element callback 401 402 if (this.$element) { 403 args = this._fireCallback($._data(this.$element[0], 'events'), type, this.namespace, args); 404 } // on target callback 405 406 407 if (this.$target) { 408 args = this._fireCallback($._data(this.$target[0], 'events'), type, this.namespace, args); 409 } // opts callback 410 411 412 if (this.opts && this.opts.callbacks && $.isFunction(this.opts.callbacks[type])) { 413 return this.opts.callbacks[type].apply(this, args); 414 } 415 416 return args; 417 }, 418 _fireCallback: function _fireCallback(events, type, eventNamespace, args) { 419 if (events && typeof events[type] !== 'undefined') { 420 var len = events[type].length; 421 422 for (var i = 0; i < len; i++) { 423 var namespace = events[type][i].namespace; 424 425 if (namespace === eventNamespace) { 426 var value = events[type][i].handler.apply(this, args); 427 } 428 } 429 } 430 431 return typeof value === 'undefined' ? args : value; 432 } 433 }; // Scope 434 435 window.MaterialisKube = Kube; 436 })(); 437 /** 438 * @library Kube Plugin 439 * @author Imperavi LLC 440 * @license MIT 441 */ 442 443 444 var Kube = window.MaterialisKube; 445 446 (function (Kube) { 447 Kube.Plugin = { 448 create: function create(classname, pluginname) { 449 pluginname = typeof pluginname === 'undefined' ? classname.toLowerCase() : pluginname; 450 451 $.fn[pluginname] = function (method, options) { 452 var args = Array.prototype.slice.call(arguments, 1); 453 var name = 'fn.' + pluginname; 454 var val = []; 455 this.each(function () { 456 var $this = $(this), 457 data = $this.data(name); 458 options = _typeof(method) === 'object' ? method : options; 459 460 if (!data) { 461 // Initialization 462 $this.data(name, {}); 463 $this.data(name, data = new Kube[classname](this, options)); 464 } // Call methods 465 466 467 if (typeof method === 'string') { 468 if ($.isFunction(data[method])) { 469 var methodVal = data[method].apply(data, args); 470 471 if (methodVal !== undefined) { 472 val.push(methodVal); 473 } 474 } else { 475 $.error('No such method "' + method + '" for ' + classname); 476 } 477 } 478 }); 479 return val.length === 0 || val.length === 1 ? val.length === 0 ? this : val[0] : val; 480 }; 481 482 $.fn[pluginname].options = {}; 483 return this; 484 }, 485 autoload: function autoload(pluginname) { 486 var arr = pluginname.split(','); 487 var len = arr.length; 488 489 for (var i = 0; i < len; i++) { 490 var name = arr[i].toLowerCase().split(',').map(function (s) { 491 return s.trim(); 492 }).join(','); 493 this.autoloadQueue.push(name); 494 } 495 496 return this; 497 }, 498 autoloadQueue: [], 499 startAutoload: function startAutoload() { 500 if (!window.MutationObserver || this.autoloadQueue.length === 0) { 501 return; 502 } 503 504 var self = this; 505 var observer = new MutationObserver(function (mutations) { 506 mutations.forEach(function (mutation) { 507 var newNodes = mutation.addedNodes; 508 509 if (newNodes.length === 0 || newNodes.length === 1 && newNodes.nodeType === 3) { 510 return; 511 } 512 513 self.startAutoloadOnce(); 514 }); 515 }); // pass in the target node, as well as the observer options 516 517 observer.observe(document, { 518 subtree: true, 519 childList: true 520 }); 521 }, 522 startAutoloadOnce: function startAutoloadOnce() { 523 var self = this; 524 var $nodes = $('[data-component]').not('[data-loaded]'); 525 $nodes.each(function () { 526 var $el = $(this); 527 var pluginname = $el.data('component'); 528 529 if (self.autoloadQueue.indexOf(pluginname) !== -1) { 530 $el.attr('data-loaded', true); 531 $el[pluginname](); 532 } 533 }); 534 }, 535 watch: function watch() { 536 Kube.Plugin.startAutoloadOnce(); 537 Kube.Plugin.startAutoload(); 538 } 539 }; 540 $(window).on('load', function () { 541 Kube.Plugin.watch(); 542 }); 543 })(Kube); 544 /** 545 * @library Kube Animation 546 * @author Imperavi LLC 547 * @license MIT 548 */ 549 550 551 (function (Kube) { 552 Kube.Animation = function (element, effect, callback) { 553 this.namespace = 'animation'; 554 this.defaults = {}; // Parent Constructor 555 556 Kube.apply(this, arguments); // Initialization 557 558 this.effect = effect; 559 this.completeCallback = typeof callback === 'undefined' ? false : callback; 560 this.prefixes = ['', '-moz-', '-o-animation-', '-webkit-']; 561 this.queue = []; 562 this.start(); 563 }; 564 565 Kube.Animation.prototype = { 566 start: function start() { 567 if (this.isSlideEffect()) this.setElementHeight(); 568 this.addToQueue(); 569 this.clean(); 570 this.animate(); 571 }, 572 addToQueue: function addToQueue() { 573 this.queue.push(this.effect); 574 }, 575 setElementHeight: function setElementHeight() { 576 this.$element.height(this.$element.height()); 577 }, 578 removeElementHeight: function removeElementHeight() { 579 this.$element.css('height', ''); 580 }, 581 isSlideEffect: function isSlideEffect() { 582 return this.effect === 'slideDown' || this.effect === 'slideUp'; 583 }, 584 isHideableEffect: function isHideableEffect() { 585 var effects = ['fadeOut', 'slideUp', 'flipOut', 'zoomOut', 'slideOutUp', 'slideOutRight', 'slideOutLeft']; 586 return $.inArray(this.effect, effects) !== -1; 587 }, 588 isToggleEffect: function isToggleEffect() { 589 return this.effect === 'show' || this.effect === 'hide'; 590 }, 591 storeHideClasses: function storeHideClasses() { 592 if (this.$element.hasClass('hide-sm')) this.$element.data('hide-sm-class', true);else if (this.$element.hasClass('hide-md')) this.$element.data('hide-md-class', true); 593 }, 594 revertHideClasses: function revertHideClasses() { 595 if (this.$element.data('hide-sm-class')) this.$element.addClass('hide-sm').removeData('hide-sm-class');else if (this.$element.data('hide-md-class')) this.$element.addClass('hide-md').removeData('hide-md-class');else this.$element.addClass('hide'); 596 }, 597 removeHideClass: function removeHideClass() { 598 if (this.$element.data('hide-sm-class')) this.$element.removeClass('hide-sm');else if (this.$element.data('hide-md-class')) this.$element.removeClass('hide-md');else this.$element.removeClass('hide'); 599 }, 600 animate: function animate() { 601 this.storeHideClasses(); 602 603 if (this.isToggleEffect()) { 604 return this.makeSimpleEffects(); 605 } 606 607 this.$element.addClass('kubeanimated'); 608 this.$element.addClass(this.queue[0]); 609 this.removeHideClass(); 610 611 var _callback = this.queue.length > 1 ? null : this.completeCallback; 612 613 this.complete('AnimationEnd', $.proxy(this.makeComplete, this), _callback); 614 }, 615 makeSimpleEffects: function makeSimpleEffects() { 616 if (this.effect === 'show') this.removeHideClass();else if (this.effect === 'hide') this.revertHideClasses(); 617 if (typeof this.completeCallback === 'function') this.completeCallback(this); 618 }, 619 makeComplete: function makeComplete() { 620 if (this.$element.hasClass(this.queue[0])) { 621 this.clean(); 622 this.queue.shift(); 623 if (this.queue.length) this.animate(); 624 } 625 }, 626 complete: function complete(type, make, callback) { 627 var events = type.split(' ').map(function (type) { 628 return type.toLowerCase() + ' webkit' + type + ' o' + type + ' MS' + type; 629 }); 630 this.$element.one(events.join(' '), $.proxy(function () { 631 if (typeof make === 'function') make(); 632 if (this.isHideableEffect()) this.revertHideClasses(); 633 if (this.isSlideEffect()) this.removeElementHeight(); 634 if (typeof callback === 'function') callback(this); 635 this.$element.off(event); 636 }, this)); 637 }, 638 clean: function clean() { 639 this.$element.removeClass('kubeanimated').removeClass(this.queue[0]); 640 } 641 }; // Inheritance 642 643 Kube.Animation.inherits(Kube); 644 })(Kube); // Plugin 645 646 647 (function ($) { 648 $.fn.animation = function (effect, callback) { 649 var name = 'fn.animation'; 650 return this.each(function () { 651 var $this = $(this), 652 data = $this.data(name); 653 $this.data(name, {}); 654 $this.data(name, data = new Kube.Animation(this, effect, callback)); 655 }); 656 }; 657 658 $.fn.animation.options = {}; 659 })(jQuery); 660 /** 661 * @library Kube Detect 662 * @author Imperavi LLC 663 * @license MIT 664 */ 665 666 667 (function (Kube) { 668 Kube.Detect = function () {}; 669 670 Kube.Detect.prototype = { 671 isMobile: function isMobile() { 672 return /(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent); 673 }, 674 isDesktop: function isDesktop() { 675 return !/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent); 676 }, 677 isMobileScreen: function isMobileScreen() { 678 return $(window).width() <= 768; 679 }, 680 isTabletScreen: function isTabletScreen() { 681 return $(window).width() >= 768 && $(window).width() <= 1024; 682 }, 683 isDesktopScreen: function isDesktopScreen() { 684 return $(window).width() > 1024; 685 } 686 }; 687 })(Kube); 688 /** 689 * @library Kube FormData 690 * @author Imperavi LLC 691 * @license MIT 692 */ 693 694 695 (function (Kube) { 696 Kube.FormData = function (app) { 697 this.opts = app.opts; 698 }; 699 700 Kube.FormData.prototype = { 701 set: function set(data) { 702 this.data = data; 703 }, 704 get: function get(formdata) { 705 this.formdata = formdata; 706 if (this.opts.appendForms) this.appendForms(); 707 if (this.opts.appendFields) this.appendFields(); 708 return this.data; 709 }, 710 appendFields: function appendFields() { 711 var $fields = $(this.opts.appendFields); 712 713 if ($fields.length === 0) { 714 return; 715 } 716 717 var self = this; 718 var str = ''; 719 720 if (this.formdata) { 721 $fields.each(function () { 722 self.data.append($(this).attr('name'), $(this).val()); 723 }); 724 } else { 725 $fields.each(function () { 726 str += '&' + $(this).attr('name') + '=' + $(this).val(); 727 }); 728 this.data = this.data === '' ? str.replace(/^&/, '') : this.data + str; 729 } 730 }, 731 appendForms: function appendForms() { 732 var $forms = $(this.opts.appendForms); 733 734 if ($forms.length === 0) { 735 return; 736 } 737 738 if (this.formdata) { 739 var self = this; 740 var formsData = $(this.opts.appendForms).serializeArray(); 741 $.each(formsData, function (i, s) { 742 self.data.append(s.name, s.value); 743 }); 744 } else { 745 var str = $forms.serialize(); 746 this.data = this.data === '' ? str : this.data + '&' + str; 747 } 748 } 749 }; 750 })(Kube); 751 /** 752 * @library Kube Response 753 * @author Imperavi LLC 754 * @license MIT 755 */ 756 757 758 (function (Kube) { 759 Kube.Response = function (app) {}; 760 761 Kube.Response.prototype = { 762 parse: function parse(str) { 763 if (str === '') return false; 764 var obj = {}; 765 766 try { 767 obj = JSON.parse(str); 768 } catch (e) { 769 return false; 770 } 771 772 if (obj[0] !== undefined) { 773 for (var item in obj) { 774 this.parseItem(obj[item]); 775 } 776 } else { 777 this.parseItem(obj); 778 } 779 780 return obj; 781 }, 782 parseItem: function parseItem(item) { 783 if (item.type === 'value') { 784 $.each(item.data, $.proxy(function (key, val) { 785 val = val === null || val === false ? 0 : val; 786 val = val === true ? 1 : val; 787 $(key).val(val); 788 }, this)); 789 } else if (item.type === 'html') { 790 $.each(item.data, $.proxy(function (key, val) { 791 val = val === null || val === false ? '' : val; 792 $(key).html(this.stripslashes(val)); 793 }, this)); 794 } else if (item.type === 'addClass') { 795 $.each(item.data, function (key, val) { 796 $(key).addClass(val); 797 }); 798 } else if (item.type === 'removeClass') { 799 $.each(item.data, function (key, val) { 800 $(key).removeClass(val); 801 }); 802 } else if (item.type === 'command') { 803 $.each(item.data, function (key, val) { 804 $(val)[key](); 805 }); 806 } else if (item.type === 'animation') { 807 $.each(item.data, function (key, data) { 808 data.opts = typeof data.opts === 'undefined' ? {} : data.opts; 809 $(key).animation(data.name, data.opts); 810 }); 811 } else if (item.type === 'location') { 812 top.location.href = item.data; 813 } else if (item.type === 'notify') { 814 $.notify(item.data); 815 } 816 817 return item; 818 }, 819 stripslashes: function stripslashes(str) { 820 return (str + '').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1'); 821 } 822 }; 823 })(Kube); 824 /** 825 * @library Kube Utils 826 * @author Imperavi LLC 827 * @license MIT 828 */ 829 830 831 (function (Kube) { 832 Kube.Utils = function () {}; 833 834 Kube.Utils.prototype = { 835 disableBodyScroll: function disableBodyScroll() { 836 var $body = $('html'); 837 var windowWidth = window.innerWidth; 838 839 if (!windowWidth) { 840 var documentElementRect = document.documentElement.getBoundingClientRect(); 841 windowWidth = documentElementRect.right - Math.abs(documentElementRect.left); 842 } 843 844 var isOverflowing = document.body.clientWidth < windowWidth; 845 var scrollbarWidth = this.measureScrollbar(); 846 $body.css('overflow', 'hidden'); 847 if (isOverflowing) $body.css('padding-right', scrollbarWidth); 848 }, 849 measureScrollbar: function measureScrollbar() { 850 var $body = $('body'); 851 var scrollDiv = document.createElement('div'); 852 scrollDiv.className = 'scrollbar-measure'; 853 $body.append(scrollDiv); 854 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 855 $body[0].removeChild(scrollDiv); 856 return scrollbarWidth; 857 }, 858 enableBodyScroll: function enableBodyScroll() { 859 $('html').css({ 860 'overflow': '', 861 'padding-right': '' 862 }); 863 } 864 }; 865 })(Kube); 866 /** 867 * @library Kube Message 868 * @author Imperavi LLC 869 * @license MIT 870 */ 871 872 873 (function (Kube) { 874 Kube.Message = function (element, options) { 875 this.namespace = 'message'; 876 this.defaults = { 877 closeSelector: '.close', 878 closeEvent: 'click', 879 animationOpen: 'fadeIn', 880 animationClose: 'fadeOut', 881 callbacks: ['open', 'opened', 'close', 'closed'] 882 }; // Parent Constructor 883 884 Kube.apply(this, arguments); // Initialization 885 886 this.start(); 887 }; // Functionality 888 889 890 Kube.Message.prototype = { 891 start: function start() { 892 this.$close = this.$element.find(this.opts.closeSelector); 893 this.$close.on(this.opts.closeEvent + '.' + this.namespace, $.proxy(this.close, this)); 894 this.$element.addClass('open'); 895 }, 896 stop: function stop() { 897 this.$close.off('.' + this.namespace); 898 this.$element.removeClass('open'); 899 }, 900 open: function open(e) { 901 if (e) e.preventDefault(); 902 903 if (!this.isOpened()) { 904 this.callback('open'); 905 this.$element.animation(this.opts.animationOpen, $.proxy(this.onOpened, this)); 906 } 907 }, 908 isOpened: function isOpened() { 909 return this.$element.hasClass('open'); 910 }, 911 onOpened: function onOpened() { 912 this.callback('opened'); 913 this.$element.addClass('open'); 914 }, 915 close: function close(e) { 916 if (e) e.preventDefault(); 917 918 if (this.isOpened()) { 919 this.callback('close'); 920 this.$element.animation(this.opts.animationClose, $.proxy(this.onClosed, this)); 921 } 922 }, 923 onClosed: function onClosed() { 924 this.callback('closed'); 925 this.$element.removeClass('open'); 926 } 927 }; // Inheritance 928 929 Kube.Message.inherits(Kube); // Plugin 930 931 Kube.Plugin.create('Message'); 932 Kube.Plugin.autoload('Message'); 933 })(Kube); 934 /** 935 * @library Kube Sticky 936 * @author Imperavi LLC 937 * @license MIT 938 */ 939 940 941 (function (Kube) { 942 Kube.Sticky = function (element, options) { 943 this.namespace = 'sticky'; 944 this.defaults = { 945 classname: 'fixed', 946 offset: 0, 947 // pixels 948 callbacks: ['fixed', 'unfixed'] 949 }; // Parent Constructor 950 951 Kube.apply(this, arguments); // Initialization 952 953 this.start(); 954 }; // Functionality 955 956 957 Kube.Sticky.prototype = { 958 start: function start() { 959 this.offsetTop = this.getOffsetTop(); 960 this.load(); 961 $(window).scroll($.proxy(this.load, this)); 962 }, 963 getOffsetTop: function getOffsetTop() { 964 return this.$element.offset().top; 965 }, 966 load: function load() { 967 return this.isFix() ? this.fixed() : this.unfixed(); 968 }, 969 isFix: function isFix() { 970 return $(window).scrollTop() > this.offsetTop + this.opts.offset; 971 }, 972 fixed: function fixed() { 973 this.$element.addClass(this.opts.classname).css('top', this.opts.offset + 'px'); 974 this.callback('fixed'); 975 }, 976 unfixed: function unfixed() { 977 this.$element.removeClass(this.opts.classname).css('top', ''); 978 this.callback('unfixed'); 979 } 980 }; // Inheritance 981 982 Kube.Sticky.inherits(Kube); // Plugin 983 984 Kube.Plugin.create('Sticky'); 985 Kube.Plugin.autoload('Sticky'); 986 })(Kube); 987 /** 988 * @library Kube Toggleme 989 * @author Imperavi LLC 990 * @license MIT 991 */ 992 993 994 (function (Kube) { 995 Kube.Toggleme = function (element, options) { 996 this.namespace = 'toggleme'; 997 this.defaults = { 998 toggleEvent: 'click', 999 target: null, 1000 text: '', 1001 animationOpen: 'slideDown', 1002 animationClose: 'slideUp', 1003 callbacks: ['open', 'opened', 'close', 'closed'] 1004 }; // Parent Constructor 1005 1006 Kube.apply(this, arguments); // Initialization 1007 1008 this.start(); 1009 }; // Functionality 1010 1011 1012 Kube.Toggleme.prototype = { 1013 start: function start() { 1014 if (!this.hasTarget()) return; 1015 this.$element.on(this.opts.toggleEvent + '.' + this.namespace, $.proxy(this.toggle, this)); 1016 }, 1017 stop: function stop() { 1018 this.$element.off('.' + this.namespace); 1019 this.revertText(); 1020 }, 1021 toggle: function toggle(e) { 1022 if (this.isOpened()) this.close(e);else this.open(e); 1023 }, 1024 open: function open(e) { 1025 if (e) e.preventDefault(); 1026 1027 if (!this.isOpened()) { 1028 this.storeText(); 1029 this.callback('open'); 1030 this.$target.animation('slideDown', $.proxy(this.onOpened, this)); // changes the text of $element with a less delay to smooth 1031 1032 setTimeout($.proxy(this.replaceText, this), 100); 1033 } 1034 }, 1035 close: function close(e) { 1036 if (e) e.preventDefault(); 1037 1038 if (this.isOpened()) { 1039 this.callback('close'); 1040 this.$target.animation('slideUp', $.proxy(this.onClosed, this)); 1041 } 1042 }, 1043 isOpened: function isOpened() { 1044 return this.$target.hasClass('open'); 1045 }, 1046 onOpened: function onOpened() { 1047 this.$target.addClass('open'); 1048 this.callback('opened'); 1049 }, 1050 onClosed: function onClosed() { 1051 this.$target.removeClass('open'); 1052 this.revertText(); 1053 this.callback('closed'); 1054 }, 1055 storeText: function storeText() { 1056 this.$element.data('replacement-text', this.$element.html()); 1057 }, 1058 revertText: function revertText() { 1059 var text = this.$element.data('replacement-text'); 1060 if (text) this.$element.html(text); 1061 this.$element.removeData('replacement-text'); 1062 }, 1063 replaceText: function replaceText() { 1064 if (this.opts.text !== '') { 1065 this.$element.html(this.opts.text); 1066 } 1067 } 1068 }; // Inheritance 1069 1070 Kube.Toggleme.inherits(Kube); // Plugin 1071 1072 Kube.Plugin.create('Toggleme'); 1073 Kube.Plugin.autoload('Toggleme'); 1074 })(Kube); 1075 /** 1076 * @library Kube Offcanvas 1077 * @author Imperavi LLC 1078 * @license MIT 1079 */ 1080 1081 1082 (function (Kube) { 1083 Kube.Offcanvas = function (element, options) { 1084 this.namespace = 'offcanvas'; 1085 this.defaults = { 1086 target: null, 1087 // selector 1088 push: true, 1089 // boolean 1090 width: '250px', 1091 // string 1092 direction: 'left', 1093 // string: left or right 1094 toggleEvent: 'click', 1095 clickOutside: true, 1096 // boolean 1097 animationOpen: 'slideInLeft', 1098 animationClose: 'slideOutLeft', 1099 callbacks: ['open', 'opened', 'close', 'closed'] 1100 }; // Parent Constructor 1101 1102 Kube.apply(this, arguments); // Services 1103 1104 this.utils = new Kube.Utils(); 1105 this.detect = new Kube.Detect(); // Initialization 1106 1107 this.start(); 1108 }; // Functionality 1109 1110 1111 Kube.Offcanvas.prototype = { 1112 start: function start() { 1113 if (!this.hasTarget()) return; 1114 this.buildTargetWidth(); 1115 this.buildAnimationDirection(); 1116 this.$close = this.getCloseLink(); 1117 this.$element.on(this.opts.toggleEvent + '.' + this.namespace, $.proxy(this.toggle, this)); 1118 this.$target.addClass('offcanvas'); 1119 this.$target.trigger('kube.offcanvas.ready'); 1120 }, 1121 stop: function stop() { 1122 this.closeAll(); 1123 this.$element.off('.' + this.namespace); 1124 this.$close.off('.' + this.namespace); 1125 $(document).off('.' + this.namespace); 1126 }, 1127 toggle: function toggle(e) { 1128 if (this.isOpened()) this.close(e);else this.open(e); 1129 }, 1130 buildTargetWidth: function buildTargetWidth() { 1131 this.opts.width = $(window).width() < parseInt(this.opts.width) ? '100%' : this.opts.width; 1132 }, 1133 buildAnimationDirection: function buildAnimationDirection() { 1134 if (this.opts.direction === 'right') { 1135 this.opts.animationOpen = 'slideInRight'; 1136 this.opts.animationClose = 'slideOutRight'; 1137 } 1138 }, 1139 getCloseLink: function getCloseLink() { 1140 return this.$target.find('.close'); 1141 }, 1142 open: function open(e) { 1143 if (e) e.preventDefault(); 1144 1145 if (!this.isOpened()) { 1146 this.closeAll(); 1147 this.callback('open'); 1148 this.$target.addClass('offcanvas-' + this.opts.direction); 1149 this.$target.css('width', Math.min(parseInt(this.opts.width), window.innerWidth - 100)); 1150 this.$target.css('right', '-' + Math.min(parseInt(this.opts.width), window.innerWidth - 100)); 1151 this.pushBody(); 1152 this.$target.trigger('kube.offcanvas.open'); 1153 this.$target.animation(this.opts.animationOpen, $.proxy(this.onOpened, this)); 1154 } 1155 }, 1156 closeAll: function closeAll() { 1157 var $elms = $(document).find('.offcanvas'); 1158 1159 if ($elms.length !== 0) { 1160 $elms.each(function () { 1161 var $el = $(this); 1162 1163 if ($el.hasClass('open')) { 1164 $el.css('width', '').animation('hide'); 1165 $el.removeClass('open offcanvas-left offcanvas-right'); 1166 } 1167 }); 1168 $(document).off('.' + this.namespace); 1169 $('body').css('left', ''); 1170 } 1171 }, 1172 close: function close(e) { 1173 if (e) { 1174 var $el = $(e.target); 1175 var tagName = $el[0].tagName; 1176 var isTag = tagName === 'A' || tagName === 'BUTTON' || tagName === 'I' || $el.parents('a').length; 1177 1178 if (isTag && $el.closest('.offcanvas').length !== 0 && !$el.hasClass('close')) { 1179 return; 1180 } 1181 1182 e.preventDefault(); 1183 } 1184 1185 if (this.isOpened()) { 1186 this.utils.enableBodyScroll(); 1187 this.callback('close'); 1188 this.pullBody(); 1189 this.$target.trigger('kube.offcanvas.close'); 1190 this.$target.animation(this.opts.animationClose, $.proxy(this.onClosed, this)); 1191 } 1192 }, 1193 isOpened: function isOpened() { 1194 return this.$target.hasClass('open'); 1195 }, 1196 onOpened: function onOpened() { 1197 if (this.opts.clickOutside) $(document).on('click.' + this.namespace + ' tap.' + this.namespace, $.proxy(this.close, this)); 1198 if (this.detect.isMobileScreen()) $('html').addClass('no-scroll'); 1199 $(document).on('keyup.' + this.namespace, $.proxy(this.handleKeyboard, this)); 1200 this.$close.on('click.' + this.namespace, $.proxy(this.close, this)); 1201 this.utils.disableBodyScroll(); 1202 this.$target.addClass('open'); 1203 this.callback('opened'); 1204 }, 1205 onClosed: function onClosed() { 1206 if (this.detect.isMobileScreen()) $('html').removeClass('no-scroll'); 1207 this.$target.css('width', '').removeClass('offcanvas-' + this.opts.direction); 1208 this.$close.off('.' + this.namespace); 1209 $(document).off('.' + this.namespace); 1210 this.$target.removeClass('open'); 1211 this.callback('closed'); 1212 this.$target.trigger('kube.offcanvas.closed'); 1213 }, 1214 handleKeyboard: function handleKeyboard(e) { 1215 if (e.which === 27) this.close(); 1216 }, 1217 pullBody: function pullBody() { 1218 if (this.opts.push) { 1219 $('body').animate({ 1220 left: 0 1221 }, 350, function () { 1222 $(this).removeClass('offcanvas-push-body'); 1223 }); 1224 } 1225 }, 1226 pushBody: function pushBody() { 1227 if (this.opts.push) { 1228 var properties = this.opts.direction === 'left' ? { 1229 'left': this.opts.width 1230 } : { 1231 'left': '-' + this.opts.width 1232 }; 1233 $('body').addClass('offcanvas-push-body').animate(properties, 200); 1234 } 1235 } 1236 }; // Inheritance 1237 1238 Kube.Offcanvas.inherits(Kube); // Plugin 1239 1240 Kube.Plugin.create('Offcanvas'); 1241 Kube.Plugin.autoload('Offcanvas'); 1242 })(Kube); 1243 /** 1244 * @library Kube Collapse 1245 * @author Imperavi LLC 1246 * @license MIT 1247 */ 1248 1249 1250 (function (Kube) { 1251 Kube.Collapse = function (element, options) { 1252 this.namespace = 'collapse'; 1253 this.defaults = { 1254 target: null, 1255 toggle: true, 1256 active: false, 1257 // string (hash = tab id selector) 1258 toggleClass: 'collapse-toggle', 1259 boxClass: 'collapse-box', 1260 callbacks: ['open', 'opened', 'close', 'closed'], 1261 // private 1262 hashes: [], 1263 currentHash: false, 1264 currentItem: false 1265 }; // Parent Constructor 1266 1267 Kube.apply(this, arguments); // Initialization 1268 1269 this.start(); 1270 }; // Functionality 1271 1272 1273 Kube.Collapse.prototype = { 1274 start: function start() { 1275 // items 1276 this.$items = this.getItems(); 1277 this.$items.each($.proxy(this.loadItems, this)); // boxes 1278 1279 this.$boxes = this.getBoxes(); // active 1280 1281 this.setActiveItem(); 1282 }, 1283 getItems: function getItems() { 1284 return this.$element.find('.' + this.opts.toggleClass); 1285 }, 1286 getBoxes: function getBoxes() { 1287 return this.$element.find('.' + this.opts.boxClass); 1288 }, 1289 loadItems: function loadItems(i, el) { 1290 var item = this.getItem(el); // set item identificator 1291 1292 item.$el.attr('rel', item.hash); // active 1293 1294 if (!$(item.hash).hasClass('hide')) { 1295 this.opts.currentItem = item; 1296 this.opts.active = item.hash; 1297 item.$el.addClass('active'); 1298 } // event 1299 1300 1301 item.$el.on('click.collapse', $.proxy(this.toggle, this)); 1302 }, 1303 setActiveItem: function setActiveItem() { 1304 if (this.opts.active !== false) { 1305 this.opts.currentItem = this.getItemBy(this.opts.active); 1306 this.opts.active = this.opts.currentItem.hash; 1307 } 1308 1309 if (this.opts.currentItem !== false) { 1310 this.addActive(this.opts.currentItem); 1311 this.opts.currentItem.$box.removeClass('hide'); 1312 } 1313 }, 1314 addActive: function addActive(item) { 1315 item.$box.removeClass('hide').addClass('open'); 1316 item.$el.addClass('active'); 1317 if (item.$caret !== false) item.$caret.removeClass('down').addClass('up'); 1318 if (item.$parent !== false) item.$parent.addClass('active'); 1319 this.opts.currentItem = item; 1320 }, 1321 removeActive: function removeActive(item) { 1322 item.$box.removeClass('open'); 1323 item.$el.removeClass('active'); 1324 if (item.$caret !== false) item.$caret.addClass('down').removeClass('up'); 1325 if (item.$parent !== false) item.$parent.removeClass('active'); 1326 this.opts.currentItem = false; 1327 }, 1328 toggle: function toggle(e) { 1329 if (e) e.preventDefault(); 1330 var target = $(e.target).closest('.' + this.opts.toggleClass).get(0) || e.target; 1331 var item = this.getItem(target); 1332 if (this.isOpened(item.hash)) this.close(item.hash);else this.open(e); 1333 }, 1334 openAll: function openAll() { 1335 this.$items.addClass('active'); 1336 this.$boxes.addClass('open').removeClass('hide'); 1337 }, 1338 open: function open(e, push) { 1339 if (typeof e === 'undefined') return; 1340 if (_typeof(e) === 'object') e.preventDefault(); 1341 var target = $(e.target).closest('.' + this.opts.toggleClass).get(0) || e.target; 1342 var item = _typeof(e) === 'object' ? this.getItem(target) : this.getItemBy(e); 1343 1344 if (item.$box.hasClass('open')) { 1345 return; 1346 } 1347 1348 if (this.opts.toggle) this.closeAll(); 1349 this.callback('open', item); 1350 this.addActive(item); 1351 item.$box.animation('slideDown', $.proxy(this.onOpened, this)); 1352 }, 1353 onOpened: function onOpened() { 1354 this.callback('opened', this.opts.currentItem); 1355 }, 1356 closeAll: function closeAll() { 1357 this.$items.removeClass('active').closest('li').removeClass('active'); 1358 this.$boxes.removeClass('open').addClass('hide'); 1359 }, 1360 close: function close(num) { 1361 var item = this.getItemBy(num); 1362 this.callback('close', item); 1363 this.opts.currentItem = item; 1364 item.$box.animation('slideUp', $.proxy(this.onClosed, this)); 1365 }, 1366 onClosed: function onClosed() { 1367 var item = this.opts.currentItem; 1368 this.removeActive(item); 1369 this.callback('closed', item); 1370 }, 1371 isOpened: function isOpened(hash) { 1372 return $(hash).hasClass('open'); 1373 }, 1374 getItem: function getItem(element) { 1375 var item = {}; 1376 item.$el = $(element); 1377 item.hash = item.$el.attr('href'); 1378 item.$box = $(item.hash); 1379 var $parent = item.$el.parent(); 1380 item.$parent = $parent[0].tagName === 'LI' ? $parent : false; 1381 var $caret = item.$el.find('.caret'); 1382 item.$caret = $caret.length !== 0 ? $caret : false; 1383 return item; 1384 }, 1385 getItemBy: function getItemBy(num) { 1386 var element = typeof num === 'number' ? this.$items.eq(num - 1) : this.$element.find('[rel="' + num + '"]'); 1387 return this.getItem(element); 1388 } 1389 }; // Inheritance 1390 1391 Kube.Collapse.inherits(Kube); // Plugin 1392 1393 Kube.Plugin.create('Collapse'); 1394 Kube.Plugin.autoload('Collapse'); 1395 })(Kube); 1396 /** 1397 * @library Kube Dropdown 1398 * @author Imperavi LLC 1399 * @license MIT 1400 */ 1401 1402 1403 (function (Kube) { 1404 Kube.Dropdown = function (element, options) { 1405 this.namespace = 'dropdown'; 1406 this.defaults = { 1407 target: null, 1408 toggleEvent: 'click', 1409 height: false, 1410 // integer 1411 width: false, 1412 // integer 1413 animationOpen: 'slideDown', 1414 animationClose: 'slideUp', 1415 caretUp: false, 1416 callbacks: ['open', 'opened', 'close', 'closed'] 1417 }; // Parent Constructor 1418 1419 Kube.apply(this, arguments); // Services 1420 1421 this.utils = new Kube.Utils(); 1422 this.detect = new Kube.Detect(); // Initialization 1423 1424 this.start(); 1425 }; // Functionality 1426 1427 1428 Kube.Dropdown.prototype = { 1429 start: function start() { 1430 this.buildClose(); 1431 this.buildCaret(); 1432 if (this.detect.isMobile()) this.buildMobileAnimation(); 1433 this.$target.addClass('hide'); 1434 this.$element.on(this.opts.toggleEvent + '.' + this.namespace, $.proxy(this.toggle, this)); 1435 }, 1436 stop: function stop() { 1437 this.$element.off('.' + this.namespace); 1438 this.$target.removeClass('open').addClass('hide'); 1439 this.disableEvents(); 1440 }, 1441 buildMobileAnimation: function buildMobileAnimation() { 1442 this.opts.animationOpen = 'fadeIn'; 1443 this.opts.animationClose = 'fadeOut'; 1444 }, 1445 buildClose: function buildClose() { 1446 this.$close = this.$target.find('.close'); 1447 }, 1448 buildCaret: function buildCaret() { 1449 this.$caret = this.getCaret(); 1450 this.buildCaretPosition(); 1451 }, 1452 buildCaretPosition: function buildCaretPosition() { 1453 var height = this.$element.offset().top + this.$element.innerHeight() + this.$target.innerHeight(); 1454 1455 if ($(document).height() > height) { 1456 return; 1457 } 1458 1459 this.opts.caretUp = true; 1460 this.$caret.addClass('up'); 1461 }, 1462 getCaret: function getCaret() { 1463 return this.$element.find('.caret'); 1464 }, 1465 toggleCaretOpen: function toggleCaretOpen() { 1466 if (this.opts.caretUp) this.$caret.removeClass('up').addClass('down');else this.$caret.removeClass('down').addClass('up'); 1467 }, 1468 toggleCaretClose: function toggleCaretClose() { 1469 if (this.opts.caretUp) this.$caret.removeClass('down').addClass('up');else this.$caret.removeClass('up').addClass('down'); 1470 }, 1471 toggle: function toggle(e) { 1472 if (this.isOpened()) this.close(e);else this.open(e); 1473 }, 1474 open: function open(e) { 1475 if (e) e.preventDefault(); 1476 this.callback('open'); 1477 $('.dropdown').removeClass('open').addClass('hide'); 1478 if (this.opts.height) this.$target.css('min-height', this.opts.height + 'px'); 1479 if (this.opts.width) this.$target.width(this.opts.width); 1480 this.setPosition(); 1481 this.toggleCaretOpen(); 1482 this.$target.animation(this.opts.animationOpen, $.proxy(this.onOpened, this)); 1483 }, 1484 close: function close(e) { 1485 if (!this.isOpened()) { 1486 return; 1487 } 1488 1489 if (e) { 1490 if (this.shouldNotBeClosed(e.target)) { 1491 return; 1492 } 1493 1494 e.preventDefault(); 1495 } 1496 1497 this.utils.enableBodyScroll(); 1498 this.callback('close'); 1499 this.toggleCaretClose(); 1500 this.$target.animation(this.opts.animationClose, $.proxy(this.onClosed, this)); 1501 }, 1502 onClosed: function onClosed() { 1503 this.$target.removeClass('open'); 1504 this.disableEvents(); 1505 this.callback('closed'); 1506 }, 1507 onOpened: function onOpened() { 1508 this.$target.addClass('open'); 1509 this.enableEvents(); 1510 this.callback('opened'); 1511 }, 1512 isOpened: function isOpened() { 1513 return this.$target.hasClass('open'); 1514 }, 1515 enableEvents: function enableEvents() { 1516 if (this.detect.isDesktop()) { 1517 this.$target.on('mouseover.' + this.namespace, $.proxy(this.utils.disableBodyScroll, this.utils)).on('mouseout.' + this.namespace, $.proxy(this.utils.enableBodyScroll, this.utils)); 1518 } 1519 1520 $(document).on('scroll.' + this.namespace, $.proxy(this.setPosition, this)); 1521 $(window).on('resize.' + this.namespace, $.proxy(this.setPosition, this)); 1522 $(document).on('click.' + this.namespace + ' touchstart.' + this.namespace, $.proxy(this.close, this)); 1523 $(document).on('keydown.' + this.namespace, $.proxy(this.handleKeyboard, this)); 1524 this.$target.find('[data-action="dropdown-close"]').on('click.' + this.namespace, $.proxy(this.close, this)); 1525 }, 1526 disableEvents: function disableEvents() { 1527 this.$target.off('.' + this.namespace); 1528 $(document).off('.' + this.namespace); 1529 $(window).off('.' + this.namespace); 1530 }, 1531 handleKeyboard: function handleKeyboard(e) { 1532 if (e.which === 27) this.close(e); 1533 }, 1534 shouldNotBeClosed: function shouldNotBeClosed(el) { 1535 if ($(el).attr('data-action') === 'dropdown-close' || el === this.$close[0]) { 1536 return false; 1537 } else if ($(el).closest('.dropdown').length === 0) { 1538 return false; 1539 } 1540 1541 return true; 1542 }, 1543 isNavigationFixed: function isNavigationFixed() { 1544 return this.$element.closest('.fixed').length !== 0; 1545 }, 1546 getPlacement: function getPlacement(height) { 1547 return $(document).height() < height ? 'top' : 'bottom'; 1548 }, 1549 getOffset: function getOffset(position) { 1550 return this.isNavigationFixed() ? this.$element.position() : this.$element.offset(); 1551 }, 1552 getPosition: function getPosition() { 1553 return this.isNavigationFixed() ? 'fixed' : 'absolute'; 1554 }, 1555 setPosition: function setPosition() { 1556 if (this.detect.isMobile()) { 1557 this.$target.addClass('dropdown-mobile'); 1558 return; 1559 } 1560 1561 var position = this.getPosition(); 1562 var coords = this.getOffset(position); 1563 var height = this.$target.innerHeight(); 1564 var width = this.$target.innerWidth(); 1565 var placement = this.getPlacement(coords.top + height + this.$element.innerHeight()); 1566 var leftFix = $(window).width() < coords.left + width ? width - this.$element.innerWidth() : 0; 1567 var top, 1568 left = coords.left - leftFix; 1569 1570 if (placement === 'bottom') { 1571 if (!this.isOpened()) this.$caret.removeClass('up').addClass('down'); 1572 this.opts.caretUp = false; 1573 top = coords.top + this.$element.outerHeight() + 1; 1574 } else { 1575 this.opts.animationOpen = 'show'; 1576 this.opts.animationClose = 'hide'; 1577 if (!this.isOpened()) this.$caret.addClass('up').removeClass('down'); 1578 this.opts.caretUp = true; 1579 top = coords.top - height - 1; 1580 } 1581 1582 this.$target.css({ 1583 position: position, 1584 top: top + 'px', 1585 left: left + 'px' 1586 }); 1587 } 1588 }; // Inheritance 1589 1590 Kube.Dropdown.inherits(Kube); // Plugin 1591 1592 Kube.Plugin.create('Dropdown'); 1593 Kube.Plugin.autoload('Dropdown'); 1594 })(Kube); 1595 /** 1596 * @library Kube Tabs 1597 * @author Imperavi LLC 1598 * @license MIT 1599 */ 1600 1601 1602 (function (Kube) { 1603 Kube.Tabs = function (element, options) { 1604 this.namespace = 'tabs'; 1605 this.defaults = { 1606 equals: false, 1607 active: false, 1608 // string (hash = tab id selector) 1609 live: false, 1610 // class selector 1611 hash: true, 1612 //boolean 1613 callbacks: ['init', 'next', 'prev', 'open', 'opened', 'close', 'closed'] 1614 }; // Parent Constructor 1615 1616 Kube.apply(this, arguments); // Initialization 1617 1618 this.start(); 1619 }; // Functionality 1620 1621 1622 Kube.Tabs.prototype = { 1623 start: function start() { 1624 if (this.opts.live !== false) this.buildLiveTabs(); 1625 this.tabsCollection = []; 1626 this.hashesCollection = []; 1627 this.currentHash = []; 1628 this.currentItem = false; // items 1629 1630 this.$items = this.getItems(); 1631 this.$items.each($.proxy(this.loadItems, this)); // tabs 1632 1633 this.$tabs = this.getTabs(); // location hash 1634 1635 this.currentHash = this.getLocationHash(); // close all 1636 1637 this.closeAll(); // active & height 1638 1639 this.setActiveItem(); 1640 this.setItemHeight(); // callback 1641 1642 this.callback('init'); 1643 }, 1644 getTabs: function getTabs() { 1645 return $(this.tabsCollection).map(function () { 1646 return this.toArray(); 1647 }); 1648 }, 1649 getItems: function getItems() { 1650 return this.$element.find('a'); 1651 }, 1652 loadItems: function loadItems(i, el) { 1653 var item = this.getItem(el); // set item identificator 1654 1655 item.$el.attr('rel', item.hash); // collect item 1656 1657 this.collectItem(item); // active 1658 1659 if (item.$parent.hasClass('active')) { 1660 this.currentItem = item; 1661 this.opts.active = item.hash; 1662 } // event 1663 1664 1665 item.$el.on('click.tabs', $.proxy(this.open, this)); 1666 }, 1667 collectItem: function collectItem(item) { 1668 this.tabsCollection.push(item.$tab); 1669 this.hashesCollection.push(item.hash); 1670 }, 1671 buildLiveTabs: function buildLiveTabs() { 1672 var $layers = $(this.opts.live); 1673 1674 if ($layers.length === 0) { 1675 return; 1676 } 1677 1678 this.$liveTabsList = $('<ul />'); 1679 $layers.each($.proxy(this.buildLiveItem, this)); 1680 this.$element.html('').append(this.$liveTabsList); 1681 }, 1682 buildLiveItem: function buildLiveItem(i, tab) { 1683 var $tab = $(tab); 1684 var $li = $('<li />'); 1685 var $a = $('<a />'); 1686 var index = i + 1; 1687 $tab.attr('id', this.getLiveItemId($tab, index)); 1688 var hash = '#' + $tab.attr('id'); 1689 var title = this.getLiveItemTitle($tab); 1690 $a.attr('href', hash).attr('rel', hash).text(title); 1691 $li.append($a); 1692 this.$liveTabsList.append($li); 1693 }, 1694 getLiveItemId: function getLiveItemId($tab, index) { 1695 return typeof $tab.attr('id') === 'undefined' ? this.opts.live.replace('.', '') + index : $tab.attr('id'); 1696 }, 1697 getLiveItemTitle: function getLiveItemTitle($tab) { 1698 return typeof $tab.attr('data-title') === 'undefined' ? $tab.attr('id') : $tab.attr('data-title'); 1699 }, 1700 setActiveItem: function setActiveItem() { 1701 if (this.currentHash) { 1702 this.currentItem = this.getItemBy(this.currentHash); 1703 this.opts.active = this.currentHash; 1704 } else if (this.opts.active === false) { 1705 this.currentItem = this.getItem(this.$items.first()); 1706 this.opts.active = this.currentItem.hash; 1707 } 1708 1709 this.addActive(this.currentItem); 1710 }, 1711 addActive: function addActive(item) { 1712 item.$parent.addClass('active'); 1713 item.$tab.removeClass('hide').addClass('open'); 1714 this.currentItem = item; 1715 }, 1716 removeActive: function removeActive(item) { 1717 item.$parent.removeClass('active'); 1718 item.$tab.addClass('hide').removeClass('open'); 1719 this.currentItem = false; 1720 }, 1721 next: function next(e) { 1722 if (e) e.preventDefault(); 1723 var item = this.getItem(this.fetchElement('next')); 1724 this.open(item.hash); 1725 this.callback('next', item); 1726 }, 1727 prev: function prev(e) { 1728 if (e) e.preventDefault(); 1729 var item = this.getItem(this.fetchElement('prev')); 1730 this.open(item.hash); 1731 this.callback('prev', item); 1732 }, 1733 fetchElement: function fetchElement(type) { 1734 var element; 1735 1736 if (this.currentItem !== false) { 1737 // prev or next 1738 element = this.currentItem.$parent[type]().find('a'); 1739 1740 if (element.length === 0) { 1741 return; 1742 } 1743 } else { 1744 // first 1745 element = this.$items[0]; 1746 } 1747 1748 return element; 1749 }, 1750 open: function open(e, push) { 1751 if (typeof e === 'undefined') return; 1752 if (_typeof(e) === 'object') e.preventDefault(); 1753 var item = _typeof(e) === 'object' ? this.getItem(e.target) : this.getItemBy(e); 1754 this.closeAll(); 1755 this.callback('open', item); 1756 this.addActive(item); // push state (doesn't need to push at the start) 1757 1758 this.pushStateOpen(push, item); 1759 this.callback('opened', item); 1760 }, 1761 pushStateOpen: function pushStateOpen(push, item) { 1762 if (push !== false && this.opts.hash !== false) { 1763 history.pushState(false, false, item.hash); 1764 } 1765 }, 1766 close: function close(num) { 1767 var item = this.getItemBy(num); 1768 1769 if (!item.$parent.hasClass('active')) { 1770 return; 1771 } 1772 1773 this.callback('close', item); 1774 this.removeActive(item); 1775 this.pushStateClose(); 1776 this.callback('closed', item); 1777 }, 1778 pushStateClose: function pushStateClose() { 1779 if (this.opts.hash !== false) { 1780 history.pushState(false, false, ' '); 1781 } 1782 }, 1783 closeAll: function closeAll() { 1784 this.$tabs.removeClass('open').addClass('hide'); 1785 this.$items.parent().removeClass('active'); 1786 }, 1787 getItem: function getItem(element) { 1788 var item = {}; 1789 item.$el = $(element); 1790 item.hash = item.$el.attr('href'); 1791 item.$parent = item.$el.parent(); 1792 item.$tab = $(item.hash); 1793 return item; 1794 }, 1795 getItemBy: function getItemBy(num) { 1796 var element = typeof num === 'number' ? this.$items.eq(num - 1) : this.$element.find('[rel="' + num + '"]'); 1797 return this.getItem(element); 1798 }, 1799 getLocationHash: function getLocationHash() { 1800 if (this.opts.hash === false) { 1801 return false; 1802 } 1803 1804 return this.isHash() ? top.location.hash : false; 1805 }, 1806 isHash: function isHash() { 1807 return !(top.location.hash === '' || $.inArray(top.location.hash, this.hashesCollection) === -1); 1808 }, 1809 setItemHeight: function setItemHeight() { 1810 if (this.opts.equals) { 1811 var minHeight = this.getItemMaxHeight() + 'px'; 1812 this.$tabs.css('min-height', minHeight); 1813 } 1814 }, 1815 getItemMaxHeight: function getItemMaxHeight() { 1816 var max = 0; 1817 this.$tabs.each(function () { 1818 var h = $(this).height(); 1819 max = h > max ? h : max; 1820 }); 1821 return max; 1822 } 1823 }; // Inheritance 1824 1825 Kube.Tabs.inherits(Kube); // Plugin 1826 1827 Kube.Plugin.create('Tabs'); 1828 Kube.Plugin.autoload('Tabs'); 1829 })(Kube); 1830 /** 1831 * @library Kube Modal 1832 * @author Imperavi LLC 1833 * @license MIT 1834 */ 1835 1836 1837 (function ($) { 1838 $.modalcurrent = null; 1839 1840 $.modalwindow = function (options) { 1841 var opts = $.extend({}, options, { 1842 show: true 1843 }); 1844 var $element = $('<span />'); 1845 $element.modal(opts); 1846 }; 1847 })(jQuery); 1848 1849 (function (Kube) { 1850 Kube.Modal = function (element, options) { 1851 this.namespace = 'modal'; 1852 this.defaults = { 1853 target: null, 1854 show: false, 1855 url: false, 1856 header: false, 1857 width: '600px', 1858 // string 1859 height: false, 1860 // or string 1861 maxHeight: false, 1862 position: 'center', 1863 // top or center 1864 overlay: true, 1865 appendForms: false, 1866 appendFields: false, 1867 animationOpen: 'show', 1868 animationClose: 'hide', 1869 callbacks: ['open', 'opened', 'close', 'closed'] 1870 }; // Parent Constructor 1871 1872 Kube.apply(this, arguments); // Services 1873 1874 this.utils = new Kube.Utils(); 1875 this.detect = new Kube.Detect(); // Initialization 1876 1877 this.start(); 1878 }; // Functionality 1879 1880 1881 Kube.Modal.prototype = { 1882 start: function start() { 1883 if (!this.hasTarget()) { 1884 return; 1885 } 1886 1887 if (this.opts.show) this.load();else this.$element.on('click.' + this.namespace, $.proxy(this.load, this)); 1888 }, 1889 buildModal: function buildModal() { 1890 this.$modal = this.$target.find('.modal'); 1891 this.$header = this.$target.find('.modal-header'); 1892 this.$close = this.$target.find('.close'); 1893 this.$body = this.$target.find('.modal-body'); 1894 }, 1895 buildOverlay: function buildOverlay() { 1896 if (this.opts.overlay === false) { 1897 return; 1898 } 1899 1900 if ($('#modal-overlay').length !== 0) { 1901 this.$overlay = $('#modal-overlay'); 1902 } else { 1903 this.$overlay = $('<div id="modal-overlay">').addClass('hide'); 1904 $('body').prepend(this.$overlay); 1905 } 1906 1907 this.$overlay.addClass('overlay'); 1908 }, 1909 buildHeader: function buildHeader() { 1910 if (this.opts.header) this.$header.html(this.opts.header); 1911 }, 1912 load: function load(e) { 1913 this.buildModal(); 1914 this.buildOverlay(); 1915 this.buildHeader(); 1916 if (this.opts.url) this.buildContent();else this.open(e); 1917 }, 1918 open: function open(e) { 1919 if (e) e.preventDefault(); 1920 1921 if (this.isOpened()) { 1922 return; 1923 } 1924 1925 if (this.detect.isMobile()) this.opts.width = '96%'; 1926 if (this.opts.overlay) this.$overlay.removeClass('hide'); 1927 this.$target.removeClass('hide'); 1928 this.$modal.removeClass('hide'); 1929 this.enableEvents(); 1930 this.findActions(); 1931 this.resize(); 1932 $(window).on('resize.' + this.namespace, $.proxy(this.resize, this)); 1933 if (this.detect.isDesktop()) this.utils.disableBodyScroll(); // enter 1934 1935 this.$modal.find('input[type=text],input[type=url],input[type=email]').on('keydown.' + this.namespace, $.proxy(this.handleEnter, this)); 1936 this.callback('open'); 1937 this.$modal.animation(this.opts.animationOpen, $.proxy(this.onOpened, this)); 1938 }, 1939 close: function close(e) { 1940 if (!this.$modal || !this.isOpened()) { 1941 return; 1942 } 1943 1944 if (e) { 1945 if (this.shouldNotBeClosed(e.target)) { 1946 return; 1947 } 1948 1949 e.preventDefault(); 1950 } 1951 1952 this.callback('close'); 1953 this.disableEvents(); 1954 this.$modal.animation(this.opts.animationClose, $.proxy(this.onClosed, this)); 1955 if (this.opts.overlay) this.$overlay.animation(this.opts.animationClose); 1956 }, 1957 onOpened: function onOpened() { 1958 this.$modal.addClass('open'); 1959 this.callback('opened'); 1960 $.modalcurrent = this; 1961 }, 1962 onClosed: function onClosed() { 1963 this.callback('closed'); 1964 this.$target.addClass('hide'); 1965 this.$modal.removeClass('open'); 1966 if (this.detect.isDesktop()) this.utils.enableBodyScroll(); 1967 this.$body.css('height', ''); 1968 $.modalcurrent = null; 1969 }, 1970 isOpened: function isOpened() { 1971 return this.$modal.hasClass('open'); 1972 }, 1973 getData: function getData() { 1974 var formdata = new Kube.FormData(this); 1975 formdata.set(''); 1976 return formdata.get(); 1977 }, 1978 buildContent: function buildContent() { 1979 $.ajax({ 1980 url: this.opts.url + '?' + new Date().getTime(), 1981 cache: false, 1982 type: 'post', 1983 data: this.getData(), 1984 success: $.proxy(function (data) { 1985 this.$body.html(data); 1986 this.open(); 1987 }, this) 1988 }); 1989 }, 1990 buildWidth: function buildWidth() { 1991 var width = this.opts.width; 1992 var top = '2%'; 1993 var bottom = '2%'; 1994 var percent = width.match(/%$/); 1995 1996 if (parseInt(this.opts.width) > $(window).width() && !percent) { 1997 width = '96%'; 1998 } else if (!percent) { 1999 top = '16px'; 2000 bottom = '16px'; 2001 } 2002 2003 this.$modal.css({ 2004 'width': width, 2005 'margin-top': top, 2006 'margin-bottom': bottom 2007 }); 2008 }, 2009 buildPosition: function buildPosition() { 2010 if (this.opts.position !== 'center') { 2011 return; 2012 } 2013 2014 var windowHeight = $(window).height(); 2015 var height = this.$modal.outerHeight(); 2016 var top = windowHeight / 2 - height / 2 + 'px'; 2017 if (this.detect.isMobile()) top = '2%';else if (height > windowHeight) top = '16px'; 2018 this.$modal.css('margin-top', top); 2019 }, 2020 buildHeight: function buildHeight() { 2021 var windowHeight = $(window).height(); 2022 2023 if (this.opts.maxHeight) { 2024 var padding = parseInt(this.$body.css('padding-top')) + parseInt(this.$body.css('padding-bottom')); 2025 var margin = parseInt(this.$modal.css('margin-top')) + parseInt(this.$modal.css('margin-bottom')); 2026 var height = windowHeight - this.$header.innerHeight() - padding - margin; 2027 this.$body.height(height); 2028 } else if (this.opts.height !== false) { 2029 this.$body.css('height', this.opts.height); 2030 } 2031 2032 var modalHeight = this.$modal.outerHeight(); 2033 2034 if (modalHeight > windowHeight) { 2035 this.opts.animationOpen = 'show'; 2036 this.opts.animationClose = 'hide'; 2037 } 2038 }, 2039 resize: function resize() { 2040 this.buildWidth(); 2041 this.buildPosition(); 2042 this.buildHeight(); 2043 }, 2044 enableEvents: function enableEvents() { 2045 this.$close.on('click.' + this.namespace, $.proxy(this.close, this)); 2046 $(document).on('keyup.' + this.namespace, $.proxy(this.handleEscape, this)); 2047 this.$target.on('click.' + this.namespace, $.proxy(this.close, this)); 2048 }, 2049 disableEvents: function disableEvents() { 2050 this.$close.off('.' + this.namespace); 2051 $(document).off('.' + this.namespace); 2052 this.$target.off('.' + this.namespace); 2053 $(window).off('.' + this.namespace); 2054 }, 2055 findActions: function findActions() { 2056 this.$body.find('[data-action="modal-close"]').on('mousedown.' + this.namespace, $.proxy(this.close, this)); 2057 }, 2058 setHeader: function setHeader(header) { 2059 this.$header.html(header); 2060 }, 2061 setContent: function setContent(content) { 2062 this.$body.html(content); 2063 }, 2064 setWidth: function setWidth(width) { 2065 this.opts.width = width; 2066 this.resize(); 2067 }, 2068 getModal: function getModal() { 2069 return this.$modal; 2070 }, 2071 getBody: function getBody() { 2072 return this.$body; 2073 }, 2074 getHeader: function getHeader() { 2075 return this.$header; 2076 }, 2077 handleEnter: function handleEnter(e) { 2078 if (e.which === 13) { 2079 e.preventDefault(); 2080 this.close(false); 2081 } 2082 }, 2083 handleEscape: function handleEscape(e) { 2084 return e.which === 27 ? this.close(false) : true; 2085 }, 2086 shouldNotBeClosed: function shouldNotBeClosed(el) { 2087 if ($(el).attr('data-action') === 'modal-close' || el === this.$close[0]) { 2088 return false; 2089 } else if ($(el).closest('.modal').length === 0) { 2090 return false; 2091 } 2092 2093 return true; 2094 } 2095 }; // Inheritance 2096 2097 Kube.Modal.inherits(Kube); // Plugin 2098 2099 Kube.Plugin.create('Modal'); 2100 Kube.Plugin.autoload('Modal'); 2101 })(Kube); 2102 })(jQuery); 2103 2104 /***/ }), 2105 2106 /***/ "../assets/js/libs/fixto.js": 2107 /*!**********************************!*\ 2108 !*** ../assets/js/libs/fixto.js ***! 2109 \**********************************/ 2110 /*! no static exports found */ 2111 /***/ (function(module, exports) { 2112 2113 var fixto = function ($, window, document) { 2114 // Start Computed Style. Please do not modify this module here. Modify it from its own repo. See address below. 2115 2116 /*! Computed Style - v0.1.0 - 2012-07-19 2117 * https://github.com/bbarakaci/computed-style 2118 * Copyright (c) 2012 Burak Barakaci; Licensed MIT */ 2119 var computedStyle = function () { 2120 var computedStyle = { 2121 getAll: function getAll(element) { 2122 return document.defaultView.getComputedStyle(element); 2123 }, 2124 get: function get(element, name) { 2125 return this.getAll(element)[name]; 2126 }, 2127 toFloat: function toFloat(value) { 2128 return parseFloat(value, 10) || 0; 2129 }, 2130 getFloat: function getFloat(element, name) { 2131 return this.toFloat(this.get(element, name)); 2132 }, 2133 _getAllCurrentStyle: function _getAllCurrentStyle(element) { 2134 return element.currentStyle; 2135 } 2136 }; 2137 2138 if (document.documentElement.currentStyle) { 2139 computedStyle.getAll = computedStyle._getAllCurrentStyle; 2140 } 2141 2142 return computedStyle; 2143 }(); // End Computed Style. Modify whatever you want to. 2144 2145 2146 var mimicNode = function () { 2147 /* 2148 Class Mimic Node 2149 Dependency : Computed Style 2150 Tries to mimick a dom node taking his styles, dimensions. May go to his repo if gets mature. 2151 */ 2152 function MimicNode(element) { 2153 this.element = element; 2154 this.replacer = document.createElement('div'); 2155 this.replacer.style.visibility = 'hidden'; 2156 this.hide(); 2157 element.parentNode.insertBefore(this.replacer, element); 2158 } 2159 2160 MimicNode.prototype = { 2161 replace: function replace() { 2162 var rst = this.replacer.style; 2163 var styles = computedStyle.getAll(this.element); // rst.width = computedStyle.width(this.element) + 'px'; 2164 // rst.height = this.element.offsetHeight + 'px'; 2165 // Setting offsetWidth 2166 2167 rst.width = this._width(); 2168 rst.height = this._height(); // Adopt margins 2169 2170 rst.marginTop = styles.marginTop; 2171 rst.marginBottom = styles.marginBottom; 2172 rst.marginLeft = styles.marginLeft; 2173 rst.marginRight = styles.marginRight; // Adopt positioning 2174 2175 rst.cssFloat = styles.cssFloat; 2176 rst.styleFloat = styles.styleFloat; //ie8; 2177 2178 rst.position = styles.position; 2179 rst.top = styles.top; 2180 rst.right = styles.right; 2181 rst.bottom = styles.bottom; 2182 rst.left = styles.left; // rst.borderStyle = styles.borderStyle; 2183 2184 rst.display = styles.display; 2185 }, 2186 hide: function hide() { 2187 this.replacer.style.display = 'none'; 2188 }, 2189 _width: function _width() { 2190 return this.element.getBoundingClientRect().width + 'px'; 2191 }, 2192 _widthOffset: function _widthOffset() { 2193 return this.element.offsetWidth + 'px'; 2194 }, 2195 _height: function _height() { 2196 return jQuery(this.element).outerHeight() + 'px'; 2197 }, 2198 _heightOffset: function _heightOffset() { 2199 return this.element.offsetHeight + 'px'; 2200 }, 2201 destroy: function destroy() { 2202 $(this.replacer).remove(); // set properties to null to break references 2203 2204 for (var prop in this) { 2205 if (this.hasOwnProperty(prop)) { 2206 this[prop] = null; 2207 } 2208 } 2209 } 2210 }; 2211 var bcr = document.documentElement.getBoundingClientRect(); 2212 2213 if (!bcr.width) { 2214 MimicNode.prototype._width = MimicNode.prototype._widthOffset; 2215 MimicNode.prototype._height = MimicNode.prototype._heightOffset; 2216 } 2217 2218 return { 2219 MimicNode: MimicNode, 2220 computedStyle: computedStyle 2221 }; 2222 }(); // Class handles vendor prefixes 2223 2224 2225 function Prefix() { 2226 // Cached vendor will be stored when it is detected 2227 this._vendor = null; //this._dummy = document.createElement('div'); 2228 } 2229 2230 Prefix.prototype = { 2231 _vendors: { 2232 webkit: { 2233 cssPrefix: '-webkit-', 2234 jsPrefix: 'Webkit' 2235 }, 2236 moz: { 2237 cssPrefix: '-moz-', 2238 jsPrefix: 'Moz' 2239 }, 2240 ms: { 2241 cssPrefix: '-ms-', 2242 jsPrefix: 'ms' 2243 }, 2244 opera: { 2245 cssPrefix: '-o-', 2246 jsPrefix: 'O' 2247 } 2248 }, 2249 _prefixJsProperty: function _prefixJsProperty(vendor, prop) { 2250 return vendor.jsPrefix + prop[0].toUpperCase() + prop.substr(1); 2251 }, 2252 _prefixValue: function _prefixValue(vendor, value) { 2253 return vendor.cssPrefix + value; 2254 }, 2255 _valueSupported: function _valueSupported(prop, value, dummy) { 2256 // IE8 will throw Illegal Argument when you attempt to set a not supported value. 2257 try { 2258 dummy.style[prop] = value; 2259 return dummy.style[prop] === value; 2260 } catch (er) { 2261 return false; 2262 } 2263 }, 2264 2265 /** 2266 * Returns true if the property is supported 2267 * @param {string} prop Property name 2268 * @returns {boolean} 2269 */ 2270 propertySupported: function propertySupported(prop) { 2271 // Supported property will return either inine style value or an empty string. 2272 // Undefined means property is not supported. 2273 return document.documentElement.style[prop] !== undefined; 2274 }, 2275 2276 /** 2277 * Returns prefixed property name for js usage 2278 * @param {string} prop Property name 2279 * @returns {string|null} 2280 */ 2281 getJsProperty: function getJsProperty(prop) { 2282 // Try native property name first. 2283 if (this.propertySupported(prop)) { 2284 return prop; 2285 } // Prefix it if we know the vendor already 2286 2287 2288 if (this._vendor) { 2289 return this._prefixJsProperty(this._vendor, prop); 2290 } // We don't know the vendor, try all the possibilities 2291 2292 2293 var prefixed; 2294 2295 for (var vendor in this._vendors) { 2296 prefixed = this._prefixJsProperty(this._vendors[vendor], prop); 2297 2298 if (this.propertySupported(prefixed)) { 2299 // Vendor detected. Cache it. 2300 this._vendor = this._vendors[vendor]; 2301 return prefixed; 2302 } 2303 } // Nothing worked 2304 2305 2306 return null; 2307 }, 2308 2309 /** 2310 * Returns supported css value for css property. Could be used to check support or get prefixed value string. 2311 * @param {string} prop Property 2312 * @param {string} value Value name 2313 * @returns {string|null} 2314 */ 2315 getCssValue: function getCssValue(prop, value) { 2316 // Create dummy element to test value 2317 var dummy = document.createElement('div'); // Get supported property name 2318 2319 var jsProperty = this.getJsProperty(prop); // Try unprefixed value 2320 2321 if (this._valueSupported(jsProperty, value, dummy)) { 2322 return value; 2323 } 2324 2325 var prefixedValue; // If we know the vendor already try prefixed value 2326 2327 if (this._vendor) { 2328 prefixedValue = this._prefixValue(this._vendor, value); 2329 2330 if (this._valueSupported(jsProperty, prefixedValue, dummy)) { 2331 return prefixedValue; 2332 } 2333 } // Try all vendors 2334 2335 2336 for (var vendor in this._vendors) { 2337 prefixedValue = this._prefixValue(this._vendors[vendor], value); 2338 2339 if (this._valueSupported(jsProperty, prefixedValue, dummy)) { 2340 // Vendor detected. Cache it. 2341 this._vendor = this._vendors[vendor]; 2342 return prefixedValue; 2343 } 2344 } // No support for value 2345 2346 2347 return null; 2348 } 2349 }; 2350 var prefix = new Prefix(); // We will need this frequently. Lets have it as a global until we encapsulate properly. 2351 2352 var transformJsProperty = prefix.getJsProperty('transform'); // Will hold if browser creates a positioning context for fixed elements. 2353 2354 var fixedPositioningContext; // Checks if browser creates a positioning context for fixed elements. 2355 // Transform rule will create a positioning context on browsers who follow the spec. 2356 // Ie for example will fix it according to documentElement 2357 // TODO: Other css rules also effects. perspective creates at chrome but not in firefox. transform-style preserve3d effects. 2358 2359 function checkFixedPositioningContextSupport() { 2360 var support = false; 2361 var parent = document.createElement('div'); 2362 var child = document.createElement('div'); 2363 parent.appendChild(child); 2364 parent.style[transformJsProperty] = 'translate(0)'; // Make sure there is space on top of parent 2365 2366 parent.style.marginTop = '10px'; 2367 parent.style.visibility = 'hidden'; 2368 child.style.position = 'fixed'; 2369 child.style.top = 0; 2370 document.body.appendChild(parent); 2371 var rect = child.getBoundingClientRect(); // If offset top is greater than 0 meand transformed element created a positioning context. 2372 2373 if (rect.top > 0) { 2374 support = true; 2375 } // Remove dummy content 2376 2377 2378 document.body.removeChild(parent); 2379 return support; 2380 } // It will return null if position sticky is not supported 2381 2382 2383 var nativeStickyValue = prefix.getCssValue('position', 'sticky'); // It will return null if position fixed is not supported 2384 2385 var fixedPositionValue = prefix.getCssValue('position', 'fixed'); // Dirty business 2386 2387 var ie = navigator.appName === 'Microsoft Internet Explorer'; 2388 var ieversion; 2389 2390 if (ie) { 2391 ieversion = parseFloat(navigator.appVersion.split("MSIE")[1]); 2392 } 2393 2394 function FixTo(child, parent, options) { 2395 this.child = child; 2396 this._$child = $(child); 2397 this.parent = parent; 2398 this.options = { 2399 className: 'fixto-fixed', 2400 top: 0 2401 }; 2402 2403 this._setOptions(options); 2404 } 2405 2406 FixTo.prototype = { 2407 // Returns the total outerHeight of the elements passed to mind option. Will return 0 if none. 2408 _mindtop: function _mindtop() { 2409 var top = 0; 2410 2411 if (this._$mind) { 2412 var el; 2413 var rect; 2414 var height; 2415 2416 for (var i = 0, l = this._$mind.length; i < l; i++) { 2417 el = this._$mind[i]; 2418 rect = el.getBoundingClientRect(); 2419 2420 if (rect.height) { 2421 top += rect.height; 2422 } else { 2423 var styles = computedStyle.getAll(el); 2424 top += el.offsetHeight + computedStyle.toFloat(styles.marginTop) + computedStyle.toFloat(styles.marginBottom); 2425 } 2426 } 2427 } 2428 2429 return top; 2430 }, 2431 // Public method to stop the behaviour of this instance. 2432 stop: function stop() { 2433 this._stop(); 2434 2435 this._running = false; 2436 }, 2437 // Public method starts the behaviour of this instance. 2438 start: function start() { 2439 // Start only if it is not running not to attach event listeners multiple times. 2440 if (!this._running) { 2441 this._start(); 2442 2443 this._running = true; 2444 } 2445 }, 2446 //Public method to destroy fixto behaviour 2447 destroy: function destroy() { 2448 this.stop(); 2449 2450 this._destroy(); // Remove jquery data from the element 2451 2452 2453 this._$child.removeData('fixto-instance'); // set properties to null to break references 2454 2455 2456 for (var prop in this) { 2457 if (this.hasOwnProperty(prop)) { 2458 this[prop] = null; 2459 } 2460 } 2461 }, 2462 _setOptions: function _setOptions(options) { 2463 $.extend(this.options, options); 2464 2465 if (this.options.mind) { 2466 this._$mind = $(this.options.mind); 2467 } 2468 2469 if (this.options.zIndex) { 2470 this.child.style.zIndex = this.options.zIndex; 2471 } 2472 }, 2473 setOptions: function setOptions(options) { 2474 this._setOptions(options); 2475 2476 this.refresh(); 2477 }, 2478 // Methods could be implemented by subclasses 2479 _stop: function _stop() {}, 2480 _start: function _start() {}, 2481 _destroy: function _destroy() {}, 2482 refresh: function refresh() {} 2483 }; // Class FixToContainer 2484 2485 function FixToContainer(child, parent, options) { 2486 FixTo.call(this, child, parent, options); 2487 this._replacer = new mimicNode.MimicNode(child); 2488 this._ghostNode = this._replacer.replacer; 2489 2490 this._saveStyles(); 2491 2492 this._saveViewportHeight(); // Create anonymous functions and keep references to register and unregister events. 2493 2494 2495 this._proxied_onscroll = this._bind(this._onscroll, this); 2496 this._proxied_onresize = this._bind(this._onresize, this); 2497 this.start(); 2498 } 2499 2500 FixToContainer.prototype = new FixTo(); 2501 $.extend(FixToContainer.prototype, { 2502 // Returns an anonymous function that will call the given function in the given context 2503 _bind: function _bind(fn, context) { 2504 return function () { 2505 return fn.call(context); 2506 }; 2507 }, 2508 // at ie8 maybe only in vm window resize event fires everytime an element is resized. 2509 _toresize: ieversion === 8 ? document.documentElement : window, 2510 _onscroll: function _onscroll() { 2511 this._scrollTop = document.documentElement.scrollTop || document.body.scrollTop; 2512 this._parentBottom = this.parent.offsetHeight + this._fullOffset('offsetTop', this.parent); // if (this.options.mindBottomPadding !== false) { 2513 // this._parentBottom -= computedStyle.getFloat(this.parent, 'paddingBottom'); 2514 // } 2515 // if (this.options.toBottom) { 2516 // this._fix(); 2517 // this._adjust(); 2518 // return 2519 // } 2520 // if (this.options.toBottom) { 2521 // this.options.top = this._viewportHeight - computedStyle.toFloat(computedStyle.getAll(this.child).height) - this.options.topSpacing; 2522 // } 2523 2524 if (!this.fixed) { 2525 var childStyles = computedStyle.getAll(this.child); 2526 2527 if (this._scrollTop < this._parentBottom && this._scrollTop > this._fullOffset('offsetTop', this.child) - this.options.top - this._mindtop() && this._viewportHeight > this.child.offsetHeight + computedStyle.toFloat(childStyles.marginTop) + computedStyle.toFloat(childStyles.marginBottom) || this.options.toBottom) { 2528 this._fix(); 2529 2530 this._adjust(); 2531 } 2532 } else { 2533 if (this.options.toBottom) { 2534 if (this._scrollTop >= this._fullOffset('offsetTop', this._ghostNode)) { 2535 this._unfix(); 2536 2537 return; 2538 } 2539 } else { 2540 if (this._scrollTop > this._parentBottom || this._scrollTop <= this._fullOffset('offsetTop', this._ghostNode) - this.options.top - this._mindtop()) { 2541 this._unfix(); 2542 2543 return; 2544 } 2545 } 2546 2547 this._adjust(); 2548 } 2549 }, 2550 _adjust: function _adjust() { 2551 var top = 0; 2552 2553 var mindTop = this._mindtop(); 2554 2555 var diff = 0; 2556 var childStyles = computedStyle.getAll(this.child); 2557 var context = null; 2558 2559 if (fixedPositioningContext) { 2560 // Get positioning context. 2561 context = this._getContext(); 2562 2563 if (context) { 2564 // There is a positioning context. Top should be according to the context. 2565 top = Math.abs(context.getBoundingClientRect().top); 2566 } 2567 } 2568 2569 diff = this._parentBottom - this._scrollTop - (this.child.offsetHeight + computedStyle.toFloat(childStyles.marginBottom) + mindTop + this.options.top); 2570 2571 if (diff > 0) { 2572 diff = 0; 2573 } 2574 2575 if (this.options.toBottom) {// this.child.style.top = (diff + mindTop + top + this.options.top) - computedStyle.toFloat(childStyles.marginTop) + 'px'; 2576 } else { 2577 var _top = this.options.top; 2578 2579 if (_top === 0) { 2580 _top = $('body').offset().top; 2581 } 2582 2583 this.child.style.top = Math.round(diff + mindTop + top + _top - computedStyle.toFloat(childStyles.marginTop)) + 'px'; 2584 } 2585 }, 2586 // Calculate cumulative offset of the element. 2587 // Optionally according to context 2588 _fullOffset: function _fullOffset(offsetName, elm, context) { 2589 var offset = elm[offsetName]; 2590 var offsetParent = elm.offsetParent; // Add offset of the ascendent tree until we reach to the document root or to the given context 2591 2592 while (offsetParent !== null && offsetParent !== context) { 2593 offset = offset + offsetParent[offsetName]; 2594 offsetParent = offsetParent.offsetParent; 2595 } 2596 2597 return offset; 2598 }, 2599 // Get positioning context of the element. 2600 // We know that the closest parent that a transform rule applied will create a positioning context. 2601 _getContext: function _getContext() { 2602 var parent; 2603 var element = this.child; 2604 var context = null; 2605 var styles; // Climb up the treee until reaching the context 2606 2607 while (!context) { 2608 parent = element.parentNode; 2609 2610 if (parent === document.documentElement) { 2611 return null; 2612 } 2613 2614 styles = computedStyle.getAll(parent); // Element has a transform rule 2615 2616 if (styles[transformJsProperty] !== 'none') { 2617 context = parent; 2618 break; 2619 } 2620 2621 element = parent; 2622 } 2623 2624 return context; 2625 }, 2626 _fix: function _fix() { 2627 var child = this.child; 2628 var childStyle = child.style; 2629 var childStyles = computedStyle.getAll(child); 2630 var left = child.getBoundingClientRect().left; 2631 var width = childStyles.width; 2632 this.options._original; 2633 2634 this._saveStyles(); 2635 2636 if (document.documentElement.currentStyle) { 2637 // Function for ie<9. When hasLayout is not triggered in ie7, he will report currentStyle as auto, clientWidth as 0. Thus using offsetWidth. 2638 // Opera also falls here 2639 width = child.offsetWidth; 2640 2641 if (childStyles.boxSizing !== "border-box") { 2642 width = width - (computedStyle.toFloat(childStyles.paddingLeft) + computedStyle.toFloat(childStyles.paddingRight) + computedStyle.toFloat(childStyles.borderLeftWidth) + computedStyle.toFloat(childStyles.borderRightWidth)); 2643 } 2644 2645 width += "px"; 2646 } // Ie still fixes the container according to the viewport. 2647 2648 2649 if (fixedPositioningContext) { 2650 var context = this._getContext(); // if(context) { 2651 // // There is a positioning context. Left should be according to the context. 2652 // left = child.getBoundingClientRect().left - context.getBoundingClientRect().left; 2653 // } else { 2654 2655 2656 left = this._$child.offset().left; // } 2657 } 2658 2659 this._replacer.replace(); 2660 2661 childStyle.left = 2662 /*left + "px"; */ 2663 left - computedStyle.toFloat(childStyles.marginLeft) + 'px'; 2664 childStyle.width = width; 2665 childStyle.position = 'fixed'; 2666 2667 if (this.options.toBottom) { 2668 childStyle.top = ""; 2669 childStyle.bottom = this.options.top + computedStyle.toFloat(childStyles.marginBottom) + 'px'; 2670 } else { 2671 childStyle.bottom = ""; 2672 var _top = this.options.top; 2673 2674 if (_top === 0) { 2675 _top = $('body').offset().top; 2676 } 2677 2678 childStyle.top = this._mindtop() + _top - computedStyle.toFloat(childStyles.marginTop) + 'px'; 2679 } 2680 2681 this._$child.addClass(this.options.className); 2682 2683 this.fixed = true; 2684 2685 this._$child.trigger('fixto-added'); 2686 }, 2687 _unfix: function _unfix() { 2688 var childStyle = this.child.style; 2689 2690 this._replacer.hide(); 2691 2692 childStyle.position = this._childOriginalPosition; 2693 childStyle.top = this._childOriginalTop; 2694 childStyle.bottom = this._childOriginalBottom; 2695 childStyle.width = this._childOriginalWidth; 2696 childStyle.left = this._childOriginalLeft; 2697 2698 if (!this.options.always) { 2699 this._$child.removeClass(this.options.className); 2700 2701 this._$child.trigger('fixto-removed'); 2702 } 2703 2704 this.fixed = false; 2705 }, 2706 _saveStyles: function _saveStyles() { 2707 var childStyle = this.child.style; 2708 this._childOriginalPosition = childStyle.position; 2709 2710 if (this.options.toBottom) { 2711 this._childOriginalTop = ""; 2712 this._childOriginalBottom = childStyle.bottom; 2713 } else { 2714 this._childOriginalTop = childStyle.top; 2715 this._childOriginalBottom = ""; 2716 } 2717 2718 this._childOriginalWidth = childStyle.width; 2719 this._childOriginalLeft = childStyle.left; 2720 }, 2721 _onresize: function _onresize() { 2722 this.refresh(); 2723 }, 2724 _saveViewportHeight: function _saveViewportHeight() { 2725 // ie8 doesn't support innerHeight 2726 this._viewportHeight = window.innerHeight || document.documentElement.clientHeight; 2727 }, 2728 _stop: function _stop() { 2729 // Unfix the container immediately. 2730 this._unfix(); // remove event listeners 2731 2732 2733 $(window).unbind('scroll.fixto mousewheel', this._proxied_onscroll); 2734 $(this._toresize).unbind('resize.fixto', this._proxied_onresize); 2735 }, 2736 _start: function _start() { 2737 // Trigger onscroll to have the effect immediately. 2738 this._onscroll(); // Attach event listeners 2739 2740 2741 $(window).bind('scroll.fixto mousewheel', this._proxied_onscroll); 2742 $(this._toresize).bind('resize.fixto', this._proxied_onresize); 2743 }, 2744 _destroy: function _destroy() { 2745 // Destroy mimic node instance 2746 this._replacer.destroy(); 2747 }, 2748 refresh: function refresh() { 2749 this._saveViewportHeight(); 2750 2751 this._unfix(); 2752 2753 this._onscroll(); 2754 } 2755 }); 2756 2757 function NativeSticky(child, parent, options) { 2758 FixTo.call(this, child, parent, options); 2759 this.start(); 2760 } 2761 2762 NativeSticky.prototype = new FixTo(); 2763 $.extend(NativeSticky.prototype, { 2764 _start: function _start() { 2765 var childStyles = computedStyle.getAll(this.child); 2766 this._childOriginalPosition = childStyles.position; 2767 this._childOriginalTop = childStyles.top; 2768 this.child.style.position = nativeStickyValue; 2769 this.refresh(); 2770 }, 2771 _stop: function _stop() { 2772 this.child.style.position = this._childOriginalPosition; 2773 this.child.style.top = this._childOriginalTop; 2774 }, 2775 refresh: function refresh() { 2776 this.child.style.top = this._mindtop() + this.options.top + 'px'; 2777 } 2778 }); 2779 2780 var fixTo = function fixTo(childElement, parentElement, options) { 2781 if (nativeStickyValue && !options || nativeStickyValue && options && options.useNativeSticky !== false) { 2782 // Position sticky supported and user did not disabled the usage of it. 2783 return new NativeSticky(childElement, parentElement, options); 2784 } else if (fixedPositionValue) { 2785 // Position fixed supported 2786 if (fixedPositioningContext === undefined) { 2787 // We don't know yet if browser creates fixed positioning contexts. Check it. 2788 fixedPositioningContext = checkFixedPositioningContextSupport(); 2789 } 2790 2791 return new FixToContainer(childElement, parentElement, options); 2792 } else { 2793 return 'Neither fixed nor sticky positioning supported'; 2794 } 2795 }; 2796 /* 2797 No support for ie lt 8 2798 */ 2799 2800 2801 if (ieversion < 8) { 2802 fixTo = function fixTo() { 2803 return 'not supported'; 2804 }; 2805 } // Let it be a jQuery Plugin 2806 2807 2808 $.fn.fixTo = function (targetSelector, options) { 2809 var $targets = $(targetSelector); 2810 var i = 0; 2811 return this.each(function () { 2812 // Check the data of the element. 2813 var instance = $(this).data('fixto-instance'); // If the element is not bound to an instance, create the instance and save it to elements data. 2814 2815 if (!instance) { 2816 $(this).data('fixto-instance', fixTo(this, $targets[i], options)); 2817 } else { 2818 // If we already have the instance here, expect that targetSelector parameter will be a string 2819 // equal to a public methods name. Run the method on the instance without checking if 2820 // it exists or it is a public method or not. Cause nasty errors when necessary. 2821 var method = targetSelector; 2822 instance[method].call(instance, options); 2823 } 2824 2825 i++; 2826 }); 2827 }; 2828 /* 2829 Expose 2830 */ 2831 2832 2833 return { 2834 FixToContainer: FixToContainer, 2835 fixTo: fixTo, 2836 computedStyle: computedStyle, 2837 mimicNode: mimicNode 2838 }; 2839 }(window.jQuery, window, document); 2840 2841 /***/ }), 2842 2843 /***/ "../assets/js/libs/jquery.backstretch.js": 2844 /*!***********************************************!*\ 2845 !*** ../assets/js/libs/jquery.backstretch.js ***! 2846 \***********************************************/ 2847 /*! no static exports found */ 2848 /***/ (function(module, exports) { 2849 2850 /* 2851 * Backstretch 2852 * http://srobbin.com/jquery-plugins/backstretch/ 2853 * 2854 * Copyright (c) 2013 Scott Robbin 2855 * Licensed under the MIT license. 2856 */ 2857 ; 2858 2859 (function ($, window, undefined) { 2860 'use strict'; 2861 /** @const */ 2862 2863 var YOUTUBE_REGEXP = /^.*(youtu\.be\/|youtube\.com\/v\/|youtube\.com\/embed\/|youtube\.com\/watch\?v=|youtube\.com\/watch\?.*\&v=)([^#\&\?]*).*/i; 2864 /* PLUGIN DEFINITION 2865 * ========================= */ 2866 2867 $.fn.backstretch = function (images, options) { 2868 var args = arguments; 2869 /* 2870 * Scroll the page one pixel to get the right window height on iOS 2871 * Pretty harmless for everyone else 2872 */ 2873 2874 if ($(window).scrollTop() === 0) { 2875 window.scrollTo(0, 0); 2876 } 2877 2878 var returnValues; 2879 this.each(function (eachIndex) { 2880 var $this = $(this), 2881 obj = $this.data('backstretch'); // Do we already have an instance attached to this element? 2882 2883 if (obj) { 2884 // Is this a method they're trying to execute? 2885 if (typeof args[0] === 'string' && typeof obj[args[0]] === 'function') { 2886 // Call the method 2887 var returnValue = obj[args[0]].apply(obj, Array.prototype.slice.call(args, 1)); 2888 2889 if (returnValue === obj) { 2890 // If a method is chaining 2891 returnValue = undefined; 2892 } 2893 2894 if (returnValue !== undefined) { 2895 returnValues = returnValues || []; 2896 returnValues[eachIndex] = returnValue; 2897 } 2898 2899 return; // Nothing further to do 2900 } // Merge the old options with the new 2901 2902 2903 options = $.extend(obj.options, options); // Remove the old instance 2904 2905 if (obj.hasOwnProperty('destroy')) { 2906 obj.destroy(true); 2907 } 2908 } // We need at least one image 2909 2910 2911 if (!images || images && images.length === 0) { 2912 var cssBackgroundImage = $this.css('background-image'); 2913 2914 if (cssBackgroundImage && cssBackgroundImage !== 'none') { 2915 images = [{ 2916 url: $this.css('backgroundImage').replace(/url\(|\)|"|'/g, "") 2917 }]; 2918 } else { 2919 $.error('No images were supplied for Backstretch, or element must have a CSS-defined background image.'); 2920 } 2921 } 2922 2923 obj = new Backstretch(this, images, options || {}); 2924 $this.data('backstretch', obj); 2925 }); 2926 return returnValues ? returnValues.length === 1 ? returnValues[0] : returnValues : this; 2927 }; // If no element is supplied, we'll attach to body 2928 2929 2930 $.backstretch = function (images, options) { 2931 // Return the instance 2932 return $('body').backstretch(images, options).data('backstretch'); 2933 }; // Custom selector 2934 2935 2936 $.expr[':'].backstretch = function (elem) { 2937 return $(elem).data('backstretch') !== undefined; 2938 }; 2939 /* DEFAULTS 2940 * ========================= */ 2941 2942 2943 $.fn.backstretch.defaults = { 2944 duration: 5000 // Amount of time in between slides (if slideshow) 2945 , 2946 transition: 'fade' // Type of transition between slides 2947 , 2948 transitionDuration: 0 // Duration of transition between slides 2949 , 2950 animateFirst: true // Animate the transition of first image of slideshow in? 2951 , 2952 alignX: 0.5 // The x-alignment for the image, can be 'left'|'center'|'right' or any number between 0.0 and 1.0 2953 , 2954 alignY: 0.5 // The y-alignment for the image, can be 'top'|'center'|'bottom' or any number between 0.0 and 1.0 2955 , 2956 paused: false // Whether the images should slide after given duration 2957 , 2958 start: 0 // Index of the first image to show 2959 , 2960 preload: 2 // How many images preload at a time? 2961 , 2962 preloadSize: 1 // How many images can we preload in parallel? 2963 , 2964 resolutionRefreshRate: 2500 // How long to wait before switching resolution? 2965 , 2966 resolutionChangeRatioThreshold: 0.1 // How much a change should it be before switching resolution? 2967 2968 }; 2969 /* STYLES 2970 * 2971 * Baked-in styles that we'll apply to our elements. 2972 * In an effort to keep the plugin simple, these are not exposed as options. 2973 * That said, anyone can override these in their own stylesheet. 2974 * ========================= */ 2975 2976 var styles = { 2977 wrap: { 2978 left: 0, 2979 top: 0, 2980 overflow: 'hidden', 2981 margin: 0, 2982 padding: 0, 2983 height: '100%', 2984 width: '100%', 2985 zIndex: -999999 2986 }, 2987 itemWrapper: { 2988 position: 'absolute', 2989 display: 'none', 2990 margin: 0, 2991 padding: 0, 2992 border: 'none', 2993 width: '100%', 2994 height: '100%', 2995 zIndex: -999999 2996 }, 2997 item: { 2998 position: 'absolute', 2999 margin: 0, 3000 padding: 0, 3001 border: 'none', 3002 width: '100%', 3003 height: '100%', 3004 maxWidth: 'none' 3005 } 3006 }; 3007 /* Given an array of different options for an image, 3008 * choose the optimal image for the container size. 3009 * 3010 * Given an image template (a string with {{ width }} and/or 3011 * {{height}} inside) and a container object, returns the 3012 * image url with the exact values for the size of that 3013 * container. 3014 * 3015 * Returns an array of urls optimized for the specified resolution. 3016 * 3017 */ 3018 3019 var optimalSizeImages = function () { 3020 /* Sorts the array of image sizes based on width */ 3021 var widthInsertSort = function widthInsertSort(arr) { 3022 for (var i = 1; i < arr.length; i++) { 3023 var tmp = arr[i], 3024 j = i; 3025 3026 while (arr[j - 1] && parseInt(arr[j - 1].width, 10) > parseInt(tmp.width, 10)) { 3027 arr[j] = arr[j - 1]; 3028 --j; 3029 } 3030 3031 arr[j] = tmp; 3032 } 3033 3034 return arr; 3035 }; 3036 /* Given an array of various sizes of the same image and a container width, 3037 * return the best image. 3038 */ 3039 3040 3041 var selectBest = function selectBest(containerWidth, containerHeight, imageSizes) { 3042 var devicePixelRatio = window.devicePixelRatio || 1; 3043 var deviceOrientation = getDeviceOrientation(); 3044 var windowOrientation = getWindowOrientation(); 3045 var wrapperOrientation = containerHeight > containerWidth ? 'portrait' : containerWidth > containerHeight ? 'landscape' : 'square'; 3046 var lastAllowedImage = 0; 3047 var testWidth; 3048 3049 for (var j = 0, image; j < imageSizes.length; j++) { 3050 image = imageSizes[j]; // In case a new image was pushed in, process it: 3051 3052 if (typeof image === 'string') { 3053 image = imageSizes[j] = { 3054 url: image 3055 }; 3056 } 3057 3058 if (image.pixelRatio && image.pixelRatio !== 'auto' && parseFloat(image.pixelRatio) !== devicePixelRatio) { 3059 // We disallowed choosing this image for current device pixel ratio, 3060 // So skip this one. 3061 continue; 3062 } 3063 3064 if (image.deviceOrientation && image.deviceOrientation !== deviceOrientation) { 3065 // We disallowed choosing this image for current device orientation, 3066 // So skip this one. 3067 continue; 3068 } 3069 3070 if (image.windowOrientation && image.windowOrientation !== deviceOrientation) { 3071 // We disallowed choosing this image for current window orientation, 3072 // So skip this one. 3073 continue; 3074 } 3075 3076 if (image.orientation && image.orientation !== wrapperOrientation) { 3077 // We disallowed choosing this image for current element's orientation, 3078 // So skip this one. 3079 continue; 3080 } // Mark this one as the last one we investigated 3081 // which does not violate device pixel ratio rules. 3082 // We may choose this one later if there's no match. 3083 3084 3085 lastAllowedImage = j; // For most images, we match the specified width against element width, 3086 // And enforcing a limit depending on the "pixelRatio" property if specified. 3087 // But if a pixelRatio="auto", then we consider the width as the physical width of the image, 3088 // And match it while considering the device's pixel ratio. 3089 3090 testWidth = containerWidth; 3091 3092 if (image.pixelRatio === 'auto') { 3093 containerWidth *= devicePixelRatio; 3094 } // Stop when the width of the image is larger or equal to the container width 3095 3096 3097 if (image.width >= testWidth) { 3098 break; 3099 } 3100 } // Use the image located at where we stopped 3101 3102 3103 return imageSizes[Math.min(j, lastAllowedImage)]; 3104 }; 3105 3106 var replaceTagsInUrl = function replaceTagsInUrl(url, templateReplacer) { 3107 if (typeof url === 'string') { 3108 url = url.replace(/{{(width|height)}}/g, templateReplacer); 3109 } else if (url instanceof Array) { 3110 for (var i = 0; i < url.length; i++) { 3111 if (url[i].src) { 3112 url[i].src = replaceTagsInUrl(url[i].src, templateReplacer); 3113 } else { 3114 url[i] = replaceTagsInUrl(url[i], templateReplacer); 3115 } 3116 } 3117 } 3118 3119 return url; 3120 }; 3121 3122 return function ($container, images) { 3123 var containerWidth = $container.width(), 3124 containerHeight = $container.height(); 3125 var chosenImages = []; 3126 3127 var templateReplacer = function templateReplacer(match, key) { 3128 if (key === 'width') { 3129 return containerWidth; 3130 } 3131 3132 if (key === 'height') { 3133 return containerHeight; 3134 } 3135 3136 return match; 3137 }; 3138 3139 for (var i = 0; i < images.length; i++) { 3140 if ($.isArray(images[i])) { 3141 images[i] = widthInsertSort(images[i]); 3142 var chosen = selectBest(containerWidth, containerHeight, images[i]); 3143 chosenImages.push(chosen); 3144 } else { 3145 // In case a new image was pushed in, process it: 3146 if (typeof images[i] === 'string') { 3147 images[i] = { 3148 url: images[i] 3149 }; 3150 } 3151 3152 var item = $.extend({}, images[i]); 3153 item.url = replaceTagsInUrl(item.url, templateReplacer); 3154 chosenImages.push(item); 3155 } 3156 } 3157 3158 return chosenImages; 3159 }; 3160 }(); 3161 3162 var isVideoSource = function isVideoSource(source) { 3163 return YOUTUBE_REGEXP.test(source.url) || source.isVideo; 3164 }; 3165 /* Preload images */ 3166 3167 3168 var preload = function (sources, startAt, count, batchSize, callback) { 3169 // Plugin cache 3170 var cache = []; // Wrapper for cache 3171 3172 var caching = function caching(image) { 3173 for (var i = 0; i < cache.length; i++) { 3174 if (cache[i].src === image.src) { 3175 return cache[i]; 3176 } 3177 } 3178 3179 cache.push(image); 3180 return image; 3181 }; // Execute callback 3182 3183 3184 var exec = function exec(sources, callback, last) { 3185 if (typeof callback === 'function') { 3186 callback.call(sources, last); 3187 } 3188 }; // Closure to hide cache 3189 3190 3191 return function preload(sources, startAt, count, batchSize, callback) { 3192 // Check input data 3193 if (typeof sources === 'undefined') { 3194 return; 3195 } 3196 3197 if (!$.isArray(sources)) { 3198 sources = [sources]; 3199 } 3200 3201 if (arguments.length < 5 && typeof arguments[arguments.length - 1] === 'function') { 3202 callback = arguments[arguments.length - 1]; 3203 } 3204 3205 startAt = typeof startAt === 'function' || !startAt ? 0 : startAt; 3206 count = typeof count === 'function' || !count || count < 0 ? sources.length : Math.min(count, sources.length); 3207 batchSize = typeof batchSize === 'function' || !batchSize ? 1 : batchSize; 3208 3209 if (startAt >= sources.length) { 3210 startAt = 0; 3211 count = 0; 3212 } 3213 3214 if (batchSize < 0) { 3215 batchSize = count; 3216 } 3217 3218 batchSize = Math.min(batchSize, count); 3219 var next = sources.slice(startAt + batchSize, count - batchSize); 3220 sources = sources.slice(startAt, batchSize); 3221 count = sources.length; // If sources array is empty 3222 3223 if (!count) { 3224 exec(sources, callback, true); 3225 return; 3226 } // Image loading callback 3227 3228 3229 var countLoaded = 0; 3230 3231 var loaded = function loaded() { 3232 countLoaded++; 3233 3234 if (countLoaded !== count) { 3235 return; 3236 } 3237 3238 exec(sources, callback, !next); 3239 preload(next, 0, 0, batchSize, callback); 3240 }; // Loop sources to preload 3241 3242 3243 var image; 3244 3245 for (var i = 0; i < sources.length; i++) { 3246 if (isVideoSource(sources[i])) { 3247 // Do not preload videos. There are issues with that. 3248 // First - we need to keep an instance of the preloaded and use that exactly, not a copy. 3249 // Second - there are memory issues. 3250 // If there will be a requirement from users - I'll try to implement this. 3251 continue; 3252 } else { 3253 image = new Image(); 3254 image.src = sources[i].url; 3255 image = caching(image); 3256 3257 if (image.complete) { 3258 loaded(); 3259 } else { 3260 $(image).on('load error', loaded); 3261 } 3262 } 3263 } 3264 }; 3265 }(); 3266 /* Process images array */ 3267 3268 3269 var processImagesArray = function processImagesArray(images) { 3270 var processed = []; 3271 3272 for (var i = 0; i < images.length; i++) { 3273 if (typeof images[i] === 'string') { 3274 processed.push({ 3275 url: images[i] 3276 }); 3277 } else if ($.isArray(images[i])) { 3278 processed.push(processImagesArray(images[i])); 3279 } else { 3280 processed.push(processOptions(images[i])); 3281 } 3282 } 3283 3284 return processed; 3285 }; 3286 /* Process options */ 3287 3288 3289 var processOptions = function processOptions(options, required) { 3290 // Convert old options 3291 // centeredX/centeredY are deprecated 3292 if (options.centeredX || options.centeredY) { 3293 if (window.console && window.console.log) { 3294 window.console.log('jquery.backstretch: `centeredX`/`centeredY` is deprecated, please use `alignX`/`alignY`'); 3295 } 3296 3297 if (options.centeredX) { 3298 options.alignX = 0.5; 3299 } 3300 3301 if (options.centeredY) { 3302 options.alignY = 0.5; 3303 } 3304 } // Deprecated spec 3305 3306 3307 if (options.speed !== undefined) { 3308 if (window.console && window.console.log) { 3309 window.console.log('jquery.backstretch: `speed` is deprecated, please use `transitionDuration`'); 3310 } 3311 3312 options.transitionDuration = options.speed; 3313 options.transition = 'fade'; 3314 } // Typo 3315 3316 3317 if (options.resolutionChangeRatioTreshold !== undefined) { 3318 window.console.log('jquery.backstretch: `treshold` is a typo!'); 3319 options.resolutionChangeRatioThreshold = options.resolutionChangeRatioTreshold; 3320 } // Current spec that needs processing 3321 3322 3323 if (options.fadeFirst !== undefined) { 3324 options.animateFirst = options.fadeFirst; 3325 } 3326 3327 if (options.fade !== undefined) { 3328 options.transitionDuration = options.fade; 3329 options.transition = 'fade'; 3330 } 3331 3332 return processAlignOptions(options); 3333 }; 3334 /* Process align options */ 3335 3336 3337 var processAlignOptions = function processAlignOptions(options, required) { 3338 if (options.alignX === 'left') { 3339 options.alignX = 0.0; 3340 } else if (options.alignX === 'center') { 3341 options.alignX = 0.5; 3342 } else if (options.alignX === 'right') { 3343 options.alignX = 1.0; 3344 } else { 3345 if (options.alignX !== undefined || required) { 3346 options.alignX = parseFloat(options.alignX); 3347 3348 if (isNaN(options.alignX)) { 3349 options.alignX = 0.5; 3350 } 3351 } 3352 } 3353 3354 if (options.alignY === 'top') { 3355 options.alignY = 0.0; 3356 } else if (options.alignY === 'center') { 3357 options.alignY = 0.5; 3358 } else if (options.alignY === 'bottom') { 3359 options.alignY = 1.0; 3360 } else { 3361 if (options.alignX !== undefined || required) { 3362 options.alignY = parseFloat(options.alignY); 3363 3364 if (isNaN(options.alignY)) { 3365 options.alignY = 0.5; 3366 } 3367 } 3368 } 3369 3370 return options; 3371 }; 3372 /* CLASS DEFINITION 3373 * ========================= */ 3374 3375 3376 var Backstretch = function Backstretch(container, images, options) { 3377 this.options = $.extend({}, $.fn.backstretch.defaults, options || {}); 3378 this.firstShow = true; // Process options 3379 3380 processOptions(this.options, true); 3381 /* In its simplest form, we allow Backstretch to be called on an image path. 3382 * e.g. $.backstretch('/path/to/image.jpg') 3383 * So, we need to turn this back into an array. 3384 */ 3385 3386 this.images = processImagesArray($.isArray(images) ? images : [images]); 3387 /** 3388 * Paused-Option 3389 */ 3390 3391 if (this.options.paused) { 3392 this.paused = true; 3393 } 3394 /** 3395 * Start-Option (Index) 3396 */ 3397 3398 3399 if (this.options.start >= this.images.length) { 3400 this.options.start = this.images.length - 1; 3401 } 3402 3403 if (this.options.start < 0) { 3404 this.options.start = 0; 3405 } // Convenience reference to know if the container is body. 3406 3407 3408 this.isBody = container === document.body; 3409 /* We're keeping track of a few different elements 3410 * 3411 * Container: the element that Backstretch was called on. 3412 * Wrap: a DIV that we place the image into, so we can hide the overflow. 3413 * Root: Convenience reference to help calculate the correct height. 3414 */ 3415 3416 var $window = $(window); 3417 this.$container = $(container); 3418 this.$root = this.isBody ? supportsFixedPosition ? $window : $(document) : this.$container; 3419 this.originalImages = this.images; 3420 this.images = optimalSizeImages(this.options.alwaysTestWindowResolution ? $window : this.$root, this.originalImages); 3421 /** 3422 * Pre-Loading. 3423 * This is the first image, so we will preload a minimum of 1 images. 3424 */ 3425 3426 preload(this.images, this.options.start || 0, this.options.preload || 1); // Don't create a new wrap if one already exists (from a previous instance of Backstretch) 3427 3428 var $existing = this.$container.children(".backstretch").first(); 3429 this.$wrap = $existing.length ? $existing : $('<div class="backstretch"></div>').css(this.options.bypassCss ? {} : styles.wrap).appendTo(this.$container); 3430 3431 if (!this.options.bypassCss) { 3432 // Non-body elements need some style adjustments 3433 if (!this.isBody) { 3434 // If the container is statically positioned, we need to make it relative, 3435 // and if no zIndex is defined, we should set it to zero. 3436 var position = this.$container.css('position'), 3437 zIndex = this.$container.css('zIndex'); 3438 this.$container.css({ 3439 position: position === 'static' ? 'relative' : position, 3440 zIndex: zIndex === 'auto' ? 0 : zIndex 3441 }); // Needs a higher z-index 3442 3443 this.$wrap.css({ 3444 zIndex: -999998 3445 }); 3446 } // Fixed or absolute positioning? 3447 3448 3449 this.$wrap.css({ 3450 position: this.isBody && supportsFixedPosition ? 'fixed' : 'absolute' 3451 }); 3452 } // Set the first image 3453 3454 3455 this.index = this.options.start; 3456 this.show(this.index); // Listen for resize 3457 3458 $window.on('resize.backstretch', $.proxy(this.resize, this)).on('orientationchange.backstretch', $.proxy(function () { 3459 // Need to do this in order to get the right window height 3460 if (this.isBody && window.pageYOffset === 0) { 3461 window.scrollTo(0, 1); 3462 this.resize(); 3463 } 3464 }, this)); 3465 }; 3466 3467 var performTransition = function performTransition(options) { 3468 var transition = options.transition || 'fade'; // Look for multiple options 3469 3470 if (typeof transition === 'string' && transition.indexOf('|') > -1) { 3471 transition = transition.split('|'); 3472 } 3473 3474 if (transition instanceof Array) { 3475 transition = transition[Math.round(Math.random() * (transition.length - 1))]; 3476 } 3477 3478 var $new = options['new']; 3479 var $old = options['old'] ? options['old'] : $([]); 3480 3481 switch (transition.toString().toLowerCase()) { 3482 default: 3483 case 'fade': 3484 $new.fadeIn({ 3485 duration: options.duration, 3486 complete: options.complete, 3487 easing: options.easing || undefined 3488 }); 3489 break; 3490 3491 case 'fadeinout': 3492 case 'fade_in_out': 3493 var fadeInNew = function fadeInNew() { 3494 $new.fadeIn({ 3495 duration: options.duration / 2, 3496 complete: options.complete, 3497 easing: options.easing || undefined 3498 }); 3499 }; 3500 3501 if ($old.length) { 3502 $old.fadeOut({ 3503 duration: options.duration / 2, 3504 complete: fadeInNew, 3505 easing: options.easing || undefined 3506 }); 3507 } else { 3508 fadeInNew(); 3509 } 3510 3511 break; 3512 3513 case 'pushleft': 3514 case 'push_left': 3515 case 'pushright': 3516 case 'push_right': 3517 case 'pushup': 3518 case 'push_up': 3519 case 'pushdown': 3520 case 'push_down': 3521 case 'coverleft': 3522 case 'cover_left': 3523 case 'coverright': 3524 case 'cover_right': 3525 case 'coverup': 3526 case 'cover_up': 3527 case 'coverdown': 3528 case 'cover_down': 3529 var transitionParts = transition.match(/^(cover|push)_?(.*)$/); 3530 var animProp = transitionParts[2] === 'left' ? 'right' : transitionParts[2] === 'right' ? 'left' : transitionParts[2] === 'down' ? 'top' : transitionParts[2] === 'up' ? 'bottom' : 'right'; 3531 var newCssStart = { 3532 'display': '' 3533 }, 3534 newCssAnim = {}; 3535 newCssStart[animProp] = '-100%'; 3536 newCssAnim[animProp] = 0; 3537 $new.css(newCssStart).animate(newCssAnim, { 3538 duration: options.duration, 3539 complete: function complete() { 3540 $new.css(animProp, ''); 3541 options.complete.apply(this, arguments); 3542 }, 3543 easing: options.easing || undefined 3544 }); 3545 3546 if (transitionParts[1] === 'push' && $old.length) { 3547 var oldCssAnim = {}; 3548 oldCssAnim[animProp] = '100%'; 3549 $old.animate(oldCssAnim, { 3550 duration: options.duration, 3551 complete: function complete() { 3552 $old.css('display', 'none'); 3553 }, 3554 easing: options.easing || undefined 3555 }); 3556 } 3557 3558 break; 3559 } 3560 }; 3561 /* PUBLIC METHODS 3562 * ========================= */ 3563 3564 3565 Backstretch.prototype = { 3566 resize: function resize() { 3567 try { 3568 // Check for a better suited image after the resize 3569 var $resTest = this.options.alwaysTestWindowResolution ? $(window) : this.$root; 3570 var newContainerWidth = $resTest.width(); 3571 var newContainerHeight = $resTest.height(); 3572 var changeRatioW = newContainerWidth / (this._lastResizeContainerWidth || 0); 3573 var changeRatioH = newContainerHeight / (this._lastResizeContainerHeight || 0); 3574 var resolutionChangeRatioThreshold = this.options.resolutionChangeRatioThreshold || 0.0; // check for big changes in container size 3575 3576 if ((newContainerWidth !== this._lastResizeContainerWidth || newContainerHeight !== this._lastResizeContainerHeight) && (Math.abs(changeRatioW - 1) >= resolutionChangeRatioThreshold || isNaN(changeRatioW) || Math.abs(changeRatioH - 1) >= resolutionChangeRatioThreshold || isNaN(changeRatioH))) { 3577 this._lastResizeContainerWidth = newContainerWidth; 3578 this._lastResizeContainerHeight = newContainerHeight; // Big change: rebuild the entire images array 3579 3580 this.images = optimalSizeImages($resTest, this.originalImages); // Preload them (they will be automatically inserted on the next cycle) 3581 3582 if (this.options.preload) { 3583 preload(this.images, (this.index + 1) % this.images.length, this.options.preload); 3584 } // In case there is no cycle and the new source is different than the current 3585 3586 3587 if (this.images.length === 1 && this._currentImage.url !== this.images[0].url) { 3588 // Wait a little an update the image being showed 3589 var that = this; 3590 clearTimeout(that._selectAnotherResolutionTimeout); 3591 that._selectAnotherResolutionTimeout = setTimeout(function () { 3592 that.show(0); 3593 }, this.options.resolutionRefreshRate); 3594 } 3595 } 3596 3597 var bgCSS = { 3598 left: 0, 3599 top: 0, 3600 right: 'auto', 3601 bottom: 'auto' 3602 }, 3603 rootWidth = this.isBody ? this.$root.width() : this.$root.innerWidth(), 3604 rootHeight = this.isBody ? window.innerHeight ? window.innerHeight : this.$root.height() : this.$root.innerHeight(), 3605 bgWidth = rootWidth, 3606 bgHeight = bgWidth / this.$itemWrapper.data('ratio'), 3607 evt = $.Event('backstretch.resize', { 3608 relatedTarget: this.$container[0] 3609 }), 3610 bgOffset, 3611 alignX = this._currentImage.alignX === undefined ? this.options.alignX : this._currentImage.alignX, 3612 alignY = this._currentImage.alignY === undefined ? this.options.alignY : this._currentImage.alignY; // Make adjustments based on image ratio 3613 3614 if (bgHeight >= rootHeight) { 3615 bgCSS.top = -(bgHeight - rootHeight) * alignY; 3616 } else { 3617 bgHeight = rootHeight; 3618 bgWidth = bgHeight * this.$itemWrapper.data('ratio'); 3619 bgOffset = (bgWidth - rootWidth) / 2; 3620 bgCSS.left = -(bgWidth - rootWidth) * alignX; 3621 } 3622 3623 if (!this.options.bypassCss) { 3624 this.$wrap.css({ 3625 width: rootWidth, 3626 height: rootHeight 3627 }).find('>.backstretch-item').not('.deleteable').each(function () { 3628 var $wrapper = $(this); 3629 $wrapper.find('img,video,iframe').css({ 3630 width: bgWidth, 3631 height: bgHeight 3632 }).css(bgCSS); 3633 }); 3634 } 3635 3636 this.$container.trigger(evt, this); 3637 } catch (err) {// IE7 seems to trigger resize before the image is loaded. 3638 // This try/catch block is a hack to let it fail gracefully. 3639 } 3640 3641 return this; 3642 } // Show the slide at a certain position 3643 , 3644 show: function show(newIndex, overrideOptions) { 3645 // Validate index 3646 if (Math.abs(newIndex) > this.images.length - 1) { 3647 return; 3648 } // Vars 3649 3650 3651 var that = this, 3652 $oldItemWrapper = that.$wrap.find('>.backstretch-item').addClass('deleteable'), 3653 oldVideoWrapper = that.videoWrapper, 3654 evtOptions = { 3655 relatedTarget: that.$container[0] 3656 }; // Trigger the "before" event 3657 3658 that.$container.trigger($.Event('backstretch.before', evtOptions), [that, newIndex]); // Set the new frame index 3659 3660 this.index = newIndex; 3661 var selectedImage = that.images[newIndex]; // Pause the slideshow 3662 3663 clearTimeout(that._cycleTimeout); // New image 3664 3665 delete that.videoWrapper; // Current item may not be a video 3666 3667 var isVideo = isVideoSource(selectedImage); 3668 3669 if (isVideo) { 3670 that.videoWrapper = new VideoWrapper(selectedImage); 3671 that.$item = that.videoWrapper.$video.css('pointer-events', 'none'); 3672 } else { 3673 that.$item = $('<img />'); 3674 } 3675 3676 that.$itemWrapper = $('<div class="backstretch-item">').append(that.$item); 3677 3678 if (this.options.bypassCss) { 3679 that.$itemWrapper.css({ 3680 'display': 'none' 3681 }); 3682 } else { 3683 that.$itemWrapper.css(styles.itemWrapper); 3684 that.$item.css(styles.item); 3685 } 3686 3687 that.$item.bind(isVideo ? 'canplay' : 'load', function (e) { 3688 var $this = $(this), 3689 $wrapper = $this.parent(), 3690 options = $wrapper.data('options'); 3691 3692 if (overrideOptions) { 3693 options = $.extend({}, options, overrideOptions); 3694 } 3695 3696 var imgWidth = this.naturalWidth || this.videoWidth || this.width, 3697 imgHeight = this.naturalHeight || this.videoHeight || this.height; // Save the ratio 3698 3699 $wrapper.data('ratio', imgWidth / imgHeight); 3700 3701 var getOption = function getOption(opt) { 3702 return options[opt] !== undefined ? options[opt] : that.options[opt]; 3703 }; 3704 3705 var transition = getOption('transition'); 3706 var transitionEasing = getOption('transitionEasing'); 3707 var transitionDuration = getOption('transitionDuration'); // Show the image, then delete the old one 3708 3709 var bringInNextImage = function bringInNextImage() { 3710 if (oldVideoWrapper) { 3711 oldVideoWrapper.stop(); 3712 oldVideoWrapper.destroy(); 3713 } 3714 3715 $oldItemWrapper.remove(); // Resume the slideshow 3716 3717 if (!that.paused && that.images.length > 1) { 3718 that.cycle(); 3719 } // Now we can clear the background on the element, to spare memory 3720 3721 3722 if (!that.options.bypassCss && !that.isBody) { 3723 that.$container.css('background-image', 'none'); 3724 } // Trigger the "after" and "show" events 3725 // "show" is being deprecated 3726 3727 3728 $(['after', 'show']).each(function () { 3729 that.$container.trigger($.Event('backstretch.' + this, evtOptions), [that, newIndex]); 3730 }); 3731 3732 if (isVideo) { 3733 that.videoWrapper.play(); 3734 } 3735 }; 3736 3737 if (that.firstShow && !that.options.animateFirst || !transitionDuration || !transition) { 3738 // Avoid transition on first show or if there's no transitionDuration value 3739 $wrapper.show(); 3740 bringInNextImage(); 3741 } else { 3742 performTransition({ 3743 'new': $wrapper, 3744 old: $oldItemWrapper, 3745 transition: transition, 3746 duration: transitionDuration, 3747 easing: transitionEasing, 3748 complete: bringInNextImage 3749 }); 3750 } 3751 3752 that.firstShow = false; // Resize 3753 3754 that.resize(); 3755 }); 3756 that.$itemWrapper.appendTo(that.$wrap); 3757 that.$item.attr('alt', selectedImage.alt || ''); 3758 that.$itemWrapper.data('options', selectedImage); 3759 3760 if (!isVideo) { 3761 that.$item.attr('src', selectedImage.url); 3762 } 3763 3764 that._currentImage = selectedImage; 3765 return that; 3766 }, 3767 current: function current() { 3768 return this.index; 3769 }, 3770 next: function next() { 3771 var args = Array.prototype.slice.call(arguments, 0); 3772 args.unshift(this.index < this.images.length - 1 ? this.index + 1 : 0); 3773 return this.show.apply(this, args); 3774 }, 3775 prev: function prev() { 3776 var args = Array.prototype.slice.call(arguments, 0); 3777 args.unshift(this.index === 0 ? this.images.length - 1 : this.index - 1); 3778 return this.show.apply(this, args); 3779 }, 3780 pause: function pause() { 3781 // Pause the slideshow 3782 this.paused = true; 3783 3784 if (this.videoWrapper) { 3785 this.videoWrapper.pause(); 3786 } 3787 3788 return this; 3789 }, 3790 resume: function resume() { 3791 // Resume the slideshow 3792 this.paused = false; 3793 3794 if (this.videoWrapper) { 3795 this.videoWrapper.play(); 3796 } 3797 3798 this.cycle(); 3799 return this; 3800 }, 3801 cycle: function cycle() { 3802 // Start/resume the slideshow 3803 if (this.images.length > 1) { 3804 // Clear the timeout, just in case 3805 clearTimeout(this._cycleTimeout); 3806 var duration = this._currentImage && this._currentImage.duration || this.options.duration; 3807 var isVideo = isVideoSource(this._currentImage); 3808 3809 var callNext = function callNext() { 3810 this.$item.off('.cycle'); // Check for paused slideshow 3811 3812 if (!this.paused) { 3813 this.next(); 3814 } 3815 }; // Special video handling 3816 3817 3818 if (isVideo) { 3819 // Leave video at last frame 3820 if (!this._currentImage.loop) { 3821 var lastFrameTimeout = 0; 3822 this.$item.on('playing.cycle', function () { 3823 var player = $(this).data('player'); 3824 clearTimeout(lastFrameTimeout); 3825 lastFrameTimeout = setTimeout(function () { 3826 player.pause(); 3827 player.$video.trigger('ended'); 3828 }, (player.getDuration() - player.getCurrentTime()) * 1000); 3829 }).on('ended.cycle', function () { 3830 clearTimeout(lastFrameTimeout); 3831 }); 3832 } // On error go to next 3833 3834 3835 this.$item.on('error.cycle initerror.cycle', $.proxy(callNext, this)); 3836 } 3837 3838 if (isVideo && !this._currentImage.duration) { 3839 // It's a video - playing until end 3840 this.$item.on('ended.cycle', $.proxy(callNext, this)); 3841 } else { 3842 // Cycling according to specified duration 3843 this._cycleTimeout = setTimeout($.proxy(callNext, this), duration); 3844 } 3845 } 3846 3847 return this; 3848 }, 3849 destroy: function destroy(preserveBackground) { 3850 // Stop the resize events 3851 $(window).off('resize.backstretch orientationchange.backstretch'); // Stop any videos 3852 3853 if (this.videoWrapper) { 3854 this.videoWrapper.destroy(); 3855 } // Clear the timeout 3856 3857 3858 clearTimeout(this._cycleTimeout); // Remove Backstretch 3859 3860 if (!preserveBackground) { 3861 this.$wrap.remove(); 3862 } 3863 3864 this.$container.removeData('backstretch'); 3865 } 3866 }; 3867 /** 3868 * Video Abstraction Layer 3869 * 3870 * Static methods: 3871 * > VideoWrapper.loadYoutubeAPI() -> Call in order to load the Youtube API. 3872 * An 'youtube_api_load' event will be triggered on $(window) when the API is loaded. 3873 * 3874 * Generic: 3875 * > player.type -> type of the video 3876 * > player.video / player.$video -> contains the element holding the video 3877 * > player.play() -> plays the video 3878 * > player.pause() -> pauses the video 3879 * > player.setCurrentTime(position) -> seeks to a position by seconds 3880 * 3881 * Youtube: 3882 * > player.ytId will contain the youtube ID if the source is a youtube url 3883 * > player.ytReady is a flag telling whether the youtube source is ready for playback 3884 * */ 3885 3886 var VideoWrapper = function VideoWrapper() { 3887 this.init.apply(this, arguments); 3888 }; 3889 /** 3890 * @param {Object} options 3891 * @param {String|Array<String>|Array<{{src: String, type: String?}}>} options.url 3892 * @param {Boolean} options.loop=false 3893 * @param {Boolean?} options.mute=true 3894 * @param {String?} options.poster 3895 * loop, mute, poster 3896 */ 3897 3898 3899 VideoWrapper.prototype.init = function (options) { 3900 var that = this; 3901 var $video; 3902 3903 var setVideoElement = function setVideoElement() { 3904 that.$video = $video; 3905 that.video = $video[0]; 3906 }; // Determine video type 3907 3908 3909 var videoType = 'video'; 3910 3911 if (!(options.url instanceof Array) && YOUTUBE_REGEXP.test(options.url)) { 3912 videoType = 'youtube'; 3913 } 3914 3915 that.type = videoType; 3916 3917 if (videoType === 'youtube') { 3918 // Try to load the API in the meantime 3919 VideoWrapper.loadYoutubeAPI(); 3920 that.ytId = options.url.match(YOUTUBE_REGEXP)[2]; 3921 var src = 'https://www.youtube.com/embed/' + that.ytId + '?rel=0&autoplay=0&showinfo=0&controls=0&modestbranding=1' + '&cc_load_policy=0&disablekb=1&iv_load_policy=3&loop=0' + '&enablejsapi=1&origin=' + encodeURIComponent(window.location.origin); 3922 that.__ytStartMuted = !!options.mute || options.mute === undefined; 3923 $video = $('<iframe />').attr({ 3924 'src_to_load': src 3925 }).css({ 3926 'border': 0, 3927 'margin': 0, 3928 'padding': 0 3929 }).data('player', that); 3930 3931 if (options.loop) { 3932 $video.on('ended.loop', function () { 3933 if (!that.__manuallyStopped) { 3934 that.play(); 3935 } 3936 }); 3937 } 3938 3939 that.ytReady = false; 3940 setVideoElement(); 3941 3942 if (window['YT']) { 3943 that._initYoutube(); 3944 3945 $video.trigger('initsuccess'); 3946 } else { 3947 $(window).one('youtube_api_load', function () { 3948 that._initYoutube(); 3949 3950 $video.trigger('initsuccess'); 3951 }); 3952 } 3953 } else { 3954 // Traditional <video> tag with multiple sources 3955 $video = $('<video>').prop('autoplay', false).prop('controls', false).prop('loop', !!options.loop).prop('muted', !!options.mute || options.mute === undefined) // Let the first frames be available before playback, as we do transitions 3956 .prop('preload', 'auto').prop('poster', options.poster || ''); 3957 var sources = options.url instanceof Array ? options.url : [options.url]; 3958 3959 for (var i = 0; i < sources.length; i++) { 3960 var sourceItem = sources[i]; 3961 3962 if (typeof sourceItem === 'string') { 3963 sourceItem = { 3964 src: sourceItem 3965 }; 3966 } 3967 3968 $('<source>').attr('src', sourceItem.src) // Make sure to not specify type if unknown - 3969 // so the browser will try to autodetect. 3970 .attr('type', sourceItem.type || null).appendTo($video); 3971 } 3972 3973 if (!$video[0].canPlayType || !sources.length) { 3974 $video.trigger('initerror'); 3975 } else { 3976 $video.trigger('initsuccess'); 3977 } 3978 3979 setVideoElement(); 3980 } 3981 }; 3982 3983 VideoWrapper.prototype._initYoutube = function () { 3984 var that = this; 3985 var YT = window['YT']; 3986 that.$video.attr('src', that.$video.attr('src_to_load')).removeAttr('src_to_load'); // It won't init if it's not in the DOM, so we emulate that 3987 3988 var hasParent = !!that.$video[0].parentNode; 3989 3990 if (!hasParent) { 3991 var $tmpParent = $('<div>').css('display', 'none !important').appendTo(document.body); 3992 that.$video.appendTo($tmpParent); 3993 } 3994 3995 var player = new YT.Player(that.video, { 3996 events: { 3997 'onReady': function onReady() { 3998 if (that.__ytStartMuted) { 3999 player.mute(); 4000 } 4001 4002 if (!hasParent) { 4003 // Restore parent to old state - without interrupting any changes 4004 if (that.$video[0].parentNode === $tmpParent[0]) { 4005 that.$video.detach(); 4006 } 4007 4008 $tmpParent.remove(); 4009 } 4010 4011 that.ytReady = true; 4012 4013 that._updateYoutubeSize(); 4014 4015 that.$video.trigger('canplay'); 4016 }, 4017 'onStateChange': function onStateChange(event) { 4018 switch (event.data) { 4019 case YT.PlayerState.PLAYING: 4020 that.$video.trigger('playing'); 4021 break; 4022 4023 case YT.PlayerState.ENDED: 4024 that.$video.trigger('ended'); 4025 break; 4026 4027 case YT.PlayerState.PAUSED: 4028 that.$video.trigger('pause'); 4029 break; 4030 4031 case YT.PlayerState.BUFFERING: 4032 that.$video.trigger('waiting'); 4033 break; 4034 4035 case YT.PlayerState.CUED: 4036 that.$video.trigger('canplay'); 4037 break; 4038 } 4039 }, 4040 'onPlaybackQualityChange': function onPlaybackQualityChange() { 4041 that._updateYoutubeSize(); 4042 4043 that.$video.trigger('resize'); 4044 }, 4045 'onError': function onError(err) { 4046 that.hasError = true; 4047 that.$video.trigger({ 4048 'type': 'error', 4049 'error': err 4050 }); 4051 } 4052 } 4053 }); 4054 that.ytPlayer = player; 4055 return that; 4056 }; 4057 4058 VideoWrapper.prototype._updateYoutubeSize = function () { 4059 var that = this; 4060 4061 switch (that.ytPlayer.getPlaybackQuality() || 'medium') { 4062 case 'small': 4063 that.video.videoWidth = 426; 4064 that.video.videoHeight = 240; 4065 break; 4066 4067 case 'medium': 4068 that.video.videoWidth = 640; 4069 that.video.videoHeight = 360; 4070 break; 4071 4072 default: 4073 case 'large': 4074 that.video.videoWidth = 854; 4075 that.video.videoHeight = 480; 4076 break; 4077 4078 case 'hd720': 4079 that.video.videoWidth = 1280; 4080 that.video.videoHeight = 720; 4081 break; 4082 4083 case 'hd1080': 4084 that.video.videoWidth = 1920; 4085 that.video.videoHeight = 1080; 4086 break; 4087 4088 case 'highres': 4089 that.video.videoWidth = 2560; 4090 that.video.videoHeight = 1440; 4091 break; 4092 } 4093 4094 return that; 4095 }; 4096 4097 VideoWrapper.prototype.play = function () { 4098 var that = this; 4099 that.__manuallyStopped = false; 4100 4101 if (that.type === 'youtube') { 4102 if (that.ytReady) { 4103 that.$video.trigger('play'); 4104 that.ytPlayer.playVideo(); 4105 } 4106 } else { 4107 that.video.play(); 4108 } 4109 4110 return that; 4111 }; 4112 4113 VideoWrapper.prototype.pause = function () { 4114 var that = this; 4115 that.__manuallyStopped = false; 4116 4117 if (that.type === 'youtube') { 4118 if (that.ytReady) { 4119 that.ytPlayer.pauseVideo(); 4120 } 4121 } else { 4122 that.video.pause(); 4123 } 4124 4125 return that; 4126 }; 4127 4128 VideoWrapper.prototype.stop = function () { 4129 var that = this; 4130 that.__manuallyStopped = true; 4131 4132 if (that.type === 'youtube') { 4133 if (that.ytReady) { 4134 that.ytPlayer.pauseVideo(); 4135 that.ytPlayer.seekTo(0); 4136 } 4137 } else { 4138 that.video.pause(); 4139 that.video.currentTime = 0; 4140 } 4141 4142 return that; 4143 }; 4144 4145 VideoWrapper.prototype.destroy = function () { 4146 var that = this; 4147 4148 if (that.ytPlayer) { 4149 that.ytPlayer.destroy(); 4150 } 4151 4152 that.$video.remove(); 4153 return that; 4154 }; 4155 4156 VideoWrapper.prototype.getCurrentTime = function (seconds) { 4157 var that = this; 4158 4159 if (that.type === 'youtube') { 4160 if (that.ytReady) { 4161 return that.ytPlayer.getCurrentTime(); 4162 } 4163 } else { 4164 return that.video.currentTime; 4165 } 4166 4167 return 0; 4168 }; 4169 4170 VideoWrapper.prototype.setCurrentTime = function (seconds) { 4171 var that = this; 4172 4173 if (that.type === 'youtube') { 4174 if (that.ytReady) { 4175 that.ytPlayer.seekTo(seconds, true); 4176 } 4177 } else { 4178 that.video.currentTime = seconds; 4179 } 4180 4181 return that; 4182 }; 4183 4184 VideoWrapper.prototype.getDuration = function () { 4185 var that = this; 4186 4187 if (that.type === 'youtube') { 4188 if (that.ytReady) { 4189 return that.ytPlayer.getDuration(); 4190 } 4191 } else { 4192 return that.video.duration; 4193 } 4194 4195 return 0; 4196 }; 4197 /** 4198 * This will load the youtube API (if not loaded yet) 4199 * Use $(window).one('youtube_api_load', ...) to listen for API loaded event 4200 */ 4201 4202 4203 VideoWrapper.loadYoutubeAPI = function () { 4204 if (window['YT']) { 4205 return; 4206 } 4207 4208 if (!$('script[src*=www\\.youtube\\.com\\/iframe_api]').length) { 4209 $('<script type="text/javascript" src="https://www.youtube.com/iframe_api">').appendTo('body'); 4210 } 4211 4212 var ytAPILoadInt = setInterval(function () { 4213 if (window['YT'] && window['YT'].loaded) { 4214 $(window).trigger('youtube_api_load'); 4215 clearTimeout(ytAPILoadInt); 4216 } 4217 }, 50); 4218 }; 4219 4220 var getDeviceOrientation = function getDeviceOrientation() { 4221 if ('matchMedia' in window) { 4222 if (window.matchMedia("(orientation: portrait)").matches) { 4223 return 'portrait'; 4224 } else if (window.matchMedia("(orientation: landscape)").matches) { 4225 return 'landscape'; 4226 } 4227 } 4228 4229 if (screen.height > screen.width) { 4230 return 'portrait'; 4231 } // Even square devices have orientation, 4232 // but a desktop browser may be too old for `matchMedia`. 4233 // Defaulting to `landscape` for the VERY rare case of a square desktop screen is good enough. 4234 4235 4236 return 'landscape'; 4237 }; 4238 4239 var getWindowOrientation = function getWindowOrientation() { 4240 if (window.innerHeight > window.innerWidth) { 4241 return 'portrait'; 4242 } 4243 4244 if (window.innerWidth > window.innerHeight) { 4245 return 'landscape'; 4246 } 4247 4248 return 'square'; 4249 }; 4250 /* SUPPORTS FIXED POSITION? 4251 * 4252 * Based on code from jQuery Mobile 1.1.0 4253 * http://jquerymobile.com/ 4254 * 4255 * In a nutshell, we need to figure out if fixed positioning is supported. 4256 * Unfortunately, this is very difficult to do on iOS, and usually involves 4257 * injecting content, scrolling the page, etc.. It's ugly. 4258 * jQuery Mobile uses this workaround. It's not ideal, but works. 4259 * 4260 * Modified to detect IE6 4261 * ========================= */ 4262 4263 4264 var supportsFixedPosition = function () { 4265 var ua = navigator.userAgent, 4266 platform = navigator.platform // Rendering engine is Webkit, and capture major version 4267 , 4268 wkmatch = ua.match(/AppleWebKit\/([0-9]+)/), 4269 wkversion = !!wkmatch && wkmatch[1], 4270 ffmatch = ua.match(/Fennec\/([0-9]+)/), 4271 ffversion = !!ffmatch && ffmatch[1], 4272 operammobilematch = ua.match(/Opera Mobi\/([0-9]+)/), 4273 omversion = !!operammobilematch && operammobilematch[1], 4274 iematch = ua.match(/MSIE ([0-9]+)/), 4275 ieversion = !!iematch && iematch[1]; 4276 return !( // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5) 4277 (platform.indexOf("iPhone") > -1 || platform.indexOf("iPad") > -1 || platform.indexOf("iPod") > -1) && wkversion && wkversion < 534 || // Opera Mini 4278 window.operamini && {}.toString.call(window.operamini) === "[object OperaMini]" || operammobilematch && omversion < 7458 || //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2) 4279 ua.indexOf("Android") > -1 && wkversion && wkversion < 533 || // Firefox Mobile before 6.0 - 4280 ffversion && ffversion < 6 || // WebOS less than 3 4281 "palmGetResource" in window && wkversion && wkversion < 534 || // MeeGo 4282 ua.indexOf("MeeGo") > -1 && ua.indexOf("NokiaBrowser/8.5.0") > -1 || // IE6 4283 ieversion && ieversion <= 6); 4284 }(); 4285 })(jQuery, window); 4286 4287 /***/ }), 4288 4289 /***/ "../assets/js/libs/typed.js": 4290 /*!**********************************!*\ 4291 !*** ../assets/js/libs/typed.js ***! 4292 \**********************************/ 4293 /*! no static exports found */ 4294 /***/ (function(module, exports) { 4295 4296 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } 4297 4298 function _typeof(obj) { 4299 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { 4300 _typeof = function _typeof(obj) { 4301 return _typeof2(obj); 4302 }; 4303 } else { 4304 _typeof = function _typeof(obj) { 4305 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 4306 }; 4307 } 4308 4309 return _typeof(obj); 4310 } // The MIT License (MIT) 4311 // Typed.js | Copyright (c) 2016 Matt Boldt | www.mattboldt.com 4312 // Permission is hereby granted, free of charge, to any person obtaining a copy 4313 // of this software and associated documentation files (the "Software"), to deal 4314 // in the Software without restriction, including without limitation the rights 4315 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4316 // copies of the Software, and to permit persons to whom the Software is 4317 // furnished to do so, subject to the following conditions: 4318 // The above copyright notice and this permission notice shall be included in 4319 // all copies or substantial portions of the Software. 4320 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4321 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4322 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4323 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4324 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4325 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4326 // THE SOFTWARE. 4327 4328 4329 !function (window, document, $) { 4330 "use strict"; 4331 4332 var Typed = function Typed(el, options) { 4333 var self = this; // chosen element to manipulate text 4334 4335 this.el = el; // options 4336 4337 this.options = {}; 4338 Object.keys(defaults).forEach(function (key) { 4339 self.options[key] = defaults[key]; 4340 }); 4341 Object.keys(options).forEach(function (key) { 4342 self.options[key] = options[key]; 4343 }); // attribute to type into 4344 4345 this.isInput = this.el.tagName.toLowerCase() === 'input'; 4346 this.attr = this.options.attr; // show cursor 4347 4348 this.showCursor = this.isInput ? false : this.options.showCursor; // text content of element 4349 4350 this.elContent = this.attr ? this.el.getAttribute(this.attr) : this.el.textContent; // html or plain text 4351 4352 this.contentType = this.options.contentType; // typing speed 4353 4354 this.typeSpeed = this.options.typeSpeed; // add a delay before typing starts 4355 4356 this.startDelay = this.options.startDelay; // backspacing speed 4357 4358 this.backSpeed = this.options.backSpeed; // amount of time to wait before backspacing 4359 4360 this.backDelay = this.options.backDelay; // Fade out instead of backspace 4361 4362 this.fadeOut = this.options.fadeOut; 4363 this.fadeOutClass = this.options.fadeOutClass; 4364 this.fadeOutDelay = this.options.fadeOutDelay; // div containing strings 4365 4366 if ($ && this.options.stringsElement instanceof $) { 4367 this.stringsElement = this.options.stringsElement[0]; 4368 } else { 4369 this.stringsElement = this.options.stringsElement; 4370 } // input strings of text 4371 4372 4373 this.strings = this.options.strings; // character number position of current string 4374 4375 this.strPos = 0; // current array position 4376 4377 this.arrayPos = 0; // number to stop backspacing on. 4378 // default 0, can change depending on how many chars 4379 // you want to remove at the time 4380 4381 this.stopNum = 0; // Looping logic 4382 4383 this.loop = this.options.loop; 4384 this.loopCount = this.options.loopCount; 4385 this.curLoop = 0; // for stopping 4386 4387 this.stop = false; // custom cursor 4388 4389 this.cursorChar = this.options.cursorChar; // shuffle the strings 4390 4391 this.shuffle = this.options.shuffle; // the order of strings 4392 4393 this.sequence = []; // All systems go! 4394 4395 this.build(); 4396 }; 4397 4398 Typed.prototype = { 4399 constructor: Typed, 4400 init: function init() { 4401 // begin the loop w/ first current string (global self.strings) 4402 // current string will be passed as an argument each time after this 4403 var self = this; 4404 self.timeout = setTimeout(function () { 4405 for (var i = 0; i < self.strings.length; ++i) { 4406 self.sequence[i] = i; 4407 } // shuffle the array if true 4408 4409 4410 if (self.shuffle) self.sequence = self.shuffleArray(self.sequence); // Start typing 4411 4412 self.typewrite(self.strings[self.sequence[self.arrayPos]], self.strPos); 4413 }, self.startDelay); 4414 }, 4415 build: function build() { 4416 var self = this; // Insert cursor 4417 4418 if (this.showCursor === true) { 4419 this.cursor = document.createElement('span'); 4420 this.cursor.className = 'typed-cursor'; 4421 this.cursor.innerHTML = this.cursorChar; 4422 this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling); 4423 } 4424 4425 if (this.stringsElement) { 4426 this.strings = []; 4427 this.stringsElement.style.display = 'none'; 4428 var strings = Array.prototype.slice.apply(this.stringsElement.children); 4429 strings.forEach(function (stringElement) { 4430 self.strings.push(stringElement.innerHTML); 4431 }); 4432 } 4433 4434 this.init(); 4435 }, 4436 // pass current string state to each function, types 1 char per call 4437 typewrite: function typewrite(curString, curStrPos) { 4438 // exit when stopped 4439 if (this.stop === true) { 4440 return; 4441 } 4442 4443 if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) { 4444 this.el.classList.remove(this.fadeOutClass); 4445 this.cursor.classList.remove(this.fadeOutClass); 4446 } // varying values for setTimeout during typing 4447 // can't be global since number changes each time loop is executed 4448 4449 4450 var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed; 4451 var self = this; // ------------- optional ------------- // 4452 // backpaces a certain string faster 4453 // ------------------------------------ // 4454 // if (self.arrayPos == 1){ 4455 // self.backDelay = 50; 4456 // } 4457 // else{ self.backDelay = 500; } 4458 // contain typing function in a timeout humanize'd delay 4459 4460 self.timeout = setTimeout(function () { 4461 // check for an escape character before a pause value 4462 // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^ 4463 // single ^ are removed from string 4464 var charPause = 0; 4465 var substr = curString.substr(curStrPos); 4466 4467 if (substr.charAt(0) === '^') { 4468 var skip = 1; // skip atleast 1 4469 4470 if (/^\^\d+/.test(substr)) { 4471 substr = /\d+/.exec(substr)[0]; 4472 skip += substr.length; 4473 charPause = parseInt(substr); 4474 } // strip out the escape character and pause value so they're not printed 4475 4476 4477 curString = curString.substring(0, curStrPos) + curString.substring(curStrPos + skip); 4478 } 4479 4480 if (self.contentType === 'html') { 4481 // skip over html tags while typing 4482 var curChar = curString.substr(curStrPos).charAt(0); 4483 4484 if (curChar === '<' 4485 /*|| curChar === '&'*/ 4486 ) { 4487 var tag = ''; 4488 var endTag = ''; 4489 4490 if (curChar === '<') { 4491 endTag = '>'; 4492 } else { 4493 endTag = ';'; 4494 } 4495 4496 while (curString.substr(curStrPos + 1).charAt(0) !== endTag) { 4497 tag += curString.substr(curStrPos).charAt(0); 4498 curStrPos++; 4499 4500 if (curStrPos + 1 > curString.length) { 4501 break; 4502 } 4503 } 4504 4505 curStrPos++; 4506 tag += endTag; 4507 } 4508 } // timeout for any pause after a character 4509 4510 4511 self.timeout = setTimeout(function () { 4512 if (curStrPos === curString.length) { 4513 // fires callback function 4514 self.options.onStringTyped(self.arrayPos); // is this the final string 4515 4516 if (self.arrayPos === self.strings.length - 1) { 4517 // animation that occurs on the last typed string 4518 self.options.callback(); 4519 self.curLoop++; // quit if we wont loop back 4520 4521 if (self.loop === false || self.curLoop === self.loopCount) return; 4522 } 4523 4524 self.timeout = setTimeout(function () { 4525 self.backspace(curString, curStrPos); 4526 }, self.backDelay); 4527 } else { 4528 /* call before functions if applicable */ 4529 if (curStrPos === 0) { 4530 self.options.preStringTyped(self.arrayPos); 4531 } // start typing each new char into existing string 4532 // curString: arg, self.el.html: original text inside element 4533 4534 4535 var nextString = curString.substr(0, curStrPos + 1); 4536 4537 if (self.attr) { 4538 self.el.setAttribute(self.attr, nextString); 4539 } else { 4540 if (self.isInput) { 4541 self.el.value = nextString; 4542 } else if (self.contentType === 'html') { 4543 self.el.innerHTML = nextString; 4544 } else { 4545 self.el.textContent = nextString; 4546 } 4547 } // add characters one by one 4548 4549 4550 curStrPos++; // loop the function 4551 4552 self.typewrite(curString, curStrPos); 4553 } // end of character pause 4554 4555 }, charPause); // humanized value for typing 4556 }, humanize); 4557 }, 4558 backspace: function backspace(curString, curStrPos) { 4559 var self = this; // exit when stopped 4560 4561 if (this.stop === true) { 4562 return; 4563 } 4564 4565 if (this.fadeOut) { 4566 this.initFadeOut(); 4567 return; 4568 } // varying values for setTimeout during typing 4569 // can't be global since number changes each time loop is executed 4570 4571 4572 var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed; 4573 self.timeout = setTimeout(function () { 4574 // ----- this part is optional ----- // 4575 // check string array position 4576 // on the first string, only delete one word 4577 // the stopNum actually represents the amount of chars to 4578 // keep in the current string. In my case it's 14. 4579 // if (self.arrayPos == 1){ 4580 // self.stopNum = 14; 4581 // } 4582 //every other time, delete the whole typed string 4583 // else{ 4584 // self.stopNum = 0; 4585 // } 4586 if (self.contentType === 'html') { 4587 // skip over html tags while backspacing 4588 if (curString.substr(curStrPos).charAt(0) === '>') { 4589 var tag = ''; 4590 4591 while (curString.substr(curStrPos - 1).charAt(0) !== '<') { 4592 tag -= curString.substr(curStrPos).charAt(0); 4593 curStrPos--; 4594 4595 if (curStrPos < 0) { 4596 break; 4597 } 4598 } 4599 4600 curStrPos--; 4601 tag += '<'; 4602 } 4603 } // ----- continue important stuff ----- // 4604 // replace text with base text + typed characters 4605 4606 4607 var nextString = curString.substr(0, curStrPos); 4608 self.replaceText(nextString); // if the number (id of character in current string) is 4609 // less than the stop number, keep going 4610 4611 if (curStrPos > self.stopNum) { 4612 // subtract characters one by one 4613 curStrPos--; // loop the function 4614 4615 self.backspace(curString, curStrPos); 4616 } // if the stop number has been reached, increase 4617 // array position to next string 4618 else if (curStrPos <= self.stopNum) { 4619 self.arrayPos++; 4620 4621 if (self.arrayPos === self.strings.length) { 4622 self.arrayPos = 0; // Shuffle sequence again 4623 4624 if (self.shuffle) self.sequence = self.shuffleArray(self.sequence); 4625 self.init(); 4626 } else self.typewrite(self.strings[self.sequence[self.arrayPos]], curStrPos); 4627 } // humanized value for typing 4628 4629 }, humanize); 4630 }, 4631 // Adds a CSS class to fade out current string 4632 initFadeOut: function initFadeOut() { 4633 self = this; 4634 this.el.className += ' ' + this.fadeOutClass; 4635 this.cursor.className += ' ' + this.fadeOutClass; 4636 return setTimeout(function () { 4637 self.arrayPos++; 4638 self.replaceText(''); 4639 self.typewrite(self.strings[self.sequence[self.arrayPos]], 0); 4640 }, self.fadeOutDelay); 4641 }, 4642 // Replaces current text in the HTML element 4643 replaceText: function replaceText(str) { 4644 if (this.attr) { 4645 this.el.setAttribute(this.attr, str); 4646 } else { 4647 if (this.isInput) { 4648 this.el.value = str; 4649 } else if (this.contentType === 'html') { 4650 this.el.innerHTML = str; 4651 } else { 4652 this.el.textContent = str; 4653 } 4654 } 4655 }, 4656 // Shuffles the numbers in the given array. 4657 shuffleArray: function shuffleArray(array) { 4658 var tmp, 4659 current, 4660 top = array.length; 4661 if (top) while (--top) { 4662 current = Math.floor(Math.random() * (top + 1)); 4663 tmp = array[current]; 4664 array[current] = array[top]; 4665 array[top] = tmp; 4666 } 4667 return array; 4668 }, 4669 // Start & Stop currently not working 4670 // , stop: function() { 4671 // var self = this; 4672 // self.stop = true; 4673 // clearInterval(self.timeout); 4674 // } 4675 // , start: function() { 4676 // var self = this; 4677 // if(self.stop === false) 4678 // return; 4679 // this.stop = false; 4680 // this.init(); 4681 // } 4682 // Reset and rebuild the element 4683 reset: function reset() { 4684 var self = this; 4685 clearInterval(self.timeout); 4686 var id = this.el.getAttribute('id'); 4687 this.el.textContent = ''; 4688 4689 if (typeof this.cursor !== 'undefined' && typeof this.cursor.parentNode !== 'undefined') { 4690 this.cursor.parentNode.removeChild(this.cursor); 4691 } 4692 4693 this.strPos = 0; 4694 this.arrayPos = 0; 4695 this.curLoop = 0; // Send the callback 4696 4697 this.options.resetCallback(); 4698 } 4699 }; 4700 4701 Typed.new = function (selector, option) { 4702 var elements = Array.prototype.slice.apply(document.querySelectorAll(selector)); 4703 elements.forEach(function (element) { 4704 var instance = element._typed, 4705 options = _typeof(option) == 'object' && option; 4706 4707 if (instance) { 4708 instance.reset(); 4709 } 4710 4711 element._typed = instance = new Typed(element, options); 4712 if (typeof option == 'string') instance[option](); 4713 }); 4714 }; 4715 4716 if ($) { 4717 $.fn.typed = function (option) { 4718 return this.each(function () { 4719 var $this = $(this), 4720 data = $this.data('typed'), 4721 options = _typeof(option) == 'object' && option; 4722 4723 if (data) { 4724 data.reset(); 4725 } 4726 4727 $this.data('typed', data = new Typed(this, options)); 4728 if (typeof option == 'string') data[option](); 4729 }); 4730 }; 4731 } 4732 4733 window.Typed = Typed; 4734 var defaults = { 4735 strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], 4736 stringsElement: null, 4737 // typing speed 4738 typeSpeed: 0, 4739 // time before typing starts 4740 startDelay: 0, 4741 // backspacing speed 4742 backSpeed: 0, 4743 // shuffle the strings 4744 shuffle: false, 4745 // time before backspacing 4746 backDelay: 500, 4747 // Fade out instead of backspace 4748 fadeOut: false, 4749 fadeOutClass: 'typed-fade-out', 4750 fadeOutDelay: 500, 4751 // milliseconds 4752 // loop 4753 loop: false, 4754 // false = infinite 4755 loopCount: false, 4756 // show cursor 4757 showCursor: true, 4758 // character for cursor 4759 cursorChar: "|", 4760 // attribute to type (null == text) 4761 attr: null, 4762 // either html or text 4763 contentType: 'html', 4764 // call when done callback function 4765 callback: function callback() {}, 4766 // starting callback function before each string 4767 preStringTyped: function preStringTyped() {}, 4768 //callback for every typed string 4769 onStringTyped: function onStringTyped() {}, 4770 // callback for reset 4771 resetCallback: function resetCallback() {} 4772 }; 4773 }(window, document, window.jQuery); 4774 4775 /***/ }), 4776 4777 /***/ "../assets/js/smoothscroll.js": 4778 /*!************************************!*\ 4779 !*** ../assets/js/smoothscroll.js ***! 4780 \************************************/ 4781 /*! no static exports found */ 4782 /***/ (function(module, exports) { 4783 4784 var currentPageURL = document.location.toString(); 4785 var isAnchor = false; 4786 4787 if (location.hash) { 4788 isAnchor = true; 4789 window.scrollTo(0, 0); 4790 } 4791 4792 (function ($) { 4793 if (window.useManagedSmoothScroll) { 4794 return; 4795 } 4796 4797 var duration = 1500; 4798 var easing = 'easeInOutQuart'; 4799 var lastId, anchors, scrollItems; 4800 4801 function targetIsSamePage(target) { 4802 return !target || target == "_self"; 4803 } 4804 4805 function getHash(url) { 4806 if (!url) { 4807 return false; 4808 } 4809 4810 var indexOfHash = url.indexOf('#'); 4811 4812 if (indexOfHash > -1) { 4813 if (indexOfHash === 0) { 4814 return url.replace('#', ''); 4815 } 4816 4817 var hash = url.substring(indexOfHash + 1); 4818 var urlQuery = ""; 4819 4820 if (url.indexOf('?') > -1) { 4821 urlQuery = url.substring(url.indexOf('?')); 4822 } 4823 4824 var absLinkRegExp = /(https?|file):\/\//; 4825 var pageLocation = window.location.pathname; 4826 var urlLocation = url.replace(urlQuery, '').replace('#' + hash, '').replace(absLinkRegExp, ''); 4827 4828 if (url.match(absLinkRegExp)) { 4829 pageLocation = window.location.host + pageLocation; 4830 } else { 4831 urlLocation = pageLocation.substring(0, pageLocation.lastIndexOf("/")) + "/" + urlLocation; 4832 } 4833 4834 if (pageLocation == urlLocation || pageLocation == urlLocation + "/") { 4835 return hash; 4836 } 4837 } 4838 4839 return false; 4840 } 4841 4842 function change_url_hash(hash) { 4843 setTimeout(function () { 4844 if (hash) { 4845 hash = "#" + hash; 4846 } else { 4847 hash = ""; 4848 } 4849 4850 if (history && history.replaceState) { 4851 history.replaceState({}, "", hash); 4852 } else {} 4853 }, 100); 4854 /* safari issue fixed by throtteling the event */ 4855 } 4856 4857 var scrollStarted = false; 4858 4859 function scrollToSection(section, elem) { 4860 if (scrollStarted) { 4861 return; 4862 } 4863 4864 try { 4865 scrollStarted = true; 4866 4867 if (section) { 4868 var parent; 4869 4870 if (elem) { 4871 parent = elem.parent().parentsUntil('body').filter(function () { 4872 if (jQuery(this).css('position') == "fixed" && !jQuery(this).is('.mobile-overlay')) return jQuery(this); 4873 }).eq(0); 4874 } 4875 4876 var topDistance = 0; 4877 4878 if (parent && parent.length) { 4879 var parentClass = parent.attr("class"); 4880 var flexiMenu = jQuery('div[class*="main-menu"]'); 4881 4882 if (parent.outerHeight() !== window.innerHeight || !parent.is('.full-sidebar')) { 4883 topDistance = parent.outerHeight() + parent.position().top; 4884 } 4885 } 4886 4887 var scrollToValue = section.offset().top - topDistance; 4888 4889 if (scrollToValue < 0) { 4890 scrollToValue = 0; 4891 } 4892 4893 var stickTo = jQuery("[data-cp-shrink=initial]"); 4894 4895 if (scrollToValue > stickTo.height()) { 4896 scrollToValue -= jQuery('[data-cp-shrink=shrinked]').height(); 4897 } 4898 4899 var ratio = Math.max(0.5, scrollToValue / jQuery('body').height()); 4900 jQuery('html, body').animate({ 4901 scrollTop: scrollToValue 4902 }, duration * ratio, easing, function () { 4903 scrollStarted = false; 4904 jQuery(window).trigger('scroll'); 4905 jQuery(document).trigger('scroll'); 4906 }); 4907 return true; 4908 } 4909 } catch (e) {// alert('error in xtd one page site script ' + e); 4910 } 4911 } 4912 4913 function linkClick(ev, elem) { 4914 if (!targetIsSamePage(elem.attr("target"))) { 4915 return; 4916 } 4917 4918 var section = elem.data('onepage-section') ? elem.data('onepage-section') : false; 4919 4920 if (section && section.length) { 4921 ev.preventDefault(); // ev.stopPropagation(); 4922 } 4923 4924 var scrolled = scrollToSection(section, elem); 4925 4926 if (scrolled && ev) { 4927 ev.preventDefault(); 4928 } 4929 } 4930 4931 function bubbleSortByTop(arr) { 4932 var swapped; 4933 4934 do { 4935 swapped = false; 4936 4937 for (var i = 0; i < arr.length - 1; i++) { 4938 var elem = arr[i]; 4939 var elem2 = arr[i + 1]; 4940 4941 if (elem.offset().top > elem2.offset().top) { 4942 var temp = arr[i]; 4943 arr[i] = arr[i + 1]; 4944 arr[i + 1] = temp; 4945 swapped = true; 4946 } 4947 } 4948 } while (swapped); 4949 } 4950 4951 function getAnchors() { 4952 scrollItems = []; 4953 anchors = jQuery('a:not(.screen-reader-text)').filter(function () { 4954 var elem = jQuery(this); 4955 var href = elem.attr('href'); 4956 var target = elem.attr('target'); 4957 var hash = getHash(href); 4958 4959 if (hash && hash !== 'wp-toolbar') { 4960 try { 4961 var section = jQuery("#" + hash); 4962 4963 if (section.length > 0) { 4964 elem.data('onepage-section', section); 4965 4966 if (elem.parent()[0].tagName == "LI") { 4967 var dataElem = section.data('onepage-anchor') || $(""); 4968 dataElem = dataElem.add(elem); 4969 section.data('onepage-anchor', dataElem); 4970 } 4971 4972 scrollItems.push(section); 4973 return true; 4974 } 4975 } catch (e) {} 4976 } 4977 4978 return false; 4979 }); 4980 anchors.each(function () { 4981 if (jQuery(this).closest('.fm2_mobile_jq_menu').length || !jQuery(this).is(':visible')) { 4982 return; 4983 } 4984 4985 if (jQuery(this).parent().is('li.menu-item')) { 4986 var selfAnchor = this; 4987 jQuery(this).unbind('click.onepage'); 4988 jQuery(this).attr('data-smoothscroll', 'true'); 4989 jQuery(this).parent().unbind('click.onepage').bind("click.onepage", function (e) { 4990 if (!jQuery(e.target).parent().is(e.currentTarget)) { 4991 return; 4992 } 4993 4994 e.preventDefault(); 4995 e.stopPropagation(); 4996 linkClick(e, jQuery(selfAnchor)); 4997 }); 4998 } else { 4999 jQuery(this).unbind('click.onepage').bind("click.onepage", function (e) { 5000 linkClick(e, jQuery(this)); 5001 }); 5002 } 5003 }); 5004 5005 try { 5006 bubbleSortByTop(scrollItems); 5007 } catch (e) {} 5008 } 5009 5010 var scrollTimeout; 5011 var is_touch_device = 'ontouchstart' in document.documentElement; 5012 5013 if (!is_touch_device) { 5014 jQuery(window).scroll(function () { 5015 clearTimeout(scrollTimeout); 5016 scrollTimeout = setTimeout(doneScrolling, 20); 5017 }); 5018 } 5019 5020 function doneScrolling() { 5021 var windowElem = jQuery(window); 5022 var fromTop = windowElem.scrollTop() + window.innerHeight * 0.5; 5023 var cur = []; 5024 5025 if (!scrollItems) { 5026 getAnchors(); 5027 } 5028 5029 for (var i = 0; i < scrollItems.length; i++) { 5030 if (scrollItems[i].offset().top < fromTop) { 5031 cur.push(scrollItems[i]); 5032 } 5033 } 5034 5035 var lastItem = scrollItems[scrollItems.length - 1]; 5036 5037 if (windowElem.scrollTop() + windowElem.height() + 50 >= jQuery(document).height()) { 5038 cur.push(lastItem); 5039 } 5040 5041 cur = cur[cur.length - 1]; 5042 var id = cur && cur.length ? cur[0].id : ""; 5043 change_url_hash(id); 5044 5045 if (id.length === 0 && anchors) { 5046 // anchors.closest('ul').find('.current_page_item').removeClass('current_page_item'); 5047 anchors.parent().addBack().removeClass('current_page_item current-menu-item'); 5048 var loc = (window.location + "").split('#')[0].replace(/\/$/, ""); 5049 anchors.closest('ul').find('[href$="' + loc + '"]').parent().addBack().addClass('current-menu-item'); 5050 5051 if (!loc.length) { 5052 anchors.closest('ul').find('[href$="' + window.location + '"]').parent().addBack().addClass('current-menu-item'); 5053 } 5054 } 5055 5056 if (lastId !== id && id.length) { 5057 lastId = id; 5058 5059 try { 5060 anchors.filter('.current_page_item, .current-menu-item').each(function () { 5061 jQuery(this).parent().addBack().removeClass('current_page_item current-menu-item'); 5062 }); 5063 anchors.closest('ul').find('.current_page_item, .current-menu-item').removeClass('current_page_item current-menu-item'); 5064 cur.data('onepage-anchor').each(function () { 5065 $(this).parent().addBack().addClass('current-menu-item'); 5066 }); 5067 } catch (e) {} 5068 } 5069 } 5070 5071 var id; 5072 jQuery(window).bind("resize orientationchange", function () { 5073 clearTimeout(id); 5074 id = setTimeout(doneResizing, 100); 5075 }); 5076 5077 function doneResizing() { 5078 getAnchors(); 5079 } 5080 5081 getAnchors(); 5082 is_touch_device = 'ontouchstart' in document.documentElement; 5083 5084 if (!is_touch_device) { 5085 doneScrolling(); 5086 } 5087 5088 if (isAnchor) { 5089 if (jQuery.find('a[href^="' + currentPageURL + '"]').length > 0) { 5090 jQuery(jQuery.find('a[href="' + currentPageURL + '"]')).trigger('click'); 5091 } else { 5092 var hash = getHash(currentPageURL); 5093 5094 if (hash.length) { 5095 jQuery(jQuery.find('a[href*="#' + hash + '"]')).trigger('click'); 5096 } 5097 } 5098 } else { 5099 jQuery('a[href*="#"]').each(function (index, el) { 5100 var parts = el.href.split('#'), 5101 anchor = parts[parts.length - 1]; 5102 5103 if (parts.length >= 2) { 5104 if (anchor.length) { 5105 jQuery(this).parent().addBack().removeClass('current_page_item current-menu-item'); 5106 } 5107 } 5108 }); 5109 } 5110 5111 if (window.wp && window.wp.customize) { 5112 $('.dropdown-menu').parent('div').parent().on('DOMNodeInserted DOMNodeRemoved', function (event) { 5113 getAnchors(); 5114 doneScrolling(); 5115 }); 5116 } 5117 5118 window.scrollToSection = scrollToSection; 5119 window.smoothScrollGetAnchors = getAnchors; 5120 })(jQuery); 5121 5122 /***/ }), 5123 5124 /***/ "../assets/js/sticky.js": 5125 /*!******************************!*\ 5126 !*** ../assets/js/sticky.js ***! 5127 \******************************/ 5128 /*! no static exports found */ 5129 /***/ (function(module, exports) { 5130 5131 (function () { 5132 window.materialisMenuSticky = function () { 5133 var $ = jQuery; 5134 var dataprefix = "data-sticky"; 5135 5136 function attrName(name) { 5137 return name ? dataprefix + "-" + name : dataprefix; 5138 } 5139 5140 var stickyElements = $('[' + dataprefix + ']'); 5141 stickyElements.each(function (index, el) { 5142 var $el = $(el); 5143 5144 if ($el.data('stickData')) { 5145 return; 5146 } 5147 5148 var distance = parseInt($el.attr(attrName())); 5149 var stickyOnMobile = $el.attr(attrName("mobile")) == "1"; 5150 var stickyOnTablet = true; //$el.attr(attrName("tablet")) == "1" ; 5151 5152 var useShrink = $el.attr(attrName("shrinked")) == "1"; 5153 var toBottom = $el.attr(attrName("to")) == "bottom"; 5154 var always = $el.attr(attrName("always")) == "1"; 5155 5156 if (always) { 5157 $el.addClass("fixto-fixed"); 5158 } 5159 5160 if (useShrink) { 5161 $el.attr(attrName(), "initial"); 5162 } 5163 5164 var stickData = { 5165 center: true, 5166 responsiveWidth: true, 5167 zIndex: 10000 + index, 5168 topSpacing: distance, 5169 stickyOnMobile: stickyOnMobile, 5170 stickyOnTablet: stickyOnTablet, 5171 useShrink: useShrink, 5172 toBottom: toBottom, 5173 useNativeSticky: false, 5174 always: always 5175 }; 5176 5177 if (useShrink) { 5178 return; 5179 } 5180 5181 if (distance === 0 && jQuery('#wpadminbar').length && jQuery('#wpadminbar').css('position') === "absolute") { 5182 distance = 0; 5183 } 5184 5185 stickData['topSpacing'] = distance; 5186 stickData['top'] = distance; 5187 $el.data('stickData', stickData); 5188 $el.fixTo('body', stickData); 5189 }); 5190 5191 var resizeCallback = function () { 5192 var stickyElements = this.$els; 5193 5194 if (window.innerWidth < 1024) { 5195 stickyElements.each(function (index, el) { 5196 var data = $(this).data(); 5197 var stickData = data.stickData; 5198 5199 if (!stickData) { 5200 return; 5201 } 5202 5203 var fixToInstance = data.fixtoInstance; 5204 if (!fixToInstance) return true; 5205 5206 if (window.innerWidth <= 767) { 5207 if (!stickData.stickyOnMobile) { 5208 fixToInstance.stop(); 5209 } 5210 } else { 5211 if (!stickData.stickyOnTablet) { 5212 fixToInstance.stop(); 5213 } 5214 } 5215 }); 5216 } else { 5217 stickyElements.each(function (index, el) { 5218 var data = $(this).data(); 5219 5220 if (!data) { 5221 return; 5222 } 5223 5224 var fixToInstance = data.fixtoInstance; 5225 if (!fixToInstance) return true; 5226 fixToInstance.start(); 5227 }); 5228 } 5229 }.bind({ 5230 "$els": stickyElements 5231 }); 5232 5233 $(window).bind('resize.sticky orientationchange.sticky', function () { 5234 setTimeout(resizeCallback, 50); 5235 }); 5236 $(window).trigger('resize.sticky'); 5237 }; 5238 5239 jQuery(document).ready(function ($) { 5240 materialisMenuSticky(); 5241 }); 5242 })(); 5243 5244 /***/ }), 5245 5246 /***/ "../assets/js/video-bg.js": 5247 /*!********************************!*\ 5248 !*** ../assets/js/video-bg.js ***! 5249 \********************************/ 5250 /*! no static exports found */ 5251 /***/ (function(module, exports) { 5252 5253 (function ($) { 5254 function getHandler() { 5255 for (var id in wp.customHeader.handlers) { 5256 var handle = wp.customHeader.handlers[id]; 5257 5258 if (handle.settings) { 5259 return handle; 5260 } 5261 } 5262 } 5263 5264 function resizeVideo(videoElement, animate) { 5265 var $videoElement = jQuery(videoElement); 5266 var size = materialis_video_background.getVideoRect(); 5267 $videoElement.css({ 5268 width: Math.round(size.width), 5269 "max-width": Math.round(size.width), 5270 height: Math.round(size.height), 5271 "opacity": 1, 5272 "left": size.left 5273 }); 5274 5275 if (animate === false) { 5276 return; 5277 } 5278 } 5279 5280 window.addEventListener('resize', function () { 5281 var videoElement = document.querySelector('video#wp-custom-header-video') || document.querySelector('iframe#wp-custom-header-video'); 5282 5283 if (videoElement) { 5284 resizeVideo(videoElement); 5285 materialis_video_background.resizePoster(); 5286 } 5287 }); 5288 jQuery(function () { 5289 var videoElement = document.querySelector('video#wp-custom-header-video') || document.querySelector('iframe#wp-custom-header-video'); 5290 5291 if (videoElement) { 5292 resizeVideo(videoElement, false); 5293 } 5294 }); 5295 var __cpVideoElementFirstPlayed = false; 5296 document.addEventListener('wp-custom-header-video-loaded', function () { 5297 var videoElement = document.querySelector('video#wp-custom-header-video'); 5298 5299 if (videoElement) { 5300 resizeVideo(videoElement); 5301 return; 5302 } 5303 5304 document.querySelector('#wp-custom-header').addEventListener('play', function () { 5305 var iframeVideo = document.querySelector('iframe#wp-custom-header-video'); 5306 var videoElement = document.querySelector('video#wp-custom-header-video') || iframeVideo; 5307 5308 if (videoElement && !__cpVideoElementFirstPlayed) { 5309 __cpVideoElementFirstPlayed = true; 5310 resizeVideo(videoElement); 5311 } 5312 5313 var handler = getHandler(); 5314 handler.play(); 5315 }); 5316 }); 5317 })(jQuery); 5318 5319 /***/ }), 5320 5321 /***/ "../assets/js/woo.js": 5322 /*!***************************!*\ 5323 !*** ../assets/js/woo.js ***! 5324 \***************************/ 5325 /*! no static exports found */ 5326 /***/ (function(module, exports) { 5327 5328 (function ($) { 5329 var addCloseCartBind = function addCloseCartBind($cart, $cart_button, $menu) { 5330 $('body').on('mouseover.ope-woo', function (event) { 5331 var $target = $(event.target); 5332 var related = isHeaderCartRelated($target, $cart, $cart_button) || $target.is($menu); 5333 5334 if (!related) { 5335 $('body').off('mouseover.ope-woo'); 5336 $cart.fadeOut(); 5337 } 5338 }); 5339 }; 5340 5341 function setHeaderTopHeight() { 5342 $('.header-wrapper .header,.header-wrapper .header-homepage').css({ 5343 'padding-top': $('.header-top').height() 5344 }); 5345 } 5346 5347 jQuery(document).ready(function () { 5348 var $menu = jQuery('#main_menu'); 5349 var $cart_button = $menu.find('li.materialis-menu-cart'); 5350 var $cart = jQuery('.materialis-woo-header-cart:first'); 5351 positionateWooCartItem($menu, $cart_button, $cart); 5352 addCloseCartButton($cart); 5353 $cart_button.children('a').on('touchstart', function (e) { 5354 'use strict'; 5355 5356 if (!$cart.is(':visible')) { 5357 e.preventDefault(); 5358 showCart($cart, $cart_button, 'absolute'); 5359 } else { 5360 window.location = $(this).attr('href'); 5361 } 5362 }); 5363 $('.add_to_cart_button.product_type_simple').click(function () { 5364 var isChecked = $(this).find('i').length; 5365 5366 if (!isChecked) { 5367 $(this).append('<i class="mdi mdi-check"></i>'); 5368 } 5369 }); 5370 var storeNotice = $('.woocommerce-store-notice'); 5371 5372 if (storeNotice.length) { 5373 $('.header-top').prepend(storeNotice[0].outerHTML); 5374 storeNotice.remove(); 5375 setTimeout(setHeaderTopHeight, 30); 5376 } 5377 }); 5378 $('.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image').on('load', function () { 5379 var $image = $(this); 5380 5381 if ($image) { 5382 setTimeout(function () { 5383 var setHeight = $image.closest('.woocommerce-product-gallery__image').height(); 5384 var $viewport = $image.closest('.flex-viewport'); 5385 5386 if (setHeight && $viewport) { 5387 $viewport.height(setHeight); 5388 } 5389 }, 500); 5390 } 5391 }).each(function () { 5392 if (this.complete) { 5393 $(this).load(); 5394 } 5395 }); 5396 5397 function addCloseCartButton($cart) { 5398 $cart.prepend('<a href="#" class="close-mini-cart small"><i class="mdi mdi-close"></i></a>'); 5399 $('.close-mini-cart').click(function () { 5400 $('body').off('mouseover.ope-woo'); 5401 $cart.fadeOut(); 5402 }); 5403 } 5404 5405 function positionateWooCartItem($menu, $cart_button, $cart) { 5406 $menu.parent().append($cart); 5407 var $menuItems = $menu.find('li').not($cart_button); 5408 $cart_button.off().on('mouseover', function (event) { 5409 if ($cart.children().length === 0) { 5410 return; 5411 } 5412 5413 $menuItems.trigger('mouseleave'); 5414 addCloseCartBind($cart, $cart_button, $menu); 5415 showCart($cart, $cart_button); 5416 }); 5417 } 5418 5419 function showCart($cart, $cart_button) { 5420 if ($('body').is('.woocommerce-cart') || $('body').is('.woocommerce-checkout')) { 5421 return; 5422 } 5423 5424 var top = $cart_button.offset().top + $cart_button.outerHeight() - $cart_button.closest('div').offset().top; 5425 var position = 5426 /*$menu.closest('[data-sticky]') ? "fixed" :*/ 5427 "absolute"; 5428 5429 if ($cart_button.offset().left < $cart.outerWidth()) { 5430 var leftPosition = $cart_button.offset().left + $cart.outerWidth() + 12; 5431 } else { 5432 var leftPosition = $cart_button.offset().left + $cart_button.width() + 5; 5433 } 5434 5435 $cart.css({ 5436 'position': position, 5437 'z-index': '100000', 5438 'top': top, 5439 'left': leftPosition 5440 }); 5441 $cart.fadeIn(); 5442 } 5443 5444 function isHeaderCartRelated($target, $cart, $cart_button) { 5445 var isMenuButtoRelated = $.contains($cart_button[0], $target[0]) || $target.is($cart_button); 5446 var isCartContentRelated = $.contains($cart[0], $target[0]) || $target.is($cart); 5447 return isMenuButtoRelated || isCartContentRelated; 5448 } 5449 })(jQuery); 5450 5451 /***/ }), 5452 5453 /***/ "./js/_theme.js": 5454 /*!**********************!*\ 5455 !*** ./js/_theme.js ***! 5456 \**********************/ 5457 /*! no static exports found */ 5458 /***/ (function(module, exports) { 5459 5460 if ("ontouchstart" in window) { 5461 document.documentElement.className = document.documentElement.className + " touch-enabled"; 5462 } 5463 5464 if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)) { 5465 document.documentElement.className = document.documentElement.className + " no-parallax"; 5466 } 5467 5468 (function ($) { 5469 var reqAnimFrame = function () { 5470 return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback, element) { 5471 window.setTimeout(callback, 1000 / 60); 5472 }; 5473 }(); 5474 5475 window.requestInterval = function (fn, delay, cancelFunction) { 5476 if (!window.requestAnimationFrame && !window.webkitRequestAnimationFrame && !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support 5477 !window.oRequestAnimationFrame && !window.msRequestAnimationFrame) return window.setInterval(fn, delay); 5478 var start = new Date().getTime(), 5479 handle = {}; 5480 5481 function loop() { 5482 var current = new Date().getTime(), 5483 delta = current - start; 5484 5485 if (delta >= delay) { 5486 fn.call(); 5487 start = new Date().getTime(); 5488 } 5489 5490 handle.value = reqAnimFrame(loop); 5491 5492 if (delta >= delay && cancelFunction && cancelFunction.call() === true) { 5493 clearRequestInterval(handle); 5494 } 5495 } 5496 5497 ; 5498 handle.value = reqAnimFrame(loop); 5499 return handle; 5500 }; 5501 5502 window.clearRequestInterval = function (handle) { 5503 window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) : window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : 5504 /* Support for legacy API */ 5505 window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) : clearInterval(handle); 5506 }; 5507 5508 if (!$.event.special.tap) { 5509 $.event.special.tap = { 5510 setup: function setup(data, namespaces) { 5511 var $elem = $(this); 5512 $elem.bind('touchstart', $.event.special.tap.handler).bind('touchmove', $.event.special.tap.handler).bind('touchend', $.event.special.tap.handler); 5513 }, 5514 teardown: function teardown(namespaces) { 5515 var $elem = $(this); 5516 $elem.unbind('touchstart', $.event.special.tap.handler).unbind('touchmove', $.event.special.tap.handler).unbind('touchend', $.event.special.tap.handler); 5517 }, 5518 handler: function handler(event) { 5519 var $elem = $(this); 5520 $elem.data(event.type, 1); 5521 5522 if (event.type === 'touchend' && !$elem.data('touchmove')) { 5523 event.type = 'tap'; 5524 $.event.handle.apply(this, arguments); 5525 } else if ($elem.data('touchend')) { 5526 $elem.removeData('touchstart touchmove touchend'); 5527 } 5528 } 5529 }; 5530 } 5531 5532 if (!$.fn.isInView) { 5533 $.fn.isInView = function (fullyInView) { 5534 var element = this; 5535 var pageTop = $(window).scrollTop(); 5536 var pageBottom = pageTop + $(window).height(); 5537 var elementTop = $(element).offset().top; 5538 var elementBottom = elementTop + $(element).height(); 5539 5540 if (fullyInView === true) { 5541 return pageTop < elementTop && pageBottom > elementBottom; 5542 } else { 5543 return elementTop <= pageBottom && elementBottom >= pageTop; 5544 } 5545 }; 5546 } 5547 5548 if (!$.throttle) { 5549 $.throttle = function (fn, threshhold, scope) { 5550 threshhold || (threshhold = 250); 5551 var last, deferTimer; 5552 return function () { 5553 var context = scope || this; 5554 var now = +new Date(), 5555 args = arguments; 5556 5557 if (last && now < last + threshhold) { 5558 // hold on to it 5559 clearTimeout(deferTimer); 5560 deferTimer = setTimeout(function () { 5561 last = now; 5562 fn.apply(context, args); 5563 }, threshhold); 5564 } else { 5565 last = now; 5566 fn.apply(context, args); 5567 } 5568 }; 5569 }; 5570 } 5571 5572 if (!$.debounce) { 5573 $.debounce = function (func, wait, immediate) { 5574 var timeout; 5575 return function () { 5576 var context = this, 5577 args = arguments; 5578 5579 var later = function later() { 5580 timeout = null; 5581 if (!immediate) func.apply(context, args); 5582 }; 5583 5584 var callNow = immediate && !timeout; 5585 clearTimeout(timeout); 5586 timeout = setTimeout(later, wait); 5587 if (callNow) func.apply(context, args); 5588 }; 5589 }; 5590 } 5591 })(jQuery); 5592 5593 /***/ }), 5594 5595 /***/ "./js/backstretch.js": 5596 /*!***************************!*\ 5597 !*** ./js/backstretch.js ***! 5598 \***************************/ 5599 /*! no exports provided */ 5600 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5601 5602 "use strict"; 5603 __webpack_require__.r(__webpack_exports__); 5604 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 5605 5606 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function ($) { 5607 if (window.materialis_backstretch) { 5608 window.materialis_backstretch.duration = parseInt(window.materialis_backstretch.duration); 5609 window.materialis_backstretch.transitionDuration = parseInt(window.materialis_backstretch.transitionDuration); 5610 var images = materialis_backstretch.images; 5611 5612 if (!images) { 5613 return; 5614 } 5615 5616 jQuery('.header-homepage, .header').backstretch(images, materialis_backstretch); 5617 } 5618 }); 5619 5620 /***/ }), 5621 5622 /***/ "./js/blog-comments.js": 5623 /*!*****************************!*\ 5624 !*** ./js/blog-comments.js ***! 5625 \*****************************/ 5626 /*! no exports provided */ 5627 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5628 5629 "use strict"; 5630 __webpack_require__.r(__webpack_exports__); 5631 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 5632 5633 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function ($) { 5634 var $commentsWrapper = jQuery('.comments-form'), 5635 $commentsForm = jQuery('#commentform'); 5636 5637 if (window.location.hash === "#respond") { 5638 $commentsWrapper.show(); 5639 } 5640 5641 $('.add-comment-toggler').click(function () { 5642 if ($commentsForm.is(':visible')) { 5643 jQuery('html, body').animate({ 5644 scrollTop: $commentsForm.offset().top - jQuery('.navigation-bar.fixto-fixed').outerHeight() - 30 5645 }, 600); 5646 return; 5647 } 5648 5649 $commentsWrapper.show(); 5650 $('html, body').animate({ 5651 scrollTop: $commentsWrapper.offset().top - jQuery('.navigation-bar.fixto-fixed').outerHeight() - 30 5652 }, 600); 5653 return false; 5654 }); 5655 }); 5656 5657 /***/ }), 5658 5659 /***/ "./js/counters.js": 5660 /*!************************!*\ 5661 !*** ./js/counters.js ***! 5662 \************************/ 5663 /*! no exports provided */ 5664 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5665 5666 "use strict"; 5667 __webpack_require__.r(__webpack_exports__); 5668 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 5669 5670 5671 (function ($) { 5672 function updateCounterCircle($el) { 5673 var $valueHolder = $el.find('[data-countup]'); 5674 var val = $valueHolder.text(); 5675 val = jQuery.map(val.match(/[\d.]*[\d]+/g), function (x) { 5676 return x; 5677 }).join([]); 5678 var max = $valueHolder.attr('data-max') !== undefined ? $valueHolder.attr('data-max') : 100; 5679 var min = $valueHolder.attr('data-min') !== undefined ? $valueHolder.attr('data-min') : 0; 5680 5681 if (min > max) { 5682 var aux = max; 5683 max = min; 5684 min = aux; 5685 } 5686 5687 if (!val) { 5688 val = min; 5689 } 5690 5691 var percentage = val / max * 100; 5692 var $circle = $el.find('.circle-bar'); 5693 var r = $circle.attr('r'); 5694 var c = Math.PI * (r * 2); 5695 5696 if (percentage < 0) { 5697 percentage = 0; 5698 } 5699 5700 if (percentage > 100) { 5701 percentage = 100; 5702 } 5703 5704 var pct = c * (100 - percentage) / 100; 5705 $circle.css({ 5706 strokeDashoffset: pct 5707 }); 5708 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function () { 5709 if (!wp || !wp.customize) { 5710 $circle.parent().height($circle.parent().width()); 5711 } 5712 }); 5713 } 5714 5715 function initCounterCircle($circle) { 5716 updateCounterCircle($circle); 5717 $circle.find('[data-countup]').bind('countup.update', function () { 5718 updateCounterCircle($circle); 5719 }); // $circle.find('[data-countup]').bind('DOMSubtreeModified', updateCircleOnDOMSubtreeModified); 5720 5721 $circle.data('doCircle', function () { 5722 updateCounterCircle($circle); 5723 }); 5724 } 5725 5726 function initCountUP($self, force) { 5727 var min = $self.attr('data-min') !== undefined ? $self.attr('data-min') : 0, 5728 stopAt = $self.attr('data-stop'), 5729 max = $self.attr('data-max') !== undefined ? $self.attr('data-max') : 100, 5730 prefix = $self.attr('data-prefix') || "", 5731 suffix = $self.attr('data-suffix') || "", 5732 duration = $self.attr('data-duration') || 2000, 5733 decimals = $self.attr('data-decimals') || 0; 5734 5735 if (stopAt !== undefined) { 5736 max = stopAt; 5737 } 5738 5739 var formattedMax = ''; 5740 5741 try { 5742 var counter = new CountUp($self[0], parseInt(min), parseInt(max), parseInt(decimals), parseInt(duration) / 1000, { 5743 prefix: prefix, 5744 suffix: suffix, 5745 onUpdate: function onUpdate(value) { 5746 $self.trigger('countup.update', [value]); 5747 } 5748 }); 5749 formattedMax = counter.options.formattingFn(parseInt(max)); 5750 } catch (e) { 5751 console.error('invalid countup args', { 5752 min: min, 5753 max: max, 5754 decimals: decimals, 5755 duration: duration, 5756 suffix: suffix, 5757 prefix: prefix 5758 }); 5759 } 5760 5761 $self.data('countup', counter); 5762 $self.attr('data-max-computed', formattedMax); 5763 5764 if (force) { 5765 $self.data('countup').reset(); 5766 } 5767 5768 if ($self.isInView(true) || force) { 5769 $self.data('countup').start(); 5770 } 5771 5772 $self.data('restartCountUp', function () { 5773 initCountUP($self); 5774 }); 5775 } 5776 5777 $('.circle-counter').each(function () { 5778 initCounterCircle($(this)); 5779 }); 5780 var $countUPs = $('[data-countup]'); 5781 $countUPs.each(function () { 5782 var $self = $(this); 5783 initCountUP($self); 5784 }); 5785 $(window).on('scroll', function () { 5786 $countUPs.each(function () { 5787 var $self = $(this); 5788 5789 if ($self.isInView(true) && !$self.data('one')) { 5790 $self.data('countup').start(); 5791 $self.data('one', true); 5792 } else {// $self.data('countup').reset(); 5793 } 5794 }); 5795 }); 5796 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function () { 5797 if (!wp || !wp.customize) { 5798 $(window).on('resize', function () { 5799 $('.circle-counter .circle-svg').each(function () { 5800 $(this).height($(this).width()); 5801 }); 5802 }); 5803 } 5804 }); // customizer binding 5805 5806 if (parent.CP_Customizer) { 5807 parent.CP_Customizer.addModule(function (CP_Customizer) { 5808 CP_Customizer.hooks.addAction('after_node_insert', function ($node) { 5809 if ($node.is('[data-countup]')) { 5810 if ($node.closest('.circle-counter').length) { 5811 initCounterCircle($node.closest('.circle-counter')); 5812 } 5813 5814 initCountUP($node, true); 5815 } 5816 5817 $node.find('[data-countup]').each(function () { 5818 if ($(this).closest('.circle-counter').length) { 5819 initCounterCircle($(this).closest('.circle-counter')); 5820 } 5821 5822 initCountUP($(this), true); 5823 }); 5824 }); 5825 }); 5826 } // Bar counters 5827 5828 5829 function initCountBar($self, force) { 5830 if ($self.data('one')) return; 5831 var min = $self.attr('data-min') !== undefined ? $self.attr('data-min') : 0; 5832 var max = $self.attr('data-max'); 5833 var stop = $self.attr('data-stop'); 5834 var color = $self.attr('data-bgcolor'); 5835 var suffix = $self.attr('data-suffix'); 5836 var text = $self.attr('data-text'); 5837 5838 if (stop !== undefined) { 5839 max = stop; 5840 } 5841 5842 try { 5843 $self.LineProgressbar({ 5844 min: min || 0, 5845 max: max || 100, 5846 stop: stop || 50, 5847 color: color || '#654ea3', 5848 suffix: suffix || '%', 5849 text: text || 'Category' 5850 }); 5851 } catch (e) { 5852 console.error('invalid countup args', { 5853 min: min, 5854 max: max, 5855 stop: stop, 5856 color: color, 5857 suffix: suffix, 5858 text: text 5859 }); 5860 } 5861 5862 $self.data('restartCountBar', function ($item) { 5863 $self.LineProgressbar({ 5864 min: $item.attr('data-min') || 0, 5865 max: $item.attr('data-max') || 100, 5866 stop: $item.attr('data-stop') || 50, 5867 color: $item.attr('data-bgcolor') || '#654ea3', 5868 suffix: $item.attr('data-suffix') || '%', 5869 text: $item.attr('data-text') || 'Category' 5870 }); 5871 }); 5872 } 5873 5874 var $countBars = $('.progressline'); 5875 /* 5876 $countBars.each(function () { 5877 var $self = $(this); 5878 initCountBar($self); 5879 }); 5880 */ 5881 5882 $(window).on('scroll', function () { 5883 $countBars.each(function () { 5884 var $self = $(this); 5885 5886 if ($self.isInView(true) && !$self.data('one')) { 5887 initCountBar($self); 5888 $self.data('one', true); 5889 } 5890 }); 5891 }); 5892 5893 if (parent.CP_Customizer) { 5894 parent.CP_Customizer.addModule(function (CP_Customizer) { 5895 CP_Customizer.hooks.addAction('after_node_insert', function ($node) { 5896 if ($node.is('[data-countbar]')) { 5897 initCountBar($node, true); 5898 } 5899 5900 $node.find('[data-countbar]').each(function () { 5901 initCountBar($(this), true); 5902 }); 5903 }); 5904 }); 5905 } 5906 })(jQuery); 5907 5908 /***/ }), 5909 5910 /***/ "./js/footer.js": 5911 /*!**********************!*\ 5912 !*** ./js/footer.js ***! 5913 \**********************/ 5914 /*! no static exports found */ 5915 /***/ (function(module, exports) { 5916 5917 (function ($, MaterialisTheme) { 5918 function toggleFooter(footer, pageContent) { 5919 var footerTop = footer.offset().top + footer.outerHeight(); 5920 var pageBottom = pageContent.offset().top + pageContent.height(); 5921 5922 if (footerTop >= pageBottom) { 5923 footer.css('visibility', 'visible'); 5924 } else { 5925 footer.css('visibility', ''); 5926 } 5927 } 5928 5929 function updateFooter(footer, pageContent) { 5930 var margin = footer.outerHeight() - 2; 5931 5932 if (pageContent.is('.boxed-layout')) { 5933 margin += 36; 5934 } 5935 5936 pageContent.css("margin-bottom", margin); 5937 toggleFooter(footer, pageContent); 5938 } 5939 5940 window.materialisFooterParalax = function () { 5941 var footer = $('.footer.paralax'); 5942 5943 if (footer.length) { 5944 if (footer.parents('.no-parallax').length) { 5945 footer.css('visibility', 'visible'); 5946 return; 5947 } 5948 5949 $('.header-wrapper').css('z-index', 1); 5950 var pageContent = footer.prev(); 5951 pageContent.addClass('footer-shadow'); 5952 pageContent.css({ 5953 'position': 'relative', 5954 'z-index': 1 5955 }); 5956 $(window).bind('resize.footerParalax', function () { 5957 updateFooter(footer, pageContent); 5958 }); 5959 jQuery(document).ready(function () { 5960 window.setTimeout(function () { 5961 updateFooter(footer, pageContent); 5962 }, 100); 5963 }); 5964 updateFooter(footer, pageContent); 5965 $(window).bind('scroll.footerParalax', function () { 5966 toggleFooter(footer, pageContent); 5967 }); 5968 } 5969 }; 5970 5971 window.materialisStopFooterParalax = function () { 5972 var footer = $('.footer'); 5973 var pageContent = footer.prev(); 5974 $('.header-wrapper').css('z-index', 0); 5975 pageContent.removeClass('footer-shadow'); 5976 pageContent.css('margin-bottom', '0px'); 5977 $(window).unbind('resize.footerParalax'); 5978 $(window).unbind('scroll.footerParalax'); 5979 }; 5980 5981 materialisFooterParalax(); 5982 /* 5983 if (footer.length && window.wp && window.wp.customize) { 5984 // Select the node that will be observed for mutations 5985 let debouncedUpdate = jQuery.debounce(updateFooter, 500); 5986 new MutationObserver(function (mutationsList) { 5987 for (let mutation of mutationsList) { 5988 if (mutation.type === 'childList') { 5989 debouncedUpdate(); 5990 } 5991 else if (mutation.type === 'attributes') { 5992 debouncedUpdate() 5993 } 5994 } 5995 }).observe(footer[0], { 5996 attributes: true, 5997 childList: true, 5998 subtree: true 5999 }); 6000 } 6001 */ 6002 6003 MaterialisTheme.updateFooterParallax = function () { 6004 var footer = $('.footer.paralax'); 6005 var pageContent = footer.prev(); 6006 6007 if (footer.length) { 6008 updateFooter(footer, pageContent); 6009 } 6010 }; 6011 })(jQuery, MaterialisTheme); 6012 6013 /***/ }), 6014 6015 /***/ "./js/form-fields/checkbox-in-label.js": 6016 /*!*********************************************!*\ 6017 !*** ./js/form-fields/checkbox-in-label.js ***! 6018 \*********************************************/ 6019 /*! exports provided: CheckboxInsideLabelField */ 6020 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6021 6022 "use strict"; 6023 __webpack_require__.r(__webpack_exports__); 6024 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxInsideLabelField", function() { return CheckboxInsideLabelField; }); 6025 /* harmony import */ var _material_animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/animation */ "./node_modules/@material/animation/index.js"); 6026 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 6027 /* harmony import */ var _material_selection_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/selection-control */ "./node_modules/@material/selection-control/index.js"); 6028 /* harmony import */ var _material_checkbox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @material/checkbox */ "./node_modules/@material/checkbox/index.js"); 6029 /* harmony import */ var _material_ripple__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material/ripple */ "./node_modules/@material/ripple/index.js"); 6030 /* harmony import */ var _material_ripple_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material/ripple/util */ "./node_modules/@material/ripple/util.js"); 6031 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } 6032 6033 function _typeof(obj) { 6034 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { 6035 _typeof = function _typeof(obj) { 6036 return _typeof2(obj); 6037 }; 6038 } else { 6039 _typeof = function _typeof(obj) { 6040 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 6041 }; 6042 } 6043 6044 return _typeof(obj); 6045 } 6046 6047 function _classCallCheck(instance, Constructor) { 6048 if (!(instance instanceof Constructor)) { 6049 throw new TypeError("Cannot call a class as a function"); 6050 } 6051 } 6052 6053 function _possibleConstructorReturn(self, call) { 6054 if (call && (_typeof(call) === "object" || typeof call === "function")) { 6055 return call; 6056 } 6057 6058 return _assertThisInitialized(self); 6059 } 6060 6061 function _assertThisInitialized(self) { 6062 if (self === void 0) { 6063 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 6064 } 6065 6066 return self; 6067 } 6068 6069 function _getPrototypeOf(o) { 6070 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 6071 return o.__proto__ || Object.getPrototypeOf(o); 6072 }; 6073 return _getPrototypeOf(o); 6074 } 6075 6076 function _inherits(subClass, superClass) { 6077 if (typeof superClass !== "function" && superClass !== null) { 6078 throw new TypeError("Super expression must either be null or a function"); 6079 } 6080 6081 subClass.prototype = Object.create(superClass && superClass.prototype, { 6082 constructor: { 6083 value: subClass, 6084 writable: true, 6085 configurable: true 6086 } 6087 }); 6088 if (superClass) _setPrototypeOf(subClass, superClass); 6089 } 6090 6091 function _setPrototypeOf(o, p) { 6092 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 6093 o.__proto__ = p; 6094 return o; 6095 }; 6096 6097 return _setPrototypeOf(o, p); 6098 } 6099 6100 6101 6102 6103 6104 6105 6106 6107 var CheckboxInsideLabelField = 6108 /*#__PURE__*/ 6109 function (_MDCCheckbox) { 6110 _inherits(CheckboxInsideLabelField, _MDCCheckbox); 6111 6112 function CheckboxInsideLabelField(input) { 6113 _classCallCheck(this, CheckboxInsideLabelField); 6114 6115 var container = document.createElement('div'); 6116 input.classList.add('mdc-checkbox__native-control'); 6117 var svgPath = '<path class="mdc-checkbox__checkmark-path" fill="none" stroke="white" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>'; 6118 var mixedMark = '<div class="mdc-checkbox__mixedmark"></div>'; 6119 var svg = '<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">' + svgPath + '</svg>'; 6120 var checkboxBackground = '<div class="mdc-checkbox__background">' + svg + mixedMark + '</div>'; 6121 var labelContent = jQuery(input).parent().find('span').html(); 6122 var labelWrapper = '<label for="' + jQuery(input).attr('id') + '">' + labelContent + '</label>'; 6123 var checkboxContent = '<div class="mdc-checkbox">' + input.outerHTML + checkboxBackground + '</div>'; 6124 var label = jQuery(input).parent(); 6125 jQuery(container).addClass('mdc-form-field'); 6126 jQuery(container).html(checkboxContent + labelWrapper); 6127 label.before(container); 6128 label.remove(); 6129 return _possibleConstructorReturn(this, _getPrototypeOf(CheckboxInsideLabelField).call(this, container)); 6130 } 6131 6132 return CheckboxInsideLabelField; 6133 }(_material_checkbox__WEBPACK_IMPORTED_MODULE_3__["MDCCheckbox"]); 6134 6135 6136 6137 /***/ }), 6138 6139 /***/ "./js/form-fields/input-in-label.js": 6140 /*!******************************************!*\ 6141 !*** ./js/form-fields/input-in-label.js ***! 6142 \******************************************/ 6143 /*! exports provided: InputInsideLabelField */ 6144 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6145 6146 "use strict"; 6147 __webpack_require__.r(__webpack_exports__); 6148 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputInsideLabelField", function() { return InputInsideLabelField; }); 6149 /* harmony import */ var _material_textfield__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/textfield */ "./node_modules/@material/textfield/index.js"); 6150 /* harmony import */ var _material_floating_label__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/floating-label */ "./node_modules/@material/floating-label/index.js"); 6151 /* harmony import */ var _material_notched_outline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/notched-outline */ "./node_modules/@material/notched-outline/index.js"); 6152 /* harmony import */ var _material_line_ripple__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @material/line-ripple */ "./node_modules/@material/line-ripple/index.js"); 6153 /* harmony import */ var _material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material/textfield/constants */ "./node_modules/@material/textfield/constants.js"); 6154 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } 6155 6156 function _typeof(obj) { 6157 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { 6158 _typeof = function _typeof(obj) { 6159 return _typeof2(obj); 6160 }; 6161 } else { 6162 _typeof = function _typeof(obj) { 6163 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 6164 }; 6165 } 6166 6167 return _typeof(obj); 6168 } 6169 6170 function _classCallCheck(instance, Constructor) { 6171 if (!(instance instanceof Constructor)) { 6172 throw new TypeError("Cannot call a class as a function"); 6173 } 6174 } 6175 6176 function _defineProperties(target, props) { 6177 for (var i = 0; i < props.length; i++) { 6178 var descriptor = props[i]; 6179 descriptor.enumerable = descriptor.enumerable || false; 6180 descriptor.configurable = true; 6181 if ("value" in descriptor) descriptor.writable = true; 6182 Object.defineProperty(target, descriptor.key, descriptor); 6183 } 6184 } 6185 6186 function _createClass(Constructor, protoProps, staticProps) { 6187 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 6188 if (staticProps) _defineProperties(Constructor, staticProps); 6189 return Constructor; 6190 } 6191 6192 function _possibleConstructorReturn(self, call) { 6193 if (call && (_typeof(call) === "object" || typeof call === "function")) { 6194 return call; 6195 } 6196 6197 return _assertThisInitialized(self); 6198 } 6199 6200 function _assertThisInitialized(self) { 6201 if (self === void 0) { 6202 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 6203 } 6204 6205 return self; 6206 } 6207 6208 function _getPrototypeOf(o) { 6209 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 6210 return o.__proto__ || Object.getPrototypeOf(o); 6211 }; 6212 return _getPrototypeOf(o); 6213 } 6214 6215 function _inherits(subClass, superClass) { 6216 if (typeof superClass !== "function" && superClass !== null) { 6217 throw new TypeError("Super expression must either be null or a function"); 6218 } 6219 6220 subClass.prototype = Object.create(superClass && superClass.prototype, { 6221 constructor: { 6222 value: subClass, 6223 writable: true, 6224 configurable: true 6225 } 6226 }); 6227 if (superClass) _setPrototypeOf(subClass, superClass); 6228 } 6229 6230 function _setPrototypeOf(o, p) { 6231 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 6232 o.__proto__ = p; 6233 return o; 6234 }; 6235 6236 return _setPrototypeOf(o, p); 6237 } 6238 6239 6240 6241 6242 6243 6244 6245 var InputInsideLabelField = 6246 /*#__PURE__*/ 6247 function (_MDCTextField) { 6248 _inherits(InputInsideLabelField, _MDCTextField); 6249 6250 function InputInsideLabelField(input, type) { 6251 var _this; 6252 6253 _classCallCheck(this, InputInsideLabelField); 6254 6255 var container = document.createElement('div'); 6256 6257 if (type == 1) { 6258 var label = jQuery(input).parent().parent(); 6259 jQuery(label).attr('for', input.name); 6260 jQuery(label).find('br').remove(); 6261 jQuery(label).find('span').remove(); 6262 } 6263 6264 if (type == 2) { 6265 var label = jQuery(input).parent().find('label'); 6266 6267 if (!label.length) { 6268 jQuery(input).parent().prepend('<label for="' + input.name + '">' + input.placeholder + '</label>'); 6269 var label = jQuery(input).parent().find('label'); 6270 } 6271 } 6272 6273 if (type == 3) { 6274 var label = jQuery(input).parent().parent().find('label'); 6275 6276 if (!label.length) { 6277 jQuery(input).parent().parent().prepend('<label for="' + input.name + '">' + input.placeholder.replace('(optional)', '') + '</label>'); 6278 var label = jQuery(input).parent().parent().find('label'); 6279 } 6280 6281 jQuery(input).parent().parent().find('.woocommerce-input-wrapper').remove(); 6282 } 6283 6284 label.before(container); 6285 container.appendChild(input); 6286 container.appendChild(label[0]); 6287 _this = _possibleConstructorReturn(this, _getPrototypeOf(InputInsideLabelField).call(this, container)); 6288 /** @private {?Element} */ 6289 6290 _this.input_; 6291 /** @type {?MDCRipple} */ 6292 6293 _this.ripple; 6294 /** @private {?MDCLineRipple} */ 6295 6296 _this.lineRipple_; 6297 /** @private {?MDCTextFieldHelperText} */ 6298 6299 _this.helperText_; 6300 /** @private {?MDCTextFieldIcon} */ 6301 6302 _this.icon_; 6303 /** @private {?MDCFloatingLabel} */ 6304 6305 _this.label_; 6306 /** @private {?MDCNotchedOutline} */ 6307 6308 _this.outline_; 6309 return _this; 6310 } 6311 6312 _createClass(InputInsideLabelField, [{ 6313 key: "initialize", 6314 value: function initialize() { 6315 var _this2 = this; 6316 6317 var rippleFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (el, foundation) { 6318 return new MDCRipple(el, foundation); 6319 }; 6320 var lineRippleFactory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (el) { 6321 return new _material_line_ripple__WEBPACK_IMPORTED_MODULE_3__["MDCLineRipple"](el); 6322 }; 6323 var helperTextFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (el) { 6324 return new _material_textfield__WEBPACK_IMPORTED_MODULE_0__["MDCTextFieldHelperText"](el); 6325 }; 6326 var iconFactory = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (el) { 6327 return new _material_textfield__WEBPACK_IMPORTED_MODULE_0__["MDCTextFieldIcon"](el); 6328 }; 6329 var labelFactory = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (el) { 6330 return new _material_floating_label__WEBPACK_IMPORTED_MODULE_1__["MDCFloatingLabel"](el); 6331 }; 6332 var outlineFactory = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function (el) { 6333 return new _material_notched_outline__WEBPACK_IMPORTED_MODULE_2__["MDCNotchedOutline"](el); 6334 }; 6335 this.input_ = this.root_.querySelector('input,textarea'); 6336 this.input_.classList.add('mdc-text-field__input'); 6337 var labelElement = this.root_.querySelector('label'); 6338 this.root_.classList.add('mdc-text-field'); 6339 6340 if (this.input_.tagName.toLocaleLowerCase() === 'textarea') { 6341 this.root_.classList.add('mdc-text-field--textarea'); 6342 } 6343 6344 if (labelElement) { 6345 labelElement.classList.add('mdc-floating-label'); 6346 this.label_ = labelFactory(labelElement); 6347 } 6348 6349 var lineRippleElement = this.root_.querySelector(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["strings"].BOTTOM_LINE_SELECTOR); 6350 6351 if (lineRippleElement) { 6352 this.lineRipple_ = lineRippleFactory(lineRippleElement); 6353 } else { 6354 if (this.input_.tagName.toLocaleLowerCase() !== 'textarea') { 6355 var newRipple = document.createElement('div'); 6356 newRipple.classList.add('mdc-line-ripple'); 6357 this.root_.appendChild(newRipple); 6358 this.lineRipple_ = lineRippleFactory(newRipple); 6359 } 6360 } 6361 6362 var outlineElement = this.root_.querySelector(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["strings"].OUTLINE_SELECTOR); 6363 6364 if (outlineElement) { 6365 this.outline_ = outlineFactory(outlineElement); 6366 } 6367 6368 if (this.input_.hasAttribute(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["strings"].ARIA_CONTROLS)) { 6369 var helperTextElement = document.getElementById(this.input_.getAttribute(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["strings"].ARIA_CONTROLS)); 6370 6371 if (helperTextElement) { 6372 this.helperText_ = helperTextFactory(helperTextElement); 6373 } 6374 } 6375 6376 var iconElement = this.root_.querySelector(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["strings"].ICON_SELECTOR); 6377 6378 if (iconElement) { 6379 this.icon_ = iconFactory(iconElement); 6380 } 6381 6382 this.ripple = null; 6383 6384 if (this.root_.classList.contains(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["cssClasses"].BOX) || this.root_.classList.contains(_material_textfield_constants__WEBPACK_IMPORTED_MODULE_4__["cssClasses"].OUTLINED)) { 6385 // For outlined text fields, the ripple is instantiated on the outline element instead of the root element 6386 // to clip the ripple at the outline while still allowing the label to be visible beyond the outline. 6387 var rippleCapableSurface = outlineElement ? this.outline_ : this; 6388 var rippleRoot = outlineElement ? outlineElement : this.root_; 6389 var MATCHES = getMatchesProperty(HTMLElement.prototype); 6390 var adapter = Object.assign(MDCRipple.createAdapter( 6391 /** @type {!RippleCapableSurface} */ 6392 rippleCapableSurface), { 6393 isSurfaceActive: function isSurfaceActive() { 6394 return _this2.input_[MATCHES](':active'); 6395 }, 6396 registerInteractionHandler: function registerInteractionHandler(type, handler) { 6397 return _this2.input_.addEventListener(type, handler); 6398 }, 6399 deregisterInteractionHandler: function deregisterInteractionHandler(type, handler) { 6400 return _this2.input_.removeEventListener(type, handler); 6401 } 6402 }); 6403 var foundation = new MDCRippleFoundation(adapter); 6404 this.ripple = rippleFactory(rippleRoot, foundation); 6405 } 6406 } 6407 }]); 6408 6409 return InputInsideLabelField; 6410 }(_material_textfield__WEBPACK_IMPORTED_MODULE_0__["MDCTextField"]); 6411 6412 6413 6414 /***/ }), 6415 6416 /***/ "./js/forms.js": 6417 /*!*********************!*\ 6418 !*** ./js/forms.js ***! 6419 \*********************/ 6420 /*! no exports provided */ 6421 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6422 6423 "use strict"; 6424 __webpack_require__.r(__webpack_exports__); 6425 /* harmony import */ var _material_form_field__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/form-field */ "./node_modules/@material/form-field/index.js"); 6426 /* harmony import */ var _material_textfield__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/textfield */ "./node_modules/@material/textfield/index.js"); 6427 /* harmony import */ var _material_checkbox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/checkbox */ "./node_modules/@material/checkbox/index.js"); 6428 /* harmony import */ var _form_fields_input_in_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./form-fields/input-in-label */ "./js/form-fields/input-in-label.js"); 6429 /* harmony import */ var _form_fields_checkbox_in_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./form-fields/checkbox-in-label */ "./js/form-fields/checkbox-in-label.js"); 6430 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6431 //import {MDCFormField, MDCFormFieldFoundation} from '@material/form-field'; 6432 6433 6434 6435 6436 6437 6438 Object(_utils__WEBPACK_IMPORTED_MODULE_5__["onDocReady"])(function ($) { 6439 var textFields = document.querySelectorAll('.mdc-text-field'); 6440 var inputSelector = 'input:not([type=hidden]):not([type=submit]):not([type=reset]):not([type=checkbox])'; 6441 6442 for (var i = 0, textField; textField = textFields[i]; i++) { 6443 new _material_textfield__WEBPACK_IMPORTED_MODULE_1__["MDCTextField"](textField); 6444 } 6445 6446 var inputsInLabels = jQuery("p > label > span > ".concat(inputSelector, " , p > label > span > textarea")); 6447 6448 for (var _i = 0; _i < inputsInLabels.length; _i++) { 6449 var input = inputsInLabels[_i]; 6450 6451 if (Object(_utils__WEBPACK_IMPORTED_MODULE_5__["isVisible"])(input)) { 6452 new _form_fields_input_in_label__WEBPACK_IMPORTED_MODULE_3__["InputInsideLabelField"](input, 1); 6453 } 6454 } 6455 6456 var inputsInParagraphs = jQuery(".woocommerce p > ".concat(inputSelector, ", .woocommerce p > textarea")); 6457 6458 for (var _i2 = 0; _i2 < inputsInParagraphs.length; _i2++) { 6459 var _input = inputsInParagraphs[_i2]; 6460 new _form_fields_input_in_label__WEBPACK_IMPORTED_MODULE_3__["InputInsideLabelField"](_input, 2); 6461 } 6462 6463 var inputsInSpans = jQuery(".woocommerce p > span > ".concat(inputSelector, ", .woocommerce p > span > textarea")); 6464 6465 for (var _i3 = 0; _i3 < inputsInSpans.length; _i3++) { 6466 var _input2 = inputsInSpans[_i3]; 6467 new _form_fields_input_in_label__WEBPACK_IMPORTED_MODULE_3__["InputInsideLabelField"](_input2, 3); 6468 } 6469 6470 var checkboxesInLabels = jQuery(".woocommerce label > input[type=checkbox]"); 6471 6472 for (var _i4 = 0; _i4 < checkboxesInLabels.length; _i4++) { 6473 var checkbox = checkboxesInLabels[_i4]; 6474 new _form_fields_checkbox_in_label__WEBPACK_IMPORTED_MODULE_4__["CheckboxInsideLabelField"](checkbox); 6475 } // custom script for create an account from checkout -> to be moved 6476 6477 6478 $('.woocommerce-checkout .woocommerce-account-fields #createaccount').on('change', function () { 6479 $('div.create-account').hide(); 6480 6481 if ($(this).is(':checked')) { 6482 // Ensure password is not pre-populated. 6483 $('#account_password').val('').change(); 6484 $('div.create-account').slideDown(); 6485 } 6486 }); 6487 /* custom script for create an account password from checkout -> to be moved */ 6488 6489 /* password strength label and password strength hint are added/removed on keyup, thus 6490 making hard for MDCTextFieldHelperText to be implemented on MDCTextField */ 6491 6492 $('.woocommerce #account_password, .woocommerce .edit-account #password_1').on('keyup', function () { 6493 var _this = this; 6494 6495 sleep(100).then(function () { 6496 var hasPasswordLabel = false, 6497 hasPasswordHint = false; 6498 var parent = $(_this).parent(); 6499 var passwordLabel = parent.find('.woocommerce-password-strength'); 6500 var passwordHint = parent.find('.woocommerce-password-hint'); 6501 var parentMarginBottom = 8; 6502 6503 if (passwordLabel.css('display') == 'block') { 6504 hasPasswordLabel = true; 6505 var passwordLabelHeight = 30; 6506 6507 if (passwordLabel.outerHeight() != 6) { 6508 passwordLabelHeight = passwordLabel.outerHeight(); 6509 } 6510 6511 passwordLabel.css('bottom', '-' + passwordLabelHeight + 'px'); 6512 parentMarginBottom += passwordLabelHeight; 6513 } 6514 6515 if (passwordHint.length) { 6516 hasPasswordHint = true; 6517 passwordHint.css('position', 'absolute'); 6518 passwordHint.css('bottom', '-' + (passwordHint.outerHeight() + passwordLabelHeight) + 'px'); 6519 passwordHint.show(); 6520 parentMarginBottom += passwordHint.outerHeight(); 6521 } 6522 6523 parent.css('margin-bottom', parentMarginBottom + 'px'); 6524 }); 6525 }); 6526 }); 6527 6528 function sleep(ms) { 6529 return new Promise(function (resolve) { 6530 return setTimeout(resolve, ms); 6531 }); 6532 } 6533 6534 /***/ }), 6535 6536 /***/ "./js/gallery.js": 6537 /*!***********************!*\ 6538 !*** ./js/gallery.js ***! 6539 \***********************/ 6540 /*! no static exports found */ 6541 /***/ (function(module, exports) { 6542 6543 (function ($) { 6544 window.MaterialisCaptionsGallery = function (gallery) { 6545 var $gallery = $(gallery); 6546 6547 if (!$gallery.is('.captions-enabled') || $gallery.attr('data-ready')) { 6548 return; 6549 } 6550 6551 $gallery.find('dl').each(function () { 6552 var $dl = $(this); 6553 6554 if ($dl.find('dd').length === 0 && $dl.find('img').attr('alt')) { 6555 $dl.append("<dd class='wp-caption-text gallery-caption'>" + $dl.find('img').attr('alt') + "</dd>"); 6556 } 6557 6558 if ($dl.find('dd').length) { 6559 $dl.find('a').attr('data-caption', $dl.find('dd').html()); 6560 } 6561 }); 6562 $gallery.attr('data-ready', 'true'); 6563 }; 6564 6565 $(function ($) { 6566 var $captionsGalleries = $(".materialis-gallery.captions-enabled"); 6567 $captionsGalleries.each(function () { 6568 window.MaterialisCaptionsGallery(this); 6569 }); 6570 }); 6571 })(jQuery); 6572 6573 /***/ }), 6574 6575 /***/ "./js/header-animations.js": 6576 /*!*********************************!*\ 6577 !*** ./js/header-animations.js ***! 6578 \*********************************/ 6579 /*! no exports provided */ 6580 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6581 6582 "use strict"; 6583 __webpack_require__.r(__webpack_exports__); 6584 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6585 6586 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function () { 6587 var morphed = jQuery("[data-text-effect]"); 6588 6589 if (jQuery.fn.typed && morphed.length && JSON.parse(materialis_morph.header_text_morph)) { 6590 morphed.each(function () { 6591 jQuery(this).empty(); 6592 jQuery(this).typed({ 6593 strings: JSON.parse(jQuery(this).attr('data-text-effect')), 6594 typeSpeed: parseInt(materialis_morph.header_text_morph_speed), 6595 loop: true 6596 }); 6597 }); 6598 } 6599 }); 6600 6601 /***/ }), 6602 6603 /***/ "./js/homepage-arrow.js": 6604 /*!******************************!*\ 6605 !*** ./js/homepage-arrow.js ***! 6606 \******************************/ 6607 /*! no exports provided */ 6608 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6609 6610 "use strict"; 6611 __webpack_require__.r(__webpack_exports__); 6612 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6613 6614 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function ($) { 6615 $('.header-homepage-arrow-c').click(function () { 6616 scrollToSection($('body').find('[data-id]').first()); 6617 }); 6618 }); 6619 6620 /***/ }), 6621 6622 /***/ "./js/masonry.js": 6623 /*!***********************!*\ 6624 !*** ./js/masonry.js ***! 6625 \***********************/ 6626 /*! no exports provided */ 6627 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6628 6629 "use strict"; 6630 __webpack_require__.r(__webpack_exports__); 6631 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6632 6633 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function ($) { 6634 if (!MaterialisTheme.blog_posts_as_masonry_grid) { 6635 return; 6636 } 6637 6638 var postsListRow = $(".post-list.row"); 6639 6640 if (!postsListRow.length) { 6641 return true; 6642 } 6643 6644 function imageLoaded() { 6645 loadedImages++; 6646 6647 if (images.length === loadedImages && postsListRow.data().postsListRow) { 6648 postsListRow.data().masonry.layout(); 6649 } 6650 } 6651 6652 var items = postsListRow.find(".post-list-item").not('.highlighted-post'), 6653 images = postsListRow.find('img'), 6654 loadedImages = 0, 6655 debouncepostsListRowRefresh = jQuery.debounce(function () { 6656 postsListRow.data().masonry.layout(); 6657 }, 500); 6658 items.each(function () { 6659 $(this).css({ 6660 width: $(this).css('max-width') 6661 }); 6662 }); 6663 postsListRow.masonry({ 6664 itemSelector: '.post-list-item', 6665 percentPosition: true, 6666 columnWidth: items.eq(0).attr('data-masonry-width') 6667 }); 6668 images.each(function () { 6669 $(this).on('load', imageLoaded); 6670 debouncepostsListRowRefresh(); 6671 }); 6672 }); 6673 6674 /***/ }), 6675 6676 /***/ "./js/offscreen-menu.js": 6677 /*!******************************!*\ 6678 !*** ./js/offscreen-menu.js ***! 6679 \******************************/ 6680 /*! no exports provided */ 6681 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6682 6683 "use strict"; 6684 __webpack_require__.r(__webpack_exports__); 6685 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6686 6687 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["onDocReady"])(function () { 6688 var $menus = jQuery('.offcanvas_menu'); 6689 var $offCanvasWrapper = jQuery('#offcanvas-wrapper'); 6690 6691 if ($offCanvasWrapper.length) { 6692 jQuery('html').addClass('has-offscreen'); 6693 $offCanvasWrapper.appendTo('body'); 6694 $offCanvasWrapper.removeClass('force-hide'); 6695 $offCanvasWrapper.on('kube.offcanvas.open', function () { 6696 jQuery('html').addClass('offcanvas-opened'); 6697 }); 6698 $offCanvasWrapper.on('kube.offcanvas.close', function () { 6699 jQuery('html').removeClass('offcanvas-opened'); 6700 }); 6701 } 6702 6703 $menus.each(function () { 6704 var $menu = jQuery(this); 6705 $menu.on('materialis.open-all', function () { 6706 jQuery(this).find('.menu-item-has-children, .page_item_has_children').each(function () { 6707 jQuery(this).addClass('open'); 6708 jQuery(this).children('ul').slideDown(100); 6709 }); 6710 }); 6711 $menu.find('.menu-item-has-children > a, .page_item_has_children > a').each(function () { 6712 if (jQuery(this).children('i.mdi.mdi-chevron-right').length === 0) { 6713 jQuery(this).append('<i class="mdi mdi-chevron-right"></i>'); 6714 } 6715 }); 6716 $menu.on('click', '.menu-item-has-children a, .page_item_has_children a,.menu-item-has-children .mdi-chevron-right, .page_item_has_children .mdi-chevron-right', function (event) { 6717 var $this = jQuery(this); 6718 var $li = $this.closest('li'); 6719 6720 if ($li.hasClass('open')) { 6721 if ($this.is('a')) { 6722 return true; 6723 } 6724 6725 $li.children('ul').slideUp(100, function () { 6726 $li.find('ul').each(function () { 6727 jQuery(this).parent().removeClass('open'); 6728 jQuery(this).css('display', 'none'); 6729 }); 6730 }); 6731 } else { 6732 if ($li.children('ul').length) { 6733 $li.children('ul').slideDown(100); 6734 } else { 6735 return true; 6736 } 6737 } 6738 6739 $li.toggleClass('open'); 6740 event.preventDefault(); 6741 event.stopPropagation(); 6742 }); 6743 }); 6744 }); 6745 6746 /***/ }), 6747 6748 /***/ "./js/polyfills.js": 6749 /*!*************************!*\ 6750 !*** ./js/polyfills.js ***! 6751 \*************************/ 6752 /*! no static exports found */ 6753 /***/ (function(module, exports) { 6754 6755 (function (ElementProto) { 6756 if (typeof ElementProto.matches !== 'function') { 6757 ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) { 6758 var element = this; 6759 var elements = (element.document || element.ownerDocument).querySelectorAll(selector); 6760 var index = 0; 6761 6762 while (elements[index] && elements[index] !== element) { 6763 ++index; 6764 } 6765 6766 return Boolean(elements[index]); 6767 }; 6768 } 6769 6770 if (typeof ElementProto.closest !== 'function') { 6771 ElementProto.closest = function closest(selector) { 6772 var element = this; 6773 6774 while (element && element.nodeType === 1) { 6775 if (element.matches(selector)) { 6776 return element; 6777 } 6778 6779 element = element.parentNode; 6780 } 6781 6782 return null; 6783 }; 6784 } 6785 })(window.Element.prototype); 6786 6787 (function () { 6788 if (typeof Object.assign != 'function') { 6789 // Must be writable: true, enumerable: false, configurable: true 6790 Object.defineProperty(Object, "assign", { 6791 value: function assign(target, varArgs) { 6792 // .length of function is 2 6793 'use strict'; 6794 6795 if (target == null) { 6796 // TypeError if undefined or null 6797 throw new TypeError('Cannot convert undefined or null to object'); 6798 } 6799 6800 var to = Object(target); 6801 6802 for (var index = 1; index < arguments.length; index++) { 6803 var nextSource = arguments[index]; 6804 6805 if (nextSource != null) { 6806 // Skip over if undefined or null 6807 for (var nextKey in nextSource) { 6808 // Avoid bugs when hasOwnProperty is shadowed 6809 if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { 6810 to[nextKey] = nextSource[nextKey]; 6811 } 6812 } 6813 } 6814 } 6815 6816 return to; 6817 }, 6818 writable: true, 6819 configurable: true 6820 }); 6821 } 6822 })(); 6823 6824 /***/ }), 6825 6826 /***/ "./js/ripple.js": 6827 /*!**********************!*\ 6828 !*** ./js/ripple.js ***! 6829 \**********************/ 6830 /*! no exports provided */ 6831 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6832 6833 "use strict"; 6834 __webpack_require__.r(__webpack_exports__); 6835 /* harmony import */ var _material_ripple__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/ripple */ "./node_modules/@material/ripple/index.js"); 6836 /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./js/utils.js"); 6837 6838 6839 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["onDocReady"])(function () { 6840 var btns = document.querySelectorAll('.button'); 6841 6842 for (var i = 0, btn; btn = btns[i]; i++) { 6843 _material_ripple__WEBPACK_IMPORTED_MODULE_0__["MDCRipple"].attachTo(btn); 6844 } 6845 }); 6846 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["onDocReady"])(function ($) { 6847 var menuElements = []; 6848 6849 if (document.querySelectorAll('#main_menu').length !== 0) { 6850 menuElements = document.querySelectorAll('#main_menu li a, #materialis-footer-menu li a'); 6851 } else { 6852 menuElements = document.querySelectorAll('#materialis-footer-menu li a'); 6853 } 6854 6855 for (var i = 0, menuElement; menuElement = menuElements[i]; i++) { 6856 _material_ripple__WEBPACK_IMPORTED_MODULE_0__["MDCRipple"].attachTo(menuElement); 6857 } 6858 }); // woocommerce 6859 6860 function sleep(ms) { 6861 return new Promise(function (resolve) { 6862 return setTimeout(resolve, ms); 6863 }); 6864 } 6865 6866 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["onDocReady"])(function ($) { 6867 var wooCommentSubmit = document.querySelectorAll('.woocommerce .product #respond input#submit'); 6868 6869 if (wooCommentSubmit.length) { 6870 _material_ripple__WEBPACK_IMPORTED_MODULE_0__["MDCRipple"].attachTo(wooCommentSubmit[0]); 6871 } 6872 6873 sleep(1000).then(function () { 6874 var miniCartBtns = document.querySelectorAll('.materialis-woo-header-cart .woocommerce-mini-cart__buttons .button'); 6875 6876 for (var i = 0, cbtn; cbtn = miniCartBtns[i]; i++) { 6877 _material_ripple__WEBPACK_IMPORTED_MODULE_0__["MDCRipple"].attachTo(cbtn); 6878 } 6879 }); 6880 }); 6881 6882 /***/ }), 6883 6884 /***/ "./js/theme.js": 6885 /*!*********************!*\ 6886 !*** ./js/theme.js ***! 6887 \*********************/ 6888 /*! no static exports found */ 6889 /***/ (function(module, exports, __webpack_require__) { 6890 6891 (function (MaterialisTheme) { 6892 __webpack_require__(/*! ./polyfills */ "./js/polyfills.js"); 6893 6894 __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js").polyfill(); 6895 6896 __webpack_require__(/*! ./_theme */ "./js/_theme.js"); 6897 6898 __webpack_require__(/*! ./ripple */ "./js/ripple.js"); 6899 6900 __webpack_require__(/*! ./offscreen-menu */ "./js/offscreen-menu.js"); 6901 6902 __webpack_require__(/*! ./masonry */ "./js/masonry.js"); 6903 6904 __webpack_require__(/*! ./blog-comments */ "./js/blog-comments.js"); 6905 6906 __webpack_require__(/*! ./forms */ "./js/forms.js"); 6907 6908 __webpack_require__(/*! ./backstretch */ "./js/backstretch.js"); 6909 6910 __webpack_require__(/*! ./masonry */ "./js/masonry.js"); 6911 6912 __webpack_require__(/*! ./homepage-arrow */ "./js/homepage-arrow.js"); 6913 6914 __webpack_require__(/*! ./counters */ "./js/counters.js"); 6915 6916 __webpack_require__(/*! ./header-animations */ "./js/header-animations.js"); 6917 6918 __webpack_require__(/*! ./footer */ "./js/footer.js"); 6919 6920 __webpack_require__(/*! ./gallery */ "./js/gallery.js"); 6921 })(function () { 6922 window.MaterialisTheme = window.MaterialisTheme || {}; 6923 return window.MaterialisTheme; 6924 }()); // require('./header-video'); 6925 6926 /***/ }), 6927 6928 /***/ "./js/utils.js": 6929 /*!*********************!*\ 6930 !*** ./js/utils.js ***! 6931 \*********************/ 6932 /*! exports provided: onDocReady, isVisible */ 6933 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6934 6935 "use strict"; 6936 __webpack_require__.r(__webpack_exports__); 6937 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onDocReady", function() { return onDocReady; }); 6938 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isVisible", function() { return isVisible; }); 6939 // function onDocReady(callback) { 6940 // // in case the document is already rendered 6941 // if (document.readyState === 'complete') { 6942 // callback(jQuery); 6943 // } else { 6944 // if (document.addEventListener) { 6945 // document.addEventListener('DOMContentLoaded', function () { 6946 // callback(jQuery); 6947 // }); 6948 // } else document.attachEvent('onreadystatechange', function () { 6949 // if (document.readyState === 'complete') callback(jQuery); 6950 // }); 6951 // } 6952 // } 6953 var onDocReady = jQuery; 6954 6955 var isVisible = function isVisible(element) { 6956 return jQuery(element).is(':visible'); 6957 }; 6958 6959 6960 6961 /***/ }), 6962 6963 /***/ "./node_modules/@material/animation/index.js": 6964 /*!***************************************************!*\ 6965 !*** ./node_modules/@material/animation/index.js ***! 6966 \***************************************************/ 6967 /*! exports provided: transformStyleProperties, getCorrectEventName, getCorrectPropertyName */ 6968 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6969 6970 "use strict"; 6971 __webpack_require__.r(__webpack_exports__); 6972 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformStyleProperties", function() { return transformStyleProperties; }); 6973 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectEventName", function() { return getCorrectEventName; }); 6974 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectPropertyName", function() { return getCorrectPropertyName; }); 6975 /** 6976 * Copyright 2016 Google Inc. All Rights Reserved. 6977 * 6978 * Licensed under the Apache License, Version 2.0 (the "License"); 6979 * you may not use this file except in compliance with the License. 6980 * You may obtain a copy of the License at 6981 * 6982 * http://www.apache.org/licenses/LICENSE-2.0 6983 * 6984 * Unless required by applicable law or agreed to in writing, software 6985 * distributed under the License is distributed on an "AS IS" BASIS, 6986 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6987 * See the License for the specific language governing permissions and 6988 * limitations under the License. 6989 */ 6990 6991 /** 6992 * @typedef {{ 6993 * noPrefix: string, 6994 * webkitPrefix: string 6995 * }} 6996 */ 6997 var VendorPropertyMapType; 6998 /** @const {Object<string, !VendorPropertyMapType>} */ 6999 7000 var eventTypeMap = { 7001 'animationstart': { 7002 noPrefix: 'animationstart', 7003 webkitPrefix: 'webkitAnimationStart', 7004 styleProperty: 'animation' 7005 }, 7006 'animationend': { 7007 noPrefix: 'animationend', 7008 webkitPrefix: 'webkitAnimationEnd', 7009 styleProperty: 'animation' 7010 }, 7011 'animationiteration': { 7012 noPrefix: 'animationiteration', 7013 webkitPrefix: 'webkitAnimationIteration', 7014 styleProperty: 'animation' 7015 }, 7016 'transitionend': { 7017 noPrefix: 'transitionend', 7018 webkitPrefix: 'webkitTransitionEnd', 7019 styleProperty: 'transition' 7020 } 7021 }; 7022 /** @const {Object<string, !VendorPropertyMapType>} */ 7023 7024 var cssPropertyMap = { 7025 'animation': { 7026 noPrefix: 'animation', 7027 webkitPrefix: '-webkit-animation' 7028 }, 7029 'transform': { 7030 noPrefix: 'transform', 7031 webkitPrefix: '-webkit-transform' 7032 }, 7033 'transition': { 7034 noPrefix: 'transition', 7035 webkitPrefix: '-webkit-transition' 7036 } 7037 }; 7038 /** 7039 * @param {!Object} windowObj 7040 * @return {boolean} 7041 */ 7042 7043 function hasProperShape(windowObj) { 7044 return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function'; 7045 } 7046 /** 7047 * @param {string} eventType 7048 * @return {boolean} 7049 */ 7050 7051 7052 function eventFoundInMaps(eventType) { 7053 return eventType in eventTypeMap || eventType in cssPropertyMap; 7054 } 7055 /** 7056 * @param {string} eventType 7057 * @param {!Object<string, !VendorPropertyMapType>} map 7058 * @param {!Element} el 7059 * @return {string} 7060 */ 7061 7062 7063 function getJavaScriptEventName(eventType, map, el) { 7064 return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; 7065 } 7066 /** 7067 * Helper function to determine browser prefix for CSS3 animation events 7068 * and property names. 7069 * @param {!Object} windowObj 7070 * @param {string} eventType 7071 * @return {string} 7072 */ 7073 7074 7075 function getAnimationName(windowObj, eventType) { 7076 if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) { 7077 return eventType; 7078 } 7079 7080 var map = 7081 /** @type {!Object<string, !VendorPropertyMapType>} */ 7082 eventType in eventTypeMap ? eventTypeMap : cssPropertyMap; 7083 var el = windowObj['document']['createElement']('div'); 7084 var eventName = ''; 7085 7086 if (map === eventTypeMap) { 7087 eventName = getJavaScriptEventName(eventType, map, el); 7088 } else { 7089 eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; 7090 } 7091 7092 return eventName; 7093 } // Public functions to access getAnimationName() for JavaScript events or CSS 7094 // property names. 7095 7096 7097 var transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform']; 7098 /** 7099 * @param {!Object} windowObj 7100 * @param {string} eventType 7101 * @return {string} 7102 */ 7103 7104 function getCorrectEventName(windowObj, eventType) { 7105 return getAnimationName(windowObj, eventType); 7106 } 7107 /** 7108 * @param {!Object} windowObj 7109 * @param {string} eventType 7110 * @return {string} 7111 */ 7112 7113 function getCorrectPropertyName(windowObj, eventType) { 7114 return getAnimationName(windowObj, eventType); 7115 } 7116 7117 /***/ }), 7118 7119 /***/ "./node_modules/@material/base/component.js": 7120 /*!**************************************************!*\ 7121 !*** ./node_modules/@material/base/component.js ***! 7122 \**************************************************/ 7123 /*! exports provided: default */ 7124 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7125 7126 "use strict"; 7127 __webpack_require__.r(__webpack_exports__); 7128 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/base/foundation.js"); 7129 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7130 7131 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); } } 7132 7133 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 7134 7135 /** 7136 * @license 7137 * Copyright 2016 Google Inc. 7138 * 7139 * Licensed under the Apache License, Version 2.0 (the "License"); 7140 * you may not use this file except in compliance with the License. 7141 * You may obtain a copy of the License at 7142 * 7143 * http://www.apache.org/licenses/LICENSE-2.0 7144 * 7145 * Unless required by applicable law or agreed to in writing, software 7146 * distributed under the License is distributed on an "AS IS" BASIS, 7147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7148 * See the License for the specific language governing permissions and 7149 * limitations under the License. 7150 */ 7151 7152 /** 7153 * @template F 7154 */ 7155 7156 var MDCComponent = 7157 /*#__PURE__*/ 7158 function () { 7159 _createClass(MDCComponent, null, [{ 7160 key: "attachTo", 7161 7162 /** 7163 * @param {!Element} root 7164 * @return {!MDCComponent} 7165 */ 7166 value: function attachTo(root) { 7167 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and 7168 // returns an instantiated component with its root set to that element. Also note that in the cases of 7169 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized 7170 // from getDefaultFoundation(). 7171 return new MDCComponent(root, new _foundation__WEBPACK_IMPORTED_MODULE_0__["default"]()); 7172 } 7173 /** 7174 * @param {!Element} root 7175 * @param {F=} foundation 7176 * @param {...?} args 7177 */ 7178 7179 }]); 7180 7181 function MDCComponent(root) { 7182 var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 7183 7184 _classCallCheck(this, MDCComponent); 7185 7186 /** @protected {!Element} */ 7187 this.root_ = root; 7188 7189 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 7190 args[_key - 2] = arguments[_key]; 7191 } 7192 7193 this.initialize.apply(this, args); // Note that we initialize foundation here and not within the constructor's default param so that 7194 // this.root_ is defined and can be used within the foundation class. 7195 7196 /** @protected {!F} */ 7197 7198 this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; 7199 this.foundation_.init(); 7200 this.initialSyncWithDOM(); 7201 } 7202 7203 _createClass(MDCComponent, [{ 7204 key: "initialize", 7205 value: function initialize() 7206 /* ...args */ 7207 {} // Subclasses can override this to do any additional setup work that would be considered part of a 7208 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is 7209 // initialized. Any additional arguments besides root and foundation will be passed in here. 7210 7211 /** 7212 * @return {!F} foundation 7213 */ 7214 7215 }, { 7216 key: "getDefaultFoundation", 7217 value: function getDefaultFoundation() { 7218 // Subclasses must override this method to return a properly configured foundation class for the 7219 // component. 7220 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); 7221 } 7222 }, { 7223 key: "initialSyncWithDOM", 7224 value: function initialSyncWithDOM() {// Subclasses should override this method if they need to perform work to synchronize with a host DOM 7225 // object. An example of this would be a form control wrapper that needs to synchronize its internal state 7226 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM 7227 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. 7228 } 7229 }, { 7230 key: "destroy", 7231 value: function destroy() { 7232 // Subclasses may implement this method to release any resources / deregister any listeners they have 7233 // attached. An example of this might be deregistering a resize event from the window object. 7234 this.foundation_.destroy(); 7235 } 7236 /** 7237 * Wrapper method to add an event listener to the component's root element. This is most useful when 7238 * listening for custom events. 7239 * @param {string} evtType 7240 * @param {!Function} handler 7241 */ 7242 7243 }, { 7244 key: "listen", 7245 value: function listen(evtType, handler) { 7246 this.root_.addEventListener(evtType, handler); 7247 } 7248 /** 7249 * Wrapper method to remove an event listener to the component's root element. This is most useful when 7250 * unlistening for custom events. 7251 * @param {string} evtType 7252 * @param {!Function} handler 7253 */ 7254 7255 }, { 7256 key: "unlisten", 7257 value: function unlisten(evtType, handler) { 7258 this.root_.removeEventListener(evtType, handler); 7259 } 7260 /** 7261 * Fires a cross-browser-compatible custom event from the component root of the given type, 7262 * with the given data. 7263 * @param {string} evtType 7264 * @param {!Object} evtData 7265 * @param {boolean=} shouldBubble 7266 */ 7267 7268 }, { 7269 key: "emit", 7270 value: function emit(evtType, evtData) { 7271 var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 7272 var evt; 7273 7274 if (typeof CustomEvent === 'function') { 7275 evt = new CustomEvent(evtType, { 7276 detail: evtData, 7277 bubbles: shouldBubble 7278 }); 7279 } else { 7280 evt = document.createEvent('CustomEvent'); 7281 evt.initCustomEvent(evtType, shouldBubble, false, evtData); 7282 } 7283 7284 this.root_.dispatchEvent(evt); 7285 } 7286 }]); 7287 7288 return MDCComponent; 7289 }(); 7290 7291 /* harmony default export */ __webpack_exports__["default"] = (MDCComponent); 7292 7293 /***/ }), 7294 7295 /***/ "./node_modules/@material/base/foundation.js": 7296 /*!***************************************************!*\ 7297 !*** ./node_modules/@material/base/foundation.js ***! 7298 \***************************************************/ 7299 /*! exports provided: default */ 7300 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7301 7302 "use strict"; 7303 __webpack_require__.r(__webpack_exports__); 7304 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7305 7306 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); } } 7307 7308 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 7309 7310 /** 7311 * @license 7312 * Copyright 2016 Google Inc. 7313 * 7314 * Licensed under the Apache License, Version 2.0 (the "License"); 7315 * you may not use this file except in compliance with the License. 7316 * You may obtain a copy of the License at 7317 * 7318 * http://www.apache.org/licenses/LICENSE-2.0 7319 * 7320 * Unless required by applicable law or agreed to in writing, software 7321 * distributed under the License is distributed on an "AS IS" BASIS, 7322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7323 * See the License for the specific language governing permissions and 7324 * limitations under the License. 7325 */ 7326 7327 /** 7328 * @template A 7329 */ 7330 var MDCFoundation = 7331 /*#__PURE__*/ 7332 function () { 7333 _createClass(MDCFoundation, null, [{ 7334 key: "cssClasses", 7335 7336 /** @return enum{cssClasses} */ 7337 get: function get() { 7338 // Classes extending MDCFoundation should implement this method to return an object which exports every 7339 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} 7340 return {}; 7341 } 7342 /** @return enum{strings} */ 7343 7344 }, { 7345 key: "strings", 7346 get: function get() { 7347 // Classes extending MDCFoundation should implement this method to return an object which exports all 7348 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} 7349 return {}; 7350 } 7351 /** @return enum{numbers} */ 7352 7353 }, { 7354 key: "numbers", 7355 get: function get() { 7356 // Classes extending MDCFoundation should implement this method to return an object which exports all 7357 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} 7358 return {}; 7359 } 7360 /** @return {!Object} */ 7361 7362 }, { 7363 key: "defaultAdapter", 7364 get: function get() { 7365 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient 7366 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter 7367 // validation. 7368 return {}; 7369 } 7370 /** 7371 * @param {A=} adapter 7372 */ 7373 7374 }]); 7375 7376 function MDCFoundation() { 7377 var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7378 7379 _classCallCheck(this, MDCFoundation); 7380 7381 /** @protected {!A} */ 7382 this.adapter_ = adapter; 7383 } 7384 7385 _createClass(MDCFoundation, [{ 7386 key: "init", 7387 value: function init() {// Subclasses should override this method to perform initialization routines (registering events, etc.) 7388 } 7389 }, { 7390 key: "destroy", 7391 value: function destroy() {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) 7392 } 7393 }]); 7394 7395 return MDCFoundation; 7396 }(); 7397 7398 /* harmony default export */ __webpack_exports__["default"] = (MDCFoundation); 7399 7400 /***/ }), 7401 7402 /***/ "./node_modules/@material/checkbox/adapter.js": 7403 /*!****************************************************!*\ 7404 !*** ./node_modules/@material/checkbox/adapter.js ***! 7405 \****************************************************/ 7406 /*! exports provided: default */ 7407 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7408 7409 "use strict"; 7410 __webpack_require__.r(__webpack_exports__); 7411 /* harmony import */ var _material_selection_control_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/selection-control/index */ "./node_modules/@material/selection-control/index.js"); 7412 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7413 7414 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); } } 7415 7416 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 7417 7418 /** 7419 * @license 7420 * Copyright 2016 Google Inc. All Rights Reserved. 7421 * 7422 * Licensed under the Apache License, Version 2.0 (the "License"); 7423 * you may not use this file except in compliance with the License. 7424 * You may obtain a copy of the License at 7425 * 7426 * http://www.apache.org/licenses/LICENSE-2.0 7427 * 7428 * Unless required by applicable law or agreed to in writing, software 7429 * distributed under the License is distributed on an "AS IS" BASIS, 7430 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7431 * See the License for the specific language governing permissions and 7432 * limitations under the License. 7433 */ 7434 7435 /* eslint-disable no-unused-vars */ 7436 7437 /* eslint no-unused-vars: [2, {"args": "none"}] */ 7438 7439 /** 7440 * Adapter for MDC Checkbox. Provides an interface for managing 7441 * - classes 7442 * - dom 7443 * - event handlers 7444 * 7445 * Additionally, provides type information for the adapter to the Closure 7446 * compiler. 7447 * 7448 * Implement this adapter for your framework of choice to delegate updates to 7449 * the component in your framework of choice. See architecture documentation 7450 * for more details. 7451 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md 7452 * 7453 * @record 7454 */ 7455 7456 var MDCCheckboxAdapter = 7457 /*#__PURE__*/ 7458 function () { 7459 function MDCCheckboxAdapter() { 7460 _classCallCheck(this, MDCCheckboxAdapter); 7461 } 7462 7463 _createClass(MDCCheckboxAdapter, [{ 7464 key: "addClass", 7465 7466 /** @param {string} className */ 7467 value: function addClass(className) {} 7468 /** @param {string} className */ 7469 7470 }, { 7471 key: "removeClass", 7472 value: function removeClass(className) {} 7473 /** 7474 * Sets an attribute with a given value on the input element. 7475 * @param {string} attr 7476 * @param {string} value 7477 */ 7478 7479 }, { 7480 key: "setNativeControlAttr", 7481 value: function setNativeControlAttr(attr, value) {} 7482 /** 7483 * Removes an attribute from the input element. 7484 * @param {string} attr 7485 */ 7486 7487 }, { 7488 key: "removeNativeControlAttr", 7489 value: function removeNativeControlAttr(attr) {} 7490 /** @param {!EventListener} handler */ 7491 7492 }, { 7493 key: "registerAnimationEndHandler", 7494 value: function registerAnimationEndHandler(handler) {} 7495 /** @param {!EventListener} handler */ 7496 7497 }, { 7498 key: "deregisterAnimationEndHandler", 7499 value: function deregisterAnimationEndHandler(handler) {} 7500 /** @param {!EventListener} handler */ 7501 7502 }, { 7503 key: "registerChangeHandler", 7504 value: function registerChangeHandler(handler) {} 7505 /** @param {!EventListener} handler */ 7506 7507 }, { 7508 key: "deregisterChangeHandler", 7509 value: function deregisterChangeHandler(handler) {} 7510 /** @return {!MDCSelectionControlState} */ 7511 7512 }, { 7513 key: "getNativeControl", 7514 value: function getNativeControl() {} 7515 }, { 7516 key: "forceLayout", 7517 value: function forceLayout() {} 7518 /** @return {boolean} */ 7519 7520 }, { 7521 key: "isAttachedToDOM", 7522 value: function isAttachedToDOM() {} 7523 }]); 7524 7525 return MDCCheckboxAdapter; 7526 }(); 7527 7528 /* harmony default export */ __webpack_exports__["default"] = (MDCCheckboxAdapter); 7529 7530 /***/ }), 7531 7532 /***/ "./node_modules/@material/checkbox/constants.js": 7533 /*!******************************************************!*\ 7534 !*** ./node_modules/@material/checkbox/constants.js ***! 7535 \******************************************************/ 7536 /*! exports provided: cssClasses, strings, numbers */ 7537 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7538 7539 "use strict"; 7540 __webpack_require__.r(__webpack_exports__); 7541 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 7542 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 7543 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numbers", function() { return numbers; }); 7544 /** 7545 * @license 7546 * Copyright 2016 Google Inc. All Rights Reserved. 7547 * 7548 * Licensed under the Apache License, Version 2.0 (the "License"); 7549 * you may not use this file except in compliance with the License. 7550 * You may obtain a copy of the License at 7551 * 7552 * http://www.apache.org/licenses/LICENSE-2.0 7553 * 7554 * Unless required by applicable law or agreed to in writing, software 7555 * distributed under the License is distributed on an "AS IS" BASIS, 7556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7557 * See the License for the specific language governing permissions and 7558 * limitations under the License. 7559 */ 7560 7561 /** @const {string} */ 7562 var ROOT = 'mdc-checkbox'; 7563 /** @enum {string} */ 7564 7565 var cssClasses = { 7566 UPGRADED: 'mdc-checkbox--upgraded', 7567 CHECKED: 'mdc-checkbox--checked', 7568 INDETERMINATE: 'mdc-checkbox--indeterminate', 7569 DISABLED: 'mdc-checkbox--disabled', 7570 ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked', 7571 ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate', 7572 ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked', 7573 ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate', 7574 ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked', 7575 ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked' 7576 }; 7577 /** @enum {string} */ 7578 7579 var strings = { 7580 NATIVE_CONTROL_SELECTOR: ".".concat(ROOT, "__native-control"), 7581 TRANSITION_STATE_INIT: 'init', 7582 TRANSITION_STATE_CHECKED: 'checked', 7583 TRANSITION_STATE_UNCHECKED: 'unchecked', 7584 TRANSITION_STATE_INDETERMINATE: 'indeterminate', 7585 ARIA_CHECKED_ATTR: 'aria-checked', 7586 ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed' 7587 }; 7588 /** @enum {number} */ 7589 7590 var numbers = { 7591 ANIM_END_LATCH_MS: 250 7592 }; 7593 7594 7595 /***/ }), 7596 7597 /***/ "./node_modules/@material/checkbox/foundation.js": 7598 /*!*******************************************************!*\ 7599 !*** ./node_modules/@material/checkbox/foundation.js ***! 7600 \*******************************************************/ 7601 /*! exports provided: default */ 7602 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7603 7604 "use strict"; 7605 __webpack_require__.r(__webpack_exports__); 7606 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 7607 /* harmony import */ var _material_selection_control_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/selection-control/index */ "./node_modules/@material/selection-control/index.js"); 7608 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/checkbox/adapter.js"); 7609 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/checkbox/constants.js"); 7610 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 7611 7612 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7613 7614 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 7615 7616 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 7617 7618 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 7619 7620 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); } } 7621 7622 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 7623 7624 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 7625 7626 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 7627 7628 /** 7629 * @license 7630 * Copyright 2016 Google Inc. All Rights Reserved. 7631 * 7632 * Licensed under the Apache License, Version 2.0 (the "License"); 7633 * you may not use this file except in compliance with the License. 7634 * You may obtain a copy of the License at 7635 * 7636 * http://www.apache.org/licenses/LICENSE-2.0 7637 * 7638 * Unless required by applicable law or agreed to in writing, software 7639 * distributed under the License is distributed on an "AS IS" BASIS, 7640 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7641 * See the License for the specific language governing permissions and 7642 * limitations under the License. 7643 */ 7644 7645 /* eslint-disable no-unused-vars */ 7646 7647 7648 7649 /* eslint-enable no-unused-vars */ 7650 7651 7652 /** @const {!Array<string>} */ 7653 7654 var CB_PROTO_PROPS = ['checked', 'indeterminate']; 7655 /** 7656 * @extends {MDCFoundation<!MDCCheckboxAdapter>} 7657 */ 7658 7659 var MDCCheckboxFoundation = 7660 /*#__PURE__*/ 7661 function (_MDCFoundation) { 7662 _inherits(MDCCheckboxFoundation, _MDCFoundation); 7663 7664 _createClass(MDCCheckboxFoundation, null, [{ 7665 key: "cssClasses", 7666 7667 /** @return enum {cssClasses} */ 7668 get: function get() { 7669 return _constants__WEBPACK_IMPORTED_MODULE_3__["cssClasses"]; 7670 } 7671 /** @return enum {strings} */ 7672 7673 }, { 7674 key: "strings", 7675 get: function get() { 7676 return _constants__WEBPACK_IMPORTED_MODULE_3__["strings"]; 7677 } 7678 /** @return enum {numbers} */ 7679 7680 }, { 7681 key: "numbers", 7682 get: function get() { 7683 return _constants__WEBPACK_IMPORTED_MODULE_3__["numbers"]; 7684 } 7685 /** @return {!MDCCheckboxAdapter} */ 7686 7687 }, { 7688 key: "defaultAdapter", 7689 get: function get() { 7690 return ( 7691 /** @type {!MDCCheckboxAdapter} */ 7692 { 7693 addClass: function addClass() 7694 /* className: string */ 7695 {}, 7696 removeClass: function removeClass() 7697 /* className: string */ 7698 {}, 7699 setNativeControlAttr: function setNativeControlAttr() 7700 /* attr: string, value: string */ 7701 {}, 7702 removeNativeControlAttr: function removeNativeControlAttr() 7703 /* attr: string */ 7704 {}, 7705 registerAnimationEndHandler: function registerAnimationEndHandler() 7706 /* handler: EventListener */ 7707 {}, 7708 deregisterAnimationEndHandler: function deregisterAnimationEndHandler() 7709 /* handler: EventListener */ 7710 {}, 7711 registerChangeHandler: function registerChangeHandler() 7712 /* handler: EventListener */ 7713 {}, 7714 deregisterChangeHandler: function deregisterChangeHandler() 7715 /* handler: EventListener */ 7716 {}, 7717 getNativeControl: function getNativeControl() 7718 /* !MDCSelectionControlState */ 7719 {}, 7720 forceLayout: function forceLayout() {}, 7721 isAttachedToDOM: function isAttachedToDOM() 7722 /* boolean */ 7723 {} 7724 } 7725 ); 7726 } 7727 }]); 7728 7729 function MDCCheckboxFoundation(adapter) { 7730 var _this; 7731 7732 _classCallCheck(this, MDCCheckboxFoundation); 7733 7734 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCCheckboxFoundation).call(this, Object.assign(MDCCheckboxFoundation.defaultAdapter, adapter))); 7735 /** @private {string} */ 7736 7737 _this.currentCheckState_ = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_INIT; 7738 /** @private {string} */ 7739 7740 _this.currentAnimationClass_ = ''; 7741 /** @private {number} */ 7742 7743 _this.animEndLatchTimer_ = 0; 7744 7745 _this.animEndHandler_ = 7746 /** @private {!EventListener} */ 7747 function () { 7748 return _this.handleAnimationEnd(); 7749 }; 7750 7751 _this.changeHandler_ = 7752 /** @private {!EventListener} */ 7753 function () { 7754 return _this.handleChange(); 7755 }; 7756 7757 return _this; 7758 } 7759 7760 _createClass(MDCCheckboxFoundation, [{ 7761 key: "init", 7762 value: function init() { 7763 this.currentCheckState_ = this.determineCheckState_(this.getNativeControl_()); 7764 this.updateAriaChecked_(); 7765 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_3__["cssClasses"].UPGRADED); 7766 this.adapter_.registerChangeHandler(this.changeHandler_); 7767 this.installPropertyChangeHooks_(); 7768 } 7769 }, { 7770 key: "destroy", 7771 value: function destroy() { 7772 this.adapter_.deregisterChangeHandler(this.changeHandler_); 7773 this.uninstallPropertyChangeHooks_(); 7774 } 7775 /** @return {boolean} */ 7776 7777 }, { 7778 key: "isChecked", 7779 value: function isChecked() { 7780 return this.getNativeControl_().checked; 7781 } 7782 /** @param {boolean} checked */ 7783 7784 }, { 7785 key: "setChecked", 7786 value: function setChecked(checked) { 7787 this.getNativeControl_().checked = checked; 7788 } 7789 /** @return {boolean} */ 7790 7791 }, { 7792 key: "isIndeterminate", 7793 value: function isIndeterminate() { 7794 return this.getNativeControl_().indeterminate; 7795 } 7796 /** @param {boolean} indeterminate */ 7797 7798 }, { 7799 key: "setIndeterminate", 7800 value: function setIndeterminate(indeterminate) { 7801 this.getNativeControl_().indeterminate = indeterminate; 7802 } 7803 /** @return {boolean} */ 7804 7805 }, { 7806 key: "isDisabled", 7807 value: function isDisabled() { 7808 return this.getNativeControl_().disabled; 7809 } 7810 /** @param {boolean} disabled */ 7811 7812 }, { 7813 key: "setDisabled", 7814 value: function setDisabled(disabled) { 7815 this.getNativeControl_().disabled = disabled; 7816 7817 if (disabled) { 7818 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_3__["cssClasses"].DISABLED); 7819 } else { 7820 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_3__["cssClasses"].DISABLED); 7821 } 7822 } 7823 /** @return {?string} */ 7824 7825 }, { 7826 key: "getValue", 7827 value: function getValue() { 7828 return this.getNativeControl_().value; 7829 } 7830 /** @param {?string} value */ 7831 7832 }, { 7833 key: "setValue", 7834 value: function setValue(value) { 7835 this.getNativeControl_().value = value; 7836 } 7837 /** 7838 * Handles the animationend event for the checkbox 7839 */ 7840 7841 }, { 7842 key: "handleAnimationEnd", 7843 value: function handleAnimationEnd() { 7844 var _this2 = this; 7845 7846 clearTimeout(this.animEndLatchTimer_); 7847 this.animEndLatchTimer_ = setTimeout(function () { 7848 _this2.adapter_.removeClass(_this2.currentAnimationClass_); 7849 7850 _this2.adapter_.deregisterAnimationEndHandler(_this2.animEndHandler_); 7851 }, _constants__WEBPACK_IMPORTED_MODULE_3__["numbers"].ANIM_END_LATCH_MS); 7852 } 7853 /** 7854 * Handles the change event for the checkbox 7855 */ 7856 7857 }, { 7858 key: "handleChange", 7859 value: function handleChange() { 7860 this.transitionCheckState_(); 7861 } 7862 /** @private */ 7863 7864 }, { 7865 key: "installPropertyChangeHooks_", 7866 value: function installPropertyChangeHooks_() { 7867 var _this3 = this; 7868 7869 var nativeCb = this.getNativeControl_(); 7870 var cbProto = Object.getPrototypeOf(nativeCb); 7871 CB_PROTO_PROPS.forEach(function (controlState) { 7872 var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); // We have to check for this descriptor, since some browsers (Safari) don't support its return. 7873 // See: https://bugs.webkit.org/show_bug.cgi?id=49739 7874 7875 if (validDescriptor(desc)) { 7876 var nativeCbDesc = 7877 /** @type {!ObjectPropertyDescriptor} */ 7878 { 7879 get: desc.get, 7880 set: function set(state) { 7881 desc.set.call(nativeCb, state); 7882 7883 _this3.transitionCheckState_(); 7884 }, 7885 configurable: desc.configurable, 7886 enumerable: desc.enumerable 7887 }; 7888 Object.defineProperty(nativeCb, controlState, nativeCbDesc); 7889 } 7890 }); 7891 } 7892 /** @private */ 7893 7894 }, { 7895 key: "uninstallPropertyChangeHooks_", 7896 value: function uninstallPropertyChangeHooks_() { 7897 var nativeCb = this.getNativeControl_(); 7898 var cbProto = Object.getPrototypeOf(nativeCb); 7899 CB_PROTO_PROPS.forEach(function (controlState) { 7900 var desc = 7901 /** @type {!ObjectPropertyDescriptor} */ 7902 Object.getOwnPropertyDescriptor(cbProto, controlState); 7903 7904 if (validDescriptor(desc)) { 7905 Object.defineProperty(nativeCb, controlState, desc); 7906 } 7907 }); 7908 } 7909 /** @private */ 7910 7911 }, { 7912 key: "transitionCheckState_", 7913 value: function transitionCheckState_() { 7914 var nativeCb = this.adapter_.getNativeControl(); 7915 7916 if (!nativeCb) { 7917 return; 7918 } 7919 7920 var oldState = this.currentCheckState_; 7921 var newState = this.determineCheckState_(nativeCb); 7922 7923 if (oldState === newState) { 7924 return; 7925 } 7926 7927 this.updateAriaChecked_(); // Check to ensure that there isn't a previously existing animation class, in case for example 7928 // the user interacted with the checkbox before the animation was finished. 7929 7930 if (this.currentAnimationClass_.length > 0) { 7931 clearTimeout(this.animEndLatchTimer_); 7932 this.adapter_.forceLayout(); 7933 this.adapter_.removeClass(this.currentAnimationClass_); 7934 } 7935 7936 this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState); 7937 this.currentCheckState_ = newState; // Check for parentNode so that animations are only run when the element is attached 7938 // to the DOM. 7939 7940 if (this.adapter_.isAttachedToDOM() && this.currentAnimationClass_.length > 0) { 7941 this.adapter_.addClass(this.currentAnimationClass_); 7942 this.adapter_.registerAnimationEndHandler(this.animEndHandler_); 7943 } 7944 } 7945 /** 7946 * @param {!MDCSelectionControlState} nativeCb 7947 * @return {string} 7948 * @private 7949 */ 7950 7951 }, { 7952 key: "determineCheckState_", 7953 value: function determineCheckState_(nativeCb) { 7954 var TRANSITION_STATE_INDETERMINATE = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_INDETERMINATE, 7955 TRANSITION_STATE_CHECKED = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_CHECKED, 7956 TRANSITION_STATE_UNCHECKED = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_UNCHECKED; 7957 7958 if (nativeCb.indeterminate) { 7959 return TRANSITION_STATE_INDETERMINATE; 7960 } 7961 7962 return nativeCb.checked ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED; 7963 } 7964 /** 7965 * @param {string} oldState 7966 * @param {string} newState 7967 * @return {string} 7968 */ 7969 7970 }, { 7971 key: "getTransitionAnimationClass_", 7972 value: function getTransitionAnimationClass_(oldState, newState) { 7973 var TRANSITION_STATE_INIT = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_INIT, 7974 TRANSITION_STATE_CHECKED = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_CHECKED, 7975 TRANSITION_STATE_UNCHECKED = _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].TRANSITION_STATE_UNCHECKED; 7976 var _MDCCheckboxFoundatio = MDCCheckboxFoundation.cssClasses, 7977 ANIM_UNCHECKED_CHECKED = _MDCCheckboxFoundatio.ANIM_UNCHECKED_CHECKED, 7978 ANIM_UNCHECKED_INDETERMINATE = _MDCCheckboxFoundatio.ANIM_UNCHECKED_INDETERMINATE, 7979 ANIM_CHECKED_UNCHECKED = _MDCCheckboxFoundatio.ANIM_CHECKED_UNCHECKED, 7980 ANIM_CHECKED_INDETERMINATE = _MDCCheckboxFoundatio.ANIM_CHECKED_INDETERMINATE, 7981 ANIM_INDETERMINATE_CHECKED = _MDCCheckboxFoundatio.ANIM_INDETERMINATE_CHECKED, 7982 ANIM_INDETERMINATE_UNCHECKED = _MDCCheckboxFoundatio.ANIM_INDETERMINATE_UNCHECKED; 7983 7984 switch (oldState) { 7985 case TRANSITION_STATE_INIT: 7986 if (newState === TRANSITION_STATE_UNCHECKED) { 7987 return ''; 7988 } 7989 7990 // fallthrough 7991 7992 case TRANSITION_STATE_UNCHECKED: 7993 return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; 7994 7995 case TRANSITION_STATE_CHECKED: 7996 return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; 7997 // TRANSITION_STATE_INDETERMINATE 7998 7999 default: 8000 return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; 8001 } 8002 } 8003 }, { 8004 key: "updateAriaChecked_", 8005 value: function updateAriaChecked_() { 8006 // Ensure aria-checked is set to mixed if checkbox is in indeterminate state. 8007 if (this.isIndeterminate()) { 8008 this.adapter_.setNativeControlAttr(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ARIA_CHECKED_ATTR, _constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ARIA_CHECKED_INDETERMINATE_VALUE); 8009 } else { 8010 this.adapter_.removeNativeControlAttr(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ARIA_CHECKED_ATTR); 8011 } 8012 } 8013 /** 8014 * @return {!MDCSelectionControlState} 8015 * @private 8016 */ 8017 8018 }, { 8019 key: "getNativeControl_", 8020 value: function getNativeControl_() { 8021 return this.adapter_.getNativeControl() || { 8022 checked: false, 8023 indeterminate: false, 8024 disabled: false, 8025 value: null 8026 }; 8027 } 8028 }]); 8029 8030 return MDCCheckboxFoundation; 8031 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 8032 /** 8033 * @param {ObjectPropertyDescriptor|undefined} inputPropDesc 8034 * @return {boolean} 8035 */ 8036 8037 8038 function validDescriptor(inputPropDesc) { 8039 return !!inputPropDesc && typeof inputPropDesc.set === 'function'; 8040 } 8041 8042 /* harmony default export */ __webpack_exports__["default"] = (MDCCheckboxFoundation); 8043 8044 /***/ }), 8045 8046 /***/ "./node_modules/@material/checkbox/index.js": 8047 /*!**************************************************!*\ 8048 !*** ./node_modules/@material/checkbox/index.js ***! 8049 \**************************************************/ 8050 /*! exports provided: MDCCheckboxFoundation, MDCCheckbox */ 8051 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8052 8053 "use strict"; 8054 __webpack_require__.r(__webpack_exports__); 8055 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCCheckbox", function() { return MDCCheckbox; }); 8056 /* harmony import */ var _material_animation_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/animation/index */ "./node_modules/@material/checkbox/node_modules/@material/animation/index.js"); 8057 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 8058 /* harmony import */ var _material_selection_control_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/selection-control/index */ "./node_modules/@material/selection-control/index.js"); 8059 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/checkbox/foundation.js"); 8060 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCCheckboxFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_3__["default"]; }); 8061 8062 /* harmony import */ var _material_ripple_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material/ripple/index */ "./node_modules/@material/ripple/index.js"); 8063 /* harmony import */ var _material_ripple_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material/ripple/util */ "./node_modules/@material/ripple/util.js"); 8064 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 8065 8066 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8067 8068 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 8069 8070 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 8071 8072 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } 8073 8074 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } 8075 8076 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 8077 8078 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); } } 8079 8080 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8081 8082 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 8083 8084 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 8085 8086 /** 8087 * @license 8088 * Copyright 2016 Google Inc. All Rights Reserved. 8089 * 8090 * Licensed under the Apache License, Version 2.0 (the "License"); 8091 * you may not use this file except in compliance with the License. 8092 * You may obtain a copy of the License at 8093 * 8094 * http://www.apache.org/licenses/LICENSE-2.0 8095 * 8096 * Unless required by applicable law or agreed to in writing, software 8097 * distributed under the License is distributed on an "AS IS" BASIS, 8098 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8099 * See the License for the specific language governing permissions and 8100 * limitations under the License. 8101 */ 8102 8103 8104 /* eslint-disable no-unused-vars */ 8105 8106 8107 /* eslint-enable no-unused-vars */ 8108 8109 8110 8111 8112 /** 8113 * @extends MDCComponent<!MDCCheckboxFoundation> 8114 * @implements {MDCSelectionControl} 8115 */ 8116 8117 var MDCCheckbox = 8118 /*#__PURE__*/ 8119 function (_MDCComponent) { 8120 _inherits(MDCCheckbox, _MDCComponent); 8121 8122 _createClass(MDCCheckbox, [{ 8123 key: "nativeCb_", 8124 8125 /** 8126 * Returns the state of the native control element, or null if the native control element is not present. 8127 * @return {?MDCSelectionControlState} 8128 * @private 8129 */ 8130 get: function get() { 8131 var NATIVE_CONTROL_SELECTOR = _foundation__WEBPACK_IMPORTED_MODULE_3__["default"].strings.NATIVE_CONTROL_SELECTOR; 8132 var cbEl = 8133 /** @type {?MDCSelectionControlState} */ 8134 this.root_.querySelector(NATIVE_CONTROL_SELECTOR); 8135 return cbEl; 8136 } 8137 }], [{ 8138 key: "attachTo", 8139 value: function attachTo(root) { 8140 return new MDCCheckbox(root); 8141 } 8142 }]); 8143 8144 function MDCCheckbox() { 8145 var _getPrototypeOf2; 8146 8147 var _this; 8148 8149 _classCallCheck(this, MDCCheckbox); 8150 8151 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 8152 args[_key] = arguments[_key]; 8153 } 8154 8155 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MDCCheckbox)).call.apply(_getPrototypeOf2, [this].concat(args))); 8156 /** @private {!MDCRipple} */ 8157 8158 _this.ripple_ = _this.initRipple_(); 8159 return _this; 8160 } 8161 /** 8162 * @return {!MDCRipple} 8163 * @private 8164 */ 8165 8166 8167 _createClass(MDCCheckbox, [{ 8168 key: "initRipple_", 8169 value: function initRipple_() { 8170 var _this2 = this; 8171 8172 var MATCHES = Object(_material_ripple_util__WEBPACK_IMPORTED_MODULE_5__["getMatchesProperty"])(HTMLElement.prototype); 8173 var adapter = Object.assign(_material_ripple_index__WEBPACK_IMPORTED_MODULE_4__["MDCRipple"].createAdapter(this), { 8174 isUnbounded: function isUnbounded() { 8175 return true; 8176 }, 8177 isSurfaceActive: function isSurfaceActive() { 8178 return _this2.nativeCb_[MATCHES](':active'); 8179 }, 8180 registerInteractionHandler: function registerInteractionHandler(type, handler) { 8181 return _this2.nativeCb_.addEventListener(type, handler); 8182 }, 8183 deregisterInteractionHandler: function deregisterInteractionHandler(type, handler) { 8184 return _this2.nativeCb_.removeEventListener(type, handler); 8185 } 8186 }); 8187 var foundation = new _material_ripple_index__WEBPACK_IMPORTED_MODULE_4__["MDCRippleFoundation"](adapter); 8188 return new _material_ripple_index__WEBPACK_IMPORTED_MODULE_4__["MDCRipple"](this.root_, foundation); 8189 } 8190 /** @return {!MDCCheckboxFoundation} */ 8191 8192 }, { 8193 key: "getDefaultFoundation", 8194 value: function getDefaultFoundation() { 8195 var _this3 = this; 8196 8197 return new _foundation__WEBPACK_IMPORTED_MODULE_3__["default"]({ 8198 addClass: function addClass(className) { 8199 return _this3.root_.classList.add(className); 8200 }, 8201 removeClass: function removeClass(className) { 8202 return _this3.root_.classList.remove(className); 8203 }, 8204 setNativeControlAttr: function setNativeControlAttr(attr, value) { 8205 return _this3.nativeCb_.setAttribute(attr, value); 8206 }, 8207 removeNativeControlAttr: function removeNativeControlAttr(attr) { 8208 return _this3.nativeCb_.removeAttribute(attr); 8209 }, 8210 registerAnimationEndHandler: function registerAnimationEndHandler(handler) { 8211 return _this3.root_.addEventListener(Object(_material_animation_index__WEBPACK_IMPORTED_MODULE_0__["getCorrectEventName"])(window, 'animationend'), handler); 8212 }, 8213 deregisterAnimationEndHandler: function deregisterAnimationEndHandler(handler) { 8214 return _this3.root_.removeEventListener(Object(_material_animation_index__WEBPACK_IMPORTED_MODULE_0__["getCorrectEventName"])(window, 'animationend'), handler); 8215 }, 8216 registerChangeHandler: function registerChangeHandler(handler) { 8217 return _this3.nativeCb_.addEventListener('change', handler); 8218 }, 8219 deregisterChangeHandler: function deregisterChangeHandler(handler) { 8220 return _this3.nativeCb_.removeEventListener('change', handler); 8221 }, 8222 getNativeControl: function getNativeControl() { 8223 return _this3.nativeCb_; 8224 }, 8225 forceLayout: function forceLayout() { 8226 return _this3.root_.offsetWidth; 8227 }, 8228 isAttachedToDOM: function isAttachedToDOM() { 8229 return Boolean(_this3.root_.parentNode); 8230 } 8231 }); 8232 } 8233 /** @return {!MDCRipple} */ 8234 8235 }, { 8236 key: "destroy", 8237 value: function destroy() { 8238 this.ripple_.destroy(); 8239 8240 _get(_getPrototypeOf(MDCCheckbox.prototype), "destroy", this).call(this); 8241 } 8242 }, { 8243 key: "ripple", 8244 get: function get() { 8245 return this.ripple_; 8246 } 8247 /** @return {boolean} */ 8248 8249 }, { 8250 key: "checked", 8251 get: function get() { 8252 return this.foundation_.isChecked(); 8253 } 8254 /** @param {boolean} checked */ 8255 , 8256 set: function set(checked) { 8257 this.foundation_.setChecked(checked); 8258 } 8259 /** @return {boolean} */ 8260 8261 }, { 8262 key: "indeterminate", 8263 get: function get() { 8264 return this.foundation_.isIndeterminate(); 8265 } 8266 /** @param {boolean} indeterminate */ 8267 , 8268 set: function set(indeterminate) { 8269 this.foundation_.setIndeterminate(indeterminate); 8270 } 8271 /** @return {boolean} */ 8272 8273 }, { 8274 key: "disabled", 8275 get: function get() { 8276 return this.foundation_.isDisabled(); 8277 } 8278 /** @param {boolean} disabled */ 8279 , 8280 set: function set(disabled) { 8281 this.foundation_.setDisabled(disabled); 8282 } 8283 /** @return {?string} */ 8284 8285 }, { 8286 key: "value", 8287 get: function get() { 8288 return this.foundation_.getValue(); 8289 } 8290 /** @param {?string} value */ 8291 , 8292 set: function set(value) { 8293 this.foundation_.setValue(value); 8294 } 8295 }]); 8296 8297 return MDCCheckbox; 8298 }(_material_base_component__WEBPACK_IMPORTED_MODULE_1__["default"]); 8299 8300 8301 8302 /***/ }), 8303 8304 /***/ "./node_modules/@material/checkbox/node_modules/@material/animation/index.js": 8305 /*!***********************************************************************************!*\ 8306 !*** ./node_modules/@material/checkbox/node_modules/@material/animation/index.js ***! 8307 \***********************************************************************************/ 8308 /*! exports provided: transformStyleProperties, getCorrectEventName, getCorrectPropertyName */ 8309 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8310 8311 "use strict"; 8312 __webpack_require__.r(__webpack_exports__); 8313 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformStyleProperties", function() { return transformStyleProperties; }); 8314 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectEventName", function() { return getCorrectEventName; }); 8315 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectPropertyName", function() { return getCorrectPropertyName; }); 8316 /** 8317 * @license 8318 * Copyright 2016 Google Inc. All Rights Reserved. 8319 * 8320 * Licensed under the Apache License, Version 2.0 (the "License"); 8321 * you may not use this file except in compliance with the License. 8322 * You may obtain a copy of the License at 8323 * 8324 * http://www.apache.org/licenses/LICENSE-2.0 8325 * 8326 * Unless required by applicable law or agreed to in writing, software 8327 * distributed under the License is distributed on an "AS IS" BASIS, 8328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8329 * See the License for the specific language governing permissions and 8330 * limitations under the License. 8331 */ 8332 8333 /** 8334 * @typedef {{ 8335 * noPrefix: string, 8336 * webkitPrefix: string, 8337 * styleProperty: string 8338 * }} 8339 */ 8340 var VendorPropertyMapType; 8341 /** @const {Object<string, !VendorPropertyMapType>} */ 8342 8343 var eventTypeMap = { 8344 'animationstart': { 8345 noPrefix: 'animationstart', 8346 webkitPrefix: 'webkitAnimationStart', 8347 styleProperty: 'animation' 8348 }, 8349 'animationend': { 8350 noPrefix: 'animationend', 8351 webkitPrefix: 'webkitAnimationEnd', 8352 styleProperty: 'animation' 8353 }, 8354 'animationiteration': { 8355 noPrefix: 'animationiteration', 8356 webkitPrefix: 'webkitAnimationIteration', 8357 styleProperty: 'animation' 8358 }, 8359 'transitionend': { 8360 noPrefix: 'transitionend', 8361 webkitPrefix: 'webkitTransitionEnd', 8362 styleProperty: 'transition' 8363 } 8364 }; 8365 /** @const {Object<string, !VendorPropertyMapType>} */ 8366 8367 var cssPropertyMap = { 8368 'animation': { 8369 noPrefix: 'animation', 8370 webkitPrefix: '-webkit-animation' 8371 }, 8372 'transform': { 8373 noPrefix: 'transform', 8374 webkitPrefix: '-webkit-transform' 8375 }, 8376 'transition': { 8377 noPrefix: 'transition', 8378 webkitPrefix: '-webkit-transition' 8379 } 8380 }; 8381 /** 8382 * @param {!Object} windowObj 8383 * @return {boolean} 8384 */ 8385 8386 function hasProperShape(windowObj) { 8387 return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function'; 8388 } 8389 /** 8390 * @param {string} eventType 8391 * @return {boolean} 8392 */ 8393 8394 8395 function eventFoundInMaps(eventType) { 8396 return eventType in eventTypeMap || eventType in cssPropertyMap; 8397 } 8398 /** 8399 * @param {string} eventType 8400 * @param {!Object<string, !VendorPropertyMapType>} map 8401 * @param {!Element} el 8402 * @return {string} 8403 */ 8404 8405 8406 function getJavaScriptEventName(eventType, map, el) { 8407 return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; 8408 } 8409 /** 8410 * Helper function to determine browser prefix for CSS3 animation events 8411 * and property names. 8412 * @param {!Object} windowObj 8413 * @param {string} eventType 8414 * @return {string} 8415 */ 8416 8417 8418 function getAnimationName(windowObj, eventType) { 8419 if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) { 8420 return eventType; 8421 } 8422 8423 var map = 8424 /** @type {!Object<string, !VendorPropertyMapType>} */ 8425 eventType in eventTypeMap ? eventTypeMap : cssPropertyMap; 8426 var el = windowObj['document']['createElement']('div'); 8427 var eventName = ''; 8428 8429 if (map === eventTypeMap) { 8430 eventName = getJavaScriptEventName(eventType, map, el); 8431 } else { 8432 eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; 8433 } 8434 8435 return eventName; 8436 } // Public functions to access getAnimationName() for JavaScript events or CSS 8437 // property names. 8438 8439 8440 var transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform']; 8441 /** 8442 * @param {!Object} windowObj 8443 * @param {string} eventType 8444 * @return {string} 8445 */ 8446 8447 function getCorrectEventName(windowObj, eventType) { 8448 return getAnimationName(windowObj, eventType); 8449 } 8450 /** 8451 * @param {!Object} windowObj 8452 * @param {string} eventType 8453 * @return {string} 8454 */ 8455 8456 8457 function getCorrectPropertyName(windowObj, eventType) { 8458 return getAnimationName(windowObj, eventType); 8459 } 8460 8461 8462 8463 /***/ }), 8464 8465 /***/ "./node_modules/@material/floating-label/adapter.js": 8466 /*!**********************************************************!*\ 8467 !*** ./node_modules/@material/floating-label/adapter.js ***! 8468 \**********************************************************/ 8469 /*! exports provided: default */ 8470 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8471 8472 "use strict"; 8473 __webpack_require__.r(__webpack_exports__); 8474 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8475 8476 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); } } 8477 8478 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8479 8480 /** 8481 * @license 8482 * Copyright 2017 Google Inc. All Rights Reserved. 8483 * 8484 * Licensed under the Apache License, Version 2.0 (the "License"); 8485 * you may not use this file except in compliance with the License. 8486 * You may obtain a copy of the License at 8487 * 8488 * http://www.apache.org/licenses/LICENSE-2.0 8489 * 8490 * Unless required by applicable law or agreed to in writing, software 8491 * distributed under the License is distributed on an "AS IS" BASIS, 8492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8493 * See the License for the specific language governing permissions and 8494 * limitations under the License. 8495 */ 8496 8497 /* eslint no-unused-vars: [2, {"args": "none"}] */ 8498 8499 /** 8500 * Adapter for MDC Floating Label. 8501 * 8502 * Defines the shape of the adapter expected by the foundation. Implement this 8503 * adapter to integrate the floating label into your framework. See 8504 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 8505 * for more information. 8506 * 8507 * @record 8508 */ 8509 var MDCFloatingLabelAdapter = 8510 /*#__PURE__*/ 8511 function () { 8512 function MDCFloatingLabelAdapter() { 8513 _classCallCheck(this, MDCFloatingLabelAdapter); 8514 } 8515 8516 _createClass(MDCFloatingLabelAdapter, [{ 8517 key: "addClass", 8518 8519 /** 8520 * Adds a class to the label element. 8521 * @param {string} className 8522 */ 8523 value: function addClass(className) {} 8524 /** 8525 * Removes a class from the label element. 8526 * @param {string} className 8527 */ 8528 8529 }, { 8530 key: "removeClass", 8531 value: function removeClass(className) {} 8532 /** 8533 * Returns the width of the label element. 8534 * @return {number} 8535 */ 8536 8537 }, { 8538 key: "getWidth", 8539 value: function getWidth() {} 8540 /** 8541 * Registers an event listener on the root element for a given event. 8542 * @param {string} evtType 8543 * @param {function(!Event): undefined} handler 8544 */ 8545 8546 }, { 8547 key: "registerInteractionHandler", 8548 value: function registerInteractionHandler(evtType, handler) {} 8549 /** 8550 * Deregisters an event listener on the root element for a given event. 8551 * @param {string} evtType 8552 * @param {function(!Event): undefined} handler 8553 */ 8554 8555 }, { 8556 key: "deregisterInteractionHandler", 8557 value: function deregisterInteractionHandler(evtType, handler) {} 8558 }]); 8559 8560 return MDCFloatingLabelAdapter; 8561 }(); 8562 8563 /* harmony default export */ __webpack_exports__["default"] = (MDCFloatingLabelAdapter); 8564 8565 /***/ }), 8566 8567 /***/ "./node_modules/@material/floating-label/constants.js": 8568 /*!************************************************************!*\ 8569 !*** ./node_modules/@material/floating-label/constants.js ***! 8570 \************************************************************/ 8571 /*! exports provided: cssClasses */ 8572 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8573 8574 "use strict"; 8575 __webpack_require__.r(__webpack_exports__); 8576 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 8577 /** 8578 * @license 8579 * Copyright 2016 Google Inc. All Rights Reserved. 8580 * 8581 * Licensed under the Apache License, Version 2.0 (the "License"); 8582 * you may not use this file except in compliance with the License. 8583 * You may obtain a copy of the License at 8584 * 8585 * http://www.apache.org/licenses/LICENSE-2.0 8586 * 8587 * Unless required by applicable law or agreed to in writing, software 8588 * distributed under the License is distributed on an "AS IS" BASIS, 8589 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8590 * See the License for the specific language governing permissions and 8591 * limitations under the License. 8592 */ 8593 8594 /** @enum {string} */ 8595 var cssClasses = { 8596 LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', 8597 LABEL_SHAKE: 'mdc-floating-label--shake' 8598 }; 8599 8600 8601 /***/ }), 8602 8603 /***/ "./node_modules/@material/floating-label/foundation.js": 8604 /*!*************************************************************!*\ 8605 !*** ./node_modules/@material/floating-label/foundation.js ***! 8606 \*************************************************************/ 8607 /*! exports provided: default */ 8608 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8609 8610 "use strict"; 8611 __webpack_require__.r(__webpack_exports__); 8612 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 8613 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/floating-label/adapter.js"); 8614 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/floating-label/constants.js"); 8615 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 8616 8617 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8618 8619 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 8620 8621 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 8622 8623 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 8624 8625 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); } } 8626 8627 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8628 8629 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 8630 8631 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 8632 8633 /** 8634 * @license 8635 * Copyright 2016 Google Inc. All Rights Reserved. 8636 * 8637 * Licensed under the Apache License, Version 2.0 (the "License"); 8638 * you may not use this file except in compliance with the License. 8639 * You may obtain a copy of the License at 8640 * 8641 * http://www.apache.org/licenses/LICENSE-2.0 8642 * 8643 * Unless required by applicable law or agreed to in writing, software 8644 * distributed under the License is distributed on an "AS IS" BASIS, 8645 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8646 * See the License for the specific language governing permissions and 8647 * limitations under the License. 8648 */ 8649 8650 8651 8652 /** 8653 * @extends {MDCFoundation<!MDCFloatingLabelAdapter>} 8654 * @final 8655 */ 8656 8657 var MDCFloatingLabelFoundation = 8658 /*#__PURE__*/ 8659 function (_MDCFoundation) { 8660 _inherits(MDCFloatingLabelFoundation, _MDCFoundation); 8661 8662 _createClass(MDCFloatingLabelFoundation, null, [{ 8663 key: "cssClasses", 8664 8665 /** @return enum {string} */ 8666 get: function get() { 8667 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 8668 } 8669 /** 8670 * {@see MDCFloatingLabelAdapter} for typing information on parameters and return 8671 * types. 8672 * @return {!MDCFloatingLabelAdapter} 8673 */ 8674 8675 }, { 8676 key: "defaultAdapter", 8677 get: function get() { 8678 return ( 8679 /** @type {!MDCFloatingLabelAdapter} */ 8680 { 8681 addClass: function addClass() {}, 8682 removeClass: function removeClass() {}, 8683 getWidth: function getWidth() {}, 8684 registerInteractionHandler: function registerInteractionHandler() {}, 8685 deregisterInteractionHandler: function deregisterInteractionHandler() {} 8686 } 8687 ); 8688 } 8689 /** 8690 * @param {!MDCFloatingLabelAdapter} adapter 8691 */ 8692 8693 }]); 8694 8695 function MDCFloatingLabelFoundation(adapter) { 8696 var _this; 8697 8698 _classCallCheck(this, MDCFloatingLabelFoundation); 8699 8700 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCFloatingLabelFoundation).call(this, Object.assign(MDCFloatingLabelFoundation.defaultAdapter, adapter))); 8701 /** @private {function(!Event): undefined} */ 8702 8703 _this.shakeAnimationEndHandler_ = function () { 8704 return _this.handleShakeAnimationEnd_(); 8705 }; 8706 8707 return _this; 8708 } 8709 8710 _createClass(MDCFloatingLabelFoundation, [{ 8711 key: "init", 8712 value: function init() { 8713 this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8714 } 8715 }, { 8716 key: "destroy", 8717 value: function destroy() { 8718 this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8719 } 8720 /** 8721 * Returns the width of the label element. 8722 * @return {number} 8723 */ 8724 8725 }, { 8726 key: "getWidth", 8727 value: function getWidth() { 8728 return this.adapter_.getWidth(); 8729 } 8730 /** 8731 * Styles the label to produce the label shake for errors. 8732 * @param {boolean} shouldShake adds shake class if true, 8733 * otherwise removes shake class. 8734 */ 8735 8736 }, { 8737 key: "shake", 8738 value: function shake(shouldShake) { 8739 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8740 8741 if (shouldShake) { 8742 this.adapter_.addClass(LABEL_SHAKE); 8743 } else { 8744 this.adapter_.removeClass(LABEL_SHAKE); 8745 } 8746 } 8747 /** 8748 * Styles the label to float or dock. 8749 * @param {boolean} shouldFloat adds float class if true, otherwise remove 8750 * float and shake class to dock label. 8751 */ 8752 8753 }, { 8754 key: "float", 8755 value: function float(shouldFloat) { 8756 var _MDCFloatingLabelFoun = MDCFloatingLabelFoundation.cssClasses, 8757 LABEL_FLOAT_ABOVE = _MDCFloatingLabelFoun.LABEL_FLOAT_ABOVE, 8758 LABEL_SHAKE = _MDCFloatingLabelFoun.LABEL_SHAKE; 8759 8760 if (shouldFloat) { 8761 this.adapter_.addClass(LABEL_FLOAT_ABOVE); 8762 } else { 8763 this.adapter_.removeClass(LABEL_FLOAT_ABOVE); 8764 this.adapter_.removeClass(LABEL_SHAKE); 8765 } 8766 } 8767 /** 8768 * Handles an interaction event on the root element. 8769 */ 8770 8771 }, { 8772 key: "handleShakeAnimationEnd_", 8773 value: function handleShakeAnimationEnd_() { 8774 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8775 this.adapter_.removeClass(LABEL_SHAKE); 8776 } 8777 }]); 8778 8779 return MDCFloatingLabelFoundation; 8780 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 8781 8782 /* harmony default export */ __webpack_exports__["default"] = (MDCFloatingLabelFoundation); 8783 8784 /***/ }), 8785 8786 /***/ "./node_modules/@material/floating-label/index.js": 8787 /*!********************************************************!*\ 8788 !*** ./node_modules/@material/floating-label/index.js ***! 8789 \********************************************************/ 8790 /*! exports provided: MDCFloatingLabel, MDCFloatingLabelFoundation */ 8791 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8792 8793 "use strict"; 8794 __webpack_require__.r(__webpack_exports__); 8795 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFloatingLabel", function() { return MDCFloatingLabel; }); 8796 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 8797 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/floating-label/adapter.js"); 8798 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/floating-label/foundation.js"); 8799 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCFloatingLabelFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 8800 8801 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 8802 8803 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8804 8805 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); } } 8806 8807 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8808 8809 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 8810 8811 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 8812 8813 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 8814 8815 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 8816 8817 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 8818 8819 /** 8820 * @license 8821 * Copyright 2016 Google Inc. All Rights Reserved. 8822 * 8823 * Licensed under the Apache License, Version 2.0 (the "License"); 8824 * you may not use this file except in compliance with the License. 8825 * You may obtain a copy of the License at 8826 * 8827 * http://www.apache.org/licenses/LICENSE-2.0 8828 * 8829 * Unless required by applicable law or agreed to in writing, software 8830 * distributed under the License is distributed on an "AS IS" BASIS, 8831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8832 * See the License for the specific language governing permissions and 8833 * limitations under the License. 8834 */ 8835 8836 8837 8838 /** 8839 * @extends {MDCComponent<!MDCFloatingLabelFoundation>} 8840 * @final 8841 */ 8842 8843 var MDCFloatingLabel = 8844 /*#__PURE__*/ 8845 function (_MDCComponent) { 8846 _inherits(MDCFloatingLabel, _MDCComponent); 8847 8848 function MDCFloatingLabel() { 8849 _classCallCheck(this, MDCFloatingLabel); 8850 8851 return _possibleConstructorReturn(this, _getPrototypeOf(MDCFloatingLabel).apply(this, arguments)); 8852 } 8853 8854 _createClass(MDCFloatingLabel, [{ 8855 key: "shake", 8856 8857 /** 8858 * Styles the label to produce the label shake for errors. 8859 * @param {boolean} shouldShake styles the label to shake by adding shake class 8860 * if true, otherwise will stop shaking by removing shake class. 8861 */ 8862 value: function shake(shouldShake) { 8863 this.foundation_.shake(shouldShake); 8864 } 8865 /** 8866 * Styles label to float/dock. 8867 * @param {boolean} shouldFloat styles the label to float by adding float class 8868 * if true, otherwise docks the label by removing the float class. 8869 */ 8870 8871 }, { 8872 key: "float", 8873 value: function float(shouldFloat) { 8874 this.foundation_.float(shouldFloat); 8875 } 8876 /** 8877 * @return {number} 8878 */ 8879 8880 }, { 8881 key: "getWidth", 8882 value: function getWidth() { 8883 return this.foundation_.getWidth(); 8884 } 8885 /** 8886 * @return {!MDCFloatingLabelFoundation} 8887 */ 8888 8889 }, { 8890 key: "getDefaultFoundation", 8891 value: function getDefaultFoundation() { 8892 var _this = this; 8893 8894 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]({ 8895 addClass: function addClass(className) { 8896 return _this.root_.classList.add(className); 8897 }, 8898 removeClass: function removeClass(className) { 8899 return _this.root_.classList.remove(className); 8900 }, 8901 getWidth: function getWidth() { 8902 return _this.root_.offsetWidth; 8903 }, 8904 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 8905 return _this.root_.addEventListener(evtType, handler); 8906 }, 8907 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 8908 return _this.root_.removeEventListener(evtType, handler); 8909 } 8910 }); 8911 } 8912 }], [{ 8913 key: "attachTo", 8914 8915 /** 8916 * @param {!Element} root 8917 * @return {!MDCFloatingLabel} 8918 */ 8919 value: function attachTo(root) { 8920 return new MDCFloatingLabel(root); 8921 } 8922 }]); 8923 8924 return MDCFloatingLabel; 8925 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 8926 8927 8928 8929 /***/ }), 8930 8931 /***/ "./node_modules/@material/form-field/adapter.js": 8932 /*!******************************************************!*\ 8933 !*** ./node_modules/@material/form-field/adapter.js ***! 8934 \******************************************************/ 8935 /*! exports provided: default */ 8936 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8937 8938 "use strict"; 8939 __webpack_require__.r(__webpack_exports__); 8940 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8941 8942 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); } } 8943 8944 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8945 8946 /** 8947 * @license 8948 * Copyright 2016 Google Inc. All Rights Reserved. 8949 * 8950 * Licensed under the Apache License, Version 2.0 (the "License"); 8951 * you may not use this file except in compliance with the License. 8952 * You may obtain a copy of the License at 8953 * 8954 * http://www.apache.org/licenses/LICENSE-2.0 8955 * 8956 * Unless required by applicable law or agreed to in writing, software 8957 * distributed under the License is distributed on an "AS IS" BASIS, 8958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8959 * See the License for the specific language governing permissions and 8960 * limitations under the License. 8961 */ 8962 8963 /* eslint no-unused-vars: [2, {"args": "none"}] */ 8964 8965 /** 8966 * Adapter for MDC Form Field. Provides an interface for managing 8967 * - event handlers 8968 * - ripple activation 8969 * 8970 * Additionally, provides type information for the adapter to the Closure 8971 * compiler. 8972 * 8973 * Implement this adapter for your framework of choice to delegate updates to 8974 * the component in your framework of choice. See architecture documentation 8975 * for more details. 8976 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md 8977 * 8978 * @record 8979 */ 8980 var MDCFormFieldAdapter = 8981 /*#__PURE__*/ 8982 function () { 8983 function MDCFormFieldAdapter() { 8984 _classCallCheck(this, MDCFormFieldAdapter); 8985 } 8986 8987 _createClass(MDCFormFieldAdapter, [{ 8988 key: "registerInteractionHandler", 8989 8990 /** 8991 * @param {string} type 8992 * @param {!EventListener} handler 8993 */ 8994 value: function registerInteractionHandler(type, handler) {} 8995 /** 8996 * @param {string} type 8997 * @param {!EventListener} handler 8998 */ 8999 9000 }, { 9001 key: "deregisterInteractionHandler", 9002 value: function deregisterInteractionHandler(type, handler) {} 9003 }, { 9004 key: "activateInputRipple", 9005 value: function activateInputRipple() {} 9006 }, { 9007 key: "deactivateInputRipple", 9008 value: function deactivateInputRipple() {} 9009 }]); 9010 9011 return MDCFormFieldAdapter; 9012 }(); 9013 9014 /* harmony default export */ __webpack_exports__["default"] = (MDCFormFieldAdapter); 9015 9016 /***/ }), 9017 9018 /***/ "./node_modules/@material/form-field/constants.js": 9019 /*!********************************************************!*\ 9020 !*** ./node_modules/@material/form-field/constants.js ***! 9021 \********************************************************/ 9022 /*! exports provided: cssClasses, strings */ 9023 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9024 9025 "use strict"; 9026 __webpack_require__.r(__webpack_exports__); 9027 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 9028 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 9029 /** 9030 * @license 9031 * Copyright 2017 Google Inc. All Rights Reserved. 9032 * 9033 * Licensed under the Apache License, Version 2.0 (the "License"); 9034 * you may not use this file except in compliance with the License. 9035 * You may obtain a copy of the License at 9036 * 9037 * http://www.apache.org/licenses/LICENSE-2.0 9038 * 9039 * Unless required by applicable law or agreed to in writing, software 9040 * distributed under the License is distributed on an "AS IS" BASIS, 9041 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9042 * See the License for the specific language governing permissions and 9043 * limitations under the License. 9044 */ 9045 9046 /** @enum {string} */ 9047 var cssClasses = { 9048 ROOT: 'mdc-form-field' 9049 }; 9050 /** @enum {string} */ 9051 9052 var strings = { 9053 LABEL_SELECTOR: '.mdc-form-field > label' 9054 }; 9055 9056 9057 /***/ }), 9058 9059 /***/ "./node_modules/@material/form-field/foundation.js": 9060 /*!*********************************************************!*\ 9061 !*** ./node_modules/@material/form-field/foundation.js ***! 9062 \*********************************************************/ 9063 /*! exports provided: default */ 9064 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9065 9066 "use strict"; 9067 __webpack_require__.r(__webpack_exports__); 9068 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 9069 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/form-field/adapter.js"); 9070 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/form-field/constants.js"); 9071 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 9072 9073 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9074 9075 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 9076 9077 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 9078 9079 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 9080 9081 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); } } 9082 9083 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9084 9085 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 9086 9087 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 9088 9089 /** 9090 * @license 9091 * Copyright 2017 Google Inc. All Rights Reserved. 9092 * 9093 * Licensed under the Apache License, Version 2.0 (the "License"); 9094 * you may not use this file except in compliance with the License. 9095 * You may obtain a copy of the License at 9096 * 9097 * http://www.apache.org/licenses/LICENSE-2.0 9098 * 9099 * Unless required by applicable law or agreed to in writing, software 9100 * distributed under the License is distributed on an "AS IS" BASIS, 9101 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9102 * See the License for the specific language governing permissions and 9103 * limitations under the License. 9104 */ 9105 9106 9107 9108 /** 9109 * @extends {MDCFoundation<!MDCFormFieldAdapter>} 9110 */ 9111 9112 var MDCFormFieldFoundation = 9113 /*#__PURE__*/ 9114 function (_MDCFoundation) { 9115 _inherits(MDCFormFieldFoundation, _MDCFoundation); 9116 9117 _createClass(MDCFormFieldFoundation, null, [{ 9118 key: "cssClasses", 9119 9120 /** @return enum {cssClasses} */ 9121 get: function get() { 9122 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 9123 } 9124 /** @return enum {strings} */ 9125 9126 }, { 9127 key: "strings", 9128 get: function get() { 9129 return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"]; 9130 } 9131 /** @return {!MDCFormFieldAdapter} */ 9132 9133 }, { 9134 key: "defaultAdapter", 9135 get: function get() { 9136 return { 9137 registerInteractionHandler: function registerInteractionHandler() 9138 /* type: string, handler: EventListener */ 9139 {}, 9140 deregisterInteractionHandler: function deregisterInteractionHandler() 9141 /* type: string, handler: EventListener */ 9142 {}, 9143 activateInputRipple: function activateInputRipple() {}, 9144 deactivateInputRipple: function deactivateInputRipple() {} 9145 }; 9146 } 9147 }]); 9148 9149 function MDCFormFieldFoundation(adapter) { 9150 var _this; 9151 9152 _classCallCheck(this, MDCFormFieldFoundation); 9153 9154 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCFormFieldFoundation).call(this, Object.assign(MDCFormFieldFoundation.defaultAdapter, adapter))); 9155 /** @private {!EventListener} */ 9156 9157 _this.clickHandler_ = 9158 /** @type {!EventListener} */ 9159 function () { 9160 return _this.handleClick_(); 9161 }; 9162 9163 return _this; 9164 } 9165 9166 _createClass(MDCFormFieldFoundation, [{ 9167 key: "init", 9168 value: function init() { 9169 this.adapter_.registerInteractionHandler('click', this.clickHandler_); 9170 } 9171 }, { 9172 key: "destroy", 9173 value: function destroy() { 9174 this.adapter_.deregisterInteractionHandler('click', this.clickHandler_); 9175 } 9176 /** @private */ 9177 9178 }, { 9179 key: "handleClick_", 9180 value: function handleClick_() { 9181 var _this2 = this; 9182 9183 this.adapter_.activateInputRipple(); 9184 requestAnimationFrame(function () { 9185 return _this2.adapter_.deactivateInputRipple(); 9186 }); 9187 } 9188 }]); 9189 9190 return MDCFormFieldFoundation; 9191 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 9192 9193 /* harmony default export */ __webpack_exports__["default"] = (MDCFormFieldFoundation); 9194 9195 /***/ }), 9196 9197 /***/ "./node_modules/@material/form-field/index.js": 9198 /*!****************************************************!*\ 9199 !*** ./node_modules/@material/form-field/index.js ***! 9200 \****************************************************/ 9201 /*! exports provided: MDCFormField, MDCFormFieldFoundation */ 9202 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9203 9204 "use strict"; 9205 __webpack_require__.r(__webpack_exports__); 9206 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFormField", function() { return MDCFormField; }); 9207 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 9208 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/form-field/foundation.js"); 9209 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCFormFieldFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_1__["default"]; }); 9210 9211 /* harmony import */ var _material_selection_control_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/selection-control/index */ "./node_modules/@material/selection-control/index.js"); 9212 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 9213 9214 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9215 9216 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 9217 9218 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 9219 9220 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 9221 9222 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); } } 9223 9224 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9225 9226 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 9227 9228 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 9229 9230 /** 9231 * @license 9232 * Copyright 2017 Google Inc. All Rights Reserved. 9233 * 9234 * Licensed under the Apache License, Version 2.0 (the "License"); 9235 * you may not use this file except in compliance with the License. 9236 * You may obtain a copy of the License at 9237 * 9238 * http://www.apache.org/licenses/LICENSE-2.0 9239 * 9240 * Unless required by applicable law or agreed to in writing, software 9241 * distributed under the License is distributed on an "AS IS" BASIS, 9242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9243 * See the License for the specific language governing permissions and 9244 * limitations under the License. 9245 */ 9246 9247 9248 /* eslint-disable no-unused-vars */ 9249 9250 9251 /* eslint-enable no-unused-vars */ 9252 9253 /** 9254 * @extends MDCComponent<!MDCFormFieldFoundation> 9255 */ 9256 9257 var MDCFormField = 9258 /*#__PURE__*/ 9259 function (_MDCComponent) { 9260 _inherits(MDCFormField, _MDCComponent); 9261 9262 _createClass(MDCFormField, [{ 9263 key: "input", 9264 9265 /** @param {?MDCSelectionControl} input */ 9266 set: function set(input) { 9267 this.input_ = input; 9268 } 9269 /** @return {?MDCSelectionControl} */ 9270 , 9271 get: function get() { 9272 return this.input_; 9273 } 9274 }], [{ 9275 key: "attachTo", 9276 value: function attachTo(root) { 9277 return new MDCFormField(root); 9278 } 9279 }]); 9280 9281 function MDCFormField() { 9282 var _getPrototypeOf2; 9283 9284 var _this; 9285 9286 _classCallCheck(this, MDCFormField); 9287 9288 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 9289 args[_key] = arguments[_key]; 9290 } 9291 9292 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MDCFormField)).call.apply(_getPrototypeOf2, [this].concat(args))); 9293 /** @private {?MDCSelectionControl} */ 9294 9295 _this.input_; 9296 return _this; 9297 } 9298 /** 9299 * @return {!Element} 9300 * @private 9301 */ 9302 9303 9304 _createClass(MDCFormField, [{ 9305 key: "getDefaultFoundation", 9306 9307 /** @return {!MDCFormFieldFoundation} */ 9308 value: function getDefaultFoundation() { 9309 var _this2 = this; 9310 9311 return new _foundation__WEBPACK_IMPORTED_MODULE_1__["default"]({ 9312 registerInteractionHandler: function registerInteractionHandler(type, handler) { 9313 return _this2.label_.addEventListener(type, handler); 9314 }, 9315 deregisterInteractionHandler: function deregisterInteractionHandler(type, handler) { 9316 return _this2.label_.removeEventListener(type, handler); 9317 }, 9318 activateInputRipple: function activateInputRipple() { 9319 if (_this2.input_ && _this2.input_.ripple) { 9320 _this2.input_.ripple.activate(); 9321 } 9322 }, 9323 deactivateInputRipple: function deactivateInputRipple() { 9324 if (_this2.input_ && _this2.input_.ripple) { 9325 _this2.input_.ripple.deactivate(); 9326 } 9327 } 9328 }); 9329 } 9330 }, { 9331 key: "label_", 9332 get: function get() { 9333 var LABEL_SELECTOR = _foundation__WEBPACK_IMPORTED_MODULE_1__["default"].strings.LABEL_SELECTOR; 9334 return ( 9335 /** @type {!Element} */ 9336 this.root_.querySelector(LABEL_SELECTOR) 9337 ); 9338 } 9339 }]); 9340 9341 return MDCFormField; 9342 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 9343 9344 9345 9346 /***/ }), 9347 9348 /***/ "./node_modules/@material/line-ripple/adapter.js": 9349 /*!*******************************************************!*\ 9350 !*** ./node_modules/@material/line-ripple/adapter.js ***! 9351 \*******************************************************/ 9352 /*! exports provided: default */ 9353 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9354 9355 "use strict"; 9356 __webpack_require__.r(__webpack_exports__); 9357 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9358 9359 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); } } 9360 9361 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9362 9363 /** 9364 * @license 9365 * Copyright 2018 Google Inc. All Rights Reserved. 9366 * 9367 * Licensed under the Apache License, Version 2.0 (the "License"); 9368 * you may not use this file except in compliance with the License. 9369 * You may obtain a copy of the License at 9370 * 9371 * http://www.apache.org/licenses/LICENSE-2.0 9372 * 9373 * Unless required by applicable law or agreed to in writing, software 9374 * distributed under the License is distributed on an "AS IS" BASIS, 9375 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9376 * See the License for the specific language governing permissions and 9377 * limitations under the License. 9378 */ 9379 9380 /* eslint no-unused-vars: [2, {"args": "none"}] */ 9381 9382 /** 9383 * Adapter for MDC TextField Line Ripple. 9384 * 9385 * Defines the shape of the adapter expected by the foundation. Implement this 9386 * adapter to integrate the line ripple into your framework. See 9387 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 9388 * for more information. 9389 * 9390 * @record 9391 */ 9392 var MDCLineRippleAdapter = 9393 /*#__PURE__*/ 9394 function () { 9395 function MDCLineRippleAdapter() { 9396 _classCallCheck(this, MDCLineRippleAdapter); 9397 } 9398 9399 _createClass(MDCLineRippleAdapter, [{ 9400 key: "addClass", 9401 9402 /** 9403 * Adds a class to the line ripple element. 9404 * @param {string} className 9405 */ 9406 value: function addClass(className) {} 9407 /** 9408 * Removes a class from the line ripple element. 9409 * @param {string} className 9410 */ 9411 9412 }, { 9413 key: "removeClass", 9414 value: function removeClass(className) {} 9415 /** 9416 * @param {string} className 9417 * @return {boolean} 9418 */ 9419 9420 }, { 9421 key: "hasClass", 9422 value: function hasClass(className) {} 9423 /** 9424 * Sets the style property with propertyName to value on the root element. 9425 * @param {string} propertyName 9426 * @param {string} value 9427 */ 9428 9429 }, { 9430 key: "setStyle", 9431 value: function setStyle(propertyName, value) {} 9432 /** 9433 * Registers an event listener on the line ripple element for a given event. 9434 * @param {string} evtType 9435 * @param {function(!Event): undefined} handler 9436 */ 9437 9438 }, { 9439 key: "registerEventHandler", 9440 value: function registerEventHandler(evtType, handler) {} 9441 /** 9442 * Deregisters an event listener on the line ripple element for a given event. 9443 * @param {string} evtType 9444 * @param {function(!Event): undefined} handler 9445 */ 9446 9447 }, { 9448 key: "deregisterEventHandler", 9449 value: function deregisterEventHandler(evtType, handler) {} 9450 }]); 9451 9452 return MDCLineRippleAdapter; 9453 }(); 9454 9455 /* harmony default export */ __webpack_exports__["default"] = (MDCLineRippleAdapter); 9456 9457 /***/ }), 9458 9459 /***/ "./node_modules/@material/line-ripple/constants.js": 9460 /*!*********************************************************!*\ 9461 !*** ./node_modules/@material/line-ripple/constants.js ***! 9462 \*********************************************************/ 9463 /*! exports provided: cssClasses */ 9464 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9465 9466 "use strict"; 9467 __webpack_require__.r(__webpack_exports__); 9468 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 9469 /** 9470 * @license 9471 * Copyright 2018 Google Inc. All Rights Reserved. 9472 * 9473 * Licensed under the Apache License, Version 2.0 (the "License"); 9474 * you may not use this file except in compliance with the License. 9475 * You may obtain a copy of the License at 9476 * 9477 * http://www.apache.org/licenses/LICENSE-2.0 9478 * 9479 * Unless required by applicable law or agreed to in writing, software 9480 * distributed under the License is distributed on an "AS IS" BASIS, 9481 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9482 * See the License for the specific language governing permissions and 9483 * limitations under the License. 9484 */ 9485 9486 /** @enum {string} */ 9487 var cssClasses = { 9488 LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', 9489 LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' 9490 }; 9491 9492 9493 /***/ }), 9494 9495 /***/ "./node_modules/@material/line-ripple/foundation.js": 9496 /*!**********************************************************!*\ 9497 !*** ./node_modules/@material/line-ripple/foundation.js ***! 9498 \**********************************************************/ 9499 /*! exports provided: default */ 9500 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9501 9502 "use strict"; 9503 __webpack_require__.r(__webpack_exports__); 9504 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 9505 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/line-ripple/adapter.js"); 9506 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/line-ripple/constants.js"); 9507 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 9508 9509 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9510 9511 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 9512 9513 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 9514 9515 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 9516 9517 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); } } 9518 9519 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9520 9521 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 9522 9523 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 9524 9525 /** 9526 * @license 9527 * Copyright 2018 Google Inc. All Rights Reserved. 9528 * 9529 * Licensed under the Apache License, Version 2.0 (the "License"); 9530 * you may not use this file except in compliance with the License. 9531 * You may obtain a copy of the License at 9532 * 9533 * http://www.apache.org/licenses/LICENSE-2.0 9534 * 9535 * Unless required by applicable law or agreed to in writing, software 9536 * distributed under the License is distributed on an "AS IS" BASIS, 9537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9538 * See the License for the specific language governing permissions and 9539 * limitations under the License. 9540 */ 9541 9542 9543 9544 /** 9545 * @extends {MDCFoundation<!MDCLineRippleAdapter>} 9546 * @final 9547 */ 9548 9549 var MDCLineRippleFoundation = 9550 /*#__PURE__*/ 9551 function (_MDCFoundation) { 9552 _inherits(MDCLineRippleFoundation, _MDCFoundation); 9553 9554 _createClass(MDCLineRippleFoundation, null, [{ 9555 key: "cssClasses", 9556 9557 /** @return enum {string} */ 9558 get: function get() { 9559 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 9560 } 9561 /** 9562 * {@see MDCLineRippleAdapter} for typing information on parameters and return 9563 * types. 9564 * @return {!MDCLineRippleAdapter} 9565 */ 9566 9567 }, { 9568 key: "defaultAdapter", 9569 get: function get() { 9570 return ( 9571 /** @type {!MDCLineRippleAdapter} */ 9572 { 9573 addClass: function addClass() {}, 9574 removeClass: function removeClass() {}, 9575 hasClass: function hasClass() {}, 9576 setStyle: function setStyle() {}, 9577 registerEventHandler: function registerEventHandler() {}, 9578 deregisterEventHandler: function deregisterEventHandler() {} 9579 } 9580 ); 9581 } 9582 /** 9583 * @param {!MDCLineRippleAdapter=} adapter 9584 */ 9585 9586 }]); 9587 9588 function MDCLineRippleFoundation() { 9589 var _this; 9590 9591 var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 9592 /** @type {!MDCLineRippleAdapter} */ 9593 {}; 9594 9595 _classCallCheck(this, MDCLineRippleFoundation); 9596 9597 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCLineRippleFoundation).call(this, Object.assign(MDCLineRippleFoundation.defaultAdapter, adapter))); 9598 /** @private {function(!Event): undefined} */ 9599 9600 _this.transitionEndHandler_ = function (evt) { 9601 return _this.handleTransitionEnd(evt); 9602 }; 9603 9604 return _this; 9605 } 9606 9607 _createClass(MDCLineRippleFoundation, [{ 9608 key: "init", 9609 value: function init() { 9610 this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_); 9611 } 9612 }, { 9613 key: "destroy", 9614 value: function destroy() { 9615 this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_); 9616 } 9617 /** 9618 * Activates the line ripple 9619 */ 9620 9621 }, { 9622 key: "activate", 9623 value: function activate() { 9624 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_DEACTIVATING); 9625 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_ACTIVE); 9626 } 9627 /** 9628 * Sets the center of the ripple animation to the given X coordinate. 9629 * @param {number} xCoordinate 9630 */ 9631 9632 }, { 9633 key: "setRippleCenter", 9634 value: function setRippleCenter(xCoordinate) { 9635 this.adapter_.setStyle('transform-origin', "".concat(xCoordinate, "px center")); 9636 } 9637 /** 9638 * Deactivates the line ripple 9639 */ 9640 9641 }, { 9642 key: "deactivate", 9643 value: function deactivate() { 9644 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_DEACTIVATING); 9645 } 9646 /** 9647 * Handles a transition end event 9648 * @param {!Event} evt 9649 */ 9650 9651 }, { 9652 key: "handleTransitionEnd", 9653 value: function handleTransitionEnd(evt) { 9654 // Wait for the line ripple to be either transparent or opaque 9655 // before emitting the animation end event 9656 var isDeactivating = this.adapter_.hasClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_DEACTIVATING); 9657 9658 if (evt.propertyName === 'opacity') { 9659 if (isDeactivating) { 9660 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_ACTIVE); 9661 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].LINE_RIPPLE_DEACTIVATING); 9662 } 9663 } 9664 } 9665 }]); 9666 9667 return MDCLineRippleFoundation; 9668 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 9669 9670 /* harmony default export */ __webpack_exports__["default"] = (MDCLineRippleFoundation); 9671 9672 /***/ }), 9673 9674 /***/ "./node_modules/@material/line-ripple/index.js": 9675 /*!*****************************************************!*\ 9676 !*** ./node_modules/@material/line-ripple/index.js ***! 9677 \*****************************************************/ 9678 /*! exports provided: MDCLineRipple, MDCLineRippleFoundation */ 9679 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9680 9681 "use strict"; 9682 __webpack_require__.r(__webpack_exports__); 9683 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCLineRipple", function() { return MDCLineRipple; }); 9684 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 9685 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/line-ripple/adapter.js"); 9686 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/line-ripple/foundation.js"); 9687 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCLineRippleFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 9688 9689 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 9690 9691 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9692 9693 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); } } 9694 9695 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9696 9697 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 9698 9699 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 9700 9701 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 9702 9703 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 9704 9705 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 9706 9707 /** 9708 * @license 9709 * Copyright 2018 Google Inc. All Rights Reserved. 9710 * 9711 * Licensed under the Apache License, Version 2.0 (the "License"); 9712 * you may not use this file except in compliance with the License. 9713 * You may obtain a copy of the License at 9714 * 9715 * http://www.apache.org/licenses/LICENSE-2.0 9716 * 9717 * Unless required by applicable law or agreed to in writing, software 9718 * distributed under the License is distributed on an "AS IS" BASIS, 9719 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9720 * See the License for the specific language governing permissions and 9721 * limitations under the License. 9722 */ 9723 9724 9725 9726 /** 9727 * @extends {MDCComponent<!MDCLineRippleFoundation>} 9728 * @final 9729 */ 9730 9731 var MDCLineRipple = 9732 /*#__PURE__*/ 9733 function (_MDCComponent) { 9734 _inherits(MDCLineRipple, _MDCComponent); 9735 9736 function MDCLineRipple() { 9737 _classCallCheck(this, MDCLineRipple); 9738 9739 return _possibleConstructorReturn(this, _getPrototypeOf(MDCLineRipple).apply(this, arguments)); 9740 } 9741 9742 _createClass(MDCLineRipple, [{ 9743 key: "activate", 9744 9745 /** 9746 * Activates the line ripple 9747 */ 9748 value: function activate() { 9749 this.foundation_.activate(); 9750 } 9751 /** 9752 * Deactivates the line ripple 9753 */ 9754 9755 }, { 9756 key: "deactivate", 9757 value: function deactivate() { 9758 this.foundation_.deactivate(); 9759 } 9760 /** 9761 * Sets the transform origin given a user's click location. The `rippleCenter` is the 9762 * x-coordinate of the middle of the ripple. 9763 * @param {number} xCoordinate 9764 */ 9765 9766 }, { 9767 key: "setRippleCenter", 9768 value: function setRippleCenter(xCoordinate) { 9769 this.foundation_.setRippleCenter(xCoordinate); 9770 } 9771 /** 9772 * @return {!MDCLineRippleFoundation} 9773 */ 9774 9775 }, { 9776 key: "getDefaultFoundation", 9777 value: function getDefaultFoundation() { 9778 var _this = this; 9779 9780 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]( 9781 /** @type {!MDCLineRippleAdapter} */ 9782 Object.assign({ 9783 addClass: function addClass(className) { 9784 return _this.root_.classList.add(className); 9785 }, 9786 removeClass: function removeClass(className) { 9787 return _this.root_.classList.remove(className); 9788 }, 9789 hasClass: function hasClass(className) { 9790 return _this.root_.classList.contains(className); 9791 }, 9792 setStyle: function setStyle(propertyName, value) { 9793 return _this.root_.style[propertyName] = value; 9794 }, 9795 registerEventHandler: function registerEventHandler(evtType, handler) { 9796 return _this.root_.addEventListener(evtType, handler); 9797 }, 9798 deregisterEventHandler: function deregisterEventHandler(evtType, handler) { 9799 return _this.root_.removeEventListener(evtType, handler); 9800 } 9801 })); 9802 } 9803 }], [{ 9804 key: "attachTo", 9805 9806 /** 9807 * @param {!Element} root 9808 * @return {!MDCLineRipple} 9809 */ 9810 value: function attachTo(root) { 9811 return new MDCLineRipple(root); 9812 } 9813 }]); 9814 9815 return MDCLineRipple; 9816 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 9817 9818 9819 9820 /***/ }), 9821 9822 /***/ "./node_modules/@material/notched-outline/adapter.js": 9823 /*!***********************************************************!*\ 9824 !*** ./node_modules/@material/notched-outline/adapter.js ***! 9825 \***********************************************************/ 9826 /*! exports provided: default */ 9827 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9828 9829 "use strict"; 9830 __webpack_require__.r(__webpack_exports__); 9831 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9832 9833 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); } } 9834 9835 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9836 9837 /** 9838 * @license 9839 * Copyright 2017 Google Inc. All Rights Reserved. 9840 * 9841 * Licensed under the Apache License, Version 2.0 (the "License"); 9842 * you may not use this file except in compliance with the License. 9843 * You may obtain a copy of the License at 9844 * 9845 * http://www.apache.org/licenses/LICENSE-2.0 9846 * 9847 * Unless required by applicable law or agreed to in writing, software 9848 * distributed under the License is distributed on an "AS IS" BASIS, 9849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9850 * See the License for the specific language governing permissions and 9851 * limitations under the License. 9852 */ 9853 9854 /* eslint no-unused-vars: [2, {"args": "none"}] */ 9855 9856 /** 9857 * Adapter for MDC Notched Outline. 9858 * 9859 * Defines the shape of the adapter expected by the foundation. Implement this 9860 * adapter to integrate the Notched Outline into your framework. See 9861 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 9862 * for more information. 9863 * 9864 * @record 9865 */ 9866 var MDCNotchedOutlineAdapter = 9867 /*#__PURE__*/ 9868 function () { 9869 function MDCNotchedOutlineAdapter() { 9870 _classCallCheck(this, MDCNotchedOutlineAdapter); 9871 } 9872 9873 _createClass(MDCNotchedOutlineAdapter, [{ 9874 key: "getWidth", 9875 9876 /** 9877 * Returns the width of the root element. 9878 * @return {number} 9879 */ 9880 value: function getWidth() {} 9881 /** 9882 * Returns the height of the root element. 9883 * @return {number} 9884 */ 9885 9886 }, { 9887 key: "getHeight", 9888 value: function getHeight() {} 9889 /** 9890 * Adds a class to the root element. 9891 * @param {string} className 9892 */ 9893 9894 }, { 9895 key: "addClass", 9896 value: function addClass(className) {} 9897 /** 9898 * Removes a class from the root element. 9899 * @param {string} className 9900 */ 9901 9902 }, { 9903 key: "removeClass", 9904 value: function removeClass(className) {} 9905 /** 9906 * Sets the "d" attribute of the outline element's SVG path. 9907 * @param {string} value 9908 */ 9909 9910 }, { 9911 key: "setOutlinePathAttr", 9912 value: function setOutlinePathAttr(value) {} 9913 /** 9914 * Returns the idle outline element's computed style value of the given css property `propertyName`. 9915 * We achieve this via `getComputedStyle(...).getPropertyValue(propertyName)`. 9916 * @param {string} propertyName 9917 * @return {string} 9918 */ 9919 9920 }, { 9921 key: "getIdleOutlineStyleValue", 9922 value: function getIdleOutlineStyleValue(propertyName) {} 9923 }]); 9924 9925 return MDCNotchedOutlineAdapter; 9926 }(); 9927 9928 /* harmony default export */ __webpack_exports__["default"] = (MDCNotchedOutlineAdapter); 9929 9930 /***/ }), 9931 9932 /***/ "./node_modules/@material/notched-outline/constants.js": 9933 /*!*************************************************************!*\ 9934 !*** ./node_modules/@material/notched-outline/constants.js ***! 9935 \*************************************************************/ 9936 /*! exports provided: cssClasses, strings */ 9937 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9938 9939 "use strict"; 9940 __webpack_require__.r(__webpack_exports__); 9941 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 9942 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 9943 /** 9944 * @license 9945 * Copyright 2018 Google Inc. All Rights Reserved. 9946 * 9947 * Licensed under the Apache License, Version 2.0 (the "License"); 9948 * you may not use this file except in compliance with the License. 9949 * You may obtain a copy of the License at 9950 * 9951 * http://www.apache.org/licenses/LICENSE-2.0 9952 * 9953 * Unless required by applicable law or agreed to in writing, software 9954 * distributed under the License is distributed on an "AS IS" BASIS, 9955 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9956 * See the License for the specific language governing permissions and 9957 * limitations under the License. 9958 */ 9959 9960 /** @enum {string} */ 9961 var strings = { 9962 PATH_SELECTOR: '.mdc-notched-outline__path', 9963 IDLE_OUTLINE_SELECTOR: '.mdc-notched-outline__idle' 9964 }; 9965 /** @enum {string} */ 9966 9967 var cssClasses = { 9968 OUTLINE_NOTCHED: 'mdc-notched-outline--notched' 9969 }; 9970 9971 9972 /***/ }), 9973 9974 /***/ "./node_modules/@material/notched-outline/foundation.js": 9975 /*!**************************************************************!*\ 9976 !*** ./node_modules/@material/notched-outline/foundation.js ***! 9977 \**************************************************************/ 9978 /*! exports provided: default */ 9979 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9980 9981 "use strict"; 9982 __webpack_require__.r(__webpack_exports__); 9983 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 9984 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/notched-outline/adapter.js"); 9985 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/notched-outline/constants.js"); 9986 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 9987 9988 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9989 9990 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 9991 9992 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 9993 9994 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 9995 9996 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); } } 9997 9998 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 9999 10000 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 10001 10002 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 10003 10004 /** 10005 * @license 10006 * Copyright 2017 Google Inc. All Rights Reserved. 10007 * 10008 * Licensed under the Apache License, Version 2.0 (the "License"); 10009 * you may not use this file except in compliance with the License. 10010 * You may obtain a copy of the License at 10011 * 10012 * http://www.apache.org/licenses/LICENSE-2.0 10013 * 10014 * Unless required by applicable law or agreed to in writing, software 10015 * distributed under the License is distributed on an "AS IS" BASIS, 10016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10017 * See the License for the specific language governing permissions and 10018 * limitations under the License. 10019 */ 10020 10021 10022 10023 /** 10024 * @extends {MDCFoundation<!MDCNotchedOutlineAdapter>} 10025 * @final 10026 */ 10027 10028 var MDCNotchedOutlineFoundation = 10029 /*#__PURE__*/ 10030 function (_MDCFoundation) { 10031 _inherits(MDCNotchedOutlineFoundation, _MDCFoundation); 10032 10033 _createClass(MDCNotchedOutlineFoundation, null, [{ 10034 key: "strings", 10035 10036 /** @return enum {string} */ 10037 get: function get() { 10038 return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"]; 10039 } 10040 /** @return enum {string} */ 10041 10042 }, { 10043 key: "cssClasses", 10044 get: function get() { 10045 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 10046 } 10047 /** 10048 * {@see MDCNotchedOutlineAdapter} for typing information on parameters and return 10049 * types. 10050 * @return {!MDCNotchedOutlineAdapter} 10051 */ 10052 10053 }, { 10054 key: "defaultAdapter", 10055 get: function get() { 10056 return ( 10057 /** @type {!MDCNotchedOutlineAdapter} */ 10058 { 10059 getWidth: function getWidth() {}, 10060 getHeight: function getHeight() {}, 10061 addClass: function addClass() {}, 10062 removeClass: function removeClass() {}, 10063 setOutlinePathAttr: function setOutlinePathAttr() {}, 10064 getIdleOutlineStyleValue: function getIdleOutlineStyleValue() {} 10065 } 10066 ); 10067 } 10068 /** 10069 * @param {!MDCNotchedOutlineAdapter} adapter 10070 */ 10071 10072 }]); 10073 10074 function MDCNotchedOutlineFoundation(adapter) { 10075 _classCallCheck(this, MDCNotchedOutlineFoundation); 10076 10077 return _possibleConstructorReturn(this, _getPrototypeOf(MDCNotchedOutlineFoundation).call(this, Object.assign(MDCNotchedOutlineFoundation.defaultAdapter, adapter))); 10078 } 10079 /** 10080 * Adds the outline notched selector and updates the notch width 10081 * calculated based off of notchWidth and isRtl. 10082 * @param {number} notchWidth 10083 * @param {boolean=} isRtl 10084 */ 10085 10086 10087 _createClass(MDCNotchedOutlineFoundation, [{ 10088 key: "notch", 10089 value: function notch(notchWidth) { 10090 var isRtl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 10091 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 10092 this.adapter_.addClass(OUTLINE_NOTCHED); 10093 this.updateSvgPath_(notchWidth, isRtl); 10094 } 10095 /** 10096 * Removes notched outline selector to close the notch in the outline. 10097 */ 10098 10099 }, { 10100 key: "closeNotch", 10101 value: function closeNotch() { 10102 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 10103 this.adapter_.removeClass(OUTLINE_NOTCHED); 10104 } 10105 /** 10106 * Updates the SVG path of the focus outline element based on the notchWidth 10107 * and the RTL context. 10108 * @param {number} notchWidth 10109 * @param {boolean=} isRtl 10110 * @private 10111 */ 10112 10113 }, { 10114 key: "updateSvgPath_", 10115 value: function updateSvgPath_(notchWidth, isRtl) { 10116 // Fall back to reading a specific corner's style because Firefox doesn't report the style on border-radius. 10117 var radiusStyleValue = this.adapter_.getIdleOutlineStyleValue('border-radius') || this.adapter_.getIdleOutlineStyleValue('border-top-left-radius'); 10118 var radius = parseFloat(radiusStyleValue); 10119 var width = this.adapter_.getWidth(); 10120 var height = this.adapter_.getHeight(); 10121 var cornerWidth = radius + 1.2; 10122 var leadingStrokeLength = Math.abs(11 - cornerWidth); 10123 var paddedNotchWidth = notchWidth + 8; // The right, bottom, and left sides of the outline follow the same SVG path. 10124 10125 var pathMiddle = 'a' + radius + ',' + radius + ' 0 0 1 ' + radius + ',' + radius + 'v' + (height - 2 * cornerWidth) + 'a' + radius + ',' + radius + ' 0 0 1 ' + -radius + ',' + radius + 'h' + (-width + 2 * cornerWidth) + 'a' + radius + ',' + radius + ' 0 0 1 ' + -radius + ',' + -radius + 'v' + (-height + 2 * cornerWidth) + 'a' + radius + ',' + radius + ' 0 0 1 ' + radius + ',' + -radius; 10126 var path; 10127 10128 if (!isRtl) { 10129 path = 'M' + (cornerWidth + leadingStrokeLength + paddedNotchWidth) + ',' + 1 + 'h' + (width - 2 * cornerWidth - paddedNotchWidth - leadingStrokeLength) + pathMiddle + 'h' + leadingStrokeLength; 10130 } else { 10131 path = 'M' + (width - cornerWidth - leadingStrokeLength) + ',' + 1 + 'h' + leadingStrokeLength + pathMiddle + 'h' + (width - 2 * cornerWidth - paddedNotchWidth - leadingStrokeLength); 10132 } 10133 10134 this.adapter_.setOutlinePathAttr(path); 10135 } 10136 }]); 10137 10138 return MDCNotchedOutlineFoundation; 10139 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 10140 10141 /* harmony default export */ __webpack_exports__["default"] = (MDCNotchedOutlineFoundation); 10142 10143 /***/ }), 10144 10145 /***/ "./node_modules/@material/notched-outline/index.js": 10146 /*!*********************************************************!*\ 10147 !*** ./node_modules/@material/notched-outline/index.js ***! 10148 \*********************************************************/ 10149 /*! exports provided: MDCNotchedOutline, MDCNotchedOutlineFoundation */ 10150 /***/ (function(module, __webpack_exports__, __webpack_require__) { 10151 10152 "use strict"; 10153 __webpack_require__.r(__webpack_exports__); 10154 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCNotchedOutline", function() { return MDCNotchedOutline; }); 10155 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 10156 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/notched-outline/adapter.js"); 10157 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/notched-outline/foundation.js"); 10158 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCNotchedOutlineFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 10159 10160 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/notched-outline/constants.js"); 10161 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 10162 10163 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10164 10165 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); } } 10166 10167 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 10168 10169 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 10170 10171 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 10172 10173 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 10174 10175 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 10176 10177 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 10178 10179 /** 10180 * @license 10181 * Copyright 2017 Google Inc. All Rights Reserved. 10182 * 10183 * Licensed under the Apache License, Version 2.0 (the "License"); 10184 * you may not use this file except in compliance with the License. 10185 * You may obtain a copy of the License at 10186 * 10187 * http://www.apache.org/licenses/LICENSE-2.0 10188 * 10189 * Unless required by applicable law or agreed to in writing, software 10190 * distributed under the License is distributed on an "AS IS" BASIS, 10191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10192 * See the License for the specific language governing permissions and 10193 * limitations under the License. 10194 */ 10195 10196 10197 10198 10199 /** 10200 * @extends {MDCComponent<!MDCNotchedOutlineFoundation>} 10201 * @final 10202 */ 10203 10204 var MDCNotchedOutline = 10205 /*#__PURE__*/ 10206 function (_MDCComponent) { 10207 _inherits(MDCNotchedOutline, _MDCComponent); 10208 10209 function MDCNotchedOutline() { 10210 _classCallCheck(this, MDCNotchedOutline); 10211 10212 return _possibleConstructorReturn(this, _getPrototypeOf(MDCNotchedOutline).apply(this, arguments)); 10213 } 10214 10215 _createClass(MDCNotchedOutline, [{ 10216 key: "notch", 10217 10218 /** 10219 * Updates outline selectors and SVG path to open notch. 10220 * @param {number} notchWidth The notch width in the outline. 10221 * @param {boolean=} isRtl Determines if outline is rtl. If rtl is true, notch 10222 * will be right justified in outline path, otherwise left justified. 10223 */ 10224 value: function notch(notchWidth, isRtl) { 10225 this.foundation_.notch(notchWidth, isRtl); 10226 } 10227 /** 10228 * Updates the outline selectors to close notch and return it to idle state. 10229 */ 10230 10231 }, { 10232 key: "closeNotch", 10233 value: function closeNotch() { 10234 this.foundation_.closeNotch(); 10235 } 10236 /** 10237 * @return {!MDCNotchedOutlineFoundation} 10238 */ 10239 10240 }, { 10241 key: "getDefaultFoundation", 10242 value: function getDefaultFoundation() { 10243 var _this = this; 10244 10245 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]({ 10246 getWidth: function getWidth() { 10247 return _this.root_.offsetWidth; 10248 }, 10249 getHeight: function getHeight() { 10250 return _this.root_.offsetHeight; 10251 }, 10252 addClass: function addClass(className) { 10253 return _this.root_.classList.add(className); 10254 }, 10255 removeClass: function removeClass(className) { 10256 return _this.root_.classList.remove(className); 10257 }, 10258 setOutlinePathAttr: function setOutlinePathAttr(value) { 10259 var path = _this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].PATH_SELECTOR); 10260 10261 path.setAttribute('d', value); 10262 }, 10263 getIdleOutlineStyleValue: function getIdleOutlineStyleValue(propertyName) { 10264 var idleOutlineElement = _this.root_.parentNode.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].IDLE_OUTLINE_SELECTOR); 10265 10266 return window.getComputedStyle(idleOutlineElement).getPropertyValue(propertyName); 10267 } 10268 }); 10269 } 10270 }], [{ 10271 key: "attachTo", 10272 10273 /** 10274 * @param {!Element} root 10275 * @return {!MDCNotchedOutline} 10276 */ 10277 value: function attachTo(root) { 10278 return new MDCNotchedOutline(root); 10279 } 10280 }]); 10281 10282 return MDCNotchedOutline; 10283 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 10284 10285 10286 10287 /***/ }), 10288 10289 /***/ "./node_modules/@material/ripple/adapter.js": 10290 /*!**************************************************!*\ 10291 !*** ./node_modules/@material/ripple/adapter.js ***! 10292 \**************************************************/ 10293 /*! exports provided: default */ 10294 /***/ (function(module, __webpack_exports__, __webpack_require__) { 10295 10296 "use strict"; 10297 __webpack_require__.r(__webpack_exports__); 10298 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10299 10300 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); } } 10301 10302 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 10303 10304 /** 10305 * @license 10306 * Copyright 2016 Google Inc. All Rights Reserved. 10307 * 10308 * Licensed under the Apache License, Version 2.0 (the "License"); 10309 * you may not use this file except in compliance with the License. 10310 * You may obtain a copy of the License at 10311 * 10312 * http://www.apache.org/licenses/LICENSE-2.0 10313 * 10314 * Unless required by applicable law or agreed to in writing, software 10315 * distributed under the License is distributed on an "AS IS" BASIS, 10316 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10317 * See the License for the specific language governing permissions and 10318 * limitations under the License. 10319 */ 10320 10321 /* eslint no-unused-vars: [2, {"args": "none"}] */ 10322 10323 /** 10324 * Adapter for MDC Ripple. Provides an interface for managing 10325 * - classes 10326 * - dom 10327 * - CSS variables 10328 * - position 10329 * - dimensions 10330 * - scroll position 10331 * - event handlers 10332 * - unbounded, active and disabled states 10333 * 10334 * Additionally, provides type information for the adapter to the Closure 10335 * compiler. 10336 * 10337 * Implement this adapter for your framework of choice to delegate updates to 10338 * the component in your framework of choice. See architecture documentation 10339 * for more details. 10340 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md 10341 * 10342 * @record 10343 */ 10344 var MDCRippleAdapter = 10345 /*#__PURE__*/ 10346 function () { 10347 function MDCRippleAdapter() { 10348 _classCallCheck(this, MDCRippleAdapter); 10349 } 10350 10351 _createClass(MDCRippleAdapter, [{ 10352 key: "browserSupportsCssVars", 10353 10354 /** @return {boolean} */ 10355 value: function browserSupportsCssVars() {} 10356 /** @return {boolean} */ 10357 10358 }, { 10359 key: "isUnbounded", 10360 value: function isUnbounded() {} 10361 /** @return {boolean} */ 10362 10363 }, { 10364 key: "isSurfaceActive", 10365 value: function isSurfaceActive() {} 10366 /** @return {boolean} */ 10367 10368 }, { 10369 key: "isSurfaceDisabled", 10370 value: function isSurfaceDisabled() {} 10371 /** @param {string} className */ 10372 10373 }, { 10374 key: "addClass", 10375 value: function addClass(className) {} 10376 /** @param {string} className */ 10377 10378 }, { 10379 key: "removeClass", 10380 value: function removeClass(className) {} 10381 /** @param {!EventTarget} target */ 10382 10383 }, { 10384 key: "containsEventTarget", 10385 value: function containsEventTarget(target) {} 10386 /** 10387 * @param {string} evtType 10388 * @param {!Function} handler 10389 */ 10390 10391 }, { 10392 key: "registerInteractionHandler", 10393 value: function registerInteractionHandler(evtType, handler) {} 10394 /** 10395 * @param {string} evtType 10396 * @param {!Function} handler 10397 */ 10398 10399 }, { 10400 key: "deregisterInteractionHandler", 10401 value: function deregisterInteractionHandler(evtType, handler) {} 10402 /** 10403 * @param {string} evtType 10404 * @param {!Function} handler 10405 */ 10406 10407 }, { 10408 key: "registerDocumentInteractionHandler", 10409 value: function registerDocumentInteractionHandler(evtType, handler) {} 10410 /** 10411 * @param {string} evtType 10412 * @param {!Function} handler 10413 */ 10414 10415 }, { 10416 key: "deregisterDocumentInteractionHandler", 10417 value: function deregisterDocumentInteractionHandler(evtType, handler) {} 10418 /** 10419 * @param {!Function} handler 10420 */ 10421 10422 }, { 10423 key: "registerResizeHandler", 10424 value: function registerResizeHandler(handler) {} 10425 /** 10426 * @param {!Function} handler 10427 */ 10428 10429 }, { 10430 key: "deregisterResizeHandler", 10431 value: function deregisterResizeHandler(handler) {} 10432 /** 10433 * @param {string} varName 10434 * @param {?number|string} value 10435 */ 10436 10437 }, { 10438 key: "updateCssVariable", 10439 value: function updateCssVariable(varName, value) {} 10440 /** @return {!ClientRect} */ 10441 10442 }, { 10443 key: "computeBoundingRect", 10444 value: function computeBoundingRect() {} 10445 /** @return {{x: number, y: number}} */ 10446 10447 }, { 10448 key: "getWindowPageOffset", 10449 value: function getWindowPageOffset() {} 10450 }]); 10451 10452 return MDCRippleAdapter; 10453 }(); 10454 10455 /* harmony default export */ __webpack_exports__["default"] = (MDCRippleAdapter); 10456 10457 /***/ }), 10458 10459 /***/ "./node_modules/@material/ripple/constants.js": 10460 /*!****************************************************!*\ 10461 !*** ./node_modules/@material/ripple/constants.js ***! 10462 \****************************************************/ 10463 /*! exports provided: cssClasses, strings, numbers */ 10464 /***/ (function(module, __webpack_exports__, __webpack_require__) { 10465 10466 "use strict"; 10467 __webpack_require__.r(__webpack_exports__); 10468 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 10469 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 10470 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numbers", function() { return numbers; }); 10471 /** 10472 * @license 10473 * Copyright 2016 Google Inc. All Rights Reserved. 10474 * 10475 * Licensed under the Apache License, Version 2.0 (the "License"); 10476 * you may not use this file except in compliance with the License. 10477 * You may obtain a copy of the License at 10478 * 10479 * http://www.apache.org/licenses/LICENSE-2.0 10480 * 10481 * Unless required by applicable law or agreed to in writing, software 10482 * distributed under the License is distributed on an "AS IS" BASIS, 10483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10484 * See the License for the specific language governing permissions and 10485 * limitations under the License. 10486 */ 10487 var cssClasses = { 10488 // Ripple is a special case where the "root" component is really a "mixin" of sorts, 10489 // given that it's an 'upgrade' to an existing component. That being said it is the root 10490 // CSS class that all other CSS classes derive from. 10491 ROOT: 'mdc-ripple-upgraded', 10492 UNBOUNDED: 'mdc-ripple-upgraded--unbounded', 10493 BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', 10494 FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', 10495 FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation' 10496 }; 10497 var strings = { 10498 VAR_LEFT: '--mdc-ripple-left', 10499 VAR_TOP: '--mdc-ripple-top', 10500 VAR_FG_SIZE: '--mdc-ripple-fg-size', 10501 VAR_FG_SCALE: '--mdc-ripple-fg-scale', 10502 VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', 10503 VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end' 10504 }; 10505 var numbers = { 10506 PADDING: 10, 10507 INITIAL_ORIGIN_SCALE: 0.6, 10508 DEACTIVATION_TIMEOUT_MS: 225, 10509 // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration) 10510 FG_DEACTIVATION_MS: 150, 10511 // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration) 10512 TAP_DELAY_MS: 300 // Delay between touch and simulated mouse events on touch devices 10513 10514 }; 10515 10516 10517 /***/ }), 10518 10519 /***/ "./node_modules/@material/ripple/foundation.js": 10520 /*!*****************************************************!*\ 10521 !*** ./node_modules/@material/ripple/foundation.js ***! 10522 \*****************************************************/ 10523 /*! exports provided: default */ 10524 /***/ (function(module, __webpack_exports__, __webpack_require__) { 10525 10526 "use strict"; 10527 __webpack_require__.r(__webpack_exports__); 10528 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 10529 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/ripple/adapter.js"); 10530 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/ripple/constants.js"); 10531 /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util */ "./node_modules/@material/ripple/util.js"); 10532 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 10533 10534 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10535 10536 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 10537 10538 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 10539 10540 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 10541 10542 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); } } 10543 10544 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 10545 10546 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 10547 10548 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 10549 10550 /** 10551 * @license 10552 * Copyright 2016 Google Inc. All Rights Reserved. 10553 * 10554 * Licensed under the Apache License, Version 2.0 (the "License"); 10555 * you may not use this file except in compliance with the License. 10556 * You may obtain a copy of the License at 10557 * 10558 * http://www.apache.org/licenses/LICENSE-2.0 10559 * 10560 * Unless required by applicable law or agreed to in writing, software 10561 * distributed under the License is distributed on an "AS IS" BASIS, 10562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10563 * See the License for the specific language governing permissions and 10564 * limitations under the License. 10565 */ 10566 10567 10568 10569 10570 /** 10571 * @typedef {{ 10572 * isActivated: (boolean|undefined), 10573 * hasDeactivationUXRun: (boolean|undefined), 10574 * wasActivatedByPointer: (boolean|undefined), 10575 * wasElementMadeActive: (boolean|undefined), 10576 * activationEvent: Event, 10577 * isProgrammatic: (boolean|undefined) 10578 * }} 10579 */ 10580 10581 var ActivationStateType; 10582 /** 10583 * @typedef {{ 10584 * activate: (string|undefined), 10585 * deactivate: (string|undefined), 10586 * focus: (string|undefined), 10587 * blur: (string|undefined) 10588 * }} 10589 */ 10590 10591 var ListenerInfoType; 10592 /** 10593 * @typedef {{ 10594 * activate: function(!Event), 10595 * deactivate: function(!Event), 10596 * focus: function(), 10597 * blur: function() 10598 * }} 10599 */ 10600 10601 var ListenersType; 10602 /** 10603 * @typedef {{ 10604 * x: number, 10605 * y: number 10606 * }} 10607 */ 10608 10609 var PointType; // Activation events registered on the root element of each instance for activation 10610 10611 var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs 10612 10613 var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup']; // Tracks activations that have occurred on the current frame, to avoid simultaneous nested activations 10614 10615 /** @type {!Array<!EventTarget>} */ 10616 10617 var activatedTargets = []; 10618 /** 10619 * @extends {MDCFoundation<!MDCRippleAdapter>} 10620 */ 10621 10622 var MDCRippleFoundation = 10623 /*#__PURE__*/ 10624 function (_MDCFoundation) { 10625 _inherits(MDCRippleFoundation, _MDCFoundation); 10626 10627 _createClass(MDCRippleFoundation, null, [{ 10628 key: "cssClasses", 10629 get: function get() { 10630 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 10631 } 10632 }, { 10633 key: "strings", 10634 get: function get() { 10635 return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"]; 10636 } 10637 }, { 10638 key: "numbers", 10639 get: function get() { 10640 return _constants__WEBPACK_IMPORTED_MODULE_2__["numbers"]; 10641 } 10642 }, { 10643 key: "defaultAdapter", 10644 get: function get() { 10645 return { 10646 browserSupportsCssVars: function browserSupportsCssVars() 10647 /* boolean - cached */ 10648 {}, 10649 isUnbounded: function isUnbounded() 10650 /* boolean */ 10651 {}, 10652 isSurfaceActive: function isSurfaceActive() 10653 /* boolean */ 10654 {}, 10655 isSurfaceDisabled: function isSurfaceDisabled() 10656 /* boolean */ 10657 {}, 10658 addClass: function addClass() 10659 /* className: string */ 10660 {}, 10661 removeClass: function removeClass() 10662 /* className: string */ 10663 {}, 10664 containsEventTarget: function containsEventTarget() 10665 /* target: !EventTarget */ 10666 {}, 10667 registerInteractionHandler: function registerInteractionHandler() 10668 /* evtType: string, handler: EventListener */ 10669 {}, 10670 deregisterInteractionHandler: function deregisterInteractionHandler() 10671 /* evtType: string, handler: EventListener */ 10672 {}, 10673 registerDocumentInteractionHandler: function registerDocumentInteractionHandler() 10674 /* evtType: string, handler: EventListener */ 10675 {}, 10676 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() 10677 /* evtType: string, handler: EventListener */ 10678 {}, 10679 registerResizeHandler: function registerResizeHandler() 10680 /* handler: EventListener */ 10681 {}, 10682 deregisterResizeHandler: function deregisterResizeHandler() 10683 /* handler: EventListener */ 10684 {}, 10685 updateCssVariable: function updateCssVariable() 10686 /* varName: string, value: string */ 10687 {}, 10688 computeBoundingRect: function computeBoundingRect() 10689 /* ClientRect */ 10690 {}, 10691 getWindowPageOffset: function getWindowPageOffset() 10692 /* {x: number, y: number} */ 10693 {} 10694 }; 10695 } 10696 }]); 10697 10698 function MDCRippleFoundation(adapter) { 10699 var _this; 10700 10701 _classCallCheck(this, MDCRippleFoundation); 10702 10703 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCRippleFoundation).call(this, Object.assign(MDCRippleFoundation.defaultAdapter, adapter))); 10704 /** @private {number} */ 10705 10706 _this.layoutFrame_ = 0; 10707 /** @private {!ClientRect} */ 10708 10709 _this.frame_ = 10710 /** @type {!ClientRect} */ 10711 { 10712 width: 0, 10713 height: 0 10714 }; 10715 /** @private {!ActivationStateType} */ 10716 10717 _this.activationState_ = _this.defaultActivationState_(); 10718 /** @private {number} */ 10719 10720 _this.initialSize_ = 0; 10721 /** @private {number} */ 10722 10723 _this.maxRadius_ = 0; 10724 /** @private {function(!Event)} */ 10725 10726 _this.activateHandler_ = function (e) { 10727 return _this.activate_(e); 10728 }; 10729 /** @private {function(!Event)} */ 10730 10731 10732 _this.deactivateHandler_ = function (e) { 10733 return _this.deactivate_(e); 10734 }; 10735 /** @private {function(?Event=)} */ 10736 10737 10738 _this.focusHandler_ = function () { 10739 return requestAnimationFrame(function () { 10740 return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 10741 }); 10742 }; 10743 /** @private {function(?Event=)} */ 10744 10745 10746 _this.blurHandler_ = function () { 10747 return requestAnimationFrame(function () { 10748 return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 10749 }); 10750 }; 10751 /** @private {!Function} */ 10752 10753 10754 _this.resizeHandler_ = function () { 10755 return _this.layout(); 10756 }; 10757 /** @private {{left: number, top:number}} */ 10758 10759 10760 _this.unboundedCoords_ = { 10761 left: 0, 10762 top: 0 10763 }; 10764 /** @private {number} */ 10765 10766 _this.fgScale_ = 0; 10767 /** @private {number} */ 10768 10769 _this.activationTimer_ = 0; 10770 /** @private {number} */ 10771 10772 _this.fgDeactivationRemovalTimer_ = 0; 10773 /** @private {boolean} */ 10774 10775 _this.activationAnimationHasEnded_ = false; 10776 /** @private {!Function} */ 10777 10778 _this.activationTimerCallback_ = function () { 10779 _this.activationAnimationHasEnded_ = true; 10780 10781 _this.runDeactivationUXLogicIfReady_(); 10782 }; 10783 /** @private {?Event} */ 10784 10785 10786 _this.previousActivationEvent_ = null; 10787 return _this; 10788 } 10789 /** 10790 * We compute this property so that we are not querying information about the client 10791 * until the point in time where the foundation requests it. This prevents scenarios where 10792 * client-side feature-detection may happen too early, such as when components are rendered on the server 10793 * and then initialized at mount time on the client. 10794 * @return {boolean} 10795 * @private 10796 */ 10797 10798 10799 _createClass(MDCRippleFoundation, [{ 10800 key: "isSupported_", 10801 value: function isSupported_() { 10802 return this.adapter_.browserSupportsCssVars(); 10803 } 10804 /** 10805 * @return {!ActivationStateType} 10806 */ 10807 10808 }, { 10809 key: "defaultActivationState_", 10810 value: function defaultActivationState_() { 10811 return { 10812 isActivated: false, 10813 hasDeactivationUXRun: false, 10814 wasActivatedByPointer: false, 10815 wasElementMadeActive: false, 10816 activationEvent: null, 10817 isProgrammatic: false 10818 }; 10819 } 10820 }, { 10821 key: "init", 10822 value: function init() { 10823 var _this2 = this; 10824 10825 if (!this.isSupported_()) { 10826 return; 10827 } 10828 10829 this.registerRootHandlers_(); 10830 var _MDCRippleFoundation$ = MDCRippleFoundation.cssClasses, 10831 ROOT = _MDCRippleFoundation$.ROOT, 10832 UNBOUNDED = _MDCRippleFoundation$.UNBOUNDED; 10833 requestAnimationFrame(function () { 10834 _this2.adapter_.addClass(ROOT); 10835 10836 if (_this2.adapter_.isUnbounded()) { 10837 _this2.adapter_.addClass(UNBOUNDED); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple 10838 10839 10840 _this2.layoutInternal_(); 10841 } 10842 }); 10843 } 10844 }, { 10845 key: "destroy", 10846 value: function destroy() { 10847 var _this3 = this; 10848 10849 if (!this.isSupported_()) { 10850 return; 10851 } 10852 10853 if (this.activationTimer_) { 10854 clearTimeout(this.activationTimer_); 10855 this.activationTimer_ = 0; 10856 var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; 10857 this.adapter_.removeClass(FG_ACTIVATION); 10858 } 10859 10860 this.deregisterRootHandlers_(); 10861 this.deregisterDeactivationHandlers_(); 10862 var _MDCRippleFoundation$2 = MDCRippleFoundation.cssClasses, 10863 ROOT = _MDCRippleFoundation$2.ROOT, 10864 UNBOUNDED = _MDCRippleFoundation$2.UNBOUNDED; 10865 requestAnimationFrame(function () { 10866 _this3.adapter_.removeClass(ROOT); 10867 10868 _this3.adapter_.removeClass(UNBOUNDED); 10869 10870 _this3.removeCssVars_(); 10871 }); 10872 } 10873 /** @private */ 10874 10875 }, { 10876 key: "registerRootHandlers_", 10877 value: function registerRootHandlers_() { 10878 var _this4 = this; 10879 10880 ACTIVATION_EVENT_TYPES.forEach(function (type) { 10881 _this4.adapter_.registerInteractionHandler(type, _this4.activateHandler_); 10882 }); 10883 this.adapter_.registerInteractionHandler('focus', this.focusHandler_); 10884 this.adapter_.registerInteractionHandler('blur', this.blurHandler_); 10885 10886 if (this.adapter_.isUnbounded()) { 10887 this.adapter_.registerResizeHandler(this.resizeHandler_); 10888 } 10889 } 10890 /** 10891 * @param {!Event} e 10892 * @private 10893 */ 10894 10895 }, { 10896 key: "registerDeactivationHandlers_", 10897 value: function registerDeactivationHandlers_(e) { 10898 var _this5 = this; 10899 10900 if (e.type === 'keydown') { 10901 this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); 10902 } else { 10903 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) { 10904 _this5.adapter_.registerDocumentInteractionHandler(type, _this5.deactivateHandler_); 10905 }); 10906 } 10907 } 10908 /** @private */ 10909 10910 }, { 10911 key: "deregisterRootHandlers_", 10912 value: function deregisterRootHandlers_() { 10913 var _this6 = this; 10914 10915 ACTIVATION_EVENT_TYPES.forEach(function (type) { 10916 _this6.adapter_.deregisterInteractionHandler(type, _this6.activateHandler_); 10917 }); 10918 this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); 10919 this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); 10920 10921 if (this.adapter_.isUnbounded()) { 10922 this.adapter_.deregisterResizeHandler(this.resizeHandler_); 10923 } 10924 } 10925 /** @private */ 10926 10927 }, { 10928 key: "deregisterDeactivationHandlers_", 10929 value: function deregisterDeactivationHandlers_() { 10930 var _this7 = this; 10931 10932 this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); 10933 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) { 10934 _this7.adapter_.deregisterDocumentInteractionHandler(type, _this7.deactivateHandler_); 10935 }); 10936 } 10937 /** @private */ 10938 10939 }, { 10940 key: "removeCssVars_", 10941 value: function removeCssVars_() { 10942 var _this8 = this; 10943 10944 var strings = MDCRippleFoundation.strings; 10945 Object.keys(strings).forEach(function (k) { 10946 if (k.indexOf('VAR_') === 0) { 10947 _this8.adapter_.updateCssVariable(strings[k], null); 10948 } 10949 }); 10950 } 10951 /** 10952 * @param {?Event} e 10953 * @private 10954 */ 10955 10956 }, { 10957 key: "activate_", 10958 value: function activate_(e) { 10959 var _this9 = this; 10960 10961 if (this.adapter_.isSurfaceDisabled()) { 10962 return; 10963 } 10964 10965 var activationState = this.activationState_; 10966 10967 if (activationState.isActivated) { 10968 return; 10969 } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction 10970 10971 10972 var previousActivationEvent = this.previousActivationEvent_; 10973 var isSameInteraction = previousActivationEvent && e && previousActivationEvent.type !== e.type; 10974 10975 if (isSameInteraction) { 10976 return; 10977 } 10978 10979 activationState.isActivated = true; 10980 activationState.isProgrammatic = e === null; 10981 activationState.activationEvent = e; 10982 activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown'; 10983 var hasActivatedChild = e && activatedTargets.length > 0 && activatedTargets.some(function (target) { 10984 return _this9.adapter_.containsEventTarget(target); 10985 }); 10986 10987 if (hasActivatedChild) { 10988 // Immediately reset activation state, while preserving logic that prevents touch follow-on events 10989 this.resetActivationState_(); 10990 return; 10991 } 10992 10993 if (e) { 10994 activatedTargets.push( 10995 /** @type {!EventTarget} */ 10996 e.target); 10997 this.registerDeactivationHandlers_(e); 10998 } 10999 11000 activationState.wasElementMadeActive = this.checkElementMadeActive_(e); 11001 11002 if (activationState.wasElementMadeActive) { 11003 this.animateActivation_(); 11004 } 11005 11006 requestAnimationFrame(function () { 11007 // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples 11008 activatedTargets = []; 11009 11010 if (!activationState.wasElementMadeActive && (e.key === ' ' || e.keyCode === 32)) { 11011 // If space was pressed, try again within an rAF call to detect :active, because different UAs report 11012 // active states inconsistently when they're called within event handling code: 11013 // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 11014 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 11015 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS 11016 // variable is set within a rAF callback for a submit button interaction (#2241). 11017 activationState.wasElementMadeActive = _this9.checkElementMadeActive_(e); 11018 11019 if (activationState.wasElementMadeActive) { 11020 _this9.animateActivation_(); 11021 } 11022 } 11023 11024 if (!activationState.wasElementMadeActive) { 11025 // Reset activation state immediately if element was not made active. 11026 _this9.activationState_ = _this9.defaultActivationState_(); 11027 } 11028 }); 11029 } 11030 /** 11031 * @param {?Event} e 11032 * @private 11033 */ 11034 11035 }, { 11036 key: "checkElementMadeActive_", 11037 value: function checkElementMadeActive_(e) { 11038 return e && e.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; 11039 } 11040 /** 11041 * @param {?Event=} event Optional event containing position information. 11042 */ 11043 11044 }, { 11045 key: "activate", 11046 value: function activate() { 11047 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 11048 this.activate_(event); 11049 } 11050 /** @private */ 11051 11052 }, { 11053 key: "animateActivation_", 11054 value: function animateActivation_() { 11055 var _this10 = this; 11056 11057 var _MDCRippleFoundation$3 = MDCRippleFoundation.strings, 11058 VAR_FG_TRANSLATE_START = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_START, 11059 VAR_FG_TRANSLATE_END = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_END; 11060 var _MDCRippleFoundation$4 = MDCRippleFoundation.cssClasses, 11061 FG_DEACTIVATION = _MDCRippleFoundation$4.FG_DEACTIVATION, 11062 FG_ACTIVATION = _MDCRippleFoundation$4.FG_ACTIVATION; 11063 var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; 11064 this.layoutInternal_(); 11065 var translateStart = ''; 11066 var translateEnd = ''; 11067 11068 if (!this.adapter_.isUnbounded()) { 11069 var _this$getFgTranslatio = this.getFgTranslationCoordinates_(), 11070 startPoint = _this$getFgTranslatio.startPoint, 11071 endPoint = _this$getFgTranslatio.endPoint; 11072 11073 translateStart = "".concat(startPoint.x, "px, ").concat(startPoint.y, "px"); 11074 translateEnd = "".concat(endPoint.x, "px, ").concat(endPoint.y, "px"); 11075 } 11076 11077 this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); 11078 this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations 11079 11080 clearTimeout(this.activationTimer_); 11081 clearTimeout(this.fgDeactivationRemovalTimer_); 11082 this.rmBoundedActivationClasses_(); 11083 this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. 11084 11085 this.adapter_.computeBoundingRect(); 11086 this.adapter_.addClass(FG_ACTIVATION); 11087 this.activationTimer_ = setTimeout(function () { 11088 return _this10.activationTimerCallback_(); 11089 }, DEACTIVATION_TIMEOUT_MS); 11090 } 11091 /** 11092 * @private 11093 * @return {{startPoint: PointType, endPoint: PointType}} 11094 */ 11095 11096 }, { 11097 key: "getFgTranslationCoordinates_", 11098 value: function getFgTranslationCoordinates_() { 11099 var _this$activationState = this.activationState_, 11100 activationEvent = _this$activationState.activationEvent, 11101 wasActivatedByPointer = _this$activationState.wasActivatedByPointer; 11102 var startPoint; 11103 11104 if (wasActivatedByPointer) { 11105 startPoint = Object(_util__WEBPACK_IMPORTED_MODULE_3__["getNormalizedEventCoords"])( 11106 /** @type {!Event} */ 11107 activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); 11108 } else { 11109 startPoint = { 11110 x: this.frame_.width / 2, 11111 y: this.frame_.height / 2 11112 }; 11113 } // Center the element around the start point. 11114 11115 11116 startPoint = { 11117 x: startPoint.x - this.initialSize_ / 2, 11118 y: startPoint.y - this.initialSize_ / 2 11119 }; 11120 var endPoint = { 11121 x: this.frame_.width / 2 - this.initialSize_ / 2, 11122 y: this.frame_.height / 2 - this.initialSize_ / 2 11123 }; 11124 return { 11125 startPoint: startPoint, 11126 endPoint: endPoint 11127 }; 11128 } 11129 /** @private */ 11130 11131 }, { 11132 key: "runDeactivationUXLogicIfReady_", 11133 value: function runDeactivationUXLogicIfReady_() { 11134 var _this11 = this; 11135 11136 // This method is called both when a pointing device is released, and when the activation animation ends. 11137 // The deactivation animation should only run after both of those occur. 11138 var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; 11139 var _this$activationState2 = this.activationState_, 11140 hasDeactivationUXRun = _this$activationState2.hasDeactivationUXRun, 11141 isActivated = _this$activationState2.isActivated; 11142 var activationHasEnded = hasDeactivationUXRun || !isActivated; 11143 11144 if (activationHasEnded && this.activationAnimationHasEnded_) { 11145 this.rmBoundedActivationClasses_(); 11146 this.adapter_.addClass(FG_DEACTIVATION); 11147 this.fgDeactivationRemovalTimer_ = setTimeout(function () { 11148 _this11.adapter_.removeClass(FG_DEACTIVATION); 11149 }, _constants__WEBPACK_IMPORTED_MODULE_2__["numbers"].FG_DEACTIVATION_MS); 11150 } 11151 } 11152 /** @private */ 11153 11154 }, { 11155 key: "rmBoundedActivationClasses_", 11156 value: function rmBoundedActivationClasses_() { 11157 var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; 11158 this.adapter_.removeClass(FG_ACTIVATION); 11159 this.activationAnimationHasEnded_ = false; 11160 this.adapter_.computeBoundingRect(); 11161 } 11162 }, { 11163 key: "resetActivationState_", 11164 value: function resetActivationState_() { 11165 var _this12 = this; 11166 11167 this.previousActivationEvent_ = this.activationState_.activationEvent; 11168 this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. 11169 // Store the previous event until it's safe to assume that subsequent events are for new interactions. 11170 11171 setTimeout(function () { 11172 return _this12.previousActivationEvent_ = null; 11173 }, MDCRippleFoundation.numbers.TAP_DELAY_MS); 11174 } 11175 /** 11176 * @param {?Event} e 11177 * @private 11178 */ 11179 11180 }, { 11181 key: "deactivate_", 11182 value: function deactivate_(e) { 11183 var _this13 = this; 11184 11185 var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. 11186 11187 if (!activationState.isActivated) { 11188 return; 11189 } 11190 11191 var state = 11192 /** @type {!ActivationStateType} */ 11193 Object.assign({}, activationState); 11194 11195 if (activationState.isProgrammatic) { 11196 var evtObject = null; 11197 requestAnimationFrame(function () { 11198 return _this13.animateDeactivation_(evtObject, state); 11199 }); 11200 this.resetActivationState_(); 11201 } else { 11202 this.deregisterDeactivationHandlers_(); 11203 requestAnimationFrame(function () { 11204 _this13.activationState_.hasDeactivationUXRun = true; 11205 11206 _this13.animateDeactivation_(e, state); 11207 11208 _this13.resetActivationState_(); 11209 }); 11210 } 11211 } 11212 /** 11213 * @param {?Event=} event Optional event containing position information. 11214 */ 11215 11216 }, { 11217 key: "deactivate", 11218 value: function deactivate() { 11219 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 11220 this.deactivate_(event); 11221 } 11222 /** 11223 * @param {Event} e 11224 * @param {!ActivationStateType} options 11225 * @private 11226 */ 11227 11228 }, { 11229 key: "animateDeactivation_", 11230 value: function animateDeactivation_(e, _ref) { 11231 var wasActivatedByPointer = _ref.wasActivatedByPointer, 11232 wasElementMadeActive = _ref.wasElementMadeActive; 11233 11234 if (wasActivatedByPointer || wasElementMadeActive) { 11235 this.runDeactivationUXLogicIfReady_(); 11236 } 11237 } 11238 }, { 11239 key: "layout", 11240 value: function layout() { 11241 var _this14 = this; 11242 11243 if (this.layoutFrame_) { 11244 cancelAnimationFrame(this.layoutFrame_); 11245 } 11246 11247 this.layoutFrame_ = requestAnimationFrame(function () { 11248 _this14.layoutInternal_(); 11249 11250 _this14.layoutFrame_ = 0; 11251 }); 11252 } 11253 /** @private */ 11254 11255 }, { 11256 key: "layoutInternal_", 11257 value: function layoutInternal_() { 11258 var _this15 = this; 11259 11260 this.frame_ = this.adapter_.computeBoundingRect(); 11261 var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. 11262 // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately 11263 // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically 11264 // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter 11265 // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via 11266 // `overflow: hidden`. 11267 11268 var getBoundedRadius = function getBoundedRadius() { 11269 var hypotenuse = Math.sqrt(Math.pow(_this15.frame_.width, 2) + Math.pow(_this15.frame_.height, 2)); 11270 return hypotenuse + MDCRippleFoundation.numbers.PADDING; 11271 }; 11272 11273 this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform 11274 11275 this.initialSize_ = maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE; 11276 this.fgScale_ = this.maxRadius_ / this.initialSize_; 11277 this.updateLayoutCssVars_(); 11278 } 11279 /** @private */ 11280 11281 }, { 11282 key: "updateLayoutCssVars_", 11283 value: function updateLayoutCssVars_() { 11284 var _MDCRippleFoundation$5 = MDCRippleFoundation.strings, 11285 VAR_FG_SIZE = _MDCRippleFoundation$5.VAR_FG_SIZE, 11286 VAR_LEFT = _MDCRippleFoundation$5.VAR_LEFT, 11287 VAR_TOP = _MDCRippleFoundation$5.VAR_TOP, 11288 VAR_FG_SCALE = _MDCRippleFoundation$5.VAR_FG_SCALE; 11289 this.adapter_.updateCssVariable(VAR_FG_SIZE, "".concat(this.initialSize_, "px")); 11290 this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); 11291 11292 if (this.adapter_.isUnbounded()) { 11293 this.unboundedCoords_ = { 11294 left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), 11295 top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) 11296 }; 11297 this.adapter_.updateCssVariable(VAR_LEFT, "".concat(this.unboundedCoords_.left, "px")); 11298 this.adapter_.updateCssVariable(VAR_TOP, "".concat(this.unboundedCoords_.top, "px")); 11299 } 11300 } 11301 /** @param {boolean} unbounded */ 11302 11303 }, { 11304 key: "setUnbounded", 11305 value: function setUnbounded(unbounded) { 11306 var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; 11307 11308 if (unbounded) { 11309 this.adapter_.addClass(UNBOUNDED); 11310 } else { 11311 this.adapter_.removeClass(UNBOUNDED); 11312 } 11313 } 11314 }]); 11315 11316 return MDCRippleFoundation; 11317 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 11318 11319 /* harmony default export */ __webpack_exports__["default"] = (MDCRippleFoundation); 11320 11321 /***/ }), 11322 11323 /***/ "./node_modules/@material/ripple/index.js": 11324 /*!************************************************!*\ 11325 !*** ./node_modules/@material/ripple/index.js ***! 11326 \************************************************/ 11327 /*! exports provided: MDCRipple, MDCRippleFoundation, RippleCapableSurface, util */ 11328 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11329 11330 "use strict"; 11331 __webpack_require__.r(__webpack_exports__); 11332 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return MDCRipple; }); 11333 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RippleCapableSurface", function() { return RippleCapableSurface; }); 11334 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 11335 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/ripple/adapter.js"); 11336 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/ripple/foundation.js"); 11337 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 11338 11339 /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util */ "./node_modules/@material/ripple/util.js"); 11340 /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "util", function() { return _util__WEBPACK_IMPORTED_MODULE_3__; }); 11341 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 11342 11343 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11344 11345 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); } } 11346 11347 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 11348 11349 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 11350 11351 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 11352 11353 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 11354 11355 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 11356 11357 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 11358 11359 /** 11360 * @license 11361 * Copyright 2016 Google Inc. All Rights Reserved. 11362 * 11363 * Licensed under the Apache License, Version 2.0 (the "License"); 11364 * you may not use this file except in compliance with the License. 11365 * You may obtain a copy of the License at 11366 * 11367 * http://www.apache.org/licenses/LICENSE-2.0 11368 * 11369 * Unless required by applicable law or agreed to in writing, software 11370 * distributed under the License is distributed on an "AS IS" BASIS, 11371 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11372 * See the License for the specific language governing permissions and 11373 * limitations under the License. 11374 */ 11375 11376 11377 11378 11379 /** 11380 * @extends MDCComponent<!MDCRippleFoundation> 11381 */ 11382 11383 var MDCRipple = 11384 /*#__PURE__*/ 11385 function (_MDCComponent) { 11386 _inherits(MDCRipple, _MDCComponent); 11387 11388 /** @param {...?} args */ 11389 function MDCRipple() { 11390 var _getPrototypeOf2; 11391 11392 var _this; 11393 11394 _classCallCheck(this, MDCRipple); 11395 11396 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 11397 args[_key] = arguments[_key]; 11398 } 11399 11400 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MDCRipple)).call.apply(_getPrototypeOf2, [this].concat(args))); 11401 /** @type {boolean} */ 11402 11403 _this.disabled = false; 11404 /** @private {boolean} */ 11405 11406 _this.unbounded_; 11407 return _this; 11408 } 11409 /** 11410 * @param {!Element} root 11411 * @param {{isUnbounded: (boolean|undefined)}=} options 11412 * @return {!MDCRipple} 11413 */ 11414 11415 11416 _createClass(MDCRipple, [{ 11417 key: "setUnbounded_", 11418 11419 /** 11420 * Closure Compiler throws an access control error when directly accessing a 11421 * protected or private property inside a getter/setter, like unbounded above. 11422 * By accessing the protected property inside a method, we solve that problem. 11423 * That's why this function exists. 11424 * @private 11425 */ 11426 value: function setUnbounded_() { 11427 this.foundation_.setUnbounded(this.unbounded_); 11428 } 11429 }, { 11430 key: "activate", 11431 value: function activate() { 11432 this.foundation_.activate(); 11433 } 11434 }, { 11435 key: "deactivate", 11436 value: function deactivate() { 11437 this.foundation_.deactivate(); 11438 } 11439 }, { 11440 key: "layout", 11441 value: function layout() { 11442 this.foundation_.layout(); 11443 } 11444 /** @return {!MDCRippleFoundation} */ 11445 11446 }, { 11447 key: "getDefaultFoundation", 11448 value: function getDefaultFoundation() { 11449 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"](MDCRipple.createAdapter(this)); 11450 } 11451 }, { 11452 key: "initialSyncWithDOM", 11453 value: function initialSyncWithDOM() { 11454 this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset; 11455 } 11456 }, { 11457 key: "unbounded", 11458 11459 /** @return {boolean} */ 11460 get: function get() { 11461 return this.unbounded_; 11462 } 11463 /** @param {boolean} unbounded */ 11464 , 11465 set: function set(unbounded) { 11466 this.unbounded_ = Boolean(unbounded); 11467 this.setUnbounded_(); 11468 } 11469 }], [{ 11470 key: "attachTo", 11471 value: function attachTo(root) { 11472 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 11473 _ref$isUnbounded = _ref.isUnbounded, 11474 isUnbounded = _ref$isUnbounded === void 0 ? undefined : _ref$isUnbounded; 11475 11476 var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified 11477 11478 if (isUnbounded !== undefined) { 11479 ripple.unbounded = 11480 /** @type {boolean} */ 11481 isUnbounded; 11482 } 11483 11484 return ripple; 11485 } 11486 /** 11487 * @param {!RippleCapableSurface} instance 11488 * @return {!MDCRippleAdapter} 11489 */ 11490 11491 }, { 11492 key: "createAdapter", 11493 value: function createAdapter(instance) { 11494 var MATCHES = _util__WEBPACK_IMPORTED_MODULE_3__["getMatchesProperty"](HTMLElement.prototype); 11495 return { 11496 browserSupportsCssVars: function browserSupportsCssVars() { 11497 return _util__WEBPACK_IMPORTED_MODULE_3__["supportsCssVariables"](window); 11498 }, 11499 isUnbounded: function isUnbounded() { 11500 return instance.unbounded; 11501 }, 11502 isSurfaceActive: function isSurfaceActive() { 11503 return instance.root_[MATCHES](':active'); 11504 }, 11505 isSurfaceDisabled: function isSurfaceDisabled() { 11506 return instance.disabled; 11507 }, 11508 addClass: function addClass(className) { 11509 return instance.root_.classList.add(className); 11510 }, 11511 removeClass: function removeClass(className) { 11512 return instance.root_.classList.remove(className); 11513 }, 11514 containsEventTarget: function containsEventTarget(target) { 11515 return instance.root_.contains(target); 11516 }, 11517 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 11518 return instance.root_.addEventListener(evtType, handler, _util__WEBPACK_IMPORTED_MODULE_3__["applyPassive"]()); 11519 }, 11520 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 11521 return instance.root_.removeEventListener(evtType, handler, _util__WEBPACK_IMPORTED_MODULE_3__["applyPassive"]()); 11522 }, 11523 registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { 11524 return document.documentElement.addEventListener(evtType, handler, _util__WEBPACK_IMPORTED_MODULE_3__["applyPassive"]()); 11525 }, 11526 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { 11527 return document.documentElement.removeEventListener(evtType, handler, _util__WEBPACK_IMPORTED_MODULE_3__["applyPassive"]()); 11528 }, 11529 registerResizeHandler: function registerResizeHandler(handler) { 11530 return window.addEventListener('resize', handler); 11531 }, 11532 deregisterResizeHandler: function deregisterResizeHandler(handler) { 11533 return window.removeEventListener('resize', handler); 11534 }, 11535 updateCssVariable: function updateCssVariable(varName, value) { 11536 return instance.root_.style.setProperty(varName, value); 11537 }, 11538 computeBoundingRect: function computeBoundingRect() { 11539 return instance.root_.getBoundingClientRect(); 11540 }, 11541 getWindowPageOffset: function getWindowPageOffset() { 11542 return { 11543 x: window.pageXOffset, 11544 y: window.pageYOffset 11545 }; 11546 } 11547 }; 11548 } 11549 }]); 11550 11551 return MDCRipple; 11552 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 11553 /** 11554 * See Material Design spec for more details on when to use ripples. 11555 * https://material.io/guidelines/motion/choreography.html#choreography-creation 11556 * @record 11557 */ 11558 11559 11560 var RippleCapableSurface = function RippleCapableSurface() { 11561 _classCallCheck(this, RippleCapableSurface); 11562 }; 11563 /** @protected {!Element} */ 11564 11565 11566 RippleCapableSurface.prototype.root_; 11567 /** 11568 * Whether or not the ripple bleeds out of the bounds of the element. 11569 * @type {boolean|undefined} 11570 */ 11571 11572 RippleCapableSurface.prototype.unbounded; 11573 /** 11574 * Whether or not the ripple is attached to a disabled component. 11575 * @type {boolean|undefined} 11576 */ 11577 11578 RippleCapableSurface.prototype.disabled; 11579 11580 11581 /***/ }), 11582 11583 /***/ "./node_modules/@material/ripple/util.js": 11584 /*!***********************************************!*\ 11585 !*** ./node_modules/@material/ripple/util.js ***! 11586 \***********************************************/ 11587 /*! exports provided: supportsCssVariables, applyPassive, getMatchesProperty, getNormalizedEventCoords */ 11588 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11589 11590 "use strict"; 11591 __webpack_require__.r(__webpack_exports__); 11592 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsCssVariables", function() { return supportsCssVariables; }); 11593 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyPassive", function() { return applyPassive; }); 11594 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMatchesProperty", function() { return getMatchesProperty; }); 11595 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; }); 11596 /** 11597 * @license 11598 * Copyright 2016 Google Inc. All Rights Reserved. 11599 * 11600 * Licensed under the Apache License, Version 2.0 (the "License"); 11601 * you may not use this file except in compliance with the License. 11602 * You may obtain a copy of the License at 11603 * 11604 * http://www.apache.org/licenses/LICENSE-2.0 11605 * 11606 * Unless required by applicable law or agreed to in writing, software 11607 * distributed under the License is distributed on an "AS IS" BASIS, 11608 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11609 * See the License for the specific language governing permissions and 11610 * limitations under the License. 11611 */ 11612 11613 /** 11614 * Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support. 11615 * @private {boolean|undefined} 11616 */ 11617 var supportsCssVariables_; 11618 /** 11619 * Stores result from applyPassive to avoid redundant processing to detect passive event listener support. 11620 * @private {boolean|undefined} 11621 */ 11622 11623 var supportsPassive_; 11624 /** 11625 * @param {!Window} windowObj 11626 * @return {boolean} 11627 */ 11628 11629 function detectEdgePseudoVarBug(windowObj) { 11630 // Detect versions of Edge with buggy var() support 11631 // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ 11632 var document = windowObj.document; 11633 var node = document.createElement('div'); 11634 node.className = 'mdc-ripple-surface--test-edge-var-bug'; 11635 document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. 11636 // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, 11637 // but Firefox is known to support CSS custom properties correctly. 11638 // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 11639 11640 var computedStyle = windowObj.getComputedStyle(node); 11641 var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; 11642 node.remove(); 11643 return hasPseudoVarBug; 11644 } 11645 /** 11646 * @param {!Window} windowObj 11647 * @param {boolean=} forceRefresh 11648 * @return {boolean|undefined} 11649 */ 11650 11651 11652 function supportsCssVariables(windowObj) { 11653 var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 11654 var supportsCssVariables = supportsCssVariables_; 11655 11656 if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { 11657 return supportsCssVariables; 11658 } 11659 11660 var supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function'; 11661 11662 if (!supportsFunctionPresent) { 11663 return; 11664 } 11665 11666 var explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 11667 // See: README section on Safari 11668 11669 var weAreFeatureDetectingSafari10plus = windowObj.CSS.supports('(--css-vars: yes)') && windowObj.CSS.supports('color', '#00000000'); 11670 11671 if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { 11672 supportsCssVariables = !detectEdgePseudoVarBug(windowObj); 11673 } else { 11674 supportsCssVariables = false; 11675 } 11676 11677 if (!forceRefresh) { 11678 supportsCssVariables_ = supportsCssVariables; 11679 } 11680 11681 return supportsCssVariables; 11682 } // 11683 11684 /** 11685 * Determine whether the current browser supports passive event listeners, and if so, use them. 11686 * @param {!Window=} globalObj 11687 * @param {boolean=} forceRefresh 11688 * @return {boolean|{passive: boolean}} 11689 */ 11690 11691 11692 function applyPassive() { 11693 var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; 11694 var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 11695 11696 if (supportsPassive_ === undefined || forceRefresh) { 11697 var isSupported = false; 11698 11699 try { 11700 globalObj.document.addEventListener('test', null, { 11701 get passive() { 11702 isSupported = true; 11703 } 11704 11705 }); 11706 } catch (e) {} 11707 11708 supportsPassive_ = isSupported; 11709 } 11710 11711 return supportsPassive_ ? { 11712 passive: true 11713 } : false; 11714 } 11715 /** 11716 * @param {!Object} HTMLElementPrototype 11717 * @return {!Array<string>} 11718 */ 11719 11720 11721 function getMatchesProperty(HTMLElementPrototype) { 11722 return ['webkitMatchesSelector', 'msMatchesSelector', 'matches'].filter(function (p) { 11723 return p in HTMLElementPrototype; 11724 }).pop(); 11725 } 11726 /** 11727 * @param {!Event} ev 11728 * @param {{x: number, y: number}} pageOffset 11729 * @param {!ClientRect} clientRect 11730 * @return {{x: number, y: number}} 11731 */ 11732 11733 11734 function getNormalizedEventCoords(ev, pageOffset, clientRect) { 11735 var x = pageOffset.x, 11736 y = pageOffset.y; 11737 var documentX = x + clientRect.left; 11738 var documentY = y + clientRect.top; 11739 var normalizedX; 11740 var normalizedY; // Determine touch point relative to the ripple container. 11741 11742 if (ev.type === 'touchstart') { 11743 normalizedX = ev.changedTouches[0].pageX - documentX; 11744 normalizedY = ev.changedTouches[0].pageY - documentY; 11745 } else { 11746 normalizedX = ev.pageX - documentX; 11747 normalizedY = ev.pageY - documentY; 11748 } 11749 11750 return { 11751 x: normalizedX, 11752 y: normalizedY 11753 }; 11754 } 11755 11756 11757 11758 /***/ }), 11759 11760 /***/ "./node_modules/@material/selection-control/index.js": 11761 /*!***********************************************************!*\ 11762 !*** ./node_modules/@material/selection-control/index.js ***! 11763 \***********************************************************/ 11764 /*! exports provided: MDCSelectionControlState, MDCSelectionControl */ 11765 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11766 11767 "use strict"; 11768 __webpack_require__.r(__webpack_exports__); 11769 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSelectionControlState", function() { return MDCSelectionControlState; }); 11770 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSelectionControl", function() { return MDCSelectionControl; }); 11771 /* harmony import */ var _material_ripple_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/ripple/index */ "./node_modules/@material/ripple/index.js"); 11772 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11773 11774 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); } } 11775 11776 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 11777 11778 /** 11779 * @license 11780 * Copyright 2017 Google Inc. All Rights Reserved. 11781 * 11782 * Licensed under the Apache License, Version 2.0 (the "License"); 11783 * you may not use this file except in compliance with the License. 11784 * You may obtain a copy of the License at 11785 * 11786 * http://www.apache.org/licenses/LICENSE-2.0 11787 * 11788 * Unless required by applicable law or agreed to in writing, software 11789 * distributed under the License is distributed on an "AS IS" BASIS, 11790 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11791 * See the License for the specific language governing permissions and 11792 * limitations under the License. 11793 */ 11794 11795 /* eslint-disable no-unused-vars */ 11796 11797 /* eslint-enable no-unused-vars */ 11798 11799 /** 11800 * @typedef {{ 11801 * checked: boolean, 11802 * indeterminate: boolean, 11803 * disabled: boolean, 11804 * value: ?string 11805 * }} 11806 */ 11807 11808 var MDCSelectionControlState; 11809 /** 11810 * @record 11811 */ 11812 11813 var MDCSelectionControl = 11814 /*#__PURE__*/ 11815 function () { 11816 function MDCSelectionControl() { 11817 _classCallCheck(this, MDCSelectionControl); 11818 } 11819 11820 _createClass(MDCSelectionControl, [{ 11821 key: "ripple", 11822 11823 /** @return {?MDCRipple} */ 11824 get: function get() {} 11825 }]); 11826 11827 return MDCSelectionControl; 11828 }(); 11829 11830 11831 11832 /***/ }), 11833 11834 /***/ "./node_modules/@material/textfield/adapter.js": 11835 /*!*****************************************************!*\ 11836 !*** ./node_modules/@material/textfield/adapter.js ***! 11837 \*****************************************************/ 11838 /*! exports provided: MDCTextFieldAdapter, NativeInputType, FoundationMapType */ 11839 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11840 11841 "use strict"; 11842 __webpack_require__.r(__webpack_exports__); 11843 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldAdapter", function() { return MDCTextFieldAdapter; }); 11844 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NativeInputType", function() { return NativeInputType; }); 11845 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoundationMapType", function() { return FoundationMapType; }); 11846 /* harmony import */ var _helper_text_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helper-text/foundation */ "./node_modules/@material/textfield/helper-text/foundation.js"); 11847 /* harmony import */ var _icon_foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./icon/foundation */ "./node_modules/@material/textfield/icon/foundation.js"); 11848 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11849 11850 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); } } 11851 11852 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 11853 11854 /** 11855 * @license 11856 * Copyright 2017 Google Inc. All Rights Reserved. 11857 * 11858 * Licensed under the Apache License, Version 2.0 (the "License"); 11859 * you may not use this file except in compliance with the License. 11860 * You may obtain a copy of the License at 11861 * 11862 * http://www.apache.org/licenses/LICENSE-2.0 11863 * 11864 * Unless required by applicable law or agreed to in writing, software 11865 * distributed under the License is distributed on an "AS IS" BASIS, 11866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11867 * See the License for the specific language governing permissions and 11868 * limitations under the License. 11869 */ 11870 11871 /* eslint-disable no-unused-vars */ 11872 11873 11874 /* eslint no-unused-vars: [2, {"args": "none"}] */ 11875 11876 /** 11877 * @typedef {{ 11878 * value: string, 11879 * disabled: boolean, 11880 * badInput: boolean, 11881 * validity: { 11882 * badInput: boolean, 11883 * valid: boolean, 11884 * }, 11885 * }} 11886 */ 11887 11888 var NativeInputType; 11889 /** 11890 * @typedef {{ 11891 * helperText: (!MDCTextFieldHelperTextFoundation|undefined), 11892 * icon: (!MDCTextFieldIconFoundation|undefined), 11893 * }} 11894 */ 11895 11896 var FoundationMapType; 11897 /** 11898 * Adapter for MDC Text Field. 11899 * 11900 * Defines the shape of the adapter expected by the foundation. Implement this 11901 * adapter to integrate the Text Field into your framework. See 11902 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 11903 * for more information. 11904 * 11905 * @record 11906 */ 11907 11908 var MDCTextFieldAdapter = 11909 /*#__PURE__*/ 11910 function () { 11911 function MDCTextFieldAdapter() { 11912 _classCallCheck(this, MDCTextFieldAdapter); 11913 } 11914 11915 _createClass(MDCTextFieldAdapter, [{ 11916 key: "addClass", 11917 11918 /** 11919 * Adds a class to the root Element. 11920 * @param {string} className 11921 */ 11922 value: function addClass(className) {} 11923 /** 11924 * Removes a class from the root Element. 11925 * @param {string} className 11926 */ 11927 11928 }, { 11929 key: "removeClass", 11930 value: function removeClass(className) {} 11931 /** 11932 * Returns true if the root element contains the given class name. 11933 * @param {string} className 11934 * @return {boolean} 11935 */ 11936 11937 }, { 11938 key: "hasClass", 11939 value: function hasClass(className) {} 11940 /** 11941 * Registers an event handler on the root element for a given event. 11942 * @param {string} type 11943 * @param {function(!Event): undefined} handler 11944 */ 11945 11946 }, { 11947 key: "registerTextFieldInteractionHandler", 11948 value: function registerTextFieldInteractionHandler(type, handler) {} 11949 /** 11950 * Deregisters an event handler on the root element for a given event. 11951 * @param {string} type 11952 * @param {function(!Event): undefined} handler 11953 */ 11954 11955 }, { 11956 key: "deregisterTextFieldInteractionHandler", 11957 value: function deregisterTextFieldInteractionHandler(type, handler) {} 11958 /** 11959 * Registers an event listener on the native input element for a given event. 11960 * @param {string} evtType 11961 * @param {function(!Event): undefined} handler 11962 */ 11963 11964 }, { 11965 key: "registerInputInteractionHandler", 11966 value: function registerInputInteractionHandler(evtType, handler) {} 11967 /** 11968 * Deregisters an event listener on the native input element for a given event. 11969 * @param {string} evtType 11970 * @param {function(!Event): undefined} handler 11971 */ 11972 11973 }, { 11974 key: "deregisterInputInteractionHandler", 11975 value: function deregisterInputInteractionHandler(evtType, handler) {} 11976 /** 11977 * Registers a validation attribute change listener on the input element. 11978 * Handler accepts list of attribute names. 11979 * @param {function(!Array<string>): undefined} handler 11980 * @return {!MutationObserver} 11981 */ 11982 11983 }, { 11984 key: "registerValidationAttributeChangeHandler", 11985 value: function registerValidationAttributeChangeHandler(handler) {} 11986 /** 11987 * Disconnects a validation attribute observer on the input element. 11988 * @param {!MutationObserver} observer 11989 */ 11990 11991 }, { 11992 key: "deregisterValidationAttributeChangeHandler", 11993 value: function deregisterValidationAttributeChangeHandler(observer) {} 11994 /** 11995 * Returns an object representing the native text input element, with a 11996 * similar API shape. The object returned should include the value, disabled 11997 * and badInput properties, as well as the checkValidity() function. We never 11998 * alter the value within our code, however we do update the disabled 11999 * property, so if you choose to duck-type the return value for this method 12000 * in your implementation it's important to keep this in mind. Also note that 12001 * this method can return null, which the foundation will handle gracefully. 12002 * @return {?Element|?NativeInputType} 12003 */ 12004 12005 }, { 12006 key: "getNativeInput", 12007 value: function getNativeInput() {} 12008 /** 12009 * Returns true if the textfield is focused. 12010 * We achieve this via `document.activeElement === this.root_`. 12011 * @return {boolean} 12012 */ 12013 12014 }, { 12015 key: "isFocused", 12016 value: function isFocused() {} 12017 /** 12018 * Returns true if the direction of the root element is set to RTL. 12019 * @return {boolean} 12020 */ 12021 12022 }, { 12023 key: "isRtl", 12024 value: function isRtl() {} 12025 /** 12026 * Activates the line ripple. 12027 */ 12028 12029 }, { 12030 key: "activateLineRipple", 12031 value: function activateLineRipple() {} 12032 /** 12033 * Deactivates the line ripple. 12034 */ 12035 12036 }, { 12037 key: "deactivateLineRipple", 12038 value: function deactivateLineRipple() {} 12039 /** 12040 * Sets the transform origin of the line ripple. 12041 * @param {number} normalizedX 12042 */ 12043 12044 }, { 12045 key: "setLineRippleTransformOrigin", 12046 value: function setLineRippleTransformOrigin(normalizedX) {} 12047 /** 12048 * Only implement if label exists. 12049 * Shakes label if shouldShake is true. 12050 * @param {boolean} shouldShake 12051 */ 12052 12053 }, { 12054 key: "shakeLabel", 12055 value: function shakeLabel(shouldShake) {} 12056 /** 12057 * Only implement if label exists. 12058 * Floats the label above the input element if shouldFloat is true. 12059 * @param {boolean} shouldFloat 12060 */ 12061 12062 }, { 12063 key: "floatLabel", 12064 value: function floatLabel(shouldFloat) {} 12065 /** 12066 * Returns true if label element exists, false if it doesn't. 12067 * @return {boolean} 12068 */ 12069 12070 }, { 12071 key: "hasLabel", 12072 value: function hasLabel() {} 12073 /** 12074 * Only implement if label exists. 12075 * Returns width of label in pixels. 12076 * @return {number} 12077 */ 12078 12079 }, { 12080 key: "getLabelWidth", 12081 value: function getLabelWidth() {} 12082 /** 12083 * Returns true if outline element exists, false if it doesn't. 12084 * @return {boolean} 12085 */ 12086 12087 }, { 12088 key: "hasOutline", 12089 value: function hasOutline() {} 12090 /** 12091 * Only implement if outline element exists. 12092 * Updates SVG Path and outline element based on the 12093 * label element width and RTL context. 12094 * @param {number} labelWidth 12095 * @param {boolean=} isRtl 12096 */ 12097 12098 }, { 12099 key: "notchOutline", 12100 value: function notchOutline(labelWidth, isRtl) {} 12101 /** 12102 * Only implement if outline element exists. 12103 * Closes notch in outline element. 12104 */ 12105 12106 }, { 12107 key: "closeOutline", 12108 value: function closeOutline() {} 12109 }]); 12110 12111 return MDCTextFieldAdapter; 12112 }(); 12113 12114 12115 12116 /***/ }), 12117 12118 /***/ "./node_modules/@material/textfield/constants.js": 12119 /*!*******************************************************!*\ 12120 !*** ./node_modules/@material/textfield/constants.js ***! 12121 \*******************************************************/ 12122 /*! exports provided: cssClasses, strings, numbers, VALIDATION_ATTR_WHITELIST */ 12123 /***/ (function(module, __webpack_exports__, __webpack_require__) { 12124 12125 "use strict"; 12126 __webpack_require__.r(__webpack_exports__); 12127 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 12128 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 12129 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numbers", function() { return numbers; }); 12130 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VALIDATION_ATTR_WHITELIST", function() { return VALIDATION_ATTR_WHITELIST; }); 12131 /** 12132 * @license 12133 * Copyright 2016 Google Inc. All Rights Reserved. 12134 * 12135 * Licensed under the Apache License, Version 2.0 (the "License"); 12136 * you may not use this file except in compliance with the License. 12137 * You may obtain a copy of the License at 12138 * 12139 * http://www.apache.org/licenses/LICENSE-2.0 12140 * 12141 * Unless required by applicable law or agreed to in writing, software 12142 * distributed under the License is distributed on an "AS IS" BASIS, 12143 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12144 * See the License for the specific language governing permissions and 12145 * limitations under the License. 12146 */ 12147 12148 /** @enum {string} */ 12149 var strings = { 12150 ARIA_CONTROLS: 'aria-controls', 12151 INPUT_SELECTOR: '.mdc-text-field__input', 12152 LABEL_SELECTOR: '.mdc-floating-label', 12153 ICON_SELECTOR: '.mdc-text-field__icon', 12154 OUTLINE_SELECTOR: '.mdc-notched-outline', 12155 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple' 12156 }; 12157 /** @enum {string} */ 12158 12159 var cssClasses = { 12160 ROOT: 'mdc-text-field', 12161 UPGRADED: 'mdc-text-field--upgraded', 12162 DISABLED: 'mdc-text-field--disabled', 12163 DENSE: 'mdc-text-field--dense', 12164 FOCUSED: 'mdc-text-field--focused', 12165 INVALID: 'mdc-text-field--invalid', 12166 BOX: 'mdc-text-field--box', 12167 OUTLINED: 'mdc-text-field--outlined' 12168 }; 12169 /** @enum {number} */ 12170 12171 var numbers = { 12172 LABEL_SCALE: 0.75, 12173 DENSE_LABEL_SCALE: 0.923 12174 }; // whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation 12175 // under section: `Validation-related attributes` 12176 12177 var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength']; 12178 12179 12180 /***/ }), 12181 12182 /***/ "./node_modules/@material/textfield/foundation.js": 12183 /*!********************************************************!*\ 12184 !*** ./node_modules/@material/textfield/foundation.js ***! 12185 \********************************************************/ 12186 /*! exports provided: default */ 12187 /***/ (function(module, __webpack_exports__, __webpack_require__) { 12188 12189 "use strict"; 12190 __webpack_require__.r(__webpack_exports__); 12191 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 12192 /* harmony import */ var _helper_text_foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helper-text/foundation */ "./node_modules/@material/textfield/helper-text/foundation.js"); 12193 /* harmony import */ var _icon_foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./icon/foundation */ "./node_modules/@material/textfield/icon/foundation.js"); 12194 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/adapter.js"); 12195 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/constants.js"); 12196 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 12197 12198 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12199 12200 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 12201 12202 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 12203 12204 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 12205 12206 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); } } 12207 12208 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 12209 12210 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 12211 12212 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 12213 12214 /** 12215 * @license 12216 * Copyright 2016 Google Inc. All Rights Reserved. 12217 * 12218 * Licensed under the Apache License, Version 2.0 (the "License"); 12219 * you may not use this file except in compliance with the License. 12220 * You may obtain a copy of the License at 12221 * 12222 * http://www.apache.org/licenses/LICENSE-2.0 12223 * 12224 * Unless required by applicable law or agreed to in writing, software 12225 * distributed under the License is distributed on an "AS IS" BASIS, 12226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12227 * See the License for the specific language governing permissions and 12228 * limitations under the License. 12229 */ 12230 12231 /* eslint-disable no-unused-vars */ 12232 12233 12234 12235 /* eslint-enable no-unused-vars */ 12236 12237 12238 12239 /** 12240 * @extends {MDCFoundation<!MDCTextFieldAdapter>} 12241 * @final 12242 */ 12243 12244 var MDCTextFieldFoundation = 12245 /*#__PURE__*/ 12246 function (_MDCFoundation) { 12247 _inherits(MDCTextFieldFoundation, _MDCFoundation); 12248 12249 _createClass(MDCTextFieldFoundation, [{ 12250 key: "shouldShake", 12251 12252 /** @return {boolean} */ 12253 get: function get() { 12254 return !this.isValid() && !this.isFocused_; 12255 } 12256 /** @return {boolean} */ 12257 12258 }, { 12259 key: "shouldFloat", 12260 get: function get() { 12261 return this.isFocused_ || !!this.getValue() || this.isBadInput_(); 12262 } 12263 /** 12264 * {@see MDCTextFieldAdapter} for typing information on parameters and return 12265 * types. 12266 * @return {!MDCTextFieldAdapter} 12267 */ 12268 12269 }], [{ 12270 key: "cssClasses", 12271 12272 /** @return enum {string} */ 12273 get: function get() { 12274 return _constants__WEBPACK_IMPORTED_MODULE_4__["cssClasses"]; 12275 } 12276 /** @return enum {string} */ 12277 12278 }, { 12279 key: "strings", 12280 get: function get() { 12281 return _constants__WEBPACK_IMPORTED_MODULE_4__["strings"]; 12282 } 12283 /** @return enum {string} */ 12284 12285 }, { 12286 key: "numbers", 12287 get: function get() { 12288 return _constants__WEBPACK_IMPORTED_MODULE_4__["numbers"]; 12289 } 12290 }, { 12291 key: "defaultAdapter", 12292 get: function get() { 12293 return ( 12294 /** @type {!MDCTextFieldAdapter} */ 12295 { 12296 addClass: function addClass() {}, 12297 removeClass: function removeClass() {}, 12298 hasClass: function hasClass() {}, 12299 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {}, 12300 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {}, 12301 registerInputInteractionHandler: function registerInputInteractionHandler() {}, 12302 deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {}, 12303 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {}, 12304 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {}, 12305 getNativeInput: function getNativeInput() {}, 12306 isFocused: function isFocused() {}, 12307 isRtl: function isRtl() {}, 12308 activateLineRipple: function activateLineRipple() {}, 12309 deactivateLineRipple: function deactivateLineRipple() {}, 12310 setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {}, 12311 shakeLabel: function shakeLabel() {}, 12312 floatLabel: function floatLabel() {}, 12313 hasLabel: function hasLabel() {}, 12314 getLabelWidth: function getLabelWidth() {}, 12315 hasOutline: function hasOutline() {}, 12316 notchOutline: function notchOutline() {}, 12317 closeOutline: function closeOutline() {} 12318 } 12319 ); 12320 } 12321 /** 12322 * @param {!MDCTextFieldAdapter} adapter 12323 * @param {!FoundationMapType=} foundationMap Map from subcomponent names to their subfoundations. 12324 */ 12325 12326 }]); 12327 12328 function MDCTextFieldFoundation(adapter) { 12329 var _this; 12330 12331 var foundationMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12332 /** @type {!FoundationMapType} */ 12333 {}; 12334 12335 _classCallCheck(this, MDCTextFieldFoundation); 12336 12337 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCTextFieldFoundation).call(this, Object.assign(MDCTextFieldFoundation.defaultAdapter, adapter))); 12338 /** @type {!MDCTextFieldHelperTextFoundation|undefined} */ 12339 12340 _this.helperText_ = foundationMap.helperText; 12341 /** @type {!MDCTextFieldIconFoundation|undefined} */ 12342 12343 _this.icon_ = foundationMap.icon; 12344 /** @private {boolean} */ 12345 12346 _this.isFocused_ = false; 12347 /** @private {boolean} */ 12348 12349 _this.receivedUserInput_ = false; 12350 /** @private {boolean} */ 12351 12352 _this.useCustomValidityChecking_ = false; 12353 /** @private {boolean} */ 12354 12355 _this.isValid_ = true; 12356 /** @private {function(): undefined} */ 12357 12358 _this.inputFocusHandler_ = function () { 12359 return _this.activateFocus(); 12360 }; 12361 /** @private {function(): undefined} */ 12362 12363 12364 _this.inputBlurHandler_ = function () { 12365 return _this.deactivateFocus(); 12366 }; 12367 /** @private {function(): undefined} */ 12368 12369 12370 _this.inputInputHandler_ = function () { 12371 return _this.autoCompleteFocus(); 12372 }; 12373 /** @private {function(!Event): undefined} */ 12374 12375 12376 _this.setPointerXOffset_ = function (evt) { 12377 return _this.setTransformOrigin(evt); 12378 }; 12379 /** @private {function(!Event): undefined} */ 12380 12381 12382 _this.textFieldInteractionHandler_ = function () { 12383 return _this.handleTextFieldInteraction(); 12384 }; 12385 /** @private {function(!Array): undefined} */ 12386 12387 12388 _this.validationAttributeChangeHandler_ = function (attributesList) { 12389 return _this.handleValidationAttributeChange(attributesList); 12390 }; 12391 /** @private {!MutationObserver} */ 12392 12393 12394 _this.validationObserver_; 12395 return _this; 12396 } 12397 12398 _createClass(MDCTextFieldFoundation, [{ 12399 key: "init", 12400 value: function init() { 12401 var _this2 = this; 12402 12403 this.adapter_.addClass(MDCTextFieldFoundation.cssClasses.UPGRADED); // Ensure label does not collide with any pre-filled value. 12404 12405 if (this.adapter_.hasLabel() && (this.getValue() || this.isBadInput_())) { 12406 this.adapter_.floatLabel(this.shouldFloat); 12407 this.notchOutline(this.shouldFloat); 12408 } 12409 12410 if (this.adapter_.isFocused()) { 12411 this.inputFocusHandler_(); 12412 } 12413 12414 this.adapter_.registerInputInteractionHandler('focus', this.inputFocusHandler_); 12415 this.adapter_.registerInputInteractionHandler('blur', this.inputBlurHandler_); 12416 this.adapter_.registerInputInteractionHandler('input', this.inputInputHandler_); 12417 ['mousedown', 'touchstart'].forEach(function (evtType) { 12418 _this2.adapter_.registerInputInteractionHandler(evtType, _this2.setPointerXOffset_); 12419 }); 12420 ['click', 'keydown'].forEach(function (evtType) { 12421 _this2.adapter_.registerTextFieldInteractionHandler(evtType, _this2.textFieldInteractionHandler_); 12422 }); 12423 this.validationObserver_ = this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_); 12424 } 12425 }, { 12426 key: "destroy", 12427 value: function destroy() { 12428 var _this3 = this; 12429 12430 this.adapter_.removeClass(MDCTextFieldFoundation.cssClasses.UPGRADED); 12431 this.adapter_.deregisterInputInteractionHandler('focus', this.inputFocusHandler_); 12432 this.adapter_.deregisterInputInteractionHandler('blur', this.inputBlurHandler_); 12433 this.adapter_.deregisterInputInteractionHandler('input', this.inputInputHandler_); 12434 ['mousedown', 'touchstart'].forEach(function (evtType) { 12435 _this3.adapter_.deregisterInputInteractionHandler(evtType, _this3.setPointerXOffset_); 12436 }); 12437 ['click', 'keydown'].forEach(function (evtType) { 12438 _this3.adapter_.deregisterTextFieldInteractionHandler(evtType, _this3.textFieldInteractionHandler_); 12439 }); 12440 this.adapter_.deregisterValidationAttributeChangeHandler(this.validationObserver_); 12441 } 12442 /** 12443 * Handles user interactions with the Text Field. 12444 */ 12445 12446 }, { 12447 key: "handleTextFieldInteraction", 12448 value: function handleTextFieldInteraction() { 12449 if (this.adapter_.getNativeInput().disabled) { 12450 return; 12451 } 12452 12453 this.receivedUserInput_ = true; 12454 } 12455 /** 12456 * Handles validation attribute changes 12457 * @param {!Array<string>} attributesList 12458 */ 12459 12460 }, { 12461 key: "handleValidationAttributeChange", 12462 value: function handleValidationAttributeChange(attributesList) { 12463 var _this4 = this; 12464 12465 attributesList.some(function (attributeName) { 12466 if (_constants__WEBPACK_IMPORTED_MODULE_4__["VALIDATION_ATTR_WHITELIST"].indexOf(attributeName) > -1) { 12467 _this4.styleValidity_(true); 12468 12469 return true; 12470 } 12471 }); 12472 } 12473 /** 12474 * Opens/closes the notched outline. 12475 * @param {boolean} openNotch 12476 */ 12477 12478 }, { 12479 key: "notchOutline", 12480 value: function notchOutline(openNotch) { 12481 if (!this.adapter_.hasOutline() || !this.adapter_.hasLabel()) { 12482 return; 12483 } 12484 12485 if (openNotch) { 12486 var isDense = this.adapter_.hasClass(_constants__WEBPACK_IMPORTED_MODULE_4__["cssClasses"].DENSE); 12487 var labelScale = isDense ? _constants__WEBPACK_IMPORTED_MODULE_4__["numbers"].DENSE_LABEL_SCALE : _constants__WEBPACK_IMPORTED_MODULE_4__["numbers"].LABEL_SCALE; 12488 var labelWidth = this.adapter_.getLabelWidth() * labelScale; 12489 var isRtl = this.adapter_.isRtl(); 12490 this.adapter_.notchOutline(labelWidth, isRtl); 12491 } else { 12492 this.adapter_.closeOutline(); 12493 } 12494 } 12495 /** 12496 * Activates the text field focus state. 12497 */ 12498 12499 }, { 12500 key: "activateFocus", 12501 value: function activateFocus() { 12502 this.isFocused_ = true; 12503 this.styleFocused_(this.isFocused_); 12504 this.adapter_.activateLineRipple(); 12505 this.notchOutline(this.shouldFloat); 12506 12507 if (this.adapter_.hasLabel()) { 12508 this.adapter_.shakeLabel(this.shouldShake); 12509 this.adapter_.floatLabel(this.shouldFloat); 12510 } 12511 12512 if (this.helperText_) { 12513 this.helperText_.showToScreenReader(); 12514 } 12515 } 12516 /** 12517 * Sets the line ripple's transform origin, so that the line ripple activate 12518 * animation will animate out from the user's click location. 12519 * @param {!Event} evt 12520 */ 12521 12522 }, { 12523 key: "setTransformOrigin", 12524 value: function setTransformOrigin(evt) { 12525 var targetClientRect = evt.target.getBoundingClientRect(); 12526 var evtCoords = { 12527 x: evt.clientX, 12528 y: evt.clientY 12529 }; 12530 var normalizedX = evtCoords.x - targetClientRect.left; 12531 this.adapter_.setLineRippleTransformOrigin(normalizedX); 12532 } 12533 /** 12534 * Activates the Text Field's focus state in cases when the input value 12535 * changes without user input (e.g. programatically). 12536 */ 12537 12538 }, { 12539 key: "autoCompleteFocus", 12540 value: function autoCompleteFocus() { 12541 if (!this.receivedUserInput_) { 12542 this.activateFocus(); 12543 } 12544 } 12545 /** 12546 * Deactivates the Text Field's focus state. 12547 */ 12548 12549 }, { 12550 key: "deactivateFocus", 12551 value: function deactivateFocus() { 12552 this.isFocused_ = false; 12553 this.adapter_.deactivateLineRipple(); 12554 var input = this.getNativeInput_(); 12555 var shouldRemoveLabelFloat = !input.value && !this.isBadInput_(); 12556 var isValid = this.isValid(); 12557 this.styleValidity_(isValid); 12558 this.styleFocused_(this.isFocused_); 12559 12560 if (this.adapter_.hasLabel()) { 12561 this.adapter_.shakeLabel(this.shouldShake); 12562 this.adapter_.floatLabel(this.shouldFloat); 12563 this.notchOutline(this.shouldFloat); 12564 } 12565 12566 if (shouldRemoveLabelFloat) { 12567 this.receivedUserInput_ = false; 12568 } 12569 } 12570 /** 12571 * @return {string} The value of the input Element. 12572 */ 12573 12574 }, { 12575 key: "getValue", 12576 value: function getValue() { 12577 return this.getNativeInput_().value; 12578 } 12579 /** 12580 * @param {string} value The value to set on the input Element. 12581 */ 12582 12583 }, { 12584 key: "setValue", 12585 value: function setValue(value) { 12586 this.getNativeInput_().value = value; 12587 var isValid = this.isValid(); 12588 this.styleValidity_(isValid); 12589 12590 if (this.adapter_.hasLabel()) { 12591 this.adapter_.shakeLabel(this.shouldShake); 12592 this.adapter_.floatLabel(this.shouldFloat); 12593 this.notchOutline(this.shouldFloat); 12594 } 12595 } 12596 /** 12597 * @return {boolean} If a custom validity is set, returns that value. 12598 * Otherwise, returns the result of native validity checks. 12599 */ 12600 12601 }, { 12602 key: "isValid", 12603 value: function isValid() { 12604 return this.useCustomValidityChecking_ ? this.isValid_ : this.isNativeInputValid_(); 12605 } 12606 /** 12607 * @param {boolean} isValid Sets the validity state of the Text Field. 12608 */ 12609 12610 }, { 12611 key: "setValid", 12612 value: function setValid(isValid) { 12613 this.useCustomValidityChecking_ = true; 12614 this.isValid_ = isValid; // Retrieve from the getter to ensure correct logic is applied. 12615 12616 isValid = this.isValid(); 12617 this.styleValidity_(isValid); 12618 12619 if (this.adapter_.hasLabel()) { 12620 this.adapter_.shakeLabel(this.shouldShake); 12621 } 12622 } 12623 /** 12624 * @return {boolean} True if the Text Field is disabled. 12625 */ 12626 12627 }, { 12628 key: "isDisabled", 12629 value: function isDisabled() { 12630 return this.getNativeInput_().disabled; 12631 } 12632 /** 12633 * @param {boolean} disabled Sets the text-field disabled or enabled. 12634 */ 12635 12636 }, { 12637 key: "setDisabled", 12638 value: function setDisabled(disabled) { 12639 this.getNativeInput_().disabled = disabled; 12640 this.styleDisabled_(disabled); 12641 } 12642 /** 12643 * @param {string} content Sets the content of the helper text. 12644 */ 12645 12646 }, { 12647 key: "setHelperTextContent", 12648 value: function setHelperTextContent(content) { 12649 if (this.helperText_) { 12650 this.helperText_.setContent(content); 12651 } 12652 } 12653 /** 12654 * Sets the aria label of the icon. 12655 * @param {string} label 12656 */ 12657 12658 }, { 12659 key: "setIconAriaLabel", 12660 value: function setIconAriaLabel(label) { 12661 if (this.icon_) { 12662 this.icon_.setAriaLabel(label); 12663 } 12664 } 12665 /** 12666 * Sets the text content of the icon. 12667 * @param {string} content 12668 */ 12669 12670 }, { 12671 key: "setIconContent", 12672 value: function setIconContent(content) { 12673 if (this.icon_) { 12674 this.icon_.setContent(content); 12675 } 12676 } 12677 /** 12678 * @return {boolean} True if the Text Field input fails in converting the 12679 * user-supplied value. 12680 * @private 12681 */ 12682 12683 }, { 12684 key: "isBadInput_", 12685 value: function isBadInput_() { 12686 return this.getNativeInput_().validity.badInput; 12687 } 12688 /** 12689 * @return {boolean} The result of native validity checking 12690 * (ValidityState.valid). 12691 */ 12692 12693 }, { 12694 key: "isNativeInputValid_", 12695 value: function isNativeInputValid_() { 12696 return this.getNativeInput_().validity.valid; 12697 } 12698 /** 12699 * Styles the component based on the validity state. 12700 * @param {boolean} isValid 12701 * @private 12702 */ 12703 12704 }, { 12705 key: "styleValidity_", 12706 value: function styleValidity_(isValid) { 12707 var INVALID = MDCTextFieldFoundation.cssClasses.INVALID; 12708 12709 if (isValid) { 12710 this.adapter_.removeClass(INVALID); 12711 } else { 12712 this.adapter_.addClass(INVALID); 12713 } 12714 12715 if (this.helperText_) { 12716 this.helperText_.setValidity(isValid); 12717 } 12718 } 12719 /** 12720 * Styles the component based on the focused state. 12721 * @param {boolean} isFocused 12722 * @private 12723 */ 12724 12725 }, { 12726 key: "styleFocused_", 12727 value: function styleFocused_(isFocused) { 12728 var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED; 12729 12730 if (isFocused) { 12731 this.adapter_.addClass(FOCUSED); 12732 } else { 12733 this.adapter_.removeClass(FOCUSED); 12734 } 12735 } 12736 /** 12737 * Styles the component based on the disabled state. 12738 * @param {boolean} isDisabled 12739 * @private 12740 */ 12741 12742 }, { 12743 key: "styleDisabled_", 12744 value: function styleDisabled_(isDisabled) { 12745 var _MDCTextFieldFoundati = MDCTextFieldFoundation.cssClasses, 12746 DISABLED = _MDCTextFieldFoundati.DISABLED, 12747 INVALID = _MDCTextFieldFoundati.INVALID; 12748 12749 if (isDisabled) { 12750 this.adapter_.addClass(DISABLED); 12751 this.adapter_.removeClass(INVALID); 12752 } else { 12753 this.adapter_.removeClass(DISABLED); 12754 } 12755 12756 if (this.icon_) { 12757 this.icon_.setDisabled(isDisabled); 12758 } 12759 } 12760 /** 12761 * @return {!Element|!NativeInputType} The native text input from the 12762 * host environment, or a dummy if none exists. 12763 * @private 12764 */ 12765 12766 }, { 12767 key: "getNativeInput_", 12768 value: function getNativeInput_() { 12769 return this.adapter_.getNativeInput() || 12770 /** @type {!NativeInputType} */ 12771 { 12772 value: '', 12773 disabled: false, 12774 validity: { 12775 badInput: false, 12776 valid: true 12777 } 12778 }; 12779 } 12780 }]); 12781 12782 return MDCTextFieldFoundation; 12783 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 12784 12785 /* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldFoundation); 12786 12787 /***/ }), 12788 12789 /***/ "./node_modules/@material/textfield/helper-text/adapter.js": 12790 /*!*****************************************************************!*\ 12791 !*** ./node_modules/@material/textfield/helper-text/adapter.js ***! 12792 \*****************************************************************/ 12793 /*! exports provided: default */ 12794 /***/ (function(module, __webpack_exports__, __webpack_require__) { 12795 12796 "use strict"; 12797 __webpack_require__.r(__webpack_exports__); 12798 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12799 12800 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); } } 12801 12802 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 12803 12804 /** 12805 * @license 12806 * Copyright 2017 Google Inc. All Rights Reserved. 12807 * 12808 * Licensed under the Apache License, Version 2.0 (the "License"); 12809 * you may not use this file except in compliance with the License. 12810 * You may obtain a copy of the License at 12811 * 12812 * http://www.apache.org/licenses/LICENSE-2.0 12813 * 12814 * Unless required by applicable law or agreed to in writing, software 12815 * distributed under the License is distributed on an "AS IS" BASIS, 12816 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12817 * See the License for the specific language governing permissions and 12818 * limitations under the License. 12819 */ 12820 12821 /* eslint no-unused-vars: [2, {"args": "none"}] */ 12822 12823 /** 12824 * Adapter for MDC Text Field Helper Text. 12825 * 12826 * Defines the shape of the adapter expected by the foundation. Implement this 12827 * adapter to integrate the TextField helper text into your framework. See 12828 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 12829 * for more information. 12830 * 12831 * @record 12832 */ 12833 var MDCTextFieldHelperTextAdapter = 12834 /*#__PURE__*/ 12835 function () { 12836 function MDCTextFieldHelperTextAdapter() { 12837 _classCallCheck(this, MDCTextFieldHelperTextAdapter); 12838 } 12839 12840 _createClass(MDCTextFieldHelperTextAdapter, [{ 12841 key: "addClass", 12842 12843 /** 12844 * Adds a class to the helper text element. 12845 * @param {string} className 12846 */ 12847 value: function addClass(className) {} 12848 /** 12849 * Removes a class from the helper text element. 12850 * @param {string} className 12851 */ 12852 12853 }, { 12854 key: "removeClass", 12855 value: function removeClass(className) {} 12856 /** 12857 * Returns whether or not the helper text element contains the given class. 12858 * @param {string} className 12859 * @return {boolean} 12860 */ 12861 12862 }, { 12863 key: "hasClass", 12864 value: function hasClass(className) {} 12865 /** 12866 * Sets an attribute with a given value on the helper text element. 12867 * @param {string} attr 12868 * @param {string} value 12869 */ 12870 12871 }, { 12872 key: "setAttr", 12873 value: function setAttr(attr, value) {} 12874 /** 12875 * Removes an attribute from the helper text element. 12876 * @param {string} attr 12877 */ 12878 12879 }, { 12880 key: "removeAttr", 12881 value: function removeAttr(attr) {} 12882 /** 12883 * Sets the text content for the helper text element. 12884 * @param {string} content 12885 */ 12886 12887 }, { 12888 key: "setContent", 12889 value: function setContent(content) {} 12890 }]); 12891 12892 return MDCTextFieldHelperTextAdapter; 12893 }(); 12894 12895 /* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldHelperTextAdapter); 12896 12897 /***/ }), 12898 12899 /***/ "./node_modules/@material/textfield/helper-text/constants.js": 12900 /*!*******************************************************************!*\ 12901 !*** ./node_modules/@material/textfield/helper-text/constants.js ***! 12902 \*******************************************************************/ 12903 /*! exports provided: strings, cssClasses */ 12904 /***/ (function(module, __webpack_exports__, __webpack_require__) { 12905 12906 "use strict"; 12907 __webpack_require__.r(__webpack_exports__); 12908 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 12909 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; }); 12910 /** 12911 * @license 12912 * Copyright 2016 Google Inc. All Rights Reserved. 12913 * 12914 * Licensed under the Apache License, Version 2.0 (the "License"); 12915 * you may not use this file except in compliance with the License. 12916 * You may obtain a copy of the License at 12917 * 12918 * http://www.apache.org/licenses/LICENSE-2.0 12919 * 12920 * Unless required by applicable law or agreed to in writing, software 12921 * distributed under the License is distributed on an "AS IS" BASIS, 12922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12923 * See the License for the specific language governing permissions and 12924 * limitations under the License. 12925 */ 12926 12927 /** @enum {string} */ 12928 var strings = { 12929 ARIA_HIDDEN: 'aria-hidden', 12930 ROLE: 'role' 12931 }; 12932 /** @enum {string} */ 12933 12934 var cssClasses = { 12935 HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent', 12936 HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg' 12937 }; 12938 12939 12940 /***/ }), 12941 12942 /***/ "./node_modules/@material/textfield/helper-text/foundation.js": 12943 /*!********************************************************************!*\ 12944 !*** ./node_modules/@material/textfield/helper-text/foundation.js ***! 12945 \********************************************************************/ 12946 /*! exports provided: default */ 12947 /***/ (function(module, __webpack_exports__, __webpack_require__) { 12948 12949 "use strict"; 12950 __webpack_require__.r(__webpack_exports__); 12951 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 12952 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/helper-text/adapter.js"); 12953 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/helper-text/constants.js"); 12954 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 12955 12956 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12957 12958 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 12959 12960 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 12961 12962 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 12963 12964 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); } } 12965 12966 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 12967 12968 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 12969 12970 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 12971 12972 /** 12973 * @license 12974 * Copyright 2017 Google Inc. All Rights Reserved. 12975 * 12976 * Licensed under the Apache License, Version 2.0 (the "License"); 12977 * you may not use this file except in compliance with the License. 12978 * You may obtain a copy of the License at 12979 * 12980 * http://www.apache.org/licenses/LICENSE-2.0 12981 * 12982 * Unless required by applicable law or agreed to in writing, software 12983 * distributed under the License is distributed on an "AS IS" BASIS, 12984 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12985 * See the License for the specific language governing permissions and 12986 * limitations under the License. 12987 */ 12988 12989 12990 12991 /** 12992 * @extends {MDCFoundation<!MDCTextFieldHelperTextAdapter>} 12993 * @final 12994 */ 12995 12996 var MDCTextFieldHelperTextFoundation = 12997 /*#__PURE__*/ 12998 function (_MDCFoundation) { 12999 _inherits(MDCTextFieldHelperTextFoundation, _MDCFoundation); 13000 13001 _createClass(MDCTextFieldHelperTextFoundation, null, [{ 13002 key: "cssClasses", 13003 13004 /** @return enum {string} */ 13005 get: function get() { 13006 return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"]; 13007 } 13008 /** @return enum {string} */ 13009 13010 }, { 13011 key: "strings", 13012 get: function get() { 13013 return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"]; 13014 } 13015 /** 13016 * {@see MDCTextFieldHelperTextAdapter} for typing information on parameters and return 13017 * types. 13018 * @return {!MDCTextFieldHelperTextAdapter} 13019 */ 13020 13021 }, { 13022 key: "defaultAdapter", 13023 get: function get() { 13024 return ( 13025 /** @type {!MDCTextFieldHelperTextAdapter} */ 13026 { 13027 addClass: function addClass() {}, 13028 removeClass: function removeClass() {}, 13029 hasClass: function hasClass() {}, 13030 setAttr: function setAttr() {}, 13031 removeAttr: function removeAttr() {}, 13032 setContent: function setContent() {} 13033 } 13034 ); 13035 } 13036 /** 13037 * @param {!MDCTextFieldHelperTextAdapter} adapter 13038 */ 13039 13040 }]); 13041 13042 function MDCTextFieldHelperTextFoundation(adapter) { 13043 _classCallCheck(this, MDCTextFieldHelperTextFoundation); 13044 13045 return _possibleConstructorReturn(this, _getPrototypeOf(MDCTextFieldHelperTextFoundation).call(this, Object.assign(MDCTextFieldHelperTextFoundation.defaultAdapter, adapter))); 13046 } 13047 /** 13048 * Sets the content of the helper text field. 13049 * @param {string} content 13050 */ 13051 13052 13053 _createClass(MDCTextFieldHelperTextFoundation, [{ 13054 key: "setContent", 13055 value: function setContent(content) { 13056 this.adapter_.setContent(content); 13057 } 13058 /** @param {boolean} isPersistent Sets the persistency of the helper text. */ 13059 13060 }, { 13061 key: "setPersistent", 13062 value: function setPersistent(isPersistent) { 13063 if (isPersistent) { 13064 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_PERSISTENT); 13065 } else { 13066 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_PERSISTENT); 13067 } 13068 } 13069 /** 13070 * @param {boolean} isValidation True to make the helper text act as an 13071 * error validation message. 13072 */ 13073 13074 }, { 13075 key: "setValidation", 13076 value: function setValidation(isValidation) { 13077 if (isValidation) { 13078 this.adapter_.addClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_VALIDATION_MSG); 13079 } else { 13080 this.adapter_.removeClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_VALIDATION_MSG); 13081 } 13082 } 13083 /** Makes the helper text visible to the screen reader. */ 13084 13085 }, { 13086 key: "showToScreenReader", 13087 value: function showToScreenReader() { 13088 this.adapter_.removeAttr(_constants__WEBPACK_IMPORTED_MODULE_2__["strings"].ARIA_HIDDEN); 13089 } 13090 /** 13091 * Sets the validity of the helper text based on the input validity. 13092 * @param {boolean} inputIsValid 13093 */ 13094 13095 }, { 13096 key: "setValidity", 13097 value: function setValidity(inputIsValid) { 13098 var helperTextIsPersistent = this.adapter_.hasClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_PERSISTENT); 13099 var helperTextIsValidationMsg = this.adapter_.hasClass(_constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"].HELPER_TEXT_VALIDATION_MSG); 13100 var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid; 13101 13102 if (validationMsgNeedsDisplay) { 13103 this.adapter_.setAttr(_constants__WEBPACK_IMPORTED_MODULE_2__["strings"].ROLE, 'alert'); 13104 } else { 13105 this.adapter_.removeAttr(_constants__WEBPACK_IMPORTED_MODULE_2__["strings"].ROLE); 13106 } 13107 13108 if (!helperTextIsPersistent && !validationMsgNeedsDisplay) { 13109 this.hide_(); 13110 } 13111 } 13112 /** 13113 * Hides the help text from screen readers. 13114 * @private 13115 */ 13116 13117 }, { 13118 key: "hide_", 13119 value: function hide_() { 13120 this.adapter_.setAttr(_constants__WEBPACK_IMPORTED_MODULE_2__["strings"].ARIA_HIDDEN, 'true'); 13121 } 13122 }]); 13123 13124 return MDCTextFieldHelperTextFoundation; 13125 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 13126 13127 /* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldHelperTextFoundation); 13128 13129 /***/ }), 13130 13131 /***/ "./node_modules/@material/textfield/helper-text/index.js": 13132 /*!***************************************************************!*\ 13133 !*** ./node_modules/@material/textfield/helper-text/index.js ***! 13134 \***************************************************************/ 13135 /*! exports provided: MDCTextFieldHelperText, MDCTextFieldHelperTextFoundation */ 13136 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13137 13138 "use strict"; 13139 __webpack_require__.r(__webpack_exports__); 13140 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldHelperText", function() { return MDCTextFieldHelperText; }); 13141 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 13142 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/helper-text/adapter.js"); 13143 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/helper-text/foundation.js"); 13144 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldHelperTextFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 13145 13146 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 13147 13148 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13149 13150 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); } } 13151 13152 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13153 13154 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 13155 13156 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 13157 13158 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 13159 13160 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 13161 13162 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 13163 13164 /** 13165 * @license 13166 * Copyright 2017 Google Inc. All Rights Reserved. 13167 * 13168 * Licensed under the Apache License, Version 2.0 (the "License"); 13169 * you may not use this file except in compliance with the License. 13170 * You may obtain a copy of the License at 13171 * 13172 * http://www.apache.org/licenses/LICENSE-2.0 13173 * 13174 * Unless required by applicable law or agreed to in writing, software 13175 * distributed under the License is distributed on an "AS IS" BASIS, 13176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13177 * See the License for the specific language governing permissions and 13178 * limitations under the License. 13179 */ 13180 13181 13182 13183 /** 13184 * @extends {MDCComponent<!MDCTextFieldHelperTextFoundation>} 13185 * @final 13186 */ 13187 13188 var MDCTextFieldHelperText = 13189 /*#__PURE__*/ 13190 function (_MDCComponent) { 13191 _inherits(MDCTextFieldHelperText, _MDCComponent); 13192 13193 function MDCTextFieldHelperText() { 13194 _classCallCheck(this, MDCTextFieldHelperText); 13195 13196 return _possibleConstructorReturn(this, _getPrototypeOf(MDCTextFieldHelperText).apply(this, arguments)); 13197 } 13198 13199 _createClass(MDCTextFieldHelperText, [{ 13200 key: "getDefaultFoundation", 13201 13202 /** 13203 * @return {!MDCTextFieldHelperTextFoundation} 13204 */ 13205 value: function getDefaultFoundation() { 13206 var _this = this; 13207 13208 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]( 13209 /** @type {!MDCTextFieldHelperTextAdapter} */ 13210 Object.assign({ 13211 addClass: function addClass(className) { 13212 return _this.root_.classList.add(className); 13213 }, 13214 removeClass: function removeClass(className) { 13215 return _this.root_.classList.remove(className); 13216 }, 13217 hasClass: function hasClass(className) { 13218 return _this.root_.classList.contains(className); 13219 }, 13220 setAttr: function setAttr(attr, value) { 13221 return _this.root_.setAttribute(attr, value); 13222 }, 13223 removeAttr: function removeAttr(attr) { 13224 return _this.root_.removeAttribute(attr); 13225 }, 13226 setContent: function setContent(content) { 13227 _this.root_.textContent = content; 13228 } 13229 })); 13230 } 13231 }, { 13232 key: "foundation", 13233 13234 /** 13235 * @return {!MDCTextFieldHelperTextFoundation} 13236 */ 13237 get: function get() { 13238 return this.foundation_; 13239 } 13240 }], [{ 13241 key: "attachTo", 13242 13243 /** 13244 * @param {!Element} root 13245 * @return {!MDCTextFieldHelperText} 13246 */ 13247 value: function attachTo(root) { 13248 return new MDCTextFieldHelperText(root); 13249 } 13250 }]); 13251 13252 return MDCTextFieldHelperText; 13253 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 13254 13255 13256 13257 /***/ }), 13258 13259 /***/ "./node_modules/@material/textfield/icon/adapter.js": 13260 /*!**********************************************************!*\ 13261 !*** ./node_modules/@material/textfield/icon/adapter.js ***! 13262 \**********************************************************/ 13263 /*! exports provided: default */ 13264 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13265 13266 "use strict"; 13267 __webpack_require__.r(__webpack_exports__); 13268 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13269 13270 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); } } 13271 13272 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13273 13274 /** 13275 * @license 13276 * Copyright 2017 Google Inc. All Rights Reserved. 13277 * 13278 * Licensed under the Apache License, Version 2.0 (the "License"); 13279 * you may not use this file except in compliance with the License. 13280 * You may obtain a copy of the License at 13281 * 13282 * http://www.apache.org/licenses/LICENSE-2.0 13283 * 13284 * Unless required by applicable law or agreed to in writing, software 13285 * distributed under the License is distributed on an "AS IS" BASIS, 13286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13287 * See the License for the specific language governing permissions and 13288 * limitations under the License. 13289 */ 13290 13291 /* eslint no-unused-vars: [2, {"args": "none"}] */ 13292 13293 /** 13294 * Adapter for MDC Text Field Icon. 13295 * 13296 * Defines the shape of the adapter expected by the foundation. Implement this 13297 * adapter to integrate the text field icon into your framework. See 13298 * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md 13299 * for more information. 13300 * 13301 * @record 13302 */ 13303 var MDCTextFieldIconAdapter = 13304 /*#__PURE__*/ 13305 function () { 13306 function MDCTextFieldIconAdapter() { 13307 _classCallCheck(this, MDCTextFieldIconAdapter); 13308 } 13309 13310 _createClass(MDCTextFieldIconAdapter, [{ 13311 key: "getAttr", 13312 13313 /** 13314 * Gets the value of an attribute on the icon element. 13315 * @param {string} attr 13316 * @return {string} 13317 */ 13318 value: function getAttr(attr) {} 13319 /** 13320 * Sets an attribute on the icon element. 13321 * @param {string} attr 13322 * @param {string} value 13323 */ 13324 13325 }, { 13326 key: "setAttr", 13327 value: function setAttr(attr, value) {} 13328 /** 13329 * Removes an attribute from the icon element. 13330 * @param {string} attr 13331 */ 13332 13333 }, { 13334 key: "removeAttr", 13335 value: function removeAttr(attr) {} 13336 /** 13337 * Sets the text content of the icon element. 13338 * @param {string} content 13339 */ 13340 13341 }, { 13342 key: "setContent", 13343 value: function setContent(content) {} 13344 /** 13345 * Registers an event listener on the icon element for a given event. 13346 * @param {string} evtType 13347 * @param {function(!Event): undefined} handler 13348 */ 13349 13350 }, { 13351 key: "registerInteractionHandler", 13352 value: function registerInteractionHandler(evtType, handler) {} 13353 /** 13354 * Deregisters an event listener on the icon element for a given event. 13355 * @param {string} evtType 13356 * @param {function(!Event): undefined} handler 13357 */ 13358 13359 }, { 13360 key: "deregisterInteractionHandler", 13361 value: function deregisterInteractionHandler(evtType, handler) {} 13362 /** 13363 * Emits a custom event "MDCTextField:icon" denoting a user has clicked the icon. 13364 */ 13365 13366 }, { 13367 key: "notifyIconAction", 13368 value: function notifyIconAction() {} 13369 }]); 13370 13371 return MDCTextFieldIconAdapter; 13372 }(); 13373 13374 /* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldIconAdapter); 13375 13376 /***/ }), 13377 13378 /***/ "./node_modules/@material/textfield/icon/constants.js": 13379 /*!************************************************************!*\ 13380 !*** ./node_modules/@material/textfield/icon/constants.js ***! 13381 \************************************************************/ 13382 /*! exports provided: strings */ 13383 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13384 13385 "use strict"; 13386 __webpack_require__.r(__webpack_exports__); 13387 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; }); 13388 /** 13389 * @license 13390 * Copyright 2016 Google Inc. All Rights Reserved. 13391 * 13392 * Licensed under the Apache License, Version 2.0 (the "License"); 13393 * you may not use this file except in compliance with the License. 13394 * You may obtain a copy of the License at 13395 * 13396 * http://www.apache.org/licenses/LICENSE-2.0 13397 * 13398 * Unless required by applicable law or agreed to in writing, software 13399 * distributed under the License is distributed on an "AS IS" BASIS, 13400 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13401 * See the License for the specific language governing permissions and 13402 * limitations under the License. 13403 */ 13404 13405 /** @enum {string} */ 13406 var strings = { 13407 ICON_EVENT: 'MDCTextField:icon', 13408 ICON_ROLE: 'button' 13409 }; 13410 13411 13412 /***/ }), 13413 13414 /***/ "./node_modules/@material/textfield/icon/foundation.js": 13415 /*!*************************************************************!*\ 13416 !*** ./node_modules/@material/textfield/icon/foundation.js ***! 13417 \*************************************************************/ 13418 /*! exports provided: default */ 13419 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13420 13421 "use strict"; 13422 __webpack_require__.r(__webpack_exports__); 13423 /* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js"); 13424 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/icon/adapter.js"); 13425 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/icon/constants.js"); 13426 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 13427 13428 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13429 13430 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 13431 13432 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 13433 13434 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 13435 13436 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); } } 13437 13438 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13439 13440 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 13441 13442 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 13443 13444 /** 13445 * @license 13446 * Copyright 2017 Google Inc. All Rights Reserved. 13447 * 13448 * Licensed under the Apache License, Version 2.0 (the "License"); 13449 * you may not use this file except in compliance with the License. 13450 * You may obtain a copy of the License at 13451 * 13452 * http://www.apache.org/licenses/LICENSE-2.0 13453 * 13454 * Unless required by applicable law or agreed to in writing, software 13455 * distributed under the License is distributed on an "AS IS" BASIS, 13456 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13457 * See the License for the specific language governing permissions and 13458 * limitations under the License. 13459 */ 13460 13461 13462 13463 /** 13464 * @extends {MDCFoundation<!MDCTextFieldIconAdapter>} 13465 * @final 13466 */ 13467 13468 var MDCTextFieldIconFoundation = 13469 /*#__PURE__*/ 13470 function (_MDCFoundation) { 13471 _inherits(MDCTextFieldIconFoundation, _MDCFoundation); 13472 13473 _createClass(MDCTextFieldIconFoundation, null, [{ 13474 key: "strings", 13475 13476 /** @return enum {string} */ 13477 get: function get() { 13478 return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"]; 13479 } 13480 /** 13481 * {@see MDCTextFieldIconAdapter} for typing information on parameters and return 13482 * types. 13483 * @return {!MDCTextFieldIconAdapter} 13484 */ 13485 13486 }, { 13487 key: "defaultAdapter", 13488 get: function get() { 13489 return ( 13490 /** @type {!MDCTextFieldIconAdapter} */ 13491 { 13492 getAttr: function getAttr() {}, 13493 setAttr: function setAttr() {}, 13494 removeAttr: function removeAttr() {}, 13495 setContent: function setContent() {}, 13496 registerInteractionHandler: function registerInteractionHandler() {}, 13497 deregisterInteractionHandler: function deregisterInteractionHandler() {}, 13498 notifyIconAction: function notifyIconAction() {} 13499 } 13500 ); 13501 } 13502 /** 13503 * @param {!MDCTextFieldIconAdapter} adapter 13504 */ 13505 13506 }]); 13507 13508 function MDCTextFieldIconFoundation(adapter) { 13509 var _this; 13510 13511 _classCallCheck(this, MDCTextFieldIconFoundation); 13512 13513 _this = _possibleConstructorReturn(this, _getPrototypeOf(MDCTextFieldIconFoundation).call(this, Object.assign(MDCTextFieldIconFoundation.defaultAdapter, adapter))); 13514 /** @private {string?} */ 13515 13516 _this.savedTabIndex_ = null; 13517 /** @private {function(!Event): undefined} */ 13518 13519 _this.interactionHandler_ = function (evt) { 13520 return _this.handleInteraction(evt); 13521 }; 13522 13523 return _this; 13524 } 13525 13526 _createClass(MDCTextFieldIconFoundation, [{ 13527 key: "init", 13528 value: function init() { 13529 var _this2 = this; 13530 13531 this.savedTabIndex_ = this.adapter_.getAttr('tabindex'); 13532 ['click', 'keydown'].forEach(function (evtType) { 13533 _this2.adapter_.registerInteractionHandler(evtType, _this2.interactionHandler_); 13534 }); 13535 } 13536 }, { 13537 key: "destroy", 13538 value: function destroy() { 13539 var _this3 = this; 13540 13541 ['click', 'keydown'].forEach(function (evtType) { 13542 _this3.adapter_.deregisterInteractionHandler(evtType, _this3.interactionHandler_); 13543 }); 13544 } 13545 /** @param {boolean} disabled */ 13546 13547 }, { 13548 key: "setDisabled", 13549 value: function setDisabled(disabled) { 13550 if (!this.savedTabIndex_) { 13551 return; 13552 } 13553 13554 if (disabled) { 13555 this.adapter_.setAttr('tabindex', '-1'); 13556 this.adapter_.removeAttr('role'); 13557 } else { 13558 this.adapter_.setAttr('tabindex', this.savedTabIndex_); 13559 this.adapter_.setAttr('role', _constants__WEBPACK_IMPORTED_MODULE_2__["strings"].ICON_ROLE); 13560 } 13561 } 13562 /** @param {string} label */ 13563 13564 }, { 13565 key: "setAriaLabel", 13566 value: function setAriaLabel(label) { 13567 this.adapter_.setAttr('aria-label', label); 13568 } 13569 /** @param {string} content */ 13570 13571 }, { 13572 key: "setContent", 13573 value: function setContent(content) { 13574 this.adapter_.setContent(content); 13575 } 13576 /** 13577 * Handles an interaction event 13578 * @param {!Event} evt 13579 */ 13580 13581 }, { 13582 key: "handleInteraction", 13583 value: function handleInteraction(evt) { 13584 if (evt.type === 'click' || evt.key === 'Enter' || evt.keyCode === 13) { 13585 this.adapter_.notifyIconAction(); 13586 } 13587 } 13588 }]); 13589 13590 return MDCTextFieldIconFoundation; 13591 }(_material_base_foundation__WEBPACK_IMPORTED_MODULE_0__["default"]); 13592 13593 /* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldIconFoundation); 13594 13595 /***/ }), 13596 13597 /***/ "./node_modules/@material/textfield/icon/index.js": 13598 /*!********************************************************!*\ 13599 !*** ./node_modules/@material/textfield/icon/index.js ***! 13600 \********************************************************/ 13601 /*! exports provided: MDCTextFieldIcon, MDCTextFieldIconFoundation */ 13602 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13603 13604 "use strict"; 13605 __webpack_require__.r(__webpack_exports__); 13606 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldIcon", function() { return MDCTextFieldIcon; }); 13607 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 13608 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/icon/adapter.js"); 13609 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/icon/foundation.js"); 13610 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldIconFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 13611 13612 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 13613 13614 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13615 13616 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); } } 13617 13618 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13619 13620 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 13621 13622 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 13623 13624 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 13625 13626 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 13627 13628 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 13629 13630 /** 13631 * @license 13632 * Copyright 2017 Google Inc. All Rights Reserved. 13633 * 13634 * Licensed under the Apache License, Version 2.0 (the "License"); 13635 * you may not use this file except in compliance with the License. 13636 * You may obtain a copy of the License at 13637 * 13638 * http://www.apache.org/licenses/LICENSE-2.0 13639 * 13640 * Unless required by applicable law or agreed to in writing, software 13641 * distributed under the License is distributed on an "AS IS" BASIS, 13642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13643 * See the License for the specific language governing permissions and 13644 * limitations under the License. 13645 */ 13646 13647 13648 13649 /** 13650 * @extends {MDCComponent<!MDCTextFieldIconFoundation>} 13651 * @final 13652 */ 13653 13654 var MDCTextFieldIcon = 13655 /*#__PURE__*/ 13656 function (_MDCComponent) { 13657 _inherits(MDCTextFieldIcon, _MDCComponent); 13658 13659 function MDCTextFieldIcon() { 13660 _classCallCheck(this, MDCTextFieldIcon); 13661 13662 return _possibleConstructorReturn(this, _getPrototypeOf(MDCTextFieldIcon).apply(this, arguments)); 13663 } 13664 13665 _createClass(MDCTextFieldIcon, [{ 13666 key: "getDefaultFoundation", 13667 13668 /** 13669 * @return {!MDCTextFieldIconFoundation} 13670 */ 13671 value: function getDefaultFoundation() { 13672 var _this = this; 13673 13674 return new _foundation__WEBPACK_IMPORTED_MODULE_2__["default"]( 13675 /** @type {!MDCTextFieldIconAdapter} */ 13676 Object.assign({ 13677 getAttr: function getAttr(attr) { 13678 return _this.root_.getAttribute(attr); 13679 }, 13680 setAttr: function setAttr(attr, value) { 13681 return _this.root_.setAttribute(attr, value); 13682 }, 13683 removeAttr: function removeAttr(attr) { 13684 return _this.root_.removeAttribute(attr); 13685 }, 13686 setContent: function setContent(content) { 13687 _this.root_.textContent = content; 13688 }, 13689 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 13690 return _this.root_.addEventListener(evtType, handler); 13691 }, 13692 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 13693 return _this.root_.removeEventListener(evtType, handler); 13694 }, 13695 notifyIconAction: function notifyIconAction() { 13696 return _this.emit(_foundation__WEBPACK_IMPORTED_MODULE_2__["default"].strings.ICON_EVENT, {} 13697 /* evtData */ 13698 , true 13699 /* shouldBubble */ 13700 ); 13701 } 13702 })); 13703 } 13704 }, { 13705 key: "foundation", 13706 13707 /** 13708 * @return {!MDCTextFieldIconFoundation} 13709 */ 13710 get: function get() { 13711 return this.foundation_; 13712 } 13713 }], [{ 13714 key: "attachTo", 13715 13716 /** 13717 * @param {!Element} root 13718 * @return {!MDCTextFieldIcon} 13719 */ 13720 value: function attachTo(root) { 13721 return new MDCTextFieldIcon(root); 13722 } 13723 }]); 13724 13725 return MDCTextFieldIcon; 13726 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 13727 13728 13729 13730 /***/ }), 13731 13732 /***/ "./node_modules/@material/textfield/index.js": 13733 /*!***************************************************!*\ 13734 !*** ./node_modules/@material/textfield/index.js ***! 13735 \***************************************************/ 13736 /*! exports provided: MDCTextField, MDCTextFieldFoundation, MDCTextFieldHelperText, MDCTextFieldHelperTextFoundation, MDCTextFieldIcon, MDCTextFieldIconFoundation */ 13737 /***/ (function(module, __webpack_exports__, __webpack_require__) { 13738 13739 "use strict"; 13740 __webpack_require__.r(__webpack_exports__); 13741 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextField", function() { return MDCTextField; }); 13742 /* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js"); 13743 /* harmony import */ var _material_ripple_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/ripple/index */ "./node_modules/@material/ripple/index.js"); 13744 /* harmony import */ var _material_ripple_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/ripple/util */ "./node_modules/@material/ripple/util.js"); 13745 /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/constants.js"); 13746 /* harmony import */ var _adapter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./adapter */ "./node_modules/@material/textfield/adapter.js"); 13747 /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/foundation.js"); 13748 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_5__["default"]; }); 13749 13750 /* harmony import */ var _material_line_ripple_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material/line-ripple/index */ "./node_modules/@material/line-ripple/index.js"); 13751 /* harmony import */ var _helper_text_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./helper-text/index */ "./node_modules/@material/textfield/helper-text/index.js"); 13752 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldHelperText", function() { return _helper_text_index__WEBPACK_IMPORTED_MODULE_7__["MDCTextFieldHelperText"]; }); 13753 13754 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldHelperTextFoundation", function() { return _helper_text_index__WEBPACK_IMPORTED_MODULE_7__["MDCTextFieldHelperTextFoundation"]; }); 13755 13756 /* harmony import */ var _icon_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./icon/index */ "./node_modules/@material/textfield/icon/index.js"); 13757 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldIcon", function() { return _icon_index__WEBPACK_IMPORTED_MODULE_8__["MDCTextFieldIcon"]; }); 13758 13759 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldIconFoundation", function() { return _icon_index__WEBPACK_IMPORTED_MODULE_8__["MDCTextFieldIconFoundation"]; }); 13760 13761 /* harmony import */ var _material_floating_label_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material/floating-label/index */ "./node_modules/@material/floating-label/index.js"); 13762 /* harmony import */ var _material_notched_outline_index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @material/notched-outline/index */ "./node_modules/@material/notched-outline/index.js"); 13763 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 13764 13765 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13766 13767 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); } } 13768 13769 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13770 13771 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 13772 13773 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 13774 13775 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } 13776 13777 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } 13778 13779 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 13780 13781 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 13782 13783 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 13784 13785 /** 13786 * @license 13787 * Copyright 2016 Google Inc. All Rights Reserved. 13788 * 13789 * Licensed under the Apache License, Version 2.0 (the "License"); 13790 * you may not use this file except in compliance with the License. 13791 * You may obtain a copy of the License at 13792 * 13793 * http://www.apache.org/licenses/LICENSE-2.0 13794 * 13795 * Unless required by applicable law or agreed to in writing, software 13796 * distributed under the License is distributed on an "AS IS" BASIS, 13797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13798 * See the License for the specific language governing permissions and 13799 * limitations under the License. 13800 */ 13801 13802 /* eslint-disable no-unused-vars */ 13803 13804 13805 /* eslint-enable no-unused-vars */ 13806 13807 13808 13809 13810 13811 /* eslint-disable no-unused-vars */ 13812 13813 13814 13815 13816 13817 13818 /* eslint-enable no-unused-vars */ 13819 13820 /** 13821 * @extends {MDCComponent<!MDCTextFieldFoundation>} 13822 * @final 13823 */ 13824 13825 var MDCTextField = 13826 /*#__PURE__*/ 13827 function (_MDCComponent) { 13828 _inherits(MDCTextField, _MDCComponent); 13829 13830 /** 13831 * @param {...?} args 13832 */ 13833 function MDCTextField() { 13834 var _getPrototypeOf2; 13835 13836 var _this; 13837 13838 _classCallCheck(this, MDCTextField); 13839 13840 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 13841 args[_key] = arguments[_key]; 13842 } 13843 13844 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MDCTextField)).call.apply(_getPrototypeOf2, [this].concat(args))); 13845 /** @private {?Element} */ 13846 13847 _this.input_; 13848 /** @type {?MDCRipple} */ 13849 13850 _this.ripple; 13851 /** @private {?MDCLineRipple} */ 13852 13853 _this.lineRipple_; 13854 /** @private {?MDCTextFieldHelperText} */ 13855 13856 _this.helperText_; 13857 /** @private {?MDCTextFieldIcon} */ 13858 13859 _this.icon_; 13860 /** @private {?MDCFloatingLabel} */ 13861 13862 _this.label_; 13863 /** @private {?MDCNotchedOutline} */ 13864 13865 _this.outline_; 13866 return _this; 13867 } 13868 /** 13869 * @param {!Element} root 13870 * @return {!MDCTextField} 13871 */ 13872 13873 13874 _createClass(MDCTextField, [{ 13875 key: "initialize", 13876 13877 /** 13878 * @param {(function(!Element): !MDCRipple)=} rippleFactory A function which 13879 * creates a new MDCRipple. 13880 * @param {(function(!Element): !MDCLineRipple)=} lineRippleFactory A function which 13881 * creates a new MDCLineRipple. 13882 * @param {(function(!Element): !MDCTextFieldHelperText)=} helperTextFactory A function which 13883 * creates a new MDCTextFieldHelperText. 13884 * @param {(function(!Element): !MDCTextFieldIcon)=} iconFactory A function which 13885 * creates a new MDCTextFieldIcon. 13886 * @param {(function(!Element): !MDCFloatingLabel)=} labelFactory A function which 13887 * creates a new MDCFloatingLabel. 13888 * @param {(function(!Element): !MDCNotchedOutline)=} outlineFactory A function which 13889 * creates a new MDCNotchedOutline. 13890 */ 13891 value: function initialize() { 13892 var _this2 = this; 13893 13894 var rippleFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (el, foundation) { 13895 return new _material_ripple_index__WEBPACK_IMPORTED_MODULE_1__["MDCRipple"](el, foundation); 13896 }; 13897 var lineRippleFactory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (el) { 13898 return new _material_line_ripple_index__WEBPACK_IMPORTED_MODULE_6__["MDCLineRipple"](el); 13899 }; 13900 var helperTextFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (el) { 13901 return new _helper_text_index__WEBPACK_IMPORTED_MODULE_7__["MDCTextFieldHelperText"](el); 13902 }; 13903 var iconFactory = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (el) { 13904 return new _icon_index__WEBPACK_IMPORTED_MODULE_8__["MDCTextFieldIcon"](el); 13905 }; 13906 var labelFactory = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (el) { 13907 return new _material_floating_label_index__WEBPACK_IMPORTED_MODULE_9__["MDCFloatingLabel"](el); 13908 }; 13909 var outlineFactory = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function (el) { 13910 return new _material_notched_outline_index__WEBPACK_IMPORTED_MODULE_10__["MDCNotchedOutline"](el); 13911 }; 13912 this.input_ = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].INPUT_SELECTOR); 13913 var labelElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].LABEL_SELECTOR); 13914 13915 if (labelElement) { 13916 this.label_ = labelFactory(labelElement); 13917 } 13918 13919 var lineRippleElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].LINE_RIPPLE_SELECTOR); 13920 13921 if (lineRippleElement) { 13922 this.lineRipple_ = lineRippleFactory(lineRippleElement); 13923 } 13924 13925 var outlineElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].OUTLINE_SELECTOR); 13926 13927 if (outlineElement) { 13928 this.outline_ = outlineFactory(outlineElement); 13929 } 13930 13931 if (this.input_.hasAttribute(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ARIA_CONTROLS)) { 13932 var helperTextElement = document.getElementById(this.input_.getAttribute(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ARIA_CONTROLS)); 13933 13934 if (helperTextElement) { 13935 this.helperText_ = helperTextFactory(helperTextElement); 13936 } 13937 } 13938 13939 var iconElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].ICON_SELECTOR); 13940 13941 if (iconElement) { 13942 this.icon_ = iconFactory(iconElement); 13943 } 13944 13945 this.ripple = null; 13946 13947 if (this.root_.classList.contains(_constants__WEBPACK_IMPORTED_MODULE_3__["cssClasses"].BOX)) { 13948 var MATCHES = Object(_material_ripple_util__WEBPACK_IMPORTED_MODULE_2__["getMatchesProperty"])(HTMLElement.prototype); 13949 var adapter = Object.assign(_material_ripple_index__WEBPACK_IMPORTED_MODULE_1__["MDCRipple"].createAdapter( 13950 /** @type {!RippleCapableSurface} */ 13951 this), { 13952 isSurfaceActive: function isSurfaceActive() { 13953 return _this2.input_[MATCHES](':active'); 13954 }, 13955 registerInteractionHandler: function registerInteractionHandler(type, handler) { 13956 return _this2.input_.addEventListener(type, handler); 13957 }, 13958 deregisterInteractionHandler: function deregisterInteractionHandler(type, handler) { 13959 return _this2.input_.removeEventListener(type, handler); 13960 } 13961 }); 13962 var foundation = new _material_ripple_index__WEBPACK_IMPORTED_MODULE_1__["MDCRippleFoundation"](adapter); 13963 this.ripple = rippleFactory(this.root_, foundation); 13964 } 13965 } 13966 }, { 13967 key: "destroy", 13968 value: function destroy() { 13969 if (this.ripple) { 13970 this.ripple.destroy(); 13971 } 13972 13973 if (this.lineRipple_) { 13974 this.lineRipple_.destroy(); 13975 } 13976 13977 if (this.helperText_) { 13978 this.helperText_.destroy(); 13979 } 13980 13981 if (this.icon_) { 13982 this.icon_.destroy(); 13983 } 13984 13985 if (this.label_) { 13986 this.label_.destroy(); 13987 } 13988 13989 if (this.outline_) { 13990 this.outline_.destroy(); 13991 } 13992 13993 _get(_getPrototypeOf(MDCTextField.prototype), "destroy", this).call(this); 13994 } 13995 /** 13996 * Initiliazes the Text Field's internal state based on the environment's 13997 * state. 13998 */ 13999 14000 }, { 14001 key: "initialSyncWithDom", 14002 value: function initialSyncWithDom() { 14003 this.disabled = this.input_.disabled; 14004 } 14005 /** 14006 * @return {string} The value of the input. 14007 */ 14008 14009 }, { 14010 key: "layout", 14011 14012 /** 14013 * Recomputes the outline SVG path for the outline element. 14014 */ 14015 value: function layout() { 14016 var openNotch = this.foundation_.shouldFloat; 14017 this.foundation_.notchOutline(openNotch); 14018 } 14019 /** 14020 * @return {!MDCTextFieldFoundation} 14021 */ 14022 14023 }, { 14024 key: "getDefaultFoundation", 14025 value: function getDefaultFoundation() { 14026 var _this3 = this; 14027 14028 return new _foundation__WEBPACK_IMPORTED_MODULE_5__["default"]( 14029 /** @type {!MDCTextFieldAdapter} */ 14030 Object.assign({ 14031 addClass: function addClass(className) { 14032 return _this3.root_.classList.add(className); 14033 }, 14034 removeClass: function removeClass(className) { 14035 return _this3.root_.classList.remove(className); 14036 }, 14037 hasClass: function hasClass(className) { 14038 return _this3.root_.classList.contains(className); 14039 }, 14040 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) { 14041 return _this3.root_.addEventListener(evtType, handler); 14042 }, 14043 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) { 14044 return _this3.root_.removeEventListener(evtType, handler); 14045 }, 14046 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) { 14047 var getAttributesList = function getAttributesList(mutationsList) { 14048 return mutationsList.map(function (mutation) { 14049 return mutation.attributeName; 14050 }); 14051 }; 14052 14053 var observer = new MutationObserver(function (mutationsList) { 14054 return handler(getAttributesList(mutationsList)); 14055 }); 14056 14057 var targetNode = _this3.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].INPUT_SELECTOR); 14058 14059 var config = { 14060 attributes: true 14061 }; 14062 observer.observe(targetNode, config); 14063 return observer; 14064 }, 14065 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) { 14066 return observer.disconnect(); 14067 }, 14068 isFocused: function isFocused() { 14069 return document.activeElement === _this3.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_3__["strings"].INPUT_SELECTOR); 14070 }, 14071 isRtl: function isRtl() { 14072 return window.getComputedStyle(_this3.root_).getPropertyValue('direction') === 'rtl'; 14073 } 14074 }, this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_()), this.getFoundationMap_()); 14075 } 14076 /** 14077 * @return {!{ 14078 * shakeLabel: function(boolean): undefined, 14079 * floatLabel: function(boolean): undefined, 14080 * hasLabel: function(): boolean, 14081 * getLabelWidth: function(): number, 14082 * }} 14083 */ 14084 14085 }, { 14086 key: "getLabelAdapterMethods_", 14087 value: function getLabelAdapterMethods_() { 14088 var _this4 = this; 14089 14090 return { 14091 shakeLabel: function shakeLabel(shouldShake) { 14092 return _this4.label_.shake(shouldShake); 14093 }, 14094 floatLabel: function floatLabel(shouldFloat) { 14095 return _this4.label_.float(shouldFloat); 14096 }, 14097 hasLabel: function hasLabel() { 14098 return !!_this4.label_; 14099 }, 14100 getLabelWidth: function getLabelWidth() { 14101 return _this4.label_.getWidth(); 14102 } 14103 }; 14104 } 14105 /** 14106 * @return {!{ 14107 * activateLineRipple: function(): undefined, 14108 * deactivateLineRipple: function(): undefined, 14109 * setLineRippleTransformOrigin: function(number): undefined, 14110 * }} 14111 */ 14112 14113 }, { 14114 key: "getLineRippleAdapterMethods_", 14115 value: function getLineRippleAdapterMethods_() { 14116 var _this5 = this; 14117 14118 return { 14119 activateLineRipple: function activateLineRipple() { 14120 if (_this5.lineRipple_) { 14121 _this5.lineRipple_.activate(); 14122 } 14123 }, 14124 deactivateLineRipple: function deactivateLineRipple() { 14125 if (_this5.lineRipple_) { 14126 _this5.lineRipple_.deactivate(); 14127 } 14128 }, 14129 setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) { 14130 if (_this5.lineRipple_) { 14131 _this5.lineRipple_.setRippleCenter(normalizedX); 14132 } 14133 } 14134 }; 14135 } 14136 /** 14137 * @return {!{ 14138 * notchOutline: function(number, boolean): undefined, 14139 * hasOutline: function(): boolean, 14140 * }} 14141 */ 14142 14143 }, { 14144 key: "getOutlineAdapterMethods_", 14145 value: function getOutlineAdapterMethods_() { 14146 var _this6 = this; 14147 14148 return { 14149 notchOutline: function notchOutline(labelWidth, isRtl) { 14150 return _this6.outline_.notch(labelWidth, isRtl); 14151 }, 14152 closeOutline: function closeOutline() { 14153 return _this6.outline_.closeNotch(); 14154 }, 14155 hasOutline: function hasOutline() { 14156 return !!_this6.outline_; 14157 } 14158 }; 14159 } 14160 /** 14161 * @return {!{ 14162 * registerInputInteractionHandler: function(string, function()): undefined, 14163 * deregisterInputInteractionHandler: function(string, function()): undefined, 14164 * getNativeInput: function(): ?Element, 14165 * }} 14166 */ 14167 14168 }, { 14169 key: "getInputAdapterMethods_", 14170 value: function getInputAdapterMethods_() { 14171 var _this7 = this; 14172 14173 return { 14174 registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) { 14175 return _this7.input_.addEventListener(evtType, handler); 14176 }, 14177 deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) { 14178 return _this7.input_.removeEventListener(evtType, handler); 14179 }, 14180 getNativeInput: function getNativeInput() { 14181 return _this7.input_; 14182 } 14183 }; 14184 } 14185 /** 14186 * Returns a map of all subcomponents to subfoundations. 14187 * @return {!FoundationMapType} 14188 */ 14189 14190 }, { 14191 key: "getFoundationMap_", 14192 value: function getFoundationMap_() { 14193 return { 14194 helperText: this.helperText_ ? this.helperText_.foundation : undefined, 14195 icon: this.icon_ ? this.icon_.foundation : undefined 14196 }; 14197 } 14198 }, { 14199 key: "value", 14200 get: function get() { 14201 return this.foundation_.getValue(); 14202 } 14203 /** 14204 * @param {string} value The value to set on the input. 14205 */ 14206 , 14207 set: function set(value) { 14208 this.foundation_.setValue(value); 14209 } 14210 /** 14211 * @return {boolean} True if the Text Field is disabled. 14212 */ 14213 14214 }, { 14215 key: "disabled", 14216 get: function get() { 14217 return this.foundation_.isDisabled(); 14218 } 14219 /** 14220 * @param {boolean} disabled Sets the Text Field disabled or enabled. 14221 */ 14222 , 14223 set: function set(disabled) { 14224 this.foundation_.setDisabled(disabled); 14225 } 14226 /** 14227 * @return {boolean} valid True if the Text Field is valid. 14228 */ 14229 14230 }, { 14231 key: "valid", 14232 get: function get() { 14233 return this.foundation_.isValid(); 14234 } 14235 /** 14236 * @param {boolean} valid Sets the Text Field valid or invalid. 14237 */ 14238 , 14239 set: function set(valid) { 14240 this.foundation_.setValid(valid); 14241 } 14242 /** 14243 * @return {boolean} True if the Text Field is required. 14244 */ 14245 14246 }, { 14247 key: "required", 14248 get: function get() { 14249 return this.input_.required; 14250 } 14251 /** 14252 * @param {boolean} required Sets the Text Field to required. 14253 */ 14254 , 14255 set: function set(required) { 14256 this.input_.required = required; 14257 } 14258 /** 14259 * @return {string} The input element's validation pattern. 14260 */ 14261 14262 }, { 14263 key: "pattern", 14264 get: function get() { 14265 return this.input_.pattern; 14266 } 14267 /** 14268 * @param {string} pattern Sets the input element's validation pattern. 14269 */ 14270 , 14271 set: function set(pattern) { 14272 this.input_.pattern = pattern; 14273 } 14274 /** 14275 * @return {number} The input element's minLength. 14276 */ 14277 14278 }, { 14279 key: "minLength", 14280 get: function get() { 14281 return this.input_.minLength; 14282 } 14283 /** 14284 * @param {number} minLength Sets the input element's minLength. 14285 */ 14286 , 14287 set: function set(minLength) { 14288 this.input_.minLength = minLength; 14289 } 14290 /** 14291 * @return {number} The input element's maxLength. 14292 */ 14293 14294 }, { 14295 key: "maxLength", 14296 get: function get() { 14297 return this.input_.maxLength; 14298 } 14299 /** 14300 * @param {number} maxLength Sets the input element's maxLength. 14301 */ 14302 , 14303 set: function set(maxLength) { 14304 // Chrome throws exception if maxLength is set < 0 14305 if (maxLength < 0) { 14306 this.input_.removeAttribute('maxLength'); 14307 } else { 14308 this.input_.maxLength = maxLength; 14309 } 14310 } 14311 /** 14312 * @return {string} The input element's min. 14313 */ 14314 14315 }, { 14316 key: "min", 14317 get: function get() { 14318 return this.input_.min; 14319 } 14320 /** 14321 * @param {string} min Sets the input element's min. 14322 */ 14323 , 14324 set: function set(min) { 14325 this.input_.min = min; 14326 } 14327 /** 14328 * @return {string} The input element's max. 14329 */ 14330 14331 }, { 14332 key: "max", 14333 get: function get() { 14334 return this.input_.max; 14335 } 14336 /** 14337 * @param {string} max Sets the input element's max. 14338 */ 14339 , 14340 set: function set(max) { 14341 this.input_.max = max; 14342 } 14343 /** 14344 * @return {string} The input element's step. 14345 */ 14346 14347 }, { 14348 key: "step", 14349 get: function get() { 14350 return this.input_.step; 14351 } 14352 /** 14353 * @param {string} step Sets the input element's step. 14354 */ 14355 , 14356 set: function set(step) { 14357 this.input_.step = step; 14358 } 14359 /** 14360 * Sets the helper text element content. 14361 * @param {string} content 14362 */ 14363 14364 }, { 14365 key: "helperTextContent", 14366 set: function set(content) { 14367 this.foundation_.setHelperTextContent(content); 14368 } 14369 /** 14370 * Sets the aria label of the icon. 14371 * @param {string} label 14372 */ 14373 14374 }, { 14375 key: "iconAriaLabel", 14376 set: function set(label) { 14377 this.foundation_.setIconAriaLabel(label); 14378 } 14379 /** 14380 * Sets the text content of the icon. 14381 * @param {string} content 14382 */ 14383 14384 }, { 14385 key: "iconContent", 14386 set: function set(content) { 14387 this.foundation_.setIconContent(content); 14388 } 14389 }], [{ 14390 key: "attachTo", 14391 value: function attachTo(root) { 14392 return new MDCTextField(root); 14393 } 14394 }]); 14395 14396 return MDCTextField; 14397 }(_material_base_component__WEBPACK_IMPORTED_MODULE_0__["default"]); 14398 14399 14400 14401 /***/ }), 14402 14403 /***/ "./node_modules/es6-promise/dist/es6-promise.js": 14404 /*!******************************************************!*\ 14405 !*** ./node_modules/es6-promise/dist/es6-promise.js ***! 14406 \******************************************************/ 14407 /*! no static exports found */ 14408 /***/ (function(module, exports, __webpack_require__) { 14409 14410 /* WEBPACK VAR INJECTION */(function(process, global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 14411 14412 /*! 14413 * @overview es6-promise - a tiny implementation of Promises/A+. 14414 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 14415 * @license Licensed under MIT license 14416 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE 14417 * @version v4.2.6+9869a4bc 14418 */ 14419 (function (global, factory) { 14420 ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 14421 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 14422 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 14423 __WEBPACK_AMD_DEFINE_FACTORY__), 14424 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined; 14425 })(this, function () { 14426 'use strict'; 14427 14428 function objectOrFunction(x) { 14429 var type = _typeof(x); 14430 14431 return x !== null && (type === 'object' || type === 'function'); 14432 } 14433 14434 function isFunction(x) { 14435 return typeof x === 'function'; 14436 } 14437 14438 var _isArray = void 0; 14439 14440 if (Array.isArray) { 14441 _isArray = Array.isArray; 14442 } else { 14443 _isArray = function _isArray(x) { 14444 return Object.prototype.toString.call(x) === '[object Array]'; 14445 }; 14446 } 14447 14448 var isArray = _isArray; 14449 var len = 0; 14450 var vertxNext = void 0; 14451 var customSchedulerFn = void 0; 14452 14453 var asap = function asap(callback, arg) { 14454 queue[len] = callback; 14455 queue[len + 1] = arg; 14456 len += 2; 14457 14458 if (len === 2) { 14459 // If len is 2, that means that we need to schedule an async flush. 14460 // If additional callbacks are queued before the queue is flushed, they 14461 // will be processed by this flush that we are scheduling. 14462 if (customSchedulerFn) { 14463 customSchedulerFn(flush); 14464 } else { 14465 scheduleFlush(); 14466 } 14467 } 14468 }; 14469 14470 function setScheduler(scheduleFn) { 14471 customSchedulerFn = scheduleFn; 14472 } 14473 14474 function setAsap(asapFn) { 14475 asap = asapFn; 14476 } 14477 14478 var browserWindow = typeof window !== 'undefined' ? window : undefined; 14479 var browserGlobal = browserWindow || {}; 14480 var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; 14481 var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10 14482 14483 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node 14484 14485 function useNextTick() { 14486 // node version 0.10.x displays a deprecation warning when nextTick is used recursively 14487 // see https://github.com/cujojs/when/issues/410 for details 14488 return function () { 14489 return process.nextTick(flush); 14490 }; 14491 } // vertx 14492 14493 14494 function useVertxTimer() { 14495 if (typeof vertxNext !== 'undefined') { 14496 return function () { 14497 vertxNext(flush); 14498 }; 14499 } 14500 14501 return useSetTimeout(); 14502 } 14503 14504 function useMutationObserver() { 14505 var iterations = 0; 14506 var observer = new BrowserMutationObserver(flush); 14507 var node = document.createTextNode(''); 14508 observer.observe(node, { 14509 characterData: true 14510 }); 14511 return function () { 14512 node.data = iterations = ++iterations % 2; 14513 }; 14514 } // web worker 14515 14516 14517 function useMessageChannel() { 14518 var channel = new MessageChannel(); 14519 channel.port1.onmessage = flush; 14520 return function () { 14521 return channel.port2.postMessage(0); 14522 }; 14523 } 14524 14525 function useSetTimeout() { 14526 // Store setTimeout reference so es6-promise will be unaffected by 14527 // other code modifying setTimeout (like sinon.useFakeTimers()) 14528 var globalSetTimeout = setTimeout; 14529 return function () { 14530 return globalSetTimeout(flush, 1); 14531 }; 14532 } 14533 14534 var queue = new Array(1000); 14535 14536 function flush() { 14537 for (var i = 0; i < len; i += 2) { 14538 var callback = queue[i]; 14539 var arg = queue[i + 1]; 14540 callback(arg); 14541 queue[i] = undefined; 14542 queue[i + 1] = undefined; 14543 } 14544 14545 len = 0; 14546 } 14547 14548 function attemptVertx() { 14549 try { 14550 var vertx = Function('return this')().require('vertx'); 14551 14552 vertxNext = vertx.runOnLoop || vertx.runOnContext; 14553 return useVertxTimer(); 14554 } catch (e) { 14555 return useSetTimeout(); 14556 } 14557 } 14558 14559 var scheduleFlush = void 0; // Decide what async method to use to triggering processing of queued callbacks: 14560 14561 if (isNode) { 14562 scheduleFlush = useNextTick(); 14563 } else if (BrowserMutationObserver) { 14564 scheduleFlush = useMutationObserver(); 14565 } else if (isWorker) { 14566 scheduleFlush = useMessageChannel(); 14567 } else if (browserWindow === undefined && "function" === 'function') { 14568 scheduleFlush = attemptVertx(); 14569 } else { 14570 scheduleFlush = useSetTimeout(); 14571 } 14572 14573 function then(onFulfillment, onRejection) { 14574 var parent = this; 14575 var child = new this.constructor(noop); 14576 14577 if (child[PROMISE_ID] === undefined) { 14578 makePromise(child); 14579 } 14580 14581 var _state = parent._state; 14582 14583 if (_state) { 14584 var callback = arguments[_state - 1]; 14585 asap(function () { 14586 return invokeCallback(_state, child, callback, parent._result); 14587 }); 14588 } else { 14589 subscribe(parent, child, onFulfillment, onRejection); 14590 } 14591 14592 return child; 14593 } 14594 /** 14595 `Promise.resolve` returns a promise that will become resolved with the 14596 passed `value`. It is shorthand for the following: 14597 14598 ```javascript 14599 let promise = new Promise(function(resolve, reject){ 14600 resolve(1); 14601 }); 14602 14603 promise.then(function(value){ 14604 // value === 1 14605 }); 14606 ``` 14607 14608 Instead of writing the above, your code now simply becomes the following: 14609 14610 ```javascript 14611 let promise = Promise.resolve(1); 14612 14613 promise.then(function(value){ 14614 // value === 1 14615 }); 14616 ``` 14617 14618 @method resolve 14619 @static 14620 @param {Any} value value that the returned promise will be resolved with 14621 Useful for tooling. 14622 @return {Promise} a promise that will become fulfilled with the given 14623 `value` 14624 */ 14625 14626 14627 function resolve$1(object) { 14628 /*jshint validthis:true */ 14629 var Constructor = this; 14630 14631 if (object && _typeof(object) === 'object' && object.constructor === Constructor) { 14632 return object; 14633 } 14634 14635 var promise = new Constructor(noop); 14636 resolve(promise, object); 14637 return promise; 14638 } 14639 14640 var PROMISE_ID = Math.random().toString(36).substring(2); 14641 14642 function noop() {} 14643 14644 var PENDING = void 0; 14645 var FULFILLED = 1; 14646 var REJECTED = 2; 14647 var TRY_CATCH_ERROR = { 14648 error: null 14649 }; 14650 14651 function selfFulfillment() { 14652 return new TypeError("You cannot resolve a promise with itself"); 14653 } 14654 14655 function cannotReturnOwn() { 14656 return new TypeError('A promises callback cannot return that same promise.'); 14657 } 14658 14659 function getThen(promise) { 14660 try { 14661 return promise.then; 14662 } catch (error) { 14663 TRY_CATCH_ERROR.error = error; 14664 return TRY_CATCH_ERROR; 14665 } 14666 } 14667 14668 function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { 14669 try { 14670 then$$1.call(value, fulfillmentHandler, rejectionHandler); 14671 } catch (e) { 14672 return e; 14673 } 14674 } 14675 14676 function handleForeignThenable(promise, thenable, then$$1) { 14677 asap(function (promise) { 14678 var sealed = false; 14679 var error = tryThen(then$$1, thenable, function (value) { 14680 if (sealed) { 14681 return; 14682 } 14683 14684 sealed = true; 14685 14686 if (thenable !== value) { 14687 resolve(promise, value); 14688 } else { 14689 fulfill(promise, value); 14690 } 14691 }, function (reason) { 14692 if (sealed) { 14693 return; 14694 } 14695 14696 sealed = true; 14697 reject(promise, reason); 14698 }, 'Settle: ' + (promise._label || ' unknown promise')); 14699 14700 if (!sealed && error) { 14701 sealed = true; 14702 reject(promise, error); 14703 } 14704 }, promise); 14705 } 14706 14707 function handleOwnThenable(promise, thenable) { 14708 if (thenable._state === FULFILLED) { 14709 fulfill(promise, thenable._result); 14710 } else if (thenable._state === REJECTED) { 14711 reject(promise, thenable._result); 14712 } else { 14713 subscribe(thenable, undefined, function (value) { 14714 return resolve(promise, value); 14715 }, function (reason) { 14716 return reject(promise, reason); 14717 }); 14718 } 14719 } 14720 14721 function handleMaybeThenable(promise, maybeThenable, then$$1) { 14722 if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { 14723 handleOwnThenable(promise, maybeThenable); 14724 } else { 14725 if (then$$1 === TRY_CATCH_ERROR) { 14726 reject(promise, TRY_CATCH_ERROR.error); 14727 TRY_CATCH_ERROR.error = null; 14728 } else if (then$$1 === undefined) { 14729 fulfill(promise, maybeThenable); 14730 } else if (isFunction(then$$1)) { 14731 handleForeignThenable(promise, maybeThenable, then$$1); 14732 } else { 14733 fulfill(promise, maybeThenable); 14734 } 14735 } 14736 } 14737 14738 function resolve(promise, value) { 14739 if (promise === value) { 14740 reject(promise, selfFulfillment()); 14741 } else if (objectOrFunction(value)) { 14742 handleMaybeThenable(promise, value, getThen(value)); 14743 } else { 14744 fulfill(promise, value); 14745 } 14746 } 14747 14748 function publishRejection(promise) { 14749 if (promise._onerror) { 14750 promise._onerror(promise._result); 14751 } 14752 14753 publish(promise); 14754 } 14755 14756 function fulfill(promise, value) { 14757 if (promise._state !== PENDING) { 14758 return; 14759 } 14760 14761 promise._result = value; 14762 promise._state = FULFILLED; 14763 14764 if (promise._subscribers.length !== 0) { 14765 asap(publish, promise); 14766 } 14767 } 14768 14769 function reject(promise, reason) { 14770 if (promise._state !== PENDING) { 14771 return; 14772 } 14773 14774 promise._state = REJECTED; 14775 promise._result = reason; 14776 asap(publishRejection, promise); 14777 } 14778 14779 function subscribe(parent, child, onFulfillment, onRejection) { 14780 var _subscribers = parent._subscribers; 14781 var length = _subscribers.length; 14782 parent._onerror = null; 14783 _subscribers[length] = child; 14784 _subscribers[length + FULFILLED] = onFulfillment; 14785 _subscribers[length + REJECTED] = onRejection; 14786 14787 if (length === 0 && parent._state) { 14788 asap(publish, parent); 14789 } 14790 } 14791 14792 function publish(promise) { 14793 var subscribers = promise._subscribers; 14794 var settled = promise._state; 14795 14796 if (subscribers.length === 0) { 14797 return; 14798 } 14799 14800 var child = void 0, 14801 callback = void 0, 14802 detail = promise._result; 14803 14804 for (var i = 0; i < subscribers.length; i += 3) { 14805 child = subscribers[i]; 14806 callback = subscribers[i + settled]; 14807 14808 if (child) { 14809 invokeCallback(settled, child, callback, detail); 14810 } else { 14811 callback(detail); 14812 } 14813 } 14814 14815 promise._subscribers.length = 0; 14816 } 14817 14818 function tryCatch(callback, detail) { 14819 try { 14820 return callback(detail); 14821 } catch (e) { 14822 TRY_CATCH_ERROR.error = e; 14823 return TRY_CATCH_ERROR; 14824 } 14825 } 14826 14827 function invokeCallback(settled, promise, callback, detail) { 14828 var hasCallback = isFunction(callback), 14829 value = void 0, 14830 error = void 0, 14831 succeeded = void 0, 14832 failed = void 0; 14833 14834 if (hasCallback) { 14835 value = tryCatch(callback, detail); 14836 14837 if (value === TRY_CATCH_ERROR) { 14838 failed = true; 14839 error = value.error; 14840 value.error = null; 14841 } else { 14842 succeeded = true; 14843 } 14844 14845 if (promise === value) { 14846 reject(promise, cannotReturnOwn()); 14847 return; 14848 } 14849 } else { 14850 value = detail; 14851 succeeded = true; 14852 } 14853 14854 if (promise._state !== PENDING) {// noop 14855 } else if (hasCallback && succeeded) { 14856 resolve(promise, value); 14857 } else if (failed) { 14858 reject(promise, error); 14859 } else if (settled === FULFILLED) { 14860 fulfill(promise, value); 14861 } else if (settled === REJECTED) { 14862 reject(promise, value); 14863 } 14864 } 14865 14866 function initializePromise(promise, resolver) { 14867 try { 14868 resolver(function resolvePromise(value) { 14869 resolve(promise, value); 14870 }, function rejectPromise(reason) { 14871 reject(promise, reason); 14872 }); 14873 } catch (e) { 14874 reject(promise, e); 14875 } 14876 } 14877 14878 var id = 0; 14879 14880 function nextId() { 14881 return id++; 14882 } 14883 14884 function makePromise(promise) { 14885 promise[PROMISE_ID] = id++; 14886 promise._state = undefined; 14887 promise._result = undefined; 14888 promise._subscribers = []; 14889 } 14890 14891 function validationError() { 14892 return new Error('Array Methods must be provided an Array'); 14893 } 14894 14895 var Enumerator = function () { 14896 function Enumerator(Constructor, input) { 14897 this._instanceConstructor = Constructor; 14898 this.promise = new Constructor(noop); 14899 14900 if (!this.promise[PROMISE_ID]) { 14901 makePromise(this.promise); 14902 } 14903 14904 if (isArray(input)) { 14905 this.length = input.length; 14906 this._remaining = input.length; 14907 this._result = new Array(this.length); 14908 14909 if (this.length === 0) { 14910 fulfill(this.promise, this._result); 14911 } else { 14912 this.length = this.length || 0; 14913 14914 this._enumerate(input); 14915 14916 if (this._remaining === 0) { 14917 fulfill(this.promise, this._result); 14918 } 14919 } 14920 } else { 14921 reject(this.promise, validationError()); 14922 } 14923 } 14924 14925 Enumerator.prototype._enumerate = function _enumerate(input) { 14926 for (var i = 0; this._state === PENDING && i < input.length; i++) { 14927 this._eachEntry(input[i], i); 14928 } 14929 }; 14930 14931 Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { 14932 var c = this._instanceConstructor; 14933 var resolve$$1 = c.resolve; 14934 14935 if (resolve$$1 === resolve$1) { 14936 var _then = getThen(entry); 14937 14938 if (_then === then && entry._state !== PENDING) { 14939 this._settledAt(entry._state, i, entry._result); 14940 } else if (typeof _then !== 'function') { 14941 this._remaining--; 14942 this._result[i] = entry; 14943 } else if (c === Promise$1) { 14944 var promise = new c(noop); 14945 handleMaybeThenable(promise, entry, _then); 14946 14947 this._willSettleAt(promise, i); 14948 } else { 14949 this._willSettleAt(new c(function (resolve$$1) { 14950 return resolve$$1(entry); 14951 }), i); 14952 } 14953 } else { 14954 this._willSettleAt(resolve$$1(entry), i); 14955 } 14956 }; 14957 14958 Enumerator.prototype._settledAt = function _settledAt(state, i, value) { 14959 var promise = this.promise; 14960 14961 if (promise._state === PENDING) { 14962 this._remaining--; 14963 14964 if (state === REJECTED) { 14965 reject(promise, value); 14966 } else { 14967 this._result[i] = value; 14968 } 14969 } 14970 14971 if (this._remaining === 0) { 14972 fulfill(promise, this._result); 14973 } 14974 }; 14975 14976 Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { 14977 var enumerator = this; 14978 subscribe(promise, undefined, function (value) { 14979 return enumerator._settledAt(FULFILLED, i, value); 14980 }, function (reason) { 14981 return enumerator._settledAt(REJECTED, i, reason); 14982 }); 14983 }; 14984 14985 return Enumerator; 14986 }(); 14987 /** 14988 `Promise.all` accepts an array of promises, and returns a new promise which 14989 is fulfilled with an array of fulfillment values for the passed promises, or 14990 rejected with the reason of the first passed promise to be rejected. It casts all 14991 elements of the passed iterable to promises as it runs this algorithm. 14992 14993 Example: 14994 14995 ```javascript 14996 let promise1 = resolve(1); 14997 let promise2 = resolve(2); 14998 let promise3 = resolve(3); 14999 let promises = [ promise1, promise2, promise3 ]; 15000 15001 Promise.all(promises).then(function(array){ 15002 // The array here would be [ 1, 2, 3 ]; 15003 }); 15004 ``` 15005 15006 If any of the `promises` given to `all` are rejected, the first promise 15007 that is rejected will be given as an argument to the returned promises's 15008 rejection handler. For example: 15009 15010 Example: 15011 15012 ```javascript 15013 let promise1 = resolve(1); 15014 let promise2 = reject(new Error("2")); 15015 let promise3 = reject(new Error("3")); 15016 let promises = [ promise1, promise2, promise3 ]; 15017 15018 Promise.all(promises).then(function(array){ 15019 // Code here never runs because there are rejected promises! 15020 }, function(error) { 15021 // error.message === "2" 15022 }); 15023 ``` 15024 15025 @method all 15026 @static 15027 @param {Array} entries array of promises 15028 @param {String} label optional string for labeling the promise. 15029 Useful for tooling. 15030 @return {Promise} promise that is fulfilled when all `promises` have been 15031 fulfilled, or rejected if any of them become rejected. 15032 @static 15033 */ 15034 15035 15036 function all(entries) { 15037 return new Enumerator(this, entries).promise; 15038 } 15039 /** 15040 `Promise.race` returns a new promise which is settled in the same way as the 15041 first passed promise to settle. 15042 15043 Example: 15044 15045 ```javascript 15046 let promise1 = new Promise(function(resolve, reject){ 15047 setTimeout(function(){ 15048 resolve('promise 1'); 15049 }, 200); 15050 }); 15051 15052 let promise2 = new Promise(function(resolve, reject){ 15053 setTimeout(function(){ 15054 resolve('promise 2'); 15055 }, 100); 15056 }); 15057 15058 Promise.race([promise1, promise2]).then(function(result){ 15059 // result === 'promise 2' because it was resolved before promise1 15060 // was resolved. 15061 }); 15062 ``` 15063 15064 `Promise.race` is deterministic in that only the state of the first 15065 settled promise matters. For example, even if other promises given to the 15066 `promises` array argument are resolved, but the first settled promise has 15067 become rejected before the other promises became fulfilled, the returned 15068 promise will become rejected: 15069 15070 ```javascript 15071 let promise1 = new Promise(function(resolve, reject){ 15072 setTimeout(function(){ 15073 resolve('promise 1'); 15074 }, 200); 15075 }); 15076 15077 let promise2 = new Promise(function(resolve, reject){ 15078 setTimeout(function(){ 15079 reject(new Error('promise 2')); 15080 }, 100); 15081 }); 15082 15083 Promise.race([promise1, promise2]).then(function(result){ 15084 // Code here never runs 15085 }, function(reason){ 15086 // reason.message === 'promise 2' because promise 2 became rejected before 15087 // promise 1 became fulfilled 15088 }); 15089 ``` 15090 15091 An example real-world use case is implementing timeouts: 15092 15093 ```javascript 15094 Promise.race([ajax('foo.json'), timeout(5000)]) 15095 ``` 15096 15097 @method race 15098 @static 15099 @param {Array} promises array of promises to observe 15100 Useful for tooling. 15101 @return {Promise} a promise which settles in the same way as the first passed 15102 promise to settle. 15103 */ 15104 15105 15106 function race(entries) { 15107 /*jshint validthis:true */ 15108 var Constructor = this; 15109 15110 if (!isArray(entries)) { 15111 return new Constructor(function (_, reject) { 15112 return reject(new TypeError('You must pass an array to race.')); 15113 }); 15114 } else { 15115 return new Constructor(function (resolve, reject) { 15116 var length = entries.length; 15117 15118 for (var i = 0; i < length; i++) { 15119 Constructor.resolve(entries[i]).then(resolve, reject); 15120 } 15121 }); 15122 } 15123 } 15124 /** 15125 `Promise.reject` returns a promise rejected with the passed `reason`. 15126 It is shorthand for the following: 15127 15128 ```javascript 15129 let promise = new Promise(function(resolve, reject){ 15130 reject(new Error('WHOOPS')); 15131 }); 15132 15133 promise.then(function(value){ 15134 // Code here doesn't run because the promise is rejected! 15135 }, function(reason){ 15136 // reason.message === 'WHOOPS' 15137 }); 15138 ``` 15139 15140 Instead of writing the above, your code now simply becomes the following: 15141 15142 ```javascript 15143 let promise = Promise.reject(new Error('WHOOPS')); 15144 15145 promise.then(function(value){ 15146 // Code here doesn't run because the promise is rejected! 15147 }, function(reason){ 15148 // reason.message === 'WHOOPS' 15149 }); 15150 ``` 15151 15152 @method reject 15153 @static 15154 @param {Any} reason value that the returned promise will be rejected with. 15155 Useful for tooling. 15156 @return {Promise} a promise rejected with the given `reason`. 15157 */ 15158 15159 15160 function reject$1(reason) { 15161 /*jshint validthis:true */ 15162 var Constructor = this; 15163 var promise = new Constructor(noop); 15164 reject(promise, reason); 15165 return promise; 15166 } 15167 15168 function needsResolver() { 15169 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); 15170 } 15171 15172 function needsNew() { 15173 throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); 15174 } 15175 /** 15176 Promise objects represent the eventual result of an asynchronous operation. The 15177 primary way of interacting with a promise is through its `then` method, which 15178 registers callbacks to receive either a promise's eventual value or the reason 15179 why the promise cannot be fulfilled. 15180 15181 Terminology 15182 ----------- 15183 15184 - `promise` is an object or function with a `then` method whose behavior conforms to this specification. 15185 - `thenable` is an object or function that defines a `then` method. 15186 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). 15187 - `exception` is a value that is thrown using the throw statement. 15188 - `reason` is a value that indicates why a promise was rejected. 15189 - `settled` the final resting state of a promise, fulfilled or rejected. 15190 15191 A promise can be in one of three states: pending, fulfilled, or rejected. 15192 15193 Promises that are fulfilled have a fulfillment value and are in the fulfilled 15194 state. Promises that are rejected have a rejection reason and are in the 15195 rejected state. A fulfillment value is never a thenable. 15196 15197 Promises can also be said to *resolve* a value. If this value is also a 15198 promise, then the original promise's settled state will match the value's 15199 settled state. So a promise that *resolves* a promise that rejects will 15200 itself reject, and a promise that *resolves* a promise that fulfills will 15201 itself fulfill. 15202 15203 15204 Basic Usage: 15205 ------------ 15206 15207 ```js 15208 let promise = new Promise(function(resolve, reject) { 15209 // on success 15210 resolve(value); 15211 15212 // on failure 15213 reject(reason); 15214 }); 15215 15216 promise.then(function(value) { 15217 // on fulfillment 15218 }, function(reason) { 15219 // on rejection 15220 }); 15221 ``` 15222 15223 Advanced Usage: 15224 --------------- 15225 15226 Promises shine when abstracting away asynchronous interactions such as 15227 `XMLHttpRequest`s. 15228 15229 ```js 15230 function getJSON(url) { 15231 return new Promise(function(resolve, reject){ 15232 let xhr = new XMLHttpRequest(); 15233 15234 xhr.open('GET', url); 15235 xhr.onreadystatechange = handler; 15236 xhr.responseType = 'json'; 15237 xhr.setRequestHeader('Accept', 'application/json'); 15238 xhr.send(); 15239 15240 function handler() { 15241 if (this.readyState === this.DONE) { 15242 if (this.status === 200) { 15243 resolve(this.response); 15244 } else { 15245 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); 15246 } 15247 } 15248 }; 15249 }); 15250 } 15251 15252 getJSON('/posts.json').then(function(json) { 15253 // on fulfillment 15254 }, function(reason) { 15255 // on rejection 15256 }); 15257 ``` 15258 15259 Unlike callbacks, promises are great composable primitives. 15260 15261 ```js 15262 Promise.all([ 15263 getJSON('/posts'), 15264 getJSON('/comments') 15265 ]).then(function(values){ 15266 values[0] // => postsJSON 15267 values[1] // => commentsJSON 15268 15269 return values; 15270 }); 15271 ``` 15272 15273 @class Promise 15274 @param {Function} resolver 15275 Useful for tooling. 15276 @constructor 15277 */ 15278 15279 15280 var Promise$1 = function () { 15281 function Promise(resolver) { 15282 this[PROMISE_ID] = nextId(); 15283 this._result = this._state = undefined; 15284 this._subscribers = []; 15285 15286 if (noop !== resolver) { 15287 typeof resolver !== 'function' && needsResolver(); 15288 this instanceof Promise ? initializePromise(this, resolver) : needsNew(); 15289 } 15290 } 15291 /** 15292 The primary way of interacting with a promise is through its `then` method, 15293 which registers callbacks to receive either a promise's eventual value or the 15294 reason why the promise cannot be fulfilled. 15295 ```js 15296 findUser().then(function(user){ 15297 // user is available 15298 }, function(reason){ 15299 // user is unavailable, and you are given the reason why 15300 }); 15301 ``` 15302 Chaining 15303 -------- 15304 The return value of `then` is itself a promise. This second, 'downstream' 15305 promise is resolved with the return value of the first promise's fulfillment 15306 or rejection handler, or rejected if the handler throws an exception. 15307 ```js 15308 findUser().then(function (user) { 15309 return user.name; 15310 }, function (reason) { 15311 return 'default name'; 15312 }).then(function (userName) { 15313 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it 15314 // will be `'default name'` 15315 }); 15316 findUser().then(function (user) { 15317 throw new Error('Found user, but still unhappy'); 15318 }, function (reason) { 15319 throw new Error('`findUser` rejected and we're unhappy'); 15320 }).then(function (value) { 15321 // never reached 15322 }, function (reason) { 15323 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. 15324 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. 15325 }); 15326 ``` 15327 If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. 15328 ```js 15329 findUser().then(function (user) { 15330 throw new PedagogicalException('Upstream error'); 15331 }).then(function (value) { 15332 // never reached 15333 }).then(function (value) { 15334 // never reached 15335 }, function (reason) { 15336 // The `PedgagocialException` is propagated all the way down to here 15337 }); 15338 ``` 15339 Assimilation 15340 ------------ 15341 Sometimes the value you want to propagate to a downstream promise can only be 15342 retrieved asynchronously. This can be achieved by returning a promise in the 15343 fulfillment or rejection handler. The downstream promise will then be pending 15344 until the returned promise is settled. This is called *assimilation*. 15345 ```js 15346 findUser().then(function (user) { 15347 return findCommentsByAuthor(user); 15348 }).then(function (comments) { 15349 // The user's comments are now available 15350 }); 15351 ``` 15352 If the assimliated promise rejects, then the downstream promise will also reject. 15353 ```js 15354 findUser().then(function (user) { 15355 return findCommentsByAuthor(user); 15356 }).then(function (comments) { 15357 // If `findCommentsByAuthor` fulfills, we'll have the value here 15358 }, function (reason) { 15359 // If `findCommentsByAuthor` rejects, we'll have the reason here 15360 }); 15361 ``` 15362 Simple Example 15363 -------------- 15364 Synchronous Example 15365 ```javascript 15366 let result; 15367 try { 15368 result = findResult(); 15369 // success 15370 } catch(reason) { 15371 // failure 15372 } 15373 ``` 15374 Errback Example 15375 ```js 15376 findResult(function(result, err){ 15377 if (err) { 15378 // failure 15379 } else { 15380 // success 15381 } 15382 }); 15383 ``` 15384 Promise Example; 15385 ```javascript 15386 findResult().then(function(result){ 15387 // success 15388 }, function(reason){ 15389 // failure 15390 }); 15391 ``` 15392 Advanced Example 15393 -------------- 15394 Synchronous Example 15395 ```javascript 15396 let author, books; 15397 try { 15398 author = findAuthor(); 15399 books = findBooksByAuthor(author); 15400 // success 15401 } catch(reason) { 15402 // failure 15403 } 15404 ``` 15405 Errback Example 15406 ```js 15407 function foundBooks(books) { 15408 } 15409 function failure(reason) { 15410 } 15411 findAuthor(function(author, err){ 15412 if (err) { 15413 failure(err); 15414 // failure 15415 } else { 15416 try { 15417 findBoooksByAuthor(author, function(books, err) { 15418 if (err) { 15419 failure(err); 15420 } else { 15421 try { 15422 foundBooks(books); 15423 } catch(reason) { 15424 failure(reason); 15425 } 15426 } 15427 }); 15428 } catch(error) { 15429 failure(err); 15430 } 15431 // success 15432 } 15433 }); 15434 ``` 15435 Promise Example; 15436 ```javascript 15437 findAuthor(). 15438 then(findBooksByAuthor). 15439 then(function(books){ 15440 // found books 15441 }).catch(function(reason){ 15442 // something went wrong 15443 }); 15444 ``` 15445 @method then 15446 @param {Function} onFulfilled 15447 @param {Function} onRejected 15448 Useful for tooling. 15449 @return {Promise} 15450 */ 15451 15452 /** 15453 `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same 15454 as the catch block of a try/catch statement. 15455 ```js 15456 function findAuthor(){ 15457 throw new Error('couldn't find that author'); 15458 } 15459 // synchronous 15460 try { 15461 findAuthor(); 15462 } catch(reason) { 15463 // something went wrong 15464 } 15465 // async with promises 15466 findAuthor().catch(function(reason){ 15467 // something went wrong 15468 }); 15469 ``` 15470 @method catch 15471 @param {Function} onRejection 15472 Useful for tooling. 15473 @return {Promise} 15474 */ 15475 15476 15477 Promise.prototype.catch = function _catch(onRejection) { 15478 return this.then(null, onRejection); 15479 }; 15480 /** 15481 `finally` will be invoked regardless of the promise's fate just as native 15482 try/catch/finally behaves 15483 15484 Synchronous example: 15485 15486 ```js 15487 findAuthor() { 15488 if (Math.random() > 0.5) { 15489 throw new Error(); 15490 } 15491 return new Author(); 15492 } 15493 15494 try { 15495 return findAuthor(); // succeed or fail 15496 } catch(error) { 15497 return findOtherAuther(); 15498 } finally { 15499 // always runs 15500 // doesn't affect the return value 15501 } 15502 ``` 15503 15504 Asynchronous example: 15505 15506 ```js 15507 findAuthor().catch(function(reason){ 15508 return findOtherAuther(); 15509 }).finally(function(){ 15510 // author was either found, or not 15511 }); 15512 ``` 15513 15514 @method finally 15515 @param {Function} callback 15516 @return {Promise} 15517 */ 15518 15519 15520 Promise.prototype.finally = function _finally(callback) { 15521 var promise = this; 15522 var constructor = promise.constructor; 15523 15524 if (isFunction(callback)) { 15525 return promise.then(function (value) { 15526 return constructor.resolve(callback()).then(function () { 15527 return value; 15528 }); 15529 }, function (reason) { 15530 return constructor.resolve(callback()).then(function () { 15531 throw reason; 15532 }); 15533 }); 15534 } 15535 15536 return promise.then(callback, callback); 15537 }; 15538 15539 return Promise; 15540 }(); 15541 15542 Promise$1.prototype.then = then; 15543 Promise$1.all = all; 15544 Promise$1.race = race; 15545 Promise$1.resolve = resolve$1; 15546 Promise$1.reject = reject$1; 15547 Promise$1._setScheduler = setScheduler; 15548 Promise$1._setAsap = setAsap; 15549 Promise$1._asap = asap; 15550 /*global self*/ 15551 15552 function polyfill() { 15553 var local = void 0; 15554 15555 if (typeof global !== 'undefined') { 15556 local = global; 15557 } else if (typeof self !== 'undefined') { 15558 local = self; 15559 } else { 15560 try { 15561 local = Function('return this')(); 15562 } catch (e) { 15563 throw new Error('polyfill failed because global object is unavailable in this environment'); 15564 } 15565 } 15566 15567 var P = local.Promise; 15568 15569 if (P) { 15570 var promiseToString = null; 15571 15572 try { 15573 promiseToString = Object.prototype.toString.call(P.resolve()); 15574 } catch (e) {// silently ignored 15575 } 15576 15577 if (promiseToString === '[object Promise]' && !P.cast) { 15578 return; 15579 } 15580 } 15581 15582 local.Promise = Promise$1; 15583 } // Strange compat.. 15584 15585 15586 Promise$1.polyfill = polyfill; 15587 Promise$1.Promise = Promise$1; 15588 return Promise$1; 15589 }); 15590 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 15591 15592 /***/ }), 15593 15594 /***/ "./node_modules/process/browser.js": 15595 /*!*****************************************!*\ 15596 !*** ./node_modules/process/browser.js ***! 15597 \*****************************************/ 15598 /*! no static exports found */ 15599 /***/ (function(module, exports) { 15600 15601 // shim for using process in browser 15602 var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it 15603 // don't break things. But we need to wrap it in a try catch in case it is 15604 // wrapped in strict mode code which doesn't define any globals. It's inside a 15605 // function because try/catches deoptimize in certain engines. 15606 15607 var cachedSetTimeout; 15608 var cachedClearTimeout; 15609 15610 function defaultSetTimout() { 15611 throw new Error('setTimeout has not been defined'); 15612 } 15613 15614 function defaultClearTimeout() { 15615 throw new Error('clearTimeout has not been defined'); 15616 } 15617 15618 (function () { 15619 try { 15620 if (typeof setTimeout === 'function') { 15621 cachedSetTimeout = setTimeout; 15622 } else { 15623 cachedSetTimeout = defaultSetTimout; 15624 } 15625 } catch (e) { 15626 cachedSetTimeout = defaultSetTimout; 15627 } 15628 15629 try { 15630 if (typeof clearTimeout === 'function') { 15631 cachedClearTimeout = clearTimeout; 15632 } else { 15633 cachedClearTimeout = defaultClearTimeout; 15634 } 15635 } catch (e) { 15636 cachedClearTimeout = defaultClearTimeout; 15637 } 15638 })(); 15639 15640 function runTimeout(fun) { 15641 if (cachedSetTimeout === setTimeout) { 15642 //normal enviroments in sane situations 15643 return setTimeout(fun, 0); 15644 } // if setTimeout wasn't available but was latter defined 15645 15646 15647 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 15648 cachedSetTimeout = setTimeout; 15649 return setTimeout(fun, 0); 15650 } 15651 15652 try { 15653 // when when somebody has screwed with setTimeout but no I.E. maddness 15654 return cachedSetTimeout(fun, 0); 15655 } catch (e) { 15656 try { 15657 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 15658 return cachedSetTimeout.call(null, fun, 0); 15659 } catch (e) { 15660 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 15661 return cachedSetTimeout.call(this, fun, 0); 15662 } 15663 } 15664 } 15665 15666 function runClearTimeout(marker) { 15667 if (cachedClearTimeout === clearTimeout) { 15668 //normal enviroments in sane situations 15669 return clearTimeout(marker); 15670 } // if clearTimeout wasn't available but was latter defined 15671 15672 15673 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 15674 cachedClearTimeout = clearTimeout; 15675 return clearTimeout(marker); 15676 } 15677 15678 try { 15679 // when when somebody has screwed with setTimeout but no I.E. maddness 15680 return cachedClearTimeout(marker); 15681 } catch (e) { 15682 try { 15683 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 15684 return cachedClearTimeout.call(null, marker); 15685 } catch (e) { 15686 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 15687 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 15688 return cachedClearTimeout.call(this, marker); 15689 } 15690 } 15691 } 15692 15693 var queue = []; 15694 var draining = false; 15695 var currentQueue; 15696 var queueIndex = -1; 15697 15698 function cleanUpNextTick() { 15699 if (!draining || !currentQueue) { 15700 return; 15701 } 15702 15703 draining = false; 15704 15705 if (currentQueue.length) { 15706 queue = currentQueue.concat(queue); 15707 } else { 15708 queueIndex = -1; 15709 } 15710 15711 if (queue.length) { 15712 drainQueue(); 15713 } 15714 } 15715 15716 function drainQueue() { 15717 if (draining) { 15718 return; 15719 } 15720 15721 var timeout = runTimeout(cleanUpNextTick); 15722 draining = true; 15723 var len = queue.length; 15724 15725 while (len) { 15726 currentQueue = queue; 15727 queue = []; 15728 15729 while (++queueIndex < len) { 15730 if (currentQueue) { 15731 currentQueue[queueIndex].run(); 15732 } 15733 } 15734 15735 queueIndex = -1; 15736 len = queue.length; 15737 } 15738 15739 currentQueue = null; 15740 draining = false; 15741 runClearTimeout(timeout); 15742 } 15743 15744 process.nextTick = function (fun) { 15745 var args = new Array(arguments.length - 1); 15746 15747 if (arguments.length > 1) { 15748 for (var i = 1; i < arguments.length; i++) { 15749 args[i - 1] = arguments[i]; 15750 } 15751 } 15752 15753 queue.push(new Item(fun, args)); 15754 15755 if (queue.length === 1 && !draining) { 15756 runTimeout(drainQueue); 15757 } 15758 }; // v8 likes predictible objects 15759 15760 15761 function Item(fun, array) { 15762 this.fun = fun; 15763 this.array = array; 15764 } 15765 15766 Item.prototype.run = function () { 15767 this.fun.apply(null, this.array); 15768 }; 15769 15770 process.title = 'browser'; 15771 process.browser = true; 15772 process.env = {}; 15773 process.argv = []; 15774 process.version = ''; // empty string to avoid regexp issues 15775 15776 process.versions = {}; 15777 15778 function noop() {} 15779 15780 process.on = noop; 15781 process.addListener = noop; 15782 process.once = noop; 15783 process.off = noop; 15784 process.removeListener = noop; 15785 process.removeAllListeners = noop; 15786 process.emit = noop; 15787 process.prependListener = noop; 15788 process.prependOnceListener = noop; 15789 15790 process.listeners = function (name) { 15791 return []; 15792 }; 15793 15794 process.binding = function (name) { 15795 throw new Error('process.binding is not supported'); 15796 }; 15797 15798 process.cwd = function () { 15799 return '/'; 15800 }; 15801 15802 process.chdir = function (dir) { 15803 throw new Error('process.chdir is not supported'); 15804 }; 15805 15806 process.umask = function () { 15807 return 0; 15808 }; 15809 15810 /***/ }), 15811 15812 /***/ "./node_modules/webpack/buildin/global.js": 15813 /*!***********************************!*\ 15814 !*** (webpack)/buildin/global.js ***! 15815 \***********************************/ 15816 /*! no static exports found */ 15817 /***/ (function(module, exports) { 15818 15819 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 15820 15821 var g; // This works in non-strict mode 15822 15823 g = function () { 15824 return this; 15825 }(); 15826 15827 try { 15828 // This works if eval is allowed (see CSP) 15829 g = g || new Function("return this")(); 15830 } catch (e) { 15831 // This works if the window reference is available 15832 if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window; 15833 } // g can still be undefined, but nothing to do about it... 15834 // We return undefined, instead of nothing here, so it's 15835 // easier to handle this case. if(!global) { ...} 15836 15837 15838 module.exports = g; 15839 15840 /***/ }), 15841 15842 /***/ 1: 15843 /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\ 15844 !*** multi ../assets/js/libs/fixto.js ../assets/js/libs/jquery.backstretch.js ../assets/js/libs/typed.js ../assets/js/kube.js ../assets/js/smoothscroll.js ../assets/js/drop_menu_selection.js ../assets/js/sticky.js ../assets/js/video-bg.js ./js/theme.js ../assets/js/woo.js ***! 15845 \***********************************************************************************************************************************************************************************************************************************************************************************/ 15846 /*! no static exports found */ 15847 /***/ (function(module, exports, __webpack_require__) { 15848 15849 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/libs/fixto.js */"../assets/js/libs/fixto.js"); 15850 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/libs/jquery.backstretch.js */"../assets/js/libs/jquery.backstretch.js"); 15851 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/libs/typed.js */"../assets/js/libs/typed.js"); 15852 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/kube.js */"../assets/js/kube.js"); 15853 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/smoothscroll.js */"../assets/js/smoothscroll.js"); 15854 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/drop_menu_selection.js */"../assets/js/drop_menu_selection.js"); 15855 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/sticky.js */"../assets/js/sticky.js"); 15856 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/video-bg.js */"../assets/js/video-bg.js"); 15857 __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/dev/js/theme.js */"./js/theme.js"); 15858 module.exports = __webpack_require__(/*! /var/lib/jenkins/workspace/Materialis FREE Release/build-materialis/materialis/assets/js/woo.js */"../assets/js/woo.js"); 15859 15860 15861 /***/ }) 15862 15863 /******/ }); 15864 //# sourceMappingURL=theme.bundle.js.map