{"version":3,"file":"application.3e8f31e5.js","sources":["../../../node_modules/@material/textfield/character-counter/constants.js","../../../node_modules/@material/textfield/character-counter/foundation.js","../../../node_modules/@material/textfield/character-counter/component.js","../../../node_modules/@material/textfield/constants.js","../../../node_modules/@material/textfield/foundation.js","../../../node_modules/@material/textfield/helper-text/constants.js","../../../node_modules/@material/textfield/helper-text/foundation.js","../../../node_modules/@material/textfield/helper-text/component.js","../../../node_modules/@material/textfield/icon/constants.js","../../../node_modules/@material/textfield/icon/foundation.js","../../../node_modules/@material/textfield/icon/component.js","../../../node_modules/@material/textfield/component.js","../../../node_modules/@material/snackbar/constants.js","../../../node_modules/@material/snackbar/util.js","../../../node_modules/@material/snackbar/foundation.js","../../../node_modules/@material/snackbar/component.js","../../../node_modules/@material/checkbox/constants.js","../../../node_modules/@material/checkbox/foundation.js","../../../node_modules/@material/checkbox/component.js","../../../node_modules/@material/linear-progress/constants.js","../../../node_modules/@material/linear-progress/foundation.js","../../../node_modules/@material/linear-progress/component.js","../../../node_modules/@material/data-table/constants.js","../../../node_modules/@material/data-table/foundation.js","../../../node_modules/@material/data-table/component.js","../../../node_modules/@material/chips/action/component-ripple.js","../../../node_modules/@material/chips/action/constants.js","../../../node_modules/@material/chips/action/foundation.js","../../../node_modules/@material/chips/action/primary-foundation.js","../../../node_modules/@material/chips/action/trailing-foundation.js","../../../node_modules/@material/chips/action/component.js","../../../node_modules/@material/animation/animationframe.js","../../../node_modules/@material/chips/chip/constants.js","../../../node_modules/@material/chips/chip/foundation.js","../../../node_modules/@material/chips/chip/component.js","../../../node_modules/@material/dom/announce.js","../../../node_modules/@material/chips/chip-set/constants.js","../../../node_modules/@material/chips/chip-set/foundation.js","../../../node_modules/@material/chips/chip-set/component.js","../../../node_modules/@material/tab-scroller/constants.js","../../../node_modules/@material/tab-scroller/rtl-scroller.js","../../../node_modules/@material/tab-scroller/rtl-default-scroller.js","../../../node_modules/@material/tab-scroller/rtl-negative-scroller.js","../../../node_modules/@material/tab-scroller/rtl-reverse-scroller.js","../../../node_modules/@material/tab-scroller/foundation.js","../../../node_modules/@material/tab-scroller/util.js","../../../node_modules/@material/tab-scroller/component.js","../../../node_modules/@material/tab-indicator/constants.js","../../../node_modules/@material/tab-indicator/foundation.js","../../../node_modules/@material/tab-indicator/fading-foundation.js","../../../node_modules/@material/tab-indicator/sliding-foundation.js","../../../node_modules/@material/tab-indicator/component.js","../../../node_modules/@material/tab/constants.js","../../../node_modules/@material/tab/foundation.js","../../../node_modules/@material/tab/component.js","../../../node_modules/@material/tab-bar/constants.js","../../../node_modules/@material/tab-bar/foundation.js","../../../node_modules/@material/tab-bar/component.js","../../../node_modules/@material/dialog/util.js","../../../node_modules/@material/dom/focus-trap.js","../../../node_modules/@material/dialog/constants.js","../../../node_modules/@material/dialog/foundation.js","../../../node_modules/@material/dialog/component.js","../../../node_modules/@material/switch/constants.js","../../../node_modules/@material/base/observer.js","../../../node_modules/@material/base/observer-foundation.js","../../../node_modules/@material/switch/foundation.js","../../../node_modules/@material/switch/component.js","../../../node_modules/@material/banner/constants.js","../../../node_modules/@material/banner/foundation.js","../../../node_modules/@material/banner/component.js","../../../node_modules/@material/tooltip/constants.js","../../../node_modules/@material/tooltip/foundation.js","../../../node_modules/@material/tooltip/component.js","../../../app/frontend/src/mdc_initialization.js","../../../app/frontend/src/datepicker.js","../../../app/frontend/src/dragandrop.js","../../../app/frontend/src/material_request.js","../../../app/frontend/src/bids.js","../../../app/frontend/src/rfqs.js","../../../app/frontend/src/settings.js","../../../node_modules/intl-tel-input/build/js/intlTelInput.js","../../../node_modules/intl-tel-input/index.js","../../../app/frontend/src/tel_input_field.js","../../../app/frontend/src/dropdown_menu.js","../../../node_modules/easytimer.js/dist/easytimer.js","../../../app/frontend/src/users.js","../../../app/frontend/src/sortable_table.js","../../../app/frontend/src/textfield.js","../../../app/frontend/src/placeholder.js","../../../node_modules/@material/drawer/util.js","../../../node_modules/@material/drawer/constants.js","../../../node_modules/@material/drawer/dismissible/foundation.js","../../../node_modules/@material/drawer/modal/foundation.js","../../../node_modules/@material/drawer/component.js","../../../app/frontend/src/drawer.js"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n ROOT: 'mdc-text-field-character-counter',\n};\nvar strings = {\n ROOT_SELECTOR: \".\" + cssClasses.ROOT,\n};\nexport { strings, cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCTextFieldCharacterCounterFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldCharacterCounterFoundation, _super);\n function MDCTextFieldCharacterCounterFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCTextFieldCharacterCounterFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldCharacterCounterFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldCharacterCounterFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.\n */\n get: function () {\n return {\n setContent: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {\n currentLength = Math.min(currentLength, maxLength);\n this.adapter.setContent(currentLength + \" / \" + maxLength);\n };\n return MDCTextFieldCharacterCounterFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldCharacterCounterFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldCharacterCounterFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCTextFieldCharacterCounterFoundation } from './foundation';\nvar MDCTextFieldCharacterCounter = /** @class */ (function (_super) {\n __extends(MDCTextFieldCharacterCounter, _super);\n function MDCTextFieldCharacterCounter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTextFieldCharacterCounter.attachTo = function (root) {\n return new MDCTextFieldCharacterCounter(root);\n };\n Object.defineProperty(MDCTextFieldCharacterCounter.prototype, \"foundationForTextField\", {\n // Provided for access by MDCTextField component\n get: function () {\n return this.foundation;\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n setContent: function (content) {\n _this.root.textContent = content;\n },\n };\n return new MDCTextFieldCharacterCounterFoundation(adapter);\n };\n return MDCTextFieldCharacterCounter;\n}(MDCComponent));\nexport { MDCTextFieldCharacterCounter };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n ARIA_CONTROLS: 'aria-controls',\n ARIA_DESCRIBEDBY: 'aria-describedby',\n INPUT_SELECTOR: '.mdc-text-field__input',\n LABEL_SELECTOR: '.mdc-floating-label',\n LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',\n LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',\n OUTLINE_SELECTOR: '.mdc-notched-outline',\n PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',\n SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',\n TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'\n};\nvar cssClasses = {\n DISABLED: 'mdc-text-field--disabled',\n FOCUSED: 'mdc-text-field--focused',\n HELPER_LINE: 'mdc-text-field-helper-line',\n INVALID: 'mdc-text-field--invalid',\n LABEL_FLOATING: 'mdc-text-field--label-floating',\n NO_LABEL: 'mdc-text-field--no-label',\n OUTLINED: 'mdc-text-field--outlined',\n ROOT: 'mdc-text-field',\n TEXTAREA: 'mdc-text-field--textarea',\n WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',\n WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',\n WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter',\n};\nvar numbers = {\n LABEL_SCALE: 0.75,\n};\n/**\n * Whitelist based off of\n * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation\n * under the \"Validation-related attributes\" section.\n */\nvar VALIDATION_ATTR_WHITELIST = [\n 'pattern',\n 'min',\n 'max',\n 'required',\n 'step',\n 'minlength',\n 'maxlength',\n];\n/**\n * Label should always float for these types as they show some UI even if value\n * is empty.\n */\nvar ALWAYS_FLOAT_TYPES = [\n 'color',\n 'date',\n 'datetime-local',\n 'month',\n 'range',\n 'time',\n 'week',\n];\nexport { cssClasses, strings, numbers, VALIDATION_ATTR_WHITELIST, ALWAYS_FLOAT_TYPES };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { ALWAYS_FLOAT_TYPES, cssClasses, numbers, strings, VALIDATION_ATTR_WHITELIST } from './constants';\nvar POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];\nvar INTERACTION_EVENTS = ['click', 'keydown'];\nvar MDCTextFieldFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldFoundation, _super);\n /**\n * @param adapter\n * @param foundationMap Map from subcomponent names to their subfoundations.\n */\n function MDCTextFieldFoundation(adapter, foundationMap) {\n if (foundationMap === void 0) { foundationMap = {}; }\n var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;\n _this.isFocused = false;\n _this.receivedUserInput = false;\n _this.valid = true;\n _this.useNativeValidation = true;\n _this.validateOnValueChange = true;\n _this.helperText = foundationMap.helperText;\n _this.characterCounter = foundationMap.characterCounter;\n _this.leadingIcon = foundationMap.leadingIcon;\n _this.trailingIcon = foundationMap.trailingIcon;\n _this.inputFocusHandler = function () {\n _this.activateFocus();\n };\n _this.inputBlurHandler = function () {\n _this.deactivateFocus();\n };\n _this.inputInputHandler = function () {\n _this.handleInput();\n };\n _this.setPointerXOffset = function (evt) {\n _this.setTransformOrigin(evt);\n };\n _this.textFieldInteractionHandler = function () {\n _this.handleTextFieldInteraction();\n };\n _this.validationAttributeChangeHandler = function (attributesList) {\n _this.handleValidationAttributeChange(attributesList);\n };\n return _this;\n }\n Object.defineProperty(MDCTextFieldFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldAlwaysFloat\", {\n get: function () {\n var type = this.getNativeInput().type;\n return ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldFloat\", {\n get: function () {\n return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() ||\n this.isBadInput();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldShake\", {\n get: function () {\n return !this.isFocused && !this.isValid() && !!this.getValue();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldAdapter} for typing information on parameters and\n * return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return true; },\n setInputAttr: function () { return undefined; },\n removeInputAttr: function () { return undefined; },\n registerTextFieldInteractionHandler: function () { return undefined; },\n deregisterTextFieldInteractionHandler: function () { return undefined; },\n registerInputInteractionHandler: function () { return undefined; },\n deregisterInputInteractionHandler: function () { return undefined; },\n registerValidationAttributeChangeHandler: function () {\n return new MutationObserver(function () { return undefined; });\n },\n deregisterValidationAttributeChangeHandler: function () { return undefined; },\n getNativeInput: function () { return null; },\n isFocused: function () { return false; },\n activateLineRipple: function () { return undefined; },\n deactivateLineRipple: function () { return undefined; },\n setLineRippleTransformOrigin: function () { return undefined; },\n shakeLabel: function () { return undefined; },\n floatLabel: function () { return undefined; },\n setLabelRequired: function () { return undefined; },\n hasLabel: function () { return false; },\n getLabelWidth: function () { return 0; },\n hasOutline: function () { return false; },\n notchOutline: function () { return undefined; },\n closeOutline: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldFoundation.prototype.init = function () {\n var e_1, _a, e_2, _b;\n if (this.adapter.hasLabel() && this.getNativeInput().required) {\n this.adapter.setLabelRequired(true);\n }\n if (this.adapter.isFocused()) {\n this.inputFocusHandler();\n }\n else if (this.adapter.hasLabel() && this.shouldFloat) {\n this.notchOutline(true);\n this.adapter.floatLabel(true);\n this.styleFloating(true);\n }\n this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);\n this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);\n this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);\n try {\n for (var POINTERDOWN_EVENTS_1 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {\n var evtType = POINTERDOWN_EVENTS_1_1.value;\n this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n try {\n for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {\n var evtType = INTERACTION_EVENTS_1_1.value;\n this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n this.validationObserver =\n this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);\n this.setcharacterCounter(this.getValue().length);\n };\n MDCTextFieldFoundation.prototype.destroy = function () {\n var e_3, _a, e_4, _b;\n this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);\n this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);\n this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);\n try {\n for (var POINTERDOWN_EVENTS_2 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {\n var evtType = POINTERDOWN_EVENTS_2_1.value;\n this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);\n }\n finally { if (e_3) throw e_3.error; }\n }\n try {\n for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {\n var evtType = INTERACTION_EVENTS_2_1.value;\n this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);\n }\n finally { if (e_4) throw e_4.error; }\n }\n this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);\n };\n /**\n * Handles user interactions with the Text Field.\n */\n MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {\n var nativeInput = this.adapter.getNativeInput();\n if (nativeInput && nativeInput.disabled) {\n return;\n }\n this.receivedUserInput = true;\n };\n /**\n * Handles validation attribute changes\n */\n MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {\n var _this = this;\n attributesList.some(function (attributeName) {\n if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {\n _this.styleValidity(true);\n _this.adapter.setLabelRequired(_this.getNativeInput().required);\n return true;\n }\n return false;\n });\n if (attributesList.indexOf('maxlength') > -1) {\n this.setcharacterCounter(this.getValue().length);\n }\n };\n /**\n * Opens/closes the notched outline.\n */\n MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {\n if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {\n return;\n }\n if (openNotch) {\n var labelWidth = this.adapter.getLabelWidth() * numbers.LABEL_SCALE;\n this.adapter.notchOutline(labelWidth);\n }\n else {\n this.adapter.closeOutline();\n }\n };\n /**\n * Activates the text field focus state.\n */\n MDCTextFieldFoundation.prototype.activateFocus = function () {\n this.isFocused = true;\n this.styleFocused(this.isFocused);\n this.adapter.activateLineRipple();\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n this.adapter.shakeLabel(this.shouldShake);\n }\n if (this.helperText &&\n (this.helperText.isPersistent() || !this.helperText.isValidation() ||\n !this.valid)) {\n this.helperText.showToScreenReader();\n }\n };\n /**\n * Sets the line ripple's transform origin, so that the line ripple activate\n * animation will animate out from the user's click location.\n */\n MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {\n if (this.isDisabled() || this.adapter.hasOutline()) {\n return;\n }\n var touches = evt.touches;\n var targetEvent = touches ? touches[0] : evt;\n var targetClientRect = targetEvent.target.getBoundingClientRect();\n var normalizedX = targetEvent.clientX - targetClientRect.left;\n this.adapter.setLineRippleTransformOrigin(normalizedX);\n };\n /**\n * Handles input change of text input and text area.\n */\n MDCTextFieldFoundation.prototype.handleInput = function () {\n this.autoCompleteFocus();\n this.setcharacterCounter(this.getValue().length);\n };\n /**\n * Activates the Text Field's focus state in cases when the input value\n * changes without user input (e.g. programmatically).\n */\n MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {\n if (!this.receivedUserInput) {\n this.activateFocus();\n }\n };\n /**\n * Deactivates the Text Field's focus state.\n */\n MDCTextFieldFoundation.prototype.deactivateFocus = function () {\n this.isFocused = false;\n this.adapter.deactivateLineRipple();\n var isValid = this.isValid();\n this.styleValidity(isValid);\n this.styleFocused(this.isFocused);\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n this.adapter.shakeLabel(this.shouldShake);\n }\n if (!this.shouldFloat) {\n this.receivedUserInput = false;\n }\n };\n MDCTextFieldFoundation.prototype.getValue = function () {\n return this.getNativeInput().value;\n };\n /**\n * @param value The value to set on the input Element.\n */\n MDCTextFieldFoundation.prototype.setValue = function (value) {\n // Prevent Safari from moving the caret to the end of the input when the\n // value has not changed.\n if (this.getValue() !== value) {\n this.getNativeInput().value = value;\n }\n this.setcharacterCounter(value.length);\n if (this.validateOnValueChange) {\n var isValid = this.isValid();\n this.styleValidity(isValid);\n }\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n if (this.validateOnValueChange) {\n this.adapter.shakeLabel(this.shouldShake);\n }\n }\n };\n /**\n * @return The custom validity state, if set; otherwise, the result of a\n * native validity check.\n */\n MDCTextFieldFoundation.prototype.isValid = function () {\n return this.useNativeValidation ? this.isNativeInputValid() : this.valid;\n };\n /**\n * @param isValid Sets the custom validity state of the Text Field.\n */\n MDCTextFieldFoundation.prototype.setValid = function (isValid) {\n this.valid = isValid;\n this.styleValidity(isValid);\n var shouldShake = !isValid && !this.isFocused && !!this.getValue();\n if (this.adapter.hasLabel()) {\n this.adapter.shakeLabel(shouldShake);\n }\n };\n /**\n * @param shouldValidate Whether or not validity should be updated on\n * value change.\n */\n MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {\n this.validateOnValueChange = shouldValidate;\n };\n /**\n * @return Whether or not validity should be updated on value change. `true`\n * by default.\n */\n MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {\n return this.validateOnValueChange;\n };\n /**\n * Enables or disables the use of native validation. Use this for custom\n * validation.\n * @param useNativeValidation Set this to false to ignore native input\n * validation.\n */\n MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {\n this.useNativeValidation = useNativeValidation;\n };\n MDCTextFieldFoundation.prototype.isDisabled = function () {\n return this.getNativeInput().disabled;\n };\n /**\n * @param disabled Sets the text-field disabled or enabled.\n */\n MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {\n this.getNativeInput().disabled = disabled;\n this.styleDisabled(disabled);\n };\n /**\n * @param content Sets the content of the helper text.\n */\n MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {\n if (this.helperText) {\n this.helperText.setContent(content);\n }\n };\n /**\n * Sets the aria label of the leading icon.\n */\n MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {\n if (this.leadingIcon) {\n this.leadingIcon.setAriaLabel(label);\n }\n };\n /**\n * Sets the text content of the leading icon.\n */\n MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {\n if (this.leadingIcon) {\n this.leadingIcon.setContent(content);\n }\n };\n /**\n * Sets the aria label of the trailing icon.\n */\n MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {\n if (this.trailingIcon) {\n this.trailingIcon.setAriaLabel(label);\n }\n };\n /**\n * Sets the text content of the trailing icon.\n */\n MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {\n if (this.trailingIcon) {\n this.trailingIcon.setContent(content);\n }\n };\n /**\n * Sets character counter values that shows characters used and the total\n * character limit.\n */\n MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {\n if (!this.characterCounter) {\n return;\n }\n var maxLength = this.getNativeInput().maxLength;\n if (maxLength === -1) {\n throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');\n }\n this.characterCounter.setCounterValue(currentLength, maxLength);\n };\n /**\n * @return True if the Text Field input fails in converting the user-supplied\n * value.\n */\n MDCTextFieldFoundation.prototype.isBadInput = function () {\n // The badInput property is not supported in IE 11 💩.\n return this.getNativeInput().validity.badInput || false;\n };\n /**\n * @return The result of native validity checking (ValidityState.valid).\n */\n MDCTextFieldFoundation.prototype.isNativeInputValid = function () {\n return this.getNativeInput().validity.valid;\n };\n /**\n * Styles the component based on the validity state.\n */\n MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {\n var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;\n if (isValid) {\n this.adapter.removeClass(INVALID);\n }\n else {\n this.adapter.addClass(INVALID);\n }\n if (this.helperText) {\n this.helperText.setValidity(isValid);\n // We dynamically set or unset aria-describedby for validation helper text\n // only, based on whether the field is valid\n var helperTextValidation = this.helperText.isValidation();\n if (!helperTextValidation) {\n return;\n }\n var helperTextVisible = this.helperText.isVisible();\n var helperTextId = this.helperText.getId();\n if (helperTextVisible && helperTextId) {\n this.adapter.setInputAttr(strings.ARIA_DESCRIBEDBY, helperTextId);\n }\n else {\n this.adapter.removeInputAttr(strings.ARIA_DESCRIBEDBY);\n }\n }\n };\n /**\n * Styles the component based on the focused state.\n */\n MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {\n var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;\n if (isFocused) {\n this.adapter.addClass(FOCUSED);\n }\n else {\n this.adapter.removeClass(FOCUSED);\n }\n };\n /**\n * Styles the component based on the disabled state.\n */\n MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {\n var _a = MDCTextFieldFoundation.cssClasses, DISABLED = _a.DISABLED, INVALID = _a.INVALID;\n if (isDisabled) {\n this.adapter.addClass(DISABLED);\n this.adapter.removeClass(INVALID);\n }\n else {\n this.adapter.removeClass(DISABLED);\n }\n if (this.leadingIcon) {\n this.leadingIcon.setDisabled(isDisabled);\n }\n if (this.trailingIcon) {\n this.trailingIcon.setDisabled(isDisabled);\n }\n };\n /**\n * Styles the component based on the label floating state.\n */\n MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {\n var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;\n if (isFloating) {\n this.adapter.addClass(LABEL_FLOATING);\n }\n else {\n this.adapter.removeClass(LABEL_FLOATING);\n }\n };\n /**\n * @return The native text input element from the host environment, or an\n * object with the same shape for unit tests.\n */\n MDCTextFieldFoundation.prototype.getNativeInput = function () {\n // this.adapter may be undefined in foundation unit tests. This happens when\n // testdouble is creating a mock object and invokes the\n // shouldShake/shouldFloat getters (which in turn call getValue(), which\n // calls this method) before init() has been called from the MDCTextField\n // constructor. To work around that issue, we return a dummy object.\n var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;\n return nativeInput || {\n disabled: false,\n maxLength: -1,\n required: false,\n type: 'input',\n validity: {\n badInput: false,\n valid: true,\n },\n value: '',\n };\n };\n return MDCTextFieldFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',\n HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',\n ROOT: 'mdc-text-field-helper-text',\n};\nvar strings = {\n ARIA_HIDDEN: 'aria-hidden',\n ROLE: 'role',\n ROOT_SELECTOR: \".\" + cssClasses.ROOT,\n};\nexport { strings, cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCTextFieldHelperTextFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldHelperTextFoundation, _super);\n function MDCTextFieldHelperTextFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n getAttr: function () { return null; },\n setAttr: function () { return undefined; },\n removeAttr: function () { return undefined; },\n setContent: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldHelperTextFoundation.prototype.getId = function () {\n return this.adapter.getAttr('id');\n };\n MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {\n return this.adapter.getAttr(strings.ARIA_HIDDEN) !== 'true';\n };\n /**\n * Sets the content of the helper text field.\n */\n MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {\n this.adapter.setContent(content);\n };\n MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {\n return this.adapter.hasClass(cssClasses.HELPER_TEXT_PERSISTENT);\n };\n /**\n * @param isPersistent Sets the persistency of the helper text.\n */\n MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {\n if (isPersistent) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_PERSISTENT);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_PERSISTENT);\n }\n };\n /**\n * @return whether the helper text acts as an error validation message.\n */\n MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {\n return this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n };\n /**\n * @param isValidation True to make the helper text act as an error validation message.\n */\n MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {\n if (isValidation) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n };\n /**\n * Makes the helper text visible to the screen reader.\n */\n MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {\n this.adapter.removeAttr(strings.ARIA_HIDDEN);\n };\n /**\n * Sets the validity of the helper text based on the input validity.\n */\n MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {\n var helperTextIsPersistent = this.adapter.hasClass(cssClasses.HELPER_TEXT_PERSISTENT);\n var helperTextIsValidationMsg = this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;\n if (validationMsgNeedsDisplay) {\n this.showToScreenReader();\n // If role is already alert, refresh it to trigger another announcement\n // from screenreader.\n if (this.adapter.getAttr(strings.ROLE) === 'alert') {\n this.refreshAlertRole();\n }\n else {\n this.adapter.setAttr(strings.ROLE, 'alert');\n }\n }\n else {\n this.adapter.removeAttr(strings.ROLE);\n }\n if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {\n this.hide();\n }\n };\n /**\n * Hides the help text from screen readers.\n */\n MDCTextFieldHelperTextFoundation.prototype.hide = function () {\n this.adapter.setAttr(strings.ARIA_HIDDEN, 'true');\n };\n MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {\n var _this = this;\n this.adapter.removeAttr(strings.ROLE);\n requestAnimationFrame(function () {\n _this.adapter.setAttr(strings.ROLE, 'alert');\n });\n };\n return MDCTextFieldHelperTextFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldHelperTextFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldHelperTextFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCTextFieldHelperTextFoundation } from './foundation';\nvar MDCTextFieldHelperText = /** @class */ (function (_super) {\n __extends(MDCTextFieldHelperText, _super);\n function MDCTextFieldHelperText() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTextFieldHelperText.attachTo = function (root) {\n return new MDCTextFieldHelperText(root);\n };\n Object.defineProperty(MDCTextFieldHelperText.prototype, \"foundationForTextField\", {\n // Provided for access by MDCTextField component\n get: function () {\n return this.foundation;\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n addClass: function (className) { return _this.root.classList.add(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n getAttr: function (attr) { return _this.root.getAttribute(attr); },\n setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },\n removeAttr: function (attr) { return _this.root.removeAttribute(attr); },\n setContent: function (content) {\n _this.root.textContent = content;\n },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCTextFieldHelperTextFoundation(adapter);\n };\n return MDCTextFieldHelperText;\n}(MDCComponent));\nexport { MDCTextFieldHelperText };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n ICON_EVENT: 'MDCTextField:icon',\n ICON_ROLE: 'button',\n};\nvar cssClasses = {\n ROOT: 'mdc-text-field__icon',\n};\nexport { strings, cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar INTERACTION_EVENTS = ['click', 'keydown'];\nvar MDCTextFieldIconFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldIconFoundation, _super);\n function MDCTextFieldIconFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;\n _this.savedTabIndex = null;\n _this.interactionHandler = function (evt) {\n _this.handleInteraction(evt);\n };\n return _this;\n }\n Object.defineProperty(MDCTextFieldIconFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldIconFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldIconFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n getAttr: function () { return null; },\n setAttr: function () { return undefined; },\n removeAttr: function () { return undefined; },\n setContent: function () { return undefined; },\n registerInteractionHandler: function () { return undefined; },\n deregisterInteractionHandler: function () { return undefined; },\n notifyIconAction: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldIconFoundation.prototype.init = function () {\n var e_1, _a;\n this.savedTabIndex = this.adapter.getAttr('tabindex');\n try {\n for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {\n var evtType = INTERACTION_EVENTS_1_1.value;\n this.adapter.registerInteractionHandler(evtType, this.interactionHandler);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n MDCTextFieldIconFoundation.prototype.destroy = function () {\n var e_2, _a;\n try {\n for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {\n var evtType = INTERACTION_EVENTS_2_1.value;\n this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {\n if (!this.savedTabIndex) {\n return;\n }\n if (disabled) {\n this.adapter.setAttr('tabindex', '-1');\n this.adapter.removeAttr('role');\n }\n else {\n this.adapter.setAttr('tabindex', this.savedTabIndex);\n this.adapter.setAttr('role', strings.ICON_ROLE);\n }\n };\n MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {\n this.adapter.setAttr('aria-label', label);\n };\n MDCTextFieldIconFoundation.prototype.setContent = function (content) {\n this.adapter.setContent(content);\n };\n MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {\n var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;\n if (evt.type === 'click' || isEnterKey) {\n evt.preventDefault(); // stop click from causing host label to focus\n // input\n this.adapter.notifyIconAction();\n }\n };\n return MDCTextFieldIconFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldIconFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldIconFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCTextFieldIconFoundation } from './foundation';\nvar MDCTextFieldIcon = /** @class */ (function (_super) {\n __extends(MDCTextFieldIcon, _super);\n function MDCTextFieldIcon() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTextFieldIcon.attachTo = function (root) {\n return new MDCTextFieldIcon(root);\n };\n Object.defineProperty(MDCTextFieldIcon.prototype, \"foundationForTextField\", {\n // Provided for access by MDCTextField component\n get: function () {\n return this.foundation;\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldIcon.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n getAttr: function (attr) { return _this.root.getAttribute(attr); },\n setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },\n removeAttr: function (attr) { return _this.root.removeAttribute(attr); },\n setContent: function (content) {\n _this.root.textContent = content;\n },\n registerInteractionHandler: function (evtType, handler) { return _this.listen(evtType, handler); },\n deregisterInteractionHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },\n notifyIconAction: function () { return _this.emit(MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCTextFieldIconFoundation(adapter);\n };\n return MDCTextFieldIcon;\n}(MDCComponent));\nexport { MDCTextFieldIcon };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { applyPassive } from '@material/dom/events';\nimport * as ponyfill from '@material/dom/ponyfill';\nimport { MDCFloatingLabel } from '@material/floating-label/component';\nimport { MDCLineRipple } from '@material/line-ripple/component';\nimport { MDCNotchedOutline } from '@material/notched-outline/component';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCRippleFoundation } from '@material/ripple/foundation';\nimport { MDCTextFieldCharacterCounter } from './character-counter/component';\nimport { MDCTextFieldCharacterCounterFoundation } from './character-counter/foundation';\nimport { cssClasses, strings } from './constants';\nimport { MDCTextFieldFoundation } from './foundation';\nimport { MDCTextFieldHelperText } from './helper-text/component';\nimport { MDCTextFieldHelperTextFoundation } from './helper-text/foundation';\nimport { MDCTextFieldIcon } from './icon/component';\nvar MDCTextField = /** @class */ (function (_super) {\n __extends(MDCTextField, _super);\n function MDCTextField() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTextField.attachTo = function (root) {\n return new MDCTextField(root);\n };\n MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {\n if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new MDCRipple(el, foundation); }; }\n if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new MDCLineRipple(el); }; }\n if (helperTextFactory === void 0) { helperTextFactory = function (el) {\n return new MDCTextFieldHelperText(el);\n }; }\n if (characterCounterFactory === void 0) { characterCounterFactory = function (el) {\n return new MDCTextFieldCharacterCounter(el);\n }; }\n if (iconFactory === void 0) { iconFactory = function (el) { return new MDCTextFieldIcon(el); }; }\n if (labelFactory === void 0) { labelFactory = function (el) { return new MDCFloatingLabel(el); }; }\n if (outlineFactory === void 0) { outlineFactory = function (el) { return new MDCNotchedOutline(el); }; }\n this.input =\n this.root.querySelector(strings.INPUT_SELECTOR);\n var labelElement = this.root.querySelector(strings.LABEL_SELECTOR);\n this.label = labelElement ? labelFactory(labelElement) : null;\n var lineRippleElement = this.root.querySelector(strings.LINE_RIPPLE_SELECTOR);\n this.lineRipple =\n lineRippleElement ? lineRippleFactory(lineRippleElement) : null;\n var outlineElement = this.root.querySelector(strings.OUTLINE_SELECTOR);\n this.outline = outlineElement ? outlineFactory(outlineElement) : null;\n // Helper text\n var helperTextStrings = MDCTextFieldHelperTextFoundation.strings;\n var nextElementSibling = this.root.nextElementSibling;\n var hasHelperLine = (nextElementSibling && nextElementSibling.classList.contains(cssClasses.HELPER_LINE));\n var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);\n this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;\n // Character counter\n var characterCounterStrings = MDCTextFieldCharacterCounterFoundation.strings;\n var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);\n // If character counter is not found in root element search in sibling element.\n if (!characterCounterEl && hasHelperLine && nextElementSibling) {\n characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);\n }\n this.characterCounter =\n characterCounterEl ? characterCounterFactory(characterCounterEl) : null;\n // Leading icon\n var leadingIconEl = this.root.querySelector(strings.LEADING_ICON_SELECTOR);\n this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;\n // Trailing icon\n var trailingIconEl = this.root.querySelector(strings.TRAILING_ICON_SELECTOR);\n this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;\n // Prefix and Suffix\n this.prefix = this.root.querySelector(strings.PREFIX_SELECTOR);\n this.suffix = this.root.querySelector(strings.SUFFIX_SELECTOR);\n this.ripple = this.createRipple(rippleFactory);\n };\n MDCTextField.prototype.destroy = function () {\n if (this.ripple) {\n this.ripple.destroy();\n }\n if (this.lineRipple) {\n this.lineRipple.destroy();\n }\n if (this.helperText) {\n this.helperText.destroy();\n }\n if (this.characterCounter) {\n this.characterCounter.destroy();\n }\n if (this.leadingIcon) {\n this.leadingIcon.destroy();\n }\n if (this.trailingIcon) {\n this.trailingIcon.destroy();\n }\n if (this.label) {\n this.label.destroy();\n }\n if (this.outline) {\n this.outline.destroy();\n }\n _super.prototype.destroy.call(this);\n };\n /**\n * Initializes the Text Field's internal state based on the environment's\n * state.\n */\n MDCTextField.prototype.initialSyncWithDOM = function () {\n this.disabled = this.input.disabled;\n };\n Object.defineProperty(MDCTextField.prototype, \"value\", {\n get: function () {\n return this.foundation.getValue();\n },\n /**\n * @param value The value to set on the input.\n */\n set: function (value) {\n this.foundation.setValue(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"disabled\", {\n get: function () {\n return this.foundation.isDisabled();\n },\n /**\n * @param disabled Sets the Text Field disabled or enabled.\n */\n set: function (disabled) {\n this.foundation.setDisabled(disabled);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"valid\", {\n get: function () {\n return this.foundation.isValid();\n },\n /**\n * @param valid Sets the Text Field valid or invalid.\n */\n set: function (valid) {\n this.foundation.setValid(valid);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"required\", {\n get: function () {\n return this.input.required;\n },\n /**\n * @param required Sets the Text Field to required.\n */\n set: function (required) {\n this.input.required = required;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"pattern\", {\n get: function () {\n return this.input.pattern;\n },\n /**\n * @param pattern Sets the input element's validation pattern.\n */\n set: function (pattern) {\n this.input.pattern = pattern;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"minLength\", {\n get: function () {\n return this.input.minLength;\n },\n /**\n * @param minLength Sets the input element's minLength.\n */\n set: function (minLength) {\n this.input.minLength = minLength;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"maxLength\", {\n get: function () {\n return this.input.maxLength;\n },\n /**\n * @param maxLength Sets the input element's maxLength.\n */\n set: function (maxLength) {\n // Chrome throws exception if maxLength is set to a value less than zero\n if (maxLength < 0) {\n this.input.removeAttribute('maxLength');\n }\n else {\n this.input.maxLength = maxLength;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"min\", {\n get: function () {\n return this.input.min;\n },\n /**\n * @param min Sets the input element's min.\n */\n set: function (min) {\n this.input.min = min;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"max\", {\n get: function () {\n return this.input.max;\n },\n /**\n * @param max Sets the input element's max.\n */\n set: function (max) {\n this.input.max = max;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"step\", {\n get: function () {\n return this.input.step;\n },\n /**\n * @param step Sets the input element's step.\n */\n set: function (step) {\n this.input.step = step;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"helperTextContent\", {\n /**\n * Sets the helper text element content.\n */\n set: function (content) {\n this.foundation.setHelperTextContent(content);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"leadingIconAriaLabel\", {\n /**\n * Sets the aria label of the leading icon.\n */\n set: function (label) {\n this.foundation.setLeadingIconAriaLabel(label);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"leadingIconContent\", {\n /**\n * Sets the text content of the leading icon.\n */\n set: function (content) {\n this.foundation.setLeadingIconContent(content);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"trailingIconAriaLabel\", {\n /**\n * Sets the aria label of the trailing icon.\n */\n set: function (label) {\n this.foundation.setTrailingIconAriaLabel(label);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"trailingIconContent\", {\n /**\n * Sets the text content of the trailing icon.\n */\n set: function (content) {\n this.foundation.setTrailingIconContent(content);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"useNativeValidation\", {\n /**\n * Enables or disables the use of native validation. Use this for custom validation.\n * @param useNativeValidation Set this to false to ignore native input validation.\n */\n set: function (useNativeValidation) {\n this.foundation.setUseNativeValidation(useNativeValidation);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"prefixText\", {\n /**\n * Gets the text content of the prefix, or null if it does not exist.\n */\n get: function () {\n return this.prefix ? this.prefix.textContent : null;\n },\n /**\n * Sets the text content of the prefix, if it exists.\n */\n set: function (prefixText) {\n if (this.prefix) {\n this.prefix.textContent = prefixText;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextField.prototype, \"suffixText\", {\n /**\n * Gets the text content of the suffix, or null if it does not exist.\n */\n get: function () {\n return this.suffix ? this.suffix.textContent : null;\n },\n /**\n * Sets the text content of the suffix, if it exists.\n */\n set: function (suffixText) {\n if (this.suffix) {\n this.suffix.textContent = suffixText;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Focuses the input element.\n */\n MDCTextField.prototype.focus = function () {\n this.input.focus();\n };\n /**\n * Recomputes the outline SVG path for the outline element.\n */\n MDCTextField.prototype.layout = function () {\n var openNotch = this.foundation.shouldFloat;\n this.foundation.notchOutline(openNotch);\n };\n MDCTextField.prototype.getDefaultFoundation = function () {\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());\n // tslint:enable:object-literal-sort-keys\n return new MDCTextFieldFoundation(adapter, this.getFoundationMap());\n };\n MDCTextField.prototype.getRootAdapterMethods = function () {\n var _this = this;\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function (className) { return _this.root.classList.add(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n registerTextFieldInteractionHandler: function (evtType, handler) {\n _this.listen(evtType, handler);\n },\n deregisterTextFieldInteractionHandler: function (evtType, handler) {\n _this.unlisten(evtType, handler);\n },\n registerValidationAttributeChangeHandler: function (handler) {\n var getAttributesList = function (mutationsList) {\n return mutationsList\n .map(function (mutation) { return mutation.attributeName; })\n .filter(function (attributeName) { return attributeName; });\n };\n var observer = new MutationObserver(function (mutationsList) { return handler(getAttributesList(mutationsList)); });\n var config = { attributes: true };\n observer.observe(_this.input, config);\n return observer;\n },\n deregisterValidationAttributeChangeHandler: function (observer) {\n observer.disconnect();\n },\n };\n // tslint:enable:object-literal-sort-keys\n };\n MDCTextField.prototype.getInputAdapterMethods = function () {\n var _this = this;\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n getNativeInput: function () { return _this.input; },\n setInputAttr: function (attr, value) {\n _this.input.setAttribute(attr, value);\n },\n removeInputAttr: function (attr) {\n _this.input.removeAttribute(attr);\n },\n isFocused: function () { return document.activeElement === _this.input; },\n registerInputInteractionHandler: function (evtType, handler) {\n _this.input.addEventListener(evtType, handler, applyPassive());\n },\n deregisterInputInteractionHandler: function (evtType, handler) {\n _this.input.removeEventListener(evtType, handler, applyPassive());\n },\n };\n // tslint:enable:object-literal-sort-keys\n };\n MDCTextField.prototype.getLabelAdapterMethods = function () {\n var _this = this;\n return {\n floatLabel: function (shouldFloat) {\n _this.label && _this.label.float(shouldFloat);\n },\n getLabelWidth: function () { return _this.label ? _this.label.getWidth() : 0; },\n hasLabel: function () { return Boolean(_this.label); },\n shakeLabel: function (shouldShake) {\n _this.label && _this.label.shake(shouldShake);\n },\n setLabelRequired: function (isRequired) {\n _this.label && _this.label.setRequired(isRequired);\n },\n };\n };\n MDCTextField.prototype.getLineRippleAdapterMethods = function () {\n var _this = this;\n return {\n activateLineRipple: function () {\n if (_this.lineRipple) {\n _this.lineRipple.activate();\n }\n },\n deactivateLineRipple: function () {\n if (_this.lineRipple) {\n _this.lineRipple.deactivate();\n }\n },\n setLineRippleTransformOrigin: function (normalizedX) {\n if (_this.lineRipple) {\n _this.lineRipple.setRippleCenter(normalizedX);\n }\n },\n };\n };\n MDCTextField.prototype.getOutlineAdapterMethods = function () {\n var _this = this;\n return {\n closeOutline: function () {\n _this.outline && _this.outline.closeNotch();\n },\n hasOutline: function () { return Boolean(_this.outline); },\n notchOutline: function (labelWidth) {\n _this.outline && _this.outline.notch(labelWidth);\n },\n };\n };\n /**\n * @return A map of all subcomponents to subfoundations.\n */\n MDCTextField.prototype.getFoundationMap = function () {\n return {\n characterCounter: this.characterCounter ?\n this.characterCounter.foundationForTextField :\n undefined,\n helperText: this.helperText ? this.helperText.foundationForTextField :\n undefined,\n leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField :\n undefined,\n trailingIcon: this.trailingIcon ?\n this.trailingIcon.foundationForTextField :\n undefined,\n };\n };\n MDCTextField.prototype.createRipple = function (rippleFactory) {\n var _this = this;\n var isTextArea = this.root.classList.contains(cssClasses.TEXTAREA);\n var isOutlined = this.root.classList.contains(cssClasses.OUTLINED);\n if (isTextArea || isOutlined) {\n return null;\n }\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { isSurfaceActive: function () { return ponyfill.matches(_this.input, ':active'); }, registerInteractionHandler: function (evtType, handler) {\n _this.input.addEventListener(evtType, handler, applyPassive());\n }, deregisterInteractionHandler: function (evtType, handler) {\n _this.input.removeEventListener(evtType, handler, applyPassive());\n } });\n // tslint:enable:object-literal-sort-keys\n return rippleFactory(this.root, new MDCRippleFoundation(adapter));\n };\n return MDCTextField;\n}(MDCComponent));\nexport { MDCTextField };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n CLOSING: 'mdc-snackbar--closing',\n OPEN: 'mdc-snackbar--open',\n OPENING: 'mdc-snackbar--opening',\n};\nvar strings = {\n ACTION_SELECTOR: '.mdc-snackbar__action',\n ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',\n CLOSED_EVENT: 'MDCSnackbar:closed',\n CLOSING_EVENT: 'MDCSnackbar:closing',\n DISMISS_SELECTOR: '.mdc-snackbar__dismiss',\n LABEL_SELECTOR: '.mdc-snackbar__label',\n OPENED_EVENT: 'MDCSnackbar:opened',\n OPENING_EVENT: 'MDCSnackbar:opening',\n REASON_ACTION: 'action',\n REASON_DISMISS: 'dismiss',\n SURFACE_SELECTOR: '.mdc-snackbar__surface',\n};\nvar numbers = {\n DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,\n INDETERMINATE: -1,\n MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,\n MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,\n // These variables need to be kept in sync with the values in _variables.scss.\n SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,\n SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,\n /**\n * Number of milliseconds to wait between temporarily clearing the label text\n * in the DOM and subsequently restoring it. This is necessary to force IE 11\n * to pick up the `aria-live` content change and announce it to the user.\n */\n ARIA_LIVE_DELAY_MS: 1000,\n};\nexport { cssClasses, strings, numbers };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { numbers, strings } from './constants';\nvar ARIA_LIVE_DELAY_MS = numbers.ARIA_LIVE_DELAY_MS;\nvar ARIA_LIVE_LABEL_TEXT_ATTR = strings.ARIA_LIVE_LABEL_TEXT_ATTR;\nfunction announce(ariaEl, labelEl) {\n if (labelEl === void 0) { labelEl = ariaEl; }\n var priority = ariaEl.getAttribute('aria-live');\n // Trim text to ignore ` ` (see below).\n // textContent is only null if the node is a document, DOCTYPE, or notation.\n var labelText = labelEl.textContent.trim();\n if (!labelText || !priority) {\n return;\n }\n // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.\n ariaEl.setAttribute('aria-live', 'off');\n // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.\n // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars\n // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.\n // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,\n // so screen readers won't announce the second message unless we first clear `textContent`.\n //\n // We have to clear the label text two different ways to make it work in all browsers and screen readers:\n //\n // 1. `textContent = ''` is required for IE11 + JAWS\n // 2. `innerHTML = ' '` is required for Chrome + JAWS and NVDA\n //\n // All other browser/screen reader combinations support both methods.\n //\n // The wrapper `` visually hides the space character so that it doesn't cause jank when added/removed.\n // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.\n //\n // This technique has been tested in:\n //\n // * JAWS 2019:\n // - Chrome 70\n // - Firefox 60 (ESR)\n // - IE 11\n // * NVDA 2018:\n // - Chrome 70\n // - Firefox 60 (ESR)\n // - IE 11\n // * ChromeVox 53\n labelEl.textContent = '';\n // For the second case, assigning a string directly to innerHTML results in a\n // Trusted Types violation. Work around that by using document.createElement.\n var span = document.createElement('span');\n span.setAttribute('style', 'display: inline-block; width: 0; height: 1px;');\n span.textContent = '\\u00a0'; // Equivalent to  \n labelEl.appendChild(span);\n // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.\n // CSS generated content is normally announced by screen readers\n // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);\n // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.\n labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);\n setTimeout(function () {\n // Allow screen readers to announce changes to the DOM again.\n ariaEl.setAttribute('aria-live', priority);\n // Remove the message from the ::before pseudo-element.\n labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);\n // Restore the original label text, which will be announced by screen readers.\n labelEl.textContent = labelText;\n }, ARIA_LIVE_DELAY_MS);\n}\nexport { announce };\n//# sourceMappingURL=util.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nvar OPENING = cssClasses.OPENING, OPEN = cssClasses.OPEN, CLOSING = cssClasses.CLOSING;\nvar REASON_ACTION = strings.REASON_ACTION, REASON_DISMISS = strings.REASON_DISMISS;\nvar MDCSnackbarFoundation = /** @class */ (function (_super) {\n __extends(MDCSnackbarFoundation, _super);\n function MDCSnackbarFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this;\n _this.opened = false;\n _this.animationFrame = 0;\n _this.animationTimer = 0;\n _this.autoDismissTimer = 0;\n _this.autoDismissTimeoutMs = numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;\n _this.closeOnEscape = true;\n return _this;\n }\n Object.defineProperty(MDCSnackbarFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbarFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbarFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbarFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n announce: function () { return undefined; },\n notifyClosed: function () { return undefined; },\n notifyClosing: function () { return undefined; },\n notifyOpened: function () { return undefined; },\n notifyOpening: function () { return undefined; },\n removeClass: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCSnackbarFoundation.prototype.destroy = function () {\n this.clearAutoDismissTimer();\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n clearTimeout(this.animationTimer);\n this.animationTimer = 0;\n this.adapter.removeClass(OPENING);\n this.adapter.removeClass(OPEN);\n this.adapter.removeClass(CLOSING);\n };\n MDCSnackbarFoundation.prototype.open = function () {\n var _this = this;\n this.clearAutoDismissTimer();\n this.opened = true;\n this.adapter.notifyOpening();\n this.adapter.removeClass(CLOSING);\n this.adapter.addClass(OPENING);\n this.adapter.announce();\n // Wait a frame once display is no longer \"none\", to establish basis for animation\n this.runNextAnimationFrame(function () {\n _this.adapter.addClass(OPEN);\n _this.animationTimer = setTimeout(function () {\n var timeoutMs = _this.getTimeoutMs();\n _this.handleAnimationTimerEnd();\n _this.adapter.notifyOpened();\n if (timeoutMs !== numbers.INDETERMINATE) {\n _this.autoDismissTimer = setTimeout(function () {\n _this.close(REASON_DISMISS);\n }, timeoutMs);\n }\n }, numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);\n });\n };\n /**\n * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the\n * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom\n * client-specific values may also be used if desired.\n */\n MDCSnackbarFoundation.prototype.close = function (reason) {\n var _this = this;\n if (reason === void 0) { reason = ''; }\n if (!this.opened) {\n // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed\n return;\n }\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n this.clearAutoDismissTimer();\n this.opened = false;\n this.adapter.notifyClosing(reason);\n this.adapter.addClass(cssClasses.CLOSING);\n this.adapter.removeClass(cssClasses.OPEN);\n this.adapter.removeClass(cssClasses.OPENING);\n clearTimeout(this.animationTimer);\n this.animationTimer = setTimeout(function () {\n _this.handleAnimationTimerEnd();\n _this.adapter.notifyClosed(reason);\n }, numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);\n };\n MDCSnackbarFoundation.prototype.isOpen = function () {\n return this.opened;\n };\n MDCSnackbarFoundation.prototype.getTimeoutMs = function () {\n return this.autoDismissTimeoutMs;\n };\n MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {\n // Use shorter variable names to make the code more readable\n var minValue = numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;\n var maxValue = numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;\n var indeterminateValue = numbers.INDETERMINATE;\n if (timeoutMs === numbers.INDETERMINATE || (timeoutMs <= maxValue && timeoutMs >= minValue)) {\n this.autoDismissTimeoutMs = timeoutMs;\n }\n else {\n throw new Error(\"\\n timeoutMs must be an integer in the range \" + minValue + \"\\u2013\" + maxValue + \"\\n (or \" + indeterminateValue + \" to disable), but got '\" + timeoutMs + \"'\");\n }\n };\n MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {\n return this.closeOnEscape;\n };\n MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {\n this.closeOnEscape = closeOnEscape;\n };\n MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {\n var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;\n if (isEscapeKey && this.getCloseOnEscape()) {\n this.close(REASON_DISMISS);\n }\n };\n MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {\n this.close(REASON_ACTION);\n };\n MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {\n this.close(REASON_DISMISS);\n };\n MDCSnackbarFoundation.prototype.clearAutoDismissTimer = function () {\n clearTimeout(this.autoDismissTimer);\n this.autoDismissTimer = 0;\n };\n MDCSnackbarFoundation.prototype.handleAnimationTimerEnd = function () {\n this.animationTimer = 0;\n this.adapter.removeClass(cssClasses.OPENING);\n this.adapter.removeClass(cssClasses.CLOSING);\n };\n /**\n * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.\n */\n MDCSnackbarFoundation.prototype.runNextAnimationFrame = function (callback) {\n var _this = this;\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = requestAnimationFrame(function () {\n _this.animationFrame = 0;\n clearTimeout(_this.animationTimer);\n _this.animationTimer = setTimeout(callback, 0);\n });\n };\n return MDCSnackbarFoundation;\n}(MDCFoundation));\nexport { MDCSnackbarFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCSnackbarFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { closest } from '@material/dom/ponyfill';\nimport { strings } from './constants';\nimport { MDCSnackbarFoundation } from './foundation';\nimport * as util from './util';\nvar SURFACE_SELECTOR = strings.SURFACE_SELECTOR, LABEL_SELECTOR = strings.LABEL_SELECTOR, ACTION_SELECTOR = strings.ACTION_SELECTOR, DISMISS_SELECTOR = strings.DISMISS_SELECTOR, OPENING_EVENT = strings.OPENING_EVENT, OPENED_EVENT = strings.OPENED_EVENT, CLOSING_EVENT = strings.CLOSING_EVENT, CLOSED_EVENT = strings.CLOSED_EVENT;\nvar MDCSnackbar = /** @class */ (function (_super) {\n __extends(MDCSnackbar, _super);\n function MDCSnackbar() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCSnackbar.attachTo = function (root) {\n return new MDCSnackbar(root);\n };\n MDCSnackbar.prototype.initialize = function (announcerFactory) {\n if (announcerFactory === void 0) { announcerFactory = function () { return util.announce; }; }\n this.announce = announcerFactory();\n };\n MDCSnackbar.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.surfaceEl = this.root.querySelector(SURFACE_SELECTOR);\n this.labelEl = this.root.querySelector(LABEL_SELECTOR);\n this.actionEl = this.root.querySelector(ACTION_SELECTOR);\n this.handleKeyDown = function (evt) {\n _this.foundation.handleKeyDown(evt);\n };\n this.handleSurfaceClick = function (evt) {\n var target = evt.target;\n if (_this.isActionButton(target)) {\n _this.foundation.handleActionButtonClick(evt);\n }\n else if (_this.isActionIcon(target)) {\n _this.foundation.handleActionIconClick(evt);\n }\n };\n this.registerKeyDownHandler(this.handleKeyDown);\n this.registerSurfaceClickHandler(this.handleSurfaceClick);\n };\n MDCSnackbar.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.deregisterKeyDownHandler(this.handleKeyDown);\n this.deregisterSurfaceClickHandler(this.handleSurfaceClick);\n };\n MDCSnackbar.prototype.open = function () {\n this.foundation.open();\n };\n /**\n * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the\n * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom\n * client-specific values may also be used if desired.\n */\n MDCSnackbar.prototype.close = function (reason) {\n if (reason === void 0) { reason = ''; }\n this.foundation.close(reason);\n };\n MDCSnackbar.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n announce: function () {\n _this.announce(_this.labelEl);\n },\n notifyClosed: function (reason) { return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {}); },\n notifyClosing: function (reason) { return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {}); },\n notifyOpened: function () { return _this.emit(OPENED_EVENT, {}); },\n notifyOpening: function () { return _this.emit(OPENING_EVENT, {}); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n };\n return new MDCSnackbarFoundation(adapter);\n };\n Object.defineProperty(MDCSnackbar.prototype, \"timeoutMs\", {\n get: function () {\n return this.foundation.getTimeoutMs();\n },\n set: function (timeoutMs) {\n this.foundation.setTimeoutMs(timeoutMs);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbar.prototype, \"closeOnEscape\", {\n get: function () {\n return this.foundation.getCloseOnEscape();\n },\n set: function (closeOnEscape) {\n this.foundation.setCloseOnEscape(closeOnEscape);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbar.prototype, \"isOpen\", {\n get: function () {\n return this.foundation.isOpen();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbar.prototype, \"labelText\", {\n get: function () {\n // This property only returns null if the node is a document, DOCTYPE,\n // or notation. On Element nodes, it always returns a string.\n return this.labelEl.textContent;\n },\n set: function (labelText) {\n this.labelEl.textContent = labelText;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSnackbar.prototype, \"actionButtonText\", {\n get: function () {\n return this.actionEl.textContent;\n },\n set: function (actionButtonText) {\n this.actionEl.textContent = actionButtonText;\n },\n enumerable: false,\n configurable: true\n });\n MDCSnackbar.prototype.registerKeyDownHandler = function (handler) {\n this.listen('keydown', handler);\n };\n MDCSnackbar.prototype.deregisterKeyDownHandler = function (handler) {\n this.unlisten('keydown', handler);\n };\n MDCSnackbar.prototype.registerSurfaceClickHandler = function (handler) {\n this.surfaceEl.addEventListener('click', handler);\n };\n MDCSnackbar.prototype.deregisterSurfaceClickHandler = function (handler) {\n this.surfaceEl.removeEventListener('click', handler);\n };\n MDCSnackbar.prototype.isActionButton = function (target) {\n return Boolean(closest(target, ACTION_SELECTOR));\n };\n MDCSnackbar.prototype.isActionIcon = function (target) {\n return Boolean(closest(target, DISMISS_SELECTOR));\n };\n return MDCSnackbar;\n}(MDCComponent));\nexport { MDCSnackbar };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',\n ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',\n ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',\n ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',\n ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',\n ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',\n BACKGROUND: 'mdc-checkbox__background',\n CHECKED: 'mdc-checkbox--checked',\n CHECKMARK: 'mdc-checkbox__checkmark',\n CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',\n DISABLED: 'mdc-checkbox--disabled',\n INDETERMINATE: 'mdc-checkbox--indeterminate',\n MIXEDMARK: 'mdc-checkbox__mixedmark',\n NATIVE_CONTROL: 'mdc-checkbox__native-control',\n ROOT: 'mdc-checkbox',\n SELECTED: 'mdc-checkbox--selected',\n UPGRADED: 'mdc-checkbox--upgraded',\n};\nexport var strings = {\n ARIA_CHECKED_ATTR: 'aria-checked',\n ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',\n DATA_INDETERMINATE_ATTR: 'data-indeterminate',\n NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',\n TRANSITION_STATE_CHECKED: 'checked',\n TRANSITION_STATE_INDETERMINATE: 'indeterminate',\n TRANSITION_STATE_INIT: 'init',\n TRANSITION_STATE_UNCHECKED: 'unchecked',\n};\nexport var numbers = {\n ANIM_END_LATCH_MS: 250,\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nvar MDCCheckboxFoundation = /** @class */ (function (_super) {\n __extends(MDCCheckboxFoundation, _super);\n function MDCCheckboxFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;\n _this.currentCheckState = strings.TRANSITION_STATE_INIT;\n _this.currentAnimationClass = '';\n _this.animEndLatchTimer = 0;\n _this.enableAnimationEndHandler = false;\n return _this;\n }\n Object.defineProperty(MDCCheckboxFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckboxFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckboxFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckboxFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n forceLayout: function () { return undefined; },\n hasNativeControl: function () { return false; },\n isAttachedToDOM: function () { return false; },\n isChecked: function () { return false; },\n isIndeterminate: function () { return false; },\n removeClass: function () { return undefined; },\n removeNativeControlAttr: function () { return undefined; },\n setNativeControlAttr: function () { return undefined; },\n setNativeControlDisabled: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCCheckboxFoundation.prototype.init = function () {\n this.currentCheckState = this.determineCheckState();\n this.updateAriaChecked();\n this.adapter.addClass(cssClasses.UPGRADED);\n };\n MDCCheckboxFoundation.prototype.destroy = function () {\n clearTimeout(this.animEndLatchTimer);\n };\n MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {\n this.adapter.setNativeControlDisabled(disabled);\n if (disabled) {\n this.adapter.addClass(cssClasses.DISABLED);\n }\n else {\n this.adapter.removeClass(cssClasses.DISABLED);\n }\n };\n /**\n * Handles the animationend event for the checkbox\n */\n MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {\n var _this = this;\n if (!this.enableAnimationEndHandler) {\n return;\n }\n clearTimeout(this.animEndLatchTimer);\n this.animEndLatchTimer = setTimeout(function () {\n _this.adapter.removeClass(_this.currentAnimationClass);\n _this.enableAnimationEndHandler = false;\n }, numbers.ANIM_END_LATCH_MS);\n };\n /**\n * Handles the change event for the checkbox\n */\n MDCCheckboxFoundation.prototype.handleChange = function () {\n this.transitionCheckState();\n };\n MDCCheckboxFoundation.prototype.transitionCheckState = function () {\n if (!this.adapter.hasNativeControl()) {\n return;\n }\n var oldState = this.currentCheckState;\n var newState = this.determineCheckState();\n if (oldState === newState) {\n return;\n }\n this.updateAriaChecked();\n var TRANSITION_STATE_UNCHECKED = strings.TRANSITION_STATE_UNCHECKED;\n var SELECTED = cssClasses.SELECTED;\n if (newState === TRANSITION_STATE_UNCHECKED) {\n this.adapter.removeClass(SELECTED);\n }\n else {\n this.adapter.addClass(SELECTED);\n }\n // Check to ensure that there isn't a previously existing animation class, in case for example\n // the user interacted with the checkbox before the animation was finished.\n if (this.currentAnimationClass.length > 0) {\n clearTimeout(this.animEndLatchTimer);\n this.adapter.forceLayout();\n this.adapter.removeClass(this.currentAnimationClass);\n }\n this.currentAnimationClass =\n this.getTransitionAnimationClass(oldState, newState);\n this.currentCheckState = newState;\n // Check for parentNode so that animations are only run when the element is attached\n // to the DOM.\n if (this.adapter.isAttachedToDOM() &&\n this.currentAnimationClass.length > 0) {\n this.adapter.addClass(this.currentAnimationClass);\n this.enableAnimationEndHandler = true;\n }\n };\n MDCCheckboxFoundation.prototype.determineCheckState = function () {\n var TRANSITION_STATE_INDETERMINATE = strings.TRANSITION_STATE_INDETERMINATE, TRANSITION_STATE_CHECKED = strings.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = strings.TRANSITION_STATE_UNCHECKED;\n if (this.adapter.isIndeterminate()) {\n return TRANSITION_STATE_INDETERMINATE;\n }\n return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED :\n TRANSITION_STATE_UNCHECKED;\n };\n MDCCheckboxFoundation.prototype.getTransitionAnimationClass = function (oldState, newState) {\n var TRANSITION_STATE_INIT = strings.TRANSITION_STATE_INIT, TRANSITION_STATE_CHECKED = strings.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = strings.TRANSITION_STATE_UNCHECKED;\n var _a = MDCCheckboxFoundation.cssClasses, ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED, ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE, ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED, ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE, ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED, ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;\n switch (oldState) {\n case TRANSITION_STATE_INIT:\n if (newState === TRANSITION_STATE_UNCHECKED) {\n return '';\n }\n return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;\n case TRANSITION_STATE_UNCHECKED:\n return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;\n case TRANSITION_STATE_CHECKED:\n return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;\n default: // TRANSITION_STATE_INDETERMINATE\n return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;\n }\n };\n MDCCheckboxFoundation.prototype.updateAriaChecked = function () {\n // Ensure aria-checked is set to mixed if checkbox is in indeterminate state.\n if (this.adapter.isIndeterminate()) {\n this.adapter.setNativeControlAttr(strings.ARIA_CHECKED_ATTR, strings.ARIA_CHECKED_INDETERMINATE_VALUE);\n }\n else {\n // The on/off state does not need to keep track of aria-checked, since\n // the screenreader uses the checked property on the checkbox element.\n this.adapter.removeNativeControlAttr(strings.ARIA_CHECKED_ATTR);\n }\n };\n return MDCCheckboxFoundation;\n}(MDCFoundation));\nexport { MDCCheckboxFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCCheckboxFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { getCorrectEventName } from '@material/animation/util';\nimport { MDCComponent } from '@material/base/component';\nimport { applyPassive } from '@material/dom/events';\nimport { matches } from '@material/dom/ponyfill';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCRippleFoundation } from '@material/ripple/foundation';\nimport { strings } from './constants';\nimport { MDCCheckboxFoundation } from './foundation';\nvar CB_PROTO_PROPS = ['checked', 'indeterminate'];\nvar MDCCheckbox = /** @class */ (function (_super) {\n __extends(MDCCheckbox, _super);\n function MDCCheckbox() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.rippleSurface = _this.createRipple();\n return _this;\n }\n MDCCheckbox.attachTo = function (root) {\n return new MDCCheckbox(root);\n };\n Object.defineProperty(MDCCheckbox.prototype, \"ripple\", {\n get: function () {\n return this.rippleSurface;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckbox.prototype, \"checked\", {\n get: function () {\n return this.getNativeControl().checked;\n },\n set: function (checked) {\n this.getNativeControl().checked = checked;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckbox.prototype, \"indeterminate\", {\n get: function () {\n return this.getNativeControl().indeterminate;\n },\n set: function (indeterminate) {\n this.getNativeControl().indeterminate = indeterminate;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckbox.prototype, \"disabled\", {\n get: function () {\n return this.getNativeControl().disabled;\n },\n set: function (disabled) {\n this.foundation.setDisabled(disabled);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCCheckbox.prototype, \"value\", {\n get: function () {\n return this.getNativeControl().value;\n },\n set: function (value) {\n this.getNativeControl().value = value;\n },\n enumerable: false,\n configurable: true\n });\n MDCCheckbox.prototype.initialize = function () {\n var DATA_INDETERMINATE_ATTR = strings.DATA_INDETERMINATE_ATTR;\n this.getNativeControl().indeterminate =\n this.getNativeControl().getAttribute(DATA_INDETERMINATE_ATTR) ===\n 'true';\n this.getNativeControl().removeAttribute(DATA_INDETERMINATE_ATTR);\n };\n MDCCheckbox.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleChange = function () {\n _this.foundation.handleChange();\n };\n this.handleAnimationEnd = function () {\n _this.foundation.handleAnimationEnd();\n };\n this.getNativeControl().addEventListener('change', this.handleChange);\n this.listen(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);\n this.installPropertyChangeHooks();\n };\n MDCCheckbox.prototype.destroy = function () {\n this.rippleSurface.destroy();\n this.getNativeControl().removeEventListener('change', this.handleChange);\n this.unlisten(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);\n this.uninstallPropertyChangeHooks();\n _super.prototype.destroy.call(this);\n };\n MDCCheckbox.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addClass: function (className) { return _this.root.classList.add(className); },\n forceLayout: function () { return _this.root.offsetWidth; },\n hasNativeControl: function () { return !!_this.getNativeControl(); },\n isAttachedToDOM: function () { return Boolean(_this.root.parentNode); },\n isChecked: function () { return _this.checked; },\n isIndeterminate: function () { return _this.indeterminate; },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n removeNativeControlAttr: function (attr) {\n _this.getNativeControl().removeAttribute(attr);\n },\n setNativeControlAttr: function (attr, value) {\n _this.getNativeControl().setAttribute(attr, value);\n },\n setNativeControlDisabled: function (disabled) {\n _this.getNativeControl().disabled = disabled;\n },\n };\n return new MDCCheckboxFoundation(adapter);\n };\n MDCCheckbox.prototype.createRipple = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n var adapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function (evtType, handler) {\n _this.getNativeControl().removeEventListener(evtType, handler, applyPassive());\n }, isSurfaceActive: function () { return matches(_this.getNativeControl(), ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) {\n _this.getNativeControl().addEventListener(evtType, handler, applyPassive());\n } });\n return new MDCRipple(this.root, new MDCRippleFoundation(adapter));\n };\n MDCCheckbox.prototype.installPropertyChangeHooks = function () {\n var e_1, _a;\n var _this = this;\n var nativeCb = this.getNativeControl();\n var cbProto = Object.getPrototypeOf(nativeCb);\n var _loop_1 = function (controlState) {\n var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);\n // We have to check for this descriptor, since some browsers (Safari) don't support its return.\n // See: https://bugs.webkit.org/show_bug.cgi?id=49739\n if (!validDescriptor(desc)) {\n return { value: void 0 };\n }\n // Type cast is needed for compatibility with Closure Compiler.\n var nativeGetter = desc.get;\n var nativeCbDesc = {\n configurable: desc.configurable,\n enumerable: desc.enumerable,\n get: nativeGetter,\n set: function (state) {\n desc.set.call(nativeCb, state);\n _this.foundation.handleChange();\n },\n };\n Object.defineProperty(nativeCb, controlState, nativeCbDesc);\n };\n try {\n for (var CB_PROTO_PROPS_1 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next(); !CB_PROTO_PROPS_1_1.done; CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next()) {\n var controlState = CB_PROTO_PROPS_1_1.value;\n var state_1 = _loop_1(controlState);\n if (typeof state_1 === \"object\")\n return state_1.value;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (CB_PROTO_PROPS_1_1 && !CB_PROTO_PROPS_1_1.done && (_a = CB_PROTO_PROPS_1.return)) _a.call(CB_PROTO_PROPS_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n MDCCheckbox.prototype.uninstallPropertyChangeHooks = function () {\n var e_2, _a;\n var nativeCb = this.getNativeControl();\n var cbProto = Object.getPrototypeOf(nativeCb);\n try {\n for (var CB_PROTO_PROPS_2 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next(); !CB_PROTO_PROPS_2_1.done; CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next()) {\n var controlState = CB_PROTO_PROPS_2_1.value;\n var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);\n if (!validDescriptor(desc)) {\n return;\n }\n Object.defineProperty(nativeCb, controlState, desc);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (CB_PROTO_PROPS_2_1 && !CB_PROTO_PROPS_2_1.done && (_a = CB_PROTO_PROPS_2.return)) _a.call(CB_PROTO_PROPS_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n MDCCheckbox.prototype.getNativeControl = function () {\n var NATIVE_CONTROL_SELECTOR = strings.NATIVE_CONTROL_SELECTOR;\n var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);\n if (!el) {\n throw new Error(\"Checkbox component requires a \" + NATIVE_CONTROL_SELECTOR + \" element\");\n }\n return el;\n };\n return MDCCheckbox;\n}(MDCComponent));\nexport { MDCCheckbox };\nfunction validDescriptor(inputPropDesc) {\n return !!inputPropDesc && typeof inputPropDesc.set === 'function';\n}\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n CLOSED_CLASS: 'mdc-linear-progress--closed',\n CLOSED_ANIMATION_OFF_CLASS: 'mdc-linear-progress--closed-animation-off',\n INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',\n REVERSED_CLASS: 'mdc-linear-progress--reversed',\n ANIMATION_READY_CLASS: 'mdc-linear-progress--animation-ready',\n};\nexport var strings = {\n ARIA_HIDDEN: 'aria-hidden',\n ARIA_VALUEMAX: 'aria-valuemax',\n ARIA_VALUEMIN: 'aria-valuemin',\n ARIA_VALUENOW: 'aria-valuenow',\n BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar',\n FLEX_BASIS: 'flex-basis',\n PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar',\n};\n// these are percentages pulled from keyframes.scss\nexport var animationDimensionPercentages = {\n PRIMARY_HALF: .8367142,\n PRIMARY_FULL: 2.00611057,\n SECONDARY_QUARTER: .37651913,\n SECONDARY_HALF: .84386165,\n SECONDARY_FULL: 1.60277782,\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { getCorrectPropertyName } from '@material/animation/util';\nimport { MDCFoundation } from '@material/base/foundation';\nimport { animationDimensionPercentages as percents, cssClasses, strings } from './constants';\nvar MDCLinearProgressFoundation = /** @class */ (function (_super) {\n __extends(MDCLinearProgressFoundation, _super);\n function MDCLinearProgressFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this;\n _this.observer = null;\n return _this;\n }\n Object.defineProperty(MDCLinearProgressFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCLinearProgressFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCLinearProgressFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n attachResizeObserver: function () { return null; },\n forceLayout: function () { return undefined; },\n getWidth: function () { return 0; },\n hasClass: function () { return false; },\n setBufferBarStyle: function () { return null; },\n setPrimaryBarStyle: function () { return null; },\n setStyle: function () { return undefined; },\n removeAttribute: function () { return undefined; },\n removeClass: function () { return undefined; },\n setAttribute: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCLinearProgressFoundation.prototype.init = function () {\n var _this = this;\n this.determinate = !this.adapter.hasClass(cssClasses.INDETERMINATE_CLASS);\n this.adapter.addClass(cssClasses.ANIMATION_READY_CLASS);\n this.progress = 0;\n this.buffer = 1;\n this.observer = this.adapter.attachResizeObserver(function (entries) {\n var e_1, _a;\n if (_this.determinate) {\n return;\n }\n try {\n for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {\n var entry = entries_1_1.value;\n if (entry.contentRect) {\n _this.calculateAndSetDimensions(entry.contentRect.width);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n });\n if (!this.determinate && this.observer) {\n this.calculateAndSetDimensions(this.adapter.getWidth());\n }\n };\n MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {\n this.determinate = isDeterminate;\n if (this.determinate) {\n this.adapter.removeClass(cssClasses.INDETERMINATE_CLASS);\n this.adapter.setAttribute(strings.ARIA_VALUENOW, this.progress.toString());\n this.adapter.setAttribute(strings.ARIA_VALUEMAX, '1');\n this.adapter.setAttribute(strings.ARIA_VALUEMIN, '0');\n this.setPrimaryBarProgress(this.progress);\n this.setBufferBarProgress(this.buffer);\n return;\n }\n if (this.observer) {\n this.calculateAndSetDimensions(this.adapter.getWidth());\n }\n this.adapter.addClass(cssClasses.INDETERMINATE_CLASS);\n this.adapter.removeAttribute(strings.ARIA_VALUENOW);\n this.adapter.removeAttribute(strings.ARIA_VALUEMAX);\n this.adapter.removeAttribute(strings.ARIA_VALUEMIN);\n this.setPrimaryBarProgress(1);\n this.setBufferBarProgress(1);\n };\n MDCLinearProgressFoundation.prototype.isDeterminate = function () {\n return this.determinate;\n };\n MDCLinearProgressFoundation.prototype.setProgress = function (value) {\n this.progress = value;\n if (this.determinate) {\n this.setPrimaryBarProgress(value);\n this.adapter.setAttribute(strings.ARIA_VALUENOW, value.toString());\n }\n };\n MDCLinearProgressFoundation.prototype.getProgress = function () {\n return this.progress;\n };\n MDCLinearProgressFoundation.prototype.setBuffer = function (value) {\n this.buffer = value;\n if (this.determinate) {\n this.setBufferBarProgress(value);\n }\n };\n MDCLinearProgressFoundation.prototype.getBuffer = function () {\n return this.buffer;\n };\n MDCLinearProgressFoundation.prototype.open = function () {\n this.adapter.removeClass(cssClasses.CLOSED_CLASS);\n this.adapter.removeClass(cssClasses.CLOSED_ANIMATION_OFF_CLASS);\n this.adapter.removeAttribute(strings.ARIA_HIDDEN);\n };\n MDCLinearProgressFoundation.prototype.close = function () {\n this.adapter.addClass(cssClasses.CLOSED_CLASS);\n this.adapter.setAttribute(strings.ARIA_HIDDEN, 'true');\n };\n MDCLinearProgressFoundation.prototype.isClosed = function () {\n return this.adapter.hasClass(cssClasses.CLOSED_CLASS);\n };\n /**\n * Handles the transitionend event emitted after `close()` is called and the\n * opacity fades out. This is so that animations are removed only after the\n * progress indicator is completely hidden.\n */\n MDCLinearProgressFoundation.prototype.handleTransitionEnd = function () {\n if (this.adapter.hasClass(cssClasses.CLOSED_CLASS)) {\n this.adapter.addClass(cssClasses.CLOSED_ANIMATION_OFF_CLASS);\n }\n };\n MDCLinearProgressFoundation.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n if (this.observer) {\n this.observer.disconnect();\n }\n };\n MDCLinearProgressFoundation.prototype.restartAnimation = function () {\n this.adapter.removeClass(cssClasses.ANIMATION_READY_CLASS);\n this.adapter.forceLayout();\n this.adapter.addClass(cssClasses.ANIMATION_READY_CLASS);\n };\n MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) {\n var value = \"scaleX(\" + progressValue + \")\";\n // Accessing `window` without a `typeof` check will throw on Node\n // environments.\n var transformProp = typeof window !== 'undefined' ?\n getCorrectPropertyName(window, 'transform') :\n 'transform';\n this.adapter.setPrimaryBarStyle(transformProp, value);\n };\n MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) {\n var value = progressValue * 100 + \"%\";\n this.adapter.setBufferBarStyle(strings.FLEX_BASIS, value);\n };\n MDCLinearProgressFoundation.prototype.calculateAndSetDimensions = function (width) {\n var primaryHalf = width * percents.PRIMARY_HALF;\n var primaryFull = width * percents.PRIMARY_FULL;\n var secondaryQuarter = width * percents.SECONDARY_QUARTER;\n var secondaryHalf = width * percents.SECONDARY_HALF;\n var secondaryFull = width * percents.SECONDARY_FULL;\n this.adapter.setStyle('--mdc-linear-progress-primary-half', primaryHalf + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-primary-half-neg', -primaryHalf + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-primary-full', primaryFull + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-primary-full-neg', -primaryFull + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-quarter', secondaryQuarter + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-quarter-neg', -secondaryQuarter + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-half', secondaryHalf + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-half-neg', -secondaryHalf + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-full', secondaryFull + \"px\");\n this.adapter.setStyle('--mdc-linear-progress-secondary-full-neg', -secondaryFull + \"px\");\n // need to restart animation for custom props to apply to keyframes\n this.restartAnimation();\n };\n return MDCLinearProgressFoundation;\n}(MDCFoundation));\nexport { MDCLinearProgressFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCLinearProgressFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCLinearProgressFoundation } from './foundation';\nvar MDCLinearProgress = /** @class */ (function (_super) {\n __extends(MDCLinearProgress, _super);\n function MDCLinearProgress() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCLinearProgress.attachTo = function (root) {\n return new MDCLinearProgress(root);\n };\n Object.defineProperty(MDCLinearProgress.prototype, \"determinate\", {\n set: function (value) {\n this.foundation.setDeterminate(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCLinearProgress.prototype, \"progress\", {\n set: function (value) {\n this.foundation.setProgress(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCLinearProgress.prototype, \"buffer\", {\n set: function (value) {\n this.foundation.setBuffer(value);\n },\n enumerable: false,\n configurable: true\n });\n MDCLinearProgress.prototype.open = function () {\n this.foundation.open();\n };\n MDCLinearProgress.prototype.close = function () {\n this.foundation.close();\n };\n MDCLinearProgress.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.root.addEventListener('transitionend', function () {\n _this.foundation.handleTransitionEnd();\n });\n };\n MDCLinearProgress.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n forceLayout: function () {\n _this.root.getBoundingClientRect();\n },\n setBufferBarStyle: function (styleProperty, value) {\n var bufferBar = _this.root.querySelector(MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);\n if (bufferBar) {\n bufferBar.style.setProperty(styleProperty, value);\n }\n },\n setPrimaryBarStyle: function (styleProperty, value) {\n var primaryBar = _this.root.querySelector(MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);\n if (primaryBar) {\n primaryBar.style.setProperty(styleProperty, value);\n }\n },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n removeAttribute: function (attributeName) {\n _this.root.removeAttribute(attributeName);\n },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n setAttribute: function (attributeName, value) {\n _this.root.setAttribute(attributeName, value);\n },\n setStyle: function (name, value) {\n _this.root.style.setProperty(name, value);\n },\n attachResizeObserver: function (callback) {\n var RO = window.ResizeObserver;\n if (RO) {\n var ro = new RO(callback);\n ro.observe(_this.root);\n return ro;\n }\n return null;\n },\n getWidth: function () { return _this.root.offsetWidth; },\n };\n return new MDCLinearProgressFoundation(adapter);\n };\n return MDCLinearProgress;\n}(MDCComponent));\nexport { MDCLinearProgress };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * CSS class names used in component.\n */\nexport var cssClasses = {\n CELL: 'mdc-data-table__cell',\n CELL_NUMERIC: 'mdc-data-table__cell--numeric',\n CONTENT: 'mdc-data-table__content',\n HEADER_CELL: 'mdc-data-table__header-cell',\n HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label',\n HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted',\n HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending',\n HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort',\n HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper',\n HEADER_ROW: 'mdc-data-table__header-row',\n HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',\n IN_PROGRESS: 'mdc-data-table--in-progress',\n LINEAR_PROGRESS: 'mdc-data-table__linear-progress',\n PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label',\n PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select',\n PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator',\n ROOT: 'mdc-data-table',\n ROW: 'mdc-data-table__row',\n ROW_CHECKBOX: 'mdc-data-table__row-checkbox',\n ROW_SELECTED: 'mdc-data-table__row--selected',\n SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button',\n SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label',\n TABLE_CONTAINER: 'mdc-data-table__table-container',\n};\n/**\n * DOM attributes used in component.\n */\nexport var attributes = {\n ARIA_SELECTED: 'aria-selected',\n ARIA_SORT: 'aria-sort',\n};\n/**\n * List of data attributes used in component.\n */\nexport var dataAttributes = {\n COLUMN_ID: 'data-column-id',\n ROW_ID: 'data-row-id',\n};\n/**\n * CSS selectors used in component.\n */\nexport var selectors = {\n CONTENT: \".\" + cssClasses.CONTENT,\n HEADER_CELL: \".\" + cssClasses.HEADER_CELL,\n HEADER_CELL_WITH_SORT: \".\" + cssClasses.HEADER_CELL_WITH_SORT,\n HEADER_ROW: \".\" + cssClasses.HEADER_ROW,\n HEADER_ROW_CHECKBOX: \".\" + cssClasses.HEADER_ROW_CHECKBOX,\n PROGRESS_INDICATOR: \".\" + cssClasses.PROGRESS_INDICATOR,\n ROW: \".\" + cssClasses.ROW,\n ROW_CHECKBOX: \".\" + cssClasses.ROW_CHECKBOX,\n ROW_SELECTED: \".\" + cssClasses.ROW_SELECTED,\n SORT_ICON_BUTTON: \".\" + cssClasses.SORT_ICON_BUTTON,\n SORT_STATUS_LABEL: \".\" + cssClasses.SORT_STATUS_LABEL,\n};\n/**\n * Messages used in component.\n */\nexport var messages = {\n SORTED_IN_DESCENDING: 'Sorted in descending order',\n SORTED_IN_ASCENDING: 'Sorted in ascending order',\n};\n/**\n * Attributes and selectors used in component.\n * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead.\n */\nexport var strings = {\n ARIA_SELECTED: attributes.ARIA_SELECTED,\n ARIA_SORT: attributes.ARIA_SORT,\n DATA_ROW_ID_ATTR: dataAttributes.ROW_ID,\n HEADER_ROW_CHECKBOX_SELECTOR: selectors.HEADER_ROW_CHECKBOX,\n ROW_CHECKBOX_SELECTOR: selectors.ROW_CHECKBOX,\n ROW_SELECTED_SELECTOR: selectors.ROW_SELECTED,\n ROW_SELECTOR: selectors.ROW,\n};\n/**\n * Sort values defined by ARIA.\n * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort\n */\nexport var SortValue;\n(function (SortValue) {\n // Items are sorted in ascending order by this column.\n SortValue[\"ASCENDING\"] = \"ascending\";\n // Items are sorted in descending order by this column.\n SortValue[\"DESCENDING\"] = \"descending\";\n // There is no defined sort applied to the column.\n SortValue[\"NONE\"] = \"none\";\n // A sort algorithm other than ascending or descending has been applied.\n SortValue[\"OTHER\"] = \"other\";\n})(SortValue || (SortValue = {}));\n/**\n * Event names used in component.\n */\nexport var events = {\n ROW_CLICK: 'MDCDataTable:rowClick',\n ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',\n SELECTED_ALL: 'MDCDataTable:selectedAll',\n SORTED: 'MDCDataTable:sorted',\n UNSELECTED_ALL: 'MDCDataTable:unselectedAll',\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __awaiter, __extends, __generator } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, SortValue, strings } from './constants';\n/**\n * The Foundation of data table component containing pure business logic, any\n * logic requiring DOM manipulation are delegated to adapter methods.\n */\nvar MDCDataTableFoundation = /** @class */ (function (_super) {\n __extends(MDCDataTableFoundation, _super);\n function MDCDataTableFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCDataTableFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n addClassAtRowIndex: function () { return undefined; },\n getAttributeByHeaderCellIndex: function () { return ''; },\n getHeaderCellCount: function () { return 0; },\n getHeaderCellElements: function () { return []; },\n getRowCount: function () { return 0; },\n getRowElements: function () { return []; },\n getRowIdAtIndex: function () { return ''; },\n getRowIndexByChildElement: function () { return 0; },\n getSelectedRowCount: function () { return 0; },\n getTableContainerHeight: function () { return 0; },\n getTableHeaderHeight: function () { return 0; },\n isCheckboxAtRowIndexChecked: function () { return false; },\n isHeaderRowCheckboxChecked: function () { return false; },\n isRowsSelectable: function () { return false; },\n notifyRowSelectionChanged: function () { return undefined; },\n notifySelectedAll: function () { return undefined; },\n notifySortAction: function () { return undefined; },\n notifyUnselectedAll: function () { return undefined; },\n notifyRowClick: function () { return undefined; },\n registerHeaderRowCheckbox: function () { return undefined; },\n registerRowCheckboxes: function () { return undefined; },\n removeClass: function () { return undefined; },\n removeClassAtRowIndex: function () { return undefined; },\n removeClassNameByHeaderCellIndex: function () { return undefined; },\n setAttributeAtRowIndex: function () { return undefined; },\n setAttributeByHeaderCellIndex: function () { return undefined; },\n setClassNameByHeaderCellIndex: function () { return undefined; },\n setHeaderRowCheckboxChecked: function () { return undefined; },\n setHeaderRowCheckboxIndeterminate: function () { return undefined; },\n setProgressIndicatorStyles: function () { return undefined; },\n setRowCheckboxCheckedAtIndex: function () { return undefined; },\n setSortStatusLabelByHeaderCellIndex: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Re-initializes header row checkbox and row checkboxes when selectable rows\n * are added or removed from table. Use this if registering checkbox is\n * synchronous.\n */\n MDCDataTableFoundation.prototype.layout = function () {\n if (this.adapter.isRowsSelectable()) {\n this.adapter.registerHeaderRowCheckbox();\n this.adapter.registerRowCheckboxes();\n this.setHeaderRowCheckboxState();\n }\n };\n /**\n * Re-initializes header row checkbox and row checkboxes when selectable rows\n * are added or removed from table. Use this if registering checkbox is\n * asynchronous.\n */\n MDCDataTableFoundation.prototype.layoutAsync = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3];\n return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.adapter.registerRowCheckboxes()];\n case 2:\n _a.sent();\n this.setHeaderRowCheckboxState();\n _a.label = 3;\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * @return Returns array of row elements.\n */\n MDCDataTableFoundation.prototype.getRows = function () {\n return this.adapter.getRowElements();\n };\n /**\n * @return Array of header cell elements.\n */\n MDCDataTableFoundation.prototype.getHeaderCells = function () {\n return this.adapter.getHeaderCellElements();\n };\n /**\n * Sets selected row ids. Overwrites previously selected rows.\n * @param rowIds Array of row ids that needs to be selected.\n */\n MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {\n for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {\n var rowId = this.adapter.getRowIdAtIndex(rowIndex);\n var isSelected = false;\n if (rowId && rowIds.indexOf(rowId) >= 0) {\n isSelected = true;\n }\n this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);\n this.selectRowAtIndex(rowIndex, isSelected);\n }\n this.setHeaderRowCheckboxState();\n };\n /**\n * @return Returns array of all row ids.\n */\n MDCDataTableFoundation.prototype.getRowIds = function () {\n var rowIds = [];\n for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {\n rowIds.push(this.adapter.getRowIdAtIndex(rowIndex));\n }\n return rowIds;\n };\n /**\n * @return Returns array of selected row ids.\n */\n MDCDataTableFoundation.prototype.getSelectedRowIds = function () {\n var selectedRowIds = [];\n for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {\n if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) {\n selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex));\n }\n }\n return selectedRowIds;\n };\n /**\n * Handles header row checkbox change event.\n */\n MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {\n var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked();\n for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {\n this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);\n this.selectRowAtIndex(rowIndex, isHeaderChecked);\n }\n if (isHeaderChecked) {\n this.adapter.notifySelectedAll();\n }\n else {\n this.adapter.notifyUnselectedAll();\n }\n };\n /**\n * Handles change event originated from row checkboxes.\n */\n MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {\n var rowIndex = this.adapter.getRowIndexByChildElement(event.target);\n if (rowIndex === -1) {\n return;\n }\n var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex);\n this.selectRowAtIndex(rowIndex, selected);\n this.setHeaderRowCheckboxState();\n var rowId = this.adapter.getRowIdAtIndex(rowIndex);\n this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });\n };\n /**\n * Handles sort action on sortable header cell.\n */\n MDCDataTableFoundation.prototype.handleSortAction = function (eventData) {\n var columnId = eventData.columnId, columnIndex = eventData.columnIndex, headerCell = eventData.headerCell;\n // Reset sort attributes / classes on other header cells.\n for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) {\n if (index === columnIndex) {\n continue;\n }\n this.adapter.removeClassNameByHeaderCellIndex(index, cssClasses.HEADER_CELL_SORTED);\n this.adapter.removeClassNameByHeaderCellIndex(index, cssClasses.HEADER_CELL_SORTED_DESCENDING);\n this.adapter.setAttributeByHeaderCellIndex(index, strings.ARIA_SORT, SortValue.NONE);\n this.adapter.setSortStatusLabelByHeaderCellIndex(index, SortValue.NONE);\n }\n // Set appropriate sort attributes / classes on target header cell.\n this.adapter.setClassNameByHeaderCellIndex(columnIndex, cssClasses.HEADER_CELL_SORTED);\n var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, strings.ARIA_SORT);\n var sortValue = SortValue.NONE;\n // Set to descending if sorted on ascending order.\n if (currentSortValue === SortValue.ASCENDING) {\n this.adapter.setClassNameByHeaderCellIndex(columnIndex, cssClasses.HEADER_CELL_SORTED_DESCENDING);\n this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings.ARIA_SORT, SortValue.DESCENDING);\n sortValue = SortValue.DESCENDING;\n // Set to ascending if sorted on descending order.\n }\n else if (currentSortValue === SortValue.DESCENDING) {\n this.adapter.removeClassNameByHeaderCellIndex(columnIndex, cssClasses.HEADER_CELL_SORTED_DESCENDING);\n this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings.ARIA_SORT, SortValue.ASCENDING);\n sortValue = SortValue.ASCENDING;\n }\n else {\n // Set to ascending by default when not sorted.\n this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings.ARIA_SORT, SortValue.ASCENDING);\n sortValue = SortValue.ASCENDING;\n }\n this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue);\n this.adapter.notifySortAction({\n columnId: columnId,\n columnIndex: columnIndex,\n headerCell: headerCell,\n sortValue: sortValue,\n });\n };\n /**\n * Handles data table row click event.\n */\n MDCDataTableFoundation.prototype.handleRowClick = function (_a) {\n var rowId = _a.rowId, row = _a.row;\n this.adapter.notifyRowClick({\n rowId: rowId,\n row: row,\n });\n };\n /**\n * Shows progress indicator blocking only the table body content when in\n * loading state.\n */\n MDCDataTableFoundation.prototype.showProgress = function () {\n var tableHeaderHeight = this.adapter.getTableHeaderHeight();\n // Calculate the height of table content (Not scroll content) excluding\n // header row height.\n var height = this.adapter.getTableContainerHeight() - tableHeaderHeight;\n var top = tableHeaderHeight;\n this.adapter.setProgressIndicatorStyles({\n height: height + \"px\",\n top: top + \"px\",\n });\n this.adapter.addClass(cssClasses.IN_PROGRESS);\n };\n /**\n * Hides progress indicator when data table is finished loading.\n */\n MDCDataTableFoundation.prototype.hideProgress = function () {\n this.adapter.removeClass(cssClasses.IN_PROGRESS);\n };\n /**\n * Updates header row checkbox state based on number of rows selected.\n */\n MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () {\n if (this.adapter.getSelectedRowCount() === 0) {\n this.adapter.setHeaderRowCheckboxChecked(false);\n this.adapter.setHeaderRowCheckboxIndeterminate(false);\n }\n else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) {\n this.adapter.setHeaderRowCheckboxChecked(true);\n this.adapter.setHeaderRowCheckboxIndeterminate(false);\n }\n else {\n this.adapter.setHeaderRowCheckboxIndeterminate(true);\n this.adapter.setHeaderRowCheckboxChecked(false);\n }\n };\n /**\n * Sets the attributes of row element based on selection state.\n */\n MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) {\n if (selected) {\n this.adapter.addClassAtRowIndex(rowIndex, cssClasses.ROW_SELECTED);\n this.adapter.setAttributeAtRowIndex(rowIndex, strings.ARIA_SELECTED, 'true');\n }\n else {\n this.adapter.removeClassAtRowIndex(rowIndex, cssClasses.ROW_SELECTED);\n this.adapter.setAttributeAtRowIndex(rowIndex, strings.ARIA_SELECTED, 'false');\n }\n };\n return MDCDataTableFoundation;\n}(MDCFoundation));\nexport { MDCDataTableFoundation };\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __values } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCCheckbox } from '@material/checkbox/component';\nimport { closest } from '@material/dom/ponyfill';\nimport { MDCLinearProgress } from '@material/linear-progress/component';\nimport { cssClasses, dataAttributes, events, messages, selectors, SortValue } from './constants';\nimport { MDCDataTableFoundation } from './foundation';\n/**\n * Implementation of `MDCDataTableFoundation`\n */\nvar MDCDataTable = /** @class */ (function (_super) {\n __extends(MDCDataTable, _super);\n function MDCDataTable() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCDataTable.attachTo = function (root) {\n return new MDCDataTable(root);\n };\n MDCDataTable.prototype.initialize = function (checkboxFactory) {\n if (checkboxFactory === void 0) { checkboxFactory = function (el) { return new MDCCheckbox(el); }; }\n this.checkboxFactory = checkboxFactory;\n };\n MDCDataTable.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.headerRow =\n this.root.querySelector(\".\" + cssClasses.HEADER_ROW);\n this.handleHeaderRowCheckboxChange = function () {\n _this.foundation.handleHeaderRowCheckboxChange();\n };\n this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange);\n this.headerRowClickListener = function (event) {\n _this.handleHeaderRowClick(event);\n };\n this.headerRow.addEventListener('click', this.headerRowClickListener);\n this.content =\n this.root.querySelector(\".\" + cssClasses.CONTENT);\n this.handleContentClick = function (event) {\n var dataRowEl = closest(event.target, selectors.ROW);\n if (!dataRowEl)\n return;\n _this.foundation.handleRowClick({\n rowId: _this.getRowIdByRowElement(dataRowEl),\n row: dataRowEl,\n });\n };\n this.content.addEventListener('click', this.handleContentClick);\n this.handleRowCheckboxChange = function (event) {\n _this.foundation.handleRowCheckboxChange(event);\n };\n this.content.addEventListener('change', this.handleRowCheckboxChange);\n this.layout();\n };\n /**\n * Re-initializes header row checkbox and row checkboxes when selectable rows\n * are added or removed from table.\n */\n MDCDataTable.prototype.layout = function () {\n this.foundation.layout();\n };\n /**\n * @return Returns array of header row cell elements.\n */\n MDCDataTable.prototype.getHeaderCells = function () {\n return [].slice.call(this.root.querySelectorAll(selectors.HEADER_CELL));\n };\n /**\n * @return Returns array of row elements.\n */\n MDCDataTable.prototype.getRows = function () {\n return this.foundation.getRows();\n };\n /**\n * @return Returns array of selected row ids.\n */\n MDCDataTable.prototype.getSelectedRowIds = function () {\n return this.foundation.getSelectedRowIds();\n };\n /**\n * Sets selected row ids. Overwrites previously selected rows.\n * @param rowIds Array of row ids that needs to be selected.\n */\n MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {\n this.foundation.setSelectedRowIds(rowIds);\n };\n /**\n * Shows progress indicator when data table is in loading state.\n */\n MDCDataTable.prototype.showProgress = function () {\n this.getLinearProgress().open();\n this.foundation.showProgress();\n };\n /**\n * Hides progress indicator after data table is finished loading.\n */\n MDCDataTable.prototype.hideProgress = function () {\n this.foundation.hideProgress();\n this.getLinearProgress().close();\n };\n MDCDataTable.prototype.destroy = function () {\n var e_1, _a;\n if (this.handleHeaderRowCheckboxChange) {\n this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange);\n }\n if (this.headerRowClickListener) {\n this.headerRow.removeEventListener('click', this.headerRowClickListener);\n }\n if (this.handleRowCheckboxChange) {\n this.content.removeEventListener('change', this.handleRowCheckboxChange);\n }\n if (this.headerRowCheckbox) {\n this.headerRowCheckbox.destroy();\n }\n if (this.rowCheckboxList) {\n try {\n for (var _b = __values(this.rowCheckboxList), _c = _b.next(); !_c.done; _c = _b.next()) {\n var checkbox = _c.value;\n checkbox.destroy();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n if (this.handleContentClick) {\n this.content.removeEventListener('click', this.handleContentClick);\n }\n };\n MDCDataTable.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n getHeaderCellElements: function () { return _this.getHeaderCells(); },\n getHeaderCellCount: function () { return _this.getHeaderCells().length; },\n getAttributeByHeaderCellIndex: function (index, attribute) {\n return _this.getHeaderCells()[index].getAttribute(attribute);\n },\n setAttributeByHeaderCellIndex: function (index, attribute, value) {\n _this.getHeaderCells()[index].setAttribute(attribute, value);\n },\n setClassNameByHeaderCellIndex: function (index, className) {\n _this.getHeaderCells()[index].classList.add(className);\n },\n removeClassNameByHeaderCellIndex: function (index, className) {\n _this.getHeaderCells()[index].classList.remove(className);\n },\n notifySortAction: function (data) {\n _this.emit(events.SORTED, data, /** shouldBubble */ true);\n },\n getTableContainerHeight: function () {\n var tableContainer = _this.root.querySelector(\".\" + cssClasses.TABLE_CONTAINER);\n if (!tableContainer) {\n throw new Error('MDCDataTable: Table container element not found.');\n }\n return tableContainer.getBoundingClientRect().height;\n },\n getTableHeaderHeight: function () {\n var tableHeader = _this.root.querySelector(selectors.HEADER_ROW);\n if (!tableHeader) {\n throw new Error('MDCDataTable: Table header element not found.');\n }\n return tableHeader.getBoundingClientRect().height;\n },\n setProgressIndicatorStyles: function (styles) {\n var progressIndicator = _this.root.querySelector(selectors.PROGRESS_INDICATOR);\n if (!progressIndicator) {\n throw new Error('MDCDataTable: Progress indicator element not found.');\n }\n progressIndicator.style.setProperty('height', styles.height);\n progressIndicator.style.setProperty('top', styles.top);\n },\n addClassAtRowIndex: function (rowIndex, className) {\n _this.getRows()[rowIndex].classList.add(className);\n },\n getRowCount: function () { return _this.getRows().length; },\n getRowElements: function () { return [].slice.call(_this.root.querySelectorAll(selectors.ROW)); },\n getRowIdAtIndex: function (rowIndex) {\n return _this.getRows()[rowIndex].getAttribute(dataAttributes.ROW_ID);\n },\n getRowIndexByChildElement: function (el) {\n return _this.getRows().indexOf(closest(el, selectors.ROW));\n },\n getSelectedRowCount: function () {\n return _this.root.querySelectorAll(selectors.ROW_SELECTED).length;\n },\n isCheckboxAtRowIndexChecked: function (rowIndex) {\n return _this.rowCheckboxList[rowIndex].checked;\n },\n isHeaderRowCheckboxChecked: function () { return _this.headerRowCheckbox.checked; },\n isRowsSelectable: function () {\n return !!_this.root.querySelector(selectors.ROW_CHECKBOX) ||\n !!_this.root.querySelector(selectors.HEADER_ROW_CHECKBOX);\n },\n notifyRowSelectionChanged: function (data) {\n _this.emit(events.ROW_SELECTION_CHANGED, {\n row: _this.getRowByIndex(data.rowIndex),\n rowId: _this.getRowIdByIndex(data.rowIndex),\n rowIndex: data.rowIndex,\n selected: data.selected,\n }, \n /** shouldBubble */ true);\n },\n notifySelectedAll: function () {\n _this.emit(events.SELECTED_ALL, {}, /** shouldBubble */ true);\n },\n notifyUnselectedAll: function () {\n _this.emit(events.UNSELECTED_ALL, {}, /** shouldBubble */ true);\n },\n notifyRowClick: function (data) {\n _this.emit(events.ROW_CLICK, data, /** shouldBubble */ true);\n },\n registerHeaderRowCheckbox: function () {\n if (_this.headerRowCheckbox) {\n _this.headerRowCheckbox.destroy();\n }\n var checkboxEl = _this.root.querySelector(selectors.HEADER_ROW_CHECKBOX);\n _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl);\n },\n registerRowCheckboxes: function () {\n if (_this.rowCheckboxList) {\n _this.rowCheckboxList.forEach(function (checkbox) {\n checkbox.destroy();\n });\n }\n _this.rowCheckboxList = [];\n _this.getRows().forEach(function (rowEl) {\n var checkbox = _this.checkboxFactory(rowEl.querySelector(selectors.ROW_CHECKBOX));\n _this.rowCheckboxList.push(checkbox);\n });\n },\n removeClassAtRowIndex: function (rowIndex, className) {\n _this.getRows()[rowIndex].classList.remove(className);\n },\n setAttributeAtRowIndex: function (rowIndex, attr, value) {\n _this.getRows()[rowIndex].setAttribute(attr, value);\n },\n setHeaderRowCheckboxChecked: function (checked) {\n _this.headerRowCheckbox.checked = checked;\n },\n setHeaderRowCheckboxIndeterminate: function (indeterminate) {\n _this.headerRowCheckbox.indeterminate = indeterminate;\n },\n setRowCheckboxCheckedAtIndex: function (rowIndex, checked) {\n _this.rowCheckboxList[rowIndex].checked = checked;\n },\n setSortStatusLabelByHeaderCellIndex: function (columnIndex, sortValue) {\n var headerCell = _this.getHeaderCells()[columnIndex];\n var sortStatusLabel = headerCell.querySelector(selectors.SORT_STATUS_LABEL);\n if (!sortStatusLabel)\n return;\n sortStatusLabel.textContent =\n _this.getSortStatusMessageBySortValue(sortValue);\n },\n };\n return new MDCDataTableFoundation(adapter);\n };\n MDCDataTable.prototype.getRowByIndex = function (index) {\n return this.getRows()[index];\n };\n MDCDataTable.prototype.getRowIdByIndex = function (index) {\n return this.getRowByIndex(index).getAttribute(dataAttributes.ROW_ID);\n };\n MDCDataTable.prototype.handleHeaderRowClick = function (event) {\n var headerCell = closest(event.target, selectors.HEADER_CELL_WITH_SORT);\n if (!headerCell) {\n return;\n }\n var columnId = headerCell.getAttribute(dataAttributes.COLUMN_ID);\n var columnIndex = this.getHeaderCells().indexOf(headerCell);\n if (columnIndex === -1) {\n return;\n }\n this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell });\n };\n MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) {\n switch (sortValue) {\n case SortValue.ASCENDING:\n return messages.SORTED_IN_ASCENDING;\n case SortValue.DESCENDING:\n return messages.SORTED_IN_DESCENDING;\n default:\n return '';\n }\n };\n MDCDataTable.prototype.getLinearProgressElement = function () {\n var el = this.root.querySelector(\".\" + cssClasses.LINEAR_PROGRESS);\n if (!el) {\n throw new Error('MDCDataTable: linear progress element is not found.');\n }\n return el;\n };\n MDCDataTable.prototype.getLinearProgress = function () {\n if (!this.linearProgress) {\n var el = this.getLinearProgressElement();\n this.linearProgress = new MDCLinearProgress(el);\n }\n return this.linearProgress;\n };\n MDCDataTable.prototype.getRowIdByRowElement = function (rowElement) {\n return rowElement.getAttribute(dataAttributes.ROW_ID);\n };\n return MDCDataTable;\n}(MDCComponent));\nexport { MDCDataTable };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Computes the ripple client rect for the primary action given the raw client\n * rect and the selected width graphic style property.\n */\nexport function computePrimaryActionRippleClientRect(clientRect, graphicSelectedWidthStyleValue) {\n // parseInt is banned so we need to manually format and parse the string.\n var graphicWidth = Number(graphicSelectedWidthStyleValue.replace('px', ''));\n if (Number.isNaN(graphicWidth)) {\n return clientRect;\n }\n // Can't use the spread operator because it has internal problems\n return {\n width: clientRect.width + graphicWidth,\n height: clientRect.height,\n top: clientRect.top,\n right: clientRect.right,\n bottom: clientRect.bottom,\n left: clientRect.left\n };\n}\n/**\n * Provides the CSS custom property whose value is read by\n * computePrimaryRippleClientRect. The CSS custom property provides the width\n * of the chip graphic when selected. It is only set for the unselected chip\n * variant without a leadinc icon. In all other cases, it will have no value.\n */\nexport var GRAPHIC_SELECTED_WIDTH_STYLE_PROP = '--mdc-chip-graphic-selected-width';\n//# sourceMappingURL=component-ripple.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * MDCChipActionCssClasses provides the classes to be queried and manipulated on\n * the root.\n */\nexport var MDCChipActionCssClasses;\n(function (MDCChipActionCssClasses) {\n MDCChipActionCssClasses[\"PRIMARY_ACTION\"] = \"mdc-evolution-chip__action--primary\";\n MDCChipActionCssClasses[\"TRAILING_ACTION\"] = \"mdc-evolution-chip__action--trailing\";\n MDCChipActionCssClasses[\"CHIP_ROOT\"] = \"mdc-evolution-chip\";\n})(MDCChipActionCssClasses || (MDCChipActionCssClasses = {}));\n/**\n * MDCChipActionInteractionTrigger provides detail of the different triggers for\n * action interactions.\n */\nexport var MDCChipActionInteractionTrigger;\n(function (MDCChipActionInteractionTrigger) {\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"UNSPECIFIED\"] = 0] = \"UNSPECIFIED\";\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"CLICK\"] = 1] = \"CLICK\";\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"BACKSPACE_KEY\"] = 2] = \"BACKSPACE_KEY\";\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"DELETE_KEY\"] = 3] = \"DELETE_KEY\";\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"SPACEBAR_KEY\"] = 4] = \"SPACEBAR_KEY\";\n MDCChipActionInteractionTrigger[MDCChipActionInteractionTrigger[\"ENTER_KEY\"] = 5] = \"ENTER_KEY\";\n})(MDCChipActionInteractionTrigger || (MDCChipActionInteractionTrigger = {}));\n/**\n * MDCChipActionType provides the different types of available actions.\n */\nexport var MDCChipActionType;\n(function (MDCChipActionType) {\n MDCChipActionType[MDCChipActionType[\"UNSPECIFIED\"] = 0] = \"UNSPECIFIED\";\n MDCChipActionType[MDCChipActionType[\"PRIMARY\"] = 1] = \"PRIMARY\";\n MDCChipActionType[MDCChipActionType[\"TRAILING\"] = 2] = \"TRAILING\";\n})(MDCChipActionType || (MDCChipActionType = {}));\n/**\n * MDCChipActionEvents provides the different events emitted by the action.\n */\nexport var MDCChipActionEvents;\n(function (MDCChipActionEvents) {\n MDCChipActionEvents[\"INTERACTION\"] = \"MDCChipAction:interaction\";\n MDCChipActionEvents[\"NAVIGATION\"] = \"MDCChipAction:navigation\";\n})(MDCChipActionEvents || (MDCChipActionEvents = {}));\n/**\n * MDCChipActionFocusBehavior provides configurations for focusing or unfocusing\n * an action.\n */\nexport var MDCChipActionFocusBehavior;\n(function (MDCChipActionFocusBehavior) {\n MDCChipActionFocusBehavior[MDCChipActionFocusBehavior[\"FOCUSABLE\"] = 0] = \"FOCUSABLE\";\n MDCChipActionFocusBehavior[MDCChipActionFocusBehavior[\"FOCUSABLE_AND_FOCUSED\"] = 1] = \"FOCUSABLE_AND_FOCUSED\";\n MDCChipActionFocusBehavior[MDCChipActionFocusBehavior[\"NOT_FOCUSABLE\"] = 2] = \"NOT_FOCUSABLE\";\n})(MDCChipActionFocusBehavior || (MDCChipActionFocusBehavior = {}));\n/**\n * MDCChipActionAttributes provides the HTML attributes used by the foundation.\n */\nexport var MDCChipActionAttributes;\n(function (MDCChipActionAttributes) {\n MDCChipActionAttributes[\"ARIA_DISABLED\"] = \"aria-disabled\";\n MDCChipActionAttributes[\"ARIA_HIDDEN\"] = \"aria-hidden\";\n MDCChipActionAttributes[\"ARIA_SELECTED\"] = \"aria-selected\";\n MDCChipActionAttributes[\"DATA_DELETABLE\"] = \"data-mdc-deletable\";\n MDCChipActionAttributes[\"DISABLED\"] = \"disabled\";\n MDCChipActionAttributes[\"ROLE\"] = \"role\";\n MDCChipActionAttributes[\"TAB_INDEX\"] = \"tabindex\";\n})(MDCChipActionAttributes || (MDCChipActionAttributes = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { isNavigationEvent, KEY, normalizeKey } from '@material/dom/keyboard';\nimport { MDCChipActionAttributes, MDCChipActionEvents, MDCChipActionFocusBehavior, MDCChipActionInteractionTrigger } from './constants';\nvar triggerMap = new Map();\ntriggerMap.set(KEY.SPACEBAR, MDCChipActionInteractionTrigger.SPACEBAR_KEY);\ntriggerMap.set(KEY.ENTER, MDCChipActionInteractionTrigger.ENTER_KEY);\ntriggerMap.set(KEY.DELETE, MDCChipActionInteractionTrigger.DELETE_KEY);\ntriggerMap.set(KEY.BACKSPACE, MDCChipActionInteractionTrigger.BACKSPACE_KEY);\n/**\n * MDCChipActionFoundation provides a base abstract foundation for all chip\n * actions.\n */\nvar MDCChipActionFoundation = /** @class */ (function (_super) {\n __extends(MDCChipActionFoundation, _super);\n function MDCChipActionFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCChipActionFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCChipActionFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n emitEvent: function () { return undefined; },\n focus: function () { return undefined; },\n getAttribute: function () { return null; },\n getElementID: function () { return ''; },\n removeAttribute: function () { return undefined; },\n setAttribute: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCChipActionFoundation.prototype.handleClick = function () {\n // Early exit for cases where the click comes from a source other than the\n // user's pointer (i.e. programmatic click from AT).\n if (this.isDisabled())\n return;\n this.emitInteraction(MDCChipActionInteractionTrigger.CLICK);\n };\n MDCChipActionFoundation.prototype.handleKeydown = function (event) {\n var key = normalizeKey(event);\n if (this.shouldNotifyInteractionFromKey(key)) {\n event.preventDefault();\n this.emitInteraction(this.getTriggerFromKey(key));\n return;\n }\n if (isNavigationEvent(event)) {\n event.preventDefault();\n this.emitNavigation(key);\n return;\n }\n };\n MDCChipActionFoundation.prototype.setDisabled = function (isDisabled) {\n // Use `aria-disabled` for the selectable (listbox) disabled state\n if (this.isSelectable()) {\n this.adapter.setAttribute(MDCChipActionAttributes.ARIA_DISABLED, \"\" + isDisabled);\n return;\n }\n if (isDisabled) {\n this.adapter.setAttribute(MDCChipActionAttributes.DISABLED, 'true');\n }\n else {\n this.adapter.removeAttribute(MDCChipActionAttributes.DISABLED);\n }\n };\n MDCChipActionFoundation.prototype.isDisabled = function () {\n if (this.adapter.getAttribute(MDCChipActionAttributes.ARIA_DISABLED) ===\n 'true') {\n return true;\n }\n if (this.adapter.getAttribute(MDCChipActionAttributes.DISABLED) !== null) {\n return true;\n }\n return false;\n };\n MDCChipActionFoundation.prototype.setFocus = function (behavior) {\n // Early exit if not focusable\n if (!this.isFocusable()) {\n return;\n }\n // Add it to the tab order and give focus\n if (behavior === MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED) {\n this.adapter.setAttribute(MDCChipActionAttributes.TAB_INDEX, '0');\n this.adapter.focus();\n return;\n }\n // Add to the tab order\n if (behavior === MDCChipActionFocusBehavior.FOCUSABLE) {\n this.adapter.setAttribute(MDCChipActionAttributes.TAB_INDEX, '0');\n return;\n }\n // Remove it from the tab order\n if (behavior === MDCChipActionFocusBehavior.NOT_FOCUSABLE) {\n this.adapter.setAttribute(MDCChipActionAttributes.TAB_INDEX, '-1');\n return;\n }\n };\n MDCChipActionFoundation.prototype.isFocusable = function () {\n if (this.isDisabled()) {\n return false;\n }\n if (this.adapter.getAttribute(MDCChipActionAttributes.ARIA_HIDDEN) ===\n 'true') {\n return false;\n }\n return true;\n };\n MDCChipActionFoundation.prototype.setSelected = function (isSelected) {\n // Early exit if not selectable\n if (!this.isSelectable()) {\n return;\n }\n this.adapter.setAttribute(MDCChipActionAttributes.ARIA_SELECTED, \"\" + isSelected);\n };\n MDCChipActionFoundation.prototype.isSelected = function () {\n return this.adapter.getAttribute(MDCChipActionAttributes.ARIA_SELECTED) ===\n 'true';\n };\n MDCChipActionFoundation.prototype.emitInteraction = function (trigger) {\n this.adapter.emitEvent(MDCChipActionEvents.INTERACTION, {\n actionID: this.adapter.getElementID(),\n source: this.actionType(),\n trigger: trigger,\n });\n };\n MDCChipActionFoundation.prototype.emitNavigation = function (key) {\n this.adapter.emitEvent(MDCChipActionEvents.NAVIGATION, {\n source: this.actionType(),\n key: key,\n });\n };\n MDCChipActionFoundation.prototype.shouldNotifyInteractionFromKey = function (key) {\n var isFromActionKey = key === KEY.ENTER || key === KEY.SPACEBAR;\n var isFromRemoveKey = key === KEY.BACKSPACE || key === KEY.DELETE;\n if (isFromActionKey) {\n return true;\n }\n if (isFromRemoveKey && this.shouldEmitInteractionOnRemoveKey()) {\n return true;\n }\n return false;\n };\n MDCChipActionFoundation.prototype.getTriggerFromKey = function (key) {\n var trigger = triggerMap.get(key);\n if (trigger) {\n return trigger;\n }\n // Default case, should ideally never be returned\n return MDCChipActionInteractionTrigger.UNSPECIFIED;\n };\n return MDCChipActionFoundation;\n}(MDCFoundation));\nexport { MDCChipActionFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCChipActionFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCChipActionAttributes, MDCChipActionType } from './constants';\nimport { MDCChipActionFoundation } from './foundation';\n/**\n * MDCChipPrimaryActionFoundation provides the business logic for the primary\n * chip action.\n */\nvar MDCChipPrimaryActionFoundation = /** @class */ (function (_super) {\n __extends(MDCChipPrimaryActionFoundation, _super);\n function MDCChipPrimaryActionFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCChipPrimaryActionFoundation.prototype.isSelectable = function () {\n return this.adapter.getAttribute(MDCChipActionAttributes.ROLE) === 'option';\n };\n MDCChipPrimaryActionFoundation.prototype.actionType = function () {\n return MDCChipActionType.PRIMARY;\n };\n MDCChipPrimaryActionFoundation.prototype.shouldEmitInteractionOnRemoveKey = function () {\n return this.adapter.getAttribute(MDCChipActionAttributes.DATA_DELETABLE) ===\n 'true';\n };\n return MDCChipPrimaryActionFoundation;\n}(MDCChipActionFoundation));\nexport { MDCChipPrimaryActionFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCChipPrimaryActionFoundation;\n//# sourceMappingURL=primary-foundation.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCChipActionType } from './constants';\nimport { MDCChipActionFoundation } from './foundation';\n/**\n * MDCChipTrailingActionFoundation provides the business logic for the trailing\n * chip action.\n */\nvar MDCChipTrailingActionFoundation = /** @class */ (function (_super) {\n __extends(MDCChipTrailingActionFoundation, _super);\n function MDCChipTrailingActionFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCChipTrailingActionFoundation.prototype.isSelectable = function () {\n return false;\n };\n MDCChipTrailingActionFoundation.prototype.actionType = function () {\n return MDCChipActionType.TRAILING;\n };\n MDCChipTrailingActionFoundation.prototype.shouldEmitInteractionOnRemoveKey = function () {\n return true;\n };\n return MDCChipTrailingActionFoundation;\n}(MDCChipActionFoundation));\nexport { MDCChipTrailingActionFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCChipTrailingActionFoundation;\n//# sourceMappingURL=trailing-foundation.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { closest } from '@material/dom/ponyfill';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCRippleFoundation } from '@material/ripple/foundation';\nimport { computePrimaryActionRippleClientRect, GRAPHIC_SELECTED_WIDTH_STYLE_PROP } from './component-ripple';\nimport { MDCChipActionCssClasses } from './constants';\nimport { MDCChipPrimaryActionFoundation } from './primary-foundation';\nimport { MDCChipTrailingActionFoundation } from './trailing-foundation';\n/**\n * MDCChipAction provides component encapsulation of the different foundation\n * implementations.\n */\nvar MDCChipAction = /** @class */ (function (_super) {\n __extends(MDCChipAction, _super);\n function MDCChipAction() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.rootHTML = _this.root;\n return _this;\n }\n MDCChipAction.attachTo = function (root) {\n return new MDCChipAction(root);\n };\n Object.defineProperty(MDCChipAction.prototype, \"ripple\", {\n get: function () {\n return this.rippleInstance;\n },\n enumerable: false,\n configurable: true\n });\n MDCChipAction.prototype.initialize = function (rippleFactory) {\n var _this = this;\n if (rippleFactory === void 0) { rippleFactory = function (el, foundation) {\n return new MDCRipple(el, foundation);\n }; }\n var rippleAdapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { computeBoundingRect: function () { return _this.computeRippleClientRect(); } });\n this.rippleInstance =\n rippleFactory(this.root, new MDCRippleFoundation(rippleAdapter));\n };\n MDCChipAction.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleClick = function () {\n _this.foundation.handleClick();\n };\n this.handleKeydown = function (event) {\n _this.foundation.handleKeydown(event);\n };\n this.listen('click', this.handleClick);\n this.listen('keydown', this.handleKeydown);\n };\n MDCChipAction.prototype.destroy = function () {\n this.ripple.destroy();\n this.unlisten('click', this.handleClick);\n this.unlisten('keydown', this.handleKeydown);\n _super.prototype.destroy.call(this);\n };\n MDCChipAction.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n emitEvent: function (eventName, eventDetail) {\n _this.emit(eventName, eventDetail, true /* shouldBubble */);\n },\n focus: function () {\n _this.rootHTML.focus();\n },\n getAttribute: function (attrName) { return _this.root.getAttribute(attrName); },\n getElementID: function () { return _this.root.id; },\n removeAttribute: function (name) {\n _this.root.removeAttribute(name);\n },\n setAttribute: function (name, value) {\n _this.root.setAttribute(name, value);\n },\n };\n if (this.root.classList.contains(MDCChipActionCssClasses.TRAILING_ACTION)) {\n return new MDCChipTrailingActionFoundation(adapter);\n }\n // Default to the primary foundation\n return new MDCChipPrimaryActionFoundation(adapter);\n };\n MDCChipAction.prototype.setDisabled = function (isDisabled) {\n this.foundation.setDisabled(isDisabled);\n };\n MDCChipAction.prototype.isDisabled = function () {\n return this.foundation.isDisabled();\n };\n MDCChipAction.prototype.setFocus = function (behavior) {\n this.foundation.setFocus(behavior);\n };\n MDCChipAction.prototype.isFocusable = function () {\n return this.foundation.isFocusable();\n };\n MDCChipAction.prototype.setSelected = function (isSelected) {\n this.foundation.setSelected(isSelected);\n };\n MDCChipAction.prototype.isSelected = function () {\n return this.foundation.isSelected();\n };\n MDCChipAction.prototype.isSelectable = function () {\n return this.foundation.isSelectable();\n };\n MDCChipAction.prototype.actionType = function () {\n return this.foundation.actionType();\n };\n MDCChipAction.prototype.computeRippleClientRect = function () {\n if (this.root.classList.contains(MDCChipActionCssClasses.PRIMARY_ACTION)) {\n var chipRoot = closest(this.root, \".\" + MDCChipActionCssClasses.CHIP_ROOT);\n // Return the root client rect since it's better than nothing\n if (!chipRoot)\n return this.root.getBoundingClientRect();\n var graphicWidth = window.getComputedStyle(chipRoot).getPropertyValue(GRAPHIC_SELECTED_WIDTH_STYLE_PROP);\n return computePrimaryActionRippleClientRect(chipRoot.getBoundingClientRect(), graphicWidth);\n }\n return this.root.getBoundingClientRect();\n };\n return MDCChipAction;\n}(MDCComponent));\nexport { MDCChipAction };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * AnimationFrame provides a user-friendly abstraction around requesting\n * and canceling animation frames.\n */\nvar AnimationFrame = /** @class */ (function () {\n function AnimationFrame() {\n this.rafIDs = new Map();\n }\n /**\n * Requests an animation frame. Cancels any existing frame with the same key.\n * @param {string} key The key for this callback.\n * @param {FrameRequestCallback} callback The callback to be executed.\n */\n AnimationFrame.prototype.request = function (key, callback) {\n var _this = this;\n this.cancel(key);\n var frameID = requestAnimationFrame(function (frame) {\n _this.rafIDs.delete(key);\n // Callback must come *after* the key is deleted so that nested calls to\n // request with the same key are not deleted.\n callback(frame);\n });\n this.rafIDs.set(key, frameID);\n };\n /**\n * Cancels a queued callback with the given key.\n * @param {string} key The key for this callback.\n */\n AnimationFrame.prototype.cancel = function (key) {\n var rafID = this.rafIDs.get(key);\n if (rafID) {\n cancelAnimationFrame(rafID);\n this.rafIDs.delete(key);\n }\n };\n /**\n * Cancels all queued callback.\n */\n AnimationFrame.prototype.cancelAll = function () {\n var _this = this;\n // Need to use forEach because it's the only iteration method supported\n // by IE11. Suppress the underscore because we don't need it.\n // tslint:disable-next-line:enforce-name-casing\n this.rafIDs.forEach(function (_, key) {\n _this.cancel(key);\n });\n };\n /**\n * Returns the queue of unexecuted callback keys.\n */\n AnimationFrame.prototype.getQueue = function () {\n var queue = [];\n // Need to use forEach because it's the only iteration method supported\n // by IE11. Suppress the underscore because we don't need it.\n // tslint:disable-next-line:enforce-name-casing\n this.rafIDs.forEach(function (_, key) {\n queue.push(key);\n });\n return queue;\n };\n return AnimationFrame;\n}());\nexport { AnimationFrame };\n//# sourceMappingURL=animationframe.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * MDCChipCssClasses provides the named constants for class names.\n */\nexport var MDCChipCssClasses;\n(function (MDCChipCssClasses) {\n MDCChipCssClasses[\"SELECTING\"] = \"mdc-evolution-chip--selecting\";\n MDCChipCssClasses[\"DESELECTING\"] = \"mdc-evolution-chip--deselecting\";\n MDCChipCssClasses[\"SELECTING_WITH_PRIMARY_ICON\"] = \"mdc-evolution-chip--selecting-with-primary-icon\";\n MDCChipCssClasses[\"DESELECTING_WITH_PRIMARY_ICON\"] = \"mdc-evolution-chip--deselecting-with-primary-icon\";\n MDCChipCssClasses[\"DISABLED\"] = \"mdc-evolution-chip--disabled\";\n MDCChipCssClasses[\"ENTER\"] = \"mdc-evolution-chip--enter\";\n MDCChipCssClasses[\"EXIT\"] = \"mdc-evolution-chip--exit\";\n MDCChipCssClasses[\"SELECTED\"] = \"mdc-evolution-chip--selected\";\n MDCChipCssClasses[\"HIDDEN\"] = \"mdc-evolution-chip--hidden\";\n MDCChipCssClasses[\"WITH_PRIMARY_ICON\"] = \"mdc-evolution-chip--with-primary-icon\";\n})(MDCChipCssClasses || (MDCChipCssClasses = {}));\n/**\n * MDCChipEvents provides the named constants for emitted events.\n */\nexport var MDCChipEvents;\n(function (MDCChipEvents) {\n MDCChipEvents[\"INTERACTION\"] = \"MDCChip:interaction\";\n MDCChipEvents[\"NAVIGATION\"] = \"MDCChip:navigation\";\n MDCChipEvents[\"ANIMATION\"] = \"MDCChip:animation\";\n})(MDCChipEvents || (MDCChipEvents = {}));\n/**\n * MDCChipAttributes provides the named constants for strings used by the\n * foundation.\n */\nexport var MDCChipAttributes;\n(function (MDCChipAttributes) {\n MDCChipAttributes[\"DATA_REMOVED_ANNOUNCEMENT\"] = \"data-mdc-removed-announcement\";\n MDCChipAttributes[\"DATA_ADDED_ANNOUNCEMENT\"] = \"data-mdc-added-announcement\";\n})(MDCChipAttributes || (MDCChipAttributes = {}));\n/**\n * MDCChipAnimation provides the names of runnable animations.\n */\nexport var MDCChipAnimation;\n(function (MDCChipAnimation) {\n MDCChipAnimation[\"ENTER\"] = \"mdc-evolution-chip-enter\";\n MDCChipAnimation[\"EXIT\"] = \"mdc-evolution-chip-exit\";\n})(MDCChipAnimation || (MDCChipAnimation = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { AnimationFrame } from '@material/animation/animationframe';\nimport { MDCFoundation } from '@material/base/foundation';\nimport { KEY } from '@material/dom/keyboard';\nimport { MDCChipActionFocusBehavior, MDCChipActionInteractionTrigger, MDCChipActionType } from '../action/constants';\nimport { MDCChipAnimation, MDCChipAttributes, MDCChipCssClasses, MDCChipEvents } from './constants';\nvar Direction;\n(function (Direction) {\n Direction[Direction[\"UNSPECIFIED\"] = 0] = \"UNSPECIFIED\";\n Direction[Direction[\"LEFT\"] = 1] = \"LEFT\";\n Direction[Direction[\"RIGHT\"] = 2] = \"RIGHT\";\n})(Direction || (Direction = {}));\nvar AnimationKeys;\n(function (AnimationKeys) {\n AnimationKeys[\"SELECTION\"] = \"selection\";\n AnimationKeys[\"EXIT\"] = \"exit\";\n})(AnimationKeys || (AnimationKeys = {}));\n/**\n * MDCChipFoundation provides a foundation for all chips.\n */\nvar MDCChipFoundation = /** @class */ (function (_super) {\n __extends(MDCChipFoundation, _super);\n function MDCChipFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this;\n _this.animFrame = new AnimationFrame();\n return _this;\n }\n Object.defineProperty(MDCChipFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n emitEvent: function () { return undefined; },\n getActions: function () { return []; },\n getAttribute: function () { return null; },\n getElementID: function () { return ''; },\n getOffsetWidth: function () { return 0; },\n hasClass: function () { return false; },\n isActionDisabled: function () { return false; },\n isActionFocusable: function () { return false; },\n isActionSelectable: function () { return false; },\n isActionSelected: function () { return false; },\n isRTL: function () { return false; },\n removeClass: function () { return undefined; },\n setActionDisabled: function () { return undefined; },\n setActionFocus: function () { return undefined; },\n setActionSelected: function () { return undefined; },\n setStyleProperty: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCChipFoundation.prototype.destroy = function () {\n this.animFrame.cancelAll();\n };\n MDCChipFoundation.prototype.getElementID = function () {\n return this.adapter.getElementID();\n };\n MDCChipFoundation.prototype.setDisabled = function (isDisabled) {\n var e_1, _a;\n var actions = this.getActions();\n try {\n for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {\n var action = actions_1_1.value;\n this.adapter.setActionDisabled(action, isDisabled);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (isDisabled) {\n this.adapter.addClass(MDCChipCssClasses.DISABLED);\n }\n else {\n this.adapter.removeClass(MDCChipCssClasses.DISABLED);\n }\n };\n MDCChipFoundation.prototype.isDisabled = function () {\n var e_2, _a;\n var actions = this.getActions();\n try {\n for (var actions_2 = __values(actions), actions_2_1 = actions_2.next(); !actions_2_1.done; actions_2_1 = actions_2.next()) {\n var action = actions_2_1.value;\n if (this.adapter.isActionDisabled(action)) {\n return true;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (actions_2_1 && !actions_2_1.done && (_a = actions_2.return)) _a.call(actions_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n return false;\n };\n MDCChipFoundation.prototype.getActions = function () {\n return this.adapter.getActions();\n };\n MDCChipFoundation.prototype.isActionFocusable = function (action) {\n return this.adapter.isActionFocusable(action);\n };\n MDCChipFoundation.prototype.isActionSelectable = function (action) {\n return this.adapter.isActionSelectable(action);\n };\n MDCChipFoundation.prototype.isActionSelected = function (action) {\n return this.adapter.isActionSelected(action);\n };\n MDCChipFoundation.prototype.setActionFocus = function (action, focus) {\n this.adapter.setActionFocus(action, focus);\n };\n MDCChipFoundation.prototype.setActionSelected = function (action, isSelected) {\n this.adapter.setActionSelected(action, isSelected);\n this.animateSelection(isSelected);\n };\n MDCChipFoundation.prototype.startAnimation = function (animation) {\n if (animation === MDCChipAnimation.ENTER) {\n this.adapter.addClass(MDCChipCssClasses.ENTER);\n return;\n }\n if (animation === MDCChipAnimation.EXIT) {\n this.adapter.addClass(MDCChipCssClasses.EXIT);\n return;\n }\n };\n MDCChipFoundation.prototype.handleAnimationEnd = function (event) {\n var _this = this;\n var animationName = event.animationName;\n if (animationName === MDCChipAnimation.ENTER) {\n this.adapter.removeClass(MDCChipCssClasses.ENTER);\n this.adapter.emitEvent(MDCChipEvents.ANIMATION, {\n chipID: this.getElementID(),\n animation: MDCChipAnimation.ENTER,\n addedAnnouncement: this.getAddedAnnouncement(),\n isComplete: true,\n });\n return;\n }\n if (animationName === MDCChipAnimation.EXIT) {\n this.adapter.removeClass(MDCChipCssClasses.EXIT);\n this.adapter.addClass(MDCChipCssClasses.HIDDEN);\n var width = this.adapter.getOffsetWidth();\n this.adapter.setStyleProperty('width', width + \"px\");\n // Wait two frames so the width gets applied correctly.\n this.animFrame.request(AnimationKeys.EXIT, function () {\n _this.animFrame.request(AnimationKeys.EXIT, function () {\n _this.adapter.setStyleProperty('width', '0');\n });\n });\n }\n };\n MDCChipFoundation.prototype.handleTransitionEnd = function () {\n if (!this.adapter.hasClass(MDCChipCssClasses.HIDDEN))\n return;\n this.adapter.emitEvent(MDCChipEvents.ANIMATION, {\n chipID: this.getElementID(),\n animation: MDCChipAnimation.EXIT,\n removedAnnouncement: this.getRemovedAnnouncement(),\n isComplete: true,\n });\n };\n MDCChipFoundation.prototype.handleActionInteraction = function (_a) {\n var detail = _a.detail;\n var source = detail.source, actionID = detail.actionID;\n var isSelectable = this.adapter.isActionSelectable(source);\n var isSelected = this.adapter.isActionSelected(source);\n this.adapter.emitEvent(MDCChipEvents.INTERACTION, {\n chipID: this.getElementID(),\n shouldRemove: this.shouldRemove(detail),\n actionID: actionID,\n isSelectable: isSelectable,\n isSelected: isSelected,\n source: source,\n });\n };\n MDCChipFoundation.prototype.handleActionNavigation = function (_a) {\n var detail = _a.detail;\n var source = detail.source, key = detail.key;\n var isRTL = this.adapter.isRTL();\n var isTrailingActionFocusable = this.adapter.isActionFocusable(MDCChipActionType.TRAILING);\n var isPrimaryActionFocusable = this.adapter.isActionFocusable(MDCChipActionType.PRIMARY);\n var dir = this.directionFromKey(key, isRTL);\n var shouldNavigateToTrailing = source === MDCChipActionType.PRIMARY &&\n dir === Direction.RIGHT && isTrailingActionFocusable;\n var shouldNavigateToPrimary = source === MDCChipActionType.TRAILING &&\n dir === Direction.LEFT && isPrimaryActionFocusable;\n if (shouldNavigateToTrailing) {\n this.navigateActions({ from: source, to: MDCChipActionType.TRAILING });\n return;\n }\n if (shouldNavigateToPrimary) {\n this.navigateActions({ from: source, to: MDCChipActionType.PRIMARY });\n return;\n }\n this.adapter.emitEvent(MDCChipEvents.NAVIGATION, {\n chipID: this.getElementID(),\n isRTL: isRTL,\n source: source,\n key: key,\n });\n };\n MDCChipFoundation.prototype.directionFromKey = function (key, isRTL) {\n var isLeftKey = key === KEY.ARROW_LEFT;\n var isRightKey = key === KEY.ARROW_RIGHT;\n if (!isRTL && isLeftKey || isRTL && isRightKey) {\n return Direction.LEFT;\n }\n if (!isRTL && isRightKey || isRTL && isLeftKey) {\n return Direction.RIGHT;\n }\n return Direction.UNSPECIFIED;\n };\n MDCChipFoundation.prototype.navigateActions = function (nav) {\n this.adapter.setActionFocus(nav.from, MDCChipActionFocusBehavior.NOT_FOCUSABLE);\n this.adapter.setActionFocus(nav.to, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n };\n MDCChipFoundation.prototype.shouldRemove = function (_a) {\n var source = _a.source, trigger = _a.trigger;\n if (trigger === MDCChipActionInteractionTrigger.BACKSPACE_KEY ||\n trigger === MDCChipActionInteractionTrigger.DELETE_KEY) {\n return true;\n }\n return source === MDCChipActionType.TRAILING;\n };\n MDCChipFoundation.prototype.getRemovedAnnouncement = function () {\n var msg = this.adapter.getAttribute(MDCChipAttributes.DATA_REMOVED_ANNOUNCEMENT);\n return msg || undefined;\n };\n MDCChipFoundation.prototype.getAddedAnnouncement = function () {\n var msg = this.adapter.getAttribute(MDCChipAttributes.DATA_ADDED_ANNOUNCEMENT);\n return msg || undefined;\n };\n MDCChipFoundation.prototype.animateSelection = function (isSelected) {\n var _this = this;\n this.resetAnimationStyles();\n // Wait two frames to ensure the animation classes are unset\n this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.updateSelectionStyles(isSelected);\n });\n });\n };\n MDCChipFoundation.prototype.resetAnimationStyles = function () {\n this.adapter.removeClass(MDCChipCssClasses.SELECTING);\n this.adapter.removeClass(MDCChipCssClasses.DESELECTING);\n this.adapter.removeClass(MDCChipCssClasses.SELECTING_WITH_PRIMARY_ICON);\n this.adapter.removeClass(MDCChipCssClasses.DESELECTING_WITH_PRIMARY_ICON);\n };\n MDCChipFoundation.prototype.updateSelectionStyles = function (isSelected) {\n var _this = this;\n var hasIcon = this.adapter.hasClass(MDCChipCssClasses.WITH_PRIMARY_ICON);\n if (hasIcon && isSelected) {\n this.adapter.addClass(MDCChipCssClasses.SELECTING_WITH_PRIMARY_ICON);\n this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.adapter.addClass(MDCChipCssClasses.SELECTED);\n });\n return;\n }\n if (hasIcon && !isSelected) {\n this.adapter.addClass(MDCChipCssClasses.DESELECTING_WITH_PRIMARY_ICON);\n this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.adapter.removeClass(MDCChipCssClasses.SELECTED);\n });\n return;\n }\n if (isSelected) {\n this.adapter.addClass(MDCChipCssClasses.SELECTING);\n this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.adapter.addClass(MDCChipCssClasses.SELECTED);\n });\n return;\n }\n if (!isSelected) {\n this.adapter.addClass(MDCChipCssClasses.DESELECTING);\n this.animFrame.request(AnimationKeys.SELECTION, function () {\n _this.adapter.removeClass(MDCChipCssClasses.SELECTED);\n });\n return;\n }\n };\n return MDCChipFoundation;\n}(MDCFoundation));\nexport { MDCChipFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCChipFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __read, __values } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCChipAction } from '../action/component';\nimport { MDCChipActionEvents } from '../action/constants';\nimport { MDCChipFoundation } from './foundation';\n/**\n * MDCChip provides component encapsulation of the foundation implementation.\n */\nvar MDCChip = /** @class */ (function (_super) {\n __extends(MDCChip, _super);\n function MDCChip() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.rootHTML = _this.root;\n return _this;\n }\n MDCChip.attachTo = function (root) {\n return new MDCChip(root);\n };\n MDCChip.prototype.initialize = function (actionFactory) {\n if (actionFactory === void 0) { actionFactory = function (el) { return new MDCChipAction(el); }; }\n this.actions = new Map();\n var actionEls = this.root.querySelectorAll('.mdc-evolution-chip__action');\n for (var i = 0; i < actionEls.length; i++) {\n var action = actionFactory(actionEls[i]);\n this.actions.set(action.actionType(), action);\n }\n };\n MDCChip.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleActionInteraction = function (event) {\n _this.foundation.handleActionInteraction(event);\n };\n this.handleActionNavigation = function (event) {\n _this.foundation.handleActionNavigation(event);\n };\n this.listen(MDCChipActionEvents.INTERACTION, this.handleActionInteraction);\n this.listen(MDCChipActionEvents.NAVIGATION, this.handleActionNavigation);\n };\n MDCChip.prototype.destroy = function () {\n this.unlisten(MDCChipActionEvents.INTERACTION, this.handleActionInteraction);\n this.unlisten(MDCChipActionEvents.NAVIGATION, this.handleActionNavigation);\n _super.prototype.destroy.call(this);\n };\n MDCChip.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n emitEvent: function (eventName, eventDetail) {\n _this.emit(eventName, eventDetail, true /* shouldBubble */);\n },\n getActions: function () {\n var e_1, _a;\n var actions = [];\n try {\n for (var _b = __values(_this.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 1), key = _d[0];\n actions.push(key);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return actions;\n },\n getAttribute: function (attrName) { return _this.root.getAttribute(attrName); },\n getElementID: function () { return _this.rootHTML.id; },\n getOffsetWidth: function () {\n return _this.rootHTML.offsetWidth;\n },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n isActionSelectable: function (actionType) {\n var action = _this.actions.get(actionType);\n if (action) {\n return action.isSelectable();\n }\n return false;\n },\n isActionSelected: function (actionType) {\n var action = _this.actions.get(actionType);\n if (action) {\n return action.isSelected();\n }\n return false;\n },\n isActionFocusable: function (actionType) {\n var action = _this.actions.get(actionType);\n if (action) {\n return action.isFocusable();\n }\n return false;\n },\n isActionDisabled: function (actionType) {\n var action = _this.actions.get(actionType);\n if (action) {\n return action.isDisabled();\n }\n return false;\n },\n isRTL: function () { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n setActionDisabled: function (actionType, isDisabled) {\n var action = _this.actions.get(actionType);\n if (action) {\n action.setDisabled(isDisabled);\n }\n },\n setActionFocus: function (actionType, behavior) {\n var action = _this.actions.get(actionType);\n if (action) {\n action.setFocus(behavior);\n }\n },\n setActionSelected: function (actionType, isSelected) {\n var action = _this.actions.get(actionType);\n if (action) {\n action.setSelected(isSelected);\n }\n },\n setStyleProperty: function (prop, value) {\n _this.rootHTML.style.setProperty(prop, value);\n },\n };\n // Default to the primary foundation\n return new MDCChipFoundation(adapter);\n };\n /** Exposed to be called by the parent chip set. */\n MDCChip.prototype.remove = function () {\n var parent = this.root.parentNode;\n if (parent !== null) {\n parent.removeChild(this.root);\n }\n };\n /** Returns the MDCChipActionTypes for the encapsulated actions. */\n MDCChip.prototype.getActions = function () {\n return this.foundation.getActions();\n };\n /** Returns the ID of the root element. */\n MDCChip.prototype.getElementID = function () {\n return this.foundation.getElementID();\n };\n MDCChip.prototype.isDisabled = function () {\n return this.foundation.isDisabled();\n };\n MDCChip.prototype.setDisabled = function (isDisabled) {\n this.foundation.setDisabled(isDisabled);\n };\n /** Returns the focusability of the action. */\n MDCChip.prototype.isActionFocusable = function (action) {\n return this.foundation.isActionFocusable(action);\n };\n /** Returns the selectability of the action. */\n MDCChip.prototype.isActionSelectable = function (action) {\n return this.foundation.isActionSelectable(action);\n };\n /** Returns the selected state of the action. */\n MDCChip.prototype.isActionSelected = function (action) {\n return this.foundation.isActionSelected(action);\n };\n /** Sets the focus behavior of the action. */\n MDCChip.prototype.setActionFocus = function (action, focus) {\n this.foundation.setActionFocus(action, focus);\n };\n /** Sets the selected state of the action. */\n MDCChip.prototype.setActionSelected = function (action, isSelected) {\n this.foundation.setActionSelected(action, isSelected);\n };\n /** Starts the animation on the chip. */\n MDCChip.prototype.startAnimation = function (animation) {\n this.foundation.startAnimation(animation);\n };\n return MDCChip;\n}(MDCComponent));\nexport { MDCChip };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Priorities for the announce function.\n */\nexport var AnnouncerPriority;\n(function (AnnouncerPriority) {\n AnnouncerPriority[\"POLITE\"] = \"polite\";\n AnnouncerPriority[\"ASSERTIVE\"] = \"assertive\";\n})(AnnouncerPriority || (AnnouncerPriority = {}));\n/**\n * Data attribute added to live region element.\n */\nexport var DATA_MDC_DOM_ANNOUNCE = 'data-mdc-dom-announce';\n/**\n * Announces the given message with optional priority, defaulting to \"polite\"\n */\nexport function announce(message, options) {\n Announcer.getInstance().say(message, options);\n}\nvar Announcer = /** @class */ (function () {\n // Constructor made private to ensure only the singleton is used\n function Announcer() {\n this.liveRegions = new Map();\n }\n Announcer.getInstance = function () {\n if (!Announcer.instance) {\n Announcer.instance = new Announcer();\n }\n return Announcer.instance;\n };\n Announcer.prototype.say = function (message, options) {\n var _a, _b;\n var priority = (_a = options === null || options === void 0 ? void 0 : options.priority) !== null && _a !== void 0 ? _a : AnnouncerPriority.POLITE;\n var ownerDocument = (_b = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _b !== void 0 ? _b : document;\n var liveRegion = this.getLiveRegion(priority, ownerDocument);\n // Reset the region to pick up the message, even if the message is the\n // exact same as before.\n liveRegion.textContent = '';\n // Timeout is necessary for screen readers like NVDA and VoiceOver.\n setTimeout(function () {\n liveRegion.textContent = message;\n ownerDocument.addEventListener('click', clearLiveRegion);\n }, 1);\n function clearLiveRegion() {\n liveRegion.textContent = '';\n ownerDocument.removeEventListener('click', clearLiveRegion);\n }\n };\n Announcer.prototype.getLiveRegion = function (priority, ownerDocument) {\n var documentLiveRegions = this.liveRegions.get(ownerDocument);\n if (!documentLiveRegions) {\n documentLiveRegions = new Map();\n this.liveRegions.set(ownerDocument, documentLiveRegions);\n }\n var existingLiveRegion = documentLiveRegions.get(priority);\n if (existingLiveRegion &&\n ownerDocument.body.contains(existingLiveRegion)) {\n return existingLiveRegion;\n }\n var liveRegion = this.createLiveRegion(priority, ownerDocument);\n documentLiveRegions.set(priority, liveRegion);\n return liveRegion;\n };\n Announcer.prototype.createLiveRegion = function (priority, ownerDocument) {\n var el = ownerDocument.createElement('div');\n el.style.position = 'absolute';\n el.style.top = '-9999px';\n el.style.left = '-9999px';\n el.style.height = '1px';\n el.style.overflow = 'hidden';\n el.setAttribute('aria-atomic', 'true');\n el.setAttribute('aria-live', priority);\n el.setAttribute(DATA_MDC_DOM_ANNOUNCE, 'true');\n ownerDocument.body.appendChild(el);\n return el;\n };\n return Announcer;\n}());\n//# sourceMappingURL=announce.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * MDCChipSetAttributes provides the named constants for attributes used by the\n * foundation.\n */\nexport var MDCChipSetAttributes;\n(function (MDCChipSetAttributes) {\n MDCChipSetAttributes[\"ARIA_MULTISELECTABLE\"] = \"aria-multiselectable\";\n})(MDCChipSetAttributes || (MDCChipSetAttributes = {}));\n/**\n * MDCChipSetCssClasses provides the named constants for class names.\n */\nexport var MDCChipSetCssClasses;\n(function (MDCChipSetCssClasses) {\n MDCChipSetCssClasses[\"CHIP\"] = \"mdc-evolution-chip\";\n})(MDCChipSetCssClasses || (MDCChipSetCssClasses = {}));\n/**\n * MDCChipSetEvents provides the constants for emitted events.\n */\nexport var MDCChipSetEvents;\n(function (MDCChipSetEvents) {\n MDCChipSetEvents[\"INTERACTION\"] = \"MDCChipSet:interaction\";\n MDCChipSetEvents[\"REMOVAL\"] = \"MDCChipSet:removal\";\n MDCChipSetEvents[\"SELECTION\"] = \"MDCChipSet:selection\";\n})(MDCChipSetEvents || (MDCChipSetEvents = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { KEY } from '@material/dom/keyboard';\nimport { MDCChipActionFocusBehavior, MDCChipActionType } from '../action/constants';\nimport { MDCChipAnimation } from '../chip/constants';\nimport { MDCChipSetAttributes, MDCChipSetEvents } from './constants';\nvar Operator;\n(function (Operator) {\n Operator[Operator[\"INCREMENT\"] = 0] = \"INCREMENT\";\n Operator[Operator[\"DECREMENT\"] = 1] = \"DECREMENT\";\n})(Operator || (Operator = {}));\n/**\n * MDCChipSetFoundation provides a foundation for all chips.\n */\nvar MDCChipSetFoundation = /** @class */ (function (_super) {\n __extends(MDCChipSetFoundation, _super);\n function MDCChipSetFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCChipSetFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n announceMessage: function () { return undefined; },\n emitEvent: function () { return undefined; },\n getAttribute: function () { return null; },\n getChipActionsAtIndex: function () { return []; },\n getChipCount: function () { return 0; },\n getChipIdAtIndex: function () { return ''; },\n getChipIndexById: function () { return 0; },\n isChipFocusableAtIndex: function () { return false; },\n isChipSelectableAtIndex: function () { return false; },\n isChipSelectedAtIndex: function () { return false; },\n removeChipAtIndex: function () { },\n setChipFocusAtIndex: function () { return undefined; },\n setChipSelectedAtIndex: function () { return undefined; },\n startChipAnimationAtIndex: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCChipSetFoundation.prototype.handleChipAnimation = function (_a) {\n var detail = _a.detail;\n var chipID = detail.chipID, animation = detail.animation, isComplete = detail.isComplete, addedAnnouncement = detail.addedAnnouncement, removedAnnouncement = detail.removedAnnouncement;\n var index = this.adapter.getChipIndexById(chipID);\n if (animation === MDCChipAnimation.EXIT && isComplete) {\n if (removedAnnouncement) {\n this.adapter.announceMessage(removedAnnouncement);\n }\n this.removeAfterAnimation(index, chipID);\n return;\n }\n if (animation === MDCChipAnimation.ENTER && isComplete && addedAnnouncement) {\n this.adapter.announceMessage(addedAnnouncement);\n return;\n }\n };\n MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) {\n var detail = _a.detail;\n var source = detail.source, chipID = detail.chipID, isSelectable = detail.isSelectable, isSelected = detail.isSelected, shouldRemove = detail.shouldRemove;\n var index = this.adapter.getChipIndexById(chipID);\n if (shouldRemove) {\n this.removeChip(index);\n return;\n }\n this.focusChip(index, source, MDCChipActionFocusBehavior.FOCUSABLE);\n this.adapter.emitEvent(MDCChipSetEvents.INTERACTION, {\n chipIndex: index,\n chipID: chipID,\n });\n if (isSelectable) {\n this.setSelection(index, source, !isSelected);\n }\n };\n MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) {\n var detail = _a.detail;\n var chipID = detail.chipID, key = detail.key, isRTL = detail.isRTL, source = detail.source;\n var index = this.adapter.getChipIndexById(chipID);\n var toNextChip = (key === KEY.ARROW_RIGHT && !isRTL) ||\n (key === KEY.ARROW_LEFT && isRTL);\n if (toNextChip) {\n // Start from the next chip so we increment the index\n this.focusNextChipFrom(index + 1);\n return;\n }\n var toPreviousChip = (key === KEY.ARROW_LEFT && !isRTL) ||\n (key === KEY.ARROW_RIGHT && isRTL);\n if (toPreviousChip) {\n // Start from the previous chip so we decrement the index\n this.focusPrevChipFrom(index - 1);\n return;\n }\n if (key === KEY.ARROW_DOWN) {\n // Start from the next chip so we increment the index\n this.focusNextChipFrom(index + 1, source);\n return;\n }\n if (key === KEY.ARROW_UP) {\n // Start from the previous chip so we decrement the index\n this.focusPrevChipFrom(index - 1, source);\n return;\n }\n if (key === KEY.HOME) {\n this.focusNextChipFrom(0, source);\n return;\n }\n if (key === KEY.END) {\n this.focusPrevChipFrom(this.adapter.getChipCount() - 1, source);\n return;\n }\n };\n /** Returns the unique selected indexes of the chips. */\n MDCChipSetFoundation.prototype.getSelectedChipIndexes = function () {\n var e_1, _a;\n var selectedIndexes = new Set();\n var chipCount = this.adapter.getChipCount();\n for (var i = 0; i < chipCount; i++) {\n var actions = this.adapter.getChipActionsAtIndex(i);\n try {\n for (var actions_1 = (e_1 = void 0, __values(actions)), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {\n var action = actions_1_1.value;\n if (this.adapter.isChipSelectedAtIndex(i, action)) {\n selectedIndexes.add(i);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n return selectedIndexes;\n };\n /** Sets the selected state of the chip at the given index and action. */\n MDCChipSetFoundation.prototype.setChipSelected = function (index, action, isSelected) {\n if (this.adapter.isChipSelectableAtIndex(index, action)) {\n this.setSelection(index, action, isSelected);\n }\n };\n /** Returns the selected state of the chip at the given index and action. */\n MDCChipSetFoundation.prototype.isChipSelected = function (index, action) {\n return this.adapter.isChipSelectedAtIndex(index, action);\n };\n /** Removes the chip at the given index. */\n MDCChipSetFoundation.prototype.removeChip = function (index) {\n // Early exit if the index is out of bounds\n if (index >= this.adapter.getChipCount() || index < 0)\n return;\n this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.EXIT);\n this.adapter.emitEvent(MDCChipSetEvents.REMOVAL, {\n chipID: this.adapter.getChipIdAtIndex(index),\n chipIndex: index,\n isComplete: false,\n });\n };\n MDCChipSetFoundation.prototype.addChip = function (index) {\n // Early exit if the index is out of bounds\n if (index >= this.adapter.getChipCount() || index < 0)\n return;\n this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.ENTER);\n };\n /**\n * Increments to find the first focusable chip.\n */\n MDCChipSetFoundation.prototype.focusNextChipFrom = function (startIndex, targetAction) {\n var chipCount = this.adapter.getChipCount();\n for (var i = startIndex; i < chipCount; i++) {\n var focusableAction = this.getFocusableAction(i, Operator.INCREMENT, targetAction);\n if (focusableAction) {\n this.focusChip(i, focusableAction, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n }\n };\n /**\n * Decrements to find the first focusable chip. Takes an optional target\n * action that can be used to focus the first matching focusable action.\n */\n MDCChipSetFoundation.prototype.focusPrevChipFrom = function (startIndex, targetAction) {\n for (var i = startIndex; i > -1; i--) {\n var focusableAction = this.getFocusableAction(i, Operator.DECREMENT, targetAction);\n if (focusableAction) {\n this.focusChip(i, focusableAction, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n }\n };\n /** Returns the appropriate focusable action, or null if none exist. */\n MDCChipSetFoundation.prototype.getFocusableAction = function (index, op, targetAction) {\n var actions = this.adapter.getChipActionsAtIndex(index);\n // Reverse the actions if decrementing\n if (op === Operator.DECREMENT)\n actions.reverse();\n if (targetAction) {\n return this.getMatchingFocusableAction(index, actions, targetAction);\n }\n return this.getFirstFocusableAction(index, actions);\n };\n /**\n * Returs the first focusable action, regardless of type, or null if no\n * focusable actions exist.\n */\n MDCChipSetFoundation.prototype.getFirstFocusableAction = function (index, actions) {\n var e_2, _a;\n try {\n for (var actions_2 = __values(actions), actions_2_1 = actions_2.next(); !actions_2_1.done; actions_2_1 = actions_2.next()) {\n var action = actions_2_1.value;\n if (this.adapter.isChipFocusableAtIndex(index, action)) {\n return action;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (actions_2_1 && !actions_2_1.done && (_a = actions_2.return)) _a.call(actions_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n return null;\n };\n /**\n * If the actions contain a focusable action that matches the target action,\n * return that. Otherwise, return the first focusable action, or null if no\n * focusable action exists.\n */\n MDCChipSetFoundation.prototype.getMatchingFocusableAction = function (index, actions, targetAction) {\n var e_3, _a;\n var focusableAction = null;\n try {\n for (var actions_3 = __values(actions), actions_3_1 = actions_3.next(); !actions_3_1.done; actions_3_1 = actions_3.next()) {\n var action = actions_3_1.value;\n if (this.adapter.isChipFocusableAtIndex(index, action)) {\n focusableAction = action;\n }\n // Exit and return the focusable action if it matches the target\n if (focusableAction === targetAction) {\n return focusableAction;\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (actions_3_1 && !actions_3_1.done && (_a = actions_3.return)) _a.call(actions_3);\n }\n finally { if (e_3) throw e_3.error; }\n }\n return focusableAction;\n };\n MDCChipSetFoundation.prototype.focusChip = function (index, action, focus) {\n var e_4, _a;\n this.adapter.setChipFocusAtIndex(index, action, focus);\n var chipCount = this.adapter.getChipCount();\n for (var i = 0; i < chipCount; i++) {\n var actions = this.adapter.getChipActionsAtIndex(i);\n try {\n for (var actions_4 = (e_4 = void 0, __values(actions)), actions_4_1 = actions_4.next(); !actions_4_1.done; actions_4_1 = actions_4.next()) {\n var chipAction = actions_4_1.value;\n // Skip the action and index provided since we set it above\n if (chipAction === action && i === index)\n continue;\n this.adapter.setChipFocusAtIndex(i, chipAction, MDCChipActionFocusBehavior.NOT_FOCUSABLE);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (actions_4_1 && !actions_4_1.done && (_a = actions_4.return)) _a.call(actions_4);\n }\n finally { if (e_4) throw e_4.error; }\n }\n }\n };\n MDCChipSetFoundation.prototype.supportsMultiSelect = function () {\n return this.adapter.getAttribute(MDCChipSetAttributes.ARIA_MULTISELECTABLE) === 'true';\n };\n MDCChipSetFoundation.prototype.setSelection = function (index, action, isSelected) {\n var e_5, _a;\n this.adapter.setChipSelectedAtIndex(index, action, isSelected);\n this.adapter.emitEvent(MDCChipSetEvents.SELECTION, {\n chipID: this.adapter.getChipIdAtIndex(index),\n chipIndex: index,\n isSelected: isSelected,\n });\n // Early exit if we support multi-selection\n if (this.supportsMultiSelect()) {\n return;\n }\n // If we get here, we ony support single selection. This means we need to\n // unselect all chips\n var chipCount = this.adapter.getChipCount();\n for (var i = 0; i < chipCount; i++) {\n var actions = this.adapter.getChipActionsAtIndex(i);\n try {\n for (var actions_5 = (e_5 = void 0, __values(actions)), actions_5_1 = actions_5.next(); !actions_5_1.done; actions_5_1 = actions_5.next()) {\n var chipAction = actions_5_1.value;\n // Skip the action and index provided since we set it above\n if (chipAction === action && i === index)\n continue;\n this.adapter.setChipSelectedAtIndex(i, chipAction, false);\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (actions_5_1 && !actions_5_1.done && (_a = actions_5.return)) _a.call(actions_5);\n }\n finally { if (e_5) throw e_5.error; }\n }\n }\n };\n MDCChipSetFoundation.prototype.removeAfterAnimation = function (index, chipID) {\n this.adapter.removeChipAtIndex(index);\n this.adapter.emitEvent(MDCChipSetEvents.REMOVAL, {\n chipIndex: index,\n isComplete: true,\n chipID: chipID,\n });\n var chipCount = this.adapter.getChipCount();\n // Early exit if we have an empty chip set\n if (chipCount <= 0)\n return;\n this.focusNearestFocusableAction(index);\n };\n /**\n * Find the first focusable action by moving bidirectionally horizontally\n * from the start index.\n *\n * Given chip set [A, B, C, D, E, F, G]...\n * Let's say we remove chip \"F\". We don't know where the nearest focusable\n * action is since any of them could be disabled. The nearest focusable\n * action could be E, it could be G, it could even be A. To find it, we\n * start from the source index (5 for \"F\" in this case) and move out\n * horizontally, checking each chip at each index.\n *\n */\n MDCChipSetFoundation.prototype.focusNearestFocusableAction = function (index) {\n var chipCount = this.adapter.getChipCount();\n var decrIndex = index;\n var incrIndex = index;\n while (decrIndex > -1 || incrIndex < chipCount) {\n var focusAction = this.getNearestFocusableAction(decrIndex, incrIndex, MDCChipActionType.TRAILING);\n if (focusAction) {\n this.focusChip(focusAction.index, focusAction.action, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n decrIndex--;\n incrIndex++;\n }\n };\n MDCChipSetFoundation.prototype.getNearestFocusableAction = function (decrIndex, incrIndex, actionType) {\n var decrAction = this.getFocusableAction(decrIndex, Operator.DECREMENT, actionType);\n if (decrAction) {\n return {\n index: decrIndex,\n action: decrAction,\n };\n }\n // Early exit if the incremented and decremented indices are identical\n if (incrIndex === decrIndex)\n return null;\n var incrAction = this.getFocusableAction(incrIndex, Operator.INCREMENT, actionType);\n if (incrAction) {\n return {\n index: incrIndex,\n action: incrAction,\n };\n }\n return null;\n };\n return MDCChipSetFoundation;\n}(MDCFoundation));\nexport { MDCChipSetFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCChipSetFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { announce } from '@material/dom/announce';\nimport { MDCChip } from '../chip/component';\nimport { MDCChipEvents } from '../chip/constants';\nimport { MDCChipSetCssClasses } from './constants';\nimport { MDCChipSetFoundation } from './foundation';\n/**\n * MDCChip provides component encapsulation of the foundation implementation.\n */\nvar MDCChipSet = /** @class */ (function (_super) {\n __extends(MDCChipSet, _super);\n function MDCChipSet() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCChipSet.attachTo = function (root) {\n return new MDCChipSet(root);\n };\n MDCChipSet.prototype.initialize = function (chipFactory) {\n if (chipFactory === void 0) { chipFactory = function (el) { return new MDCChip(el); }; }\n this.chips = [];\n var chipEls = this.root.querySelectorAll(\".\" + MDCChipSetCssClasses.CHIP);\n for (var i = 0; i < chipEls.length; i++) {\n var chip = chipFactory(chipEls[i]);\n this.chips.push(chip);\n }\n };\n MDCChipSet.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleChipAnimation = function (event) {\n _this.foundation.handleChipAnimation(event);\n };\n this.handleChipInteraction = function (event) {\n _this.foundation.handleChipInteraction(event);\n };\n this.handleChipNavigation = function (event) {\n _this.foundation.handleChipNavigation(event);\n };\n this.listen(MDCChipEvents.ANIMATION, this.handleChipAnimation);\n this.listen(MDCChipEvents.INTERACTION, this.handleChipInteraction);\n this.listen(MDCChipEvents.NAVIGATION, this.handleChipNavigation);\n };\n MDCChipSet.prototype.destroy = function () {\n this.unlisten(MDCChipEvents.ANIMATION, this.handleChipAnimation);\n this.unlisten(MDCChipEvents.INTERACTION, this.handleChipInteraction);\n this.unlisten(MDCChipEvents.NAVIGATION, this.handleChipNavigation);\n _super.prototype.destroy.call(this);\n };\n MDCChipSet.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n announceMessage: function (message) {\n announce(message);\n },\n emitEvent: function (eventName, eventDetail) {\n _this.emit(eventName, eventDetail, true /* shouldBubble */);\n },\n getAttribute: function (attrName) { return _this.root.getAttribute(attrName); },\n getChipActionsAtIndex: function (index) {\n if (!_this.isIndexValid(index))\n return [];\n return _this.chips[index].getActions();\n },\n getChipCount: function () { return _this.chips.length; },\n getChipIdAtIndex: function (index) {\n if (!_this.isIndexValid(index))\n return '';\n return _this.chips[index].getElementID();\n },\n getChipIndexById: function (id) {\n return _this.chips.findIndex(function (chip) { return chip.getElementID() === id; });\n },\n isChipFocusableAtIndex: function (index, action) {\n if (!_this.isIndexValid(index))\n return false;\n return _this.chips[index].isActionFocusable(action);\n },\n isChipSelectableAtIndex: function (index, action) {\n if (!_this.isIndexValid(index))\n return false;\n return _this.chips[index].isActionSelectable(action);\n },\n isChipSelectedAtIndex: function (index, action) {\n if (!_this.isIndexValid(index))\n return false;\n return _this.chips[index].isActionSelected(action);\n },\n removeChipAtIndex: function (index) {\n if (!_this.isIndexValid(index))\n return;\n _this.chips[index].destroy();\n _this.chips[index].remove();\n _this.chips.splice(index, 1);\n },\n setChipFocusAtIndex: function (index, action, focus) {\n if (!_this.isIndexValid(index))\n return;\n _this.chips[index].setActionFocus(action, focus);\n },\n setChipSelectedAtIndex: function (index, action, selected) {\n if (!_this.isIndexValid(index))\n return;\n _this.chips[index].setActionSelected(action, selected);\n },\n startChipAnimationAtIndex: function (index, animation) {\n if (!_this.isIndexValid(index))\n return;\n _this.chips[index].startAnimation(animation);\n },\n };\n // Default to the primary foundation\n return new MDCChipSetFoundation(adapter);\n };\n /** Returns the index of the chip with the given ID or -1 if none exists. */\n MDCChipSet.prototype.getChipIndexByID = function (chipID) {\n return this.chips.findIndex(function (chip) { return chip.getElementID() === chipID; });\n };\n /**\n * Returns the ID of the chip at the given index or an empty string if the\n * index is out of bounds.\n */\n MDCChipSet.prototype.getChipIdAtIndex = function (index) {\n if (!this.isIndexValid(index))\n return '';\n return this.chips[index].getElementID();\n };\n /** Returns the unique indexes of the selected chips. */\n MDCChipSet.prototype.getSelectedChipIndexes = function () {\n return this.foundation.getSelectedChipIndexes();\n };\n /** Sets the selection state of the chip. */\n MDCChipSet.prototype.setChipSelected = function (index, action, isSelected) {\n this.foundation.setChipSelected(index, action, isSelected);\n };\n /** Returns the selection state of the chip. */\n MDCChipSet.prototype.isChipSelected = function (index, action) {\n return this.foundation.isChipSelected(index, action);\n };\n /** Animates the chip addition at the given index. */\n MDCChipSet.prototype.addChip = function (index) {\n this.foundation.addChip(index);\n };\n /** Removes the chip at the given index. */\n MDCChipSet.prototype.removeChip = function (index) {\n this.foundation.removeChip(index);\n };\n MDCChipSet.prototype.isIndexValid = function (index) {\n return index > -1 && index < this.chips.length;\n };\n return MDCChipSet;\n}(MDCComponent));\nexport { MDCChipSet };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n ANIMATING: 'mdc-tab-scroller--animating',\n SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',\n SCROLL_TEST: 'mdc-tab-scroller__test',\n};\nvar strings = {\n AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',\n CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content',\n};\nexport { cssClasses, strings, };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar MDCTabScrollerRTL = /** @class */ (function () {\n function MDCTabScrollerRTL(adapter) {\n this.adapter = adapter;\n }\n return MDCTabScrollerRTL;\n}());\nexport { MDCTabScrollerRTL };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabScrollerRTL;\n//# sourceMappingURL=rtl-scroller.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCTabScrollerRTL } from './rtl-scroller';\nvar MDCTabScrollerRTLDefault = /** @class */ (function (_super) {\n __extends(MDCTabScrollerRTLDefault, _super);\n function MDCTabScrollerRTLDefault() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var right = this.calculateScrollEdges().right;\n // Scroll values on most browsers are ints instead of floats so we round\n return Math.round(right - currentScrollLeft);\n };\n MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {\n var edges = this.calculateScrollEdges();\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(edges.right - scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: clampedScrollLeft - currentScrollLeft,\n };\n };\n MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: clampedScrollLeft - currentScrollLeft,\n };\n };\n MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {\n return scrollX;\n };\n MDCTabScrollerRTLDefault.prototype.calculateScrollEdges = function () {\n var contentWidth = this.adapter.getScrollContentOffsetWidth();\n var rootWidth = this.adapter.getScrollAreaOffsetWidth();\n return {\n left: 0,\n right: contentWidth - rootWidth,\n };\n };\n MDCTabScrollerRTLDefault.prototype.clampScrollValue = function (scrollX) {\n var edges = this.calculateScrollEdges();\n return Math.min(Math.max(edges.left, scrollX), edges.right);\n };\n return MDCTabScrollerRTLDefault;\n}(MDCTabScrollerRTL));\nexport { MDCTabScrollerRTLDefault };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabScrollerRTLDefault;\n//# sourceMappingURL=rtl-default-scroller.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCTabScrollerRTL } from './rtl-scroller';\nvar MDCTabScrollerRTLNegative = /** @class */ (function (_super) {\n __extends(MDCTabScrollerRTLNegative, _super);\n function MDCTabScrollerRTLNegative() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n return Math.round(translateX - currentScrollLeft);\n };\n MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(-scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: clampedScrollLeft - currentScrollLeft,\n };\n };\n MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: clampedScrollLeft - currentScrollLeft,\n };\n };\n MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {\n return scrollX - translateX;\n };\n MDCTabScrollerRTLNegative.prototype.calculateScrollEdges = function () {\n var contentWidth = this.adapter.getScrollContentOffsetWidth();\n var rootWidth = this.adapter.getScrollAreaOffsetWidth();\n return {\n left: rootWidth - contentWidth,\n right: 0,\n };\n };\n MDCTabScrollerRTLNegative.prototype.clampScrollValue = function (scrollX) {\n var edges = this.calculateScrollEdges();\n return Math.max(Math.min(edges.right, scrollX), edges.left);\n };\n return MDCTabScrollerRTLNegative;\n}(MDCTabScrollerRTL));\nexport { MDCTabScrollerRTLNegative };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabScrollerRTLNegative;\n//# sourceMappingURL=rtl-negative-scroller.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCTabScrollerRTL } from './rtl-scroller';\nvar MDCTabScrollerRTLReverse = /** @class */ (function (_super) {\n __extends(MDCTabScrollerRTLReverse, _super);\n function MDCTabScrollerRTLReverse() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n // Scroll values on most browsers are ints instead of floats so we round\n return Math.round(currentScrollLeft - translateX);\n };\n MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: currentScrollLeft - clampedScrollLeft,\n };\n };\n MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {\n var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();\n var clampedScrollLeft = this.clampScrollValue(currentScrollLeft + scrollX);\n return {\n finalScrollPosition: clampedScrollLeft,\n scrollDelta: currentScrollLeft - clampedScrollLeft,\n };\n };\n MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {\n return scrollX + translateX;\n };\n MDCTabScrollerRTLReverse.prototype.calculateScrollEdges = function () {\n var contentWidth = this.adapter.getScrollContentOffsetWidth();\n var rootWidth = this.adapter.getScrollAreaOffsetWidth();\n return {\n left: contentWidth - rootWidth,\n right: 0,\n };\n };\n MDCTabScrollerRTLReverse.prototype.clampScrollValue = function (scrollX) {\n var edges = this.calculateScrollEdges();\n return Math.min(Math.max(edges.right, scrollX), edges.left);\n };\n return MDCTabScrollerRTLReverse;\n}(MDCTabScrollerRTL));\nexport { MDCTabScrollerRTLReverse };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabScrollerRTLReverse;\n//# sourceMappingURL=rtl-reverse-scroller.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __read } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nimport { MDCTabScrollerRTLDefault } from './rtl-default-scroller';\nimport { MDCTabScrollerRTLNegative } from './rtl-negative-scroller';\nimport { MDCTabScrollerRTLReverse } from './rtl-reverse-scroller';\nvar MDCTabScrollerFoundation = /** @class */ (function (_super) {\n __extends(MDCTabScrollerFoundation, _super);\n function MDCTabScrollerFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this;\n /**\n * Controls whether we should handle the transitionend and interaction events during the animation.\n */\n _this.isAnimating = false;\n return _this;\n }\n Object.defineProperty(MDCTabScrollerFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabScrollerFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabScrollerFoundation, \"defaultAdapter\", {\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n eventTargetMatchesSelector: function () { return false; },\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n addScrollAreaClass: function () { return undefined; },\n setScrollAreaStyleProperty: function () { return undefined; },\n setScrollContentStyleProperty: function () { return undefined; },\n getScrollContentStyleValue: function () { return ''; },\n setScrollAreaScrollLeft: function () { return undefined; },\n getScrollAreaScrollLeft: function () { return 0; },\n getScrollContentOffsetWidth: function () { return 0; },\n getScrollAreaOffsetWidth: function () { return 0; },\n computeScrollAreaClientRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n computeScrollContentClientRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n computeHorizontalScrollbarHeight: function () { return 0; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTabScrollerFoundation.prototype.init = function () {\n // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll\n // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.\n var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight();\n this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');\n this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);\n };\n /**\n * Computes the current visual scroll position\n */\n MDCTabScrollerFoundation.prototype.getScrollPosition = function () {\n if (this.isRTL()) {\n return this.computeCurrentScrollPositionRTL();\n }\n var currentTranslateX = this.calculateCurrentTranslateX();\n var scrollLeft = this.adapter.getScrollAreaScrollLeft();\n return scrollLeft - currentTranslateX;\n };\n /**\n * Handles interaction events that occur during transition\n */\n MDCTabScrollerFoundation.prototype.handleInteraction = function () {\n // Early exit if we aren't animating\n if (!this.isAnimating) {\n return;\n }\n // Prevent other event listeners from handling this event\n this.stopScrollAnimation();\n };\n /**\n * Handles the transitionend event\n */\n MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {\n // Early exit if we aren't animating or the event was triggered by a different element.\n var evtTarget = evt.target;\n if (!this.isAnimating ||\n !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {\n return;\n }\n this.isAnimating = false;\n this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);\n };\n /**\n * Increment the scroll value by the scrollXIncrement using animation.\n * @param scrollXIncrement The value by which to increment the scroll position\n */\n MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {\n // Early exit for non-operational increment values\n if (scrollXIncrement === 0) {\n return;\n }\n this.animate(this.getIncrementScrollOperation(scrollXIncrement));\n };\n /**\n * Increment the scroll value by the scrollXIncrement without animation.\n * @param scrollXIncrement The value by which to increment the scroll position\n */\n MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) {\n // Early exit for non-operational increment values\n if (scrollXIncrement === 0) {\n return;\n }\n var operation = this.getIncrementScrollOperation(scrollXIncrement);\n if (operation.scrollDelta === 0) {\n return;\n }\n this.stopScrollAnimation();\n this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition);\n };\n /**\n * Scrolls to the given scrollX value\n */\n MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {\n if (this.isRTL()) {\n this.scrollToImplRTL(scrollX);\n return;\n }\n this.scrollToImpl(scrollX);\n };\n /**\n * @return Browser-specific {@link MDCTabScrollerRTL} instance.\n */\n MDCTabScrollerFoundation.prototype.getRTLScroller = function () {\n if (!this.rtlScrollerInstance) {\n this.rtlScrollerInstance = this.rtlScrollerFactory();\n }\n return this.rtlScrollerInstance;\n };\n /**\n * @return translateX value from a CSS matrix transform function string.\n */\n MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX = function () {\n var transformValue = this.adapter.getScrollContentStyleValue('transform');\n // Early exit if no transform is present\n if (transformValue === 'none') {\n return 0;\n }\n // The transform value comes back as a matrix transformation in the form\n // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so\n // we're going to grab all the parenthesized values, strip out tx, and\n // parse it.\n var match = /\\((.+?)\\)/.exec(transformValue);\n if (!match) {\n return 0;\n }\n var matrixParams = match[1];\n // tslint:disable-next-line:ban-ts-ignore \"Unused vars\" should be a linter warning, not a compiler error.\n // @ts-ignore These unused variables should retain their semantic names for clarity.\n var _a = __read(matrixParams.split(','), 6), a = _a[0], b = _a[1], c = _a[2], d = _a[3], tx = _a[4], ty = _a[5];\n return parseFloat(tx); // tslint:disable-line:ban\n };\n /**\n * Calculates a safe scroll value that is > 0 and < the max scroll value\n * @param scrollX The distance to scroll\n */\n MDCTabScrollerFoundation.prototype.clampScrollValue = function (scrollX) {\n var edges = this.calculateScrollEdges();\n return Math.min(Math.max(edges.left, scrollX), edges.right);\n };\n MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL = function () {\n var translateX = this.calculateCurrentTranslateX();\n return this.getRTLScroller().getScrollPositionRTL(translateX);\n };\n MDCTabScrollerFoundation.prototype.calculateScrollEdges = function () {\n var contentWidth = this.adapter.getScrollContentOffsetWidth();\n var rootWidth = this.adapter.getScrollAreaOffsetWidth();\n return {\n left: 0,\n right: contentWidth - rootWidth,\n };\n };\n /**\n * Internal scroll method\n * @param scrollX The new scroll position\n */\n MDCTabScrollerFoundation.prototype.scrollToImpl = function (scrollX) {\n var currentScrollX = this.getScrollPosition();\n var safeScrollX = this.clampScrollValue(scrollX);\n var scrollDelta = safeScrollX - currentScrollX;\n this.animate({\n finalScrollPosition: safeScrollX,\n scrollDelta: scrollDelta,\n });\n };\n /**\n * Internal RTL scroll method\n * @param scrollX The new scroll position\n */\n MDCTabScrollerFoundation.prototype.scrollToImplRTL = function (scrollX) {\n var animation = this.getRTLScroller().scrollToRTL(scrollX);\n this.animate(animation);\n };\n /**\n * Internal method to compute the increment scroll operation values.\n * @param scrollX The desired scroll position increment\n * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation.\n */\n MDCTabScrollerFoundation.prototype.getIncrementScrollOperation = function (scrollX) {\n if (this.isRTL()) {\n return this.getRTLScroller().incrementScrollRTL(scrollX);\n }\n var currentScrollX = this.getScrollPosition();\n var targetScrollX = scrollX + currentScrollX;\n var safeScrollX = this.clampScrollValue(targetScrollX);\n var scrollDelta = safeScrollX - currentScrollX;\n return {\n finalScrollPosition: safeScrollX,\n scrollDelta: scrollDelta,\n };\n };\n /**\n * Animates the tab scrolling\n * @param animation The animation to apply\n */\n MDCTabScrollerFoundation.prototype.animate = function (animation) {\n var _this = this;\n // Early exit if translateX is 0, which means there's no animation to perform\n if (animation.scrollDelta === 0) {\n return;\n }\n this.stopScrollAnimation();\n // This animation uses the FLIP approach.\n // Read more here: https://aerotwist.com/blog/flip-your-animations/\n this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition);\n this.adapter.setScrollContentStyleProperty('transform', \"translateX(\" + animation.scrollDelta + \"px)\");\n // Force repaint\n this.adapter.computeScrollAreaClientRect();\n requestAnimationFrame(function () {\n _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);\n _this.adapter.setScrollContentStyleProperty('transform', 'none');\n });\n this.isAnimating = true;\n };\n /**\n * Stops scroll animation\n */\n MDCTabScrollerFoundation.prototype.stopScrollAnimation = function () {\n this.isAnimating = false;\n var currentScrollPosition = this.getAnimatingScrollPosition();\n this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);\n this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)');\n this.adapter.setScrollAreaScrollLeft(currentScrollPosition);\n };\n /**\n * Gets the current scroll position during animation\n */\n MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition = function () {\n var currentTranslateX = this.calculateCurrentTranslateX();\n var scrollLeft = this.adapter.getScrollAreaScrollLeft();\n if (this.isRTL()) {\n return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);\n }\n return scrollLeft - currentTranslateX;\n };\n /**\n * Determines the RTL Scroller to use\n */\n MDCTabScrollerFoundation.prototype.rtlScrollerFactory = function () {\n // Browsers have three different implementations of scrollLeft in RTL mode,\n // dependent on the browser. The behavior is based off the max LTR\n // scrollLeft value and 0.\n //\n // * Default scrolling in RTL *\n // - Left-most value: 0\n // - Right-most value: Max LTR scrollLeft value\n //\n // * Negative scrolling in RTL *\n // - Left-most value: Negated max LTR scrollLeft value\n // - Right-most value: 0\n //\n // * Reverse scrolling in RTL *\n // - Left-most value: Max LTR scrollLeft value\n // - Right-most value: 0\n //\n // We use those principles below to determine which RTL scrollLeft\n // behavior is implemented in the current browser.\n var initialScrollLeft = this.adapter.getScrollAreaScrollLeft();\n this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1);\n var newScrollLeft = this.adapter.getScrollAreaScrollLeft();\n // If the newScrollLeft value is negative,then we know that the browser has\n // implemented negative RTL scrolling, since all other implementations have\n // only positive values.\n if (newScrollLeft < 0) {\n // Undo the scrollLeft test check\n this.adapter.setScrollAreaScrollLeft(initialScrollLeft);\n return new MDCTabScrollerRTLNegative(this.adapter);\n }\n var rootClientRect = this.adapter.computeScrollAreaClientRect();\n var contentClientRect = this.adapter.computeScrollContentClientRect();\n var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);\n // Undo the scrollLeft test check\n this.adapter.setScrollAreaScrollLeft(initialScrollLeft);\n // By calculating the clientRect of the root element and the clientRect of\n // the content element, we can determine how much the scroll value changed\n // when we performed the scrollLeft subtraction above.\n if (rightEdgeDelta === newScrollLeft) {\n return new MDCTabScrollerRTLReverse(this.adapter);\n }\n return new MDCTabScrollerRTLDefault(this.adapter);\n };\n MDCTabScrollerFoundation.prototype.isRTL = function () {\n return this.adapter.getScrollContentStyleValue('direction') === 'rtl';\n };\n return MDCTabScrollerFoundation;\n}(MDCFoundation));\nexport { MDCTabScrollerFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabScrollerFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { cssClasses } from './constants';\n/**\n * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.\n */\nvar horizontalScrollbarHeight_;\n/**\n * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.\n * May return 0 (e.g. on OS X browsers under default configuration).\n */\nexport function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {\n if (shouldCacheResult === void 0) { shouldCacheResult = true; }\n if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {\n return horizontalScrollbarHeight_;\n }\n var el = documentObj.createElement('div');\n el.classList.add(cssClasses.SCROLL_TEST);\n documentObj.body.appendChild(el);\n var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;\n documentObj.body.removeChild(el);\n if (shouldCacheResult) {\n horizontalScrollbarHeight_ = horizontalScrollbarHeight;\n }\n return horizontalScrollbarHeight;\n}\n//# sourceMappingURL=util.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { applyPassive } from '@material/dom/events';\nimport { matches } from '@material/dom/ponyfill';\nimport { MDCTabScrollerFoundation } from './foundation';\nimport * as util from './util';\nvar MDCTabScroller = /** @class */ (function (_super) {\n __extends(MDCTabScroller, _super);\n function MDCTabScroller() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabScroller.attachTo = function (root) {\n return new MDCTabScroller(root);\n };\n // initialSyncWithDOM()\n MDCTabScroller.prototype.initialize = function () {\n this.area = this.root.querySelector(MDCTabScrollerFoundation.strings.AREA_SELECTOR);\n this.content = this.root.querySelector(MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);\n };\n MDCTabScroller.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleInteraction = function () {\n _this.foundation.handleInteraction();\n };\n this.handleTransitionEnd = function (evt) {\n _this.foundation.handleTransitionEnd(evt);\n };\n this.area.addEventListener('wheel', this.handleInteraction, applyPassive());\n this.area.addEventListener('touchstart', this.handleInteraction, applyPassive());\n this.area.addEventListener('pointerdown', this.handleInteraction, applyPassive());\n this.area.addEventListener('mousedown', this.handleInteraction, applyPassive());\n this.area.addEventListener('keydown', this.handleInteraction, applyPassive());\n this.content.addEventListener('transitionend', this.handleTransitionEnd);\n };\n MDCTabScroller.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.area.removeEventListener('wheel', this.handleInteraction, applyPassive());\n this.area.removeEventListener('touchstart', this.handleInteraction, applyPassive());\n this.area.removeEventListener('pointerdown', this.handleInteraction, applyPassive());\n this.area.removeEventListener('mousedown', this.handleInteraction, applyPassive());\n this.area.removeEventListener('keydown', this.handleInteraction, applyPassive());\n this.content.removeEventListener('transitionend', this.handleTransitionEnd);\n };\n MDCTabScroller.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n eventTargetMatchesSelector: function (evtTarget, selector) {\n return matches(evtTarget, selector);\n },\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n addScrollAreaClass: function (className) {\n _this.area.classList.add(className);\n },\n setScrollAreaStyleProperty: function (prop, value) {\n _this.area.style.setProperty(prop, value);\n },\n setScrollContentStyleProperty: function (prop, value) {\n _this.content.style.setProperty(prop, value);\n },\n getScrollContentStyleValue: function (propName) {\n return window.getComputedStyle(_this.content).getPropertyValue(propName);\n },\n setScrollAreaScrollLeft: function (scrollX) { return _this.area.scrollLeft = scrollX; },\n getScrollAreaScrollLeft: function () { return _this.area.scrollLeft; },\n getScrollContentOffsetWidth: function () { return _this.content.offsetWidth; },\n getScrollAreaOffsetWidth: function () { return _this.area.offsetWidth; },\n computeScrollAreaClientRect: function () { return _this.area.getBoundingClientRect(); },\n computeScrollContentClientRect: function () {\n return _this.content.getBoundingClientRect();\n },\n computeHorizontalScrollbarHeight: function () {\n return util.computeHorizontalScrollbarHeight(document);\n },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCTabScrollerFoundation(adapter);\n };\n /**\n * Returns the current visual scroll position\n */\n MDCTabScroller.prototype.getScrollPosition = function () {\n return this.foundation.getScrollPosition();\n };\n /**\n * Returns the width of the scroll content\n */\n MDCTabScroller.prototype.getScrollContentWidth = function () {\n return this.content.offsetWidth;\n };\n /**\n * Increments the scroll value by the given amount\n * @param scrollXIncrement The pixel value by which to increment the scroll value\n */\n MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {\n this.foundation.incrementScroll(scrollXIncrement);\n };\n /**\n * Scrolls to the given pixel position\n * @param scrollX The pixel value to scroll to\n */\n MDCTabScroller.prototype.scrollTo = function (scrollX) {\n this.foundation.scrollTo(scrollX);\n };\n return MDCTabScroller;\n}(MDCComponent));\nexport { MDCTabScroller };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n ACTIVE: 'mdc-tab-indicator--active',\n FADE: 'mdc-tab-indicator--fade',\n NO_TRANSITION: 'mdc-tab-indicator--no-transition',\n};\nvar strings = {\n CONTENT_SELECTOR: '.mdc-tab-indicator__content',\n};\nexport { cssClasses, strings, };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCTabIndicatorFoundation = /** @class */ (function (_super) {\n __extends(MDCTabIndicatorFoundation, _super);\n function MDCTabIndicatorFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCTabIndicatorFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabIndicatorFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabIndicatorFoundation, \"defaultAdapter\", {\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n computeContentClientRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n setContentStyleProperty: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {\n return this.adapter.computeContentClientRect();\n };\n return MDCTabIndicatorFoundation;\n}(MDCFoundation));\nexport { MDCTabIndicatorFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabIndicatorFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCTabIndicatorFoundation } from './foundation';\n/* istanbul ignore next: subclass is not a branch statement */\nvar MDCFadingTabIndicatorFoundation = /** @class */ (function (_super) {\n __extends(MDCFadingTabIndicatorFoundation, _super);\n function MDCFadingTabIndicatorFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCFadingTabIndicatorFoundation.prototype.activate = function () {\n this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);\n };\n MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {\n this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);\n };\n return MDCFadingTabIndicatorFoundation;\n}(MDCTabIndicatorFoundation));\nexport { MDCFadingTabIndicatorFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCFadingTabIndicatorFoundation;\n//# sourceMappingURL=fading-foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCTabIndicatorFoundation } from './foundation';\n/* istanbul ignore next: subclass is not a branch statement */\nvar MDCSlidingTabIndicatorFoundation = /** @class */ (function (_super) {\n __extends(MDCSlidingTabIndicatorFoundation, _super);\n function MDCSlidingTabIndicatorFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {\n // Early exit if no indicator is present to handle cases where an indicator\n // may be activated without a prior indicator state\n if (!previousIndicatorClientRect) {\n this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);\n return;\n }\n // This animation uses the FLIP approach. You can read more about it at the link below:\n // https://aerotwist.com/blog/flip-your-animations/\n // Calculate the dimensions based on the dimensions of the previous indicator\n var currentClientRect = this.computeContentClientRect();\n var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;\n var xPosition = previousIndicatorClientRect.left - currentClientRect.left;\n this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);\n this.adapter.setContentStyleProperty('transform', \"translateX(\" + xPosition + \"px) scaleX(\" + widthDelta + \")\");\n // Force repaint before updating classes and transform to ensure the transform properly takes effect\n this.computeContentClientRect();\n this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);\n this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);\n this.adapter.setContentStyleProperty('transform', '');\n };\n MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {\n this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);\n };\n return MDCSlidingTabIndicatorFoundation;\n}(MDCTabIndicatorFoundation));\nexport { MDCSlidingTabIndicatorFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCSlidingTabIndicatorFoundation;\n//# sourceMappingURL=sliding-foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCFadingTabIndicatorFoundation } from './fading-foundation';\nimport { MDCTabIndicatorFoundation } from './foundation';\nimport { MDCSlidingTabIndicatorFoundation } from './sliding-foundation';\nvar MDCTabIndicator = /** @class */ (function (_super) {\n __extends(MDCTabIndicator, _super);\n function MDCTabIndicator() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabIndicator.attachTo = function (root) {\n return new MDCTabIndicator(root);\n };\n MDCTabIndicator.prototype.initialize = function () {\n this.content = this.root.querySelector(MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);\n };\n MDCTabIndicator.prototype.computeContentClientRect = function () {\n return this.foundation.computeContentClientRect();\n };\n MDCTabIndicator.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n addClass: function (className) { return _this.root.classList.add(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n computeContentClientRect: function () { return _this.content.getBoundingClientRect(); },\n setContentStyleProperty: function (prop, value) {\n _this.content.style.setProperty(prop, value);\n },\n };\n // tslint:enable:object-literal-sort-keys\n if (this.root.classList.contains(MDCTabIndicatorFoundation.cssClasses.FADE)) {\n return new MDCFadingTabIndicatorFoundation(adapter);\n }\n // Default to the sliding indicator\n return new MDCSlidingTabIndicatorFoundation(adapter);\n };\n MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {\n this.foundation.activate(previousIndicatorClientRect);\n };\n MDCTabIndicator.prototype.deactivate = function () {\n this.foundation.deactivate();\n };\n return MDCTabIndicator;\n}(MDCComponent));\nexport { MDCTabIndicator };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n ACTIVE: 'mdc-tab--active',\n};\nvar strings = {\n ARIA_SELECTED: 'aria-selected',\n CONTENT_SELECTOR: '.mdc-tab__content',\n INTERACTED_EVENT: 'MDCTab:interacted',\n RIPPLE_SELECTOR: '.mdc-tab__ripple',\n TABINDEX: 'tabIndex',\n TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator',\n};\nexport { cssClasses, strings, };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCTabFoundation = /** @class */ (function (_super) {\n __extends(MDCTabFoundation, _super);\n function MDCTabFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this;\n _this.focusOnActivate = true;\n return _this;\n }\n Object.defineProperty(MDCTabFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabFoundation, \"defaultAdapter\", {\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n setAttr: function () { return undefined; },\n activateIndicator: function () { return undefined; },\n deactivateIndicator: function () { return undefined; },\n notifyInteracted: function () { return undefined; },\n getOffsetLeft: function () { return 0; },\n getOffsetWidth: function () { return 0; },\n getContentOffsetLeft: function () { return 0; },\n getContentOffsetWidth: function () { return 0; },\n focus: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTabFoundation.prototype.handleClick = function () {\n // It's up to the parent component to keep track of the active Tab and\n // ensure we don't activate a Tab that's already active.\n this.adapter.notifyInteracted();\n };\n MDCTabFoundation.prototype.isActive = function () {\n return this.adapter.hasClass(cssClasses.ACTIVE);\n };\n /**\n * Sets whether the tab should focus itself when activated\n */\n MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {\n this.focusOnActivate = focusOnActivate;\n };\n /**\n * Activates the Tab\n */\n MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {\n this.adapter.addClass(cssClasses.ACTIVE);\n this.adapter.setAttr(strings.ARIA_SELECTED, 'true');\n this.adapter.setAttr(strings.TABINDEX, '0');\n this.adapter.activateIndicator(previousIndicatorClientRect);\n if (this.focusOnActivate) {\n this.adapter.focus();\n }\n };\n /**\n * Deactivates the Tab\n */\n MDCTabFoundation.prototype.deactivate = function () {\n // Early exit\n if (!this.isActive()) {\n return;\n }\n this.adapter.removeClass(cssClasses.ACTIVE);\n this.adapter.setAttr(strings.ARIA_SELECTED, 'false');\n this.adapter.setAttr(strings.TABINDEX, '-1');\n this.adapter.deactivateIndicator();\n };\n /**\n * Returns the dimensions of the Tab\n */\n MDCTabFoundation.prototype.computeDimensions = function () {\n var rootWidth = this.adapter.getOffsetWidth();\n var rootLeft = this.adapter.getOffsetLeft();\n var contentWidth = this.adapter.getContentOffsetWidth();\n var contentLeft = this.adapter.getContentOffsetLeft();\n return {\n contentLeft: rootLeft + contentLeft,\n contentRight: rootLeft + contentLeft + contentWidth,\n rootLeft: rootLeft,\n rootRight: rootLeft + rootWidth,\n };\n };\n return MDCTabFoundation;\n}(MDCFoundation));\nexport { MDCTabFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCRippleFoundation } from '@material/ripple/foundation';\nimport { MDCTabIndicator } from '@material/tab-indicator/component';\nimport { MDCTabFoundation } from './foundation';\nvar MDCTab = /** @class */ (function (_super) {\n __extends(MDCTab, _super);\n function MDCTab() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTab.attachTo = function (root) {\n return new MDCTab(root);\n };\n MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {\n if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new MDCRipple(el, foundation); }; }\n if (tabIndicatorFactory === void 0) { tabIndicatorFactory = function (el) { return new MDCTabIndicator(el); }; }\n this.id = this.root.id;\n var rippleFoundation = new MDCRippleFoundation(MDCRipple.createAdapter(this));\n this.ripple = rippleFactory(this.root, rippleFoundation);\n var tabIndicatorElement = this.root.querySelector(MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);\n this.tabIndicator = tabIndicatorFactory(tabIndicatorElement);\n this.content = this.root.querySelector(MDCTabFoundation.strings.CONTENT_SELECTOR);\n };\n MDCTab.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleClick = function () {\n _this.foundation.handleClick();\n };\n this.listen('click', this.handleClick);\n };\n MDCTab.prototype.destroy = function () {\n this.unlisten('click', this.handleClick);\n this.ripple.destroy();\n _super.prototype.destroy.call(this);\n };\n MDCTab.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },\n addClass: function (className) { return _this.root.classList.add(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n activateIndicator: function (previousIndicatorClientRect) {\n _this.tabIndicator.activate(previousIndicatorClientRect);\n },\n deactivateIndicator: function () {\n _this.tabIndicator.deactivate();\n },\n notifyInteracted: function () { return _this.emit(MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */); },\n getOffsetLeft: function () { return _this.root.offsetLeft; },\n getOffsetWidth: function () { return _this.root.offsetWidth; },\n getContentOffsetLeft: function () { return _this.content.offsetLeft; },\n getContentOffsetWidth: function () { return _this.content.offsetWidth; },\n focus: function () { return _this.root.focus(); },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCTabFoundation(adapter);\n };\n Object.defineProperty(MDCTab.prototype, \"active\", {\n /**\n * Getter for the active state of the tab\n */\n get: function () {\n return this.foundation.isActive();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTab.prototype, \"focusOnActivate\", {\n set: function (focusOnActivate) {\n this.foundation.setFocusOnActivate(focusOnActivate);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Activates the tab\n */\n MDCTab.prototype.activate = function (computeIndicatorClientRect) {\n this.foundation.activate(computeIndicatorClientRect);\n };\n /**\n * Deactivates the tab\n */\n MDCTab.prototype.deactivate = function () {\n this.foundation.deactivate();\n };\n /**\n * Returns the indicator's client rect\n */\n MDCTab.prototype.computeIndicatorClientRect = function () {\n return this.tabIndicator.computeContentClientRect();\n };\n MDCTab.prototype.computeDimensions = function () {\n return this.foundation.computeDimensions();\n };\n /**\n * Focuses the tab\n */\n MDCTab.prototype.focus = function () {\n this.root.focus();\n };\n return MDCTab;\n}(MDCComponent));\nexport { MDCTab };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n ARROW_LEFT_KEY: 'ArrowLeft',\n ARROW_RIGHT_KEY: 'ArrowRight',\n END_KEY: 'End',\n ENTER_KEY: 'Enter',\n HOME_KEY: 'Home',\n SPACE_KEY: 'Space',\n TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',\n TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',\n TAB_SELECTOR: '.mdc-tab',\n};\nvar numbers = {\n ARROW_LEFT_KEYCODE: 37,\n ARROW_RIGHT_KEYCODE: 39,\n END_KEYCODE: 35,\n ENTER_KEYCODE: 13,\n EXTRA_SCROLL_AMOUNT: 20,\n HOME_KEYCODE: 36,\n SPACE_KEYCODE: 32,\n};\nexport { numbers, strings };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { numbers, strings } from './constants';\nvar ACCEPTABLE_KEYS = new Set();\n// IE11 has no support for new Set with iterable so we need to initialize this by hand\nACCEPTABLE_KEYS.add(strings.ARROW_LEFT_KEY);\nACCEPTABLE_KEYS.add(strings.ARROW_RIGHT_KEY);\nACCEPTABLE_KEYS.add(strings.END_KEY);\nACCEPTABLE_KEYS.add(strings.HOME_KEY);\nACCEPTABLE_KEYS.add(strings.ENTER_KEY);\nACCEPTABLE_KEYS.add(strings.SPACE_KEY);\nvar KEYCODE_MAP = new Map();\n// IE11 has no support for new Map with iterable so we need to initialize this by hand\nKEYCODE_MAP.set(numbers.ARROW_LEFT_KEYCODE, strings.ARROW_LEFT_KEY);\nKEYCODE_MAP.set(numbers.ARROW_RIGHT_KEYCODE, strings.ARROW_RIGHT_KEY);\nKEYCODE_MAP.set(numbers.END_KEYCODE, strings.END_KEY);\nKEYCODE_MAP.set(numbers.HOME_KEYCODE, strings.HOME_KEY);\nKEYCODE_MAP.set(numbers.ENTER_KEYCODE, strings.ENTER_KEY);\nKEYCODE_MAP.set(numbers.SPACE_KEYCODE, strings.SPACE_KEY);\nvar MDCTabBarFoundation = /** @class */ (function (_super) {\n __extends(MDCTabBarFoundation, _super);\n function MDCTabBarFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this;\n _this.useAutomaticActivation = false;\n return _this;\n }\n Object.defineProperty(MDCTabBarFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabBarFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabBarFoundation, \"defaultAdapter\", {\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n scrollTo: function () { return undefined; },\n incrementScroll: function () { return undefined; },\n getScrollPosition: function () { return 0; },\n getScrollContentWidth: function () { return 0; },\n getOffsetWidth: function () { return 0; },\n isRTL: function () { return false; },\n setActiveTab: function () { return undefined; },\n activateTabAtIndex: function () { return undefined; },\n deactivateTabAtIndex: function () { return undefined; },\n focusTabAtIndex: function () { return undefined; },\n getTabIndicatorClientRectAtIndex: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n getTabDimensionsAtIndex: function () {\n return ({ rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 });\n },\n getPreviousActiveTabIndex: function () { return -1; },\n getFocusedTabIndex: function () { return -1; },\n getIndexOfTabById: function () { return -1; },\n getTabListLength: function () { return 0; },\n notifyTabActivated: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Switches between automatic and manual activation modes.\n * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.\n */\n MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {\n this.useAutomaticActivation = useAutomaticActivation;\n };\n MDCTabBarFoundation.prototype.activateTab = function (index) {\n var previousActiveIndex = this.adapter.getPreviousActiveTabIndex();\n if (!this.indexIsInRange(index) || index === previousActiveIndex) {\n return;\n }\n var previousClientRect;\n if (previousActiveIndex !== -1) {\n this.adapter.deactivateTabAtIndex(previousActiveIndex);\n previousClientRect =\n this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex);\n }\n this.adapter.activateTabAtIndex(index, previousClientRect);\n this.scrollIntoView(index);\n this.adapter.notifyTabActivated(index);\n };\n MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {\n // Get the key from the event\n var key = this.getKeyFromEvent(evt);\n // Early exit if the event key isn't one of the keyboard navigation keys\n if (key === undefined) {\n return;\n }\n // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple\n if (!this.isActivationKey(key)) {\n evt.preventDefault();\n }\n if (this.useAutomaticActivation) {\n if (this.isActivationKey(key)) {\n return;\n }\n var index = this.determineTargetFromKey(this.adapter.getPreviousActiveTabIndex(), key);\n this.adapter.setActiveTab(index);\n this.scrollIntoView(index);\n }\n else {\n var focusedTabIndex = this.adapter.getFocusedTabIndex();\n if (this.isActivationKey(key)) {\n this.adapter.setActiveTab(focusedTabIndex);\n }\n else {\n var index = this.determineTargetFromKey(focusedTabIndex, key);\n this.adapter.focusTabAtIndex(index);\n this.scrollIntoView(index);\n }\n }\n };\n /**\n * Handles the MDCTab:interacted event\n */\n MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {\n this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId));\n };\n /**\n * Scrolls the tab at the given index into view\n * @param index The tab index to make visible\n */\n MDCTabBarFoundation.prototype.scrollIntoView = function (index) {\n // Early exit if the index is out of range\n if (!this.indexIsInRange(index)) {\n return;\n }\n // Always scroll to 0 if scrolling to the 0th index\n if (index === 0) {\n this.adapter.scrollTo(0);\n return;\n }\n // Always scroll to the max value if scrolling to the Nth index\n // MDCTabScroller.scrollTo() will never scroll past the max possible value\n if (index === this.adapter.getTabListLength() - 1) {\n this.adapter.scrollTo(this.adapter.getScrollContentWidth());\n return;\n }\n if (this.isRTL()) {\n this.scrollIntoViewImplRTL(index);\n return;\n }\n this.scrollIntoViewImpl(index);\n };\n /**\n * Private method for determining the index of the destination tab based on what key was pressed\n * @param origin The original index from which to determine the destination\n * @param key The name of the key\n */\n MDCTabBarFoundation.prototype.determineTargetFromKey = function (origin, key) {\n var isRTL = this.isRTL();\n var maxIndex = this.adapter.getTabListLength() - 1;\n var shouldGoToEnd = key === strings.END_KEY;\n var shouldDecrement = key === strings.ARROW_LEFT_KEY && !isRTL || key === strings.ARROW_RIGHT_KEY && isRTL;\n var shouldIncrement = key === strings.ARROW_RIGHT_KEY && !isRTL || key === strings.ARROW_LEFT_KEY && isRTL;\n var index = origin;\n if (shouldGoToEnd) {\n index = maxIndex;\n }\n else if (shouldDecrement) {\n index -= 1;\n }\n else if (shouldIncrement) {\n index += 1;\n }\n else {\n index = 0;\n }\n if (index < 0) {\n index = maxIndex;\n }\n else if (index > maxIndex) {\n index = 0;\n }\n return index;\n };\n /**\n * Calculates the scroll increment that will make the tab at the given index visible\n * @param index The index of the tab\n * @param nextIndex The index of the next tab\n * @param scrollPosition The current scroll position\n * @param barWidth The width of the Tab Bar\n */\n MDCTabBarFoundation.prototype.calculateScrollIncrement = function (index, nextIndex, scrollPosition, barWidth) {\n var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);\n var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;\n var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;\n var leftIncrement = relativeContentRight - numbers.EXTRA_SCROLL_AMOUNT;\n var rightIncrement = relativeContentLeft + numbers.EXTRA_SCROLL_AMOUNT;\n if (nextIndex < index) {\n return Math.min(leftIncrement, 0);\n }\n return Math.max(rightIncrement, 0);\n };\n /**\n * Calculates the scroll increment that will make the tab at the given index visible in RTL\n * @param index The index of the tab\n * @param nextIndex The index of the next tab\n * @param scrollPosition The current scroll position\n * @param barWidth The width of the Tab Bar\n * @param scrollContentWidth The width of the scroll content\n */\n MDCTabBarFoundation.prototype.calculateScrollIncrementRTL = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {\n var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);\n var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;\n var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;\n var leftIncrement = relativeContentRight + numbers.EXTRA_SCROLL_AMOUNT;\n var rightIncrement = relativeContentLeft - numbers.EXTRA_SCROLL_AMOUNT;\n if (nextIndex > index) {\n return Math.max(leftIncrement, 0);\n }\n return Math.min(rightIncrement, 0);\n };\n /**\n * Determines the index of the adjacent tab closest to either edge of the Tab Bar\n * @param index The index of the tab\n * @param tabDimensions The dimensions of the tab\n * @param scrollPosition The current scroll position\n * @param barWidth The width of the tab bar\n */\n MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge = function (index, tabDimensions, scrollPosition, barWidth) {\n /**\n * Tabs are laid out in the Tab Scroller like this:\n *\n * Scroll Position\n * +---+\n * | | Bar Width\n * | +-----------------------------------+\n * | | |\n * | V V\n * | +-----------------------------------+\n * V | Tab Scroller |\n * +------------+--------------+-------------------+\n * | Tab | Tab | Tab |\n * +------------+--------------+-------------------+\n * | |\n * +-----------------------------------+\n *\n * To determine the next adjacent index, we look at the Tab root left and\n * Tab root right, both relative to the scroll position. If the Tab root\n * left is less than 0, then we know it's out of view to the left. If the\n * Tab root right minus the bar width is greater than 0, we know the Tab is\n * out of view to the right. From there, we either increment or decrement\n * the index.\n */\n var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;\n var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;\n var relativeRootDelta = relativeRootLeft + relativeRootRight;\n var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;\n var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;\n if (leftEdgeIsCloser) {\n return index - 1;\n }\n if (rightEdgeIsCloser) {\n return index + 1;\n }\n return -1;\n };\n /**\n * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL\n * @param index The index of the tab\n * @param tabDimensions The dimensions of the tab\n * @param scrollPosition The current scroll position\n * @param barWidth The width of the tab bar\n * @param scrollContentWidth The width of the scroller content\n */\n MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {\n var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;\n var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;\n var rootDelta = rootLeft + rootRight;\n var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;\n var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;\n if (leftEdgeIsCloser) {\n return index + 1;\n }\n if (rightEdgeIsCloser) {\n return index - 1;\n }\n return -1;\n };\n /**\n * Returns the key associated with a keydown event\n * @param evt The keydown event\n */\n MDCTabBarFoundation.prototype.getKeyFromEvent = function (evt) {\n if (ACCEPTABLE_KEYS.has(evt.key)) {\n return evt.key;\n }\n return KEYCODE_MAP.get(evt.keyCode);\n };\n MDCTabBarFoundation.prototype.isActivationKey = function (key) {\n return key === strings.SPACE_KEY || key === strings.ENTER_KEY;\n };\n /**\n * Returns whether a given index is inclusively between the ends\n * @param index The index to test\n */\n MDCTabBarFoundation.prototype.indexIsInRange = function (index) {\n return index >= 0 && index < this.adapter.getTabListLength();\n };\n /**\n * Returns the view's RTL property\n */\n MDCTabBarFoundation.prototype.isRTL = function () {\n return this.adapter.isRTL();\n };\n /**\n * Scrolls the tab at the given index into view for left-to-right user agents.\n * @param index The index of the tab to scroll into view\n */\n MDCTabBarFoundation.prototype.scrollIntoViewImpl = function (index) {\n var scrollPosition = this.adapter.getScrollPosition();\n var barWidth = this.adapter.getOffsetWidth();\n var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);\n var nextIndex = this.findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth);\n if (!this.indexIsInRange(nextIndex)) {\n return;\n }\n var scrollIncrement = this.calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth);\n this.adapter.incrementScroll(scrollIncrement);\n };\n /**\n * Scrolls the tab at the given index into view in RTL\n * @param index The tab index to make visible\n */\n MDCTabBarFoundation.prototype.scrollIntoViewImplRTL = function (index) {\n var scrollPosition = this.adapter.getScrollPosition();\n var barWidth = this.adapter.getOffsetWidth();\n var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);\n var scrollWidth = this.adapter.getScrollContentWidth();\n var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL(index, tabDimensions, scrollPosition, barWidth, scrollWidth);\n if (!this.indexIsInRange(nextIndex)) {\n return;\n }\n var scrollIncrement = this.calculateScrollIncrementRTL(index, nextIndex, scrollPosition, barWidth, scrollWidth);\n this.adapter.incrementScroll(scrollIncrement);\n };\n return MDCTabBarFoundation;\n}(MDCFoundation));\nexport { MDCTabBarFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTabBarFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __values } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCTabScroller } from '@material/tab-scroller/component';\nimport { MDCTab } from '@material/tab/component';\nimport { MDCTabFoundation } from '@material/tab/foundation';\nimport { MDCTabBarFoundation } from './foundation';\nvar strings = MDCTabBarFoundation.strings;\nvar tabIdCounter = 0;\nvar MDCTabBar = /** @class */ (function (_super) {\n __extends(MDCTabBar, _super);\n function MDCTabBar() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTabBar.attachTo = function (root) {\n return new MDCTabBar(root);\n };\n Object.defineProperty(MDCTabBar.prototype, \"focusOnActivate\", {\n set: function (focusOnActivate) {\n var e_1, _a;\n try {\n for (var _b = __values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {\n var tab = _c.value;\n tab.focusOnActivate = focusOnActivate;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTabBar.prototype, \"useAutomaticActivation\", {\n set: function (useAutomaticActivation) {\n this.foundation.setUseAutomaticActivation(useAutomaticActivation);\n },\n enumerable: false,\n configurable: true\n });\n MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {\n if (tabFactory === void 0) { tabFactory = function (el) { return new MDCTab(el); }; }\n if (tabScrollerFactory === void 0) { tabScrollerFactory = function (el) { return new MDCTabScroller(el); }; }\n this.tabList = this.instantiateTabs(tabFactory);\n this.tabScroller = this.instantiatetabScroller(tabScrollerFactory);\n };\n MDCTabBar.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.handleTabInteraction = function (evt) {\n _this.foundation.handleTabInteraction(evt);\n };\n this.handleKeyDown = function (evt) {\n _this.foundation.handleKeyDown(evt);\n };\n this.listen(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);\n this.listen('keydown', this.handleKeyDown);\n for (var i = 0; i < this.tabList.length; i++) {\n if (this.tabList[i].active) {\n this.scrollIntoView(i);\n break;\n }\n }\n };\n MDCTabBar.prototype.destroy = function () {\n var e_2, _a;\n _super.prototype.destroy.call(this);\n this.unlisten(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);\n this.unlisten('keydown', this.handleKeyDown);\n try {\n for (var _b = __values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {\n var tab = _c.value;\n tab.destroy();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (this.tabScroller) {\n this.tabScroller.destroy();\n }\n };\n MDCTabBar.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n scrollTo: function (scrollX) {\n _this.tabScroller.scrollTo(scrollX);\n },\n incrementScroll: function (scrollXIncrement) {\n _this.tabScroller.incrementScroll(scrollXIncrement);\n },\n getScrollPosition: function () { return _this.tabScroller.getScrollPosition(); },\n getScrollContentWidth: function () { return _this.tabScroller.getScrollContentWidth(); },\n getOffsetWidth: function () { return _this.root.offsetWidth; },\n isRTL: function () { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; },\n setActiveTab: function (index) {\n _this.foundation.activateTab(index);\n },\n activateTabAtIndex: function (index, clientRect) {\n _this.tabList[index].activate(clientRect);\n },\n deactivateTabAtIndex: function (index) {\n _this.tabList[index].deactivate();\n },\n focusTabAtIndex: function (index) {\n _this.tabList[index].focus();\n },\n getTabIndicatorClientRectAtIndex: function (index) {\n return _this.tabList[index].computeIndicatorClientRect();\n },\n getTabDimensionsAtIndex: function (index) {\n return _this.tabList[index].computeDimensions();\n },\n getPreviousActiveTabIndex: function () {\n for (var i = 0; i < _this.tabList.length; i++) {\n if (_this.tabList[i].active) {\n return i;\n }\n }\n return -1;\n },\n getFocusedTabIndex: function () {\n var tabElements = _this.getTabElements();\n var activeElement = document.activeElement;\n return tabElements.indexOf(activeElement);\n },\n getIndexOfTabById: function (id) {\n for (var i = 0; i < _this.tabList.length; i++) {\n if (_this.tabList[i].id === id) {\n return i;\n }\n }\n return -1;\n },\n getTabListLength: function () { return _this.tabList.length; },\n notifyTabActivated: function (index) { return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true); },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCTabBarFoundation(adapter);\n };\n /**\n * Activates the tab at the given index\n * @param index The index of the tab\n */\n MDCTabBar.prototype.activateTab = function (index) {\n this.foundation.activateTab(index);\n };\n /**\n * Scrolls the tab at the given index into view\n * @param index THe index of the tab\n */\n MDCTabBar.prototype.scrollIntoView = function (index) {\n this.foundation.scrollIntoView(index);\n };\n /**\n * Returns all the tab elements in a nice clean array\n */\n MDCTabBar.prototype.getTabElements = function () {\n return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR));\n };\n /**\n * Instantiates tab components on all child tab elements\n */\n MDCTabBar.prototype.instantiateTabs = function (tabFactory) {\n return this.getTabElements().map(function (el) {\n el.id = el.id || \"mdc-tab-\" + ++tabIdCounter;\n return tabFactory(el);\n });\n };\n /**\n * Instantiates tab scroller component on the child tab scroller element\n */\n MDCTabBar.prototype.instantiatetabScroller = function (tabScrollerFactory) {\n var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR);\n if (tabScrollerElement) {\n return tabScrollerFactory(tabScrollerElement);\n }\n return null;\n };\n return MDCTabBar;\n}(MDCComponent));\nexport { MDCTabBar };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {\n return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl });\n}\nexport function isScrollable(el) {\n return el ? el.scrollHeight > el.offsetHeight : false;\n}\n/**\n * For scrollable content, returns true if the content has not been scrolled\n * (that is, the scroll content is as the \"top\"). This is used in full-screen\n * dialogs, where the scroll divider is expected only to appear once the\n * content has been scrolled \"underneath\" the header bar.\n */\nexport function isScrollAtTop(el) {\n return el ? el.scrollTop === 0 : false;\n}\n/**\n * For scrollable content, returns true if the content has been scrolled all the\n * way to the bottom. This is used in full-screen dialogs, where the footer\n * scroll divider is expected only to appear when the content is \"cut-off\" by\n * the footer bar.\n */\nexport function isScrollAtBottom(el) {\n return el ? Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight :\n false;\n}\nexport function areTopsMisaligned(els) {\n var tops = new Set();\n [].forEach.call(els, function (el) { return tops.add(el.offsetTop); });\n return tops.size > 1;\n}\n//# sourceMappingURL=util.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';\n/**\n * Utility to trap focus in a given root element, e.g. for modal components such\n * as dialogs. The root should have at least one focusable child element,\n * for setting initial focus when trapping focus.\n * Also tracks the previously focused element, and restores focus to that\n * element when releasing focus.\n */\nvar FocusTrap = /** @class */ (function () {\n function FocusTrap(root, options) {\n if (options === void 0) { options = {}; }\n this.root = root;\n this.options = options;\n // Previously focused element before trapping focus.\n this.elFocusedBeforeTrapFocus = null;\n }\n /**\n * Traps focus in `root`. Also focuses on either `initialFocusEl` if set;\n * otherwises sets initial focus to the first focusable child element.\n */\n FocusTrap.prototype.trapFocus = function () {\n var focusableEls = this.getFocusableElements(this.root);\n if (focusableEls.length === 0) {\n throw new Error('FocusTrap: Element must have at least one focusable child.');\n }\n this.elFocusedBeforeTrapFocus =\n document.activeElement instanceof HTMLElement ? document.activeElement :\n null;\n this.wrapTabFocus(this.root);\n if (!this.options.skipInitialFocus) {\n this.focusInitialElement(focusableEls, this.options.initialFocusEl);\n }\n };\n /**\n * Releases focus from `root`. Also restores focus to the previously focused\n * element.\n */\n FocusTrap.prototype.releaseFocus = function () {\n [].slice.call(this.root.querySelectorAll(\".\" + FOCUS_SENTINEL_CLASS))\n .forEach(function (sentinelEl) {\n sentinelEl.parentElement.removeChild(sentinelEl);\n });\n if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) {\n this.elFocusedBeforeTrapFocus.focus();\n }\n };\n /**\n * Wraps tab focus within `el` by adding two hidden sentinel divs which are\n * used to mark the beginning and the end of the tabbable region. When\n * focused, these sentinel elements redirect focus to the first/last\n * children elements of the tabbable region, ensuring that focus is trapped\n * within that region.\n */\n FocusTrap.prototype.wrapTabFocus = function (el) {\n var _this = this;\n var sentinelStart = this.createSentinel();\n var sentinelEnd = this.createSentinel();\n sentinelStart.addEventListener('focus', function () {\n var focusableEls = _this.getFocusableElements(el);\n if (focusableEls.length > 0) {\n focusableEls[focusableEls.length - 1].focus();\n }\n });\n sentinelEnd.addEventListener('focus', function () {\n var focusableEls = _this.getFocusableElements(el);\n if (focusableEls.length > 0) {\n focusableEls[0].focus();\n }\n });\n el.insertBefore(sentinelStart, el.children[0]);\n el.appendChild(sentinelEnd);\n };\n /**\n * Focuses on `initialFocusEl` if defined and a child of the root element.\n * Otherwise, focuses on the first focusable child element of the root.\n */\n FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {\n var focusIndex = 0;\n if (initialFocusEl) {\n focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);\n }\n focusableEls[focusIndex].focus();\n };\n FocusTrap.prototype.getFocusableElements = function (root) {\n var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));\n return focusableEls.filter(function (el) {\n var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' ||\n el.getAttribute('disabled') != null ||\n el.getAttribute('hidden') != null ||\n el.getAttribute('aria-hidden') === 'true';\n var isTabbableAndVisible = el.tabIndex >= 0 &&\n el.getBoundingClientRect().width > 0 &&\n !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;\n var isProgrammaticallyHidden = false;\n if (isTabbableAndVisible) {\n var style = getComputedStyle(el);\n isProgrammaticallyHidden =\n style.display === 'none' || style.visibility === 'hidden';\n }\n return isTabbableAndVisible && !isProgrammaticallyHidden;\n });\n };\n FocusTrap.prototype.createSentinel = function () {\n var sentinel = document.createElement('div');\n sentinel.setAttribute('tabindex', '0');\n // Don't announce in screen readers.\n sentinel.setAttribute('aria-hidden', 'true');\n sentinel.classList.add(FOCUS_SENTINEL_CLASS);\n return sentinel;\n };\n return FocusTrap;\n}());\nexport { FocusTrap };\n//# sourceMappingURL=focus-trap.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n CLOSING: 'mdc-dialog--closing',\n OPEN: 'mdc-dialog--open',\n OPENING: 'mdc-dialog--opening',\n SCROLLABLE: 'mdc-dialog--scrollable',\n SCROLL_LOCK: 'mdc-dialog-scroll-lock',\n STACKED: 'mdc-dialog--stacked',\n FULLSCREEN: 'mdc-dialog--fullscreen',\n // Class for showing a scroll divider on full-screen dialog header element.\n // Should only be displayed on scrollable content, when the dialog content is\n // scrolled \"underneath\" the header.\n SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header',\n // Class for showing a scroll divider on a full-screen dialog footer element.\n // Should only be displayed on scrolalble content, when the dialog content is\n // obscured \"underneath\" the footer.\n SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer',\n // The \"surface scrim\" is a scrim covering only the surface of a dialog. This\n // is used in situations where a confirmation dialog is shown over an already\n // opened full-screen dialog. On larger screen-sizes, the full-screen dialog\n // is sized as a modal and so in these situations we display a \"surface scrim\"\n // to prevent a \"double scrim\" (where the scrim from the secondary\n // confirmation dialog would overlap with the scrim from the full-screen\n // dialog).\n SURFACE_SCRIM_SHOWN: 'mdc-dialog__surface-scrim--shown',\n // \"Showing\" animating class for the surface-scrim.\n SURFACE_SCRIM_SHOWING: 'mdc-dialog__surface-scrim--showing',\n // \"Hiding\" animating class for the surface-scrim.\n SURFACE_SCRIM_HIDING: 'mdc-dialog__surface-scrim--hiding',\n // Class to hide a dialog's scrim (used in conjunction with a surface-scrim).\n // Note that we only hide the original scrim rather than removing it entirely\n // to prevent interactions with the content behind this scrim, and to capture\n // scrim clicks.\n SCRIM_HIDDEN: 'mdc-dialog__scrim--hidden',\n};\nexport var strings = {\n ACTION_ATTRIBUTE: 'data-mdc-dialog-action',\n BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',\n BUTTON_SELECTOR: '.mdc-dialog__button',\n CLOSED_EVENT: 'MDCDialog:closed',\n CLOSE_ACTION: 'close',\n CLOSING_EVENT: 'MDCDialog:closing',\n CONTAINER_SELECTOR: '.mdc-dialog__container',\n CONTENT_SELECTOR: '.mdc-dialog__content',\n DESTROY_ACTION: 'destroy',\n INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',\n OPENED_EVENT: 'MDCDialog:opened',\n OPENING_EVENT: 'MDCDialog:opening',\n SCRIM_SELECTOR: '.mdc-dialog__scrim',\n SUPPRESS_DEFAULT_PRESS_SELECTOR: [\n 'textarea',\n '.mdc-menu .mdc-list-item',\n '.mdc-menu .mdc-deprecated-list-item',\n ].join(', '),\n SURFACE_SELECTOR: '.mdc-dialog__surface',\n};\nexport var numbers = {\n DIALOG_ANIMATION_CLOSE_TIME_MS: 75,\n DIALOG_ANIMATION_OPEN_TIME_MS: 150,\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { AnimationFrame } from '@material/animation/animationframe';\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nvar AnimationKeys;\n(function (AnimationKeys) {\n AnimationKeys[\"POLL_SCROLL_POS\"] = \"poll_scroll_position\";\n AnimationKeys[\"POLL_LAYOUT_CHANGE\"] = \"poll_layout_change\";\n})(AnimationKeys || (AnimationKeys = {}));\nvar MDCDialogFoundation = /** @class */ (function (_super) {\n __extends(MDCDialogFoundation, _super);\n function MDCDialogFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this;\n _this.dialogOpen = false;\n _this.isFullscreen = false;\n _this.animationFrame = 0;\n _this.animationTimer = 0;\n _this.escapeKeyAction = strings.CLOSE_ACTION;\n _this.scrimClickAction = strings.CLOSE_ACTION;\n _this.autoStackButtons = true;\n _this.areButtonsStacked = false;\n _this.suppressDefaultPressSelector = strings.SUPPRESS_DEFAULT_PRESS_SELECTOR;\n _this.animFrame = new AnimationFrame();\n _this.contentScrollHandler = function () {\n _this.handleScrollEvent();\n };\n _this.windowResizeHandler = function () {\n _this.layout();\n };\n _this.windowOrientationChangeHandler = function () {\n _this.layout();\n };\n return _this;\n }\n Object.defineProperty(MDCDialogFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addBodyClass: function () { return undefined; },\n addClass: function () { return undefined; },\n areButtonsStacked: function () { return false; },\n clickDefaultButton: function () { return undefined; },\n eventTargetMatches: function () { return false; },\n getActionFromEvent: function () { return ''; },\n getInitialFocusEl: function () { return null; },\n hasClass: function () { return false; },\n isContentScrollable: function () { return false; },\n notifyClosed: function () { return undefined; },\n notifyClosing: function () { return undefined; },\n notifyOpened: function () { return undefined; },\n notifyOpening: function () { return undefined; },\n releaseFocus: function () { return undefined; },\n removeBodyClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n reverseButtons: function () { return undefined; },\n trapFocus: function () { return undefined; },\n registerContentEventHandler: function () { return undefined; },\n deregisterContentEventHandler: function () { return undefined; },\n isScrollableContentAtTop: function () { return false; },\n isScrollableContentAtBottom: function () { return false; },\n registerWindowEventHandler: function () { return undefined; },\n deregisterWindowEventHandler: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCDialogFoundation.prototype.init = function () {\n if (this.adapter.hasClass(cssClasses.STACKED)) {\n this.setAutoStackButtons(false);\n }\n this.isFullscreen = this.adapter.hasClass(cssClasses.FULLSCREEN);\n };\n MDCDialogFoundation.prototype.destroy = function () {\n if (this.animationTimer) {\n clearTimeout(this.animationTimer);\n this.handleAnimationTimerEnd();\n }\n if (this.isFullscreen) {\n this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);\n }\n this.animFrame.cancelAll();\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n };\n MDCDialogFoundation.prototype.open = function (dialogOptions) {\n var _this = this;\n this.dialogOpen = true;\n this.adapter.notifyOpening();\n this.adapter.addClass(cssClasses.OPENING);\n if (this.isFullscreen) {\n // A scroll event listener is registered even if the dialog is not\n // scrollable on open, since the window resize event, or orientation\n // change may make the dialog scrollable after it is opened.\n this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler);\n }\n if (dialogOptions && dialogOptions.isAboveFullscreenDialog) {\n this.adapter.addClass(cssClasses.SCRIM_HIDDEN);\n }\n this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.registerWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n // Wait a frame once display is no longer \"none\", to establish basis for\n // animation\n this.runNextAnimationFrame(function () {\n _this.adapter.addClass(cssClasses.OPEN);\n _this.adapter.addBodyClass(cssClasses.SCROLL_LOCK);\n _this.layout();\n _this.animationTimer = setTimeout(function () {\n _this.handleAnimationTimerEnd();\n _this.adapter.trapFocus(_this.adapter.getInitialFocusEl());\n _this.adapter.notifyOpened();\n }, numbers.DIALOG_ANIMATION_OPEN_TIME_MS);\n });\n };\n MDCDialogFoundation.prototype.close = function (action) {\n var _this = this;\n if (action === void 0) { action = ''; }\n if (!this.dialogOpen) {\n // Avoid redundant close calls (and events), e.g. from keydown on elements\n // that inherently emit click\n return;\n }\n this.dialogOpen = false;\n this.adapter.notifyClosing(action);\n this.adapter.addClass(cssClasses.CLOSING);\n this.adapter.removeClass(cssClasses.OPEN);\n this.adapter.removeBodyClass(cssClasses.SCROLL_LOCK);\n if (this.isFullscreen) {\n this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);\n }\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n clearTimeout(this.animationTimer);\n this.animationTimer = setTimeout(function () {\n _this.adapter.releaseFocus();\n _this.handleAnimationTimerEnd();\n _this.adapter.notifyClosed(action);\n }, numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);\n };\n /**\n * Used only in instances of showing a secondary dialog over a full-screen\n * dialog. Shows the \"surface scrim\" displayed over the full-screen dialog.\n */\n MDCDialogFoundation.prototype.showSurfaceScrim = function () {\n var _this = this;\n this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWING);\n this.runNextAnimationFrame(function () {\n _this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWN);\n });\n };\n /**\n * Used only in instances of showing a secondary dialog over a full-screen\n * dialog. Hides the \"surface scrim\" displayed over the full-screen dialog.\n */\n MDCDialogFoundation.prototype.hideSurfaceScrim = function () {\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWN);\n this.adapter.addClass(cssClasses.SURFACE_SCRIM_HIDING);\n };\n /**\n * Handles `transitionend` event triggered when surface scrim animation is\n * finished.\n */\n MDCDialogFoundation.prototype.handleSurfaceScrimTransitionEnd = function () {\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_HIDING);\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWING);\n };\n MDCDialogFoundation.prototype.isOpen = function () {\n return this.dialogOpen;\n };\n MDCDialogFoundation.prototype.getEscapeKeyAction = function () {\n return this.escapeKeyAction;\n };\n MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {\n this.escapeKeyAction = action;\n };\n MDCDialogFoundation.prototype.getScrimClickAction = function () {\n return this.scrimClickAction;\n };\n MDCDialogFoundation.prototype.setScrimClickAction = function (action) {\n this.scrimClickAction = action;\n };\n MDCDialogFoundation.prototype.getAutoStackButtons = function () {\n return this.autoStackButtons;\n };\n MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {\n this.autoStackButtons = autoStack;\n };\n MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () {\n return this.suppressDefaultPressSelector;\n };\n MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) {\n this.suppressDefaultPressSelector = selector;\n };\n MDCDialogFoundation.prototype.layout = function () {\n var _this = this;\n this.animFrame.request(AnimationKeys.POLL_LAYOUT_CHANGE, function () {\n _this.layoutInternal();\n });\n };\n /** Handles click on the dialog root element. */\n MDCDialogFoundation.prototype.handleClick = function (evt) {\n var isScrim = this.adapter.eventTargetMatches(evt.target, strings.SCRIM_SELECTOR);\n // Check for scrim click first since it doesn't require querying ancestors.\n if (isScrim && this.scrimClickAction !== '') {\n this.close(this.scrimClickAction);\n }\n else {\n var action = this.adapter.getActionFromEvent(evt);\n if (action) {\n this.close(action);\n }\n }\n };\n /** Handles keydown on the dialog root element. */\n MDCDialogFoundation.prototype.handleKeydown = function (evt) {\n var isEnter = evt.key === 'Enter' || evt.keyCode === 13;\n if (!isEnter) {\n return;\n }\n var action = this.adapter.getActionFromEvent(evt);\n if (action) {\n // Action button callback is handled in `handleClick`,\n // since space/enter keydowns on buttons trigger click events.\n return;\n }\n // `composedPath` is used here, when available, to account for use cases\n // where a target meant to suppress the default press behaviour\n // may exist in a shadow root.\n // For example, a textarea inside a web component:\n // \n // \n // #shadow-root (open)\n // \n // #shadow-root (open)\n // \n // \n // \n // \n var target = evt.composedPath ? evt.composedPath()[0] : evt.target;\n var isDefault = this.suppressDefaultPressSelector ?\n !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) :\n true;\n if (isEnter && isDefault) {\n this.adapter.clickDefaultButton();\n }\n };\n /** Handles keydown on the document. */\n MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {\n var isEscape = evt.key === 'Escape' || evt.keyCode === 27;\n if (isEscape && this.escapeKeyAction !== '') {\n this.close(this.escapeKeyAction);\n }\n };\n /**\n * Handles scroll event on the dialog's content element -- showing a scroll\n * divider on the header or footer based on the scroll position. This handler\n * should only be registered on full-screen dialogs with scrollable content.\n */\n MDCDialogFoundation.prototype.handleScrollEvent = function () {\n var _this = this;\n // Since scroll events can fire at a high rate, we throttle these events by\n // using requestAnimationFrame.\n this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () {\n _this.toggleScrollDividerHeader();\n _this.toggleScrollDividerFooter();\n });\n };\n MDCDialogFoundation.prototype.layoutInternal = function () {\n if (this.autoStackButtons) {\n this.detectStackedButtons();\n }\n this.toggleScrollableClasses();\n };\n MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () {\n this.animationTimer = 0;\n this.adapter.removeClass(cssClasses.OPENING);\n this.adapter.removeClass(cssClasses.CLOSING);\n };\n /**\n * Runs the given logic on the next animation frame, using setTimeout to\n * factor in Firefox reflow behavior.\n */\n MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) {\n var _this = this;\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = requestAnimationFrame(function () {\n _this.animationFrame = 0;\n clearTimeout(_this.animationTimer);\n _this.animationTimer = setTimeout(callback, 0);\n });\n };\n MDCDialogFoundation.prototype.detectStackedButtons = function () {\n // Remove the class first to let us measure the buttons' natural positions.\n this.adapter.removeClass(cssClasses.STACKED);\n var areButtonsStacked = this.adapter.areButtonsStacked();\n if (areButtonsStacked) {\n this.adapter.addClass(cssClasses.STACKED);\n }\n if (areButtonsStacked !== this.areButtonsStacked) {\n this.adapter.reverseButtons();\n this.areButtonsStacked = areButtonsStacked;\n }\n };\n MDCDialogFoundation.prototype.toggleScrollableClasses = function () {\n // Remove the class first to let us measure the natural height of the\n // content.\n this.adapter.removeClass(cssClasses.SCROLLABLE);\n if (this.adapter.isContentScrollable()) {\n this.adapter.addClass(cssClasses.SCROLLABLE);\n if (this.isFullscreen) {\n // If dialog is full-screen and scrollable, check if a scroll divider\n // should be shown.\n this.toggleScrollDividerHeader();\n this.toggleScrollDividerFooter();\n }\n }\n };\n MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () {\n if (!this.adapter.isScrollableContentAtTop()) {\n this.adapter.addClass(cssClasses.SCROLL_DIVIDER_HEADER);\n }\n else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_HEADER)) {\n this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_HEADER);\n }\n };\n MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () {\n if (!this.adapter.isScrollableContentAtBottom()) {\n this.adapter.addClass(cssClasses.SCROLL_DIVIDER_FOOTER);\n }\n else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_FOOTER)) {\n this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_FOOTER);\n }\n };\n return MDCDialogFoundation;\n}(MDCFoundation));\nexport { MDCDialogFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCDialogFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __values } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { FocusTrap } from '@material/dom/focus-trap';\nimport { closest, matches } from '@material/dom/ponyfill';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCDialogFoundation } from './foundation';\nimport * as util from './util';\nvar strings = MDCDialogFoundation.strings;\nvar MDCDialog = /** @class */ (function (_super) {\n __extends(MDCDialog, _super);\n function MDCDialog() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(MDCDialog.prototype, \"isOpen\", {\n get: function () {\n return this.foundation.isOpen();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialog.prototype, \"escapeKeyAction\", {\n get: function () {\n return this.foundation.getEscapeKeyAction();\n },\n set: function (action) {\n this.foundation.setEscapeKeyAction(action);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialog.prototype, \"scrimClickAction\", {\n get: function () {\n return this.foundation.getScrimClickAction();\n },\n set: function (action) {\n this.foundation.setScrimClickAction(action);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialog.prototype, \"autoStackButtons\", {\n get: function () {\n return this.foundation.getAutoStackButtons();\n },\n set: function (autoStack) {\n this.foundation.setAutoStackButtons(autoStack);\n },\n enumerable: false,\n configurable: true\n });\n MDCDialog.attachTo = function (root) {\n return new MDCDialog(root);\n };\n MDCDialog.prototype.initialize = function (focusTrapFactory) {\n var e_1, _a;\n if (focusTrapFactory === void 0) { focusTrapFactory = function (el, focusOptions) {\n return new FocusTrap(el, focusOptions);\n }; }\n var container = this.root.querySelector(strings.CONTAINER_SELECTOR);\n if (!container) {\n throw new Error(\"Dialog component requires a \" + strings.CONTAINER_SELECTOR + \" container element\");\n }\n this.container = container;\n this.content =\n this.root.querySelector(strings.CONTENT_SELECTOR);\n this.buttons = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR));\n this.defaultButton = this.root.querySelector(\"[\" + strings.BUTTON_DEFAULT_ATTRIBUTE + \"]\");\n this.focusTrapFactory = focusTrapFactory;\n this.buttonRipples = [];\n try {\n for (var _b = __values(this.buttons), _c = _b.next(); !_c.done; _c = _b.next()) {\n var buttonEl = _c.value;\n this.buttonRipples.push(new MDCRipple(buttonEl));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n MDCDialog.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.focusTrap = util.createFocusTrapInstance(this.container, this.focusTrapFactory, this.getInitialFocusEl() || undefined);\n this.handleClick = this.foundation.handleClick.bind(this.foundation);\n this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation);\n this.handleDocumentKeydown =\n this.foundation.handleDocumentKeydown.bind(this.foundation);\n // this.handleLayout = this.layout.bind(this);\n this.handleOpening = function () {\n document.addEventListener('keydown', _this.handleDocumentKeydown);\n };\n this.handleClosing = function () {\n document.removeEventListener('keydown', _this.handleDocumentKeydown);\n };\n this.listen('click', this.handleClick);\n this.listen('keydown', this.handleKeydown);\n this.listen(strings.OPENING_EVENT, this.handleOpening);\n this.listen(strings.CLOSING_EVENT, this.handleClosing);\n };\n MDCDialog.prototype.destroy = function () {\n this.unlisten('click', this.handleClick);\n this.unlisten('keydown', this.handleKeydown);\n this.unlisten(strings.OPENING_EVENT, this.handleOpening);\n this.unlisten(strings.CLOSING_EVENT, this.handleClosing);\n this.handleClosing();\n this.buttonRipples.forEach(function (ripple) {\n ripple.destroy();\n });\n _super.prototype.destroy.call(this);\n };\n MDCDialog.prototype.layout = function () {\n this.foundation.layout();\n };\n MDCDialog.prototype.open = function () {\n this.foundation.open();\n };\n MDCDialog.prototype.close = function (action) {\n if (action === void 0) { action = ''; }\n this.foundation.close(action);\n };\n MDCDialog.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addBodyClass: function (className) { return document.body.classList.add(className); },\n addClass: function (className) { return _this.root.classList.add(className); },\n areButtonsStacked: function () { return util.areTopsMisaligned(_this.buttons); },\n clickDefaultButton: function () {\n if (_this.defaultButton && !_this.defaultButton.disabled) {\n _this.defaultButton.click();\n }\n },\n eventTargetMatches: function (target, selector) {\n return target ? matches(target, selector) : false;\n },\n getActionFromEvent: function (evt) {\n if (!evt.target) {\n return '';\n }\n var element = closest(evt.target, \"[\" + strings.ACTION_ATTRIBUTE + \"]\");\n return element && element.getAttribute(strings.ACTION_ATTRIBUTE);\n },\n getInitialFocusEl: function () { return _this.getInitialFocusEl(); },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n isContentScrollable: function () { return util.isScrollable(_this.content); },\n notifyClosed: function (action) { return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {}); },\n notifyClosing: function (action) { return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {}); },\n notifyOpened: function () { return _this.emit(strings.OPENED_EVENT, {}); },\n notifyOpening: function () { return _this.emit(strings.OPENING_EVENT, {}); },\n releaseFocus: function () {\n _this.focusTrap.releaseFocus();\n },\n removeBodyClass: function (className) { return document.body.classList.remove(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n reverseButtons: function () {\n _this.buttons.reverse();\n _this.buttons.forEach(function (button) {\n button.parentElement.appendChild(button);\n });\n },\n trapFocus: function () {\n _this.focusTrap.trapFocus();\n },\n registerContentEventHandler: function (evt, handler) {\n if (_this.content instanceof HTMLElement) {\n _this.content.addEventListener(evt, handler);\n }\n },\n deregisterContentEventHandler: function (evt, handler) {\n if (_this.content instanceof HTMLElement) {\n _this.content.removeEventListener(evt, handler);\n }\n },\n isScrollableContentAtTop: function () {\n return util.isScrollAtTop(_this.content);\n },\n isScrollableContentAtBottom: function () {\n return util.isScrollAtBottom(_this.content);\n },\n registerWindowEventHandler: function (evt, handler) {\n window.addEventListener(evt, handler);\n },\n deregisterWindowEventHandler: function (evt, handler) {\n window.removeEventListener(evt, handler);\n },\n };\n return new MDCDialogFoundation(adapter);\n };\n MDCDialog.prototype.getInitialFocusEl = function () {\n return this.root.querySelector(\"[\" + strings.INITIAL_FOCUS_ATTRIBUTE + \"]\");\n };\n return MDCDialog;\n}(MDCComponent));\nexport { MDCDialog };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * CSS classes used for switch.\n */\nexport var CssClasses;\n(function (CssClasses) {\n CssClasses[\"PROCESSING\"] = \"mdc-switch--processing\";\n CssClasses[\"SELECTED\"] = \"mdc-switch--selected\";\n CssClasses[\"UNSELECTED\"] = \"mdc-switch--unselected\";\n})(CssClasses || (CssClasses = {}));\n/**\n * Query selectors used for switch.\n */\nexport var Selectors;\n(function (Selectors) {\n Selectors[\"RIPPLE\"] = \".mdc-switch__ripple\";\n})(Selectors || (Selectors = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __read, __spreadArray, __values } from \"tslib\";\n/**\n * Mixin to add `MDCObserver` functionality to an optional base class.\n *\n * @deprecated Prefer MDCObserverFoundation for stricter closure compliance.\n * @template C Optional base class constructor type.\n * @param baseClass - Optional base class.\n * @return A class that extends the optional base class with `MDCObserver`\n * functionality.\n */\nexport function mdcObserver(baseClass) {\n if (baseClass === void 0) { baseClass = /** @class */ (function () {\n function class_1() {\n }\n return class_1;\n }()); }\n // Mixin classes cannot use private members and Symbol() cannot be used in 3P\n // for IE11.\n var unobserveMap = new WeakMap();\n return /** @class */ (function (_super) {\n __extends(MDCObserver, _super);\n function MDCObserver() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCObserver.prototype.observe = function (target, observers) {\n var e_1, _a;\n var _this = this;\n var cleanup = [];\n try {\n for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var property = _c.value;\n var observer = observers[property].bind(this);\n cleanup.push(observeProperty(target, property, observer));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var unobserve = function () {\n var e_2, _a;\n try {\n for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {\n var cleanupFn = cleanup_1_1.value;\n cleanupFn();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n var unobserves = unobserveMap.get(_this) || [];\n var index = unobserves.indexOf(unobserve);\n if (index > -1) {\n unobserves.splice(index, 1);\n }\n };\n var unobserves = unobserveMap.get(this);\n if (!unobserves) {\n unobserves = [];\n unobserveMap.set(this, unobserves);\n }\n unobserves.push(unobserve);\n return unobserve;\n };\n MDCObserver.prototype.setObserversEnabled = function (target, enabled) {\n setObserversEnabled(target, enabled);\n };\n MDCObserver.prototype.unobserve = function () {\n var e_3, _a;\n // Iterate over a copy since unobserve() will remove themselves from the\n // array\n var unobserves = unobserveMap.get(this) || [];\n try {\n for (var _b = __values(__spreadArray([], __read(unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {\n var unobserve = _c.value;\n unobserve();\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n return MDCObserver;\n }(baseClass));\n}\n/**\n * Observe a target's property for changes. When a property changes, the\n * provided `Observer` function will be invoked with the properties current and\n * previous values.\n *\n * The returned cleanup function will stop listening to changes for the\n * provided `Observer`.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @param target - The target to observe.\n * @param property - The property of the target to observe.\n * @param observer - An observer function to invoke each time the property\n * changes.\n * @return A cleanup function that will stop observing changes for the provided\n * `Observer`.\n */\nexport function observeProperty(target, property, observer) {\n var targetObservers = installObserver(target, property);\n var observers = targetObservers.getObservers(property);\n observers.push(observer);\n return function () {\n observers.splice(observers.indexOf(observer), 1);\n };\n}\n/**\n * A Map of all `TargetObservers` that have been installed.\n */\nvar allTargetObservers = new WeakMap();\n/**\n * Installs a `TargetObservers` for the provided target (if not already\n * installed), and replaces the given property with a getter and setter that\n * will respond to changes and call `TargetObservers`.\n *\n * Subsequent calls to `installObserver()` with the same target and property\n * will not override the property's previously installed getter/setter.\n *\n * @template T The observed target type.\n * @template K The observed property to create a getter/setter for.\n * @param target - The target to observe.\n * @param property - The property to create a getter/setter for, if needed.\n * @return The installed `TargetObservers` for the provided target.\n */\nfunction installObserver(target, property) {\n var observersMap = new Map();\n if (!allTargetObservers.has(target)) {\n allTargetObservers.set(target, {\n isEnabled: true,\n getObservers: function (key) {\n var observers = observersMap.get(key) || [];\n if (!observersMap.has(key)) {\n observersMap.set(key, observers);\n }\n return observers;\n },\n installedProperties: new Set()\n });\n }\n var targetObservers = allTargetObservers.get(target);\n if (targetObservers.installedProperties.has(property)) {\n // The getter/setter has already been replaced for this property\n return targetObservers;\n }\n // Retrieve (or create if it's a plain property) the original descriptor from\n // the target...\n var descriptor = getDescriptor(target, property) || {\n configurable: true,\n enumerable: true,\n value: target[property],\n writable: true\n };\n // ...and create a copy that will be used for the observer.\n var observedDescriptor = __assign({}, descriptor);\n var descGet = descriptor.get, descSet = descriptor.set;\n if ('value' in descriptor) {\n // The descriptor is a simple value (not a getter/setter).\n // For our observer descriptor that we copied, delete the value/writable\n // properties, since they are incompatible with the get/set properties\n // for descriptors.\n delete observedDescriptor.value;\n delete observedDescriptor.writable;\n // Set up a simple getter...\n var value_1 = descriptor.value;\n descGet = function () { return value_1; };\n // ...and setter (if the original property was writable).\n if (descriptor.writable) {\n descSet = function (newValue) {\n value_1 = newValue;\n };\n }\n }\n if (descGet) {\n observedDescriptor.get = function () {\n // `this as T` needed for closure conformance\n return descGet.call(this);\n };\n }\n if (descSet) {\n observedDescriptor.set = function (newValue) {\n var e_4, _a;\n // `thus as T` needed for closure conformance\n var previous = descGet ? descGet.call(this) : newValue;\n descSet.call(this, newValue);\n if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {\n try {\n for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var observer = _c.value;\n observer(newValue, previous);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n }\n };\n }\n targetObservers.installedProperties.add(property);\n Object.defineProperty(target, property, observedDescriptor);\n return targetObservers;\n}\n/**\n * Retrieves the descriptor for a property from the provided target. This\n * function will walk up the target's prototype chain to search for the\n * descriptor.\n *\n * @template T The target type.\n * @template K The property type.\n * @param target - The target to retrieve a descriptor from.\n * @param property - The name of the property to retrieve a descriptor for.\n * @return the descriptor, or undefined if it does not exist. Keep in mind that\n * plain properties may not have a descriptor defined.\n */\nexport function getDescriptor(target, property) {\n var descriptorTarget = target;\n var descriptor;\n while (descriptorTarget) {\n descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);\n if (descriptor) {\n break;\n }\n // Walk up the instance's prototype chain in case the property is declared\n // on a superclass.\n descriptorTarget = Object.getPrototypeOf(descriptorTarget);\n }\n return descriptor;\n}\n/**\n * Enables or disables all observers for a provided target. Changes to observed\n * properties will not call any observers when disabled.\n *\n * @template T The observed target type.\n * @param target - The target to enable or disable observers for.\n * @param enabled - True to enable or false to disable observers.\n */\nexport function setObserversEnabled(target, enabled) {\n var targetObservers = allTargetObservers.get(target);\n if (targetObservers) {\n targetObservers.isEnabled = enabled;\n }\n}\n//# sourceMappingURL=observer.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __read, __spreadArray, __values } from \"tslib\";\nimport { MDCFoundation } from './foundation';\nimport { observeProperty, setObserversEnabled } from './observer';\nvar MDCObserverFoundation = /** @class */ (function (_super) {\n __extends(MDCObserverFoundation, _super);\n function MDCObserverFoundation(adapter) {\n var _this = _super.call(this, adapter) || this;\n /** A set of cleanup functions to unobserve changes. */\n _this.unobserves = new Set();\n return _this;\n }\n MDCObserverFoundation.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.unobserve();\n };\n /**\n * Observe a target's properties for changes using the provided map of\n * property names and observer functions.\n *\n * @template T The target type.\n * @param target - The target to observe.\n * @param observers - An object whose keys are target properties and values\n * are observer functions that are called when the associated property\n * changes.\n * @return A cleanup function that can be called to unobserve the\n * target.\n */\n MDCObserverFoundation.prototype.observe = function (target, observers) {\n var e_1, _a;\n var _this = this;\n var cleanup = [];\n try {\n for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var property = _c.value;\n var observer = observers[property].bind(this);\n cleanup.push(this.observeProperty(target, property, observer));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var unobserve = function () {\n var e_2, _a;\n try {\n for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {\n var cleanupFn = cleanup_1_1.value;\n cleanupFn();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n _this.unobserves.delete(unobserve);\n };\n this.unobserves.add(unobserve);\n return unobserve;\n };\n /**\n * Observe a target's property for changes. When a property changes, the\n * provided `Observer` function will be invoked with the properties current\n * and previous values.\n *\n * The returned cleanup function will stop listening to changes for the\n * provided `Observer`.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @param target - The target to observe.\n * @param property - The property of the target to observe.\n * @param observer - An observer function to invoke each time the property\n * changes.\n * @return A cleanup function that will stop observing changes for the\n * provided `Observer`.\n */\n MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {\n return observeProperty(target, property, observer);\n };\n /**\n * Enables or disables all observers for the provided target. Disabling\n * observers will prevent them from being called until they are re-enabled.\n *\n * @param target - The target to enable or disable observers for.\n * @param enabled - Whether or not observers should be called.\n */\n MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {\n setObserversEnabled(target, enabled);\n };\n /**\n * Clean up all observers and stop listening for property changes.\n */\n MDCObserverFoundation.prototype.unobserve = function () {\n var e_3, _a;\n try {\n // Iterate over a copy since unobserve() will remove themselves from the set\n for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {\n var unobserve = _c.value;\n unobserve();\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n return MDCObserverFoundation;\n}(MDCFoundation));\nexport { MDCObserverFoundation };\n//# sourceMappingURL=observer-foundation.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCObserverFoundation } from '@material/base/observer-foundation';\nimport { CssClasses } from './constants';\n/**\n * `MDCSwitchFoundation` provides a state-only foundation for a switch\n * component.\n *\n * State observers and event handler entrypoints update a component's adapter's\n * state with the logic needed for switch to function.\n */\nvar MDCSwitchFoundation = /** @class */ (function (_super) {\n __extends(MDCSwitchFoundation, _super);\n function MDCSwitchFoundation(adapter) {\n var _this = _super.call(this, adapter) || this;\n _this.handleClick = _this.handleClick.bind(_this);\n return _this;\n }\n /**\n * Initializes the foundation and starts observing state changes.\n */\n MDCSwitchFoundation.prototype.init = function () {\n this.observe(this.adapter.state, {\n disabled: this.stopProcessingIfDisabled,\n processing: this.stopProcessingIfDisabled,\n });\n };\n /**\n * Event handler for switch click events. Clicking on a switch will toggle its\n * selected state.\n */\n MDCSwitchFoundation.prototype.handleClick = function () {\n if (this.adapter.state.disabled) {\n return;\n }\n this.adapter.state.selected = !this.adapter.state.selected;\n };\n MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {\n if (this.adapter.state.disabled) {\n this.adapter.state.processing = false;\n }\n };\n return MDCSwitchFoundation;\n}(MDCObserverFoundation));\nexport { MDCSwitchFoundation };\n/**\n * `MDCSwitchRenderFoundation` provides a state and rendering foundation for a\n * switch component.\n *\n * State observers and event handler entrypoints update a component's\n * adapter's state with the logic needed for switch to function.\n *\n * In response to state changes, the rendering foundation uses the component's\n * render adapter to keep the component's DOM updated with the state.\n */\nvar MDCSwitchRenderFoundation = /** @class */ (function (_super) {\n __extends(MDCSwitchRenderFoundation, _super);\n function MDCSwitchRenderFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Initializes the foundation and starts observing state changes.\n */\n MDCSwitchRenderFoundation.prototype.init = function () {\n _super.prototype.init.call(this);\n this.observe(this.adapter.state, {\n disabled: this.onDisabledChange,\n processing: this.onProcessingChange,\n selected: this.onSelectedChange,\n });\n };\n /**\n * Initializes the foundation from a server side rendered (SSR) component.\n * This will sync the adapter's state with the current state of the DOM.\n *\n * This method should be called after `init()`.\n */\n MDCSwitchRenderFoundation.prototype.initFromDOM = function () {\n // Turn off observers while setting state\n this.setObserversEnabled(this.adapter.state, false);\n this.adapter.state.selected = this.adapter.hasClass(CssClasses.SELECTED);\n // Ensure aria-checked is set if attribute is not present\n this.onSelectedChange();\n this.adapter.state.disabled = this.adapter.isDisabled();\n this.adapter.state.processing =\n this.adapter.hasClass(CssClasses.PROCESSING);\n // Re-observe state\n this.setObserversEnabled(this.adapter.state, true);\n this.stopProcessingIfDisabled();\n };\n MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {\n this.adapter.setDisabled(this.adapter.state.disabled);\n };\n MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {\n this.toggleClass(this.adapter.state.processing, CssClasses.PROCESSING);\n };\n MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {\n this.adapter.setAriaChecked(String(this.adapter.state.selected));\n this.toggleClass(this.adapter.state.selected, CssClasses.SELECTED);\n this.toggleClass(!this.adapter.state.selected, CssClasses.UNSELECTED);\n };\n MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {\n if (addClass) {\n this.adapter.addClass(className);\n }\n else {\n this.adapter.removeClass(className);\n }\n };\n return MDCSwitchRenderFoundation;\n}(MDCSwitchFoundation));\nexport { MDCSwitchRenderFoundation };\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCRipple } from '@material/ripple/component';\nimport { MDCRippleFoundation } from '@material/ripple/foundation';\nimport { Selectors } from './constants';\nimport { MDCSwitchRenderFoundation } from './foundation';\n/**\n * `MDCSwitch` provides a component implementation of a Material Design switch.\n */\nvar MDCSwitch = /** @class */ (function (_super) {\n __extends(MDCSwitch, _super);\n function MDCSwitch(root, foundation) {\n var _this = _super.call(this, root, foundation) || this;\n _this.root = root;\n return _this;\n }\n /**\n * Creates a new `MDCSwitch` and attaches it to the given root element.\n * @param root The root to attach to.\n * @return the new component instance.\n */\n MDCSwitch.attachTo = function (root) {\n return new MDCSwitch(root);\n };\n MDCSwitch.prototype.initialize = function () {\n this.ripple = new MDCRipple(this.root, this.createRippleFoundation());\n };\n MDCSwitch.prototype.initialSyncWithDOM = function () {\n var rippleElement = this.root.querySelector(Selectors.RIPPLE);\n if (!rippleElement) {\n throw new Error(\"Switch \" + Selectors.RIPPLE + \" element is required.\");\n }\n this.rippleElement = rippleElement;\n this.root.addEventListener('click', this.foundation.handleClick);\n this.foundation.initFromDOM();\n };\n MDCSwitch.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.ripple.destroy();\n this.root.removeEventListener('click', this.foundation.handleClick);\n };\n MDCSwitch.prototype.getDefaultFoundation = function () {\n return new MDCSwitchRenderFoundation(this.createAdapter());\n };\n MDCSwitch.prototype.createAdapter = function () {\n var _this = this;\n return {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n isDisabled: function () { return _this.root.disabled; },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n setAriaChecked: function (ariaChecked) {\n return _this.root.setAttribute('aria-checked', ariaChecked);\n },\n setDisabled: function (disabled) {\n _this.root.disabled = disabled;\n },\n state: this,\n };\n };\n MDCSwitch.prototype.createRippleFoundation = function () {\n return new MDCRippleFoundation(this.createRippleAdapter());\n };\n MDCSwitch.prototype.createRippleAdapter = function () {\n var _this = this;\n return __assign(__assign({}, MDCRipple.createAdapter(this)), { computeBoundingRect: function () { return _this.rippleElement.getBoundingClientRect(); }, isUnbounded: function () { return true; } });\n };\n return MDCSwitch;\n}(MDCComponent));\nexport { MDCSwitch };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/** Banner element classes. */\nexport var cssClasses = {\n CLOSING: 'mdc-banner--closing',\n OPEN: 'mdc-banner--open',\n OPENING: 'mdc-banner--opening',\n};\n/** Banner numbers. */\nexport var numbers = {\n BANNER_ANIMATION_CLOSE_TIME_MS: 250,\n BANNER_ANIMATION_OPEN_TIME_MS: 300,\n};\n/** Banner events. */\nexport var events = {\n CLOSED: 'MDCBanner:closed',\n CLOSING: 'MDCBanner:closing',\n OPENED: 'MDCBanner:opened',\n OPENING: 'MDCBanner:opening',\n ACTION_CLICKED: 'MDCBanner:actionClicked',\n};\n/** Banner selectors. */\nexport var selectors = {\n CONTENT: '.mdc-banner__content',\n PRIMARY_ACTION: '.mdc-banner__primary-action',\n SECONDARY_ACTION: '.mdc-banner__secondary-action',\n TEXT: '.mdc-banner__text',\n};\n/** Reason as to why the banner was closed. */\nexport var CloseReason;\n(function (CloseReason) {\n // Indicates the banner was closed via primary action button.\n CloseReason[CloseReason[\"PRIMARY\"] = 0] = \"PRIMARY\";\n // Indicates the banner was closed via secondary action button.\n CloseReason[CloseReason[\"SECONDARY\"] = 1] = \"SECONDARY\";\n // Will never be used by the component. Provided for custom handling of\n // programmatic closing of the banner.\n CloseReason[CloseReason[\"UNSPECIFIED\"] = 2] = \"UNSPECIFIED\";\n})(CloseReason || (CloseReason = {}));\n/**\n * Payload of actionClicked events to signify which action emitted the event.\n */\nexport var Action;\n(function (Action) {\n Action[Action[\"PRIMARY\"] = 0] = \"PRIMARY\";\n Action[Action[\"SECONDARY\"] = 1] = \"SECONDARY\";\n Action[Action[\"UNKNOWN\"] = 2] = \"UNKNOWN\";\n})(Action || (Action = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { CloseReason, cssClasses, numbers } from './constants';\nvar OPENING = cssClasses.OPENING, OPEN = cssClasses.OPEN, CLOSING = cssClasses.CLOSING;\n/**\n * Foundation class for banner. Responsibilities include opening and closing the\n * banner.\n */\nvar MDCBannerFoundation = /** @class */ (function (_super) {\n __extends(MDCBannerFoundation, _super);\n function MDCBannerFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCBannerFoundation.defaultAdapter), adapter)) || this;\n _this.isOpened = false;\n // Request id for open animation, used to cancel the refresh callback\n // request on close() and destroy().\n _this.animationFrame = 0;\n // Timer id for close and open animation, used to cancel the timer on\n // close() and destroy().\n _this.animationTimer = 0;\n return _this;\n }\n Object.defineProperty(MDCBannerFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n getContentHeight: function () { return 0; },\n notifyClosed: function () { return undefined; },\n notifyClosing: function () { return undefined; },\n notifyOpened: function () { return undefined; },\n notifyOpening: function () { return undefined; },\n notifyActionClicked: function () { return undefined; },\n releaseFocus: function () { return undefined; },\n removeClass: function () { return undefined; },\n setStyleProperty: function () { return undefined; },\n trapFocus: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCBannerFoundation.prototype.destroy = function () {\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n clearTimeout(this.animationTimer);\n this.animationTimer = 0;\n };\n MDCBannerFoundation.prototype.open = function () {\n var _this = this;\n this.isOpened = true;\n this.adapter.notifyOpening();\n this.adapter.removeClass(CLOSING);\n this.adapter.addClass(OPENING);\n var contentHeight = this.adapter.getContentHeight();\n this.animationFrame = requestAnimationFrame(function () {\n _this.adapter.addClass(OPEN);\n _this.adapter.setStyleProperty('height', contentHeight + \"px\");\n _this.animationTimer = setTimeout(function () {\n _this.handleAnimationTimerEnd();\n _this.adapter.trapFocus();\n _this.adapter.notifyOpened();\n }, numbers.BANNER_ANIMATION_OPEN_TIME_MS);\n });\n };\n /**\n * @param reason Why the banner was closed. Value will be passed to\n * events.CLOSING and events.CLOSED via the `event.detail.reason`\n * property. Standard values are CloseReason.PRIMARY and\n * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for\n * custom handling of programmatic closing of the banner.\n */\n MDCBannerFoundation.prototype.close = function (reason) {\n var _this = this;\n if (!this.isOpened) {\n // Avoid redundant close calls (and events), e.g. repeated interactions as\n // the banner is animating closed\n return;\n }\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n this.isOpened = false;\n this.adapter.notifyClosing(reason);\n this.adapter.addClass(CLOSING);\n this.adapter.setStyleProperty('height', '0');\n this.adapter.removeClass(OPEN);\n this.adapter.removeClass(OPENING);\n clearTimeout(this.animationTimer);\n this.animationTimer = setTimeout(function () {\n _this.adapter.releaseFocus();\n _this.handleAnimationTimerEnd();\n _this.adapter.notifyClosed(reason);\n }, numbers.BANNER_ANIMATION_CLOSE_TIME_MS);\n };\n MDCBannerFoundation.prototype.isOpen = function () {\n return this.isOpened;\n };\n MDCBannerFoundation.prototype.handlePrimaryActionClick = function (disableAutoClose) {\n if (disableAutoClose === void 0) { disableAutoClose = false; }\n if (disableAutoClose) {\n this.adapter.notifyActionClicked(0 /* PRIMARY */);\n }\n else {\n this.close(CloseReason.PRIMARY);\n }\n };\n MDCBannerFoundation.prototype.handleSecondaryActionClick = function (disableAutoClose) {\n if (disableAutoClose === void 0) { disableAutoClose = false; }\n if (disableAutoClose) {\n this.adapter.notifyActionClicked(1 /* SECONDARY */);\n }\n else {\n this.close(CloseReason.SECONDARY);\n }\n };\n MDCBannerFoundation.prototype.layout = function () {\n var contentHeight = this.adapter.getContentHeight();\n this.adapter.setStyleProperty('height', contentHeight + \"px\");\n };\n MDCBannerFoundation.prototype.handleAnimationTimerEnd = function () {\n this.animationTimer = 0;\n this.adapter.removeClass(OPENING);\n this.adapter.removeClass(CLOSING);\n };\n return MDCBannerFoundation;\n}(MDCFoundation));\nexport { MDCBannerFoundation };\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { FocusTrap } from '@material/dom/focus-trap';\nimport { closest } from '@material/dom/ponyfill';\nimport { events, selectors } from './constants';\nimport { MDCBannerFoundation } from './foundation';\n/** Vanilla JS implementation of banner component. */\nvar MDCBanner = /** @class */ (function (_super) {\n __extends(MDCBanner, _super);\n function MDCBanner() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCBanner.attachTo = function (root) {\n return new MDCBanner(root);\n };\n MDCBanner.prototype.initialize = function (focusTrapFactory) {\n var _this = this;\n if (focusTrapFactory === void 0) { focusTrapFactory = function (el, focusOptions) {\n return new FocusTrap(el, focusOptions);\n }; }\n this.contentEl = this.root.querySelector(selectors.CONTENT);\n this.textEl = this.root.querySelector(selectors.TEXT);\n this.primaryActionEl =\n this.root.querySelector(selectors.PRIMARY_ACTION);\n this.secondaryActionEl =\n this.root.querySelector(selectors.SECONDARY_ACTION);\n this.focusTrapFactory = focusTrapFactory;\n this.handleContentClick = function (evt) {\n var target = evt.target;\n if (closest(target, selectors.PRIMARY_ACTION)) {\n _this.foundation.handlePrimaryActionClick();\n }\n else if (closest(target, selectors.SECONDARY_ACTION)) {\n _this.foundation.handleSecondaryActionClick();\n }\n };\n };\n MDCBanner.prototype.initialSyncWithDOM = function () {\n this.registerContentClickHandler(this.handleContentClick);\n this.focusTrap = this.focusTrapFactory(this.root, { initialFocusEl: this.primaryActionEl });\n };\n MDCBanner.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.deregisterContentClickHandler(this.handleContentClick);\n };\n MDCBanner.prototype.layout = function () {\n this.foundation.layout();\n };\n /**\n * Opens the banner and fires events.OPENING to indicate the beginning of its\n * opening animation and then events.OPENED once the animation finishes.\n */\n MDCBanner.prototype.open = function () {\n this.foundation.open();\n };\n /**\n * Closes the banner and fires events.CLOSING to indicate the beginning of its\n * closing animation and then events.CLOSED once the animation finishes.\n * @param reason Why the banner was closed. Value will be passed to\n * events.CLOSING and events.CLOSED via the `event.detail.reason`\n * property. Standard values are CloseReason.PRIMARY and\n * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for\n * custom handling of programmatic closing of the banner.\n */\n MDCBanner.prototype.close = function (reason) {\n this.foundation.close(reason);\n };\n MDCBanner.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n var adapter = {\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n getContentHeight: function () {\n return _this.contentEl.offsetHeight;\n },\n notifyClosed: function (reason) {\n _this.emit(events.CLOSED, { reason: reason });\n },\n notifyClosing: function (reason) {\n _this.emit(events.CLOSING, { reason: reason });\n },\n notifyOpened: function () {\n _this.emit(events.OPENED, {});\n },\n notifyOpening: function () {\n _this.emit(events.OPENING, {});\n },\n notifyActionClicked: function (action) {\n _this.emit(events.ACTION_CLICKED, { action: action });\n },\n releaseFocus: function () {\n _this.focusTrap.releaseFocus();\n },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n setStyleProperty: function (propertyName, value) {\n _this.root.style.setProperty(propertyName, value);\n },\n trapFocus: function () {\n _this.focusTrap.trapFocus();\n },\n };\n return new MDCBannerFoundation(adapter);\n };\n Object.defineProperty(MDCBanner.prototype, \"isOpen\", {\n get: function () {\n return this.foundation.isOpen();\n },\n enumerable: false,\n configurable: true\n });\n MDCBanner.prototype.getText = function () {\n return this.textEl.textContent || '';\n };\n MDCBanner.prototype.setText = function (text) {\n this.textEl.textContent = text;\n };\n MDCBanner.prototype.getPrimaryActionText = function () {\n return this.primaryActionEl.textContent || '';\n };\n MDCBanner.prototype.setPrimaryActionText = function (actionButtonText) {\n this.primaryActionEl.textContent = actionButtonText;\n };\n /** Returns null if the banner has no secondary action. */\n MDCBanner.prototype.getSecondaryActionText = function () {\n return this.secondaryActionEl ? this.secondaryActionEl.textContent || '' :\n null;\n };\n MDCBanner.prototype.setSecondaryActionText = function (actionButtonText) {\n if (this.secondaryActionEl) {\n this.secondaryActionEl.textContent = actionButtonText;\n }\n };\n MDCBanner.prototype.registerContentClickHandler = function (handler) {\n this.contentEl.addEventListener('click', handler);\n };\n MDCBanner.prototype.deregisterContentClickHandler = function (handler) {\n this.contentEl.removeEventListener('click', handler);\n };\n return MDCBanner;\n}(MDCComponent));\nexport { MDCBanner };\n//# sourceMappingURL=component.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar CssClasses;\n(function (CssClasses) {\n CssClasses[\"RICH\"] = \"mdc-tooltip--rich\";\n CssClasses[\"SHOWN\"] = \"mdc-tooltip--shown\";\n CssClasses[\"SHOWING\"] = \"mdc-tooltip--showing\";\n CssClasses[\"SHOWING_TRANSITION\"] = \"mdc-tooltip--showing-transition\";\n CssClasses[\"HIDE\"] = \"mdc-tooltip--hide\";\n CssClasses[\"HIDE_TRANSITION\"] = \"mdc-tooltip--hide-transition\";\n CssClasses[\"MULTILINE_TOOLTIP\"] = \"mdc-tooltip--multiline\";\n CssClasses[\"SURFACE\"] = \"mdc-tooltip__surface\";\n CssClasses[\"SURFACE_ANIMATION\"] = \"mdc-tooltip__surface-animation\";\n CssClasses[\"TOOLTIP_CARET_TOP\"] = \"mdc-tooltip__caret-surface-top\";\n CssClasses[\"TOOLTIP_CARET_BOTTOM\"] = \"mdc-tooltip__caret-surface-bottom\";\n})(CssClasses || (CssClasses = {}));\nvar numbers = {\n BOUNDED_ANCHOR_GAP: 4,\n UNBOUNDED_ANCHOR_GAP: 8,\n MIN_VIEWPORT_TOOLTIP_THRESHOLD: 8,\n HIDE_DELAY_MS: 600,\n SHOW_DELAY_MS: 500,\n // LINT.IfChange(tooltip-dimensions)\n MIN_HEIGHT: 24,\n MAX_WIDTH: 200,\n // LINT.ThenChange(_tooltip.scss:tooltip-dimensions)\n CARET_INDENTATION: 24,\n // LINT.IfChange(tooltip-anim-scale)\n ANIMATION_SCALE: 0.8,\n // LINT.ThenChange(_tooltip.scss:tooltip-anim-scale)\n};\nvar attributes = {\n ARIA_EXPANDED: 'aria-expanded',\n ARIA_HASPOPUP: 'aria-haspopup',\n PERSISTENT: 'data-mdc-tooltip-persistent',\n SCROLLABLE_ANCESTOR: 'tooltip-scrollable-ancestor',\n HAS_CARET: 'data-mdc-tooltip-has-caret',\n};\nvar events = {\n HIDDEN: 'MDCTooltip:hidden',\n};\n/** Enum for possible tooltip positioning relative to its anchor element. */\nvar XPosition;\n(function (XPosition) {\n XPosition[XPosition[\"DETECTED\"] = 0] = \"DETECTED\";\n XPosition[XPosition[\"START\"] = 1] = \"START\";\n // Note: CENTER is not valid for rich tooltips.\n XPosition[XPosition[\"CENTER\"] = 2] = \"CENTER\";\n XPosition[XPosition[\"END\"] = 3] = \"END\";\n})(XPosition || (XPosition = {}));\nvar YPosition;\n(function (YPosition) {\n YPosition[YPosition[\"DETECTED\"] = 0] = \"DETECTED\";\n YPosition[YPosition[\"ABOVE\"] = 1] = \"ABOVE\";\n YPosition[YPosition[\"BELOW\"] = 2] = \"BELOW\";\n})(YPosition || (YPosition = {}));\n/**\n * Enum for possible anchor boundary types. This determines the gap between the\n * bottom of the anchor and the tooltip element.\n * Bounded anchors have an identifiable boundary (e.g. buttons).\n * Unbounded anchors don't have a visually declared boundary (e.g. plain text).\n */\nvar AnchorBoundaryType;\n(function (AnchorBoundaryType) {\n AnchorBoundaryType[AnchorBoundaryType[\"BOUNDED\"] = 0] = \"BOUNDED\";\n AnchorBoundaryType[AnchorBoundaryType[\"UNBOUNDED\"] = 1] = \"UNBOUNDED\";\n})(AnchorBoundaryType || (AnchorBoundaryType = {}));\nvar strings = {\n LEFT: 'left',\n RIGHT: 'right',\n CENTER: 'center',\n TOP: 'top',\n BOTTOM: 'bottom'\n};\n/**\n * Enum for possible positions of a tooltip with caret (this specifies the\n * positioning of the tooltip relative to the anchor -- the position of the\n * caret will follow that of the tooltip). This can NOT be combined with the\n * above X/YPosition options. Naming for the enums follows: (vertical\n * placement)_(horizontal placement).\n */\nvar PositionWithCaret;\n(function (PositionWithCaret) {\n PositionWithCaret[PositionWithCaret[\"DETECTED\"] = 0] = \"DETECTED\";\n PositionWithCaret[PositionWithCaret[\"ABOVE_START\"] = 1] = \"ABOVE_START\";\n PositionWithCaret[PositionWithCaret[\"ABOVE_CENTER\"] = 2] = \"ABOVE_CENTER\";\n PositionWithCaret[PositionWithCaret[\"ABOVE_END\"] = 3] = \"ABOVE_END\";\n PositionWithCaret[PositionWithCaret[\"TOP_SIDE_START\"] = 4] = \"TOP_SIDE_START\";\n PositionWithCaret[PositionWithCaret[\"CENTER_SIDE_START\"] = 5] = \"CENTER_SIDE_START\";\n PositionWithCaret[PositionWithCaret[\"BOTTOM_SIDE_START\"] = 6] = \"BOTTOM_SIDE_START\";\n PositionWithCaret[PositionWithCaret[\"TOP_SIDE_END\"] = 7] = \"TOP_SIDE_END\";\n PositionWithCaret[PositionWithCaret[\"CENTER_SIDE_END\"] = 8] = \"CENTER_SIDE_END\";\n PositionWithCaret[PositionWithCaret[\"BOTTOM_SIDE_END\"] = 9] = \"BOTTOM_SIDE_END\";\n PositionWithCaret[PositionWithCaret[\"BELOW_START\"] = 10] = \"BELOW_START\";\n PositionWithCaret[PositionWithCaret[\"BELOW_CENTER\"] = 11] = \"BELOW_CENTER\";\n PositionWithCaret[PositionWithCaret[\"BELOW_END\"] = 12] = \"BELOW_END\";\n})(PositionWithCaret || (PositionWithCaret = {}));\nvar YPositionWithCaret;\n(function (YPositionWithCaret) {\n YPositionWithCaret[YPositionWithCaret[\"ABOVE\"] = 1] = \"ABOVE\";\n YPositionWithCaret[YPositionWithCaret[\"BELOW\"] = 2] = \"BELOW\";\n YPositionWithCaret[YPositionWithCaret[\"SIDE_TOP\"] = 3] = \"SIDE_TOP\";\n YPositionWithCaret[YPositionWithCaret[\"SIDE_CENTER\"] = 4] = \"SIDE_CENTER\";\n YPositionWithCaret[YPositionWithCaret[\"SIDE_BOTTOM\"] = 5] = \"SIDE_BOTTOM\";\n})(YPositionWithCaret || (YPositionWithCaret = {}));\nvar XPositionWithCaret;\n(function (XPositionWithCaret) {\n XPositionWithCaret[XPositionWithCaret[\"START\"] = 1] = \"START\";\n XPositionWithCaret[XPositionWithCaret[\"CENTER\"] = 2] = \"CENTER\";\n XPositionWithCaret[XPositionWithCaret[\"END\"] = 3] = \"END\";\n XPositionWithCaret[XPositionWithCaret[\"SIDE_START\"] = 4] = \"SIDE_START\";\n XPositionWithCaret[XPositionWithCaret[\"SIDE_END\"] = 5] = \"SIDE_END\";\n})(XPositionWithCaret || (XPositionWithCaret = {}));\nexport { CssClasses, numbers, attributes, events, XPosition, AnchorBoundaryType, YPosition, strings, PositionWithCaret, YPositionWithCaret, XPositionWithCaret };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { AnimationFrame } from '@material/animation/animationframe';\nimport { getCorrectPropertyName } from '@material/animation/util';\nimport { MDCFoundation } from '@material/base/foundation';\nimport { KEY, normalizeKey } from '@material/dom/keyboard';\nimport { AnchorBoundaryType, attributes, CssClasses, numbers, PositionWithCaret, strings, XPosition, XPositionWithCaret, YPosition, YPositionWithCaret } from './constants';\nvar RICH = CssClasses.RICH, SHOWN = CssClasses.SHOWN, SHOWING = CssClasses.SHOWING, SHOWING_TRANSITION = CssClasses.SHOWING_TRANSITION, HIDE = CssClasses.HIDE, HIDE_TRANSITION = CssClasses.HIDE_TRANSITION, MULTILINE_TOOLTIP = CssClasses.MULTILINE_TOOLTIP;\nvar AnimationKeys;\n(function (AnimationKeys) {\n AnimationKeys[\"POLL_ANCHOR\"] = \"poll_anchor\";\n})(AnimationKeys || (AnimationKeys = {}));\n// Accessing `window` without a `typeof` check will throw on Node environments.\nvar HAS_WINDOW = typeof window !== 'undefined';\nvar MDCTooltipFoundation = /** @class */ (function (_super) {\n __extends(MDCTooltipFoundation, _super);\n function MDCTooltipFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCTooltipFoundation.defaultAdapter), adapter)) || this;\n _this.tooltipShown = false;\n _this.anchorGap = numbers.BOUNDED_ANCHOR_GAP;\n _this.xTooltipPos = XPosition.DETECTED;\n _this.yTooltipPos = YPosition.DETECTED;\n _this.tooltipPositionWithCaret = PositionWithCaret.DETECTED;\n // Minimum threshold distance needed between the tooltip and the viewport.\n _this.minViewportTooltipThreshold = numbers.MIN_VIEWPORT_TOOLTIP_THRESHOLD;\n _this.hideDelayMs = numbers.HIDE_DELAY_MS;\n _this.showDelayMs = numbers.SHOW_DELAY_MS;\n _this.anchorRect = null;\n _this.parentRect = null;\n _this.frameId = null;\n _this.hideTimeout = null;\n _this.showTimeout = null;\n _this.addAncestorScrollEventListeners = new Array();\n _this.removeAncestorScrollEventListeners = new Array();\n _this.animFrame = new AnimationFrame();\n _this.anchorBlurHandler = function (evt) {\n _this.handleAnchorBlur(evt);\n };\n _this.documentClickHandler = function (evt) {\n _this.handleDocumentClick(evt);\n };\n _this.documentKeydownHandler = function (evt) {\n _this.handleKeydown(evt);\n };\n _this.tooltipMouseEnterHandler = function () {\n _this.handleTooltipMouseEnter();\n };\n _this.tooltipMouseLeaveHandler = function () {\n _this.handleTooltipMouseLeave();\n };\n _this.richTooltipFocusOutHandler = function (evt) {\n _this.handleRichTooltipFocusOut(evt);\n };\n _this.windowScrollHandler = function () {\n _this.handleWindowScrollEvent();\n };\n _this.windowResizeHandler = function () {\n _this.handleWindowChangeEvent();\n };\n return _this;\n }\n Object.defineProperty(MDCTooltipFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n getAttribute: function () { return null; },\n setAttribute: function () { return undefined; },\n removeAttribute: function () { return undefined; },\n addClass: function () { return undefined; },\n hasClass: function () { return false; },\n removeClass: function () { return undefined; },\n getComputedStyleProperty: function () { return ''; },\n setStyleProperty: function () { return undefined; },\n setSurfaceAnimationStyleProperty: function () { return undefined; },\n getViewportWidth: function () { return 0; },\n getViewportHeight: function () { return 0; },\n getTooltipSize: function () { return ({ width: 0, height: 0 }); },\n getAnchorBoundingRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n getParentBoundingRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n getAnchorAttribute: function () { return null; },\n setAnchorAttribute: function () { return null; },\n isRTL: function () { return false; },\n anchorContainsElement: function () { return false; },\n tooltipContainsElement: function () { return false; },\n focusAnchorElement: function () { return undefined; },\n registerEventHandler: function () { return undefined; },\n deregisterEventHandler: function () { return undefined; },\n registerAnchorEventHandler: function () { return undefined; },\n deregisterAnchorEventHandler: function () { return undefined; },\n registerDocumentEventHandler: function () { return undefined; },\n deregisterDocumentEventHandler: function () { return undefined; },\n registerWindowEventHandler: function () { return undefined; },\n deregisterWindowEventHandler: function () { return undefined; },\n notifyHidden: function () { return undefined; },\n getTooltipCaretBoundingRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n setTooltipCaretStyle: function () { return undefined; },\n clearTooltipCaretStyles: function () { return undefined; },\n getActiveElement: function () { return null; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCTooltipFoundation.prototype.init = function () {\n this.richTooltip = this.adapter.hasClass(RICH);\n this.persistentTooltip =\n this.adapter.getAttribute(attributes.PERSISTENT) === 'true';\n this.interactiveTooltip =\n !!this.adapter.getAnchorAttribute(attributes.ARIA_EXPANDED) &&\n this.adapter.getAnchorAttribute(attributes.ARIA_HASPOPUP) === 'dialog';\n this.hasCaret = this.richTooltip &&\n this.adapter.getAttribute(attributes.HAS_CARET) === 'true';\n };\n MDCTooltipFoundation.prototype.isShown = function () {\n return this.tooltipShown;\n };\n MDCTooltipFoundation.prototype.isRich = function () {\n return this.richTooltip;\n };\n MDCTooltipFoundation.prototype.isPersistent = function () {\n return this.persistentTooltip;\n };\n MDCTooltipFoundation.prototype.handleAnchorMouseEnter = function () {\n var _this = this;\n if (this.tooltipShown) {\n // Covers the instance where a user hovers over the anchor to reveal the\n // tooltip, and then quickly navigates away and then back to the anchor.\n // The tooltip should stay visible without animating out and then back in\n // again.\n this.show();\n }\n else {\n // clearHideTimeout here since handleAnchorMouseLeave sets a hideTimeout\n // and that can execute before the showTimeout executes, resulting in hide\n // being called and the showTimeout set below to be cleared.\n this.clearHideTimeout();\n this.showTimeout = setTimeout(function () {\n _this.show();\n }, this.showDelayMs);\n }\n };\n MDCTooltipFoundation.prototype.handleAnchorTouchstart = function () {\n var _this = this;\n this.showTimeout = setTimeout(function () {\n _this.show();\n }, this.showDelayMs);\n // Prevent a context menu from appearing if user is long-pressing on a\n // tooltip anchor.\n this.adapter.registerWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);\n };\n MDCTooltipFoundation.prototype.preventContextMenuOnLongTouch = function (evt) {\n evt.preventDefault();\n };\n MDCTooltipFoundation.prototype.handleAnchorTouchend = function () {\n this.clearShowTimeout();\n // Only remove the 'contextmenu' listener if the tooltip is not shown. When\n // the tooltip *is* shown, listener is removed in the close method.\n if (!this.isShown()) {\n this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);\n }\n };\n MDCTooltipFoundation.prototype.handleAnchorFocus = function (evt) {\n var _this = this;\n // TODO(b/157075286): Need to add some way to distinguish keyboard\n // navigation focus events from other focus events, and only show the\n // tooltip on the former of these events.\n var relatedTarget = evt.relatedTarget;\n var tooltipContainsRelatedTarget = relatedTarget instanceof HTMLElement &&\n this.adapter.tooltipContainsElement(relatedTarget);\n // Do not show tooltip if the previous focus was on a tooltip element. This\n // occurs when a rich tooltip is closed and focus is restored to the anchor\n // or when user tab-navigates back into the anchor from the rich tooltip.\n if (tooltipContainsRelatedTarget) {\n return;\n }\n this.showTimeout = setTimeout(function () {\n _this.show();\n }, this.showDelayMs);\n };\n MDCTooltipFoundation.prototype.handleAnchorMouseLeave = function () {\n var _this = this;\n this.clearShowTimeout();\n this.hideTimeout = setTimeout(function () {\n _this.hide();\n }, this.hideDelayMs);\n };\n MDCTooltipFoundation.prototype.handleAnchorClick = function () {\n if (this.tooltipShown) {\n this.hide();\n }\n else {\n this.show();\n }\n };\n MDCTooltipFoundation.prototype.handleDocumentClick = function (evt) {\n var anchorOrTooltipContainsTargetElement = evt.target instanceof HTMLElement &&\n (this.adapter.anchorContainsElement(evt.target) ||\n this.adapter.tooltipContainsElement(evt.target));\n // For persistent rich tooltips, we will not hide if:\n // - The click target is within the anchor element. Otherwise, both\n // the anchor element's click handler and this handler will handle the\n // click (due to event propagation), resulting in a shown tooltip\n // being immediately hidden if the tooltip was initially hidden.\n // - The click target is within the tooltip element, since clicks\n // on the tooltip do not close the tooltip.\n if (this.richTooltip && this.persistentTooltip &&\n anchorOrTooltipContainsTargetElement) {\n return;\n }\n // Hide the tooltip immediately on click.\n this.hide();\n };\n MDCTooltipFoundation.prototype.handleKeydown = function (evt) {\n // Hide the tooltip immediately on ESC key.\n var key = normalizeKey(evt);\n if (key === KEY.ESCAPE) {\n var activeElement = this.adapter.getActiveElement();\n var tooltipContainsActiveElement = activeElement instanceof HTMLElement &&\n this.adapter.tooltipContainsElement(activeElement);\n if (tooltipContainsActiveElement) {\n this.adapter.focusAnchorElement();\n }\n this.hide();\n }\n };\n MDCTooltipFoundation.prototype.handleAnchorBlur = function (evt) {\n if (this.richTooltip) {\n var tooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement &&\n this.adapter.tooltipContainsElement(evt.relatedTarget);\n // If focus changed to the tooltip element, don't hide the tooltip.\n if (tooltipContainsRelatedTargetElement) {\n return;\n }\n if (evt.relatedTarget === null && this.interactiveTooltip) {\n // If evt.relatedTarget is null, it is because focus is moving to an\n // element that is not focusable. This should only occur in instances\n // of a screen reader in browse mode/linear navigation mode. If the\n // tooltip is interactive (and so the entire content is not read by\n // the screen reader upon the tooltip being opened), we want to allow\n // users to read the content of the tooltip (and not just the focusable\n // elements).\n return;\n }\n }\n // Hide tooltip immediately on focus change.\n this.hide();\n };\n MDCTooltipFoundation.prototype.handleTooltipMouseEnter = function () {\n this.show();\n };\n MDCTooltipFoundation.prototype.handleTooltipMouseLeave = function () {\n var _this = this;\n this.clearShowTimeout();\n this.hideTimeout = setTimeout(function () {\n _this.hide();\n }, this.hideDelayMs);\n };\n MDCTooltipFoundation.prototype.handleRichTooltipFocusOut = function (evt) {\n var anchorOrTooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement &&\n (this.adapter.anchorContainsElement(evt.relatedTarget) ||\n this.adapter.tooltipContainsElement(evt.relatedTarget));\n // If the focus is still within the anchor or the tooltip, do not hide the\n // tooltip.\n if (anchorOrTooltipContainsRelatedTargetElement) {\n return;\n }\n if (evt.relatedTarget === null && this.interactiveTooltip) {\n // If evt.relatedTarget is null, it is because focus is moving to an\n // element that is not focusable. This should only occur in instances\n // of a screen reader in browse mode/linear navigation mode. If the\n // tooltip is interactive (and so the entire content is not read by\n // the screen reader upon the tooltip being opened), we want to allow\n // users to read the content of the tooltip (and not just the focusable\n // elements).\n return;\n }\n this.hide();\n };\n MDCTooltipFoundation.prototype.handleWindowScrollEvent = function () {\n if (this.persistentTooltip) {\n // Persistent tooltips remain visible on user scroll, call appropriate\n // handler to ensure the tooltip remains pinned to the anchor on page\n // scroll.\n this.handleWindowChangeEvent();\n return;\n }\n this.hide();\n };\n /**\n * On window resize or scroll, check the anchor position and size and\n * repostion tooltip if necessary.\n */\n MDCTooltipFoundation.prototype.handleWindowChangeEvent = function () {\n var _this = this;\n // Since scroll and resize events can fire at a high rate, we throttle\n // the potential re-positioning of tooltip component using\n // requestAnimationFrame.\n this.animFrame.request(AnimationKeys.POLL_ANCHOR, function () {\n _this.repositionTooltipOnAnchorMove();\n });\n };\n MDCTooltipFoundation.prototype.show = function () {\n var e_1, _a;\n var _this = this;\n this.clearHideTimeout();\n this.clearShowTimeout();\n if (this.tooltipShown) {\n return;\n }\n this.tooltipShown = true;\n this.adapter.removeAttribute('aria-hidden');\n if (this.richTooltip) {\n if (this.interactiveTooltip) {\n this.adapter.setAnchorAttribute('aria-expanded', 'true');\n }\n this.adapter.registerEventHandler('focusout', this.richTooltipFocusOutHandler);\n }\n if (!this.persistentTooltip) {\n this.adapter.registerEventHandler('mouseenter', this.tooltipMouseEnterHandler);\n this.adapter.registerEventHandler('mouseleave', this.tooltipMouseLeaveHandler);\n }\n this.adapter.removeClass(HIDE);\n this.adapter.addClass(SHOWING);\n if (this.isTooltipMultiline() && !this.richTooltip) {\n this.adapter.addClass(MULTILINE_TOOLTIP);\n }\n this.anchorRect = this.adapter.getAnchorBoundingRect();\n this.parentRect = this.adapter.getParentBoundingRect();\n this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip();\n this.adapter.registerAnchorEventHandler('blur', this.anchorBlurHandler);\n this.adapter.registerDocumentEventHandler('click', this.documentClickHandler);\n this.adapter.registerDocumentEventHandler('keydown', this.documentKeydownHandler);\n this.adapter.registerWindowEventHandler('scroll', this.windowScrollHandler);\n this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);\n try {\n // Register any additional scroll handlers\n for (var _b = __values(this.addAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {\n var fn = _c.value;\n fn();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.frameId = requestAnimationFrame(function () {\n _this.clearAllAnimationClasses();\n _this.adapter.addClass(SHOWN);\n _this.adapter.addClass(SHOWING_TRANSITION);\n });\n };\n MDCTooltipFoundation.prototype.hide = function () {\n var e_2, _a;\n this.clearHideTimeout();\n this.clearShowTimeout();\n if (!this.tooltipShown) {\n return;\n }\n if (this.frameId) {\n cancelAnimationFrame(this.frameId);\n }\n this.tooltipShown = false;\n this.adapter.setAttribute('aria-hidden', 'true');\n this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);\n if (this.richTooltip) {\n if (this.interactiveTooltip) {\n this.adapter.setAnchorAttribute('aria-expanded', 'false');\n }\n }\n if (!this.persistentTooltip) {\n this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);\n this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);\n }\n this.clearAllAnimationClasses();\n this.adapter.addClass(HIDE);\n this.adapter.addClass(HIDE_TRANSITION);\n this.adapter.removeClass(SHOWN);\n this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);\n this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);\n this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);\n this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);\n try {\n // Deregister any additional scroll handlers\n for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {\n var fn = _c.value;\n fn();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n MDCTooltipFoundation.prototype.handleTransitionEnd = function () {\n var isHidingTooltip = this.adapter.hasClass(HIDE);\n this.adapter.removeClass(SHOWING);\n this.adapter.removeClass(SHOWING_TRANSITION);\n this.adapter.removeClass(HIDE);\n this.adapter.removeClass(HIDE_TRANSITION);\n // If handleTransitionEnd is called after hiding the tooltip, the tooltip\n // will have the HIDE class (before calling the adapter removeClass method).\n // If tooltip is now hidden, send a notification that the animation has\n // completed and the tooltip is no longer visible.\n // We don't send a notification of the animation completing if a showTimeout\n // value is set -- this happens when a user triggers a tooltip to be shown\n // while that tooltip is fading. Once this hide transition is completed,\n // that same tooltip will be re-shown.\n if (isHidingTooltip && this.showTimeout === null) {\n this.adapter.notifyHidden();\n }\n };\n MDCTooltipFoundation.prototype.clearAllAnimationClasses = function () {\n this.adapter.removeClass(SHOWING_TRANSITION);\n this.adapter.removeClass(HIDE_TRANSITION);\n };\n MDCTooltipFoundation.prototype.setTooltipPosition = function (position) {\n var xPos = position.xPos, yPos = position.yPos, withCaretPos = position.withCaretPos;\n if (this.hasCaret && withCaretPos) {\n this.tooltipPositionWithCaret = withCaretPos;\n return;\n }\n if (xPos) {\n this.xTooltipPos = xPos;\n }\n if (yPos) {\n this.yTooltipPos = yPos;\n }\n };\n MDCTooltipFoundation.prototype.setAnchorBoundaryType = function (type) {\n if (type === AnchorBoundaryType.UNBOUNDED) {\n this.anchorGap = numbers.UNBOUNDED_ANCHOR_GAP;\n }\n else {\n this.anchorGap = numbers.BOUNDED_ANCHOR_GAP;\n }\n };\n MDCTooltipFoundation.prototype.setShowDelay = function (delayMs) {\n this.showDelayMs = delayMs;\n };\n MDCTooltipFoundation.prototype.setHideDelay = function (delayMs) {\n this.hideDelayMs = delayMs;\n };\n MDCTooltipFoundation.prototype.isTooltipMultiline = function () {\n var tooltipSize = this.adapter.getTooltipSize();\n return tooltipSize.height > numbers.MIN_HEIGHT &&\n tooltipSize.width >= numbers.MAX_WIDTH;\n };\n MDCTooltipFoundation.prototype.positionPlainTooltip = function () {\n // A plain tooltip has `fixed` positioning and is placed as an immediate\n // child of the document body. Its positioning is calculated with respect to\n // the viewport.\n var _a = this.calculateTooltipStyles(this.anchorRect), top = _a.top, yTransformOrigin = _a.yTransformOrigin, left = _a.left, xTransformOrigin = _a.xTransformOrigin;\n var transformProperty = HAS_WINDOW ? getCorrectPropertyName(window, 'transform') : 'transform';\n this.adapter.setSurfaceAnimationStyleProperty(transformProperty + \"-origin\", xTransformOrigin + \" \" + yTransformOrigin);\n this.adapter.setStyleProperty('top', top + \"px\");\n this.adapter.setStyleProperty('left', left + \"px\");\n };\n MDCTooltipFoundation.prototype.positionRichTooltip = function () {\n // TODO(b/177686782): Remove width setting when max-content is used to style\n // the rich tooltip.\n var _a, _b, _c, _d;\n // getComputedStyleProperty is used instead of getTooltipSize since\n // getTooltipSize returns the offSetWidth, which includes the border and\n // padding. What we need is the width of the tooltip without border and\n // padding.\n var width = this.adapter.getComputedStyleProperty('width');\n // When rich tooltips are positioned within their parent containers, the\n // tooltip width might be shrunk if it collides with the edge of the parent\n // container. We set the width of the tooltip to prevent this.\n this.adapter.setStyleProperty('width', width);\n var _e = this.hasCaret ?\n this.calculateTooltipWithCaretStyles(this.anchorRect) :\n this.calculateTooltipStyles(this.anchorRect), top = _e.top, yTransformOrigin = _e.yTransformOrigin, left = _e.left, xTransformOrigin = _e.xTransformOrigin;\n var transformProperty = HAS_WINDOW ? getCorrectPropertyName(window, 'transform') : 'transform';\n this.adapter.setSurfaceAnimationStyleProperty(transformProperty + \"-origin\", xTransformOrigin + \" \" + yTransformOrigin);\n // A rich tooltip has `absolute` positioning and is placed as a sibling to\n // the anchor element. Its positioning is calculated with respect to the\n // parent element, and so the values need to be adjusted against the parent\n // element.\n var leftAdjustment = left - ((_b = (_a = this.parentRect) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0);\n var topAdjustment = top - ((_d = (_c = this.parentRect) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0);\n this.adapter.setStyleProperty('top', topAdjustment + \"px\");\n this.adapter.setStyleProperty('left', leftAdjustment + \"px\");\n };\n /**\n * Calculates the position of the tooltip. A tooltip will be placed beneath\n * the anchor element and aligned either with the 'start'/'end' edge of the\n * anchor element or the 'center'.\n *\n * Tooltip alignment is selected such that the tooltip maintains a threshold\n * distance away from the viewport (defaulting to 'center' alignment). If the\n * placement of the anchor prevents this threshold distance from being\n * maintained, the tooltip is positioned so that it does not collide with the\n * viewport.\n *\n * Users can specify an alignment, however, if this alignment results in the\n * tooltip colliding with the viewport, this specification is overwritten.\n */\n MDCTooltipFoundation.prototype.calculateTooltipStyles = function (anchorRect) {\n if (!anchorRect) {\n return { top: 0, left: 0 };\n }\n var tooltipSize = this.adapter.getTooltipSize();\n var top = this.calculateYTooltipDistance(anchorRect, tooltipSize.height);\n var left = this.calculateXTooltipDistance(anchorRect, tooltipSize.width);\n return {\n top: top.distance,\n yTransformOrigin: top.yTransformOrigin,\n left: left.distance,\n xTransformOrigin: left.xTransformOrigin\n };\n };\n /**\n * Calculates the `left` distance for the tooltip.\n * Returns the distance value and a string indicating the x-axis transform-\n * origin that should be used when animating the tooltip.\n */\n MDCTooltipFoundation.prototype.calculateXTooltipDistance = function (anchorRect, tooltipWidth) {\n var isLTR = !this.adapter.isRTL();\n var startPos, endPos, centerPos;\n var startTransformOrigin, endTransformOrigin;\n if (this.richTooltip) {\n startPos = isLTR ? anchorRect.left - tooltipWidth : anchorRect.right;\n endPos = isLTR ? anchorRect.right : anchorRect.left - tooltipWidth;\n startTransformOrigin = isLTR ? strings.RIGHT : strings.LEFT;\n endTransformOrigin = isLTR ? strings.LEFT : strings.RIGHT;\n }\n else {\n startPos = isLTR ? anchorRect.left : anchorRect.right - tooltipWidth;\n endPos = isLTR ? anchorRect.right - tooltipWidth : anchorRect.left;\n centerPos = anchorRect.left + (anchorRect.width - tooltipWidth) / 2;\n startTransformOrigin = isLTR ? strings.LEFT : strings.RIGHT;\n endTransformOrigin = isLTR ? strings.RIGHT : strings.LEFT;\n }\n var positionOptions = this.richTooltip ?\n this.determineValidPositionOptions(startPos, endPos) :\n // For plain tooltips, centerPos is defined\n this.determineValidPositionOptions(centerPos, startPos, endPos);\n if (this.xTooltipPos === XPosition.START && positionOptions.has(startPos)) {\n return { distance: startPos, xTransformOrigin: startTransformOrigin };\n }\n if (this.xTooltipPos === XPosition.END && positionOptions.has(endPos)) {\n return { distance: endPos, xTransformOrigin: endTransformOrigin };\n }\n if (this.xTooltipPos === XPosition.CENTER &&\n positionOptions.has(centerPos)) {\n // This code path is only executed if calculating the distance for plain\n // tooltips. In this instance, centerPos will always be defined, so we can\n // safely assert that the returned value is non-null/undefined.\n return { distance: centerPos, xTransformOrigin: strings.CENTER };\n }\n // If no user position is supplied, rich tooltips default to end pos, then\n // start position. Plain tooltips default to center, start, then end.\n var possiblePositions = this.richTooltip ?\n [\n { distance: endPos, xTransformOrigin: endTransformOrigin },\n { distance: startPos, xTransformOrigin: startTransformOrigin }\n ] :\n [\n { distance: centerPos, xTransformOrigin: strings.CENTER },\n { distance: startPos, xTransformOrigin: startTransformOrigin },\n { distance: endPos, xTransformOrigin: endTransformOrigin }\n ];\n var validPosition = possiblePositions.find(function (_a) {\n var distance = _a.distance;\n return positionOptions.has(distance);\n });\n if (validPosition) {\n return validPosition;\n }\n // Indicates that all potential positions would result in the tooltip\n // colliding with the viewport. This would only occur when the anchor\n // element itself collides with the viewport, or the viewport is very\n // narrow. In this case, we allow the tooltip to be mis-aligned from the\n // anchor element.\n if (anchorRect.left < 0) {\n return {\n distance: this.minViewportTooltipThreshold,\n xTransformOrigin: strings.LEFT\n };\n }\n else {\n var viewportWidth = this.adapter.getViewportWidth();\n var distance = viewportWidth - (tooltipWidth + this.minViewportTooltipThreshold);\n return { distance: distance, xTransformOrigin: strings.RIGHT };\n }\n };\n /**\n * Given the values for the horizontal alignments of the tooltip, calculates\n * which of these options would result in the tooltip maintaining the required\n * threshold distance vs which would result in the tooltip staying within the\n * viewport.\n *\n * A Set of values is returned holding the distances that would honor the\n * above requirements. Following the logic for determining the tooltip\n * position, if all alignments violate the threshold, then the returned Set\n * contains values that keep the tooltip within the viewport.\n */\n MDCTooltipFoundation.prototype.determineValidPositionOptions = function () {\n var e_3, _a;\n var positions = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n positions[_i] = arguments[_i];\n }\n var posWithinThreshold = new Set();\n var posWithinViewport = new Set();\n try {\n for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {\n var position = positions_1_1.value;\n if (this.positionHonorsViewportThreshold(position)) {\n posWithinThreshold.add(position);\n }\n else if (this.positionDoesntCollideWithViewport(position)) {\n posWithinViewport.add(position);\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);\n }\n finally { if (e_3) throw e_3.error; }\n }\n return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;\n };\n MDCTooltipFoundation.prototype.positionHonorsViewportThreshold = function (leftPos) {\n var viewportWidth = this.adapter.getViewportWidth();\n var tooltipWidth = this.adapter.getTooltipSize().width;\n return leftPos + tooltipWidth <=\n viewportWidth - this.minViewportTooltipThreshold &&\n leftPos >= this.minViewportTooltipThreshold;\n };\n MDCTooltipFoundation.prototype.positionDoesntCollideWithViewport = function (leftPos) {\n var viewportWidth = this.adapter.getViewportWidth();\n var tooltipWidth = this.adapter.getTooltipSize().width;\n return leftPos + tooltipWidth <= viewportWidth && leftPos >= 0;\n };\n /**\n * Calculates the `top` distance for the tooltip.\n * Returns the distance value and a string indicating the y-axis transform-\n * origin that should be used when animating the tooltip.\n */\n MDCTooltipFoundation.prototype.calculateYTooltipDistance = function (anchorRect, tooltipHeight) {\n var belowYPos = anchorRect.bottom + this.anchorGap;\n var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight);\n var yPositionOptions = this.determineValidYPositionOptions(aboveYPos, belowYPos);\n if (this.yTooltipPos === YPosition.ABOVE &&\n yPositionOptions.has(aboveYPos)) {\n return { distance: aboveYPos, yTransformOrigin: strings.BOTTOM };\n }\n else if (this.yTooltipPos === YPosition.BELOW &&\n yPositionOptions.has(belowYPos)) {\n return { distance: belowYPos, yTransformOrigin: strings.TOP };\n }\n if (yPositionOptions.has(belowYPos)) {\n return { distance: belowYPos, yTransformOrigin: strings.TOP };\n }\n if (yPositionOptions.has(aboveYPos)) {\n return { distance: aboveYPos, yTransformOrigin: strings.BOTTOM };\n }\n // Indicates that all potential positions would result in the tooltip\n // colliding with the viewport. This would only occur when the viewport is\n // very short.\n return { distance: belowYPos, yTransformOrigin: strings.TOP };\n };\n /**\n * Given the values for above/below alignment of the tooltip, calculates\n * which of these options would result in the tooltip maintaining the required\n * threshold distance vs which would result in the tooltip staying within the\n * viewport.\n *\n * A Set of values is returned holding the distances that would honor the\n * above requirements. Following the logic for determining the tooltip\n * position, if all possible alignments violate the threshold, then the\n * returned Set contains values that keep the tooltip within the viewport.\n */\n MDCTooltipFoundation.prototype.determineValidYPositionOptions = function (aboveAnchorPos, belowAnchorPos) {\n var posWithinThreshold = new Set();\n var posWithinViewport = new Set();\n if (this.yPositionHonorsViewportThreshold(aboveAnchorPos)) {\n posWithinThreshold.add(aboveAnchorPos);\n }\n else if (this.yPositionDoesntCollideWithViewport(aboveAnchorPos)) {\n posWithinViewport.add(aboveAnchorPos);\n }\n if (this.yPositionHonorsViewportThreshold(belowAnchorPos)) {\n posWithinThreshold.add(belowAnchorPos);\n }\n else if (this.yPositionDoesntCollideWithViewport(belowAnchorPos)) {\n posWithinViewport.add(belowAnchorPos);\n }\n return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;\n };\n MDCTooltipFoundation.prototype.yPositionHonorsViewportThreshold = function (yPos) {\n var viewportHeight = this.adapter.getViewportHeight();\n var tooltipHeight = this.adapter.getTooltipSize().height;\n return yPos + tooltipHeight + this.minViewportTooltipThreshold <=\n viewportHeight &&\n yPos >= this.minViewportTooltipThreshold;\n };\n MDCTooltipFoundation.prototype.yPositionDoesntCollideWithViewport = function (yPos) {\n var viewportHeight = this.adapter.getViewportHeight();\n var tooltipHeight = this.adapter.getTooltipSize().height;\n return yPos + tooltipHeight <= viewportHeight && yPos >= 0;\n };\n MDCTooltipFoundation.prototype.calculateTooltipWithCaretStyles = function (anchorRect) {\n // Prior to grabbing the caret bounding rect, we clear all styles set on the\n // caret. This will ensure the width/height is consistent (since we rotate\n // the caret 90deg in some positions which would result in the height and\n // width bounding rect measurements flipping).\n this.adapter.clearTooltipCaretStyles();\n var caretSize = this.adapter.getTooltipCaretBoundingRect();\n if (!anchorRect || !caretSize) {\n return { position: PositionWithCaret.DETECTED, top: 0, left: 0 };\n }\n // The caret for the rich tooltip is created by rotating/skewing/scaling\n // square div into a diamond shape and then hiding half of it so it looks\n // like a triangle. We use the boundingClientRect to calculate the\n // width/height of the element after the transforms (to the caret) have been\n // applied. Since the full tooltip is scaled by 0.8 for the entrance\n // animation, we divide by this value to retrieve the actual caret\n // dimensions.\n var caretWidth = caretSize.width / numbers.ANIMATION_SCALE;\n // Since we hide half of caret, we divide the returned DOMRect height\n // by 2.\n var caretHeight = (caretSize.height / numbers.ANIMATION_SCALE) / 2;\n var tooltipSize = this.adapter.getTooltipSize();\n var yOptions = this.calculateYWithCaretDistanceOptions(anchorRect, tooltipSize.height, { caretWidth: caretWidth, caretHeight: caretHeight });\n var xOptions = this.calculateXWithCaretDistanceOptions(anchorRect, tooltipSize.width, { caretWidth: caretWidth, caretHeight: caretHeight });\n var positionOptions = this.validateTooltipWithCaretDistances(yOptions, xOptions);\n if (positionOptions.size < 1) {\n positionOptions = this.generateBackupPositionOption(anchorRect, tooltipSize, { caretWidth: caretWidth, caretHeight: caretHeight });\n }\n var _a = this.determineTooltipWithCaretDistance(positionOptions), position = _a.position, xDistance = _a.xDistance, yDistance = _a.yDistance;\n // After determining the position of the tooltip relative to the anchor,\n // place the caret in the corresponding position and retrieve the necessary\n // x/y transform origins needed to properly animate the tooltip entrance.\n var _b = this.setCaretPositionStyles(position, { caretWidth: caretWidth, caretHeight: caretHeight }), yTransformOrigin = _b.yTransformOrigin, xTransformOrigin = _b.xTransformOrigin;\n return {\n yTransformOrigin: yTransformOrigin,\n xTransformOrigin: xTransformOrigin,\n top: yDistance,\n left: xDistance\n };\n };\n MDCTooltipFoundation.prototype.calculateXWithCaretDistanceOptions = function (anchorRect, tooltipWidth, caretSize) {\n var caretWidth = caretSize.caretWidth, caretHeight = caretSize.caretHeight;\n var isLTR = !this.adapter.isRTL();\n var anchorMidpoint = anchorRect.left + anchorRect.width / 2;\n var sideLeftAligned = anchorRect.left - (tooltipWidth + this.anchorGap + caretHeight);\n var sideRightAligned = anchorRect.right + this.anchorGap + caretHeight;\n var sideStartPos = isLTR ? sideLeftAligned : sideRightAligned;\n var sideEndPos = isLTR ? sideRightAligned : sideLeftAligned;\n var verticalLeftAligned = anchorMidpoint - (numbers.CARET_INDENTATION + caretWidth / 2);\n var verticalRightAligned = anchorMidpoint -\n (tooltipWidth - numbers.CARET_INDENTATION - caretWidth / 2);\n var verticalStartPos = isLTR ? verticalLeftAligned : verticalRightAligned;\n var verticalEndPos = isLTR ? verticalRightAligned : verticalLeftAligned;\n var verticalCenterPos = anchorMidpoint - tooltipWidth / 2;\n var possiblePositionsMap = new Map([\n [XPositionWithCaret.START, verticalStartPos],\n [XPositionWithCaret.CENTER, verticalCenterPos],\n [XPositionWithCaret.END, verticalEndPos],\n [XPositionWithCaret.SIDE_END, sideEndPos],\n [XPositionWithCaret.SIDE_START, sideStartPos],\n ]);\n return possiblePositionsMap;\n };\n MDCTooltipFoundation.prototype.calculateYWithCaretDistanceOptions = function (anchorRect, tooltipHeight, caretSize) {\n var caretWidth = caretSize.caretWidth, caretHeight = caretSize.caretHeight;\n var anchorMidpoint = anchorRect.top + anchorRect.height / 2;\n var belowYPos = anchorRect.bottom + this.anchorGap + caretHeight;\n var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight + caretHeight);\n var sideTopYPos = anchorMidpoint - (numbers.CARET_INDENTATION + caretWidth / 2);\n var sideCenterYPos = anchorMidpoint - (tooltipHeight / 2);\n var sideBottomYPos = anchorMidpoint -\n (tooltipHeight - numbers.CARET_INDENTATION - caretWidth / 2);\n var possiblePositionsMap = new Map([\n [YPositionWithCaret.ABOVE, aboveYPos],\n [YPositionWithCaret.BELOW, belowYPos],\n [YPositionWithCaret.SIDE_TOP, sideTopYPos],\n [YPositionWithCaret.SIDE_CENTER, sideCenterYPos],\n [YPositionWithCaret.SIDE_BOTTOM, sideBottomYPos],\n ]);\n return possiblePositionsMap;\n };\n MDCTooltipFoundation.prototype.repositionTooltipOnAnchorMove = function () {\n var newAnchorRect = this.adapter.getAnchorBoundingRect();\n if (!newAnchorRect || !this.anchorRect)\n return;\n if (newAnchorRect.top !== this.anchorRect.top ||\n newAnchorRect.left !== this.anchorRect.left ||\n newAnchorRect.height !== this.anchorRect.height ||\n newAnchorRect.width !== this.anchorRect.width) {\n this.anchorRect = newAnchorRect;\n this.parentRect = this.adapter.getParentBoundingRect();\n this.richTooltip ? this.positionRichTooltip() :\n this.positionPlainTooltip();\n }\n };\n /**\n * Given a list of x/y position options for a rich tooltip with caret, checks\n * if valid x/y combinations of these position options are either within the\n * viewport threshold, or simply within the viewport. Returns a map with the\n * valid x/y position combinations that all either honor the viewport\n * threshold or are simply inside within the viewport.\n */\n MDCTooltipFoundation.prototype.validateTooltipWithCaretDistances = function (yOptions, xOptions) {\n var e_4, _a, e_5, _b, e_6, _c;\n var posWithinThreshold = new Map();\n var posWithinViewport = new Map();\n // If a tooltip has a caret, not all combinations of YPositionWithCarets and\n // XPositionWithCarets are possible. Because of this we only check the\n // validity of a given XPositionWithCaret if a potential corresponding\n // YPositionWithCaret is valid.\n var validMappings = new Map([\n [\n YPositionWithCaret.ABOVE,\n [\n XPositionWithCaret.START, XPositionWithCaret.CENTER,\n XPositionWithCaret.END\n ]\n ],\n [\n YPositionWithCaret.BELOW,\n [\n XPositionWithCaret.START, XPositionWithCaret.CENTER,\n XPositionWithCaret.END\n ]\n ],\n [\n YPositionWithCaret.SIDE_TOP,\n [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]\n ],\n [\n YPositionWithCaret.SIDE_CENTER,\n [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]\n ],\n [\n YPositionWithCaret.SIDE_BOTTOM,\n [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]\n ],\n ]);\n try {\n // TODO(b/227383292): Handle instances where one direction can fit in\n // in the viewport (whether honoring the threshold or not), and the\n // other direction does not.\n for (var _d = __values(validMappings.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {\n var y = _e.value;\n var yDistance = yOptions.get(y);\n if (this.yPositionHonorsViewportThreshold(yDistance)) {\n try {\n for (var _f = (e_5 = void 0, __values(validMappings.get(y))), _g = _f.next(); !_g.done; _g = _f.next()) {\n var x = _g.value;\n var xDistance = xOptions.get(x);\n if (this.positionHonorsViewportThreshold(xDistance)) {\n var caretPositionName = this.caretPositionOptionsMapping(x, y);\n posWithinThreshold.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });\n }\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_g && !_g.done && (_b = _f.return)) _b.call(_f);\n }\n finally { if (e_5) throw e_5.error; }\n }\n }\n if (this.yPositionDoesntCollideWithViewport(yDistance)) {\n try {\n for (var _h = (e_6 = void 0, __values(validMappings.get(y))), _j = _h.next(); !_j.done; _j = _h.next()) {\n var x = _j.value;\n var xDistance = xOptions.get(x);\n if (this.positionDoesntCollideWithViewport(xDistance)) {\n var caretPositionName = this.caretPositionOptionsMapping(x, y);\n posWithinViewport.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });\n }\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (_j && !_j.done && (_c = _h.return)) _c.call(_h);\n }\n finally { if (e_6) throw e_6.error; }\n }\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n }\n finally { if (e_4) throw e_4.error; }\n }\n return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;\n };\n /**\n * Method for generating a horizontal and vertical position for the tooltip if\n * all other calculated values are considered invalid. This would only happen\n * in situations of very small viewports/large tooltips.\n */\n MDCTooltipFoundation.prototype.generateBackupPositionOption = function (anchorRect, tooltipSize, caretSize) {\n var isLTR = !this.adapter.isRTL();\n var xDistance;\n var xPos;\n if (anchorRect.left < 0) {\n xDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;\n xPos = isLTR ? XPositionWithCaret.END : XPositionWithCaret.START;\n }\n else {\n var viewportWidth = this.adapter.getViewportWidth();\n xDistance = viewportWidth -\n (tooltipSize.width + this.minViewportTooltipThreshold +\n caretSize.caretHeight);\n xPos = isLTR ? XPositionWithCaret.START : XPositionWithCaret.END;\n }\n var yDistance;\n var yPos;\n if (anchorRect.top < 0) {\n yDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;\n yPos = YPositionWithCaret.BELOW;\n }\n else {\n var viewportHeight = this.adapter.getViewportHeight();\n yDistance = viewportHeight -\n (tooltipSize.height + this.minViewportTooltipThreshold +\n caretSize.caretHeight);\n yPos = YPositionWithCaret.ABOVE;\n }\n var caretPositionName = this.caretPositionOptionsMapping(xPos, yPos);\n return new Map([[caretPositionName, { xDistance: xDistance, yDistance: yDistance }]]);\n };\n /**\n * Given a list of valid position options for a rich tooltip with caret,\n * returns the option that should be used.\n */\n MDCTooltipFoundation.prototype.determineTooltipWithCaretDistance = function (options) {\n if (options.has(this.tooltipPositionWithCaret)) {\n var tooltipPos = options.get(this.tooltipPositionWithCaret);\n return {\n position: this.tooltipPositionWithCaret,\n xDistance: tooltipPos.xDistance,\n yDistance: tooltipPos.yDistance,\n };\n }\n var orderPref = [\n PositionWithCaret.ABOVE_START, PositionWithCaret.ABOVE_CENTER,\n PositionWithCaret.ABOVE_END, PositionWithCaret.TOP_SIDE_START,\n PositionWithCaret.CENTER_SIDE_START, PositionWithCaret.BOTTOM_SIDE_START,\n PositionWithCaret.TOP_SIDE_END, PositionWithCaret.CENTER_SIDE_END,\n PositionWithCaret.BOTTOM_SIDE_END, PositionWithCaret.BELOW_START,\n PositionWithCaret.BELOW_CENTER, PositionWithCaret.BELOW_END\n ];\n // Before calling this method we check whether or not the \"options\" param\n // is empty and invoke a different method. We, therefore, can be certain\n // that \"validPosition\" will always be defined.\n var validPosition = orderPref.find(function (pos) { return options.has(pos); });\n var pos = options.get(validPosition);\n return {\n position: validPosition,\n xDistance: pos.xDistance,\n yDistance: pos.yDistance,\n };\n };\n /**\n * Returns the corresponding PositionWithCaret enum for the proivded\n * XPositionWithCaret and YPositionWithCaret enums. This mapping exists so our\n * public API accepts only PositionWithCaret enums (as all combinations of\n * XPositionWithCaret and YPositionWithCaret are not valid), but internally we\n * can calculate the X and Y positions of a rich tooltip with caret\n * separately.\n */\n MDCTooltipFoundation.prototype.caretPositionOptionsMapping = function (xPos, yPos) {\n switch (yPos) {\n case YPositionWithCaret.ABOVE:\n if (xPos === XPositionWithCaret.START) {\n return PositionWithCaret.ABOVE_START;\n }\n else if (xPos === XPositionWithCaret.CENTER) {\n return PositionWithCaret.ABOVE_CENTER;\n }\n else if (xPos === XPositionWithCaret.END) {\n return PositionWithCaret.ABOVE_END;\n }\n break;\n case YPositionWithCaret.BELOW:\n if (xPos === XPositionWithCaret.START) {\n return PositionWithCaret.BELOW_START;\n }\n else if (xPos === XPositionWithCaret.CENTER) {\n return PositionWithCaret.BELOW_CENTER;\n }\n else if (xPos === XPositionWithCaret.END) {\n return PositionWithCaret.BELOW_END;\n }\n break;\n case YPositionWithCaret.SIDE_TOP:\n if (xPos === XPositionWithCaret.SIDE_START) {\n return PositionWithCaret.TOP_SIDE_START;\n }\n else if (xPos === XPositionWithCaret.SIDE_END) {\n return PositionWithCaret.TOP_SIDE_END;\n }\n break;\n case YPositionWithCaret.SIDE_CENTER:\n if (xPos === XPositionWithCaret.SIDE_START) {\n return PositionWithCaret.CENTER_SIDE_START;\n }\n else if (xPos === XPositionWithCaret.SIDE_END) {\n return PositionWithCaret.CENTER_SIDE_END;\n }\n break;\n case YPositionWithCaret.SIDE_BOTTOM:\n if (xPos === XPositionWithCaret.SIDE_START) {\n return PositionWithCaret.BOTTOM_SIDE_START;\n }\n else if (xPos === XPositionWithCaret.SIDE_END) {\n return PositionWithCaret.BOTTOM_SIDE_END;\n }\n break;\n default:\n break;\n }\n throw new Error(\"MDCTooltipFoundation: Invalid caret position of \" + xPos + \", \" + yPos);\n };\n /**\n * Given a PositionWithCaret, applies the correct styles to the caret element\n * so that it is positioned properly on the rich tooltip.\n * Returns the x and y positions of the caret, to be used as the\n * transform-origin on the tooltip itself for entrance animations.\n */\n MDCTooltipFoundation.prototype.setCaretPositionStyles = function (position, caretSize) {\n var e_7, _a;\n var values = this.calculateCaretPositionOnTooltip(position, caretSize);\n if (!values) {\n return { yTransformOrigin: 0, xTransformOrigin: 0 };\n }\n // Prior to setting the caret position styles, clear any previous styles\n // set. This is necessary as all position options do not use the same\n // properties (e.g. using 'left' or 'right') and so old style properties\n // might not get overridden, causing misplaced carets.\n this.adapter.clearTooltipCaretStyles();\n this.adapter.setTooltipCaretStyle(values.yAlignment, values.yAxisPx);\n this.adapter.setTooltipCaretStyle(values.xAlignment, values.xAxisPx);\n // Value of scaleX is cos(skew), Math.cos() expects radians though, so we\n // must first convert the skew value (which is in degrees) to radians.\n var skewRadians = values.skew * (Math.PI / 180);\n var scaleX = Math.cos(skewRadians);\n this.adapter.setTooltipCaretStyle('transform', \"rotate(\" + values.rotation + \"deg) skewY(\" + values.skew + \"deg) scaleX(\" + scaleX + \")\");\n this.adapter.setTooltipCaretStyle('transform-origin', values.xAlignment + \" \" + values.yAlignment);\n try {\n for (var _b = __values(values.caretCorners), _c = _b.next(); !_c.done; _c = _b.next()) {\n var corner = _c.value;\n this.adapter.setTooltipCaretStyle(corner, '0');\n }\n }\n catch (e_7_1) { e_7 = { error: e_7_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_7) throw e_7.error; }\n }\n return {\n yTransformOrigin: values.yTransformOrigin,\n xTransformOrigin: values.xTransformOrigin\n };\n };\n /**\n * Given a PositionWithCaret, determines the correct styles to position the\n * caret properly on the rich tooltip.\n */\n MDCTooltipFoundation.prototype.calculateCaretPositionOnTooltip = function (tooltipPos, caretSize) {\n var isLTR = !this.adapter.isRTL();\n var tooltipWidth = this.adapter.getComputedStyleProperty('width');\n var tooltipHeight = this.adapter.getComputedStyleProperty('height');\n if (!tooltipWidth || !tooltipHeight || !caretSize) {\n return;\n }\n var midpointWidth = \"calc((\" + tooltipWidth + \" - \" + caretSize.caretWidth + \"px) / 2)\";\n var midpointHeight = \"calc((\" + tooltipHeight + \" - \" + caretSize.caretWidth + \"px) / 2)\";\n var flushWithEdge = '0';\n var indentedFromEdge = numbers.CARET_INDENTATION + \"px\";\n var indentedFromWidth = \"calc(\" + tooltipWidth + \" - \" + indentedFromEdge + \")\";\n var indentedFromHeight = \"calc(\" + tooltipHeight + \" - \" + indentedFromEdge + \")\";\n var verticalRotation = 35;\n var horizontalRotation = Math.abs(90 - verticalRotation);\n var bottomRightTopLeftBorderRadius = ['border-bottom-right-radius', 'border-top-left-radius'];\n var bottomLeftTopRightBorderRadius = ['border-bottom-left-radius', 'border-top-right-radius'];\n var skewDeg = 20;\n switch (tooltipPos) {\n case PositionWithCaret.BELOW_CENTER:\n return {\n yAlignment: strings.TOP,\n xAlignment: strings.LEFT,\n yAxisPx: flushWithEdge,\n xAxisPx: midpointWidth,\n rotation: -1 * verticalRotation,\n skew: -1 * skewDeg,\n xTransformOrigin: midpointWidth,\n yTransformOrigin: flushWithEdge,\n caretCorners: bottomRightTopLeftBorderRadius,\n };\n case PositionWithCaret.BELOW_END:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.RIGHT : strings.LEFT,\n yAxisPx: flushWithEdge,\n xAxisPx: indentedFromEdge,\n rotation: isLTR ? verticalRotation : -1 * verticalRotation,\n skew: isLTR ? skewDeg : -1 * skewDeg,\n xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,\n yTransformOrigin: flushWithEdge,\n caretCorners: isLTR ? bottomLeftTopRightBorderRadius :\n bottomRightTopLeftBorderRadius,\n };\n case PositionWithCaret.BELOW_START:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.LEFT : strings.RIGHT,\n yAxisPx: flushWithEdge,\n xAxisPx: indentedFromEdge,\n rotation: isLTR ? -1 * verticalRotation : verticalRotation,\n skew: isLTR ? -1 * skewDeg : skewDeg,\n xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,\n yTransformOrigin: flushWithEdge,\n caretCorners: isLTR ? bottomRightTopLeftBorderRadius :\n bottomLeftTopRightBorderRadius,\n };\n case PositionWithCaret.TOP_SIDE_END:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.LEFT : strings.RIGHT,\n yAxisPx: indentedFromEdge,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,\n skew: isLTR ? -1 * skewDeg : skewDeg,\n xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,\n yTransformOrigin: indentedFromEdge,\n caretCorners: isLTR ? bottomRightTopLeftBorderRadius :\n bottomLeftTopRightBorderRadius,\n };\n case PositionWithCaret.CENTER_SIDE_END:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.LEFT : strings.RIGHT,\n yAxisPx: midpointHeight,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,\n skew: isLTR ? -1 * skewDeg : skewDeg,\n xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,\n yTransformOrigin: midpointHeight,\n caretCorners: isLTR ? bottomRightTopLeftBorderRadius :\n bottomLeftTopRightBorderRadius,\n };\n case PositionWithCaret.BOTTOM_SIDE_END:\n return {\n yAlignment: strings.BOTTOM,\n xAlignment: isLTR ? strings.LEFT : strings.RIGHT,\n yAxisPx: indentedFromEdge,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,\n skew: isLTR ? skewDeg : -1 * skewDeg,\n xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,\n yTransformOrigin: indentedFromHeight,\n caretCorners: isLTR ? bottomLeftTopRightBorderRadius :\n bottomRightTopLeftBorderRadius,\n };\n case PositionWithCaret.TOP_SIDE_START:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.RIGHT : strings.LEFT,\n yAxisPx: indentedFromEdge,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,\n skew: isLTR ? skewDeg : -1 * skewDeg,\n xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,\n yTransformOrigin: indentedFromEdge,\n caretCorners: isLTR ? bottomLeftTopRightBorderRadius :\n bottomRightTopLeftBorderRadius,\n };\n case PositionWithCaret.CENTER_SIDE_START:\n return {\n yAlignment: strings.TOP,\n xAlignment: isLTR ? strings.RIGHT : strings.LEFT,\n yAxisPx: midpointHeight,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,\n skew: isLTR ? skewDeg : -1 * skewDeg,\n xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,\n yTransformOrigin: midpointHeight,\n caretCorners: isLTR ? bottomLeftTopRightBorderRadius :\n bottomRightTopLeftBorderRadius,\n };\n case PositionWithCaret.BOTTOM_SIDE_START:\n return {\n yAlignment: strings.BOTTOM,\n xAlignment: isLTR ? strings.RIGHT : strings.LEFT,\n yAxisPx: indentedFromEdge,\n xAxisPx: flushWithEdge,\n rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,\n skew: isLTR ? -1 * skewDeg : skewDeg,\n xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,\n yTransformOrigin: indentedFromHeight,\n caretCorners: isLTR ? bottomRightTopLeftBorderRadius :\n bottomLeftTopRightBorderRadius,\n };\n case PositionWithCaret.ABOVE_CENTER:\n return {\n yAlignment: strings.BOTTOM,\n xAlignment: strings.LEFT,\n yAxisPx: flushWithEdge,\n xAxisPx: midpointWidth,\n rotation: verticalRotation,\n skew: skewDeg,\n xTransformOrigin: midpointWidth,\n yTransformOrigin: tooltipHeight,\n caretCorners: bottomLeftTopRightBorderRadius,\n };\n case PositionWithCaret.ABOVE_END:\n return {\n yAlignment: strings.BOTTOM,\n xAlignment: isLTR ? strings.RIGHT : strings.LEFT,\n yAxisPx: flushWithEdge,\n xAxisPx: indentedFromEdge,\n rotation: isLTR ? -1 * verticalRotation : verticalRotation,\n skew: isLTR ? -1 * skewDeg : skewDeg,\n xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,\n yTransformOrigin: tooltipHeight,\n caretCorners: isLTR ? bottomRightTopLeftBorderRadius :\n bottomLeftTopRightBorderRadius,\n };\n default:\n case PositionWithCaret.ABOVE_START:\n return {\n yAlignment: strings.BOTTOM,\n xAlignment: isLTR ? strings.LEFT : strings.RIGHT,\n yAxisPx: flushWithEdge,\n xAxisPx: indentedFromEdge,\n rotation: isLTR ? verticalRotation : -1 * verticalRotation,\n skew: isLTR ? skewDeg : -1 * skewDeg,\n xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,\n yTransformOrigin: tooltipHeight,\n caretCorners: isLTR ? bottomLeftTopRightBorderRadius :\n bottomRightTopLeftBorderRadius,\n };\n }\n };\n MDCTooltipFoundation.prototype.clearShowTimeout = function () {\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n };\n MDCTooltipFoundation.prototype.clearHideTimeout = function () {\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n };\n /**\n * Method that allows user to specify additional elements that should have a\n * scroll event listener attached to it. This should be used in instances\n * where the anchor element is placed inside a scrollable container, and will\n * ensure that the tooltip will stay attached to the anchor on scroll.\n */\n MDCTooltipFoundation.prototype.attachScrollHandler = function (addEventListenerFn) {\n var _this = this;\n this.addAncestorScrollEventListeners.push(function () {\n addEventListenerFn('scroll', _this.windowScrollHandler);\n });\n };\n /**\n * Must be used in conjunction with #attachScrollHandler. Removes the scroll\n * event handler from elements on the page.\n */\n MDCTooltipFoundation.prototype.removeScrollHandler = function (removeEventHandlerFn) {\n var _this = this;\n this.removeAncestorScrollEventListeners.push(function () {\n removeEventHandlerFn('scroll', _this.windowScrollHandler);\n });\n };\n MDCTooltipFoundation.prototype.destroy = function () {\n var e_8, _a;\n if (this.frameId) {\n cancelAnimationFrame(this.frameId);\n this.frameId = null;\n }\n this.clearHideTimeout();\n this.clearShowTimeout();\n this.adapter.removeClass(SHOWN);\n this.adapter.removeClass(SHOWING_TRANSITION);\n this.adapter.removeClass(SHOWING);\n this.adapter.removeClass(HIDE);\n this.adapter.removeClass(HIDE_TRANSITION);\n if (this.richTooltip) {\n this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);\n }\n if (!this.persistentTooltip) {\n this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);\n this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);\n }\n this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);\n this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);\n this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);\n this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n try {\n for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {\n var fn = _c.value;\n fn();\n }\n }\n catch (e_8_1) { e_8 = { error: e_8_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_8) throw e_8.error; }\n }\n this.animFrame.cancelAll();\n };\n return MDCTooltipFoundation;\n}(MDCFoundation));\nexport { MDCTooltipFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTooltipFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { CssClasses, events } from './constants';\nimport { MDCTooltipFoundation } from './foundation';\nvar MDCTooltip = /** @class */ (function (_super) {\n __extends(MDCTooltip, _super);\n function MDCTooltip() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCTooltip.attachTo = function (root) {\n return new MDCTooltip(root);\n };\n MDCTooltip.prototype.initialize = function () {\n var tooltipId = this.root.getAttribute('id');\n if (!tooltipId) {\n throw new Error('MDCTooltip: Tooltip component must have an id.');\n }\n var anchorElem = document.querySelector(\"[data-tooltip-id=\\\"\" + tooltipId + \"\\\"]\") ||\n document.querySelector(\"[aria-describedby=\\\"\" + tooltipId + \"\\\"]\");\n if (!anchorElem) {\n throw new Error('MDCTooltip: Tooltip component requires an anchor element annotated with [aria-describedby] or [data-tooltip-id].');\n }\n this.anchorElem = anchorElem;\n };\n MDCTooltip.prototype.initialSyncWithDOM = function () {\n var _this = this;\n this.isTooltipRich = this.foundation.isRich();\n this.isTooltipPersistent = this.foundation.isPersistent();\n this.handleMouseEnter = function () {\n _this.foundation.handleAnchorMouseEnter();\n };\n this.handleFocus = function (evt) {\n _this.foundation.handleAnchorFocus(evt);\n };\n this.handleMouseLeave = function () {\n _this.foundation.handleAnchorMouseLeave();\n };\n this.handleTransitionEnd = function () {\n _this.foundation.handleTransitionEnd();\n };\n this.handleClick = function () {\n _this.foundation.handleAnchorClick();\n };\n this.handleTouchstart = function () {\n _this.foundation.handleAnchorTouchstart();\n };\n this.handleTouchend = function () {\n _this.foundation.handleAnchorTouchend();\n };\n if (this.isTooltipRich && this.isTooltipPersistent) {\n this.anchorElem.addEventListener('click', this.handleClick);\n }\n else {\n this.anchorElem.addEventListener('mouseenter', this.handleMouseEnter);\n // TODO(b/157075286): Listening for a 'focus' event is too broad.\n this.anchorElem.addEventListener('focus', this.handleFocus);\n this.anchorElem.addEventListener('mouseleave', this.handleMouseLeave);\n this.anchorElem.addEventListener('touchstart', this.handleTouchstart);\n this.anchorElem.addEventListener('touchend', this.handleTouchend);\n }\n this.listen('transitionend', this.handleTransitionEnd);\n };\n MDCTooltip.prototype.destroy = function () {\n if (this.anchorElem) {\n if (this.isTooltipRich && this.isTooltipPersistent) {\n this.anchorElem.removeEventListener('click', this.handleClick);\n }\n else {\n this.anchorElem.removeEventListener('mouseenter', this.handleMouseEnter);\n this.anchorElem.removeEventListener('focus', this.handleFocus);\n this.anchorElem.removeEventListener('mouseleave', this.handleMouseLeave);\n this.anchorElem.removeEventListener('touchstart', this.handleTouchstart);\n this.anchorElem.removeEventListener('touchend', this.handleTouchend);\n }\n }\n this.unlisten('transitionend', this.handleTransitionEnd);\n _super.prototype.destroy.call(this);\n };\n MDCTooltip.prototype.setTooltipPosition = function (position) {\n this.foundation.setTooltipPosition(position);\n };\n MDCTooltip.prototype.setAnchorBoundaryType = function (type) {\n this.foundation.setAnchorBoundaryType(type);\n };\n MDCTooltip.prototype.setShowDelay = function (delayMs) {\n this.foundation.setShowDelay(delayMs);\n };\n MDCTooltip.prototype.setHideDelay = function (delayMs) {\n this.foundation.setHideDelay(delayMs);\n };\n MDCTooltip.prototype.hide = function () {\n this.foundation.hide();\n };\n MDCTooltip.prototype.isShown = function () {\n return this.foundation.isShown();\n };\n /**\n * Method that allows user to specify additional elements that should have a\n * scroll event listener attached to it. This should be used in instances\n * where the anchor element is placed inside a scrollable container (that is\n * not the body element), and will ensure that the tooltip will stay attached\n * to the anchor on scroll.\n */\n MDCTooltip.prototype.attachScrollHandler = function (addEventListenerFn) {\n this.foundation.attachScrollHandler(addEventListenerFn);\n };\n /**\n * Must be used in conjunction with #attachScrollHandler. Removes the scroll\n * event handler from elements on the page.\n */\n MDCTooltip.prototype.removeScrollHandler = function (removeEventHandlerFn) {\n this.foundation.removeScrollHandler(removeEventHandlerFn);\n };\n MDCTooltip.prototype.getDefaultFoundation = function () {\n var _this = this;\n var adapter = {\n getAttribute: function (attr) { return _this.root.getAttribute(attr); },\n setAttribute: function (attr, value) {\n _this.root.setAttribute(attr, value);\n },\n removeAttribute: function (attr) {\n _this.root.removeAttribute(attr);\n },\n addClass: function (className) {\n _this.root.classList.add(className);\n },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n removeClass: function (className) {\n _this.root.classList.remove(className);\n },\n getComputedStyleProperty: function (propertyName) {\n return window.getComputedStyle(_this.root).getPropertyValue(propertyName);\n },\n setStyleProperty: function (propertyName, value) {\n _this.root.style.setProperty(propertyName, value);\n },\n setSurfaceAnimationStyleProperty: function (propertyName, value) {\n var surface = _this.root.querySelector(\".\" + CssClasses.SURFACE_ANIMATION);\n surface === null || surface === void 0 ? void 0 : surface.style.setProperty(propertyName, value);\n },\n getViewportWidth: function () { return window.innerWidth; },\n getViewportHeight: function () { return window.innerHeight; },\n getTooltipSize: function () {\n return {\n width: _this.root.offsetWidth,\n height: _this.root.offsetHeight\n };\n },\n getAnchorBoundingRect: function () {\n return _this.anchorElem ? _this.anchorElem.getBoundingClientRect() : null;\n },\n getParentBoundingRect: function () {\n var _a, _b;\n return (_b = (_a = _this.root.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : null;\n },\n getAnchorAttribute: function (attr) {\n return _this.anchorElem ? _this.anchorElem.getAttribute(attr) : null;\n },\n setAnchorAttribute: function (attr, value) {\n var _a;\n (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.setAttribute(attr, value);\n },\n isRTL: function () { return getComputedStyle(_this.root).direction === 'rtl'; },\n anchorContainsElement: function (element) {\n var _a;\n return !!((_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.contains(element));\n },\n tooltipContainsElement: function (element) {\n return _this.root.contains(element);\n },\n focusAnchorElement: function () {\n var _a;\n (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.focus();\n },\n registerEventHandler: function (evt, handler) {\n if (_this.root instanceof HTMLElement) {\n _this.root.addEventListener(evt, handler);\n }\n },\n deregisterEventHandler: function (evt, handler) {\n if (_this.root instanceof HTMLElement) {\n _this.root.removeEventListener(evt, handler);\n }\n },\n registerAnchorEventHandler: function (evt, handler) {\n var _a;\n (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.addEventListener(evt, handler);\n },\n deregisterAnchorEventHandler: function (evt, handler) {\n var _a;\n (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.removeEventListener(evt, handler);\n },\n registerDocumentEventHandler: function (evt, handler) {\n document.body.addEventListener(evt, handler);\n },\n deregisterDocumentEventHandler: function (evt, handler) {\n document.body.removeEventListener(evt, handler);\n },\n registerWindowEventHandler: function (evt, handler) {\n window.addEventListener(evt, handler);\n },\n deregisterWindowEventHandler: function (evt, handler) {\n window.removeEventListener(evt, handler);\n },\n notifyHidden: function () {\n _this.emit(events.HIDDEN, {});\n },\n getTooltipCaretBoundingRect: function () {\n var caret = _this.root.querySelector(\".\" + CssClasses.TOOLTIP_CARET_TOP);\n if (!caret) {\n return null;\n }\n return caret.getBoundingClientRect();\n },\n setTooltipCaretStyle: function (propertyName, value) {\n var topCaret = _this.root.querySelector(\".\" + CssClasses.TOOLTIP_CARET_TOP);\n var bottomCaret = _this.root.querySelector(\".\" + CssClasses.TOOLTIP_CARET_BOTTOM);\n if (!topCaret || !bottomCaret) {\n return;\n }\n topCaret.style.setProperty(propertyName, value);\n bottomCaret.style.setProperty(propertyName, value);\n },\n clearTooltipCaretStyles: function () {\n var topCaret = _this.root.querySelector(\".\" + CssClasses.TOOLTIP_CARET_TOP);\n var bottomCaret = _this.root.querySelector(\".\" + CssClasses.TOOLTIP_CARET_BOTTOM);\n if (!topCaret || !bottomCaret) {\n return;\n }\n topCaret.removeAttribute('style');\n bottomCaret.removeAttribute('style');\n },\n getActiveElement: function () {\n return document.activeElement;\n },\n };\n //tslint:enable:object-literal-sort-keys\n return new MDCTooltipFoundation(adapter);\n };\n return MDCTooltip;\n}(MDCComponent));\nexport { MDCTooltip };\n//# sourceMappingURL=component.js.map","import {MDCRipple} from '@material/ripple';\nimport {MDCTextField} from '@material/textfield';\nimport {MDCSelect} from '@material/select';\nimport {MDCList} from '@material/list';\nimport {MDCSnackbar} from '@material/snackbar';\nimport {MDCDataTable} from '@material/data-table';\nimport {MDCChipSet} from '@material/chips';\nimport {MDCTabBar} from '@material/tab-bar';\nimport {MDCDialog} from '@material/dialog';\nimport {MDCSwitch} from '@material/switch';\nimport {MDCBanner} from '@material/banner';\nimport {MDCTooltip} from '@material/tooltip';\nimport {MDCTextFieldIcon} from '@material/textfield/icon';\n\ndocument.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n // const textField = new MDCTextField(document.querySelectorAll('.mdc-text-field'));\n const textFields = [].map.call(document.querySelectorAll('.mdc-text-field'), function(el) {\n return new MDCTextField(el);\n });\n\n const selectFields = [].map.call(document.querySelectorAll('.mdc-select'), function(el) {\n let select = new MDCSelect(el);\n select.listen('MDCSelect:change', () => {\n // console.log(select.attr('id'));\n // console.log(el);\n // console.log(el.dataset.selectName);\n let selectName = el.dataset.selectName;\n console.log(`${selectName} - Selected option at index ${select.selectedIndex} with value \"${select.value}\"`);\n\n if (selectName == \"pagination\") {\n let form = document.getElementById(\"rfq-pagination-form\");\n let per_page_field = form.querySelector('#per-page-field');\n per_page_field.value = parseInt(select.value);\n form.submit();\n } else {\n let textEle = el.querySelector(\".mdc-select__selected-text\");\n if (select.value == \"\") {\n textEle.classList.add(\"placeholder-color\");\n } else {\n textEle.classList.remove(\"placeholder-color\");\n }\n }\n });\n return select;\n });\n\n const lists = [].map.call(document.querySelectorAll('.mdc-list'), function(el) {\n return new MDCList(el);\n });\n\n const snackbar = new MDCSnackbar(document.querySelector('.mdc-snackbar'));\n let noticeText = document.getElementById(\"flash_notice\").innerText;\n if (noticeText && noticeText.length > 0) {\n let el = document.querySelector('.mdc-snackbar');\n el.classList.remove(\"mdc-snackbar--alert\");\n snackbar.labelText = noticeText;\n snackbar.open();\n } else {\n // Might want to style it accordingly\n let alertText = document.getElementById(\"flash_alert\").innerText;\n if (alertText && alertText.length > 0) {\n let el = document.querySelector('.mdc-snackbar');\n el.classList.add(\"mdc-snackbar--alert\");\n snackbar.labelText = alertText;\n snackbar.open();\n }\n }\n\n let mdcTable = document.querySelector('.mdc-data-table')\n if (mdcTable) {\n const dataTable = new MDCDataTable(mdcTable);\n }\n\n const chipsets = [].map.call(document.querySelectorAll('.mdc-evolution-chip-set'), function(el) {\n return new MDCChipSet(el);\n });\n\n const tabBars = [].map.call(document.querySelectorAll('.mdc-tab-bar'), function(el) {\n let tabBar = new MDCTabBar(el);\n tabBar.listen('MDCTabBar:activated', function(event) {\n console.log(event);\n if (el.id === \"rfq-detail-tab-bar\") {\n let tabCount = document.querySelectorAll(\".mdc-tab\").length;\n let index = event.detail.index;\n\n if (tabCount == 4) {\n $('#show-partial-offer').hide();\n $('#show-bid-submitted').hide();\n $('#show-material-request').hide();\n $('#show-files').hide();\n\n if (index == 0) {\n $('#show-partial-offer').show();\n } else if (index == 1) {\n $('#show-bid-submitted').show();\n } else if (index == 2) {\n $('#show-material-request').show();\n } else { // 3\n $('#show-files').show();\n }\n } else if (tabCount == 3) {\n if (index == 0) {\n $('#show-bid-submitted').show();\n $('#show-material-request').hide();\n $('#show-files').hide();\n } else if (index == 1) {\n $('#show-bid-submitted').hide();\n $('#show-material-request').show();\n $('#show-files').hide();\n } else {\n $('#show-bid-submitted').hide();\n $('#show-material-request').hide();\n $('#show-files').show();\n }\n } else {\n if (index == 0) {\n $('#show-material-request').show();\n $('#show-files').hide();\n } else {\n $('#show-material-request').hide();\n $('#show-files').show();\n }\n }\n }\n });\n return tabBar;\n });\n\n /**\n * MDC Dialog\n */\n let dialogEle = document.querySelector('#dialog-bid-success');\n if (dialogEle) {\n let dialog = new MDCDialog(dialogEle);\n dialog.open();\n }\n $(\".invite-client-button\").click(function(e) {\n e.preventDefault();\n let inviteDialog = document.querySelector('#dialog-invite-clients');\n if (inviteDialog) {\n let dialog = new MDCDialog(inviteDialog);\n dialog.open();\n }\n })\n \n const switchControl = [].map.call(document.querySelectorAll('.mdc-switch'), function(el) {\n return new MDCSwitch(el);\n });\n \n const banner = [].map.call(document.querySelectorAll('.mdc-banner'), function(el) {\n return new MDCBanner(el);\n });\n\n const buttonRipple = [].map.call(document.querySelectorAll('.mdc-button'), function(el) {\n return new MDCRipple(el);\n });\n\n const tooltip = [].map.call(document.querySelectorAll('.mdc-tooltip'), function(el) {\n return new MDCTooltip(el);\n });\n\n const icon = [].map.call(document.querySelectorAll('.mdc-text-field-icon'), function(el) {\n return new MDCTextFieldIcon(el);\n });\n};\n\n/**\n * Offer buying options select\n */\nfunction handleDirectOffer(id) {\n updateOfferForWithPaymentMethodAndSubmit(id, 'direct');\n}\nfunction handleFinanceOffer(id) {\n updateOfferForWithPaymentMethodAndSubmit(id, 'finance');\n}\nfunction updateOfferForWithPaymentMethodAndSubmit(id, payment_method) {\n if (confirm('Are you sure?')) {\n let arr = id.split(\"-\");\n arr.shift();\n let identifier = arr.join(\"-\");\n\n let form = document.getElementById(`offer-${identifier}`);\n let field = form.querySelector('#offer_selected_payment_type');\n field.value = payment_method;\n form.submit();\n } else {\n // Do nothing!\n }\n}\n","document.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n $(\"input[data-type='date']\").datepicker(\"destroy\");\n $(\"input[data-type='date']\").datepicker({\n showButtonPanel: true,\n closeText: 'OK',\n onSelect: function(date, inst) {\n // changeMaterialHeader(headerHtml, moment(date, 'MM/DD/YYYY'));\n },\n });\n}\n","// import imageIconUrl from '../images/image_black_24dp.svg'\n// import pdfIconUrl from '../images/picture_as_pdf_black_24dp.svg'\n// import xlsIconUrl from '../images/table_chart_black_24dp.svg'\n\nlet maxFileSize = 1024 * 1024 * 2; // 2 MB\n\ndocument.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n var list = new DataTransfer();\n\n function updateFileListUI() {\n let files = list.files;\n // console.log(\"FILES:\");\n // console.log(files, Array.from(files));\n\n let removeButtonTemplate = document.getElementById(\"remove-button-template\").innerHTML;\n let updatedHTML = \"\";\n\n Array.from(files).forEach(file => {\n let iconUrl;\n let ft = file.type;\n switch(file.type) {\n case 'application/pdf':\n iconUrl = \"mdi:file-pdf-box\";\n break;\n case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':\n case 'application/vnd.ms-excel.sheet.binary.macroEnabled.12':\n case 'application/vnd.ms-excel':\n case 'application/vnd.ms-excel.sheet.macroEnabled.12':\n iconUrl = \"mdi:google-spreadsheet\";\n break;\n case 'application/msword':\n case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':\n case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':\n case 'application/vnd.ms-word.document.macroEnabled.12':\n case 'application/vnd.ms-word.template.macroEnabled.12':\n iconUrl = \"mdi:file-word\"\n break;\n case 'image/png':\n iconUrl = \"mdi:file-png-box\";\n break;\n default:\n iconUrl = \"mdi:file-jpg-box\";\n break;\n }\n let html = `\n
  • \n \n \n \n ${file.name}\n \n
  • \n `;\n updatedHTML = updatedHTML + html;\n });\n let parent = document.getElementById(\"uploaded-file-list\");\n let children = parent.querySelectorAll('.list-qoutes-item');\n children.forEach(function(child) {\n if (!child.classList.contains('persisted')) {\n parent.removeChild(child);\n }\n })\n parent.innerHTML = parent.innerHTML + updatedHTML;\n //\n $(\".remove-uploaded-file\").off();\n $(\".remove-uploaded-file\").click(removeFile);\n }\n\n function removeFile(e) {\n e.preventDefault();\n e.stopPropagation();\n\n let fn = $(this).data('file-name');\n for (var i = list.items.length - 1; i >= 0; i--) {\n let item = list.items[i];\n let file = item.getAsFile();\n if (file && file.name == fn) {\n list.items.remove(i);\n }\n }\n document.getElementById(\"bid_files\").files = list.files;\n updateFileListUI();\n }\n\n function notifyOversizedFiles(names) {\n if (names.length > 0) {\n let joined = names.join(\", \");\n alert('Maximum file size is 2MB:\\n' + joined);\n }\n }\n /**\n * Dropzone\n */\n $(\"#file-dropzone\").off();\n $(\"#file-dropzone\").on(\"drop\", function(e) {\n e.preventDefault();\n e.stopPropagation();\n\n let oversizedFileNames = [];\n\n // Get elements\n let dt = e.originalEvent.dataTransfer;\n if (dt.items) {\n // Use DataTransferItemList interface to access the file(s)\n for (var i = 0; i < dt.items.length; i++) {\n // If dropped items aren't files, reject them\n if (dt.items[i].kind === 'file') {\n let file = dt.items[i].getAsFile();\n if (file.size > maxFileSize) {\n oversizedFileNames.push(file.name);\n } else {\n list.items.add(file);\n }\n }\n }\n } else {\n // Use DataTransfer interface to access the file(s)\n for (var i = 0; i < dt.files.length; i++) {\n let file = dt.files[i];\n if (file.size > maxFileSize) {\n oversizedFileNames.push(file.name);\n } else {\n list.items.add(file);\n }\n }\n }\n document.getElementById(\"bid_files\").files = list.files;\n updateFileListUI();\n notifyOversizedFiles(oversizedFileNames);\n });\n $(\"#file-dropzone\").on('dragover', function(e) {\n e.preventDefault();\n e.stopPropagation();\n $(this).addClass('dropzone-highlight');\n })\n $(\"#file-dropzone\").on(\"dragleave\", function(e) {\n e.preventDefault();\n e.stopPropagation();\n $(this).removeClass('dropzone-highlight');\n });\n /**\n * Input file onchange\n */\n $(\"#bid_files\").on('change', function(e) {\n let oversizedFileNames = [];\n\n let files = $(this)[0].files;\n for (var i = 0; i < files.length; i++) {\n let file = files[i];\n if (file.size > maxFileSize) {\n oversizedFileNames.push(file.name);\n } else {\n list.items.add(file);\n }\n }\n document.getElementById(\"bid_files\").files = list.files;\n updateFileListUI();\n notifyOversizedFiles(oversizedFileNames);\n });\n};\n","document.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n $(\"#material-requested-tab\").off();\n $(\"#material-requested-tab\").click(function(e) {\n e.preventDefault();\n if ($(\".material-details-table\").hasClass('hidden')) {\n $(\".material-details-table\").removeClass('hidden');\n $(\".documents-list\").addClass('hidden');\n }\n })\n $(\"#document-uploaded-tab\").off();\n $(\"#document-uploaded-tab\").click(function(e) {\n e.preventDefault();\n if ($(\".documents-list\").hasClass('hidden')) {\n $(\".documents-list\").removeClass('hidden');\n $(\".material-details-table\").addClass('hidden');\n }\n })\n\n $(\"#button_direct_offer\").off();\n $(\"#button_direct_offer\").click(function(e) {\n e.preventDefault();\n updateOfferForWithPaymentMethodAndSubmit('direct');\n })\n\n $(\"#button_finance_offer\").off();\n $(\"#button_finance_offer\").click(function(e) {\n e.preventDefault();\n updateOfferForWithPaymentMethodAndSubmit('finance');\n })\n\n $(\".material-request-row\").off();\n $(\".material-request-row\").click(function(e) {\n $(this).find(\".detail-link\")[0].click();\n })\n\n $(\".material-option-select\").off();\n $(\".material-option-select\").click(function(e) {\n e.stopPropagation();\n })\n\n // $(\".show-spinner\").off();\n $(\".show-spinner\").click(function(e) {\n $(\"#overlay\").fadeIn(300);\n })\n};\n/**\n * Offer buying options select\n */\nfunction updateOfferForWithPaymentMethodAndSubmit(payment_method) {\n if (confirm('Are you sure?')) {\n let form = document.getElementById('submit-offer-form');\n let field = form.querySelector('#offer_selected_payment_type');\n field.value = payment_method;\n form.submit();\n } else {\n // Do nothing!\n }\n}\n","import {MDCMenu} from '@material/menu';\nimport {Corner} from '@material/menu';\n\ndocument.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n function calculateTotalPrice() {\n var totalPrice = 0;\n $(\".input-list__item\").each(function() {\n var price = 0;\n var quantity = 0;\n\n let not_available = $(this).find('.not_available_field').first().val();\n if (not_available === 'true') {\n return;\n }\n\n let swapped = $(this).find('.swapped_field').first().val();\n if (swapped === 'true') {\n price = $(this).find('.material-cost-replacement').first().val();\n quantity = $(this).find('.material-quantity-replacement').first().val();\n } else {\n price = $(this).find('.material-cost-original').first().val();\n quantity = $(this).find('.material-quantity').first().val();\n }\n price = ep_currency_to_number(price);\n quantity = ep_currency_to_number(quantity);\n\n totalPrice = totalPrice + (price * quantity);\n });\n $(\"#material-total-cost\").html(('$' + ep_number_to_currency(totalPrice)));\n $(\"#bid_total_price\").val(totalPrice);\n }\n calculateTotalPrice();\n\n $('.material-cost').on('input', function(e) {\n calculateTotalPrice();\n });\n $('.quantity-field').on('input', function(e) {\n calculateTotalPrice();\n });\n\n // Dropdown\n\n var handleMenuSelection = false;\n document.querySelectorAll('.more-menu-trigger').forEach(bidMenu => {\n const menu = new MDCMenu(bidMenu.nextElementSibling);\n menu.setAnchorCorner(Corner.BOTTOM_END);\n menu.setAnchorMargin({right: 135});\n menu.listen('MDCMenu:selected', (event) => {\n if (!handleMenuSelection) {\n return;\n }\n handleMenuSelection = false;\n\n let parent = bidMenu.closest(\".input-list__item\");\n parent.classList.remove(\"input-list__item-swapped\", \"input-list__item-unavailable\");\n\n let el = event.detail.item;\n let textEle = el.querySelector(\".mdc-list-item__text\");\n\n let inputLabel = parent.querySelectorAll(\".input-list__request-fields .mdc-text-field\");\n inputLabel.forEach(i => {\n i.classList.remove(\"mdc-text-field--disabled\");\n })\n let inputField = parent.querySelectorAll(\".input-list__request-fields .mdc-text-field__input\");\n inputField.forEach(i => {\n i.readOnly = false;\n i.disabled = false;\n })\n\n let updatedText = \"\";\n let updatedAction = \"\";\n let icon = \"\";\n\n let isSwapped = false;\n let isNotAvailable = false;\n\n let cmd = el.dataset.action;\n if (cmd == \"swap\") {\n updatedText = \"Unswap\";\n updatedAction = \"unswap\";\n icon = \"mdi:swap-vertical-circle\";\n parent.classList.add(\"input-list__item-swapped\");\n //\n isSwapped = true;\n }\n else if (cmd == \"unswap\") {\n updatedText = \"Swap\";\n updatedAction = \"swap\";\n }\n else if (cmd == \"not_available\") {\n updatedText = \"Available\";\n updatedAction = \"available\";\n icon = \"mdi:minus-circle\";\n //\n parent.classList.add(\"input-list__item-unavailable\");\n let inputLabel = parent.querySelectorAll(\".input-list__request-fields .mdc-text-field\");\n inputLabel.forEach(i => {\n i.classList.add(\"mdc-text-field--disabled\");\n })\n let inputField = parent.querySelectorAll(\".input-list__request-fields .mdc-text-field__input\");\n inputField.forEach(i => {\n i.readOnly = true;\n })\n //\n isNotAvailable = true;\n }\n else if (cmd == \"available\") {\n updatedText = \"Not Available\";\n updatedAction = \"not_available\";\n }\n el.dataset.action = updatedAction;\n textEle.innerText = updatedText;\n\n let iconEl = parent.querySelector(\".iconify-inline\");\n iconEl.dataset.icon = icon;\n\n parent.querySelector(\".swapped_field\").value = isSwapped;\n parent.querySelector(\".not_available_field\").value = isNotAvailable;\n\n calculateTotalPrice();\n });\n\n bidMenu.addEventListener('click', event => {\n event.preventDefault();\n handleMenuSelection = true;\n menu.open = true;\n })\n })\n}\n","document.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n}\n","document.addEventListener('DOMContentLoaded', initFns);\ndocument.addEventListener('turbo:render', initFns);\nfunction initFns(event) {\n document.removeEventListener('DOMContentLoaded', initFns);\n\n $(\".company_logo_input\").change(function(e) {\n var input = this;\n var url = $(this).val();\n var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();\n if (input.files && input.files[0]&& (ext == \"gif\" || ext == \"png\" || ext == \"jpeg\" || ext == \"jpg\")) {\n var reader = new FileReader();\n reader.onload = function (e) {\n $(\".mdc-file-field__avatar-img\").get(0).src = e.target.result;\n $(\".mdc-file-field__avatar-img\").show();\n }\n reader.readAsDataURL(input.files[0]);\n }\n });\n\n $(\".help-and-feedback-button\").click(function(e) {\n e.preventDefault();\n Intercom('show');\n });\n};\n","/*\n * International Telephone Input v17.0.18\n * https://github.com/jackocnr/intl-tel-input.git\n * Licensed under the MIT license\n */\n\n// wrap in UMD\n(function(factory) {\n if (typeof module === \"object\" && module.exports) module.exports = factory(); else window.intlTelInput = factory();\n})(function(undefined) {\n \"use strict\";\n return function() {\n // Array of country objects for the flag dropdown.\n // Here is the criteria for the plugin to support a given country/territory\n // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\n // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes\n // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png\n // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml\n // Each country array has the following information:\n // [\n // Country name,\n // iso2 code,\n // International dial code,\n // Order (if >1 country with same dial code),\n // Area codes\n // ]\n var allCountries = [ [ \"Afghanistan (‫افغانستان‬‎)\", \"af\", \"93\" ], [ \"Albania (Shqipëri)\", \"al\", \"355\" ], [ \"Algeria (‫الجزائر‬‎)\", \"dz\", \"213\" ], [ \"American Samoa\", \"as\", \"1\", 5, [ \"684\" ] ], [ \"Andorra\", \"ad\", \"376\" ], [ \"Angola\", \"ao\", \"244\" ], [ \"Anguilla\", \"ai\", \"1\", 6, [ \"264\" ] ], [ \"Antigua and Barbuda\", \"ag\", \"1\", 7, [ \"268\" ] ], [ \"Argentina\", \"ar\", \"54\" ], [ \"Armenia (Հայաստան)\", \"am\", \"374\" ], [ \"Aruba\", \"aw\", \"297\" ], [ \"Ascension Island\", \"ac\", \"247\" ], [ \"Australia\", \"au\", \"61\", 0 ], [ \"Austria (Österreich)\", \"at\", \"43\" ], [ \"Azerbaijan (Azərbaycan)\", \"az\", \"994\" ], [ \"Bahamas\", \"bs\", \"1\", 8, [ \"242\" ] ], [ \"Bahrain (‫البحرين‬‎)\", \"bh\", \"973\" ], [ \"Bangladesh (বাংলাদেশ)\", \"bd\", \"880\" ], [ \"Barbados\", \"bb\", \"1\", 9, [ \"246\" ] ], [ \"Belarus (Беларусь)\", \"by\", \"375\" ], [ \"Belgium (België)\", \"be\", \"32\" ], [ \"Belize\", \"bz\", \"501\" ], [ \"Benin (Bénin)\", \"bj\", \"229\" ], [ \"Bermuda\", \"bm\", \"1\", 10, [ \"441\" ] ], [ \"Bhutan (འབྲུག)\", \"bt\", \"975\" ], [ \"Bolivia\", \"bo\", \"591\" ], [ \"Bosnia and Herzegovina (Босна и Херцеговина)\", \"ba\", \"387\" ], [ \"Botswana\", \"bw\", \"267\" ], [ \"Brazil (Brasil)\", \"br\", \"55\" ], [ \"British Indian Ocean Territory\", \"io\", \"246\" ], [ \"British Virgin Islands\", \"vg\", \"1\", 11, [ \"284\" ] ], [ \"Brunei\", \"bn\", \"673\" ], [ \"Bulgaria (България)\", \"bg\", \"359\" ], [ \"Burkina Faso\", \"bf\", \"226\" ], [ \"Burundi (Uburundi)\", \"bi\", \"257\" ], [ \"Cambodia (កម្ពុជា)\", \"kh\", \"855\" ], [ \"Cameroon (Cameroun)\", \"cm\", \"237\" ], [ \"Canada\", \"ca\", \"1\", 1, [ \"204\", \"226\", \"236\", \"249\", \"250\", \"289\", \"306\", \"343\", \"365\", \"387\", \"403\", \"416\", \"418\", \"431\", \"437\", \"438\", \"450\", \"506\", \"514\", \"519\", \"548\", \"579\", \"581\", \"587\", \"604\", \"613\", \"639\", \"647\", \"672\", \"705\", \"709\", \"742\", \"778\", \"780\", \"782\", \"807\", \"819\", \"825\", \"867\", \"873\", \"902\", \"905\" ] ], [ \"Cape Verde (Kabu Verdi)\", \"cv\", \"238\" ], [ \"Caribbean Netherlands\", \"bq\", \"599\", 1, [ \"3\", \"4\", \"7\" ] ], [ \"Cayman Islands\", \"ky\", \"1\", 12, [ \"345\" ] ], [ \"Central African Republic (République centrafricaine)\", \"cf\", \"236\" ], [ \"Chad (Tchad)\", \"td\", \"235\" ], [ \"Chile\", \"cl\", \"56\" ], [ \"China (中国)\", \"cn\", \"86\" ], [ \"Christmas Island\", \"cx\", \"61\", 2, [ \"89164\" ] ], [ \"Cocos (Keeling) Islands\", \"cc\", \"61\", 1, [ \"89162\" ] ], [ \"Colombia\", \"co\", \"57\" ], [ \"Comoros (‫جزر القمر‬‎)\", \"km\", \"269\" ], [ \"Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)\", \"cd\", \"243\" ], [ \"Congo (Republic) (Congo-Brazzaville)\", \"cg\", \"242\" ], [ \"Cook Islands\", \"ck\", \"682\" ], [ \"Costa Rica\", \"cr\", \"506\" ], [ \"Côte d’Ivoire\", \"ci\", \"225\" ], [ \"Croatia (Hrvatska)\", \"hr\", \"385\" ], [ \"Cuba\", \"cu\", \"53\" ], [ \"Curaçao\", \"cw\", \"599\", 0 ], [ \"Cyprus (Κύπρος)\", \"cy\", \"357\" ], [ \"Czech Republic (Česká republika)\", \"cz\", \"420\" ], [ \"Denmark (Danmark)\", \"dk\", \"45\" ], [ \"Djibouti\", \"dj\", \"253\" ], [ \"Dominica\", \"dm\", \"1\", 13, [ \"767\" ] ], [ \"Dominican Republic (República Dominicana)\", \"do\", \"1\", 2, [ \"809\", \"829\", \"849\" ] ], [ \"Ecuador\", \"ec\", \"593\" ], [ \"Egypt (‫مصر‬‎)\", \"eg\", \"20\" ], [ \"El Salvador\", \"sv\", \"503\" ], [ \"Equatorial Guinea (Guinea Ecuatorial)\", \"gq\", \"240\" ], [ \"Eritrea\", \"er\", \"291\" ], [ \"Estonia (Eesti)\", \"ee\", \"372\" ], [ \"Eswatini\", \"sz\", \"268\" ], [ \"Ethiopia\", \"et\", \"251\" ], [ \"Falkland Islands (Islas Malvinas)\", \"fk\", \"500\" ], [ \"Faroe Islands (Føroyar)\", \"fo\", \"298\" ], [ \"Fiji\", \"fj\", \"679\" ], [ \"Finland (Suomi)\", \"fi\", \"358\", 0 ], [ \"France\", \"fr\", \"33\" ], [ \"French Guiana (Guyane française)\", \"gf\", \"594\" ], [ \"French Polynesia (Polynésie française)\", \"pf\", \"689\" ], [ \"Gabon\", \"ga\", \"241\" ], [ \"Gambia\", \"gm\", \"220\" ], [ \"Georgia (საქართველო)\", \"ge\", \"995\" ], [ \"Germany (Deutschland)\", \"de\", \"49\" ], [ \"Ghana (Gaana)\", \"gh\", \"233\" ], [ \"Gibraltar\", \"gi\", \"350\" ], [ \"Greece (Ελλάδα)\", \"gr\", \"30\" ], [ \"Greenland (Kalaallit Nunaat)\", \"gl\", \"299\" ], [ \"Grenada\", \"gd\", \"1\", 14, [ \"473\" ] ], [ \"Guadeloupe\", \"gp\", \"590\", 0 ], [ \"Guam\", \"gu\", \"1\", 15, [ \"671\" ] ], [ \"Guatemala\", \"gt\", \"502\" ], [ \"Guernsey\", \"gg\", \"44\", 1, [ \"1481\", \"7781\", \"7839\", \"7911\" ] ], [ \"Guinea (Guinée)\", \"gn\", \"224\" ], [ \"Guinea-Bissau (Guiné Bissau)\", \"gw\", \"245\" ], [ \"Guyana\", \"gy\", \"592\" ], [ \"Haiti\", \"ht\", \"509\" ], [ \"Honduras\", \"hn\", \"504\" ], [ \"Hong Kong (香港)\", \"hk\", \"852\" ], [ \"Hungary (Magyarország)\", \"hu\", \"36\" ], [ \"Iceland (Ísland)\", \"is\", \"354\" ], [ \"India (भारत)\", \"in\", \"91\" ], [ \"Indonesia\", \"id\", \"62\" ], [ \"Iran (‫ایران‬‎)\", \"ir\", \"98\" ], [ \"Iraq (‫العراق‬‎)\", \"iq\", \"964\" ], [ \"Ireland\", \"ie\", \"353\" ], [ \"Isle of Man\", \"im\", \"44\", 2, [ \"1624\", \"74576\", \"7524\", \"7924\", \"7624\" ] ], [ \"Israel (‫ישראל‬‎)\", \"il\", \"972\" ], [ \"Italy (Italia)\", \"it\", \"39\", 0 ], [ \"Jamaica\", \"jm\", \"1\", 4, [ \"876\", \"658\" ] ], [ \"Japan (日本)\", \"jp\", \"81\" ], [ \"Jersey\", \"je\", \"44\", 3, [ \"1534\", \"7509\", \"7700\", \"7797\", \"7829\", \"7937\" ] ], [ \"Jordan (‫الأردن‬‎)\", \"jo\", \"962\" ], [ \"Kazakhstan (Казахстан)\", \"kz\", \"7\", 1, [ \"33\", \"7\" ] ], [ \"Kenya\", \"ke\", \"254\" ], [ \"Kiribati\", \"ki\", \"686\" ], [ \"Kosovo\", \"xk\", \"383\" ], [ \"Kuwait (‫الكويت‬‎)\", \"kw\", \"965\" ], [ \"Kyrgyzstan (Кыргызстан)\", \"kg\", \"996\" ], [ \"Laos (ລາວ)\", \"la\", \"856\" ], [ \"Latvia (Latvija)\", \"lv\", \"371\" ], [ \"Lebanon (‫لبنان‬‎)\", \"lb\", \"961\" ], [ \"Lesotho\", \"ls\", \"266\" ], [ \"Liberia\", \"lr\", \"231\" ], [ \"Libya (‫ليبيا‬‎)\", \"ly\", \"218\" ], [ \"Liechtenstein\", \"li\", \"423\" ], [ \"Lithuania (Lietuva)\", \"lt\", \"370\" ], [ \"Luxembourg\", \"lu\", \"352\" ], [ \"Macau (澳門)\", \"mo\", \"853\" ], [ \"North Macedonia (Македонија)\", \"mk\", \"389\" ], [ \"Madagascar (Madagasikara)\", \"mg\", \"261\" ], [ \"Malawi\", \"mw\", \"265\" ], [ \"Malaysia\", \"my\", \"60\" ], [ \"Maldives\", \"mv\", \"960\" ], [ \"Mali\", \"ml\", \"223\" ], [ \"Malta\", \"mt\", \"356\" ], [ \"Marshall Islands\", \"mh\", \"692\" ], [ \"Martinique\", \"mq\", \"596\" ], [ \"Mauritania (‫موريتانيا‬‎)\", \"mr\", \"222\" ], [ \"Mauritius (Moris)\", \"mu\", \"230\" ], [ \"Mayotte\", \"yt\", \"262\", 1, [ \"269\", \"639\" ] ], [ \"Mexico (México)\", \"mx\", \"52\" ], [ \"Micronesia\", \"fm\", \"691\" ], [ \"Moldova (Republica Moldova)\", \"md\", \"373\" ], [ \"Monaco\", \"mc\", \"377\" ], [ \"Mongolia (Монгол)\", \"mn\", \"976\" ], [ \"Montenegro (Crna Gora)\", \"me\", \"382\" ], [ \"Montserrat\", \"ms\", \"1\", 16, [ \"664\" ] ], [ \"Morocco (‫المغرب‬‎)\", \"ma\", \"212\", 0 ], [ \"Mozambique (Moçambique)\", \"mz\", \"258\" ], [ \"Myanmar (Burma) (မြန်မာ)\", \"mm\", \"95\" ], [ \"Namibia (Namibië)\", \"na\", \"264\" ], [ \"Nauru\", \"nr\", \"674\" ], [ \"Nepal (नेपाल)\", \"np\", \"977\" ], [ \"Netherlands (Nederland)\", \"nl\", \"31\" ], [ \"New Caledonia (Nouvelle-Calédonie)\", \"nc\", \"687\" ], [ \"New Zealand\", \"nz\", \"64\" ], [ \"Nicaragua\", \"ni\", \"505\" ], [ \"Niger (Nijar)\", \"ne\", \"227\" ], [ \"Nigeria\", \"ng\", \"234\" ], [ \"Niue\", \"nu\", \"683\" ], [ \"Norfolk Island\", \"nf\", \"672\" ], [ \"North Korea (조선 민주주의 인민 공화국)\", \"kp\", \"850\" ], [ \"Northern Mariana Islands\", \"mp\", \"1\", 17, [ \"670\" ] ], [ \"Norway (Norge)\", \"no\", \"47\", 0 ], [ \"Oman (‫عُمان‬‎)\", \"om\", \"968\" ], [ \"Pakistan (‫پاکستان‬‎)\", \"pk\", \"92\" ], [ \"Palau\", \"pw\", \"680\" ], [ \"Palestine (‫فلسطين‬‎)\", \"ps\", \"970\" ], [ \"Panama (Panamá)\", \"pa\", \"507\" ], [ \"Papua New Guinea\", \"pg\", \"675\" ], [ \"Paraguay\", \"py\", \"595\" ], [ \"Peru (Perú)\", \"pe\", \"51\" ], [ \"Philippines\", \"ph\", \"63\" ], [ \"Poland (Polska)\", \"pl\", \"48\" ], [ \"Portugal\", \"pt\", \"351\" ], [ \"Puerto Rico\", \"pr\", \"1\", 3, [ \"787\", \"939\" ] ], [ \"Qatar (‫قطر‬‎)\", \"qa\", \"974\" ], [ \"Réunion (La Réunion)\", \"re\", \"262\", 0 ], [ \"Romania (România)\", \"ro\", \"40\" ], [ \"Russia (Россия)\", \"ru\", \"7\", 0 ], [ \"Rwanda\", \"rw\", \"250\" ], [ \"Saint Barthélemy\", \"bl\", \"590\", 1 ], [ \"Saint Helena\", \"sh\", \"290\" ], [ \"Saint Kitts and Nevis\", \"kn\", \"1\", 18, [ \"869\" ] ], [ \"Saint Lucia\", \"lc\", \"1\", 19, [ \"758\" ] ], [ \"Saint Martin (Saint-Martin (partie française))\", \"mf\", \"590\", 2 ], [ \"Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)\", \"pm\", \"508\" ], [ \"Saint Vincent and the Grenadines\", \"vc\", \"1\", 20, [ \"784\" ] ], [ \"Samoa\", \"ws\", \"685\" ], [ \"San Marino\", \"sm\", \"378\" ], [ \"São Tomé and Príncipe (São Tomé e Príncipe)\", \"st\", \"239\" ], [ \"Saudi Arabia (‫المملكة العربية السعودية‬‎)\", \"sa\", \"966\" ], [ \"Senegal (Sénégal)\", \"sn\", \"221\" ], [ \"Serbia (Србија)\", \"rs\", \"381\" ], [ \"Seychelles\", \"sc\", \"248\" ], [ \"Sierra Leone\", \"sl\", \"232\" ], [ \"Singapore\", \"sg\", \"65\" ], [ \"Sint Maarten\", \"sx\", \"1\", 21, [ \"721\" ] ], [ \"Slovakia (Slovensko)\", \"sk\", \"421\" ], [ \"Slovenia (Slovenija)\", \"si\", \"386\" ], [ \"Solomon Islands\", \"sb\", \"677\" ], [ \"Somalia (Soomaaliya)\", \"so\", \"252\" ], [ \"South Africa\", \"za\", \"27\" ], [ \"South Korea (대한민국)\", \"kr\", \"82\" ], [ \"South Sudan (‫جنوب السودان‬‎)\", \"ss\", \"211\" ], [ \"Spain (España)\", \"es\", \"34\" ], [ \"Sri Lanka (ශ්‍රී ලංකාව)\", \"lk\", \"94\" ], [ \"Sudan (‫السودان‬‎)\", \"sd\", \"249\" ], [ \"Suriname\", \"sr\", \"597\" ], [ \"Svalbard and Jan Mayen\", \"sj\", \"47\", 1, [ \"79\" ] ], [ \"Sweden (Sverige)\", \"se\", \"46\" ], [ \"Switzerland (Schweiz)\", \"ch\", \"41\" ], [ \"Syria (‫سوريا‬‎)\", \"sy\", \"963\" ], [ \"Taiwan (台灣)\", \"tw\", \"886\" ], [ \"Tajikistan\", \"tj\", \"992\" ], [ \"Tanzania\", \"tz\", \"255\" ], [ \"Thailand (ไทย)\", \"th\", \"66\" ], [ \"Timor-Leste\", \"tl\", \"670\" ], [ \"Togo\", \"tg\", \"228\" ], [ \"Tokelau\", \"tk\", \"690\" ], [ \"Tonga\", \"to\", \"676\" ], [ \"Trinidad and Tobago\", \"tt\", \"1\", 22, [ \"868\" ] ], [ \"Tunisia (‫تونس‬‎)\", \"tn\", \"216\" ], [ \"Turkey (Türkiye)\", \"tr\", \"90\" ], [ \"Turkmenistan\", \"tm\", \"993\" ], [ \"Turks and Caicos Islands\", \"tc\", \"1\", 23, [ \"649\" ] ], [ \"Tuvalu\", \"tv\", \"688\" ], [ \"U.S. Virgin Islands\", \"vi\", \"1\", 24, [ \"340\" ] ], [ \"Uganda\", \"ug\", \"256\" ], [ \"Ukraine (Україна)\", \"ua\", \"380\" ], [ \"United Arab Emirates (‫الإمارات العربية المتحدة‬‎)\", \"ae\", \"971\" ], [ \"United Kingdom\", \"gb\", \"44\", 0 ], [ \"United States\", \"us\", \"1\", 0 ], [ \"Uruguay\", \"uy\", \"598\" ], [ \"Uzbekistan (Oʻzbekiston)\", \"uz\", \"998\" ], [ \"Vanuatu\", \"vu\", \"678\" ], [ \"Vatican City (Città del Vaticano)\", \"va\", \"39\", 1, [ \"06698\" ] ], [ \"Venezuela\", \"ve\", \"58\" ], [ \"Vietnam (Việt Nam)\", \"vn\", \"84\" ], [ \"Wallis and Futuna (Wallis-et-Futuna)\", \"wf\", \"681\" ], [ \"Western Sahara (‫الصحراء الغربية‬‎)\", \"eh\", \"212\", 1, [ \"5288\", \"5289\" ] ], [ \"Yemen (‫اليمن‬‎)\", \"ye\", \"967\" ], [ \"Zambia\", \"zm\", \"260\" ], [ \"Zimbabwe\", \"zw\", \"263\" ], [ \"Åland Islands\", \"ax\", \"358\", 1, [ \"18\" ] ] ];\n // loop over all of the countries above, restructuring the data to be objects with named keys\n for (var i = 0; i < allCountries.length; i++) {\n var c = allCountries[i];\n allCountries[i] = {\n name: c[0],\n iso2: c[1],\n dialCode: c[2],\n priority: c[3] || 0,\n areaCodes: c[4] || null\n };\n }\n \"use strict\";\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var intlTelInputGlobals = {\n getInstance: function getInstance(input) {\n var id = input.getAttribute(\"data-intl-tel-input-id\");\n return window.intlTelInputGlobals.instances[id];\n },\n instances: {},\n // using a global like this allows us to mock it in the tests\n documentReady: function documentReady() {\n return document.readyState === \"complete\";\n }\n };\n if (typeof window === \"object\") window.intlTelInputGlobals = intlTelInputGlobals;\n // these vars persist through all instances of the plugin\n var id = 0;\n var defaults = {\n // whether or not to allow the dropdown\n allowDropdown: true,\n // if there is just a dial code in the input: remove it on blur\n autoHideDialCode: true,\n // add a placeholder in the input with an example number for the selected country\n autoPlaceholder: \"polite\",\n // modify the parentClass\n customContainer: \"\",\n // modify the auto placeholder\n customPlaceholder: null,\n // append menu to specified element\n dropdownContainer: null,\n // don't display these countries\n excludeCountries: [],\n // format the input value during initialisation and on setNumber\n formatOnDisplay: true,\n // geoIp lookup function\n geoIpLookup: null,\n // inject a hidden input with this name, and on submit, populate it with the result of getNumber\n hiddenInput: \"\",\n // initial country\n initialCountry: \"\",\n // localized country names e.g. { 'de': 'Deutschland' }\n localizedCountries: null,\n // don't insert international dial codes\n nationalMode: true,\n // display only these countries\n onlyCountries: [],\n // number type to use for placeholders\n placeholderNumberType: \"MOBILE\",\n // the countries at the top of the list. defaults to united states and united kingdom\n preferredCountries: [ \"us\", \"gb\" ],\n // display the country dial code next to the selected flag so it's not part of the typed number\n separateDialCode: false,\n // specify the path to the libphonenumber script to enable validation/formatting\n utilsScript: \"\"\n };\n // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes\n var regionlessNanpNumbers = [ \"800\", \"822\", \"833\", \"844\", \"855\", \"866\", \"877\", \"880\", \"881\", \"882\", \"883\", \"884\", \"885\", \"886\", \"887\", \"888\", \"889\" ];\n // utility function to iterate over an object. can't use Object.entries or native forEach because\n // of IE11\n var forEachProp = function forEachProp(obj, callback) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n callback(keys[i], obj[keys[i]]);\n }\n };\n // run a method on each instance of the plugin\n var forEachInstance = function forEachInstance(method) {\n forEachProp(window.intlTelInputGlobals.instances, function(key) {\n window.intlTelInputGlobals.instances[key][method]();\n });\n };\n // this is our plugin class that we will create an instance of\n // eslint-disable-next-line no-unused-vars\n var Iti = /*#__PURE__*/\n function() {\n function Iti(input, options) {\n var _this = this;\n _classCallCheck(this, Iti);\n this.id = id++;\n this.telInput = input;\n this.activeItem = null;\n this.highlightedItem = null;\n // process specified options / defaults\n // alternative to Object.assign, which isn't supported by IE11\n var customOptions = options || {};\n this.options = {};\n forEachProp(defaults, function(key, value) {\n _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;\n });\n this.hadInitialPlaceholder = Boolean(input.getAttribute(\"placeholder\"));\n }\n _createClass(Iti, [ {\n key: \"_init\",\n value: function _init() {\n var _this2 = this;\n // if in nationalMode, disable options relating to dial codes\n if (this.options.nationalMode) this.options.autoHideDialCode = false;\n // if separateDialCode then doesn't make sense to A) insert dial code into input\n // (autoHideDialCode), and B) display national numbers (because we're displaying the country\n // dial code next to them)\n if (this.options.separateDialCode) {\n this.options.autoHideDialCode = this.options.nationalMode = false;\n }\n // we cannot just test screen size as some smartphones/website meta tags will report desktop\n // resolutions\n // Note: for some reason jasmine breaks if you put this in the main Plugin function with the\n // rest of these declarations\n // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'\n this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n if (this.isMobile) {\n // trigger the mobile dropdown css\n document.body.classList.add(\"iti-mobile\");\n // on mobile, we want a full screen dropdown, so we must append it to the body\n if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body;\n }\n // these promises get resolved when their individual requests complete\n // this way the dev can do something like iti.promise.then(...) to know when all requests are\n // complete\n if (typeof Promise !== \"undefined\") {\n var autoCountryPromise = new Promise(function(resolve, reject) {\n _this2.resolveAutoCountryPromise = resolve;\n _this2.rejectAutoCountryPromise = reject;\n });\n var utilsScriptPromise = new Promise(function(resolve, reject) {\n _this2.resolveUtilsScriptPromise = resolve;\n _this2.rejectUtilsScriptPromise = reject;\n });\n this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);\n } else {\n // prevent errors when Promise doesn't exist\n this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};\n this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};\n }\n // in various situations there could be no country selected initially, but we need to be able\n // to assume this variable exists\n this.selectedCountryData = {};\n // process all the data: onlyCountries, excludeCountries, preferredCountries etc\n this._processCountryData();\n // generate the markup\n this._generateMarkup();\n // set the initial state of the input value and the selected flag\n this._setInitialState();\n // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click\n this._initListeners();\n // utils script, and auto country\n this._initRequests();\n }\n }, {\n key: \"_processCountryData\",\n value: function _processCountryData() {\n // process onlyCountries or excludeCountries array if present\n this._processAllCountries();\n // process the countryCodes map\n this._processCountryCodes();\n // process the preferredCountries\n this._processPreferredCountries();\n // translate countries according to localizedCountries option\n if (this.options.localizedCountries) this._translateCountriesByLocale();\n // sort countries by name\n if (this.options.onlyCountries.length || this.options.localizedCountries) {\n this.countries.sort(this._countryNameSort);\n }\n }\n }, {\n key: \"_addCountryCode\",\n value: function _addCountryCode(iso2, countryCode, priority) {\n if (countryCode.length > this.countryCodeMaxLen) {\n this.countryCodeMaxLen = countryCode.length;\n }\n if (!this.countryCodes.hasOwnProperty(countryCode)) {\n this.countryCodes[countryCode] = [];\n }\n // bail if we already have this country for this countryCode\n for (var i = 0; i < this.countryCodes[countryCode].length; i++) {\n if (this.countryCodes[countryCode][i] === iso2) return;\n }\n // check for undefined as 0 is falsy\n var index = priority !== undefined ? priority : this.countryCodes[countryCode].length;\n this.countryCodes[countryCode][index] = iso2;\n }\n }, {\n key: \"_processAllCountries\",\n value: function _processAllCountries() {\n if (this.options.onlyCountries.length) {\n var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function(country) {\n return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;\n });\n } else if (this.options.excludeCountries.length) {\n var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function(country) {\n return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;\n });\n } else {\n this.countries = allCountries;\n }\n }\n }, {\n key: \"_translateCountriesByLocale\",\n value: function _translateCountriesByLocale() {\n for (var i = 0; i < this.countries.length; i++) {\n var iso = this.countries[i].iso2.toLowerCase();\n if (this.options.localizedCountries.hasOwnProperty(iso)) {\n this.countries[i].name = this.options.localizedCountries[iso];\n }\n }\n }\n }, {\n key: \"_countryNameSort\",\n value: function _countryNameSort(a, b) {\n return a.name.localeCompare(b.name);\n }\n }, {\n key: \"_processCountryCodes\",\n value: function _processCountryCodes() {\n this.countryCodeMaxLen = 0;\n // here we store just dial codes\n this.dialCodes = {};\n // here we store \"country codes\" (both dial codes and their area codes)\n this.countryCodes = {};\n // first: add dial codes\n for (var i = 0; i < this.countries.length; i++) {\n var c = this.countries[i];\n if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true;\n this._addCountryCode(c.iso2, c.dialCode, c.priority);\n }\n // next: add area codes\n // this is a second loop over countries, to make sure we have all of the \"root\" countries\n // already in the map, so that we can access them, as each time we add an area code substring\n // to the map, we also need to include the \"root\" country's code, as that also matches\n for (var _i = 0; _i < this.countries.length; _i++) {\n var _c = this.countries[_i];\n // area codes\n if (_c.areaCodes) {\n var rootCountryCode = this.countryCodes[_c.dialCode][0];\n // for each area code\n for (var j = 0; j < _c.areaCodes.length; j++) {\n var areaCode = _c.areaCodes[j];\n // for each digit in the area code to add all partial matches as well\n for (var k = 1; k < areaCode.length; k++) {\n var partialDialCode = _c.dialCode + areaCode.substr(0, k);\n // start with the root country, as that also matches this dial code\n this._addCountryCode(rootCountryCode, partialDialCode);\n this._addCountryCode(_c.iso2, partialDialCode);\n }\n // add the full area code\n this._addCountryCode(_c.iso2, _c.dialCode + areaCode);\n }\n }\n }\n }\n }, {\n key: \"_processPreferredCountries\",\n value: function _processPreferredCountries() {\n this.preferredCountries = [];\n for (var i = 0; i < this.options.preferredCountries.length; i++) {\n var countryCode = this.options.preferredCountries[i].toLowerCase();\n var countryData = this._getCountryData(countryCode, false, true);\n if (countryData) this.preferredCountries.push(countryData);\n }\n }\n }, {\n key: \"_createEl\",\n value: function _createEl(name, attrs, container) {\n var el = document.createElement(name);\n if (attrs) forEachProp(attrs, function(key, value) {\n return el.setAttribute(key, value);\n });\n if (container) container.appendChild(el);\n return el;\n }\n }, {\n key: \"_generateMarkup\",\n value: function _generateMarkup() {\n // if autocomplete does not exist on the element and its form, then\n // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can\n // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the\n // autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode)\n if (!this.telInput.hasAttribute(\"autocomplete\") && !(this.telInput.form && this.telInput.form.hasAttribute(\"autocomplete\"))) {\n this.telInput.setAttribute(\"autocomplete\", \"off\");\n }\n // containers (mostly for positioning)\n var parentClass = \"iti\";\n if (this.options.allowDropdown) parentClass += \" iti--allow-dropdown\";\n if (this.options.separateDialCode) parentClass += \" iti--separate-dial-code\";\n if (this.options.customContainer) {\n parentClass += \" \";\n parentClass += this.options.customContainer;\n }\n var wrapper = this._createEl(\"div\", {\n \"class\": parentClass\n });\n this.telInput.parentNode.insertBefore(wrapper, this.telInput);\n this.flagsContainer = this._createEl(\"div\", {\n \"class\": \"iti__flag-container\"\n }, wrapper);\n wrapper.appendChild(this.telInput);\n // selected flag (displayed to left of input)\n this.selectedFlag = this._createEl(\"div\", {\n \"class\": \"iti__selected-flag\",\n role: \"combobox\",\n \"aria-controls\": \"iti-\".concat(this.id, \"__country-listbox\"),\n \"aria-owns\": \"iti-\".concat(this.id, \"__country-listbox\"),\n \"aria-expanded\": \"false\"\n }, this.flagsContainer);\n this.selectedFlagInner = this._createEl(\"div\", {\n \"class\": \"iti__flag\"\n }, this.selectedFlag);\n if (this.options.separateDialCode) {\n this.selectedDialCode = this._createEl(\"div\", {\n \"class\": \"iti__selected-dial-code\"\n }, this.selectedFlag);\n }\n if (this.options.allowDropdown) {\n // make element focusable and tab navigable\n this.selectedFlag.setAttribute(\"tabindex\", \"0\");\n this.dropdownArrow = this._createEl(\"div\", {\n \"class\": \"iti__arrow\"\n }, this.selectedFlag);\n // country dropdown: preferred countries, then divider, then all countries\n this.countryList = this._createEl(\"ul\", {\n \"class\": \"iti__country-list iti__hide\",\n id: \"iti-\".concat(this.id, \"__country-listbox\"),\n role: \"listbox\",\n \"aria-label\": \"List of countries\"\n });\n if (this.preferredCountries.length) {\n this._appendListItems(this.preferredCountries, \"iti__preferred\", true);\n this._createEl(\"li\", {\n \"class\": \"iti__divider\",\n role: \"separator\",\n \"aria-disabled\": \"true\"\n }, this.countryList);\n }\n this._appendListItems(this.countries, \"iti__standard\");\n // create dropdownContainer markup\n if (this.options.dropdownContainer) {\n this.dropdown = this._createEl(\"div\", {\n \"class\": \"iti iti--container\"\n });\n this.dropdown.appendChild(this.countryList);\n } else {\n this.flagsContainer.appendChild(this.countryList);\n }\n }\n if (this.options.hiddenInput) {\n var hiddenInputName = this.options.hiddenInput;\n var name = this.telInput.getAttribute(\"name\");\n if (name) {\n var i = name.lastIndexOf(\"[\");\n // if input name contains square brackets, then give the hidden input the same name,\n // replacing the contents of the last set of brackets with the given hiddenInput name\n if (i !== -1) hiddenInputName = \"\".concat(name.substr(0, i), \"[\").concat(hiddenInputName, \"]\");\n }\n this.hiddenInput = this._createEl(\"input\", {\n type: \"hidden\",\n name: hiddenInputName\n });\n wrapper.appendChild(this.hiddenInput);\n }\n }\n }, {\n key: \"_appendListItems\",\n value: function _appendListItems(countries, className, preferred) {\n // we create so many DOM elements, it is faster to build a temp string\n // and then add everything to the DOM in one go at the end\n var tmp = \"\";\n // for each country\n for (var i = 0; i < countries.length; i++) {\n var c = countries[i];\n var idSuffix = preferred ? \"-preferred\" : \"\";\n // open the list item\n tmp += \"
  • \");\n // add the flag\n tmp += \"
    \");\n // and the country name and dial code\n tmp += \"\".concat(c.name, \"\");\n tmp += \"+\".concat(c.dialCode, \"\");\n // close the list item\n tmp += \"
  • \";\n }\n this.countryList.insertAdjacentHTML(\"beforeend\", tmp);\n }\n }, {\n key: \"_setInitialState\",\n value: function _setInitialState() {\n // fix firefox bug: when first load page (with input with value set to number with intl dial\n // code) and initialising plugin removes the dial code from the input, then refresh page,\n // and we try to init plugin again but this time on number without dial code so get grey flag\n var attributeValue = this.telInput.getAttribute(\"value\");\n var inputValue = this.telInput.value;\n var useAttribute = attributeValue && attributeValue.charAt(0) === \"+\" && (!inputValue || inputValue.charAt(0) !== \"+\");\n var val = useAttribute ? attributeValue : inputValue;\n var dialCode = this._getDialCode(val);\n var isRegionlessNanp = this._isRegionlessNanp(val);\n var _this$options = this.options, initialCountry = _this$options.initialCountry, nationalMode = _this$options.nationalMode, autoHideDialCode = _this$options.autoHideDialCode, separateDialCode = _this$options.separateDialCode;\n // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the\n // flag, else fall back to the default country\n if (dialCode && !isRegionlessNanp) {\n this._updateFlagFromNumber(val);\n } else if (initialCountry !== \"auto\") {\n // see if we should select a flag\n if (initialCountry) {\n this._setFlag(initialCountry.toLowerCase());\n } else {\n if (dialCode && isRegionlessNanp) {\n // has intl dial code, is regionless nanp, and no initialCountry, so default to US\n this._setFlag(\"us\");\n } else {\n // no dial code and no initialCountry, so default to first in list\n this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;\n if (!val) {\n this._setFlag(this.defaultCountry);\n }\n }\n }\n // if empty and no nationalMode and no autoHideDialCode then insert the default dial code\n if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) {\n this.telInput.value = \"+\".concat(this.selectedCountryData.dialCode);\n }\n }\n // NOTE: if initialCountry is set to auto, that will be handled separately\n // format - note this wont be run after _updateDialCode as that's only called if no val\n if (val) this._updateValFromNumber(val);\n }\n }, {\n key: \"_initListeners\",\n value: function _initListeners() {\n this._initKeyListeners();\n if (this.options.autoHideDialCode) this._initBlurListeners();\n if (this.options.allowDropdown) this._initDropdownListeners();\n if (this.hiddenInput) this._initHiddenInputListener();\n }\n }, {\n key: \"_initHiddenInputListener\",\n value: function _initHiddenInputListener() {\n var _this3 = this;\n this._handleHiddenInputSubmit = function() {\n _this3.hiddenInput.value = _this3.getNumber();\n };\n if (this.telInput.form) this.telInput.form.addEventListener(\"submit\", this._handleHiddenInputSubmit);\n }\n }, {\n key: \"_getClosestLabel\",\n value: function _getClosestLabel() {\n var el = this.telInput;\n while (el && el.tagName !== \"LABEL\") {\n el = el.parentNode;\n }\n return el;\n }\n }, {\n key: \"_initDropdownListeners\",\n value: function _initDropdownListeners() {\n var _this4 = this;\n // hack for input nested inside label (which is valid markup): clicking the selected-flag to\n // open the dropdown would then automatically trigger a 2nd click on the input which would\n // close it again\n this._handleLabelClick = function(e) {\n // if the dropdown is closed, then focus the input, else ignore the click\n if (_this4.countryList.classList.contains(\"iti__hide\")) _this4.telInput.focus(); else e.preventDefault();\n };\n var label = this._getClosestLabel();\n if (label) label.addEventListener(\"click\", this._handleLabelClick);\n // toggle country dropdown on click\n this._handleClickSelectedFlag = function() {\n // only intercept this event if we're opening the dropdown\n // else let it bubble up to the top (\"click-off-to-close\" listener)\n // we cannot just stopPropagation as it may be needed to close another instance\n if (_this4.countryList.classList.contains(\"iti__hide\") && !_this4.telInput.disabled && !_this4.telInput.readOnly) {\n _this4._showDropdown();\n }\n };\n this.selectedFlag.addEventListener(\"click\", this._handleClickSelectedFlag);\n // open dropdown list if currently focused\n this._handleFlagsContainerKeydown = function(e) {\n var isDropdownHidden = _this4.countryList.classList.contains(\"iti__hide\");\n if (isDropdownHidden && [ \"ArrowUp\", \"Up\", \"ArrowDown\", \"Down\", \" \", \"Enter\" ].indexOf(e.key) !== -1) {\n // prevent form from being submitted if \"ENTER\" was pressed\n e.preventDefault();\n // prevent event from being handled again by document\n e.stopPropagation();\n _this4._showDropdown();\n }\n // allow navigation from dropdown to input on TAB\n if (e.key === \"Tab\") _this4._closeDropdown();\n };\n this.flagsContainer.addEventListener(\"keydown\", this._handleFlagsContainerKeydown);\n }\n }, {\n key: \"_initRequests\",\n value: function _initRequests() {\n var _this5 = this;\n // if the user has specified the path to the utils script, fetch it on window.load, else resolve\n if (this.options.utilsScript && !window.intlTelInputUtils) {\n // if the plugin is being initialised after the window.load event has already been fired\n if (window.intlTelInputGlobals.documentReady()) {\n window.intlTelInputGlobals.loadUtils(this.options.utilsScript);\n } else {\n // wait until the load event so we don't block any other requests e.g. the flags image\n window.addEventListener(\"load\", function() {\n window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);\n });\n }\n } else this.resolveUtilsScriptPromise();\n if (this.options.initialCountry === \"auto\") this._loadAutoCountry(); else this.resolveAutoCountryPromise();\n }\n }, {\n key: \"_loadAutoCountry\",\n value: function _loadAutoCountry() {\n // 3 options:\n // 1) already loaded (we're done)\n // 2) not already started loading (start)\n // 3) already started loading (do nothing - just wait for loading callback to fire)\n if (window.intlTelInputGlobals.autoCountry) {\n this.handleAutoCountry();\n } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {\n // don't do this twice!\n window.intlTelInputGlobals.startedLoadingAutoCountry = true;\n if (typeof this.options.geoIpLookup === \"function\") {\n this.options.geoIpLookup(function(countryCode) {\n window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();\n // tell all instances the auto country is ready\n // TODO: this should just be the current instances\n // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight\n // away (e.g. if they have already done the geo ip lookup somewhere else). Using\n // setTimeout means that the current thread of execution will finish before executing\n // this, which allows the plugin to finish initialising.\n setTimeout(function() {\n return forEachInstance(\"handleAutoCountry\");\n });\n }, function() {\n return forEachInstance(\"rejectAutoCountryPromise\");\n });\n }\n }\n }\n }, {\n key: \"_initKeyListeners\",\n value: function _initKeyListeners() {\n var _this6 = this;\n // update flag on keyup\n this._handleKeyupEvent = function() {\n if (_this6._updateFlagFromNumber(_this6.telInput.value)) {\n _this6._triggerCountryChange();\n }\n };\n this.telInput.addEventListener(\"keyup\", this._handleKeyupEvent);\n // update flag on cut/paste events (now supported in all major browsers)\n this._handleClipboardEvent = function() {\n // hack because \"paste\" event is fired before input is updated\n setTimeout(_this6._handleKeyupEvent);\n };\n this.telInput.addEventListener(\"cut\", this._handleClipboardEvent);\n this.telInput.addEventListener(\"paste\", this._handleClipboardEvent);\n }\n }, {\n key: \"_cap\",\n value: function _cap(number) {\n var max = this.telInput.getAttribute(\"maxlength\");\n return max && number.length > max ? number.substr(0, max) : number;\n }\n }, {\n key: \"_initBlurListeners\",\n value: function _initBlurListeners() {\n var _this7 = this;\n // on blur or form submit: if just a dial code then remove it\n this._handleSubmitOrBlurEvent = function() {\n _this7._removeEmptyDialCode();\n };\n if (this.telInput.form) this.telInput.form.addEventListener(\"submit\", this._handleSubmitOrBlurEvent);\n this.telInput.addEventListener(\"blur\", this._handleSubmitOrBlurEvent);\n }\n }, {\n key: \"_removeEmptyDialCode\",\n value: function _removeEmptyDialCode() {\n if (this.telInput.value.charAt(0) === \"+\") {\n var numeric = this._getNumeric(this.telInput.value);\n // if just a plus, or if just a dial code\n if (!numeric || this.selectedCountryData.dialCode === numeric) {\n this.telInput.value = \"\";\n }\n }\n }\n }, {\n key: \"_getNumeric\",\n value: function _getNumeric(s) {\n return s.replace(/\\D/g, \"\");\n }\n }, {\n key: \"_trigger\",\n value: function _trigger(name) {\n // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n // can bubble, and is cancellable\n this.telInput.dispatchEvent(e);\n }\n }, {\n key: \"_showDropdown\",\n value: function _showDropdown() {\n this.countryList.classList.remove(\"iti__hide\");\n this.selectedFlag.setAttribute(\"aria-expanded\", \"true\");\n this._setDropdownPosition();\n // update highlighting and scroll to active list item\n if (this.activeItem) {\n this._highlightListItem(this.activeItem, false);\n this._scrollTo(this.activeItem, true);\n }\n // bind all the dropdown-related listeners: mouseover, click, click-off, keydown\n this._bindDropdownListeners();\n // update the arrow\n this.dropdownArrow.classList.add(\"iti__arrow--up\");\n this._trigger(\"open:countrydropdown\");\n }\n }, {\n key: \"_toggleClass\",\n value: function _toggleClass(el, className, shouldHaveClass) {\n if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className); else if (!shouldHaveClass && el.classList.contains(className)) el.classList.remove(className);\n }\n }, {\n key: \"_setDropdownPosition\",\n value: function _setDropdownPosition() {\n var _this8 = this;\n if (this.options.dropdownContainer) {\n this.options.dropdownContainer.appendChild(this.dropdown);\n }\n if (!this.isMobile) {\n var pos = this.telInput.getBoundingClientRect();\n // windowTop from https://stackoverflow.com/a/14384091/217866\n var windowTop = window.pageYOffset || document.documentElement.scrollTop;\n var inputTop = pos.top + windowTop;\n var dropdownHeight = this.countryList.offsetHeight;\n // dropdownFitsBelow = (dropdownBottom < windowBottom)\n var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;\n var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;\n // by default, the dropdown will be below the input. If we want to position it above the\n // input, we add the dropup class.\n this._toggleClass(this.countryList, \"iti__country-list--dropup\", !dropdownFitsBelow && dropdownFitsAbove);\n // if dropdownContainer is enabled, calculate postion\n if (this.options.dropdownContainer) {\n // by default the dropdown will be directly over the input because it's not in the flow.\n // If we want to position it below, we need to add some extra top value.\n var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight;\n // calculate placement\n this.dropdown.style.top = \"\".concat(inputTop + extraTop, \"px\");\n this.dropdown.style.left = \"\".concat(pos.left + document.body.scrollLeft, \"px\");\n // close menu on window scroll\n this._handleWindowScroll = function() {\n return _this8._closeDropdown();\n };\n window.addEventListener(\"scroll\", this._handleWindowScroll);\n }\n }\n }\n }, {\n key: \"_getClosestListItem\",\n value: function _getClosestListItem(target) {\n var el = target;\n while (el && el !== this.countryList && !el.classList.contains(\"iti__country\")) {\n el = el.parentNode;\n }\n // if we reached the countryList element, then return null\n return el === this.countryList ? null : el;\n }\n }, {\n key: \"_bindDropdownListeners\",\n value: function _bindDropdownListeners() {\n var _this9 = this;\n // when mouse over a list item, just highlight that one\n // we add the class \"highlight\", so if they hit \"enter\" we know which one to select\n this._handleMouseoverCountryList = function(e) {\n // handle event delegation, as we're listening for this event on the countryList\n var listItem = _this9._getClosestListItem(e.target);\n if (listItem) _this9._highlightListItem(listItem, false);\n };\n this.countryList.addEventListener(\"mouseover\", this._handleMouseoverCountryList);\n // listen for country selection\n this._handleClickCountryList = function(e) {\n var listItem = _this9._getClosestListItem(e.target);\n if (listItem) _this9._selectListItem(listItem);\n };\n this.countryList.addEventListener(\"click\", this._handleClickCountryList);\n // click off to close\n // (except when this initial opening click is bubbling up)\n // we cannot just stopPropagation as it may be needed to close another instance\n var isOpening = true;\n this._handleClickOffToClose = function() {\n if (!isOpening) _this9._closeDropdown();\n isOpening = false;\n };\n document.documentElement.addEventListener(\"click\", this._handleClickOffToClose);\n // listen for up/down scrolling, enter to select, or letters to jump to country name.\n // use keydown as keypress doesn't fire for non-char keys and we want to catch if they\n // just hit down and hold it to scroll down (no keyup event).\n // listen on the document because that's where key events are triggered if no input has focus\n var query = \"\";\n var queryTimer = null;\n this._handleKeydownOnDropdown = function(e) {\n // prevent down key from scrolling the whole page,\n // and enter key from submitting a form etc\n e.preventDefault();\n // up and down to navigate\n if (e.key === \"ArrowUp\" || e.key === \"Up\" || e.key === \"ArrowDown\" || e.key === \"Down\") _this9._handleUpDownKey(e.key); else if (e.key === \"Enter\") _this9._handleEnterKey(); else if (e.key === \"Escape\") _this9._closeDropdown(); else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {\n // jump to countries that start with the query string\n if (queryTimer) clearTimeout(queryTimer);\n query += e.key.toLowerCase();\n _this9._searchForCountry(query);\n // if the timer hits 1 second, reset the query\n queryTimer = setTimeout(function() {\n query = \"\";\n }, 1e3);\n }\n };\n document.addEventListener(\"keydown\", this._handleKeydownOnDropdown);\n }\n }, {\n key: \"_handleUpDownKey\",\n value: function _handleUpDownKey(key) {\n var next = key === \"ArrowUp\" || key === \"Up\" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;\n if (next) {\n // skip the divider\n if (next.classList.contains(\"iti__divider\")) {\n next = key === \"ArrowUp\" || key === \"Up\" ? next.previousElementSibling : next.nextElementSibling;\n }\n this._highlightListItem(next, true);\n }\n }\n }, {\n key: \"_handleEnterKey\",\n value: function _handleEnterKey() {\n if (this.highlightedItem) this._selectListItem(this.highlightedItem);\n }\n }, {\n key: \"_searchForCountry\",\n value: function _searchForCountry(query) {\n for (var i = 0; i < this.countries.length; i++) {\n if (this._startsWith(this.countries[i].name, query)) {\n var listItem = this.countryList.querySelector(\"#iti-\".concat(this.id, \"__item-\").concat(this.countries[i].iso2));\n // update highlighting and scroll\n this._highlightListItem(listItem, false);\n this._scrollTo(listItem, true);\n break;\n }\n }\n }\n }, {\n key: \"_startsWith\",\n value: function _startsWith(a, b) {\n return a.substr(0, b.length).toLowerCase() === b;\n }\n }, {\n key: \"_updateValFromNumber\",\n value: function _updateValFromNumber(originalNumber) {\n var number = originalNumber;\n if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {\n var useNational = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) !== \"+\");\n var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;\n var format = useNational ? NATIONAL : INTERNATIONAL;\n number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);\n }\n number = this._beforeSetNumber(number);\n this.telInput.value = number;\n }\n }, {\n key: \"_updateFlagFromNumber\",\n value: function _updateFlagFromNumber(originalNumber) {\n // if we're in nationalMode and we already have US/Canada selected, make sure the number starts\n // with a +1 so _getDialCode will be able to extract the area code\n // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag\n // from the number), that means we're initialising the plugin with a number that already has a\n // dial code, so fine to ignore this bit\n var number = originalNumber;\n var selectedDialCode = this.selectedCountryData.dialCode;\n var isNanp = selectedDialCode === \"1\";\n if (number && this.options.nationalMode && isNanp && number.charAt(0) !== \"+\") {\n if (number.charAt(0) !== \"1\") number = \"1\".concat(number);\n number = \"+\".concat(number);\n }\n // update flag if user types area code for another country\n if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== \"+\") {\n number = \"+\".concat(selectedDialCode).concat(number);\n }\n // try and extract valid dial code from input\n var dialCode = this._getDialCode(number, true);\n var numeric = this._getNumeric(number);\n var countryCode = null;\n if (dialCode) {\n var countryCodes = this.countryCodes[this._getNumeric(dialCode)];\n // check if the right country is already selected. this should be false if the number is\n // longer than the matched dial code because in this case we need to make sure that if\n // there are multiple country matches, that the first one is selected (note: we could\n // just check that here, but it requires the same loop that we already have later)\n var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;\n var isRegionlessNanpNumber = selectedDialCode === \"1\" && this._isRegionlessNanp(numeric);\n // only update the flag if:\n // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)\n // AND\n // B) the right country is not already selected\n if (!isRegionlessNanpNumber && !alreadySelected) {\n // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first\n // non-empty index\n for (var j = 0; j < countryCodes.length; j++) {\n if (countryCodes[j]) {\n countryCode = countryCodes[j];\n break;\n }\n }\n }\n } else if (number.charAt(0) === \"+\" && numeric.length) {\n // invalid dial code, so empty\n // Note: use getNumeric here because the number has not been formatted yet, so could contain\n // bad chars\n countryCode = \"\";\n } else if (!number || number === \"+\") {\n // empty, or just a plus, so default\n countryCode = this.defaultCountry;\n }\n if (countryCode !== null) {\n return this._setFlag(countryCode);\n }\n return false;\n }\n }, {\n key: \"_isRegionlessNanp\",\n value: function _isRegionlessNanp(number) {\n var numeric = this._getNumeric(number);\n if (numeric.charAt(0) === \"1\") {\n var areaCode = numeric.substr(1, 3);\n return regionlessNanpNumbers.indexOf(areaCode) !== -1;\n }\n return false;\n }\n }, {\n key: \"_highlightListItem\",\n value: function _highlightListItem(listItem, shouldFocus) {\n var prevItem = this.highlightedItem;\n if (prevItem) prevItem.classList.remove(\"iti__highlight\");\n this.highlightedItem = listItem;\n this.highlightedItem.classList.add(\"iti__highlight\");\n if (shouldFocus) this.highlightedItem.focus();\n }\n }, {\n key: \"_getCountryData\",\n value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {\n var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;\n for (var i = 0; i < countryList.length; i++) {\n if (countryList[i].iso2 === countryCode) {\n return countryList[i];\n }\n }\n if (allowFail) {\n return null;\n }\n throw new Error(\"No country data for '\".concat(countryCode, \"'\"));\n }\n }, {\n key: \"_setFlag\",\n value: function _setFlag(countryCode) {\n var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};\n // do this first as it will throw an error and stop if countryCode is invalid\n this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};\n // update the defaultCountry - we only need the iso2 from now on, so just store that\n if (this.selectedCountryData.iso2) {\n this.defaultCountry = this.selectedCountryData.iso2;\n }\n this.selectedFlagInner.setAttribute(\"class\", \"iti__flag iti__\".concat(countryCode));\n // update the selected country's title attribute\n var title = countryCode ? \"\".concat(this.selectedCountryData.name, \": +\").concat(this.selectedCountryData.dialCode) : \"Unknown\";\n this.selectedFlag.setAttribute(\"title\", title);\n if (this.options.separateDialCode) {\n var dialCode = this.selectedCountryData.dialCode ? \"+\".concat(this.selectedCountryData.dialCode) : \"\";\n this.selectedDialCode.innerHTML = dialCode;\n // offsetWidth is zero if input is in a hidden container during initialisation\n var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();\n // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css\n this.telInput.style.paddingLeft = \"\".concat(selectedFlagWidth + 6, \"px\");\n }\n // and the input's placeholder\n this._updatePlaceholder();\n // update the active list item\n if (this.options.allowDropdown) {\n var prevItem = this.activeItem;\n if (prevItem) {\n prevItem.classList.remove(\"iti__active\");\n prevItem.setAttribute(\"aria-selected\", \"false\");\n }\n if (countryCode) {\n // check if there is a preferred item first, else fall back to standard\n var nextItem = this.countryList.querySelector(\"#iti-\".concat(this.id, \"__item-\").concat(countryCode, \"-preferred\")) || this.countryList.querySelector(\"#iti-\".concat(this.id, \"__item-\").concat(countryCode));\n nextItem.setAttribute(\"aria-selected\", \"true\");\n nextItem.classList.add(\"iti__active\");\n this.activeItem = nextItem;\n this.selectedFlag.setAttribute(\"aria-activedescendant\", nextItem.getAttribute(\"id\"));\n }\n }\n // return if the flag has changed or not\n return prevCountry.iso2 !== countryCode;\n }\n }, {\n key: \"_getHiddenSelectedFlagWidth\",\n value: function _getHiddenSelectedFlagWidth() {\n // to get the right styling to apply, all we need is a shallow clone of the container,\n // and then to inject a deep clone of the selectedFlag element\n var containerClone = this.telInput.parentNode.cloneNode();\n containerClone.style.visibility = \"hidden\";\n document.body.appendChild(containerClone);\n var flagsContainerClone = this.flagsContainer.cloneNode();\n containerClone.appendChild(flagsContainerClone);\n var selectedFlagClone = this.selectedFlag.cloneNode(true);\n flagsContainerClone.appendChild(selectedFlagClone);\n var width = selectedFlagClone.offsetWidth;\n containerClone.parentNode.removeChild(containerClone);\n return width;\n }\n }, {\n key: \"_updatePlaceholder\",\n value: function _updatePlaceholder() {\n var shouldSetPlaceholder = this.options.autoPlaceholder === \"aggressive\" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === \"polite\";\n if (window.intlTelInputUtils && shouldSetPlaceholder) {\n var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];\n var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : \"\";\n placeholder = this._beforeSetNumber(placeholder);\n if (typeof this.options.customPlaceholder === \"function\") {\n placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);\n }\n this.telInput.setAttribute(\"placeholder\", placeholder);\n }\n }\n }, {\n key: \"_selectListItem\",\n value: function _selectListItem(listItem) {\n // update selected flag and active list item\n var flagChanged = this._setFlag(listItem.getAttribute(\"data-country-code\"));\n this._closeDropdown();\n this._updateDialCode(listItem.getAttribute(\"data-dial-code\"), true);\n // focus the input\n this.telInput.focus();\n // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto\n // inserting dial code), who try to put the cursor at the beginning the first time\n var len = this.telInput.value.length;\n this.telInput.setSelectionRange(len, len);\n if (flagChanged) {\n this._triggerCountryChange();\n }\n }\n }, {\n key: \"_closeDropdown\",\n value: function _closeDropdown() {\n this.countryList.classList.add(\"iti__hide\");\n this.selectedFlag.setAttribute(\"aria-expanded\", \"false\");\n // update the arrow\n this.dropdownArrow.classList.remove(\"iti__arrow--up\");\n // unbind key events\n document.removeEventListener(\"keydown\", this._handleKeydownOnDropdown);\n document.documentElement.removeEventListener(\"click\", this._handleClickOffToClose);\n this.countryList.removeEventListener(\"mouseover\", this._handleMouseoverCountryList);\n this.countryList.removeEventListener(\"click\", this._handleClickCountryList);\n // remove menu from container\n if (this.options.dropdownContainer) {\n if (!this.isMobile) window.removeEventListener(\"scroll\", this._handleWindowScroll);\n if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown);\n }\n this._trigger(\"close:countrydropdown\");\n }\n }, {\n key: \"_scrollTo\",\n value: function _scrollTo(element, middle) {\n var container = this.countryList;\n // windowTop from https://stackoverflow.com/a/14384091/217866\n var windowTop = window.pageYOffset || document.documentElement.scrollTop;\n var containerHeight = container.offsetHeight;\n var containerTop = container.getBoundingClientRect().top + windowTop;\n var containerBottom = containerTop + containerHeight;\n var elementHeight = element.offsetHeight;\n var elementTop = element.getBoundingClientRect().top + windowTop;\n var elementBottom = elementTop + elementHeight;\n var newScrollTop = elementTop - containerTop + container.scrollTop;\n var middleOffset = containerHeight / 2 - elementHeight / 2;\n if (elementTop < containerTop) {\n // scroll up\n if (middle) newScrollTop -= middleOffset;\n container.scrollTop = newScrollTop;\n } else if (elementBottom > containerBottom) {\n // scroll down\n if (middle) newScrollTop += middleOffset;\n var heightDifference = containerHeight - elementHeight;\n container.scrollTop = newScrollTop - heightDifference;\n }\n }\n }, {\n key: \"_updateDialCode\",\n value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) {\n var inputVal = this.telInput.value;\n // save having to pass this every time\n var newDialCode = \"+\".concat(newDialCodeBare);\n var newNumber;\n if (inputVal.charAt(0) === \"+\") {\n // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)\n var prevDialCode = this._getDialCode(inputVal);\n if (prevDialCode) {\n // current number contains a valid dial code, so replace it\n newNumber = inputVal.replace(prevDialCode, newDialCode);\n } else {\n // current number contains an invalid dial code, so ditch it\n // (no way to determine where the invalid dial code ends and the rest of the number begins)\n newNumber = newDialCode;\n }\n } else if (this.options.nationalMode || this.options.separateDialCode) {\n // don't do anything\n return;\n } else {\n // nationalMode is disabled\n if (inputVal) {\n // there is an existing value with no dial code: prefix the new dial code\n newNumber = newDialCode + inputVal;\n } else if (hasSelectedListItem || !this.options.autoHideDialCode) {\n // no existing value and either they've just selected a list item, or autoHideDialCode is\n // disabled: insert new dial code\n newNumber = newDialCode;\n } else {\n return;\n }\n }\n this.telInput.value = newNumber;\n }\n }, {\n key: \"_getDialCode\",\n value: function _getDialCode(number, includeAreaCode) {\n var dialCode = \"\";\n // only interested in international numbers (starting with a plus)\n if (number.charAt(0) === \"+\") {\n var numericChars = \"\";\n // iterate over chars\n for (var i = 0; i < number.length; i++) {\n var c = number.charAt(i);\n // if char is number (https://stackoverflow.com/a/8935649/217866)\n if (!isNaN(parseInt(c, 10))) {\n numericChars += c;\n // if current numericChars make a valid dial code\n if (includeAreaCode) {\n if (this.countryCodes[numericChars]) {\n // store the actual raw string (useful for matching later)\n dialCode = number.substr(0, i + 1);\n }\n } else {\n if (this.dialCodes[numericChars]) {\n dialCode = number.substr(0, i + 1);\n // if we're just looking for a dial code, we can break as soon as we find one\n break;\n }\n }\n // stop searching as soon as we can - in this case when we hit max len\n if (numericChars.length === this.countryCodeMaxLen) {\n break;\n }\n }\n }\n }\n return dialCode;\n }\n }, {\n key: \"_getFullNumber\",\n value: function _getFullNumber() {\n var val = this.telInput.value.trim();\n var dialCode = this.selectedCountryData.dialCode;\n var prefix;\n var numericVal = this._getNumeric(val);\n if (this.options.separateDialCode && val.charAt(0) !== \"+\" && dialCode && numericVal) {\n // when using separateDialCode, it is visible so is effectively part of the typed number\n prefix = \"+\".concat(dialCode);\n } else {\n prefix = \"\";\n }\n return prefix + val;\n }\n }, {\n key: \"_beforeSetNumber\",\n value: function _beforeSetNumber(originalNumber) {\n var number = originalNumber;\n if (this.options.separateDialCode) {\n var dialCode = this._getDialCode(number);\n // if there is a valid dial code\n if (dialCode) {\n // in case _getDialCode returned an area code as well\n dialCode = \"+\".concat(this.selectedCountryData.dialCode);\n // a lot of numbers will have a space separating the dial code and the main number, and\n // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get\n // rid of it\n // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc\n var start = number[dialCode.length] === \" \" || number[dialCode.length] === \"-\" ? dialCode.length + 1 : dialCode.length;\n number = number.substr(start);\n }\n }\n return this._cap(number);\n }\n }, {\n key: \"_triggerCountryChange\",\n value: function _triggerCountryChange() {\n this._trigger(\"countrychange\");\n }\n }, {\n key: \"handleAutoCountry\",\n value: function handleAutoCountry() {\n if (this.options.initialCountry === \"auto\") {\n // we must set this even if there is an initial val in the input: in case the initial val is\n // invalid and they delete it - they should see their auto country\n this.defaultCountry = window.intlTelInputGlobals.autoCountry;\n // if there's no initial value in the input, then update the flag\n if (!this.telInput.value) {\n this.setCountry(this.defaultCountry);\n }\n this.resolveAutoCountryPromise();\n }\n }\n }, {\n key: \"handleUtils\",\n value: function handleUtils() {\n // if the request was successful\n if (window.intlTelInputUtils) {\n // if there's an initial value in the input, then format it\n if (this.telInput.value) {\n this._updateValFromNumber(this.telInput.value);\n }\n this._updatePlaceholder();\n }\n this.resolveUtilsScriptPromise();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n var form = this.telInput.form;\n if (this.options.allowDropdown) {\n // make sure the dropdown is closed (and unbind listeners)\n this._closeDropdown();\n this.selectedFlag.removeEventListener(\"click\", this._handleClickSelectedFlag);\n this.flagsContainer.removeEventListener(\"keydown\", this._handleFlagsContainerKeydown);\n // label click hack\n var label = this._getClosestLabel();\n if (label) label.removeEventListener(\"click\", this._handleLabelClick);\n }\n // unbind hiddenInput listeners\n if (this.hiddenInput && form) form.removeEventListener(\"submit\", this._handleHiddenInputSubmit);\n // unbind autoHideDialCode listeners\n if (this.options.autoHideDialCode) {\n if (form) form.removeEventListener(\"submit\", this._handleSubmitOrBlurEvent);\n this.telInput.removeEventListener(\"blur\", this._handleSubmitOrBlurEvent);\n }\n // unbind key events, and cut/paste events\n this.telInput.removeEventListener(\"keyup\", this._handleKeyupEvent);\n this.telInput.removeEventListener(\"cut\", this._handleClipboardEvent);\n this.telInput.removeEventListener(\"paste\", this._handleClipboardEvent);\n // remove attribute of id instance: data-intl-tel-input-id\n this.telInput.removeAttribute(\"data-intl-tel-input-id\");\n // remove markup (but leave the original input)\n var wrapper = this.telInput.parentNode;\n wrapper.parentNode.insertBefore(this.telInput, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n delete window.intlTelInputGlobals.instances[this.id];\n }\n }, {\n key: \"getExtension\",\n value: function getExtension() {\n if (window.intlTelInputUtils) {\n return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);\n }\n return \"\";\n }\n }, {\n key: \"getNumber\",\n value: function getNumber(format) {\n if (window.intlTelInputUtils) {\n var iso2 = this.selectedCountryData.iso2;\n return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);\n }\n return \"\";\n }\n }, {\n key: \"getNumberType\",\n value: function getNumberType() {\n if (window.intlTelInputUtils) {\n return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);\n }\n return -99;\n }\n }, {\n key: \"getSelectedCountryData\",\n value: function getSelectedCountryData() {\n return this.selectedCountryData;\n }\n }, {\n key: \"getValidationError\",\n value: function getValidationError() {\n if (window.intlTelInputUtils) {\n var iso2 = this.selectedCountryData.iso2;\n return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);\n }\n return -99;\n }\n }, {\n key: \"isValidNumber\",\n value: function isValidNumber() {\n var val = this._getFullNumber().trim();\n var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : \"\";\n return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;\n }\n }, {\n key: \"setCountry\",\n value: function setCountry(originalCountryCode) {\n var countryCode = originalCountryCode.toLowerCase();\n // check if already selected\n if (!this.selectedFlagInner.classList.contains(\"iti__\".concat(countryCode))) {\n this._setFlag(countryCode);\n this._updateDialCode(this.selectedCountryData.dialCode, false);\n this._triggerCountryChange();\n }\n }\n }, {\n key: \"setNumber\",\n value: function setNumber(number) {\n // we must update the flag first, which updates this.selectedCountryData, which is used for\n // formatting the number before displaying it\n var flagChanged = this._updateFlagFromNumber(number);\n this._updateValFromNumber(number);\n if (flagChanged) {\n this._triggerCountryChange();\n }\n }\n }, {\n key: \"setPlaceholderNumberType\",\n value: function setPlaceholderNumberType(type) {\n this.options.placeholderNumberType = type;\n this._updatePlaceholder();\n }\n } ]);\n return Iti;\n }();\n /********************\n * STATIC METHODS\n ********************/\n // get the country data object\n intlTelInputGlobals.getCountryData = function() {\n return allCountries;\n };\n // inject a