UNPKG

115 kBJavaScriptView Raw
1function ownKeys(object, enumerableOnly) {
2 var keys = Object.keys(object);
3
4 if (Object.getOwnPropertySymbols) {
5 var symbols = Object.getOwnPropertySymbols(object);
6 enumerableOnly && (symbols = symbols.filter(function (sym) {
7 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
8 })), keys.push.apply(keys, symbols);
9 }
10
11 return keys;
12}
13
14function _objectSpread2(target) {
15 for (var i = 1; i < arguments.length; i++) {
16 var source = null != arguments[i] ? arguments[i] : {};
17 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
18 _defineProperty(target, key, source[key]);
19 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
20 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21 });
22 }
23
24 return target;
25}
26
27function _typeof(obj) {
28 "@babel/helpers - typeof";
29
30 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
31 return typeof obj;
32 } : function (obj) {
33 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34 }, _typeof(obj);
35}
36
37function _wrapRegExp() {
38 _wrapRegExp = function (re, groups) {
39 return new BabelRegExp(re, void 0, groups);
40 };
41
42 var _super = RegExp.prototype,
43 _groups = new WeakMap();
44
45 function BabelRegExp(re, flags, groups) {
46 var _this = new RegExp(re, flags);
47
48 return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
49 }
50
51 function buildGroups(result, re) {
52 var g = _groups.get(re);
53
54 return Object.keys(g).reduce(function (groups, name) {
55 return groups[name] = result[g[name]], groups;
56 }, Object.create(null));
57 }
58
59 return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
60 var result = _super.exec.call(this, str);
61
62 return result && (result.groups = buildGroups(result, this)), result;
63 }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
64 if ("string" == typeof substitution) {
65 var groups = _groups.get(this);
66
67 return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
68 return "$" + groups[name];
69 }));
70 }
71
72 if ("function" == typeof substitution) {
73 var _this = this;
74
75 return _super[Symbol.replace].call(this, str, function () {
76 var args = arguments;
77 return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
78 });
79 }
80
81 return _super[Symbol.replace].call(this, str, substitution);
82 }, _wrapRegExp.apply(this, arguments);
83}
84
85function _classCallCheck(instance, Constructor) {
86 if (!(instance instanceof Constructor)) {
87 throw new TypeError("Cannot call a class as a function");
88 }
89}
90
91function _defineProperties(target, props) {
92 for (var i = 0; i < props.length; i++) {
93 var descriptor = props[i];
94 descriptor.enumerable = descriptor.enumerable || false;
95 descriptor.configurable = true;
96 if ("value" in descriptor) descriptor.writable = true;
97 Object.defineProperty(target, descriptor.key, descriptor);
98 }
99}
100
101function _createClass(Constructor, protoProps, staticProps) {
102 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
103 if (staticProps) _defineProperties(Constructor, staticProps);
104 Object.defineProperty(Constructor, "prototype", {
105 writable: false
106 });
107 return Constructor;
108}
109
110function _defineProperty(obj, key, value) {
111 if (key in obj) {
112 Object.defineProperty(obj, key, {
113 value: value,
114 enumerable: true,
115 configurable: true,
116 writable: true
117 });
118 } else {
119 obj[key] = value;
120 }
121
122 return obj;
123}
124
125function _inherits(subClass, superClass) {
126 if (typeof superClass !== "function" && superClass !== null) {
127 throw new TypeError("Super expression must either be null or a function");
128 }
129
130 subClass.prototype = Object.create(superClass && superClass.prototype, {
131 constructor: {
132 value: subClass,
133 writable: true,
134 configurable: true
135 }
136 });
137 Object.defineProperty(subClass, "prototype", {
138 writable: false
139 });
140 if (superClass) _setPrototypeOf(subClass, superClass);
141}
142
143function _setPrototypeOf(o, p) {
144 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
145 o.__proto__ = p;
146 return o;
147 };
148
149 return _setPrototypeOf(o, p);
150}
151
152function _slicedToArray(arr, i) {
153 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
154}
155
156function _toConsumableArray(arr) {
157 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
158}
159
160function _arrayWithoutHoles(arr) {
161 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
162}
163
164function _arrayWithHoles(arr) {
165 if (Array.isArray(arr)) return arr;
166}
167
168function _iterableToArray(iter) {
169 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
170}
171
172function _iterableToArrayLimit(arr, i) {
173 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
174
175 if (_i == null) return;
176 var _arr = [];
177 var _n = true;
178 var _d = false;
179
180 var _s, _e;
181
182 try {
183 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
184 _arr.push(_s.value);
185
186 if (i && _arr.length === i) break;
187 }
188 } catch (err) {
189 _d = true;
190 _e = err;
191 } finally {
192 try {
193 if (!_n && _i["return"] != null) _i["return"]();
194 } finally {
195 if (_d) throw _e;
196 }
197 }
198
199 return _arr;
200}
201
202function _unsupportedIterableToArray(o, minLen) {
203 if (!o) return;
204 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
205 var n = Object.prototype.toString.call(o).slice(8, -1);
206 if (n === "Object" && o.constructor) n = o.constructor.name;
207 if (n === "Map" || n === "Set") return Array.from(o);
208 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
209}
210
211function _arrayLikeToArray(arr, len) {
212 if (len == null || len > arr.length) len = arr.length;
213
214 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
215
216 return arr2;
217}
218
219function _nonIterableSpread() {
220 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
221}
222
223function _nonIterableRest() {
224 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
225}
226
227var _plugins = [];
228var _hooks = {};
229var providers = {};
230var defaultProviderKeys = Object.keys(providers);
231function registerPlugins(nextPlugins, _ref) {
232 var obj = _ref.mixoutsTo;
233 _plugins = nextPlugins;
234 _hooks = {};
235 Object.keys(providers).forEach(function (k) {
236 if (defaultProviderKeys.indexOf(k) === -1) {
237 delete providers[k];
238 }
239 });
240
241 _plugins.forEach(function (plugin) {
242 var mixout = plugin.mixout ? plugin.mixout() : {};
243 Object.keys(mixout).forEach(function (tk) {
244 if (typeof mixout[tk] === 'function') {
245 obj[tk] = mixout[tk];
246 }
247
248 if (_typeof(mixout[tk]) === 'object') {
249 Object.keys(mixout[tk]).forEach(function (sk) {
250 if (!obj[tk]) {
251 obj[tk] = {};
252 }
253
254 obj[tk][sk] = mixout[tk][sk];
255 });
256 }
257 });
258
259 if (plugin.hooks) {
260 var hooks = plugin.hooks();
261 Object.keys(hooks).forEach(function (hook) {
262 if (!_hooks[hook]) {
263 _hooks[hook] = [];
264 }
265
266 _hooks[hook].push(hooks[hook]);
267 });
268 }
269
270 if (plugin.provides) {
271 plugin.provides(providers);
272 }
273 });
274
275 return obj;
276}
277function chainHooks(hook, accumulator) {
278 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
279 args[_key - 2] = arguments[_key];
280 }
281
282 var hookFns = _hooks[hook] || [];
283 hookFns.forEach(function (hookFn) {
284 accumulator = hookFn.apply(null, [accumulator].concat(args)); // eslint-disable-line no-useless-call
285 });
286 return accumulator;
287}
288function callHooks(hook) {
289 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
290 args[_key2 - 1] = arguments[_key2];
291 }
292
293 var hookFns = _hooks[hook] || [];
294 hookFns.forEach(function (hookFn) {
295 hookFn.apply(null, args);
296 });
297 return undefined;
298}
299function callProvided() {
300 var hook = arguments[0];
301 var args = Array.prototype.slice.call(arguments, 1);
302 return providers[hook] ? providers[hook].apply(null, args) : undefined;
303}
304
305var noop = function noop() {};
306
307var _WINDOW = {};
308var _DOCUMENT = {};
309var _MUTATION_OBSERVER = null;
310var _PERFORMANCE = {
311 mark: noop,
312 measure: noop
313};
314
315try {
316 if (typeof window !== 'undefined') _WINDOW = window;
317 if (typeof document !== 'undefined') _DOCUMENT = document;
318 if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
319 if (typeof performance !== 'undefined') _PERFORMANCE = performance;
320} catch (e) {}
321
322var _ref = _WINDOW.navigator || {},
323 _ref$userAgent = _ref.userAgent,
324 userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
325var WINDOW = _WINDOW;
326var DOCUMENT = _DOCUMENT;
327var MUTATION_OBSERVER = _MUTATION_OBSERVER;
328var PERFORMANCE = _PERFORMANCE;
329var IS_BROWSER = !!WINDOW.document;
330var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
331var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
332
333var _familyProxy, _familyProxy2, _familyProxy3, _familyProxy4, _familyProxy5;
334
335var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
336var UNITS_IN_GRID = 16;
337var DEFAULT_CSS_PREFIX = 'fa';
338var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
339var DATA_FA_I2SVG = 'data-fa-i2svg';
340var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
341var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
342var DATA_PREFIX = 'data-prefix';
343var DATA_ICON = 'data-icon';
344var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
345var MUTATION_APPROACH_ASYNC = 'async';
346var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
347var PRODUCTION = function () {
348 try {
349 return process.env.NODE_ENV === 'production';
350 } catch (e) {
351 return false;
352 }
353}();
354var FAMILY_CLASSIC = 'classic';
355var FAMILY_SHARP = 'sharp';
356var FAMILIES = [FAMILY_CLASSIC, FAMILY_SHARP];
357
358function familyProxy(obj) {
359 // Defaults to the classic family if family is not available
360 return new Proxy(obj, {
361 get: function get(target, prop) {
362 return prop in target ? target[prop] : target[FAMILY_CLASSIC];
363 }
364 });
365}
366var PREFIX_TO_STYLE = familyProxy((_familyProxy = {}, _defineProperty(_familyProxy, FAMILY_CLASSIC, {
367 'fa': 'solid',
368 'fas': 'solid',
369 'fa-solid': 'solid',
370 'far': 'regular',
371 'fa-regular': 'regular',
372 'fal': 'light',
373 'fa-light': 'light',
374 'fat': 'thin',
375 'fa-thin': 'thin',
376 'fad': 'duotone',
377 'fa-duotone': 'duotone',
378 'fab': 'brands',
379 'fa-brands': 'brands',
380 'fak': 'kit',
381 'fa-kit': 'kit'
382}), _defineProperty(_familyProxy, FAMILY_SHARP, {
383 'fa': 'solid',
384 'fass': 'solid',
385 'fa-solid': 'solid'
386}), _familyProxy));
387var STYLE_TO_PREFIX = familyProxy((_familyProxy2 = {}, _defineProperty(_familyProxy2, FAMILY_CLASSIC, {
388 'solid': 'fas',
389 'regular': 'far',
390 'light': 'fal',
391 'thin': 'fat',
392 'duotone': 'fad',
393 'brands': 'fab',
394 'kit': 'fak'
395}), _defineProperty(_familyProxy2, FAMILY_SHARP, {
396 'solid': 'fass'
397}), _familyProxy2));
398var PREFIX_TO_LONG_STYLE = familyProxy((_familyProxy3 = {}, _defineProperty(_familyProxy3, FAMILY_CLASSIC, {
399 'fab': 'fa-brands',
400 'fad': 'fa-duotone',
401 'fak': 'fa-kit',
402 'fal': 'fa-light',
403 'far': 'fa-regular',
404 'fas': 'fa-solid',
405 'fat': 'fa-thin'
406}), _defineProperty(_familyProxy3, FAMILY_SHARP, {
407 'fass': 'fa-solid'
408}), _familyProxy3));
409var LONG_STYLE_TO_PREFIX = familyProxy((_familyProxy4 = {}, _defineProperty(_familyProxy4, FAMILY_CLASSIC, {
410 'fa-brands': 'fab',
411 'fa-duotone': 'fad',
412 'fa-kit': 'fak',
413 'fa-light': 'fal',
414 'fa-regular': 'far',
415 'fa-solid': 'fas',
416 'fa-thin': 'fat'
417}), _defineProperty(_familyProxy4, FAMILY_SHARP, {
418 'fa-solid': 'fass'
419}), _familyProxy4));
420var ICON_SELECTION_SYNTAX_PATTERN = /fa(s|r|l|t|d|b|k|ss)?[\-\ ]/; // eslint-disable-line no-useless-escape
421
422var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
423var FONT_FAMILY_PATTERN = /Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp|Kit)?.*/i; // TODO: this needs to support fass
424// TODO: do we need to handle font-weight for kit SVG pseudo-elements?
425
426var FONT_WEIGHT_TO_PREFIX = familyProxy((_familyProxy5 = {}, _defineProperty(_familyProxy5, FAMILY_CLASSIC, {
427 '900': 'fas',
428 '400': 'far',
429 'normal': 'far',
430 '300': 'fal',
431 '100': 'fat'
432}), _defineProperty(_familyProxy5, FAMILY_SHARP, {
433 '900': 'fass'
434}), _familyProxy5));
435var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
436var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
437var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
438var DUOTONE_CLASSES = {
439 GROUP: 'duotone-group',
440 SWAP_OPACITY: 'swap-opacity',
441 PRIMARY: 'primary',
442 SECONDARY: 'secondary'
443};
444var prefixes = new Set();
445Object.keys(STYLE_TO_PREFIX[FAMILY_CLASSIC]).map(prefixes.add.bind(prefixes));
446Object.keys(STYLE_TO_PREFIX[FAMILY_SHARP]).map(prefixes.add.bind(prefixes));
447var RESERVED_CLASSES = [].concat(FAMILIES, _toConsumableArray(prefixes), ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', 'beat', 'border', 'fade', 'beat-fade', 'bounce', 'flip-both', 'flip-horizontal', 'flip-vertical', 'flip', 'fw', 'inverse', 'layers-counter', 'layers-text', 'layers', 'li', 'pull-left', 'pull-right', 'pulse', 'rotate-180', 'rotate-270', 'rotate-90', 'rotate-by', 'shake', 'spin-pulse', 'spin-reverse', 'spin', 'stack-1x', 'stack-2x', 'stack', 'ul', DUOTONE_CLASSES.GROUP, DUOTONE_CLASSES.SWAP_OPACITY, DUOTONE_CLASSES.PRIMARY, DUOTONE_CLASSES.SECONDARY]).concat(oneToTen.map(function (n) {
448 return "".concat(n, "x");
449})).concat(oneToTwenty.map(function (n) {
450 return "w-".concat(n);
451}));
452
453var initial = WINDOW.FontAwesomeConfig || {};
454
455function getAttrConfig(attr) {
456 var element = DOCUMENT.querySelector('script[' + attr + ']');
457
458 if (element) {
459 return element.getAttribute(attr);
460 }
461}
462
463function coerce(val) {
464 // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
465 // We'll assume that this is an indication that it should be toggled to true
466 if (val === '') return true;
467 if (val === 'false') return false;
468 if (val === 'true') return true;
469 return val;
470}
471
472if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
473 var attrs = [['data-family-prefix', 'familyPrefix'], ['data-css-prefix', 'cssPrefix'], ['data-family-default', 'familyDefault'], ['data-style-default', 'styleDefault'], ['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']];
474 attrs.forEach(function (_ref) {
475 var _ref2 = _slicedToArray(_ref, 2),
476 attr = _ref2[0],
477 key = _ref2[1];
478
479 var val = coerce(getAttrConfig(attr));
480
481 if (val !== undefined && val !== null) {
482 initial[key] = val;
483 }
484 });
485}
486
487var _default = {
488 styleDefault: 'solid',
489 familyDefault: 'classic',
490 cssPrefix: DEFAULT_CSS_PREFIX,
491 replacementClass: DEFAULT_REPLACEMENT_CLASS,
492 autoReplaceSvg: true,
493 autoAddCss: true,
494 autoA11y: true,
495 searchPseudoElements: false,
496 observeMutations: true,
497 mutateApproach: 'async',
498 keepOriginalSource: true,
499 measurePerformance: false,
500 showMissingIcons: true
501}; // familyPrefix is deprecated but we must still support it if present
502
503if (initial.familyPrefix) {
504 initial.cssPrefix = initial.familyPrefix;
505}
506
507var _config = _objectSpread2(_objectSpread2({}, _default), initial);
508
509if (!_config.autoReplaceSvg) _config.observeMutations = false;
510var config = {};
511Object.keys(_default).forEach(function (key) {
512 Object.defineProperty(config, key, {
513 enumerable: true,
514 set: function set(val) {
515 _config[key] = val;
516
517 _onChangeCb.forEach(function (cb) {
518 return cb(config);
519 });
520 },
521 get: function get() {
522 return _config[key];
523 }
524 });
525}); // familyPrefix is deprecated as of 6.2.0 and should be removed in 7.0.0
526
527Object.defineProperty(config, 'familyPrefix', {
528 enumerable: true,
529 set: function set(val) {
530 _config.cssPrefix = val;
531
532 _onChangeCb.forEach(function (cb) {
533 return cb(config);
534 });
535 },
536 get: function get() {
537 return _config.cssPrefix;
538 }
539});
540WINDOW.FontAwesomeConfig = config;
541var _onChangeCb = [];
542function onChange(cb) {
543 _onChangeCb.push(cb);
544
545 return function () {
546 _onChangeCb.splice(_onChangeCb.indexOf(cb), 1);
547 };
548}
549
550var w = WINDOW || {};
551if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
552if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
553if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
554if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
555var namespace = w[NAMESPACE_IDENTIFIER];
556
557var functions = [];
558
559var listener = function listener() {
560 DOCUMENT.removeEventListener('DOMContentLoaded', listener);
561 loaded = 1;
562 functions.map(function (fn) {
563 return fn();
564 });
565};
566
567var loaded = false;
568
569if (IS_DOM) {
570 loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
571 if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
572}
573
574function domready (fn) {
575 if (!IS_DOM) return;
576 loaded ? setTimeout(fn, 0) : functions.push(fn);
577}
578
579var d = UNITS_IN_GRID;
580var meaninglessTransform = {
581 size: 16,
582 x: 0,
583 y: 0,
584 rotate: 0,
585 flipX: false,
586 flipY: false
587};
588function insertCss(css) {
589 if (!css || !IS_DOM) {
590 return;
591 }
592
593 var style = DOCUMENT.createElement('style');
594 style.setAttribute('type', 'text/css');
595 style.innerHTML = css;
596 var headChildren = DOCUMENT.head.childNodes;
597 var beforeChild = null;
598
599 for (var i = headChildren.length - 1; i > -1; i--) {
600 var child = headChildren[i];
601 var tagName = (child.tagName || '').toUpperCase();
602
603 if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
604 beforeChild = child;
605 }
606 }
607
608 DOCUMENT.head.insertBefore(style, beforeChild);
609 return css;
610}
611var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
612function nextUniqueId() {
613 var size = 12;
614 var id = '';
615
616 while (size-- > 0) {
617 id += idPool[Math.random() * 62 | 0];
618 }
619
620 return id;
621}
622function toArray(obj) {
623 var array = [];
624
625 for (var i = (obj || []).length >>> 0; i--;) {
626 array[i] = obj[i];
627 }
628
629 return array;
630}
631function classArray(node) {
632 if (node.classList) {
633 return toArray(node.classList);
634 } else {
635 return (node.getAttribute('class') || '').split(' ').filter(function (i) {
636 return i;
637 });
638 }
639}
640function htmlEscape(str) {
641 return "".concat(str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
642}
643function joinAttributes(attributes) {
644 return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
645 return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
646 }, '').trim();
647}
648function joinStyles(styles) {
649 return Object.keys(styles || {}).reduce(function (acc, styleName) {
650 return acc + "".concat(styleName, ": ").concat(styles[styleName].trim(), ";");
651 }, '');
652}
653function transformIsMeaningful(transform) {
654 return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
655}
656function transformForSvg(_ref) {
657 var transform = _ref.transform,
658 containerWidth = _ref.containerWidth,
659 iconWidth = _ref.iconWidth;
660 var outer = {
661 transform: "translate(".concat(containerWidth / 2, " 256)")
662 };
663 var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
664 var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
665 var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
666 var inner = {
667 transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
668 };
669 var path = {
670 transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
671 };
672 return {
673 outer: outer,
674 inner: inner,
675 path: path
676 };
677}
678function transformForCss(_ref2) {
679 var transform = _ref2.transform,
680 _ref2$width = _ref2.width,
681 width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
682 _ref2$height = _ref2.height,
683 height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
684 _ref2$startCentered = _ref2.startCentered,
685 startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
686 var val = '';
687
688 if (startCentered && IS_IE) {
689 val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
690 } else if (startCentered) {
691 val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
692 } else {
693 val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
694 }
695
696 val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
697 val += "rotate(".concat(transform.rotate, "deg) ");
698 return val;
699}
700
701function toHtml(abstractNodes) {
702 var tag = abstractNodes.tag,
703 _abstractNodes$attrib = abstractNodes.attributes,
704 attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
705 _abstractNodes$childr = abstractNodes.children,
706 children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
707
708 if (typeof abstractNodes === 'string') {
709 return htmlEscape(abstractNodes);
710 } else {
711 return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
712 }
713}
714
715function iconFromMapping(mapping, prefix, iconName) {
716 if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
717 return {
718 prefix: prefix,
719 iconName: iconName,
720 icon: mapping[prefix][iconName]
721 };
722 }
723}
724
725/**
726 * Internal helper to bind a function known to have 4 arguments
727 * to a given context.
728 */
729
730var bindInternal4 = function bindInternal4(func, thisContext) {
731 return function (a, b, c, d) {
732 return func.call(thisContext, a, b, c, d);
733 };
734};
735
736/**
737 * # Reduce
738 *
739 * A fast object `.reduce()` implementation.
740 *
741 * @param {Object} subject The object to reduce over.
742 * @param {Function} fn The reducer function.
743 * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
744 * @param {Object} thisContext The context for the reducer.
745 * @return {mixed} The final result.
746 */
747
748
749var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
750 var keys = Object.keys(subject),
751 length = keys.length,
752 iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
753 i,
754 key,
755 result;
756
757 if (initialValue === undefined) {
758 i = 1;
759 result = subject[keys[0]];
760 } else {
761 i = 0;
762 result = initialValue;
763 }
764
765 for (; i < length; i++) {
766 key = keys[i];
767 result = iterator(result, subject[key], key, subject);
768 }
769
770 return result;
771};
772
773/**
774 * ucs2decode() and codePointAt() are both works of Mathias Bynens and licensed under MIT
775 *
776 * Copyright Mathias Bynens <https://mathiasbynens.be/>
777
778 * Permission is hereby granted, free of charge, to any person obtaining
779 * a copy of this software and associated documentation files (the
780 * "Software"), to deal in the Software without restriction, including
781 * without limitation the rights to use, copy, modify, merge, publish,
782 * distribute, sublicense, and/or sell copies of the Software, and to
783 * permit persons to whom the Software is furnished to do so, subject to
784 * the following conditions:
785
786 * The above copyright notice and this permission notice shall be
787 * included in all copies or substantial portions of the Software.
788
789 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
790 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
791 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
792 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
793 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
794 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
795 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
796 */
797function ucs2decode(string) {
798 var output = [];
799 var counter = 0;
800 var length = string.length;
801
802 while (counter < length) {
803 var value = string.charCodeAt(counter++);
804
805 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
806 var extra = string.charCodeAt(counter++);
807
808 if ((extra & 0xFC00) == 0xDC00) {
809 // eslint-disable-line eqeqeq
810 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
811 } else {
812 output.push(value);
813 counter--;
814 }
815 } else {
816 output.push(value);
817 }
818 }
819
820 return output;
821}
822
823function toHex(unicode) {
824 var decoded = ucs2decode(unicode);
825 return decoded.length === 1 ? decoded[0].toString(16) : null;
826}
827function codePointAt(string, index) {
828 var size = string.length;
829 var first = string.charCodeAt(index);
830 var second;
831
832 if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
833 second = string.charCodeAt(index + 1);
834
835 if (second >= 0xDC00 && second <= 0xDFFF) {
836 return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
837 }
838 }
839
840 return first;
841}
842
843function normalizeIcons(icons) {
844 return Object.keys(icons).reduce(function (acc, iconName) {
845 var icon = icons[iconName];
846 var expanded = !!icon.icon;
847
848 if (expanded) {
849 acc[icon.iconName] = icon.icon;
850 } else {
851 acc[iconName] = icon;
852 }
853
854 return acc;
855 }, {});
856}
857
858function defineIcons(prefix, icons) {
859 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
860 var _params$skipHooks = params.skipHooks,
861 skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
862 var normalized = normalizeIcons(icons);
863
864 if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
865 namespace.hooks.addPack(prefix, normalizeIcons(icons));
866 } else {
867 namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), normalized);
868 }
869 /**
870 * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
871 * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
872 * for `fas` so we'll ease the upgrade process for our users by automatically defining
873 * this as well.
874 */
875
876
877 if (prefix === 'fas') {
878 defineIcons('fa', icons);
879 }
880}
881
882var duotonePathRe = [/*#__PURE__*/_wrapRegExp(/path d="((?:(?!")[\s\S])+)".*path d="((?:(?!")[\s\S])+)"/, {
883 d1: 1,
884 d2: 2
885}), /*#__PURE__*/_wrapRegExp(/path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)".*path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)"/, {
886 cls1: 1,
887 d1: 2,
888 cls2: 3,
889 d2: 4
890}), /*#__PURE__*/_wrapRegExp(/path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)"/, {
891 cls1: 1,
892 d1: 2
893})];
894
895var _LONG_STYLE, _PREFIXES, _PREFIXES_FOR_FAMILY;
896var styles = namespace.styles,
897 shims = namespace.shims;
898var LONG_STYLE = (_LONG_STYLE = {}, _defineProperty(_LONG_STYLE, FAMILY_CLASSIC, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_LONG_STYLE, FAMILY_SHARP, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _LONG_STYLE);
899var _defaultUsablePrefix = null;
900var _byUnicode = {};
901var _byLigature = {};
902var _byOldName = {};
903var _byOldUnicode = {};
904var _byAlias = {};
905var PREFIXES = (_PREFIXES = {}, _defineProperty(_PREFIXES, FAMILY_CLASSIC, Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES, FAMILY_SHARP, Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP])), _PREFIXES);
906
907function isReserved(name) {
908 return ~RESERVED_CLASSES.indexOf(name);
909}
910
911function getIconName(cssPrefix, cls) {
912 var parts = cls.split('-');
913 var prefix = parts[0];
914 var iconName = parts.slice(1).join('-');
915
916 if (prefix === cssPrefix && iconName !== '' && !isReserved(iconName)) {
917 return iconName;
918 } else {
919 return null;
920 }
921}
922var build = function build() {
923 var lookup = function lookup(reducer) {
924 return reduce(styles, function (o, style, prefix) {
925 o[prefix] = reduce(style, reducer, {});
926 return o;
927 }, {});
928 };
929
930 _byUnicode = lookup(function (acc, icon, iconName) {
931 if (icon[3]) {
932 acc[icon[3]] = iconName;
933 }
934
935 if (icon[2]) {
936 var aliases = icon[2].filter(function (a) {
937 return typeof a === 'number';
938 });
939 aliases.forEach(function (alias) {
940 acc[alias.toString(16)] = iconName;
941 });
942 }
943
944 return acc;
945 });
946 _byLigature = lookup(function (acc, icon, iconName) {
947 acc[iconName] = iconName;
948
949 if (icon[2]) {
950 var aliases = icon[2].filter(function (a) {
951 return typeof a === 'string';
952 });
953 aliases.forEach(function (alias) {
954 acc[alias] = iconName;
955 });
956 }
957
958 return acc;
959 });
960 _byAlias = lookup(function (acc, icon, iconName) {
961 var aliases = icon[2];
962 acc[iconName] = iconName;
963 aliases.forEach(function (alias) {
964 acc[alias] = iconName;
965 });
966 return acc;
967 }); // If we have a Kit, we can't determine if regular is available since we
968 // could be auto-fetching it. We'll have to assume that it is available.
969
970 var hasRegular = 'far' in styles || config.autoFetchSvg;
971 var shimLookups = reduce(shims, function (acc, shim) {
972 var maybeNameMaybeUnicode = shim[0];
973 var prefix = shim[1];
974 var iconName = shim[2];
975
976 if (prefix === 'far' && !hasRegular) {
977 prefix = 'fas';
978 }
979
980 if (typeof maybeNameMaybeUnicode === 'string') {
981 acc.names[maybeNameMaybeUnicode] = {
982 prefix: prefix,
983 iconName: iconName
984 };
985 }
986
987 if (typeof maybeNameMaybeUnicode === 'number') {
988 acc.unicodes[maybeNameMaybeUnicode.toString(16)] = {
989 prefix: prefix,
990 iconName: iconName
991 };
992 }
993
994 return acc;
995 }, {
996 names: {},
997 unicodes: {}
998 });
999 _byOldName = shimLookups.names;
1000 _byOldUnicode = shimLookups.unicodes;
1001 _defaultUsablePrefix = getCanonicalPrefix(config.styleDefault, {
1002 family: config.familyDefault
1003 });
1004};
1005onChange(function (c) {
1006 _defaultUsablePrefix = getCanonicalPrefix(c.styleDefault, {
1007 family: config.familyDefault
1008 });
1009});
1010build();
1011function byUnicode(prefix, unicode) {
1012 return (_byUnicode[prefix] || {})[unicode];
1013}
1014function byLigature(prefix, ligature) {
1015 return (_byLigature[prefix] || {})[ligature];
1016}
1017function byAlias(prefix, alias) {
1018 return (_byAlias[prefix] || {})[alias];
1019}
1020function byOldName(name) {
1021 return _byOldName[name] || {
1022 prefix: null,
1023 iconName: null
1024 };
1025}
1026function byOldUnicode(unicode) {
1027 var oldUnicode = _byOldUnicode[unicode];
1028 var newUnicode = byUnicode('fas', unicode);
1029 return oldUnicode || (newUnicode ? {
1030 prefix: 'fas',
1031 iconName: newUnicode
1032 } : null) || {
1033 prefix: null,
1034 iconName: null
1035 };
1036}
1037function getDefaultUsablePrefix() {
1038 return _defaultUsablePrefix;
1039}
1040var emptyCanonicalIcon = function emptyCanonicalIcon() {
1041 return {
1042 prefix: null,
1043 iconName: null,
1044 rest: []
1045 };
1046};
1047function getCanonicalPrefix(styleOrPrefix) {
1048 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1049 var _params$family = params.family,
1050 family = _params$family === void 0 ? FAMILY_CLASSIC : _params$family;
1051 var style = PREFIX_TO_STYLE[family][styleOrPrefix];
1052 var prefix = STYLE_TO_PREFIX[family][styleOrPrefix] || STYLE_TO_PREFIX[family][style];
1053 var defined = styleOrPrefix in namespace.styles ? styleOrPrefix : null;
1054 return prefix || defined || null;
1055}
1056var PREFIXES_FOR_FAMILY = (_PREFIXES_FOR_FAMILY = {}, _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_CLASSIC, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_SHARP, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _PREFIXES_FOR_FAMILY);
1057function getCanonicalIcon(values) {
1058 var _famProps;
1059
1060 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1061 var _params$skipLookups = params.skipLookups,
1062 skipLookups = _params$skipLookups === void 0 ? false : _params$skipLookups;
1063 var famProps = (_famProps = {}, _defineProperty(_famProps, FAMILY_CLASSIC, "".concat(config.cssPrefix, "-").concat(FAMILY_CLASSIC)), _defineProperty(_famProps, FAMILY_SHARP, "".concat(config.cssPrefix, "-").concat(FAMILY_SHARP)), _famProps);
1064 var givenPrefix = null;
1065 var family = FAMILY_CLASSIC;
1066
1067 if (values.includes(famProps[FAMILY_CLASSIC]) || values.some(function (v) {
1068 return PREFIXES_FOR_FAMILY[FAMILY_CLASSIC].includes(v);
1069 })) {
1070 family = FAMILY_CLASSIC;
1071 }
1072
1073 if (values.includes(famProps[FAMILY_SHARP]) || values.some(function (v) {
1074 return PREFIXES_FOR_FAMILY[FAMILY_SHARP].includes(v);
1075 })) {
1076 family = FAMILY_SHARP;
1077 }
1078
1079 var canonical = values.reduce(function (acc, cls) {
1080 var iconName = getIconName(config.cssPrefix, cls);
1081
1082 if (styles[cls]) {
1083 cls = LONG_STYLE[family].includes(cls) ? LONG_STYLE_TO_PREFIX[family][cls] : cls;
1084 givenPrefix = cls;
1085 acc.prefix = cls;
1086 } else if (PREFIXES[family].indexOf(cls) > -1) {
1087 givenPrefix = cls;
1088 acc.prefix = getCanonicalPrefix(cls, {
1089 family: family
1090 });
1091 } else if (iconName) {
1092 acc.iconName = iconName;
1093 } else if (cls !== config.replacementClass && cls !== famProps[FAMILY_CLASSIC] && cls !== famProps[FAMILY_SHARP]) {
1094 acc.rest.push(cls);
1095 }
1096
1097 if (!skipLookups && acc.prefix && acc.iconName) {
1098 var shim = givenPrefix === 'fa' ? byOldName(acc.iconName) : {};
1099 var aliasIconName = byAlias(acc.prefix, acc.iconName);
1100
1101 if (shim.prefix) {
1102 givenPrefix = null;
1103 }
1104
1105 acc.iconName = shim.iconName || aliasIconName || acc.iconName;
1106 acc.prefix = shim.prefix || acc.prefix;
1107
1108 if (acc.prefix === 'far' && !styles['far'] && styles['fas'] && !config.autoFetchSvg) {
1109 // Allow a fallback from the regular style to solid if regular is not available
1110 // but only if we aren't auto-fetching SVGs
1111 acc.prefix = 'fas';
1112 }
1113 }
1114
1115 return acc;
1116 }, emptyCanonicalIcon());
1117
1118 if (values.includes('fa-brands') || values.includes('fab')) {
1119 canonical.prefix = 'fab';
1120 }
1121
1122 if (values.includes('fa-duotone') || values.includes('fad')) {
1123 canonical.prefix = 'fad';
1124 }
1125
1126 if (!canonical.prefix && family === FAMILY_SHARP && (styles['fass'] || config.autoFetchSvg)) {
1127 canonical.prefix = 'fass';
1128 canonical.iconName = byAlias(canonical.prefix, canonical.iconName) || canonical.iconName;
1129 }
1130
1131 if (canonical.prefix === 'fa' || givenPrefix === 'fa') {
1132 // The fa prefix is not canonical. So if it has made it through until this point
1133 // we will shift it to the correct prefix.
1134 canonical.prefix = getDefaultUsablePrefix() || 'fas';
1135 }
1136
1137 return canonical;
1138}
1139
1140var Library = /*#__PURE__*/function () {
1141 function Library() {
1142 _classCallCheck(this, Library);
1143
1144 this.definitions = {};
1145 }
1146
1147 _createClass(Library, [{
1148 key: "add",
1149 value: function add() {
1150 var _this = this;
1151
1152 for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
1153 definitions[_key] = arguments[_key];
1154 }
1155
1156 var additions = definitions.reduce(this._pullDefinitions, {});
1157 Object.keys(additions).forEach(function (key) {
1158 _this.definitions[key] = _objectSpread2(_objectSpread2({}, _this.definitions[key] || {}), additions[key]);
1159 defineIcons(key, additions[key]); // TODO can we stop doing this? We can't get the icons by 'fa-solid' any longer so this probably needs to change
1160
1161 var longPrefix = PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC][key];
1162 if (longPrefix) defineIcons(longPrefix, additions[key]);
1163 build();
1164 });
1165 }
1166 }, {
1167 key: "reset",
1168 value: function reset() {
1169 this.definitions = {};
1170 }
1171 }, {
1172 key: "_pullDefinitions",
1173 value: function _pullDefinitions(additions, definition) {
1174 var normalized = definition.prefix && definition.iconName && definition.icon ? {
1175 0: definition
1176 } : definition;
1177 Object.keys(normalized).map(function (key) {
1178 var _normalized$key = normalized[key],
1179 prefix = _normalized$key.prefix,
1180 iconName = _normalized$key.iconName,
1181 icon = _normalized$key.icon;
1182 var aliases = icon[2];
1183 if (!additions[prefix]) additions[prefix] = {};
1184
1185 if (aliases.length > 0) {
1186 aliases.forEach(function (alias) {
1187 if (typeof alias === 'string') {
1188 additions[prefix][alias] = icon;
1189 }
1190 });
1191 }
1192
1193 additions[prefix][iconName] = icon;
1194 });
1195 return additions;
1196 }
1197 }]);
1198
1199 return Library;
1200}();
1201
1202function findIconDefinition(iconLookup) {
1203 if (iconLookup.prefix === 'fa') {
1204 iconLookup.prefix = 'fas';
1205 }
1206
1207 var iconName = iconLookup.iconName;
1208 var prefix = iconLookup.prefix || getDefaultUsablePrefix();
1209 if (!iconName) return;
1210 iconName = byAlias(prefix, iconName) || iconName;
1211 return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
1212}
1213var library = new Library();
1214var noAuto = function noAuto() {
1215 config.autoReplaceSvg = false;
1216 config.observeMutations = false;
1217 callHooks('noAuto');
1218};
1219var dom = {
1220 i2svg: function i2svg() {
1221 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1222
1223 if (IS_DOM) {
1224 callHooks('beforeI2svg', params);
1225 callProvided('pseudoElements2svg', params);
1226 return callProvided('i2svg', params);
1227 } else {
1228 return Promise.reject('Operation requires a DOM of some kind.');
1229 }
1230 },
1231 watch: function watch() {
1232 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1233 var autoReplaceSvgRoot = params.autoReplaceSvgRoot;
1234
1235 if (config.autoReplaceSvg === false) {
1236 config.autoReplaceSvg = true;
1237 }
1238
1239 config.observeMutations = true;
1240 domready(function () {
1241 autoReplace({
1242 autoReplaceSvgRoot: autoReplaceSvgRoot
1243 });
1244 callHooks('watch', params);
1245 });
1246 }
1247};
1248var parse = {
1249 icon: function icon(_icon) {
1250 if (_icon === null) {
1251 return null;
1252 }
1253
1254 if (_typeof(_icon) === 'object' && _icon.prefix && _icon.iconName) {
1255 return {
1256 prefix: _icon.prefix,
1257 iconName: byAlias(_icon.prefix, _icon.iconName) || _icon.iconName
1258 };
1259 }
1260
1261 if (Array.isArray(_icon) && _icon.length === 2) {
1262 var iconName = _icon[1].indexOf('fa-') === 0 ? _icon[1].slice(3) : _icon[1];
1263 var prefix = getCanonicalPrefix(_icon[0]);
1264 return {
1265 prefix: prefix,
1266 iconName: byAlias(prefix, iconName) || iconName
1267 };
1268 }
1269
1270 if (typeof _icon === 'string' && (_icon.indexOf("".concat(config.cssPrefix, "-")) > -1 || _icon.match(ICON_SELECTION_SYNTAX_PATTERN))) {
1271 var canonicalIcon = getCanonicalIcon(_icon.split(' '), {
1272 skipLookups: true
1273 });
1274 return {
1275 prefix: canonicalIcon.prefix || getDefaultUsablePrefix(),
1276 iconName: byAlias(canonicalIcon.prefix, canonicalIcon.iconName) || canonicalIcon.iconName
1277 };
1278 }
1279
1280 if (typeof _icon === 'string') {
1281 var _prefix = getDefaultUsablePrefix();
1282
1283 return {
1284 prefix: _prefix,
1285 iconName: byAlias(_prefix, _icon) || _icon
1286 };
1287 }
1288 }
1289};
1290var api = {
1291 noAuto: noAuto,
1292 config: config,
1293 dom: dom,
1294 parse: parse,
1295 library: library,
1296 findIconDefinition: findIconDefinition,
1297 toHtml: toHtml
1298};
1299
1300var autoReplace = function autoReplace() {
1301 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1302 var _params$autoReplaceSv = params.autoReplaceSvgRoot,
1303 autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
1304 if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
1305 node: autoReplaceSvgRoot
1306 });
1307};
1308
1309var baseStyles = ":root, :host {\n --fa-font-solid: normal 900 1em/1 \"Font Awesome 6 Solid\";\n --fa-font-regular: normal 400 1em/1 \"Font Awesome 6 Regular\";\n --fa-font-light: normal 300 1em/1 \"Font Awesome 6 Light\";\n --fa-font-thin: normal 100 1em/1 \"Font Awesome 6 Thin\";\n --fa-font-duotone: normal 900 1em/1 \"Font Awesome 6 Duotone\";\n --fa-font-sharp-solid: normal 900 1em/1 \"Font Awesome 6 Sharp\";\n --fa-font-brands: normal 400 1em/1 \"Font Awesome 6 Brands\";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-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-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\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-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: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-counter-scale, 0.25));\n transform: scale(var(--fa-counter-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top left;\n transform-origin: top left;\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-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\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: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(var(--fa-li-width, 2em) * -1);\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n -webkit-animation-name: fa-beat;\n animation-name: fa-beat;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n -webkit-animation-name: fa-bounce;\n animation-name: fa-bounce;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n -webkit-animation-name: fa-fade;\n animation-name: fa-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n -webkit-animation-name: fa-beat-fade;\n animation-name: fa-beat-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n -webkit-animation-name: fa-flip;\n animation-name: fa-flip;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n -webkit-animation-name: fa-shake;\n animation-name: fa-shake;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 2s);\n animation-duration: var(--fa-animation-duration, 2s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, steps(8));\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n -webkit-animation-delay: -1ms;\n animation-delay: -1ms;\n -webkit-animation-duration: 1ms;\n animation-duration: 1ms;\n -webkit-animation-iteration-count: 1;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@-webkit-keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@-webkit-keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@-webkit-keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@-webkit-keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@-webkit-keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@-webkit-keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n}\n@keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\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@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 -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n -webkit-transform: rotate(var(--fa-rotate-angle, none));\n transform: rotate(var(--fa-rotate-angle, none));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\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 z-index: var(--fa-stack-z-index, auto);\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: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.fad.fa-inverse,\n.fa-duotone.fa-inverse {\n color: var(--fa-inverse, #fff);\n}";
1310
1311function css() {
1312 var dcp = DEFAULT_CSS_PREFIX;
1313 var drc = DEFAULT_REPLACEMENT_CLASS;
1314 var fp = config.cssPrefix;
1315 var rc = config.replacementClass;
1316 var s = baseStyles;
1317
1318 if (fp !== dcp || rc !== drc) {
1319 var dPatt = new RegExp("\\.".concat(dcp, "\\-"), 'g');
1320 var customPropPatt = new RegExp("\\--".concat(dcp, "\\-"), 'g');
1321 var rPatt = new RegExp("\\.".concat(drc), 'g');
1322 s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
1323 }
1324
1325 return s;
1326}
1327
1328var _cssInserted = false;
1329
1330function ensureCss() {
1331 if (config.autoAddCss && !_cssInserted) {
1332 insertCss(css());
1333 _cssInserted = true;
1334 }
1335}
1336
1337var injectCss = {
1338 mixout: function mixout() {
1339 return {
1340 dom: {
1341 css: css,
1342 insertCss: ensureCss
1343 }
1344 };
1345 },
1346 hooks: function hooks() {
1347 return {
1348 beforeDOMElementCreation: function beforeDOMElementCreation() {
1349 ensureCss();
1350 },
1351 beforeI2svg: function beforeI2svg() {
1352 ensureCss();
1353 }
1354 };
1355 }
1356};
1357
1358function domVariants(val, abstractCreator) {
1359 Object.defineProperty(val, 'abstract', {
1360 get: abstractCreator
1361 });
1362 Object.defineProperty(val, 'html', {
1363 get: function get() {
1364 return val.abstract.map(function (a) {
1365 return toHtml(a);
1366 });
1367 }
1368 });
1369 Object.defineProperty(val, 'node', {
1370 get: function get() {
1371 if (!IS_DOM) return;
1372 var container = DOCUMENT.createElement('div');
1373 container.innerHTML = val.html;
1374 return container.children;
1375 }
1376 });
1377 return val;
1378}
1379
1380function asIcon (_ref) {
1381 var children = _ref.children,
1382 main = _ref.main,
1383 mask = _ref.mask,
1384 attributes = _ref.attributes,
1385 styles = _ref.styles,
1386 transform = _ref.transform;
1387
1388 if (transformIsMeaningful(transform) && main.found && !mask.found) {
1389 var width = main.width,
1390 height = main.height;
1391 var offset = {
1392 x: width / height / 2,
1393 y: 0.5
1394 };
1395 attributes['style'] = joinStyles(_objectSpread2(_objectSpread2({}, styles), {}, {
1396 'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
1397 }));
1398 }
1399
1400 return [{
1401 tag: 'svg',
1402 attributes: attributes,
1403 children: children
1404 }];
1405}
1406
1407function asSymbol (_ref) {
1408 var prefix = _ref.prefix,
1409 iconName = _ref.iconName,
1410 children = _ref.children,
1411 attributes = _ref.attributes,
1412 symbol = _ref.symbol;
1413 var id = symbol === true ? "".concat(prefix, "-").concat(config.cssPrefix, "-").concat(iconName) : symbol;
1414 return [{
1415 tag: 'svg',
1416 attributes: {
1417 style: 'display: none;'
1418 },
1419 children: [{
1420 tag: 'symbol',
1421 attributes: _objectSpread2(_objectSpread2({}, attributes), {}, {
1422 id: id
1423 }),
1424 children: children
1425 }]
1426 }];
1427}
1428
1429function makeInlineSvgAbstract(params) {
1430 var _params$icons = params.icons,
1431 main = _params$icons.main,
1432 mask = _params$icons.mask,
1433 prefix = params.prefix,
1434 iconName = params.iconName,
1435 transform = params.transform,
1436 symbol = params.symbol,
1437 title = params.title,
1438 maskId = params.maskId,
1439 titleId = params.titleId,
1440 extra = params.extra,
1441 _params$watchable = params.watchable,
1442 watchable = _params$watchable === void 0 ? false : _params$watchable;
1443
1444 var _ref = mask.found ? mask : main,
1445 width = _ref.width,
1446 height = _ref.height;
1447
1448 var isUploadedIcon = prefix === 'fak';
1449 var attrClass = [config.replacementClass, iconName ? "".concat(config.cssPrefix, "-").concat(iconName) : ''].filter(function (c) {
1450 return extra.classes.indexOf(c) === -1;
1451 }).filter(function (c) {
1452 return c !== '' || !!c;
1453 }).concat(extra.classes).join(' ');
1454 var content = {
1455 children: [],
1456 attributes: _objectSpread2(_objectSpread2({}, extra.attributes), {}, {
1457 'data-prefix': prefix,
1458 'data-icon': iconName,
1459 'class': attrClass,
1460 'role': extra.attributes.role || 'img',
1461 'xmlns': 'http://www.w3.org/2000/svg',
1462 'viewBox': "0 0 ".concat(width, " ").concat(height)
1463 })
1464 };
1465 var uploadedIconWidthStyle = isUploadedIcon && !~extra.classes.indexOf('fa-fw') ? {
1466 width: "".concat(width / height * 16 * 0.0625, "em")
1467 } : {};
1468
1469 if (watchable) {
1470 content.attributes[DATA_FA_I2SVG] = '';
1471 }
1472
1473 if (title) {
1474 content.children.push({
1475 tag: 'title',
1476 attributes: {
1477 id: content.attributes['aria-labelledby'] || "title-".concat(titleId || nextUniqueId())
1478 },
1479 children: [title]
1480 });
1481 delete content.attributes.title;
1482 }
1483
1484 var args = _objectSpread2(_objectSpread2({}, content), {}, {
1485 prefix: prefix,
1486 iconName: iconName,
1487 main: main,
1488 mask: mask,
1489 maskId: maskId,
1490 transform: transform,
1491 symbol: symbol,
1492 styles: _objectSpread2(_objectSpread2({}, uploadedIconWidthStyle), extra.styles)
1493 });
1494
1495 var _ref2 = mask.found && main.found ? callProvided('generateAbstractMask', args) || {
1496 children: [],
1497 attributes: {}
1498 } : callProvided('generateAbstractIcon', args) || {
1499 children: [],
1500 attributes: {}
1501 },
1502 children = _ref2.children,
1503 attributes = _ref2.attributes;
1504
1505 args.children = children;
1506 args.attributes = attributes;
1507
1508 if (symbol) {
1509 return asSymbol(args);
1510 } else {
1511 return asIcon(args);
1512 }
1513}
1514function makeLayersTextAbstract(params) {
1515 var content = params.content,
1516 width = params.width,
1517 height = params.height,
1518 transform = params.transform,
1519 title = params.title,
1520 extra = params.extra,
1521 _params$watchable2 = params.watchable,
1522 watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
1523
1524 var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
1525 'title': title
1526 } : {}), {}, {
1527 'class': extra.classes.join(' ')
1528 });
1529
1530 if (watchable) {
1531 attributes[DATA_FA_I2SVG] = '';
1532 }
1533
1534 var styles = _objectSpread2({}, extra.styles);
1535
1536 if (transformIsMeaningful(transform)) {
1537 styles['transform'] = transformForCss({
1538 transform: transform,
1539 startCentered: true,
1540 width: width,
1541 height: height
1542 });
1543 styles['-webkit-transform'] = styles['transform'];
1544 }
1545
1546 var styleString = joinStyles(styles);
1547
1548 if (styleString.length > 0) {
1549 attributes['style'] = styleString;
1550 }
1551
1552 var val = [];
1553 val.push({
1554 tag: 'span',
1555 attributes: attributes,
1556 children: [content]
1557 });
1558
1559 if (title) {
1560 val.push({
1561 tag: 'span',
1562 attributes: {
1563 class: 'sr-only'
1564 },
1565 children: [title]
1566 });
1567 }
1568
1569 return val;
1570}
1571function makeLayersCounterAbstract(params) {
1572 var content = params.content,
1573 title = params.title,
1574 extra = params.extra;
1575
1576 var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
1577 'title': title
1578 } : {}), {}, {
1579 'class': extra.classes.join(' ')
1580 });
1581
1582 var styleString = joinStyles(extra.styles);
1583
1584 if (styleString.length > 0) {
1585 attributes['style'] = styleString;
1586 }
1587
1588 var val = [];
1589 val.push({
1590 tag: 'span',
1591 attributes: attributes,
1592 children: [content]
1593 });
1594
1595 if (title) {
1596 val.push({
1597 tag: 'span',
1598 attributes: {
1599 class: 'sr-only'
1600 },
1601 children: [title]
1602 });
1603 }
1604
1605 return val;
1606}
1607
1608var styles$1 = namespace.styles;
1609function asFoundIcon(icon) {
1610 var width = icon[0];
1611 var height = icon[1];
1612
1613 var _icon$slice = icon.slice(4),
1614 _icon$slice2 = _slicedToArray(_icon$slice, 1),
1615 vectorData = _icon$slice2[0];
1616
1617 var element = null;
1618
1619 if (Array.isArray(vectorData)) {
1620 element = {
1621 tag: 'g',
1622 attributes: {
1623 class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
1624 },
1625 children: [{
1626 tag: 'path',
1627 attributes: {
1628 class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
1629 fill: 'currentColor',
1630 d: vectorData[0]
1631 }
1632 }, {
1633 tag: 'path',
1634 attributes: {
1635 class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
1636 fill: 'currentColor',
1637 d: vectorData[1]
1638 }
1639 }]
1640 };
1641 } else {
1642 element = {
1643 tag: 'path',
1644 attributes: {
1645 fill: 'currentColor',
1646 d: vectorData
1647 }
1648 };
1649 }
1650
1651 return {
1652 found: true,
1653 width: width,
1654 height: height,
1655 icon: element
1656 };
1657}
1658var missingIconResolutionMixin = {
1659 found: false,
1660 width: 512,
1661 height: 512
1662};
1663
1664function maybeNotifyMissing(iconName, prefix) {
1665 if (!PRODUCTION && !config.showMissingIcons && iconName) {
1666 console.error("Icon with name \"".concat(iconName, "\" and prefix \"").concat(prefix, "\" is missing."));
1667 }
1668}
1669
1670function findIcon(iconName, prefix) {
1671 var givenPrefix = prefix;
1672
1673 if (prefix === 'fa' && config.styleDefault !== null) {
1674 prefix = getDefaultUsablePrefix();
1675 }
1676
1677 return new Promise(function (resolve, reject) {
1678 var val = {
1679 found: false,
1680 width: 512,
1681 height: 512,
1682 icon: callProvided('missingIconAbstract') || {}
1683 };
1684
1685 if (givenPrefix === 'fa') {
1686 var shim = byOldName(iconName) || {};
1687 iconName = shim.iconName || iconName;
1688 prefix = shim.prefix || prefix;
1689 }
1690
1691 if (iconName && prefix && styles$1[prefix] && styles$1[prefix][iconName]) {
1692 var icon = styles$1[prefix][iconName];
1693 return resolve(asFoundIcon(icon));
1694 }
1695
1696 maybeNotifyMissing(iconName, prefix);
1697 resolve(_objectSpread2(_objectSpread2({}, missingIconResolutionMixin), {}, {
1698 icon: config.showMissingIcons && iconName ? callProvided('missingIconAbstract') || {} : {}
1699 }));
1700 });
1701}
1702
1703var noop$1 = function noop() {};
1704
1705var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
1706 mark: noop$1,
1707 measure: noop$1
1708};
1709var preamble = "FA \"6.2.1\"";
1710
1711var begin = function begin(name) {
1712 p.mark("".concat(preamble, " ").concat(name, " begins"));
1713 return function () {
1714 return end(name);
1715 };
1716};
1717
1718var end = function end(name) {
1719 p.mark("".concat(preamble, " ").concat(name, " ends"));
1720 p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
1721};
1722
1723var perf = {
1724 begin: begin,
1725 end: end
1726};
1727
1728var noop$2 = function noop() {};
1729
1730function isWatched(node) {
1731 var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
1732 return typeof i2svg === 'string';
1733}
1734
1735function hasPrefixAndIcon(node) {
1736 var prefix = node.getAttribute ? node.getAttribute(DATA_PREFIX) : null;
1737 var icon = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
1738 return prefix && icon;
1739}
1740
1741function hasBeenReplaced(node) {
1742 return node && node.classList && node.classList.contains && node.classList.contains(config.replacementClass);
1743}
1744
1745function getMutator() {
1746 if (config.autoReplaceSvg === true) {
1747 return mutators.replace;
1748 }
1749
1750 var mutator = mutators[config.autoReplaceSvg];
1751 return mutator || mutators.replace;
1752}
1753
1754function createElementNS(tag) {
1755 return DOCUMENT.createElementNS('http://www.w3.org/2000/svg', tag);
1756}
1757
1758function createElement(tag) {
1759 return DOCUMENT.createElement(tag);
1760}
1761
1762function convertSVG(abstractObj) {
1763 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1764 var _params$ceFn = params.ceFn,
1765 ceFn = _params$ceFn === void 0 ? abstractObj.tag === 'svg' ? createElementNS : createElement : _params$ceFn;
1766
1767 if (typeof abstractObj === 'string') {
1768 return DOCUMENT.createTextNode(abstractObj);
1769 }
1770
1771 var tag = ceFn(abstractObj.tag);
1772 Object.keys(abstractObj.attributes || []).forEach(function (key) {
1773 tag.setAttribute(key, abstractObj.attributes[key]);
1774 });
1775 var children = abstractObj.children || [];
1776 children.forEach(function (child) {
1777 tag.appendChild(convertSVG(child, {
1778 ceFn: ceFn
1779 }));
1780 });
1781 return tag;
1782}
1783
1784function nodeAsComment(node) {
1785 var comment = " ".concat(node.outerHTML, " ");
1786 /* BEGIN.ATTRIBUTION */
1787
1788 comment = "".concat(comment, "Font Awesome fontawesome.com ");
1789 /* END.ATTRIBUTION */
1790
1791 return comment;
1792}
1793
1794var mutators = {
1795 replace: function replace(mutation) {
1796 var node = mutation[0];
1797
1798 if (node.parentNode) {
1799 mutation[1].forEach(function (abstract) {
1800 node.parentNode.insertBefore(convertSVG(abstract), node);
1801 });
1802
1803 if (node.getAttribute(DATA_FA_I2SVG) === null && config.keepOriginalSource) {
1804 var comment = DOCUMENT.createComment(nodeAsComment(node));
1805 node.parentNode.replaceChild(comment, node);
1806 } else {
1807 node.remove();
1808 }
1809 }
1810 },
1811 nest: function nest(mutation) {
1812 var node = mutation[0];
1813 var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
1814 // Short-circuit to the standard replacement
1815
1816 if (~classArray(node).indexOf(config.replacementClass)) {
1817 return mutators.replace(mutation);
1818 }
1819
1820 var forSvg = new RegExp("".concat(config.cssPrefix, "-.*"));
1821 delete abstract[0].attributes.id;
1822
1823 if (abstract[0].attributes.class) {
1824 var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
1825 if (cls === config.replacementClass || cls.match(forSvg)) {
1826 acc.toSvg.push(cls);
1827 } else {
1828 acc.toNode.push(cls);
1829 }
1830
1831 return acc;
1832 }, {
1833 toNode: [],
1834 toSvg: []
1835 });
1836 abstract[0].attributes.class = splitClasses.toSvg.join(' ');
1837
1838 if (splitClasses.toNode.length === 0) {
1839 node.removeAttribute('class');
1840 } else {
1841 node.setAttribute('class', splitClasses.toNode.join(' '));
1842 }
1843 }
1844
1845 var newInnerHTML = abstract.map(function (a) {
1846 return toHtml(a);
1847 }).join('\n');
1848 node.setAttribute(DATA_FA_I2SVG, '');
1849 node.innerHTML = newInnerHTML;
1850 }
1851};
1852
1853function performOperationSync(op) {
1854 op();
1855}
1856
1857function perform(mutations, callback) {
1858 var callbackFunction = typeof callback === 'function' ? callback : noop$2;
1859
1860 if (mutations.length === 0) {
1861 callbackFunction();
1862 } else {
1863 var frame = performOperationSync;
1864
1865 if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
1866 frame = WINDOW.requestAnimationFrame || performOperationSync;
1867 }
1868
1869 frame(function () {
1870 var mutator = getMutator();
1871 var mark = perf.begin('mutate');
1872 mutations.map(mutator);
1873 mark();
1874 callbackFunction();
1875 });
1876 }
1877}
1878var disabled = false;
1879function disableObservation() {
1880 disabled = true;
1881}
1882function enableObservation() {
1883 disabled = false;
1884}
1885var mo = null;
1886function observe(options) {
1887 if (!MUTATION_OBSERVER) {
1888 return;
1889 }
1890
1891 if (!config.observeMutations) {
1892 return;
1893 }
1894
1895 var _options$treeCallback = options.treeCallback,
1896 treeCallback = _options$treeCallback === void 0 ? noop$2 : _options$treeCallback,
1897 _options$nodeCallback = options.nodeCallback,
1898 nodeCallback = _options$nodeCallback === void 0 ? noop$2 : _options$nodeCallback,
1899 _options$pseudoElemen = options.pseudoElementsCallback,
1900 pseudoElementsCallback = _options$pseudoElemen === void 0 ? noop$2 : _options$pseudoElemen,
1901 _options$observeMutat = options.observeMutationsRoot,
1902 observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
1903 mo = new MUTATION_OBSERVER(function (objects) {
1904 if (disabled) return;
1905 var defaultPrefix = getDefaultUsablePrefix();
1906 toArray(objects).forEach(function (mutationRecord) {
1907 if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
1908 if (config.searchPseudoElements) {
1909 pseudoElementsCallback(mutationRecord.target);
1910 }
1911
1912 treeCallback(mutationRecord.target);
1913 }
1914
1915 if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1916 pseudoElementsCallback(mutationRecord.target.parentNode);
1917 }
1918
1919 if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1920 if (mutationRecord.attributeName === 'class' && hasPrefixAndIcon(mutationRecord.target)) {
1921 var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1922 prefix = _getCanonicalIcon.prefix,
1923 iconName = _getCanonicalIcon.iconName;
1924
1925 mutationRecord.target.setAttribute(DATA_PREFIX, prefix || defaultPrefix);
1926 if (iconName) mutationRecord.target.setAttribute(DATA_ICON, iconName);
1927 } else if (hasBeenReplaced(mutationRecord.target)) {
1928 nodeCallback(mutationRecord.target);
1929 }
1930 }
1931 });
1932 });
1933 if (!IS_DOM) return;
1934 mo.observe(observeMutationsRoot, {
1935 childList: true,
1936 attributes: true,
1937 characterData: true,
1938 subtree: true
1939 });
1940}
1941function disconnect() {
1942 if (!mo) return;
1943 mo.disconnect();
1944}
1945
1946function styleParser (node) {
1947 var style = node.getAttribute('style');
1948 var val = [];
1949
1950 if (style) {
1951 val = style.split(';').reduce(function (acc, style) {
1952 var styles = style.split(':');
1953 var prop = styles[0];
1954 var value = styles.slice(1);
1955
1956 if (prop && value.length > 0) {
1957 acc[prop] = value.join(':').trim();
1958 }
1959
1960 return acc;
1961 }, {});
1962 }
1963
1964 return val;
1965}
1966
1967function classParser (node) {
1968 var existingPrefix = node.getAttribute('data-prefix');
1969 var existingIconName = node.getAttribute('data-icon');
1970 var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
1971 var val = getCanonicalIcon(classArray(node));
1972
1973 if (!val.prefix) {
1974 val.prefix = getDefaultUsablePrefix();
1975 }
1976
1977 if (existingPrefix && existingIconName) {
1978 val.prefix = existingPrefix;
1979 val.iconName = existingIconName;
1980 }
1981
1982 if (val.iconName && val.prefix) {
1983 return val;
1984 }
1985
1986 if (val.prefix && innerText.length > 0) {
1987 val.iconName = byLigature(val.prefix, node.innerText) || byUnicode(val.prefix, toHex(node.innerText));
1988 }
1989
1990 if (!val.iconName && config.autoFetchSvg && node.firstChild && node.firstChild.nodeType === Node.TEXT_NODE) {
1991 val.iconName = node.firstChild.data;
1992 }
1993
1994 return val;
1995}
1996
1997function attributesParser (node) {
1998 var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
1999 if (acc.name !== 'class' && acc.name !== 'style') {
2000 acc[attr.name] = attr.value;
2001 }
2002
2003 return acc;
2004 }, {});
2005 var title = node.getAttribute('title');
2006 var titleId = node.getAttribute('data-fa-title-id');
2007
2008 if (config.autoA11y) {
2009 if (title) {
2010 extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
2011 } else {
2012 extraAttributes['aria-hidden'] = 'true';
2013 extraAttributes['focusable'] = 'false';
2014 }
2015 }
2016
2017 return extraAttributes;
2018}
2019
2020function blankMeta() {
2021 return {
2022 iconName: null,
2023 title: null,
2024 titleId: null,
2025 prefix: null,
2026 transform: meaninglessTransform,
2027 symbol: false,
2028 mask: {
2029 iconName: null,
2030 prefix: null,
2031 rest: []
2032 },
2033 maskId: null,
2034 extra: {
2035 classes: [],
2036 styles: {},
2037 attributes: {}
2038 }
2039 };
2040}
2041function parseMeta(node) {
2042 var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
2043 styleParser: true
2044 };
2045
2046 var _classParser = classParser(node),
2047 iconName = _classParser.iconName,
2048 prefix = _classParser.prefix,
2049 extraClasses = _classParser.rest;
2050
2051 var extraAttributes = attributesParser(node);
2052 var pluginMeta = chainHooks('parseNodeAttributes', {}, node);
2053 var extraStyles = parser.styleParser ? styleParser(node) : [];
2054 return _objectSpread2({
2055 iconName: iconName,
2056 title: node.getAttribute('title'),
2057 titleId: node.getAttribute('data-fa-title-id'),
2058 prefix: prefix,
2059 transform: meaninglessTransform,
2060 mask: {
2061 iconName: null,
2062 prefix: null,
2063 rest: []
2064 },
2065 maskId: null,
2066 symbol: false,
2067 extra: {
2068 classes: extraClasses,
2069 styles: extraStyles,
2070 attributes: extraAttributes
2071 }
2072 }, pluginMeta);
2073}
2074
2075var styles$2 = namespace.styles;
2076
2077function generateMutation(node) {
2078 var nodeMeta = config.autoReplaceSvg === 'nest' ? parseMeta(node, {
2079 styleParser: false
2080 }) : parseMeta(node);
2081
2082 if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
2083 return callProvided('generateLayersText', node, nodeMeta);
2084 } else {
2085 return callProvided('generateSvgReplacementMutation', node, nodeMeta);
2086 }
2087}
2088
2089var knownPrefixes = new Set();
2090FAMILIES.map(function (family) {
2091 knownPrefixes.add("fa-".concat(family));
2092});
2093Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC]).map(knownPrefixes.add.bind(knownPrefixes));
2094Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP]).map(knownPrefixes.add.bind(knownPrefixes));
2095knownPrefixes = _toConsumableArray(knownPrefixes);
2096
2097function onTree(root) {
2098 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2099 if (!IS_DOM) return Promise.resolve();
2100 var htmlClassList = DOCUMENT.documentElement.classList;
2101
2102 var hclAdd = function hclAdd(suffix) {
2103 return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
2104 };
2105
2106 var hclRemove = function hclRemove(suffix) {
2107 return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
2108 };
2109
2110 var prefixes = config.autoFetchSvg ? knownPrefixes : FAMILIES.map(function (f) {
2111 return "fa-".concat(f);
2112 }).concat(Object.keys(styles$2));
2113
2114 if (!prefixes.includes('fa')) {
2115 prefixes.push('fa');
2116 }
2117
2118 var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
2119 return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
2120 })).join(', ');
2121
2122 if (prefixesDomQuery.length === 0) {
2123 return Promise.resolve();
2124 }
2125
2126 var candidates = [];
2127
2128 try {
2129 candidates = toArray(root.querySelectorAll(prefixesDomQuery));
2130 } catch (e) {// noop
2131 }
2132
2133 if (candidates.length > 0) {
2134 hclAdd('pending');
2135 hclRemove('complete');
2136 } else {
2137 return Promise.resolve();
2138 }
2139
2140 var mark = perf.begin('onTree');
2141 var mutations = candidates.reduce(function (acc, node) {
2142 try {
2143 var mutation = generateMutation(node);
2144
2145 if (mutation) {
2146 acc.push(mutation);
2147 }
2148 } catch (e) {
2149 if (!PRODUCTION) {
2150 if (e.name === 'MissingIcon') {
2151 console.error(e);
2152 }
2153 }
2154 }
2155
2156 return acc;
2157 }, []);
2158 return new Promise(function (resolve, reject) {
2159 Promise.all(mutations).then(function (resolvedMutations) {
2160 perform(resolvedMutations, function () {
2161 hclAdd('active');
2162 hclAdd('complete');
2163 hclRemove('pending');
2164 if (typeof callback === 'function') callback();
2165 mark();
2166 resolve();
2167 });
2168 }).catch(function (e) {
2169 mark();
2170 reject(e);
2171 });
2172 });
2173}
2174
2175function onNode(node) {
2176 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2177 generateMutation(node).then(function (mutation) {
2178 if (mutation) {
2179 perform([mutation], callback);
2180 }
2181 });
2182}
2183
2184function resolveIcons(next) {
2185 return function (maybeIconDefinition) {
2186 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2187 var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
2188 var mask = params.mask;
2189
2190 if (mask) {
2191 mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
2192 }
2193
2194 return next(iconDefinition, _objectSpread2(_objectSpread2({}, params), {}, {
2195 mask: mask
2196 }));
2197 };
2198}
2199
2200var render = function render(iconDefinition) {
2201 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2202 var _params$transform = params.transform,
2203 transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2204 _params$symbol = params.symbol,
2205 symbol = _params$symbol === void 0 ? false : _params$symbol,
2206 _params$mask = params.mask,
2207 mask = _params$mask === void 0 ? null : _params$mask,
2208 _params$maskId = params.maskId,
2209 maskId = _params$maskId === void 0 ? null : _params$maskId,
2210 _params$title = params.title,
2211 title = _params$title === void 0 ? null : _params$title,
2212 _params$titleId = params.titleId,
2213 titleId = _params$titleId === void 0 ? null : _params$titleId,
2214 _params$classes = params.classes,
2215 classes = _params$classes === void 0 ? [] : _params$classes,
2216 _params$attributes = params.attributes,
2217 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2218 _params$styles = params.styles,
2219 styles = _params$styles === void 0 ? {} : _params$styles;
2220 if (!iconDefinition) return;
2221 var prefix = iconDefinition.prefix,
2222 iconName = iconDefinition.iconName,
2223 icon = iconDefinition.icon;
2224 return domVariants(_objectSpread2({
2225 type: 'icon'
2226 }, iconDefinition), function () {
2227 callHooks('beforeDOMElementCreation', {
2228 iconDefinition: iconDefinition,
2229 params: params
2230 });
2231
2232 if (config.autoA11y) {
2233 if (title) {
2234 attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
2235 } else {
2236 attributes['aria-hidden'] = 'true';
2237 attributes['focusable'] = 'false';
2238 }
2239 }
2240
2241 return makeInlineSvgAbstract({
2242 icons: {
2243 main: asFoundIcon(icon),
2244 mask: mask ? asFoundIcon(mask.icon) : {
2245 found: false,
2246 width: null,
2247 height: null,
2248 icon: {}
2249 }
2250 },
2251 prefix: prefix,
2252 iconName: iconName,
2253 transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
2254 symbol: symbol,
2255 title: title,
2256 maskId: maskId,
2257 titleId: titleId,
2258 extra: {
2259 attributes: attributes,
2260 styles: styles,
2261 classes: classes
2262 }
2263 });
2264 });
2265};
2266var replaceElements = {
2267 mixout: function mixout() {
2268 return {
2269 icon: resolveIcons(render)
2270 };
2271 },
2272 hooks: function hooks() {
2273 return {
2274 mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
2275 accumulator.treeCallback = onTree;
2276 accumulator.nodeCallback = onNode;
2277 return accumulator;
2278 }
2279 };
2280 },
2281 provides: function provides(providers$$1) {
2282 providers$$1.i2svg = function (params) {
2283 var _params$node = params.node,
2284 node = _params$node === void 0 ? DOCUMENT : _params$node,
2285 _params$callback = params.callback,
2286 callback = _params$callback === void 0 ? function () {} : _params$callback;
2287 return onTree(node, callback);
2288 };
2289
2290 providers$$1.generateSvgReplacementMutation = function (node, nodeMeta) {
2291 var iconName = nodeMeta.iconName,
2292 title = nodeMeta.title,
2293 titleId = nodeMeta.titleId,
2294 prefix = nodeMeta.prefix,
2295 transform = nodeMeta.transform,
2296 symbol = nodeMeta.symbol,
2297 mask = nodeMeta.mask,
2298 maskId = nodeMeta.maskId,
2299 extra = nodeMeta.extra;
2300 return new Promise(function (resolve, reject) {
2301 Promise.all([findIcon(iconName, prefix), mask.iconName ? findIcon(mask.iconName, mask.prefix) : Promise.resolve({
2302 found: false,
2303 width: 512,
2304 height: 512,
2305 icon: {}
2306 })]).then(function (_ref) {
2307 var _ref2 = _slicedToArray(_ref, 2),
2308 main = _ref2[0],
2309 mask = _ref2[1];
2310
2311 resolve([node, makeInlineSvgAbstract({
2312 icons: {
2313 main: main,
2314 mask: mask
2315 },
2316 prefix: prefix,
2317 iconName: iconName,
2318 transform: transform,
2319 symbol: symbol,
2320 maskId: maskId,
2321 title: title,
2322 titleId: titleId,
2323 extra: extra,
2324 watchable: true
2325 })]);
2326 }).catch(reject);
2327 });
2328 };
2329
2330 providers$$1.generateAbstractIcon = function (_ref3) {
2331 var children = _ref3.children,
2332 attributes = _ref3.attributes,
2333 main = _ref3.main,
2334 transform = _ref3.transform,
2335 styles = _ref3.styles;
2336 var styleString = joinStyles(styles);
2337
2338 if (styleString.length > 0) {
2339 attributes['style'] = styleString;
2340 }
2341
2342 var nextChild;
2343
2344 if (transformIsMeaningful(transform)) {
2345 nextChild = callProvided('generateAbstractTransformGrouping', {
2346 main: main,
2347 transform: transform,
2348 containerWidth: main.width,
2349 iconWidth: main.width
2350 });
2351 }
2352
2353 children.push(nextChild || main.icon);
2354 return {
2355 children: children,
2356 attributes: attributes
2357 };
2358 };
2359 }
2360};
2361
2362var layers = {
2363 mixout: function mixout() {
2364 return {
2365 layer: function layer(assembler) {
2366 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2367 var _params$classes = params.classes,
2368 classes = _params$classes === void 0 ? [] : _params$classes;
2369 return domVariants({
2370 type: 'layer'
2371 }, function () {
2372 callHooks('beforeDOMElementCreation', {
2373 assembler: assembler,
2374 params: params
2375 });
2376 var children = [];
2377 assembler(function (args) {
2378 Array.isArray(args) ? args.map(function (a) {
2379 children = children.concat(a.abstract);
2380 }) : children = children.concat(args.abstract);
2381 });
2382 return [{
2383 tag: 'span',
2384 attributes: {
2385 class: ["".concat(config.cssPrefix, "-layers")].concat(_toConsumableArray(classes)).join(' ')
2386 },
2387 children: children
2388 }];
2389 });
2390 }
2391 };
2392 }
2393};
2394
2395var layersCounter = {
2396 mixout: function mixout() {
2397 return {
2398 counter: function counter(content) {
2399 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2400 var _params$title = params.title,
2401 title = _params$title === void 0 ? null : _params$title,
2402 _params$classes = params.classes,
2403 classes = _params$classes === void 0 ? [] : _params$classes,
2404 _params$attributes = params.attributes,
2405 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2406 _params$styles = params.styles,
2407 styles = _params$styles === void 0 ? {} : _params$styles;
2408 return domVariants({
2409 type: 'counter',
2410 content: content
2411 }, function () {
2412 callHooks('beforeDOMElementCreation', {
2413 content: content,
2414 params: params
2415 });
2416 return makeLayersCounterAbstract({
2417 content: content.toString(),
2418 title: title,
2419 extra: {
2420 attributes: attributes,
2421 styles: styles,
2422 classes: ["".concat(config.cssPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
2423 }
2424 });
2425 });
2426 }
2427 };
2428 }
2429};
2430
2431var layersText = {
2432 mixout: function mixout() {
2433 return {
2434 text: function text(content) {
2435 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2436 var _params$transform = params.transform,
2437 transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2438 _params$title = params.title,
2439 title = _params$title === void 0 ? null : _params$title,
2440 _params$classes = params.classes,
2441 classes = _params$classes === void 0 ? [] : _params$classes,
2442 _params$attributes = params.attributes,
2443 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2444 _params$styles = params.styles,
2445 styles = _params$styles === void 0 ? {} : _params$styles;
2446 return domVariants({
2447 type: 'text',
2448 content: content
2449 }, function () {
2450 callHooks('beforeDOMElementCreation', {
2451 content: content,
2452 params: params
2453 });
2454 return makeLayersTextAbstract({
2455 content: content,
2456 transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
2457 title: title,
2458 extra: {
2459 attributes: attributes,
2460 styles: styles,
2461 classes: ["".concat(config.cssPrefix, "-layers-text")].concat(_toConsumableArray(classes))
2462 }
2463 });
2464 });
2465 }
2466 };
2467 },
2468 provides: function provides(providers$$1) {
2469 providers$$1.generateLayersText = function (node, nodeMeta) {
2470 var title = nodeMeta.title,
2471 transform = nodeMeta.transform,
2472 extra = nodeMeta.extra;
2473 var width = null;
2474 var height = null;
2475
2476 if (IS_IE) {
2477 var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
2478 var boundingClientRect = node.getBoundingClientRect();
2479 width = boundingClientRect.width / computedFontSize;
2480 height = boundingClientRect.height / computedFontSize;
2481 }
2482
2483 if (config.autoA11y && !title) {
2484 extra.attributes['aria-hidden'] = 'true';
2485 }
2486
2487 return Promise.resolve([node, makeLayersTextAbstract({
2488 content: node.innerHTML,
2489 width: width,
2490 height: height,
2491 transform: transform,
2492 title: title,
2493 extra: extra,
2494 watchable: true
2495 })]);
2496 };
2497 }
2498};
2499
2500var CLEAN_CONTENT_PATTERN = new RegExp("\"", 'ug');
2501var SECONDARY_UNICODE_RANGE = [1105920, 1112319];
2502function hexValueFromContent(content) {
2503 var cleaned = content.replace(CLEAN_CONTENT_PATTERN, '');
2504 var codePoint = codePointAt(cleaned, 0);
2505 var isPrependTen = codePoint >= SECONDARY_UNICODE_RANGE[0] && codePoint <= SECONDARY_UNICODE_RANGE[1];
2506 var isDoubled = cleaned.length === 2 ? cleaned[0] === cleaned[1] : false;
2507 return {
2508 value: isDoubled ? toHex(cleaned[0]) : toHex(cleaned),
2509 isSecondary: isPrependTen || isDoubled
2510 };
2511}
2512
2513function replaceForPosition(node, position) {
2514 var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
2515 return new Promise(function (resolve, reject) {
2516 if (node.getAttribute(pendingAttribute) !== null) {
2517 // This node is already being processed
2518 return resolve();
2519 }
2520
2521 var children = toArray(node.children);
2522 var alreadyProcessedPseudoElement = children.filter(function (c) {
2523 return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
2524 })[0];
2525 var styles = WINDOW.getComputedStyle(node, position);
2526 var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
2527 var fontWeight = styles.getPropertyValue('font-weight');
2528 var content = styles.getPropertyValue('content');
2529
2530 if (alreadyProcessedPseudoElement && !fontFamily) {
2531 // If we've already processed it but the current computed style does not result in a font-family,
2532 // that probably means that a class name that was previously present to make the icon has been
2533 // removed. So we now should delete the icon.
2534 node.removeChild(alreadyProcessedPseudoElement);
2535 return resolve();
2536 } else if (fontFamily && content !== 'none' && content !== '') {
2537 var _content = styles.getPropertyValue('content');
2538
2539 var family = ~['Sharp'].indexOf(fontFamily[2]) ? FAMILY_SHARP : FAMILY_CLASSIC;
2540 var prefix = ~['Solid', 'Regular', 'Light', 'Thin', 'Duotone', 'Brands', 'Kit'].indexOf(fontFamily[2]) ? STYLE_TO_PREFIX[family][fontFamily[2].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[family][fontWeight];
2541
2542 var _hexValueFromContent = hexValueFromContent(_content),
2543 hexValue = _hexValueFromContent.value,
2544 isSecondary = _hexValueFromContent.isSecondary;
2545
2546 var isV4 = fontFamily[0].startsWith('FontAwesome');
2547 var iconName = byUnicode(prefix, hexValue);
2548 var iconIdentifier = iconName;
2549
2550 if (isV4) {
2551 var iconName4 = byOldUnicode(hexValue);
2552
2553 if (iconName4.iconName && iconName4.prefix) {
2554 iconName = iconName4.iconName;
2555 prefix = iconName4.prefix;
2556 }
2557 } // Only convert the pseudo element in this ::before/::after position into an icon if we haven't
2558 // already done so with the same prefix and iconName
2559
2560
2561 if (iconName && !isSecondary && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
2562 node.setAttribute(pendingAttribute, iconIdentifier);
2563
2564 if (alreadyProcessedPseudoElement) {
2565 // Delete the old one, since we're replacing it with a new one
2566 node.removeChild(alreadyProcessedPseudoElement);
2567 }
2568
2569 var meta = blankMeta();
2570 var extra = meta.extra;
2571 extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
2572 findIcon(iconName, prefix).then(function (main) {
2573 var abstract = makeInlineSvgAbstract(_objectSpread2(_objectSpread2({}, meta), {}, {
2574 icons: {
2575 main: main,
2576 mask: emptyCanonicalIcon()
2577 },
2578 prefix: prefix,
2579 iconName: iconIdentifier,
2580 extra: extra,
2581 watchable: true
2582 }));
2583 var element = DOCUMENT.createElement('svg');
2584
2585 if (position === '::before') {
2586 node.insertBefore(element, node.firstChild);
2587 } else {
2588 node.appendChild(element);
2589 }
2590
2591 element.outerHTML = abstract.map(function (a) {
2592 return toHtml(a);
2593 }).join('\n');
2594 node.removeAttribute(pendingAttribute);
2595 resolve();
2596 }).catch(reject);
2597 } else {
2598 resolve();
2599 }
2600 } else {
2601 resolve();
2602 }
2603 });
2604}
2605
2606function replace(node) {
2607 return Promise.all([replaceForPosition(node, '::before'), replaceForPosition(node, '::after')]);
2608}
2609
2610function processable(node) {
2611 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');
2612}
2613
2614function searchPseudoElements(root) {
2615 if (!IS_DOM) return;
2616 return new Promise(function (resolve, reject) {
2617 var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
2618 var end = perf.begin('searchPseudoElements');
2619 disableObservation();
2620 Promise.all(operations).then(function () {
2621 end();
2622 enableObservation();
2623 resolve();
2624 }).catch(function () {
2625 end();
2626 enableObservation();
2627 reject();
2628 });
2629 });
2630}
2631
2632var pseudoElements = {
2633 hooks: function hooks() {
2634 return {
2635 mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
2636 accumulator.pseudoElementsCallback = searchPseudoElements;
2637 return accumulator;
2638 }
2639 };
2640 },
2641 provides: function provides(providers$$1) {
2642 providers$$1.pseudoElements2svg = function (params) {
2643 var _params$node = params.node,
2644 node = _params$node === void 0 ? DOCUMENT : _params$node;
2645
2646 if (config.searchPseudoElements) {
2647 searchPseudoElements(node);
2648 }
2649 };
2650 }
2651};
2652
2653var _unwatched = false;
2654var mutationObserver = {
2655 mixout: function mixout() {
2656 return {
2657 dom: {
2658 unwatch: function unwatch() {
2659 disableObservation();
2660 _unwatched = true;
2661 }
2662 }
2663 };
2664 },
2665 hooks: function hooks() {
2666 return {
2667 bootstrap: function bootstrap() {
2668 observe(chainHooks('mutationObserverCallbacks', {}));
2669 },
2670 noAuto: function noAuto() {
2671 disconnect();
2672 },
2673 watch: function watch(params) {
2674 var observeMutationsRoot = params.observeMutationsRoot;
2675
2676 if (_unwatched) {
2677 enableObservation();
2678 } else {
2679 observe(chainHooks('mutationObserverCallbacks', {
2680 observeMutationsRoot: observeMutationsRoot
2681 }));
2682 }
2683 }
2684 };
2685 }
2686};
2687
2688var parseTransformString = function parseTransformString(transformString) {
2689 var transform = {
2690 size: 16,
2691 x: 0,
2692 y: 0,
2693 flipX: false,
2694 flipY: false,
2695 rotate: 0
2696 };
2697 return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
2698 var parts = n.toLowerCase().split('-');
2699 var first = parts[0];
2700 var rest = parts.slice(1).join('-');
2701
2702 if (first && rest === 'h') {
2703 acc.flipX = true;
2704 return acc;
2705 }
2706
2707 if (first && rest === 'v') {
2708 acc.flipY = true;
2709 return acc;
2710 }
2711
2712 rest = parseFloat(rest);
2713
2714 if (isNaN(rest)) {
2715 return acc;
2716 }
2717
2718 switch (first) {
2719 case 'grow':
2720 acc.size = acc.size + rest;
2721 break;
2722
2723 case 'shrink':
2724 acc.size = acc.size - rest;
2725 break;
2726
2727 case 'left':
2728 acc.x = acc.x - rest;
2729 break;
2730
2731 case 'right':
2732 acc.x = acc.x + rest;
2733 break;
2734
2735 case 'up':
2736 acc.y = acc.y - rest;
2737 break;
2738
2739 case 'down':
2740 acc.y = acc.y + rest;
2741 break;
2742
2743 case 'rotate':
2744 acc.rotate = acc.rotate + rest;
2745 break;
2746 }
2747
2748 return acc;
2749 }, transform);
2750};
2751var powerTransforms = {
2752 mixout: function mixout() {
2753 return {
2754 parse: {
2755 transform: function transform(transformString) {
2756 return parseTransformString(transformString);
2757 }
2758 }
2759 };
2760 },
2761 hooks: function hooks() {
2762 return {
2763 parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
2764 var transformString = node.getAttribute('data-fa-transform');
2765
2766 if (transformString) {
2767 accumulator.transform = parseTransformString(transformString);
2768 }
2769
2770 return accumulator;
2771 }
2772 };
2773 },
2774 provides: function provides(providers) {
2775 providers.generateAbstractTransformGrouping = function (_ref) {
2776 var main = _ref.main,
2777 transform = _ref.transform,
2778 containerWidth = _ref.containerWidth,
2779 iconWidth = _ref.iconWidth;
2780 var outer = {
2781 transform: "translate(".concat(containerWidth / 2, " 256)")
2782 };
2783 var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
2784 var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
2785 var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
2786 var inner = {
2787 transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
2788 };
2789 var path = {
2790 transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
2791 };
2792 var operations = {
2793 outer: outer,
2794 inner: inner,
2795 path: path
2796 };
2797 return {
2798 tag: 'g',
2799 attributes: _objectSpread2({}, operations.outer),
2800 children: [{
2801 tag: 'g',
2802 attributes: _objectSpread2({}, operations.inner),
2803 children: [{
2804 tag: main.icon.tag,
2805 children: main.icon.children,
2806 attributes: _objectSpread2(_objectSpread2({}, main.icon.attributes), operations.path)
2807 }]
2808 }]
2809 };
2810 };
2811 }
2812};
2813
2814var ALL_SPACE = {
2815 x: 0,
2816 y: 0,
2817 width: '100%',
2818 height: '100%'
2819};
2820
2821function fillBlack(abstract) {
2822 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2823
2824 if (abstract.attributes && (abstract.attributes.fill || force)) {
2825 abstract.attributes.fill = 'black';
2826 }
2827
2828 return abstract;
2829}
2830
2831function deGroup(abstract) {
2832 if (abstract.tag === 'g') {
2833 return abstract.children;
2834 } else {
2835 return [abstract];
2836 }
2837}
2838
2839var masks = {
2840 hooks: function hooks() {
2841 return {
2842 parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
2843 var maskData = node.getAttribute('data-fa-mask');
2844 var mask = !maskData ? emptyCanonicalIcon() : getCanonicalIcon(maskData.split(' ').map(function (i) {
2845 return i.trim();
2846 }));
2847
2848 if (!mask.prefix) {
2849 mask.prefix = getDefaultUsablePrefix();
2850 }
2851
2852 accumulator.mask = mask;
2853 accumulator.maskId = node.getAttribute('data-fa-mask-id');
2854 return accumulator;
2855 }
2856 };
2857 },
2858 provides: function provides(providers) {
2859 providers.generateAbstractMask = function (_ref) {
2860 var children = _ref.children,
2861 attributes = _ref.attributes,
2862 main = _ref.main,
2863 mask = _ref.mask,
2864 explicitMaskId = _ref.maskId,
2865 transform = _ref.transform;
2866 var mainWidth = main.width,
2867 mainPath = main.icon;
2868 var maskWidth = mask.width,
2869 maskPath = mask.icon;
2870 var trans = transformForSvg({
2871 transform: transform,
2872 containerWidth: maskWidth,
2873 iconWidth: mainWidth
2874 });
2875 var maskRect = {
2876 tag: 'rect',
2877 attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
2878 fill: 'white'
2879 })
2880 };
2881 var maskInnerGroupChildrenMixin = mainPath.children ? {
2882 children: mainPath.children.map(fillBlack)
2883 } : {};
2884 var maskInnerGroup = {
2885 tag: 'g',
2886 attributes: _objectSpread2({}, trans.inner),
2887 children: [fillBlack(_objectSpread2({
2888 tag: mainPath.tag,
2889 attributes: _objectSpread2(_objectSpread2({}, mainPath.attributes), trans.path)
2890 }, maskInnerGroupChildrenMixin))]
2891 };
2892 var maskOuterGroup = {
2893 tag: 'g',
2894 attributes: _objectSpread2({}, trans.outer),
2895 children: [maskInnerGroup]
2896 };
2897 var maskId = "mask-".concat(explicitMaskId || nextUniqueId());
2898 var clipId = "clip-".concat(explicitMaskId || nextUniqueId());
2899 var maskTag = {
2900 tag: 'mask',
2901 attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
2902 id: maskId,
2903 maskUnits: 'userSpaceOnUse',
2904 maskContentUnits: 'userSpaceOnUse'
2905 }),
2906 children: [maskRect, maskOuterGroup]
2907 };
2908 var defs = {
2909 tag: 'defs',
2910 children: [{
2911 tag: 'clipPath',
2912 attributes: {
2913 id: clipId
2914 },
2915 children: deGroup(maskPath)
2916 }, maskTag]
2917 };
2918 children.push(defs, {
2919 tag: 'rect',
2920 attributes: _objectSpread2({
2921 fill: 'currentColor',
2922 'clip-path': "url(#".concat(clipId, ")"),
2923 mask: "url(#".concat(maskId, ")")
2924 }, ALL_SPACE)
2925 });
2926 return {
2927 children: children,
2928 attributes: attributes
2929 };
2930 };
2931 }
2932};
2933
2934var missingIconIndicator = {
2935 provides: function provides(providers) {
2936 var reduceMotion = false;
2937
2938 if (WINDOW.matchMedia) {
2939 reduceMotion = WINDOW.matchMedia('(prefers-reduced-motion: reduce)').matches;
2940 }
2941
2942 providers.missingIconAbstract = function () {
2943 var gChildren = [];
2944 var FILL = {
2945 fill: 'currentColor'
2946 };
2947 var ANIMATION_BASE = {
2948 attributeType: 'XML',
2949 repeatCount: 'indefinite',
2950 dur: '2s'
2951 }; // Ring
2952
2953 gChildren.push({
2954 tag: 'path',
2955 attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
2956 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'
2957 })
2958 });
2959
2960 var OPACITY_ANIMATE = _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
2961 attributeName: 'opacity'
2962 });
2963
2964 var dot = {
2965 tag: 'circle',
2966 attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
2967 cx: '256',
2968 cy: '364',
2969 r: '28'
2970 }),
2971 children: []
2972 };
2973
2974 if (!reduceMotion) {
2975 dot.children.push({
2976 tag: 'animate',
2977 attributes: _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
2978 attributeName: 'r',
2979 values: '28;14;28;28;14;28;'
2980 })
2981 }, {
2982 tag: 'animate',
2983 attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
2984 values: '1;0;1;1;0;1;'
2985 })
2986 });
2987 }
2988
2989 gChildren.push(dot);
2990 gChildren.push({
2991 tag: 'path',
2992 attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
2993 opacity: '1',
2994 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'
2995 }),
2996 children: reduceMotion ? [] : [{
2997 tag: 'animate',
2998 attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
2999 values: '1;0;0;0;0;1;'
3000 })
3001 }]
3002 });
3003
3004 if (!reduceMotion) {
3005 // Exclamation
3006 gChildren.push({
3007 tag: 'path',
3008 attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
3009 opacity: '0',
3010 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'
3011 }),
3012 children: [{
3013 tag: 'animate',
3014 attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
3015 values: '0;0;1;1;0;0;'
3016 })
3017 }]
3018 });
3019 }
3020
3021 return {
3022 tag: 'g',
3023 attributes: {
3024 'class': 'missing'
3025 },
3026 children: gChildren
3027 };
3028 };
3029 }
3030};
3031
3032var svgSymbols = {
3033 hooks: function hooks() {
3034 return {
3035 parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
3036 var symbolData = node.getAttribute('data-fa-symbol');
3037 var symbol = symbolData === null ? false : symbolData === '' ? true : symbolData;
3038 accumulator['symbol'] = symbol;
3039 return accumulator;
3040 }
3041 };
3042 }
3043};
3044
3045function register(plugins) {
3046 return registerPlugins(plugins, {
3047 mixoutsTo: api
3048 });
3049}
3050
3051export { register, injectCss as InjectCSS, replaceElements as ReplaceElements, layers as Layers, layersCounter as LayersCounter, layersText as LayersText, pseudoElements as PseudoElements, mutationObserver as MutationObserver, powerTransforms as PowerTransforms, masks as Masks, missingIconIndicator as MissingIconIndicator, svgSymbols as SvgSymbols };