BIMviewer

Форк
0
2459 строк · 76.5 Кб
1
/*!
2
 * Font Awesome Free 5.11.2 by @fontawesome - https://fontawesome.com
3
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
4
 */
5
(function () {
6
  'use strict';
7

8
  function _typeof(obj) {
9
    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10
      _typeof = function (obj) {
11
        return typeof obj;
12
      };
13
    } else {
14
      _typeof = function (obj) {
15
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16
      };
17
    }
18

19
    return _typeof(obj);
20
  }
21

22
  function _classCallCheck(instance, Constructor) {
23
    if (!(instance instanceof Constructor)) {
24
      throw new TypeError("Cannot call a class as a function");
25
    }
26
  }
27

28
  function _defineProperties(target, props) {
29
    for (var i = 0; i < props.length; i++) {
30
      var descriptor = props[i];
31
      descriptor.enumerable = descriptor.enumerable || false;
32
      descriptor.configurable = true;
33
      if ("value" in descriptor) descriptor.writable = true;
34
      Object.defineProperty(target, descriptor.key, descriptor);
35
    }
36
  }
37

38
  function _createClass(Constructor, protoProps, staticProps) {
39
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
40
    if (staticProps) _defineProperties(Constructor, staticProps);
41
    return Constructor;
42
  }
43

44
  function _defineProperty(obj, key, value) {
45
    if (key in obj) {
46
      Object.defineProperty(obj, key, {
47
        value: value,
48
        enumerable: true,
49
        configurable: true,
50
        writable: true
51
      });
52
    } else {
53
      obj[key] = value;
54
    }
55

56
    return obj;
57
  }
58

59
  function _objectSpread(target) {
60
    for (var i = 1; i < arguments.length; i++) {
61
      var source = arguments[i] != null ? arguments[i] : {};
62
      var ownKeys = Object.keys(source);
63

64
      if (typeof Object.getOwnPropertySymbols === 'function') {
65
        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
66
          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
67
        }));
68
      }
69

70
      ownKeys.forEach(function (key) {
71
        _defineProperty(target, key, source[key]);
72
      });
73
    }
74

75
    return target;
76
  }
77

78
  function _slicedToArray(arr, i) {
79
    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
80
  }
81

82
  function _toConsumableArray(arr) {
83
    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
84
  }
85

86
  function _arrayWithoutHoles(arr) {
87
    if (Array.isArray(arr)) {
88
      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
89

90
      return arr2;
91
    }
92
  }
93

94
  function _arrayWithHoles(arr) {
95
    if (Array.isArray(arr)) return arr;
96
  }
97

98
  function _iterableToArray(iter) {
99
    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
100
  }
101

102
  function _iterableToArrayLimit(arr, i) {
103
    var _arr = [];
104
    var _n = true;
105
    var _d = false;
106
    var _e = undefined;
107

108
    try {
109
      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
110
        _arr.push(_s.value);
111

112
        if (i && _arr.length === i) break;
113
      }
114
    } catch (err) {
115
      _d = true;
116
      _e = err;
117
    } finally {
118
      try {
119
        if (!_n && _i["return"] != null) _i["return"]();
120
      } finally {
121
        if (_d) throw _e;
122
      }
123
    }
124

125
    return _arr;
126
  }
127

128
  function _nonIterableSpread() {
129
    throw new TypeError("Invalid attempt to spread non-iterable instance");
130
  }
131

132
  function _nonIterableRest() {
133
    throw new TypeError("Invalid attempt to destructure non-iterable instance");
134
  }
135

136
  var noop = function noop() {};
137

138
  var _WINDOW = {};
139
  var _DOCUMENT = {};
140
  var _MUTATION_OBSERVER = null;
141
  var _PERFORMANCE = {
142
    mark: noop,
143
    measure: noop
144
  };
145

146
  try {
147
    if (typeof window !== 'undefined') _WINDOW = window;
148
    if (typeof document !== 'undefined') _DOCUMENT = document;
149
    if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
150
    if (typeof performance !== 'undefined') _PERFORMANCE = performance;
151
  } catch (e) {}
152

153
  var _ref = _WINDOW.navigator || {},
154
      _ref$userAgent = _ref.userAgent,
155
      userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
156

157
  var WINDOW = _WINDOW;
158
  var DOCUMENT = _DOCUMENT;
159
  var MUTATION_OBSERVER = _MUTATION_OBSERVER;
160
  var PERFORMANCE = _PERFORMANCE;
161
  var IS_BROWSER = !!WINDOW.document;
162
  var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
163
  var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
164

165
  var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
166
  var UNITS_IN_GRID = 16;
167
  var DEFAULT_FAMILY_PREFIX = 'fa';
168
  var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
169
  var DATA_FA_I2SVG = 'data-fa-i2svg';
170
  var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
171
  var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
172
  var DATA_PREFIX = 'data-prefix';
173
  var DATA_ICON = 'data-icon';
174
  var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
175
  var MUTATION_APPROACH_ASYNC = 'async';
176
  var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
177
  var PRODUCTION = function () {
178
    try {
179
      return "production" === 'production';
180
    } catch (e) {
181
      return false;
182
    }
183
  }();
184
  var PREFIX_TO_STYLE = {
185
    'fas': 'solid',
186
    'far': 'regular',
187
    'fal': 'light',
188
    'fad': 'duotone',
189
    'fab': 'brands',
190
    'fa': 'solid'
191
  };
192
  var STYLE_TO_PREFIX = {
193
    'solid': 'fas',
194
    'regular': 'far',
195
    'light': 'fal',
196
    'duotone': 'fad',
197
    'brands': 'fab'
198
  };
199
  var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
200
  var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Duotone|Brands|Free|Pro)/;
201
  var FONT_WEIGHT_TO_PREFIX = {
202
    '900': 'fas',
203
    '400': 'far',
204
    'normal': 'far',
205
    '300': 'fal'
206
  };
207
  var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
208
  var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
209
  var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
210
  var DUOTONE_CLASSES = {
211
    GROUP: 'group',
212
    SWAP_OPACITY: 'swap-opacity',
213
    PRIMARY: 'primary',
214
    SECONDARY: 'secondary'
215
  };
216
  var RESERVED_CLASSES = ['xs', 'sm', 'lg', 'fw', 'ul', 'li', 'border', 'pull-left', 'pull-right', 'spin', 'pulse', 'rotate-90', 'rotate-180', 'rotate-270', 'flip-horizontal', 'flip-vertical', 'flip-both', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter', DUOTONE_CLASSES.GROUP, DUOTONE_CLASSES.SWAP_OPACITY, DUOTONE_CLASSES.PRIMARY, DUOTONE_CLASSES.SECONDARY].concat(oneToTen.map(function (n) {
217
    return "".concat(n, "x");
218
  })).concat(oneToTwenty.map(function (n) {
219
    return "w-".concat(n);
220
  }));
221

222
  var initial = WINDOW.FontAwesomeConfig || {};
223

224
  function getAttrConfig(attr) {
225
    var element = DOCUMENT.querySelector('script[' + attr + ']');
226

227
    if (element) {
228
      return element.getAttribute(attr);
229
    }
230
  }
231

232
  function coerce(val) {
233
    // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
234
    // We'll assume that this is an indication that it should be toggled to true
235
    // For example <script data-search-pseudo-elements src="..."></script>
236
    if (val === '') return true;
237
    if (val === 'false') return false;
238
    if (val === 'true') return true;
239
    return val;
240
  }
241

242
  if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
243
    var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
244
    attrs.forEach(function (_ref) {
245
      var _ref2 = _slicedToArray(_ref, 2),
246
          attr = _ref2[0],
247
          key = _ref2[1];
248

249
      var val = coerce(getAttrConfig(attr));
250

251
      if (val !== undefined && val !== null) {
252
        initial[key] = val;
253
      }
254
    });
255
  }
256

257
  var _default = {
258
    familyPrefix: DEFAULT_FAMILY_PREFIX,
259
    replacementClass: DEFAULT_REPLACEMENT_CLASS,
260
    autoReplaceSvg: true,
261
    autoAddCss: true,
262
    autoA11y: true,
263
    searchPseudoElements: false,
264
    observeMutations: true,
265
    mutateApproach: 'async',
266
    keepOriginalSource: true,
267
    measurePerformance: false,
268
    showMissingIcons: true
269
  };
270

271
  var _config = _objectSpread({}, _default, initial);
272

273
  if (!_config.autoReplaceSvg) _config.observeMutations = false;
274

275
  var config = _objectSpread({}, _config);
276

277
  WINDOW.FontAwesomeConfig = config;
278

279
  var w = WINDOW || {};
280
  if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
281
  if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
282
  if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
283
  if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
284
  var namespace = w[NAMESPACE_IDENTIFIER];
285

286
  var functions = [];
287

288
  var listener = function listener() {
289
    DOCUMENT.removeEventListener('DOMContentLoaded', listener);
290
    loaded = 1;
291
    functions.map(function (fn) {
292
      return fn();
293
    });
294
  };
295

296
  var loaded = false;
297

298
  if (IS_DOM) {
299
    loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
300
    if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
301
  }
302

303
  function domready (fn) {
304
    if (!IS_DOM) return;
305
    loaded ? setTimeout(fn, 0) : functions.push(fn);
306
  }
307

308
  var PENDING = 'pending';
309
  var SETTLED = 'settled';
310
  var FULFILLED = 'fulfilled';
311
  var REJECTED = 'rejected';
312

313
  var NOOP = function NOOP() {};
314

315
  var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
316
  var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
317
  var asyncQueue = [];
318
  var asyncTimer;
319

320
  function asyncFlush() {
321
    // run promise callbacks
322
    for (var i = 0; i < asyncQueue.length; i++) {
323
      asyncQueue[i][0](asyncQueue[i][1]);
324
    } // reset async asyncQueue
325

326

327
    asyncQueue = [];
328
    asyncTimer = false;
329
  }
330

331
  function asyncCall(callback, arg) {
332
    asyncQueue.push([callback, arg]);
333

334
    if (!asyncTimer) {
335
      asyncTimer = true;
336
      asyncSetTimer(asyncFlush, 0);
337
    }
338
  }
339

340
  function invokeResolver(resolver, promise) {
341
    function resolvePromise(value) {
342
      resolve(promise, value);
343
    }
344

345
    function rejectPromise(reason) {
346
      reject(promise, reason);
347
    }
348

349
    try {
350
      resolver(resolvePromise, rejectPromise);
351
    } catch (e) {
352
      rejectPromise(e);
353
    }
354
  }
355

356
  function invokeCallback(subscriber) {
357
    var owner = subscriber.owner;
358
    var settled = owner._state;
359
    var value = owner._data;
360
    var callback = subscriber[settled];
361
    var promise = subscriber.then;
362

363
    if (typeof callback === 'function') {
364
      settled = FULFILLED;
365

366
      try {
367
        value = callback(value);
368
      } catch (e) {
369
        reject(promise, e);
370
      }
371
    }
372

373
    if (!handleThenable(promise, value)) {
374
      if (settled === FULFILLED) {
375
        resolve(promise, value);
376
      }
377

378
      if (settled === REJECTED) {
379
        reject(promise, value);
380
      }
381
    }
382
  }
383

384
  function handleThenable(promise, value) {
385
    var resolved;
386

387
    try {
388
      if (promise === value) {
389
        throw new TypeError('A promises callback cannot return that same promise.');
390
      }
391

392
      if (value && (typeof value === 'function' || _typeof(value) === 'object')) {
393
        // then should be retrieved only once
394
        var then = value.then;
395

396
        if (typeof then === 'function') {
397
          then.call(value, function (val) {
398
            if (!resolved) {
399
              resolved = true;
400

401
              if (value === val) {
402
                fulfill(promise, val);
403
              } else {
404
                resolve(promise, val);
405
              }
406
            }
407
          }, function (reason) {
408
            if (!resolved) {
409
              resolved = true;
410
              reject(promise, reason);
411
            }
412
          });
413
          return true;
414
        }
415
      }
416
    } catch (e) {
417
      if (!resolved) {
418
        reject(promise, e);
419
      }
420

421
      return true;
422
    }
423

424
    return false;
425
  }
426

427
  function resolve(promise, value) {
428
    if (promise === value || !handleThenable(promise, value)) {
429
      fulfill(promise, value);
430
    }
431
  }
432

433
  function fulfill(promise, value) {
434
    if (promise._state === PENDING) {
435
      promise._state = SETTLED;
436
      promise._data = value;
437
      asyncCall(publishFulfillment, promise);
438
    }
439
  }
440

441
  function reject(promise, reason) {
442
    if (promise._state === PENDING) {
443
      promise._state = SETTLED;
444
      promise._data = reason;
445
      asyncCall(publishRejection, promise);
446
    }
447
  }
448

449
  function publish(promise) {
450
    promise._then = promise._then.forEach(invokeCallback);
451
  }
452

453
  function publishFulfillment(promise) {
454
    promise._state = FULFILLED;
455
    publish(promise);
456
  }
457

458
  function publishRejection(promise) {
459
    promise._state = REJECTED;
460
    publish(promise);
461

462
    if (!promise._handled && isNode) {
463
      global.process.emit('unhandledRejection', promise._data, promise);
464
    }
465
  }
466

467
  function notifyRejectionHandled(promise) {
468
    global.process.emit('rejectionHandled', promise);
469
  }
470
  /**
471
   * @class
472
   */
473

474

475
  function P(resolver) {
476
    if (typeof resolver !== 'function') {
477
      throw new TypeError('Promise resolver ' + resolver + ' is not a function');
478
    }
479

480
    if (this instanceof P === false) {
481
      throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
482
    }
483

484
    this._then = [];
485
    invokeResolver(resolver, this);
486
  }
487

488
  P.prototype = {
489
    constructor: P,
490
    _state: PENDING,
491
    _then: null,
492
    _data: undefined,
493
    _handled: false,
494
    then: function then(onFulfillment, onRejection) {
495
      var subscriber = {
496
        owner: this,
497
        then: new this.constructor(NOOP),
498
        fulfilled: onFulfillment,
499
        rejected: onRejection
500
      };
501

502
      if ((onRejection || onFulfillment) && !this._handled) {
503
        this._handled = true;
504

505
        if (this._state === REJECTED && isNode) {
506
          asyncCall(notifyRejectionHandled, this);
507
        }
508
      }
509

510
      if (this._state === FULFILLED || this._state === REJECTED) {
511
        // already resolved, call callback async
512
        asyncCall(invokeCallback, subscriber);
513
      } else {
514
        // subscribe
515
        this._then.push(subscriber);
516
      }
517

518
      return subscriber.then;
519
    },
520
    catch: function _catch(onRejection) {
521
      return this.then(null, onRejection);
522
    }
523
  };
524

525
  P.all = function (promises) {
526
    if (!Array.isArray(promises)) {
527
      throw new TypeError('You must pass an array to Promise.all().');
528
    }
529

530
    return new P(function (resolve, reject) {
531
      var results = [];
532
      var remaining = 0;
533

534
      function resolver(index) {
535
        remaining++;
536
        return function (value) {
537
          results[index] = value;
538

539
          if (! --remaining) {
540
            resolve(results);
541
          }
542
        };
543
      }
544

545
      for (var i = 0, promise; i < promises.length; i++) {
546
        promise = promises[i];
547

548
        if (promise && typeof promise.then === 'function') {
549
          promise.then(resolver(i), reject);
550
        } else {
551
          results[i] = promise;
552
        }
553
      }
554

555
      if (!remaining) {
556
        resolve(results);
557
      }
558
    });
559
  };
560

561
  P.race = function (promises) {
562
    if (!Array.isArray(promises)) {
563
      throw new TypeError('You must pass an array to Promise.race().');
564
    }
565

566
    return new P(function (resolve, reject) {
567
      for (var i = 0, promise; i < promises.length; i++) {
568
        promise = promises[i];
569

570
        if (promise && typeof promise.then === 'function') {
571
          promise.then(resolve, reject);
572
        } else {
573
          resolve(promise);
574
        }
575
      }
576
    });
577
  };
578

579
  P.resolve = function (value) {
580
    if (value && _typeof(value) === 'object' && value.constructor === P) {
581
      return value;
582
    }
583

584
    return new P(function (resolve) {
585
      resolve(value);
586
    });
587
  };
588

589
  P.reject = function (reason) {
590
    return new P(function (resolve, reject) {
591
      reject(reason);
592
    });
593
  };
594

595
  var picked = typeof Promise === 'function' ? Promise : P;
596

597
  var d = UNITS_IN_GRID;
598
  var meaninglessTransform = {
599
    size: 16,
600
    x: 0,
601
    y: 0,
602
    rotate: 0,
603
    flipX: false,
604
    flipY: false
605
  };
606

607
  function isReserved(name) {
608
    return ~RESERVED_CLASSES.indexOf(name);
609
  }
610

611
  function bunker(fn) {
612
    try {
613
      fn();
614
    } catch (e) {
615
      if (!PRODUCTION) {
616
        throw e;
617
      }
618
    }
619
  }
620
  function insertCss(css) {
621
    if (!css || !IS_DOM) {
622
      return;
623
    }
624

625
    var style = DOCUMENT.createElement('style');
626
    style.setAttribute('type', 'text/css');
627
    style.innerHTML = css;
628
    var headChildren = DOCUMENT.head.childNodes;
629
    var beforeChild = null;
630

631
    for (var i = headChildren.length - 1; i > -1; i--) {
632
      var child = headChildren[i];
633
      var tagName = (child.tagName || '').toUpperCase();
634

635
      if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
636
        beforeChild = child;
637
      }
638
    }
639

640
    DOCUMENT.head.insertBefore(style, beforeChild);
641
    return css;
642
  }
643
  var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
644
  function nextUniqueId() {
645
    var size = 12;
646
    var id = '';
647

648
    while (size-- > 0) {
649
      id += idPool[Math.random() * 62 | 0];
650
    }
651

652
    return id;
653
  }
654
  function toArray(obj) {
655
    var array = [];
656

657
    for (var i = (obj || []).length >>> 0; i--;) {
658
      array[i] = obj[i];
659
    }
660

661
    return array;
662
  }
663
  function classArray(node) {
664
    if (node.classList) {
665
      return toArray(node.classList);
666
    } else {
667
      return (node.getAttribute('class') || '').split(' ').filter(function (i) {
668
        return i;
669
      });
670
    }
671
  }
672
  function getIconName(familyPrefix, cls) {
673
    var parts = cls.split('-');
674
    var prefix = parts[0];
675
    var iconName = parts.slice(1).join('-');
676

677
    if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
678
      return iconName;
679
    } else {
680
      return null;
681
    }
682
  }
683
  function htmlEscape(str) {
684
    return "".concat(str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
685
  }
686
  function joinAttributes(attributes) {
687
    return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
688
      return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
689
    }, '').trim();
690
  }
691
  function joinStyles(styles) {
692
    return Object.keys(styles || {}).reduce(function (acc, styleName) {
693
      return acc + "".concat(styleName, ": ").concat(styles[styleName], ";");
694
    }, '');
695
  }
696
  function transformIsMeaningful(transform) {
697
    return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
698
  }
699
  function transformForSvg(_ref) {
700
    var transform = _ref.transform,
701
        containerWidth = _ref.containerWidth,
702
        iconWidth = _ref.iconWidth;
703
    var outer = {
704
      transform: "translate(".concat(containerWidth / 2, " 256)")
705
    };
706
    var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
707
    var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
708
    var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
709
    var inner = {
710
      transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
711
    };
712
    var path = {
713
      transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
714
    };
715
    return {
716
      outer: outer,
717
      inner: inner,
718
      path: path
719
    };
720
  }
721
  function transformForCss(_ref2) {
722
    var transform = _ref2.transform,
723
        _ref2$width = _ref2.width,
724
        width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
725
        _ref2$height = _ref2.height,
726
        height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
727
        _ref2$startCentered = _ref2.startCentered,
728
        startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
729
    var val = '';
730

731
    if (startCentered && IS_IE) {
732
      val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
733
    } else if (startCentered) {
734
      val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
735
    } else {
736
      val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
737
    }
738

739
    val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
740
    val += "rotate(".concat(transform.rotate, "deg) ");
741
    return val;
742
  }
743

744
  var ALL_SPACE = {
745
    x: 0,
746
    y: 0,
747
    width: '100%',
748
    height: '100%'
749
  };
750

751
  function fillBlack(abstract) {
752
    var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
753

754
    if (abstract.attributes && (abstract.attributes.fill || force)) {
755
      abstract.attributes.fill = 'black';
756
    }
757

758
    return abstract;
759
  }
760

761
  function deGroup(abstract) {
762
    if (abstract.tag === 'g') {
763
      return abstract.children;
764
    } else {
765
      return [abstract];
766
    }
767
  }
768

769
  function makeIconMasking (_ref) {
770
    var children = _ref.children,
771
        attributes = _ref.attributes,
772
        main = _ref.main,
773
        mask = _ref.mask,
774
        transform = _ref.transform;
775
    var mainWidth = main.width,
776
        mainPath = main.icon;
777
    var maskWidth = mask.width,
778
        maskPath = mask.icon;
779
    var trans = transformForSvg({
780
      transform: transform,
781
      containerWidth: maskWidth,
782
      iconWidth: mainWidth
783
    });
784
    var maskRect = {
785
      tag: 'rect',
786
      attributes: _objectSpread({}, ALL_SPACE, {
787
        fill: 'white'
788
      })
789
    };
790
    var maskInnerGroupChildrenMixin = mainPath.children ? {
791
      children: mainPath.children.map(fillBlack)
792
    } : {};
793
    var maskInnerGroup = {
794
      tag: 'g',
795
      attributes: _objectSpread({}, trans.inner),
796
      children: [fillBlack(_objectSpread({
797
        tag: mainPath.tag,
798
        attributes: _objectSpread({}, mainPath.attributes, trans.path)
799
      }, maskInnerGroupChildrenMixin))]
800
    };
801
    var maskOuterGroup = {
802
      tag: 'g',
803
      attributes: _objectSpread({}, trans.outer),
804
      children: [maskInnerGroup]
805
    };
806
    var maskId = "mask-".concat(nextUniqueId());
807
    var clipId = "clip-".concat(nextUniqueId());
808
    var maskTag = {
809
      tag: 'mask',
810
      attributes: _objectSpread({}, ALL_SPACE, {
811
        id: maskId,
812
        maskUnits: 'userSpaceOnUse',
813
        maskContentUnits: 'userSpaceOnUse'
814
      }),
815
      children: [maskRect, maskOuterGroup]
816
    };
817
    var defs = {
818
      tag: 'defs',
819
      children: [{
820
        tag: 'clipPath',
821
        attributes: {
822
          id: clipId
823
        },
824
        children: deGroup(maskPath)
825
      }, maskTag]
826
    };
827
    children.push(defs, {
828
      tag: 'rect',
829
      attributes: _objectSpread({
830
        fill: 'currentColor',
831
        'clip-path': "url(#".concat(clipId, ")"),
832
        mask: "url(#".concat(maskId, ")")
833
      }, ALL_SPACE)
834
    });
835
    return {
836
      children: children,
837
      attributes: attributes
838
    };
839
  }
840

841
  function makeIconStandard (_ref) {
842
    var children = _ref.children,
843
        attributes = _ref.attributes,
844
        main = _ref.main,
845
        transform = _ref.transform,
846
        styles = _ref.styles;
847
    var styleString = joinStyles(styles);
848

849
    if (styleString.length > 0) {
850
      attributes['style'] = styleString;
851
    }
852

853
    if (transformIsMeaningful(transform)) {
854
      var trans = transformForSvg({
855
        transform: transform,
856
        containerWidth: main.width,
857
        iconWidth: main.width
858
      });
859
      children.push({
860
        tag: 'g',
861
        attributes: _objectSpread({}, trans.outer),
862
        children: [{
863
          tag: 'g',
864
          attributes: _objectSpread({}, trans.inner),
865
          children: [{
866
            tag: main.icon.tag,
867
            children: main.icon.children,
868
            attributes: _objectSpread({}, main.icon.attributes, trans.path)
869
          }]
870
        }]
871
      });
872
    } else {
873
      children.push(main.icon);
874
    }
875

876
    return {
877
      children: children,
878
      attributes: attributes
879
    };
880
  }
881

882
  function asIcon (_ref) {
883
    var children = _ref.children,
884
        main = _ref.main,
885
        mask = _ref.mask,
886
        attributes = _ref.attributes,
887
        styles = _ref.styles,
888
        transform = _ref.transform;
889

890
    if (transformIsMeaningful(transform) && main.found && !mask.found) {
891
      var width = main.width,
892
          height = main.height;
893
      var offset = {
894
        x: width / height / 2,
895
        y: 0.5
896
      };
897
      attributes['style'] = joinStyles(_objectSpread({}, styles, {
898
        'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
899
      }));
900
    }
901

902
    return [{
903
      tag: 'svg',
904
      attributes: attributes,
905
      children: children
906
    }];
907
  }
908

909
  function asSymbol (_ref) {
910
    var prefix = _ref.prefix,
911
        iconName = _ref.iconName,
912
        children = _ref.children,
913
        attributes = _ref.attributes,
914
        symbol = _ref.symbol;
915
    var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
916
    return [{
917
      tag: 'svg',
918
      attributes: {
919
        style: 'display: none;'
920
      },
921
      children: [{
922
        tag: 'symbol',
923
        attributes: _objectSpread({}, attributes, {
924
          id: id
925
        }),
926
        children: children
927
      }]
928
    }];
929
  }
930

931
  function makeInlineSvgAbstract(params) {
932
    var _params$icons = params.icons,
933
        main = _params$icons.main,
934
        mask = _params$icons.mask,
935
        prefix = params.prefix,
936
        iconName = params.iconName,
937
        transform = params.transform,
938
        symbol = params.symbol,
939
        title = params.title,
940
        extra = params.extra,
941
        _params$watchable = params.watchable,
942
        watchable = _params$watchable === void 0 ? false : _params$watchable;
943

944
    var _ref = mask.found ? mask : main,
945
        width = _ref.width,
946
        height = _ref.height;
947

948
    var widthClass = "fa-w-".concat(Math.ceil(width / height * 16));
949
    var attrClass = [config.replacementClass, iconName ? "".concat(config.familyPrefix, "-").concat(iconName) : '', widthClass].filter(function (c) {
950
      return extra.classes.indexOf(c) === -1;
951
    }).concat(extra.classes).join(' ');
952
    var content = {
953
      children: [],
954
      attributes: _objectSpread({}, extra.attributes, {
955
        'data-prefix': prefix,
956
        'data-icon': iconName,
957
        'class': attrClass,
958
        'role': extra.attributes.role || 'img',
959
        'xmlns': 'http://www.w3.org/2000/svg',
960
        'viewBox': "0 0 ".concat(width, " ").concat(height)
961
      })
962
    };
963

964
    if (watchable) {
965
      content.attributes[DATA_FA_I2SVG] = '';
966
    }
967

968
    if (title) content.children.push({
969
      tag: 'title',
970
      attributes: {
971
        id: content.attributes['aria-labelledby'] || "title-".concat(nextUniqueId())
972
      },
973
      children: [title]
974
    });
975

976
    var args = _objectSpread({}, content, {
977
      prefix: prefix,
978
      iconName: iconName,
979
      main: main,
980
      mask: mask,
981
      transform: transform,
982
      symbol: symbol,
983
      styles: extra.styles
984
    });
985

986
    var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
987
        children = _ref2.children,
988
        attributes = _ref2.attributes;
989

990
    args.children = children;
991
    args.attributes = attributes;
992

993
    if (symbol) {
994
      return asSymbol(args);
995
    } else {
996
      return asIcon(args);
997
    }
998
  }
999
  function makeLayersTextAbstract(params) {
1000
    var content = params.content,
1001
        width = params.width,
1002
        height = params.height,
1003
        transform = params.transform,
1004
        title = params.title,
1005
        extra = params.extra,
1006
        _params$watchable2 = params.watchable,
1007
        watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
1008

1009
    var attributes = _objectSpread({}, extra.attributes, title ? {
1010
      'title': title
1011
    } : {}, {
1012
      'class': extra.classes.join(' ')
1013
    });
1014

1015
    if (watchable) {
1016
      attributes[DATA_FA_I2SVG] = '';
1017
    }
1018

1019
    var styles = _objectSpread({}, extra.styles);
1020

1021
    if (transformIsMeaningful(transform)) {
1022
      styles['transform'] = transformForCss({
1023
        transform: transform,
1024
        startCentered: true,
1025
        width: width,
1026
        height: height
1027
      });
1028
      styles['-webkit-transform'] = styles['transform'];
1029
    }
1030

1031
    var styleString = joinStyles(styles);
1032

1033
    if (styleString.length > 0) {
1034
      attributes['style'] = styleString;
1035
    }
1036

1037
    var val = [];
1038
    val.push({
1039
      tag: 'span',
1040
      attributes: attributes,
1041
      children: [content]
1042
    });
1043

1044
    if (title) {
1045
      val.push({
1046
        tag: 'span',
1047
        attributes: {
1048
          class: 'sr-only'
1049
        },
1050
        children: [title]
1051
      });
1052
    }
1053

1054
    return val;
1055
  }
1056
  function makeLayersCounterAbstract(params) {
1057
    var content = params.content,
1058
        title = params.title,
1059
        extra = params.extra;
1060

1061
    var attributes = _objectSpread({}, extra.attributes, title ? {
1062
      'title': title
1063
    } : {}, {
1064
      'class': extra.classes.join(' ')
1065
    });
1066

1067
    var styleString = joinStyles(extra.styles);
1068

1069
    if (styleString.length > 0) {
1070
      attributes['style'] = styleString;
1071
    }
1072

1073
    var val = [];
1074
    val.push({
1075
      tag: 'span',
1076
      attributes: attributes,
1077
      children: [content]
1078
    });
1079

1080
    if (title) {
1081
      val.push({
1082
        tag: 'span',
1083
        attributes: {
1084
          class: 'sr-only'
1085
        },
1086
        children: [title]
1087
      });
1088
    }
1089

1090
    return val;
1091
  }
1092

1093
  var noop$1 = function noop() {};
1094

1095
  var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
1096
    mark: noop$1,
1097
    measure: noop$1
1098
  };
1099
  var preamble = "FA \"5.11.2\"";
1100

1101
  var begin = function begin(name) {
1102
    p.mark("".concat(preamble, " ").concat(name, " begins"));
1103
    return function () {
1104
      return end(name);
1105
    };
1106
  };
1107

1108
  var end = function end(name) {
1109
    p.mark("".concat(preamble, " ").concat(name, " ends"));
1110
    p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
1111
  };
1112

1113
  var perf = {
1114
    begin: begin,
1115
    end: end
1116
  };
1117

1118
  /**
1119
   * Internal helper to bind a function known to have 4 arguments
1120
   * to a given context.
1121
   */
1122

1123
  var bindInternal4 = function bindInternal4(func, thisContext) {
1124
    return function (a, b, c, d) {
1125
      return func.call(thisContext, a, b, c, d);
1126
    };
1127
  };
1128

1129
  /**
1130
   * # Reduce
1131
   *
1132
   * A fast object `.reduce()` implementation.
1133
   *
1134
   * @param  {Object}   subject      The object to reduce over.
1135
   * @param  {Function} fn           The reducer function.
1136
   * @param  {mixed}    initialValue The initial value for the reducer, defaults to subject[0].
1137
   * @param  {Object}   thisContext  The context for the reducer.
1138
   * @return {mixed}                 The final result.
1139
   */
1140

1141

1142
  var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
1143
    var keys = Object.keys(subject),
1144
        length = keys.length,
1145
        iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
1146
        i,
1147
        key,
1148
        result;
1149

1150
    if (initialValue === undefined) {
1151
      i = 1;
1152
      result = subject[keys[0]];
1153
    } else {
1154
      i = 0;
1155
      result = initialValue;
1156
    }
1157

1158
    for (; i < length; i++) {
1159
      key = keys[i];
1160
      result = iterator(result, subject[key], key, subject);
1161
    }
1162

1163
    return result;
1164
  };
1165

1166
  function toHex(unicode) {
1167
    var result = '';
1168

1169
    for (var i = 0; i < unicode.length; i++) {
1170
      var hex = unicode.charCodeAt(i).toString(16);
1171
      result += ('000' + hex).slice(-4);
1172
    }
1173

1174
    return result;
1175
  }
1176

1177
  function defineIcons(prefix, icons) {
1178
    var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1179
    var _params$skipHooks = params.skipHooks,
1180
        skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
1181
    var normalized = Object.keys(icons).reduce(function (acc, iconName) {
1182
      var icon = icons[iconName];
1183
      var expanded = !!icon.icon;
1184

1185
      if (expanded) {
1186
        acc[icon.iconName] = icon.icon;
1187
      } else {
1188
        acc[iconName] = icon;
1189
      }
1190

1191
      return acc;
1192
    }, {});
1193

1194
    if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
1195
      namespace.hooks.addPack(prefix, normalized);
1196
    } else {
1197
      namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
1198
    }
1199
    /**
1200
     * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
1201
     * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
1202
     * for `fas` so we'll easy the upgrade process for our users by automatically defining
1203
     * this as well.
1204
     */
1205

1206

1207
    if (prefix === 'fas') {
1208
      defineIcons('fa', icons);
1209
    }
1210
  }
1211

1212
  var styles = namespace.styles,
1213
      shims = namespace.shims;
1214
  var _byUnicode = {};
1215
  var _byLigature = {};
1216
  var _byOldName = {};
1217
  var build = function build() {
1218
    var lookup = function lookup(reducer) {
1219
      return reduce(styles, function (o, style, prefix) {
1220
        o[prefix] = reduce(style, reducer, {});
1221
        return o;
1222
      }, {});
1223
    };
1224

1225
    _byUnicode = lookup(function (acc, icon, iconName) {
1226
      if (icon[3]) {
1227
        acc[icon[3]] = iconName;
1228
      }
1229

1230
      return acc;
1231
    });
1232
    _byLigature = lookup(function (acc, icon, iconName) {
1233
      var ligatures = icon[2];
1234
      acc[iconName] = iconName;
1235
      ligatures.forEach(function (ligature) {
1236
        acc[ligature] = iconName;
1237
      });
1238
      return acc;
1239
    });
1240
    var hasRegular = 'far' in styles;
1241
    _byOldName = reduce(shims, function (acc, shim) {
1242
      var oldName = shim[0];
1243
      var prefix = shim[1];
1244
      var iconName = shim[2];
1245

1246
      if (prefix === 'far' && !hasRegular) {
1247
        prefix = 'fas';
1248
      }
1249

1250
      acc[oldName] = {
1251
        prefix: prefix,
1252
        iconName: iconName
1253
      };
1254
      return acc;
1255
    }, {});
1256
  };
1257
  build();
1258
  function byUnicode(prefix, unicode) {
1259
    return (_byUnicode[prefix] || {})[unicode];
1260
  }
1261
  function byLigature(prefix, ligature) {
1262
    return (_byLigature[prefix] || {})[ligature];
1263
  }
1264
  function byOldName(name) {
1265
    return _byOldName[name] || {
1266
      prefix: null,
1267
      iconName: null
1268
    };
1269
  }
1270

1271
  var styles$1 = namespace.styles;
1272
  var emptyCanonicalIcon = function emptyCanonicalIcon() {
1273
    return {
1274
      prefix: null,
1275
      iconName: null,
1276
      rest: []
1277
    };
1278
  };
1279
  function getCanonicalIcon(values) {
1280
    return values.reduce(function (acc, cls) {
1281
      var iconName = getIconName(config.familyPrefix, cls);
1282

1283
      if (styles$1[cls]) {
1284
        acc.prefix = cls;
1285
      } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fad', 'fab', 'fa'].indexOf(cls) > -1) {
1286
        acc.prefix = cls;
1287
      } else if (iconName) {
1288
        var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
1289
        acc.iconName = shim.iconName || iconName;
1290
        acc.prefix = shim.prefix || acc.prefix;
1291
      } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
1292
        acc.rest.push(cls);
1293
      }
1294

1295
      return acc;
1296
    }, emptyCanonicalIcon());
1297
  }
1298
  function iconFromMapping(mapping, prefix, iconName) {
1299
    if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
1300
      return {
1301
        prefix: prefix,
1302
        iconName: iconName,
1303
        icon: mapping[prefix][iconName]
1304
      };
1305
    }
1306
  }
1307

1308
  function toHtml(abstractNodes) {
1309
    var tag = abstractNodes.tag,
1310
        _abstractNodes$attrib = abstractNodes.attributes,
1311
        attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
1312
        _abstractNodes$childr = abstractNodes.children,
1313
        children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
1314

1315
    if (typeof abstractNodes === 'string') {
1316
      return htmlEscape(abstractNodes);
1317
    } else {
1318
      return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
1319
    }
1320
  }
1321

1322
  var noop$2 = function noop() {};
1323

1324
  function isWatched(node) {
1325
    var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
1326
    return typeof i2svg === 'string';
1327
  }
1328

1329
  function getMutator() {
1330
    if (config.autoReplaceSvg === true) {
1331
      return mutators.replace;
1332
    }
1333

1334
    var mutator = mutators[config.autoReplaceSvg];
1335
    return mutator || mutators.replace;
1336
  }
1337

1338
  var mutators = {
1339
    replace: function replace(mutation) {
1340
      var node = mutation[0];
1341
      var abstract = mutation[1];
1342
      var newOuterHTML = abstract.map(function (a) {
1343
        return toHtml(a);
1344
      }).join('\n');
1345

1346
      if (node.parentNode && node.outerHTML) {
1347
        node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : '');
1348
      } else if (node.parentNode) {
1349
        var newNode = document.createElement('span');
1350
        node.parentNode.replaceChild(newNode, node);
1351
        newNode.outerHTML = newOuterHTML;
1352
      }
1353
    },
1354
    nest: function nest(mutation) {
1355
      var node = mutation[0];
1356
      var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
1357
      // Short-circuit to the standard replacement
1358

1359
      if (~classArray(node).indexOf(config.replacementClass)) {
1360
        return mutators.replace(mutation);
1361
      }
1362

1363
      var forSvg = new RegExp("".concat(config.familyPrefix, "-.*"));
1364
      delete abstract[0].attributes.style;
1365
      delete abstract[0].attributes.id;
1366
      var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
1367
        if (cls === config.replacementClass || cls.match(forSvg)) {
1368
          acc.toSvg.push(cls);
1369
        } else {
1370
          acc.toNode.push(cls);
1371
        }
1372

1373
        return acc;
1374
      }, {
1375
        toNode: [],
1376
        toSvg: []
1377
      });
1378
      abstract[0].attributes.class = splitClasses.toSvg.join(' ');
1379
      var newInnerHTML = abstract.map(function (a) {
1380
        return toHtml(a);
1381
      }).join('\n');
1382
      node.setAttribute('class', splitClasses.toNode.join(' '));
1383
      node.setAttribute(DATA_FA_I2SVG, '');
1384
      node.innerHTML = newInnerHTML;
1385
    }
1386
  };
1387

1388
  function performOperationSync(op) {
1389
    op();
1390
  }
1391

1392
  function perform(mutations, callback) {
1393
    var callbackFunction = typeof callback === 'function' ? callback : noop$2;
1394

1395
    if (mutations.length === 0) {
1396
      callbackFunction();
1397
    } else {
1398
      var frame = performOperationSync;
1399

1400
      if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
1401
        frame = WINDOW.requestAnimationFrame || performOperationSync;
1402
      }
1403

1404
      frame(function () {
1405
        var mutator = getMutator();
1406
        var mark = perf.begin('mutate');
1407
        mutations.map(mutator);
1408
        mark();
1409
        callbackFunction();
1410
      });
1411
    }
1412
  }
1413
  var disabled = false;
1414
  function disableObservation() {
1415
    disabled = true;
1416
  }
1417
  function enableObservation() {
1418
    disabled = false;
1419
  }
1420
  var mo = null;
1421
  function observe(options) {
1422
    if (!MUTATION_OBSERVER) {
1423
      return;
1424
    }
1425

1426
    if (!config.observeMutations) {
1427
      return;
1428
    }
1429

1430
    var treeCallback = options.treeCallback,
1431
        nodeCallback = options.nodeCallback,
1432
        pseudoElementsCallback = options.pseudoElementsCallback,
1433
        _options$observeMutat = options.observeMutationsRoot,
1434
        observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
1435
    mo = new MUTATION_OBSERVER(function (objects) {
1436
      if (disabled) return;
1437
      toArray(objects).forEach(function (mutationRecord) {
1438
        if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
1439
          if (config.searchPseudoElements) {
1440
            pseudoElementsCallback(mutationRecord.target);
1441
          }
1442

1443
          treeCallback(mutationRecord.target);
1444
        }
1445

1446
        if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1447
          pseudoElementsCallback(mutationRecord.target.parentNode);
1448
        }
1449

1450
        if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1451
          if (mutationRecord.attributeName === 'class') {
1452
            var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1453
                prefix = _getCanonicalIcon.prefix,
1454
                iconName = _getCanonicalIcon.iconName;
1455

1456
            if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
1457
            if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
1458
          } else {
1459
            nodeCallback(mutationRecord.target);
1460
          }
1461
        }
1462
      });
1463
    });
1464
    if (!IS_DOM) return;
1465
    mo.observe(observeMutationsRoot, {
1466
      childList: true,
1467
      attributes: true,
1468
      characterData: true,
1469
      subtree: true
1470
    });
1471
  }
1472
  function disconnect() {
1473
    if (!mo) return;
1474
    mo.disconnect();
1475
  }
1476

1477
  function styleParser (node) {
1478
    var style = node.getAttribute('style');
1479
    var val = [];
1480

1481
    if (style) {
1482
      val = style.split(';').reduce(function (acc, style) {
1483
        var styles = style.split(':');
1484
        var prop = styles[0];
1485
        var value = styles.slice(1);
1486

1487
        if (prop && value.length > 0) {
1488
          acc[prop] = value.join(':').trim();
1489
        }
1490

1491
        return acc;
1492
      }, {});
1493
    }
1494

1495
    return val;
1496
  }
1497

1498
  function classParser (node) {
1499
    var existingPrefix = node.getAttribute('data-prefix');
1500
    var existingIconName = node.getAttribute('data-icon');
1501
    var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
1502
    var val = getCanonicalIcon(classArray(node));
1503

1504
    if (existingPrefix && existingIconName) {
1505
      val.prefix = existingPrefix;
1506
      val.iconName = existingIconName;
1507
    }
1508

1509
    if (val.prefix && innerText.length > 1) {
1510
      val.iconName = byLigature(val.prefix, node.innerText);
1511
    } else if (val.prefix && innerText.length === 1) {
1512
      val.iconName = byUnicode(val.prefix, toHex(node.innerText));
1513
    }
1514

1515
    return val;
1516
  }
1517

1518
  var parseTransformString = function parseTransformString(transformString) {
1519
    var transform = {
1520
      size: 16,
1521
      x: 0,
1522
      y: 0,
1523
      flipX: false,
1524
      flipY: false,
1525
      rotate: 0
1526
    };
1527

1528
    if (!transformString) {
1529
      return transform;
1530
    } else {
1531
      return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
1532
        var parts = n.toLowerCase().split('-');
1533
        var first = parts[0];
1534
        var rest = parts.slice(1).join('-');
1535

1536
        if (first && rest === 'h') {
1537
          acc.flipX = true;
1538
          return acc;
1539
        }
1540

1541
        if (first && rest === 'v') {
1542
          acc.flipY = true;
1543
          return acc;
1544
        }
1545

1546
        rest = parseFloat(rest);
1547

1548
        if (isNaN(rest)) {
1549
          return acc;
1550
        }
1551

1552
        switch (first) {
1553
          case 'grow':
1554
            acc.size = acc.size + rest;
1555
            break;
1556

1557
          case 'shrink':
1558
            acc.size = acc.size - rest;
1559
            break;
1560

1561
          case 'left':
1562
            acc.x = acc.x - rest;
1563
            break;
1564

1565
          case 'right':
1566
            acc.x = acc.x + rest;
1567
            break;
1568

1569
          case 'up':
1570
            acc.y = acc.y - rest;
1571
            break;
1572

1573
          case 'down':
1574
            acc.y = acc.y + rest;
1575
            break;
1576

1577
          case 'rotate':
1578
            acc.rotate = acc.rotate + rest;
1579
            break;
1580
        }
1581

1582
        return acc;
1583
      }, transform);
1584
    }
1585
  };
1586
  function transformParser (node) {
1587
    return parseTransformString(node.getAttribute('data-fa-transform'));
1588
  }
1589

1590
  function symbolParser (node) {
1591
    var symbol = node.getAttribute('data-fa-symbol');
1592
    return symbol === null ? false : symbol === '' ? true : symbol;
1593
  }
1594

1595
  function attributesParser (node) {
1596
    var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
1597
      if (acc.name !== 'class' && acc.name !== 'style') {
1598
        acc[attr.name] = attr.value;
1599
      }
1600

1601
      return acc;
1602
    }, {});
1603
    var title = node.getAttribute('title');
1604

1605
    if (config.autoA11y) {
1606
      if (title) {
1607
        extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
1608
      } else {
1609
        extraAttributes['aria-hidden'] = 'true';
1610
        extraAttributes['focusable'] = 'false';
1611
      }
1612
    }
1613

1614
    return extraAttributes;
1615
  }
1616

1617
  function maskParser (node) {
1618
    var mask = node.getAttribute('data-fa-mask');
1619

1620
    if (!mask) {
1621
      return emptyCanonicalIcon();
1622
    } else {
1623
      return getCanonicalIcon(mask.split(' ').map(function (i) {
1624
        return i.trim();
1625
      }));
1626
    }
1627
  }
1628

1629
  function blankMeta() {
1630
    return {
1631
      iconName: null,
1632
      title: null,
1633
      prefix: null,
1634
      transform: meaninglessTransform,
1635
      symbol: false,
1636
      mask: null,
1637
      extra: {
1638
        classes: [],
1639
        styles: {},
1640
        attributes: {}
1641
      }
1642
    };
1643
  }
1644
  function parseMeta(node) {
1645
    var _classParser = classParser(node),
1646
        iconName = _classParser.iconName,
1647
        prefix = _classParser.prefix,
1648
        extraClasses = _classParser.rest;
1649

1650
    var extraStyles = styleParser(node);
1651
    var transform = transformParser(node);
1652
    var symbol = symbolParser(node);
1653
    var extraAttributes = attributesParser(node);
1654
    var mask = maskParser(node);
1655
    return {
1656
      iconName: iconName,
1657
      title: node.getAttribute('title'),
1658
      prefix: prefix,
1659
      transform: transform,
1660
      symbol: symbol,
1661
      mask: mask,
1662
      extra: {
1663
        classes: extraClasses,
1664
        styles: extraStyles,
1665
        attributes: extraAttributes
1666
      }
1667
    };
1668
  }
1669

1670
  function MissingIcon(error) {
1671
    this.name = 'MissingIcon';
1672
    this.message = error || 'Icon unavailable';
1673
    this.stack = new Error().stack;
1674
  }
1675
  MissingIcon.prototype = Object.create(Error.prototype);
1676
  MissingIcon.prototype.constructor = MissingIcon;
1677

1678
  var FILL = {
1679
    fill: 'currentColor'
1680
  };
1681
  var ANIMATION_BASE = {
1682
    attributeType: 'XML',
1683
    repeatCount: 'indefinite',
1684
    dur: '2s'
1685
  };
1686
  var RING = {
1687
    tag: 'path',
1688
    attributes: _objectSpread({}, FILL, {
1689
      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'
1690
    })
1691
  };
1692

1693
  var OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {
1694
    attributeName: 'opacity'
1695
  });
1696

1697
  var DOT = {
1698
    tag: 'circle',
1699
    attributes: _objectSpread({}, FILL, {
1700
      cx: '256',
1701
      cy: '364',
1702
      r: '28'
1703
    }),
1704
    children: [{
1705
      tag: 'animate',
1706
      attributes: _objectSpread({}, ANIMATION_BASE, {
1707
        attributeName: 'r',
1708
        values: '28;14;28;28;14;28;'
1709
      })
1710
    }, {
1711
      tag: 'animate',
1712
      attributes: _objectSpread({}, OPACITY_ANIMATE, {
1713
        values: '1;0;1;1;0;1;'
1714
      })
1715
    }]
1716
  };
1717
  var QUESTION = {
1718
    tag: 'path',
1719
    attributes: _objectSpread({}, FILL, {
1720
      opacity: '1',
1721
      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'
1722
    }),
1723
    children: [{
1724
      tag: 'animate',
1725
      attributes: _objectSpread({}, OPACITY_ANIMATE, {
1726
        values: '1;0;0;0;0;1;'
1727
      })
1728
    }]
1729
  };
1730
  var EXCLAMATION = {
1731
    tag: 'path',
1732
    attributes: _objectSpread({}, FILL, {
1733
      opacity: '0',
1734
      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'
1735
    }),
1736
    children: [{
1737
      tag: 'animate',
1738
      attributes: _objectSpread({}, OPACITY_ANIMATE, {
1739
        values: '0;0;1;1;0;0;'
1740
      })
1741
    }]
1742
  };
1743
  var missing = {
1744
    tag: 'g',
1745
    children: [RING, DOT, QUESTION, EXCLAMATION]
1746
  };
1747

1748
  var styles$2 = namespace.styles;
1749
  function asFoundIcon(icon) {
1750
    var width = icon[0];
1751
    var height = icon[1];
1752

1753
    var _icon$slice = icon.slice(4),
1754
        _icon$slice2 = _slicedToArray(_icon$slice, 1),
1755
        vectorData = _icon$slice2[0];
1756

1757
    var element = null;
1758

1759
    if (Array.isArray(vectorData)) {
1760
      element = {
1761
        tag: 'g',
1762
        attributes: {
1763
          class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
1764
        },
1765
        children: [{
1766
          tag: 'path',
1767
          attributes: {
1768
            class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
1769
            fill: 'currentColor',
1770
            d: vectorData[0]
1771
          }
1772
        }, {
1773
          tag: 'path',
1774
          attributes: {
1775
            class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
1776
            fill: 'currentColor',
1777
            d: vectorData[1]
1778
          }
1779
        }]
1780
      };
1781
    } else {
1782
      element = {
1783
        tag: 'path',
1784
        attributes: {
1785
          fill: 'currentColor',
1786
          d: vectorData
1787
        }
1788
      };
1789
    }
1790

1791
    return {
1792
      found: true,
1793
      width: width,
1794
      height: height,
1795
      icon: element
1796
    };
1797
  }
1798
  function findIcon(iconName, prefix) {
1799
    return new picked(function (resolve, reject) {
1800
      var val = {
1801
        found: false,
1802
        width: 512,
1803
        height: 512,
1804
        icon: missing
1805
      };
1806

1807
      if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {
1808
        var icon = styles$2[prefix][iconName];
1809
        return resolve(asFoundIcon(icon));
1810
      }
1811

1812
      var headers = {};
1813

1814
      if (_typeof(WINDOW.FontAwesomeKitConfig) === 'object' && typeof window.FontAwesomeKitConfig.token === 'string') {
1815
        headers['fa-kit-token'] = WINDOW.FontAwesomeKitConfig.token;
1816
      }
1817

1818
      if (iconName && prefix && !config.showMissingIcons) {
1819
        reject(new MissingIcon("Icon is missing for prefix ".concat(prefix, " with icon name ").concat(iconName)));
1820
      } else {
1821
        resolve(val);
1822
      }
1823
    });
1824
  }
1825

1826
  var styles$3 = namespace.styles;
1827

1828
  function generateSvgReplacementMutation(node, nodeMeta) {
1829
    var iconName = nodeMeta.iconName,
1830
        title = nodeMeta.title,
1831
        prefix = nodeMeta.prefix,
1832
        transform = nodeMeta.transform,
1833
        symbol = nodeMeta.symbol,
1834
        mask = nodeMeta.mask,
1835
        extra = nodeMeta.extra;
1836
    return new picked(function (resolve, reject) {
1837
      picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {
1838
        var _ref2 = _slicedToArray(_ref, 2),
1839
            main = _ref2[0],
1840
            mask = _ref2[1];
1841

1842
        resolve([node, makeInlineSvgAbstract({
1843
          icons: {
1844
            main: main,
1845
            mask: mask
1846
          },
1847
          prefix: prefix,
1848
          iconName: iconName,
1849
          transform: transform,
1850
          symbol: symbol,
1851
          mask: mask,
1852
          title: title,
1853
          extra: extra,
1854
          watchable: true
1855
        })]);
1856
      });
1857
    });
1858
  }
1859

1860
  function generateLayersText(node, nodeMeta) {
1861
    var title = nodeMeta.title,
1862
        transform = nodeMeta.transform,
1863
        extra = nodeMeta.extra;
1864
    var width = null;
1865
    var height = null;
1866

1867
    if (IS_IE) {
1868
      var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
1869
      var boundingClientRect = node.getBoundingClientRect();
1870
      width = boundingClientRect.width / computedFontSize;
1871
      height = boundingClientRect.height / computedFontSize;
1872
    }
1873

1874
    if (config.autoA11y && !title) {
1875
      extra.attributes['aria-hidden'] = 'true';
1876
    }
1877

1878
    return picked.resolve([node, makeLayersTextAbstract({
1879
      content: node.innerHTML,
1880
      width: width,
1881
      height: height,
1882
      transform: transform,
1883
      title: title,
1884
      extra: extra,
1885
      watchable: true
1886
    })]);
1887
  }
1888

1889
  function generateMutation(node) {
1890
    var nodeMeta = parseMeta(node);
1891

1892
    if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
1893
      return generateLayersText(node, nodeMeta);
1894
    } else {
1895
      return generateSvgReplacementMutation(node, nodeMeta);
1896
    }
1897
  }
1898

1899
  function onTree(root) {
1900
    var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1901
    if (!IS_DOM) return;
1902
    var htmlClassList = DOCUMENT.documentElement.classList;
1903

1904
    var hclAdd = function hclAdd(suffix) {
1905
      return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1906
    };
1907

1908
    var hclRemove = function hclRemove(suffix) {
1909
      return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1910
    };
1911

1912
    var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);
1913
    var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
1914
      return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
1915
    })).join(', ');
1916

1917
    if (prefixesDomQuery.length === 0) {
1918
      return;
1919
    }
1920

1921
    var candidates = [];
1922

1923
    try {
1924
      candidates = toArray(root.querySelectorAll(prefixesDomQuery));
1925
    } catch (e) {// noop
1926
    }
1927

1928
    if (candidates.length > 0) {
1929
      hclAdd('pending');
1930
      hclRemove('complete');
1931
    } else {
1932
      return;
1933
    }
1934

1935
    var mark = perf.begin('onTree');
1936
    var mutations = candidates.reduce(function (acc, node) {
1937
      try {
1938
        var mutation = generateMutation(node);
1939

1940
        if (mutation) {
1941
          acc.push(mutation);
1942
        }
1943
      } catch (e) {
1944
        if (!PRODUCTION) {
1945
          if (e instanceof MissingIcon) {
1946
            console.error(e);
1947
          }
1948
        }
1949
      }
1950

1951
      return acc;
1952
    }, []);
1953
    return new picked(function (resolve, reject) {
1954
      picked.all(mutations).then(function (resolvedMutations) {
1955
        perform(resolvedMutations, function () {
1956
          hclAdd('active');
1957
          hclAdd('complete');
1958
          hclRemove('pending');
1959
          if (typeof callback === 'function') callback();
1960
          mark();
1961
          resolve();
1962
        });
1963
      }).catch(function () {
1964
        mark();
1965
        reject();
1966
      });
1967
    });
1968
  }
1969
  function onNode(node) {
1970
    var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1971
    generateMutation(node).then(function (mutation) {
1972
      if (mutation) {
1973
        perform([mutation], callback);
1974
      }
1975
    });
1976
  }
1977

1978
  function replaceForPosition(node, position) {
1979
    var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
1980
    return new picked(function (resolve, reject) {
1981
      if (node.getAttribute(pendingAttribute) !== null) {
1982
        // This node is already being processed
1983
        return resolve();
1984
      }
1985

1986
      var children = toArray(node.children);
1987
      var alreadyProcessedPseudoElement = children.filter(function (c) {
1988
        return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
1989
      })[0];
1990
      var styles = WINDOW.getComputedStyle(node, position);
1991
      var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
1992
      var fontWeight = styles.getPropertyValue('font-weight');
1993

1994
      if (alreadyProcessedPseudoElement && !fontFamily) {
1995
        // If we've already processed it but the current computed style does not result in a font-family,
1996
        // that probably means that a class name that was previously present to make the icon has been
1997
        // removed. So we now should delete the icon.
1998
        node.removeChild(alreadyProcessedPseudoElement);
1999
        return resolve();
2000
      } else if (fontFamily) {
2001
        var content = styles.getPropertyValue('content');
2002
        var prefix = ~['Solid', 'Regular', 'Light', 'Duotone', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];
2003
        var hexValue = toHex(content.length === 3 ? content.substr(1, 1) : content);
2004
        var iconName = byUnicode(prefix, hexValue);
2005
        var iconIdentifier = iconName; // Only convert the pseudo element in this :before/:after position into an icon if we haven't
2006
        // already done so with the same prefix and iconName
2007

2008
        if (iconName && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
2009
          node.setAttribute(pendingAttribute, iconIdentifier);
2010

2011
          if (alreadyProcessedPseudoElement) {
2012
            // Delete the old one, since we're replacing it with a new one
2013
            node.removeChild(alreadyProcessedPseudoElement);
2014
          }
2015

2016
          var meta = blankMeta();
2017
          var extra = meta.extra;
2018
          extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
2019
          findIcon(iconName, prefix).then(function (main) {
2020
            var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {
2021
              icons: {
2022
                main: main,
2023
                mask: emptyCanonicalIcon()
2024
              },
2025
              prefix: prefix,
2026
              iconName: iconIdentifier,
2027
              extra: extra,
2028
              watchable: true
2029
            }));
2030
            var element = DOCUMENT.createElement('svg');
2031

2032
            if (position === ':before') {
2033
              node.insertBefore(element, node.firstChild);
2034
            } else {
2035
              node.appendChild(element);
2036
            }
2037

2038
            element.outerHTML = abstract.map(function (a) {
2039
              return toHtml(a);
2040
            }).join('\n');
2041
            node.removeAttribute(pendingAttribute);
2042
            resolve();
2043
          }).catch(reject);
2044
        } else {
2045
          resolve();
2046
        }
2047
      } else {
2048
        resolve();
2049
      }
2050
    });
2051
  }
2052

2053
  function replace(node) {
2054
    return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);
2055
  }
2056

2057
  function processable(node) {
2058
    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');
2059
  }
2060

2061
  function searchPseudoElements (root) {
2062
    if (!IS_DOM) return;
2063
    return new picked(function (resolve, reject) {
2064
      var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
2065
      var end = perf.begin('searchPseudoElements');
2066
      disableObservation();
2067
      picked.all(operations).then(function () {
2068
        end();
2069
        enableObservation();
2070
        resolve();
2071
      }).catch(function () {
2072
        end();
2073
        enableObservation();
2074
        reject();
2075
      });
2076
    });
2077
  }
2078

2079
  var baseStyles = "svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom right;transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom left;transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top left;transform-origin:top left}.fa-lg{font-size:1.3333333333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2.5em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1.25em}.svg-inline--fa.fa-stack-2x{height:2em;width:2.5em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.svg-inline--fa .fa-primary{fill:var(--fa-primary-color,currentColor);opacity:1;opacity:var(--fa-primary-opacity,1)}.svg-inline--fa .fa-secondary{fill:var(--fa-secondary-color,currentColor);opacity:.4;opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-primary{opacity:.4;opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-secondary{opacity:1;opacity:var(--fa-primary-opacity,1)}.svg-inline--fa mask .fa-primary,.svg-inline--fa mask .fa-secondary{fill:#000}.fad.fa-inverse{color:#fff}";
2080

2081
  function css () {
2082
    var dfp = DEFAULT_FAMILY_PREFIX;
2083
    var drc = DEFAULT_REPLACEMENT_CLASS;
2084
    var fp = config.familyPrefix;
2085
    var rc = config.replacementClass;
2086
    var s = baseStyles;
2087

2088
    if (fp !== dfp || rc !== drc) {
2089
      var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g');
2090
      var customPropPatt = new RegExp("\\--".concat(dfp, "\\-"), 'g');
2091
      var rPatt = new RegExp("\\.".concat(drc), 'g');
2092
      s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
2093
    }
2094

2095
    return s;
2096
  }
2097

2098
  var Library =
2099
  /*#__PURE__*/
2100
  function () {
2101
    function Library() {
2102
      _classCallCheck(this, Library);
2103

2104
      this.definitions = {};
2105
    }
2106

2107
    _createClass(Library, [{
2108
      key: "add",
2109
      value: function add() {
2110
        var _this = this;
2111

2112
        for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
2113
          definitions[_key] = arguments[_key];
2114
        }
2115

2116
        var additions = definitions.reduce(this._pullDefinitions, {});
2117
        Object.keys(additions).forEach(function (key) {
2118
          _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);
2119
          defineIcons(key, additions[key]);
2120
          build();
2121
        });
2122
      }
2123
    }, {
2124
      key: "reset",
2125
      value: function reset() {
2126
        this.definitions = {};
2127
      }
2128
    }, {
2129
      key: "_pullDefinitions",
2130
      value: function _pullDefinitions(additions, definition) {
2131
        var normalized = definition.prefix && definition.iconName && definition.icon ? {
2132
          0: definition
2133
        } : definition;
2134
        Object.keys(normalized).map(function (key) {
2135
          var _normalized$key = normalized[key],
2136
              prefix = _normalized$key.prefix,
2137
              iconName = _normalized$key.iconName,
2138
              icon = _normalized$key.icon;
2139
          if (!additions[prefix]) additions[prefix] = {};
2140
          additions[prefix][iconName] = icon;
2141
        });
2142
        return additions;
2143
      }
2144
    }]);
2145

2146
    return Library;
2147
  }();
2148

2149
  function ensureCss() {
2150
    if (config.autoAddCss && !_cssInserted) {
2151
      insertCss(css());
2152

2153
      _cssInserted = true;
2154
    }
2155
  }
2156

2157
  function apiObject(val, abstractCreator) {
2158
    Object.defineProperty(val, 'abstract', {
2159
      get: abstractCreator
2160
    });
2161
    Object.defineProperty(val, 'html', {
2162
      get: function get() {
2163
        return val.abstract.map(function (a) {
2164
          return toHtml(a);
2165
        });
2166
      }
2167
    });
2168
    Object.defineProperty(val, 'node', {
2169
      get: function get() {
2170
        if (!IS_DOM) return;
2171
        var container = DOCUMENT.createElement('div');
2172
        container.innerHTML = val.html;
2173
        return container.children;
2174
      }
2175
    });
2176
    return val;
2177
  }
2178

2179
  function findIconDefinition(iconLookup) {
2180
    var _iconLookup$prefix = iconLookup.prefix,
2181
        prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,
2182
        iconName = iconLookup.iconName;
2183
    if (!iconName) return;
2184
    return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
2185
  }
2186

2187
  function resolveIcons(next) {
2188
    return function (maybeIconDefinition) {
2189
      var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2190
      var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
2191
      var mask = params.mask;
2192

2193
      if (mask) {
2194
        mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
2195
      }
2196

2197
      return next(iconDefinition, _objectSpread({}, params, {
2198
        mask: mask
2199
      }));
2200
    };
2201
  }
2202

2203
  var library = new Library();
2204
  var noAuto = function noAuto() {
2205
    config.autoReplaceSvg = false;
2206
    config.observeMutations = false;
2207
    disconnect();
2208
  };
2209
  var _cssInserted = false;
2210
  var dom = {
2211
    i2svg: function i2svg() {
2212
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2213

2214
      if (IS_DOM) {
2215
        ensureCss();
2216
        var _params$node = params.node,
2217
            node = _params$node === void 0 ? DOCUMENT : _params$node,
2218
            _params$callback = params.callback,
2219
            callback = _params$callback === void 0 ? function () {} : _params$callback;
2220

2221
        if (config.searchPseudoElements) {
2222
          searchPseudoElements(node);
2223
        }
2224

2225
        return onTree(node, callback);
2226
      } else {
2227
        return picked.reject('Operation requires a DOM of some kind.');
2228
      }
2229
    },
2230
    css: css,
2231
    insertCss: function insertCss$$1() {
2232
      if (!_cssInserted) {
2233
        insertCss(css());
2234

2235
        _cssInserted = true;
2236
      }
2237
    },
2238
    watch: function watch() {
2239
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2240
      var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
2241
          observeMutationsRoot = params.observeMutationsRoot;
2242

2243
      if (config.autoReplaceSvg === false) {
2244
        config.autoReplaceSvg = true;
2245
      }
2246

2247
      config.observeMutations = true;
2248
      domready(function () {
2249
        autoReplace({
2250
          autoReplaceSvgRoot: autoReplaceSvgRoot
2251
        });
2252
        observe({
2253
          treeCallback: onTree,
2254
          nodeCallback: onNode,
2255
          pseudoElementsCallback: searchPseudoElements,
2256
          observeMutationsRoot: observeMutationsRoot
2257
        });
2258
      });
2259
    }
2260
  };
2261
  var parse = {
2262
    transform: function transform(transformString) {
2263
      return parseTransformString(transformString);
2264
    }
2265
  };
2266
  var icon = resolveIcons(function (iconDefinition) {
2267
    var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2268
    var _params$transform = params.transform,
2269
        transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2270
        _params$symbol = params.symbol,
2271
        symbol = _params$symbol === void 0 ? false : _params$symbol,
2272
        _params$mask = params.mask,
2273
        mask = _params$mask === void 0 ? null : _params$mask,
2274
        _params$title = params.title,
2275
        title = _params$title === void 0 ? null : _params$title,
2276
        _params$classes = params.classes,
2277
        classes = _params$classes === void 0 ? [] : _params$classes,
2278
        _params$attributes = params.attributes,
2279
        attributes = _params$attributes === void 0 ? {} : _params$attributes,
2280
        _params$styles = params.styles,
2281
        styles = _params$styles === void 0 ? {} : _params$styles;
2282
    if (!iconDefinition) return;
2283
    var prefix = iconDefinition.prefix,
2284
        iconName = iconDefinition.iconName,
2285
        icon = iconDefinition.icon;
2286
    return apiObject(_objectSpread({
2287
      type: 'icon'
2288
    }, iconDefinition), function () {
2289
      ensureCss();
2290

2291
      if (config.autoA11y) {
2292
        if (title) {
2293
          attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
2294
        } else {
2295
          attributes['aria-hidden'] = 'true';
2296
          attributes['focusable'] = 'false';
2297
        }
2298
      }
2299

2300
      return makeInlineSvgAbstract({
2301
        icons: {
2302
          main: asFoundIcon(icon),
2303
          mask: mask ? asFoundIcon(mask.icon) : {
2304
            found: false,
2305
            width: null,
2306
            height: null,
2307
            icon: {}
2308
          }
2309
        },
2310
        prefix: prefix,
2311
        iconName: iconName,
2312
        transform: _objectSpread({}, meaninglessTransform, transform),
2313
        symbol: symbol,
2314
        title: title,
2315
        extra: {
2316
          attributes: attributes,
2317
          styles: styles,
2318
          classes: classes
2319
        }
2320
      });
2321
    });
2322
  });
2323
  var text = function text(content) {
2324
    var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2325
    var _params$transform2 = params.transform,
2326
        transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,
2327
        _params$title2 = params.title,
2328
        title = _params$title2 === void 0 ? null : _params$title2,
2329
        _params$classes2 = params.classes,
2330
        classes = _params$classes2 === void 0 ? [] : _params$classes2,
2331
        _params$attributes2 = params.attributes,
2332
        attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,
2333
        _params$styles2 = params.styles,
2334
        styles = _params$styles2 === void 0 ? {} : _params$styles2;
2335
    return apiObject({
2336
      type: 'text',
2337
      content: content
2338
    }, function () {
2339
      ensureCss();
2340
      return makeLayersTextAbstract({
2341
        content: content,
2342
        transform: _objectSpread({}, meaninglessTransform, transform),
2343
        title: title,
2344
        extra: {
2345
          attributes: attributes,
2346
          styles: styles,
2347
          classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes))
2348
        }
2349
      });
2350
    });
2351
  };
2352
  var counter = function counter(content) {
2353
    var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2354
    var _params$title3 = params.title,
2355
        title = _params$title3 === void 0 ? null : _params$title3,
2356
        _params$classes3 = params.classes,
2357
        classes = _params$classes3 === void 0 ? [] : _params$classes3,
2358
        _params$attributes3 = params.attributes,
2359
        attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,
2360
        _params$styles3 = params.styles,
2361
        styles = _params$styles3 === void 0 ? {} : _params$styles3;
2362
    return apiObject({
2363
      type: 'counter',
2364
      content: content
2365
    }, function () {
2366
      ensureCss();
2367
      return makeLayersCounterAbstract({
2368
        content: content.toString(),
2369
        title: title,
2370
        extra: {
2371
          attributes: attributes,
2372
          styles: styles,
2373
          classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
2374
        }
2375
      });
2376
    });
2377
  };
2378
  var layer = function layer(assembler) {
2379
    var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2380
    var _params$classes4 = params.classes,
2381
        classes = _params$classes4 === void 0 ? [] : _params$classes4;
2382
    return apiObject({
2383
      type: 'layer'
2384
    }, function () {
2385
      ensureCss();
2386
      var children = [];
2387
      assembler(function (args) {
2388
        Array.isArray(args) ? args.map(function (a) {
2389
          children = children.concat(a.abstract);
2390
        }) : children = children.concat(args.abstract);
2391
      });
2392
      return [{
2393
        tag: 'span',
2394
        attributes: {
2395
          class: ["".concat(config.familyPrefix, "-layers")].concat(_toConsumableArray(classes)).join(' ')
2396
        },
2397
        children: children
2398
      }];
2399
    });
2400
  };
2401
  var api = {
2402
    noAuto: noAuto,
2403
    config: config,
2404
    dom: dom,
2405
    library: library,
2406
    parse: parse,
2407
    findIconDefinition: findIconDefinition,
2408
    icon: icon,
2409
    text: text,
2410
    counter: counter,
2411
    layer: layer,
2412
    toHtml: toHtml
2413
  };
2414

2415
  var autoReplace = function autoReplace() {
2416
    var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2417
    var _params$autoReplaceSv = params.autoReplaceSvgRoot,
2418
        autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
2419
    if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
2420
      node: autoReplaceSvgRoot
2421
    });
2422
  };
2423

2424
  function bootstrap() {
2425
    if (IS_BROWSER) {
2426
      if (!WINDOW.FontAwesome) {
2427
        WINDOW.FontAwesome = api;
2428
      }
2429

2430
      domready(function () {
2431
        autoReplace();
2432
        observe({
2433
          treeCallback: onTree,
2434
          nodeCallback: onNode,
2435
          pseudoElementsCallback: searchPseudoElements
2436
        });
2437
      });
2438
    }
2439

2440
    namespace.hooks = _objectSpread({}, namespace.hooks, {
2441
      addPack: function addPack(prefix, icons) {
2442
        namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, icons);
2443
        build();
2444
        autoReplace();
2445
      },
2446
      addShims: function addShims(shims) {
2447
        var _namespace$shims;
2448

2449
        (_namespace$shims = namespace.shims).push.apply(_namespace$shims, _toConsumableArray(shims));
2450

2451
        build();
2452
        autoReplace();
2453
      }
2454
    });
2455
  }
2456

2457
  bunker(bootstrap);
2458

2459
}());
2460

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.