UNPKG

ionicons

Version:

Premium icons for Ionic.

1 lines 1.62 kB
import{g as n}from"./p-e298ede3.js";let t;const e=()=>{if("undefined"==typeof window)return new Map;if(!t){const n=window;n.Ionicons=n.Ionicons||{},t=n.Ionicons.map=n.Ionicons.map||new Map}return t},o=n=>{Object.keys(n).forEach((t=>{i(t,n[t]);const e=t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g,"$1-$2").toLowerCase();t!==e&&i(e,n[t])}))},i=(n,t)=>{const o=e(),i=o.get(n);void 0===i?o.set(n,t):i!==t&&console.warn(`[Ionicons Warning]: Multiple icons were mapped to name "${n}". Ensure that multiple icons are not mapped to the same icon name.`)},r=n=>{let t=c(n.src);if(t)return t;if(t=a(n.name,n.icon,n.mode,n.ios,n.md),t)return s(t,n);if(n.icon){if(t=c(n.icon),t)return t;if(t=c(n.icon[n.mode]),t)return t}return null},s=(t,o)=>{const i=e().get(t);if(i)return i;try{return n(`svg/${t}.svg`)}catch(n){console.warn(`[Ionicons Warning]: Could not load icon with name "${t}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`,o)}},a=(n,t,e,o,i)=>(e="ios"===(e&&l(e))?"ios":"md",o&&"ios"===e?n=l(o):i&&"md"===e?n=l(i):(n||!t||u(t)||(n=t),d(n)&&(n=l(n))),d(n)&&""!==n.trim()?""!==n.replace(/[a-z]|-|\d/gi,"")?null:n:null),c=n=>d(n)&&(n=n.trim(),u(n))?n:null,u=n=>n.length>0&&/(\/|\.)/.test(n),d=n=>"string"==typeof n,l=n=>n.toLowerCase(),m=(n,t=[])=>{const e={};return t.forEach((t=>{n.hasAttribute(t)&&(null!==n.getAttribute(t)&&(e[t]=n.getAttribute(t)),n.removeAttribute(t))})),e},p=n=>n&&""!==n.dir?"rtl"===n.dir.toLowerCase():"rtl"===(null===document||void 0===document?void 0:document.dir.toLowerCase());export{o as a,m as b,a as c,p as d,r as g,d as i}