index.js 80 KB

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