2018-12-07 21:53:43 +00:00
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) {
throw new TypeError ( "Cannot call a class as a function" ) ;
}
}
function _defineProperties ( target , props ) {
for ( var i = 0 ; i < props . length ; i ++ ) {
var descriptor = props [ i ] ;
descriptor . enumerable = descriptor . enumerable || false ;
descriptor . configurable = true ;
if ( "value" in descriptor ) descriptor . writable = true ;
Object . defineProperty ( target , descriptor . key , descriptor ) ;
}
}
function _createClass ( Constructor , protoProps , staticProps ) {
if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ;
if ( staticProps ) _defineProperties ( Constructor , staticProps ) ;
return Constructor ;
}
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
return obj ;
}
function _objectSpread ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] != null ? arguments [ i ] : { } ;
var ownKeys = Object . keys ( source ) ;
if ( typeof Object . getOwnPropertySymbols === 'function' ) {
ownKeys = ownKeys . concat ( Object . getOwnPropertySymbols ( source ) . filter ( function ( sym ) {
return Object . getOwnPropertyDescriptor ( source , sym ) . enumerable ;
} ) ) ;
}
ownKeys . forEach ( function ( key ) {
_defineProperty ( target , key , source [ key ] ) ;
} ) ;
}
return target ;
}
function _slicedToArray ( arr , i ) {
return _arrayWithHoles ( arr ) || _iterableToArrayLimit ( arr , i ) || _nonIterableRest ( ) ;
}
function _toConsumableArray ( arr ) {
return _arrayWithoutHoles ( arr ) || _iterableToArray ( arr ) || _nonIterableSpread ( ) ;
}
function _arrayWithoutHoles ( arr ) {
if ( Array . isArray ( arr ) ) {
for ( var i = 0 , arr2 = new Array ( arr . length ) ; i < arr . length ; i ++ ) arr2 [ i ] = arr [ i ] ;
return arr2 ;
}
}
function _arrayWithHoles ( arr ) {
if ( Array . isArray ( arr ) ) return arr ;
}
function _iterableToArray ( iter ) {
if ( Symbol . iterator in Object ( iter ) || Object . prototype . toString . call ( iter ) === "[object Arguments]" ) return Array . from ( iter ) ;
}
function _iterableToArrayLimit ( arr , i ) {
var _arr = [ ] ;
var _n = true ;
var _d = false ;
var _e = undefined ;
try {
for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) {
_arr . push ( _s . value ) ;
if ( i && _arr . length === i ) break ;
}
} catch ( err ) {
_d = true ;
_e = err ;
} finally {
try {
if ( ! _n && _i [ "return" ] != null ) _i [ "return" ] ( ) ;
} finally {
if ( _d ) throw _e ;
}
}
return _arr ;
}
function _nonIterableSpread ( ) {
throw new TypeError ( "Invalid attempt to spread non-iterable instance" ) ;
}
function _nonIterableRest ( ) {
throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ;
}
2018-06-20 20:12:02 +00:00
var noop = function noop ( ) { } ;
var _WINDOW = { } ;
var _DOCUMENT = { } ;
2018-12-07 21:53:43 +00:00
var _MUTATION _OBSERVER = null ;
var _PERFORMANCE = {
mark : noop ,
measure : noop
} ;
2018-06-20 20:12:02 +00:00
try {
if ( typeof window !== 'undefined' ) _WINDOW = window ;
if ( typeof document !== 'undefined' ) _DOCUMENT = document ;
2018-12-07 21:53:43 +00:00
if ( typeof MutationObserver !== 'undefined' ) _MUTATION _OBSERVER = MutationObserver ;
2018-06-20 20:12:02 +00:00
if ( typeof performance !== 'undefined' ) _PERFORMANCE = performance ;
} catch ( e ) { }
2018-12-07 21:53:43 +00:00
var _ref = _WINDOW . navigator || { } ,
_ref$userAgent = _ref . userAgent ,
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent ;
2018-06-20 20:12:02 +00:00
var WINDOW = _WINDOW ;
var DOCUMENT = _DOCUMENT ;
2018-12-07 21:53:43 +00:00
var MUTATION _OBSERVER = _MUTATION _OBSERVER ;
2018-06-20 20:12:02 +00:00
var PERFORMANCE = _PERFORMANCE ;
2018-12-07 21:53:43 +00:00
var IS _BROWSER = ! ! WINDOW . document ;
2018-06-20 20:12:02 +00:00
var IS _DOM = ! ! DOCUMENT . documentElement && ! ! DOCUMENT . head && typeof DOCUMENT . addEventListener === 'function' && typeof DOCUMENT . createElement === 'function' ;
var IS _IE = ~ userAgent . indexOf ( 'MSIE' ) || ~ userAgent . indexOf ( 'Trident/' ) ;
var NAMESPACE _IDENTIFIER = '___FONT_AWESOME___' ;
var UNITS _IN _GRID = 16 ;
var DEFAULT _FAMILY _PREFIX = 'fa' ;
var DEFAULT _REPLACEMENT _CLASS = 'svg-inline--fa' ;
var DATA _FA _I2SVG = 'data-fa-i2svg' ;
var DATA _FA _PSEUDO _ELEMENT = 'data-fa-pseudo-element' ;
var DATA _PREFIX = 'data-prefix' ;
var DATA _ICON = 'data-icon' ;
var HTML _CLASS _I2SVG _BASE _CLASS = 'fontawesome-i2svg' ;
var TAGNAMES _TO _SKIP _FOR _PSEUDOELEMENTS = [ 'HTML' , 'HEAD' , 'STYLE' , 'SCRIPT' ] ;
var PRODUCTION = function ( ) {
try {
return process . env . NODE _ENV === 'production' ;
} catch ( e ) {
return false ;
}
} ( ) ;
var oneToTen = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
var oneToTwenty = oneToTen . concat ( [ 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 ] ) ;
var ATTRIBUTES _WATCHED _FOR _MUTATION = [ 'class' , 'data-prefix' , 'data-icon' , 'data-fa-transform' , 'data-fa-mask' ] ;
var RESERVED _CLASSES = [ 'xs' , 'sm' , 'lg' , 'fw' , 'ul' , 'li' , 'border' , 'pull-left' , 'pull-right' , 'spin' , 'pulse' , 'rotate-90' , 'rotate-180' , 'rotate-270' , 'flip-horizontal' , 'flip-vertical' , 'stack' , 'stack-1x' , 'stack-2x' , 'inverse' , 'layers' , 'layers-text' , 'layers-counter' ] . concat ( oneToTen . map ( function ( n ) {
2018-12-07 21:53:43 +00:00
return "" . concat ( n , "x" ) ;
2018-06-20 20:12:02 +00:00
} ) ) . concat ( oneToTwenty . map ( function ( n ) {
2018-12-07 21:53:43 +00:00
return "w-" . concat ( n ) ;
2018-06-20 20:12:02 +00:00
} ) ) ;
var initial = WINDOW . FontAwesomeConfig || { } ;
function getAttrConfig ( attr ) {
var element = DOCUMENT . querySelector ( 'script[' + attr + ']' ) ;
if ( element ) {
return element . getAttribute ( attr ) ;
}
}
function coerce ( val ) {
// Getting an empty string will occur if the attribute is set on the HTML tag but without a value
// We'll assume that this is an indication that it should be toggled to true
// For example <script data-search-pseudo-elements src="..."></script>
if ( val === '' ) return true ;
if ( val === 'false' ) return false ;
if ( val === 'true' ) return true ;
return val ;
}
if ( DOCUMENT && typeof DOCUMENT . querySelector === 'function' ) {
var attrs = [ [ 'data-family-prefix' , 'familyPrefix' ] , [ 'data-replacement-class' , 'replacementClass' ] , [ 'data-auto-replace-svg' , 'autoReplaceSvg' ] , [ 'data-auto-add-css' , 'autoAddCss' ] , [ 'data-auto-a11y' , 'autoA11y' ] , [ 'data-search-pseudo-elements' , 'searchPseudoElements' ] , [ 'data-observe-mutations' , 'observeMutations' ] , [ 'data-keep-original-source' , 'keepOriginalSource' ] , [ 'data-measure-performance' , 'measurePerformance' ] , [ 'data-show-missing-icons' , 'showMissingIcons' ] ] ;
attrs . forEach ( function ( _ref ) {
2018-12-07 21:53:43 +00:00
var _ref2 = _slicedToArray ( _ref , 2 ) ,
2018-06-20 20:12:02 +00:00
attr = _ref2 [ 0 ] ,
key = _ref2 [ 1 ] ;
var val = coerce ( getAttrConfig ( attr ) ) ;
if ( val !== undefined && val !== null ) {
initial [ key ] = val ;
}
} ) ;
}
2018-12-07 21:53:43 +00:00
var _default = _objectSpread ( {
2018-06-20 20:12:02 +00:00
familyPrefix : DEFAULT _FAMILY _PREFIX ,
replacementClass : DEFAULT _REPLACEMENT _CLASS ,
autoReplaceSvg : true ,
autoAddCss : true ,
autoA11y : true ,
searchPseudoElements : false ,
observeMutations : true ,
keepOriginalSource : true ,
measurePerformance : false ,
showMissingIcons : true
} , initial ) ;
if ( ! _default . autoReplaceSvg ) _default . observeMutations = false ;
2018-12-07 21:53:43 +00:00
var config = _objectSpread ( { } , _default ) ;
2018-06-20 20:12:02 +00:00
WINDOW . FontAwesomeConfig = config ;
var w = WINDOW || { } ;
if ( ! w [ NAMESPACE _IDENTIFIER ] ) w [ NAMESPACE _IDENTIFIER ] = { } ;
if ( ! w [ NAMESPACE _IDENTIFIER ] . styles ) w [ NAMESPACE _IDENTIFIER ] . styles = { } ;
if ( ! w [ NAMESPACE _IDENTIFIER ] . hooks ) w [ NAMESPACE _IDENTIFIER ] . hooks = { } ;
if ( ! w [ NAMESPACE _IDENTIFIER ] . shims ) w [ NAMESPACE _IDENTIFIER ] . shims = [ ] ;
var namespace = w [ NAMESPACE _IDENTIFIER ] ;
var functions = [ ] ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
var listener = function listener ( ) {
DOCUMENT . removeEventListener ( 'DOMContentLoaded' , listener ) ;
loaded = 1 ;
functions . map ( function ( fn ) {
return fn ( ) ;
} ) ;
} ;
var loaded = false ;
if ( IS _DOM ) {
loaded = ( DOCUMENT . documentElement . doScroll ? /^loaded|^c/ : /^loaded|^i|^c/ ) . test ( DOCUMENT . readyState ) ;
if ( ! loaded ) DOCUMENT . addEventListener ( 'DOMContentLoaded' , listener ) ;
}
2018-12-07 21:53:43 +00:00
function domready ( fn ) {
2018-06-20 20:12:02 +00:00
if ( ! IS _DOM ) return ;
loaded ? setTimeout ( fn , 0 ) : functions . push ( fn ) ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
var d = UNITS _IN _GRID ;
var meaninglessTransform = {
size : 16 ,
x : 0 ,
y : 0 ,
rotate : 0 ,
flipX : false ,
flipY : false
} ;
function isReserved ( name ) {
return ~ RESERVED _CLASSES . indexOf ( name ) ;
}
function insertCss ( css ) {
if ( ! css || ! IS _DOM ) {
return ;
}
var style = DOCUMENT . createElement ( 'style' ) ;
style . setAttribute ( 'type' , 'text/css' ) ;
style . innerHTML = css ;
var headChildren = DOCUMENT . head . childNodes ;
var beforeChild = null ;
for ( var i = headChildren . length - 1 ; i > - 1 ; i -- ) {
var child = headChildren [ i ] ;
var tagName = ( child . tagName || '' ) . toUpperCase ( ) ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
if ( [ 'STYLE' , 'LINK' ] . indexOf ( tagName ) > - 1 ) {
beforeChild = child ;
}
}
DOCUMENT . head . insertBefore ( style , beforeChild ) ;
return css ;
}
2018-10-08 19:40:30 +00:00
var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ;
2018-06-20 20:12:02 +00:00
function nextUniqueId ( ) {
2018-10-08 19:40:30 +00:00
var size = 12 ;
var id = '' ;
2018-12-07 21:53:43 +00:00
2018-10-08 19:40:30 +00:00
while ( size -- > 0 ) {
id += idPool [ Math . random ( ) * 62 | 0 ] ;
}
2018-12-07 21:53:43 +00:00
2018-10-08 19:40:30 +00:00
return id ;
2018-06-20 20:12:02 +00:00
}
function toArray ( obj ) {
var array = [ ] ;
for ( var i = ( obj || [ ] ) . length >>> 0 ; i -- ; ) {
array [ i ] = obj [ i ] ;
}
return array ;
}
function classArray ( node ) {
if ( node . classList ) {
return toArray ( node . classList ) ;
} else {
return ( node . getAttribute ( 'class' ) || '' ) . split ( ' ' ) . filter ( function ( i ) {
return i ;
} ) ;
}
}
function getIconName ( familyPrefix , cls ) {
var parts = cls . split ( '-' ) ;
var prefix = parts [ 0 ] ;
var iconName = parts . slice ( 1 ) . join ( '-' ) ;
if ( prefix === familyPrefix && iconName !== '' && ! isReserved ( iconName ) ) {
return iconName ;
} else {
return null ;
}
}
function htmlEscape ( str ) {
2018-12-07 21:53:43 +00:00
return "" . concat ( str ) . replace ( /&/g , '&' ) . replace ( /"/g , '"' ) . replace ( /'/g , ''' ) . replace ( /</g , '<' ) . replace ( />/g , '>' ) ;
2018-06-20 20:12:02 +00:00
}
function joinAttributes ( attributes ) {
return Object . keys ( attributes || { } ) . reduce ( function ( acc , attributeName ) {
2018-12-07 21:53:43 +00:00
return acc + "" . concat ( attributeName , "=\"" ) . concat ( htmlEscape ( attributes [ attributeName ] ) , "\" " ) ;
2018-06-20 20:12:02 +00:00
} , '' ) . trim ( ) ;
}
function joinStyles ( styles ) {
return Object . keys ( styles || { } ) . reduce ( function ( acc , styleName ) {
2018-12-07 21:53:43 +00:00
return acc + "" . concat ( styleName , ": " ) . concat ( styles [ styleName ] , ";" ) ;
2018-06-20 20:12:02 +00:00
} , '' ) ;
}
function transformIsMeaningful ( transform ) {
return transform . size !== meaninglessTransform . size || transform . x !== meaninglessTransform . x || transform . y !== meaninglessTransform . y || transform . rotate !== meaninglessTransform . rotate || transform . flipX || transform . flipY ;
}
function transformForSvg ( _ref ) {
var transform = _ref . transform ,
containerWidth = _ref . containerWidth ,
iconWidth = _ref . iconWidth ;
var outer = {
2018-12-07 21:53:43 +00:00
transform : "translate(" . concat ( containerWidth / 2 , " 256)" )
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
var innerTranslate = "translate(" . concat ( transform . x * 32 , ", " ) . concat ( transform . y * 32 , ") " ) ;
var innerScale = "scale(" . concat ( transform . size / 16 * ( transform . flipX ? - 1 : 1 ) , ", " ) . concat ( transform . size / 16 * ( transform . flipY ? - 1 : 1 ) , ") " ) ;
var innerRotate = "rotate(" . concat ( transform . rotate , " 0 0)" ) ;
2018-06-20 20:12:02 +00:00
var inner = {
2018-12-07 21:53:43 +00:00
transform : "" . concat ( innerTranslate , " " ) . concat ( innerScale , " " ) . concat ( innerRotate )
2018-06-20 20:12:02 +00:00
} ;
var path = {
2018-12-07 21:53:43 +00:00
transform : "translate(" . concat ( iconWidth / 2 * - 1 , " -256)" )
2018-06-20 20:12:02 +00:00
} ;
return {
outer : outer ,
inner : inner ,
path : path
} ;
}
function transformForCss ( _ref2 ) {
var transform = _ref2 . transform ,
_ref2$width = _ref2 . width ,
2018-12-07 21:53:43 +00:00
width = _ref2$width === void 0 ? UNITS _IN _GRID : _ref2$width ,
2018-06-20 20:12:02 +00:00
_ref2$height = _ref2 . height ,
2018-12-07 21:53:43 +00:00
height = _ref2$height === void 0 ? UNITS _IN _GRID : _ref2$height ,
2018-06-20 20:12:02 +00:00
_ref2$startCentered = _ref2 . startCentered ,
2018-12-07 21:53:43 +00:00
startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered ;
2018-06-20 20:12:02 +00:00
var val = '' ;
if ( startCentered && IS _IE ) {
2018-12-07 21:53:43 +00:00
val += "translate(" . concat ( transform . x / d - width / 2 , "em, " ) . concat ( transform . y / d - height / 2 , "em) " ) ;
2018-06-20 20:12:02 +00:00
} else if ( startCentered ) {
2018-12-07 21:53:43 +00:00
val += "translate(calc(-50% + " . concat ( transform . x / d , "em), calc(-50% + " ) . concat ( transform . y / d , "em)) " ) ;
2018-06-20 20:12:02 +00:00
} else {
2018-12-07 21:53:43 +00:00
val += "translate(" . concat ( transform . x / d , "em, " ) . concat ( transform . y / d , "em) " ) ;
2018-06-20 20:12:02 +00:00
}
2018-12-07 21:53:43 +00:00
val += "scale(" . concat ( transform . size / d * ( transform . flipX ? - 1 : 1 ) , ", " ) . concat ( transform . size / d * ( transform . flipY ? - 1 : 1 ) , ") " ) ;
val += "rotate(" . concat ( transform . rotate , "deg) " ) ;
2018-06-20 20:12:02 +00:00
return val ;
}
var ALL _SPACE = {
x : 0 ,
y : 0 ,
width : '100%' ,
height : '100%'
} ;
2018-12-07 21:53:43 +00:00
function makeIconMasking ( _ref ) {
2018-06-20 20:12:02 +00:00
var children = _ref . children ,
attributes = _ref . attributes ,
main = _ref . main ,
mask = _ref . mask ,
transform = _ref . transform ;
var mainWidth = main . width ,
mainPath = main . icon ;
var maskWidth = mask . width ,
maskPath = mask . icon ;
2018-12-07 21:53:43 +00:00
var trans = transformForSvg ( {
transform : transform ,
containerWidth : maskWidth ,
iconWidth : mainWidth
} ) ;
2018-06-20 20:12:02 +00:00
var maskRect = {
tag : 'rect' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , ALL _SPACE , {
2018-06-20 20:12:02 +00:00
fill : 'white'
} )
} ;
var maskInnerGroup = {
tag : 'g' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , trans . inner ) ,
children : [ {
tag : 'path' ,
attributes : _objectSpread ( { } , mainPath . attributes , trans . path , {
fill : 'black'
} )
} ]
2018-06-20 20:12:02 +00:00
} ;
var maskOuterGroup = {
tag : 'g' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , trans . outer ) ,
2018-06-20 20:12:02 +00:00
children : [ maskInnerGroup ]
} ;
2018-12-07 21:53:43 +00:00
var maskId = "mask-" . concat ( nextUniqueId ( ) ) ;
var clipId = "clip-" . concat ( nextUniqueId ( ) ) ;
2018-06-20 20:12:02 +00:00
var maskTag = {
tag : 'mask' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , ALL _SPACE , {
2018-06-20 20:12:02 +00:00
id : maskId ,
maskUnits : 'userSpaceOnUse' ,
maskContentUnits : 'userSpaceOnUse'
} ) ,
children : [ maskRect , maskOuterGroup ]
} ;
var defs = {
tag : 'defs' ,
2018-12-07 21:53:43 +00:00
children : [ {
tag : 'clipPath' ,
attributes : {
id : clipId
} ,
children : [ maskPath ]
} , maskTag ]
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
children . push ( defs , {
tag : 'rect' ,
attributes : _objectSpread ( {
fill : 'currentColor' ,
'clip-path' : "url(#" . concat ( clipId , ")" ) ,
mask : "url(#" . concat ( maskId , ")" )
} , ALL _SPACE )
} ) ;
2018-06-20 20:12:02 +00:00
return {
children : children ,
attributes : attributes
} ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function makeIconStandard ( _ref ) {
2018-06-20 20:12:02 +00:00
var children = _ref . children ,
attributes = _ref . attributes ,
main = _ref . main ,
transform = _ref . transform ,
styles = _ref . styles ;
var styleString = joinStyles ( styles ) ;
if ( styleString . length > 0 ) {
attributes [ 'style' ] = styleString ;
}
if ( transformIsMeaningful ( transform ) ) {
2018-12-07 21:53:43 +00:00
var trans = transformForSvg ( {
transform : transform ,
containerWidth : main . width ,
iconWidth : main . width
} ) ;
2018-06-20 20:12:02 +00:00
children . push ( {
tag : 'g' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , trans . outer ) ,
2018-06-20 20:12:02 +00:00
children : [ {
tag : 'g' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , trans . inner ) ,
2018-06-20 20:12:02 +00:00
children : [ {
tag : main . icon . tag ,
children : main . icon . children ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , main . icon . attributes , trans . path )
2018-06-20 20:12:02 +00:00
} ]
} ]
} ) ;
} else {
children . push ( main . icon ) ;
}
return {
children : children ,
attributes : attributes
} ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function asIcon ( _ref ) {
2018-06-20 20:12:02 +00:00
var children = _ref . children ,
main = _ref . main ,
mask = _ref . mask ,
attributes = _ref . attributes ,
styles = _ref . styles ,
transform = _ref . transform ;
if ( transformIsMeaningful ( transform ) && main . found && ! mask . found ) {
var width = main . width ,
height = main . height ;
var offset = {
x : width / height / 2 ,
y : 0.5
} ;
2018-12-07 21:53:43 +00:00
attributes [ 'style' ] = joinStyles ( _objectSpread ( { } , styles , {
'transform-origin' : "" . concat ( offset . x + transform . x / 16 , "em " ) . concat ( offset . y + transform . y / 16 , "em" )
2018-06-20 20:12:02 +00:00
} ) ) ;
}
return [ {
tag : 'svg' ,
attributes : attributes ,
children : children
} ] ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function asSymbol ( _ref ) {
2018-06-20 20:12:02 +00:00
var prefix = _ref . prefix ,
iconName = _ref . iconName ,
children = _ref . children ,
attributes = _ref . attributes ,
symbol = _ref . symbol ;
2018-12-07 21:53:43 +00:00
var id = symbol === true ? "" . concat ( prefix , "-" ) . concat ( config . familyPrefix , "-" ) . concat ( iconName ) : symbol ;
2018-06-20 20:12:02 +00:00
return [ {
tag : 'svg' ,
attributes : {
style : 'display: none;'
} ,
children : [ {
tag : 'symbol' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , attributes , {
id : id
} ) ,
2018-06-20 20:12:02 +00:00
children : children
} ]
} ] ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
function makeInlineSvgAbstract ( params ) {
var _params$icons = params . icons ,
main = _params$icons . main ,
mask = _params$icons . mask ,
prefix = params . prefix ,
iconName = params . iconName ,
transform = params . transform ,
symbol = params . symbol ,
title = params . title ,
extra = params . extra ,
_params$watchable = params . watchable ,
2018-12-07 21:53:43 +00:00
watchable = _params$watchable === void 0 ? false : _params$watchable ;
2018-06-20 20:12:02 +00:00
var _ref = mask . found ? mask : main ,
width = _ref . width ,
height = _ref . height ;
2018-12-07 21:53:43 +00:00
var widthClass = "fa-w-" . concat ( Math . ceil ( width / height * 16 ) ) ;
var attrClass = [ config . replacementClass , iconName ? "" . concat ( config . familyPrefix , "-" ) . concat ( iconName ) : '' , widthClass ] . filter ( function ( c ) {
2018-06-20 20:12:02 +00:00
return extra . classes . indexOf ( c ) === - 1 ;
} ) . concat ( extra . classes ) . join ( ' ' ) ;
var content = {
children : [ ] ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , extra . attributes , {
2018-06-20 20:12:02 +00:00
'data-prefix' : prefix ,
'data-icon' : iconName ,
'class' : attrClass ,
'role' : 'img' ,
'xmlns' : 'http://www.w3.org/2000/svg' ,
2018-12-07 21:53:43 +00:00
'viewBox' : "0 0 " . concat ( width , " " ) . concat ( height )
2018-06-20 20:12:02 +00:00
} )
} ;
if ( watchable ) {
content . attributes [ DATA _FA _I2SVG ] = '' ;
}
2018-12-07 21:53:43 +00:00
if ( title ) content . children . push ( {
tag : 'title' ,
attributes : {
id : content . attributes [ 'aria-labelledby' ] || "title-" . concat ( nextUniqueId ( ) )
} ,
children : [ title ]
} ) ;
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
var args = _objectSpread ( { } , content , {
2018-06-20 20:12:02 +00:00
prefix : prefix ,
iconName : iconName ,
main : main ,
mask : mask ,
transform : transform ,
symbol : symbol ,
styles : extra . styles
} ) ;
var _ref2 = mask . found && main . found ? makeIconMasking ( args ) : makeIconStandard ( args ) ,
children = _ref2 . children ,
attributes = _ref2 . attributes ;
args . children = children ;
args . attributes = attributes ;
if ( symbol ) {
return asSymbol ( args ) ;
} else {
return asIcon ( args ) ;
}
}
function makeLayersTextAbstract ( params ) {
var content = params . content ,
width = params . width ,
height = params . height ,
transform = params . transform ,
title = params . title ,
extra = params . extra ,
_params$watchable2 = params . watchable ,
2018-12-07 21:53:43 +00:00
watchable = _params$watchable2 === void 0 ? false : _params$watchable2 ;
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
var attributes = _objectSpread ( { } , extra . attributes , title ? {
'title' : title
} : { } , {
2018-06-20 20:12:02 +00:00
'class' : extra . classes . join ( ' ' )
} ) ;
if ( watchable ) {
attributes [ DATA _FA _I2SVG ] = '' ;
}
2018-12-07 21:53:43 +00:00
var styles = _objectSpread ( { } , extra . styles ) ;
2018-06-20 20:12:02 +00:00
if ( transformIsMeaningful ( transform ) ) {
2018-12-07 21:53:43 +00:00
styles [ 'transform' ] = transformForCss ( {
transform : transform ,
startCentered : true ,
width : width ,
height : height
} ) ;
2018-06-20 20:12:02 +00:00
styles [ '-webkit-transform' ] = styles [ 'transform' ] ;
}
var styleString = joinStyles ( styles ) ;
if ( styleString . length > 0 ) {
attributes [ 'style' ] = styleString ;
}
var val = [ ] ;
val . push ( {
tag : 'span' ,
attributes : attributes ,
children : [ content ]
} ) ;
if ( title ) {
2018-12-07 21:53:43 +00:00
val . push ( {
tag : 'span' ,
attributes : {
class : 'sr-only'
} ,
children : [ title ]
} ) ;
2018-06-20 20:12:02 +00:00
}
return val ;
}
function makeLayersCounterAbstract ( params ) {
var content = params . content ,
title = params . title ,
extra = params . extra ;
2018-12-07 21:53:43 +00:00
var attributes = _objectSpread ( { } , extra . attributes , title ? {
'title' : title
} : { } , {
2018-06-20 20:12:02 +00:00
'class' : extra . classes . join ( ' ' )
} ) ;
var styleString = joinStyles ( extra . styles ) ;
if ( styleString . length > 0 ) {
attributes [ 'style' ] = styleString ;
}
var val = [ ] ;
val . push ( {
tag : 'span' ,
attributes : attributes ,
children : [ content ]
} ) ;
if ( title ) {
2018-12-07 21:53:43 +00:00
val . push ( {
tag : 'span' ,
attributes : {
class : 'sr-only'
} ,
children : [ title ]
} ) ;
2018-06-20 20:12:02 +00:00
}
return val ;
}
2018-12-07 21:53:43 +00:00
var noop$1 = function noop ( ) { } ;
var p = config . measurePerformance && PERFORMANCE && PERFORMANCE . mark && PERFORMANCE . measure ? PERFORMANCE : {
mark : noop$1 ,
measure : noop$1
} ;
2018-12-12 17:26:34 +00:00
var preamble = "FA \"5.6.1\"" ;
2018-06-20 20:12:02 +00:00
var begin = function begin ( name ) {
2018-12-07 21:53:43 +00:00
p . mark ( "" . concat ( preamble , " " ) . concat ( name , " begins" ) ) ;
2018-06-20 20:12:02 +00:00
return function ( ) {
return end ( name ) ;
} ;
} ;
var end = function end ( name ) {
2018-12-07 21:53:43 +00:00
p . mark ( "" . concat ( preamble , " " ) . concat ( name , " ends" ) ) ;
p . measure ( "" . concat ( preamble , " " ) . concat ( name ) , "" . concat ( preamble , " " ) . concat ( name , " begins" ) , "" . concat ( preamble , " " ) . concat ( name , " ends" ) ) ;
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
var perf = {
begin : begin ,
end : end
} ;
2018-06-20 20:12:02 +00:00
/ * *
* Internal helper to bind a function known to have 4 arguments
* to a given context .
* /
2018-12-12 17:26:34 +00:00
var bindInternal4 = function bindInternal4 ( func , thisContext ) {
2018-06-20 20:12:02 +00:00
return function ( a , b , c , d ) {
return func . call ( thisContext , a , b , c , d ) ;
} ;
} ;
/ * *
* # Reduce
*
* A fast object ` .reduce() ` implementation .
*
* @ param { Object } subject The object to reduce over .
* @ param { Function } fn The reducer function .
* @ param { mixed } initialValue The initial value for the reducer , defaults to subject [ 0 ] .
* @ param { Object } thisContext The context for the reducer .
* @ return { mixed } The final result .
* /
2018-12-12 17:26:34 +00:00
var reduce = function fastReduceObject ( subject , fn , initialValue , thisContext ) {
2018-06-20 20:12:02 +00:00
var keys = Object . keys ( subject ) ,
length = keys . length ,
iterator = thisContext !== undefined ? bindInternal4 ( fn , thisContext ) : fn ,
2018-12-12 17:26:34 +00:00
i ,
key ,
result ;
2018-06-20 20:12:02 +00:00
if ( initialValue === undefined ) {
i = 1 ;
result = subject [ keys [ 0 ] ] ;
2018-12-12 17:26:34 +00:00
} else {
2018-06-20 20:12:02 +00:00
i = 0 ;
result = initialValue ;
}
for ( ; i < length ; i ++ ) {
key = keys [ i ] ;
result = iterator ( result , subject [ key ] , key , subject ) ;
}
return result ;
} ;
2018-12-07 21:53:43 +00:00
var styles = namespace . styles ,
shims = namespace . shims ;
2018-06-20 20:12:02 +00:00
var _byUnicode = { } ;
var _byLigature = { } ;
var _byOldName = { } ;
var build = function build ( ) {
var lookup = function lookup ( reducer ) {
2018-12-07 21:53:43 +00:00
return reduce ( styles , function ( o , style , prefix ) {
2018-06-20 20:12:02 +00:00
o [ prefix ] = reduce ( style , reducer , { } ) ;
return o ;
} , { } ) ;
} ;
_byUnicode = lookup ( function ( acc , icon , iconName ) {
acc [ icon [ 3 ] ] = iconName ;
return acc ;
} ) ;
_byLigature = lookup ( function ( acc , icon , iconName ) {
var ligatures = icon [ 2 ] ;
acc [ iconName ] = iconName ;
ligatures . forEach ( function ( ligature ) {
acc [ ligature ] = iconName ;
} ) ;
return acc ;
} ) ;
2018-12-07 21:53:43 +00:00
var hasRegular = 'far' in styles ;
2018-06-20 20:12:02 +00:00
_byOldName = reduce ( shims , function ( acc , shim ) {
var oldName = shim [ 0 ] ;
var prefix = shim [ 1 ] ;
var iconName = shim [ 2 ] ;
if ( prefix === 'far' && ! hasRegular ) {
prefix = 'fas' ;
}
2018-12-07 21:53:43 +00:00
acc [ oldName ] = {
prefix : prefix ,
iconName : iconName
} ;
2018-06-20 20:12:02 +00:00
return acc ;
} , { } ) ;
} ;
build ( ) ;
function byUnicode ( prefix , unicode ) {
return _byUnicode [ prefix ] [ unicode ] ;
}
function byLigature ( prefix , ligature ) {
return _byLigature [ prefix ] [ ligature ] ;
}
function byOldName ( name ) {
2018-12-07 21:53:43 +00:00
return _byOldName [ name ] || {
prefix : null ,
iconName : null
} ;
2018-06-20 20:12:02 +00:00
}
var styles$1 = namespace . styles ;
var emptyCanonicalIcon = function emptyCanonicalIcon ( ) {
2018-12-07 21:53:43 +00:00
return {
prefix : null ,
iconName : null ,
rest : [ ]
} ;
2018-06-20 20:12:02 +00:00
} ;
function getCanonicalIcon ( values ) {
return values . reduce ( function ( acc , cls ) {
var iconName = getIconName ( config . familyPrefix , cls ) ;
if ( styles$1 [ cls ] ) {
acc . prefix = cls ;
} else if ( iconName ) {
var shim = acc . prefix === 'fa' ? byOldName ( iconName ) : { } ;
acc . iconName = shim . iconName || iconName ;
acc . prefix = shim . prefix || acc . prefix ;
} else if ( cls !== config . replacementClass && cls . indexOf ( 'fa-w-' ) !== 0 ) {
acc . rest . push ( cls ) ;
}
return acc ;
} , emptyCanonicalIcon ( ) ) ;
}
function iconFromMapping ( mapping , prefix , iconName ) {
if ( mapping && mapping [ prefix ] && mapping [ prefix ] [ iconName ] ) {
return {
prefix : prefix ,
iconName : iconName ,
icon : mapping [ prefix ] [ iconName ]
} ;
}
}
function toHtml ( abstractNodes ) {
var tag = abstractNodes . tag ,
_abstractNodes$attrib = abstractNodes . attributes ,
2018-12-07 21:53:43 +00:00
attributes = _abstractNodes$attrib === void 0 ? { } : _abstractNodes$attrib ,
2018-06-20 20:12:02 +00:00
_abstractNodes$childr = abstractNodes . children ,
2018-12-07 21:53:43 +00:00
children = _abstractNodes$childr === void 0 ? [ ] : _abstractNodes$childr ;
2018-06-20 20:12:02 +00:00
if ( typeof abstractNodes === 'string' ) {
return htmlEscape ( abstractNodes ) ;
} else {
2018-12-07 21:53:43 +00:00
return "<" . concat ( tag , " " ) . concat ( joinAttributes ( attributes ) , ">" ) . concat ( children . map ( toHtml ) . join ( '' ) , "</" ) . concat ( tag , ">" ) ;
2018-06-20 20:12:02 +00:00
}
}
2018-12-07 21:53:43 +00:00
var noop$2 = function noop ( ) { } ;
2018-06-20 20:12:02 +00:00
function isWatched ( node ) {
var i2svg = node . getAttribute ? node . getAttribute ( DATA _FA _I2SVG ) : null ;
return typeof i2svg === 'string' ;
}
function getMutator ( ) {
if ( config . autoReplaceSvg === true ) {
return mutators . replace ;
}
var mutator = mutators [ config . autoReplaceSvg ] ;
return mutator || mutators . replace ;
}
var mutators = {
replace : function replace ( mutation ) {
var node = mutation [ 0 ] ;
var abstract = mutation [ 1 ] ;
var newOuterHTML = abstract . map ( function ( a ) {
return toHtml ( a ) ;
} ) . join ( '\n' ) ;
if ( node . parentNode && node . outerHTML ) {
2018-12-07 21:53:43 +00:00
node . outerHTML = newOuterHTML + ( config . keepOriginalSource && node . tagName . toLowerCase ( ) !== 'svg' ? "<!-- " . concat ( node . outerHTML , " -->" ) : '' ) ;
2018-06-20 20:12:02 +00:00
} else if ( node . parentNode ) {
var newNode = document . createElement ( 'span' ) ;
node . parentNode . replaceChild ( newNode , node ) ;
newNode . outerHTML = newOuterHTML ;
}
} ,
nest : function nest ( mutation ) {
var node = mutation [ 0 ] ;
2018-12-07 21:53:43 +00:00
var abstract = mutation [ 1 ] ; // If we already have a replaced node we do not want to continue nesting within it.
2018-06-20 20:12:02 +00:00
// Short-circuit to the standard replacement
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
if ( ~ classArray ( node ) . indexOf ( config . replacementClass ) ) {
return mutators . replace ( mutation ) ;
}
2018-12-07 21:53:43 +00:00
var forSvg = new RegExp ( "" . concat ( config . familyPrefix , "-.*" ) ) ;
2018-06-20 20:12:02 +00:00
delete abstract [ 0 ] . attributes . style ;
var splitClasses = abstract [ 0 ] . attributes . class . split ( ' ' ) . reduce ( function ( acc , cls ) {
if ( cls === config . replacementClass || cls . match ( forSvg ) ) {
acc . toSvg . push ( cls ) ;
} else {
acc . toNode . push ( cls ) ;
}
return acc ;
2018-12-07 21:53:43 +00:00
} , {
toNode : [ ] ,
toSvg : [ ]
} ) ;
2018-06-20 20:12:02 +00:00
abstract [ 0 ] . attributes . class = splitClasses . toSvg . join ( ' ' ) ;
var newInnerHTML = abstract . map ( function ( a ) {
return toHtml ( a ) ;
} ) . join ( '\n' ) ;
node . setAttribute ( 'class' , splitClasses . toNode . join ( ' ' ) ) ;
node . setAttribute ( DATA _FA _I2SVG , '' ) ;
node . innerHTML = newInnerHTML ;
}
} ;
function perform ( mutations , callback ) {
2018-12-07 21:53:43 +00:00
var callbackFunction = typeof callback === 'function' ? callback : noop$2 ;
2018-06-20 20:12:02 +00:00
if ( mutations . length === 0 ) {
callbackFunction ( ) ;
} else {
var frame = WINDOW . requestAnimationFrame || function ( op ) {
return op ( ) ;
} ;
frame ( function ( ) {
var mutator = getMutator ( ) ;
var mark = perf . begin ( 'mutate' ) ;
mutations . map ( mutator ) ;
mark ( ) ;
callbackFunction ( ) ;
} ) ;
}
}
var disabled = false ;
function disableObservation ( operation ) {
disabled = true ;
operation ( ) ;
disabled = false ;
}
var mo = null ;
function observe ( options ) {
if ( ! MUTATION _OBSERVER ) {
return ;
}
if ( ! config . observeMutations ) {
return ;
}
var treeCallback = options . treeCallback ,
nodeCallback = options . nodeCallback ,
pseudoElementsCallback = options . pseudoElementsCallback ,
_options$observeMutat = options . observeMutationsRoot ,
2018-12-07 21:53:43 +00:00
observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT . body : _options$observeMutat ;
2018-06-20 20:12:02 +00:00
mo = new MUTATION _OBSERVER ( function ( objects ) {
if ( disabled ) return ;
toArray ( objects ) . forEach ( function ( mutationRecord ) {
if ( mutationRecord . type === 'childList' && mutationRecord . addedNodes . length > 0 && ! isWatched ( mutationRecord . addedNodes [ 0 ] ) ) {
if ( config . searchPseudoElements ) {
pseudoElementsCallback ( mutationRecord . target ) ;
}
treeCallback ( mutationRecord . target ) ;
}
if ( mutationRecord . type === 'attributes' && mutationRecord . target . parentNode && config . searchPseudoElements ) {
pseudoElementsCallback ( mutationRecord . target . parentNode ) ;
}
if ( mutationRecord . type === 'attributes' && isWatched ( mutationRecord . target ) && ~ ATTRIBUTES _WATCHED _FOR _MUTATION . indexOf ( mutationRecord . attributeName ) ) {
if ( mutationRecord . attributeName === 'class' ) {
var _getCanonicalIcon = getCanonicalIcon ( classArray ( mutationRecord . target ) ) ,
prefix = _getCanonicalIcon . prefix ,
iconName = _getCanonicalIcon . iconName ;
if ( prefix ) mutationRecord . target . setAttribute ( 'data-prefix' , prefix ) ;
if ( iconName ) mutationRecord . target . setAttribute ( 'data-icon' , iconName ) ;
} else {
nodeCallback ( mutationRecord . target ) ;
}
}
} ) ;
} ) ;
if ( ! IS _DOM ) return ;
mo . observe ( observeMutationsRoot , {
2018-12-07 21:53:43 +00:00
childList : true ,
attributes : true ,
characterData : true ,
subtree : true
2018-06-20 20:12:02 +00:00
} ) ;
}
function disconnect ( ) {
if ( ! mo ) return ;
mo . disconnect ( ) ;
}
2018-12-07 21:53:43 +00:00
function styleParser ( node ) {
2018-06-20 20:12:02 +00:00
var style = node . getAttribute ( 'style' ) ;
var val = [ ] ;
if ( style ) {
val = style . split ( ';' ) . reduce ( function ( acc , style ) {
var styles = style . split ( ':' ) ;
var prop = styles [ 0 ] ;
var value = styles . slice ( 1 ) ;
if ( prop && value . length > 0 ) {
acc [ prop ] = value . join ( ':' ) . trim ( ) ;
}
return acc ;
} , { } ) ;
}
return val ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
function toHex ( unicode ) {
var result = '' ;
for ( var i = 0 ; i < unicode . length ; i ++ ) {
var hex = unicode . charCodeAt ( i ) . toString ( 16 ) ;
result += ( '000' + hex ) . slice ( - 4 ) ;
}
return result ;
}
2018-12-07 21:53:43 +00:00
function classParser ( node ) {
2018-06-20 20:12:02 +00:00
var existingPrefix = node . getAttribute ( 'data-prefix' ) ;
var existingIconName = node . getAttribute ( 'data-icon' ) ;
var innerText = node . innerText !== undefined ? node . innerText . trim ( ) : '' ;
var val = getCanonicalIcon ( classArray ( node ) ) ;
if ( existingPrefix && existingIconName ) {
val . prefix = existingPrefix ;
val . iconName = existingIconName ;
}
if ( val . prefix && innerText . length > 1 ) {
val . iconName = byLigature ( val . prefix , node . innerText ) ;
} else if ( val . prefix && innerText . length === 1 ) {
val . iconName = byUnicode ( val . prefix , toHex ( node . innerText ) ) ;
}
return val ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
var parseTransformString = function parseTransformString ( transformString ) {
var transform = {
size : 16 ,
x : 0 ,
y : 0 ,
flipX : false ,
flipY : false ,
rotate : 0
} ;
if ( ! transformString ) {
return transform ;
} else {
return transformString . toLowerCase ( ) . split ( ' ' ) . reduce ( function ( acc , n ) {
var parts = n . toLowerCase ( ) . split ( '-' ) ;
var first = parts [ 0 ] ;
var rest = parts . slice ( 1 ) . join ( '-' ) ;
if ( first && rest === 'h' ) {
acc . flipX = true ;
return acc ;
}
if ( first && rest === 'v' ) {
acc . flipY = true ;
return acc ;
}
rest = parseFloat ( rest ) ;
if ( isNaN ( rest ) ) {
return acc ;
}
switch ( first ) {
case 'grow' :
acc . size = acc . size + rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'shrink' :
acc . size = acc . size - rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'left' :
acc . x = acc . x - rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'right' :
acc . x = acc . x + rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'up' :
acc . y = acc . y - rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'down' :
acc . y = acc . y + rest ;
break ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
case 'rotate' :
acc . rotate = acc . rotate + rest ;
break ;
}
return acc ;
} , transform ) ;
}
} ;
2018-12-07 21:53:43 +00:00
function transformParser ( node ) {
2018-06-20 20:12:02 +00:00
return parseTransformString ( node . getAttribute ( 'data-fa-transform' ) ) ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function symbolParser ( node ) {
2018-06-20 20:12:02 +00:00
var symbol = node . getAttribute ( 'data-fa-symbol' ) ;
return symbol === null ? false : symbol === '' ? true : symbol ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function attributesParser ( node ) {
2018-06-20 20:12:02 +00:00
var extraAttributes = toArray ( node . attributes ) . reduce ( function ( acc , attr ) {
if ( acc . name !== 'class' && acc . name !== 'style' ) {
acc [ attr . name ] = attr . value ;
}
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
return acc ;
} , { } ) ;
var title = node . getAttribute ( 'title' ) ;
if ( config . autoA11y ) {
if ( title ) {
2018-12-07 21:53:43 +00:00
extraAttributes [ 'aria-labelledby' ] = "" . concat ( config . replacementClass , "-title-" ) . concat ( nextUniqueId ( ) ) ;
2018-06-20 20:12:02 +00:00
} else {
extraAttributes [ 'aria-hidden' ] = 'true' ;
}
}
return extraAttributes ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function maskParser ( node ) {
2018-06-20 20:12:02 +00:00
var mask = node . getAttribute ( 'data-fa-mask' ) ;
if ( ! mask ) {
return emptyCanonicalIcon ( ) ;
} else {
return getCanonicalIcon ( mask . split ( ' ' ) . map ( function ( i ) {
return i . trim ( ) ;
} ) ) ;
}
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
var blankMeta = {
iconName : null ,
title : null ,
prefix : null ,
transform : meaninglessTransform ,
symbol : false ,
mask : null ,
2018-12-07 21:53:43 +00:00
extra : {
classes : [ ] ,
styles : { } ,
attributes : { }
}
2018-06-20 20:12:02 +00:00
} ;
function parseMeta ( node ) {
var _classParser = classParser ( node ) ,
iconName = _classParser . iconName ,
prefix = _classParser . prefix ,
extraClasses = _classParser . rest ;
var extraStyles = styleParser ( node ) ;
var transform = transformParser ( node ) ;
var symbol = symbolParser ( node ) ;
var extraAttributes = attributesParser ( node ) ;
var mask = maskParser ( node ) ;
return {
iconName : iconName ,
title : node . getAttribute ( 'title' ) ,
prefix : prefix ,
transform : transform ,
symbol : symbol ,
mask : mask ,
extra : {
classes : extraClasses ,
styles : extraStyles ,
attributes : extraAttributes
}
} ;
}
function MissingIcon ( error ) {
this . name = 'MissingIcon' ;
this . message = error || 'Icon unavailable' ;
this . stack = new Error ( ) . stack ;
}
MissingIcon . prototype = Object . create ( Error . prototype ) ;
MissingIcon . prototype . constructor = MissingIcon ;
2018-12-07 21:53:43 +00:00
var FILL = {
fill : 'currentColor'
} ;
2018-06-20 20:12:02 +00:00
var ANIMATION _BASE = {
attributeType : 'XML' ,
repeatCount : 'indefinite' ,
dur : '2s'
} ;
var RING = {
tag : 'path' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , FILL , {
2018-06-20 20:12:02 +00:00
d : 'M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z'
} )
} ;
2018-12-07 21:53:43 +00:00
var OPACITY _ANIMATE = _objectSpread ( { } , ANIMATION _BASE , {
2018-06-20 20:12:02 +00:00
attributeName : 'opacity'
} ) ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
var DOT = {
tag : 'circle' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , FILL , {
2018-06-20 20:12:02 +00:00
cx : '256' ,
cy : '364' ,
r : '28'
} ) ,
2018-12-07 21:53:43 +00:00
children : [ {
tag : 'animate' ,
attributes : _objectSpread ( { } , ANIMATION _BASE , {
attributeName : 'r' ,
values : '28;14;28;28;14;28;'
} )
} , {
tag : 'animate' ,
attributes : _objectSpread ( { } , OPACITY _ANIMATE , {
values : '1;0;1;1;0;1;'
} )
} ]
2018-06-20 20:12:02 +00:00
} ;
var QUESTION = {
tag : 'path' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , FILL , {
2018-06-20 20:12:02 +00:00
opacity : '1' ,
d : 'M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z'
} ) ,
2018-12-07 21:53:43 +00:00
children : [ {
tag : 'animate' ,
attributes : _objectSpread ( { } , OPACITY _ANIMATE , {
values : '1;0;0;0;0;1;'
} )
} ]
2018-06-20 20:12:02 +00:00
} ;
var EXCLAMATION = {
tag : 'path' ,
2018-12-07 21:53:43 +00:00
attributes : _objectSpread ( { } , FILL , {
2018-06-20 20:12:02 +00:00
opacity : '0' ,
d : 'M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z'
} ) ,
2018-12-07 21:53:43 +00:00
children : [ {
tag : 'animate' ,
attributes : _objectSpread ( { } , OPACITY _ANIMATE , {
values : '0;0;1;1;0;0;'
} )
} ]
} ;
var missing = {
tag : 'g' ,
children : [ RING , DOT , QUESTION , EXCLAMATION ]
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
var styles$2 = namespace . styles ;
2018-06-20 20:12:02 +00:00
var LAYERS _TEXT _CLASSNAME = 'fa-layers-text' ;
var FONT _FAMILY _PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/ ;
var STYLE _TO _PREFIX = {
'Solid' : 'fas' ,
'Regular' : 'far' ,
'Light' : 'fal' ,
'Brands' : 'fab'
} ;
var FONT _WEIGHT _TO _PREFIX = {
'900' : 'fas' ,
'400' : 'far' ,
'300' : 'fal'
} ;
function findIcon ( iconName , prefix ) {
var val = {
found : false ,
width : 512 ,
height : 512 ,
icon : missing
} ;
2018-12-07 21:53:43 +00:00
if ( iconName && prefix && styles$2 [ prefix ] && styles$2 [ prefix ] [ iconName ] ) {
var icon = styles$2 [ prefix ] [ iconName ] ;
2018-06-20 20:12:02 +00:00
var width = icon [ 0 ] ;
var height = icon [ 1 ] ;
var vectorData = icon . slice ( 4 ) ;
val = {
found : true ,
width : width ,
height : height ,
2018-12-07 21:53:43 +00:00
icon : {
tag : 'path' ,
attributes : {
fill : 'currentColor' ,
d : vectorData [ 0 ]
}
}
2018-06-20 20:12:02 +00:00
} ;
} else if ( iconName && prefix && ! config . showMissingIcons ) {
2018-12-07 21:53:43 +00:00
throw new MissingIcon ( "Icon is missing for prefix " . concat ( prefix , " with icon name " ) . concat ( iconName ) ) ;
2018-06-20 20:12:02 +00:00
}
return val ;
}
function generateSvgReplacementMutation ( node , nodeMeta ) {
var iconName = nodeMeta . iconName ,
title = nodeMeta . title ,
prefix = nodeMeta . prefix ,
transform = nodeMeta . transform ,
symbol = nodeMeta . symbol ,
mask = nodeMeta . mask ,
extra = nodeMeta . extra ;
return [ node , makeInlineSvgAbstract ( {
icons : {
main : findIcon ( iconName , prefix ) ,
mask : findIcon ( mask . iconName , mask . prefix )
} ,
prefix : prefix ,
iconName : iconName ,
transform : transform ,
symbol : symbol ,
mask : mask ,
title : title ,
extra : extra ,
watchable : true
} ) ] ;
}
function generateLayersText ( node , nodeMeta ) {
var title = nodeMeta . title ,
transform = nodeMeta . transform ,
extra = nodeMeta . extra ;
var width = null ;
var height = null ;
if ( IS _IE ) {
var computedFontSize = parseInt ( getComputedStyle ( node ) . fontSize , 10 ) ;
var boundingClientRect = node . getBoundingClientRect ( ) ;
width = boundingClientRect . width / computedFontSize ;
height = boundingClientRect . height / computedFontSize ;
}
if ( config . autoA11y && ! title ) {
extra . attributes [ 'aria-hidden' ] = 'true' ;
}
return [ node , makeLayersTextAbstract ( {
content : node . innerHTML ,
width : width ,
height : height ,
transform : transform ,
title : title ,
extra : extra ,
watchable : true
} ) ] ;
}
function generateMutation ( node ) {
var nodeMeta = parseMeta ( node ) ;
if ( ~ nodeMeta . extra . classes . indexOf ( LAYERS _TEXT _CLASSNAME ) ) {
return generateLayersText ( node , nodeMeta ) ;
} else {
return generateSvgReplacementMutation ( node , nodeMeta ) ;
}
}
function searchPseudoElements ( root ) {
if ( ! IS _DOM ) return ;
var end = perf . begin ( 'searchPseudoElements' ) ;
disableObservation ( function ( ) {
toArray ( root . querySelectorAll ( '*' ) ) . filter ( function ( n ) {
return n . parentNode !== document . head && ! ~ TAGNAMES _TO _SKIP _FOR _PSEUDOELEMENTS . indexOf ( n . tagName . toUpperCase ( ) ) && ! n . getAttribute ( DATA _FA _PSEUDO _ELEMENT ) && ( ! n . parentNode || n . parentNode . tagName !== 'svg' ) ;
} ) . forEach ( function ( node ) {
[ ':before' , ':after' ] . forEach ( function ( pos ) {
var children = toArray ( node . children ) ;
var alreadyProcessedPseudoElement = children . filter ( function ( c ) {
return c . getAttribute ( DATA _FA _PSEUDO _ELEMENT ) === pos ;
} ) [ 0 ] ;
var styles = WINDOW . getComputedStyle ( node , pos ) ;
var fontFamily = styles . getPropertyValue ( 'font-family' ) . match ( FONT _FAMILY _PATTERN ) ;
var fontWeight = styles . getPropertyValue ( 'font-weight' ) ;
if ( alreadyProcessedPseudoElement && ! fontFamily ) {
// If we've already processed it but the current computed style does not result in a font-family,
// that probably means that a class name that was previously present to make the icon has been
// removed. So we now should delete the icon.
node . removeChild ( alreadyProcessedPseudoElement ) ;
} else if ( fontFamily ) {
var content = styles . getPropertyValue ( 'content' ) ;
2018-07-17 20:07:25 +00:00
var prefix = ~ [ 'Light' , 'Regular' , 'Solid' , 'Brands' ] . indexOf ( fontFamily [ 1 ] ) ? STYLE _TO _PREFIX [ fontFamily [ 1 ] ] : FONT _WEIGHT _TO _PREFIX [ fontWeight ] ;
2018-12-07 21:53:43 +00:00
var iconName = byUnicode ( prefix , toHex ( content . length === 3 ? content . substr ( 1 , 1 ) : content ) ) ; // Only convert the pseudo element in this :before/:after position into an icon if we haven't
2018-06-20 20:12:02 +00:00
// already done so with the same prefix and iconName
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
if ( ! alreadyProcessedPseudoElement || alreadyProcessedPseudoElement . getAttribute ( DATA _PREFIX ) !== prefix || alreadyProcessedPseudoElement . getAttribute ( DATA _ICON ) !== iconName ) {
if ( alreadyProcessedPseudoElement ) {
// Delete the old one, since we're replacing it with a new one
node . removeChild ( alreadyProcessedPseudoElement ) ;
}
var extra = blankMeta . extra ;
extra . attributes [ DATA _FA _PSEUDO _ELEMENT ] = pos ;
2018-12-07 21:53:43 +00:00
var abstract = makeInlineSvgAbstract ( _objectSpread ( { } , blankMeta , {
2018-06-20 20:12:02 +00:00
icons : {
main : findIcon ( iconName , prefix ) ,
mask : emptyCanonicalIcon ( )
} ,
prefix : prefix ,
iconName : iconName ,
extra : extra ,
watchable : true
} ) ) ;
var element = DOCUMENT . createElement ( 'svg' ) ;
if ( pos === ':before' ) {
node . insertBefore ( element , node . firstChild ) ;
} else {
node . appendChild ( element ) ;
}
element . outerHTML = abstract . map ( function ( a ) {
return toHtml ( a ) ;
} ) . join ( '\n' ) ;
}
}
} ) ;
} ) ;
} ) ;
end ( ) ;
}
function onTree ( root ) {
var callback = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ;
if ( ! IS _DOM ) return ;
var htmlClassList = DOCUMENT . documentElement . classList ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
var hclAdd = function hclAdd ( suffix ) {
2018-12-07 21:53:43 +00:00
return htmlClassList . add ( "" . concat ( HTML _CLASS _I2SVG _BASE _CLASS , "-" ) . concat ( suffix ) ) ;
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
var hclRemove = function hclRemove ( suffix ) {
2018-12-07 21:53:43 +00:00
return htmlClassList . remove ( "" . concat ( HTML _CLASS _I2SVG _BASE _CLASS , "-" ) . concat ( suffix ) ) ;
2018-06-20 20:12:02 +00:00
} ;
2018-12-07 21:53:43 +00:00
var prefixes = Object . keys ( styles$2 ) ;
var prefixesDomQuery = [ "." . concat ( LAYERS _TEXT _CLASSNAME , ":not([" ) . concat ( DATA _FA _I2SVG , "])" ) ] . concat ( prefixes . map ( function ( p ) {
return "." . concat ( p , ":not([" ) . concat ( DATA _FA _I2SVG , "])" ) ;
2018-06-20 20:12:02 +00:00
} ) ) . join ( ', ' ) ;
if ( prefixesDomQuery . length === 0 ) {
return ;
}
var candidates = toArray ( root . querySelectorAll ( prefixesDomQuery ) ) ;
if ( candidates . length > 0 ) {
hclAdd ( 'pending' ) ;
hclRemove ( 'complete' ) ;
} else {
return ;
}
var mark = perf . begin ( 'onTree' ) ;
var mutations = candidates . reduce ( function ( acc , node ) {
try {
var mutation = generateMutation ( node ) ;
if ( mutation ) {
acc . push ( mutation ) ;
}
} catch ( e ) {
if ( ! PRODUCTION ) {
if ( e instanceof MissingIcon ) {
console . error ( e ) ;
}
}
}
return acc ;
} , [ ] ) ;
mark ( ) ;
perform ( mutations , function ( ) {
hclAdd ( 'active' ) ;
hclAdd ( 'complete' ) ;
hclRemove ( 'pending' ) ;
if ( typeof callback === 'function' ) callback ( ) ;
} ) ;
}
function onNode ( node ) {
var callback = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ;
var mutation = generateMutation ( node ) ;
if ( mutation ) {
perform ( [ mutation ] , callback ) ;
}
}
2018-12-07 21:53:43 +00:00
var baseStyles = " svg : not ( : root ) . svg - inline -- fa { \ n overflow : visible ; \ n } \ n \ n . svg - inline -- fa { \ n display : inline - block ; \ n font - size : inherit ; \ n height : 1 em ; \ n overflow : visible ; \ n vertical - align : - 0.125 em ; \ n } \ n . svg - inline -- fa . fa - lg { \ n vertical - align : - 0.225 em ; \ n } \ n . svg - inline -- fa . fa - w - 1 { \ n width : 0.0625 em ; \ n } \ n . svg - inline -- fa . fa - w - 2 { \ n width : 0.125 em ; \ n } \ n . svg - inline -- fa . fa - w - 3 { \ n width : 0.1875 em ; \ n } \ n . svg - inline -- fa . fa - w - 4 { \ n width : 0.25 em ; \ n } \ n . svg - inline -- fa . fa - w - 5 { \ n width : 0.3125 em ; \ n } \ n . svg - inline -- fa . fa - w - 6 { \ n width : 0.375 em ; \ n } \ n . svg - inline -- fa . fa - w - 7 { \ n width : 0.4375 em ; \ n } \ n . svg - inline -- fa . fa - w - 8 { \ n width : 0.5 em ; \ n } \ n . svg - inline -- fa . fa - w - 9 { \ n width : 0.5625 em ; \ n } \ n . svg - inline -- fa . fa - w - 10 { \ n width : 0.625 em ; \ n } \ n . svg - inline -- fa . fa - w - 11 { \ n width : 0.6875 em ; \ n } \ n . svg - inline -- fa . fa - w - 12 { \ n width : 0.75 em ; \ n } \ n . svg - inline -- fa . fa - w - 13 { \ n width : 0.8125 em ; \ n } \ n . svg - inline -- fa . fa - w - 14 { \ n width : 0.875 em ; \ n } \ n . svg - inline -- fa . fa - w - 15 { \ n width : 0.9375 em ; \ n } \ n . svg - inline -- fa . fa - w - 16 { \ n width : 1 em ; \ n } \ n . svg - inline -- fa . fa - w - 17 { \ n width : 1.0625 em ; \ n } \ n . svg - inline -- fa . fa - w - 18 { \ n width : 1.125 em ; \ n } \ n . svg - inline -- fa . fa - w - 19 { \ n width : 1.1875 em ; \ n } \ n . svg - inline -- fa . fa - w - 20 { \ n width : 1.25 em ; \ n } \ n . svg - inline -- fa . fa - pull - left { \ n margin - right : 0.3 em ; \ n width : auto ; \ n } \ n . svg - inline -- fa . fa - pull - right { \ n margin - left : 0.3 em ; \ n width : auto ; \ n } \ n . svg - inline -- fa . fa - border { \ n height : 1.5 em ; \ n } \ n . svg - inline -- fa . fa - li { \ n width : 2 em ; \ n } \ n . svg - inline -- fa . fa - fw { \ n width : 1.25 em ; \ n } \ n \ n . fa - layers svg . svg - inline -- fa { \ n bottom : 0 ; \ n left : 0 ; \ n margin : auto ; \ n position : absolute ; \ n right : 0 ; \ n top : 0 ; \ n } \ n \ n . fa - layers { \ n display : inline - block ; \ n height : 1 em ; \ n position : relative ; \ n text - align : center ; \ n vertical - align : - 0.125 em ; \ n width : 1 em ; \ n } \ n . fa - layers svg . svg - inline -- fa { \ n - webkit - transform - origin : center center ; \ n transform - origin : center center ; \ n } \ n \ n . fa - layers - counter , . fa - layers - text { \ n display : inline - block ; \ n position : absolute ; \ n text - align : center ; \ n } \ n \ n . fa - layers - text { \ n left : 50 % ; \ n top : 50 % ; \ n - webkit - transform : translate ( - 50 % , - 50 % ) ; \ n transform : translate ( - 50 % , - 50 % ) ; \ n - webkit - transform - origin : center center ; \ n transform - origin : center center ; \ n } \ n \ n . fa - layers - counter { \ n background - color : # ff253a ; \ n border - radius : 1 em ; \ n - webkit - box - sizing : border - box ; \ n box - sizing : border - box ; \ n color : # fff ; \ n height : 1.5 em ; \ n line - height : 1 ; \ n max - width : 5 em ; \ n min - width : 1.5 em ; \ n overflow : hidden ; \ n padding : 0.25 em ; \ n right : 0 ; \ n text - overflow : ellipsis ; \ n top : 0 ; \ n - webkit - transform : scale ( 0.25 ) ; \ n transform : scale ( 0.25 ) ; \ n - webkit - transform - origin : top right ; \ n transform - origin : top right ; \ n } \ n \ n . fa - layers - bottom - right { \ n bottom : 0 ; \ n right : 0 ; \ n top : auto ; \ n - webkit - transform : scale ( 0.25 ) ; \ n transform : scale ( 0.25 ) ; \ n - webkit - transform - origin : bottom right ; \ n transform - origin : bottom right ; \ n } \ n \ n . fa - layers - bottom - left { \ n bottom : 0 ; \ n left : 0 ; \ n right : auto ; \ n top : auto ; \ n - webkit - transform : scale ( 0.25 ) ; \ n transform : scale ( 0.25 ) ; \ n - webkit - transform - origin : bottom left ; \ n transform - origin : bottom left ; \ n } \ n \ n . fa - layers - top - right { \ n right : 0 ; \ n top : 0 ; \ n - webkit - transform : scale ( 0.25 ) ; \ n transform : scale ( 0.25 ) ; \ n - webkit - transform - origin : top right ; \ n transform - origin : top right ; \ n } \ n \ n . fa - layers - top - left { \ n left : 0 ; \ n right : auto ; \ n top : 0 ; \ n - webkit - transform : scale ( 0.25 ) ; \ n transform : scale ( 0.25 ) ; \ n - webkit - transform - origin : top left ; \ n transform - origin : top left ; \ n } \ n \ n . fa - lg { \ n font - size : 1.3333333333 em ; \ n line - height : 0.75 em ; \ n vertical - align : - 0.0667 em ; \ n } \ n \ n . fa - xs { \ n font - size : 0.75 em ; \ n } \ n \ n . fa - sm { \ n font - size : 0.875 em ; \ n } \ n \ n . fa - 1 x { \ n font - size : 1 em ; \ n } \ n \ n . fa - 2 x { \ n font - size : 2 em ; \ n } \ n \ n . fa - 3 x { \ n font - size : 3 em ; \ n } \ n \ n . fa - 4 x { \ n font - size : 4 em ; \ n } \ n \ n . fa - 5 x { \ n font - size : 5 em ; \ n } \ n \ n . fa - 6 x { \ n font - size : 6 em ; \ n } \ n \ n . fa - 7 x { \ n font - size : 7 em ; \ n } \ n \ n . fa - 8 x { \ n font - size : 8 e
2018-06-20 20:12:02 +00:00
2018-12-07 21:53:43 +00:00
function css ( ) {
2018-06-20 20:12:02 +00:00
var dfp = DEFAULT _FAMILY _PREFIX ;
var drc = DEFAULT _REPLACEMENT _CLASS ;
var fp = config . familyPrefix ;
var rc = config . replacementClass ;
var s = baseStyles ;
if ( fp !== dfp || rc !== drc ) {
2018-12-07 21:53:43 +00:00
var dPatt = new RegExp ( "\\." . concat ( dfp , "\\-" ) , 'g' ) ;
var rPatt = new RegExp ( "\\." . concat ( drc ) , 'g' ) ;
s = s . replace ( dPatt , "." . concat ( fp , "-" ) ) . replace ( rPatt , "." . concat ( rc ) ) ;
2018-06-20 20:12:02 +00:00
}
return s ;
2018-12-07 21:53:43 +00:00
}
2018-06-20 20:12:02 +00:00
function define ( prefix , icons ) {
var normalized = Object . keys ( icons ) . reduce ( function ( acc , iconName ) {
var icon = icons [ iconName ] ;
var expanded = ! ! icon . icon ;
if ( expanded ) {
acc [ icon . iconName ] = icon . icon ;
} else {
acc [ iconName ] = icon ;
}
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
return acc ;
} , { } ) ;
if ( typeof namespace . hooks . addPack === 'function' ) {
namespace . hooks . addPack ( prefix , normalized ) ;
} else {
2018-12-07 21:53:43 +00:00
namespace . styles [ prefix ] = _objectSpread ( { } , namespace . styles [ prefix ] || { } , normalized ) ;
2018-06-20 20:12:02 +00:00
}
/ * *
* Font Awesome 4 used the prefix of ` fa ` for all icons . With the introduction
* of new styles we needed to differentiate between them . Prefix ` fa ` is now an alias
* for ` fas ` so we ' ll easy the upgrade process for our users by automatically defining
* this as well .
* /
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
if ( prefix === 'fas' ) {
define ( 'fa' , icons ) ;
}
}
2018-12-07 21:53:43 +00:00
var Library =
/*#__PURE__*/
function ( ) {
2018-06-20 20:12:02 +00:00
function Library ( ) {
2018-12-07 21:53:43 +00:00
_classCallCheck ( this , Library ) ;
2018-06-20 20:12:02 +00:00
this . definitions = { } ;
}
2018-12-07 21:53:43 +00:00
_createClass ( Library , [ {
key : "add" ,
2018-06-20 20:12:02 +00:00
value : function add ( ) {
var _this = this ;
2018-12-07 21:53:43 +00:00
for ( var _len = arguments . length , definitions = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
2018-06-20 20:12:02 +00:00
definitions [ _key ] = arguments [ _key ] ;
}
var additions = definitions . reduce ( this . _pullDefinitions , { } ) ;
Object . keys ( additions ) . forEach ( function ( key ) {
2018-12-07 21:53:43 +00:00
_this . definitions [ key ] = _objectSpread ( { } , _this . definitions [ key ] || { } , additions [ key ] ) ;
2018-06-20 20:12:02 +00:00
define ( key , additions [ key ] ) ;
2018-07-17 20:07:25 +00:00
build ( ) ;
2018-06-20 20:12:02 +00:00
} ) ;
}
} , {
2018-12-07 21:53:43 +00:00
key : "reset" ,
2018-06-20 20:12:02 +00:00
value : function reset ( ) {
this . definitions = { } ;
}
} , {
2018-12-07 21:53:43 +00:00
key : "_pullDefinitions" ,
2018-06-20 20:12:02 +00:00
value : function _pullDefinitions ( additions , definition ) {
2018-12-07 21:53:43 +00:00
var normalized = definition . prefix && definition . iconName && definition . icon ? {
0 : definition
} : definition ;
2018-06-20 20:12:02 +00:00
Object . keys ( normalized ) . map ( function ( key ) {
var _normalized$key = normalized [ key ] ,
prefix = _normalized$key . prefix ,
iconName = _normalized$key . iconName ,
icon = _normalized$key . icon ;
if ( ! additions [ prefix ] ) additions [ prefix ] = { } ;
additions [ prefix ] [ iconName ] = icon ;
} ) ;
return additions ;
}
} ] ) ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
return Library ;
} ( ) ;
function prepIcon ( icon ) {
var width = icon [ 0 ] ;
var height = icon [ 1 ] ;
var vectorData = icon . slice ( 4 ) ;
return {
found : true ,
width : width ,
height : height ,
2018-12-07 21:53:43 +00:00
icon : {
tag : 'path' ,
attributes : {
fill : 'currentColor' ,
d : vectorData [ 0 ]
}
}
2018-06-20 20:12:02 +00:00
} ;
}
function ensureCss ( ) {
if ( config . autoAddCss && ! _cssInserted ) {
insertCss ( css ( ) ) ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
_cssInserted = true ;
}
}
function apiObject ( val , abstractCreator ) {
Object . defineProperty ( val , 'abstract' , {
get : abstractCreator
} ) ;
Object . defineProperty ( val , 'html' , {
get : function get ( ) {
return val . abstract . map ( function ( a ) {
return toHtml ( a ) ;
} ) ;
}
} ) ;
Object . defineProperty ( val , 'node' , {
get : function get ( ) {
if ( ! IS _DOM ) return ;
var container = DOCUMENT . createElement ( 'div' ) ;
container . innerHTML = val . html ;
return container . children ;
}
} ) ;
return val ;
}
function findIconDefinition ( params ) {
var _params$prefix = params . prefix ,
2018-12-07 21:53:43 +00:00
prefix = _params$prefix === void 0 ? 'fa' : _params$prefix ,
2018-06-20 20:12:02 +00:00
iconName = params . iconName ;
if ( ! iconName ) return ;
return iconFromMapping ( library . definitions , prefix , iconName ) || iconFromMapping ( namespace . styles , prefix , iconName ) ;
}
function resolveIcons ( next ) {
return function ( maybeIconDefinition ) {
var params = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var iconDefinition = ( maybeIconDefinition || { } ) . icon ? maybeIconDefinition : findIconDefinition ( maybeIconDefinition || { } ) ;
var mask = params . mask ;
if ( mask ) {
mask = ( mask || { } ) . icon ? mask : findIconDefinition ( mask || { } ) ;
}
2018-12-07 21:53:43 +00:00
return next ( iconDefinition , _objectSpread ( { } , params , {
mask : mask
} ) ) ;
2018-06-20 20:12:02 +00:00
} ;
}
var library = new Library ( ) ;
var noAuto = function noAuto ( ) {
config . autoReplaceSvg = false ;
config . observeMutations = false ;
disconnect ( ) ;
} ;
var _cssInserted = false ;
var dom = {
i2svg : function i2svg ( ) {
var params = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
if ( IS _DOM ) {
ensureCss ( ) ;
var _params$node = params . node ,
2018-12-07 21:53:43 +00:00
node = _params$node === void 0 ? DOCUMENT : _params$node ,
2018-06-20 20:12:02 +00:00
_params$callback = params . callback ,
2018-12-07 21:53:43 +00:00
callback = _params$callback === void 0 ? function ( ) { } : _params$callback ;
2018-06-20 20:12:02 +00:00
if ( config . searchPseudoElements ) {
searchPseudoElements ( node ) ;
}
onTree ( node , callback ) ;
}
} ,
css : css ,
insertCss : function insertCss$$1 ( ) {
if ( ! _cssInserted ) {
insertCss ( css ( ) ) ;
2018-12-07 21:53:43 +00:00
2018-06-20 20:12:02 +00:00
_cssInserted = true ;
}
} ,
watch : function watch ( ) {
var params = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var autoReplaceSvgRoot = params . autoReplaceSvgRoot ,
observeMutationsRoot = params . observeMutationsRoot ;
if ( config . autoReplaceSvg === false ) {
config . autoReplaceSvg = true ;
}
config . observeMutations = true ;
domready ( function ( ) {
autoReplace ( {
autoReplaceSvgRoot : autoReplaceSvgRoot
} ) ;
observe ( {
treeCallback : onTree ,
nodeCallback : onNode ,
pseudoElementsCallback : searchPseudoElements ,
observeMutationsRoot : observeMutationsRoot
} ) ;
} ) ;
}
} ;
var parse = {
transform : function transform ( transformString ) {
return parseTransformString ( transformString ) ;
}
} ;
var icon = resolveIcons ( function ( iconDefinition ) {
var params = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var _params$transform = params . transform ,
2018-12-07 21:53:43 +00:00
transform = _params$transform === void 0 ? meaninglessTransform : _params$transform ,
2018-06-20 20:12:02 +00:00
_params$symbol = params . symbol ,
2018-12-07 21:53:43 +00:00
symbol = _params$symbol === void 0 ? false : _params$symbol ,
2018-06-20 20:12:02 +00:00
_params$mask = params . mask ,
2018-12-07 21:53:43 +00:00
mask = _params$mask === void 0 ? null : _params$mask ,
2018-06-20 20:12:02 +00:00
_params$title = params . title ,
2018-12-07 21:53:43 +00:00
title = _params$title === void 0 ? null : _params$title ,
2018-06-20 20:12:02 +00:00
_params$classes = params . classes ,
2018-12-07 21:53:43 +00:00
classes = _params$classes === void 0 ? [ ] : _params$classes ,
2018-06-20 20:12:02 +00:00
_params$attributes = params . attributes ,
2018-12-07 21:53:43 +00:00
attributes = _params$attributes === void 0 ? { } : _params$attributes ,
2018-06-20 20:12:02 +00:00
_params$styles = params . styles ,
2018-12-07 21:53:43 +00:00
styles = _params$styles === void 0 ? { } : _params$styles ;
2018-06-20 20:12:02 +00:00
if ( ! iconDefinition ) return ;
var prefix = iconDefinition . prefix ,
iconName = iconDefinition . iconName ,
icon = iconDefinition . icon ;
2018-12-07 21:53:43 +00:00
return apiObject ( _objectSpread ( {
type : 'icon'
} , iconDefinition ) , function ( ) {
2018-06-20 20:12:02 +00:00
ensureCss ( ) ;
if ( config . autoA11y ) {
if ( title ) {
2018-12-07 21:53:43 +00:00
attributes [ 'aria-labelledby' ] = "" . concat ( config . replacementClass , "-title-" ) . concat ( nextUniqueId ( ) ) ;
2018-06-20 20:12:02 +00:00
} else {
attributes [ 'aria-hidden' ] = 'true' ;
}
}
return makeInlineSvgAbstract ( {
icons : {
main : prepIcon ( icon ) ,
2018-12-07 21:53:43 +00:00
mask : mask ? prepIcon ( mask . icon ) : {
found : false ,
width : null ,
height : null ,
icon : { }
}
2018-06-20 20:12:02 +00:00
} ,
prefix : prefix ,
iconName : iconName ,
2018-12-07 21:53:43 +00:00
transform : _objectSpread ( { } , meaninglessTransform , transform ) ,
2018-06-20 20:12:02 +00:00
symbol : symbol ,
title : title ,
extra : {
attributes : attributes ,
styles : styles ,
classes : classes
}
} ) ;
} ) ;
} ) ;
var text = function text ( content ) {
var params = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var _params$transform2 = params . transform ,
2018-12-07 21:53:43 +00:00
transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2 ,
2018-06-20 20:12:02 +00:00
_params$title2 = params . title ,
2018-12-07 21:53:43 +00:00
title = _params$title2 === void 0 ? null : _params$title2 ,
2018-06-20 20:12:02 +00:00
_params$classes2 = params . classes ,
2018-12-07 21:53:43 +00:00
classes = _params$classes2 === void 0 ? [ ] : _params$classes2 ,
2018-06-20 20:12:02 +00:00
_params$attributes2 = params . attributes ,
2018-12-07 21:53:43 +00:00
attributes = _params$attributes2 === void 0 ? { } : _params$attributes2 ,
2018-06-20 20:12:02 +00:00
_params$styles2 = params . styles ,
2018-12-07 21:53:43 +00:00
styles = _params$styles2 === void 0 ? { } : _params$styles2 ;
return apiObject ( {
type : 'text' ,
content : content
} , function ( ) {
2018-06-20 20:12:02 +00:00
ensureCss ( ) ;
return makeLayersTextAbstract ( {
content : content ,
2018-12-07 21:53:43 +00:00
transform : _objectSpread ( { } , meaninglessTransform , transform ) ,
2018-06-20 20:12:02 +00:00
title : title ,
extra : {
attributes : attributes ,
styles : styles ,
2018-12-07 21:53:43 +00:00
classes : [ "" . concat ( config . familyPrefix , "-layers-text" ) ] . concat ( _toConsumableArray ( classes ) )
2018-06-20 20:12:02 +00:00
}
} ) ;
} ) ;
} ;
var counter = function counter ( content ) {
var params = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var _params$title3 = params . title ,
2018-12-07 21:53:43 +00:00
title = _params$title3 === void 0 ? null : _params$title3 ,
2018-06-20 20:12:02 +00:00
_params$classes3 = params . classes ,
2018-12-07 21:53:43 +00:00
classes = _params$classes3 === void 0 ? [ ] : _params$classes3 ,
2018-06-20 20:12:02 +00:00
_params$attributes3 = params . attributes ,
2018-12-07 21:53:43 +00:00
attributes = _params$attributes3 === void 0 ? { } : _params$attributes3 ,
2018-06-20 20:12:02 +00:00
_params$styles3 = params . styles ,
2018-12-07 21:53:43 +00:00
styles = _params$styles3 === void 0 ? { } : _params$styles3 ;
return apiObject ( {
type : 'counter' ,
content : content
} , function ( ) {
2018-06-20 20:12:02 +00:00
ensureCss ( ) ;
return makeLayersCounterAbstract ( {
content : content . toString ( ) ,
title : title ,
extra : {
attributes : attributes ,
styles : styles ,
2018-12-07 21:53:43 +00:00
classes : [ "" . concat ( config . familyPrefix , "-layers-counter" ) ] . concat ( _toConsumableArray ( classes ) )
2018-06-20 20:12:02 +00:00
}
} ) ;
} ) ;
} ;
var layer = function layer ( assembler ) {
2018-12-07 21:53:43 +00:00
return apiObject ( {
type : 'layer'
} , function ( ) {
2018-06-20 20:12:02 +00:00
ensureCss ( ) ;
var children = [ ] ;
assembler ( function ( args ) {
Array . isArray ( args ) ? args . map ( function ( a ) {
children = children . concat ( a . abstract ) ;
} ) : children = children . concat ( args . abstract ) ;
} ) ;
return [ {
tag : 'span' ,
2018-12-07 21:53:43 +00:00
attributes : {
class : "" . concat ( config . familyPrefix , "-layers" )
} ,
2018-06-20 20:12:02 +00:00
children : children
} ] ;
} ) ;
} ;
var api = {
noAuto : noAuto ,
config : config ,
dom : dom ,
library : library ,
parse : parse ,
findIconDefinition : findIconDefinition ,
icon : icon ,
text : text ,
counter : counter ,
layer : layer ,
toHtml : toHtml
} ;
var autoReplace = function autoReplace ( ) {
var params = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var _params$autoReplaceSv = params . autoReplaceSvgRoot ,
2018-12-07 21:53:43 +00:00
autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv ;
if ( Object . keys ( namespace . styles ) . length > 0 && IS _DOM && config . autoReplaceSvg ) api . dom . i2svg ( {
node : autoReplaceSvgRoot
} ) ;
2018-06-20 20:12:02 +00:00
} ;
export { icon , noAuto , config , toHtml , layer , text , counter , library , dom , parse , findIconDefinition } ;