/* stylelint-disable value-list-max-empty-lines */
@use 'sass:map';

/**
 * Retrieves the Unicode escape sequence of a given symbol by its human-friendly name.
 *
 * @see https://www.w3schools.com/cssref/css_entities.asp
 *
 * @param    {string}     $char    Human-friendly symbol name.
 *
 * @return   {?string}    The Unicode escape sequence of a given symbol.
 */
@function get-char($char) {
	/* stylelint-disable-next-line @stylistic/value-list-max-empty-lines */
	$symbols: (
		'dollar':               '\0024', // $
		'section':              '\00A7', // §
		'bullet':               '\2022', // •

		'hyphen':               '\2011', // ‑
		'en-dash':              '\2013', // –
		'em-dash':              '\2014', // —

		'copyright':            '\00A9', // ©
		'registered':           '\00AE', // ®

		'degree':               '\00B0', // °
		'ring':                 '\2218', // ∘
		'infinity':             '\221E', // ∞

		'triangle-up-black':    '\25B2', // ▲
		'triangle-up-white':    '\25B2', // △
		'triangle-right-black': '\25B6', // ▶
		'triangle-right-white': '\25B7', // ▷
		'triangle-down-black':  '\25BC', // ▼
		'triangle-down-white':  '\25BD', // ▽
		'triangle-left-black':  '\25C0', // ◀
		'triangle-left-white':  '\25C1', // ◁

		'circle-black':         '\25CF', // ●
		'circle-white':         '\25CB', // ○

		'square-black':         '\25A0', // ■
		'square-white':         '\25A1', // □

		'diamond-black':        '\25C6', // ◆
		'diamond-white':        '\25C7', // ◇
		'diamond-inside':       '\25C8', // ◈

		'check':                '\2713', // ✓
		'check-heavy':          '\2714', // ✔

		'cross':                '\2713', // ✕
		'cross-heavy':          '\2714', // ✖

		'fisheye':              '\25C9', // ◉
	);

	@if (not map.has-key($symbols, '#{$char}')) {
		@return null;
	}

	@return map.get($symbols, '#{$char}');
}
