use utf8;
use strict;
use warnings;
use Shiar_Sheet::KeyboardChars 'kbmodes';

my %rows = (
	'' => {
		'=' => '=',
		'>' => '>',
		'<' => '<',
	},
	'=' => {
		'!' => 'ǂ',
		'#' => '‿',
		'+' => '+',
		':' => 'ː',
		'.' => '‖',
		'0' => '∅',
		'?' => 'ʔ',
		B => 'ʙ',
		E => 'ɘ',
		G => 'ɢ',
		H => 'ʜ',
		I => 'ɨ',
		N => 'ɴ',
		O => 'ɵ',
		Q => 'ʡ',
		R => 'ʀ',
		S => 'ᶘ',
		U => 'ʉ',
		Y => 'ʏ',
		Z => 'ᶚ',
		a => 'ɑ',
		b => 'β',
		c => 'ç',
		e => 'ə',
		f => 'ɸ',
		g => 'ɣ',
		h => 'ɥ', # y<
		i => 'ɪ',
		j => 'ɟ',
		l => 'ɬ',
		n => 'ɲ',
		o => 'ɒ',
		p => 'ʘ',
		q => 'ʡ',
		r => 'ɹ',
		s => 'ʃ',
		t => 'θ',
		u => 'ɯ',
		v => 'ʋ',
		w => 'ʍ',
		x => 'χ',
		z => 'ʒ',
		qw( 1  2  3  4  5  6  7  8  9  ), # pitch contours in Graphite apps
	},
	'>' => {
		'!' => 'ǁ',
		'|' => 'ˈ',
		'0' => '◌', # diacritic holder
		A => 'ᴂ',
		E => 'ɶ',
		G => 'ʛ',
		H => 'ɧ',
		I => 'ᵼ',
		L => 'ɺ',
		O => 'ɤ',
		R => 'ʁ',
		U => 'ᵾ',
		a => 'ɐ',
		b => 'ɓ',
		c => 'ƈ',
		d => 'ɗ',
		e => 'ɜ',
		g => 'ɠ',
		h => 'ħ',
		j => 'ʄ',
		k => 'ƙ',
		l => 'ɮ',
		m => 'ɱ',
		n => 'ŋ',
		o => 'ø',
		p => 'ƥ',
		q => 'ʠ',
		r => 'ɾ',
		t => 'ƭ',
		u => 'ʌ',
		w => 'ɰ',
		z => 'ʑ',
	},
	'<' => {
		'!' => 'ǀ',
		':' => 'ˑ',
		'.' => '|',
		'|' => 'ˌ',
		'?' => 'ʕ',
		E => 'œ',
		I => 'ᵻ',
		L => 'ʎ',
		O => 'ɞ',
		Q => 'ʢ',
		R => 'ɻ',
		a => 'æ',
		c => 'ɕ',
		d => 'ɖ',
		e => 'ɛ',
		g => 'ɡ',
		h => 'ɦ',
		j => 'ʝ',
		l => 'ɭ',
		n => 'ɳ',
		o => 'ɔ',
		q => 'ʢ',
		r => 'ɽ',
		s => 'ʂ',
		t => 'ʈ',
		u => 'ʊ',
		v => 'ⱱ',
		w => 'ⱳ',
		y => 'ɥ', # h=
		z => 'ʐ',
	},
	'|' => {
		A => 'ᴀ',
		E => 'ᴇ',
		T => 'ʇ',
		Y => 'ʯ',
		Z => 'ʅ',
		a => 'α',
		d => 'ȡ',
		e => 'ʚ',
		h => 'ђ',
		i => 'ɩ',
		l => 'ȴ',
		n => 'ȵ',
		t => 'ȶ',
		u => 'ɷ',
		y => 'ʮ',
		z => 'ɿ',
		'[' => '˞',
		']' => "\N{COMBINING LEFT ANGLE ABOVE}",
	},
	'^' => {
		# superscripts
		'(' => '⁽',
		')' => '⁾',
		'+' => '⁺',
		'-' => '⁻',
		'=' => '⁼',
		'?' => 'ˀ',
		'!' => 'ꜝ', # african
		'A' => 'ᵄ',
		'B' => 'ᵝ',
		'C' => 'ᶝ',
		'D' => 'ᶞ',
		'E' => 'ᵊ',
		'F' => 'ᶲ',
		'G' => 'ᶢ',
		'H' => 'ʱ',
		'I' => 'ᶦ',
		'J' => 'ᶨ',
		'L' => 'ᶫ',
		'M' => 'ᶬ',
		'N' => 'ᶰ',
		'O' => 'ᵓ',
		'R' => 'ʶ',
		'S' => 'ᶳ',
		'U' => 'ᶷ',
		'V' => 'ᶺ',
		'W' => 'ᵚ',
		'X' => '',
		'Y' => '',
		'Z' => 'ᶽ',
		'a' => 'ᵃ',
		'b' => 'ᵇ',
		'c' => 'ᶜ',
		'd' => 'ᵈ',
		'e' => 'ᵉ',
		'f' => 'ᶠ',
		'g' => 'ᵍ',
		'h' => 'ʰ',
		'i' => 'ⁱ',
		'j' => 'ʲ',
		'k' => 'ᵏ',
		'l' => 'ˡ',
		'm' => 'ᵐ',
		'n' => 'ⁿ',
		'o' => 'ᵒ',
		'p' => 'ᵖ',
		'r' => 'ʳ',
		's' => 'ˢ',
		't' => 'ᵗ',
		'u' => 'ᵘ',
		'v' => 'ᵛ',
		'w' => 'ʷ',
		'x' => 'ˣ',
		'y' => 'ʸ',
		'z' => 'ᶻ',
		'1' => '¹',
		# ..
		'9' => '⁹',
	},
	'#' => {
		# more superscripts
		'?' => 'ˤ',
		'!' => 'ꜞ', # african
		A => 'ᶛ',
		B => '',
		C => '',
		D => '',
		E => 'ᵋ',
		J => 'ᶮ',
		N => 'ᶯ',
		O => '',
		R => 'ʵ',
		Y => 'ᶣ',
		Z => 'ᶾ',
		a => 'ᵅ',
		b => 'ᵆ',
		c => '',
		d => '',
		e => 'ᶟ',
		g => 'ˠ',
		h => '',
		i => 'ᶤ',
		j => 'ᶡ',
		l => 'ᶩ',
		m => 'ᶭ',
		n => 'ᵑ',
		o => 'ᶱ',
		r => 'ʴ',
		s => 'ᶴ',
		t => 'ᶿ',
		u => 'ᶶ',
		v => 'ᶹ',
		y => '',
		z => 'ᶼ',
	},
	'&' => {
		# retroflex
		a => 'ᶏ',
		A => 'ᶐ',
		b => 'ᶔ',
		B => 'ᶕ',
		d => 'ᶑ',
		e => 'ᶒ',
		E => 'ᶓ',
		i => 'ᶖ',
		o => 'ᶗ',
		s => 'ᶘ',
		u => 'ᶙ',
		z => 'ᶚ',

		# dicritics & supersegmentals
		'|' => 'syllabic',
		'*' => "\N{COMBINING INVERTED BREVE BELOW}",
		'~' => "\N{COMBINING TILDE BELOW}",
		'%' => "\N{COMBINING RING BELOW}",
		'5' => "\N{COMBINING CARON BELOW}",
		'"' => "\N{COMBINING DIAERESIS BELOW}",
		# ..
	},
	'@' => {
		# palatal
		'!' => 'ꜟ', # african
		b => 'ᶀ',
		d => 'ᶁ',
		f => 'ᶂ',
		g => 'ᶃ',
		k => 'ᶄ',
		l => 'ᶅ',
		m => 'ᶆ',
		n => 'ᶇ',
		p => 'ᶈ',
		r => 'ᶉ',
		s => 'ᶊ',
		S => 'ᶋ',
		v => 'ᶌ',
		x => 'ᶍ',
		z => 'ᶎ',
	},
	'~' => {
		# velarized (or pharyngealized)
		b => 'ᵬ',
		d => 'ᵭ',
		f => 'ᵮ',
		l => 'ɫ',
		m => 'ᵯ',
		n => 'ᵰ',
		p => 'ᵱ',
		r => 'ᵲ',
		R => 'ᵳ',
		s => 'ᵴ',
		t => 'ᵵ',
		z => 'ᵶ',
	},
);

+{
	%{ kbmodes(\%rows) },
	version => '1.0',
	title => 'IPA SIL',
	intro => join("\n",
		'<a href="https://keyman.com/keyboards/sil_ipa" target=_blank>Keyman</a>',
	),
	description => [
	],
}
