plugins.mjs 100 KB

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