import { asciiAlpha as e, asciiAlphanumeric as t, asciiAtext as n, asciiControl as r } from "../../micromark-util-character/index.js";
//#region ../../node_modules/micromark-core-commonmark/lib/autolink.js
var i = {
	name: "autolink",
	tokenize: a
};
function a(i, a, o) {
	let s = 0;
	return c;
	function c(e) {
		return i.enter("autolink"), i.enter("autolinkMarker"), i.consume(e), i.exit("autolinkMarker"), i.enter("autolinkProtocol"), l;
	}
	function l(t) {
		return e(t) ? (i.consume(t), u) : t === 64 ? o(t) : p(t);
	}
	function u(e) {
		return e === 43 || e === 45 || e === 46 || t(e) ? (s = 1, d(e)) : p(e);
	}
	function d(e) {
		return e === 58 ? (i.consume(e), s = 0, f) : (e === 43 || e === 45 || e === 46 || t(e)) && s++ < 32 ? (i.consume(e), d) : (s = 0, p(e));
	}
	function f(e) {
		return e === 62 ? (i.exit("autolinkProtocol"), i.enter("autolinkMarker"), i.consume(e), i.exit("autolinkMarker"), i.exit("autolink"), a) : e === null || e === 32 || e === 60 || r(e) ? o(e) : (i.consume(e), f);
	}
	function p(e) {
		return e === 64 ? (i.consume(e), m) : n(e) ? (i.consume(e), p) : o(e);
	}
	function m(e) {
		return t(e) ? h(e) : o(e);
	}
	function h(e) {
		return e === 46 ? (i.consume(e), s = 0, m) : e === 62 ? (i.exit("autolinkProtocol").type = "autolinkEmail", i.enter("autolinkMarker"), i.consume(e), i.exit("autolinkMarker"), i.exit("autolink"), a) : g(e);
	}
	function g(e) {
		if ((e === 45 || t(e)) && s++ < 63) {
			let t = e === 45 ? g : h;
			return i.consume(e), t;
		}
		return o(e);
	}
}
//#endregion
export { i as autolink };
