UNPKG

1.3 kBJavaScriptView Raw
1import{g as getAssetPath}from"./index-468d974f.js";var CACHED_MAP;var getIconMap=function(){if(typeof window==="undefined"){return new Map}else{if(!CACHED_MAP){var r=window;r.Ionicons=r.Ionicons||{};CACHED_MAP=r.Ionicons.map=r.Ionicons.map||new Map}return CACHED_MAP}};var addIcons=function(r){var e=getIconMap();Object.keys(r).forEach((function(t){return e.set(t,r[t])}))};var getUrl=function(r){var e=getSrc(r.src);if(e){return e}e=getName(r.name,r.icon,r.mode,r.ios,r.md);if(e){return getNamedUrl(e)}if(r.icon){e=getSrc(r.icon);if(e){return e}e=getSrc(r.icon[r.mode]);if(e){return e}}return null};var getNamedUrl=function(r){var e=getIconMap().get(r);if(e){return e}return getAssetPath("svg/"+r+".svg")};var getName=function(r,e,t,n,i){t=(t&&toLower(t))==="ios"?"ios":"md";if(n&&t==="ios"){r=toLower(n)}else if(i&&t==="md"){r=toLower(i)}else{if(!r&&e&&!isSrc(e)){r=e}if(isStr(r)){r=toLower(r)}}if(!isStr(r)||r.trim()===""){return null}var o=r.replace(/[a-z]|-|\d/gi,"");if(o!==""){return null}return r};var getSrc=function(r){if(isStr(r)){r=r.trim();if(isSrc(r)){return r}}return null};var isSrc=function(r){return r.length>0&&/(\/|\.)/.test(r)};var isStr=function(r){return typeof r==="string"};var toLower=function(r){return r.toLowerCase()};export{addIcons as a,getName as b,getUrl as g,isStr as i};
\No newline at end of file