UNPKG

72.8 kBJavaScriptView Raw
1function _typeof(obj) {
2 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
3 _typeof = function (obj) {
4 return typeof obj;
5 };
6 } else {
7 _typeof = function (obj) {
8 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9 };
10 }
11
12 return _typeof(obj);
13}
14
15function _classCallCheck(instance, Constructor) {
16 if (!(instance instanceof Constructor)) {
17 throw new TypeError("Cannot call a class as a function");
18 }
19}
20
21function _defineProperties(target, props) {
22 for (var i = 0; i < props.length; i++) {
23 var descriptor = props[i];
24 descriptor.enumerable = descriptor.enumerable || false;
25 descriptor.configurable = true;
26 if ("value" in descriptor) descriptor.writable = true;
27 Object.defineProperty(target, descriptor.key, descriptor);
28 }
29}
30
31function _createClass(Constructor, protoProps, staticProps) {
32 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33 if (staticProps) _defineProperties(Constructor, staticProps);
34 return Constructor;
35}
36
37function _defineProperty(obj, key, value) {
38 if (key in obj) {
39 Object.defineProperty(obj, key, {
40 value: value,
41 enumerable: true,
42 configurable: true,
43 writable: true
44 });
45 } else {
46 obj[key] = value;
47 }
48
49 return obj;
50}
51
52function _objectSpread(target) {
53 for (var i = 1; i < arguments.length; i++) {
54 var source = arguments[i] != null ? arguments[i] : {};
55 var ownKeys = Object.keys(source);
56
57 if (typeof Object.getOwnPropertySymbols === 'function') {
58 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
59 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
60 }));
61 }
62
63 ownKeys.forEach(function (key) {
64 _defineProperty(target, key, source[key]);
65 });
66 }
67
68 return target;
69}
70
71function _slicedToArray(arr, i) {
72 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
73}
74
75function _toConsumableArray(arr) {
76 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
77}
78
79function _arrayWithoutHoles(arr) {
80 if (Array.isArray(arr)) {
81 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
82
83 return arr2;
84 }
85}
86
87function _arrayWithHoles(arr) {
88 if (Array.isArray(arr)) return arr;
89}
90
91function _iterableToArray(iter) {
92 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
93}
94
95function _iterableToArrayLimit(arr, i) {
96 var _arr = [];
97 var _n = true;
98 var _d = false;
99 var _e = undefined;
100
101 try {
102 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
103 _arr.push(_s.value);
104
105 if (i && _arr.length === i) break;
106 }
107 } catch (err) {
108 _d = true;
109 _e = err;
110 } finally {
111 try {
112 if (!_n && _i["return"] != null) _i["return"]();
113 } finally {
114 if (_d) throw _e;
115 }
116 }
117
118 return _arr;
119}
120
121function _nonIterableSpread() {
122 throw new TypeError("Invalid attempt to spread non-iterable instance");
123}
124
125function _nonIterableRest() {
126 throw new TypeError("Invalid attempt to destructure non-iterable instance");
127}
128
129var noop = function noop() {};
130
131var _WINDOW = {};
132var _DOCUMENT = {};
133var _MUTATION_OBSERVER = null;
134var _PERFORMANCE = {
135 mark: noop,
136 measure: noop
137};
138
139try {
140 if (typeof window !== 'undefined') _WINDOW = window;
141 if (typeof document !== 'undefined') _DOCUMENT = document;
142 if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
143 if (typeof performance !== 'undefined') _PERFORMANCE = performance;
144} catch (e) {}
145
146var _ref = _WINDOW.navigator || {},
147 _ref$userAgent = _ref.userAgent,
148 userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
149
150var WINDOW = _WINDOW;
151var DOCUMENT = _DOCUMENT;
152var MUTATION_OBSERVER = _MUTATION_OBSERVER;
153var PERFORMANCE = _PERFORMANCE;
154var IS_BROWSER = !!WINDOW.document;
155var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
156var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
157
158var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
159var UNITS_IN_GRID = 16;
160var DEFAULT_FAMILY_PREFIX = 'fa';
161var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
162var DATA_FA_I2SVG = 'data-fa-i2svg';
163var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
164var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
165var DATA_PREFIX = 'data-prefix';
166var DATA_ICON = 'data-icon';
167var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
168var MUTATION_APPROACH_ASYNC = 'async';
169var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
170var PRODUCTION = function () {
171 try {
172 return process.env.NODE_ENV === 'production';
173 } catch (e) {
174 return false;
175 }
176}();
177var PREFIX_TO_STYLE = {
178 'fas': 'solid',
179 'far': 'regular',
180 'fal': 'light',
181 'fab': 'brands',
182 'fa': 'solid'
183};
184var STYLE_TO_PREFIX = {
185 'solid': 'fas',
186 'regular': 'far',
187 'light': 'fal',
188 'brands': 'fab'
189};
190var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
191var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/;
192var FONT_WEIGHT_TO_PREFIX = {
193 '900': 'fas',
194 '400': 'far',
195 'normal': 'far',
196 '300': 'fal'
197};
198var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
199var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
200var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
201var 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', 'flip-both', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter'].concat(oneToTen.map(function (n) {
202 return "".concat(n, "x");
203})).concat(oneToTwenty.map(function (n) {
204 return "w-".concat(n);
205}));
206
207var initial = WINDOW.FontAwesomeConfig || {};
208
209function getAttrConfig(attr) {
210 var element = DOCUMENT.querySelector('script[' + attr + ']');
211
212 if (element) {
213 return element.getAttribute(attr);
214 }
215}
216
217function coerce(val) {
218 // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
219 // We'll assume that this is an indication that it should be toggled to true
220 // For example <script data-search-pseudo-elements src="..."></script>
221 if (val === '') return true;
222 if (val === 'false') return false;
223 if (val === 'true') return true;
224 return val;
225}
226
227if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
228 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-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
229 attrs.forEach(function (_ref) {
230 var _ref2 = _slicedToArray(_ref, 2),
231 attr = _ref2[0],
232 key = _ref2[1];
233
234 var val = coerce(getAttrConfig(attr));
235
236 if (val !== undefined && val !== null) {
237 initial[key] = val;
238 }
239 });
240}
241
242var _default = {
243 familyPrefix: DEFAULT_FAMILY_PREFIX,
244 replacementClass: DEFAULT_REPLACEMENT_CLASS,
245 autoReplaceSvg: true,
246 autoAddCss: true,
247 autoA11y: true,
248 searchPseudoElements: false,
249 observeMutations: true,
250 mutateApproach: 'async',
251 keepOriginalSource: true,
252 measurePerformance: false,
253 showMissingIcons: true
254};
255
256var _config = _objectSpread({}, _default, initial);
257
258if (!_config.autoReplaceSvg) _config.observeMutations = false;
259
260var config = _objectSpread({}, _config);
261
262WINDOW.FontAwesomeConfig = config;
263
264var w = WINDOW || {};
265if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
266if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
267if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
268if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
269var namespace = w[NAMESPACE_IDENTIFIER];
270
271var functions = [];
272
273var listener = function listener() {
274 DOCUMENT.removeEventListener('DOMContentLoaded', listener);
275 loaded = 1;
276 functions.map(function (fn) {
277 return fn();
278 });
279};
280
281var loaded = false;
282
283if (IS_DOM) {
284 loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
285 if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
286}
287
288function domready (fn) {
289 if (!IS_DOM) return;
290 loaded ? setTimeout(fn, 0) : functions.push(fn);
291}
292
293var PENDING = 'pending';
294var SETTLED = 'settled';
295var FULFILLED = 'fulfilled';
296var REJECTED = 'rejected';
297
298var NOOP = function NOOP() {};
299
300var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
301var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
302var asyncQueue = [];
303var asyncTimer;
304
305function asyncFlush() {
306 // run promise callbacks
307 for (var i = 0; i < asyncQueue.length; i++) {
308 asyncQueue[i][0](asyncQueue[i][1]);
309 } // reset async asyncQueue
310
311
312 asyncQueue = [];
313 asyncTimer = false;
314}
315
316function asyncCall(callback, arg) {
317 asyncQueue.push([callback, arg]);
318
319 if (!asyncTimer) {
320 asyncTimer = true;
321 asyncSetTimer(asyncFlush, 0);
322 }
323}
324
325function invokeResolver(resolver, promise) {
326 function resolvePromise(value) {
327 resolve(promise, value);
328 }
329
330 function rejectPromise(reason) {
331 reject(promise, reason);
332 }
333
334 try {
335 resolver(resolvePromise, rejectPromise);
336 } catch (e) {
337 rejectPromise(e);
338 }
339}
340
341function invokeCallback(subscriber) {
342 var owner = subscriber.owner;
343 var settled = owner._state;
344 var value = owner._data;
345 var callback = subscriber[settled];
346 var promise = subscriber.then;
347
348 if (typeof callback === 'function') {
349 settled = FULFILLED;
350
351 try {
352 value = callback(value);
353 } catch (e) {
354 reject(promise, e);
355 }
356 }
357
358 if (!handleThenable(promise, value)) {
359 if (settled === FULFILLED) {
360 resolve(promise, value);
361 }
362
363 if (settled === REJECTED) {
364 reject(promise, value);
365 }
366 }
367}
368
369function handleThenable(promise, value) {
370 var resolved;
371
372 try {
373 if (promise === value) {
374 throw new TypeError('A promises callback cannot return that same promise.');
375 }
376
377 if (value && (typeof value === 'function' || _typeof(value) === 'object')) {
378 // then should be retrieved only once
379 var then = value.then;
380
381 if (typeof then === 'function') {
382 then.call(value, function (val) {
383 if (!resolved) {
384 resolved = true;
385
386 if (value === val) {
387 fulfill(promise, val);
388 } else {
389 resolve(promise, val);
390 }
391 }
392 }, function (reason) {
393 if (!resolved) {
394 resolved = true;
395 reject(promise, reason);
396 }
397 });
398 return true;
399 }
400 }
401 } catch (e) {
402 if (!resolved) {
403 reject(promise, e);
404 }
405
406 return true;
407 }
408
409 return false;
410}
411
412function resolve(promise, value) {
413 if (promise === value || !handleThenable(promise, value)) {
414 fulfill(promise, value);
415 }
416}
417
418function fulfill(promise, value) {
419 if (promise._state === PENDING) {
420 promise._state = SETTLED;
421 promise._data = value;
422 asyncCall(publishFulfillment, promise);
423 }
424}
425
426function reject(promise, reason) {
427 if (promise._state === PENDING) {
428 promise._state = SETTLED;
429 promise._data = reason;
430 asyncCall(publishRejection, promise);
431 }
432}
433
434function publish(promise) {
435 promise._then = promise._then.forEach(invokeCallback);
436}
437
438function publishFulfillment(promise) {
439 promise._state = FULFILLED;
440 publish(promise);
441}
442
443function publishRejection(promise) {
444 promise._state = REJECTED;
445 publish(promise);
446
447 if (!promise._handled && isNode) {
448 global.process.emit('unhandledRejection', promise._data, promise);
449 }
450}
451
452function notifyRejectionHandled(promise) {
453 global.process.emit('rejectionHandled', promise);
454}
455/**
456 * @class
457 */
458
459
460function P(resolver) {
461 if (typeof resolver !== 'function') {
462 throw new TypeError('Promise resolver ' + resolver + ' is not a function');
463 }
464
465 if (this instanceof P === false) {
466 throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
467 }
468
469 this._then = [];
470 invokeResolver(resolver, this);
471}
472
473P.prototype = {
474 constructor: P,
475 _state: PENDING,
476 _then: null,
477 _data: undefined,
478 _handled: false,
479 then: function then(onFulfillment, onRejection) {
480 var subscriber = {
481 owner: this,
482 then: new this.constructor(NOOP),
483 fulfilled: onFulfillment,
484 rejected: onRejection
485 };
486
487 if ((onRejection || onFulfillment) && !this._handled) {
488 this._handled = true;
489
490 if (this._state === REJECTED && isNode) {
491 asyncCall(notifyRejectionHandled, this);
492 }
493 }
494
495 if (this._state === FULFILLED || this._state === REJECTED) {
496 // already resolved, call callback async
497 asyncCall(invokeCallback, subscriber);
498 } else {
499 // subscribe
500 this._then.push(subscriber);
501 }
502
503 return subscriber.then;
504 },
505 catch: function _catch(onRejection) {
506 return this.then(null, onRejection);
507 }
508};
509
510P.all = function (promises) {
511 if (!Array.isArray(promises)) {
512 throw new TypeError('You must pass an array to Promise.all().');
513 }
514
515 return new P(function (resolve, reject) {
516 var results = [];
517 var remaining = 0;
518
519 function resolver(index) {
520 remaining++;
521 return function (value) {
522 results[index] = value;
523
524 if (! --remaining) {
525 resolve(results);
526 }
527 };
528 }
529
530 for (var i = 0, promise; i < promises.length; i++) {
531 promise = promises[i];
532
533 if (promise && typeof promise.then === 'function') {
534 promise.then(resolver(i), reject);
535 } else {
536 results[i] = promise;
537 }
538 }
539
540 if (!remaining) {
541 resolve(results);
542 }
543 });
544};
545
546P.race = function (promises) {
547 if (!Array.isArray(promises)) {
548 throw new TypeError('You must pass an array to Promise.race().');
549 }
550
551 return new P(function (resolve, reject) {
552 for (var i = 0, promise; i < promises.length; i++) {
553 promise = promises[i];
554
555 if (promise && typeof promise.then === 'function') {
556 promise.then(resolve, reject);
557 } else {
558 resolve(promise);
559 }
560 }
561 });
562};
563
564P.resolve = function (value) {
565 if (value && _typeof(value) === 'object' && value.constructor === P) {
566 return value;
567 }
568
569 return new P(function (resolve) {
570 resolve(value);
571 });
572};
573
574P.reject = function (reason) {
575 return new P(function (resolve, reject) {
576 reject(reason);
577 });
578};
579
580var picked = typeof Promise === 'function' ? Promise : P;
581
582var d = UNITS_IN_GRID;
583var meaninglessTransform = {
584 size: 16,
585 x: 0,
586 y: 0,
587 rotate: 0,
588 flipX: false,
589 flipY: false
590};
591
592function isReserved(name) {
593 return ~RESERVED_CLASSES.indexOf(name);
594}
595function insertCss(css) {
596 if (!css || !IS_DOM) {
597 return;
598 }
599
600 var style = DOCUMENT.createElement('style');
601 style.setAttribute('type', 'text/css');
602 style.innerHTML = css;
603 var headChildren = DOCUMENT.head.childNodes;
604 var beforeChild = null;
605
606 for (var i = headChildren.length - 1; i > -1; i--) {
607 var child = headChildren[i];
608 var tagName = (child.tagName || '').toUpperCase();
609
610 if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
611 beforeChild = child;
612 }
613 }
614
615 DOCUMENT.head.insertBefore(style, beforeChild);
616 return css;
617}
618var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
619function nextUniqueId() {
620 var size = 12;
621 var id = '';
622
623 while (size-- > 0) {
624 id += idPool[Math.random() * 62 | 0];
625 }
626
627 return id;
628}
629function toArray(obj) {
630 var array = [];
631
632 for (var i = (obj || []).length >>> 0; i--;) {
633 array[i] = obj[i];
634 }
635
636 return array;
637}
638function classArray(node) {
639 if (node.classList) {
640 return toArray(node.classList);
641 } else {
642 return (node.getAttribute('class') || '').split(' ').filter(function (i) {
643 return i;
644 });
645 }
646}
647function getIconName(familyPrefix, cls) {
648 var parts = cls.split('-');
649 var prefix = parts[0];
650 var iconName = parts.slice(1).join('-');
651
652 if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
653 return iconName;
654 } else {
655 return null;
656 }
657}
658function htmlEscape(str) {
659 return "".concat(str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
660}
661function joinAttributes(attributes) {
662 return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
663 return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
664 }, '').trim();
665}
666function joinStyles(styles) {
667 return Object.keys(styles || {}).reduce(function (acc, styleName) {
668 return acc + "".concat(styleName, ": ").concat(styles[styleName], ";");
669 }, '');
670}
671function transformIsMeaningful(transform) {
672 return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
673}
674function transformForSvg(_ref) {
675 var transform = _ref.transform,
676 containerWidth = _ref.containerWidth,
677 iconWidth = _ref.iconWidth;
678 var outer = {
679 transform: "translate(".concat(containerWidth / 2, " 256)")
680 };
681 var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
682 var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
683 var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
684 var inner = {
685 transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
686 };
687 var path = {
688 transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
689 };
690 return {
691 outer: outer,
692 inner: inner,
693 path: path
694 };
695}
696function transformForCss(_ref2) {
697 var transform = _ref2.transform,
698 _ref2$width = _ref2.width,
699 width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
700 _ref2$height = _ref2.height,
701 height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
702 _ref2$startCentered = _ref2.startCentered,
703 startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
704 var val = '';
705
706 if (startCentered && IS_IE) {
707 val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
708 } else if (startCentered) {
709 val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
710 } else {
711 val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
712 }
713
714 val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
715 val += "rotate(".concat(transform.rotate, "deg) ");
716 return val;
717}
718
719var ALL_SPACE = {
720 x: 0,
721 y: 0,
722 width: '100%',
723 height: '100%'
724};
725function makeIconMasking (_ref) {
726 var children = _ref.children,
727 attributes = _ref.attributes,
728 main = _ref.main,
729 mask = _ref.mask,
730 transform = _ref.transform;
731 var mainWidth = main.width,
732 mainPath = main.icon;
733 var maskWidth = mask.width,
734 maskPath = mask.icon;
735 var trans = transformForSvg({
736 transform: transform,
737 containerWidth: maskWidth,
738 iconWidth: mainWidth
739 });
740 var maskRect = {
741 tag: 'rect',
742 attributes: _objectSpread({}, ALL_SPACE, {
743 fill: 'white'
744 })
745 };
746 var maskInnerGroup = {
747 tag: 'g',
748 attributes: _objectSpread({}, trans.inner),
749 children: [{
750 tag: 'path',
751 attributes: _objectSpread({}, mainPath.attributes, trans.path, {
752 fill: 'black'
753 })
754 }]
755 };
756 var maskOuterGroup = {
757 tag: 'g',
758 attributes: _objectSpread({}, trans.outer),
759 children: [maskInnerGroup]
760 };
761 var maskId = "mask-".concat(nextUniqueId());
762 var clipId = "clip-".concat(nextUniqueId());
763 var maskTag = {
764 tag: 'mask',
765 attributes: _objectSpread({}, ALL_SPACE, {
766 id: maskId,
767 maskUnits: 'userSpaceOnUse',
768 maskContentUnits: 'userSpaceOnUse'
769 }),
770 children: [maskRect, maskOuterGroup]
771 };
772 var defs = {
773 tag: 'defs',
774 children: [{
775 tag: 'clipPath',
776 attributes: {
777 id: clipId
778 },
779 children: [maskPath]
780 }, maskTag]
781 };
782 children.push(defs, {
783 tag: 'rect',
784 attributes: _objectSpread({
785 fill: 'currentColor',
786 'clip-path': "url(#".concat(clipId, ")"),
787 mask: "url(#".concat(maskId, ")")
788 }, ALL_SPACE)
789 });
790 return {
791 children: children,
792 attributes: attributes
793 };
794}
795
796function makeIconStandard (_ref) {
797 var children = _ref.children,
798 attributes = _ref.attributes,
799 main = _ref.main,
800 transform = _ref.transform,
801 styles = _ref.styles;
802 var styleString = joinStyles(styles);
803
804 if (styleString.length > 0) {
805 attributes['style'] = styleString;
806 }
807
808 if (transformIsMeaningful(transform)) {
809 var trans = transformForSvg({
810 transform: transform,
811 containerWidth: main.width,
812 iconWidth: main.width
813 });
814 children.push({
815 tag: 'g',
816 attributes: _objectSpread({}, trans.outer),
817 children: [{
818 tag: 'g',
819 attributes: _objectSpread({}, trans.inner),
820 children: [{
821 tag: main.icon.tag,
822 children: main.icon.children,
823 attributes: _objectSpread({}, main.icon.attributes, trans.path)
824 }]
825 }]
826 });
827 } else {
828 children.push(main.icon);
829 }
830
831 return {
832 children: children,
833 attributes: attributes
834 };
835}
836
837function asIcon (_ref) {
838 var children = _ref.children,
839 main = _ref.main,
840 mask = _ref.mask,
841 attributes = _ref.attributes,
842 styles = _ref.styles,
843 transform = _ref.transform;
844
845 if (transformIsMeaningful(transform) && main.found && !mask.found) {
846 var width = main.width,
847 height = main.height;
848 var offset = {
849 x: width / height / 2,
850 y: 0.5
851 };
852 attributes['style'] = joinStyles(_objectSpread({}, styles, {
853 'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
854 }));
855 }
856
857 return [{
858 tag: 'svg',
859 attributes: attributes,
860 children: children
861 }];
862}
863
864function asSymbol (_ref) {
865 var prefix = _ref.prefix,
866 iconName = _ref.iconName,
867 children = _ref.children,
868 attributes = _ref.attributes,
869 symbol = _ref.symbol;
870 var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
871 return [{
872 tag: 'svg',
873 attributes: {
874 style: 'display: none;'
875 },
876 children: [{
877 tag: 'symbol',
878 attributes: _objectSpread({}, attributes, {
879 id: id
880 }),
881 children: children
882 }]
883 }];
884}
885
886function makeInlineSvgAbstract(params) {
887 var _params$icons = params.icons,
888 main = _params$icons.main,
889 mask = _params$icons.mask,
890 prefix = params.prefix,
891 iconName = params.iconName,
892 transform = params.transform,
893 symbol = params.symbol,
894 title = params.title,
895 extra = params.extra,
896 _params$watchable = params.watchable,
897 watchable = _params$watchable === void 0 ? false : _params$watchable;
898
899 var _ref = mask.found ? mask : main,
900 width = _ref.width,
901 height = _ref.height;
902
903 var widthClass = "fa-w-".concat(Math.ceil(width / height * 16));
904 var attrClass = [config.replacementClass, iconName ? "".concat(config.familyPrefix, "-").concat(iconName) : '', widthClass].filter(function (c) {
905 return extra.classes.indexOf(c) === -1;
906 }).concat(extra.classes).join(' ');
907 var content = {
908 children: [],
909 attributes: _objectSpread({}, extra.attributes, {
910 'data-prefix': prefix,
911 'data-icon': iconName,
912 'class': attrClass,
913 'role': 'img',
914 'xmlns': 'http://www.w3.org/2000/svg',
915 'viewBox': "0 0 ".concat(width, " ").concat(height)
916 })
917 };
918
919 if (watchable) {
920 content.attributes[DATA_FA_I2SVG] = '';
921 }
922
923 if (title) content.children.push({
924 tag: 'title',
925 attributes: {
926 id: content.attributes['aria-labelledby'] || "title-".concat(nextUniqueId())
927 },
928 children: [title]
929 });
930
931 var args = _objectSpread({}, content, {
932 prefix: prefix,
933 iconName: iconName,
934 main: main,
935 mask: mask,
936 transform: transform,
937 symbol: symbol,
938 styles: extra.styles
939 });
940
941 var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
942 children = _ref2.children,
943 attributes = _ref2.attributes;
944
945 args.children = children;
946 args.attributes = attributes;
947
948 if (symbol) {
949 return asSymbol(args);
950 } else {
951 return asIcon(args);
952 }
953}
954function makeLayersTextAbstract(params) {
955 var content = params.content,
956 width = params.width,
957 height = params.height,
958 transform = params.transform,
959 title = params.title,
960 extra = params.extra,
961 _params$watchable2 = params.watchable,
962 watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
963
964 var attributes = _objectSpread({}, extra.attributes, title ? {
965 'title': title
966 } : {}, {
967 'class': extra.classes.join(' ')
968 });
969
970 if (watchable) {
971 attributes[DATA_FA_I2SVG] = '';
972 }
973
974 var styles = _objectSpread({}, extra.styles);
975
976 if (transformIsMeaningful(transform)) {
977 styles['transform'] = transformForCss({
978 transform: transform,
979 startCentered: true,
980 width: width,
981 height: height
982 });
983 styles['-webkit-transform'] = styles['transform'];
984 }
985
986 var styleString = joinStyles(styles);
987
988 if (styleString.length > 0) {
989 attributes['style'] = styleString;
990 }
991
992 var val = [];
993 val.push({
994 tag: 'span',
995 attributes: attributes,
996 children: [content]
997 });
998
999 if (title) {
1000 val.push({
1001 tag: 'span',
1002 attributes: {
1003 class: 'sr-only'
1004 },
1005 children: [title]
1006 });
1007 }
1008
1009 return val;
1010}
1011function makeLayersCounterAbstract(params) {
1012 var content = params.content,
1013 title = params.title,
1014 extra = params.extra;
1015
1016 var attributes = _objectSpread({}, extra.attributes, title ? {
1017 'title': title
1018 } : {}, {
1019 'class': extra.classes.join(' ')
1020 });
1021
1022 var styleString = joinStyles(extra.styles);
1023
1024 if (styleString.length > 0) {
1025 attributes['style'] = styleString;
1026 }
1027
1028 var val = [];
1029 val.push({
1030 tag: 'span',
1031 attributes: attributes,
1032 children: [content]
1033 });
1034
1035 if (title) {
1036 val.push({
1037 tag: 'span',
1038 attributes: {
1039 class: 'sr-only'
1040 },
1041 children: [title]
1042 });
1043 }
1044
1045 return val;
1046}
1047
1048var noop$1 = function noop() {};
1049
1050var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
1051 mark: noop$1,
1052 measure: noop$1
1053};
1054var preamble = "FA \"5.8.0\"";
1055
1056var begin = function begin(name) {
1057 p.mark("".concat(preamble, " ").concat(name, " begins"));
1058 return function () {
1059 return end(name);
1060 };
1061};
1062
1063var end = function end(name) {
1064 p.mark("".concat(preamble, " ").concat(name, " ends"));
1065 p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
1066};
1067
1068var perf = {
1069 begin: begin,
1070 end: end
1071};
1072
1073/**
1074 * Internal helper to bind a function known to have 4 arguments
1075 * to a given context.
1076 */
1077
1078var bindInternal4 = function bindInternal4(func, thisContext) {
1079 return function (a, b, c, d) {
1080 return func.call(thisContext, a, b, c, d);
1081 };
1082};
1083
1084/**
1085 * # Reduce
1086 *
1087 * A fast object `.reduce()` implementation.
1088 *
1089 * @param {Object} subject The object to reduce over.
1090 * @param {Function} fn The reducer function.
1091 * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
1092 * @param {Object} thisContext The context for the reducer.
1093 * @return {mixed} The final result.
1094 */
1095
1096
1097var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
1098 var keys = Object.keys(subject),
1099 length = keys.length,
1100 iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
1101 i,
1102 key,
1103 result;
1104
1105 if (initialValue === undefined) {
1106 i = 1;
1107 result = subject[keys[0]];
1108 } else {
1109 i = 0;
1110 result = initialValue;
1111 }
1112
1113 for (; i < length; i++) {
1114 key = keys[i];
1115 result = iterator(result, subject[key], key, subject);
1116 }
1117
1118 return result;
1119};
1120
1121function defineIcons(prefix, icons) {
1122 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1123 var _params$skipHooks = params.skipHooks,
1124 skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
1125 var normalized = Object.keys(icons).reduce(function (acc, iconName) {
1126 var icon = icons[iconName];
1127 var expanded = !!icon.icon;
1128
1129 if (expanded) {
1130 acc[icon.iconName] = icon.icon;
1131 } else {
1132 acc[iconName] = icon;
1133 }
1134
1135 return acc;
1136 }, {});
1137
1138 if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
1139 namespace.hooks.addPack(prefix, normalized);
1140 } else {
1141 namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
1142 }
1143 /**
1144 * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
1145 * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
1146 * for `fas` so we'll easy the upgrade process for our users by automatically defining
1147 * this as well.
1148 */
1149
1150
1151 if (prefix === 'fas') {
1152 defineIcons('fa', icons);
1153 }
1154}
1155
1156var styles = namespace.styles,
1157 shims = namespace.shims;
1158var _byUnicode = {};
1159var _byLigature = {};
1160var _byOldName = {};
1161var build = function build() {
1162 var lookup = function lookup(reducer) {
1163 return reduce(styles, function (o, style, prefix) {
1164 o[prefix] = reduce(style, reducer, {});
1165 return o;
1166 }, {});
1167 };
1168
1169 _byUnicode = lookup(function (acc, icon, iconName) {
1170 if (icon[3]) {
1171 acc[icon[3]] = iconName;
1172 }
1173
1174 return acc;
1175 });
1176 _byLigature = lookup(function (acc, icon, iconName) {
1177 var ligatures = icon[2];
1178 acc[iconName] = iconName;
1179 ligatures.forEach(function (ligature) {
1180 acc[ligature] = iconName;
1181 });
1182 return acc;
1183 });
1184 var hasRegular = 'far' in styles;
1185 _byOldName = reduce(shims, function (acc, shim) {
1186 var oldName = shim[0];
1187 var prefix = shim[1];
1188 var iconName = shim[2];
1189
1190 if (prefix === 'far' && !hasRegular) {
1191 prefix = 'fas';
1192 }
1193
1194 acc[oldName] = {
1195 prefix: prefix,
1196 iconName: iconName
1197 };
1198 return acc;
1199 }, {});
1200};
1201build();
1202function byUnicode(prefix, unicode) {
1203 return _byUnicode[prefix][unicode];
1204}
1205function byLigature(prefix, ligature) {
1206 return _byLigature[prefix][ligature];
1207}
1208function byOldName(name) {
1209 return _byOldName[name] || {
1210 prefix: null,
1211 iconName: null
1212 };
1213}
1214
1215var styles$1 = namespace.styles;
1216var emptyCanonicalIcon = function emptyCanonicalIcon() {
1217 return {
1218 prefix: null,
1219 iconName: null,
1220 rest: []
1221 };
1222};
1223function getCanonicalIcon(values) {
1224 return values.reduce(function (acc, cls) {
1225 var iconName = getIconName(config.familyPrefix, cls);
1226
1227 if (styles$1[cls]) {
1228 acc.prefix = cls;
1229 } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fab', 'fa'].indexOf(cls) > -1) {
1230 acc.prefix = cls;
1231 } else if (iconName) {
1232 var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
1233 acc.iconName = shim.iconName || iconName;
1234 acc.prefix = shim.prefix || acc.prefix;
1235 } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
1236 acc.rest.push(cls);
1237 }
1238
1239 return acc;
1240 }, emptyCanonicalIcon());
1241}
1242function iconFromMapping(mapping, prefix, iconName) {
1243 if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
1244 return {
1245 prefix: prefix,
1246 iconName: iconName,
1247 icon: mapping[prefix][iconName]
1248 };
1249 }
1250}
1251
1252function toHtml(abstractNodes) {
1253 var tag = abstractNodes.tag,
1254 _abstractNodes$attrib = abstractNodes.attributes,
1255 attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
1256 _abstractNodes$childr = abstractNodes.children,
1257 children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
1258
1259 if (typeof abstractNodes === 'string') {
1260 return htmlEscape(abstractNodes);
1261 } else {
1262 return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
1263 }
1264}
1265
1266var noop$2 = function noop() {};
1267
1268function isWatched(node) {
1269 var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
1270 return typeof i2svg === 'string';
1271}
1272
1273function getMutator() {
1274 if (config.autoReplaceSvg === true) {
1275 return mutators.replace;
1276 }
1277
1278 var mutator = mutators[config.autoReplaceSvg];
1279 return mutator || mutators.replace;
1280}
1281
1282var mutators = {
1283 replace: function replace(mutation) {
1284 var node = mutation[0];
1285 var abstract = mutation[1];
1286 var newOuterHTML = abstract.map(function (a) {
1287 return toHtml(a);
1288 }).join('\n');
1289
1290 if (node.parentNode && node.outerHTML) {
1291 node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : '');
1292 } else if (node.parentNode) {
1293 var newNode = document.createElement('span');
1294 node.parentNode.replaceChild(newNode, node);
1295 newNode.outerHTML = newOuterHTML;
1296 }
1297 },
1298 nest: function nest(mutation) {
1299 var node = mutation[0];
1300 var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
1301 // Short-circuit to the standard replacement
1302
1303 if (~classArray(node).indexOf(config.replacementClass)) {
1304 return mutators.replace(mutation);
1305 }
1306
1307 var forSvg = new RegExp("".concat(config.familyPrefix, "-.*"));
1308 delete abstract[0].attributes.style;
1309 var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
1310 if (cls === config.replacementClass || cls.match(forSvg)) {
1311 acc.toSvg.push(cls);
1312 } else {
1313 acc.toNode.push(cls);
1314 }
1315
1316 return acc;
1317 }, {
1318 toNode: [],
1319 toSvg: []
1320 });
1321 abstract[0].attributes.class = splitClasses.toSvg.join(' ');
1322 var newInnerHTML = abstract.map(function (a) {
1323 return toHtml(a);
1324 }).join('\n');
1325 node.setAttribute('class', splitClasses.toNode.join(' '));
1326 node.setAttribute(DATA_FA_I2SVG, '');
1327 node.innerHTML = newInnerHTML;
1328 }
1329};
1330
1331function performOperationSync(op) {
1332 op();
1333}
1334
1335function perform(mutations, callback) {
1336 var callbackFunction = typeof callback === 'function' ? callback : noop$2;
1337
1338 if (mutations.length === 0) {
1339 callbackFunction();
1340 } else {
1341 var frame = performOperationSync;
1342
1343 if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
1344 frame = WINDOW.requestAnimationFrame || performOperationSync;
1345 }
1346
1347 frame(function () {
1348 var mutator = getMutator();
1349 var mark = perf.begin('mutate');
1350 mutations.map(mutator);
1351 mark();
1352 callbackFunction();
1353 });
1354 }
1355}
1356var disabled = false;
1357function disableObservation() {
1358 disabled = true;
1359}
1360function enableObservation() {
1361 disabled = false;
1362}
1363var mo = null;
1364function observe(options) {
1365 if (!MUTATION_OBSERVER) {
1366 return;
1367 }
1368
1369 if (!config.observeMutations) {
1370 return;
1371 }
1372
1373 var treeCallback = options.treeCallback,
1374 nodeCallback = options.nodeCallback,
1375 pseudoElementsCallback = options.pseudoElementsCallback,
1376 _options$observeMutat = options.observeMutationsRoot,
1377 observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
1378 mo = new MUTATION_OBSERVER(function (objects) {
1379 if (disabled) return;
1380 toArray(objects).forEach(function (mutationRecord) {
1381 if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
1382 if (config.searchPseudoElements) {
1383 pseudoElementsCallback(mutationRecord.target);
1384 }
1385
1386 treeCallback(mutationRecord.target);
1387 }
1388
1389 if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1390 pseudoElementsCallback(mutationRecord.target.parentNode);
1391 }
1392
1393 if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1394 if (mutationRecord.attributeName === 'class') {
1395 var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1396 prefix = _getCanonicalIcon.prefix,
1397 iconName = _getCanonicalIcon.iconName;
1398
1399 if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
1400 if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
1401 } else {
1402 nodeCallback(mutationRecord.target);
1403 }
1404 }
1405 });
1406 });
1407 if (!IS_DOM) return;
1408 mo.observe(observeMutationsRoot, {
1409 childList: true,
1410 attributes: true,
1411 characterData: true,
1412 subtree: true
1413 });
1414}
1415function disconnect() {
1416 if (!mo) return;
1417 mo.disconnect();
1418}
1419
1420function styleParser (node) {
1421 var style = node.getAttribute('style');
1422 var val = [];
1423
1424 if (style) {
1425 val = style.split(';').reduce(function (acc, style) {
1426 var styles = style.split(':');
1427 var prop = styles[0];
1428 var value = styles.slice(1);
1429
1430 if (prop && value.length > 0) {
1431 acc[prop] = value.join(':').trim();
1432 }
1433
1434 return acc;
1435 }, {});
1436 }
1437
1438 return val;
1439}
1440
1441function toHex(unicode) {
1442 var result = '';
1443
1444 for (var i = 0; i < unicode.length; i++) {
1445 var hex = unicode.charCodeAt(i).toString(16);
1446 result += ('000' + hex).slice(-4);
1447 }
1448
1449 return result;
1450}
1451
1452function classParser (node) {
1453 var existingPrefix = node.getAttribute('data-prefix');
1454 var existingIconName = node.getAttribute('data-icon');
1455 var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
1456 var val = getCanonicalIcon(classArray(node));
1457
1458 if (existingPrefix && existingIconName) {
1459 val.prefix = existingPrefix;
1460 val.iconName = existingIconName;
1461 }
1462
1463 if (val.prefix && innerText.length > 1) {
1464 val.iconName = byLigature(val.prefix, node.innerText);
1465 } else if (val.prefix && innerText.length === 1) {
1466 val.iconName = byUnicode(val.prefix, toHex(node.innerText));
1467 }
1468
1469 return val;
1470}
1471
1472var parseTransformString = function parseTransformString(transformString) {
1473 var transform = {
1474 size: 16,
1475 x: 0,
1476 y: 0,
1477 flipX: false,
1478 flipY: false,
1479 rotate: 0
1480 };
1481
1482 if (!transformString) {
1483 return transform;
1484 } else {
1485 return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
1486 var parts = n.toLowerCase().split('-');
1487 var first = parts[0];
1488 var rest = parts.slice(1).join('-');
1489
1490 if (first && rest === 'h') {
1491 acc.flipX = true;
1492 return acc;
1493 }
1494
1495 if (first && rest === 'v') {
1496 acc.flipY = true;
1497 return acc;
1498 }
1499
1500 rest = parseFloat(rest);
1501
1502 if (isNaN(rest)) {
1503 return acc;
1504 }
1505
1506 switch (first) {
1507 case 'grow':
1508 acc.size = acc.size + rest;
1509 break;
1510
1511 case 'shrink':
1512 acc.size = acc.size - rest;
1513 break;
1514
1515 case 'left':
1516 acc.x = acc.x - rest;
1517 break;
1518
1519 case 'right':
1520 acc.x = acc.x + rest;
1521 break;
1522
1523 case 'up':
1524 acc.y = acc.y - rest;
1525 break;
1526
1527 case 'down':
1528 acc.y = acc.y + rest;
1529 break;
1530
1531 case 'rotate':
1532 acc.rotate = acc.rotate + rest;
1533 break;
1534 }
1535
1536 return acc;
1537 }, transform);
1538 }
1539};
1540function transformParser (node) {
1541 return parseTransformString(node.getAttribute('data-fa-transform'));
1542}
1543
1544function symbolParser (node) {
1545 var symbol = node.getAttribute('data-fa-symbol');
1546 return symbol === null ? false : symbol === '' ? true : symbol;
1547}
1548
1549function attributesParser (node) {
1550 var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
1551 if (acc.name !== 'class' && acc.name !== 'style') {
1552 acc[attr.name] = attr.value;
1553 }
1554
1555 return acc;
1556 }, {});
1557 var title = node.getAttribute('title');
1558
1559 if (config.autoA11y) {
1560 if (title) {
1561 extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
1562 } else {
1563 extraAttributes['aria-hidden'] = 'true';
1564 extraAttributes['focusable'] = 'false';
1565 }
1566 }
1567
1568 return extraAttributes;
1569}
1570
1571function maskParser (node) {
1572 var mask = node.getAttribute('data-fa-mask');
1573
1574 if (!mask) {
1575 return emptyCanonicalIcon();
1576 } else {
1577 return getCanonicalIcon(mask.split(' ').map(function (i) {
1578 return i.trim();
1579 }));
1580 }
1581}
1582
1583function blankMeta() {
1584 return {
1585 iconName: null,
1586 title: null,
1587 prefix: null,
1588 transform: meaninglessTransform,
1589 symbol: false,
1590 mask: null,
1591 extra: {
1592 classes: [],
1593 styles: {},
1594 attributes: {}
1595 }
1596 };
1597}
1598function parseMeta(node) {
1599 var _classParser = classParser(node),
1600 iconName = _classParser.iconName,
1601 prefix = _classParser.prefix,
1602 extraClasses = _classParser.rest;
1603
1604 var extraStyles = styleParser(node);
1605 var transform = transformParser(node);
1606 var symbol = symbolParser(node);
1607 var extraAttributes = attributesParser(node);
1608 var mask = maskParser(node);
1609 return {
1610 iconName: iconName,
1611 title: node.getAttribute('title'),
1612 prefix: prefix,
1613 transform: transform,
1614 symbol: symbol,
1615 mask: mask,
1616 extra: {
1617 classes: extraClasses,
1618 styles: extraStyles,
1619 attributes: extraAttributes
1620 }
1621 };
1622}
1623
1624function MissingIcon(error) {
1625 this.name = 'MissingIcon';
1626 this.message = error || 'Icon unavailable';
1627 this.stack = new Error().stack;
1628}
1629MissingIcon.prototype = Object.create(Error.prototype);
1630MissingIcon.prototype.constructor = MissingIcon;
1631
1632var FILL = {
1633 fill: 'currentColor'
1634};
1635var ANIMATION_BASE = {
1636 attributeType: 'XML',
1637 repeatCount: 'indefinite',
1638 dur: '2s'
1639};
1640var RING = {
1641 tag: 'path',
1642 attributes: _objectSpread({}, FILL, {
1643 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'
1644 })
1645};
1646
1647var OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {
1648 attributeName: 'opacity'
1649});
1650
1651var DOT = {
1652 tag: 'circle',
1653 attributes: _objectSpread({}, FILL, {
1654 cx: '256',
1655 cy: '364',
1656 r: '28'
1657 }),
1658 children: [{
1659 tag: 'animate',
1660 attributes: _objectSpread({}, ANIMATION_BASE, {
1661 attributeName: 'r',
1662 values: '28;14;28;28;14;28;'
1663 })
1664 }, {
1665 tag: 'animate',
1666 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1667 values: '1;0;1;1;0;1;'
1668 })
1669 }]
1670};
1671var QUESTION = {
1672 tag: 'path',
1673 attributes: _objectSpread({}, FILL, {
1674 opacity: '1',
1675 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'
1676 }),
1677 children: [{
1678 tag: 'animate',
1679 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1680 values: '1;0;0;0;0;1;'
1681 })
1682 }]
1683};
1684var EXCLAMATION = {
1685 tag: 'path',
1686 attributes: _objectSpread({}, FILL, {
1687 opacity: '0',
1688 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'
1689 }),
1690 children: [{
1691 tag: 'animate',
1692 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1693 values: '0;0;1;1;0;0;'
1694 })
1695 }]
1696};
1697var missing = {
1698 tag: 'g',
1699 children: [RING, DOT, QUESTION, EXCLAMATION]
1700};
1701
1702var styles$2 = namespace.styles;
1703function findIcon(iconName, prefix) {
1704 return new picked(function (resolve, reject) {
1705 var val = {
1706 found: false,
1707 width: 512,
1708 height: 512,
1709 icon: missing
1710 };
1711
1712 if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {
1713 var icon = styles$2[prefix][iconName];
1714 var width = icon[0];
1715 var height = icon[1];
1716 var vectorData = icon.slice(4);
1717 val = {
1718 found: true,
1719 width: width,
1720 height: height,
1721 icon: {
1722 tag: 'path',
1723 attributes: {
1724 fill: 'currentColor',
1725 d: vectorData[0]
1726 }
1727 }
1728 };
1729 return resolve(val);
1730 }
1731
1732 if (iconName && prefix && !config.showMissingIcons) {
1733 reject(new MissingIcon("Icon is missing for prefix ".concat(prefix, " with icon name ").concat(iconName)));
1734 } else {
1735 resolve(val);
1736 }
1737 });
1738}
1739
1740var styles$3 = namespace.styles;
1741
1742function generateSvgReplacementMutation(node, nodeMeta) {
1743 var iconName = nodeMeta.iconName,
1744 title = nodeMeta.title,
1745 prefix = nodeMeta.prefix,
1746 transform = nodeMeta.transform,
1747 symbol = nodeMeta.symbol,
1748 mask = nodeMeta.mask,
1749 extra = nodeMeta.extra;
1750 return new picked(function (resolve, reject) {
1751 picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {
1752 var _ref2 = _slicedToArray(_ref, 2),
1753 main = _ref2[0],
1754 mask = _ref2[1];
1755
1756 resolve([node, makeInlineSvgAbstract({
1757 icons: {
1758 main: main,
1759 mask: mask
1760 },
1761 prefix: prefix,
1762 iconName: iconName,
1763 transform: transform,
1764 symbol: symbol,
1765 mask: mask,
1766 title: title,
1767 extra: extra,
1768 watchable: true
1769 })]);
1770 });
1771 });
1772}
1773
1774function generateLayersText(node, nodeMeta) {
1775 var title = nodeMeta.title,
1776 transform = nodeMeta.transform,
1777 extra = nodeMeta.extra;
1778 var width = null;
1779 var height = null;
1780
1781 if (IS_IE) {
1782 var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
1783 var boundingClientRect = node.getBoundingClientRect();
1784 width = boundingClientRect.width / computedFontSize;
1785 height = boundingClientRect.height / computedFontSize;
1786 }
1787
1788 if (config.autoA11y && !title) {
1789 extra.attributes['aria-hidden'] = 'true';
1790 }
1791
1792 return picked.resolve([node, makeLayersTextAbstract({
1793 content: node.innerHTML,
1794 width: width,
1795 height: height,
1796 transform: transform,
1797 title: title,
1798 extra: extra,
1799 watchable: true
1800 })]);
1801}
1802
1803function generateMutation(node) {
1804 var nodeMeta = parseMeta(node);
1805
1806 if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
1807 return generateLayersText(node, nodeMeta);
1808 } else {
1809 return generateSvgReplacementMutation(node, nodeMeta);
1810 }
1811}
1812
1813function onTree(root) {
1814 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1815 if (!IS_DOM) return;
1816 var htmlClassList = DOCUMENT.documentElement.classList;
1817
1818 var hclAdd = function hclAdd(suffix) {
1819 return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1820 };
1821
1822 var hclRemove = function hclRemove(suffix) {
1823 return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1824 };
1825
1826 var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);
1827 var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
1828 return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
1829 })).join(', ');
1830
1831 if (prefixesDomQuery.length === 0) {
1832 return;
1833 }
1834
1835 var candidates = toArray(root.querySelectorAll(prefixesDomQuery));
1836
1837 if (candidates.length > 0) {
1838 hclAdd('pending');
1839 hclRemove('complete');
1840 } else {
1841 return;
1842 }
1843
1844 var mark = perf.begin('onTree');
1845 var mutations = candidates.reduce(function (acc, node) {
1846 try {
1847 var mutation = generateMutation(node);
1848
1849 if (mutation) {
1850 acc.push(mutation);
1851 }
1852 } catch (e) {
1853 if (!PRODUCTION) {
1854 if (e instanceof MissingIcon) {
1855 console.error(e);
1856 }
1857 }
1858 }
1859
1860 return acc;
1861 }, []);
1862 return new picked(function (resolve, reject) {
1863 picked.all(mutations).then(function (resolvedMutations) {
1864 perform(resolvedMutations, function () {
1865 hclAdd('active');
1866 hclAdd('complete');
1867 hclRemove('pending');
1868 if (typeof callback === 'function') callback();
1869 mark();
1870 resolve();
1871 });
1872 }).catch(function () {
1873 mark();
1874 reject();
1875 });
1876 });
1877}
1878function onNode(node) {
1879 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1880 generateMutation(node).then(function (mutation) {
1881 if (mutation) {
1882 perform([mutation], callback);
1883 }
1884 });
1885}
1886
1887function replaceForPosition(node, position) {
1888 var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
1889 return new picked(function (resolve, reject) {
1890 if (node.getAttribute(pendingAttribute) !== null) {
1891 // This node is already being processed
1892 return resolve();
1893 }
1894
1895 var children = toArray(node.children);
1896 var alreadyProcessedPseudoElement = children.filter(function (c) {
1897 return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
1898 })[0];
1899 var styles = WINDOW.getComputedStyle(node, position);
1900 var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
1901 var fontWeight = styles.getPropertyValue('font-weight');
1902
1903 if (alreadyProcessedPseudoElement && !fontFamily) {
1904 // If we've already processed it but the current computed style does not result in a font-family,
1905 // that probably means that a class name that was previously present to make the icon has been
1906 // removed. So we now should delete the icon.
1907 node.removeChild(alreadyProcessedPseudoElement);
1908 return resolve();
1909 } else if (fontFamily) {
1910 var content = styles.getPropertyValue('content');
1911 var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];
1912 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
1913 // already done so with the same prefix and iconName
1914
1915 if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
1916 node.setAttribute(pendingAttribute, iconName);
1917
1918 if (alreadyProcessedPseudoElement) {
1919 // Delete the old one, since we're replacing it with a new one
1920 node.removeChild(alreadyProcessedPseudoElement);
1921 }
1922
1923 var meta = blankMeta();
1924 var extra = meta.extra;
1925 extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
1926 findIcon(iconName, prefix).then(function (main) {
1927 var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {
1928 icons: {
1929 main: main,
1930 mask: emptyCanonicalIcon()
1931 },
1932 prefix: prefix,
1933 iconName: iconName,
1934 extra: extra,
1935 watchable: true
1936 }));
1937 var element = DOCUMENT.createElement('svg');
1938
1939 if (position === ':before') {
1940 node.insertBefore(element, node.firstChild);
1941 } else {
1942 node.appendChild(element);
1943 }
1944
1945 element.outerHTML = abstract.map(function (a) {
1946 return toHtml(a);
1947 }).join('\n');
1948 node.removeAttribute(pendingAttribute);
1949 resolve();
1950 }).catch(reject);
1951 } else {
1952 resolve();
1953 }
1954 } else {
1955 resolve();
1956 }
1957 });
1958}
1959
1960function replace(node) {
1961 return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);
1962}
1963
1964function processable(node) {
1965 return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== 'svg');
1966}
1967
1968function searchPseudoElements (root) {
1969 if (!IS_DOM) return;
1970 return new picked(function (resolve, reject) {
1971 var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
1972 var end = perf.begin('searchPseudoElements');
1973 disableObservation();
1974 picked.all(operations).then(function () {
1975 end();
1976 enableObservation();
1977 resolve();
1978 }).catch(function () {
1979 end();
1980 enableObservation();
1981 reject();
1982 });
1983 });
1984}
1985
1986var 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: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.225em;\n}\n.svg-inline--fa.fa-w-1 {\n width: 0.0625em;\n}\n.svg-inline--fa.fa-w-2 {\n width: 0.125em;\n}\n.svg-inline--fa.fa-w-3 {\n width: 0.1875em;\n}\n.svg-inline--fa.fa-w-4 {\n width: 0.25em;\n}\n.svg-inline--fa.fa-w-5 {\n width: 0.3125em;\n}\n.svg-inline--fa.fa-w-6 {\n width: 0.375em;\n}\n.svg-inline--fa.fa-w-7 {\n width: 0.4375em;\n}\n.svg-inline--fa.fa-w-8 {\n width: 0.5em;\n}\n.svg-inline--fa.fa-w-9 {\n width: 0.5625em;\n}\n.svg-inline--fa.fa-w-10 {\n width: 0.625em;\n}\n.svg-inline--fa.fa-w-11 {\n width: 0.6875em;\n}\n.svg-inline--fa.fa-w-12 {\n width: 0.75em;\n}\n.svg-inline--fa.fa-w-13 {\n width: 0.8125em;\n}\n.svg-inline--fa.fa-w-14 {\n width: 0.875em;\n}\n.svg-inline--fa.fa-w-15 {\n width: 0.9375em;\n}\n.svg-inline--fa.fa-w-16 {\n width: 1em;\n}\n.svg-inline--fa.fa-w-17 {\n width: 1.0625em;\n}\n.svg-inline--fa.fa-w-18 {\n width: 1.125em;\n}\n.svg-inline--fa.fa-w-19 {\n width: 1.1875em;\n}\n.svg-inline--fa.fa-w-20 {\n width: 1.25em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-border {\n height: 1.5em;\n}\n.svg-inline--fa.fa-li {\n width: 2em;\n}\n.svg-inline--fa.fa-fw {\n width: 1.25em;\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: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\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: 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: 0.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\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.3333333333em;\n line-height: 0.75em;\n vertical-align: -0.0667em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: 2.5em;\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: -2em;\n position: absolute;\n text-align: center;\n width: 2em;\n line-height: inherit;\n}\n\n.fa-border {\n border: solid 0.08em #eee;\n border-radius: 0.1em;\n padding: 0.2em 0.25em 0.15em;\n}\n\n.fa-pull-left {\n float: left;\n}\n\n.fa-pull-right {\n float: right;\n}\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: 0.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: 0.3em;\n}\n\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear;\n}\n\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8);\n}\n\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\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\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\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\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\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\n.fa-flip-both, .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\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:root .fa-flip-both {\n -webkit-filter: none;\n filter: none;\n}\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\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\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: #fff;\n}\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\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}";
1987
1988function css () {
1989 var dfp = DEFAULT_FAMILY_PREFIX;
1990 var drc = DEFAULT_REPLACEMENT_CLASS;
1991 var fp = config.familyPrefix;
1992 var rc = config.replacementClass;
1993 var s = baseStyles;
1994
1995 if (fp !== dfp || rc !== drc) {
1996 var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g');
1997 var rPatt = new RegExp("\\.".concat(drc), 'g');
1998 s = s.replace(dPatt, ".".concat(fp, "-")).replace(rPatt, ".".concat(rc));
1999 }
2000
2001 return s;
2002}
2003
2004var Library =
2005/*#__PURE__*/
2006function () {
2007 function Library() {
2008 _classCallCheck(this, Library);
2009
2010 this.definitions = {};
2011 }
2012
2013 _createClass(Library, [{
2014 key: "add",
2015 value: function add() {
2016 var _this = this;
2017
2018 for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
2019 definitions[_key] = arguments[_key];
2020 }
2021
2022 var additions = definitions.reduce(this._pullDefinitions, {});
2023 Object.keys(additions).forEach(function (key) {
2024 _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);
2025 defineIcons(key, additions[key]);
2026 build();
2027 });
2028 }
2029 }, {
2030 key: "reset",
2031 value: function reset() {
2032 this.definitions = {};
2033 }
2034 }, {
2035 key: "_pullDefinitions",
2036 value: function _pullDefinitions(additions, definition) {
2037 var normalized = definition.prefix && definition.iconName && definition.icon ? {
2038 0: definition
2039 } : definition;
2040 Object.keys(normalized).map(function (key) {
2041 var _normalized$key = normalized[key],
2042 prefix = _normalized$key.prefix,
2043 iconName = _normalized$key.iconName,
2044 icon = _normalized$key.icon;
2045 if (!additions[prefix]) additions[prefix] = {};
2046 additions[prefix][iconName] = icon;
2047 });
2048 return additions;
2049 }
2050 }]);
2051
2052 return Library;
2053}();
2054
2055function prepIcon(icon) {
2056 var width = icon[0];
2057 var height = icon[1];
2058 var vectorData = icon.slice(4);
2059 return {
2060 found: true,
2061 width: width,
2062 height: height,
2063 icon: {
2064 tag: 'path',
2065 attributes: {
2066 fill: 'currentColor',
2067 d: vectorData[0]
2068 }
2069 }
2070 };
2071}
2072
2073function ensureCss() {
2074 if (config.autoAddCss && !_cssInserted) {
2075 insertCss(css());
2076
2077 _cssInserted = true;
2078 }
2079}
2080
2081function apiObject(val, abstractCreator) {
2082 Object.defineProperty(val, 'abstract', {
2083 get: abstractCreator
2084 });
2085 Object.defineProperty(val, 'html', {
2086 get: function get() {
2087 return val.abstract.map(function (a) {
2088 return toHtml(a);
2089 });
2090 }
2091 });
2092 Object.defineProperty(val, 'node', {
2093 get: function get() {
2094 if (!IS_DOM) return;
2095 var container = DOCUMENT.createElement('div');
2096 container.innerHTML = val.html;
2097 return container.children;
2098 }
2099 });
2100 return val;
2101}
2102
2103function findIconDefinition(iconLookup) {
2104 var _iconLookup$prefix = iconLookup.prefix,
2105 prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,
2106 iconName = iconLookup.iconName;
2107 if (!iconName) return;
2108 return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
2109}
2110
2111function resolveIcons(next) {
2112 return function (maybeIconDefinition) {
2113 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2114 var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
2115 var mask = params.mask;
2116
2117 if (mask) {
2118 mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
2119 }
2120
2121 return next(iconDefinition, _objectSpread({}, params, {
2122 mask: mask
2123 }));
2124 };
2125}
2126
2127var library = new Library();
2128var noAuto = function noAuto() {
2129 config.autoReplaceSvg = false;
2130 config.observeMutations = false;
2131 disconnect();
2132};
2133var _cssInserted = false;
2134var dom = {
2135 i2svg: function i2svg() {
2136 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2137
2138 if (IS_DOM) {
2139 ensureCss();
2140 var _params$node = params.node,
2141 node = _params$node === void 0 ? DOCUMENT : _params$node,
2142 _params$callback = params.callback,
2143 callback = _params$callback === void 0 ? function () {} : _params$callback;
2144
2145 if (config.searchPseudoElements) {
2146 searchPseudoElements(node);
2147 }
2148
2149 return onTree(node, callback);
2150 } else {
2151 return picked.reject('Operation requires a DOM of some kind.');
2152 }
2153 },
2154 css: css,
2155 insertCss: function insertCss$$1() {
2156 if (!_cssInserted) {
2157 insertCss(css());
2158
2159 _cssInserted = true;
2160 }
2161 },
2162 watch: function watch() {
2163 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2164 var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
2165 observeMutationsRoot = params.observeMutationsRoot;
2166
2167 if (config.autoReplaceSvg === false) {
2168 config.autoReplaceSvg = true;
2169 }
2170
2171 config.observeMutations = true;
2172 domready(function () {
2173 autoReplace({
2174 autoReplaceSvgRoot: autoReplaceSvgRoot
2175 });
2176 observe({
2177 treeCallback: onTree,
2178 nodeCallback: onNode,
2179 pseudoElementsCallback: searchPseudoElements,
2180 observeMutationsRoot: observeMutationsRoot
2181 });
2182 });
2183 }
2184};
2185var parse = {
2186 transform: function transform(transformString) {
2187 return parseTransformString(transformString);
2188 }
2189};
2190var icon = resolveIcons(function (iconDefinition) {
2191 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2192 var _params$transform = params.transform,
2193 transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2194 _params$symbol = params.symbol,
2195 symbol = _params$symbol === void 0 ? false : _params$symbol,
2196 _params$mask = params.mask,
2197 mask = _params$mask === void 0 ? null : _params$mask,
2198 _params$title = params.title,
2199 title = _params$title === void 0 ? null : _params$title,
2200 _params$classes = params.classes,
2201 classes = _params$classes === void 0 ? [] : _params$classes,
2202 _params$attributes = params.attributes,
2203 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2204 _params$styles = params.styles,
2205 styles = _params$styles === void 0 ? {} : _params$styles;
2206 if (!iconDefinition) return;
2207 var prefix = iconDefinition.prefix,
2208 iconName = iconDefinition.iconName,
2209 icon = iconDefinition.icon;
2210 return apiObject(_objectSpread({
2211 type: 'icon'
2212 }, iconDefinition), function () {
2213 ensureCss();
2214
2215 if (config.autoA11y) {
2216 if (title) {
2217 attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
2218 } else {
2219 attributes['aria-hidden'] = 'true';
2220 attributes['focusable'] = 'false';
2221 }
2222 }
2223
2224 return makeInlineSvgAbstract({
2225 icons: {
2226 main: prepIcon(icon),
2227 mask: mask ? prepIcon(mask.icon) : {
2228 found: false,
2229 width: null,
2230 height: null,
2231 icon: {}
2232 }
2233 },
2234 prefix: prefix,
2235 iconName: iconName,
2236 transform: _objectSpread({}, meaninglessTransform, transform),
2237 symbol: symbol,
2238 title: title,
2239 extra: {
2240 attributes: attributes,
2241 styles: styles,
2242 classes: classes
2243 }
2244 });
2245 });
2246});
2247var text = function text(content) {
2248 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2249 var _params$transform2 = params.transform,
2250 transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,
2251 _params$title2 = params.title,
2252 title = _params$title2 === void 0 ? null : _params$title2,
2253 _params$classes2 = params.classes,
2254 classes = _params$classes2 === void 0 ? [] : _params$classes2,
2255 _params$attributes2 = params.attributes,
2256 attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,
2257 _params$styles2 = params.styles,
2258 styles = _params$styles2 === void 0 ? {} : _params$styles2;
2259 return apiObject({
2260 type: 'text',
2261 content: content
2262 }, function () {
2263 ensureCss();
2264 return makeLayersTextAbstract({
2265 content: content,
2266 transform: _objectSpread({}, meaninglessTransform, transform),
2267 title: title,
2268 extra: {
2269 attributes: attributes,
2270 styles: styles,
2271 classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes))
2272 }
2273 });
2274 });
2275};
2276var counter = function counter(content) {
2277 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2278 var _params$title3 = params.title,
2279 title = _params$title3 === void 0 ? null : _params$title3,
2280 _params$classes3 = params.classes,
2281 classes = _params$classes3 === void 0 ? [] : _params$classes3,
2282 _params$attributes3 = params.attributes,
2283 attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,
2284 _params$styles3 = params.styles,
2285 styles = _params$styles3 === void 0 ? {} : _params$styles3;
2286 return apiObject({
2287 type: 'counter',
2288 content: content
2289 }, function () {
2290 ensureCss();
2291 return makeLayersCounterAbstract({
2292 content: content.toString(),
2293 title: title,
2294 extra: {
2295 attributes: attributes,
2296 styles: styles,
2297 classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
2298 }
2299 });
2300 });
2301};
2302var layer = function layer(assembler) {
2303 return apiObject({
2304 type: 'layer'
2305 }, function () {
2306 ensureCss();
2307 var children = [];
2308 assembler(function (args) {
2309 Array.isArray(args) ? args.map(function (a) {
2310 children = children.concat(a.abstract);
2311 }) : children = children.concat(args.abstract);
2312 });
2313 return [{
2314 tag: 'span',
2315 attributes: {
2316 class: "".concat(config.familyPrefix, "-layers")
2317 },
2318 children: children
2319 }];
2320 });
2321};
2322var api = {
2323 noAuto: noAuto,
2324 config: config,
2325 dom: dom,
2326 library: library,
2327 parse: parse,
2328 findIconDefinition: findIconDefinition,
2329 icon: icon,
2330 text: text,
2331 counter: counter,
2332 layer: layer,
2333 toHtml: toHtml
2334};
2335
2336var autoReplace = function autoReplace() {
2337 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2338 var _params$autoReplaceSv = params.autoReplaceSvgRoot,
2339 autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
2340 if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
2341 node: autoReplaceSvgRoot
2342 });
2343};
2344
2345export { icon, noAuto, config, toHtml, layer, text, counter, library, dom, parse, findIconDefinition };