@ttoss/components 2.10.0 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/package.json +18 -11
  2. package/dist/Accordion/index.d.ts +0 -16
  3. package/dist/Drawer/index.d.ts +0 -12
  4. package/dist/FileUploader/index.d.ts +0 -55
  5. package/dist/InstallPwa/index.d.ts +0 -10
  6. package/dist/JsonEditor/index.d.ts +0 -2
  7. package/dist/JsonView/index.d.ts +0 -1
  8. package/dist/List/index.d.ts +0 -13
  9. package/dist/Markdown/index.d.ts +0 -11
  10. package/dist/Menu/index.d.ts +0 -11
  11. package/dist/Modal/index.d.ts +0 -10
  12. package/dist/NavList/index.d.ts +0 -55
  13. package/dist/NotificationCard/index.d.ts +0 -21
  14. package/dist/NotificationsMenu/index.d.ts +0 -36
  15. package/dist/Search/index.d.ts +0 -11
  16. package/dist/SpotlightCard/index.d.ts +0 -27
  17. package/dist/Table/index.d.ts +0 -16
  18. package/dist/Tabs/index.d.ts +0 -18
  19. package/dist/Toast/index.d.ts +0 -8
  20. package/dist/esm/Accordion/index.js +0 -49
  21. package/dist/esm/Drawer/index.js +0 -59
  22. package/dist/esm/FileUploader/index.js +0 -401
  23. package/dist/esm/InstallPwa/index.js +0 -61
  24. package/dist/esm/JsonEditor/index.js +0 -6
  25. package/dist/esm/JsonView/index.js +0 -6
  26. package/dist/esm/List/index.js +0 -30
  27. package/dist/esm/Markdown/index.js +0 -23
  28. package/dist/esm/Menu/index.js +0 -131
  29. package/dist/esm/Modal/index.js +0 -65
  30. package/dist/esm/NavList/index.js +0 -246
  31. package/dist/esm/NotificationCard/index.js +0 -156
  32. package/dist/esm/NotificationsMenu/index.js +0 -358
  33. package/dist/esm/Search/index.js +0 -29
  34. package/dist/esm/SpotlightCard/index.js +0 -212
  35. package/dist/esm/Table/index.js +0 -63
  36. package/dist/esm/Tabs/index.js +0 -75
  37. package/dist/esm/Toast/index.js +0 -38
  38. package/dist/esm/chunk-2R7AUPJL.js +0 -2176
  39. package/dist/esm/chunk-V4MHYKRI.js +0 -7
@@ -1,2176 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { __name } from "./chunk-V4MHYKRI.js";
3
-
4
- // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.0/node_modules/@iconify-icon/react/dist/iconify.mjs
5
- import React from "react";
6
-
7
- // ../../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
8
- var defaultIconDimensions = Object.freeze({
9
- left: 0,
10
- top: 0,
11
- width: 16,
12
- height: 16
13
- });
14
- var defaultIconTransformations = Object.freeze({
15
- rotate: 0,
16
- vFlip: false,
17
- hFlip: false
18
- });
19
- var defaultIconProps = Object.freeze({
20
- ...defaultIconDimensions,
21
- ...defaultIconTransformations
22
- });
23
- var defaultExtendedIconProps = Object.freeze({
24
- ...defaultIconProps,
25
- body: "",
26
- hidden: false
27
- });
28
- var defaultIconSizeCustomisations = Object.freeze({
29
- width: null,
30
- height: null
31
- });
32
- var defaultIconCustomisations = Object.freeze({
33
- // Dimensions
34
- ...defaultIconSizeCustomisations,
35
- // Transformations
36
- ...defaultIconTransformations
37
- });
38
- function rotateFromString(value, defaultValue = 0) {
39
- const units = value.replace(/^-?[0-9.]*/, "");
40
- function cleanup(value2) {
41
- while (value2 < 0) {
42
- value2 += 4;
43
- }
44
- return value2 % 4;
45
- }
46
- __name(cleanup, "cleanup");
47
- if (units === "") {
48
- const num = parseInt(value);
49
- return isNaN(num) ? 0 : cleanup(num);
50
- } else if (units !== value) {
51
- let split = 0;
52
- switch (units) {
53
- case "%":
54
- split = 25;
55
- break;
56
- case "deg":
57
- split = 90;
58
- }
59
- if (split) {
60
- let num = parseFloat(value.slice(0, value.length - units.length));
61
- if (isNaN(num)) {
62
- return 0;
63
- }
64
- num = num / split;
65
- return num % 1 === 0 ? cleanup(num) : 0;
66
- }
67
- }
68
- return defaultValue;
69
- }
70
- __name(rotateFromString, "rotateFromString");
71
- var separator = /[\s,]+/;
72
- function flipFromString(custom, flip) {
73
- flip.split(separator).forEach(str => {
74
- const value = str.trim();
75
- switch (value) {
76
- case "horizontal":
77
- custom.hFlip = true;
78
- break;
79
- case "vertical":
80
- custom.vFlip = true;
81
- break;
82
- }
83
- });
84
- }
85
- __name(flipFromString, "flipFromString");
86
- var defaultCustomisations = {
87
- ...defaultIconCustomisations,
88
- preserveAspectRatio: ""
89
- };
90
- function getCustomisations(node) {
91
- const customisations = {
92
- ...defaultCustomisations
93
- };
94
- const attr = /* @__PURE__ */__name((key, def) => node.getAttribute(key) || def, "attr");
95
- customisations.width = attr("width", null);
96
- customisations.height = attr("height", null);
97
- customisations.rotate = rotateFromString(attr("rotate", ""));
98
- flipFromString(customisations, attr("flip", ""));
99
- customisations.preserveAspectRatio = attr("preserveAspectRatio", attr("preserveaspectratio", ""));
100
- return customisations;
101
- }
102
- __name(getCustomisations, "getCustomisations");
103
- function haveCustomisationsChanged(value1, value2) {
104
- for (const key in defaultCustomisations) {
105
- if (value1[key] !== value2[key]) {
106
- return true;
107
- }
108
- }
109
- return false;
110
- }
111
- __name(haveCustomisationsChanged, "haveCustomisationsChanged");
112
- var matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
113
- var stringToIcon = /* @__PURE__ */__name((value, validate, allowSimpleName, provider = "") => {
114
- const colonSeparated = value.split(":");
115
- if (value.slice(0, 1) === "@") {
116
- if (colonSeparated.length < 2 || colonSeparated.length > 3) {
117
- return null;
118
- }
119
- provider = colonSeparated.shift().slice(1);
120
- }
121
- if (colonSeparated.length > 3 || !colonSeparated.length) {
122
- return null;
123
- }
124
- if (colonSeparated.length > 1) {
125
- const name2 = colonSeparated.pop();
126
- const prefix = colonSeparated.pop();
127
- const result = {
128
- // Allow provider without '@': "provider:prefix:name"
129
- provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
130
- prefix,
131
- name: name2
132
- };
133
- return validate && !validateIconName(result) ? null : result;
134
- }
135
- const name = colonSeparated[0];
136
- const dashSeparated = name.split("-");
137
- if (dashSeparated.length > 1) {
138
- const result = {
139
- provider,
140
- prefix: dashSeparated.shift(),
141
- name: dashSeparated.join("-")
142
- };
143
- return validate && !validateIconName(result) ? null : result;
144
- }
145
- if (allowSimpleName && provider === "") {
146
- const result = {
147
- provider,
148
- prefix: "",
149
- name
150
- };
151
- return validate && !validateIconName(result, allowSimpleName) ? null : result;
152
- }
153
- return null;
154
- }, "stringToIcon");
155
- var validateIconName = /* @__PURE__ */__name((icon, allowSimpleName) => {
156
- if (!icon) {
157
- return false;
158
- }
159
- return !!(
160
- // Check prefix: cannot be empty, unless allowSimpleName is enabled
161
- // Check name: cannot be empty
162
- (allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
163
- }, "validateIconName");
164
- function mergeIconTransformations(obj1, obj2) {
165
- const result = {};
166
- if (!obj1.hFlip !== !obj2.hFlip) {
167
- result.hFlip = true;
168
- }
169
- if (!obj1.vFlip !== !obj2.vFlip) {
170
- result.vFlip = true;
171
- }
172
- const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
173
- if (rotate) {
174
- result.rotate = rotate;
175
- }
176
- return result;
177
- }
178
- __name(mergeIconTransformations, "mergeIconTransformations");
179
- function mergeIconData(parent, child) {
180
- const result = mergeIconTransformations(parent, child);
181
- for (const key in defaultExtendedIconProps) {
182
- if (key in defaultIconTransformations) {
183
- if (key in parent && !(key in result)) {
184
- result[key] = defaultIconTransformations[key];
185
- }
186
- } else if (key in child) {
187
- result[key] = child[key];
188
- } else if (key in parent) {
189
- result[key] = parent[key];
190
- }
191
- }
192
- return result;
193
- }
194
- __name(mergeIconData, "mergeIconData");
195
- function getIconsTree(data, names) {
196
- const icons = data.icons;
197
- const aliases = data.aliases || /* @__PURE__ */Object.create(null);
198
- const resolved = /* @__PURE__ */Object.create(null);
199
- function resolve(name) {
200
- if (icons[name]) {
201
- return resolved[name] = [];
202
- }
203
- if (!(name in resolved)) {
204
- resolved[name] = null;
205
- const parent = aliases[name] && aliases[name].parent;
206
- const value = parent && resolve(parent);
207
- if (value) {
208
- resolved[name] = [parent].concat(value);
209
- }
210
- }
211
- return resolved[name];
212
- }
213
- __name(resolve, "resolve");
214
- Object.keys(icons).concat(Object.keys(aliases)).forEach(resolve);
215
- return resolved;
216
- }
217
- __name(getIconsTree, "getIconsTree");
218
- function internalGetIconData(data, name, tree) {
219
- const icons = data.icons;
220
- const aliases = data.aliases || /* @__PURE__ */Object.create(null);
221
- let currentProps = {};
222
- function parse(name2) {
223
- currentProps = mergeIconData(icons[name2] || aliases[name2], currentProps);
224
- }
225
- __name(parse, "parse");
226
- parse(name);
227
- tree.forEach(parse);
228
- return mergeIconData(data, currentProps);
229
- }
230
- __name(internalGetIconData, "internalGetIconData");
231
- function parseIconSet(data, callback) {
232
- const names = [];
233
- if (typeof data !== "object" || typeof data.icons !== "object") {
234
- return names;
235
- }
236
- if (data.not_found instanceof Array) {
237
- data.not_found.forEach(name => {
238
- callback(name, null);
239
- names.push(name);
240
- });
241
- }
242
- const tree = getIconsTree(data);
243
- for (const name in tree) {
244
- const item = tree[name];
245
- if (item) {
246
- callback(name, internalGetIconData(data, name, item));
247
- names.push(name);
248
- }
249
- }
250
- return names;
251
- }
252
- __name(parseIconSet, "parseIconSet");
253
- var optionalPropertyDefaults = {
254
- provider: "",
255
- aliases: {},
256
- not_found: {},
257
- ...defaultIconDimensions
258
- };
259
- function checkOptionalProps(item, defaults) {
260
- for (const prop in defaults) {
261
- if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
262
- return false;
263
- }
264
- }
265
- return true;
266
- }
267
- __name(checkOptionalProps, "checkOptionalProps");
268
- function quicklyValidateIconSet(obj) {
269
- if (typeof obj !== "object" || obj === null) {
270
- return null;
271
- }
272
- const data = obj;
273
- if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
274
- return null;
275
- }
276
- if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
277
- return null;
278
- }
279
- const icons = data.icons;
280
- for (const name in icons) {
281
- const icon = icons[name];
282
- if (
283
- // Name cannot be empty
284
- !name ||
285
- // Must have body
286
- typeof icon.body !== "string" ||
287
- // Check other props
288
- !checkOptionalProps(icon, defaultExtendedIconProps)) {
289
- return null;
290
- }
291
- }
292
- const aliases = data.aliases || /* @__PURE__ */Object.create(null);
293
- for (const name in aliases) {
294
- const icon = aliases[name];
295
- const parent = icon.parent;
296
- if (
297
- // Name cannot be empty
298
- !name ||
299
- // Parent must be set and point to existing icon
300
- typeof parent !== "string" || !icons[parent] && !aliases[parent] ||
301
- // Check other props
302
- !checkOptionalProps(icon, defaultExtendedIconProps)) {
303
- return null;
304
- }
305
- }
306
- return data;
307
- }
308
- __name(quicklyValidateIconSet, "quicklyValidateIconSet");
309
- var dataStorage = /* @__PURE__ */Object.create(null);
310
- function newStorage(provider, prefix) {
311
- return {
312
- provider,
313
- prefix,
314
- icons: /* @__PURE__ */Object.create(null),
315
- missing: /* @__PURE__ */new Set()
316
- };
317
- }
318
- __name(newStorage, "newStorage");
319
- function getStorage(provider, prefix) {
320
- const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */Object.create(null));
321
- return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
322
- }
323
- __name(getStorage, "getStorage");
324
- function addIconSet(storage2, data) {
325
- if (!quicklyValidateIconSet(data)) {
326
- return [];
327
- }
328
- return parseIconSet(data, (name, icon) => {
329
- if (icon) {
330
- storage2.icons[name] = icon;
331
- } else {
332
- storage2.missing.add(name);
333
- }
334
- });
335
- }
336
- __name(addIconSet, "addIconSet");
337
- function addIconToStorage(storage2, name, icon) {
338
- try {
339
- if (typeof icon.body === "string") {
340
- storage2.icons[name] = {
341
- ...icon
342
- };
343
- return true;
344
- }
345
- } catch (err) {}
346
- return false;
347
- }
348
- __name(addIconToStorage, "addIconToStorage");
349
- function listIcons$1(provider, prefix) {
350
- let allIcons = [];
351
- const providers = typeof provider === "string" ? [provider] : Object.keys(dataStorage);
352
- providers.forEach(provider2 => {
353
- const prefixes = typeof provider2 === "string" && typeof prefix === "string" ? [prefix] : Object.keys(dataStorage[provider2] || {});
354
- prefixes.forEach(prefix2 => {
355
- const storage2 = getStorage(provider2, prefix2);
356
- allIcons = allIcons.concat(Object.keys(storage2.icons).map(name => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name));
357
- });
358
- });
359
- return allIcons;
360
- }
361
- __name(listIcons$1, "listIcons$1");
362
- var simpleNames = false;
363
- function allowSimpleNames(allow) {
364
- if (typeof allow === "boolean") {
365
- simpleNames = allow;
366
- }
367
- return simpleNames;
368
- }
369
- __name(allowSimpleNames, "allowSimpleNames");
370
- function getIconData(name) {
371
- const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
372
- if (icon) {
373
- const storage2 = getStorage(icon.provider, icon.prefix);
374
- const iconName = icon.name;
375
- return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
376
- }
377
- }
378
- __name(getIconData, "getIconData");
379
- function addIcon$1(name, data) {
380
- const icon = stringToIcon(name, true, simpleNames);
381
- if (!icon) {
382
- return false;
383
- }
384
- const storage2 = getStorage(icon.provider, icon.prefix);
385
- if (data) {
386
- return addIconToStorage(storage2, icon.name, data);
387
- } else {
388
- storage2.missing.add(icon.name);
389
- return true;
390
- }
391
- }
392
- __name(addIcon$1, "addIcon$1");
393
- function addCollection$1(data, provider) {
394
- if (typeof data !== "object") {
395
- return false;
396
- }
397
- if (typeof provider !== "string") {
398
- provider = data.provider || "";
399
- }
400
- if (simpleNames && !provider && !data.prefix) {
401
- let added = false;
402
- if (quicklyValidateIconSet(data)) {
403
- data.prefix = "";
404
- parseIconSet(data, (name, icon) => {
405
- if (addIcon$1(name, icon)) {
406
- added = true;
407
- }
408
- });
409
- }
410
- return added;
411
- }
412
- const prefix = data.prefix;
413
- if (!validateIconName({
414
- provider,
415
- prefix,
416
- name: "a"
417
- })) {
418
- return false;
419
- }
420
- const storage2 = getStorage(provider, prefix);
421
- return !!addIconSet(storage2, data);
422
- }
423
- __name(addCollection$1, "addCollection$1");
424
- function iconLoaded$1(name) {
425
- return !!getIconData(name);
426
- }
427
- __name(iconLoaded$1, "iconLoaded$1");
428
- function getIcon$1(name) {
429
- const result = getIconData(name);
430
- return result ? {
431
- ...defaultIconProps,
432
- ...result
433
- } : result;
434
- }
435
- __name(getIcon$1, "getIcon$1");
436
- function sortIcons(icons) {
437
- const result = {
438
- loaded: [],
439
- missing: [],
440
- pending: []
441
- };
442
- const storage2 = /* @__PURE__ */Object.create(null);
443
- icons.sort((a, b) => {
444
- if (a.provider !== b.provider) {
445
- return a.provider.localeCompare(b.provider);
446
- }
447
- if (a.prefix !== b.prefix) {
448
- return a.prefix.localeCompare(b.prefix);
449
- }
450
- return a.name.localeCompare(b.name);
451
- });
452
- let lastIcon = {
453
- provider: "",
454
- prefix: "",
455
- name: ""
456
- };
457
- icons.forEach(icon => {
458
- if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
459
- return;
460
- }
461
- lastIcon = icon;
462
- const provider = icon.provider;
463
- const prefix = icon.prefix;
464
- const name = icon.name;
465
- const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */Object.create(null));
466
- const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
467
- let list;
468
- if (name in localStorage.icons) {
469
- list = result.loaded;
470
- } else if (prefix === "" || localStorage.missing.has(name)) {
471
- list = result.missing;
472
- } else {
473
- list = result.pending;
474
- }
475
- const item = {
476
- provider,
477
- prefix,
478
- name
479
- };
480
- list.push(item);
481
- });
482
- return result;
483
- }
484
- __name(sortIcons, "sortIcons");
485
- function removeCallback(storages, id) {
486
- storages.forEach(storage2 => {
487
- const items = storage2.loaderCallbacks;
488
- if (items) {
489
- storage2.loaderCallbacks = items.filter(row => row.id !== id);
490
- }
491
- });
492
- }
493
- __name(removeCallback, "removeCallback");
494
- function updateCallbacks(storage2) {
495
- if (!storage2.pendingCallbacksFlag) {
496
- storage2.pendingCallbacksFlag = true;
497
- setTimeout(() => {
498
- storage2.pendingCallbacksFlag = false;
499
- const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
500
- if (!items.length) {
501
- return;
502
- }
503
- let hasPending = false;
504
- const provider = storage2.provider;
505
- const prefix = storage2.prefix;
506
- items.forEach(item => {
507
- const icons = item.icons;
508
- const oldLength = icons.pending.length;
509
- icons.pending = icons.pending.filter(icon => {
510
- if (icon.prefix !== prefix) {
511
- return true;
512
- }
513
- const name = icon.name;
514
- if (storage2.icons[name]) {
515
- icons.loaded.push({
516
- provider,
517
- prefix,
518
- name
519
- });
520
- } else if (storage2.missing.has(name)) {
521
- icons.missing.push({
522
- provider,
523
- prefix,
524
- name
525
- });
526
- } else {
527
- hasPending = true;
528
- return true;
529
- }
530
- return false;
531
- });
532
- if (icons.pending.length !== oldLength) {
533
- if (!hasPending) {
534
- removeCallback([storage2], item.id);
535
- }
536
- item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort);
537
- }
538
- });
539
- });
540
- }
541
- }
542
- __name(updateCallbacks, "updateCallbacks");
543
- var idCounter = 0;
544
- function storeCallback(callback, icons, pendingSources) {
545
- const id = idCounter++;
546
- const abort = removeCallback.bind(null, pendingSources, id);
547
- if (!icons.pending.length) {
548
- return abort;
549
- }
550
- const item = {
551
- id,
552
- icons,
553
- callback,
554
- abort
555
- };
556
- pendingSources.forEach(storage2 => {
557
- (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
558
- });
559
- return abort;
560
- }
561
- __name(storeCallback, "storeCallback");
562
- var storage = /* @__PURE__ */Object.create(null);
563
- function setAPIModule(provider, item) {
564
- storage[provider] = item;
565
- }
566
- __name(setAPIModule, "setAPIModule");
567
- function getAPIModule(provider) {
568
- return storage[provider] || storage[""];
569
- }
570
- __name(getAPIModule, "getAPIModule");
571
- function listToIcons(list, validate = true, simpleNames2 = false) {
572
- const result = [];
573
- list.forEach(item => {
574
- const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
575
- if (icon) {
576
- result.push(icon);
577
- }
578
- });
579
- return result;
580
- }
581
- __name(listToIcons, "listToIcons");
582
- var defaultConfig = {
583
- resources: [],
584
- index: 0,
585
- timeout: 2e3,
586
- rotate: 750,
587
- random: false,
588
- dataAfterTimeout: false
589
- };
590
- function sendQuery(config, payload, query, done) {
591
- const resourcesCount = config.resources.length;
592
- const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
593
- let resources;
594
- if (config.random) {
595
- let list = config.resources.slice(0);
596
- resources = [];
597
- while (list.length > 1) {
598
- const nextIndex = Math.floor(Math.random() * list.length);
599
- resources.push(list[nextIndex]);
600
- list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
601
- }
602
- resources = resources.concat(list);
603
- } else {
604
- resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
605
- }
606
- const startTime = Date.now();
607
- let status = "pending";
608
- let queriesSent = 0;
609
- let lastError;
610
- let timer = null;
611
- let queue = [];
612
- let doneCallbacks = [];
613
- if (typeof done === "function") {
614
- doneCallbacks.push(done);
615
- }
616
- function resetTimer() {
617
- if (timer) {
618
- clearTimeout(timer);
619
- timer = null;
620
- }
621
- }
622
- __name(resetTimer, "resetTimer");
623
- function abort() {
624
- if (status === "pending") {
625
- status = "aborted";
626
- }
627
- resetTimer();
628
- queue.forEach(item => {
629
- if (item.status === "pending") {
630
- item.status = "aborted";
631
- }
632
- });
633
- queue = [];
634
- }
635
- __name(abort, "abort");
636
- function subscribe(callback, overwrite) {
637
- if (overwrite) {
638
- doneCallbacks = [];
639
- }
640
- if (typeof callback === "function") {
641
- doneCallbacks.push(callback);
642
- }
643
- }
644
- __name(subscribe, "subscribe");
645
- function getQueryStatus() {
646
- return {
647
- startTime,
648
- payload,
649
- status,
650
- queriesSent,
651
- queriesPending: queue.length,
652
- subscribe,
653
- abort
654
- };
655
- }
656
- __name(getQueryStatus, "getQueryStatus");
657
- function failQuery() {
658
- status = "failed";
659
- doneCallbacks.forEach(callback => {
660
- callback(void 0, lastError);
661
- });
662
- }
663
- __name(failQuery, "failQuery");
664
- function clearQueue() {
665
- queue.forEach(item => {
666
- if (item.status === "pending") {
667
- item.status = "aborted";
668
- }
669
- });
670
- queue = [];
671
- }
672
- __name(clearQueue, "clearQueue");
673
- function moduleResponse(item, response, data) {
674
- const isError = response !== "success";
675
- queue = queue.filter(queued => queued !== item);
676
- switch (status) {
677
- case "pending":
678
- break;
679
- case "failed":
680
- if (isError || !config.dataAfterTimeout) {
681
- return;
682
- }
683
- break;
684
- default:
685
- return;
686
- }
687
- if (response === "abort") {
688
- lastError = data;
689
- failQuery();
690
- return;
691
- }
692
- if (isError) {
693
- lastError = data;
694
- if (!queue.length) {
695
- if (!resources.length) {
696
- failQuery();
697
- } else {
698
- execNext();
699
- }
700
- }
701
- return;
702
- }
703
- resetTimer();
704
- clearQueue();
705
- if (!config.random) {
706
- const index = config.resources.indexOf(item.resource);
707
- if (index !== -1 && index !== config.index) {
708
- config.index = index;
709
- }
710
- }
711
- status = "completed";
712
- doneCallbacks.forEach(callback => {
713
- callback(data);
714
- });
715
- }
716
- __name(moduleResponse, "moduleResponse");
717
- function execNext() {
718
- if (status !== "pending") {
719
- return;
720
- }
721
- resetTimer();
722
- const resource = resources.shift();
723
- if (resource === void 0) {
724
- if (queue.length) {
725
- timer = setTimeout(() => {
726
- resetTimer();
727
- if (status === "pending") {
728
- clearQueue();
729
- failQuery();
730
- }
731
- }, config.timeout);
732
- return;
733
- }
734
- failQuery();
735
- return;
736
- }
737
- const item = {
738
- status: "pending",
739
- resource,
740
- callback: /* @__PURE__ */__name((status2, data) => {
741
- moduleResponse(item, status2, data);
742
- }, "callback")
743
- };
744
- queue.push(item);
745
- queriesSent++;
746
- timer = setTimeout(execNext, config.rotate);
747
- query(resource, payload, item.callback);
748
- }
749
- __name(execNext, "execNext");
750
- setTimeout(execNext);
751
- return getQueryStatus;
752
- }
753
- __name(sendQuery, "sendQuery");
754
- function initRedundancy(cfg) {
755
- const config = {
756
- ...defaultConfig,
757
- ...cfg
758
- };
759
- let queries = [];
760
- function cleanup() {
761
- queries = queries.filter(item => item().status === "pending");
762
- }
763
- __name(cleanup, "cleanup");
764
- function query(payload, queryCallback, doneCallback) {
765
- const query2 = sendQuery(config, payload, queryCallback, (data, error) => {
766
- cleanup();
767
- if (doneCallback) {
768
- doneCallback(data, error);
769
- }
770
- });
771
- queries.push(query2);
772
- return query2;
773
- }
774
- __name(query, "query");
775
- function find(callback) {
776
- return queries.find(value => {
777
- return callback(value);
778
- }) || null;
779
- }
780
- __name(find, "find");
781
- const instance = {
782
- query,
783
- find,
784
- setIndex: /* @__PURE__ */__name(index => {
785
- config.index = index;
786
- }, "setIndex"),
787
- getIndex: /* @__PURE__ */__name(() => config.index, "getIndex"),
788
- cleanup
789
- };
790
- return instance;
791
- }
792
- __name(initRedundancy, "initRedundancy");
793
- function createAPIConfig(source) {
794
- let resources;
795
- if (typeof source.resources === "string") {
796
- resources = [source.resources];
797
- } else {
798
- resources = source.resources;
799
- if (!(resources instanceof Array) || !resources.length) {
800
- return null;
801
- }
802
- }
803
- const result = {
804
- // API hosts
805
- resources,
806
- // Root path
807
- path: source.path || "/",
808
- // URL length limit
809
- maxURL: source.maxURL || 500,
810
- // Timeout before next host is used.
811
- rotate: source.rotate || 750,
812
- // Timeout before failing query.
813
- timeout: source.timeout || 5e3,
814
- // Randomise default API end point.
815
- random: source.random === true,
816
- // Start index
817
- index: source.index || 0,
818
- // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
819
- dataAfterTimeout: source.dataAfterTimeout !== false
820
- };
821
- return result;
822
- }
823
- __name(createAPIConfig, "createAPIConfig");
824
- var configStorage = /* @__PURE__ */Object.create(null);
825
- var fallBackAPISources = ["https://api.simplesvg.com", "https://api.unisvg.com"];
826
- var fallBackAPI = [];
827
- while (fallBackAPISources.length > 0) {
828
- if (fallBackAPISources.length === 1) {
829
- fallBackAPI.push(fallBackAPISources.shift());
830
- } else {
831
- if (Math.random() > 0.5) {
832
- fallBackAPI.push(fallBackAPISources.shift());
833
- } else {
834
- fallBackAPI.push(fallBackAPISources.pop());
835
- }
836
- }
837
- }
838
- configStorage[""] = createAPIConfig({
839
- resources: ["https://api.iconify.design"].concat(fallBackAPI)
840
- });
841
- function addAPIProvider$1(provider, customConfig) {
842
- const config = createAPIConfig(customConfig);
843
- if (config === null) {
844
- return false;
845
- }
846
- configStorage[provider] = config;
847
- return true;
848
- }
849
- __name(addAPIProvider$1, "addAPIProvider$1");
850
- function getAPIConfig(provider) {
851
- return configStorage[provider];
852
- }
853
- __name(getAPIConfig, "getAPIConfig");
854
- function listAPIProviders() {
855
- return Object.keys(configStorage);
856
- }
857
- __name(listAPIProviders, "listAPIProviders");
858
- function emptyCallback$1() {}
859
- __name(emptyCallback$1, "emptyCallback$1");
860
- var redundancyCache = /* @__PURE__ */Object.create(null);
861
- function getRedundancyCache(provider) {
862
- if (!redundancyCache[provider]) {
863
- const config = getAPIConfig(provider);
864
- if (!config) {
865
- return;
866
- }
867
- const redundancy = initRedundancy(config);
868
- const cachedReundancy = {
869
- config,
870
- redundancy
871
- };
872
- redundancyCache[provider] = cachedReundancy;
873
- }
874
- return redundancyCache[provider];
875
- }
876
- __name(getRedundancyCache, "getRedundancyCache");
877
- function sendAPIQuery(target, query, callback) {
878
- let redundancy;
879
- let send2;
880
- if (typeof target === "string") {
881
- const api = getAPIModule(target);
882
- if (!api) {
883
- callback(void 0, 424);
884
- return emptyCallback$1;
885
- }
886
- send2 = api.send;
887
- const cached = getRedundancyCache(target);
888
- if (cached) {
889
- redundancy = cached.redundancy;
890
- }
891
- } else {
892
- const config = createAPIConfig(target);
893
- if (config) {
894
- redundancy = initRedundancy(config);
895
- const moduleKey = target.resources ? target.resources[0] : "";
896
- const api = getAPIModule(moduleKey);
897
- if (api) {
898
- send2 = api.send;
899
- }
900
- }
901
- }
902
- if (!redundancy || !send2) {
903
- callback(void 0, 424);
904
- return emptyCallback$1;
905
- }
906
- return redundancy.query(query, send2, callback)().abort;
907
- }
908
- __name(sendAPIQuery, "sendAPIQuery");
909
- function emptyCallback() {}
910
- __name(emptyCallback, "emptyCallback");
911
- function loadedNewIcons(storage2) {
912
- if (!storage2.iconsLoaderFlag) {
913
- storage2.iconsLoaderFlag = true;
914
- setTimeout(() => {
915
- storage2.iconsLoaderFlag = false;
916
- updateCallbacks(storage2);
917
- });
918
- }
919
- }
920
- __name(loadedNewIcons, "loadedNewIcons");
921
- function checkIconNamesForAPI(icons) {
922
- const valid = [];
923
- const invalid = [];
924
- icons.forEach(name => {
925
- (name.match(matchIconName) ? valid : invalid).push(name);
926
- });
927
- return {
928
- valid,
929
- invalid
930
- };
931
- }
932
- __name(checkIconNamesForAPI, "checkIconNamesForAPI");
933
- function parseLoaderResponse(storage2, icons, data) {
934
- function checkMissing() {
935
- const pending = storage2.pendingIcons;
936
- icons.forEach(name => {
937
- if (pending) {
938
- pending.delete(name);
939
- }
940
- if (!storage2.icons[name]) {
941
- storage2.missing.add(name);
942
- }
943
- });
944
- }
945
- __name(checkMissing, "checkMissing");
946
- if (data && typeof data === "object") {
947
- try {
948
- const parsed = addIconSet(storage2, data);
949
- if (!parsed.length) {
950
- checkMissing();
951
- return;
952
- }
953
- } catch (err) {
954
- console.error(err);
955
- }
956
- }
957
- checkMissing();
958
- loadedNewIcons(storage2);
959
- }
960
- __name(parseLoaderResponse, "parseLoaderResponse");
961
- function parsePossiblyAsyncResponse(response, callback) {
962
- if (response instanceof Promise) {
963
- response.then(data => {
964
- callback(data);
965
- }).catch(() => {
966
- callback(null);
967
- });
968
- } else {
969
- callback(response);
970
- }
971
- }
972
- __name(parsePossiblyAsyncResponse, "parsePossiblyAsyncResponse");
973
- function loadNewIcons(storage2, icons) {
974
- if (!storage2.iconsToLoad) {
975
- storage2.iconsToLoad = icons;
976
- } else {
977
- storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
978
- }
979
- if (!storage2.iconsQueueFlag) {
980
- storage2.iconsQueueFlag = true;
981
- setTimeout(() => {
982
- storage2.iconsQueueFlag = false;
983
- const {
984
- provider,
985
- prefix
986
- } = storage2;
987
- const icons2 = storage2.iconsToLoad;
988
- delete storage2.iconsToLoad;
989
- if (!icons2 || !icons2.length) {
990
- return;
991
- }
992
- const customIconLoader = storage2.loadIcon;
993
- if (storage2.loadIcons && (icons2.length > 1 || !customIconLoader)) {
994
- parsePossiblyAsyncResponse(storage2.loadIcons(icons2, prefix, provider), data => {
995
- parseLoaderResponse(storage2, icons2, data);
996
- });
997
- return;
998
- }
999
- if (customIconLoader) {
1000
- icons2.forEach(name => {
1001
- const response = customIconLoader(name, prefix, provider);
1002
- parsePossiblyAsyncResponse(response, data => {
1003
- const iconSet = data ? {
1004
- prefix,
1005
- icons: {
1006
- [name]: data
1007
- }
1008
- } : null;
1009
- parseLoaderResponse(storage2, [name], iconSet);
1010
- });
1011
- });
1012
- return;
1013
- }
1014
- const {
1015
- valid,
1016
- invalid
1017
- } = checkIconNamesForAPI(icons2);
1018
- if (invalid.length) {
1019
- parseLoaderResponse(storage2, invalid, null);
1020
- }
1021
- if (!valid.length) {
1022
- return;
1023
- }
1024
- const api = prefix.match(matchIconName) ? getAPIModule(provider) : null;
1025
- if (!api) {
1026
- parseLoaderResponse(storage2, valid, null);
1027
- return;
1028
- }
1029
- const params = api.prepare(provider, prefix, valid);
1030
- params.forEach(item => {
1031
- sendAPIQuery(provider, item, data => {
1032
- parseLoaderResponse(storage2, item.icons, data);
1033
- });
1034
- });
1035
- });
1036
- }
1037
- }
1038
- __name(loadNewIcons, "loadNewIcons");
1039
- var loadIcons$1 = /* @__PURE__ */__name((icons, callback) => {
1040
- const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
1041
- const sortedIcons = sortIcons(cleanedIcons);
1042
- if (!sortedIcons.pending.length) {
1043
- let callCallback = true;
1044
- if (callback) {
1045
- setTimeout(() => {
1046
- if (callCallback) {
1047
- callback(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback);
1048
- }
1049
- });
1050
- }
1051
- return () => {
1052
- callCallback = false;
1053
- };
1054
- }
1055
- const newIcons = /* @__PURE__ */Object.create(null);
1056
- const sources = [];
1057
- let lastProvider, lastPrefix;
1058
- sortedIcons.pending.forEach(icon => {
1059
- const {
1060
- provider,
1061
- prefix
1062
- } = icon;
1063
- if (prefix === lastPrefix && provider === lastProvider) {
1064
- return;
1065
- }
1066
- lastProvider = provider;
1067
- lastPrefix = prefix;
1068
- sources.push(getStorage(provider, prefix));
1069
- const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */Object.create(null));
1070
- if (!providerNewIcons[prefix]) {
1071
- providerNewIcons[prefix] = [];
1072
- }
1073
- });
1074
- sortedIcons.pending.forEach(icon => {
1075
- const {
1076
- provider,
1077
- prefix,
1078
- name
1079
- } = icon;
1080
- const storage2 = getStorage(provider, prefix);
1081
- const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */new Set());
1082
- if (!pendingQueue.has(name)) {
1083
- pendingQueue.add(name);
1084
- newIcons[provider][prefix].push(name);
1085
- }
1086
- });
1087
- sources.forEach(storage2 => {
1088
- const list = newIcons[storage2.provider][storage2.prefix];
1089
- if (list.length) {
1090
- loadNewIcons(storage2, list);
1091
- }
1092
- });
1093
- return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
1094
- }, "loadIcons$1");
1095
- var loadIcon$1 = /* @__PURE__ */__name(icon => {
1096
- return new Promise((fulfill, reject) => {
1097
- const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
1098
- if (!iconObj) {
1099
- reject(icon);
1100
- return;
1101
- }
1102
- loadIcons$1([iconObj || icon], loaded => {
1103
- if (loaded.length && iconObj) {
1104
- const data = getIconData(iconObj);
1105
- if (data) {
1106
- fulfill({
1107
- ...defaultIconProps,
1108
- ...data
1109
- });
1110
- return;
1111
- }
1112
- }
1113
- reject(icon);
1114
- });
1115
- });
1116
- }, "loadIcon$1");
1117
- function testIconObject(value) {
1118
- try {
1119
- const obj = typeof value === "string" ? JSON.parse(value) : value;
1120
- if (typeof obj.body === "string") {
1121
- return {
1122
- ...obj
1123
- };
1124
- }
1125
- } catch (err) {}
1126
- }
1127
- __name(testIconObject, "testIconObject");
1128
- function parseIconValue(value, onload) {
1129
- if (typeof value === "object") {
1130
- const data2 = testIconObject(value);
1131
- return {
1132
- data: data2,
1133
- value
1134
- };
1135
- }
1136
- if (typeof value !== "string") {
1137
- return {
1138
- value
1139
- };
1140
- }
1141
- if (value.includes("{")) {
1142
- const data2 = testIconObject(value);
1143
- if (data2) {
1144
- return {
1145
- data: data2,
1146
- value
1147
- };
1148
- }
1149
- }
1150
- const name = stringToIcon(value, true, true);
1151
- if (!name) {
1152
- return {
1153
- value
1154
- };
1155
- }
1156
- const data = getIconData(name);
1157
- if (data !== void 0 || !name.prefix) {
1158
- return {
1159
- value,
1160
- name,
1161
- data
1162
- // could be 'null' -> icon is missing
1163
- };
1164
- }
1165
- const loading = loadIcons$1([name], () => onload(value, name, getIconData(name)));
1166
- return {
1167
- value,
1168
- name,
1169
- loading
1170
- };
1171
- }
1172
- __name(parseIconValue, "parseIconValue");
1173
- var isBuggedSafari = false;
1174
- try {
1175
- isBuggedSafari = navigator.vendor.indexOf("Apple") === 0;
1176
- } catch (err) {}
1177
- function getRenderMode(body, mode) {
1178
- switch (mode) {
1179
- // Force mode
1180
- case "svg":
1181
- case "bg":
1182
- case "mask":
1183
- return mode;
1184
- }
1185
- if (mode !== "style" && (isBuggedSafari || body.indexOf("<a") === -1)) {
1186
- return "svg";
1187
- }
1188
- return body.indexOf("currentColor") === -1 ? "bg" : "mask";
1189
- }
1190
- __name(getRenderMode, "getRenderMode");
1191
- var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
1192
- var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
1193
- function calculateSize$1(size, ratio, precision) {
1194
- if (ratio === 1) {
1195
- return size;
1196
- }
1197
- precision = precision || 100;
1198
- if (typeof size === "number") {
1199
- return Math.ceil(size * ratio * precision) / precision;
1200
- }
1201
- if (typeof size !== "string") {
1202
- return size;
1203
- }
1204
- const oldParts = size.split(unitsSplit);
1205
- if (oldParts === null || !oldParts.length) {
1206
- return size;
1207
- }
1208
- const newParts = [];
1209
- let code = oldParts.shift();
1210
- let isNumber = unitsTest.test(code);
1211
- while (true) {
1212
- if (isNumber) {
1213
- const num = parseFloat(code);
1214
- if (isNaN(num)) {
1215
- newParts.push(code);
1216
- } else {
1217
- newParts.push(Math.ceil(num * ratio * precision) / precision);
1218
- }
1219
- } else {
1220
- newParts.push(code);
1221
- }
1222
- code = oldParts.shift();
1223
- if (code === void 0) {
1224
- return newParts.join("");
1225
- }
1226
- isNumber = !isNumber;
1227
- }
1228
- }
1229
- __name(calculateSize$1, "calculateSize$1");
1230
- function splitSVGDefs(content, tag = "defs") {
1231
- let defs = "";
1232
- const index = content.indexOf("<" + tag);
1233
- while (index >= 0) {
1234
- const start = content.indexOf(">", index);
1235
- const end = content.indexOf("</" + tag);
1236
- if (start === -1 || end === -1) {
1237
- break;
1238
- }
1239
- const endEnd = content.indexOf(">", end);
1240
- if (endEnd === -1) {
1241
- break;
1242
- }
1243
- defs += content.slice(start + 1, end).trim();
1244
- content = content.slice(0, index).trim() + content.slice(endEnd + 1);
1245
- }
1246
- return {
1247
- defs,
1248
- content
1249
- };
1250
- }
1251
- __name(splitSVGDefs, "splitSVGDefs");
1252
- function mergeDefsAndContent(defs, content) {
1253
- return defs ? "<defs>" + defs + "</defs>" + content : content;
1254
- }
1255
- __name(mergeDefsAndContent, "mergeDefsAndContent");
1256
- function wrapSVGContent(body, start, end) {
1257
- const split = splitSVGDefs(body);
1258
- return mergeDefsAndContent(split.defs, start + split.content + end);
1259
- }
1260
- __name(wrapSVGContent, "wrapSVGContent");
1261
- var isUnsetKeyword = /* @__PURE__ */__name(value => value === "unset" || value === "undefined" || value === "none", "isUnsetKeyword");
1262
- function iconToSVG(icon, customisations) {
1263
- const fullIcon = {
1264
- ...defaultIconProps,
1265
- ...icon
1266
- };
1267
- const fullCustomisations = {
1268
- ...defaultIconCustomisations,
1269
- ...customisations
1270
- };
1271
- const box = {
1272
- left: fullIcon.left,
1273
- top: fullIcon.top,
1274
- width: fullIcon.width,
1275
- height: fullIcon.height
1276
- };
1277
- let body = fullIcon.body;
1278
- [fullIcon, fullCustomisations].forEach(props => {
1279
- const transformations = [];
1280
- const hFlip = props.hFlip;
1281
- const vFlip = props.vFlip;
1282
- let rotation = props.rotate;
1283
- if (hFlip) {
1284
- if (vFlip) {
1285
- rotation += 2;
1286
- } else {
1287
- transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
1288
- transformations.push("scale(-1 1)");
1289
- box.top = box.left = 0;
1290
- }
1291
- } else if (vFlip) {
1292
- transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
1293
- transformations.push("scale(1 -1)");
1294
- box.top = box.left = 0;
1295
- }
1296
- let tempValue;
1297
- if (rotation < 0) {
1298
- rotation -= Math.floor(rotation / 4) * 4;
1299
- }
1300
- rotation = rotation % 4;
1301
- switch (rotation) {
1302
- case 1:
1303
- tempValue = box.height / 2 + box.top;
1304
- transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
1305
- break;
1306
- case 2:
1307
- transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
1308
- break;
1309
- case 3:
1310
- tempValue = box.width / 2 + box.left;
1311
- transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
1312
- break;
1313
- }
1314
- if (rotation % 2 === 1) {
1315
- if (box.left !== box.top) {
1316
- tempValue = box.left;
1317
- box.left = box.top;
1318
- box.top = tempValue;
1319
- }
1320
- if (box.width !== box.height) {
1321
- tempValue = box.width;
1322
- box.width = box.height;
1323
- box.height = tempValue;
1324
- }
1325
- }
1326
- if (transformations.length) {
1327
- body = wrapSVGContent(body, '<g transform="' + transformations.join(" ") + '">', "</g>");
1328
- }
1329
- });
1330
- const customisationsWidth = fullCustomisations.width;
1331
- const customisationsHeight = fullCustomisations.height;
1332
- const boxWidth = box.width;
1333
- const boxHeight = box.height;
1334
- let width;
1335
- let height;
1336
- if (customisationsWidth === null) {
1337
- height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1338
- width = calculateSize$1(height, boxWidth / boxHeight);
1339
- } else {
1340
- width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
1341
- height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1342
- }
1343
- const attributes = {};
1344
- const setAttr = /* @__PURE__ */__name((prop, value) => {
1345
- if (!isUnsetKeyword(value)) {
1346
- attributes[prop] = value.toString();
1347
- }
1348
- }, "setAttr");
1349
- setAttr("width", width);
1350
- setAttr("height", height);
1351
- const viewBox = [box.left, box.top, boxWidth, boxHeight];
1352
- attributes.viewBox = viewBox.join(" ");
1353
- return {
1354
- attributes,
1355
- viewBox,
1356
- body
1357
- };
1358
- }
1359
- __name(iconToSVG, "iconToSVG");
1360
- function iconToHTML$1(body, attributes) {
1361
- let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
1362
- for (const attr in attributes) {
1363
- renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
1364
- }
1365
- return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
1366
- }
1367
- __name(iconToHTML$1, "iconToHTML$1");
1368
- function encodeSVGforURL(svg) {
1369
- return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
1370
- }
1371
- __name(encodeSVGforURL, "encodeSVGforURL");
1372
- function svgToData(svg) {
1373
- return "data:image/svg+xml," + encodeSVGforURL(svg);
1374
- }
1375
- __name(svgToData, "svgToData");
1376
- function svgToURL$1(svg) {
1377
- return 'url("' + svgToData(svg) + '")';
1378
- }
1379
- __name(svgToURL$1, "svgToURL$1");
1380
- var detectFetch = /* @__PURE__ */__name(() => {
1381
- let callback;
1382
- try {
1383
- callback = fetch;
1384
- if (typeof callback === "function") {
1385
- return callback;
1386
- }
1387
- } catch (err) {}
1388
- }, "detectFetch");
1389
- var fetchModule = detectFetch();
1390
- function setFetch(fetch2) {
1391
- fetchModule = fetch2;
1392
- }
1393
- __name(setFetch, "setFetch");
1394
- function getFetch() {
1395
- return fetchModule;
1396
- }
1397
- __name(getFetch, "getFetch");
1398
- function calculateMaxLength(provider, prefix) {
1399
- const config = getAPIConfig(provider);
1400
- if (!config) {
1401
- return 0;
1402
- }
1403
- let result;
1404
- if (!config.maxURL) {
1405
- result = 0;
1406
- } else {
1407
- let maxHostLength = 0;
1408
- config.resources.forEach(item => {
1409
- const host = item;
1410
- maxHostLength = Math.max(maxHostLength, host.length);
1411
- });
1412
- const url = prefix + ".json?icons=";
1413
- result = config.maxURL - maxHostLength - config.path.length - url.length;
1414
- }
1415
- return result;
1416
- }
1417
- __name(calculateMaxLength, "calculateMaxLength");
1418
- function shouldAbort(status) {
1419
- return status === 404;
1420
- }
1421
- __name(shouldAbort, "shouldAbort");
1422
- var prepare = /* @__PURE__ */__name((provider, prefix, icons) => {
1423
- const results = [];
1424
- const maxLength = calculateMaxLength(provider, prefix);
1425
- const type = "icons";
1426
- let item = {
1427
- type,
1428
- provider,
1429
- prefix,
1430
- icons: []
1431
- };
1432
- let length = 0;
1433
- icons.forEach((name, index) => {
1434
- length += name.length + 1;
1435
- if (length >= maxLength && index > 0) {
1436
- results.push(item);
1437
- item = {
1438
- type,
1439
- provider,
1440
- prefix,
1441
- icons: []
1442
- };
1443
- length = name.length;
1444
- }
1445
- item.icons.push(name);
1446
- });
1447
- results.push(item);
1448
- return results;
1449
- }, "prepare");
1450
- function getPath(provider) {
1451
- if (typeof provider === "string") {
1452
- const config = getAPIConfig(provider);
1453
- if (config) {
1454
- return config.path;
1455
- }
1456
- }
1457
- return "/";
1458
- }
1459
- __name(getPath, "getPath");
1460
- var send = /* @__PURE__ */__name((host, params, callback) => {
1461
- if (!fetchModule) {
1462
- callback("abort", 424);
1463
- return;
1464
- }
1465
- let path = getPath(params.provider);
1466
- switch (params.type) {
1467
- case "icons":
1468
- {
1469
- const prefix = params.prefix;
1470
- const icons = params.icons;
1471
- const iconsList = icons.join(",");
1472
- const urlParams = new URLSearchParams({
1473
- icons: iconsList
1474
- });
1475
- path += prefix + ".json?" + urlParams.toString();
1476
- break;
1477
- }
1478
- case "custom":
1479
- {
1480
- const uri = params.uri;
1481
- path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
1482
- break;
1483
- }
1484
- default:
1485
- callback("abort", 400);
1486
- return;
1487
- }
1488
- let defaultError = 503;
1489
- fetchModule(host + path).then(response => {
1490
- const status = response.status;
1491
- if (status !== 200) {
1492
- setTimeout(() => {
1493
- callback(shouldAbort(status) ? "abort" : "next", status);
1494
- });
1495
- return;
1496
- }
1497
- defaultError = 501;
1498
- return response.json();
1499
- }).then(data => {
1500
- if (typeof data !== "object" || data === null) {
1501
- setTimeout(() => {
1502
- if (data === 404) {
1503
- callback("abort", data);
1504
- } else {
1505
- callback("next", defaultError);
1506
- }
1507
- });
1508
- return;
1509
- }
1510
- setTimeout(() => {
1511
- callback("success", data);
1512
- });
1513
- }).catch(() => {
1514
- callback("next", defaultError);
1515
- });
1516
- }, "send");
1517
- var fetchAPIModule = {
1518
- prepare,
1519
- send
1520
- };
1521
- function setCustomIconsLoader$1(loader, prefix, provider) {
1522
- getStorage(provider || "", prefix).loadIcons = loader;
1523
- }
1524
- __name(setCustomIconsLoader$1, "setCustomIconsLoader$1");
1525
- function setCustomIconLoader$1(loader, prefix, provider) {
1526
- getStorage(provider || "", prefix).loadIcon = loader;
1527
- }
1528
- __name(setCustomIconLoader$1, "setCustomIconLoader$1");
1529
- var nodeAttr = "data-style";
1530
- var customStyle = "";
1531
- function appendCustomStyle(style) {
1532
- customStyle = style;
1533
- }
1534
- __name(appendCustomStyle, "appendCustomStyle");
1535
- function updateStyle(parent, inline) {
1536
- let styleNode = Array.from(parent.childNodes).find(node => node.hasAttribute && node.hasAttribute(nodeAttr));
1537
- if (!styleNode) {
1538
- styleNode = document.createElement("style");
1539
- styleNode.setAttribute(nodeAttr, nodeAttr);
1540
- parent.appendChild(styleNode);
1541
- }
1542
- styleNode.textContent = ":host{display:inline-block;vertical-align:" + (inline ? "-0.125em" : "0") + "}span,svg{display:block;margin:auto}" + customStyle;
1543
- }
1544
- __name(updateStyle, "updateStyle");
1545
- function exportFunctions() {
1546
- setAPIModule("", fetchAPIModule);
1547
- allowSimpleNames(true);
1548
- let _window;
1549
- try {
1550
- _window = window;
1551
- } catch (err) {}
1552
- if (_window) {
1553
- if (_window.IconifyPreload !== void 0) {
1554
- const preload = _window.IconifyPreload;
1555
- const err = "Invalid IconifyPreload syntax.";
1556
- if (typeof preload === "object" && preload !== null) {
1557
- (preload instanceof Array ? preload : [preload]).forEach(item => {
1558
- try {
1559
- if (
1560
- // Check if item is an object and not null/array
1561
- typeof item !== "object" || item === null || item instanceof Array ||
1562
- // Check for 'icons' and 'prefix'
1563
- typeof item.icons !== "object" || typeof item.prefix !== "string" ||
1564
- // Add icon set
1565
- !addCollection$1(item)) {
1566
- console.error(err);
1567
- }
1568
- } catch (e) {
1569
- console.error(err);
1570
- }
1571
- });
1572
- }
1573
- }
1574
- if (_window.IconifyProviders !== void 0) {
1575
- const providers = _window.IconifyProviders;
1576
- if (typeof providers === "object" && providers !== null) {
1577
- for (const key in providers) {
1578
- const err = "IconifyProviders[" + key + "] is invalid.";
1579
- try {
1580
- const value = providers[key];
1581
- if (typeof value !== "object" || !value || value.resources === void 0) {
1582
- continue;
1583
- }
1584
- if (!addAPIProvider$1(key, value)) {
1585
- console.error(err);
1586
- }
1587
- } catch (e) {
1588
- console.error(err);
1589
- }
1590
- }
1591
- }
1592
- }
1593
- }
1594
- const _api2 = {
1595
- getAPIConfig,
1596
- setAPIModule,
1597
- sendAPIQuery,
1598
- setFetch,
1599
- getFetch,
1600
- listAPIProviders
1601
- };
1602
- return {
1603
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1604
- enableCache: /* @__PURE__ */__name(storage2 => {}, "enableCache"),
1605
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1606
- disableCache: /* @__PURE__ */__name(storage2 => {}, "disableCache"),
1607
- iconLoaded: iconLoaded$1,
1608
- iconExists: iconLoaded$1,
1609
- // deprecated, kept to avoid breaking changes
1610
- getIcon: getIcon$1,
1611
- listIcons: listIcons$1,
1612
- addIcon: addIcon$1,
1613
- addCollection: addCollection$1,
1614
- calculateSize: calculateSize$1,
1615
- buildIcon: iconToSVG,
1616
- iconToHTML: iconToHTML$1,
1617
- svgToURL: svgToURL$1,
1618
- loadIcons: loadIcons$1,
1619
- loadIcon: loadIcon$1,
1620
- addAPIProvider: addAPIProvider$1,
1621
- setCustomIconLoader: setCustomIconLoader$1,
1622
- setCustomIconsLoader: setCustomIconsLoader$1,
1623
- appendCustomStyle,
1624
- _api: _api2
1625
- };
1626
- }
1627
- __name(exportFunctions, "exportFunctions");
1628
- var monotoneProps = {
1629
- "background-color": "currentColor"
1630
- };
1631
- var coloredProps = {
1632
- "background-color": "transparent"
1633
- };
1634
- var propsToAdd = {
1635
- image: "var(--svg)",
1636
- repeat: "no-repeat",
1637
- size: "100% 100%"
1638
- };
1639
- var propsToAddTo = {
1640
- "-webkit-mask": monotoneProps,
1641
- "mask": monotoneProps,
1642
- "background": coloredProps
1643
- };
1644
- for (const prefix in propsToAddTo) {
1645
- const list = propsToAddTo[prefix];
1646
- for (const prop in propsToAdd) {
1647
- list[prefix + "-" + prop] = propsToAdd[prop];
1648
- }
1649
- }
1650
- function fixSize(value) {
1651
- return value ? value + (value.match(/^[-0-9.]+$/) ? "px" : "") : "inherit";
1652
- }
1653
- __name(fixSize, "fixSize");
1654
- function renderSPAN(data, icon, useMask) {
1655
- const node = document.createElement("span");
1656
- let body = data.body;
1657
- if (body.indexOf("<a") !== -1) {
1658
- body += "<!-- " + Date.now() + " -->";
1659
- }
1660
- const renderAttribs = data.attributes;
1661
- const html = iconToHTML$1(body, {
1662
- ...renderAttribs,
1663
- width: icon.width + "",
1664
- height: icon.height + ""
1665
- });
1666
- const url = svgToURL$1(html);
1667
- const svgStyle = node.style;
1668
- const styles = {
1669
- "--svg": url,
1670
- "width": fixSize(renderAttribs.width),
1671
- "height": fixSize(renderAttribs.height),
1672
- ...(useMask ? monotoneProps : coloredProps)
1673
- };
1674
- for (const prop in styles) {
1675
- svgStyle.setProperty(prop, styles[prop]);
1676
- }
1677
- return node;
1678
- }
1679
- __name(renderSPAN, "renderSPAN");
1680
- var policy;
1681
- function createPolicy() {
1682
- try {
1683
- policy = window.trustedTypes.createPolicy("iconify", {
1684
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
1685
- createHTML: /* @__PURE__ */__name(s => s, "createHTML")
1686
- });
1687
- } catch (err) {
1688
- policy = null;
1689
- }
1690
- }
1691
- __name(createPolicy, "createPolicy");
1692
- function cleanUpInnerHTML(html) {
1693
- if (policy === void 0) {
1694
- createPolicy();
1695
- }
1696
- return policy ? policy.createHTML(html) : html;
1697
- }
1698
- __name(cleanUpInnerHTML, "cleanUpInnerHTML");
1699
- function renderSVG(data) {
1700
- const node = document.createElement("span");
1701
- const attr = data.attributes;
1702
- let style = "";
1703
- if (!attr.width) {
1704
- style = "width: inherit;";
1705
- }
1706
- if (!attr.height) {
1707
- style += "height: inherit;";
1708
- }
1709
- if (style) {
1710
- attr.style = style;
1711
- }
1712
- const html = iconToHTML$1(data.body, attr);
1713
- node.innerHTML = cleanUpInnerHTML(html);
1714
- return node.firstChild;
1715
- }
1716
- __name(renderSVG, "renderSVG");
1717
- function findIconElement(parent) {
1718
- return Array.from(parent.childNodes).find(node => {
1719
- const tag = node.tagName && node.tagName.toUpperCase();
1720
- return tag === "SPAN" || tag === "SVG";
1721
- });
1722
- }
1723
- __name(findIconElement, "findIconElement");
1724
- function renderIcon(parent, state) {
1725
- const iconData = state.icon.data;
1726
- const customisations = state.customisations;
1727
- const renderData = iconToSVG(iconData, customisations);
1728
- if (customisations.preserveAspectRatio) {
1729
- renderData.attributes["preserveAspectRatio"] = customisations.preserveAspectRatio;
1730
- }
1731
- const mode = state.renderedMode;
1732
- let node;
1733
- switch (mode) {
1734
- case "svg":
1735
- node = renderSVG(renderData);
1736
- break;
1737
- default:
1738
- node = renderSPAN(renderData, {
1739
- ...defaultIconProps,
1740
- ...iconData
1741
- }, mode === "mask");
1742
- }
1743
- const oldNode = findIconElement(parent);
1744
- if (oldNode) {
1745
- if (node.tagName === "SPAN" && oldNode.tagName === node.tagName) {
1746
- oldNode.setAttribute("style", node.getAttribute("style"));
1747
- } else {
1748
- parent.replaceChild(node, oldNode);
1749
- }
1750
- } else {
1751
- parent.appendChild(node);
1752
- }
1753
- }
1754
- __name(renderIcon, "renderIcon");
1755
- function setPendingState(icon, inline, lastState) {
1756
- const lastRender = lastState && (lastState.rendered ? lastState : lastState.lastRender);
1757
- return {
1758
- rendered: false,
1759
- inline,
1760
- icon,
1761
- lastRender
1762
- };
1763
- }
1764
- __name(setPendingState, "setPendingState");
1765
- function defineIconifyIcon(name = "iconify-icon") {
1766
- let customElements;
1767
- let ParentClass;
1768
- try {
1769
- customElements = window.customElements;
1770
- ParentClass = window.HTMLElement;
1771
- } catch (err) {
1772
- return;
1773
- }
1774
- if (!customElements || !ParentClass) {
1775
- return;
1776
- }
1777
- const ConflictingClass = customElements.get(name);
1778
- if (ConflictingClass) {
1779
- return ConflictingClass;
1780
- }
1781
- const attributes = [
1782
- // Icon
1783
- "icon",
1784
- // Mode
1785
- "mode", "inline", "noobserver",
1786
- // Customisations
1787
- "width", "height", "rotate", "flip"];
1788
- const IconifyIcon = class extends ParentClass {
1789
- static {
1790
- __name(this, "IconifyIcon");
1791
- }
1792
- // Root
1793
- _shadowRoot;
1794
- // Initialised
1795
- _initialised = false;
1796
- // Icon state
1797
- _state;
1798
- // Attributes check queued
1799
- _checkQueued = false;
1800
- // Connected
1801
- _connected = false;
1802
- // Observer
1803
- _observer = null;
1804
- _visible = true;
1805
- /**
1806
- * Constructor
1807
- */
1808
- constructor() {
1809
- super();
1810
- const root = this._shadowRoot = this.attachShadow({
1811
- mode: "open"
1812
- });
1813
- const inline = this.hasAttribute("inline");
1814
- updateStyle(root, inline);
1815
- this._state = setPendingState({
1816
- value: ""
1817
- }, inline);
1818
- this._queueCheck();
1819
- }
1820
- /**
1821
- * Connected to DOM
1822
- */
1823
- connectedCallback() {
1824
- this._connected = true;
1825
- this.startObserver();
1826
- }
1827
- /**
1828
- * Disconnected from DOM
1829
- */
1830
- disconnectedCallback() {
1831
- this._connected = false;
1832
- this.stopObserver();
1833
- }
1834
- /**
1835
- * Observed attributes
1836
- */
1837
- static get observedAttributes() {
1838
- return attributes.slice(0);
1839
- }
1840
- /**
1841
- * Observed properties that are different from attributes
1842
- *
1843
- * Experimental! Need to test with various frameworks that support it
1844
- */
1845
- /*
1846
- static get properties() {
1847
- return {
1848
- inline: {
1849
- type: Boolean,
1850
- reflect: true,
1851
- },
1852
- // Not listing other attributes because they are strings or combination
1853
- // of string and another type. Cannot have multiple types
1854
- };
1855
- }
1856
- */
1857
- /**
1858
- * Attribute has changed
1859
- */
1860
- attributeChangedCallback(name2) {
1861
- switch (name2) {
1862
- case "inline":
1863
- {
1864
- const newInline = this.hasAttribute("inline");
1865
- const state = this._state;
1866
- if (newInline !== state.inline) {
1867
- state.inline = newInline;
1868
- updateStyle(this._shadowRoot, newInline);
1869
- }
1870
- break;
1871
- }
1872
- case "noobserver":
1873
- {
1874
- const value = this.hasAttribute("noobserver");
1875
- if (value) {
1876
- this.startObserver();
1877
- } else {
1878
- this.stopObserver();
1879
- }
1880
- break;
1881
- }
1882
- default:
1883
- this._queueCheck();
1884
- }
1885
- }
1886
- /**
1887
- * Get/set icon
1888
- */
1889
- get icon() {
1890
- const value = this.getAttribute("icon");
1891
- if (value && value.slice(0, 1) === "{") {
1892
- try {
1893
- return JSON.parse(value);
1894
- } catch (err) {}
1895
- }
1896
- return value;
1897
- }
1898
- set icon(value) {
1899
- if (typeof value === "object") {
1900
- value = JSON.stringify(value);
1901
- }
1902
- this.setAttribute("icon", value);
1903
- }
1904
- /**
1905
- * Get/set inline
1906
- */
1907
- get inline() {
1908
- return this.hasAttribute("inline");
1909
- }
1910
- set inline(value) {
1911
- if (value) {
1912
- this.setAttribute("inline", "true");
1913
- } else {
1914
- this.removeAttribute("inline");
1915
- }
1916
- }
1917
- /**
1918
- * Get/set observer
1919
- */
1920
- get observer() {
1921
- return this.hasAttribute("observer");
1922
- }
1923
- set observer(value) {
1924
- if (value) {
1925
- this.setAttribute("observer", "true");
1926
- } else {
1927
- this.removeAttribute("observer");
1928
- }
1929
- }
1930
- /**
1931
- * Restart animation
1932
- */
1933
- restartAnimation() {
1934
- const state = this._state;
1935
- if (state.rendered) {
1936
- const root = this._shadowRoot;
1937
- if (state.renderedMode === "svg") {
1938
- try {
1939
- root.lastChild.setCurrentTime(0);
1940
- return;
1941
- } catch (err) {}
1942
- }
1943
- renderIcon(root, state);
1944
- }
1945
- }
1946
- /**
1947
- * Get status
1948
- */
1949
- get status() {
1950
- const state = this._state;
1951
- return state.rendered ? "rendered" : state.icon.data === null ? "failed" : "loading";
1952
- }
1953
- /**
1954
- * Queue attributes re-check
1955
- */
1956
- _queueCheck() {
1957
- if (!this._checkQueued) {
1958
- this._checkQueued = true;
1959
- setTimeout(() => {
1960
- this._check();
1961
- });
1962
- }
1963
- }
1964
- /**
1965
- * Check for changes
1966
- */
1967
- _check() {
1968
- if (!this._checkQueued) {
1969
- return;
1970
- }
1971
- this._checkQueued = false;
1972
- const state = this._state;
1973
- const newIcon = this.getAttribute("icon");
1974
- if (newIcon !== state.icon.value) {
1975
- this._iconChanged(newIcon);
1976
- return;
1977
- }
1978
- if (!state.rendered || !this._visible) {
1979
- return;
1980
- }
1981
- const mode = this.getAttribute("mode");
1982
- const customisations = getCustomisations(this);
1983
- if (state.attrMode !== mode || haveCustomisationsChanged(state.customisations, customisations) || !findIconElement(this._shadowRoot)) {
1984
- this._renderIcon(state.icon, customisations, mode);
1985
- }
1986
- }
1987
- /**
1988
- * Icon value has changed
1989
- */
1990
- _iconChanged(newValue) {
1991
- const icon = parseIconValue(newValue, (value, name2, data) => {
1992
- const state = this._state;
1993
- if (state.rendered || this.getAttribute("icon") !== value) {
1994
- return;
1995
- }
1996
- const icon2 = {
1997
- value,
1998
- name: name2,
1999
- data
2000
- };
2001
- if (icon2.data) {
2002
- this._gotIconData(icon2);
2003
- } else {
2004
- state.icon = icon2;
2005
- }
2006
- });
2007
- if (icon.data) {
2008
- this._gotIconData(icon);
2009
- } else {
2010
- this._state = setPendingState(icon, this._state.inline, this._state);
2011
- }
2012
- }
2013
- /**
2014
- * Force render icon on state change
2015
- */
2016
- _forceRender() {
2017
- if (!this._visible) {
2018
- const node = findIconElement(this._shadowRoot);
2019
- if (node) {
2020
- this._shadowRoot.removeChild(node);
2021
- }
2022
- return;
2023
- }
2024
- this._queueCheck();
2025
- }
2026
- /**
2027
- * Got new icon data, icon is ready to (re)render
2028
- */
2029
- _gotIconData(icon) {
2030
- this._checkQueued = false;
2031
- this._renderIcon(icon, getCustomisations(this), this.getAttribute("mode"));
2032
- }
2033
- /**
2034
- * Re-render based on icon data
2035
- */
2036
- _renderIcon(icon, customisations, attrMode) {
2037
- const renderedMode = getRenderMode(icon.data.body, attrMode);
2038
- const inline = this._state.inline;
2039
- renderIcon(this._shadowRoot, this._state = {
2040
- rendered: true,
2041
- icon,
2042
- inline,
2043
- customisations,
2044
- attrMode,
2045
- renderedMode
2046
- });
2047
- }
2048
- /**
2049
- * Start observer
2050
- */
2051
- startObserver() {
2052
- if (!this._observer && !this.hasAttribute("noobserver")) {
2053
- try {
2054
- this._observer = new IntersectionObserver(entries => {
2055
- const intersecting = entries.some(entry => entry.isIntersecting);
2056
- if (intersecting !== this._visible) {
2057
- this._visible = intersecting;
2058
- this._forceRender();
2059
- }
2060
- });
2061
- this._observer.observe(this);
2062
- } catch (err) {
2063
- if (this._observer) {
2064
- try {
2065
- this._observer.disconnect();
2066
- } catch (err2) {}
2067
- this._observer = null;
2068
- }
2069
- }
2070
- }
2071
- }
2072
- /**
2073
- * Stop observer
2074
- */
2075
- stopObserver() {
2076
- if (this._observer) {
2077
- this._observer.disconnect();
2078
- this._observer = null;
2079
- this._visible = true;
2080
- if (this._connected) {
2081
- this._forceRender();
2082
- }
2083
- }
2084
- }
2085
- };
2086
- attributes.forEach(attr => {
2087
- if (!(attr in IconifyIcon.prototype)) {
2088
- Object.defineProperty(IconifyIcon.prototype, attr, {
2089
- get: /* @__PURE__ */__name(function () {
2090
- return this.getAttribute(attr);
2091
- }, "get"),
2092
- set: /* @__PURE__ */__name(function (value) {
2093
- if (value !== null) {
2094
- this.setAttribute(attr, value);
2095
- } else {
2096
- this.removeAttribute(attr);
2097
- }
2098
- }, "set")
2099
- });
2100
- }
2101
- });
2102
- const functions = exportFunctions();
2103
- for (const key in functions) {
2104
- IconifyIcon[key] = IconifyIcon.prototype[key] = functions[key];
2105
- }
2106
- customElements.define(name, IconifyIcon);
2107
- return IconifyIcon;
2108
- }
2109
- __name(defineIconifyIcon, "defineIconifyIcon");
2110
- var IconifyIconComponent = defineIconifyIcon() || exportFunctions();
2111
- var {
2112
- enableCache,
2113
- disableCache,
2114
- iconLoaded,
2115
- iconExists,
2116
- // deprecated, kept to avoid breaking changes
2117
- getIcon,
2118
- listIcons,
2119
- addIcon,
2120
- addCollection,
2121
- calculateSize,
2122
- buildIcon,
2123
- iconToHTML,
2124
- svgToURL,
2125
- loadIcons,
2126
- loadIcon,
2127
- setCustomIconLoader,
2128
- setCustomIconsLoader,
2129
- addAPIProvider,
2130
- _api
2131
- } = IconifyIconComponent;
2132
-
2133
- // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.0/node_modules/@iconify-icon/react/dist/iconify.mjs
2134
- var Icon = React.forwardRef((props, ref) => {
2135
- const newProps = {
2136
- ...props,
2137
- ref
2138
- };
2139
- if (typeof props.icon === "object") {
2140
- newProps.icon = JSON.stringify(props.icon);
2141
- }
2142
- if (!props.inline) {
2143
- delete newProps.inline;
2144
- }
2145
- if (props.className) {
2146
- newProps["class"] = props.className;
2147
- }
2148
- return React.createElement("iconify-icon", newProps);
2149
- });
2150
-
2151
- // ../react-icons/src/Icon.tsx
2152
- import * as React2 from "react";
2153
- var Icon2 = /* @__PURE__ */React2.forwardRef((props, ref) => {
2154
- return /* @__PURE__ */React2.createElement(Icon, {
2155
- ref,
2156
- "data-testid": "iconify-icon",
2157
- ...props
2158
- });
2159
- });
2160
- Icon2.displayName = "Icon";
2161
- export { Icon2 as Icon };
2162
- /*! Bundled license information:
2163
-
2164
- iconify-icon/dist/iconify-icon.mjs:
2165
- (**
2166
- * (c) Iconify
2167
- *
2168
- * For the full copyright and license information, please view the license.txt
2169
- * files at https://github.com/iconify/iconify
2170
- *
2171
- * Licensed under MIT.
2172
- *
2173
- * @license MIT
2174
- * @version 2.3.0
2175
- *)
2176
- */