local data = {}

local U = require("Module:string/char")

local nuktA = U(0x11173)
local consonants = "𑅕𑅖𑅗𑅘𑅙𑅚𑅛𑅜𑅝𑅞𑅟𑅠𑅡𑅢𑅣𑅤𑅥𑅦𑅧𑅨𑅩𑅪𑅫𑅬𑅭𑅮𑅯𑅰𑅱𑅲"
local consonant = "[" .. consonants .. "]" .. nuktA .. "?"

local acute = U(0x301)		-- combining acute

data["mwr"] = {
	-- Vowels and modifiers. Do the diphthongs and diaereses first.
	{"ai", "𑅑"},
	{"au", "𑅒"},
	{"ä", "𑅐"},
	{"ö", "𑅔"},
	{"ï", "𑅑"},
	{"ü", "𑅒"},
	{"a", "𑅐"},
	{"ā", "𑅐"},
	{"i", "𑅑"},
	{"ī", "𑅑"},
	{"u", "𑅒"},
	{"ū", "𑅒"},
	{"e", "𑅓"},
	{"o", "𑅔"},
	{"(𑅐)[%-/]([𑅑𑅒])", "%1%2"},		-- a-i, a-u for 𑅐𑅑, 𑅐𑅒; must follow rules for "ai", "au"

	-- Two-letter consonants must go before h.
	{"kh", "𑅖"},
	{"gh", "𑅘"},
	{"ch", "𑅚"},
	{"jh", "𑅜"},
	{"ṭh", "𑅟"},
	{"ḍh", "𑅡"},
	{"th", "𑅤"},
	{"dh", "𑅦"},
	{"ph", "𑅩"},
	{"bh", "𑅫"},
	{"h", "𑅱"},

	-- Other stops.
	{"k", "𑅕"},
	{"g", "𑅗"},
	{"c", "𑅙"},
	{"j", "𑅛"},
	{"ṭ", "𑅞"},
	{"ḍ", "𑅠"},
	{"ṛ", "𑅲"},
	{"t", "𑅣"},
	{"d", "𑅥"},
	{"p", "𑅨"},
	{"b", "𑅪"},

	-- Nasals.
	{"ñ", "𑅝"},
	{"ṇ", "𑅢"},
	{"n", "𑅧"},
	{"n", "𑅧"},
	{"m", "𑅬"},

	-- Remaining consonants.
	{"y", "𑅛"},
	{"r", "𑅭"},
	{"l", "𑅮"},
	{"v", "𑅯"},
	{"ś", "𑅰"},
	{"s", "𑅰"},
	{"ṣ", "𑅖"},
	{"ṃ", "𑅧"},

}

-- This must go last, after independent vowels are converted to diacritics, or "aï", "aü" won't work.
table.insert(data["mwr"], {"(" .. consonant .. ")𑅐", "%1"})

-- [[w:Harvard-Kyoto]] to [[w:International Alphabet of Sanskrit Transliteration]]
data["mwr-tr"] = {
	[1] = {
		["A"] = "ā",
		["I"] = "ī",
		["U"] = "ū",
		["J"] = "ñ",
		["T"] = "ṭ",
		["D"] = "ḍ",
		["N"] = "ṇ",
		["z"] = "ś",
		["S"] = "ṣ",
		["M"] = "ṃ",
		["/"] = acute,
	},
	[2] = {
		["R"] = "ṛ",
	},
}

return data