import { normalize } from "./normalize.js";
import { Info } from "./util/info.js";
import { DefinedInfo } from "./util/defined-info.js";
var cap = /[A-Z]/g, dash = /-[a-z]/g, valid = /^data[-\w.:]+$/i;
function find(c, l) {
	let u = normalize(l), d = l, f = Info;
	if (u in c.normal) return c.property[c.normal[u]];
	if (u.length > 4 && u.slice(0, 4) === "data" && valid.test(l)) {
		if (l.charAt(4) === "-") {
			let e = l.slice(5).replace(dash, camelcase);
			d = "data" + e.charAt(0).toUpperCase() + e.slice(1);
		} else {
			let e = l.slice(4);
			if (!dash.test(e)) {
				let s = e.replace(cap, kebab);
				s.charAt(0) !== "-" && (s = "-" + s), l = "data" + s;
			}
		}
		f = DefinedInfo;
	}
	return new f(d, l);
}
function kebab(e) {
	return "-" + e.toLowerCase();
}
function camelcase(e) {
	return e.charAt(1).toUpperCase();
}
export { find };
