import {
__spreadValues,
init_define_APP_INFO
} from "./chunk-XY75H3MP.js";
// dep:@iconify_iconify
init_define_APP_INFO();
// node_modules/@iconify/iconify/dist/iconify.mjs
init_define_APP_INFO();
var matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
var iconDefaults = Object.freeze({
left: 0,
top: 0,
width: 16,
height: 16,
rotate: 0,
vFlip: false,
hFlip: false
});
function fullIcon(data) {
return __spreadValues(__spreadValues({}, iconDefaults), data);
}
function mergeIconData(icon, alias) {
const result = __spreadValues({}, icon);
for (const key in iconDefaults) {
const prop = key;
if (alias[prop] !== void 0) {
const value = alias[prop];
if (result[prop] === void 0) {
result[prop] = value;
continue;
}
switch (prop) {
case "rotate":
result[prop] = (result[prop] + value) % 4;
break;
case "hFlip":
case "vFlip":
result[prop] = value !== result[prop];
break;
default:
result[prop] = value;
}
}
}
return result;
}
function getIconData$1(data, name, full = false) {
function getIcon2(name2, iteration) {
if (data.icons[name2] !== void 0) {
return Object.assign({}, data.icons[name2]);
}
if (iteration > 5) {
return null;
}
const aliases = data.aliases;
if (aliases && aliases[name2] !== void 0) {
const item = aliases[name2];
const result2 = getIcon2(item.parent, iteration + 1);
if (result2) {
return mergeIconData(result2, item);
}
return result2;
}
const chars = data.chars;
if (!iteration && chars && chars[name2] !== void 0) {
return getIcon2(chars[name2], iteration + 1);
}
return null;
}
const result = getIcon2(name, 0);
if (result) {
for (const key in iconDefaults) {
if (result[key] === void 0 && data[key] !== void 0) {
result[key] = data[key];
}
}
}
return result && full ? fullIcon(result) : result;
}
function isVariation(item) {
for (const key in iconDefaults) {
if (item[key] !== void 0) {
return true;
}
}
return false;
}
function parseIconSet(data, callback2, options) {
options = options || {};
const names = [];
if (typeof data !== "object" || typeof data.icons !== "object") {
return names;
}
if (data.not_found instanceof Array) {
data.not_found.forEach((name) => {
callback2(name, null);
names.push(name);
});
}
const icons = data.icons;
Object.keys(icons).forEach((name) => {
const iconData = getIconData$1(data, name, true);
if (iconData) {
callback2(name, iconData);
names.push(name);
}
});
const parseAliases = options.aliases || "all";
if (parseAliases !== "none" && typeof data.aliases === "object") {
const aliases = data.aliases;
Object.keys(aliases).forEach((name) => {
if (parseAliases === "variations" && isVariation(aliases[name])) {
return;
}
const iconData = getIconData$1(data, name, true);
if (iconData) {
callback2(name, iconData);
names.push(name);
}
});
}
return names;
}
var optionalProperties = {
provider: "string",
aliases: "object",
not_found: "object"
};
for (const prop in iconDefaults) {
optionalProperties[prop] = typeof iconDefaults[prop];
}
function quicklyValidateIconSet(obj) {
if (typeof obj !== "object" || obj === null) {
return null;
}
const data = obj;
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
return null;
}
for (const prop in optionalProperties) {
if (obj[prop] !== void 0 && typeof obj[prop] !== optionalProperties[prop]) {
return null;
}
}
const icons = data.icons;
for (const name in icons) {
const icon = icons[name];
if (!name.match(matchName) || typeof icon.body !== "string") {
return null;
}
for (const prop in iconDefaults) {
if (icon[prop] !== void 0 && typeof icon[prop] !== typeof iconDefaults[prop]) {
return null;
}
}
}
const aliases = data.aliases;
if (aliases) {
for (const name in aliases) {
const icon = aliases[name];
const parent = icon.parent;
if (!name.match(matchName) || typeof parent !== "string" || !icons[parent] && !aliases[parent]) {
return null;
}
for (const prop in iconDefaults) {
if (icon[prop] !== void 0 && typeof icon[prop] !== typeof iconDefaults[prop]) {
return null;
}
}
}
}
return data;
}
var stringToIcon = (value, validate, allowSimpleName, provider = "") => {
const colonSeparated = value.split(":");
if (value.slice(0, 1) === "@") {
if (colonSeparated.length < 2 || colonSeparated.length > 3) {
return null;
}
provider = colonSeparated.shift().slice(1);
}
if (colonSeparated.length > 3 || !colonSeparated.length) {
return null;
}
if (colonSeparated.length > 1) {
const name2 = colonSeparated.pop();
const prefix = colonSeparated.pop();
const result = {
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
prefix,
name: name2
};
return validate && !validateIcon(result) ? null : result;
}
const name = colonSeparated[0];
const dashSeparated = name.split("-");
if (dashSeparated.length > 1) {
const result = {
provider,
prefix: dashSeparated.shift(),
name: dashSeparated.join("-")
};
return validate && !validateIcon(result) ? null : result;
}
if (allowSimpleName && provider === "") {
const result = {
provider,
prefix: "",
name
};
return validate && !validateIcon(result, allowSimpleName) ? null : result;
}
return null;
};
var validateIcon = (icon, allowSimpleName) => {
if (!icon) {
return false;
}
return !!((icon.provider === "" || icon.provider.match(matchName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchName)) && icon.name.match(matchName));
};
var storageVersion = 1;
var storage$1 = /* @__PURE__ */ Object.create(null);
try {
const w = window || self;
if (w && w._iconifyStorage.version === storageVersion) {
storage$1 = w._iconifyStorage.storage;
}
} catch (err) {
}
function shareStorage() {
try {
const w = window || self;
if (w && !w._iconifyStorage) {
w._iconifyStorage = {
version: storageVersion,
storage: storage$1
};
}
} catch (err) {
}
}
function newStorage(provider, prefix) {
return {
provider,
prefix,
icons: /* @__PURE__ */ Object.create(null),
missing: /* @__PURE__ */ Object.create(null)
};
}
function getStorage(provider, prefix) {
if (storage$1[provider] === void 0) {
storage$1[provider] = /* @__PURE__ */ Object.create(null);
}
const providerStorage = storage$1[provider];
if (providerStorage[prefix] === void 0) {
providerStorage[prefix] = newStorage(provider, prefix);
}
return providerStorage[prefix];
}
function addIconSet(storage2, data) {
if (!quicklyValidateIconSet(data)) {
return [];
}
const t = Date.now();
return parseIconSet(data, (name, icon) => {
if (icon) {
storage2.icons[name] = icon;
} else {
storage2.missing[name] = t;
}
});
}
function addIconToStorage(storage2, name, icon) {
try {
if (typeof icon.body === "string") {
storage2.icons[name] = Object.freeze(fullIcon(icon));
return true;
}
} catch (err) {
}
return false;
}
function getIconFromStorage(storage2, name) {
const value = storage2.icons[name];
return value === void 0 ? null : value;
}
function listIcons(provider, prefix) {
let allIcons = [];
let providers;
if (typeof provider === "string") {
providers = [provider];
} else {
providers = Object.keys(storage$1);
}
providers.forEach((provider2) => {
let prefixes;
if (typeof provider2 === "string" && typeof prefix === "string") {
prefixes = [prefix];
} else {
prefixes = storage$1[provider2] === void 0 ? [] : Object.keys(storage$1[provider2]);
}
prefixes.forEach((prefix2) => {
const storage2 = getStorage(provider2, prefix2);
const icons = Object.keys(storage2.icons).map((name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name);
allIcons = allIcons.concat(icons);
});
});
return allIcons;
}
var simpleNames = false;
function allowSimpleNames(allow) {
if (typeof allow === "boolean") {
simpleNames = allow;
}
return simpleNames;
}
function getIconData(name) {
const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
return icon ? getIconFromStorage(getStorage(icon.provider, icon.prefix), icon.name) : null;
}
function addIcon(name, data) {
const icon = stringToIcon(name, true, simpleNames);
if (!icon) {
return false;
}
const storage2 = getStorage(icon.provider, icon.prefix);
return addIconToStorage(storage2, icon.name, data);
}
function addCollection(data, provider) {
if (typeof data !== "object") {
return false;
}
if (typeof provider !== "string") {
provider = typeof data.provider === "string" ? data.provider : "";
}
if (simpleNames && provider === "" && (typeof data.prefix !== "string" || data.prefix === "")) {
let added = false;
if (quicklyValidateIconSet(data)) {
data.prefix = "";
parseIconSet(data, (name, icon) => {
if (icon && addIcon(name, icon)) {
added = true;
}
});
}
return added;
}
if (typeof data.prefix !== "string" || !validateIcon({
provider,
prefix: data.prefix,
name: "a"
})) {
return false;
}
const storage2 = getStorage(provider, data.prefix);
return !!addIconSet(storage2, data);
}
function iconExists(name) {
return getIconData(name) !== null;
}
function getIcon(name) {
const result = getIconData(name);
return result ? __spreadValues({}, result) : null;
}
var defaults = Object.freeze({
inline: false,
width: null,
height: null,
hAlign: "center",
vAlign: "middle",
slice: false,
hFlip: false,
vFlip: false,
rotate: 0
});
function mergeCustomisations(defaults2, item) {
const result = {};
for (const key in defaults2) {
const attr = key;
result[attr] = defaults2[attr];
if (item[attr] === void 0) {
continue;
}
const value = item[attr];
switch (attr) {
case "inline":
case "slice":
if (typeof value === "boolean") {
result[attr] = value;
}
break;
case "hFlip":
case "vFlip":
if (value === true) {
result[attr] = !result[attr];
}
break;
case "hAlign":
case "vAlign":
if (typeof value === "string" && value !== "") {
result[attr] = value;
}
break;
case "width":
case "height":
if (typeof value === "string" && value !== "" || typeof value === "number" && value || value === null) {
result[attr] = value;
}
break;
case "rotate":
if (typeof value === "number") {
result[attr] += value;
}
break;
}
}
return result;
}
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function calculateSize(size, ratio, precision) {
if (ratio === 1) {
return size;
}
precision = precision === void 0 ? 100 : precision;
if (typeof size === "number") {
return Math.ceil(size * ratio * precision) / precision;
}
if (typeof size !== "string") {
return size;
}
const oldParts = size.split(unitsSplit);
if (oldParts === null || !oldParts.length) {
return size;
}
const newParts = [];
let code = oldParts.shift();
let isNumber = unitsTest.test(code);
while (true) {
if (isNumber) {
const num = parseFloat(code);
if (isNaN(num)) {
newParts.push(code);
} else {
newParts.push(Math.ceil(num * ratio * precision) / precision);
}
} else {
newParts.push(code);
}
code = oldParts.shift();
if (code === void 0) {
return newParts.join("");
}
isNumber = !isNumber;
}
}
function preserveAspectRatio(props) {
let result = "";
switch (props.hAlign) {
case "left":
result += "xMin";
break;
case "right":
result += "xMax";
break;
default:
result += "xMid";
}
switch (props.vAlign) {
case "top":
result += "YMin";
break;
case "bottom":
result += "YMax";
break;
default:
result += "YMid";
}
result += props.slice ? " slice" : " meet";
return result;
}
function iconToSVG(icon, customisations) {
const box = {
left: icon.left,
top: icon.top,
width: icon.width,
height: icon.height
};
let body = icon.body;
[icon, customisations].forEach((props) => {
const transformations = [];
const hFlip = props.hFlip;
const vFlip = props.vFlip;
let rotation = props.rotate;
if (hFlip) {
if (vFlip) {
rotation += 2;
} else {
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
transformations.push("scale(-1 1)");
box.top = box.left = 0;
}
} else if (vFlip) {
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
transformations.push("scale(1 -1)");
box.top = box.left = 0;
}
let tempValue;
if (rotation < 0) {
rotation -= Math.floor(rotation / 4) * 4;
}
rotation = rotation % 4;
switch (rotation) {
case 1:
tempValue = box.height / 2 + box.top;
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
break;
case 2:
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
break;
case 3:
tempValue = box.width / 2 + box.left;
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
break;
}
if (rotation % 2 === 1) {
if (box.left !== 0 || box.top !== 0) {
tempValue = box.left;
box.left = box.top;
box.top = tempValue;
}
if (box.width !== box.height) {
tempValue = box.width;
box.width = box.height;
box.height = tempValue;
}
}
if (transformations.length) {
body = '' + body + "";
}
});
let width, height;
if (customisations.width === null && customisations.height === null) {
height = "1em";
width = calculateSize(height, box.width / box.height);
} else if (customisations.width !== null && customisations.height !== null) {
width = customisations.width;
height = customisations.height;
} else if (customisations.height !== null) {
height = customisations.height;
width = calculateSize(height, box.width / box.height);
} else {
width = customisations.width;
height = calculateSize(width, box.height / box.width);
}
if (width === "auto") {
width = box.width;
}
if (height === "auto") {
height = box.height;
}
width = typeof width === "string" ? width : width.toString() + "";
height = typeof height === "string" ? height : height.toString() + "";
const result = {
attributes: {
width,
height,
preserveAspectRatio: preserveAspectRatio(customisations),
viewBox: box.left.toString() + " " + box.top.toString() + " " + box.width.toString() + " " + box.height.toString()
},
body
};
if (customisations.inline) {
result.inline = true;
}
return result;
}
function buildIcon(icon, customisations) {
return iconToSVG(fullIcon(icon), customisations ? mergeCustomisations(defaults, customisations) : defaults);
}
var regex = /\sid="(\S+)"/g;
var randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
var counter = 0;
function replaceIDs(body, prefix = randomPrefix) {
const ids = [];
let match;
while (match = regex.exec(body)) {
ids.push(match[1]);
}
if (!ids.length) {
return body;
}
ids.forEach((id) => {
const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3");
});
return body;
}
var cacheVersion = "iconify2";
var cachePrefix = "iconify";
var countKey = cachePrefix + "-count";
var versionKey = cachePrefix + "-version";
var hour = 36e5;
var cacheExpiration = 168;
var config = {
local: true,
session: true
};
var loaded = false;
var count = {
local: 0,
session: 0
};
var emptyList = {
local: [],
session: []
};
var _window = typeof window === "undefined" ? {} : window;
function getGlobal(key) {
const attr = key + "Storage";
try {
if (_window && _window[attr] && typeof _window[attr].length === "number") {
return _window[attr];
}
} catch (err) {
}
config[key] = false;
return null;
}
function setCount(storage2, key, value) {
try {
storage2.setItem(countKey, value.toString());
count[key] = value;
return true;
} catch (err) {
return false;
}
}
function getCount(storage2) {
const count2 = storage2.getItem(countKey);
if (count2) {
const total = parseInt(count2);
return total ? total : 0;
}
return 0;
}
function initCache(storage2, key) {
try {
storage2.setItem(versionKey, cacheVersion);
} catch (err) {
}
setCount(storage2, key, 0);
}
function destroyCache(storage2) {
try {
const total = getCount(storage2);
for (let i = 0; i < total; i++) {
storage2.removeItem(cachePrefix + i.toString());
}
} catch (err) {
}
}
var loadCache = () => {
if (loaded) {
return;
}
loaded = true;
const minTime = Math.floor(Date.now() / hour) - cacheExpiration;
function load(key) {
const func = getGlobal(key);
if (!func) {
return;
}
const getItem = (index) => {
const name = cachePrefix + index.toString();
const item = func.getItem(name);
if (typeof item !== "string") {
return false;
}
let valid = true;
try {
const data = JSON.parse(item);
if (typeof data !== "object" || typeof data.cached !== "number" || data.cached < minTime || typeof data.provider !== "string" || typeof data.data !== "object" || typeof data.data.prefix !== "string") {
valid = false;
} else {
const provider = data.provider;
const prefix = data.data.prefix;
const storage2 = getStorage(provider, prefix);
valid = addIconSet(storage2, data.data).length > 0;
}
} catch (err) {
valid = false;
}
if (!valid) {
func.removeItem(name);
}
return valid;
};
try {
const version = func.getItem(versionKey);
if (version !== cacheVersion) {
if (version) {
destroyCache(func);
}
initCache(func, key);
return;
}
let total = getCount(func);
for (let i = total - 1; i >= 0; i--) {
if (!getItem(i)) {
if (i === total - 1) {
total--;
} else {
emptyList[key].push(i);
}
}
}
setCount(func, key, total);
} catch (err) {
}
}
for (const key in config) {
load(key);
}
};
var storeCache = (provider, data) => {
if (!loaded) {
loadCache();
}
function store(key) {
if (!config[key]) {
return false;
}
const func = getGlobal(key);
if (!func) {
return false;
}
let index = emptyList[key].shift();
if (index === void 0) {
index = count[key];
if (!setCount(func, key, index + 1)) {
return false;
}
}
try {
const item = {
cached: Math.floor(Date.now() / hour),
provider,
data
};
func.setItem(cachePrefix + index.toString(), JSON.stringify(item));
} catch (err) {
return false;
}
return true;
}
if (!Object.keys(data.icons).length) {
return;
}
if (data.not_found) {
data = Object.assign({}, data);
delete data.not_found;
}
if (!store("local")) {
store("session");
}
};
var cache = {};
function toggleBrowserCache(storage2, value) {
switch (storage2) {
case "local":
case "session":
config[storage2] = value;
break;
case "all":
for (const key in config) {
config[key] = value;
}
break;
}
}
var storage = /* @__PURE__ */ Object.create(null);
function setAPIModule(provider, item) {
storage[provider] = item;
}
function getAPIModule(provider) {
return storage[provider] || storage[""];
}
function createAPIConfig(source) {
let resources;
if (typeof source.resources === "string") {
resources = [source.resources];
} else {
resources = source.resources;
if (!(resources instanceof Array) || !resources.length) {
return null;
}
}
const result = {
resources,
path: source.path === void 0 ? "/" : source.path,
maxURL: source.maxURL ? source.maxURL : 500,
rotate: source.rotate ? source.rotate : 750,
timeout: source.timeout ? source.timeout : 5e3,
random: source.random === true,
index: source.index ? source.index : 0,
dataAfterTimeout: source.dataAfterTimeout !== false
};
return result;
}
var configStorage = /* @__PURE__ */ Object.create(null);
var fallBackAPISources = [
"https://api.simplesvg.com",
"https://api.unisvg.com"
];
var fallBackAPI = [];
while (fallBackAPISources.length > 0) {
if (fallBackAPISources.length === 1) {
fallBackAPI.push(fallBackAPISources.shift());
} else {
if (Math.random() > 0.5) {
fallBackAPI.push(fallBackAPISources.shift());
} else {
fallBackAPI.push(fallBackAPISources.pop());
}
}
}
configStorage[""] = createAPIConfig({
resources: ["https://api.iconify.design"].concat(fallBackAPI)
});
function addAPIProvider(provider, customConfig) {
const config2 = createAPIConfig(customConfig);
if (config2 === null) {
return false;
}
configStorage[provider] = config2;
return true;
}
function getAPIConfig(provider) {
return configStorage[provider];
}
function listAPIProviders() {
return Object.keys(configStorage);
}
var mergeParams = (base, params) => {
let result = base, hasParams = result.indexOf("?") !== -1;
function paramToString(value) {
switch (typeof value) {
case "boolean":
return value ? "true" : "false";
case "number":
return encodeURIComponent(value);
case "string":
return encodeURIComponent(value);
default:
throw new Error("Invalid parameter");
}
}
Object.keys(params).forEach((key) => {
let value;
try {
value = paramToString(params[key]);
} catch (err) {
return;
}
result += (hasParams ? "&" : "?") + encodeURIComponent(key) + "=" + value;
hasParams = true;
});
return result;
};
var maxLengthCache = {};
var pathCache = {};
var detectFetch = () => {
let callback2;
try {
callback2 = fetch;
if (typeof callback2 === "function") {
return callback2;
}
} catch (err) {
}
return null;
};
var fetchModule = detectFetch();
function setFetch(fetch2) {
fetchModule = fetch2;
}
function getFetch() {
return fetchModule;
}
function calculateMaxLength(provider, prefix) {
const config2 = getAPIConfig(provider);
if (!config2) {
return 0;
}
let result;
if (!config2.maxURL) {
result = 0;
} else {
let maxHostLength = 0;
config2.resources.forEach((item) => {
const host = item;
maxHostLength = Math.max(maxHostLength, host.length);
});
const url = mergeParams(prefix + ".json", {
icons: ""
});
result = config2.maxURL - maxHostLength - config2.path.length - url.length;
}
const cacheKey = provider + ":" + prefix;
pathCache[provider] = config2.path;
maxLengthCache[cacheKey] = result;
return result;
}
function shouldAbort(status) {
return status === 404;
}
var prepare = (provider, prefix, icons) => {
const results = [];
let maxLength = maxLengthCache[prefix];
if (maxLength === void 0) {
maxLength = calculateMaxLength(provider, prefix);
}
const type = "icons";
let item = {
type,
provider,
prefix,
icons: []
};
let length = 0;
icons.forEach((name, index) => {
length += name.length + 1;
if (length >= maxLength && index > 0) {
results.push(item);
item = {
type,
provider,
prefix,
icons: []
};
length = name.length;
}
item.icons.push(name);
});
results.push(item);
return results;
};
function getPath(provider) {
if (typeof provider === "string") {
if (pathCache[provider] === void 0) {
const config2 = getAPIConfig(provider);
if (!config2) {
return "/";
}
pathCache[provider] = config2.path;
}
return pathCache[provider];
}
return "/";
}
var send = (host, params, callback2) => {
if (!fetchModule) {
callback2("abort", 424);
return;
}
let path = getPath(params.provider);
switch (params.type) {
case "icons": {
const prefix = params.prefix;
const icons = params.icons;
const iconsList = icons.join(",");
path += mergeParams(prefix + ".json", {
icons: iconsList
});
break;
}
case "custom": {
const uri = params.uri;
path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
break;
}
default:
callback2("abort", 400);
return;
}
let defaultError = 503;
fetchModule(host + path).then((response) => {
const status = response.status;
if (status !== 200) {
setTimeout(() => {
callback2(shouldAbort(status) ? "abort" : "next", status);
});
return;
}
defaultError = 501;
return response.json();
}).then((data) => {
if (typeof data !== "object" || data === null) {
setTimeout(() => {
callback2("next", defaultError);
});
return;
}
setTimeout(() => {
callback2("success", data);
});
}).catch(() => {
callback2("next", defaultError);
});
};
var fetchAPIModule = {
prepare,
send
};
function sortIcons(icons) {
const result = {
loaded: [],
missing: [],
pending: []
};
const storage2 = /* @__PURE__ */ Object.create(null);
icons.sort((a, b) => {
if (a.provider !== b.provider) {
return a.provider.localeCompare(b.provider);
}
if (a.prefix !== b.prefix) {
return a.prefix.localeCompare(b.prefix);
}
return a.name.localeCompare(b.name);
});
let lastIcon = {
provider: "",
prefix: "",
name: ""
};
icons.forEach((icon) => {
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
return;
}
lastIcon = icon;
const provider = icon.provider;
const prefix = icon.prefix;
const name = icon.name;
if (storage2[provider] === void 0) {
storage2[provider] = /* @__PURE__ */ Object.create(null);
}
const providerStorage = storage2[provider];
if (providerStorage[prefix] === void 0) {
providerStorage[prefix] = getStorage(provider, prefix);
}
const localStorage = providerStorage[prefix];
let list;
if (localStorage.icons[name] !== void 0) {
list = result.loaded;
} else if (prefix === "" || localStorage.missing[name] !== void 0) {
list = result.missing;
} else {
list = result.pending;
}
const item = {
provider,
prefix,
name
};
list.push(item);
});
return result;
}
var callbacks = /* @__PURE__ */ Object.create(null);
var pendingUpdates = /* @__PURE__ */ Object.create(null);
function removeCallback(sources, id) {
sources.forEach((source) => {
const provider = source.provider;
if (callbacks[provider] === void 0) {
return;
}
const providerCallbacks = callbacks[provider];
const prefix = source.prefix;
const items = providerCallbacks[prefix];
if (items) {
providerCallbacks[prefix] = items.filter((row) => row.id !== id);
}
});
}
function updateCallbacks(provider, prefix) {
if (pendingUpdates[provider] === void 0) {
pendingUpdates[provider] = /* @__PURE__ */ Object.create(null);
}
const providerPendingUpdates = pendingUpdates[provider];
if (!providerPendingUpdates[prefix]) {
providerPendingUpdates[prefix] = true;
setTimeout(() => {
providerPendingUpdates[prefix] = false;
if (callbacks[provider] === void 0 || callbacks[provider][prefix] === void 0) {
return;
}
const items = callbacks[provider][prefix].slice(0);
if (!items.length) {
return;
}
const storage2 = getStorage(provider, prefix);
let hasPending = false;
items.forEach((item) => {
const icons = item.icons;
const oldLength = icons.pending.length;
icons.pending = icons.pending.filter((icon) => {
if (icon.prefix !== prefix) {
return true;
}
const name = icon.name;
if (storage2.icons[name] !== void 0) {
icons.loaded.push({
provider,
prefix,
name
});
} else if (storage2.missing[name] !== void 0) {
icons.missing.push({
provider,
prefix,
name
});
} else {
hasPending = true;
return true;
}
return false;
});
if (icons.pending.length !== oldLength) {
if (!hasPending) {
removeCallback([
{
provider,
prefix
}
], item.id);
}
item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort);
}
});
});
}
}
var idCounter = 0;
function storeCallback(callback2, icons, pendingSources) {
const id = idCounter++;
const abort = removeCallback.bind(null, pendingSources, id);
if (!icons.pending.length) {
return abort;
}
const item = {
id,
icons,
callback: callback2,
abort
};
pendingSources.forEach((source) => {
const provider = source.provider;
const prefix = source.prefix;
if (callbacks[provider] === void 0) {
callbacks[provider] = /* @__PURE__ */ Object.create(null);
}
const providerCallbacks = callbacks[provider];
if (providerCallbacks[prefix] === void 0) {
providerCallbacks[prefix] = [];
}
providerCallbacks[prefix].push(item);
});
return abort;
}
function listToIcons(list, validate = true, simpleNames2 = false) {
const result = [];
list.forEach((item) => {
const icon = typeof item === "string" ? stringToIcon(item, false, simpleNames2) : item;
if (!validate || validateIcon(icon, simpleNames2)) {
result.push({
provider: icon.provider,
prefix: icon.prefix,
name: icon.name
});
}
});
return result;
}
var defaultConfig = {
resources: [],
index: 0,
timeout: 2e3,
rotate: 750,
random: false,
dataAfterTimeout: false
};
function sendQuery(config2, payload, query, done) {
const resourcesCount = config2.resources.length;
const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
let resources;
if (config2.random) {
let list = config2.resources.slice(0);
resources = [];
while (list.length > 1) {
const nextIndex = Math.floor(Math.random() * list.length);
resources.push(list[nextIndex]);
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
}
resources = resources.concat(list);
} else {
resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
}
const startTime = Date.now();
let status = "pending";
let queriesSent = 0;
let lastError;
let timer = null;
let queue = [];
let doneCallbacks = [];
if (typeof done === "function") {
doneCallbacks.push(done);
}
function resetTimer() {
if (timer) {
clearTimeout(timer);
timer = null;
}
}
function abort() {
if (status === "pending") {
status = "aborted";
}
resetTimer();
queue.forEach((item) => {
if (item.status === "pending") {
item.status = "aborted";
}
});
queue = [];
}
function subscribe(callback2, overwrite) {
if (overwrite) {
doneCallbacks = [];
}
if (typeof callback2 === "function") {
doneCallbacks.push(callback2);
}
}
function getQueryStatus() {
return {
startTime,
payload,
status,
queriesSent,
queriesPending: queue.length,
subscribe,
abort
};
}
function failQuery() {
status = "failed";
doneCallbacks.forEach((callback2) => {
callback2(void 0, lastError);
});
}
function clearQueue() {
queue.forEach((item) => {
if (item.status === "pending") {
item.status = "aborted";
}
});
queue = [];
}
function moduleResponse(item, response, data) {
const isError = response !== "success";
queue = queue.filter((queued) => queued !== item);
switch (status) {
case "pending":
break;
case "failed":
if (isError || !config2.dataAfterTimeout) {
return;
}
break;
default:
return;
}
if (response === "abort") {
lastError = data;
failQuery();
return;
}
if (isError) {
lastError = data;
if (!queue.length) {
if (!resources.length) {
failQuery();
} else {
execNext();
}
}
return;
}
resetTimer();
clearQueue();
if (!config2.random) {
const index = config2.resources.indexOf(item.resource);
if (index !== -1 && index !== config2.index) {
config2.index = index;
}
}
status = "completed";
doneCallbacks.forEach((callback2) => {
callback2(data);
});
}
function execNext() {
if (status !== "pending") {
return;
}
resetTimer();
const resource = resources.shift();
if (resource === void 0) {
if (queue.length) {
timer = setTimeout(() => {
resetTimer();
if (status === "pending") {
clearQueue();
failQuery();
}
}, config2.timeout);
return;
}
failQuery();
return;
}
const item = {
status: "pending",
resource,
callback: (status2, data) => {
moduleResponse(item, status2, data);
}
};
queue.push(item);
queriesSent++;
timer = setTimeout(execNext, config2.rotate);
query(resource, payload, item.callback);
}
setTimeout(execNext);
return getQueryStatus;
}
function setConfig(config2) {
if (typeof config2 !== "object" || typeof config2.resources !== "object" || !(config2.resources instanceof Array) || !config2.resources.length) {
throw new Error("Invalid Reduncancy configuration");
}
const newConfig = /* @__PURE__ */ Object.create(null);
let key;
for (key in defaultConfig) {
if (config2[key] !== void 0) {
newConfig[key] = config2[key];
} else {
newConfig[key] = defaultConfig[key];
}
}
return newConfig;
}
function initRedundancy(cfg) {
const config2 = setConfig(cfg);
let queries = [];
function cleanup() {
queries = queries.filter((item) => item().status === "pending");
}
function query(payload, queryCallback, doneCallback) {
const query2 = sendQuery(config2, payload, queryCallback, (data, error) => {
cleanup();
if (doneCallback) {
doneCallback(data, error);
}
});
queries.push(query2);
return query2;
}
function find(callback2) {
const result = queries.find((value) => {
return callback2(value);
});
return result !== void 0 ? result : null;
}
const instance = {
query,
find,
setIndex: (index) => {
config2.index = index;
},
getIndex: () => config2.index,
cleanup
};
return instance;
}
function emptyCallback$1() {
}
var redundancyCache = /* @__PURE__ */ Object.create(null);
function getRedundancyCache(provider) {
if (redundancyCache[provider] === void 0) {
const config2 = getAPIConfig(provider);
if (!config2) {
return;
}
const redundancy = initRedundancy(config2);
const cachedReundancy = {
config: config2,
redundancy
};
redundancyCache[provider] = cachedReundancy;
}
return redundancyCache[provider];
}
function sendAPIQuery(target, query, callback2) {
let redundancy;
let send2;
if (typeof target === "string") {
const api = getAPIModule(target);
if (!api) {
callback2(void 0, 424);
return emptyCallback$1;
}
send2 = api.send;
const cached = getRedundancyCache(target);
if (cached) {
redundancy = cached.redundancy;
}
} else {
const config2 = createAPIConfig(target);
if (config2) {
redundancy = initRedundancy(config2);
const moduleKey = target.resources ? target.resources[0] : "";
const api = getAPIModule(moduleKey);
if (api) {
send2 = api.send;
}
}
}
if (!redundancy || !send2) {
callback2(void 0, 424);
return emptyCallback$1;
}
return redundancy.query(query, send2, callback2)().abort;
}
function emptyCallback() {
}
var pendingIcons = /* @__PURE__ */ Object.create(null);
var iconsToLoad = /* @__PURE__ */ Object.create(null);
var loaderFlags = /* @__PURE__ */ Object.create(null);
var queueFlags = /* @__PURE__ */ Object.create(null);
function loadedNewIcons(provider, prefix) {
if (loaderFlags[provider] === void 0) {
loaderFlags[provider] = /* @__PURE__ */ Object.create(null);
}
const providerLoaderFlags = loaderFlags[provider];
if (!providerLoaderFlags[prefix]) {
providerLoaderFlags[prefix] = true;
setTimeout(() => {
providerLoaderFlags[prefix] = false;
updateCallbacks(provider, prefix);
});
}
}
var errorsCache = /* @__PURE__ */ Object.create(null);
function loadNewIcons(provider, prefix, icons) {
function err() {
const key = (provider === "" ? "" : "@" + provider + ":") + prefix;
const time = Math.floor(Date.now() / 6e4);
if (errorsCache[key] < time) {
errorsCache[key] = time;
console.error('Unable to retrieve icons for "' + key + '" because API is not configured properly.');
}
}
if (iconsToLoad[provider] === void 0) {
iconsToLoad[provider] = /* @__PURE__ */ Object.create(null);
}
const providerIconsToLoad = iconsToLoad[provider];
if (queueFlags[provider] === void 0) {
queueFlags[provider] = /* @__PURE__ */ Object.create(null);
}
const providerQueueFlags = queueFlags[provider];
if (pendingIcons[provider] === void 0) {
pendingIcons[provider] = /* @__PURE__ */ Object.create(null);
}
const providerPendingIcons = pendingIcons[provider];
if (providerIconsToLoad[prefix] === void 0) {
providerIconsToLoad[prefix] = icons;
} else {
providerIconsToLoad[prefix] = providerIconsToLoad[prefix].concat(icons).sort();
}
if (!providerQueueFlags[prefix]) {
providerQueueFlags[prefix] = true;
setTimeout(() => {
providerQueueFlags[prefix] = false;
const icons2 = providerIconsToLoad[prefix];
delete providerIconsToLoad[prefix];
const api = getAPIModule(provider);
if (!api) {
err();
return;
}
const params = api.prepare(provider, prefix, icons2);
params.forEach((item) => {
sendAPIQuery(provider, item, (data, error) => {
const storage2 = getStorage(provider, prefix);
if (typeof data !== "object") {
if (error !== 404) {
return;
}
const t = Date.now();
item.icons.forEach((name) => {
storage2.missing[name] = t;
});
} else {
try {
const parsed = addIconSet(storage2, data);
if (!parsed.length) {
return;
}
const pending = providerPendingIcons[prefix];
parsed.forEach((name) => {
delete pending[name];
});
if (cache.store) {
cache.store(provider, data);
}
} catch (err2) {
console.error(err2);
}
}
loadedNewIcons(provider, prefix);
});
});
});
}
}
var isPending = (icon) => {
const provider = icon.provider;
const prefix = icon.prefix;
return pendingIcons[provider] && pendingIcons[provider][prefix] && pendingIcons[provider][prefix][icon.name] !== void 0;
};
var loadIcons = (icons, callback2) => {
const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
const sortedIcons = sortIcons(cleanedIcons);
if (!sortedIcons.pending.length) {
let callCallback = true;
if (callback2) {
setTimeout(() => {
if (callCallback) {
callback2(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback);
}
});
}
return () => {
callCallback = false;
};
}
const newIcons = /* @__PURE__ */ Object.create(null);
const sources = [];
let lastProvider, lastPrefix;
sortedIcons.pending.forEach((icon) => {
const provider = icon.provider;
const prefix = icon.prefix;
if (prefix === lastPrefix && provider === lastProvider) {
return;
}
lastProvider = provider;
lastPrefix = prefix;
sources.push({
provider,
prefix
});
if (pendingIcons[provider] === void 0) {
pendingIcons[provider] = /* @__PURE__ */ Object.create(null);
}
const providerPendingIcons = pendingIcons[provider];
if (providerPendingIcons[prefix] === void 0) {
providerPendingIcons[prefix] = /* @__PURE__ */ Object.create(null);
}
if (newIcons[provider] === void 0) {
newIcons[provider] = /* @__PURE__ */ Object.create(null);
}
const providerNewIcons = newIcons[provider];
if (providerNewIcons[prefix] === void 0) {
providerNewIcons[prefix] = [];
}
});
const time = Date.now();
sortedIcons.pending.forEach((icon) => {
const provider = icon.provider;
const prefix = icon.prefix;
const name = icon.name;
const pendingQueue = pendingIcons[provider][prefix];
if (pendingQueue[name] === void 0) {
pendingQueue[name] = time;
newIcons[provider][prefix].push(name);
}
});
sources.forEach((source) => {
const provider = source.provider;
const prefix = source.prefix;
if (newIcons[provider][prefix].length) {
loadNewIcons(provider, prefix, newIcons[provider][prefix]);
}
});
return callback2 ? storeCallback(callback2, sortedIcons, sources) : emptyCallback;
};
var loadIcon = (icon) => {
return new Promise((fulfill, reject) => {
const iconObj = typeof icon === "string" ? stringToIcon(icon) : icon;
loadIcons([iconObj || icon], (loaded2) => {
if (loaded2.length && iconObj) {
const storage2 = getStorage(iconObj.provider, iconObj.prefix);
const data = getIconFromStorage(storage2, iconObj.name);
if (data) {
fulfill(data);
return;
}
}
reject(icon);
});
});
};
var elementFinderProperty = "iconifyFinder" + Date.now();
var elementDataProperty = "iconifyData" + Date.now();
function renderIconInPlaceholder(placeholder, customisations, iconData, returnString) {
let span;
try {
span = document.createElement("span");
} catch (err) {
return returnString ? "" : null;
}
const data = iconToSVG(iconData, mergeCustomisations(defaults, customisations));
const placeholderElement = placeholder.element;
const finder2 = placeholder.finder;
const name = placeholder.name;
const placeholderClassName = placeholderElement ? placeholderElement.getAttribute("class") : "";
const filteredClassList = finder2 ? finder2.classFilter(placeholderClassName ? placeholderClassName.split(/\s+/) : []) : [];
const className = "iconify iconify--" + name.prefix + (name.provider === "" ? "" : " iconify--" + name.provider) + (filteredClassList.length ? " " + filteredClassList.join(" ") : "");
const html = '";
span.innerHTML = html;
const svg = span.childNodes[0];
const svgStyle = svg.style;
const svgAttributes = data.attributes;
Object.keys(svgAttributes).forEach((attr) => {
svg.setAttribute(attr, svgAttributes[attr]);
});
if (data.inline) {
svgStyle.verticalAlign = "-0.125em";
}
if (placeholderElement) {
const placeholderAttributes = placeholderElement.attributes;
for (let i = 0; i < placeholderAttributes.length; i++) {
const item = placeholderAttributes.item(i);
if (item) {
const name2 = item.name;
if (name2 !== "class" && name2 !== "style" && svgAttributes[name2] === void 0) {
try {
svg.setAttribute(name2, item.value);
} catch (err) {
}
}
}
}
const placeholderStyle = placeholderElement.style;
for (let i = 0; i < placeholderStyle.length; i++) {
const attr = placeholderStyle[i];
svgStyle[attr] = placeholderStyle[attr];
}
}
if (finder2) {
const elementData = {
name,
status: "loaded",
customisations
};
svg[elementDataProperty] = elementData;
svg[elementFinderProperty] = finder2;
}
const result = returnString ? span.innerHTML : svg;
if (placeholderElement && placeholderElement.parentNode) {
placeholderElement.parentNode.replaceChild(svg, placeholderElement);
} else {
span.removeChild(svg);
}
return result;
}
var nodes = [];
function findRootNode(node) {
for (let i = 0; i < nodes.length; i++) {
const item = nodes[i];
const root = typeof item.node === "function" ? item.node() : item.node;
if (root === node) {
return item;
}
}
}
function addRootNode(root, autoRemove = false) {
let node = findRootNode(root);
if (node) {
if (node.temporary) {
node.temporary = autoRemove;
}
return node;
}
node = {
node: root,
temporary: autoRemove
};
nodes.push(node);
return node;
}
function addBodyNode() {
if (document.documentElement) {
return addRootNode(document.documentElement);
}
nodes.push({
node: () => {
return document.documentElement;
}
});
}
function removeRootNode(root) {
nodes = nodes.filter((node) => {
const element = typeof node.node === "function" ? node.node() : node.node;
return root !== element;
});
}
function listRootNodes() {
return nodes;
}
function onReady(callback2) {
const doc = document;
if (doc.readyState === "complete" || doc.readyState !== "loading" && !doc.documentElement.doScroll) {
callback2();
} else {
doc.addEventListener("DOMContentLoaded", callback2);
window.addEventListener("load", callback2);
}
}
var callback = null;
var observerParams = {
childList: true,
subtree: true,
attributes: true
};
function queueScan(node) {
if (!node.observer) {
return;
}
const observer = node.observer;
if (!observer.pendingScan) {
observer.pendingScan = setTimeout(() => {
delete observer.pendingScan;
if (callback) {
callback(node);
}
});
}
}
function checkMutations(node, mutations) {
if (!node.observer) {
return;
}
const observer = node.observer;
if (!observer.pendingScan) {
for (let i = 0; i < mutations.length; i++) {
const item = mutations[i];
if (item.addedNodes && item.addedNodes.length > 0 || item.type === "attributes" && item.target[elementFinderProperty] !== void 0) {
if (!observer.paused) {
queueScan(node);
}
return;
}
}
}
}
function continueObserving(node, root) {
node.observer.instance.observe(root, observerParams);
}
function startObserver(node) {
let observer = node.observer;
if (observer && observer.instance) {
return;
}
const root = typeof node.node === "function" ? node.node() : node.node;
if (!root) {
return;
}
if (!observer) {
observer = {
paused: 0
};
node.observer = observer;
}
observer.instance = new MutationObserver(checkMutations.bind(null, node));
continueObserving(node, root);
if (!observer.paused) {
queueScan(node);
}
}
function startObservers() {
listRootNodes().forEach(startObserver);
}
function stopObserver(node) {
if (!node.observer) {
return;
}
const observer = node.observer;
if (observer.pendingScan) {
clearTimeout(observer.pendingScan);
delete observer.pendingScan;
}
if (observer.instance) {
observer.instance.disconnect();
delete observer.instance;
}
}
function initObserver(cb) {
const isRestart = callback !== null;
if (callback !== cb) {
callback = cb;
if (isRestart) {
listRootNodes().forEach(stopObserver);
}
}
if (isRestart) {
startObservers();
return;
}
onReady(startObservers);
}
function pauseObservingNode(node) {
(node ? [node] : listRootNodes()).forEach((node2) => {
if (!node2.observer) {
node2.observer = {
paused: 1
};
return;
}
const observer = node2.observer;
observer.paused++;
if (observer.paused > 1 || !observer.instance) {
return;
}
const instance = observer.instance;
instance.disconnect();
});
}
function pauseObserver(root) {
if (root) {
const node = findRootNode(root);
if (node) {
pauseObservingNode(node);
}
} else {
pauseObservingNode();
}
}
function resumeObservingNode(observer) {
(observer ? [observer] : listRootNodes()).forEach((node) => {
if (!node.observer) {
startObserver(node);
return;
}
const observer2 = node.observer;
if (observer2.paused) {
observer2.paused--;
if (!observer2.paused) {
const root = typeof node.node === "function" ? node.node() : node.node;
if (!root) {
return;
} else if (observer2.instance) {
continueObserving(node, root);
} else {
startObserver(node);
}
}
}
});
}
function resumeObserver(root) {
if (root) {
const node = findRootNode(root);
if (node) {
resumeObservingNode(node);
}
} else {
resumeObservingNode();
}
}
function observe(root, autoRemove = false) {
const node = addRootNode(root, autoRemove);
startObserver(node);
return node;
}
function stopObserving(root) {
const node = findRootNode(root);
if (node) {
stopObserver(node);
removeRootNode(root);
}
}
var finders = [];
function addFinder(finder2) {
if (finders.indexOf(finder2) === -1) {
finders.push(finder2);
}
}
function cleanIconName(name) {
if (typeof name === "string") {
name = stringToIcon(name);
}
return name === null || !validateIcon(name) ? null : name;
}
function compareCustomisations(list1, list2) {
const keys1 = Object.keys(list1);
const keys2 = Object.keys(list2);
if (keys1.length !== keys2.length) {
return false;
}
for (let i = 0; i < keys1.length; i++) {
const key = keys1[i];
if (list2[key] !== list1[key]) {
return false;
}
}
return true;
}
function findPlaceholders(root) {
const results = [];
finders.forEach((finder2) => {
const elements2 = finder2.find(root);
Array.prototype.forEach.call(elements2, (item) => {
const element = item;
if (element[elementFinderProperty] !== void 0 && element[elementFinderProperty] !== finder2) {
return;
}
const name = cleanIconName(finder2.name(element));
if (name === null) {
return;
}
element[elementFinderProperty] = finder2;
const placeholder = {
element,
finder: finder2,
name
};
results.push(placeholder);
});
});
const elements = root.querySelectorAll("svg.iconify");
Array.prototype.forEach.call(elements, (item) => {
const element = item;
const finder2 = element[elementFinderProperty];
const data = element[elementDataProperty];
if (!finder2 || !data) {
return;
}
const name = cleanIconName(finder2.name(element));
if (name === null) {
return;
}
let updated = false;
let customisations;
if (name.prefix !== data.name.prefix || name.name !== data.name.name) {
updated = true;
} else {
customisations = finder2.customisations(element);
if (!compareCustomisations(data.customisations, customisations)) {
updated = true;
}
}
if (updated) {
const placeholder = {
element,
finder: finder2,
name,
customisations
};
results.push(placeholder);
}
});
return results;
}
var scanQueued = false;
function checkPendingIcons() {
if (!scanQueued) {
scanQueued = true;
setTimeout(() => {
if (scanQueued) {
scanQueued = false;
scanDOM();
}
});
}
}
var compareIcons = (icon1, icon2) => {
return icon1 !== null && icon2 !== null && icon1.name === icon2.name && icon1.prefix === icon2.prefix;
};
function scanElement(root) {
const node = findRootNode(root);
if (!node) {
scanDOM({
node: root,
temporary: true
}, true);
} else {
scanDOM(node);
}
}
function scanDOM(node, addTempNode = false) {
scanQueued = false;
const iconsToLoad2 = /* @__PURE__ */ Object.create(null);
(node ? [node] : listRootNodes()).forEach((node2) => {
const root = typeof node2.node === "function" ? node2.node() : node2.node;
if (!root || !root.querySelectorAll) {
return;
}
let hasPlaceholders = false;
let paused = false;
findPlaceholders(root).forEach((item) => {
const element = item.element;
const iconName = item.name;
const provider = iconName.provider;
const prefix = iconName.prefix;
const name = iconName.name;
let data = element[elementDataProperty];
if (data !== void 0 && compareIcons(data.name, iconName)) {
switch (data.status) {
case "missing":
return;
case "loading":
if (isPending({
provider,
prefix,
name
})) {
hasPlaceholders = true;
return;
}
}
}
const storage2 = getStorage(provider, prefix);
if (storage2.icons[name] !== void 0) {
if (!paused && node2.observer) {
pauseObservingNode(node2);
paused = true;
}
const customisations = item.customisations !== void 0 ? item.customisations : item.finder.customisations(element);
renderIconInPlaceholder(item, customisations, getIconFromStorage(storage2, name));
return;
}
if (storage2.missing[name]) {
data = {
name: iconName,
status: "missing",
customisations: {}
};
element[elementDataProperty] = data;
return;
}
if (!isPending({ provider, prefix, name })) {
if (iconsToLoad2[provider] === void 0) {
iconsToLoad2[provider] = /* @__PURE__ */ Object.create(null);
}
const providerIconsToLoad = iconsToLoad2[provider];
if (providerIconsToLoad[prefix] === void 0) {
providerIconsToLoad[prefix] = /* @__PURE__ */ Object.create(null);
}
providerIconsToLoad[prefix][name] = true;
}
data = {
name: iconName,
status: "loading",
customisations: {}
};
element[elementDataProperty] = data;
hasPlaceholders = true;
});
if (node2.temporary && !hasPlaceholders) {
stopObserving(root);
} else if (addTempNode && hasPlaceholders) {
observe(root, true);
} else if (paused && node2.observer) {
resumeObservingNode(node2);
}
});
Object.keys(iconsToLoad2).forEach((provider) => {
const providerIconsToLoad = iconsToLoad2[provider];
Object.keys(providerIconsToLoad).forEach((prefix) => {
loadIcons(Object.keys(providerIconsToLoad[prefix]).map((name) => {
const icon = {
provider,
prefix,
name
};
return icon;
}), checkPendingIcons);
});
});
}
function rotateFromString(value, defaultValue = 0) {
const units = value.replace(/^-?[0-9.]*/, "");
function cleanup(value2) {
while (value2 < 0) {
value2 += 4;
}
return value2 % 4;
}
if (units === "") {
const num = parseInt(value);
return isNaN(num) ? 0 : cleanup(num);
} else if (units !== value) {
let split = 0;
switch (units) {
case "%":
split = 25;
break;
case "deg":
split = 90;
}
if (split) {
let num = parseFloat(value.slice(0, value.length - units.length));
if (isNaN(num)) {
return 0;
}
num = num / split;
return num % 1 === 0 ? cleanup(num) : 0;
}
}
return defaultValue;
}
var separator = /[\s,]+/;
function flipFromString(custom, flip) {
flip.split(separator).forEach((str) => {
const value = str.trim();
switch (value) {
case "horizontal":
custom.hFlip = true;
break;
case "vertical":
custom.vFlip = true;
break;
}
});
}
function alignmentFromString(custom, align) {
align.split(separator).forEach((str) => {
const value = str.trim();
switch (value) {
case "left":
case "center":
case "right":
custom.hAlign = value;
break;
case "top":
case "middle":
case "bottom":
custom.vAlign = value;
break;
case "slice":
case "crop":
custom.slice = true;
break;
case "meet":
custom.slice = false;
}
});
}
function hasAttribute(element, key) {
return element.hasAttribute(key);
}
function getAttribute(element, key) {
return element.getAttribute(key);
}
function getBooleanAttribute(element, key) {
const value = element.getAttribute(key);
if (value === key || value === "true") {
return true;
}
if (value === "" || value === "false") {
return false;
}
return null;
}
var booleanAttributes = [
"inline",
"hFlip",
"vFlip"
];
var stringAttributes = [
"width",
"height"
];
var mainClass = "iconify";
var inlineClass = "iconify-inline";
var selector = "i." + mainClass + ", span." + mainClass + ", i." + inlineClass + ", span." + inlineClass;
var finder = {
find: (root) => root.querySelectorAll(selector),
name: (element) => {
if (hasAttribute(element, "data-icon")) {
return getAttribute(element, "data-icon");
}
return null;
},
customisations: (element, defaultValues = {
inline: false
}) => {
const result = defaultValues;
const className = element.getAttribute("class");
const classList = className ? className.split(/\s+/) : [];
if (classList.indexOf(inlineClass) !== -1) {
result.inline = true;
}
if (hasAttribute(element, "data-rotate")) {
const value = rotateFromString(getAttribute(element, "data-rotate"));
if (value) {
result.rotate = value;
}
}
if (hasAttribute(element, "data-flip")) {
flipFromString(result, getAttribute(element, "data-flip"));
}
if (hasAttribute(element, "data-align")) {
alignmentFromString(result, getAttribute(element, "data-align"));
}
booleanAttributes.forEach((attr) => {
if (hasAttribute(element, "data-" + attr)) {
const value = getBooleanAttribute(element, "data-" + attr);
if (typeof value === "boolean") {
result[attr] = value;
}
}
});
stringAttributes.forEach((attr) => {
if (hasAttribute(element, "data-" + attr)) {
const value = getAttribute(element, "data-" + attr);
if (value !== "") {
result[attr] = value;
}
}
});
return result;
},
classFilter: (classList) => {
const result = [];
classList.forEach((className) => {
if (className !== "iconify" && className !== "" && className.slice(0, 9) !== "iconify--") {
result.push(className);
}
});
return result;
}
};
function generateIcon(name, customisations, returnString) {
const iconData = getIconData(name);
if (!iconData) {
return null;
}
const iconName = stringToIcon(name);
const changes = mergeCustomisations(defaults, typeof customisations === "object" ? customisations : {});
return renderIconInPlaceholder({
name: iconName
}, changes, iconData, returnString);
}
function getVersion() {
return "2.2.1";
}
function renderSVG(name, customisations) {
return generateIcon(name, customisations, false);
}
function renderHTML(name, customisations) {
return generateIcon(name, customisations, true);
}
function renderIcon(name, customisations) {
const iconData = getIconData(name);
if (!iconData) {
return null;
}
const changes = mergeCustomisations(defaults, typeof customisations === "object" ? customisations : {});
return iconToSVG(iconData, changes);
}
function scan(root) {
if (root) {
scanElement(root);
} else {
scanDOM();
}
}
if (typeof document !== "undefined" && typeof window !== "undefined") {
addBodyNode();
addFinder(finder);
const _window2 = window;
if (_window2.IconifyPreload !== void 0) {
const preload = _window2.IconifyPreload;
const err = "Invalid IconifyPreload syntax.";
if (typeof preload === "object" && preload !== null) {
(preload instanceof Array ? preload : [preload]).forEach((item) => {
try {
if (typeof item !== "object" || item === null || item instanceof Array || typeof item.icons !== "object" || typeof item.prefix !== "string" || !addCollection(item)) {
console.error(err);
}
} catch (e) {
console.error(err);
}
});
}
}
setTimeout(() => {
initObserver(scanDOM);
scanDOM();
});
}
function enableCache(storage2, enable) {
toggleBrowserCache(storage2, enable !== false);
}
function disableCache(storage2) {
toggleBrowserCache(storage2, true);
}
setAPIModule("", fetchAPIModule);
if (typeof document !== "undefined" && typeof window !== "undefined") {
cache.store = storeCache;
loadCache();
const _window2 = window;
if (_window2.IconifyProviders !== void 0) {
const providers = _window2.IconifyProviders;
if (typeof providers === "object" && providers !== null) {
for (const key in providers) {
const err = "IconifyProviders[" + key + "] is invalid.";
try {
const value = providers[key];
if (typeof value !== "object" || !value || value.resources === void 0) {
continue;
}
if (!addAPIProvider(key, value)) {
console.error(err);
}
} catch (e) {
console.error(err);
}
}
}
}
}
var _api = {
getAPIConfig,
setAPIModule,
sendAPIQuery,
setFetch,
getFetch,
listAPIProviders,
mergeParams
};
var Iconify = {
_api,
addAPIProvider,
loadIcons,
loadIcon,
iconExists,
getIcon,
listIcons,
addIcon,
addCollection,
shareStorage,
replaceIDs,
calculateSize,
buildIcon,
getVersion,
renderSVG,
renderHTML,
renderIcon,
scan,
observe,
stopObserving,
pauseObserver,
resumeObserver,
enableCache,
disableCache
};
try {
if (self.Iconify === void 0) {
self.Iconify = Iconify;
}
} catch (err) {
}
// dep:@iconify_iconify
var iconify_iconify_default = Iconify;
export {
_api,
addAPIProvider,
addCollection,
addIcon,
buildIcon,
calculateSize,
iconify_iconify_default as default,
disableCache,
enableCache,
getIcon,
getVersion,
iconExists,
listIcons,
loadIcon,
loadIcons,
observe,
pauseObserver,
renderHTML,
renderIcon,
renderSVG,
replaceIDs,
resumeObserver,
scan,
shareStorage,
stopObserving
};
/**
* (c) Iconify
*
* For the full copyright and license information, please view the license.txt or license.gpl.txt
* files at https://github.com/iconify/iconify
*
* Licensed under Apache 2.0 or GPL 2.0 at your option.
* If derivative product is not compatible with one of licenses, you can pick one of licenses.
*
* @license Apache 2.0
* @license GPL 2.0
* @version 2.2.1
*/
//# sourceMappingURL=@iconify_iconify.js.map