{"version":3,"file":"angular-fontawesome.js","sources":["../../../src/lib/config.ts","../../../src/lib/icon-library.ts","../../../src/lib/shared/errors/warn-if-icon-html-missing.ts","../../../src/lib/shared/errors/warn-if-icon-spec-missing.ts","../../../src/lib/shared/utils/classlist.util.ts","../../../src/lib/shared/utils/is-icon-lookup.util.ts","../../../src/lib/shared/utils/normalize-icon-spec.util.ts","../../../src/lib/stack/stack-item-size.directive.ts","../../../src/lib/stack/stack.component.ts","../../../src/lib/icon/icon.component.ts","../../../src/lib/icon/duotone-icon.component.ts","../../../src/lib/shared/errors/warn-if-parent-not-exist.ts","../../../src/lib/layers/layers.component.ts","../../../src/lib/layers/layers-counter.component.ts","../../../src/lib/layers/layers-text.component.ts","../../../src/lib/fontawesome.module.ts","../../../src/lib/angular-fontawesome.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { IconDefinition, IconPrefix } from '@fortawesome/fontawesome-common-types';\nimport { FaIconLibrary } from './icon-library';\n\n@Injectable({ providedIn: 'root' })\nexport class FaConfig {\n /**\n * Default prefix to use, when one is not provided with the icon name.\n *\n * @default 'fas'\n */\n defaultPrefix: IconPrefix = 'fas';\n\n /**\n * Provides a fallback icon to use whilst main icon is being loaded asynchronously.\n * When value is null, then fa-icon component will throw an error if icon input is missing.\n * When value is not null, then the provided icon will be used as a fallback icon if icon input is missing.\n *\n * @default null\n */\n fallbackIcon: IconDefinition = null;\n\n /**\n * Set icons to the same fixed width.\n * @see {@link: https://fontawesome.com/how-to-use/on-the-web/styling/fixed-width-icons}\n * @default false\n */\n fixedWidth?: boolean;\n\n /**\n * Whether components should lookup icon definitions in the global icon\n * library (the one available from\n * `import { library } from '@fortawesome/fontawesome-svg-core')`.\n *\n * See https://github.com/FortAwesome/angular-fontawesome/blob/master/docs/usage/icon-library.md\n * for detailed description of library modes.\n *\n * - 'unset' - Components should lookup icon definitions in the global library\n * and emit warning if they find a definition there. This option is a default\n * to assist existing applications with a migration. Applications are expected\n * to switch to using {@link FaIconLibrary}.\n * - true - Components should lookup icon definitions in the global library.\n * Note that global icon library is deprecated and support for it will be\n * removed. This option can be used to temporarily suppress warnings.\n * - false - Components should not lookup icon definitions in the global\n * library. Library will throw an error if missing icon is found in the global\n * library.\n *\n * @deprecated This option is deprecated since 0.5.0. In 0.6.0 default will\n * be changed to false. In 0.8.0 the option will be removed together with the\n * support for the global icon library.\n *\n * @default false\n */\n globalLibrary: boolean | 'unset' = false;\n}\n","import { Injectable } from '@angular/core';\nimport { IconDefinition, IconName, IconPack, IconPrefix } from '@fortawesome/fontawesome-svg-core';\n\nexport interface FaIconLibraryInterface {\n addIcons(...icons: IconDefinition[]): void;\n addIconPacks(...packs: IconPack[]): void;\n getIconDefinition(prefix: IconPrefix, name: IconName): IconDefinition | null;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class FaIconLibrary implements FaIconLibraryInterface {\n private definitions: { [prefix: string]: { [name: string]: IconDefinition } } = {};\n\n addIcons(...icons: IconDefinition[]) {\n for (const icon of icons) {\n if (!(icon.prefix in this.definitions)) {\n this.definitions[icon.prefix] = {};\n }\n this.definitions[icon.prefix][icon.iconName] = icon;\n }\n }\n\n addIconPacks(...packs: IconPack[]) {\n for (const pack of packs) {\n const icons = Object.keys(pack).map((key) => pack[key]);\n this.addIcons(...icons);\n }\n }\n\n getIconDefinition(prefix: IconPrefix, name: IconName): IconDefinition | null {\n if (prefix in this.definitions && name in this.definitions[prefix]) {\n return this.definitions[prefix][name];\n }\n return null;\n }\n}\n","import { IconLookup } from '@fortawesome/fontawesome-svg-core';\n\nexport const faWarnIfIconDefinitionMissing = (iconSpec: IconLookup) => {\n throw new Error(\n `Could not find icon with iconName=${iconSpec.iconName} and prefix=${iconSpec.prefix} in the icon library.`,\n );\n};\n","export const faWarnIfIconSpecMissing = () => {\n throw new Error('Property `icon` is required for `fa-icon`/`fa-duotone-icon` components.');\n};\n","import { FaProps } from '../models/props.model';\n\n/**\n * Fontawesome class list.\n * Returns classes array by props.\n */\nexport const faClassList = (props: FaProps): string[] => {\n const classes = {\n 'fa-spin': props.spin,\n 'fa-pulse': props.pulse,\n 'fa-fw': props.fixedWidth,\n 'fa-border': props.border,\n 'fa-inverse': props.inverse,\n 'fa-layers-counter': props.counter,\n 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',\n 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both',\n [`fa-${props.size}`]: props.size !== null,\n [`fa-rotate-${props.rotate}`]: props.rotate !== null,\n [`fa-pull-${props.pull}`]: props.pull !== null,\n [`fa-stack-${props.stackItemSize}`]: props.stackItemSize != null,\n };\n\n return Object.keys(classes)\n .map((key) => (classes[key] ? key : null))\n .filter((key) => key);\n};\n","import { IconLookup, IconProp } from '@fortawesome/fontawesome-svg-core';\n\n/**\n * Returns if is IconLookup or not.\n */\nexport const isIconLookup = (i: IconProp): i is IconLookup => {\n return (i as IconLookup).prefix !== undefined && (i as IconLookup).iconName !== undefined;\n};\n","import { IconDefinition, IconLookup, IconPrefix, IconProp } from '@fortawesome/fontawesome-svg-core';\nimport { isIconLookup } from './is-icon-lookup.util';\n\n/**\n * Normalizing icon spec.\n */\nexport const faNormalizeIconSpec = (\n iconSpec: IconProp | IconDefinition,\n defaultPrefix: IconPrefix,\n): IconLookup | IconDefinition => {\n if (isIconLookup(iconSpec)) {\n return iconSpec;\n }\n\n if (Array.isArray(iconSpec) && (iconSpec as string[]).length === 2) {\n return { prefix: iconSpec[0], iconName: iconSpec[1] };\n }\n\n if (typeof iconSpec === 'string') {\n return { prefix: defaultPrefix, iconName: iconSpec };\n }\n};\n","import { Directive, Input, OnChanges, SimpleChanges } from '@angular/core';\nimport { SizeProp } from '@fortawesome/fontawesome-svg-core';\nimport { FaStackComponent } from './stack.component';\n\n@Directive({\n // tslint:disable-next-line:directive-selector\n selector: 'fa-icon[stackItemSize],fa-duotone-icon[stackItemSize]',\n})\nexport class FaStackItemSizeDirective implements OnChanges {\n /**\n * Specify whether icon inside {@link FaStackComponent} should be rendered in\n * regular size (1x) or as a larger icon (2x).\n */\n @Input() stackItemSize: '1x' | '2x' = '1x';\n\n /**\n * @internal\n */\n @Input() size?: SizeProp;\n\n ngOnChanges(changes: SimpleChanges) {\n if ('size' in changes) {\n throw new Error(\n 'fa-icon is not allowed to customize size when used inside fa-stack. ' +\n 'Set size on the enclosing fa-stack instead: ....',\n );\n }\n }\n}\n","import { Component, ElementRef, Input, OnChanges, OnInit, Renderer2, SimpleChanges } from '@angular/core';\nimport { SizeProp } from '@fortawesome/fontawesome-svg-core';\n\n@Component({\n selector: 'fa-stack',\n template: ``,\n})\nexport class FaStackComponent implements OnInit, OnChanges {\n /**\n * Size of the stacked icon.\n * Note that stacked icon is by default 2 times bigger, than non-stacked icon.\n * You'll need to set size using custom CSS to align stacked icon with a\n * simple one. E.g. `fa-stack { font-size: 0.5em; }`.\n */\n @Input() size?: SizeProp;\n\n constructor(private renderer: Renderer2, private elementRef: ElementRef) {}\n\n ngOnInit() {\n this.renderer.addClass(this.elementRef.nativeElement, 'fa-stack');\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if ('size' in changes) {\n if (changes.size.currentValue != null) {\n this.renderer.addClass(this.elementRef.nativeElement, `fa-${changes.size.currentValue}`);\n }\n if (changes.size.previousValue != null) {\n this.renderer.removeClass(this.elementRef.nativeElement, `fa-${changes.size.previousValue}`);\n }\n }\n }\n}\n","import { Component, HostBinding, Input, OnChanges, Optional, SimpleChanges } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport {\n FaSymbol,\n findIconDefinition,\n FlipProp,\n icon,\n IconDefinition,\n IconParams,\n IconProp,\n parse,\n PullProp,\n RotateProp,\n SizeProp,\n Styles,\n Transform,\n} from '@fortawesome/fontawesome-svg-core';\nimport { FaConfig } from '../config';\nimport { FaIconLibrary } from '../icon-library';\nimport { faWarnIfIconDefinitionMissing } from '../shared/errors/warn-if-icon-html-missing';\nimport { faWarnIfIconSpecMissing } from '../shared/errors/warn-if-icon-spec-missing';\nimport { FaProps } from '../shared/models/props.model';\nimport { faClassList } from '../shared/utils/classlist.util';\nimport { faNormalizeIconSpec } from '../shared/utils/normalize-icon-spec.util';\nimport { FaStackItemSizeDirective } from '../stack/stack-item-size.directive';\nimport { FaStackComponent } from '../stack/stack.component';\n\n@Component({\n selector: 'fa-icon',\n template: ``,\n host: {\n class: 'ng-fa-icon',\n '[attr.title]': 'title',\n },\n})\nexport class FaIconComponent implements OnChanges {\n @Input() icon: IconProp;\n\n /**\n * Specify a title for the icon.\n * This text will be displayed in a tooltip on hover and presented to the\n * screen readers.\n */\n @Input() title?: string;\n @Input() spin?: boolean;\n @Input() pulse?: boolean;\n @Input() mask?: IconProp;\n @Input() styles?: Styles;\n @Input() flip?: FlipProp;\n @Input() size?: SizeProp;\n @Input() pull?: PullProp;\n @Input() border?: boolean;\n @Input() inverse?: boolean;\n @Input() symbol?: FaSymbol;\n @Input() rotate?: RotateProp;\n @Input() fixedWidth?: boolean;\n @Input() classes?: string[] = [];\n @Input() transform?: string | Transform;\n\n /**\n * Specify the `role` attribute for the rendered