blob: 2d20bfb7ab0446bee40dbdd9ec3c2086dcb2c825 [file] [log] [blame]
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/material/core"),require("@angular/cdk/coercion"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("@angular/common/http"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("@angular/material/icon",["exports","@angular/core","@angular/material/core","@angular/cdk/coercion","@angular/common","rxjs","rxjs/operators","@angular/common/http","@angular/platform-browser"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.icon={}),t.ng.core,t.ng.material.core,t.ng.cdk.coercion,t.ng.common,t.rxjs,t.rxjs.operators,t.ng.common.http,t.ng.platformBrowser)}(this,(function(t,e,n,r,o,i,s,a,c){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};
/**
* @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 u(t){return Error('Unable to find icon with the name "'+t+'"')}function p(){return Error("Could not find HttpClient provider for use with Angular Material icons. Please include the HttpClientModule from @angular/common/http in your app imports.")}function f(t){return Error("The URL provided to MatIconRegistry was not trusted as a resource URL via Angular's DomSanitizer. Attempted URL was \""+t+'".')}function h(t){return Error("The literal provided to MatIconRegistry was not trusted as safe HTML by Angular's DomSanitizer. Attempted literal was \""+t+'".')}var g=function g(t,e,n){this.url=t,this.svgText=e,this.options=n},m=function(){function t(t,e,n,r){this._httpClient=t,this._sanitizer=e,this._errorHandler=r,this._svgIconConfigs=new Map,this._iconSetConfigs=new Map,this._cachedIconsByUrl=new Map,this._inProgressUrlFetches=new Map,this._fontCssClassesByAlias=new Map,this._resolvers=[],this._defaultFontSetClass="material-icons",this._document=n}return t.prototype.addSvgIcon=function(t,e,n){return this.addSvgIconInNamespace("",t,e,n)},t.prototype.addSvgIconLiteral=function(t,e,n){return this.addSvgIconLiteralInNamespace("",t,e,n)},t.prototype.addSvgIconInNamespace=function(t,e,n,r){return this._addSvgIconConfig(t,e,new g(n,null,r))},t.prototype.addSvgIconResolver=function(t){return this._resolvers.push(t),this},t.prototype.addSvgIconLiteralInNamespace=function(t,n,r,o){var i=this._sanitizer.sanitize(e.SecurityContext.HTML,r);if(!i)throw h(r);return this._addSvgIconConfig(t,n,new g("",i,o))},t.prototype.addSvgIconSet=function(t,e){return this.addSvgIconSetInNamespace("",t,e)},t.prototype.addSvgIconSetLiteral=function(t,e){return this.addSvgIconSetLiteralInNamespace("",t,e)},t.prototype.addSvgIconSetInNamespace=function(t,e,n){return this._addSvgIconSetConfig(t,new g(e,null,n))},t.prototype.addSvgIconSetLiteralInNamespace=function(t,n,r){var o=this._sanitizer.sanitize(e.SecurityContext.HTML,n);if(!o)throw h(n);return this._addSvgIconSetConfig(t,new g("",o,r))},t.prototype.registerFontClassAlias=function(t,e){return void 0===e&&(e=t),this._fontCssClassesByAlias.set(t,e),this},t.prototype.classNameForFontAlias=function(t){return this._fontCssClassesByAlias.get(t)||t},t.prototype.setDefaultFontSetClass=function(t){return this._defaultFontSetClass=t,this},t.prototype.getDefaultFontSetClass=function(){return this._defaultFontSetClass},t.prototype.getSvgIconFromUrl=function(t){var n=this,r=this._sanitizer.sanitize(e.SecurityContext.RESOURCE_URL,t);if(!r)throw f(t);var o=this._cachedIconsByUrl.get(r);return o?i.of(_(o)):this._loadSvgIconFromConfig(new g(t,null)).pipe(s.tap((function(t){return n._cachedIconsByUrl.set(r,t)})),s.map((function(t){return _(t)})))},t.prototype.getNamedSvgIcon=function(t,e){void 0===e&&(e="");var n=y(e,t),r=this._svgIconConfigs.get(n);if(r)return this._getSvgFromConfig(r);if(r=this._getIconConfigFromResolvers(e,t))return this._svgIconConfigs.set(n,r),this._getSvgFromConfig(r);var o=this._iconSetConfigs.get(e);return o?this._getSvgFromIconSetConfigs(t,o):i.throwError(u(n))},t.prototype.ngOnDestroy=function(){this._resolvers=[],this._svgIconConfigs.clear(),this._iconSetConfigs.clear(),this._cachedIconsByUrl.clear()},t.prototype._getSvgFromConfig=function(t){return t.svgText?i.of(_(this._svgElementFromConfig(t))):this._loadSvgIconFromConfig(t).pipe(s.map((function(t){return _(t)})))},t.prototype._getSvgFromIconSetConfigs=function(t,n){var r=this,o=this._extractIconWithNameFromAnySet(t,n);if(o)return i.of(o);var a=n.filter((function(t){return!t.svgText})).map((function(t){return r._loadSvgIconSetFromConfig(t).pipe(s.catchError((function(n){var o=r._sanitizer.sanitize(e.SecurityContext.RESOURCE_URL,t.url);return r._errorHandler.handleError(new Error("Loading icon set URL: "+o+" failed: "+n.message)),i.of(null)})))}));return i.forkJoin(a).pipe(s.map((function(){var e=r._extractIconWithNameFromAnySet(t,n);if(!e)throw u(t);return e})))},t.prototype._extractIconWithNameFromAnySet=function(t,e){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.svgText&&r.svgText.indexOf(t)>-1){var o=this._svgElementFromConfig(r),i=this._extractSvgIconFromSet(o,t,r.options);if(i)return i}}return null},t.prototype._loadSvgIconFromConfig=function(t){var e=this;return this._fetchIcon(t).pipe(s.tap((function(e){return t.svgText=e})),s.map((function(){return e._svgElementFromConfig(t)})))},t.prototype._loadSvgIconSetFromConfig=function(t){return t.svgText?i.of(null):this._fetchIcon(t).pipe(s.tap((function(e){return t.svgText=e})))},t.prototype._extractSvgIconFromSet=function(t,e,n){var r=t.querySelector('[id="'+e+'"]');if(!r)return null;var o=r.cloneNode(!0);if(o.removeAttribute("id"),"svg"===o.nodeName.toLowerCase())return this._setSvgAttributes(o,n);if("symbol"===o.nodeName.toLowerCase())return this._setSvgAttributes(this._toSvgElement(o),n);var i=this._svgElementFromString("<svg></svg>");return i.appendChild(o),this._setSvgAttributes(i,n)},t.prototype._svgElementFromString=function(t){var e=this._document.createElement("DIV");e.innerHTML=t;var n=e.querySelector("svg");if(!n)throw Error("<svg> tag not found");return n},t.prototype._toSvgElement=function(t){for(var e=this._svgElementFromString("<svg></svg>"),n=t.attributes,r=0;r<n.length;r++){var o=n[r],i=o.name;"id"!==i&&e.setAttribute(i,o.value)}for(r=0;r<t.childNodes.length;r++)t.childNodes[r].nodeType===this._document.ELEMENT_NODE&&e.appendChild(t.childNodes[r].cloneNode(!0));return e},t.prototype._setSvgAttributes=function(t,e){return t.setAttribute("fit",""),t.setAttribute("height","100%"),t.setAttribute("width","100%"),t.setAttribute("preserveAspectRatio","xMidYMid meet"),t.setAttribute("focusable","false"),e&&e.viewBox&&t.setAttribute("viewBox",e.viewBox),t},t.prototype._fetchIcon=function(t){var n,r=this,o=t.url,i=t.options,a=null!==(n=null==i?void 0:i.withCredentials)&&void 0!==n&&n;if(!this._httpClient)throw p();if(null==o)throw Error('Cannot fetch icon from URL "'+o+'".');var c=this._sanitizer.sanitize(e.SecurityContext.RESOURCE_URL,o);if(!c)throw f(o);var l=this._inProgressUrlFetches.get(c);if(l)return l;var u=this._httpClient.get(c,{responseType:"text",withCredentials:a}).pipe(s.finalize((function(){return r._inProgressUrlFetches.delete(c)})),s.share());return this._inProgressUrlFetches.set(c,u),u},t.prototype._addSvgIconConfig=function(t,e,n){return this._svgIconConfigs.set(y(t,e),n),this},t.prototype._addSvgIconSetConfig=function(t,e){var n=this._iconSetConfigs.get(t);return n?n.push(e):this._iconSetConfigs.set(t,[e]),this},t.prototype._svgElementFromConfig=function(t){if(!t.svgElement){var e=this._svgElementFromString(t.svgText);this._setSvgAttributes(e,t.options),t.svgElement=e}return t.svgElement},t.prototype._getIconConfigFromResolvers=function(t,e){for(var n=0;n<this._resolvers.length;n++){var r=this._resolvers[n](e,t);if(r)return(o=r).url&&o.options?new g(r.url,null,r.options):new g(r,null)}var o},t}();function d(t,e,n,r,o){return t||new m(e,n,o,r)}mprov=e.ɵɵdefineInjectable({factory:function t(){return new m(e.ɵɵinject(a.HttpClient,8),e.ɵɵinject(c.DomSanitizer),e.ɵɵinject(o.DOCUMENT,8),e.ɵɵinject(e.ErrorHandler))},token:m,providedIn:"root"}),m.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],m.ctorParameters=function(){return[{type:a.HttpClient,decorators:[{type:e.Optional}]},{type:c.DomSanitizer},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[o.DOCUMENT]}]},{type:e.ErrorHandler}]};var v={provide:m,deps:[[new e.Optional,new e.SkipSelf,m],[new e.Optional,a.HttpClient],c.DomSanitizer,e.ErrorHandler,[new e.Optional,o.DOCUMENT]],useFactory:d};function _(t){return t.cloneNode(!0)}function y(t,e){return t+":"+e}var I=n.mixinColor((function S(t){this._elementRef=t})),C=new e.InjectionToken("mat-icon-location",{providedIn:"root",factory:E});function E(){var t=e.inject(o.DOCUMENT),n=t?t.location:null;return{getPathname:function(){return n?n.pathname+n.search:""}}}var F,w=["clip-path","color-profile","src","cursor","fill","filter","marker","marker-start","marker-mid","marker-end","mask","stroke"],b=function(t){return"["+t+"]"},x=w.map(b).join(", "),R=/^url\(['"]?#(.*?)['"]?\)$/,N=function(t){function e(e,n,r,o,s){var a=t.call(this,e)||this;return a._iconRegistry=n,a._location=o,a._errorHandler=s,a._inline=!1,a._currentIconFetch=i.Subscription.EMPTY,r||e.nativeElement.setAttribute("aria-hidden","true"),a}return function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),Object.defineProperty(e.prototype,"inline",{get:function(){return this._inline},set:function(t){this._inline=r.coerceBooleanProperty(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"svgIcon",{get:function(){return this._svgIcon},set:function(t){t!==this._svgIcon&&(t?this._updateSvgIcon(t):this._svgIcon&&this._clearSvgElement(),this._svgIcon=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSet",{get:function(){return this._fontSet},set:function(t){var e=this._cleanupFontValue(t);e!==this._fontSet&&(this._fontSet=e,this._updateFontIconClasses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontIcon",{get:function(){return this._fontIcon},set:function(t){var e=this._cleanupFontValue(t);e!==this._fontIcon&&(this._fontIcon=e,this._updateFontIconClasses())},enumerable:!1,configurable:!0}),e.prototype._splitIconName=function(t){if(!t)return["",""];var e=t.split(":");switch(e.length){case 1:return["",e[0]];case 2:return e;default:throw Error('Invalid icon name: "'+t+'"')}},e.prototype.ngOnInit=function(){this._updateFontIconClasses()},e.prototype.ngAfterViewChecked=function(){var t=this._elementsWithExternalReferences;if(t&&t.size){var e=this._location.getPathname();e!==this._previousPath&&(this._previousPath=e,this._prependPathToReferences(e))}},e.prototype.ngOnDestroy=function(){this._currentIconFetch.unsubscribe(),this._elementsWithExternalReferences&&this._elementsWithExternalReferences.clear()},e.prototype._usingFontIcon=function(){return!this.svgIcon},e.prototype._setSvgElement=function(t){this._clearSvgElement();for(var e=t.querySelectorAll("style"),n=0;n<e.length;n++)e[n].textContent+=" ";var r=this._location.getPathname();this._previousPath=r,this._cacheChildrenWithExternalReferences(t),this._prependPathToReferences(r),this._elementRef.nativeElement.appendChild(t)},e.prototype._clearSvgElement=function(){var t=this._elementRef.nativeElement,e=t.childNodes.length;for(this._elementsWithExternalReferences&&this._elementsWithExternalReferences.clear();e--;){var n=t.childNodes[e];1===n.nodeType&&"svg"!==n.nodeName.toLowerCase()||t.removeChild(n)}},e.prototype._updateFontIconClasses=function(){if(this._usingFontIcon()){var t=this._elementRef.nativeElement,e=this.fontSet?this._iconRegistry.classNameForFontAlias(this.fontSet):this._iconRegistry.getDefaultFontSetClass();e!=this._previousFontSetClass&&(this._previousFontSetClass&&t.classList.remove(this._previousFontSetClass),e&&t.classList.add(e),this._previousFontSetClass=e),this.fontIcon!=this._previousFontIconClass&&(this._previousFontIconClass&&t.classList.remove(this._previousFontIconClass),this.fontIcon&&t.classList.add(this.fontIcon),this._previousFontIconClass=this.fontIcon)}},e.prototype._cleanupFontValue=function(t){return"string"==typeof t?t.trim().split(" ")[0]:t},e.prototype._prependPathToReferences=function(t){var e=this._elementsWithExternalReferences;e&&e.forEach((function(e,n){e.forEach((function(e){n.setAttribute(e.name,"url('"+t+"#"+e.value+"')")}))}))},e.prototype._cacheChildrenWithExternalReferences=function(t){for(var e=t.querySelectorAll(x),n=this._elementsWithExternalReferences=this._elementsWithExternalReferences||new Map,r=function(t){w.forEach((function(r){var o=e[t],i=o.getAttribute(r),s=i?i.match(R):null;if(s){var a=n.get(o);a||n.set(o,a=[]),a.push({name:r,value:s[1]})}}))},o=0;o<e.length;o++)r(o)},e.prototype._updateSvgIcon=function(t){var e=this;if(this._svgNamespace=null,this._svgName=null,this._currentIconFetch.unsubscribe(),t){var n=function r(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}(this._splitIconName(t),2),o=n[0],i=n[1];o&&(this._svgNamespace=o),i&&(this._svgName=i),this._currentIconFetch=this._iconRegistry.getNamedSvgIcon(i,o).pipe(s.take(1)).subscribe((function(t){return e._setSvgElement(t)}),(function(t){e._errorHandler.handleError(new Error("Error retrieving icon "+o+":"+i+"! "+t.message))}))}},e}(I);N.decorators=[{type:e.Component,args:[{template:"<ng-content></ng-content>",selector:"mat-icon",exportAs:"matIcon",inputs:["color"],host:{role:"img",class:"mat-icon notranslate","[attr.data-mat-icon-type]":'_usingFontIcon() ? "font" : "svg"',"[attr.data-mat-icon-name]":"_svgName || fontIcon","[attr.data-mat-icon-namespace]":"_svgNamespace || fontSet","[class.mat-icon-inline]":"inline","[class.mat-icon-no-color]":'color !== "primary" && color !== "accent" && color !== "warn"'},encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".mat-icon{background-repeat:no-repeat;display:inline-block;fill:currentColor;height:24px;width:24px}.mat-icon.mat-icon-inline{font-size:inherit;height:inherit;line-height:inherit;width:inherit}[dir=rtl] .mat-icon-rtl-mirror{transform:scale(-1, 1)}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon{display:block}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon{margin:auto}\n"]}]}],N.ctorParameters=function(){return[{type:e.ElementRef},{type:m},{type:String,decorators:[{type:e.Attribute,args:["aria-hidden"]}]},{type:void 0,decorators:[{type:e.Inject,args:[C]}]},{type:e.ErrorHandler}]},N.propDecorators={inline:[{type:e.Input}],svgIcon:[{type:e.Input}],fontSet:[{type:e.Input}],fontIcon:[{type:e.Input}]},(F=function F(){}).decorators=[{type:e.NgModule,args:[{imports:[n.MatCommonModule],exports:[N,n.MatCommonModule],declarations:[N]}]}],
/**
* @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
*/
t.ICON_REGISTRY_PROVIDER=v,t.ICON_REGISTRY_PROVIDER_FACTORY=d,t.MAT_ICON_LOCATION=C,t.MAT_ICON_LOCATION_FACTORY=E,t.MatIcon=N,t.MatIconModule=F,t.MatIconRegistry=m,t.getMatIconFailedToSanitizeLiteralError=h,t.getMatIconFailedToSanitizeUrlError=f,t.getMatIconNameNotFoundError=u,t.getMatIconNoHttpProviderError=p,t0=b,Object.defineProperty(t,"__esModule",{value:!0})}));