/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core"),require("rxjs"),require("@angular/cdk/keycodes"),require("rxjs/operators"),require("@angular/cdk/platform"),require("@angular/cdk/coercion"),require("@angular/cdk/observers")):"function"==typeof define&&define.amd?define("@angular/cdk/a11y",["exports","@angular/common","@angular/core","rxjs","@angular/cdk/keycodes","rxjs/operators","@angular/cdk/platform","@angular/cdk/coercion","@angular/cdk/observers"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.a11y={}),e.ng.common,e.ng.core,e.rxjs,e.ng.cdk.keycodes,e.rxjs.operators,e.ng.cdk.platform,e.ng.cdk.coercion,e.ng.cdk.observers)}(this,function(e,t,n,r,i,o,s,c,u){"use strict";function a(e,t){function n(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t,n){var r=h(e,t);r.some(function(e){return e.trim()==n.trim()})||(r.push(n.trim()),e.setAttribute(t,r.join(F)))}function l(e,t,n){var r=h(e,t),i=r.filter(function(e){return e!=n.trim()});i.length?e.setAttribute(t,i.join(F)):e.removeAttribute(t)}function h(e,t){return(e.getAttribute(t)||"").match(/\S+/g)||[]}function p(e,t){return e||new D(t)}function f(e){try{return e.frameElement}catch(e){return null}}function _(e){return!!(e.offsetWidth||e.offsetHeight||"function"==typeof e.getClientRects&&e.getClientRects().length)}function m(e){var t=e.nodeName.toLowerCase();return"input"===t||"select"===t||"button"===t||"textarea"===t}function b(e){return v(e)&&"hidden"==e.type}function y(e){return g(e)&&e.hasAttribute("href")}function v(e){return"input"==e.nodeName.toLowerCase()}function g(e){return"a"==e.nodeName.toLowerCase()}function I(e){if(!e.hasAttribute("tabindex")||void 0===e.tabIndex)return!1;var t=e.getAttribute("tabindex");return"-32768"!=t&&!(!t||isNaN(parseInt(t,10)))}function E(e){if(!I(e))return null;var t=parseInt(e.getAttribute("tabindex")||"",10);return isNaN(t)?-1:t}function A(e){var t=e.nodeName.toLowerCase(),n="input"===t&&e.type;return"text"===n||"password"===n||"select"===t||"textarea"===t}function T(e){return!b(e)&&(m(e)||y(e)||e.hasAttribute("contenteditable")||I(e))}function k(e){return e.ownerDocument&&e.ownerDocument.defaultView||window}function O(){return null}function C(e,t,n,r){return e||new z(t,r,n)}function w(e,t,n){return e||new X(t,n)}function N(e){return 0===e.buttons}var L=function(e,t){return(L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},F=" ",M=0,R=new Map,x=null,D=function(){function e(e){this._document=e}return e.prototype.describe=function(e,t){this._canBeDescribed(e,t)&&("string"!=typeof t?(this._setMessageId(t),R.set(t,{messageElement:t,referenceCount:0})):R.has(t)||this._createMessageElement(t),this._isElementDescribedByMessage(e,t)||this._addMessageReference(e,t))},e.prototype.removeDescription=function(e,t){if(this._isElementNode(e)){if(this._isElementDescribedByMessage(e,t)&&this._removeMessageReference(e,t),"string"==typeof t){var n=R.get(t);n&&0===n.referenceCount&&this._deleteMessageElement(t)}x&&0===x.childNodes.length&&this._deleteMessagesContainer()}},e.prototype.ngOnDestroy=function(){for(var e=this._document.querySelectorAll("[cdk-describedby-host]"),t=0;t-1&&r!==t._activeItemIndex&&(t._activeItemIndex=r)}})}return e.prototype.skipPredicate=function(e){return this._skipPredicateFn=e,this},e.prototype.withWrap=function(e){return void 0===e&&(e=!0),this._wrap=e,this},e.prototype.withVerticalOrientation=function(e){return void 0===e&&(e=!0),this._vertical=e,this},e.prototype.withHorizontalOrientation=function(e){return this._horizontal=e,this},e.prototype.withAllowedModifierKeys=function(e){return this._allowedModifierKeys=e,this},e.prototype.withTypeAhead=function(e){var t=this;if(void 0===e&&(e=200),this._items.length&&this._items.some(function(e){return"function"!=typeof e.getLabel}))throw Error("ListKeyManager items in typeahead mode must implement the `getLabel` method.");return this._typeaheadSubscription.unsubscribe(),this._typeaheadSubscription=this._letterKeyStream.pipe(o.tap(function(e){return t._pressedLetters.push(e)}),o.debounceTime(e),o.filter(function(){return t._pressedLetters.length>0}),o.map(function(){return t._pressedLetters.join("")})).subscribe(function(e){for(var n=t._getItemsArray(),r=1;r-1});switch(n){case i.TAB:return void this.tabOut.next();case i.DOWN_ARROW:if(this._vertical&&o){this.setNextItemActive();break}return;case i.UP_ARROW:if(this._vertical&&o){this.setPreviousItemActive();break}return;case i.RIGHT_ARROW:if(this._horizontal&&o){"rtl"===this._horizontal?this.setPreviousItemActive():this.setNextItemActive();break}return;case i.LEFT_ARROW:if(this._horizontal&&o){"rtl"===this._horizontal?this.setNextItemActive():this.setPreviousItemActive();break}return;default:return void((o||i.hasModifierKey(e,"shiftKey"))&&(e.key&&1===e.key.length?this._letterKeyStream.next(e.key.toLocaleUpperCase()):(n>=i.A&&n<=i.Z||n>=i.ZERO&&n<=i.NINE)&&this._letterKeyStream.next(String.fromCharCode(n))))}this._pressedLetters=[],e.preventDefault()},Object.defineProperty(e.prototype,"activeItemIndex",{get:function(){return this._activeItemIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this._activeItem},enumerable:!0,configurable:!0}),e.prototype.setFirstItemActive=function(){this._setActiveItemByIndex(0,1)},e.prototype.setLastItemActive=function(){this._setActiveItemByIndex(this._items.length-1,-1)},e.prototype.setNextItemActive=function(){this._activeItemIndex<0?this.setFirstItemActive():this._setActiveItemByDelta(1)},e.prototype.setPreviousItemActive=function(){this._activeItemIndex<0&&this._wrap?this.setLastItemActive():this._setActiveItemByDelta(-1)},e.prototype.updateActiveItem=function(e){var t=this._getItemsArray(),n="number"==typeof e?e:t.indexOf(e),r=t[n];this._activeItem=null==r?null:r,this._activeItemIndex=n},e.prototype.updateActiveItemIndex=function(e){this.updateActiveItem(e)},e.prototype._setActiveItemByDelta=function(e){this._wrap?this._setActiveInWrapMode(e):this._setActiveInDefaultMode(e)},e.prototype._setActiveInWrapMode=function(e){for(var t=this._getItemsArray(),n=1;n<=t.length;n++){var r=(this._activeItemIndex+e*n+t.length)%t.length,i=t[r];if(!this._skipPredicateFn(i))return void this.setActiveItem(r)}},e.prototype._setActiveInDefaultMode=function(e){this._setActiveItemByIndex(this._activeItemIndex+e,e)},e.prototype._setActiveItemByIndex=function(e,t){var n=this._getItemsArray();if(n[e]){for(;this._skipPredicateFn(n[e]);)if(e+=t,!n[e])return;this.setActiveItem(e)}},e.prototype._getItemsArray=function(){return this._items instanceof n.QueryList?this._items.toArray():this._items},e}(),S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.setActiveItem=function(t){this.activeItem&&this.activeItem.setInactiveStyles(),e.prototype.setActiveItem.call(this,t),this.activeItem&&this.activeItem.setActiveStyles()},t}(P),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._origin="program",t}return a(t,e),t.prototype.setFocusOrigin=function(e){return this._origin=e,this},t.prototype.setActiveItem=function(t){e.prototype.setActiveItem.call(this,t),this.activeItem&&this.activeItem.focus(this._origin)},t}(P),K=function(){function e(e){this._platform=e}return e.prototype.isDisabled=function(e){return e.hasAttribute("disabled")},e.prototype.isVisible=function(e){return _(e)&&"visible"===getComputedStyle(e).visibility},e.prototype.isTabbable=function(e){if(!this._platform.isBrowser)return!1;var t=f(k(e));if(t){var n=t&&t.nodeName.toLowerCase();if(-1===E(t))return!1;if((this._platform.BLINK||this._platform.WEBKIT)&&"object"===n)return!1;if((this._platform.BLINK||this._platform.WEBKIT)&&!this.isVisible(t))return!1}var r=e.nodeName.toLowerCase(),i=E(e);if(e.hasAttribute("contenteditable"))return-1!==i;if("iframe"===r)return!1;if("audio"===r){if(!e.hasAttribute("controls"))return!1;if(this._platform.BLINK)return!0}if("video"===r){if(!e.hasAttribute("controls")&&this._platform.TRIDENT)return!1;if(this._platform.BLINK||this._platform.FIREFOX)return!0}return("object"!==r||!this._platform.BLINK&&!this._platform.WEBKIT)&&(!(this._platform.WEBKIT&&this._platform.IOS&&!A(e))&&e.tabIndex>=0)},e.prototype.isFocusable=function(e){return T(e)&&!this.isDisabled(e)&&this.isVisible(e)},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:s.Platform}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(s.Platform))},token:e,providedIn:"root"}),e}(),Z=function(){function e(e,t,n,r,i){var o=this;void 0===i&&(i=!1),this._element=e,this._checker=t,this._ngZone=n,this._document=r,this._hasAttached=!1,this.startAnchorListener=function(){return o.focusLastTabbableElement()},this.endAnchorListener=function(){return o.focusFirstTabbableElement()},this._enabled=!0,i||this.attachAnchors()}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e,this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(e,this._startAnchor),this._toggleAnchorTabIndex(e,this._endAnchor))},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){var e=this._startAnchor,t=this._endAnchor;e&&(e.removeEventListener("focus",this.startAnchorListener),e.parentNode&&e.parentNode.removeChild(e)),t&&(t.removeEventListener("focus",this.endAnchorListener),t.parentNode&&t.parentNode.removeChild(t)),this._startAnchor=this._endAnchor=null},e.prototype.attachAnchors=function(){var e=this;return!!this._hasAttached||(this._ngZone.runOutsideAngular(function(){e._startAnchor||(e._startAnchor=e._createAnchor(),e._startAnchor.addEventListener("focus",e.startAnchorListener)),e._endAnchor||(e._endAnchor=e._createAnchor(),e._endAnchor.addEventListener("focus",e.endAnchorListener))}),this._element.parentNode&&(this._element.parentNode.insertBefore(this._startAnchor,this._element),this._element.parentNode.insertBefore(this._endAnchor,this._element.nextSibling),this._hasAttached=!0),this._hasAttached)},e.prototype.focusInitialElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusInitialElement())})})},e.prototype.focusFirstTabbableElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusFirstTabbableElement())})})},e.prototype.focusLastTabbableElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusLastTabbableElement())})})},e.prototype._getRegionBoundary=function(e){for(var t=this._element.querySelectorAll("[cdk-focus-region-"+e+"], [cdkFocusRegion"+e+"], [cdk-focus-"+e+"]"),n=0;n=0;n--){var r=t[n].nodeType===this._document.ELEMENT_NODE?this._getLastTabbableElement(t[n]):null;if(r)return r}return null},e.prototype._createAnchor=function(){var e=this._document.createElement("div");return this._toggleAnchorTabIndex(this._enabled,e),e.classList.add("cdk-visually-hidden"),e.classList.add("cdk-focus-trap-anchor"),e.setAttribute("aria-hidden","true"),e},e.prototype._toggleAnchorTabIndex=function(e,t){e?t.setAttribute("tabindex","0"):t.removeAttribute("tabindex")},e.prototype._executeOnStable=function(e){this._ngZone.isStable?e():this._ngZone.onStable.asObservable().pipe(o.take(1)).subscribe(e)},e}(),U=function(){function e(e,t,n){this._checker=e,this._ngZone=t,this._document=n}return e.prototype.create=function(e,t){return void 0===t&&(t=!1),new Z(e,this._checker,this._ngZone,this._document,t)},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:K},{type:n.NgZone},{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(K),n.ɵɵinject(n.NgZone),n.ɵɵinject(t.DOCUMENT))},token:e,providedIn:"root"}),e}(),V=function(){function e(e,t,n){this._elementRef=e,this._focusTrapFactory=t,this._previouslyFocusedElement=null,this._document=n,this.focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement,!0)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this.focusTrap.enabled},set:function(e){this.focusTrap.enabled=c.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoCapture",{get:function(){return this._autoCapture},set:function(e){this._autoCapture=c.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this.focusTrap.destroy(),this._previouslyFocusedElement&&(this._previouslyFocusedElement.focus(),this._previouslyFocusedElement=null)},e.prototype.ngAfterContentInit=function(){this.focusTrap.attachAnchors(),this.autoCapture&&(this._previouslyFocusedElement=this._document.activeElement,this.focusTrap.focusInitialElementWhenReady())},e.prototype.ngDoCheck=function(){this.focusTrap.hasAttached()||this.focusTrap.attachAnchors()},e.decorators=[{type:n.Directive,args:[{selector:"[cdkTrapFocus]",exportAs:"cdkTrapFocus"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:U},{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]}]},e.propDecorators={enabled:[{type:n.Input,args:["cdkTrapFocus"]}],autoCapture:[{type:n.Input,args:["cdkTrapFocusAutoCapture"]}]},e}(),W=new n.InjectionToken("liveAnnouncerElement",{providedIn:"root",factory:O}),q=new n.InjectionToken("LIVE_ANNOUNCER_DEFAULT_OPTIONS"),z=function(){function e(e,t,n,r){this._ngZone=t,this._defaultOptions=r,this._document=n,this._liveElement=e||this._createLiveElement()}return e.prototype.announce=function(e){for(var t=this,n=[],r=1;r