mdc.min.js 50 KB

1
  1. "use strict";var _get=function t(e,n,i){null===e&&(e=Function.prototype);var a=Object.getOwnPropertyDescriptor(e,n);if(void 0===a){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,n,i)}if("value"in a)return a.value;var s=a.get;return void 0!==s?s.call(i):void 0},_createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var mdc=function(t){var e=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,t),this.adapter_=e}return _createClass(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),_createClass(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}(),n=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;_classCallCheck(this,t),this.root_=e;for(var i=arguments.length,a=Array(i>2?i-2:0),r=2;r<i;r++)a[r-2]=arguments[r];this.initialize.apply(this,a),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return _createClass(t,null,[{key:"attachTo",value:function(n){return new t(n,new e)}}]),_createClass(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root_.dispatchEvent(i)}}]),t}(),i={ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded",BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation"},a={VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end"},r={PADDING:10,INITIAL_ORIGIN_SCALE:.6,DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,TAP_DELAY_MS:300},s=void 0,o=void 0;function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===o||e){var n=!1;try{t.document.addEventListener("test",null,{get passive(){n=!0}})}catch(t){}o=n}return!!o&&{passive:!0}}function c(t){return["webkitMatchesSelector","msMatchesSelector","matches"].filter(function(e){return e in t}).pop()}var l=["touchstart","pointerdown","mousedown","keydown"],d=["touchend","pointerup","mouseup"],_=[],h=function(t){function n(t){_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.layoutFrame_=0,e.frame_={width:0,height:0},e.activationState_=e.defaultActivationState_(),e.initialSize_=0,e.maxRadius_=0,e.activateHandler_=function(t){return e.activate_(t)},e.deactivateHandler_=function(t){return e.deactivate_(t)},e.focusHandler_=function(){return requestAnimationFrame(function(){return e.adapter_.addClass(n.cssClasses.BG_FOCUSED)})},e.blurHandler_=function(){return requestAnimationFrame(function(){return e.adapter_.removeClass(n.cssClasses.BG_FOCUSED)})},e.resizeHandler_=function(){return e.layout()},e.unboundedCoords_={left:0,top:0},e.fgScale_=0,e.activationTimer_=0,e.fgDeactivationRemovalTimer_=0,e.activationAnimationHasEnded_=!1,e.activationTimerCallback_=function(){e.activationAnimationHasEnded_=!0,e.runDeactivationUXLogicIfReady_()},e.previousActivationEvent_=null,e}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return i}},{key:"strings",get:function(){return a}},{key:"numbers",get:function(){return r}},{key:"defaultAdapter",get:function(){return{browserSupportsCssVars:function(){},isUnbounded:function(){},isSurfaceActive:function(){},isSurfaceDisabled:function(){},addClass:function(){},removeClass:function(){},containsEventTarget:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerDocumentInteractionHandler:function(){},deregisterDocumentInteractionHandler:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},updateCssVariable:function(){},computeBoundingRect:function(){},getWindowPageOffset:function(){}}}}]),_createClass(n,[{key:"isSupported_",value:function(){return this.adapter_.browserSupportsCssVars()}},{key:"defaultActivationState_",value:function(){return{isActivated:!1,hasDeactivationUXRun:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1,activationEvent:null,isProgrammatic:!1}}},{key:"init",value:function(){var t=this;if(this.isSupported_()){this.registerRootHandlers_();var e=n.cssClasses,i=e.ROOT,a=e.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.addClass(i),t.adapter_.isUnbounded()&&t.adapter_.addClass(a),t.layoutInternal_()})}}},{key:"destroy",value:function(){var t=this;if(this.isSupported_()){if(this.activationTimer_){clearTimeout(this.activationTimer_),this.activationTimer_=0;var e=n.cssClasses.FG_ACTIVATION;this.adapter_.removeClass(e)}this.deregisterRootHandlers_(),this.deregisterDeactivationHandlers_();var i=n.cssClasses,a=i.ROOT,r=i.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.removeClass(a),t.adapter_.removeClass(r),t.removeCssVars_()})}}},{key:"registerRootHandlers_",value:function(){var t=this;l.forEach(function(e){t.adapter_.registerInteractionHandler(e,t.activateHandler_)}),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_),this.adapter_.registerResizeHandler(this.resizeHandler_)}},{key:"registerDeactivationHandlers_",value:function(t){var e=this;"keydown"===t.type?this.adapter_.registerInteractionHandler("keyup",this.deactivateHandler_):d.forEach(function(t){e.adapter_.registerDocumentInteractionHandler(t,e.deactivateHandler_)})}},{key:"deregisterRootHandlers_",value:function(){var t=this;l.forEach(function(e){t.adapter_.deregisterInteractionHandler(e,t.activateHandler_)}),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.deregisterResizeHandler(this.resizeHandler_)}},{key:"deregisterDeactivationHandlers_",value:function(){var t=this;this.adapter_.deregisterInteractionHandler("keyup",this.deactivateHandler_),d.forEach(function(e){t.adapter_.deregisterDocumentInteractionHandler(e,t.deactivateHandler_)})}},{key:"removeCssVars_",value:function(){var t=this,e=n.strings;Object.keys(e).forEach(function(n){0===n.indexOf("VAR_")&&t.adapter_.updateCssVariable(e[n],null)})}},{key:"activate_",value:function(t){var e=this;if(!this.adapter_.isSurfaceDisabled()){var n=this.activationState_;if(!n.isActivated){var i=this.previousActivationEvent_;if(!(i&&t&&i.type!==t.type))n.isActivated=!0,n.isProgrammatic=null===t,n.activationEvent=t,n.wasActivatedByPointer=!n.isProgrammatic&&("mousedown"===t.type||"touchstart"===t.type||"pointerdown"===t.type),t&&_.length>0&&_.some(function(t){return e.adapter_.containsEventTarget(t)})?this.resetActivationState_():(t&&(_.push(t.target),this.registerDeactivationHandlers_(t)),requestAnimationFrame(function(){n.wasElementMadeActive=!t||"keydown"!==t.type||e.adapter_.isSurfaceActive(),n.wasElementMadeActive?e.animateActivation_():e.activationState_=e.defaultActivationState_(),_=[]}))}}}},{key:"activate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.activate_(t)}},{key:"animateActivation_",value:function(){var t=this,e=n.strings,i=e.VAR_FG_TRANSLATE_START,a=e.VAR_FG_TRANSLATE_END,r=n.cssClasses,s=r.FG_DEACTIVATION,o=r.FG_ACTIVATION,u=n.numbers.DEACTIVATION_TIMEOUT_MS,c="",l="";if(!this.adapter_.isUnbounded()){var d=this.getFgTranslationCoordinates_(),_=d.startPoint,h=d.endPoint;c=_.x+"px, "+_.y+"px",l=h.x+"px, "+h.y+"px"}this.adapter_.updateCssVariable(i,c),this.adapter_.updateCssVariable(a,l),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(s),this.adapter_.computeBoundingRect(),this.adapter_.addClass(o),this.activationTimer_=setTimeout(function(){return t.activationTimerCallback_()},u)}},{key:"getFgTranslationCoordinates_",value:function(){var t,e,n,i,a,r,s,o,u,c=this.activationState_,l=c.activationEvent,d=void 0;return c.wasActivatedByPointer?(t=l,e=this.adapter_.getWindowPageOffset(),n=this.adapter_.computeBoundingRect(),i=e.x,a=e.y,r=i+n.left,s=a+n.top,o=void 0,u=void 0,"touchstart"===t.type?(o=t.changedTouches[0].pageX-r,u=t.changedTouches[0].pageY-s):(o=t.pageX-r,u=t.pageY-s),d={x:o,y:u}):d={x:this.frame_.width/2,y:this.frame_.height/2},{startPoint:d={x:d.x-this.initialSize_/2,y:d.y-this.initialSize_/2},endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}}},{key:"runDeactivationUXLogicIfReady_",value:function(){var t=this,e=n.cssClasses.FG_DEACTIVATION,i=this.activationState_,a=i.hasDeactivationUXRun,s=i.isActivated;(a||!s)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(e),this.fgDeactivationRemovalTimer_=setTimeout(function(){t.adapter_.removeClass(e)},r.FG_DEACTIVATION_MS))}},{key:"rmBoundedActivationClasses_",value:function(){var t=n.cssClasses.FG_ACTIVATION;this.adapter_.removeClass(t),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()}},{key:"resetActivationState_",value:function(){var t=this;this.previousActivationEvent_=this.activationState_.activationEvent,this.activationState_=this.defaultActivationState_(),setTimeout(function(){return t.previousActivationEvent_=null},n.numbers.TAP_DELAY_MS)}},{key:"deactivate_",value:function(t){var e=this,n=this.activationState_;if(n.isActivated){var i=Object.assign({},n);if(n.isProgrammatic){requestAnimationFrame(function(){return e.animateDeactivation_(null,i)}),this.resetActivationState_()}else this.deregisterDeactivationHandlers_(),requestAnimationFrame(function(){e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(t,i),e.resetActivationState_()})}}},{key:"deactivate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.deactivate_(t)}},{key:"animateDeactivation_",value:function(t,e){var n=e.wasActivatedByPointer,i=e.wasElementMadeActive;(n||i)&&this.runDeactivationUXLogicIfReady_()}},{key:"layout",value:function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){t.layoutInternal_(),t.layoutFrame_=0})}},{key:"layoutInternal_",value:function(){var t=this;this.frame_=this.adapter_.computeBoundingRect();var e=Math.max(this.frame_.height,this.frame_.width);this.maxRadius_=this.adapter_.isUnbounded()?e:Math.sqrt(Math.pow(t.frame_.width,2)+Math.pow(t.frame_.height,2))+n.numbers.PADDING,this.initialSize_=e*n.numbers.INITIAL_ORIGIN_SCALE,this.fgScale_=this.maxRadius_/this.initialSize_,this.updateLayoutCssVars_()}},{key:"updateLayoutCssVars_",value:function(){var t=n.strings,e=t.VAR_FG_SIZE,i=t.VAR_LEFT,a=t.VAR_TOP,r=t.VAR_FG_SCALE;this.adapter_.updateCssVariable(e,this.initialSize_+"px"),this.adapter_.updateCssVariable(r,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(i,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(a,this.unboundedCoords_.top+"px"))}},{key:"setUnbounded",value:function(t){var e=n.cssClasses.UNBOUNDED;t?this.adapter_.addClass(e):this.adapter_.removeClass(e)}}]),n}(),f=function(t){function e(){var t;_classCallCheck(this,e);for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];var r=_possibleConstructorReturn(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(i)));return r.disabled=!1,r.unbounded_,r}return _inherits(e,n),_createClass(e,[{key:"setUnbounded_",value:function(){this.foundation_.setUnbounded(this.unbounded_)}},{key:"activate",value:function(){this.foundation_.activate()}},{key:"deactivate",value:function(){this.foundation_.deactivate()}},{key:"layout",value:function(){this.foundation_.layout()}},{key:"getDefaultFoundation",value:function(){return new h(e.createAdapter(this))}},{key:"initialSyncWithDOM",value:function(){this.unbounded="mdcRippleIsUnbounded"in this.root_.dataset}},{key:"unbounded",get:function(){return this.unbounded_},set:function(t){this.unbounded_=Boolean(t),this.setUnbounded_()}}],[{key:"attachTo",value:function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isUnbounded,i=void 0===n?void 0:n,a=new e(t);return void 0!==i&&(a.unbounded=i),a}},{key:"createAdapter",value:function(t){var e=c(HTMLElement.prototype);return{browserSupportsCssVars:function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=s;if("boolean"==typeof s&&!e)return n;if(t.CSS&&"function"==typeof t.CSS.supports){var i=t.CSS.supports("--css-vars","yes"),a=t.CSS.supports("(--css-vars: yes)")&&t.CSS.supports("color","#00000000");return n=!(!i&&!a||function(t){var e=t.document,n=e.createElement("div");n.className="mdc-ripple-surface--test-edge-var-bug",e.body.appendChild(n);var i=t.getComputedStyle(n),a=null!==i&&"solid"===i.borderTopStyle;return n.remove(),a}(t)),e||(s=n),n}}(window)},isUnbounded:function(){return t.unbounded},isSurfaceActive:function(){return t.root_[e](":active")},isSurfaceDisabled:function(){return t.disabled},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},containsEventTarget:function(e){return t.root_.contains(e)},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n,u())},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n,u())},registerDocumentInteractionHandler:function(t,e){return document.documentElement.addEventListener(t,e,u())},deregisterDocumentInteractionHandler:function(t,e){return document.documentElement.removeEventListener(t,e,u())},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},updateCssVariable:function(e,n){return t.root_.style.setProperty(e,n)},computeBoundingRect:function(){return t.root_.getBoundingClientRect()},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}}}}]),e}(),p=function t(){_classCallCheck(this,t)};p.prototype.root_,p.prototype.unbounded,p.prototype.disabled;var v={ACTIVE:"mdc-tab--active"},y={SELECTED_EVENT:"MDCTab:selected"},g=function(t){function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.computedWidth_=0,e.computedLeft_=0,e.isActive_=!1,e.preventDefaultOnClick_=!1,e.clickHandler_=function(t){e.preventDefaultOnClick_&&t.preventDefault(),e.adapter_.notifySelected()},e.keydownHandler_=function(t){(t.key&&"Enter"===t.key||13===t.keyCode)&&e.adapter_.notifySelected()},e}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return v}},{key:"strings",get:function(){return y}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},getOffsetWidth:function(){return 0},getOffsetLeft:function(){return 0},notifySelected:function(){}}}}]),_createClass(n,[{key:"init",value:function(){this.adapter_.registerInteractionHandler("click",this.clickHandler_),this.adapter_.registerInteractionHandler("keydown",this.keydownHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterInteractionHandler("click",this.clickHandler_),this.adapter_.deregisterInteractionHandler("keydown",this.keydownHandler_)}},{key:"getComputedWidth",value:function(){return this.computedWidth_}},{key:"getComputedLeft",value:function(){return this.computedLeft_}},{key:"isActive",value:function(){return this.isActive_}},{key:"setActive",value:function(t){this.isActive_=t,this.isActive_?this.adapter_.addClass(v.ACTIVE):this.adapter_.removeClass(v.ACTIVE)}},{key:"preventsDefaultOnClick",value:function(){return this.preventDefaultOnClick_}},{key:"setPreventDefaultOnClick",value:function(t){this.preventDefaultOnClick_=t}},{key:"measureSelf",value:function(){this.computedWidth_=this.adapter_.getOffsetWidth(),this.computedLeft_=this.adapter_.getOffsetLeft()}}]),n}(),C=function(t){function e(){var t;_classCallCheck(this,e);for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];var r=_possibleConstructorReturn(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(i)));return r.ripple_=f.attachTo(r.root_),r}return _inherits(e,n),_createClass(e,[{key:"computedWidth",get:function(){return this.foundation_.getComputedWidth()}},{key:"computedLeft",get:function(){return this.foundation_.getComputedLeft()}},{key:"isActive",get:function(){return this.foundation_.isActive()},set:function(t){this.foundation_.setActive(t)}},{key:"preventDefaultOnClick",get:function(){return this.foundation_.preventsDefaultOnClick()},set:function(t){this.foundation_.setPreventDefaultOnClick(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),_createClass(e,[{key:"destroy",value:function(){this.ripple_.destroy(),_get(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"getDefaultFoundation",value:function(){var t=this;return new g({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)},getOffsetWidth:function(){return t.root_.offsetWidth},getOffsetLeft:function(){return t.root_.offsetLeft},notifySelected:function(){return t.emit(g.strings.SELECTED_EVENT,{tab:t},!0)}})}},{key:"initialSyncWithDOM",value:function(){this.isActive=this.root_.classList.contains(v.ACTIVE)}},{key:"measureSelf",value:function(){this.foundation_.measureSelf()}}]),e}(),m={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},b={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}};function E(t,e){if(void 0===(i=t).document||"function"!=typeof i.document.createElement||!((n=e)in m||n in b))return e;var n,i,a,r,s,o=e in m?m:b,u=t.document.createElement("div"),c="";return o===m?(s=u,c=(r=o)[a=e].styleProperty in s.style?r[a].noPrefix:r[a].webkitPrefix):c=o[e].noPrefix in u.style?o[e].noPrefix:o[e].webkitPrefix,c}var A={UPGRADED:"mdc-tab-bar-upgraded"},k={TAB_SELECTOR:".mdc-tab",INDICATOR_SELECTOR:".mdc-tab-bar__indicator",CHANGE_EVENT:"MDCTabBar:change"},I=function(t){function n(t){_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.isIndicatorShown_=!1,e.computedWidth_=0,e.computedLeft_=0,e.activeTabIndex_=0,e.layoutFrame_=0,e.resizeHandler_=function(){return e.layout()},e}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return A}},{key:"strings",get:function(){return k}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},bindOnMDCTabSelectedEvent:function(){},unbindOnMDCTabSelectedEvent:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},getOffsetWidth:function(){return 0},setStyleForIndicator:function(){},getOffsetWidthForIndicator:function(){return 0},notifyChange:function(){},getNumberOfTabs:function(){return 0},isTabActiveAtIndex:function(){return!1},setTabActiveAtIndex:function(){},isDefaultPreventedOnClickForTabAtIndex:function(){return!1},setPreventDefaultOnClickForTabAtIndex:function(){},measureTabAtIndex:function(){},getComputedWidthForTabAtIndex:function(){return 0},getComputedLeftForTabAtIndex:function(){return 0}}}}]),_createClass(n,[{key:"init",value:function(){this.adapter_.addClass(A.UPGRADED),this.adapter_.bindOnMDCTabSelectedEvent(),this.adapter_.registerResizeHandler(this.resizeHandler_);var t=this.findActiveTabIndex_();t>=0&&(this.activeTabIndex_=t),this.layout()}},{key:"destroy",value:function(){this.adapter_.removeClass(A.UPGRADED),this.adapter_.unbindOnMDCTabSelectedEvent(),this.adapter_.deregisterResizeHandler(this.resizeHandler_)}},{key:"layoutInternal_",value:function(){var t=this;this.forEachTabIndex_(function(e){return t.adapter_.measureTabAtIndex(e)}),this.computedWidth_=this.adapter_.getOffsetWidth(),this.layoutIndicator_()}},{key:"layoutIndicator_",value:function(){var t=!this.isIndicatorShown_;t&&this.adapter_.setStyleForIndicator("transition","none");var e="translateX("+this.adapter_.getComputedLeftForTabAtIndex(this.activeTabIndex_)+"px) scale("+this.adapter_.getComputedWidthForTabAtIndex(this.activeTabIndex_)/this.adapter_.getOffsetWidth()+", 1)";this.adapter_.setStyleForIndicator(E(window,"transform"),e),t&&(this.adapter_.getOffsetWidthForIndicator(),this.adapter_.setStyleForIndicator("transition",""),this.adapter_.setStyleForIndicator("visibility","visible"),this.isIndicatorShown_=!0)}},{key:"findActiveTabIndex_",value:function(){var t=this,e=-1;return this.forEachTabIndex_(function(n){if(t.adapter_.isTabActiveAtIndex(n))return e=n,!0}),e}},{key:"forEachTabIndex_",value:function(t){for(var e=this.adapter_.getNumberOfTabs(),n=0;n<e;n++){if(t(n))break}}},{key:"layout",value:function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){t.layoutInternal_(),t.layoutFrame_=0})}},{key:"switchToTabAtIndex",value:function(t,e){var n=this;if(t!==this.activeTabIndex_){if(t<0||t>=this.adapter_.getNumberOfTabs())throw new Error("Out of bounds index specified for tab: "+t);var i=this.activeTabIndex_;this.activeTabIndex_=t,requestAnimationFrame(function(){i>=0&&n.adapter_.setTabActiveAtIndex(i,!1),n.adapter_.setTabActiveAtIndex(n.activeTabIndex_,!0),n.layoutIndicator_(),e&&n.adapter_.notifyChange({activeTabIndex:n.activeTabIndex_})})}}},{key:"getActiveTabIndex",value:function(){return this.findActiveTabIndex_()}}]),n}(),T=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return new C(t)};this.indicator_=this.root_.querySelector(I.strings.INDICATOR_SELECTOR),this.tabs_=this.gatherTabs_(e),this.tabSelectedHandler_=function(e){var n=e.detail.tab;t.setActiveTab_(n,!0)}}},{key:"getDefaultFoundation",value:function(){var t=this;return new I({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},bindOnMDCTabSelectedEvent:function(){return t.listen(g.strings.SELECTED_EVENT,t.tabSelectedHandler_)},unbindOnMDCTabSelectedEvent:function(){return t.unlisten(g.strings.SELECTED_EVENT,t.tabSelectedHandler_)},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},getOffsetWidth:function(){return t.root_.offsetWidth},setStyleForIndicator:function(e,n){return t.indicator_.style.setProperty(e,n)},getOffsetWidthForIndicator:function(){return t.indicator_.offsetWidth},notifyChange:function(e){return t.emit(I.strings.CHANGE_EVENT,e)},getNumberOfTabs:function(){return t.tabs.length},isTabActiveAtIndex:function(e){return t.tabs[e].isActive},setTabActiveAtIndex:function(e,n){t.tabs[e].isActive=n},isDefaultPreventedOnClickForTabAtIndex:function(e){return t.tabs[e].preventDefaultOnClick},setPreventDefaultOnClickForTabAtIndex:function(e,n){t.tabs[e].preventDefaultOnClick=n},measureTabAtIndex:function(e){return t.tabs[e].measureSelf()},getComputedWidthForTabAtIndex:function(e){return t.tabs[e].computedWidth},getComputedLeftForTabAtIndex:function(e){return t.tabs[e].computedLeft}})}},{key:"gatherTabs_",value:function(t){return[].slice.call(this.root_.querySelectorAll(I.strings.TAB_SELECTOR)).map(function(e){return t(e)})}},{key:"setActiveTabIndex_",value:function(t,e){this.foundation_.switchToTabAtIndex(t,e)}},{key:"layout",value:function(){this.foundation_.layout()}},{key:"setActiveTab_",value:function(t,e){var n=this.tabs.indexOf(t);if(n<0)throw new Error("Invalid tab component given as activeTab: Tab not found within this component's tab list");this.setActiveTabIndex_(n,e)}},{key:"tabs",get:function(){return this.tabs_}},{key:"activeTab",get:function(){var t=this.foundation_.getActiveTabIndex();return this.tabs[t]},set:function(t){this.setActiveTab_(t,!1)}},{key:"activeTabIndex",get:function(){return this.foundation_.getActiveTabIndex()},set:function(t){this.setActiveTabIndex_(t,!1)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),O={ARIA_CONTROLS:"aria-controls",INPUT_SELECTOR:".mdc-text-field__input",LABEL_SELECTOR:".mdc-floating-label",ICON_SELECTOR:".mdc-text-field__icon",OUTLINE_SELECTOR:".mdc-notched-outline",BOTTOM_LINE_SELECTOR:".mdc-line-ripple"},L={ROOT:"mdc-text-field",UPGRADED:"mdc-text-field--upgraded",DISABLED:"mdc-text-field--disabled",DENSE:"mdc-text-field--dense",FOCUSED:"mdc-text-field--focused",INVALID:"mdc-text-field--invalid",BOX:"mdc-text-field--box",OUTLINED:"mdc-text-field--outlined"},S={LABEL_SCALE:.75,DENSE_LABEL_SCALE:.923},H={ARIA_HIDDEN:"aria-hidden",ROLE:"role"},R={HELPER_TEXT_PERSISTENT:"mdc-text-field-helper-text--persistent",HELPER_TEXT_VALIDATION_MSG:"mdc-text-field-helper-text--validation-msg"},D=function(t){function n(t){return _classCallCheck(this,n),_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)))}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return R}},{key:"strings",get:function(){return H}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},setAttr:function(){},removeAttr:function(){},setContent:function(){}}}}]),_createClass(n,[{key:"setContent",value:function(t){this.adapter_.setContent(t)}},{key:"setPersistent",value:function(t){t?this.adapter_.addClass(R.HELPER_TEXT_PERSISTENT):this.adapter_.removeClass(R.HELPER_TEXT_PERSISTENT)}},{key:"setValidation",value:function(t){t?this.adapter_.addClass(R.HELPER_TEXT_VALIDATION_MSG):this.adapter_.removeClass(R.HELPER_TEXT_VALIDATION_MSG)}},{key:"showToScreenReader",value:function(){this.adapter_.removeAttr(H.ARIA_HIDDEN)}},{key:"setValidity",value:function(t){var e=this.adapter_.hasClass(R.HELPER_TEXT_PERSISTENT),n=this.adapter_.hasClass(R.HELPER_TEXT_VALIDATION_MSG)&&!t;n?this.adapter_.setAttr(H.ROLE,"alert"):this.adapter_.removeAttr(H.ROLE),e||n||this.hide_()}},{key:"hide_",value:function(){this.adapter_.setAttr(H.ARIA_HIDDEN,"true")}}]),n}(),x={ICON_EVENT:"MDCTextField:icon"},w=function(t){function n(t){_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.interactionHandler_=function(t){return e.handleInteraction(t)},e}return _inherits(n,e),_createClass(n,null,[{key:"strings",get:function(){return x}},{key:"defaultAdapter",get:function(){return{setAttr:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},notifyIconAction:function(){}}}}]),_createClass(n,[{key:"init",value:function(){var t=this;["click","keydown"].forEach(function(e){t.adapter_.registerInteractionHandler(e,t.interactionHandler_)})}},{key:"destroy",value:function(){var t=this;["click","keydown"].forEach(function(e){t.adapter_.deregisterInteractionHandler(e,t.interactionHandler_)})}},{key:"setDisabled",value:function(t){t?this.adapter_.setAttr("tabindex","-1"):this.adapter_.setAttr("tabindex","0")}},{key:"handleInteraction",value:function(t){"click"!==t.type&&"Enter"!==t.key&&13!==t.keyCode||this.adapter_.notifyIconAction()}}]),n}(),F={LINE_RIPPLE_ACTIVE:"mdc-line-ripple--active",LINE_RIPPLE_DEACTIVATING:"mdc-line-ripple--deactivating"},P=function(t){function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.transitionEndHandler_=function(t){return e.handleTransitionEnd(t)},e}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return F}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},setStyle:function(){},registerEventHandler:function(){},deregisterEventHandler:function(){}}}}]),_createClass(n,[{key:"init",value:function(){this.adapter_.registerEventHandler("transitionend",this.transitionEndHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterEventHandler("transitionend",this.transitionEndHandler_)}},{key:"activate",value:function(){this.adapter_.removeClass(F.LINE_RIPPLE_DEACTIVATING),this.adapter_.addClass(F.LINE_RIPPLE_ACTIVE)}},{key:"setRippleCenter",value:function(t){this.adapter_.setStyle("transform-origin",t+"px center")}},{key:"deactivate",value:function(){this.adapter_.addClass(F.LINE_RIPPLE_DEACTIVATING)}},{key:"handleTransitionEnd",value:function(t){var e=this.adapter_.hasClass(F.LINE_RIPPLE_DEACTIVATING);"opacity"===t.propertyName&&e&&(this.adapter_.removeClass(F.LINE_RIPPLE_ACTIVE),this.adapter_.removeClass(F.LINE_RIPPLE_DEACTIVATING))}}]),n}(),N={LABEL_FLOAT_ABOVE:"mdc-floating-label--float-above",LABEL_SHAKE:"mdc-floating-label--shake"},V=function(t){function n(t){_classCallCheck(this,n);var e=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return e.shakeAnimationEndHandler_=function(){return e.handleShakeAnimationEnd_()},e}return _inherits(n,e),_createClass(n,null,[{key:"cssClasses",get:function(){return N}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},getWidth:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){}}}}]),_createClass(n,[{key:"init",value:function(){this.adapter_.registerInteractionHandler("animationend",this.shakeAnimationEndHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterInteractionHandler("animationend",this.shakeAnimationEndHandler_)}},{key:"getWidth",value:function(){return this.adapter_.getWidth()}},{key:"shake",value:function(t){var e=n.cssClasses.LABEL_SHAKE;t?this.adapter_.addClass(e):this.adapter_.removeClass(e)}},{key:"float",value:function(t){var e=n.cssClasses,i=e.LABEL_FLOAT_ABOVE,a=e.LABEL_SHAKE;t?this.adapter_.addClass(i):(this.adapter_.removeClass(i),this.adapter_.removeClass(a))}},{key:"handleShakeAnimationEnd_",value:function(){var t=n.cssClasses.LABEL_SHAKE;this.adapter_.removeClass(t)}}]),n}(),M={PATH_SELECTOR:".mdc-notched-outline__path",IDLE_OUTLINE_SELECTOR:".mdc-notched-outline__idle"},U={OUTLINE_NOTCHED:"mdc-notched-outline--notched"},B=function(t){function n(t){return _classCallCheck(this,n),_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)))}return _inherits(n,e),_createClass(n,null,[{key:"strings",get:function(){return M}},{key:"cssClasses",get:function(){return U}},{key:"defaultAdapter",get:function(){return{getWidth:function(){},getHeight:function(){},addClass:function(){},removeClass:function(){},setOutlinePathAttr:function(){},getIdleOutlineStyleValue:function(){}}}}]),_createClass(n,[{key:"notch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=n.cssClasses.OUTLINE_NOTCHED;this.adapter_.addClass(i),this.updateSvgPath_(t,e)}},{key:"closeNotch",value:function(){var t=n.cssClasses.OUTLINE_NOTCHED;this.adapter_.removeClass(t)}},{key:"updateSvgPath_",value:function(t,e){var n=this.adapter_.getIdleOutlineStyleValue("border-radius")||this.adapter_.getIdleOutlineStyleValue("border-top-left-radius"),i=parseFloat(n),a=this.adapter_.getWidth(),r=this.adapter_.getHeight(),s=i+1.2,o=Math.abs(11-s),u=t+8,c="a"+i+","+i+" 0 0 1 "+i+","+i+"v"+(r-2*s)+"a"+i+","+i+" 0 0 1 "+-i+","+i+"h"+(2*s-a)+"a"+i+","+i+" 0 0 1 "+-i+","+-i+"v"+(2*s-r)+"a"+i+","+i+" 0 0 1 "+i+","+-i,l=void 0;l=e?"M"+(a-s-o)+",1h"+o+c+"h"+(a-2*s-u-o):"M"+(s+o+u)+",1h"+(a-2*s-u-o)+c+"h"+o,this.adapter_.setOutlinePathAttr(l)}}]),n}(),W=["pattern","min","max","required","step","minlength","maxlength"],j=function(t){function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,Object.assign(n.defaultAdapter,t)));return i.helperText_=e.helperText,i.icon_=e.icon,i.isFocused_=!1,i.receivedUserInput_=!1,i.useCustomValidityChecking_=!1,i.isValid_=!0,i.inputFocusHandler_=function(){return i.activateFocus()},i.inputBlurHandler_=function(){return i.deactivateFocus()},i.inputInputHandler_=function(){return i.autoCompleteFocus()},i.setPointerXOffset_=function(t){return i.setTransformOrigin(t)},i.textFieldInteractionHandler_=function(){return i.handleTextFieldInteraction()},i.validationAttributeChangeHandler_=function(t){return i.handleValidationAttributeMutation_(t)},i.validationObserver_,i}return _inherits(n,e),_createClass(n,[{key:"shouldShake",get:function(){return!this.isValid()&&!this.isFocused_}},{key:"shouldFloat",get:function(){return!this.isBadInput_()&&(!!this.getValue()||this.isFocused_)}}],[{key:"cssClasses",get:function(){return L}},{key:"strings",get:function(){return O}},{key:"numbers",get:function(){return S}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},registerTextFieldInteractionHandler:function(){},deregisterTextFieldInteractionHandler:function(){},registerInputInteractionHandler:function(){},deregisterInputInteractionHandler:function(){},registerValidationAttributeChangeHandler:function(){},deregisterValidationAttributeChangeHandler:function(){},getNativeInput:function(){},isFocused:function(){},isRtl:function(){},activateLineRipple:function(){},deactivateLineRipple:function(){},setLineRippleTransformOrigin:function(){},shakeLabel:function(){},floatLabel:function(){},hasLabel:function(){},getLabelWidth:function(){},hasOutline:function(){},notchOutline:function(){},closeOutline:function(){}}}}]),_createClass(n,[{key:"init",value:function(){var t=this;this.adapter_.addClass(n.cssClasses.UPGRADED),this.adapter_.hasLabel()&&this.getValue()&&(this.adapter_.floatLabel(this.shouldFloat),this.notchOutline(this.shouldFloat)),this.adapter_.isFocused()&&this.inputFocusHandler_(),this.adapter_.registerInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.registerInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.registerInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.registerInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.registerTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.validationObserver_=this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_)}},{key:"destroy",value:function(){var t=this;this.adapter_.removeClass(n.cssClasses.UPGRADED),this.adapter_.deregisterInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.deregisterInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.deregisterInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.deregisterInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.deregisterTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.adapter_.deregisterValidationAttributeChangeHandler(this.validationObserver_)}},{key:"handleTextFieldInteraction",value:function(){this.adapter_.getNativeInput().disabled||(this.receivedUserInput_=!0)}},{key:"handleValidationAttributeMutation_",value:function(t){var e=this;t.some(function(t){if(W.indexOf(t.attributeName)>-1)return e.styleValidity_(!0),!0})}},{key:"notchOutline",value:function(t){if(this.adapter_.hasOutline()&&this.adapter_.hasLabel())if(t){var e=this.adapter_.hasClass(L.DENSE)?S.DENSE_LABEL_SCALE:S.LABEL_SCALE,n=this.adapter_.getLabelWidth()*e,i=this.adapter_.isRtl();this.adapter_.notchOutline(n,i)}else this.adapter_.closeOutline()}},{key:"activateFocus",value:function(){this.isFocused_=!0,this.styleFocused_(this.isFocused_),this.adapter_.activateLineRipple(),this.notchOutline(this.shouldFloat),this.adapter_.hasLabel()&&(this.adapter_.shakeLabel(this.shouldShake),this.adapter_.floatLabel(this.shouldFloat)),this.helperText_&&this.helperText_.showToScreenReader()}},{key:"setTransformOrigin",value:function(t){var e=t.target.getBoundingClientRect(),n=t.clientX,i=(t.clientY,n-e.left);this.adapter_.setLineRippleTransformOrigin(i)}},{key:"autoCompleteFocus",value:function(){this.receivedUserInput_||this.activateFocus()}},{key:"deactivateFocus",value:function(){this.isFocused_=!1,this.adapter_.deactivateLineRipple();var t=!this.getNativeInput_().value&&!this.isBadInput_(),e=this.isValid();this.styleValidity_(e),this.styleFocused_(this.isFocused_),this.adapter_.hasLabel()&&(this.adapter_.shakeLabel(this.shouldShake),this.adapter_.floatLabel(this.shouldFloat),this.notchOutline(this.shouldFloat)),t&&(this.receivedUserInput_=!1)}},{key:"getValue",value:function(){return this.getNativeInput_().value}},{key:"setValue",value:function(t){this.getNativeInput_().value=t;var e=this.isValid();this.styleValidity_(e),this.adapter_.hasLabel()&&(this.adapter_.shakeLabel(this.shouldShake),this.adapter_.floatLabel(this.shouldFloat),this.notchOutline(this.shouldFloat))}},{key:"isValid",value:function(){return this.useCustomValidityChecking_?this.isValid_:this.isNativeInputValid_()}},{key:"setValid",value:function(t){this.useCustomValidityChecking_=!0,this.isValid_=t,t=this.isValid(),this.styleValidity_(t),this.adapter_.hasLabel()&&this.adapter_.shakeLabel(this.shouldShake)}},{key:"isDisabled",value:function(){return this.getNativeInput_().disabled}},{key:"setDisabled",value:function(t){this.getNativeInput_().disabled=t,this.styleDisabled_(t)}},{key:"setHelperTextContent",value:function(t){this.helperText_&&this.helperText_.setContent(t)}},{key:"isBadInput_",value:function(){return this.getNativeInput_().validity.badInput}},{key:"isNativeInputValid_",value:function(){return this.getNativeInput_().validity.valid}},{key:"styleValidity_",value:function(t){var e=n.cssClasses.INVALID;t?this.adapter_.removeClass(e):this.adapter_.addClass(e),this.helperText_&&this.helperText_.setValidity(t)}},{key:"styleFocused_",value:function(t){var e=n.cssClasses.FOCUSED;t?this.adapter_.addClass(e):this.adapter_.removeClass(e)}},{key:"styleDisabled_",value:function(t){var e=n.cssClasses,i=e.DISABLED,a=e.INVALID;t?(this.adapter_.addClass(i),this.adapter_.removeClass(a)):this.adapter_.removeClass(i),this.icon_&&this.icon_.setDisabled(t)}},{key:"getNativeInput_",value:function(){return this.adapter_.getNativeInput()||{value:"",disabled:!1,validity:{badInput:!1,valid:!0}}}}]),n}(),G=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"activate",value:function(){this.foundation_.activate()}},{key:"deactivate",value:function(){this.foundation_.deactivate()}},{key:"setRippleCenter",value:function(t){this.foundation_.setRippleCenter(t)}},{key:"getDefaultFoundation",value:function(){var t=this;return new P(Object.assign({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},hasClass:function(e){return t.root_.classList.contains(e)},setStyle:function(e,n){return t.root_.style[e]=n},registerEventHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterEventHandler:function(e,n){return t.root_.removeEventListener(e,n)}}))}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),z=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"getDefaultFoundation",value:function(){var t=this;return new D(Object.assign({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},hasClass:function(e){return t.root_.classList.contains(e)},setAttr:function(e,n){return t.root_.setAttribute(e,n)},removeAttr:function(e){return t.root_.removeAttribute(e)},setContent:function(e){t.root_.textContent=e}}))}},{key:"foundation",get:function(){return this.foundation_}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),q=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"getDefaultFoundation",value:function(){var t=this;return new w(Object.assign({setAttr:function(e,n){return t.root_.setAttribute(e,n)},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)},notifyIconAction:function(){return t.emit(w.strings.ICON_EVENT,{},!0)}}))}},{key:"foundation",get:function(){return this.foundation_}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),X=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"shake",value:function(t){this.foundation_.shake(t)}},{key:"float",value:function(t){this.foundation_.float(t)}},{key:"getWidth",value:function(){return this.foundation_.getWidth()}},{key:"getDefaultFoundation",value:function(){var t=this;return new V({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},getWidth:function(){return t.root_.offsetWidth},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)}})}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),Y=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,n),_createClass(e,[{key:"notch",value:function(t,e){this.foundation_.notch(t,e)}},{key:"closeNotch",value:function(){this.foundation_.closeNotch()}},{key:"getDefaultFoundation",value:function(){var t=this;return new B({getWidth:function(){return t.root_.offsetWidth},getHeight:function(){return t.root_.offsetHeight},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setOutlinePathAttr:function(e){t.root_.querySelector(M.PATH_SELECTOR).setAttribute("d",e)},getIdleOutlineStyleValue:function(e){var n=t.root_.parentNode.querySelector(M.IDLE_OUTLINE_SELECTOR);return window.getComputedStyle(n).getPropertyValue(e)}})}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),K=function(t){function e(){var t;_classCallCheck(this,e);for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];var r=_possibleConstructorReturn(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(i)));return r.input_,r.ripple,r.lineRipple_,r.helperText_,r.icon_,r.label_,r.outline_,r}return _inherits(e,n),_createClass(e,[{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t,e){return new f(t,e)},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return new G(t)},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return new z(t)},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(t){return new q(t)},a=this,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(t){return new X(t)},s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(t){return new Y(t)};this.input_=this.root_.querySelector(O.INPUT_SELECTOR);var o=this.root_.querySelector(O.LABEL_SELECTOR);o&&(this.label_=r(o));var u=this.root_.querySelector(O.BOTTOM_LINE_SELECTOR);u&&(this.lineRipple_=e(u));var l=this.root_.querySelector(O.OUTLINE_SELECTOR);if(l&&(this.outline_=s(l)),this.input_.hasAttribute(O.ARIA_CONTROLS)){var d=document.getElementById(this.input_.getAttribute(O.ARIA_CONTROLS));d&&(this.helperText_=n(d))}var _=this.root_.querySelector(O.ICON_SELECTOR);if(_&&(this.icon_=i(_)),this.ripple=null,this.root_.classList.contains(L.BOX)){var p=c(HTMLElement.prototype),v=Object.assign(f.createAdapter(this),{isSurfaceActive:function(){return a.input_[p](":active")},registerInteractionHandler:function(t,e){return a.input_.addEventListener(t,e)},deregisterInteractionHandler:function(t,e){return a.input_.removeEventListener(t,e)}}),y=new h(v);this.ripple=t(this.root_,y)}}},{key:"destroy",value:function(){this.ripple&&this.ripple.destroy(),this.lineRipple_&&this.lineRipple_.destroy(),this.helperText_&&this.helperText_.destroy(),this.icon_&&this.icon_.destroy(),this.label_&&this.label_.destroy(),this.outline_&&this.outline_.destroy(),_get(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"initialSyncWithDom",value:function(){this.disabled=this.input_.disabled}},{key:"layout",value:function(){var t=this.foundation_.shouldFloat;this.foundation_.notchOutline(t),this.ripple&&this.ripple.layout()}},{key:"getDefaultFoundation",value:function(){var t=this;return new j(Object.assign({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},hasClass:function(e){return t.root_.classList.contains(e)},registerTextFieldInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterTextFieldInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)},registerValidationAttributeChangeHandler:function(e){var n=new MutationObserver(e),i=t.root_.querySelector(O.INPUT_SELECTOR);return n.observe(i,{attributes:!0}),n},deregisterValidationAttributeChangeHandler:function(t){return t.disconnect()},isFocused:function(){return document.activeElement===t.root_.querySelector(O.INPUT_SELECTOR)},isRtl:function(){return"rtl"===window.getComputedStyle(t.root_).getPropertyValue("direction")}},this.getInputAdapterMethods_(),this.getLabelAdapterMethods_(),this.getLineRippleAdapterMethods_(),this.getOutlineAdapterMethods_()),this.getFoundationMap_())}},{key:"getLabelAdapterMethods_",value:function(){var t=this;return{shakeLabel:function(e){return t.label_.shake(e)},floatLabel:function(e){return t.label_.float(e)},hasLabel:function(){return!!t.label_},getLabelWidth:function(){return t.label_.getWidth()}}}},{key:"getLineRippleAdapterMethods_",value:function(){var t=this;return{activateLineRipple:function(){t.lineRipple_&&t.lineRipple_.activate()},deactivateLineRipple:function(){t.lineRipple_&&t.lineRipple_.deactivate()},setLineRippleTransformOrigin:function(e){t.lineRipple_&&t.lineRipple_.setRippleCenter(e)}}}},{key:"getOutlineAdapterMethods_",value:function(){var t=this;return{notchOutline:function(e,n){return t.outline_.notch(e,n)},closeOutline:function(){return t.outline_.closeNotch()},hasOutline:function(){return!!t.outline_}}}},{key:"getInputAdapterMethods_",value:function(){var t=this;return{registerInputInteractionHandler:function(e,n){return t.input_.addEventListener(e,n)},deregisterInputInteractionHandler:function(e,n){return t.input_.removeEventListener(e,n)},getNativeInput:function(){return t.input_}}}},{key:"getFoundationMap_",value:function(){return{helperText:this.helperText_?this.helperText_.foundation:void 0,icon:this.icon_?this.icon_.foundation:void 0}}},{key:"value",get:function(){return this.foundation_.getValue()},set:function(t){this.foundation_.setValue(t)}},{key:"disabled",get:function(){return this.foundation_.isDisabled()},set:function(t){this.foundation_.setDisabled(t)}},{key:"valid",get:function(){return this.foundation_.isValid()},set:function(t){this.foundation_.setValid(t)}},{key:"required",get:function(){return this.input_.required},set:function(t){this.input_.required=t}},{key:"pattern",get:function(){return this.input_.pattern},set:function(t){this.input_.pattern=t}},{key:"minLength",get:function(){return this.input_.minLength},set:function(t){this.input_.minLength=t}},{key:"maxLength",get:function(){return this.input_.maxLength},set:function(t){t<0?this.input_.removeAttribute("maxLength"):this.input_.maxLength=t}},{key:"min",get:function(){return this.input_.min},set:function(t){this.input_.min=t}},{key:"max",get:function(){return this.input_.max},set:function(t){this.input_.max=t}},{key:"step",get:function(){return this.input_.step},set:function(t){this.input_.step=t}},{key:"helperTextContent",set:function(t){this.foundation_.setHelperTextContent(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(),Z={MDCRipple:f},J={MDCTabBar:T},Q={MDCTextField:K};return t.ripple=Z,t.tabs=J,t.textfield=Q,t}({});