693 |
steven |
1 |
/*!
|
|
|
2 |
* Font Awesome Free 5.10.2 by @fontawesome - https://fontawesome.com
|
|
|
3 |
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
|
4 |
*/
|
|
|
5 |
(function (global, factory) {
|
|
|
6 |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
|
7 |
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
|
8 |
(factory((global['fontawesome-free-conflict-detection'] = {})));
|
|
|
9 |
}(this, (function (exports) { 'use strict';
|
|
|
10 |
|
|
|
11 |
function _typeof(obj) {
|
|
|
12 |
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
|
13 |
_typeof = function (obj) {
|
|
|
14 |
return typeof obj;
|
|
|
15 |
};
|
|
|
16 |
} else {
|
|
|
17 |
_typeof = function (obj) {
|
|
|
18 |
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
|
19 |
};
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
return _typeof(obj);
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
function _defineProperty(obj, key, value) {
|
|
|
26 |
if (key in obj) {
|
|
|
27 |
Object.defineProperty(obj, key, {
|
|
|
28 |
value: value,
|
|
|
29 |
enumerable: true,
|
|
|
30 |
configurable: true,
|
|
|
31 |
writable: true
|
|
|
32 |
});
|
|
|
33 |
} else {
|
|
|
34 |
obj[key] = value;
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
return obj;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
function _objectSpread(target) {
|
|
|
41 |
for (var i = 1; i < arguments.length; i++) {
|
|
|
42 |
var source = arguments[i] != null ? arguments[i] : {};
|
|
|
43 |
var ownKeys = Object.keys(source);
|
|
|
44 |
|
|
|
45 |
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
|
46 |
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
|
47 |
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
|
48 |
}));
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
ownKeys.forEach(function (key) {
|
|
|
52 |
_defineProperty(target, key, source[key]);
|
|
|
53 |
});
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
return target;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
var _WINDOW = {};
|
|
|
60 |
var _DOCUMENT = {};
|
|
|
61 |
|
|
|
62 |
try {
|
|
|
63 |
if (typeof window !== 'undefined') _WINDOW = window;
|
|
|
64 |
if (typeof document !== 'undefined') _DOCUMENT = document;
|
|
|
65 |
} catch (e) {}
|
|
|
66 |
|
|
|
67 |
var _ref = _WINDOW.navigator || {},
|
|
|
68 |
_ref$userAgent = _ref.userAgent,
|
|
|
69 |
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
|
|
|
70 |
|
|
|
71 |
var WINDOW = _WINDOW;
|
|
|
72 |
var DOCUMENT = _DOCUMENT;
|
|
|
73 |
var IS_BROWSER = !!WINDOW.document;
|
|
|
74 |
var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
|
|
|
75 |
var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
|
|
|
76 |
|
|
|
77 |
var functions = [];
|
|
|
78 |
|
|
|
79 |
var listener = function listener() {
|
|
|
80 |
DOCUMENT.removeEventListener('DOMContentLoaded', listener);
|
|
|
81 |
loaded = 1;
|
|
|
82 |
functions.map(function (fn) {
|
|
|
83 |
return fn();
|
|
|
84 |
});
|
|
|
85 |
};
|
|
|
86 |
|
|
|
87 |
var loaded = false;
|
|
|
88 |
|
|
|
89 |
if (IS_DOM) {
|
|
|
90 |
loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
|
|
|
91 |
if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
function domready (fn) {
|
|
|
95 |
if (!IS_DOM) return;
|
|
|
96 |
loaded ? setTimeout(fn, 0) : functions.push(fn);
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
function report (_ref) {
|
|
|
100 |
var nodesTested = _ref.nodesTested,
|
|
|
101 |
nodesFound = _ref.nodesFound;
|
|
|
102 |
var timedOutTests = {};
|
|
|
103 |
|
|
|
104 |
for (var key in nodesFound) {
|
|
|
105 |
if (!(nodesTested.conflict[key] || nodesTested.noConflict[key])) {
|
|
|
106 |
timedOutTests[key] = nodesFound[key];
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
var conflictsCount = Object.keys(nodesTested.conflict).length;
|
|
|
111 |
|
|
|
112 |
if (conflictsCount > 0) {
|
|
|
113 |
console.info("%cConflict".concat(conflictsCount > 1 ? 's' : '', " found:"), 'color: darkred; font-size: large');
|
|
|
114 |
var data = {};
|
|
|
115 |
|
|
|
116 |
for (var _key in nodesTested.conflict) {
|
|
|
117 |
var item = nodesTested.conflict[_key];
|
|
|
118 |
data[_key] = {
|
|
|
119 |
'tagName': item.tagName,
|
|
|
120 |
'src/href': item.src || item.href || 'n/a',
|
|
|
121 |
'innerText excerpt': item.innerText && item.innerText !== '' ? item.innerText.slice(0, 200) + '...' : '(empty)'
|
|
|
122 |
};
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
console.table(data);
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
var noConflictsCount = Object.keys(nodesTested.noConflict).length;
|
|
|
129 |
|
|
|
130 |
if (noConflictsCount > 0) {
|
|
|
131 |
console.info("%cNo conflict".concat(noConflictsCount > 1 ? 's' : '', " found with ").concat(noConflictsCount == 1 ? 'this' : 'these', ":"), 'color: green; font-size: large');
|
|
|
132 |
var _data = {};
|
|
|
133 |
|
|
|
134 |
for (var _key2 in nodesTested.noConflict) {
|
|
|
135 |
var _item = nodesTested.noConflict[_key2];
|
|
|
136 |
_data[_key2] = {
|
|
|
137 |
'tagName': _item.tagName,
|
|
|
138 |
'src/href': _item.src || _item.href || 'n/a',
|
|
|
139 |
'innerText excerpt': _item.innerText && _item.innerText !== '' ? _item.innerText.slice(0, 200) + '...' : '(empty)'
|
|
|
140 |
};
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
console.table(_data);
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
var timeOutCount = Object.keys(timedOutTests).length;
|
|
|
147 |
|
|
|
148 |
if (timeOutCount > 0) {
|
|
|
149 |
console.info("%cLeftovers--we timed out before collecting test results for ".concat(timeOutCount == 1 ? 'this' : 'these', ":"), 'color: blue; font-size: large');
|
|
|
150 |
var _data2 = {};
|
|
|
151 |
|
|
|
152 |
for (var _key3 in timedOutTests) {
|
|
|
153 |
var _item2 = timedOutTests[_key3];
|
|
|
154 |
_data2[_key3] = {
|
|
|
155 |
'tagName': _item2.tagName,
|
|
|
156 |
'src/href': _item2.src || _item2.href || 'n/a',
|
|
|
157 |
'innerText excerpt': _item2.innerText && _item2.innerText !== '' ? _item2.innerText.slice(0, 200) + '...' : '(empty)'
|
|
|
158 |
};
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
console.table(_data2);
|
|
|
162 |
}
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
|
166 |
|
|
|
167 |
function createCommonjsModule(fn, module) {
|
|
|
168 |
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
var md5 = createCommonjsModule(function (module) {
|
|
|
172 |
|
|
|
173 |
(function ($) {
|
|
|
174 |
/**
|
|
|
175 |
* Add integers, wrapping at 2^32.
|
|
|
176 |
* This uses 16-bit operations internally to work around bugs in interpreters.
|
|
|
177 |
*
|
|
|
178 |
* @param {number} x First integer
|
|
|
179 |
* @param {number} y Second integer
|
|
|
180 |
* @returns {number} Sum
|
|
|
181 |
*/
|
|
|
182 |
|
|
|
183 |
function safeAdd(x, y) {
|
|
|
184 |
var lsw = (x & 0xffff) + (y & 0xffff);
|
|
|
185 |
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
|
186 |
return msw << 16 | lsw & 0xffff;
|
|
|
187 |
}
|
|
|
188 |
/**
|
|
|
189 |
* Bitwise rotate a 32-bit number to the left.
|
|
|
190 |
*
|
|
|
191 |
* @param {number} num 32-bit number
|
|
|
192 |
* @param {number} cnt Rotation count
|
|
|
193 |
* @returns {number} Rotated number
|
|
|
194 |
*/
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
function bitRotateLeft(num, cnt) {
|
|
|
198 |
return num << cnt | num >>> 32 - cnt;
|
|
|
199 |
}
|
|
|
200 |
/**
|
|
|
201 |
* Basic operation the algorithm uses.
|
|
|
202 |
*
|
|
|
203 |
* @param {number} q q
|
|
|
204 |
* @param {number} a a
|
|
|
205 |
* @param {number} b b
|
|
|
206 |
* @param {number} x x
|
|
|
207 |
* @param {number} s s
|
|
|
208 |
* @param {number} t t
|
|
|
209 |
* @returns {number} Result
|
|
|
210 |
*/
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
function md5cmn(q, a, b, x, s, t) {
|
|
|
214 |
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
|
215 |
}
|
|
|
216 |
/**
|
|
|
217 |
* Basic operation the algorithm uses.
|
|
|
218 |
*
|
|
|
219 |
* @param {number} a a
|
|
|
220 |
* @param {number} b b
|
|
|
221 |
* @param {number} c c
|
|
|
222 |
* @param {number} d d
|
|
|
223 |
* @param {number} x x
|
|
|
224 |
* @param {number} s s
|
|
|
225 |
* @param {number} t t
|
|
|
226 |
* @returns {number} Result
|
|
|
227 |
*/
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
function md5ff(a, b, c, d, x, s, t) {
|
|
|
231 |
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
|
232 |
}
|
|
|
233 |
/**
|
|
|
234 |
* Basic operation the algorithm uses.
|
|
|
235 |
*
|
|
|
236 |
* @param {number} a a
|
|
|
237 |
* @param {number} b b
|
|
|
238 |
* @param {number} c c
|
|
|
239 |
* @param {number} d d
|
|
|
240 |
* @param {number} x x
|
|
|
241 |
* @param {number} s s
|
|
|
242 |
* @param {number} t t
|
|
|
243 |
* @returns {number} Result
|
|
|
244 |
*/
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
function md5gg(a, b, c, d, x, s, t) {
|
|
|
248 |
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
|
249 |
}
|
|
|
250 |
/**
|
|
|
251 |
* Basic operation the algorithm uses.
|
|
|
252 |
*
|
|
|
253 |
* @param {number} a a
|
|
|
254 |
* @param {number} b b
|
|
|
255 |
* @param {number} c c
|
|
|
256 |
* @param {number} d d
|
|
|
257 |
* @param {number} x x
|
|
|
258 |
* @param {number} s s
|
|
|
259 |
* @param {number} t t
|
|
|
260 |
* @returns {number} Result
|
|
|
261 |
*/
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
function md5hh(a, b, c, d, x, s, t) {
|
|
|
265 |
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
|
266 |
}
|
|
|
267 |
/**
|
|
|
268 |
* Basic operation the algorithm uses.
|
|
|
269 |
*
|
|
|
270 |
* @param {number} a a
|
|
|
271 |
* @param {number} b b
|
|
|
272 |
* @param {number} c c
|
|
|
273 |
* @param {number} d d
|
|
|
274 |
* @param {number} x x
|
|
|
275 |
* @param {number} s s
|
|
|
276 |
* @param {number} t t
|
|
|
277 |
* @returns {number} Result
|
|
|
278 |
*/
|
|
|
279 |
|
|
|
280 |
|
|
|
281 |
function md5ii(a, b, c, d, x, s, t) {
|
|
|
282 |
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
|
283 |
}
|
|
|
284 |
/**
|
|
|
285 |
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
|
286 |
*
|
|
|
287 |
* @param {Array} x Array of little-endian words
|
|
|
288 |
* @param {number} len Bit length
|
|
|
289 |
* @returns {Array<number>} MD5 Array
|
|
|
290 |
*/
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
function binlMD5(x, len) {
|
|
|
294 |
/* append padding */
|
|
|
295 |
x[len >> 5] |= 0x80 << len % 32;
|
|
|
296 |
x[(len + 64 >>> 9 << 4) + 14] = len;
|
|
|
297 |
var i;
|
|
|
298 |
var olda;
|
|
|
299 |
var oldb;
|
|
|
300 |
var oldc;
|
|
|
301 |
var oldd;
|
|
|
302 |
var a = 1732584193;
|
|
|
303 |
var b = -271733879;
|
|
|
304 |
var c = -1732584194;
|
|
|
305 |
var d = 271733878;
|
|
|
306 |
|
|
|
307 |
for (i = 0; i < x.length; i += 16) {
|
|
|
308 |
olda = a;
|
|
|
309 |
oldb = b;
|
|
|
310 |
oldc = c;
|
|
|
311 |
oldd = d;
|
|
|
312 |
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
|
313 |
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
|
314 |
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
|
315 |
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
|
316 |
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
|
317 |
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
|
318 |
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
|
319 |
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
|
320 |
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
|
321 |
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
|
322 |
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
|
323 |
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
|
324 |
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
|
325 |
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
|
326 |
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
|
327 |
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
|
328 |
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
|
329 |
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
|
330 |
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
|
331 |
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
|
332 |
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
|
333 |
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
|
334 |
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
|
335 |
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
|
336 |
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
|
337 |
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
|
338 |
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
|
339 |
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
|
340 |
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
|
341 |
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
|
342 |
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
|
343 |
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
|
344 |
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
|
345 |
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
|
346 |
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
|
347 |
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
|
348 |
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
|
349 |
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
|
350 |
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
|
351 |
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
|
352 |
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
|
353 |
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
|
354 |
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
|
355 |
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
|
356 |
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
|
357 |
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
|
358 |
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
|
359 |
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
|
360 |
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
|
361 |
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
|
362 |
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
|
363 |
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
|
364 |
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
|
365 |
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
|
366 |
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
|
367 |
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
|
368 |
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
|
369 |
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
|
370 |
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
|
371 |
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
|
372 |
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
|
373 |
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
|
374 |
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
|
375 |
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
|
376 |
a = safeAdd(a, olda);
|
|
|
377 |
b = safeAdd(b, oldb);
|
|
|
378 |
c = safeAdd(c, oldc);
|
|
|
379 |
d = safeAdd(d, oldd);
|
|
|
380 |
}
|
|
|
381 |
|
|
|
382 |
return [a, b, c, d];
|
|
|
383 |
}
|
|
|
384 |
/**
|
|
|
385 |
* Convert an array of little-endian words to a string
|
|
|
386 |
*
|
|
|
387 |
* @param {Array<number>} input MD5 Array
|
|
|
388 |
* @returns {string} MD5 string
|
|
|
389 |
*/
|
|
|
390 |
|
|
|
391 |
|
|
|
392 |
function binl2rstr(input) {
|
|
|
393 |
var i;
|
|
|
394 |
var output = '';
|
|
|
395 |
var length32 = input.length * 32;
|
|
|
396 |
|
|
|
397 |
for (i = 0; i < length32; i += 8) {
|
|
|
398 |
output += String.fromCharCode(input[i >> 5] >>> i % 32 & 0xff);
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
return output;
|
|
|
402 |
}
|
|
|
403 |
/**
|
|
|
404 |
* Convert a raw string to an array of little-endian words
|
|
|
405 |
* Characters >255 have their high-byte silently ignored.
|
|
|
406 |
*
|
|
|
407 |
* @param {string} input Raw input string
|
|
|
408 |
* @returns {Array<number>} Array of little-endian words
|
|
|
409 |
*/
|
|
|
410 |
|
|
|
411 |
|
|
|
412 |
function rstr2binl(input) {
|
|
|
413 |
var i;
|
|
|
414 |
var output = [];
|
|
|
415 |
output[(input.length >> 2) - 1] = undefined;
|
|
|
416 |
|
|
|
417 |
for (i = 0; i < output.length; i += 1) {
|
|
|
418 |
output[i] = 0;
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
var length8 = input.length * 8;
|
|
|
422 |
|
|
|
423 |
for (i = 0; i < length8; i += 8) {
|
|
|
424 |
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
return output;
|
|
|
428 |
}
|
|
|
429 |
/**
|
|
|
430 |
* Calculate the MD5 of a raw string
|
|
|
431 |
*
|
|
|
432 |
* @param {string} s Input string
|
|
|
433 |
* @returns {string} Raw MD5 string
|
|
|
434 |
*/
|
|
|
435 |
|
|
|
436 |
|
|
|
437 |
function rstrMD5(s) {
|
|
|
438 |
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
|
|
|
439 |
}
|
|
|
440 |
/**
|
|
|
441 |
* Calculates the HMAC-MD5 of a key and some data (raw strings)
|
|
|
442 |
*
|
|
|
443 |
* @param {string} key HMAC key
|
|
|
444 |
* @param {string} data Raw input string
|
|
|
445 |
* @returns {string} Raw MD5 string
|
|
|
446 |
*/
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
function rstrHMACMD5(key, data) {
|
|
|
450 |
var i;
|
|
|
451 |
var bkey = rstr2binl(key);
|
|
|
452 |
var ipad = [];
|
|
|
453 |
var opad = [];
|
|
|
454 |
var hash;
|
|
|
455 |
ipad[15] = opad[15] = undefined;
|
|
|
456 |
|
|
|
457 |
if (bkey.length > 16) {
|
|
|
458 |
bkey = binlMD5(bkey, key.length * 8);
|
|
|
459 |
}
|
|
|
460 |
|
|
|
461 |
for (i = 0; i < 16; i += 1) {
|
|
|
462 |
ipad[i] = bkey[i] ^ 0x36363636;
|
|
|
463 |
opad[i] = bkey[i] ^ 0x5c5c5c5c;
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
|
|
467 |
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
|
|
|
468 |
}
|
|
|
469 |
/**
|
|
|
470 |
* Convert a raw string to a hex string
|
|
|
471 |
*
|
|
|
472 |
* @param {string} input Raw input string
|
|
|
473 |
* @returns {string} Hex encoded string
|
|
|
474 |
*/
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
function rstr2hex(input) {
|
|
|
478 |
var hexTab = '0123456789abcdef';
|
|
|
479 |
var output = '';
|
|
|
480 |
var x;
|
|
|
481 |
var i;
|
|
|
482 |
|
|
|
483 |
for (i = 0; i < input.length; i += 1) {
|
|
|
484 |
x = input.charCodeAt(i);
|
|
|
485 |
output += hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f);
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
return output;
|
|
|
489 |
}
|
|
|
490 |
/**
|
|
|
491 |
* Encode a string as UTF-8
|
|
|
492 |
*
|
|
|
493 |
* @param {string} input Input string
|
|
|
494 |
* @returns {string} UTF8 string
|
|
|
495 |
*/
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
function str2rstrUTF8(input) {
|
|
|
499 |
return unescape(encodeURIComponent(input));
|
|
|
500 |
}
|
|
|
501 |
/**
|
|
|
502 |
* Encodes input string as raw MD5 string
|
|
|
503 |
*
|
|
|
504 |
* @param {string} s Input string
|
|
|
505 |
* @returns {string} Raw MD5 string
|
|
|
506 |
*/
|
|
|
507 |
|
|
|
508 |
|
|
|
509 |
function rawMD5(s) {
|
|
|
510 |
return rstrMD5(str2rstrUTF8(s));
|
|
|
511 |
}
|
|
|
512 |
/**
|
|
|
513 |
* Encodes input string as Hex encoded string
|
|
|
514 |
*
|
|
|
515 |
* @param {string} s Input string
|
|
|
516 |
* @returns {string} Hex encoded string
|
|
|
517 |
*/
|
|
|
518 |
|
|
|
519 |
|
|
|
520 |
function hexMD5(s) {
|
|
|
521 |
return rstr2hex(rawMD5(s));
|
|
|
522 |
}
|
|
|
523 |
/**
|
|
|
524 |
* Calculates the raw HMAC-MD5 for the given key and data
|
|
|
525 |
*
|
|
|
526 |
* @param {string} k HMAC key
|
|
|
527 |
* @param {string} d Input string
|
|
|
528 |
* @returns {string} Raw MD5 string
|
|
|
529 |
*/
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
function rawHMACMD5(k, d) {
|
|
|
533 |
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
|
|
|
534 |
}
|
|
|
535 |
/**
|
|
|
536 |
* Calculates the Hex encoded HMAC-MD5 for the given key and data
|
|
|
537 |
*
|
|
|
538 |
* @param {string} k HMAC key
|
|
|
539 |
* @param {string} d Input string
|
|
|
540 |
* @returns {string} Raw MD5 string
|
|
|
541 |
*/
|
|
|
542 |
|
|
|
543 |
|
|
|
544 |
function hexHMACMD5(k, d) {
|
|
|
545 |
return rstr2hex(rawHMACMD5(k, d));
|
|
|
546 |
}
|
|
|
547 |
/**
|
|
|
548 |
* Calculates MD5 value for a given string.
|
|
|
549 |
* If a key is provided, calculates the HMAC-MD5 value.
|
|
|
550 |
* Returns a Hex encoded string unless the raw argument is given.
|
|
|
551 |
*
|
|
|
552 |
* @param {string} string Input string
|
|
|
553 |
* @param {string} [key] HMAC key
|
|
|
554 |
* @param {boolean} raw Raw oytput switch
|
|
|
555 |
* @returns {string} MD5 output
|
|
|
556 |
*/
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
function md5(string, key, raw) {
|
|
|
560 |
if (!key) {
|
|
|
561 |
if (!raw) {
|
|
|
562 |
return hexMD5(string);
|
|
|
563 |
}
|
|
|
564 |
|
|
|
565 |
return rawMD5(string);
|
|
|
566 |
}
|
|
|
567 |
|
|
|
568 |
if (!raw) {
|
|
|
569 |
return hexHMACMD5(key, string);
|
|
|
570 |
}
|
|
|
571 |
|
|
|
572 |
return rawHMACMD5(key, string);
|
|
|
573 |
}
|
|
|
574 |
|
|
|
575 |
if (module.exports) {
|
|
|
576 |
module.exports = md5;
|
|
|
577 |
} else {
|
|
|
578 |
$.md5 = md5;
|
|
|
579 |
}
|
|
|
580 |
})(commonjsGlobal);
|
|
|
581 |
});
|
|
|
582 |
|
|
|
583 |
function md5ForNode(node) {
|
|
|
584 |
if (null === node || 'object' !== _typeof(node)) return undefined;
|
|
|
585 |
|
|
|
586 |
if (node.src) {
|
|
|
587 |
return md5(node.src);
|
|
|
588 |
} else if (node.href) {
|
|
|
589 |
return md5(node.href);
|
|
|
590 |
} else if (node.innerText && '' !== node.innerText) {
|
|
|
591 |
// eslint-disable-line yoda
|
|
|
592 |
return md5(node.innerText);
|
|
|
593 |
} else {
|
|
|
594 |
return undefined;
|
|
|
595 |
}
|
|
|
596 |
}
|
|
|
597 |
|
|
|
598 |
var diagScriptId = 'fa-kits-diag';
|
|
|
599 |
var nodeUnderTestId = 'fa-kits-node-under-test';
|
|
|
600 |
var md5Attr = 'data-md5';
|
|
|
601 |
var detectionIgnoreAttr = 'data-fa-detection-ignore';
|
|
|
602 |
var timeoutAttr = 'data-fa-detection-timeout';
|
|
|
603 |
var resultsCollectionMaxWaitAttr = 'data-fa-detection-results-collection-max-wait';
|
|
|
604 |
|
|
|
605 |
function pollUntil(_ref) {
|
|
|
606 |
var _ref$fn = _ref.fn,
|
|
|
607 |
fn = _ref$fn === void 0 ? function () {
|
|
|
608 |
return true;
|
|
|
609 |
} : _ref$fn,
|
|
|
610 |
_ref$initialDuration = _ref.initialDuration,
|
|
|
611 |
initialDuration = _ref$initialDuration === void 0 ? 1 : _ref$initialDuration,
|
|
|
612 |
_ref$maxDuration = _ref.maxDuration,
|
|
|
613 |
maxDuration = _ref$maxDuration === void 0 ? WINDOW.FontAwesomeDetection.timeout : _ref$maxDuration,
|
|
|
614 |
_ref$showProgress = _ref.showProgress,
|
|
|
615 |
showProgress = _ref$showProgress === void 0 ? false : _ref$showProgress,
|
|
|
616 |
progressIndicator = _ref.progressIndicator;
|
|
|
617 |
return new Promise(function (resolve, reject) {
|
|
|
618 |
// eslint-disable-line compat/compat
|
|
|
619 |
function poll(duration, cumulativeDuration) {
|
|
|
620 |
setTimeout(function () {
|
|
|
621 |
var result = fn();
|
|
|
622 |
|
|
|
623 |
if (showProgress) {
|
|
|
624 |
console.info(progressIndicator);
|
|
|
625 |
}
|
|
|
626 |
|
|
|
627 |
if (!!result) {
|
|
|
628 |
// eslint-disable-line no-extra-boolean-cast
|
|
|
629 |
resolve(result);
|
|
|
630 |
} else {
|
|
|
631 |
var nextDuration = 250;
|
|
|
632 |
var nextCumulativeDuration = nextDuration + cumulativeDuration;
|
|
|
633 |
|
|
|
634 |
if (nextCumulativeDuration <= maxDuration) {
|
|
|
635 |
poll(nextDuration, nextCumulativeDuration);
|
|
|
636 |
} else {
|
|
|
637 |
reject('timeout'); // eslint-disable-line prefer-promise-reject-errors
|
|
|
638 |
}
|
|
|
639 |
}
|
|
|
640 |
}, duration);
|
|
|
641 |
}
|
|
|
642 |
|
|
|
643 |
poll(initialDuration, 0);
|
|
|
644 |
});
|
|
|
645 |
}
|
|
|
646 |
|
|
|
647 |
function detectWebfontConflicts() {
|
|
|
648 |
var linkTags = Array.from(DOCUMENT.getElementsByTagName('link')).filter(function (t) {
|
|
|
649 |
return !t.hasAttribute(detectionIgnoreAttr);
|
|
|
650 |
});
|
|
|
651 |
var styleTags = Array.from(DOCUMENT.getElementsByTagName('style')).filter(function (t) {
|
|
|
652 |
if (t.hasAttribute(detectionIgnoreAttr)) {
|
|
|
653 |
return false;
|
|
|
654 |
} // If the browser has loaded the FA5 CSS, let's not test that <style> element.
|
|
|
655 |
// Its enough that we'll be testing for traces of the corresponding JS being loaded, and testing
|
|
|
656 |
// this <style> would only produce a false negative anyway.
|
|
|
657 |
|
|
|
658 |
|
|
|
659 |
if (WINDOW.FontAwesomeConfig && t.innerText.match(new RegExp("svg:not\\(:root\\)\\.".concat(WINDOW.FontAwesomeConfig.replacementClass)))) {
|
|
|
660 |
return false;
|
|
|
661 |
}
|
|
|
662 |
|
|
|
663 |
return true;
|
|
|
664 |
});
|
|
|
665 |
|
|
|
666 |
function runDiag(scriptOrLinkTag, md5) {
|
|
|
667 |
var diagFrame = DOCUMENT.createElement('iframe'); // Using "visibility: hidden; position: absolute" instead of "display: none;" because
|
|
|
668 |
// Firefox will not return the expected results for getComputedStyle if our iframe has display: none.
|
|
|
669 |
|
|
|
670 |
diagFrame.setAttribute('style', 'visibility: hidden; position: absolute; height: 0; width: 0;');
|
|
|
671 |
var testIconId = 'fa-test-icon-' + md5;
|
|
|
672 |
var iTag = DOCUMENT.createElement('i');
|
|
|
673 |
iTag.setAttribute('class', 'fa fa-coffee');
|
|
|
674 |
iTag.setAttribute('id', testIconId);
|
|
|
675 |
var diagScript = DOCUMENT.createElement('script');
|
|
|
676 |
diagScript.setAttribute('id', diagScriptId); // WARNING: this function will be toString()'d and assigned to innerText of the diag script
|
|
|
677 |
// element that we'll be putting into a diagnostic iframe.
|
|
|
678 |
// That means that this code won't compile until after the outer script has run and injected
|
|
|
679 |
// this code into the iframe. There are some compile time errors that might occur there.
|
|
|
680 |
// For example, using single line (double-slash) comments like this one inside that function
|
|
|
681 |
// will probably cause it to choke. Chrome will show an error like this:
|
|
|
682 |
// Uncaught SyntaxError: Unexpected end of input
|
|
|
683 |
|
|
|
684 |
var diagScriptFun = function diagScriptFun(nodeUnderTestId, testIconId, md5, parentOrigin) {
|
|
|
685 |
parent.FontAwesomeDetection.__pollUntil({
|
|
|
686 |
fn: function fn() {
|
|
|
687 |
var iEl = document.getElementById(testIconId);
|
|
|
688 |
var computedStyle = window.getComputedStyle(iEl);
|
|
|
689 |
var fontFamily = computedStyle.getPropertyValue('font-family');
|
|
|
690 |
|
|
|
691 |
if (!!fontFamily.match(/FontAwesome/) || !!fontFamily.match(/Font Awesome 5/)) {
|
|
|
692 |
return true;
|
|
|
693 |
} else {
|
|
|
694 |
return false;
|
|
|
695 |
}
|
|
|
696 |
}
|
|
|
697 |
}).then(function () {
|
|
|
698 |
var node = document.getElementById(nodeUnderTestId);
|
|
|
699 |
parent.postMessage({
|
|
|
700 |
type: 'fontawesome-conflict',
|
|
|
701 |
technology: 'webfont',
|
|
|
702 |
href: node.href,
|
|
|
703 |
innerText: node.innerText,
|
|
|
704 |
tagName: node.tagName,
|
|
|
705 |
md5: md5
|
|
|
706 |
}, parentOrigin);
|
|
|
707 |
}).catch(function (e) {
|
|
|
708 |
var node = document.getElementById(nodeUnderTestId);
|
|
|
709 |
|
|
|
710 |
if (e === 'timeout') {
|
|
|
711 |
parent.postMessage({
|
|
|
712 |
type: 'no-conflict',
|
|
|
713 |
technology: 'webfont',
|
|
|
714 |
href: node.src,
|
|
|
715 |
innerText: node.innerText,
|
|
|
716 |
tagName: node.tagName,
|
|
|
717 |
md5: md5
|
|
|
718 |
}, parentOrigin);
|
|
|
719 |
} else {
|
|
|
720 |
console.error(e);
|
|
|
721 |
}
|
|
|
722 |
});
|
|
|
723 |
};
|
|
|
724 |
|
|
|
725 |
var parentOrigin = WINDOW.location.origin === 'file://' ? '*' : WINDOW.location.origin;
|
|
|
726 |
diagScript.innerText = "(".concat(diagScriptFun.toString(), ")('").concat(nodeUnderTestId, "', '").concat(testIconId || 'foo', "', '").concat(md5, "', '").concat(parentOrigin, "');");
|
|
|
727 |
|
|
|
728 |
diagFrame.onload = function () {
|
|
|
729 |
diagFrame.contentDocument.head.appendChild(diagScript);
|
|
|
730 |
diagFrame.contentDocument.head.appendChild(scriptOrLinkTag);
|
|
|
731 |
diagFrame.contentDocument.body.appendChild(iTag);
|
|
|
732 |
};
|
|
|
733 |
|
|
|
734 |
domready(function () {
|
|
|
735 |
return DOCUMENT.body.appendChild(diagFrame);
|
|
|
736 |
});
|
|
|
737 |
}
|
|
|
738 |
|
|
|
739 |
var cssByMD5 = {};
|
|
|
740 |
|
|
|
741 |
for (var i = 0; i < linkTags.length; i++) {
|
|
|
742 |
var linkUnderTest = DOCUMENT.createElement('link');
|
|
|
743 |
linkUnderTest.setAttribute('id', nodeUnderTestId);
|
|
|
744 |
linkUnderTest.setAttribute('href', linkTags[i].href);
|
|
|
745 |
linkUnderTest.setAttribute('rel', linkTags[i].rel);
|
|
|
746 |
var md5ForLink = md5ForNode(linkTags[i]);
|
|
|
747 |
linkUnderTest.setAttribute(md5Attr, md5ForLink);
|
|
|
748 |
cssByMD5[md5ForLink] = linkTags[i];
|
|
|
749 |
runDiag(linkUnderTest, md5ForLink);
|
|
|
750 |
}
|
|
|
751 |
|
|
|
752 |
for (var _i = 0; _i < styleTags.length; _i++) {
|
|
|
753 |
var styleUnderTest = DOCUMENT.createElement('style');
|
|
|
754 |
styleUnderTest.setAttribute('id', nodeUnderTestId);
|
|
|
755 |
var md5ForStyle = md5ForNode(styleTags[_i]);
|
|
|
756 |
styleUnderTest.setAttribute(md5Attr, md5ForStyle);
|
|
|
757 |
styleUnderTest.innerText = styleTags[_i].innerText;
|
|
|
758 |
cssByMD5[md5ForStyle] = styleTags[_i];
|
|
|
759 |
runDiag(styleUnderTest, md5ForStyle);
|
|
|
760 |
}
|
|
|
761 |
|
|
|
762 |
return cssByMD5;
|
|
|
763 |
}
|
|
|
764 |
|
|
|
765 |
function detectSvgConflicts(currentScript) {
|
|
|
766 |
var scripts = Array.from(DOCUMENT.scripts).filter(function (t) {
|
|
|
767 |
return !t.hasAttribute(detectionIgnoreAttr) && t !== currentScript;
|
|
|
768 |
});
|
|
|
769 |
var scriptsByMD5 = {};
|
|
|
770 |
|
|
|
771 |
var _loop = function _loop(scriptIdx) {
|
|
|
772 |
var diagFrame = DOCUMENT.createElement('iframe');
|
|
|
773 |
diagFrame.setAttribute('style', 'display:none;');
|
|
|
774 |
var scriptUnderTest = DOCUMENT.createElement('script');
|
|
|
775 |
scriptUnderTest.setAttribute('id', nodeUnderTestId);
|
|
|
776 |
var md5ForScript = md5ForNode(scripts[scriptIdx]);
|
|
|
777 |
scriptUnderTest.setAttribute(md5Attr, md5ForScript);
|
|
|
778 |
scriptsByMD5[md5ForScript] = scripts[scriptIdx];
|
|
|
779 |
|
|
|
780 |
if (scripts[scriptIdx].src !== '') {
|
|
|
781 |
scriptUnderTest.src = scripts[scriptIdx].src;
|
|
|
782 |
}
|
|
|
783 |
|
|
|
784 |
if (scripts[scriptIdx].innerText !== '') {
|
|
|
785 |
scriptUnderTest.innerText = scripts[scriptIdx].innerText;
|
|
|
786 |
}
|
|
|
787 |
|
|
|
788 |
scriptUnderTest.async = true;
|
|
|
789 |
var diagScript = DOCUMENT.createElement('script');
|
|
|
790 |
diagScript.setAttribute('id', diagScriptId);
|
|
|
791 |
var parentOrigin = WINDOW.location.origin === 'file://' ? '*' : WINDOW.location.origin;
|
|
|
792 |
|
|
|
793 |
var diagScriptFun = function diagScriptFun(nodeUnderTestId, md5, parentOrigin) {
|
|
|
794 |
parent.FontAwesomeDetection.__pollUntil({
|
|
|
795 |
fn: function fn() {
|
|
|
796 |
return !!window.FontAwesomeConfig;
|
|
|
797 |
}
|
|
|
798 |
}).then(function () {
|
|
|
799 |
var scriptNode = document.getElementById(nodeUnderTestId);
|
|
|
800 |
parent.postMessage({
|
|
|
801 |
type: 'fontawesome-conflict',
|
|
|
802 |
technology: 'js',
|
|
|
803 |
src: scriptNode.src,
|
|
|
804 |
innerText: scriptNode.innerText,
|
|
|
805 |
tagName: scriptNode.tagName,
|
|
|
806 |
md5: md5
|
|
|
807 |
}, parentOrigin);
|
|
|
808 |
}).catch(function (e) {
|
|
|
809 |
var scriptNode = document.getElementById(nodeUnderTestId);
|
|
|
810 |
|
|
|
811 |
if (e === 'timeout') {
|
|
|
812 |
parent.postMessage({
|
|
|
813 |
type: 'no-conflict',
|
|
|
814 |
src: scriptNode.src,
|
|
|
815 |
innerText: scriptNode.innerText,
|
|
|
816 |
tagName: scriptNode.tagName,
|
|
|
817 |
md5: md5
|
|
|
818 |
}, parentOrigin);
|
|
|
819 |
} else {
|
|
|
820 |
console.error(e);
|
|
|
821 |
}
|
|
|
822 |
});
|
|
|
823 |
};
|
|
|
824 |
|
|
|
825 |
diagScript.innerText = "(".concat(diagScriptFun.toString(), ")('").concat(nodeUnderTestId, "', '").concat(md5ForScript, "', '").concat(parentOrigin, "');");
|
|
|
826 |
|
|
|
827 |
diagFrame.onload = function () {
|
|
|
828 |
diagFrame.contentDocument.head.appendChild(diagScript);
|
|
|
829 |
diagFrame.contentDocument.head.appendChild(scriptUnderTest);
|
|
|
830 |
};
|
|
|
831 |
|
|
|
832 |
domready(function () {
|
|
|
833 |
return DOCUMENT.body.appendChild(diagFrame);
|
|
|
834 |
});
|
|
|
835 |
};
|
|
|
836 |
|
|
|
837 |
for (var scriptIdx = 0; scriptIdx < scripts.length; scriptIdx++) {
|
|
|
838 |
_loop(scriptIdx);
|
|
|
839 |
}
|
|
|
840 |
|
|
|
841 |
return scriptsByMD5;
|
|
|
842 |
}
|
|
|
843 |
|
|
|
844 |
function setDoneResults(_ref2) {
|
|
|
845 |
var nodesTested = _ref2.nodesTested,
|
|
|
846 |
nodesFound = _ref2.nodesFound;
|
|
|
847 |
WINDOW.FontAwesomeDetection = WINDOW.FontAwesomeDetection || {};
|
|
|
848 |
WINDOW.FontAwesomeDetection.nodesTested = nodesTested;
|
|
|
849 |
WINDOW.FontAwesomeDetection.nodesFound = nodesFound;
|
|
|
850 |
WINDOW.FontAwesomeDetection.detectionDone = true;
|
|
|
851 |
}
|
|
|
852 |
|
|
|
853 |
function conflictDetection() {
|
|
|
854 |
var report$$1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
|
|
|
855 |
var nodesTested = {
|
|
|
856 |
conflict: {},
|
|
|
857 |
noConflict: {}
|
|
|
858 |
};
|
|
|
859 |
|
|
|
860 |
WINDOW.onmessage = function (e) {
|
|
|
861 |
if (WINDOW.location.origin === 'file://' || e.origin === WINDOW.location.origin) {
|
|
|
862 |
if (e && e.data) {
|
|
|
863 |
if (e.data.type === 'fontawesome-conflict') {
|
|
|
864 |
nodesTested.conflict[e.data.md5] = e.data;
|
|
|
865 |
} else if (e.data.type === 'no-conflict') {
|
|
|
866 |
nodesTested.noConflict[e.data.md5] = e.data;
|
|
|
867 |
}
|
|
|
868 |
}
|
|
|
869 |
}
|
|
|
870 |
};
|
|
|
871 |
|
|
|
872 |
var scriptsToTest = detectSvgConflicts(DOCUMENT.currentScript);
|
|
|
873 |
var cssToTest = detectWebfontConflicts();
|
|
|
874 |
|
|
|
875 |
var nodesFound = _objectSpread({}, scriptsToTest, cssToTest);
|
|
|
876 |
|
|
|
877 |
var testCount = Object.keys(scriptsToTest).length + Object.keys(cssToTest).length; // The resultsCollectionMaxWait allows for the time between when the tests running under
|
|
|
878 |
// child iframes call postMessage with their results, and when the parent window
|
|
|
879 |
// receives and handles those events with window.onmessage.
|
|
|
880 |
// Making it configurable allows us to test the scenario where this timeout is exceeded.
|
|
|
881 |
// Naming it something very different from "timeout" is to help avoid the potential ambiguity between
|
|
|
882 |
// these two timeout-related settings.
|
|
|
883 |
|
|
|
884 |
var masterTimeout = WINDOW.FontAwesomeDetection.timeout + WINDOW.FontAwesomeDetection.resultsCollectionMaxWait;
|
|
|
885 |
console.group('Font Awesome Detector');
|
|
|
886 |
|
|
|
887 |
if (testCount === 0) {
|
|
|
888 |
console.info('%cAll Good!', 'color: green; font-size: large');
|
|
|
889 |
console.info('We didn\'t find anything that needs testing for conflicts. Ergo, no conflicts.');
|
|
|
890 |
} else {
|
|
|
891 |
console.info("Testing ".concat(testCount, " possible conflicts."));
|
|
|
892 |
console.info("We'll wait about ".concat(Math.round(WINDOW.FontAwesomeDetection.timeout / 10) / 100, " seconds while testing these and\n") + "then up to another ".concat(Math.round(WINDOW.FontAwesomeDetection.resultsCollectionMaxWait / 10) / 100, " to allow the browser time\n") + "to accumulate the results. But we'll probably be outta here way before then.\n\n");
|
|
|
893 |
console.info("You can adjust those durations by assigning values to these attributes on the <script> element that loads this detection:");
|
|
|
894 |
console.info("\t%c".concat(timeoutAttr, "%c: milliseconds to wait for each test before deciding whether it's a conflict."), 'font-weight: bold;', 'font-size: normal;');
|
|
|
895 |
console.info("\t%c".concat(resultsCollectionMaxWaitAttr, "%c: milliseconds to wait for the browser to accumulate test results before giving up."), 'font-weight: bold;', 'font-size: normal;');
|
|
|
896 |
pollUntil({
|
|
|
897 |
// Give this overall timer a little extra cushion
|
|
|
898 |
maxDuration: masterTimeout,
|
|
|
899 |
showProgress: true,
|
|
|
900 |
progressIndicator: 'waiting...',
|
|
|
901 |
fn: function fn() {
|
|
|
902 |
return Object.keys(nodesTested.conflict).length + Object.keys(nodesTested.noConflict).length >= testCount;
|
|
|
903 |
}
|
|
|
904 |
}).then(function () {
|
|
|
905 |
console.info('DONE!');
|
|
|
906 |
setDoneResults({
|
|
|
907 |
nodesTested: nodesTested,
|
|
|
908 |
nodesFound: nodesFound
|
|
|
909 |
});
|
|
|
910 |
report$$1({
|
|
|
911 |
nodesTested: nodesTested,
|
|
|
912 |
nodesFound: nodesFound
|
|
|
913 |
});
|
|
|
914 |
console.groupEnd();
|
|
|
915 |
}).catch(function (e) {
|
|
|
916 |
if (e === 'timeout') {
|
|
|
917 |
console.info('TIME OUT! We waited until we got tired. Here\'s what we found:');
|
|
|
918 |
setDoneResults({
|
|
|
919 |
nodesTested: nodesTested,
|
|
|
920 |
nodesFound: nodesFound
|
|
|
921 |
});
|
|
|
922 |
report$$1({
|
|
|
923 |
nodesTested: nodesTested,
|
|
|
924 |
nodesFound: nodesFound
|
|
|
925 |
});
|
|
|
926 |
} else {
|
|
|
927 |
console.info('Whoops! We hit an error:', e);
|
|
|
928 |
console.info('Here\'s what we\'d found up until that error:');
|
|
|
929 |
setDoneResults({
|
|
|
930 |
nodesTested: nodesTested,
|
|
|
931 |
nodesFound: nodesFound
|
|
|
932 |
});
|
|
|
933 |
report$$1({
|
|
|
934 |
nodesTested: nodesTested,
|
|
|
935 |
nodesFound: nodesFound
|
|
|
936 |
});
|
|
|
937 |
}
|
|
|
938 |
|
|
|
939 |
console.groupEnd();
|
|
|
940 |
});
|
|
|
941 |
}
|
|
|
942 |
} // Allow clients to access, and in some cases, override some properties
|
|
|
943 |
|
|
|
944 |
var initialConfig = WINDOW.FontAwesomeDetection || {}; // These can be overridden
|
|
|
945 |
|
|
|
946 |
var _default = {
|
|
|
947 |
report: report,
|
|
|
948 |
timeout: +(DOCUMENT.currentScript.getAttribute(timeoutAttr) || "2000"),
|
|
|
949 |
resultsCollectionMaxWait: +(DOCUMENT.currentScript.getAttribute(resultsCollectionMaxWaitAttr) || "5000")
|
|
|
950 |
};
|
|
|
951 |
|
|
|
952 |
var _config = _objectSpread({}, _default, initialConfig, {
|
|
|
953 |
// These cannot be overridden
|
|
|
954 |
__pollUntil: pollUntil,
|
|
|
955 |
md5ForNode: md5ForNode,
|
|
|
956 |
detectionDone: false,
|
|
|
957 |
nodesTested: null,
|
|
|
958 |
nodesFound: null
|
|
|
959 |
});
|
|
|
960 |
|
|
|
961 |
WINDOW.FontAwesomeDetection = _config;
|
|
|
962 |
|
|
|
963 |
var PRODUCTION = function () {
|
|
|
964 |
try {
|
|
|
965 |
return process.env.NODE_ENV === 'production';
|
|
|
966 |
} catch (e) {
|
|
|
967 |
return false;
|
|
|
968 |
}
|
|
|
969 |
}();
|
|
|
970 |
|
|
|
971 |
function bunker(fn) {
|
|
|
972 |
try {
|
|
|
973 |
fn();
|
|
|
974 |
} catch (e) {
|
|
|
975 |
if (!PRODUCTION) {
|
|
|
976 |
throw e;
|
|
|
977 |
}
|
|
|
978 |
}
|
|
|
979 |
}
|
|
|
980 |
|
|
|
981 |
bunker(function () {
|
|
|
982 |
if (IS_BROWSER && IS_DOM) {
|
|
|
983 |
conflictDetection(window.FontAwesomeDetection.report);
|
|
|
984 |
}
|
|
|
985 |
});
|
|
|
986 |
|
|
|
987 |
exports.conflictDetection = conflictDetection;
|
|
|
988 |
|
|
|
989 |
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
990 |
|
|
|
991 |
})));
|