use utf8;
use strict;
use warnings;
our %rows = (
	'A' => "\N{MACRON}",
	'a' => "\N{COMBINING MACRON}",
	'B' => "\N{BREVE}",
	'b' => "\N{COMBINING BREVE}",
	'C' => "\N{CEDILLA}",
	'c' => "\N{COMBINING CEDILLA}",
	'D' => 'Ð',
	'd' => 'ð',
	'E' => "\N{ACUTE ACCENT}",
	'e' => "\N{COMBINING ACUTE ACCENT}",
	'f' => 'ƒ',
	'F' => "\N{COMBINING TILDE BELOW}",
	'G' => "\N{COMBINING CIRCUMFLEX ACCENT BELOW}",
	'g' => '©',
	'H' => "\N{MODIFIER LETTER LOW MACRON}",
	'h' => "\N{COMBINING MACRON BELOW}",
	'I' => "\N{MODIFIER LETTER APOSTROPHE}",
	'i' => "\N{COMBINING COMMA ABOVE}",
	'J' => "\N{DOUBLE ACUTE ACCENT}",
	'j' => "\N{COMBINING DOUBLE ACUTE ACCENT}",
	'K' => '°',
	'k' => "\N{COMBINING RING ABOVE}",
	'L' => '-',
	'l' => "\N{COMBINING SHORT STROKE OVERLAY}", #XXX
	'M' => "\N{OGONEK}",
	'm' => "\N{COMBINING OGONEK}",
	'N' => "\N{SMALL TILDE}",
	'n' => "\N{COMBINING TILDE}",
	'O' => 'Ø',
	'o' => 'ø',
	'P' => "\N{SINGLE LOW-9 QUOTATION MARK}", #XXX
	'p' => "\N{COMBINING COMMA BELOW}",
	'Q' => 'Œ',
	'q' => 'œ',
	'R' => '‰',
	'r' => '®',
	'S' => "\N{COMBINING INVERTED BREVE}",
	's' => 'ß',
	'T' => 'Þ',
	't' => 'þ',
	'U' => "\N{DIAERESIS}",
	'u' => "\N{COMBINING DIAERESIS}",
	'V' => "\N{CARON}",
	'v' => "\N{COMBINING CARON}",
	'W' => "\N{DOT ABOVE}",
	'w' => "\N{COMBINING DOT ABOVE}",
	'X' => "\N{MODIFIER LETTER LOW RING}", #XXX
	'x' => "\N{COMBINING DOT BELOW}",
	'Y' => "\N{COMBINING DOUBLE GRAVE ACCENT}",
	'y' => '¥',
	'Z' => "\N{MODIFIER LETTER GLOTTAL STOP}",
	'z' => "\N{COMBINING HOOK ABOVE}",
	'[' => "\N{LEFT DOUBLE QUOTATION MARK}",
	'{' => "\N{RIGHT DOUBLE QUOTATION MARK}",
	']' => "\N{LEFT SINGLE QUOTATION MARK}",
	'}' => "\N{RIGHT SINGLE QUOTATION MARK}",
	';' => '…',
	':' => '№',
	'"' => 'Æ',
	"'" => 'æ',
	'|' => '»',
	'\\'=> '«',
	'<' => "\N{DOUBLE LOW-9 QUOTATION MARK}",
	',' => '≤',
	'>' => 'ʔ',
	'.' => '≥',
	'/' => '÷',
	'?' => '¿',
	'~' => "\N{GRAVE ACCENT}",
	'`' => "\N{COMBINING GRAVE ACCENT}",
	'1' => '¡',
	'!' => '⁄',
	'2' => '™',
	'@' => '€',
	'3' => '£',
	'#' => '‹',
	'4' => '¢',
	'$' => '›',
	'5' => '§',
	'%' => '†',
	'6' => "\N{COMBINING CIRCUMFLEX ACCENT}",
	'^' => "\N{MODIFIER LETTER CIRCUMFLEX ACCENT}", #XXX
	'7' => '¶',
	'&' => '‡',
	'8' => '•',
	'*' => '°',
	'9' => 'ª',
	'(' => '·',
	'0' => 'º',
	')' => '‚',
	'-' => '–',
	'_' => '—',
	'+' => '±',
	'=' => '≠',

	'::' => ' ',
	':@' => 'Ƨ',
	':2' => 'ƨ',
	':#' => 'Ɛ',
	':3' => 'ɛ',
	':%' => 'Ƽ',
	':5' => 'ƽ',
	':^' => 'Ƅ',
	':6' => 'ƅ', #XXX
	':7' => '⁊',
	':*' => 'Ȣ',
	':8' => 'ȣ',
	':Q' => 'Ƣ',
	':q' => 'ƣ',
	':W' => 'Ƿ',
	':w' => 'ƿ',
	':E' => 'Ǝ',
	':e' => 'ǝ', #XXX ə
	':R' => 'Ʀ',
	':r' => 'ʀ', #XXX
	':k' => 'ĸ',
	':Y' => 'Ɜ',
	':y' => 'ɜ',
	':U' => 'Ʊ',
	':u' => 'ʊ',
	':A' => 'Ə',
	':a' => 'ə',
	':s' => 'ſ',
	':G' => 'Ɣ',
	':g' => 'ɣ',
	':H' => 'Ƕ',
	':h' => 'ƕ',
	':J' => 'Ƞ',
	':j' => 'ƞ', #XXX ɳ
	':K' => 'Ǩ',
	':Z' => 'Ʒ',
	':z' => 'ʒ',
	':C' => 'Ɔ',
	':c' => 'ɔ',
	':v' => 'ʌ',
	':N' => 'Ŋ', #XXX
	':n' => 'ŋ',
	':M' => 'Ɯ',
	':m' => 'ɯ',
	':"' => '″', #XXX ʺ
	":'" => '′', #XXX ʹ

	'>>' => ' ',
	'>q' => 'ʠ',
	'>R' => 'Ʈ', #XXX mirrored?
	'>r' => 'ʈ',
	'>T' => 'Ƭ',
	'>t' => 'ƭ',
	'>Y' => 'Ƴ',
	'>y' => 'ƴ',
	'>U' => 'Ʋ',
	'>u' => 'ʋ',
	'>I' => 'Ɩ',
	'>i' => 'ɩ',
	'>P' => 'Ƥ',
	'>p' => 'ƥ',
	'>S' => 'Ʃ',
	'>s' => 'ʃ',
	'>D' => 'Ɗ',
	'>d' => 'ɗ',
	'>F' => 'Ƒ',
	'>f' => 'ƒ',
	'>G' => 'Ɠ',
	'>g' => 'ɠ',
	'>h' => 'ɦ',
	'>K' => 'Ƙ',
	'>k' => 'ƙ',
	'>Z' => 'Ȥ',
	'>z' => 'ȥ',
	'>X' => 'Ɖ',
	'>x' => 'ɖ',
	'>C' => 'Ƈ',
	'>c' => 'ƈ',
	'>N' => 'Ɲ',
	'>n' => 'ɲ',
	'>B' => 'Ɓ',
	'>b' => 'ɓ',
);

my $groups = do 'keyboard/altgr/groups.inc.pl';
$groups->{mode} = {
	''  => 'option-shifted ⌥',
	':' => '№ number prefix ⌥:',
	'>' => 'ʔ hook prefix ⌥>',
};
for my $m (qw' : > ') {
	$groups->{def}->{''}->{$m} = "g1 mode$m";
	$groups->{mode}->{$m} //= "mode $m";
	$groups->{def}->{$m} = {
		(map {s/^.//r => 'g0'} grep {/^\Q$m/} keys %rows),
		$m => 'g1 mode',
	};
}
$groups->{flag}->{g1} = ['mode' => "switch to an alternate set of keys"];

+{
	%{$groups},
	version => '1.0',
	title => 'ABC option',
	intro => join("\n",
		'Resulting <a href="/unicode">selection</a> of <a href="/charset">Unicode</a> characters',
		"while pressing ⌥ Option (Alt) with Apple's ABC Extended",
		"(formerly US Extended and Extended Roman) layout",
		'on <abbr title="at least in Ventura 13.2">macOS</abbr>.',
		'Significant changes from standard',
		'<a href="/keyboard/altgr/macos">US</a> or local options.',
	),
	description => [
		"Apple ABC Extended keyboard layout table",
		"with the Option modifier key.",
	],
	image => 'keyboard/altgr/macoption.jpg',
}
