-- Official Unicode script values for individual codepoints and ranges of
-- codepoints.

-- https://www.unicode.org/Public/UNIDATA/Scripts.txt provided
-- the script names, and https://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt
-- provided script codes corresponding to the names (see Script (Unicode)).
--]=]

local data = {
	singles = {
		[0x000AA] = "Latn",
		[0x000BA] = "Latn",
		[0x000D7] = "Zyyy",
		[0x000F7] = "Zyyy",
		[0x00374] = "Zyyy",
		[0x0037E] = "Zyyy",
		[0x0037F] = "Grek",
		[0x00384] = "Grek",
		[0x00385] = "Zyyy",
		[0x00386] = "Grek",
		[0x00387] = "Zyyy",
		[0x0038C] = "Grek",
		[0x00605] = "Zyyy",
		[0x0060C] = "Zyyy",
		[0x0061B] = "Zyyy",
		[0x0061C] = "Arab",
		[0x0061E] = "Arab",
		[0x0061F] = "Zyyy",
		[0x00640] = "Zyyy",
		[0x00670] = "Zinh",
		[0x006DD] = "Zyyy",
		[0x0085E] = "Mand",
		[0x008E2] = "Zyyy",
		[0x009B2] = "Beng",
		[0x009D7] = "Beng",
		[0x00A3C] = "Guru",
		[0x00A51] = "Guru",
		[0x00A5E] = "Guru",
		[0x00AD0] = "Gujr",
		[0x00B9C] = "Taml",
		[0x00BD0] = "Taml",
		[0x00BD7] = "Taml",
		[0x00CDE] = "Knda",
		[0x00DBD] = "Sinh",
		[0x00DCA] = "Sinh",
		[0x00DD6] = "Sinh",
		[0x00E3F] = "Zyyy",
		[0x00E84] = "Laoo",
		[0x00EA5] = "Laoo",
		[0x00EC6] = "Laoo",
		[0x010C7] = "Geor",
		[0x010CD] = "Geor",
		[0x010FB] = "Zyyy",
		[0x01258] = "Ethi",
		[0x012C0] = "Ethi",
		[0x01804] = "Mong",
		[0x01805] = "Zyyy",
		[0x01940] = "Limb",
		[0x01CD3] = "Zyyy",
		[0x01CE1] = "Zyyy",
		[0x01CED] = "Zinh",
		[0x01CF4] = "Zinh",
		[0x01CFA] = "Zyyy",
		[0x01D2B] = "Cyrl",
		[0x01D78] = "Cyrl",
		[0x01DBF] = "Grek",
		[0x01F59] = "Grek",
		[0x01F5B] = "Grek",
		[0x01F5D] = "Grek",
		[0x02071] = "Latn",
		[0x0207F] = "Latn",
		[0x02126] = "Grek",
		[0x02132] = "Latn",
		[0x0214E] = "Latn",
		[0x02D27] = "Geor",
		[0x02D2D] = "Geor",
		[0x02D7F] = "Tfng",
		[0x03005] = "Hani",
		[0x03006] = "Zyyy",
		[0x03007] = "Hani",
		[0x030A0] = "Zyyy",
		[0x032FF] = "Zyyy",
		[0x0A92E] = "Zyyy",
		[0x0A92F] = "Kali",
		[0x0A95F] = "Rjng",
		[0x0A9CF] = "Zyyy",
		[0x0AB5B] = "Zyyy",
		[0x0AB65] = "Grek",
		[0x0FB3E] = "Hebr",
		[0x0FEFF] = "Zyyy",
		[0x0FF70] = "Zyyy",
		[0x101A0] = "Grek",
		[0x101FD] = "Zinh",
		[0x102E0] = "Zinh",
		[0x1039F] = "Ugar",
		[0x1056F] = "Aghb",
		[0x10808] = "Cprt",
		[0x1083C] = "Cprt",
		[0x1083F] = "Cprt",
		[0x1091F] = "Phnx",
		[0x1093F] = "Lydi",
		[0x1107F] = "Brah",
		[0x110CD] = "Kthi",
		[0x11288] = "Mult",
		[0x1133B] = "Zinh",
		[0x11350] = "Gran",
		[0x11357] = "Gran",
		[0x118FF] = "Wara",
		[0x11909] = "Diak",
		[0x11D3A] = "Gonm",
		[0x11FB0] = "Lisu",
		[0x11FFF] = "Taml",
		[0x16FE0] = "Tang",
		[0x16FE1] = "Nshu",
		[0x16FE4] = "Kits",
		[0x1B000] = "Kana",
		[0x1D4A2] = "Zyyy",
		[0x1D4BB] = "Zyyy",
		[0x1D546] = "Zyyy",
		[0x1E2FF] = "Wcho",
		[0x1EE24] = "Arab",
		[0x1EE27] = "Arab",
		[0x1EE39] = "Arab",
		[0x1EE3B] = "Arab",
		[0x1EE42] = "Arab",
		[0x1EE47] = "Arab",
		[0x1EE49] = "Arab",
		[0x1EE4B] = "Arab",
		[0x1EE54] = "Arab",
		[0x1EE57] = "Arab",
		[0x1EE59] = "Arab",
		[0x1EE5B] = "Arab",
		[0x1EE5D] = "Arab",
		[0x1EE5F] = "Arab",
		[0x1EE64] = "Arab",
		[0x1EE7E] = "Arab",
		[0x1F200] = "Hira",
		[0xE0001] = "Zyyy",
	
	ranges = {
	-- Scripts.txt gives full names; here we consider them aliases to save space.
	aliases = {
		Adlm = "Adlam",
		Aghb = "Caucasian Albanian",
		Ahom = "Ahom",
		Arab = "Arabic",
		Armi = "Imperial Aramaic",
		Armn = "Armenian",
		Avst = "Avestan",
		Bali = "Balinese",
		Bamu = "Bamum",
		Bass = "Bassa Vah",
		Batk = "Batak",
		Beng = "Bengali",
		Bhks = "Bhaiksuki",
		Bopo = "Bopomofo",
		Brah = "Brahmi",
		Brai = "Braille",
		Bugi = "Buginese",
		Buhd = "Buhid",
		Cakm = "Chakma",
		Cans = "Canadian Aboriginal",
		Cari = "Carian",
		Cham = "Cham",
		Cher = "Cherokee",
		Chrs = "Chorasmian",
		Copt = "Coptic",
		Cprt = "Cypriot",
		Cyrl = "Cyrillic",
		Deva = "Devanagari",
		Diak = "Dives Akuru",
		Dogr = "Dogra",
		Dsrt = "Deseret",
		Dupl = "Duployan",
		Egyp = "Egyptian Hieroglyphs",
		Elba = "Elbasan",
		Elym = "Elymaic",
		Ethi = "Ethiopic",
		Geor = "Georgian",
		Glag = "Glagolitic",
		Gong = "Gunjala Gondi",
		Gonm = "Masaram Gondi",
		Goth = "Gothic",
		Gran = "Grantha",
		Grek = "Greek",
		Gujr = "Gujarati",
		Guru = "Gurmukhi",
		Hang = "Hangul",
		Hani = "Han",
		Hano = "Hanunoo",
		Hatr = "Hatran",
		Hebr = "Hebrew",
		Hira = "Hiragana",
		Hluw = "Anatolian Hieroglyphs",
		Hmng = "Pahawh Hmong",
		Hmnp = "Nyiakeng Puachue Hmong",
		Hrkt = "Katakana Or Hiragana",
		Hung = "Old Hungarian",
		Ital = "Old Italic",
		Java = "Javanese",
		Kali = "Kayah Li",
		Kana = "Katakana",
		Khar = "Kharoshthi",
		Khmr = "Khmer",
		Khoj = "Khojki",
		Kits = "Khitan Small Script",
		Knda = "Kannada",
		Kthi = "Kaithi",
		Lana = "Tai Tham",
		Laoo = "Lao",
		Latn = "Latin",
		Lepc = "Lepcha",
		Limb = "Limbu",
		Lina = "Linear A",
		Linb = "Linear B",
		Lisu = "Lisu",
		Lyci = "Lycian",
		Lydi = "Lydian",
		Mahj = "Mahajani",
		Maka = "Makasar",
		Mand = "Mandaic",
		Mani = "Manichaean",
		Marc = "Marchen",
		Medf = "Medefaidrin",
		Mend = "Mende Kikakui",
		Merc = "Meroitic Cursive",
		Mero = "Meroitic Hieroglyphs",
		Mlym = "Malayalam",
		Modi = "Modi",
		Mong = "Mongolian",
		Mroo = "Mro",
		Mtei = "Meetei Mayek",
		Mult = "Multani",
		Mymr = "Myanmar",
		Nand = "Nandinagari",
		Narb = "Old North Arabian",
		Nbat = "Nabataean",
		Newa = "Newa",
		Nkoo = "Nko",
		Nshu = "Nushu",
		Ogam = "Ogham",
		Olck = "Ol Chiki",
		Orkh = "Old Turkic",
		Orya = "Oriya",
		Osge = "Osage",
		Osma = "Osmanya",
		Palm = "Palmyrene",
		Pauc = "Pau Cin Hau",
		Perm = "Old Permic",
		Phag = "Phags Pa",
		Phli = "Inscriptional Pahlavi",
		Phlp = "Psalter Pahlavi",
		Phnx = "Phoenician",
		Plrd = "Miao",
		Prti = "Inscriptional Parthian",
		Rjng = "Rejang",
		Rohg = "Hanifi Rohingya",
		Runr = "Runic",
		Samr = "Samaritan",
		Sarb = "Old South Arabian",
		Saur = "Saurashtra",
		Sgnw = "SignWriting",
		Shaw = "Shavian",
		Shrd = "Sharada",
		Sidd = "Siddham",
		Sind = "Khudawadi",
		Sinh = "Sinhala",
		Sogd = "Sogdian",
		Sogo = "Old Sogdian",
		Sora = "Sora Sompeng",
		Soyo = "Soyombo",
		Sund = "Sundanese",
		Sylo = "Syloti Nagri",
		Syrc = "Syriac",
		Tagb = "Tagbanwa",
		Takr = "Takri",
		Tale = "Tai Le",
		Talu = "New Tai Lue",
		Taml = "Tamil",
		Tang = "Tangut",
		Tavt = "Tai Viet",
		Telu = "Telugu",
		Tfng = "Tifinagh",
		Tglg = "Tagalog",
		Thaa = "Thaana",
		Thai = "Thai",
		Tibt = "Tibetan",
		Tirh = "Tirhuta",
		Ugar = "Ugaritic",
		Vaii = "Vai",
		Wara = "Warang Citi",
		Wcho = "Wancho",
		Xpeo = "Old Persian",
		Xsux = "Cuneiform",
		Yezi = "Yezidi",
		Yiii = "Yi",
		Zanb = "Zanabazar Square",
		Zinh = "Inherited",
		Zyyy = "Common",
		Zzzz = "Unknown",

-- Required for binary search function in Module:Language/scripts.
-- Cannot get length of module loaded with mw.loadData.
data.ranges.length = #data.ranges

data.rtl = {}

for _, script in ipairs(mw.loadData "Module:Lang/data".rtl_scripts) do
	-- Module:Lang/data has script codes in lowercase;
	-- this module has script codes with the first letter capitalized.
	data.rtl[script:gsub] = true
end