index.es.js 75 KB

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