import { asciiAlpha, asciiAlphanumeric, markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from "../../micromark-util-character/index.js";
import { factorySpace } from "../../micromark-factory-space/index.js";
const htmlText = {
	name: "htmlText",
	tokenize: tokenizeHtmlText
};
function tokenizeHtmlText(o, s, c) {
	let l = this, u, d, f;
	return p;
	function p(n) {
		return o.enter("htmlText"), o.enter("htmlTextData"), o.consume(n), m;
	}
	function m(a) {
		return a === 33 ? (o.consume(a), h) : a === 47 ? (o.consume(a), D) : a === 63 ? (o.consume(a), T) : asciiAlpha(a) ? (o.consume(a), A) : c(a);
	}
	function h(a) {
		return a === 45 ? (o.consume(a), g) : a === 91 ? (o.consume(a), d = 0, b) : asciiAlpha(a) ? (o.consume(a), w) : c(a);
	}
	function g(n) {
		return n === 45 ? (o.consume(n), y) : c(n);
	}
	function _(n) {
		return n === null ? c(n) : n === 45 ? (o.consume(n), v) : markdownLineEnding(n) ? (f = _, z(n)) : (o.consume(n), _);
	}
	function v(n) {
		return n === 45 ? (o.consume(n), y) : _(n);
	}
	function y(n) {
		return n === 62 ? R(n) : n === 45 ? v(n) : _(n);
	}
	function b(n) {
		return n === "CDATA[".charCodeAt(d++) ? (o.consume(n), d === 6 ? x : b) : c(n);
	}
	function x(n) {
		return n === null ? c(n) : n === 93 ? (o.consume(n), S) : markdownLineEnding(n) ? (f = x, z(n)) : (o.consume(n), x);
	}
	function S(n) {
		return n === 93 ? (o.consume(n), C) : x(n);
	}
	function C(n) {
		return n === 62 ? R(n) : n === 93 ? (o.consume(n), C) : x(n);
	}
	function w(n) {
		return n === null || n === 62 ? R(n) : markdownLineEnding(n) ? (f = w, z(n)) : (o.consume(n), w);
	}
	function T(n) {
		return n === null ? c(n) : n === 63 ? (o.consume(n), E) : markdownLineEnding(n) ? (f = T, z(n)) : (o.consume(n), T);
	}
	function E(n) {
		return n === 62 ? R(n) : T(n);
	}
	function D(a) {
		return asciiAlpha(a) ? (o.consume(a), O) : c(a);
	}
	function O(n) {
		return n === 45 || asciiAlphanumeric(n) ? (o.consume(n), O) : k(n);
	}
	function k(n) {
		return markdownLineEnding(n) ? (f = k, z(n)) : markdownSpace(n) ? (o.consume(n), k) : R(n);
	}
	function A(n) {
		return n === 45 || asciiAlphanumeric(n) ? (o.consume(n), A) : n === 47 || n === 62 || markdownLineEndingOrSpace(n) ? j(n) : c(n);
	}
	function j(a) {
		return a === 47 ? (o.consume(a), R) : a === 58 || a === 95 || asciiAlpha(a) ? (o.consume(a), M) : markdownLineEnding(a) ? (f = j, z(a)) : markdownSpace(a) ? (o.consume(a), j) : R(a);
	}
	function M(n) {
		return n === 45 || n === 46 || n === 58 || n === 95 || asciiAlphanumeric(n) ? (o.consume(n), M) : N(n);
	}
	function N(n) {
		return n === 61 ? (o.consume(n), P) : markdownLineEnding(n) ? (f = N, z(n)) : markdownSpace(n) ? (o.consume(n), N) : j(n);
	}
	function P(n) {
		return n === null || n === 60 || n === 61 || n === 62 || n === 96 ? c(n) : n === 34 || n === 39 ? (o.consume(n), u = n, F) : markdownLineEnding(n) ? (f = P, z(n)) : markdownSpace(n) ? (o.consume(n), P) : (o.consume(n), I);
	}
	function F(n) {
		return n === u ? (o.consume(n), u = void 0, L) : n === null ? c(n) : markdownLineEnding(n) ? (f = F, z(n)) : (o.consume(n), F);
	}
	function I(n) {
		return n === null || n === 34 || n === 39 || n === 60 || n === 61 || n === 96 ? c(n) : n === 47 || n === 62 || markdownLineEndingOrSpace(n) ? j(n) : (o.consume(n), I);
	}
	function L(n) {
		return n === 47 || n === 62 || markdownLineEndingOrSpace(n) ? j(n) : c(n);
	}
	function R(n) {
		return n === 62 ? (o.consume(n), o.exit("htmlTextData"), o.exit("htmlText"), s) : c(n);
	}
	function z(n) {
		return o.exit("htmlTextData"), o.enter("lineEnding"), o.consume(n), o.exit("lineEnding"), B;
	}
	function B(n) {
		return markdownSpace(n) ? factorySpace(o, V, "linePrefix", l.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(n) : V(n);
	}
	function V(n) {
		return o.enter("htmlTextData"), f(n);
	}
}
export { htmlText };
