-- lx-bundle:true

-- This file is part of Lx, created by Liqube <www.liqube.com>
-- Copyright Liqube Audio. All rights reserved.
-- Lx Interim License. See LICENSE for details.

--- TeX command to Unicode symbol definitions
-- @module plugins.mdpreview.math.symbols

--[[
Keep these out of SYMBOLS, because they require parser or layout behavior rather than a glyph replacement:

\frac \dfrac \tfrac \binom \sqrt
\left \middle \right
\begin \end
\text \operatorname
\overset \underset \stackrel
\limits \nolimits
\not
\hat \bar \vec \dot \ddot \overline \underline
\mathbf \mathrm \mathit \mathbb \mathcal

For correct TeX spacing, the eventual representation should also retain an atom class
such as ord, bin, rel, op, open, close, or punct.
Only mapping to Unicode loses that information.
]]

local SYMBOLS = {
	-- Greek letters
	alpha = "α",		Alpha = "Α",
	beta = "β",		Beta = "Β",
	gamma = "γ",	Gamma = "Γ",	varGamma = "Γ",
	delta = "δ",	Delta = "Δ",	varDelta = "Δ",
	epsilon = "ε",	varepsilon = "ϵ",	Epsilon = "Ε",
	zeta = "ζ",		Zeta = "Ζ",
	eta = "η",		Eta = "Η",
	theta = "θ",	Theta = "Θ",	varTheta = "ϴ",
	vartheta = "ϑ",	thetasym = "ϑ",
	iota = "ι",		Iota = "Ι",
	kappa = "κ",	varkappa = "ϰ",	Kappa = "Κ",
	lambda = "λ",	Lambda = "Λ",	varLambda = "Λ",
	mu = "μ",		Mu = "Μ",
	nu = "ν",		Nu = "Ν",
	xi = "ξ",		Xi = "Ξ",		varXi = "Ξ",
	omicron = "ο",	Omicron = "Ο",
	pi = "π",		Pi = "Π",		varPi = "Π",
	varpi = "ϖ",
	rho = "ρ",		varrho = "ϱ",	Rho = "Ρ",
	sigma = "σ",	Sigma = "Σ",	varSigma = "Σ",
	varsigma = "ς",
	tau = "τ",		Tau = "Τ",
	upsilon = "υ",	Upsilon = "Υ",	varUpsilon = "Υ",
	phi = "φ",		Phi = "Φ",		varPhi = "Φ",
	varphi = "ϕ",
	chi = "χ",		Chi = "Χ",
	psi = "ψ",		Psi = "Ψ",		varPsi = "Ψ",
	omega = "ω",	Omega = "Ω",	varOmega = "Ω",
	digamma = "ϝ",	Digamma = "Ϝ",

	-- Letter-like symbols
	aleph = "ℵ",
	beth = "ℶ",
	gimel = "ℷ",
	daleth = "ℸ",
	ell = "ℓ",
	hbar = "ℏ",
	hslash = "ℏ",
	imath = "ı",
	jmath = "ȷ",
	wp = "℘",
	Re = "ℜ",
	Im = "ℑ",
	Reals = "ℝ",
	image = "ℑ",
	weierp = "℘",
	alef = "ℵ",
	alefsym = "ℵ",
	N = "ℕ",
	natnums = "ℕ",
	Z = "ℤ",
	cnums = "ℂ",
	Complex = "ℂ",
	R = "ℝ",
	reals = "ℝ",
	real = "ℜ",
	mho = "℧",
	eth = "ð",
	Finv = "Ⅎ",
	Game = "⅁",
	Bbbk = "𝕜",

	-- Constants and general symbols
	infty = "∞",
	-- Alternate infinity spelling uses same glyph
	infin = "∞",
	partial = "∂",
	nabla = "∇",
	emptyset = "∅",
	empty = "∅",
	varnothing = "∅",
	complement = "∁",
	top = "⊤",
	bot = "⊥",
	perp = "⟂",
	angle = "∠",
	measuredangle = "∡",
	sphericalangle = "∢",
	prime = "′",
	backprime = "‵",
	degree = "°",

	-- Quantifiers and logic
	forall = "∀",
	exists = "∃",
	exist = "∃",
	nexists = "∄",
	neg = "¬",
	lnot = "¬",
	land = "∧",
	wedge = "∧",
	And = "&",
	lor = "∨",
	vee = "∨",
	therefore = "∴",
	because = "∵",

	-- Binary operators
	plusmn = "±",
	pm = "±",
	mp = "∓",
	times = "×",
	div = "÷",
	cdot = "·",
	cdotp = "·",
	centerdot = "·",
	ldotp = ".",
	dotplus = "∔",
	ast = "∗",
	star = "⋆",
	circ = "∘",
	bullet = "∙",
	diamond = "⋄",
	bigcirc = "○",
	setminus = "∖",
	wr = "≀",
	amalg = "⨿",

	cap = "∩",
	cup = "∪",
	uplus = "⊎",
	sqcap = "⊓",
	sqcup = "⊔",
	Cap = "⋒",
	Cup = "⋓",
	doublecap = "⋒",
	doublecup = "⋓",

	oplus = "⊕",
	ominus = "⊖",
	otimes = "⊗",
	oslash = "⊘",
	odot = "⊙",

	boxplus = "⊞",
	boxminus = "⊟",
	boxtimes = "⊠",
	boxdot = "⊡",

	circledast = "⊛",
	circledcirc = "⊚",
	circleddash = "⊝",

	divideontimes = "⋇",
	ltimes = "⋉",
	rtimes = "⋊",
	leftthreetimes = "⋋",
	rightthreetimes = "⋌",

	curlywedge = "⋏",
	curlyvee = "⋎",
	barwedge = "⊼",
	veebar = "⊻",
	doublebarwedge = "⩞",
	intercal = "⊺",

	triangleleft = "◁",
	triangleright = "▷",
	vartriangleleft = "⊲",
	vartriangleright = "⊳",
	lhd = "⊲",
	rhd = "⊳",
	unlhd = "⊴",
	unrhd = "⊵",

	-- Large operators
	sum = "∑",
	prod = "∏",
	coprod = "∐",

	bigcap = "⋂",
	bigcup = "⋃",
	bigwedge = "⋀",
	bigvee = "⋁",
	biguplus = "⨄",
	bigsqcup = "⨆",
	bigodot = "⨀",
	bigoplus = "⨁",
	bigotimes = "⨂",

	int = "∫",
	intop = "∫",
	smallint = "∫",
	iint = "∬",
	iiint = "∭",
	iiiint = "⨌",
	oint = "∮",
	oiint = "∯",
	oiiint = "∰",
	intclockwise = "∱",
	varointclockwise = "∲",
	ointctrclockwise = "∳",
	fint = "⨏",

	-- Equality and approximation
	ne = "≠",
	neq = "≠",
	equiv = "≡",
	sim = "∼",
	nsim = "≁",
	simeq = "≃",
	approx = "≈",
	approxeq = "≊",
	asymp = "≍",
	cong = "≅",
	ncong = "≇",
	propto = "∝",
	varpropto = "∝",

	doteq = "≐",
	Doteq = "≑",
	doteqdot = "≑",
	fallingdotseq = "≒",
	risingdotseq = "≓",
	eqcirc = "≖",
	circeq = "≗",
	triangleq = "≜",
	questeq = "≟",
	bumpeq = "≏",
	Bumpeq = "≎",
	backsim = "∽",
	backsimeq = "⋍",
	thicksim = "∼",
	thickapprox = "≈",

	coloneq = ":−",
	coloneqq = "≔",
	eqcolon = "∹",
	eqqcolon = "≕",
	-- KaTeX relation aliases use same visible glyphs as their base commands
	vcentcolon = ":",
	ratio = ":",
	dblcolon = "∷",
	coloncolon = "∷",
	colonequals = "≔",
	Coloneqq = "∷=",
	coloncolonequals = "∷=",
	colonminus = ":−",
	Coloneq = "∷−",
	coloncolonminus = "∷−",
	colonapprox = ":≈",
	Colonapprox = "∷≈",
	coloncolonapprox = "∷≈",
	colonsim = ":∼",
	Colonsim = "∷∼",
	coloncolonsim = "∷∼",
	simcolon = "∼:",
	simcoloncolon = "∼∷",
	minuscolon = "∹",
	Eqcolon = "−∷",
	minuscoloncolon = "−∷",
	equalscolon = "≕",
	Eqqcolon = "=∷",
	equalscoloncolon = "=∷",
	approxcolon = "≈:",
	approxcoloncolon = "≈∷",
	eqsim = "≂",

	-- Ordering relations
	lt = "<",
	gt = ">",
	le = "≤",
	leq = "≤",
	ge = "≥",
	geq = "≥",

	leqq = "≦",
	geqq = "≧",
	leqslant = "⩽",
	geqslant = "⩾",

	nless = "≮",
	ngtr = "≯",
	nle = "≰",
	nleq = "≰",
	nge = "≱",
	ngeq = "≱",
	nleqq = "≰",
	nleqslant = "≰",
	ngeqq = "≱",
	ngeqslant = "≱",
	lvertneqq = "≨",
	gvertneqq = "≩",

	ll = "≪",
	gg = "≫",
	lll = "⋘",
	ggg = "⋙",
	llless = "⋘",
	gggtr = "⋙",

	lesssim = "≲",
	gtrsim = "≳",
	lessapprox = "⪅",
	gtrapprox = "⪆",
	lessdot = "⋖",
	gtrdot = "⋗",

	lessgtr = "≶",
	gtrless = "≷",
	lesseqgtr = "⋚",
	gtreqless = "⋛",
	lesseqqgtr = "⪋",
	gtreqqless = "⪌",
	eqslantless = "⪕",
	eqslantgtr = "⪖",

	lneq = "⪇",
	gneq = "⪈",
	lneqq = "≨",
	gneqq = "≩",
	lnsim = "⋦",
	gnsim = "⋧",
	lnapprox = "⪉",
	gnapprox = "⪊",

	-- Precedence relations
	prec = "≺",
	succ = "≻",
	preceq = "⪯",
	succeq = "⪰",
	preccurlyeq = "≼",
	succcurlyeq = "≽",
	curlyeqprec = "⋞",
	curlyeqsucc = "⋟",
	precsim = "≾",
	succsim = "≿",
	precapprox = "⪷",
	succapprox = "⪸",

	nprec = "⊀",
	nsucc = "⊁",
	npreceq = "⋠",
	nsucceq = "⋡",
	precneqq = "⪵",
	succneqq = "⪶",
	precnsim = "⋨",
	succnsim = "⋩",
	precnapprox = "⪹",
	succnapprox = "⪺",

	-- Sets and membership
	["in"] = "∈",
	isin = "∈",
	notin = "∉",
	ni = "∋",
	owns = "∋",
	notni = "∌",
	smallin = "∊",
	smallni = "∍",
	backepsilon = "∍",

	subset = "⊂",
	sub = "⊂",
	supset = "⊃",
	subseteq = "⊆",
	sube = "⊆",
	supseteq = "⊇",
	supe = "⊇",
	Supset = "⋑",
	nsubset = "⊄",
	nsupset = "⊅",
	nsubseteq = "⊈",
	nsupseteq = "⊉",
	nsubseteqq = "⊈",
	nsupseteqq = "⊉",

	subsetneq = "⊊",
	supsetneq = "⊋",
	subseteqq = "⫅",
	supseteqq = "⫆",
	subsetneqq = "⫋",
	supsetneqq = "⫌",
	varsubsetneq = "⊊",
	varsupsetneq = "⊋",
	varsubsetneqq = "⫋",
	varsupsetneqq = "⫌",

	sqsubset = "⊏",
	sqsupset = "⊐",
	sqsubseteq = "⊑",
	sqsupseteq = "⊒",
	Subset = "⋐",

	-- Other relations
	mid = "∣",
	nmid = "∤",
	shortmid = "∣",
	nshortmid = "∤",

	parallel = "∥",
	nparallel = "∦",
	shortparallel = "∥",
	nshortparallel = "∦",

	smile = "⌣",
	frown = "⌢",
	smallsmile = "⌣",
	smallfrown = "⌢",
	bowtie = "⋈",
	Join = "⋈",
	pitchfork = "⋔",
	between = "≬",
	origof = "⊶",
	imageof = "⊷",

	trianglelefteq = "⊴",
	trianglerighteq = "⊵",
	ntriangleleft = "⋪",
	ntriangleright = "⋫",
	ntrianglelefteq = "⋬",
	ntrianglerighteq = "⋭",

	-- Turnstiles and entailment
	vdash = "⊢",
	dashv = "⊣",
	models = "⊨",
	vDash = "⊨",
	Vdash = "⊩",
	Vvdash = "⊪",
	VDash = "⊫",
	nvdash = "⊬",
	nvDash = "⊭",
	nVdash = "⊮",
	nVDash = "⊯",

	-- Basic arrows
	to = "→",
	gets = "←",
	rightarrow = "→",
	rarr = "→",
	leftarrow = "←",
	larr = "←",
	leftrightarrow = "↔",
	harr = "↔",

	Rightarrow = "⇒",
	rArr = "⇒",
	Rarr = "⇒",
	Leftarrow = "⇐",
	lArr = "⇐",
	Larr = "⇐",
	Leftrightarrow = "⇔",
	hArr = "⇔",
	Harr = "⇔",
	lrArr = "⇔",
	Lrarr = "⇔",
	lrarr = "↔",

	longrightarrow = "⟶",
	longleftarrow = "⟵",
	longleftrightarrow = "⟷",

	Longrightarrow = "⟹",
	Longleftarrow = "⟸",
	Longleftrightarrow = "⟺",

	implies = "⟹",
	impliedby = "⟸",
	["iff"] = "⟺",

	mapsto = "↦",
	mapsfrom = "↤",
	longmapsto = "⟼",
	longmapsfrom = "⟻",
	multimap = "⊸",

	-- Vertical and diagonal arrows
	uparrow = "↑",
	uarr = "↑",
	downarrow = "↓",
	darr = "↓",
	updownarrow = "↕",
	Uparrow = "⇑",
	uArr = "⇑",
	Uarr = "⇑",
	Downarrow = "⇓",
	dArr = "⇓",
	Darr = "⇓",
	Updownarrow = "⇕",

	nearrow = "↗",
	searrow = "↘",
	swarrow = "↙",
	nwarrow = "↖",

	-- Arrow variants
	hookleftarrow = "↩",
	hookrightarrow = "↪",
	twoheadleftarrow = "↞",
	twoheadrightarrow = "↠",
	leftarrowtail = "↢",
	rightarrowtail = "↣",

	dashleftarrow = "⇠",
	dashrightarrow = "⇢",

	leftleftarrows = "⇇",
	rightrightarrows = "⇉",
	leftrightarrows = "⇆",
	rightleftarrows = "⇄",

	upuparrows = "⇈",
	downdownarrows = "⇊",

	leftharpoonup = "↼",
	leftharpoondown = "↽",
	rightharpoonup = "⇀",
	rightharpoondown = "⇁",

	upharpoonleft = "↿",
	upharpoonright = "↾",
	downharpoonleft = "⇃",
	downharpoonright = "⇂",

	leftrightharpoons = "⇋",
	rightleftharpoons = "⇌",

	Lleftarrow = "⇚",
	Rrightarrow = "⇛",
	Lsh = "↰",
	Rsh = "↱",

	looparrowleft = "↫",
	looparrowright = "↬",
	curvearrowleft = "↶",
	curvearrowright = "↷",
	circlearrowleft = "↺",
	circlearrowright = "↻",

	rightsquigarrow = "⇝",
	leadsto = "↝",
	leftrightsquigarrow = "↭",
	restriction = "↾",

	-- Negated arrows
	nleftarrow = "↚",
	nrightarrow = "↛",
	nleftrightarrow = "↮",
	nLeftarrow = "⇍",
	nRightarrow = "⇏",
	nLeftrightarrow = "⇎",

	-- Delimiters
	lparen = "(",
	rparen = ")",
	lbrack = "[",
	rbrack = "]",
	lbrace = "{",
	rbrace = "}",
	lBrace = "{",
	rBrace = "}",

	langle = "⟨",
	rangle = "⟩",
	lang = "⟨",
	rang = "⟩",
	lceil = "⌈",
	rceil = "⌉",
	lfloor = "⌊",
	rfloor = "⌋",

	lvert = "|",
	rvert = "|",
	vert = "|",
	lVert = "‖",
	rVert = "‖",
	Vert = "‖",

	backslash = "\\",
	slash = "∕",

	lgroup = "⟮",
	rgroup = "⟯",
	lmoustache = "⎰",
	rmoustache = "⎱",
	bracevert = "⎪",

	ulcorner = "⌜",
	urcorner = "⌝",
	llcorner = "⌞",
	lrcorner = "⌟",

	llbracket = "⟦",
	rrbracket = "⟧",

	-- Dots and punctuation
	ldots = "…",
	cdots = "⋯",
	vdots = "⋮",
	ddots = "⋱",
	iddots = "⋰",
	dots = "…",
	dotsb = "⋯",
	dotsc = "…",
	dotsi = "⋯",
	dotsm = "⋯",
	dotso = "…",
	mathellipsis = "…",
	-- Small centered dot is distinct from baseline punctuation
	sdot = "⋅",

	colon = "∶",
	Colon = "∷",

	-- Shapes
	triangle = "△",
	vartriangle = "△",
	triangledown = "▽",
	bigtriangleup = "△",
	bigtriangledown = "▽",

	blacktriangle = "▲",
	blacktriangledown = "▼",
	blacktriangleleft = "◀",
	blacktriangleright = "▶",

	square = "□",
	Box = "□",
	blacksquare = "■",
	Diamond = "◇",
	lozenge = "◊",
	blacklozenge = "◆",

	diagup = "╱",
	diagdown = "╲",

	-- Miscellaneous
	dagger = "†",
	ddagger = "‡",
	-- Plain TeX and uppercase aliases share same dagger glyphs
	dag = "†",
	ddag = "‡",
	Dagger = "‡",
	-- Quote commands produce literal typographic quotes
	lq = "‘",
	rq = "’",
	checkmark = "✓",
	-- These direct symbols and plain aliases match their KaTeX command meanings
	mathsterling = "£",
	surd = "√",
	P = "¶",
	S = "§",
	bigstar = "★",
	minuso = "⦵",
	maltese = "✠",
	qed = "∎",
	qedsymbol = "∎",

	flat = "♭",
	natural = "♮",
	sharp = "♯",

	clubsuit = "♣",
	diamondsuit = "♢",
	heartsuit = "♡",
	spadesuit = "♠",
	clubs = "♣",
	diamonds = "♢",
	hearts = "♡",
	spades = "♠",

	copyright = "©",
	circledR = "®",
	circledS = "Ⓢ",
	pounds = "£",
	yen = "¥",
	euro = "€",
}

return SYMBOLS
