HTML_TAGS: dict[str, tuple[tuple[str, ...], bool]] = {
    "html": (("lang", "dir", "xmlns", "manifest"), False),
    "head": ((), False),
    "title": ((), False),
    "style": (("type", "media", "scoped", "title", "disabled"), False),
    "script": (
        (
            "src",
            "type",
            "charset",
            "async",
            "defer",
            "crossorigin",
            "integrity",
            "nomodule",
            "referrerpolicy",
            "fetchpriority",
        ),
        False,
    ),
    "noscript": ((), False),
    "body": (
        (
            "onload",
            "onunload",
            "onbeforeunload",
            "onhashchange",
            "onmessage",
            "onoffline",
            "ononline",
            "onpagehide",
            "onpageshow",
            "onpopstate",
            "onresize",
            "onstorage",
            "onunhandledrejection",
        ),
        False,
    ),
    "section": ((), False),
    "nav": ((), False),
    "article": ((), False),
    "aside": ((), False),
    "h1": ((), False),
    "h2": ((), False),
    "h3": ((), False),
    "h4": ((), False),
    "h5": ((), False),
    "h6": ((), False),
    "hgroup": ((), False),
    "header": ((), False),
    "footer": ((), False),
    "address": ((), False),
    "p": ((), False),
    "hr": ((), True),
    "pre": (("width",), False),
    "blockquote": (("cite",), False),
    "ol": (("reversed", "start", "type"), False),
    "ul": ((), False),
    "menu": (("type", "label"), False),
    "li": (("value",), False),
    "dl": ((), False),
    "dt": ((), False),
    "dd": ((), False),
    "figure": ((), False),
    "figcaption": ((), False),
    "main": ((), False),
    "div": ((), False),
    "a": (
        (
            "href",
            "target",
            "download",
            "ping",
            "rel",
            "hreflang",
            "type",
            "referrerpolicy",
        ),
        False,
    ),
    "em": ((), False),
    "strong": ((), False),
    "small": ((), False),
    "s": ((), False),
    "cite": ((), False),
    "q": (("cite",), False),
    "dfn": ((), False),
    "abbr": ((), False),
    "ruby": ((), False),
    "rt": ((), False),
    "rp": ((), False),
    "data": (("value",), False),
    "time": (("datetime",), False),
    "code": ((), False),
    "var": ((), False),
    "samp": ((), False),
    "kbd": ((), False),
    "sub": ((), False),
    "sup": ((), False),
    "i": ((), False),
    "b": ((), False),
    "u": ((), False),
    "mark": ((), False),
    "bdi": ((), False),
    "bdo": (("dir",), False),
    "span": ((), False),
    "ins": (("cite", "datetime"), False),
    "del": (("cite", "datetime"), False),
    "picture": ((), False),
    "img": (
        (
            "src",
            "alt",
            "srcset",
            "sizes",
            "crossorigin",
            "usemap",
            "ismap",
            "width",
            "height",
            "referrerpolicy",
            "decoding",
            "loading",
            "fetchpriority",
        ),
        True,
    ),
    "iframe": (
        (
            "src",
            "srcdoc",
            "name",
            "sandbox",
            "allow",
            "allowfullscreen",
            "width",
            "height",
            "referrerpolicy",
            "loading",
        ),
        False,
    ),
    "embed": (("src", "type", "width", "height"), True),
    "object": (("data", "type", "name", "usemap", "form", "width", "height"), False),
    "video": (
        (
            "src",
            "crossorigin",
            "poster",
            "preload",
            "autoplay",
            "playsinline",
            "loop",
            "muted",
            "controls",
            "width",
            "height",
        ),
        False,
    ),
    "audio": (
        ("src", "crossorigin", "preload", "autoplay", "loop", "muted", "controls"),
        False,
    ),
    "source": (("src", "type", "srcset", "sizes", "media", "width", "height"), True),
    "track": (("default", "kind", "label", "src", "srclang"), True),
    "canvas": (("width", "height"), False),
    "map": (("name",), False),
    "area": (
        (
            "alt",
            "coords",
            "shape",
            "href",
            "target",
            "download",
            "ping",
            "rel",
            "referrerpolicy",
        ),
        True,
    ),
    "svg": (("xmlns", "width", "height", "viewBox", "preserveAspectRatio"), False),
    "math": (("xmlns",), False),
    "table": ((), False),
    "caption": ((), False),
    "colgroup": (("span",), False),
    "col": (("span",), True),
    "tbody": ((), False),
    "thead": ((), False),
    "tfoot": ((), False),
    "tr": ((), False),
    "td": (("colspan", "rowspan", "headers"), False),
    "th": (("colspan", "rowspan", "headers", "scope", "abbr"), False),
    "form": (
        (
            "accept-charset",
            "action",
            "autocomplete",
            "enctype",
            "method",
            "name",
            "novalidate",
            "target",
            "rel",
        ),
        False,
    ),
    "label": (("for",), False),
    "input": (
        (
            "accept",
            "alt",
            "autocomplete",
            "checked",
            "dirname",
            "disabled",
            "form",
            "formaction",
            "formenctype",
            "formmethod",
            "formnovalidate",
            "formtarget",
            "height",
            "list",
            "max",
            "maxlength",
            "min",
            "minlength",
            "multiple",
            "name",
            "pattern",
            "placeholder",
            "popovertarget",
            "popovertargetaction",
            "readonly",
            "required",
            "size",
            "src",
            "step",
            "type",
            "value",
            "width",
        ),
        True,
    ),
    "button": (
        (
            "disabled",
            "form",
            "formaction",
            "formenctype",
            "formmethod",
            "formnovalidate",
            "formtarget",
            "name",
            "popovertarget",
            "popovertargetaction",
            "type",
            "value",
        ),
        False,
    ),
    "select": (
        (
            "autocomplete",
            "disabled",
            "form",
            "multiple",
            "name",
            "required",
            "size",
        ),
        False,
    ),
    "datalist": ((), False),
    "optgroup": (("disabled", "label"), False),
    "option": (("disabled", "label", "selected", "value"), False),
    "textarea": (
        (
            "autocomplete",
            "cols",
            "dirname",
            "disabled",
            "form",
            "maxlength",
            "minlength",
            "name",
            "placeholder",
            "readonly",
            "required",
            "rows",
            "wrap",
        ),
        False,
    ),
    "output": (("for", "form", "name"), False),
    "progress": (("value", "max"), False),
    "meter": (("value", "min", "max", "low", "high", "optimum"), False),
    "fieldset": (("disabled", "form", "name"), False),
    "legend": ((), False),
    "details": (("open",), False),
    "summary": ((), False),
    "dialog": (("open",), False),
    "slot": (("name",), False),
    "template": ((), False),
    "br": ((), True),
    "base": (("href", "target"), True),
    "link": (
        (
            "rel",
            "href",
            "type",
            "media",
            "sizes",
            "hreflang",
            "crossorigin",
            "integrity",
            "referrerpolicy",
            "as",
            "color",
            "disabled",
            "imagesizes",
            "imagesrcset",
        ),
        True,
    ),
    "meta": (("name", "content", "charset", "http-equiv", "property", "scheme"), True),
    "param": (("name", "value"), True),
    "wbr": ((), True),
}

GLOBAL_ATTRIBUTES = (
    "accesskey",
    "autocapitalize",
    "autofocus",
    "class",
    "contenteditable",
    "contextmenu",
    "dir",
    "draggable",
    "enterkeyhint",
    "exportparts",
    "hidden",
    "id",
    "inert",
    "inputmode",
    "is",
    "itemid",
    "itemprop",
    "itemref",
    "itemscope",
    "itemtype",
    "lang",
    "nonce",
    "part",
    "popover",
    "role",
    "slot",
    "spellcheck",
    "style",
    "tabindex",
    "title",
    "translate",
    "virtualkeyboardpolicy",
)

# Event handler attributes (начинающиеся с "on")
EVENT_ATTRIBUTES = (
    "onabort",
    "onafterprint",
    "onbeforeprint",
    "onbeforeunload",
    "onblur",
    "oncanplay",
    "oncanplaythrough",
    "onchange",
    "onclick",
    "oncontextmenu",
    "oncopy",
    "oncuechange",
    "oncut",
    "ondblclick",
    "ondrag",
    "ondragend",
    "ondragenter",
    "ondragleave",
    "ondragover",
    "ondragstart",
    "ondrop",
    "ondurationchange",
    "onemptied",
    "onended",
    "onerror",
    "onfocus",
    "onhashchange",
    "oninput",
    "oninvalid",
    "onkeydown",
    "onkeypress",
    "onkeyup",
    "onload",
    "onloadeddata",
    "onloadedmetadata",
    "onloadstart",
    "onmessage",
    "onmousedown",
    "onmousemove",
    "onmouseout",
    "onmouseover",
    "onmouseup",
    "onmousewheel",
    "onoffline",
    "ononline",
    "onpagehide",
    "onpageshow",
    "onpaste",
    "onpause",
    "onplay",
    "onplaying",
    "onpopstate",
    "onprogress",
    "onratechange",
    "onreset",
    "onresize",
    "onscroll",
    "onsearch",
    "onseeked",
    "onseeking",
    "onselect",
    "onstalled",
    "onstorage",
    "onsubmit",
    "onsuspend",
    "ontimeupdate",
    "ontoggle",
    "onunload",
    "onvolumechange",
    "onwaiting",
    "onwheel",
)


UNIQUE_IDENTIFIER = "id"
