{"size": 27599, "ext": "js", "max_stars_repo_path": "node_modules/@angular-mdc/web/esm2015/snackbar.js", "max_stars_repo_name": "Arquisoft/dechat_es2a", "max_stars_repo_stars_event_min_datetime": "2019-03-04T13:33:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-04T13:29:02.000Z", "max_issues_repo_path": "node_modules/@angular-mdc/web/esm2015/snackbar.js", "max_issues_repo_name": "Arquisoft/dechat_es2a", "max_issues_repo_issues_event_min_datetime": "2019-02-15T08:04:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T03:21:50.000Z", "max_forks_repo_path": "node_modules/@angular-mdc/web/esm2015/snackbar.js", "max_forks_repo_name": "Arquisoft/dechat_es2a", "max_forks_repo_forks_event_min_datetime": "2019-04-01T12:27:20.000Z", "max_forks_repo_forks_event_max_datetime": "2020-08-14T13:13:33.000Z"}
{"max_stars_count": 2, "max_issues_count": 29, "max_forks_count": 5, "avg_line_length": 31.6865671642, "max_line_length": 152, "alphanum_fraction": 0.6416174499}
/**
 * @license
 * Copyright (c) 2018 Dominic Carretto
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE
 */
import { Subject } from 'rxjs';
import { Component, ElementRef, EventEmitter, HostBinding, Output, Renderer2, ViewChild, ViewEncapsulation, Injectable, NgModule } from '@angular/core';
import { isBrowser, EventRegistry, MdcPortalService } from '@angular-mdc/web/common';
import { takeUntil } from 'rxjs/operators';

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
/**
 * Reference to a snackbar dispatched from the snackbar service.
 * @template T
 */
class MdcSnackbarRef {
    /**
     * @param {?} component
     */
    constructor(component) {
        /**
         * Subject for notifying the user that the snackbar has been dismissed.
         */
        this._afterDismiss = new Subject();
        /**
         * Subject for notifying the user that the snackbar has opened and appeared.
         */
        this._afterOpen = new Subject();
        this.componentInstance = component;
    }
    /**
     * Gets an observable that is notified when the snackbar is finished closing.
     * @return {?}
     */
    afterDismiss() {
        return this._afterDismiss.asObservable();
    }
    /**
     * Gets an observable that is notified when the snackbar has opened and appeared.
     * @return {?}
     */
    afterOpen() {
        return this._afterOpen.asObservable();
    }
    /**
     * @return {?}
     */
    open() {
        this.componentInstance.show();
        this._afterOpen.next();
        this._afterOpen.complete();
    }
    /**
     * @return {?}
     */
    dismiss() {
        this._afterDismiss.next();
        this._afterDismiss.complete();
    }
}

/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @template A
 */
class MDCFoundation {
  /** @return enum{cssClasses} */
  static get cssClasses() {
    // Classes extending MDCFoundation should implement this method to return an object which exports every
    // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
    return {};
  }

  /** @return enum{strings} */
  static get strings() {
    // Classes extending MDCFoundation should implement this method to return an object which exports all
    // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
    return {};
  }

  /** @return enum{numbers} */
  static get numbers() {
    // Classes extending MDCFoundation should implement this method to return an object which exports all
    // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
    return {};
  }

  /** @return {!Object} */
  static get defaultAdapter() {
    // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
    // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
    // validation.
    return {};
  }

  /**
   * @param {A=} adapter
   */
  constructor(adapter = {}) {
    /** @protected {!A} */
    this.adapter_ = adapter;
  }

  init() {
    // Subclasses should override this method to perform initialization routines (registering events, etc.)
  }

  destroy() {
    // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  }
}

/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const cssClasses = {
  ROOT: 'mdc-snackbar',
  TEXT: 'mdc-snackbar__text',
  ACTION_WRAPPER: 'mdc-snackbar__action-wrapper',
  ACTION_BUTTON: 'mdc-snackbar__action-button',
  ACTIVE: 'mdc-snackbar--active',
  MULTILINE: 'mdc-snackbar--multiline',
  ACTION_ON_BOTTOM: 'mdc-snackbar--action-on-bottom',
};

const strings = {
  TEXT_SELECTOR: '.mdc-snackbar__text',
  ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper',
  ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button',
  SHOW_EVENT: 'MDCSnackbar:show',
  HIDE_EVENT: 'MDCSnackbar:hide',
};

const numbers = {
  MESSAGE_TIMEOUT: 2750,
};

/**
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

class MDCSnackbarFoundation extends MDCFoundation {
  static get cssClasses() {
    return cssClasses;
  }

  static get strings() {
    return strings;
  }

  static get defaultAdapter() {
    return {
      addClass: (/* className: string */) => {},
      removeClass: (/* className: string */) => {},
      setAriaHidden: () => {},
      unsetAriaHidden: () => {},
      setActionAriaHidden: () => {},
      unsetActionAriaHidden: () => {},
      setActionText: (/* actionText: string */) => {},
      setMessageText: (/* message: string */) => {},
      setFocus: () => {},
      visibilityIsHidden: () => /* boolean */ false,
      registerCapturedBlurHandler: (/* handler: EventListener */) => {},
      deregisterCapturedBlurHandler: (/* handler: EventListener */) => {},
      registerVisibilityChangeHandler: (/* handler: EventListener */) => {},
      deregisterVisibilityChangeHandler: (/* handler: EventListener */) => {},
      registerCapturedInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
      deregisterCapturedInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
      registerActionClickHandler: (/* handler: EventListener */) => {},
      deregisterActionClickHandler: (/* handler: EventListener */) => {},
      registerTransitionEndHandler: (/* handler: EventListener */) => {},
      deregisterTransitionEndHandler: (/* handler: EventListener */) => {},
      notifyShow: () => {},
      notifyHide: () => {},
    };
  }

  get active() {
    return this.active_;
  }

  constructor(adapter) {
    super(Object.assign(MDCSnackbarFoundation.defaultAdapter, adapter));

    this.active_ = false;
    this.actionWasClicked_ = false;
    this.dismissOnAction_ = true;
    this.firstFocus_ = true;
    this.pointerDownRecognized_ = false;
    this.snackbarHasFocus_ = false;
    this.snackbarData_ = null;
    this.queue_ = [];
    this.actionClickHandler_ = () => {
      this.actionWasClicked_ = true;
      this.invokeAction_();
    };
    this.visibilitychangeHandler_ = () => {
      clearTimeout(this.timeoutId_);
      this.snackbarHasFocus_ = true;

      if (!this.adapter_.visibilityIsHidden()) {
        setTimeout(this.cleanup_.bind(this), this.snackbarData_.timeout || numbers.MESSAGE_TIMEOUT);
      }
    };
    this.interactionHandler_ = (evt) => {
      if (evt.type == 'touchstart' || evt.type == 'mousedown') {
        this.pointerDownRecognized_ = true;
      }
      this.handlePossibleTabKeyboardFocus_(evt);

      if (evt.type == 'focus') {
        this.pointerDownRecognized_ = false;
      }
    };
    this.blurHandler_ = () => {
      clearTimeout(this.timeoutId_);
      this.snackbarHasFocus_ = false;
      this.timeoutId_ = setTimeout(this.cleanup_.bind(this), this.snackbarData_.timeout || numbers.MESSAGE_TIMEOUT);
    };
  }

  init() {
    this.adapter_.registerActionClickHandler(this.actionClickHandler_);
    this.adapter_.setAriaHidden();
    this.adapter_.setActionAriaHidden();
  }

  destroy() {
    this.adapter_.deregisterActionClickHandler(this.actionClickHandler_);
    this.adapter_.deregisterCapturedBlurHandler(this.blurHandler_);
    this.adapter_.deregisterVisibilityChangeHandler(this.visibilitychangeHandler_);
    ['touchstart', 'mousedown', 'focus'].forEach((evtType) => {
      this.adapter_.deregisterCapturedInteractionHandler(evtType, this.interactionHandler_);
    });
  }

  dismissesOnAction() {
    return this.dismissOnAction_;
  }

  setDismissOnAction(dismissOnAction) {
    this.dismissOnAction_ = !!dismissOnAction;
  }

  show(data) {
    if (!data) {
      throw new Error(
        'Please provide a data object with at least a message to display.');
    }
    if (!data.message) {
      throw new Error('Please provide a message to be displayed.');
    }
    if (data.actionHandler && !data.actionText) {
      throw new Error('Please provide action text with the handler.');
    }
    if (this.active) {
      this.queue_.push(data);
      return;
    }
    clearTimeout(this.timeoutId_);
    this.snackbarData_ = data;
    this.firstFocus_ = true;
    this.adapter_.registerVisibilityChangeHandler(this.visibilitychangeHandler_);
    this.adapter_.registerCapturedBlurHandler(this.blurHandler_);
    ['touchstart', 'mousedown', 'focus'].forEach((evtType) => {
      this.adapter_.registerCapturedInteractionHandler(evtType, this.interactionHandler_);
    });

    const {ACTIVE, MULTILINE, ACTION_ON_BOTTOM} = cssClasses;

    this.adapter_.setMessageText(this.snackbarData_.message);

    if (this.snackbarData_.multiline) {
      this.adapter_.addClass(MULTILINE);
      if (this.snackbarData_.actionOnBottom) {
        this.adapter_.addClass(ACTION_ON_BOTTOM);
      }
    }

    if (this.snackbarData_.actionHandler) {
      this.adapter_.setActionText(this.snackbarData_.actionText);
      this.actionHandler_ = this.snackbarData_.actionHandler;
      this.setActionHidden_(false);
    } else {
      this.setActionHidden_(true);
      this.actionHandler_ = null;
      this.adapter_.setActionText(null);
    }

    this.active_ = true;
    this.adapter_.addClass(ACTIVE);
    this.adapter_.unsetAriaHidden();
    this.adapter_.notifyShow();

    this.timeoutId_ = setTimeout(this.cleanup_.bind(this), this.snackbarData_.timeout || numbers.MESSAGE_TIMEOUT);
  }

  handlePossibleTabKeyboardFocus_() {
    const hijackFocus =
      this.firstFocus_ && !this.pointerDownRecognized_;

    if (hijackFocus) {
      this.setFocusOnAction_();
    }

    this.firstFocus_ = false;
  }

  setFocusOnAction_() {
    this.adapter_.setFocus();
    this.snackbarHasFocus_ = true;
    this.firstFocus_ = false;
  }

  invokeAction_() {
    try {
      if (!this.actionHandler_) {
        return;
      }

      this.actionHandler_();
    } finally {
      if (this.dismissOnAction_) {
        this.cleanup_();
      }
    }
  }

  cleanup_() {
    const allowDismissal = !this.snackbarHasFocus_ || this.actionWasClicked_;

    if (allowDismissal) {
      const {ACTIVE, MULTILINE, ACTION_ON_BOTTOM} = cssClasses;

      this.adapter_.removeClass(ACTIVE);

      const handler = () => {
        clearTimeout(this.timeoutId_);
        this.adapter_.deregisterTransitionEndHandler(handler);
        this.adapter_.removeClass(MULTILINE);
        this.adapter_.removeClass(ACTION_ON_BOTTOM);
        this.setActionHidden_(true);
        this.adapter_.setAriaHidden();
        this.active_ = false;
        this.snackbarHasFocus_ = false;
        this.adapter_.notifyHide();
        this.showNext_();
      };

      this.adapter_.registerTransitionEndHandler(handler);
    }
  }

  showNext_() {
    if (!this.queue_.length) {
      return;
    }
    this.show(this.queue_.shift());
  }

  setActionHidden_(isHidden) {
    if (isHidden) {
      this.adapter_.setActionAriaHidden();
    } else {
      this.adapter_.unsetActionAriaHidden();
    }
  }
}

/**
 * @license
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** @const {Object<string, !VendorPropertyMapType>} */
const eventTypeMap = {
  'animationstart': {
    noPrefix: 'animationstart',
    webkitPrefix: 'webkitAnimationStart',
    styleProperty: 'animation',
  },
  'animationend': {
    noPrefix: 'animationend',
    webkitPrefix: 'webkitAnimationEnd',
    styleProperty: 'animation',
  },
  'animationiteration': {
    noPrefix: 'animationiteration',
    webkitPrefix: 'webkitAnimationIteration',
    styleProperty: 'animation',
  },
  'transitionend': {
    noPrefix: 'transitionend',
    webkitPrefix: 'webkitTransitionEnd',
    styleProperty: 'transition',
  },
};

/** @const {Object<string, !VendorPropertyMapType>} */
const cssPropertyMap = {
  'animation': {
    noPrefix: 'animation',
    webkitPrefix: '-webkit-animation',
  },
  'transform': {
    noPrefix: 'transform',
    webkitPrefix: '-webkit-transform',
  },
  'transition': {
    noPrefix: 'transition',
    webkitPrefix: '-webkit-transition',
  },
};

/**
 * @param {!Object} windowObj
 * @return {boolean}
 */
function hasProperShape(windowObj) {
  return (windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function');
}

/**
 * @param {string} eventType
 * @return {boolean}
 */
function eventFoundInMaps(eventType) {
  return (eventType in eventTypeMap || eventType in cssPropertyMap);
}

/**
 * @param {string} eventType
 * @param {!Object<string, !VendorPropertyMapType>} map
 * @param {!Element} el
 * @return {string}
 */
function getJavaScriptEventName(eventType, map, el) {
  return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}

/**
 * Helper function to determine browser prefix for CSS3 animation events
 * and property names.
 * @param {!Object} windowObj
 * @param {string} eventType
 * @return {string}
 */
function getAnimationName(windowObj, eventType) {
  if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {
    return eventType;
  }

  const map = /** @type {!Object<string, !VendorPropertyMapType>} */ (
    eventType in eventTypeMap ? eventTypeMap : cssPropertyMap
  );
  const el = windowObj['document']['createElement']('div');
  let eventName = '';

  if (map === eventTypeMap) {
    eventName = getJavaScriptEventName(eventType, map, el);
  } else {
    eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
  }

  return eventName;
}

/**
 * @param {!Object} windowObj
 * @param {string} eventType
 * @return {string}
 */
function getCorrectEventName(windowObj, eventType) {
  return getAnimationName(windowObj, eventType);
}

/**
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
class MdcSnackbarComponent {
    /**
     * @param {?} _renderer
     * @param {?} elementRef
     * @param {?} _registry
     */
    constructor(_renderer, elementRef, _registry) {
        this._renderer = _renderer;
        this.elementRef = elementRef;
        this._registry = _registry;
        this.isHostClass = true;
        this.ariaLive = 'assertive';
        this.ariaAtomic = 'true';
        this.ariaHidden = 'true';
        /**
         * Event emitted when the snackbar is shown.
         */
        this.shown = new EventEmitter();
        /**
         * Event emitted when the snackbar is dismissed.
         */
        this.dismissed = new EventEmitter();
        this._mdcAdapter = {
            addClass: (className) => this._renderer.addClass(this._getHostElement(), className),
            removeClass: (className) => this._renderer.removeClass(this._getHostElement(), className),
            setAriaHidden: () => this._renderer.setAttribute(this._getHostElement(), 'aria-hidden', 'true'),
            unsetAriaHidden: () => this._renderer.removeAttribute(this._getHostElement(), 'aria-hidden'),
            setActionAriaHidden: () => {
                if (this.actionButton) {
                    this._renderer.setAttribute(this.actionButton.nativeElement, 'aria-hidden', 'true');
                }
            },
            unsetActionAriaHidden: () => {
                if (this.actionButton) {
                    this._renderer.removeAttribute(this.actionButton.nativeElement, 'aria-hidden');
                }
            },
            setMessageText: (message) => this.snackText.nativeElement.textContent = message,
            setActionText: (actionText) => {
                if (this.actionButton) {
                    this.actionButton.nativeElement.textContent = actionText;
                }
            },
            setFocus: () => this.actionButton.nativeElement.focus(),
            visibilityIsHidden: () => isBrowser() ? document.hidden : false,
            registerCapturedBlurHandler: (handler) => {
                if (this.actionButton) {
                    this._registry.listen('blur', handler, this.actionButton.nativeElement, true);
                }
            },
            deregisterCapturedBlurHandler: (handler) => this._registry.unlisten('blur', handler),
            registerVisibilityChangeHandler: (handler) => {
                if (isBrowser()) {
                    this._registry.listen('visibilitychange', handler, document);
                }
            },
            deregisterVisibilityChangeHandler: (handler) => this._registry.unlisten('visibilitychange', handler),
            registerCapturedInteractionHandler: (evtType, handler) => {
                if (isBrowser()) {
                    this._registry.listen(evtType, handler, document.body, true);
                }
            },
            deregisterCapturedInteractionHandler: (evtType, handler) => this._registry.unlisten(evtType, handler),
            registerActionClickHandler: (handler) => {
                if (this.actionButton) {
                    this._registry.listen('click', handler, this.actionButton.nativeElement);
                }
            },
            deregisterActionClickHandler: (handler) => this._registry.unlisten('click', handler),
            registerTransitionEndHandler: (handler) => {
                if (isBrowser()) {
                    this._registry.listen(getCorrectEventName(window, 'transitionend'), handler, this._getHostElement());
                }
            },
            deregisterTransitionEndHandler: (handler) => {
                if (isBrowser()) {
                    this._registry.unlisten(getCorrectEventName(window, 'transitionend'), handler);
                }
            },
            notifyShow: () => this.shown.emit(),
            notifyHide: () => this.dismissed.emit()
        };
        this._foundation = new MDCSnackbarFoundation(this._mdcAdapter);
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this._foundation.init();
    }
    /**
     * @return {?}
     */
    ngOnDestroy() {
        this._foundation.destroy();
    }
    /**
     * @param {?} dismissOnAction
     * @return {?}
     */
    setDismissOnAction(dismissOnAction) {
        this._foundation.setDismissOnAction(dismissOnAction);
    }
    /**
     * @return {?}
     */
    show() {
        this.setDismissOnAction(this.config.dismissOnAction ? true : false);
        if (this.config.align === 'start') {
            this._mdcAdapter.addClass('mdc-snackbar--align-start');
        }
        if (!this.config.actionHandler && this.data.actionText) {
            this.config.actionHandler = () => { };
        }
        if (!this.data.actionText) {
            this.config.actionHandler = undefined;
        }
        setTimeout(() => {
            this._foundation.show(Object.assign({}, this.data, this.config));
            if (this.config.focusAction) {
                this._mdcAdapter.setFocus();
            }
        }, 40);
    }
    /**
     * Retrieves the DOM element of the component host.
     * @return {?}
     */
    _getHostElement() {
        return this.elementRef.nativeElement;
    }
}
MdcSnackbarComponent.decorators = [
    { type: Component, args: [{selector: 'mdc-snackbar',
                template: `
  <div #text class="mdc-snackbar__text"></div>
  <div class="mdc-snackbar__action-wrapper">
    <button #action type="submit" class="mdc-snackbar__action-button"></button>
  </div>
  `,
                encapsulation: ViewEncapsulation.None,
                providers: [EventRegistry]
            },] },
];
/** @nocollapse */
MdcSnackbarComponent.ctorParameters = () => [
    { type: Renderer2 },
    { type: ElementRef },
    { type: EventRegistry }
];
MdcSnackbarComponent.propDecorators = {
    isHostClass: [{ type: HostBinding, args: ['class.mdc-snackbar',] }],
    ariaLive: [{ type: HostBinding, args: ['attr.aria-live',] }],
    ariaAtomic: [{ type: HostBinding, args: ['attr.aria-atomic',] }],
    ariaHidden: [{ type: HostBinding, args: ['attr.aria-hidden',] }],
    snackText: [{ type: ViewChild, args: ['text',] }],
    actionButton: [{ type: ViewChild, args: ['action',] }],
    shown: [{ type: Output }],
    dismissed: [{ type: Output }]
};

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
class MdcSnackbarConfig {
    constructor() {
        this.timeout = 2750;
        this.multiline = false;
        this.actionOnBottom = false;
        this.align = 'center';
        this.dismissOnAction = true;
        this.focusAction = false;
    }
}

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
class MdcSnackbar {
    /**
     * @param {?} _portalService
     */
    constructor(_portalService) {
        this._portalService = _portalService;
        /**
         * Emits whenever the component is destroyed.
         */
        this._destroy = new Subject();
        this._openedSnackbarRef = null;
    }
    /**
     * @return {?}
     */
    ngOnDestroy() {
        this._destroy.next();
        this._destroy.complete();
        this.dismiss();
    }
    /**
     * Shows a snackbar with a message and an optional action.
     * @param {?} message The message to show in the snackbar.
     * @param {?=} actionText The label for the snackbar action.
     * @param {?=} config Additional configuration options for the snackbar.
     * @return {?}
     */
    show(message, actionText = '', config) {
        if (this.isShowing()) {
            this.dismiss();
        }
        this._openedSnackbarRef
            = new MdcSnackbarRef(this._portalService.createComponentRef(MdcSnackbarComponent).instance);
        this._openedSnackbarRef.componentInstance.data = { message, actionText };
        this._openedSnackbarRef.componentInstance.config = _applyConfigDefaults(config);
        this._snackbarSubscription = this._openedSnackbarRef.componentInstance.dismissed
            .pipe(takeUntil(this._destroy))
            .subscribe(() => {
            this.dismiss();
        });
        this._openedSnackbarRef.open();
        return this._openedSnackbarRef;
    }
    /**
     * @return {?}
     */
    isShowing() {
        return !!this._openedSnackbarRef;
    }
    /**
     * Dismisses the currently-visible snack bar.
     * @return {?}
     */
    dismiss() {
        if (this._openedSnackbarRef) {
            this._openedSnackbarRef.dismiss();
            this._portalService.dispose();
            this._openedSnackbarRef = null;
        }
    }
}
MdcSnackbar.decorators = [
    { type: Injectable },
];
/** @nocollapse */
MdcSnackbar.ctorParameters = () => [
    { type: MdcPortalService }
];
/**
 * Applies default options to the snackbar config.
 * @param {?=} config The configuration to which the defaults will be applied.
 * @return {?} The new configuration object with defaults applied.
 */
function _applyConfigDefaults(config) {
    return Object.assign({}, new MdcSnackbarConfig(), config);
}

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
class MdcSnackbarModule {
}
MdcSnackbarModule.decorators = [
    { type: NgModule, args: [{
                exports: [MdcSnackbarComponent],
                declarations: [MdcSnackbarComponent],
                providers: [MdcSnackbar, MdcPortalService],
                entryComponents: [MdcSnackbarComponent]
            },] },
];

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */

export { MdcSnackbarModule, MdcSnackbarConfig, MdcSnackbarRef, MdcSnackbarComponent, MdcSnackbar };
