2022-02-08 04:16:51 +08:00
|
|
|
/*!
|
2024-12-17 01:25:57 +08:00
|
|
|
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
2022-02-08 04:16:51 +08:00
|
|
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
2024-04-03 02:54:47 +08:00
|
|
|
* Copyright 2024 Fonticons, Inc.
|
2022-02-08 04:16:51 +08:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
function _defineProperty(e, r, t) {
|
|
|
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
|
|
value: t,
|
|
|
|
enumerable: !0,
|
|
|
|
configurable: !0,
|
|
|
|
writable: !0
|
|
|
|
}) : e[r] = t, e;
|
|
|
|
}
|
|
|
|
function _inherits(t, e) {
|
|
|
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
|
|
t.prototype = Object.create(e && e.prototype, {
|
|
|
|
constructor: {
|
|
|
|
value: t,
|
|
|
|
writable: !0,
|
|
|
|
configurable: !0
|
|
|
|
}
|
|
|
|
}), Object.defineProperty(t, "prototype", {
|
|
|
|
writable: !1
|
|
|
|
}), e && _setPrototypeOf(t, e);
|
|
|
|
}
|
|
|
|
function ownKeys(e, r) {
|
|
|
|
var t = Object.keys(e);
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
|
|
var o = Object.getOwnPropertySymbols(e);
|
|
|
|
r && (o = o.filter(function (r) {
|
|
|
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
|
|
})), t.push.apply(t, o);
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
function _objectSpread2(e) {
|
|
|
|
for (var r = 1; r < arguments.length; r++) {
|
|
|
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
|
|
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
|
|
_defineProperty(e, r, t[r]);
|
|
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
|
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
function _setPrototypeOf(t, e) {
|
|
|
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
|
|
return t.__proto__ = e, t;
|
|
|
|
}, _setPrototypeOf(t, e);
|
|
|
|
}
|
|
|
|
function _toPrimitive(t, r) {
|
|
|
|
if ("object" != typeof t || !t) return t;
|
|
|
|
var e = t[Symbol.toPrimitive];
|
|
|
|
if (void 0 !== e) {
|
|
|
|
var i = e.call(t, r || "default");
|
|
|
|
if ("object" != typeof i) return i;
|
|
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
|
|
}
|
|
|
|
return ("string" === r ? String : Number)(t);
|
|
|
|
}
|
|
|
|
function _toPropertyKey(t) {
|
|
|
|
var i = _toPrimitive(t, "string");
|
|
|
|
return "symbol" == typeof i ? i : i + "";
|
|
|
|
}
|
|
|
|
function _wrapRegExp() {
|
|
|
|
_wrapRegExp = function (e, r) {
|
|
|
|
return new BabelRegExp(e, void 0, r);
|
|
|
|
};
|
|
|
|
var e = RegExp.prototype,
|
|
|
|
r = new WeakMap();
|
|
|
|
function BabelRegExp(e, t, p) {
|
|
|
|
var o = RegExp(e, t);
|
|
|
|
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype);
|
|
|
|
}
|
|
|
|
function buildGroups(e, t) {
|
|
|
|
var p = r.get(t);
|
|
|
|
return Object.keys(p).reduce(function (r, t) {
|
|
|
|
var o = p[t];
|
|
|
|
if ("number" == typeof o) r[t] = e[o];else {
|
|
|
|
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++;
|
|
|
|
r[t] = e[o[i]];
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}, Object.create(null));
|
|
|
|
}
|
|
|
|
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) {
|
|
|
|
var t = e.exec.call(this, r);
|
|
|
|
if (t) {
|
|
|
|
t.groups = buildGroups(t, this);
|
|
|
|
var p = t.indices;
|
|
|
|
p && (p.groups = buildGroups(p, this));
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) {
|
|
|
|
if ("string" == typeof p) {
|
|
|
|
var o = r.get(this);
|
|
|
|
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) {
|
|
|
|
var t = o[r];
|
|
|
|
return "$" + (Array.isArray(t) ? t.join("$") : t);
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
if ("function" == typeof p) {
|
|
|
|
var i = this;
|
|
|
|
return e[Symbol.replace].call(this, t, function () {
|
|
|
|
var e = arguments;
|
|
|
|
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return e[Symbol.replace].call(this, t, p);
|
|
|
|
}, _wrapRegExp.apply(this, arguments);
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
const noop = () => {};
|
2024-07-17 01:13:31 +08:00
|
|
|
let _WINDOW = {};
|
|
|
|
let _DOCUMENT = {};
|
|
|
|
let _MUTATION_OBSERVER = null;
|
|
|
|
let _PERFORMANCE = {
|
2022-02-08 04:16:51 +08:00
|
|
|
mark: noop,
|
|
|
|
measure: noop
|
|
|
|
};
|
|
|
|
try {
|
|
|
|
if (typeof window !== 'undefined') _WINDOW = window;
|
|
|
|
if (typeof document !== 'undefined') _DOCUMENT = document;
|
|
|
|
if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
|
|
|
|
if (typeof performance !== 'undefined') _PERFORMANCE = performance;
|
|
|
|
} catch (e) {}
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
userAgent = ''
|
|
|
|
} = _WINDOW.navigator || {};
|
|
|
|
const WINDOW = _WINDOW;
|
|
|
|
const DOCUMENT = _DOCUMENT;
|
|
|
|
const MUTATION_OBSERVER = _MUTATION_OBSERVER;
|
|
|
|
const PERFORMANCE = _PERFORMANCE;
|
|
|
|
const IS_BROWSER = !!WINDOW.document;
|
|
|
|
const IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
|
|
|
|
const IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
|
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
var p = /fa(s|r|l|t|d|dr|dl|dt|b|k|kd|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,
|
|
|
|
g = /Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i;
|
|
|
|
var S = {
|
|
|
|
classic: {
|
|
|
|
fa: "solid",
|
|
|
|
fas: "solid",
|
|
|
|
"fa-solid": "solid",
|
|
|
|
far: "regular",
|
|
|
|
"fa-regular": "regular",
|
|
|
|
fal: "light",
|
|
|
|
"fa-light": "light",
|
|
|
|
fat: "thin",
|
|
|
|
"fa-thin": "thin",
|
|
|
|
fab: "brands",
|
|
|
|
"fa-brands": "brands"
|
|
|
|
},
|
|
|
|
duotone: {
|
|
|
|
fa: "solid",
|
|
|
|
fad: "solid",
|
|
|
|
"fa-solid": "solid",
|
|
|
|
"fa-duotone": "solid",
|
|
|
|
fadr: "regular",
|
|
|
|
"fa-regular": "regular",
|
|
|
|
fadl: "light",
|
|
|
|
"fa-light": "light",
|
|
|
|
fadt: "thin",
|
|
|
|
"fa-thin": "thin"
|
|
|
|
},
|
|
|
|
sharp: {
|
|
|
|
fa: "solid",
|
|
|
|
fass: "solid",
|
|
|
|
"fa-solid": "solid",
|
|
|
|
fasr: "regular",
|
|
|
|
"fa-regular": "regular",
|
|
|
|
fasl: "light",
|
|
|
|
"fa-light": "light",
|
|
|
|
fast: "thin",
|
|
|
|
"fa-thin": "thin"
|
|
|
|
},
|
|
|
|
"sharp-duotone": {
|
|
|
|
fa: "solid",
|
|
|
|
fasds: "solid",
|
|
|
|
"fa-solid": "solid",
|
|
|
|
fasdr: "regular",
|
|
|
|
"fa-regular": "regular",
|
|
|
|
fasdl: "light",
|
|
|
|
"fa-light": "light",
|
|
|
|
fasdt: "thin",
|
|
|
|
"fa-thin": "thin"
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
},
|
2024-11-19 05:38:46 +08:00
|
|
|
A = {
|
|
|
|
GROUP: "duotone-group",
|
|
|
|
SWAP_OPACITY: "swap-opacity",
|
|
|
|
PRIMARY: "primary",
|
|
|
|
SECONDARY: "secondary"
|
2024-07-17 01:13:31 +08:00
|
|
|
},
|
2024-11-19 05:38:46 +08:00
|
|
|
P = ["fa-classic", "fa-duotone", "fa-sharp", "fa-sharp-duotone"];
|
|
|
|
var s = "classic",
|
|
|
|
t = "duotone",
|
|
|
|
r = "sharp",
|
|
|
|
o = "sharp-duotone",
|
|
|
|
L = [s, t, r, o];
|
|
|
|
var G = {
|
|
|
|
classic: {
|
|
|
|
900: "fas",
|
|
|
|
400: "far",
|
|
|
|
normal: "far",
|
|
|
|
300: "fal",
|
|
|
|
100: "fat"
|
|
|
|
},
|
|
|
|
duotone: {
|
|
|
|
900: "fad",
|
|
|
|
400: "fadr",
|
|
|
|
300: "fadl",
|
|
|
|
100: "fadt"
|
|
|
|
},
|
|
|
|
sharp: {
|
|
|
|
900: "fass",
|
|
|
|
400: "fasr",
|
|
|
|
300: "fasl",
|
|
|
|
100: "fast"
|
|
|
|
},
|
|
|
|
"sharp-duotone": {
|
|
|
|
900: "fasds",
|
|
|
|
400: "fasdr",
|
|
|
|
300: "fasdl",
|
|
|
|
100: "fasdt"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var lt = {
|
|
|
|
"Font Awesome 6 Free": {
|
|
|
|
900: "fas",
|
|
|
|
400: "far"
|
|
|
|
},
|
|
|
|
"Font Awesome 6 Pro": {
|
|
|
|
900: "fas",
|
|
|
|
400: "far",
|
|
|
|
normal: "far",
|
|
|
|
300: "fal",
|
|
|
|
100: "fat"
|
|
|
|
},
|
|
|
|
"Font Awesome 6 Brands": {
|
|
|
|
400: "fab",
|
|
|
|
normal: "fab"
|
|
|
|
},
|
|
|
|
"Font Awesome 6 Duotone": {
|
|
|
|
900: "fad",
|
|
|
|
400: "fadr",
|
|
|
|
normal: "fadr",
|
|
|
|
300: "fadl",
|
|
|
|
100: "fadt"
|
|
|
|
},
|
|
|
|
"Font Awesome 6 Sharp": {
|
|
|
|
900: "fass",
|
|
|
|
400: "fasr",
|
|
|
|
normal: "fasr",
|
|
|
|
300: "fasl",
|
|
|
|
100: "fast"
|
|
|
|
},
|
|
|
|
"Font Awesome 6 Sharp Duotone": {
|
|
|
|
900: "fasds",
|
|
|
|
400: "fasdr",
|
|
|
|
normal: "fasdr",
|
|
|
|
300: "fasdl",
|
|
|
|
100: "fasdt"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var pt = new Map([["classic", {
|
|
|
|
defaultShortPrefixId: "fas",
|
|
|
|
defaultStyleId: "solid",
|
|
|
|
styleIds: ["solid", "regular", "light", "thin", "brands"],
|
|
|
|
futureStyleIds: [],
|
|
|
|
defaultFontWeight: 900
|
|
|
|
}], ["sharp", {
|
|
|
|
defaultShortPrefixId: "fass",
|
|
|
|
defaultStyleId: "solid",
|
|
|
|
styleIds: ["solid", "regular", "light", "thin"],
|
|
|
|
futureStyleIds: [],
|
|
|
|
defaultFontWeight: 900
|
|
|
|
}], ["duotone", {
|
|
|
|
defaultShortPrefixId: "fad",
|
|
|
|
defaultStyleId: "solid",
|
|
|
|
styleIds: ["solid", "regular", "light", "thin"],
|
|
|
|
futureStyleIds: [],
|
|
|
|
defaultFontWeight: 900
|
|
|
|
}], ["sharp-duotone", {
|
|
|
|
defaultShortPrefixId: "fasds",
|
|
|
|
defaultStyleId: "solid",
|
|
|
|
styleIds: ["solid", "regular", "light", "thin"],
|
|
|
|
futureStyleIds: [],
|
|
|
|
defaultFontWeight: 900
|
|
|
|
}]]),
|
|
|
|
xt = {
|
|
|
|
classic: {
|
|
|
|
solid: "fas",
|
|
|
|
regular: "far",
|
|
|
|
light: "fal",
|
|
|
|
thin: "fat",
|
|
|
|
brands: "fab"
|
|
|
|
},
|
|
|
|
duotone: {
|
|
|
|
solid: "fad",
|
|
|
|
regular: "fadr",
|
|
|
|
light: "fadl",
|
|
|
|
thin: "fadt"
|
|
|
|
},
|
|
|
|
sharp: {
|
|
|
|
solid: "fass",
|
|
|
|
regular: "fasr",
|
|
|
|
light: "fasl",
|
|
|
|
thin: "fast"
|
|
|
|
},
|
|
|
|
"sharp-duotone": {
|
|
|
|
solid: "fasds",
|
|
|
|
regular: "fasdr",
|
|
|
|
light: "fasdl",
|
|
|
|
thin: "fasdt"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var Ft = ["fak", "fa-kit", "fakd", "fa-kit-duotone"],
|
|
|
|
St = {
|
|
|
|
kit: {
|
|
|
|
fak: "kit",
|
|
|
|
"fa-kit": "kit"
|
|
|
|
},
|
|
|
|
"kit-duotone": {
|
|
|
|
fakd: "kit-duotone",
|
|
|
|
"fa-kit-duotone": "kit-duotone"
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
},
|
2024-11-19 05:38:46 +08:00
|
|
|
At = ["kit"];
|
|
|
|
var Ct = {
|
2024-07-17 01:13:31 +08:00
|
|
|
kit: {
|
|
|
|
"fa-kit": "fak"
|
|
|
|
},
|
|
|
|
"kit-duotone": {
|
|
|
|
"fa-kit-duotone": "fakd"
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
};
|
|
|
|
var Lt = ["fak", "fakd"],
|
|
|
|
Wt = {
|
|
|
|
kit: {
|
|
|
|
fak: "fa-kit"
|
|
|
|
},
|
|
|
|
"kit-duotone": {
|
|
|
|
fakd: "fa-kit-duotone"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var Et = {
|
|
|
|
kit: {
|
|
|
|
kit: "fak"
|
|
|
|
},
|
|
|
|
"kit-duotone": {
|
|
|
|
"kit-duotone": "fakd"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var t$1 = {
|
|
|
|
GROUP: "duotone-group",
|
|
|
|
SWAP_OPACITY: "swap-opacity",
|
|
|
|
PRIMARY: "primary",
|
|
|
|
SECONDARY: "secondary"
|
2024-07-17 01:13:31 +08:00
|
|
|
},
|
2024-11-19 05:38:46 +08:00
|
|
|
r$1 = ["fa-classic", "fa-duotone", "fa-sharp", "fa-sharp-duotone"];
|
|
|
|
var bt$1 = ["fak", "fa-kit", "fakd", "fa-kit-duotone"];
|
|
|
|
var Yt = {
|
|
|
|
"Font Awesome Kit": {
|
|
|
|
400: "fak",
|
|
|
|
normal: "fak"
|
|
|
|
},
|
|
|
|
"Font Awesome Kit Duotone": {
|
|
|
|
400: "fakd",
|
|
|
|
normal: "fakd"
|
|
|
|
}
|
|
|
|
};
|
2024-12-17 01:25:57 +08:00
|
|
|
var ua = {
|
2024-11-19 05:38:46 +08:00
|
|
|
classic: {
|
|
|
|
"fa-brands": "fab",
|
|
|
|
"fa-duotone": "fad",
|
|
|
|
"fa-light": "fal",
|
|
|
|
"fa-regular": "far",
|
|
|
|
"fa-solid": "fas",
|
|
|
|
"fa-thin": "fat"
|
|
|
|
},
|
|
|
|
duotone: {
|
|
|
|
"fa-regular": "fadr",
|
|
|
|
"fa-light": "fadl",
|
|
|
|
"fa-thin": "fadt"
|
|
|
|
},
|
|
|
|
sharp: {
|
|
|
|
"fa-solid": "fass",
|
|
|
|
"fa-regular": "fasr",
|
|
|
|
"fa-light": "fasl",
|
|
|
|
"fa-thin": "fast"
|
|
|
|
},
|
|
|
|
"sharp-duotone": {
|
|
|
|
"fa-solid": "fasds",
|
|
|
|
"fa-regular": "fasdr",
|
|
|
|
"fa-light": "fasdl",
|
|
|
|
"fa-thin": "fasdt"
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
},
|
2024-11-19 05:38:46 +08:00
|
|
|
I$1 = {
|
|
|
|
classic: ["fas", "far", "fal", "fat", "fad"],
|
|
|
|
duotone: ["fadr", "fadl", "fadt"],
|
|
|
|
sharp: ["fass", "fasr", "fasl", "fast"],
|
|
|
|
"sharp-duotone": ["fasds", "fasdr", "fasdl", "fasdt"]
|
|
|
|
},
|
2024-12-17 01:25:57 +08:00
|
|
|
ga = {
|
2024-11-19 05:38:46 +08:00
|
|
|
classic: {
|
|
|
|
fab: "fa-brands",
|
|
|
|
fad: "fa-duotone",
|
|
|
|
fal: "fa-light",
|
|
|
|
far: "fa-regular",
|
|
|
|
fas: "fa-solid",
|
|
|
|
fat: "fa-thin"
|
|
|
|
},
|
|
|
|
duotone: {
|
|
|
|
fadr: "fa-regular",
|
|
|
|
fadl: "fa-light",
|
|
|
|
fadt: "fa-thin"
|
|
|
|
},
|
|
|
|
sharp: {
|
|
|
|
fass: "fa-solid",
|
|
|
|
fasr: "fa-regular",
|
|
|
|
fasl: "fa-light",
|
|
|
|
fast: "fa-thin"
|
|
|
|
},
|
|
|
|
"sharp-duotone": {
|
|
|
|
fasds: "fa-solid",
|
|
|
|
fasdr: "fa-regular",
|
|
|
|
fasdl: "fa-light",
|
|
|
|
fasdt: "fa-thin"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
x = ["fa-solid", "fa-regular", "fa-light", "fa-thin", "fa-duotone", "fa-brands"],
|
2024-12-17 01:25:57 +08:00
|
|
|
Ia = ["fa", "fas", "far", "fal", "fat", "fad", "fadr", "fadl", "fadt", "fab", "fass", "fasr", "fasl", "fast", "fasds", "fasdr", "fasdl", "fasdt", ...r$1, ...x],
|
2024-11-19 05:38:46 +08:00
|
|
|
m$1 = ["solid", "regular", "light", "thin", "duotone", "brands"],
|
|
|
|
c$1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
|
|
F$1 = c$1.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),
|
2024-12-17 01:25:57 +08:00
|
|
|
ma = [...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(a => "".concat(a, "x"))).concat(F$1.map(a => "w-".concat(a)));
|
|
|
|
var wa = {
|
2024-11-19 05:38:46 +08:00
|
|
|
"Font Awesome 5 Free": {
|
|
|
|
900: "fas",
|
|
|
|
400: "far"
|
|
|
|
},
|
|
|
|
"Font Awesome 5 Pro": {
|
|
|
|
900: "fas",
|
|
|
|
400: "far",
|
|
|
|
normal: "far",
|
|
|
|
300: "fal"
|
|
|
|
},
|
|
|
|
"Font Awesome 5 Brands": {
|
|
|
|
400: "fab",
|
|
|
|
normal: "fab"
|
|
|
|
},
|
|
|
|
"Font Awesome 5 Duotone": {
|
|
|
|
900: "fad"
|
|
|
|
}
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
|
|
|
|
const NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
|
|
|
|
const UNITS_IN_GRID = 16;
|
|
|
|
const DEFAULT_CSS_PREFIX = 'fa';
|
|
|
|
const DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
|
|
|
|
const DATA_FA_I2SVG = 'data-fa-i2svg';
|
|
|
|
const DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
|
|
|
|
const DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
|
|
|
|
const DATA_PREFIX = 'data-prefix';
|
|
|
|
const DATA_ICON = 'data-icon';
|
|
|
|
const HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
|
|
|
|
const MUTATION_APPROACH_ASYNC = 'async';
|
|
|
|
const TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
|
|
|
|
const PRODUCTION = (() => {
|
2022-02-08 04:16:51 +08:00
|
|
|
try {
|
|
|
|
return undefined === 'production';
|
2024-07-17 01:13:31 +08:00
|
|
|
} catch (e$$1) {
|
2022-02-08 04:16:51 +08:00
|
|
|
return false;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
})();
|
2022-09-01 05:02:43 +08:00
|
|
|
function familyProxy(obj) {
|
|
|
|
// Defaults to the classic family if family is not available
|
|
|
|
return new Proxy(obj, {
|
2024-07-17 01:13:31 +08:00
|
|
|
get(target, prop) {
|
2024-11-19 05:38:46 +08:00
|
|
|
return prop in target ? target[prop] : target[s];
|
2022-09-01 05:02:43 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
const _PREFIX_TO_STYLE = _objectSpread2({}, S);
|
2024-07-17 01:13:31 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// We changed FACSSClassesToStyleId in the icons repo to be canonical and as such, "classic" family does not have any
|
|
|
|
// duotone styles. But we do still need duotone in _PREFIX_TO_STYLE below, so we are manually adding
|
|
|
|
// {'fa-duotone': 'duotone'}
|
|
|
|
_PREFIX_TO_STYLE[s] = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, {
|
|
|
|
'fa-duotone': 'duotone'
|
|
|
|
}), S[s]), St['kit']), St['kit-duotone']);
|
2024-07-17 01:13:31 +08:00
|
|
|
const PREFIX_TO_STYLE = familyProxy(_PREFIX_TO_STYLE);
|
2024-11-19 05:38:46 +08:00
|
|
|
const _STYLE_TO_PREFIX = _objectSpread2({}, xt);
|
|
|
|
|
|
|
|
// We changed FAStyleIdToShortPrefixId in the icons repo to be canonical and as such, "classic" family does not have any
|
|
|
|
// duotone styles. But we do still need duotone in _STYLE_TO_PREFIX below, so we are manually adding {duotone: 'fad'}
|
|
|
|
_STYLE_TO_PREFIX[s] = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, {
|
|
|
|
duotone: 'fad'
|
|
|
|
}), _STYLE_TO_PREFIX[s]), Et['kit']), Et['kit-duotone']);
|
2024-07-17 01:13:31 +08:00
|
|
|
const STYLE_TO_PREFIX = familyProxy(_STYLE_TO_PREFIX);
|
2024-12-17 01:25:57 +08:00
|
|
|
const _PREFIX_TO_LONG_STYLE = _objectSpread2({}, ga);
|
2024-11-19 05:38:46 +08:00
|
|
|
_PREFIX_TO_LONG_STYLE[s] = _objectSpread2(_objectSpread2({}, _PREFIX_TO_LONG_STYLE[s]), Wt['kit']);
|
2024-07-17 01:13:31 +08:00
|
|
|
const PREFIX_TO_LONG_STYLE = familyProxy(_PREFIX_TO_LONG_STYLE);
|
2024-12-17 01:25:57 +08:00
|
|
|
const _LONG_STYLE_TO_PREFIX = _objectSpread2({}, ua);
|
2024-11-19 05:38:46 +08:00
|
|
|
_LONG_STYLE_TO_PREFIX[s] = _objectSpread2(_objectSpread2({}, _LONG_STYLE_TO_PREFIX[s]), Ct['kit']);
|
2024-07-17 01:13:31 +08:00
|
|
|
const LONG_STYLE_TO_PREFIX = familyProxy(_LONG_STYLE_TO_PREFIX);
|
2024-11-19 05:38:46 +08:00
|
|
|
const ICON_SELECTION_SYNTAX_PATTERN = p; // eslint-disable-line no-useless-escape
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
|
2024-11-19 05:38:46 +08:00
|
|
|
const FONT_FAMILY_PATTERN = g;
|
|
|
|
const _FONT_WEIGHT_TO_PREFIX = _objectSpread2({}, G);
|
2024-07-17 01:13:31 +08:00
|
|
|
const FONT_WEIGHT_TO_PREFIX = familyProxy(_FONT_WEIGHT_TO_PREFIX);
|
|
|
|
const ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
|
2024-11-19 05:38:46 +08:00
|
|
|
const DUOTONE_CLASSES = A;
|
2024-12-17 01:25:57 +08:00
|
|
|
const RESERVED_CLASSES = [...At, ...ma];
|
2024-07-17 01:13:31 +08:00
|
|
|
|
|
|
|
const initial = WINDOW.FontAwesomeConfig || {};
|
2022-02-08 04:16:51 +08:00
|
|
|
function getAttrConfig(attr) {
|
|
|
|
var element = DOCUMENT.querySelector('script[' + attr + ']');
|
|
|
|
if (element) {
|
|
|
|
return element.getAttribute(attr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function coerce(val) {
|
|
|
|
// Getting an empty string will occur if the attribute is set on the HTML tag but without a value
|
|
|
|
// We'll assume that this is an indication that it should be toggled to true
|
|
|
|
if (val === '') return true;
|
|
|
|
if (val === 'false') return false;
|
|
|
|
if (val === 'true') return true;
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
|
2024-07-17 01:13:31 +08:00
|
|
|
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']];
|
|
|
|
attrs.forEach(_ref => {
|
|
|
|
let [attr, key] = _ref;
|
|
|
|
const val = coerce(getAttrConfig(attr));
|
2022-02-08 04:16:51 +08:00
|
|
|
if (val !== undefined && val !== null) {
|
|
|
|
initial[key] = val;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const _default = {
|
2022-02-08 04:16:51 +08:00
|
|
|
styleDefault: 'solid',
|
2024-11-19 05:38:46 +08:00
|
|
|
familyDefault: s,
|
2022-09-01 05:02:43 +08:00
|
|
|
cssPrefix: DEFAULT_CSS_PREFIX,
|
2022-02-08 04:16:51 +08:00
|
|
|
replacementClass: DEFAULT_REPLACEMENT_CLASS,
|
|
|
|
autoReplaceSvg: true,
|
|
|
|
autoAddCss: true,
|
|
|
|
autoA11y: true,
|
|
|
|
searchPseudoElements: false,
|
|
|
|
observeMutations: true,
|
|
|
|
mutateApproach: 'async',
|
|
|
|
keepOriginalSource: true,
|
|
|
|
measurePerformance: false,
|
|
|
|
showMissingIcons: true
|
2024-11-19 05:38:46 +08:00
|
|
|
};
|
2022-09-01 05:02:43 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// familyPrefix is deprecated but we must still support it if present
|
2022-09-01 05:02:43 +08:00
|
|
|
if (initial.familyPrefix) {
|
|
|
|
initial.cssPrefix = initial.familyPrefix;
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
const _config = _objectSpread2(_objectSpread2({}, _default), initial);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!_config.autoReplaceSvg) _config.observeMutations = false;
|
2024-07-17 01:13:31 +08:00
|
|
|
const config = {};
|
|
|
|
Object.keys(_default).forEach(key => {
|
2022-02-08 04:16:51 +08:00
|
|
|
Object.defineProperty(config, key, {
|
|
|
|
enumerable: true,
|
2024-07-17 01:13:31 +08:00
|
|
|
set: function (val) {
|
2022-02-08 04:16:51 +08:00
|
|
|
_config[key] = val;
|
2024-07-17 01:13:31 +08:00
|
|
|
_onChangeCb.forEach(cb => cb(config));
|
2022-02-08 04:16:51 +08:00
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
get: function () {
|
2022-02-08 04:16:51 +08:00
|
|
|
return _config[key];
|
|
|
|
}
|
|
|
|
});
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2022-09-01 05:02:43 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// familyPrefix is deprecated as of 6.2.0 and should be removed in 7.0.0
|
2022-09-01 05:02:43 +08:00
|
|
|
Object.defineProperty(config, 'familyPrefix', {
|
|
|
|
enumerable: true,
|
2024-07-17 01:13:31 +08:00
|
|
|
set: function (val) {
|
2022-09-01 05:02:43 +08:00
|
|
|
_config.cssPrefix = val;
|
2024-07-17 01:13:31 +08:00
|
|
|
_onChangeCb.forEach(cb => cb(config));
|
2022-09-01 05:02:43 +08:00
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
get: function () {
|
2022-09-01 05:02:43 +08:00
|
|
|
return _config.cssPrefix;
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
WINDOW.FontAwesomeConfig = config;
|
2024-07-17 01:13:31 +08:00
|
|
|
const _onChangeCb = [];
|
2022-02-08 04:16:51 +08:00
|
|
|
function onChange(cb) {
|
|
|
|
_onChangeCb.push(cb);
|
2024-07-17 01:13:31 +08:00
|
|
|
return () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
_onChangeCb.splice(_onChangeCb.indexOf(cb), 1);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const d$2 = UNITS_IN_GRID;
|
|
|
|
const meaninglessTransform = {
|
2022-02-08 04:16:51 +08:00
|
|
|
size: 16,
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
rotate: 0,
|
|
|
|
flipX: false,
|
|
|
|
flipY: false
|
|
|
|
};
|
|
|
|
function bunker(fn) {
|
|
|
|
try {
|
|
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
|
|
args[_key - 1] = arguments[_key];
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
fn(...args);
|
2022-02-08 04:16:51 +08:00
|
|
|
} catch (e) {
|
|
|
|
if (!PRODUCTION) {
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function insertCss(css) {
|
|
|
|
if (!css || !IS_DOM) {
|
|
|
|
return;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const style = DOCUMENT.createElement('style');
|
2022-02-08 04:16:51 +08:00
|
|
|
style.setAttribute('type', 'text/css');
|
|
|
|
style.innerHTML = css;
|
2024-07-17 01:13:31 +08:00
|
|
|
const headChildren = DOCUMENT.head.childNodes;
|
|
|
|
let beforeChild = null;
|
|
|
|
for (let i = headChildren.length - 1; i > -1; i--) {
|
|
|
|
const child = headChildren[i];
|
|
|
|
const tagName = (child.tagName || '').toUpperCase();
|
2022-02-08 04:16:51 +08:00
|
|
|
if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
|
|
|
|
beforeChild = child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DOCUMENT.head.insertBefore(style, beforeChild);
|
|
|
|
return css;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
2022-02-08 04:16:51 +08:00
|
|
|
function nextUniqueId() {
|
2024-07-17 01:13:31 +08:00
|
|
|
let size = 12;
|
|
|
|
let id = '';
|
2022-02-08 04:16:51 +08:00
|
|
|
while (size-- > 0) {
|
|
|
|
id += idPool[Math.random() * 62 | 0];
|
|
|
|
}
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
function toArray(obj) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const array = [];
|
|
|
|
for (let i = (obj || []).length >>> 0; i--;) {
|
2022-02-08 04:16:51 +08:00
|
|
|
array[i] = obj[i];
|
|
|
|
}
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
function classArray(node) {
|
|
|
|
if (node.classList) {
|
|
|
|
return toArray(node.classList);
|
|
|
|
} else {
|
2024-07-17 01:13:31 +08:00
|
|
|
return (node.getAttribute('class') || '').split(' ').filter(i => i);
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function htmlEscape(str) {
|
|
|
|
return "".concat(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
|
|
|
|
}
|
|
|
|
function joinAttributes(attributes) {
|
2024-07-17 01:13:31 +08:00
|
|
|
return Object.keys(attributes || {}).reduce((acc, attributeName) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
|
|
|
|
}, '').trim();
|
|
|
|
}
|
|
|
|
function joinStyles(styles) {
|
2024-07-17 01:13:31 +08:00
|
|
|
return Object.keys(styles || {}).reduce((acc, styleName) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
return acc + "".concat(styleName, ": ").concat(styles[styleName].trim(), ";");
|
|
|
|
}, '');
|
|
|
|
}
|
|
|
|
function transformIsMeaningful(transform) {
|
|
|
|
return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
|
|
|
|
}
|
|
|
|
function transformForSvg(_ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
transform,
|
|
|
|
containerWidth,
|
|
|
|
iconWidth
|
|
|
|
} = _ref;
|
|
|
|
const outer = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "translate(".concat(containerWidth / 2, " 256)")
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
|
|
|
|
const innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
|
|
|
|
const innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
|
|
|
|
const inner = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const path = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
|
|
|
|
};
|
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
outer,
|
|
|
|
inner,
|
|
|
|
path
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
function transformForCss(_ref2) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
transform,
|
|
|
|
width = UNITS_IN_GRID,
|
|
|
|
height = UNITS_IN_GRID,
|
|
|
|
startCentered = false
|
|
|
|
} = _ref2;
|
|
|
|
let val = '';
|
2022-02-08 04:16:51 +08:00
|
|
|
if (startCentered && IS_IE) {
|
2024-07-17 01:13:31 +08:00
|
|
|
val += "translate(".concat(transform.x / d$2 - width / 2, "em, ").concat(transform.y / d$2 - height / 2, "em) ");
|
2022-02-08 04:16:51 +08:00
|
|
|
} else if (startCentered) {
|
2024-07-17 01:13:31 +08:00
|
|
|
val += "translate(calc(-50% + ".concat(transform.x / d$2, "em), calc(-50% + ").concat(transform.y / d$2, "em)) ");
|
2022-02-08 04:16:51 +08:00
|
|
|
} else {
|
2024-07-17 01:13:31 +08:00
|
|
|
val += "translate(".concat(transform.x / d$2, "em, ").concat(transform.y / d$2, "em) ");
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
val += "scale(".concat(transform.size / d$2 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d$2 * (transform.flipY ? -1 : 1), ") ");
|
2022-02-08 04:16:51 +08:00
|
|
|
val += "rotate(".concat(transform.rotate, "deg) ");
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
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)
|
2022-02-08 04:16:51 +08:00
|
|
|
|
|
|
|
function css() {
|
2024-07-17 01:13:31 +08:00
|
|
|
const dcp = DEFAULT_CSS_PREFIX;
|
|
|
|
const drc = DEFAULT_REPLACEMENT_CLASS;
|
|
|
|
const fp = config.cssPrefix;
|
|
|
|
const rc = config.replacementClass;
|
|
|
|
let s = baseStyles;
|
2022-09-01 05:02:43 +08:00
|
|
|
if (fp !== dcp || rc !== drc) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const dPatt = new RegExp("\\.".concat(dcp, "\\-"), 'g');
|
|
|
|
const customPropPatt = new RegExp("\\--".concat(dcp, "\\-"), 'g');
|
|
|
|
const rPatt = new RegExp("\\.".concat(drc), 'g');
|
2022-02-08 04:16:51 +08:00
|
|
|
s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
let _cssInserted = false;
|
2022-02-08 04:16:51 +08:00
|
|
|
function ensureCss() {
|
|
|
|
if (config.autoAddCss && !_cssInserted) {
|
|
|
|
insertCss(css());
|
|
|
|
_cssInserted = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var InjectCSS = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
dom: {
|
2024-07-17 01:13:31 +08:00
|
|
|
css,
|
2022-02-08 04:16:51 +08:00
|
|
|
insertCss: ensureCss
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
beforeDOMElementCreation() {
|
2022-02-08 04:16:51 +08:00
|
|
|
ensureCss();
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
beforeI2svg() {
|
2022-02-08 04:16:51 +08:00
|
|
|
ensureCss();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
const w = WINDOW || {};
|
|
|
|
if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
|
|
|
|
if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
|
|
|
|
if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
|
|
|
|
if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
|
|
|
|
var namespace = w[NAMESPACE_IDENTIFIER];
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const functions = [];
|
|
|
|
const listener = function () {
|
2022-02-08 04:16:51 +08:00
|
|
|
DOCUMENT.removeEventListener('DOMContentLoaded', listener);
|
|
|
|
loaded = 1;
|
2024-07-17 01:13:31 +08:00
|
|
|
functions.map(fn => fn());
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
let loaded = false;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (IS_DOM) {
|
|
|
|
loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
|
|
|
|
if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
|
|
|
|
}
|
|
|
|
function domready (fn) {
|
|
|
|
if (!IS_DOM) return;
|
|
|
|
loaded ? setTimeout(fn, 0) : functions.push(fn);
|
|
|
|
}
|
|
|
|
|
|
|
|
function toHtml(abstractNodes) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
tag,
|
|
|
|
attributes = {},
|
|
|
|
children = []
|
|
|
|
} = abstractNodes;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (typeof abstractNodes === 'string') {
|
|
|
|
return htmlEscape(abstractNodes);
|
|
|
|
} else {
|
|
|
|
return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function iconFromMapping(mapping, prefix, iconName) {
|
|
|
|
if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
|
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName,
|
2022-02-08 04:16:51 +08:00
|
|
|
icon: mapping[prefix][iconName]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal helper to bind a function known to have 4 arguments
|
|
|
|
* to a given context.
|
|
|
|
*/
|
|
|
|
var bindInternal4 = function bindInternal4(func, thisContext) {
|
|
|
|
return function (a, b, c, d) {
|
|
|
|
return func.call(thisContext, a, b, c, d);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* # Reduce
|
|
|
|
*
|
|
|
|
* A fast object `.reduce()` implementation.
|
|
|
|
*
|
|
|
|
* @param {Object} subject The object to reduce over.
|
|
|
|
* @param {Function} fn The reducer function.
|
|
|
|
* @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
|
|
|
|
* @param {Object} thisContext The context for the reducer.
|
|
|
|
* @return {mixed} The final result.
|
|
|
|
*/
|
|
|
|
var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
|
|
|
|
var keys = Object.keys(subject),
|
2024-11-19 05:38:46 +08:00
|
|
|
length = keys.length,
|
|
|
|
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
|
|
|
|
i,
|
|
|
|
key,
|
|
|
|
result;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (initialValue === undefined) {
|
|
|
|
i = 1;
|
|
|
|
result = subject[keys[0]];
|
|
|
|
} else {
|
|
|
|
i = 0;
|
|
|
|
result = initialValue;
|
|
|
|
}
|
|
|
|
for (; i < length; i++) {
|
|
|
|
key = keys[i];
|
|
|
|
result = iterator(result, subject[key], key, subject);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ucs2decode() and codePointAt() are both works of Mathias Bynens and licensed under MIT
|
|
|
|
*
|
|
|
|
* Copyright Mathias Bynens <https://mathiasbynens.be/>
|
|
|
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2024-11-19 05:38:46 +08:00
|
|
|
|
2022-02-08 04:16:51 +08:00
|
|
|
function ucs2decode(string) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const output = [];
|
|
|
|
let counter = 0;
|
|
|
|
const length = string.length;
|
2022-02-08 04:16:51 +08:00
|
|
|
while (counter < length) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const value = string.charCodeAt(counter++);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const extra = string.charCodeAt(counter++);
|
2022-02-08 04:16:51 +08:00
|
|
|
if ((extra & 0xFC00) == 0xDC00) {
|
|
|
|
// eslint-disable-line eqeqeq
|
|
|
|
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
|
|
} else {
|
|
|
|
output.push(value);
|
|
|
|
counter--;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
output.push(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
function toHex(unicode) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const decoded = ucs2decode(unicode);
|
2022-02-08 04:16:51 +08:00
|
|
|
return decoded.length === 1 ? decoded[0].toString(16) : null;
|
|
|
|
}
|
|
|
|
function codePointAt(string, index) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const size = string.length;
|
|
|
|
let first = string.charCodeAt(index);
|
|
|
|
let second;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
|
|
|
|
second = string.charCodeAt(index + 1);
|
|
|
|
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
|
|
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return first;
|
|
|
|
}
|
|
|
|
|
|
|
|
function normalizeIcons(icons) {
|
2024-07-17 01:13:31 +08:00
|
|
|
return Object.keys(icons).reduce((acc, iconName) => {
|
|
|
|
const icon = icons[iconName];
|
|
|
|
const expanded = !!icon.icon;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (expanded) {
|
|
|
|
acc[icon.iconName] = icon.icon;
|
|
|
|
} else {
|
|
|
|
acc[iconName] = icon;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
}
|
|
|
|
function defineIcons(prefix, icons) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
|
|
const {
|
|
|
|
skipHooks = false
|
|
|
|
} = params;
|
|
|
|
const normalized = normalizeIcons(icons);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
|
|
|
|
namespace.hooks.addPack(prefix, normalizeIcons(icons));
|
|
|
|
} else {
|
2024-11-19 05:38:46 +08:00
|
|
|
namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), normalized);
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
|
2022-02-08 04:16:51 +08:00
|
|
|
/**
|
|
|
|
* Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
|
|
|
|
* of new styles we needed to differentiate between them. Prefix `fa` is now an alias
|
|
|
|
* for `fas` so we'll ease the upgrade process for our users by automatically defining
|
|
|
|
* this as well.
|
|
|
|
*/
|
|
|
|
if (prefix === 'fas') {
|
|
|
|
defineIcons('fa', icons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
const duotonePathRe = [/*#__PURE__*/_wrapRegExp(/path d="([^"]+)".*path d="([^"]+)"/, {
|
|
|
|
d1: 1,
|
|
|
|
d2: 2
|
|
|
|
}), /*#__PURE__*/_wrapRegExp(/path class="([^"]+)".*d="([^"]+)".*path class="([^"]+)".*d="([^"]+)"/, {
|
|
|
|
cls1: 1,
|
|
|
|
d1: 2,
|
|
|
|
cls2: 3,
|
|
|
|
d2: 4
|
|
|
|
}), /*#__PURE__*/_wrapRegExp(/path class="([^"]+)".*d="([^"]+)"/, {
|
|
|
|
cls1: 1,
|
|
|
|
d1: 2
|
|
|
|
})];
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
styles,
|
|
|
|
shims
|
|
|
|
} = namespace;
|
2024-11-19 05:38:46 +08:00
|
|
|
const FAMILY_NAMES = Object.keys(PREFIX_TO_LONG_STYLE);
|
|
|
|
const PREFIXES_FOR_FAMILY = FAMILY_NAMES.reduce((acc, familyId) => {
|
|
|
|
acc[familyId] = Object.keys(PREFIX_TO_LONG_STYLE[familyId]);
|
|
|
|
return acc;
|
|
|
|
}, {});
|
2024-07-17 01:13:31 +08:00
|
|
|
let _defaultUsablePrefix = null;
|
|
|
|
let _byUnicode = {};
|
|
|
|
let _byLigature = {};
|
|
|
|
let _byOldName = {};
|
|
|
|
let _byOldUnicode = {};
|
|
|
|
let _byAlias = {};
|
2022-02-08 04:16:51 +08:00
|
|
|
function isReserved(name) {
|
|
|
|
return ~RESERVED_CLASSES.indexOf(name);
|
|
|
|
}
|
2022-09-01 05:02:43 +08:00
|
|
|
function getIconName(cssPrefix, cls) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const parts = cls.split('-');
|
|
|
|
const prefix = parts[0];
|
|
|
|
const iconName = parts.slice(1).join('-');
|
2022-09-01 05:02:43 +08:00
|
|
|
if (prefix === cssPrefix && iconName !== '' && !isReserved(iconName)) {
|
2022-02-08 04:16:51 +08:00
|
|
|
return iconName;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const build = () => {
|
|
|
|
const lookup = reducer => {
|
|
|
|
return reduce(styles, (o$$1, style, prefix) => {
|
|
|
|
o$$1[prefix] = reduce(style, reducer, {});
|
|
|
|
return o$$1;
|
2022-02-08 04:16:51 +08:00
|
|
|
}, {});
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
_byUnicode = lookup((acc, icon, iconName) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (icon[3]) {
|
|
|
|
acc[icon[3]] = iconName;
|
|
|
|
}
|
|
|
|
if (icon[2]) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const aliases = icon[2].filter(a$$1 => {
|
|
|
|
return typeof a$$1 === 'number';
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
aliases.forEach(alias => {
|
2022-02-08 04:16:51 +08:00
|
|
|
acc[alias.toString(16)] = iconName;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
_byLigature = lookup((acc, icon, iconName) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
acc[iconName] = iconName;
|
|
|
|
if (icon[2]) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const aliases = icon[2].filter(a$$1 => {
|
|
|
|
return typeof a$$1 === 'string';
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
aliases.forEach(alias => {
|
2022-02-08 04:16:51 +08:00
|
|
|
acc[alias] = iconName;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
_byAlias = lookup((acc, icon, iconName) => {
|
|
|
|
const aliases = icon[2];
|
2022-02-08 04:16:51 +08:00
|
|
|
acc[iconName] = iconName;
|
2024-07-17 01:13:31 +08:00
|
|
|
aliases.forEach(alias => {
|
2022-02-08 04:16:51 +08:00
|
|
|
acc[alias] = iconName;
|
|
|
|
});
|
|
|
|
return acc;
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// If we have a Kit, we can't determine if regular is available since we
|
|
|
|
// could be auto-fetching it. We'll have to assume that it is available.
|
2024-07-17 01:13:31 +08:00
|
|
|
const hasRegular = 'far' in styles || config.autoFetchSvg;
|
|
|
|
const shimLookups = reduce(shims, (acc, shim) => {
|
|
|
|
const maybeNameMaybeUnicode = shim[0];
|
|
|
|
let prefix = shim[1];
|
|
|
|
const iconName = shim[2];
|
2022-02-08 04:16:51 +08:00
|
|
|
if (prefix === 'far' && !hasRegular) {
|
|
|
|
prefix = 'fas';
|
|
|
|
}
|
|
|
|
if (typeof maybeNameMaybeUnicode === 'string') {
|
|
|
|
acc.names[maybeNameMaybeUnicode] = {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (typeof maybeNameMaybeUnicode === 'number') {
|
|
|
|
acc.unicodes[maybeNameMaybeUnicode.toString(16)] = {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, {
|
|
|
|
names: {},
|
|
|
|
unicodes: {}
|
|
|
|
});
|
|
|
|
_byOldName = shimLookups.names;
|
|
|
|
_byOldUnicode = shimLookups.unicodes;
|
2022-09-01 05:02:43 +08:00
|
|
|
_defaultUsablePrefix = getCanonicalPrefix(config.styleDefault, {
|
|
|
|
family: config.familyDefault
|
|
|
|
});
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
onChange(c$$1 => {
|
|
|
|
_defaultUsablePrefix = getCanonicalPrefix(c$$1.styleDefault, {
|
2022-09-01 05:02:43 +08:00
|
|
|
family: config.familyDefault
|
|
|
|
});
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
build();
|
|
|
|
function byUnicode(prefix, unicode) {
|
|
|
|
return (_byUnicode[prefix] || {})[unicode];
|
|
|
|
}
|
|
|
|
function byLigature(prefix, ligature) {
|
|
|
|
return (_byLigature[prefix] || {})[ligature];
|
|
|
|
}
|
|
|
|
function byAlias(prefix, alias) {
|
|
|
|
return (_byAlias[prefix] || {})[alias];
|
|
|
|
}
|
|
|
|
function byOldName(name) {
|
|
|
|
return _byOldName[name] || {
|
|
|
|
prefix: null,
|
|
|
|
iconName: null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
function byOldUnicode(unicode) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const oldUnicode = _byOldUnicode[unicode];
|
|
|
|
const newUnicode = byUnicode('fas', unicode);
|
2022-02-08 04:16:51 +08:00
|
|
|
return oldUnicode || (newUnicode ? {
|
|
|
|
prefix: 'fas',
|
|
|
|
iconName: newUnicode
|
|
|
|
} : null) || {
|
|
|
|
prefix: null,
|
|
|
|
iconName: null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
function getDefaultUsablePrefix() {
|
|
|
|
return _defaultUsablePrefix;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const emptyCanonicalIcon = () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
prefix: null,
|
|
|
|
iconName: null,
|
|
|
|
rest: []
|
|
|
|
};
|
|
|
|
};
|
2024-11-19 05:38:46 +08:00
|
|
|
function getFamilyId(values) {
|
|
|
|
let family = s;
|
|
|
|
const famProps = FAMILY_NAMES.reduce((acc, familyId) => {
|
|
|
|
acc[familyId] = "".concat(config.cssPrefix, "-").concat(familyId);
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
L.forEach(familyId => {
|
|
|
|
if (values.includes(famProps[familyId]) || values.some(v$$1 => PREFIXES_FOR_FAMILY[familyId].includes(v$$1))) {
|
|
|
|
family = familyId;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return family;
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
function getCanonicalPrefix(styleOrPrefix) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
2024-11-19 05:38:46 +08:00
|
|
|
family = s
|
2024-07-17 01:13:31 +08:00
|
|
|
} = params;
|
|
|
|
const style = PREFIX_TO_STYLE[family][styleOrPrefix];
|
2024-11-19 05:38:46 +08:00
|
|
|
|
|
|
|
// handles the exception of passing in only a family of 'duotone' with no style
|
|
|
|
if (family === t && !styleOrPrefix) {
|
|
|
|
return 'fad';
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const prefix = STYLE_TO_PREFIX[family][styleOrPrefix] || STYLE_TO_PREFIX[family][style];
|
|
|
|
const defined = styleOrPrefix in namespace.styles ? styleOrPrefix : null;
|
|
|
|
const result = prefix || defined || null;
|
|
|
|
return result;
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
function moveNonFaClassesToRest(classNames) {
|
|
|
|
let rest = [];
|
|
|
|
let iconName = null;
|
|
|
|
classNames.forEach(cls => {
|
|
|
|
const result = getIconName(config.cssPrefix, cls);
|
|
|
|
if (result) {
|
|
|
|
iconName = result;
|
|
|
|
} else if (cls) {
|
|
|
|
rest.push(cls);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
iconName,
|
|
|
|
rest
|
|
|
|
};
|
|
|
|
}
|
|
|
|
function sortedUniqueValues(arr) {
|
|
|
|
return arr.sort().filter((value, index, arr) => {
|
|
|
|
return arr.indexOf(value) === index;
|
|
|
|
});
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
function getCanonicalIcon(values) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
skipLookups = false
|
|
|
|
} = params;
|
|
|
|
let givenPrefix = null;
|
2024-12-17 01:25:57 +08:00
|
|
|
const faCombinedClasses = Ia.concat(bt$1);
|
2024-11-19 05:38:46 +08:00
|
|
|
const faStyleOrFamilyClasses = sortedUniqueValues(values.filter(cls => faCombinedClasses.includes(cls)));
|
2024-12-17 01:25:57 +08:00
|
|
|
const nonStyleOrFamilyClasses = sortedUniqueValues(values.filter(cls => !Ia.includes(cls)));
|
2024-11-19 05:38:46 +08:00
|
|
|
const faStyles = faStyleOrFamilyClasses.filter(cls => {
|
|
|
|
givenPrefix = cls;
|
|
|
|
return !P.includes(cls);
|
2024-07-17 01:13:31 +08:00
|
|
|
});
|
2024-11-19 05:38:46 +08:00
|
|
|
const [styleFromValues = null] = faStyles;
|
|
|
|
const family = getFamilyId(faStyleOrFamilyClasses);
|
|
|
|
const canonical = _objectSpread2(_objectSpread2({}, moveNonFaClassesToRest(nonStyleOrFamilyClasses)), {}, {
|
|
|
|
prefix: getCanonicalPrefix(styleFromValues, {
|
|
|
|
family
|
|
|
|
})
|
|
|
|
});
|
|
|
|
return _objectSpread2(_objectSpread2(_objectSpread2({}, canonical), getDefaultCanonicalPrefix({
|
|
|
|
values,
|
|
|
|
family,
|
|
|
|
styles,
|
|
|
|
config,
|
|
|
|
canonical,
|
|
|
|
givenPrefix
|
|
|
|
})), applyShimAndAlias(skipLookups, givenPrefix, canonical));
|
|
|
|
}
|
|
|
|
function applyShimAndAlias(skipLookups, givenPrefix, canonical) {
|
|
|
|
let {
|
|
|
|
prefix,
|
|
|
|
iconName
|
|
|
|
} = canonical;
|
|
|
|
if (skipLookups || !prefix || !iconName) {
|
|
|
|
return {
|
|
|
|
prefix,
|
|
|
|
iconName
|
|
|
|
};
|
2022-09-01 05:02:43 +08:00
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
const shim = givenPrefix === 'fa' ? byOldName(iconName) : {};
|
|
|
|
const aliasIconName = byAlias(prefix, iconName);
|
|
|
|
iconName = shim.iconName || aliasIconName || iconName;
|
|
|
|
prefix = shim.prefix || prefix;
|
|
|
|
if (prefix === 'far' && !styles['far'] && styles['fas'] && !config.autoFetchSvg) {
|
|
|
|
// Allow a fallback from the regular style to solid if regular is not available
|
|
|
|
// but only if we aren't auto-fetching SVGs
|
|
|
|
prefix = 'fas';
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
prefix,
|
|
|
|
iconName
|
|
|
|
};
|
|
|
|
}
|
|
|
|
const newCanonicalFamilies = L.filter(familyId => {
|
|
|
|
return familyId !== s || familyId !== t;
|
|
|
|
});
|
2024-12-17 01:25:57 +08:00
|
|
|
const newCanonicalStyles = Object.keys(ga).filter(key => key !== s).map(key => Object.keys(ga[key])).flat();
|
2024-11-19 05:38:46 +08:00
|
|
|
function getDefaultCanonicalPrefix(prefixOptions) {
|
|
|
|
const {
|
|
|
|
values,
|
|
|
|
family,
|
|
|
|
canonical,
|
|
|
|
givenPrefix = '',
|
|
|
|
styles = {},
|
|
|
|
config: config$$1 = {}
|
|
|
|
} = prefixOptions;
|
|
|
|
const isDuotoneFamily = family === t;
|
|
|
|
const valuesHasDuotone = values.includes('fa-duotone') || values.includes('fad');
|
|
|
|
const defaultFamilyIsDuotone = config$$1.familyDefault === 'duotone';
|
|
|
|
const canonicalPrefixIsDuotone = canonical.prefix === 'fad' || canonical.prefix === 'fa-duotone';
|
|
|
|
if (!isDuotoneFamily && (valuesHasDuotone || defaultFamilyIsDuotone || canonicalPrefixIsDuotone)) {
|
2022-09-01 05:02:43 +08:00
|
|
|
canonical.prefix = 'fad';
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
if (values.includes('fa-brands') || values.includes('fab')) {
|
|
|
|
canonical.prefix = 'fab';
|
2022-09-01 05:02:43 +08:00
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
if (!canonical.prefix && newCanonicalFamilies.includes(family)) {
|
|
|
|
const validPrefix = Object.keys(styles).find(key => newCanonicalStyles.includes(key));
|
|
|
|
if (validPrefix || config$$1.autoFetchSvg) {
|
|
|
|
const defaultPrefix = pt.get(family).defaultShortPrefixId;
|
|
|
|
canonical.prefix = defaultPrefix;
|
|
|
|
canonical.iconName = byAlias(canonical.prefix, canonical.iconName) || canonical.iconName;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
if (canonical.prefix === 'fa' || givenPrefix === 'fa') {
|
|
|
|
// The fa prefix is not canonical. So if it has made it through until this point
|
|
|
|
// we will shift it to the correct prefix.
|
|
|
|
canonical.prefix = getDefaultUsablePrefix() || 'fas';
|
|
|
|
}
|
|
|
|
return canonical;
|
|
|
|
}
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
class Library {
|
|
|
|
constructor() {
|
2022-02-08 04:16:51 +08:00
|
|
|
this.definitions = {};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
add() {
|
|
|
|
for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
|
|
definitions[_key] = arguments[_key];
|
|
|
|
}
|
|
|
|
const additions = definitions.reduce(this._pullDefinitions, {});
|
|
|
|
Object.keys(additions).forEach(key => {
|
2024-11-19 05:38:46 +08:00
|
|
|
this.definitions[key] = _objectSpread2(_objectSpread2({}, this.definitions[key] || {}), additions[key]);
|
|
|
|
defineIcons(key, additions[key]);
|
2024-07-17 01:13:31 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// TODO can we stop doing this? We can't get the icons by 'fa-solid' any longer so this probably needs to change
|
|
|
|
const longPrefix = PREFIX_TO_LONG_STYLE[s][key];
|
2024-07-17 01:13:31 +08:00
|
|
|
if (longPrefix) defineIcons(longPrefix, additions[key]);
|
|
|
|
build();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
reset() {
|
|
|
|
this.definitions = {};
|
|
|
|
}
|
|
|
|
_pullDefinitions(additions, definition) {
|
|
|
|
const normalized = definition.prefix && definition.iconName && definition.icon ? {
|
|
|
|
0: definition
|
|
|
|
} : definition;
|
|
|
|
Object.keys(normalized).map(key => {
|
|
|
|
const {
|
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
icon
|
|
|
|
} = normalized[key];
|
|
|
|
const aliases = icon[2];
|
|
|
|
if (!additions[prefix]) additions[prefix] = {};
|
|
|
|
if (aliases.length > 0) {
|
|
|
|
aliases.forEach(alias => {
|
|
|
|
if (typeof alias === 'string') {
|
|
|
|
additions[prefix][alias] = icon;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
additions[prefix][iconName] = icon;
|
|
|
|
});
|
|
|
|
return additions;
|
|
|
|
}
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
let _plugins = [];
|
|
|
|
let _hooks = {};
|
|
|
|
const providers = {};
|
|
|
|
const defaultProviderKeys = Object.keys(providers);
|
2022-02-08 04:16:51 +08:00
|
|
|
function registerPlugins(nextPlugins, _ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
mixoutsTo: obj
|
|
|
|
} = _ref;
|
2022-02-08 04:16:51 +08:00
|
|
|
_plugins = nextPlugins;
|
|
|
|
_hooks = {};
|
2024-07-17 01:13:31 +08:00
|
|
|
Object.keys(providers).forEach(k => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (defaultProviderKeys.indexOf(k) === -1) {
|
|
|
|
delete providers[k];
|
|
|
|
}
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
_plugins.forEach(plugin => {
|
|
|
|
const mixout = plugin.mixout ? plugin.mixout() : {};
|
|
|
|
Object.keys(mixout).forEach(tk => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (typeof mixout[tk] === 'function') {
|
|
|
|
obj[tk] = mixout[tk];
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
if (typeof mixout[tk] === 'object') {
|
|
|
|
Object.keys(mixout[tk]).forEach(sk => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!obj[tk]) {
|
|
|
|
obj[tk] = {};
|
|
|
|
}
|
|
|
|
obj[tk][sk] = mixout[tk][sk];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (plugin.hooks) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const hooks = plugin.hooks();
|
|
|
|
Object.keys(hooks).forEach(hook => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!_hooks[hook]) {
|
|
|
|
_hooks[hook] = [];
|
|
|
|
}
|
|
|
|
_hooks[hook].push(hooks[hook]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (plugin.provides) {
|
|
|
|
plugin.provides(providers);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
function chainHooks(hook, accumulator) {
|
|
|
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
|
|
args[_key - 2] = arguments[_key];
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const hookFns = _hooks[hook] || [];
|
|
|
|
hookFns.forEach(hookFn => {
|
|
|
|
accumulator = hookFn.apply(null, [accumulator, ...args]); // eslint-disable-line no-useless-call
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
function callHooks(hook) {
|
|
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
|
|
args[_key2 - 1] = arguments[_key2];
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const hookFns = _hooks[hook] || [];
|
|
|
|
hookFns.forEach(hookFn => {
|
2022-02-08 04:16:51 +08:00
|
|
|
hookFn.apply(null, args);
|
|
|
|
});
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
function callProvided() {
|
2024-07-17 01:13:31 +08:00
|
|
|
const hook = arguments[0];
|
|
|
|
const args = Array.prototype.slice.call(arguments, 1);
|
2022-02-08 04:16:51 +08:00
|
|
|
return providers[hook] ? providers[hook].apply(null, args) : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
function findIconDefinition(iconLookup) {
|
|
|
|
if (iconLookup.prefix === 'fa') {
|
|
|
|
iconLookup.prefix = 'fas';
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
iconName
|
|
|
|
} = iconLookup;
|
|
|
|
const prefix = iconLookup.prefix || getDefaultUsablePrefix();
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!iconName) return;
|
|
|
|
iconName = byAlias(prefix, iconName) || iconName;
|
|
|
|
return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const library = new Library();
|
|
|
|
const noAuto = () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
config.autoReplaceSvg = false;
|
|
|
|
config.observeMutations = false;
|
|
|
|
callHooks('noAuto');
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const dom = {
|
|
|
|
i2svg: function () {
|
|
|
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
2022-02-08 04:16:51 +08:00
|
|
|
if (IS_DOM) {
|
|
|
|
callHooks('beforeI2svg', params);
|
|
|
|
callProvided('pseudoElements2svg', params);
|
|
|
|
return callProvided('i2svg', params);
|
|
|
|
} else {
|
2024-07-17 01:13:31 +08:00
|
|
|
return Promise.reject(new Error('Operation requires a DOM of some kind.'));
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
watch: function () {
|
|
|
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
const {
|
|
|
|
autoReplaceSvgRoot
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (config.autoReplaceSvg === false) {
|
|
|
|
config.autoReplaceSvg = true;
|
|
|
|
}
|
|
|
|
config.observeMutations = true;
|
2024-07-17 01:13:31 +08:00
|
|
|
domready(() => {
|
2022-02-08 04:16:51 +08:00
|
|
|
autoReplace({
|
2024-07-17 01:13:31 +08:00
|
|
|
autoReplaceSvgRoot
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
callHooks('watch', params);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const parse = {
|
|
|
|
icon: icon => {
|
|
|
|
if (icon === null) {
|
2022-02-08 04:16:51 +08:00
|
|
|
return null;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
if (typeof icon === 'object' && icon.prefix && icon.iconName) {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix: icon.prefix,
|
|
|
|
iconName: byAlias(icon.prefix, icon.iconName) || icon.iconName
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
if (Array.isArray(icon) && icon.length === 2) {
|
|
|
|
const iconName = icon[1].indexOf('fa-') === 0 ? icon[1].slice(3) : icon[1];
|
|
|
|
const prefix = getCanonicalPrefix(icon[0]);
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
2022-02-08 04:16:51 +08:00
|
|
|
iconName: byAlias(prefix, iconName) || iconName
|
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
if (typeof icon === 'string' && (icon.indexOf("".concat(config.cssPrefix, "-")) > -1 || icon.match(ICON_SELECTION_SYNTAX_PATTERN))) {
|
|
|
|
const canonicalIcon = getCanonicalIcon(icon.split(' '), {
|
2022-02-08 04:16:51 +08:00
|
|
|
skipLookups: true
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
prefix: canonicalIcon.prefix || getDefaultUsablePrefix(),
|
|
|
|
iconName: byAlias(canonicalIcon.prefix, canonicalIcon.iconName) || canonicalIcon.iconName
|
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
if (typeof icon === 'string') {
|
|
|
|
const prefix = getDefaultUsablePrefix();
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName: byAlias(prefix, icon) || icon
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const api = {
|
|
|
|
noAuto,
|
|
|
|
config,
|
|
|
|
dom,
|
|
|
|
parse,
|
|
|
|
library,
|
|
|
|
findIconDefinition,
|
|
|
|
toHtml
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const autoReplace = function () {
|
|
|
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
const {
|
|
|
|
autoReplaceSvgRoot = DOCUMENT
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
|
|
|
|
node: autoReplaceSvgRoot
|
|
|
|
});
|
|
|
|
};
|
|
|
|
function bootstrap(plugins) {
|
|
|
|
if (IS_BROWSER) {
|
|
|
|
if (!WINDOW.FontAwesome) {
|
|
|
|
WINDOW.FontAwesome = api;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
domready(() => {
|
2022-02-08 04:16:51 +08:00
|
|
|
autoReplace();
|
|
|
|
callHooks('bootstrap');
|
|
|
|
});
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
namespace.hooks = _objectSpread2(_objectSpread2({}, namespace.hooks), {}, {
|
2024-07-17 01:13:31 +08:00
|
|
|
addPack: (prefix, icons) => {
|
2024-11-19 05:38:46 +08:00
|
|
|
namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), icons);
|
2022-02-08 04:16:51 +08:00
|
|
|
build();
|
|
|
|
autoReplace();
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
addPacks: packs => {
|
|
|
|
packs.forEach(_ref => {
|
|
|
|
let [prefix, icons] = _ref;
|
2024-11-19 05:38:46 +08:00
|
|
|
namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), icons);
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
build();
|
|
|
|
autoReplace();
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
addShims: shims => {
|
|
|
|
namespace.shims.push(...shims);
|
2022-02-08 04:16:51 +08:00
|
|
|
build();
|
|
|
|
autoReplace();
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function domVariants(val, abstractCreator) {
|
|
|
|
Object.defineProperty(val, 'abstract', {
|
|
|
|
get: abstractCreator
|
|
|
|
});
|
|
|
|
Object.defineProperty(val, 'html', {
|
2024-07-17 01:13:31 +08:00
|
|
|
get: function () {
|
|
|
|
return val.abstract.map(a => toHtml(a));
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
Object.defineProperty(val, 'node', {
|
2024-07-17 01:13:31 +08:00
|
|
|
get: function () {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!IS_DOM) return;
|
2024-07-17 01:13:31 +08:00
|
|
|
const container = DOCUMENT.createElement('div');
|
2022-02-08 04:16:51 +08:00
|
|
|
container.innerHTML = val.html;
|
|
|
|
return container.children;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
function asIcon (_ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
children,
|
|
|
|
main,
|
|
|
|
mask,
|
|
|
|
attributes,
|
|
|
|
styles,
|
|
|
|
transform
|
|
|
|
} = _ref;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (transformIsMeaningful(transform) && main.found && !mask.found) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
width,
|
|
|
|
height
|
|
|
|
} = main;
|
|
|
|
const offset = {
|
2022-02-08 04:16:51 +08:00
|
|
|
x: width / height / 2,
|
|
|
|
y: 0.5
|
|
|
|
};
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes['style'] = joinStyles(_objectSpread2(_objectSpread2({}, styles), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
|
2024-11-19 05:38:46 +08:00
|
|
|
}));
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
return [{
|
|
|
|
tag: 'svg',
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
|
|
|
children
|
2022-02-08 04:16:51 +08:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
function asSymbol (_ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
children,
|
|
|
|
attributes,
|
|
|
|
symbol
|
|
|
|
} = _ref;
|
|
|
|
const id = symbol === true ? "".concat(prefix, "-").concat(config.cssPrefix, "-").concat(iconName) : symbol;
|
2022-02-08 04:16:51 +08:00
|
|
|
return [{
|
|
|
|
tag: 'svg',
|
|
|
|
attributes: {
|
|
|
|
style: 'display: none;'
|
|
|
|
},
|
|
|
|
children: [{
|
|
|
|
tag: 'symbol',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, attributes), {}, {
|
2024-07-17 01:13:31 +08:00
|
|
|
id
|
2024-11-19 05:38:46 +08:00
|
|
|
}),
|
2024-07-17 01:13:31 +08:00
|
|
|
children
|
2022-02-08 04:16:51 +08:00
|
|
|
}]
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
function makeInlineSvgAbstract(params) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
icons: {
|
|
|
|
main,
|
|
|
|
mask
|
|
|
|
},
|
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
transform,
|
|
|
|
symbol,
|
|
|
|
title,
|
|
|
|
maskId,
|
|
|
|
titleId,
|
|
|
|
extra,
|
|
|
|
watchable = false
|
|
|
|
} = params;
|
|
|
|
const {
|
|
|
|
width,
|
|
|
|
height
|
|
|
|
} = mask.found ? mask : main;
|
2024-11-19 05:38:46 +08:00
|
|
|
const isUploadedIcon = Lt.includes(prefix);
|
|
|
|
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(' ');
|
2024-07-17 01:13:31 +08:00
|
|
|
let content = {
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [],
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, extra.attributes), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
'data-prefix': prefix,
|
|
|
|
'data-icon': iconName,
|
|
|
|
'class': attrClass,
|
|
|
|
'role': extra.attributes.role || 'img',
|
|
|
|
'xmlns': 'http://www.w3.org/2000/svg',
|
|
|
|
'viewBox': "0 0 ".concat(width, " ").concat(height)
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const uploadedIconWidthStyle = isUploadedIcon && !~extra.classes.indexOf('fa-fw') ? {
|
2022-02-08 04:16:51 +08:00
|
|
|
width: "".concat(width / height * 16 * 0.0625, "em")
|
|
|
|
} : {};
|
|
|
|
if (watchable) {
|
|
|
|
content.attributes[DATA_FA_I2SVG] = '';
|
|
|
|
}
|
|
|
|
if (title) {
|
|
|
|
content.children.push({
|
|
|
|
tag: 'title',
|
|
|
|
attributes: {
|
|
|
|
id: content.attributes['aria-labelledby'] || "title-".concat(titleId || nextUniqueId())
|
|
|
|
},
|
|
|
|
children: [title]
|
|
|
|
});
|
|
|
|
delete content.attributes.title;
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
const args = _objectSpread2(_objectSpread2({}, content), {}, {
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
main,
|
|
|
|
mask,
|
|
|
|
maskId,
|
|
|
|
transform,
|
|
|
|
symbol,
|
2024-11-19 05:38:46 +08:00
|
|
|
styles: _objectSpread2(_objectSpread2({}, uploadedIconWidthStyle), extra.styles)
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
children,
|
|
|
|
attributes
|
|
|
|
} = mask.found && main.found ? callProvided('generateAbstractMask', args) || {
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [],
|
|
|
|
attributes: {}
|
|
|
|
} : callProvided('generateAbstractIcon', args) || {
|
|
|
|
children: [],
|
|
|
|
attributes: {}
|
2024-07-17 01:13:31 +08:00
|
|
|
};
|
2022-02-08 04:16:51 +08:00
|
|
|
args.children = children;
|
|
|
|
args.attributes = attributes;
|
|
|
|
if (symbol) {
|
|
|
|
return asSymbol(args);
|
|
|
|
} else {
|
|
|
|
return asIcon(args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function makeLayersTextAbstract(params) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
content,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
transform,
|
|
|
|
title,
|
|
|
|
extra,
|
|
|
|
watchable = false
|
|
|
|
} = params;
|
2024-11-19 05:38:46 +08:00
|
|
|
const attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
|
|
|
|
'title': title
|
|
|
|
} : {}), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
'class': extra.classes.join(' ')
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2022-02-08 04:16:51 +08:00
|
|
|
if (watchable) {
|
|
|
|
attributes[DATA_FA_I2SVG] = '';
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
const styles = _objectSpread2({}, extra.styles);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (transformIsMeaningful(transform)) {
|
|
|
|
styles['transform'] = transformForCss({
|
2024-07-17 01:13:31 +08:00
|
|
|
transform,
|
2022-02-08 04:16:51 +08:00
|
|
|
startCentered: true,
|
2024-07-17 01:13:31 +08:00
|
|
|
width,
|
|
|
|
height
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
styles['-webkit-transform'] = styles['transform'];
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const styleString = joinStyles(styles);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (styleString.length > 0) {
|
|
|
|
attributes['style'] = styleString;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const val = [];
|
2022-02-08 04:16:51 +08:00
|
|
|
val.push({
|
|
|
|
tag: 'span',
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [content]
|
|
|
|
});
|
|
|
|
if (title) {
|
|
|
|
val.push({
|
|
|
|
tag: 'span',
|
|
|
|
attributes: {
|
|
|
|
class: 'sr-only'
|
|
|
|
},
|
|
|
|
children: [title]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
function makeLayersCounterAbstract(params) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
content,
|
|
|
|
title,
|
|
|
|
extra
|
|
|
|
} = params;
|
2024-11-19 05:38:46 +08:00
|
|
|
const attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
|
|
|
|
'title': title
|
|
|
|
} : {}), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
'class': extra.classes.join(' ')
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
const styleString = joinStyles(extra.styles);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (styleString.length > 0) {
|
|
|
|
attributes['style'] = styleString;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const val = [];
|
2022-02-08 04:16:51 +08:00
|
|
|
val.push({
|
|
|
|
tag: 'span',
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [content]
|
|
|
|
});
|
|
|
|
if (title) {
|
|
|
|
val.push({
|
|
|
|
tag: 'span',
|
|
|
|
attributes: {
|
|
|
|
class: 'sr-only'
|
|
|
|
},
|
|
|
|
children: [title]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
styles: styles$1
|
|
|
|
} = namespace;
|
2022-02-08 04:16:51 +08:00
|
|
|
function asFoundIcon(icon) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const width = icon[0];
|
|
|
|
const height = icon[1];
|
|
|
|
const [vectorData] = icon.slice(4);
|
|
|
|
let element = null;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (Array.isArray(vectorData)) {
|
|
|
|
element = {
|
|
|
|
tag: 'g',
|
|
|
|
attributes: {
|
2022-09-01 05:02:43 +08:00
|
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
|
2022-02-08 04:16:51 +08:00
|
|
|
},
|
|
|
|
children: [{
|
|
|
|
tag: 'path',
|
|
|
|
attributes: {
|
2022-09-01 05:02:43 +08:00
|
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
|
2022-02-08 04:16:51 +08:00
|
|
|
fill: 'currentColor',
|
|
|
|
d: vectorData[0]
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
tag: 'path',
|
|
|
|
attributes: {
|
2022-09-01 05:02:43 +08:00
|
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
|
2022-02-08 04:16:51 +08:00
|
|
|
fill: 'currentColor',
|
|
|
|
d: vectorData[1]
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
element = {
|
|
|
|
tag: 'path',
|
|
|
|
attributes: {
|
|
|
|
fill: 'currentColor',
|
|
|
|
d: vectorData
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
found: true,
|
2024-07-17 01:13:31 +08:00
|
|
|
width,
|
|
|
|
height,
|
2022-02-08 04:16:51 +08:00
|
|
|
icon: element
|
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const missingIconResolutionMixin = {
|
2022-02-08 04:16:51 +08:00
|
|
|
found: false,
|
|
|
|
width: 512,
|
|
|
|
height: 512
|
|
|
|
};
|
|
|
|
function maybeNotifyMissing(iconName, prefix) {
|
|
|
|
if (!PRODUCTION && !config.showMissingIcons && iconName) {
|
|
|
|
console.error("Icon with name \"".concat(iconName, "\" and prefix \"").concat(prefix, "\" is missing."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function findIcon(iconName, prefix) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let givenPrefix = prefix;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (prefix === 'fa' && config.styleDefault !== null) {
|
|
|
|
prefix = getDefaultUsablePrefix();
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
return new Promise((resolve, reject) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (givenPrefix === 'fa') {
|
2024-07-17 01:13:31 +08:00
|
|
|
const shim = byOldName(iconName) || {};
|
2022-02-08 04:16:51 +08:00
|
|
|
iconName = shim.iconName || iconName;
|
|
|
|
prefix = shim.prefix || prefix;
|
|
|
|
}
|
|
|
|
if (iconName && prefix && styles$1[prefix] && styles$1[prefix][iconName]) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const icon = styles$1[prefix][iconName];
|
2022-02-08 04:16:51 +08:00
|
|
|
return resolve(asFoundIcon(icon));
|
|
|
|
}
|
|
|
|
maybeNotifyMissing(iconName, prefix);
|
2024-11-19 05:38:46 +08:00
|
|
|
resolve(_objectSpread2(_objectSpread2({}, missingIconResolutionMixin), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
icon: config.showMissingIcons && iconName ? callProvided('missingIconAbstract') || {} : {}
|
2024-11-19 05:38:46 +08:00
|
|
|
}));
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const noop$1 = () => {};
|
|
|
|
const p$2 = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
|
2022-02-08 04:16:51 +08:00
|
|
|
mark: noop$1,
|
|
|
|
measure: noop$1
|
|
|
|
};
|
2024-12-17 01:25:57 +08:00
|
|
|
const preamble = "FA \"6.7.2\"";
|
2024-07-17 01:13:31 +08:00
|
|
|
const begin = name => {
|
|
|
|
p$2.mark("".concat(preamble, " ").concat(name, " begins"));
|
|
|
|
return () => end(name);
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const end = name => {
|
|
|
|
p$2.mark("".concat(preamble, " ").concat(name, " ends"));
|
|
|
|
p$2.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
var perf = {
|
2024-07-17 01:13:31 +08:00
|
|
|
begin,
|
|
|
|
end
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const noop$2 = () => {};
|
2022-02-08 04:16:51 +08:00
|
|
|
function isWatched(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
|
2022-02-08 04:16:51 +08:00
|
|
|
return typeof i2svg === 'string';
|
|
|
|
}
|
|
|
|
function hasPrefixAndIcon(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const prefix = node.getAttribute ? node.getAttribute(DATA_PREFIX) : null;
|
|
|
|
const icon = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
|
2022-02-08 04:16:51 +08:00
|
|
|
return prefix && icon;
|
|
|
|
}
|
|
|
|
function hasBeenReplaced(node) {
|
|
|
|
return node && node.classList && node.classList.contains && node.classList.contains(config.replacementClass);
|
|
|
|
}
|
|
|
|
function getMutator() {
|
|
|
|
if (config.autoReplaceSvg === true) {
|
|
|
|
return mutators.replace;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const mutator = mutators[config.autoReplaceSvg];
|
2022-02-08 04:16:51 +08:00
|
|
|
return mutator || mutators.replace;
|
|
|
|
}
|
|
|
|
function createElementNS(tag) {
|
|
|
|
return DOCUMENT.createElementNS('http://www.w3.org/2000/svg', tag);
|
|
|
|
}
|
|
|
|
function createElement(tag) {
|
|
|
|
return DOCUMENT.createElement(tag);
|
|
|
|
}
|
|
|
|
function convertSVG(abstractObj) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
ceFn = abstractObj.tag === 'svg' ? createElementNS : createElement
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (typeof abstractObj === 'string') {
|
|
|
|
return DOCUMENT.createTextNode(abstractObj);
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const tag = ceFn(abstractObj.tag);
|
2022-02-08 04:16:51 +08:00
|
|
|
Object.keys(abstractObj.attributes || []).forEach(function (key) {
|
|
|
|
tag.setAttribute(key, abstractObj.attributes[key]);
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
const children = abstractObj.children || [];
|
2022-02-08 04:16:51 +08:00
|
|
|
children.forEach(function (child) {
|
|
|
|
tag.appendChild(convertSVG(child, {
|
2024-07-17 01:13:31 +08:00
|
|
|
ceFn
|
2022-02-08 04:16:51 +08:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
return tag;
|
|
|
|
}
|
|
|
|
function nodeAsComment(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let comment = " ".concat(node.outerHTML, " ");
|
2022-02-08 04:16:51 +08:00
|
|
|
/* BEGIN.ATTRIBUTION */
|
|
|
|
comment = "".concat(comment, "Font Awesome fontawesome.com ");
|
|
|
|
/* END.ATTRIBUTION */
|
|
|
|
return comment;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const mutators = {
|
|
|
|
replace: function (mutation) {
|
|
|
|
const node = mutation[0];
|
2022-02-08 04:16:51 +08:00
|
|
|
if (node.parentNode) {
|
2024-07-17 01:13:31 +08:00
|
|
|
mutation[1].forEach(abstract => {
|
|
|
|
node.parentNode.insertBefore(convertSVG(abstract), node);
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
if (node.getAttribute(DATA_FA_I2SVG) === null && config.keepOriginalSource) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let comment = DOCUMENT.createComment(nodeAsComment(node));
|
2022-02-08 04:16:51 +08:00
|
|
|
node.parentNode.replaceChild(comment, node);
|
|
|
|
} else {
|
|
|
|
node.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
nest: function (mutation) {
|
|
|
|
const node = mutation[0];
|
2024-11-19 05:38:46 +08:00
|
|
|
const abstract = mutation[1];
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// If we already have a replaced node we do not want to continue nesting within it.
|
|
|
|
// Short-circuit to the standard replacement
|
2022-02-08 04:16:51 +08:00
|
|
|
if (~classArray(node).indexOf(config.replacementClass)) {
|
|
|
|
return mutators.replace(mutation);
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const forSvg = new RegExp("".concat(config.cssPrefix, "-.*"));
|
|
|
|
delete abstract[0].attributes.id;
|
|
|
|
if (abstract[0].attributes.class) {
|
|
|
|
const splitClasses = abstract[0].attributes.class.split(' ').reduce((acc, cls) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (cls === config.replacementClass || cls.match(forSvg)) {
|
|
|
|
acc.toSvg.push(cls);
|
|
|
|
} else {
|
|
|
|
acc.toNode.push(cls);
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, {
|
|
|
|
toNode: [],
|
|
|
|
toSvg: []
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
abstract[0].attributes.class = splitClasses.toSvg.join(' ');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (splitClasses.toNode.length === 0) {
|
|
|
|
node.removeAttribute('class');
|
|
|
|
} else {
|
|
|
|
node.setAttribute('class', splitClasses.toNode.join(' '));
|
|
|
|
}
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const newInnerHTML = abstract.map(a => toHtml(a)).join('\n');
|
2022-02-08 04:16:51 +08:00
|
|
|
node.setAttribute(DATA_FA_I2SVG, '');
|
|
|
|
node.innerHTML = newInnerHTML;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
function performOperationSync(op) {
|
|
|
|
op();
|
|
|
|
}
|
|
|
|
function perform(mutations, callback) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const callbackFunction = typeof callback === 'function' ? callback : noop$2;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (mutations.length === 0) {
|
|
|
|
callbackFunction();
|
|
|
|
} else {
|
2024-07-17 01:13:31 +08:00
|
|
|
let frame = performOperationSync;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
|
|
|
|
frame = WINDOW.requestAnimationFrame || performOperationSync;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
frame(() => {
|
|
|
|
const mutator = getMutator();
|
|
|
|
const mark = perf.begin('mutate');
|
2022-02-08 04:16:51 +08:00
|
|
|
mutations.map(mutator);
|
|
|
|
mark();
|
|
|
|
callbackFunction();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
let disabled = false;
|
2022-02-08 04:16:51 +08:00
|
|
|
function disableObservation() {
|
|
|
|
disabled = true;
|
|
|
|
}
|
|
|
|
function enableObservation() {
|
|
|
|
disabled = false;
|
|
|
|
}
|
2024-12-17 01:25:57 +08:00
|
|
|
let mo = null;
|
2022-02-08 04:16:51 +08:00
|
|
|
function observe(options) {
|
|
|
|
if (!MUTATION_OBSERVER) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!config.observeMutations) {
|
|
|
|
return;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
treeCallback = noop$2,
|
|
|
|
nodeCallback = noop$2,
|
|
|
|
pseudoElementsCallback = noop$2,
|
|
|
|
observeMutationsRoot = DOCUMENT
|
|
|
|
} = options;
|
2024-12-17 01:25:57 +08:00
|
|
|
mo = new MUTATION_OBSERVER(objects => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (disabled) return;
|
2024-07-17 01:13:31 +08:00
|
|
|
const defaultPrefix = getDefaultUsablePrefix();
|
|
|
|
toArray(objects).forEach(mutationRecord => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
|
|
|
|
if (config.searchPseudoElements) {
|
|
|
|
pseudoElementsCallback(mutationRecord.target);
|
|
|
|
}
|
|
|
|
treeCallback(mutationRecord.target);
|
|
|
|
}
|
|
|
|
if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
|
|
|
|
pseudoElementsCallback(mutationRecord.target.parentNode);
|
|
|
|
}
|
|
|
|
if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
|
|
|
|
if (mutationRecord.attributeName === 'class' && hasPrefixAndIcon(mutationRecord.target)) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
prefix,
|
|
|
|
iconName
|
|
|
|
} = getCanonicalIcon(classArray(mutationRecord.target));
|
2022-02-08 04:16:51 +08:00
|
|
|
mutationRecord.target.setAttribute(DATA_PREFIX, prefix || defaultPrefix);
|
|
|
|
if (iconName) mutationRecord.target.setAttribute(DATA_ICON, iconName);
|
|
|
|
} else if (hasBeenReplaced(mutationRecord.target)) {
|
|
|
|
nodeCallback(mutationRecord.target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (!IS_DOM) return;
|
2024-12-17 01:25:57 +08:00
|
|
|
mo.observe(observeMutationsRoot, {
|
2022-02-08 04:16:51 +08:00
|
|
|
childList: true,
|
|
|
|
attributes: true,
|
|
|
|
characterData: true,
|
|
|
|
subtree: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function disconnect() {
|
2024-12-17 01:25:57 +08:00
|
|
|
if (!mo) return;
|
|
|
|
mo.disconnect();
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function styleParser (node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const style = node.getAttribute('style');
|
|
|
|
let val = [];
|
2022-02-08 04:16:51 +08:00
|
|
|
if (style) {
|
2024-07-17 01:13:31 +08:00
|
|
|
val = style.split(';').reduce((acc, style) => {
|
|
|
|
const styles = style.split(':');
|
|
|
|
const prop = styles[0];
|
|
|
|
const value = styles.slice(1);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (prop && value.length > 0) {
|
|
|
|
acc[prop] = value.join(':').trim();
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
function classParser (node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const existingPrefix = node.getAttribute('data-prefix');
|
|
|
|
const existingIconName = node.getAttribute('data-icon');
|
|
|
|
const innerText = node.innerText !== undefined ? node.innerText.trim() : '';
|
|
|
|
let val = getCanonicalIcon(classArray(node));
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!val.prefix) {
|
|
|
|
val.prefix = getDefaultUsablePrefix();
|
|
|
|
}
|
|
|
|
if (existingPrefix && existingIconName) {
|
|
|
|
val.prefix = existingPrefix;
|
|
|
|
val.iconName = existingIconName;
|
|
|
|
}
|
|
|
|
if (val.iconName && val.prefix) {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
if (val.prefix && innerText.length > 0) {
|
|
|
|
val.iconName = byLigature(val.prefix, node.innerText) || byUnicode(val.prefix, toHex(node.innerText));
|
|
|
|
}
|
2022-07-26 01:48:16 +08:00
|
|
|
if (!val.iconName && config.autoFetchSvg && node.firstChild && node.firstChild.nodeType === Node.TEXT_NODE) {
|
|
|
|
val.iconName = node.firstChild.data;
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
function attributesParser (node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const extraAttributes = toArray(node.attributes).reduce((acc, attr) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (acc.name !== 'class' && acc.name !== 'style') {
|
|
|
|
acc[attr.name] = attr.value;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, {});
|
2024-07-17 01:13:31 +08:00
|
|
|
const title = node.getAttribute('title');
|
|
|
|
const titleId = node.getAttribute('data-fa-title-id');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (config.autoA11y) {
|
|
|
|
if (title) {
|
|
|
|
extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
|
|
|
|
} else {
|
|
|
|
extraAttributes['aria-hidden'] = 'true';
|
|
|
|
extraAttributes['focusable'] = 'false';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return extraAttributes;
|
|
|
|
}
|
|
|
|
|
|
|
|
function blankMeta() {
|
|
|
|
return {
|
|
|
|
iconName: null,
|
|
|
|
title: null,
|
|
|
|
titleId: null,
|
|
|
|
prefix: null,
|
|
|
|
transform: meaninglessTransform,
|
|
|
|
symbol: false,
|
|
|
|
mask: {
|
|
|
|
iconName: null,
|
|
|
|
prefix: null,
|
|
|
|
rest: []
|
|
|
|
},
|
|
|
|
maskId: null,
|
|
|
|
extra: {
|
|
|
|
classes: [],
|
|
|
|
styles: {},
|
|
|
|
attributes: {}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
function parseMeta(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
2022-02-08 04:16:51 +08:00
|
|
|
styleParser: true
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
iconName,
|
|
|
|
prefix,
|
|
|
|
rest: extraClasses
|
|
|
|
} = classParser(node);
|
|
|
|
const extraAttributes = attributesParser(node);
|
|
|
|
const pluginMeta = chainHooks('parseNodeAttributes', {}, node);
|
|
|
|
let extraStyles = parser.styleParser ? styleParser(node) : [];
|
2024-11-19 05:38:46 +08:00
|
|
|
return _objectSpread2({
|
2024-07-17 01:13:31 +08:00
|
|
|
iconName,
|
2022-02-08 04:16:51 +08:00
|
|
|
title: node.getAttribute('title'),
|
|
|
|
titleId: node.getAttribute('data-fa-title-id'),
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: meaninglessTransform,
|
|
|
|
mask: {
|
|
|
|
iconName: null,
|
|
|
|
prefix: null,
|
|
|
|
rest: []
|
|
|
|
},
|
|
|
|
maskId: null,
|
|
|
|
symbol: false,
|
|
|
|
extra: {
|
|
|
|
classes: extraClasses,
|
|
|
|
styles: extraStyles,
|
|
|
|
attributes: extraAttributes
|
2024-11-19 05:38:46 +08:00
|
|
|
}
|
|
|
|
}, pluginMeta);
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
styles: styles$2
|
|
|
|
} = namespace;
|
2022-02-08 04:16:51 +08:00
|
|
|
function generateMutation(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const nodeMeta = config.autoReplaceSvg === 'nest' ? parseMeta(node, {
|
2022-02-08 04:16:51 +08:00
|
|
|
styleParser: false
|
|
|
|
}) : parseMeta(node);
|
|
|
|
if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
|
|
|
|
return callProvided('generateLayersText', node, nodeMeta);
|
|
|
|
} else {
|
|
|
|
return callProvided('generateSvgReplacementMutation', node, nodeMeta);
|
|
|
|
}
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
function getKnownPrefixes() {
|
2024-12-17 01:25:57 +08:00
|
|
|
return [...Ft, ...Ia];
|
2024-11-19 05:38:46 +08:00
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
function onTree(root) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!IS_DOM) return Promise.resolve();
|
2024-07-17 01:13:31 +08:00
|
|
|
const htmlClassList = DOCUMENT.documentElement.classList;
|
|
|
|
const hclAdd = suffix => htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
|
|
|
const hclRemove = suffix => htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
2024-11-19 05:38:46 +08:00
|
|
|
const prefixes = config.autoFetchSvg ? getKnownPrefixes() : P.concat(Object.keys(styles$2));
|
2022-07-26 01:48:16 +08:00
|
|
|
if (!prefixes.includes('fa')) {
|
|
|
|
prefixes.push('fa');
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
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(', ');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (prefixesDomQuery.length === 0) {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
let candidates = [];
|
2022-02-08 04:16:51 +08:00
|
|
|
try {
|
|
|
|
candidates = toArray(root.querySelectorAll(prefixesDomQuery));
|
2024-11-19 05:38:46 +08:00
|
|
|
} catch (e$$1) {
|
|
|
|
// noop
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
if (candidates.length > 0) {
|
|
|
|
hclAdd('pending');
|
|
|
|
hclRemove('complete');
|
|
|
|
} else {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const mark = perf.begin('onTree');
|
|
|
|
const mutations = candidates.reduce((acc, node) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
try {
|
2024-07-17 01:13:31 +08:00
|
|
|
const mutation = generateMutation(node);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (mutation) {
|
|
|
|
acc.push(mutation);
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
} catch (e$$1) {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!PRODUCTION) {
|
2024-07-17 01:13:31 +08:00
|
|
|
if (e$$1.name === 'MissingIcon') {
|
|
|
|
console.error(e$$1);
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, []);
|
2024-07-17 01:13:31 +08:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
Promise.all(mutations).then(resolvedMutations => {
|
|
|
|
perform(resolvedMutations, () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
hclAdd('active');
|
|
|
|
hclAdd('complete');
|
|
|
|
hclRemove('pending');
|
|
|
|
if (typeof callback === 'function') callback();
|
|
|
|
mark();
|
|
|
|
resolve();
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
}).catch(e$$1 => {
|
2022-02-08 04:16:51 +08:00
|
|
|
mark();
|
2024-07-17 01:13:31 +08:00
|
|
|
reject(e$$1);
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function onNode(node) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
|
|
generateMutation(node).then(mutation => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (mutation) {
|
|
|
|
perform([mutation], callback);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function resolveIcons(next) {
|
|
|
|
return function (maybeIconDefinition) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
|
|
|
|
let {
|
|
|
|
mask
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (mask) {
|
|
|
|
mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
return next(iconDefinition, _objectSpread2(_objectSpread2({}, params), {}, {
|
2024-07-17 01:13:31 +08:00
|
|
|
mask
|
2024-11-19 05:38:46 +08:00
|
|
|
}));
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const render = function (iconDefinition) {
|
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
transform = meaninglessTransform,
|
|
|
|
symbol = false,
|
|
|
|
mask = null,
|
|
|
|
maskId = null,
|
|
|
|
title = null,
|
|
|
|
titleId = null,
|
|
|
|
classes = [],
|
|
|
|
attributes = {},
|
|
|
|
styles = {}
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!iconDefinition) return;
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
icon
|
|
|
|
} = iconDefinition;
|
2024-11-19 05:38:46 +08:00
|
|
|
return domVariants(_objectSpread2({
|
|
|
|
type: 'icon'
|
|
|
|
}, iconDefinition), () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
callHooks('beforeDOMElementCreation', {
|
2024-07-17 01:13:31 +08:00
|
|
|
iconDefinition,
|
|
|
|
params
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
if (config.autoA11y) {
|
|
|
|
if (title) {
|
|
|
|
attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
|
|
|
|
} else {
|
|
|
|
attributes['aria-hidden'] = 'true';
|
|
|
|
attributes['focusable'] = 'false';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return makeInlineSvgAbstract({
|
|
|
|
icons: {
|
|
|
|
main: asFoundIcon(icon),
|
|
|
|
mask: mask ? asFoundIcon(mask.icon) : {
|
|
|
|
found: false,
|
|
|
|
width: null,
|
|
|
|
height: null,
|
|
|
|
icon: {}
|
|
|
|
}
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName,
|
2024-11-19 05:38:46 +08:00
|
|
|
transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
|
2024-07-17 01:13:31 +08:00
|
|
|
symbol,
|
|
|
|
title,
|
|
|
|
maskId,
|
|
|
|
titleId,
|
2022-02-08 04:16:51 +08:00
|
|
|
extra: {
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
|
|
|
styles,
|
|
|
|
classes
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var ReplaceElements = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
icon: resolveIcons(render)
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
mutationObserverCallbacks(accumulator) {
|
2022-02-08 04:16:51 +08:00
|
|
|
accumulator.treeCallback = onTree;
|
|
|
|
accumulator.nodeCallback = onNode;
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers$$1) {
|
2022-02-08 04:16:51 +08:00
|
|
|
providers$$1.i2svg = function (params) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
node = DOCUMENT,
|
|
|
|
callback = () => {}
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
return onTree(node, callback);
|
|
|
|
};
|
|
|
|
providers$$1.generateSvgReplacementMutation = function (node, nodeMeta) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
iconName,
|
|
|
|
title,
|
|
|
|
titleId,
|
|
|
|
prefix,
|
|
|
|
transform,
|
|
|
|
symbol,
|
|
|
|
mask,
|
|
|
|
maskId,
|
|
|
|
extra
|
|
|
|
} = nodeMeta;
|
|
|
|
return new Promise((resolve, reject) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
Promise.all([findIcon(iconName, prefix), mask.iconName ? findIcon(mask.iconName, mask.prefix) : Promise.resolve({
|
|
|
|
found: false,
|
|
|
|
width: 512,
|
|
|
|
height: 512,
|
|
|
|
icon: {}
|
2024-07-17 01:13:31 +08:00
|
|
|
})]).then(_ref => {
|
|
|
|
let [main, mask] = _ref;
|
2022-02-08 04:16:51 +08:00
|
|
|
resolve([node, makeInlineSvgAbstract({
|
|
|
|
icons: {
|
2024-07-17 01:13:31 +08:00
|
|
|
main,
|
|
|
|
mask
|
2022-02-08 04:16:51 +08:00
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
|
|
|
iconName,
|
|
|
|
transform,
|
|
|
|
symbol,
|
|
|
|
maskId,
|
|
|
|
title,
|
|
|
|
titleId,
|
|
|
|
extra,
|
2022-02-08 04:16:51 +08:00
|
|
|
watchable: true
|
|
|
|
})]);
|
|
|
|
}).catch(reject);
|
|
|
|
});
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
providers$$1.generateAbstractIcon = function (_ref2) {
|
|
|
|
let {
|
|
|
|
children,
|
|
|
|
attributes,
|
|
|
|
main,
|
|
|
|
transform,
|
|
|
|
styles
|
|
|
|
} = _ref2;
|
|
|
|
const styleString = joinStyles(styles);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (styleString.length > 0) {
|
|
|
|
attributes['style'] = styleString;
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
let nextChild;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (transformIsMeaningful(transform)) {
|
|
|
|
nextChild = callProvided('generateAbstractTransformGrouping', {
|
2024-07-17 01:13:31 +08:00
|
|
|
main,
|
|
|
|
transform,
|
2022-02-08 04:16:51 +08:00
|
|
|
containerWidth: main.width,
|
|
|
|
iconWidth: main.width
|
|
|
|
});
|
|
|
|
}
|
|
|
|
children.push(nextChild || main.icon);
|
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
children,
|
|
|
|
attributes
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var Layers = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
layer(assembler) {
|
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
classes = []
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
return domVariants({
|
|
|
|
type: 'layer'
|
2024-07-17 01:13:31 +08:00
|
|
|
}, () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
callHooks('beforeDOMElementCreation', {
|
2024-07-17 01:13:31 +08:00
|
|
|
assembler,
|
|
|
|
params
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
let children = [];
|
|
|
|
assembler(args => {
|
|
|
|
Array.isArray(args) ? args.map(a => {
|
2022-02-08 04:16:51 +08:00
|
|
|
children = children.concat(a.abstract);
|
|
|
|
}) : children = children.concat(args.abstract);
|
|
|
|
});
|
|
|
|
return [{
|
|
|
|
tag: 'span',
|
|
|
|
attributes: {
|
2024-07-17 01:13:31 +08:00
|
|
|
class: ["".concat(config.cssPrefix, "-layers"), ...classes].join(' ')
|
2022-02-08 04:16:51 +08:00
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
children
|
2022-02-08 04:16:51 +08:00
|
|
|
}];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var LayersCounter = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
counter(content) {
|
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
title = null,
|
|
|
|
classes = [],
|
|
|
|
attributes = {},
|
|
|
|
styles = {}
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
return domVariants({
|
|
|
|
type: 'counter',
|
2024-07-17 01:13:31 +08:00
|
|
|
content
|
|
|
|
}, () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
callHooks('beforeDOMElementCreation', {
|
2024-07-17 01:13:31 +08:00
|
|
|
content,
|
|
|
|
params
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
return makeLayersCounterAbstract({
|
|
|
|
content: content.toString(),
|
2024-07-17 01:13:31 +08:00
|
|
|
title,
|
2022-02-08 04:16:51 +08:00
|
|
|
extra: {
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
|
|
|
styles,
|
|
|
|
classes: ["".concat(config.cssPrefix, "-layers-counter"), ...classes]
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var LayersText = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
text(content) {
|
|
|
|
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
const {
|
|
|
|
transform = meaninglessTransform,
|
|
|
|
title = null,
|
|
|
|
classes = [],
|
|
|
|
attributes = {},
|
|
|
|
styles = {}
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
return domVariants({
|
|
|
|
type: 'text',
|
2024-07-17 01:13:31 +08:00
|
|
|
content
|
|
|
|
}, () => {
|
2022-02-08 04:16:51 +08:00
|
|
|
callHooks('beforeDOMElementCreation', {
|
2024-07-17 01:13:31 +08:00
|
|
|
content,
|
|
|
|
params
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
return makeLayersTextAbstract({
|
2024-07-17 01:13:31 +08:00
|
|
|
content,
|
2024-11-19 05:38:46 +08:00
|
|
|
transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
|
2024-07-17 01:13:31 +08:00
|
|
|
title,
|
2022-02-08 04:16:51 +08:00
|
|
|
extra: {
|
2024-07-17 01:13:31 +08:00
|
|
|
attributes,
|
|
|
|
styles,
|
|
|
|
classes: ["".concat(config.cssPrefix, "-layers-text"), ...classes]
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers$$1) {
|
2022-02-08 04:16:51 +08:00
|
|
|
providers$$1.generateLayersText = function (node, nodeMeta) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const {
|
|
|
|
title,
|
|
|
|
transform,
|
|
|
|
extra
|
|
|
|
} = nodeMeta;
|
|
|
|
let width = null;
|
|
|
|
let height = null;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (IS_IE) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
|
|
|
|
const boundingClientRect = node.getBoundingClientRect();
|
2022-02-08 04:16:51 +08:00
|
|
|
width = boundingClientRect.width / computedFontSize;
|
|
|
|
height = boundingClientRect.height / computedFontSize;
|
|
|
|
}
|
|
|
|
if (config.autoA11y && !title) {
|
|
|
|
extra.attributes['aria-hidden'] = 'true';
|
|
|
|
}
|
|
|
|
return Promise.resolve([node, makeLayersTextAbstract({
|
|
|
|
content: node.innerHTML,
|
2024-07-17 01:13:31 +08:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
transform,
|
|
|
|
title,
|
|
|
|
extra,
|
2022-02-08 04:16:51 +08:00
|
|
|
watchable: true
|
|
|
|
})]);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const CLEAN_CONTENT_PATTERN = new RegExp('\u{22}', 'ug');
|
|
|
|
const SECONDARY_UNICODE_RANGE = [1105920, 1112319];
|
2024-11-19 05:38:46 +08:00
|
|
|
const _FONT_FAMILY_WEIGHT_TO_PREFIX = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, {
|
|
|
|
FontAwesome: {
|
|
|
|
normal: 'fas',
|
|
|
|
400: 'fas'
|
|
|
|
}
|
2024-12-17 01:25:57 +08:00
|
|
|
}), lt), wa), Yt);
|
2024-07-17 01:13:31 +08:00
|
|
|
const FONT_FAMILY_WEIGHT_TO_PREFIX = Object.keys(_FONT_FAMILY_WEIGHT_TO_PREFIX).reduce((acc, key) => {
|
|
|
|
acc[key.toLowerCase()] = _FONT_FAMILY_WEIGHT_TO_PREFIX[key];
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
const FONT_FAMILY_WEIGHT_FALLBACK = Object.keys(FONT_FAMILY_WEIGHT_TO_PREFIX).reduce((acc, fontFamily) => {
|
|
|
|
const weights = FONT_FAMILY_WEIGHT_TO_PREFIX[fontFamily];
|
|
|
|
acc[fontFamily] = weights[900] || [...Object.entries(weights)][0][1];
|
|
|
|
return acc;
|
|
|
|
}, {});
|
2022-02-08 04:16:51 +08:00
|
|
|
function hexValueFromContent(content) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const cleaned = content.replace(CLEAN_CONTENT_PATTERN, '');
|
|
|
|
const codePoint = codePointAt(cleaned, 0);
|
|
|
|
const isPrependTen = codePoint >= SECONDARY_UNICODE_RANGE[0] && codePoint <= SECONDARY_UNICODE_RANGE[1];
|
|
|
|
const isDoubled = cleaned.length === 2 ? cleaned[0] === cleaned[1] : false;
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
value: isDoubled ? toHex(cleaned[0]) : toHex(cleaned),
|
|
|
|
isSecondary: isPrependTen || isDoubled
|
|
|
|
};
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
function getPrefix(fontFamily, fontWeight) {
|
|
|
|
const fontFamilySanitized = fontFamily.replace(/^['"]|['"]$/g, '').toLowerCase();
|
|
|
|
const fontWeightInteger = parseInt(fontWeight);
|
|
|
|
const fontWeightSanitized = isNaN(fontWeightInteger) ? 'normal' : fontWeightInteger;
|
|
|
|
return (FONT_FAMILY_WEIGHT_TO_PREFIX[fontFamilySanitized] || {})[fontWeightSanitized] || FONT_FAMILY_WEIGHT_FALLBACK[fontFamilySanitized];
|
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
function replaceForPosition(node, position) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
|
|
|
|
return new Promise((resolve, reject) => {
|
2022-02-08 04:16:51 +08:00
|
|
|
if (node.getAttribute(pendingAttribute) !== null) {
|
|
|
|
// This node is already being processed
|
|
|
|
return resolve();
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const children = toArray(node.children);
|
2024-11-19 05:38:46 +08:00
|
|
|
const alreadyProcessedPseudoElement = children.filter(c$$1 => c$$1.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position)[0];
|
2024-07-17 01:13:31 +08:00
|
|
|
const styles = WINDOW.getComputedStyle(node, position);
|
|
|
|
const fontFamily = styles.getPropertyValue('font-family');
|
|
|
|
const fontFamilyMatch = fontFamily.match(FONT_FAMILY_PATTERN);
|
|
|
|
const fontWeight = styles.getPropertyValue('font-weight');
|
|
|
|
const content = styles.getPropertyValue('content');
|
|
|
|
if (alreadyProcessedPseudoElement && !fontFamilyMatch) {
|
2022-02-08 04:16:51 +08:00
|
|
|
// If we've already processed it but the current computed style does not result in a font-family,
|
|
|
|
// that probably means that a class name that was previously present to make the icon has been
|
|
|
|
// removed. So we now should delete the icon.
|
|
|
|
node.removeChild(alreadyProcessedPseudoElement);
|
|
|
|
return resolve();
|
2024-07-17 01:13:31 +08:00
|
|
|
} else if (fontFamilyMatch && content !== 'none' && content !== '') {
|
|
|
|
const content = styles.getPropertyValue('content');
|
|
|
|
let prefix = getPrefix(fontFamily, fontWeight);
|
|
|
|
const {
|
|
|
|
value: hexValue,
|
|
|
|
isSecondary
|
|
|
|
} = hexValueFromContent(content);
|
|
|
|
const isV4 = fontFamilyMatch[0].startsWith('FontAwesome');
|
|
|
|
let iconName = byUnicode(prefix, hexValue);
|
|
|
|
let iconIdentifier = iconName;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (isV4) {
|
2024-07-17 01:13:31 +08:00
|
|
|
const iconName4 = byOldUnicode(hexValue);
|
2022-02-08 04:16:51 +08:00
|
|
|
if (iconName4.iconName && iconName4.prefix) {
|
|
|
|
iconName = iconName4.iconName;
|
|
|
|
prefix = iconName4.prefix;
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
}
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// Only convert the pseudo element in this ::before/::after position into an icon if we haven't
|
|
|
|
// already done so with the same prefix and iconName
|
2022-02-08 04:16:51 +08:00
|
|
|
if (iconName && !isSecondary && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
|
|
|
|
node.setAttribute(pendingAttribute, iconIdentifier);
|
|
|
|
if (alreadyProcessedPseudoElement) {
|
|
|
|
// Delete the old one, since we're replacing it with a new one
|
|
|
|
node.removeChild(alreadyProcessedPseudoElement);
|
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
const meta = blankMeta();
|
|
|
|
const {
|
|
|
|
extra
|
|
|
|
} = meta;
|
2022-02-08 04:16:51 +08:00
|
|
|
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
|
2024-07-17 01:13:31 +08:00
|
|
|
findIcon(iconName, prefix).then(main => {
|
2024-11-19 05:38:46 +08:00
|
|
|
const abstract = makeInlineSvgAbstract(_objectSpread2(_objectSpread2({}, meta), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
icons: {
|
2024-07-17 01:13:31 +08:00
|
|
|
main,
|
2022-02-08 04:16:51 +08:00
|
|
|
mask: emptyCanonicalIcon()
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
prefix,
|
2022-02-08 04:16:51 +08:00
|
|
|
iconName: iconIdentifier,
|
2024-07-17 01:13:31 +08:00
|
|
|
extra,
|
2022-02-08 04:16:51 +08:00
|
|
|
watchable: true
|
2024-11-19 05:38:46 +08:00
|
|
|
}));
|
2024-07-17 01:13:31 +08:00
|
|
|
const element = DOCUMENT.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (position === '::before') {
|
|
|
|
node.insertBefore(element, node.firstChild);
|
|
|
|
} else {
|
|
|
|
node.appendChild(element);
|
|
|
|
}
|
2024-11-19 05:38:46 +08:00
|
|
|
element.outerHTML = abstract.map(a$$1 => toHtml(a$$1)).join('\n');
|
2022-02-08 04:16:51 +08:00
|
|
|
node.removeAttribute(pendingAttribute);
|
|
|
|
resolve();
|
|
|
|
}).catch(reject);
|
|
|
|
} else {
|
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function replace(node) {
|
|
|
|
return Promise.all([replaceForPosition(node, '::before'), replaceForPosition(node, '::after')]);
|
|
|
|
}
|
|
|
|
function processable(node) {
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
function searchPseudoElements(root) {
|
|
|
|
if (!IS_DOM) return;
|
2024-07-17 01:13:31 +08:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
const operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
|
|
|
|
const end = perf.begin('searchPseudoElements');
|
2022-02-08 04:16:51 +08:00
|
|
|
disableObservation();
|
2024-07-17 01:13:31 +08:00
|
|
|
Promise.all(operations).then(() => {
|
2022-02-08 04:16:51 +08:00
|
|
|
end();
|
|
|
|
enableObservation();
|
|
|
|
resolve();
|
2024-07-17 01:13:31 +08:00
|
|
|
}).catch(() => {
|
2022-02-08 04:16:51 +08:00
|
|
|
end();
|
|
|
|
enableObservation();
|
|
|
|
reject();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
var PseudoElements = {
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
mutationObserverCallbacks(accumulator) {
|
2022-02-08 04:16:51 +08:00
|
|
|
accumulator.pseudoElementsCallback = searchPseudoElements;
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers) {
|
|
|
|
providers.pseudoElements2svg = function (params) {
|
|
|
|
const {
|
|
|
|
node = DOCUMENT
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (config.searchPseudoElements) {
|
|
|
|
searchPseudoElements(node);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
let _unwatched = false;
|
2022-02-08 04:16:51 +08:00
|
|
|
var MutationObserver$1 = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
dom: {
|
2024-07-17 01:13:31 +08:00
|
|
|
unwatch() {
|
2022-02-08 04:16:51 +08:00
|
|
|
disableObservation();
|
|
|
|
_unwatched = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
bootstrap() {
|
2022-02-08 04:16:51 +08:00
|
|
|
observe(chainHooks('mutationObserverCallbacks', {}));
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
noAuto() {
|
2022-02-08 04:16:51 +08:00
|
|
|
disconnect();
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
watch(params) {
|
|
|
|
const {
|
|
|
|
observeMutationsRoot
|
|
|
|
} = params;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (_unwatched) {
|
|
|
|
enableObservation();
|
|
|
|
} else {
|
|
|
|
observe(chainHooks('mutationObserverCallbacks', {
|
2024-07-17 01:13:31 +08:00
|
|
|
observeMutationsRoot
|
2022-02-08 04:16:51 +08:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const parseTransformString = transformString => {
|
|
|
|
let transform = {
|
2022-02-08 04:16:51 +08:00
|
|
|
size: 16,
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
flipX: false,
|
|
|
|
flipY: false,
|
|
|
|
rotate: 0
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
return transformString.toLowerCase().split(' ').reduce((acc, n) => {
|
|
|
|
const parts = n.toLowerCase().split('-');
|
|
|
|
const first = parts[0];
|
|
|
|
let rest = parts.slice(1).join('-');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (first && rest === 'h') {
|
|
|
|
acc.flipX = true;
|
|
|
|
return acc;
|
|
|
|
}
|
|
|
|
if (first && rest === 'v') {
|
|
|
|
acc.flipY = true;
|
|
|
|
return acc;
|
|
|
|
}
|
|
|
|
rest = parseFloat(rest);
|
|
|
|
if (isNaN(rest)) {
|
|
|
|
return acc;
|
|
|
|
}
|
|
|
|
switch (first) {
|
|
|
|
case 'grow':
|
|
|
|
acc.size = acc.size + rest;
|
|
|
|
break;
|
|
|
|
case 'shrink':
|
|
|
|
acc.size = acc.size - rest;
|
|
|
|
break;
|
|
|
|
case 'left':
|
|
|
|
acc.x = acc.x - rest;
|
|
|
|
break;
|
|
|
|
case 'right':
|
|
|
|
acc.x = acc.x + rest;
|
|
|
|
break;
|
|
|
|
case 'up':
|
|
|
|
acc.y = acc.y - rest;
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
acc.y = acc.y + rest;
|
|
|
|
break;
|
|
|
|
case 'rotate':
|
|
|
|
acc.rotate = acc.rotate + rest;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, transform);
|
|
|
|
};
|
|
|
|
var PowerTransforms = {
|
2024-07-17 01:13:31 +08:00
|
|
|
mixout() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
|
|
|
parse: {
|
2024-07-17 01:13:31 +08:00
|
|
|
transform: transformString => {
|
2022-02-08 04:16:51 +08:00
|
|
|
return parseTransformString(transformString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
parseNodeAttributes(accumulator, node) {
|
|
|
|
const transformString = node.getAttribute('data-fa-transform');
|
2022-02-08 04:16:51 +08:00
|
|
|
if (transformString) {
|
|
|
|
accumulator.transform = parseTransformString(transformString);
|
|
|
|
}
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers) {
|
2022-02-08 04:16:51 +08:00
|
|
|
providers.generateAbstractTransformGrouping = function (_ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
main,
|
|
|
|
transform,
|
|
|
|
containerWidth,
|
|
|
|
iconWidth
|
|
|
|
} = _ref;
|
|
|
|
const outer = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "translate(".concat(containerWidth / 2, " 256)")
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
|
|
|
|
const innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
|
|
|
|
const innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
|
|
|
|
const inner = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const path = {
|
2022-02-08 04:16:51 +08:00
|
|
|
transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const operations = {
|
|
|
|
outer,
|
|
|
|
inner,
|
|
|
|
path
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
return {
|
|
|
|
tag: 'g',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2({}, operations.outer),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [{
|
|
|
|
tag: 'g',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2({}, operations.inner),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [{
|
|
|
|
tag: main.icon.tag,
|
|
|
|
children: main.icon.children,
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, main.icon.attributes), operations.path)
|
2022-02-08 04:16:51 +08:00
|
|
|
}]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-07-17 01:13:31 +08:00
|
|
|
const ALL_SPACE = {
|
2022-02-08 04:16:51 +08:00
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
width: '100%',
|
|
|
|
height: '100%'
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
function fillBlack(abstract) {
|
|
|
|
let force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
|
|
if (abstract.attributes && (abstract.attributes.fill || force)) {
|
|
|
|
abstract.attributes.fill = 'black';
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
return abstract;
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
2024-07-17 01:13:31 +08:00
|
|
|
function deGroup(abstract) {
|
|
|
|
if (abstract.tag === 'g') {
|
|
|
|
return abstract.children;
|
2022-02-08 04:16:51 +08:00
|
|
|
} else {
|
2024-07-17 01:13:31 +08:00
|
|
|
return [abstract];
|
2022-02-08 04:16:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
var Masks = {
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
parseNodeAttributes(accumulator, node) {
|
|
|
|
const maskData = node.getAttribute('data-fa-mask');
|
|
|
|
const mask = !maskData ? emptyCanonicalIcon() : getCanonicalIcon(maskData.split(' ').map(i => i.trim()));
|
2022-02-08 04:16:51 +08:00
|
|
|
if (!mask.prefix) {
|
|
|
|
mask.prefix = getDefaultUsablePrefix();
|
|
|
|
}
|
|
|
|
accumulator.mask = mask;
|
|
|
|
accumulator.maskId = node.getAttribute('data-fa-mask-id');
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers) {
|
2022-02-08 04:16:51 +08:00
|
|
|
providers.generateAbstractMask = function (_ref) {
|
2024-07-17 01:13:31 +08:00
|
|
|
let {
|
|
|
|
children,
|
|
|
|
attributes,
|
|
|
|
main,
|
|
|
|
mask,
|
|
|
|
maskId: explicitMaskId,
|
|
|
|
transform
|
|
|
|
} = _ref;
|
|
|
|
const {
|
|
|
|
width: mainWidth,
|
|
|
|
icon: mainPath
|
|
|
|
} = main;
|
|
|
|
const {
|
|
|
|
width: maskWidth,
|
|
|
|
icon: maskPath
|
|
|
|
} = mask;
|
|
|
|
const trans = transformForSvg({
|
|
|
|
transform,
|
2022-02-08 04:16:51 +08:00
|
|
|
containerWidth: maskWidth,
|
|
|
|
iconWidth: mainWidth
|
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
const maskRect = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'rect',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
fill: 'white'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const maskInnerGroupChildrenMixin = mainPath.children ? {
|
2022-02-08 04:16:51 +08:00
|
|
|
children: mainPath.children.map(fillBlack)
|
|
|
|
} : {};
|
2024-07-17 01:13:31 +08:00
|
|
|
const maskInnerGroup = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'g',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2({}, trans.inner),
|
|
|
|
children: [fillBlack(_objectSpread2({
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: mainPath.tag,
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, mainPath.attributes), trans.path)
|
|
|
|
}, maskInnerGroupChildrenMixin))]
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const maskOuterGroup = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'g',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2({}, trans.outer),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [maskInnerGroup]
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const maskId = "mask-".concat(explicitMaskId || nextUniqueId());
|
|
|
|
const clipId = "clip-".concat(explicitMaskId || nextUniqueId());
|
|
|
|
const maskTag = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'mask',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
id: maskId,
|
|
|
|
maskUnits: 'userSpaceOnUse',
|
|
|
|
maskContentUnits: 'userSpaceOnUse'
|
2024-11-19 05:38:46 +08:00
|
|
|
}),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [maskRect, maskOuterGroup]
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const defs = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'defs',
|
|
|
|
children: [{
|
|
|
|
tag: 'clipPath',
|
|
|
|
attributes: {
|
|
|
|
id: clipId
|
|
|
|
},
|
|
|
|
children: deGroup(maskPath)
|
|
|
|
}, maskTag]
|
|
|
|
};
|
|
|
|
children.push(defs, {
|
|
|
|
tag: 'rect',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2({
|
2022-02-08 04:16:51 +08:00
|
|
|
fill: 'currentColor',
|
|
|
|
'clip-path': "url(#".concat(clipId, ")"),
|
2024-11-19 05:38:46 +08:00
|
|
|
mask: "url(#".concat(maskId, ")")
|
|
|
|
}, ALL_SPACE)
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
children,
|
|
|
|
attributes
|
2022-02-08 04:16:51 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var MissingIconIndicator = {
|
2024-07-17 01:13:31 +08:00
|
|
|
provides(providers) {
|
|
|
|
let reduceMotion = false;
|
2022-02-08 04:16:51 +08:00
|
|
|
if (WINDOW.matchMedia) {
|
|
|
|
reduceMotion = WINDOW.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
|
|
}
|
|
|
|
providers.missingIconAbstract = function () {
|
2024-07-17 01:13:31 +08:00
|
|
|
const gChildren = [];
|
|
|
|
const FILL = {
|
2022-02-08 04:16:51 +08:00
|
|
|
fill: 'currentColor'
|
|
|
|
};
|
2024-07-17 01:13:31 +08:00
|
|
|
const ANIMATION_BASE = {
|
2022-02-08 04:16:51 +08:00
|
|
|
attributeType: 'XML',
|
|
|
|
repeatCount: 'indefinite',
|
|
|
|
dur: '2s'
|
2024-11-19 05:38:46 +08:00
|
|
|
};
|
2022-02-08 04:16:51 +08:00
|
|
|
|
2024-11-19 05:38:46 +08:00
|
|
|
// Ring
|
2022-02-08 04:16:51 +08:00
|
|
|
gChildren.push({
|
|
|
|
tag: 'path',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
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'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
2024-11-19 05:38:46 +08:00
|
|
|
const OPACITY_ANIMATE = _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
attributeName: 'opacity'
|
2024-11-19 05:38:46 +08:00
|
|
|
});
|
2024-07-17 01:13:31 +08:00
|
|
|
const dot = {
|
2022-02-08 04:16:51 +08:00
|
|
|
tag: 'circle',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
cx: '256',
|
|
|
|
cy: '364',
|
|
|
|
r: '28'
|
2024-11-19 05:38:46 +08:00
|
|
|
}),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: []
|
|
|
|
};
|
|
|
|
if (!reduceMotion) {
|
|
|
|
dot.children.push({
|
|
|
|
tag: 'animate',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
attributeName: 'r',
|
|
|
|
values: '28;14;28;28;14;28;'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
}, {
|
|
|
|
tag: 'animate',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
values: '1;0;1;1;0;1;'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
gChildren.push(dot);
|
|
|
|
gChildren.push({
|
|
|
|
tag: 'path',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
opacity: '1',
|
|
|
|
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'
|
2024-11-19 05:38:46 +08:00
|
|
|
}),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: reduceMotion ? [] : [{
|
|
|
|
tag: 'animate',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
values: '1;0;0;0;0;1;'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
if (!reduceMotion) {
|
|
|
|
// Exclamation
|
|
|
|
gChildren.push({
|
|
|
|
tag: 'path',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
opacity: '0',
|
|
|
|
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'
|
2024-11-19 05:38:46 +08:00
|
|
|
}),
|
2022-02-08 04:16:51 +08:00
|
|
|
children: [{
|
|
|
|
tag: 'animate',
|
2024-11-19 05:38:46 +08:00
|
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
2022-02-08 04:16:51 +08:00
|
|
|
values: '0;0;1;1;0;0;'
|
2024-11-19 05:38:46 +08:00
|
|
|
})
|
2022-02-08 04:16:51 +08:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
tag: 'g',
|
|
|
|
attributes: {
|
|
|
|
'class': 'missing'
|
|
|
|
},
|
|
|
|
children: gChildren
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var SvgSymbols = {
|
2024-07-17 01:13:31 +08:00
|
|
|
hooks() {
|
2022-02-08 04:16:51 +08:00
|
|
|
return {
|
2024-07-17 01:13:31 +08:00
|
|
|
parseNodeAttributes(accumulator, node) {
|
|
|
|
const symbolData = node.getAttribute('data-fa-symbol');
|
|
|
|
const symbol = symbolData === null ? false : symbolData === '' ? true : symbolData;
|
2022-02-08 04:16:51 +08:00
|
|
|
accumulator['symbol'] = symbol;
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var plugins = [InjectCSS, ReplaceElements, Layers, LayersCounter, LayersText, PseudoElements, MutationObserver$1, PowerTransforms, Masks, MissingIconIndicator, SvgSymbols];
|
|
|
|
|
|
|
|
registerPlugins(plugins, {
|
|
|
|
mixoutsTo: api
|
|
|
|
});
|
|
|
|
bunker(bootstrap);
|
|
|
|
|
|
|
|
}());
|