index.es.js 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805
  1. /*!
  2. * Font Awesome Free 5.0.13 by @fontawesome - https://fontawesome.com
  3. * License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  4. */
  5. var noop = function noop() {};
  6. var _WINDOW = {};
  7. var _DOCUMENT = {};
  8. var _MUTATION_OBSERVER$1 = null;
  9. var _PERFORMANCE = { mark: noop, measure: noop };
  10. try {
  11. if (typeof window !== 'undefined') _WINDOW = window;
  12. if (typeof document !== 'undefined') _DOCUMENT = document;
  13. if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER$1 = MutationObserver;
  14. if (typeof performance !== 'undefined') _PERFORMANCE = performance;
  15. } catch (e) {}
  16. var _ref = _WINDOW.navigator || {};
  17. var _ref$userAgent = _ref.userAgent;
  18. var userAgent = _ref$userAgent === undefined ? '' : _ref$userAgent;
  19. var WINDOW = _WINDOW;
  20. var DOCUMENT = _DOCUMENT;
  21. var MUTATION_OBSERVER = _MUTATION_OBSERVER$1;
  22. var PERFORMANCE = _PERFORMANCE;
  23. var IS_BROWSER = !!WINDOW.document;
  24. var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
  25. var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
  26. var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
  27. var UNITS_IN_GRID = 16;
  28. var DEFAULT_FAMILY_PREFIX = 'fa';
  29. var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
  30. var DATA_FA_I2SVG = 'data-fa-i2svg';
  31. var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
  32. var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
  33. var PRODUCTION = function () {
  34. try {
  35. return process.env.NODE_ENV === 'production';
  36. } catch (e) {
  37. return false;
  38. }
  39. }();
  40. var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  41. var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
  42. var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
  43. 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) {
  44. return n + 'x';
  45. })).concat(oneToTwenty.map(function (n) {
  46. return 'w-' + n;
  47. }));
  48. var classCallCheck = function (instance, Constructor) {
  49. if (!(instance instanceof Constructor)) {
  50. throw new TypeError("Cannot call a class as a function");
  51. }
  52. };
  53. var createClass = function () {
  54. function defineProperties(target, props) {
  55. for (var i = 0; i < props.length; i++) {
  56. var descriptor = props[i];
  57. descriptor.enumerable = descriptor.enumerable || false;
  58. descriptor.configurable = true;
  59. if ("value" in descriptor) descriptor.writable = true;
  60. Object.defineProperty(target, descriptor.key, descriptor);
  61. }
  62. }
  63. return function (Constructor, protoProps, staticProps) {
  64. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  65. if (staticProps) defineProperties(Constructor, staticProps);
  66. return Constructor;
  67. };
  68. }();
  69. var _extends = Object.assign || function (target) {
  70. for (var i = 1; i < arguments.length; i++) {
  71. var source = arguments[i];
  72. for (var key in source) {
  73. if (Object.prototype.hasOwnProperty.call(source, key)) {
  74. target[key] = source[key];
  75. }
  76. }
  77. }
  78. return target;
  79. };
  80. var toConsumableArray = function (arr) {
  81. if (Array.isArray(arr)) {
  82. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
  83. return arr2;
  84. } else {
  85. return Array.from(arr);
  86. }
  87. };
  88. var initial = WINDOW.FontAwesomeConfig || {};
  89. var initialKeys = Object.keys(initial);
  90. var _default = _extends({
  91. familyPrefix: DEFAULT_FAMILY_PREFIX,
  92. replacementClass: DEFAULT_REPLACEMENT_CLASS,
  93. autoReplaceSvg: true,
  94. autoAddCss: true,
  95. autoA11y: true,
  96. searchPseudoElements: false,
  97. observeMutations: true,
  98. keepOriginalSource: true,
  99. measurePerformance: false,
  100. showMissingIcons: true
  101. }, initial);
  102. if (!_default.autoReplaceSvg) _default.observeMutations = false;
  103. var config$1 = _extends({}, _default);
  104. WINDOW.FontAwesomeConfig = config$1;
  105. function update(newConfig) {
  106. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  107. var _params$asNewDefault = params.asNewDefault,
  108. asNewDefault = _params$asNewDefault === undefined ? false : _params$asNewDefault;
  109. var validKeys = Object.keys(config$1);
  110. var ok = asNewDefault ? function (k) {
  111. return ~validKeys.indexOf(k) && !~initialKeys.indexOf(k);
  112. } : function (k) {
  113. return ~validKeys.indexOf(k);
  114. };
  115. Object.keys(newConfig).forEach(function (configKey) {
  116. if (ok(configKey)) config$1[configKey] = newConfig[configKey];
  117. });
  118. }
  119. function auto(value) {
  120. update({
  121. autoReplaceSvg: value,
  122. observeMutations: value
  123. });
  124. }
  125. var w = WINDOW || {};
  126. if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
  127. if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
  128. if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
  129. if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
  130. var namespace = w[NAMESPACE_IDENTIFIER];
  131. var functions = [];
  132. var listener = function listener() {
  133. DOCUMENT.removeEventListener('DOMContentLoaded', listener);
  134. loaded = 1;
  135. functions.map(function (fn) {
  136. return fn();
  137. });
  138. };
  139. var loaded = false;
  140. if (IS_DOM) {
  141. loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
  142. if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
  143. }
  144. var domready = function (fn) {
  145. if (!IS_DOM) return;
  146. loaded ? setTimeout(fn, 0) : functions.push(fn);
  147. };
  148. var d = UNITS_IN_GRID;
  149. var meaninglessTransform = {
  150. size: 16,
  151. x: 0,
  152. y: 0,
  153. rotate: 0,
  154. flipX: false,
  155. flipY: false
  156. };
  157. function isReserved(name) {
  158. return ~RESERVED_CLASSES.indexOf(name);
  159. }
  160. function bunker(fn) {
  161. try {
  162. fn();
  163. } catch (e) {
  164. if (!PRODUCTION) {
  165. throw e;
  166. }
  167. }
  168. }
  169. function insertCss(css) {
  170. if (!css || !IS_DOM) {
  171. return;
  172. }
  173. var style = DOCUMENT.createElement('style');
  174. style.setAttribute('type', 'text/css');
  175. style.innerHTML = css;
  176. var headChildren = DOCUMENT.head.childNodes;
  177. var beforeChild = null;
  178. for (var i = headChildren.length - 1; i > -1; i--) {
  179. var child = headChildren[i];
  180. var tagName = (child.tagName || '').toUpperCase();
  181. if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
  182. beforeChild = child;
  183. }
  184. }
  185. DOCUMENT.head.insertBefore(style, beforeChild);
  186. return css;
  187. }
  188. var _uniqueId = 0;
  189. function nextUniqueId() {
  190. _uniqueId++;
  191. return _uniqueId;
  192. }
  193. function toArray(obj) {
  194. var array = [];
  195. for (var i = (obj || []).length >>> 0; i--;) {
  196. array[i] = obj[i];
  197. }
  198. return array;
  199. }
  200. function classArray(node) {
  201. if (node.classList) {
  202. return toArray(node.classList);
  203. } else {
  204. return (node.getAttribute('class') || '').split(' ').filter(function (i) {
  205. return i;
  206. });
  207. }
  208. }
  209. function getIconName(familyPrefix, cls) {
  210. var parts = cls.split('-');
  211. var prefix = parts[0];
  212. var iconName = parts.slice(1).join('-');
  213. if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
  214. return iconName;
  215. } else {
  216. return null;
  217. }
  218. }
  219. function htmlEscape(str) {
  220. return ('' + str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  221. }
  222. function joinAttributes(attributes) {
  223. return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
  224. return acc + (attributeName + '="' + htmlEscape(attributes[attributeName]) + '" ');
  225. }, '').trim();
  226. }
  227. function joinStyles(styles) {
  228. return Object.keys(styles || {}).reduce(function (acc, styleName) {
  229. return acc + (styleName + ': ' + styles[styleName] + ';');
  230. }, '');
  231. }
  232. function transformIsMeaningful(transform) {
  233. return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
  234. }
  235. function transformForSvg(_ref) {
  236. var transform = _ref.transform,
  237. containerWidth = _ref.containerWidth,
  238. iconWidth = _ref.iconWidth;
  239. var outer = {
  240. transform: 'translate(' + containerWidth / 2 + ' 256)'
  241. };
  242. var innerTranslate = 'translate(' + transform.x * 32 + ', ' + transform.y * 32 + ') ';
  243. var innerScale = 'scale(' + transform.size / 16 * (transform.flipX ? -1 : 1) + ', ' + transform.size / 16 * (transform.flipY ? -1 : 1) + ') ';
  244. var innerRotate = 'rotate(' + transform.rotate + ' 0 0)';
  245. var inner = {
  246. transform: innerTranslate + ' ' + innerScale + ' ' + innerRotate
  247. };
  248. var path = {
  249. transform: 'translate(' + iconWidth / 2 * -1 + ' -256)'
  250. };
  251. return {
  252. outer: outer,
  253. inner: inner,
  254. path: path
  255. };
  256. }
  257. function transformForCss(_ref2) {
  258. var transform = _ref2.transform,
  259. _ref2$width = _ref2.width,
  260. width = _ref2$width === undefined ? UNITS_IN_GRID : _ref2$width,
  261. _ref2$height = _ref2.height,
  262. height = _ref2$height === undefined ? UNITS_IN_GRID : _ref2$height,
  263. _ref2$startCentered = _ref2.startCentered,
  264. startCentered = _ref2$startCentered === undefined ? false : _ref2$startCentered;
  265. var val = '';
  266. if (startCentered && IS_IE) {
  267. val += 'translate(' + (transform.x / d - width / 2) + 'em, ' + (transform.y / d - height / 2) + 'em) ';
  268. } else if (startCentered) {
  269. val += 'translate(calc(-50% + ' + transform.x / d + 'em), calc(-50% + ' + transform.y / d + 'em)) ';
  270. } else {
  271. val += 'translate(' + transform.x / d + 'em, ' + transform.y / d + 'em) ';
  272. }
  273. val += 'scale(' + transform.size / d * (transform.flipX ? -1 : 1) + ', ' + transform.size / d * (transform.flipY ? -1 : 1) + ') ';
  274. val += 'rotate(' + transform.rotate + 'deg) ';
  275. return val;
  276. }
  277. var ALL_SPACE = {
  278. x: 0,
  279. y: 0,
  280. width: '100%',
  281. height: '100%'
  282. };
  283. var makeIconMasking = function (_ref) {
  284. var children = _ref.children,
  285. attributes = _ref.attributes,
  286. main = _ref.main,
  287. mask = _ref.mask,
  288. transform = _ref.transform;
  289. var mainWidth = main.width,
  290. mainPath = main.icon;
  291. var maskWidth = mask.width,
  292. maskPath = mask.icon;
  293. var trans = transformForSvg({ transform: transform, containerWidth: maskWidth, iconWidth: mainWidth });
  294. var maskRect = {
  295. tag: 'rect',
  296. attributes: _extends({}, ALL_SPACE, {
  297. fill: 'white'
  298. })
  299. };
  300. var maskInnerGroup = {
  301. tag: 'g',
  302. attributes: _extends({}, trans.inner),
  303. children: [{ tag: 'path', attributes: _extends({}, mainPath.attributes, trans.path, { fill: 'black' }) }]
  304. };
  305. var maskOuterGroup = {
  306. tag: 'g',
  307. attributes: _extends({}, trans.outer),
  308. children: [maskInnerGroup]
  309. };
  310. var maskId = 'mask-' + nextUniqueId();
  311. var clipId = 'clip-' + nextUniqueId();
  312. var maskTag = {
  313. tag: 'mask',
  314. attributes: _extends({}, ALL_SPACE, {
  315. id: maskId,
  316. maskUnits: 'userSpaceOnUse',
  317. maskContentUnits: 'userSpaceOnUse'
  318. }),
  319. children: [maskRect, maskOuterGroup]
  320. };
  321. var defs = {
  322. tag: 'defs',
  323. children: [{ tag: 'clipPath', attributes: { id: clipId }, children: [maskPath] }, maskTag]
  324. };
  325. children.push(defs, { tag: 'rect', attributes: _extends({ fill: 'currentColor', 'clip-path': 'url(#' + clipId + ')', mask: 'url(#' + maskId + ')' }, ALL_SPACE) });
  326. return {
  327. children: children,
  328. attributes: attributes
  329. };
  330. };
  331. var makeIconStandard = function (_ref) {
  332. var children = _ref.children,
  333. attributes = _ref.attributes,
  334. main = _ref.main,
  335. transform = _ref.transform,
  336. styles = _ref.styles;
  337. var styleString = joinStyles(styles);
  338. if (styleString.length > 0) {
  339. attributes['style'] = styleString;
  340. }
  341. if (transformIsMeaningful(transform)) {
  342. var trans = transformForSvg({ transform: transform, containerWidth: main.width, iconWidth: main.width });
  343. children.push({
  344. tag: 'g',
  345. attributes: _extends({}, trans.outer),
  346. children: [{
  347. tag: 'g',
  348. attributes: _extends({}, trans.inner),
  349. children: [{
  350. tag: main.icon.tag,
  351. children: main.icon.children,
  352. attributes: _extends({}, main.icon.attributes, trans.path)
  353. }]
  354. }]
  355. });
  356. } else {
  357. children.push(main.icon);
  358. }
  359. return {
  360. children: children,
  361. attributes: attributes
  362. };
  363. };
  364. var asIcon = function (_ref) {
  365. var children = _ref.children,
  366. main = _ref.main,
  367. mask = _ref.mask,
  368. attributes = _ref.attributes,
  369. styles = _ref.styles,
  370. transform = _ref.transform;
  371. if (transformIsMeaningful(transform) && main.found && !mask.found) {
  372. var width = main.width,
  373. height = main.height;
  374. var offset = {
  375. x: width / height / 2,
  376. y: 0.5
  377. };
  378. attributes['style'] = joinStyles(_extends({}, styles, {
  379. 'transform-origin': offset.x + transform.x / 16 + 'em ' + (offset.y + transform.y / 16) + 'em'
  380. }));
  381. }
  382. return [{
  383. tag: 'svg',
  384. attributes: attributes,
  385. children: children
  386. }];
  387. };
  388. var asSymbol = function (_ref) {
  389. var prefix = _ref.prefix,
  390. iconName = _ref.iconName,
  391. children = _ref.children,
  392. attributes = _ref.attributes,
  393. symbol = _ref.symbol;
  394. var id = symbol === true ? prefix + '-' + config$1.familyPrefix + '-' + iconName : symbol;
  395. return [{
  396. tag: 'svg',
  397. attributes: {
  398. style: 'display: none;'
  399. },
  400. children: [{
  401. tag: 'symbol',
  402. attributes: _extends({}, attributes, { id: id }),
  403. children: children
  404. }]
  405. }];
  406. };
  407. function makeInlineSvgAbstract(params) {
  408. var _params$icons = params.icons,
  409. main = _params$icons.main,
  410. mask = _params$icons.mask,
  411. prefix = params.prefix,
  412. iconName = params.iconName,
  413. transform = params.transform,
  414. symbol = params.symbol,
  415. title = params.title,
  416. extra = params.extra,
  417. _params$watchable = params.watchable,
  418. watchable = _params$watchable === undefined ? false : _params$watchable;
  419. var _ref = mask.found ? mask : main,
  420. width = _ref.width,
  421. height = _ref.height;
  422. var widthClass = 'fa-w-' + Math.ceil(width / height * 16);
  423. var attrClass = [config$1.replacementClass, iconName ? config$1.familyPrefix + '-' + iconName : '', widthClass].concat(extra.classes).join(' ');
  424. var content = {
  425. children: [],
  426. attributes: _extends({}, extra.attributes, {
  427. 'data-prefix': prefix,
  428. 'data-icon': iconName,
  429. 'class': attrClass,
  430. 'role': 'img',
  431. 'xmlns': 'http://www.w3.org/2000/svg',
  432. 'viewBox': '0 0 ' + width + ' ' + height
  433. })
  434. };
  435. if (watchable) {
  436. content.attributes[DATA_FA_I2SVG] = '';
  437. }
  438. if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] });
  439. var args = _extends({}, content, {
  440. prefix: prefix,
  441. iconName: iconName,
  442. main: main,
  443. mask: mask,
  444. transform: transform,
  445. symbol: symbol,
  446. styles: extra.styles
  447. });
  448. var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
  449. children = _ref2.children,
  450. attributes = _ref2.attributes;
  451. args.children = children;
  452. args.attributes = attributes;
  453. if (symbol) {
  454. return asSymbol(args);
  455. } else {
  456. return asIcon(args);
  457. }
  458. }
  459. function makeLayersTextAbstract(params) {
  460. var content = params.content,
  461. width = params.width,
  462. height = params.height,
  463. transform = params.transform,
  464. title = params.title,
  465. extra = params.extra,
  466. _params$watchable2 = params.watchable,
  467. watchable = _params$watchable2 === undefined ? false : _params$watchable2;
  468. var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, {
  469. 'class': extra.classes.join(' ')
  470. });
  471. if (watchable) {
  472. attributes[DATA_FA_I2SVG] = '';
  473. }
  474. var styles = _extends({}, extra.styles);
  475. if (transformIsMeaningful(transform)) {
  476. styles['transform'] = transformForCss({ transform: transform, startCentered: true, width: width, height: height });
  477. styles['-webkit-transform'] = styles['transform'];
  478. }
  479. var styleString = joinStyles(styles);
  480. if (styleString.length > 0) {
  481. attributes['style'] = styleString;
  482. }
  483. var val = [];
  484. val.push({
  485. tag: 'span',
  486. attributes: attributes,
  487. children: [content]
  488. });
  489. if (title) {
  490. val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] });
  491. }
  492. return val;
  493. }
  494. var noop$2 = function noop() {};
  495. var p = config$1.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
  496. var preamble = 'FA "5.0.13"';
  497. var begin = function begin(name) {
  498. p.mark(preamble + ' ' + name + ' begins');
  499. return function () {
  500. return end(name);
  501. };
  502. };
  503. var end = function end(name) {
  504. p.mark(preamble + ' ' + name + ' ends');
  505. p.measure(preamble + ' ' + name, preamble + ' ' + name + ' begins', preamble + ' ' + name + ' ends');
  506. };
  507. var perf = { begin: begin, end: end };
  508. 'use strict';
  509. /**
  510. * Internal helper to bind a function known to have 4 arguments
  511. * to a given context.
  512. */
  513. var bindInternal4 = function bindInternal4 (func, thisContext) {
  514. return function (a, b, c, d) {
  515. return func.call(thisContext, a, b, c, d);
  516. };
  517. };
  518. 'use strict';
  519. /**
  520. * # Reduce
  521. *
  522. * A fast object `.reduce()` implementation.
  523. *
  524. * @param {Object} subject The object to reduce over.
  525. * @param {Function} fn The reducer function.
  526. * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
  527. * @param {Object} thisContext The context for the reducer.
  528. * @return {mixed} The final result.
  529. */
  530. var reduce = function fastReduceObject (subject, fn, initialValue, thisContext) {
  531. var keys = Object.keys(subject),
  532. length = keys.length,
  533. iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
  534. i, key, result;
  535. if (initialValue === undefined) {
  536. i = 1;
  537. result = subject[keys[0]];
  538. }
  539. else {
  540. i = 0;
  541. result = initialValue;
  542. }
  543. for (; i < length; i++) {
  544. key = keys[i];
  545. result = iterator(result, subject[key], key, subject);
  546. }
  547. return result;
  548. };
  549. var styles$2 = namespace.styles;
  550. var shims = namespace.shims;
  551. var _byUnicode = {};
  552. var _byLigature = {};
  553. var _byOldName = {};
  554. var build = function build() {
  555. var lookup = function lookup(reducer) {
  556. return reduce(styles$2, function (o, style, prefix) {
  557. o[prefix] = reduce(style, reducer, {});
  558. return o;
  559. }, {});
  560. };
  561. _byUnicode = lookup(function (acc, icon, iconName) {
  562. acc[icon[3]] = iconName;
  563. return acc;
  564. });
  565. _byLigature = lookup(function (acc, icon, iconName) {
  566. var ligatures = icon[2];
  567. acc[iconName] = iconName;
  568. ligatures.forEach(function (ligature) {
  569. acc[ligature] = iconName;
  570. });
  571. return acc;
  572. });
  573. var hasRegular = 'far' in styles$2;
  574. _byOldName = reduce(shims, function (acc, shim) {
  575. var oldName = shim[0];
  576. var prefix = shim[1];
  577. var iconName = shim[2];
  578. if (prefix === 'far' && !hasRegular) {
  579. prefix = 'fas';
  580. }
  581. acc[oldName] = { prefix: prefix, iconName: iconName };
  582. return acc;
  583. }, {});
  584. };
  585. build();
  586. function byUnicode(prefix, unicode) {
  587. return _byUnicode[prefix][unicode];
  588. }
  589. function byLigature(prefix, ligature) {
  590. return _byLigature[prefix][ligature];
  591. }
  592. function byOldName(name) {
  593. return _byOldName[name] || { prefix: null, iconName: null };
  594. }
  595. var styles$1 = namespace.styles;
  596. var emptyCanonicalIcon = function emptyCanonicalIcon() {
  597. return { prefix: null, iconName: null, rest: [] };
  598. };
  599. function getCanonicalIcon(values) {
  600. return values.reduce(function (acc, cls) {
  601. var iconName = getIconName(config$1.familyPrefix, cls);
  602. if (styles$1[cls]) {
  603. acc.prefix = cls;
  604. } else if (iconName) {
  605. var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
  606. acc.iconName = shim.iconName || iconName;
  607. acc.prefix = shim.prefix || acc.prefix;
  608. } else if (cls !== config$1.replacementClass && cls.indexOf('fa-w-') !== 0) {
  609. acc.rest.push(cls);
  610. }
  611. return acc;
  612. }, emptyCanonicalIcon());
  613. }
  614. function iconFromMapping(mapping, prefix, iconName) {
  615. if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
  616. return {
  617. prefix: prefix,
  618. iconName: iconName,
  619. icon: mapping[prefix][iconName]
  620. };
  621. }
  622. }
  623. function toHtml(abstractNodes) {
  624. var tag = abstractNodes.tag,
  625. _abstractNodes$attrib = abstractNodes.attributes,
  626. attributes = _abstractNodes$attrib === undefined ? {} : _abstractNodes$attrib,
  627. _abstractNodes$childr = abstractNodes.children,
  628. children = _abstractNodes$childr === undefined ? [] : _abstractNodes$childr;
  629. if (typeof abstractNodes === 'string') {
  630. return htmlEscape(abstractNodes);
  631. } else {
  632. return '<' + tag + ' ' + joinAttributes(attributes) + '>' + children.map(toHtml).join('') + '</' + tag + '>';
  633. }
  634. }
  635. var noop$1 = function noop() {};
  636. function isWatched(node) {
  637. var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
  638. return typeof i2svg === 'string';
  639. }
  640. function getMutator() {
  641. if (config$1.autoReplaceSvg === true) {
  642. return mutators.replace;
  643. }
  644. var mutator = mutators[config$1.autoReplaceSvg];
  645. return mutator || mutators.replace;
  646. }
  647. var mutators = {
  648. replace: function replace(mutation) {
  649. var node = mutation[0];
  650. var abstract = mutation[1];
  651. var newOuterHTML = abstract.map(function (a) {
  652. return toHtml(a);
  653. }).join('\n');
  654. if (node.parentNode && node.outerHTML) {
  655. node.outerHTML = newOuterHTML + (config$1.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : '');
  656. } else if (node.parentNode) {
  657. var newNode = document.createElement('span');
  658. node.parentNode.replaceChild(newNode, node);
  659. newNode.outerHTML = newOuterHTML;
  660. }
  661. },
  662. nest: function nest(mutation) {
  663. var node = mutation[0];
  664. var abstract = mutation[1];
  665. // If we already have a replaced node we do not want to continue nesting within it.
  666. // Short-circuit to the standard replacement
  667. if (~classArray(node).indexOf(config$1.replacementClass)) {
  668. return mutators.replace(mutation);
  669. }
  670. var forSvg = new RegExp(config$1.familyPrefix + '-.*');
  671. delete abstract[0].attributes.style;
  672. var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
  673. if (cls === config$1.replacementClass || cls.match(forSvg)) {
  674. acc.toSvg.push(cls);
  675. } else {
  676. acc.toNode.push(cls);
  677. }
  678. return acc;
  679. }, { toNode: [], toSvg: [] });
  680. abstract[0].attributes.class = splitClasses.toSvg.join(' ');
  681. var newInnerHTML = abstract.map(function (a) {
  682. return toHtml(a);
  683. }).join('\n');
  684. node.setAttribute('class', splitClasses.toNode.join(' '));
  685. node.setAttribute(DATA_FA_I2SVG, '');
  686. node.innerHTML = newInnerHTML;
  687. }
  688. };
  689. function perform(mutations, callback) {
  690. var callbackFunction = typeof callback === 'function' ? callback : noop$1;
  691. if (mutations.length === 0) {
  692. callbackFunction();
  693. } else {
  694. var frame = WINDOW.requestAnimationFrame || function (op) {
  695. return op();
  696. };
  697. frame(function () {
  698. var mutator = getMutator();
  699. var mark = perf.begin('mutate');
  700. mutations.map(mutator);
  701. mark();
  702. callbackFunction();
  703. });
  704. }
  705. }
  706. var disabled = false;
  707. function disableObservation(operation) {
  708. disabled = true;
  709. operation();
  710. disabled = false;
  711. }
  712. var mo = null;
  713. function observe(options) {
  714. if (!MUTATION_OBSERVER) return;
  715. var treeCallback = options.treeCallback,
  716. nodeCallback = options.nodeCallback,
  717. pseudoElementsCallback = options.pseudoElementsCallback;
  718. mo = new MUTATION_OBSERVER(function (objects) {
  719. if (disabled) return;
  720. toArray(objects).forEach(function (mutationRecord) {
  721. if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
  722. if (config$1.searchPseudoElements) {
  723. pseudoElementsCallback(mutationRecord.target);
  724. }
  725. treeCallback(mutationRecord.target);
  726. }
  727. if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config$1.searchPseudoElements) {
  728. pseudoElementsCallback(mutationRecord.target.parentNode);
  729. }
  730. if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
  731. if (mutationRecord.attributeName === 'class') {
  732. var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
  733. prefix = _getCanonicalIcon.prefix,
  734. iconName = _getCanonicalIcon.iconName;
  735. if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
  736. if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
  737. } else {
  738. nodeCallback(mutationRecord.target);
  739. }
  740. }
  741. });
  742. });
  743. if (!IS_DOM) return;
  744. mo.observe(DOCUMENT.getElementsByTagName('body')[0], {
  745. childList: true, attributes: true, characterData: true, subtree: true
  746. });
  747. }
  748. function disconnect() {
  749. if (!mo) return;
  750. mo.disconnect();
  751. }
  752. var styleParser = function (node) {
  753. var style = node.getAttribute('style');
  754. var val = [];
  755. if (style) {
  756. val = style.split(';').reduce(function (acc, style) {
  757. var styles = style.split(':');
  758. var prop = styles[0];
  759. var value = styles.slice(1);
  760. if (prop && value.length > 0) {
  761. acc[prop] = value.join(':').trim();
  762. }
  763. return acc;
  764. }, {});
  765. }
  766. return val;
  767. };
  768. function toHex(unicode) {
  769. var result = '';
  770. for (var i = 0; i < unicode.length; i++) {
  771. var hex = unicode.charCodeAt(i).toString(16);
  772. result += ('000' + hex).slice(-4);
  773. }
  774. return result;
  775. }
  776. var classParser = function (node) {
  777. var existingPrefix = node.getAttribute('data-prefix');
  778. var existingIconName = node.getAttribute('data-icon');
  779. var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
  780. var val = getCanonicalIcon(classArray(node));
  781. if (existingPrefix && existingIconName) {
  782. val.prefix = existingPrefix;
  783. val.iconName = existingIconName;
  784. }
  785. if (val.prefix && innerText.length > 1) {
  786. val.iconName = byLigature(val.prefix, node.innerText);
  787. } else if (val.prefix && innerText.length === 1) {
  788. val.iconName = byUnicode(val.prefix, toHex(node.innerText));
  789. }
  790. return val;
  791. };
  792. var parseTransformString = function parseTransformString(transformString) {
  793. var transform = {
  794. size: 16,
  795. x: 0,
  796. y: 0,
  797. flipX: false,
  798. flipY: false,
  799. rotate: 0
  800. };
  801. if (!transformString) {
  802. return transform;
  803. } else {
  804. return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
  805. var parts = n.toLowerCase().split('-');
  806. var first = parts[0];
  807. var rest = parts.slice(1).join('-');
  808. if (first && rest === 'h') {
  809. acc.flipX = true;
  810. return acc;
  811. }
  812. if (first && rest === 'v') {
  813. acc.flipY = true;
  814. return acc;
  815. }
  816. rest = parseFloat(rest);
  817. if (isNaN(rest)) {
  818. return acc;
  819. }
  820. switch (first) {
  821. case 'grow':
  822. acc.size = acc.size + rest;
  823. break;
  824. case 'shrink':
  825. acc.size = acc.size - rest;
  826. break;
  827. case 'left':
  828. acc.x = acc.x - rest;
  829. break;
  830. case 'right':
  831. acc.x = acc.x + rest;
  832. break;
  833. case 'up':
  834. acc.y = acc.y - rest;
  835. break;
  836. case 'down':
  837. acc.y = acc.y + rest;
  838. break;
  839. case 'rotate':
  840. acc.rotate = acc.rotate + rest;
  841. break;
  842. }
  843. return acc;
  844. }, transform);
  845. }
  846. };
  847. var transformParser = function (node) {
  848. return parseTransformString(node.getAttribute('data-fa-transform'));
  849. };
  850. var symbolParser = function (node) {
  851. var symbol = node.getAttribute('data-fa-symbol');
  852. return symbol === null ? false : symbol === '' ? true : symbol;
  853. };
  854. var attributesParser = function (node) {
  855. var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
  856. if (acc.name !== 'class' && acc.name !== 'style') {
  857. acc[attr.name] = attr.value;
  858. }
  859. return acc;
  860. }, {});
  861. var title = node.getAttribute('title');
  862. if (config$1.autoA11y) {
  863. if (title) {
  864. extraAttributes['aria-labelledby'] = config$1.replacementClass + '-title-' + nextUniqueId();
  865. } else {
  866. extraAttributes['aria-hidden'] = 'true';
  867. }
  868. }
  869. return extraAttributes;
  870. };
  871. var maskParser = function (node) {
  872. var mask = node.getAttribute('data-fa-mask');
  873. if (!mask) {
  874. return emptyCanonicalIcon();
  875. } else {
  876. return getCanonicalIcon(mask.split(' ').map(function (i) {
  877. return i.trim();
  878. }));
  879. }
  880. };
  881. function parseMeta(node) {
  882. var _classParser = classParser(node),
  883. iconName = _classParser.iconName,
  884. prefix = _classParser.prefix,
  885. extraClasses = _classParser.rest;
  886. var extraStyles = styleParser(node);
  887. var transform = transformParser(node);
  888. var symbol = symbolParser(node);
  889. var extraAttributes = attributesParser(node);
  890. var mask = maskParser(node);
  891. return {
  892. iconName: iconName,
  893. title: node.getAttribute('title'),
  894. prefix: prefix,
  895. transform: transform,
  896. symbol: symbol,
  897. mask: mask,
  898. extra: {
  899. classes: extraClasses,
  900. styles: extraStyles,
  901. attributes: extraAttributes
  902. }
  903. };
  904. }
  905. function MissingIcon(error) {
  906. this.name = 'MissingIcon';
  907. this.message = error || 'Icon unavailable';
  908. this.stack = new Error().stack;
  909. }
  910. MissingIcon.prototype = Object.create(Error.prototype);
  911. MissingIcon.prototype.constructor = MissingIcon;
  912. var FILL = { fill: 'currentColor' };
  913. var ANIMATION_BASE = {
  914. attributeType: 'XML',
  915. repeatCount: 'indefinite',
  916. dur: '2s'
  917. };
  918. var RING = {
  919. tag: 'path',
  920. attributes: _extends({}, FILL, {
  921. 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'
  922. })
  923. };
  924. var OPACITY_ANIMATE = _extends({}, ANIMATION_BASE, {
  925. attributeName: 'opacity'
  926. });
  927. var DOT = {
  928. tag: 'circle',
  929. attributes: _extends({}, FILL, {
  930. cx: '256',
  931. cy: '364',
  932. r: '28'
  933. }),
  934. children: [{ tag: 'animate', attributes: _extends({}, ANIMATION_BASE, { attributeName: 'r', values: '28;14;28;28;14;28;' }) }, { tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;1;1;0;1;' }) }]
  935. };
  936. var QUESTION = {
  937. tag: 'path',
  938. attributes: _extends({}, FILL, {
  939. opacity: '1',
  940. 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'
  941. }),
  942. children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;0;0;0;1;' }) }]
  943. };
  944. var EXCLAMATION = {
  945. tag: 'path',
  946. attributes: _extends({}, FILL, {
  947. opacity: '0',
  948. 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'
  949. }),
  950. children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '0;0;1;1;0;0;' }) }]
  951. };
  952. var missing = { tag: 'g', children: [RING, DOT, QUESTION, EXCLAMATION] };
  953. var styles = namespace.styles;
  954. var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
  955. var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands)/;
  956. var STYLE_TO_PREFIX = {
  957. 'Solid': 'fas',
  958. 'Regular': 'far',
  959. 'Light': 'fal',
  960. 'Brands': 'fab'
  961. };
  962. function findIcon(iconName, prefix) {
  963. var val = {
  964. found: false,
  965. width: 512,
  966. height: 512,
  967. icon: missing
  968. };
  969. if (iconName && prefix && styles[prefix] && styles[prefix][iconName]) {
  970. var icon = styles[prefix][iconName];
  971. var width = icon[0];
  972. var height = icon[1];
  973. var vectorData = icon.slice(4);
  974. val = {
  975. found: true,
  976. width: width,
  977. height: height,
  978. icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
  979. };
  980. } else if (iconName && prefix && !config$1.showMissingIcons) {
  981. throw new MissingIcon('Icon is missing for prefix ' + prefix + ' with icon name ' + iconName);
  982. }
  983. return val;
  984. }
  985. function generateSvgReplacementMutation(node, nodeMeta) {
  986. var iconName = nodeMeta.iconName,
  987. title = nodeMeta.title,
  988. prefix = nodeMeta.prefix,
  989. transform = nodeMeta.transform,
  990. symbol = nodeMeta.symbol,
  991. mask = nodeMeta.mask,
  992. extra = nodeMeta.extra;
  993. return [node, makeInlineSvgAbstract({
  994. icons: {
  995. main: findIcon(iconName, prefix),
  996. mask: findIcon(mask.iconName, mask.prefix)
  997. },
  998. prefix: prefix,
  999. iconName: iconName,
  1000. transform: transform,
  1001. symbol: symbol,
  1002. mask: mask,
  1003. title: title,
  1004. extra: extra,
  1005. watchable: true
  1006. })];
  1007. }
  1008. function generateLayersText(node, nodeMeta) {
  1009. var title = nodeMeta.title,
  1010. transform = nodeMeta.transform,
  1011. extra = nodeMeta.extra;
  1012. var width = null;
  1013. var height = null;
  1014. if (IS_IE) {
  1015. var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
  1016. var boundingClientRect = node.getBoundingClientRect();
  1017. width = boundingClientRect.width / computedFontSize;
  1018. height = boundingClientRect.height / computedFontSize;
  1019. }
  1020. if (config$1.autoA11y && !title) {
  1021. extra.attributes['aria-hidden'] = 'true';
  1022. }
  1023. return [node, makeLayersTextAbstract({
  1024. content: node.innerHTML,
  1025. width: width,
  1026. height: height,
  1027. transform: transform,
  1028. title: title,
  1029. extra: extra,
  1030. watchable: true
  1031. })];
  1032. }
  1033. function generateMutation(node) {
  1034. var nodeMeta = parseMeta(node);
  1035. if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
  1036. return generateLayersText(node, nodeMeta);
  1037. } else {
  1038. return generateSvgReplacementMutation(node, nodeMeta);
  1039. }
  1040. }
  1041. function remove(node) {
  1042. if (typeof node.remove === 'function') {
  1043. node.remove();
  1044. } else if (node && node.parentNode) {
  1045. node.parentNode.removeChild(node);
  1046. }
  1047. }
  1048. function searchPseudoElements(root) {
  1049. if (!IS_DOM) return;
  1050. var end = perf.begin('searchPseudoElements');
  1051. disableObservation(function () {
  1052. toArray(root.querySelectorAll('*')).forEach(function (node) {
  1053. [':before', ':after'].forEach(function (pos) {
  1054. var styles = WINDOW.getComputedStyle(node, pos);
  1055. var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
  1056. var children = toArray(node.children);
  1057. var pseudoElement = children.filter(function (c) {
  1058. return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === pos;
  1059. })[0];
  1060. if (pseudoElement) {
  1061. if (pseudoElement.nextSibling && pseudoElement.nextSibling.textContent.indexOf(DATA_FA_PSEUDO_ELEMENT) > -1) {
  1062. remove(pseudoElement.nextSibling);
  1063. }
  1064. remove(pseudoElement);
  1065. pseudoElement = null;
  1066. }
  1067. if (fontFamily && !pseudoElement) {
  1068. var content = styles.getPropertyValue('content');
  1069. var i = DOCUMENT.createElement('i');
  1070. i.setAttribute('class', '' + STYLE_TO_PREFIX[fontFamily[1]]);
  1071. i.setAttribute(DATA_FA_PSEUDO_ELEMENT, pos);
  1072. i.innerText = content.length === 3 ? content.substr(1, 1) : content;
  1073. if (pos === ':before') {
  1074. node.insertBefore(i, node.firstChild);
  1075. } else {
  1076. node.appendChild(i);
  1077. }
  1078. }
  1079. });
  1080. });
  1081. });
  1082. end();
  1083. }
  1084. function onTree(root) {
  1085. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1086. if (!IS_DOM) return;
  1087. var htmlClassList = DOCUMENT.documentElement.classList;
  1088. var hclAdd = function hclAdd(suffix) {
  1089. return htmlClassList.add(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
  1090. };
  1091. var hclRemove = function hclRemove(suffix) {
  1092. return htmlClassList.remove(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
  1093. };
  1094. var prefixes = Object.keys(styles);
  1095. var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) {
  1096. return '.' + p + ':not([' + DATA_FA_I2SVG + '])';
  1097. })).join(', ');
  1098. if (prefixesDomQuery.length === 0) {
  1099. return;
  1100. }
  1101. var candidates = toArray(root.querySelectorAll(prefixesDomQuery));
  1102. if (candidates.length > 0) {
  1103. hclAdd('pending');
  1104. hclRemove('complete');
  1105. } else {
  1106. return;
  1107. }
  1108. var mark = perf.begin('onTree');
  1109. var mutations = candidates.reduce(function (acc, node) {
  1110. try {
  1111. var mutation = generateMutation(node);
  1112. if (mutation) {
  1113. acc.push(mutation);
  1114. }
  1115. } catch (e) {
  1116. if (!PRODUCTION) {
  1117. if (e instanceof MissingIcon) {
  1118. console.error(e);
  1119. }
  1120. }
  1121. }
  1122. return acc;
  1123. }, []);
  1124. mark();
  1125. perform(mutations, function () {
  1126. hclAdd('active');
  1127. hclAdd('complete');
  1128. hclRemove('pending');
  1129. if (typeof callback === 'function') callback();
  1130. });
  1131. }
  1132. function onNode(node) {
  1133. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1134. var mutation = generateMutation(node);
  1135. if (mutation) {
  1136. perform([mutation], callback);
  1137. }
  1138. }
  1139. var baseStyles = "svg:not(:root).svg-inline--fa {\n overflow: visible; }\n\n.svg-inline--fa {\n display: inline-block;\n font-size: inherit;\n height: 1em;\n overflow: visible;\n vertical-align: -.125em; }\n .svg-inline--fa.fa-lg {\n vertical-align: -.225em; }\n .svg-inline--fa.fa-w-1 {\n width: 0.0625em; }\n .svg-inline--fa.fa-w-2 {\n width: 0.125em; }\n .svg-inline--fa.fa-w-3 {\n width: 0.1875em; }\n .svg-inline--fa.fa-w-4 {\n width: 0.25em; }\n .svg-inline--fa.fa-w-5 {\n width: 0.3125em; }\n .svg-inline--fa.fa-w-6 {\n width: 0.375em; }\n .svg-inline--fa.fa-w-7 {\n width: 0.4375em; }\n .svg-inline--fa.fa-w-8 {\n width: 0.5em; }\n .svg-inline--fa.fa-w-9 {\n width: 0.5625em; }\n .svg-inline--fa.fa-w-10 {\n width: 0.625em; }\n .svg-inline--fa.fa-w-11 {\n width: 0.6875em; }\n .svg-inline--fa.fa-w-12 {\n width: 0.75em; }\n .svg-inline--fa.fa-w-13 {\n width: 0.8125em; }\n .svg-inline--fa.fa-w-14 {\n width: 0.875em; }\n .svg-inline--fa.fa-w-15 {\n width: 0.9375em; }\n .svg-inline--fa.fa-w-16 {\n width: 1em; }\n .svg-inline--fa.fa-w-17 {\n width: 1.0625em; }\n .svg-inline--fa.fa-w-18 {\n width: 1.125em; }\n .svg-inline--fa.fa-w-19 {\n width: 1.1875em; }\n .svg-inline--fa.fa-w-20 {\n width: 1.25em; }\n .svg-inline--fa.fa-pull-left {\n margin-right: .3em;\n width: auto; }\n .svg-inline--fa.fa-pull-right {\n margin-left: .3em;\n width: auto; }\n .svg-inline--fa.fa-border {\n height: 1.5em; }\n .svg-inline--fa.fa-li {\n width: 2em; }\n .svg-inline--fa.fa-fw {\n width: 1.25em; }\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.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -.125em;\n width: 1em; }\n .fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n\n.fa-layers-text, .fa-layers-counter {\n display: inline-block;\n position: absolute;\n text-align: center; }\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.fa-layers-counter {\n background-color: #ff253a;\n border-radius: 1em;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n height: 1.5em;\n line-height: 1;\n max-width: 5em;\n min-width: 1.5em;\n overflow: hidden;\n padding: .25em;\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.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.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.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.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.fa-lg {\n font-size: 1.33333em;\n line-height: 0.75em;\n vertical-align: -.0667em; }\n\n.fa-xs {\n font-size: .75em; }\n\n.fa-sm {\n font-size: .875em; }\n\n.fa-1x {\n font-size: 1em; }\n\n.fa-2x {\n font-size: 2em; }\n\n.fa-3x {\n font-size: 3em; }\n\n.fa-4x {\n font-size: 4em; }\n\n.fa-5x {\n font-size: 5em; }\n\n.fa-6x {\n font-size: 6em; }\n\n.fa-7x {\n font-size: 7em; }\n\n.fa-8x {\n font-size: 8em; }\n\n.fa-9x {\n font-size: 9em; }\n\n.fa-10x {\n font-size: 10em; }\n\n.fa-fw {\n text-align: center;\n width: 1.25em; }\n\n.fa-ul {\n list-style-type: none;\n margin-left: 2.5em;\n padding-left: 0; }\n .fa-ul > li {\n position: relative; }\n\n.fa-li {\n left: -2em;\n position: absolute;\n text-align: center;\n width: 2em;\n line-height: inherit; }\n\n.fa-border {\n border: solid 0.08em #eee;\n border-radius: .1em;\n padding: .2em .25em .15em; }\n\n.fa-pull-left {\n float: left; }\n\n.fa-pull-right {\n float: right; }\n\n.fa.fa-pull-left,\n.fas.fa-pull-left,\n.far.fa-pull-left,\n.fal.fa-pull-left,\n.fab.fa-pull-left {\n margin-right: .3em; }\n\n.fa.fa-pull-right,\n.fas.fa-pull-right,\n.far.fa-pull-right,\n.fal.fa-pull-right,\n.fab.fa-pull-right {\n margin-left: .3em; }\n\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear; }\n\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8); }\n\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n.fa-rotate-90 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\";\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg); }\n\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg); }\n\n.fa-rotate-270 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\";\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg); }\n\n.fa-flip-horizontal {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\";\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1); }\n\n.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1); }\n\n.fa-flip-horizontal.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1); }\n\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical {\n -webkit-filter: none;\n filter: none; }\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n position: relative;\n width: 2em; }\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0; }\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1em; }\n\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2em; }\n\n.fa-inverse {\n color: #fff; }\n\n.sr-only {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px; }\n\n.sr-only-focusable:active, .sr-only-focusable:focus {\n clip: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n position: static;\n width: auto; }\n";
  1140. var css = function () {
  1141. var dfp = DEFAULT_FAMILY_PREFIX;
  1142. var drc = DEFAULT_REPLACEMENT_CLASS;
  1143. var fp = config$1.familyPrefix;
  1144. var rc = config$1.replacementClass;
  1145. var s = baseStyles;
  1146. if (fp !== dfp || rc !== drc) {
  1147. var dPatt = new RegExp('\\.' + dfp + '\\-', 'g');
  1148. var rPatt = new RegExp('\\.' + drc, 'g');
  1149. s = s.replace(dPatt, '.' + fp + '-').replace(rPatt, '.' + rc);
  1150. }
  1151. return s;
  1152. };
  1153. function define(prefix, icons) {
  1154. var normalized = Object.keys(icons).reduce(function (acc, iconName) {
  1155. var icon = icons[iconName];
  1156. var expanded = !!icon.icon;
  1157. if (expanded) {
  1158. acc[icon.iconName] = icon.icon;
  1159. } else {
  1160. acc[iconName] = icon;
  1161. }
  1162. return acc;
  1163. }, {});
  1164. if (typeof namespace.hooks.addPack === 'function') {
  1165. namespace.hooks.addPack(prefix, normalized);
  1166. } else {
  1167. namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, normalized);
  1168. }
  1169. /**
  1170. * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
  1171. * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
  1172. * for `fas` so we'll easy the upgrade process for our users by automatically defining
  1173. * this as well.
  1174. */
  1175. if (prefix === 'fas') {
  1176. define('fa', icons);
  1177. }
  1178. }
  1179. var Library = function () {
  1180. function Library() {
  1181. classCallCheck(this, Library);
  1182. this.definitions = {};
  1183. }
  1184. createClass(Library, [{
  1185. key: 'add',
  1186. value: function add() {
  1187. var _this = this;
  1188. for (var _len = arguments.length, definitions = Array(_len), _key = 0; _key < _len; _key++) {
  1189. definitions[_key] = arguments[_key];
  1190. }
  1191. var additions = definitions.reduce(this._pullDefinitions, {});
  1192. Object.keys(additions).forEach(function (key) {
  1193. _this.definitions[key] = _extends({}, _this.definitions[key] || {}, additions[key]);
  1194. define(key, additions[key]);
  1195. });
  1196. }
  1197. }, {
  1198. key: 'reset',
  1199. value: function reset() {
  1200. this.definitions = {};
  1201. }
  1202. }, {
  1203. key: '_pullDefinitions',
  1204. value: function _pullDefinitions(additions, definition) {
  1205. var normalized = definition.prefix && definition.iconName && definition.icon ? { 0: definition } : definition;
  1206. Object.keys(normalized).map(function (key) {
  1207. var _normalized$key = normalized[key],
  1208. prefix = _normalized$key.prefix,
  1209. iconName = _normalized$key.iconName,
  1210. icon = _normalized$key.icon;
  1211. if (!additions[prefix]) additions[prefix] = {};
  1212. additions[prefix][iconName] = icon;
  1213. });
  1214. return additions;
  1215. }
  1216. }]);
  1217. return Library;
  1218. }();
  1219. function prepIcon(icon) {
  1220. var width = icon[0];
  1221. var height = icon[1];
  1222. var vectorData = icon.slice(4);
  1223. return {
  1224. found: true,
  1225. width: width,
  1226. height: height,
  1227. icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
  1228. };
  1229. }
  1230. var _cssInserted = false;
  1231. function ensureCss() {
  1232. if (!config$1.autoAddCss) {
  1233. return;
  1234. }
  1235. if (!_cssInserted) {
  1236. insertCss(css());
  1237. }
  1238. _cssInserted = true;
  1239. }
  1240. function apiObject(val, abstractCreator) {
  1241. Object.defineProperty(val, 'abstract', {
  1242. get: abstractCreator
  1243. });
  1244. Object.defineProperty(val, 'html', {
  1245. get: function get() {
  1246. return val.abstract.map(function (a) {
  1247. return toHtml(a);
  1248. });
  1249. }
  1250. });
  1251. Object.defineProperty(val, 'node', {
  1252. get: function get() {
  1253. if (!IS_DOM) return;
  1254. var container = DOCUMENT.createElement('div');
  1255. container.innerHTML = val.html;
  1256. return container.children;
  1257. }
  1258. });
  1259. return val;
  1260. }
  1261. function findIconDefinition(params) {
  1262. var _params$prefix = params.prefix,
  1263. prefix = _params$prefix === undefined ? 'fa' : _params$prefix,
  1264. iconName = params.iconName;
  1265. if (!iconName) return;
  1266. return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
  1267. }
  1268. function resolveIcons(next) {
  1269. return function (maybeIconDefinition) {
  1270. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1271. var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
  1272. var mask = params.mask;
  1273. if (mask) {
  1274. mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
  1275. }
  1276. return next(iconDefinition, _extends({}, params, { mask: mask }));
  1277. };
  1278. }
  1279. var library = new Library();
  1280. var noAuto = function noAuto() {
  1281. auto(false);
  1282. disconnect();
  1283. };
  1284. var dom = {
  1285. i2svg: function i2svg() {
  1286. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1287. if (IS_DOM) {
  1288. ensureCss();
  1289. var _params$node = params.node,
  1290. node = _params$node === undefined ? DOCUMENT : _params$node,
  1291. _params$callback = params.callback,
  1292. callback = _params$callback === undefined ? function () {} : _params$callback;
  1293. if (config$1.searchPseudoElements) {
  1294. searchPseudoElements(node);
  1295. }
  1296. onTree(node, callback);
  1297. }
  1298. },
  1299. css: css,
  1300. insertCss: function insertCss$$1() {
  1301. insertCss(css());
  1302. }
  1303. };
  1304. var parse = {
  1305. transform: function transform(transformString) {
  1306. return parseTransformString(transformString);
  1307. }
  1308. };
  1309. var icon = resolveIcons(function (iconDefinition) {
  1310. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1311. var _params$transform = params.transform,
  1312. transform = _params$transform === undefined ? meaninglessTransform : _params$transform,
  1313. _params$symbol = params.symbol,
  1314. symbol = _params$symbol === undefined ? false : _params$symbol,
  1315. _params$mask = params.mask,
  1316. mask = _params$mask === undefined ? null : _params$mask,
  1317. _params$title = params.title,
  1318. title = _params$title === undefined ? null : _params$title,
  1319. _params$classes = params.classes,
  1320. classes = _params$classes === undefined ? [] : _params$classes,
  1321. _params$attributes = params.attributes,
  1322. attributes = _params$attributes === undefined ? {} : _params$attributes,
  1323. _params$styles = params.styles,
  1324. styles = _params$styles === undefined ? {} : _params$styles;
  1325. if (!iconDefinition) return;
  1326. var prefix = iconDefinition.prefix,
  1327. iconName = iconDefinition.iconName,
  1328. icon = iconDefinition.icon;
  1329. return apiObject(_extends({ type: 'icon' }, iconDefinition), function () {
  1330. ensureCss();
  1331. if (config$1.autoA11y) {
  1332. if (title) {
  1333. attributes['aria-labelledby'] = config$1.replacementClass + '-title-' + nextUniqueId();
  1334. } else {
  1335. attributes['aria-hidden'] = 'true';
  1336. }
  1337. }
  1338. return makeInlineSvgAbstract({
  1339. icons: {
  1340. main: prepIcon(icon),
  1341. mask: mask ? prepIcon(mask.icon) : { found: false, width: null, height: null, icon: {} }
  1342. },
  1343. prefix: prefix,
  1344. iconName: iconName,
  1345. transform: _extends({}, meaninglessTransform, transform),
  1346. symbol: symbol,
  1347. title: title,
  1348. extra: {
  1349. attributes: attributes,
  1350. styles: styles,
  1351. classes: classes
  1352. }
  1353. });
  1354. });
  1355. });
  1356. var text = function text(content) {
  1357. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1358. var _params$transform2 = params.transform,
  1359. transform = _params$transform2 === undefined ? meaninglessTransform : _params$transform2,
  1360. _params$title2 = params.title,
  1361. title = _params$title2 === undefined ? null : _params$title2,
  1362. _params$classes2 = params.classes,
  1363. classes = _params$classes2 === undefined ? [] : _params$classes2,
  1364. _params$attributes2 = params.attributes,
  1365. attributes = _params$attributes2 === undefined ? {} : _params$attributes2,
  1366. _params$styles2 = params.styles,
  1367. styles = _params$styles2 === undefined ? {} : _params$styles2;
  1368. return apiObject({ type: 'text', content: content }, function () {
  1369. ensureCss();
  1370. return makeLayersTextAbstract({
  1371. content: content,
  1372. transform: _extends({}, meaninglessTransform, transform),
  1373. title: title,
  1374. extra: {
  1375. attributes: attributes,
  1376. styles: styles,
  1377. classes: [config$1.familyPrefix + '-layers-text'].concat(toConsumableArray(classes))
  1378. }
  1379. });
  1380. });
  1381. };
  1382. var layer = function layer(assembler) {
  1383. return apiObject({ type: 'layer' }, function () {
  1384. ensureCss();
  1385. var children = [];
  1386. assembler(function (args) {
  1387. Array.isArray(args) ? args.map(function (a) {
  1388. children = children.concat(a.abstract);
  1389. }) : children = children.concat(args.abstract);
  1390. });
  1391. return [{
  1392. tag: 'span',
  1393. attributes: { class: config$1.familyPrefix + '-layers' },
  1394. children: children
  1395. }];
  1396. });
  1397. };
  1398. var api$1 = {
  1399. noAuto: noAuto,
  1400. dom: dom,
  1401. library: library,
  1402. parse: parse,
  1403. findIconDefinition: findIconDefinition,
  1404. icon: icon,
  1405. text: text,
  1406. layer: layer
  1407. };
  1408. var autoReplace = function autoReplace() {
  1409. if (IS_DOM && config$1.autoReplaceSvg) api$1.dom.i2svg({ node: DOCUMENT });
  1410. };
  1411. function bootstrap() {
  1412. if (IS_BROWSER) {
  1413. if (!WINDOW.FontAwesome) {
  1414. WINDOW.FontAwesome = api$1;
  1415. }
  1416. domready(function () {
  1417. if (Object.keys(namespace.styles).length > 0) {
  1418. autoReplace();
  1419. }
  1420. if (config$1.observeMutations && typeof MutationObserver === 'function') {
  1421. observe({
  1422. treeCallback: onTree,
  1423. nodeCallback: onNode,
  1424. pseudoElementsCallback: searchPseudoElements
  1425. });
  1426. }
  1427. });
  1428. }
  1429. namespace.hooks = _extends({}, namespace.hooks, {
  1430. addPack: function addPack(prefix, icons) {
  1431. namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, icons);
  1432. build();
  1433. autoReplace();
  1434. },
  1435. addShims: function addShims(shims) {
  1436. var _namespace$shims;
  1437. (_namespace$shims = namespace.shims).push.apply(_namespace$shims, toConsumableArray(shims));
  1438. build();
  1439. autoReplace();
  1440. }
  1441. });
  1442. }
  1443. Object.defineProperty(api$1, 'config', {
  1444. get: function get() {
  1445. return config$1;
  1446. },
  1447. set: function set(newConfig) {
  1448. update(newConfig);
  1449. }
  1450. });
  1451. if (IS_DOM) bunker(bootstrap);
  1452. var config = api$1.config;
  1453. export { config, icon, noAuto, layer, text, library, dom, parse, findIconDefinition };
  1454. export default api$1;