import html
import re
from typing import Any, Final, Literal

from .node import Node

HTMLunescape = html.unescape
ESCAPED_CHAR: Final[str]
rePunctuation: Final[re.Pattern[str]]
reLinkTitle: Final[re.Pattern[str]]
reLinkDestinationBraces: Final[re.Pattern[str]]
reEscapable: Final[re.Pattern[str]]
reEntityHere: Final[re.Pattern[str]]
reTicks: Final[re.Pattern[str]]
reTicksHere: Final[re.Pattern[str]]
reEllipses: Final[re.Pattern[str]]
reDash: Final[re.Pattern[str]]
reEmailAutolink: Final[re.Pattern[str]]
reAutolink: Final[re.Pattern[str]]
reSpnl: Final[re.Pattern[str]]
reWhitespaceChar: Final[re.Pattern[str]]
reWhitespace: Final[re.Pattern[str]]
reUnicodeWhitespaceChar: Final[re.Pattern[str]]
reFinalSpace: Final[re.Pattern[str]]
reInitialSpace: Final[re.Pattern[str]]
reSpaceAtEndOfLine: Final[re.Pattern[str]]
reLinkLabel: Final[re.Pattern[str]]
reMain: Final[re.Pattern[str]]

def text(s: str) -> Node: ...
def smart_dashes(chars: str) -> str: ...

class InlineParser:
    subject: str
    brackets: dict[str, Any] | None
    pos: int
    refmap: dict[str, Any]
    options: dict[str, Any]
    def __init__(self, options: dict[str, Any] = {}) -> None: ...
    def match(self, regexString: str | re.Pattern[str]) -> str | None: ...
    def peek(self) -> str | None: ...
    def spnl(self) -> Literal[True]: ...
    def parseBackticks(self, block: Node) -> bool: ...
    def parseBackslash(self, block: Node) -> Literal[True]: ...
    def parseAutolink(self, block: Node) -> bool: ...
    def parseHtmlTag(self, block: Node) -> bool: ...
    def scanDelims(self, c: str) -> dict[str, Any] | None: ...
    delimiters: dict[str, Any]
    def handleDelim(self, cc: str, block: Node) -> bool: ...
    def removeDelimiter(self, delim: dict[str, Any]) -> None: ...
    @staticmethod
    def removeDelimitersBetween(bottom: dict[str, Any], top: dict[str, Any]) -> None: ...
    def processEmphasis(self, stack_bottom: dict[str, Any]) -> None: ...
    def parseLinkTitle(self) -> str | None: ...
    def parseLinkDestination(self) -> str | None: ...
    def parseLinkLabel(self) -> int: ...
    def parseOpenBracket(self, block: Node) -> Literal[True]: ...
    def parseBang(self, block: Node) -> Literal[True]: ...
    def parseCloseBracket(self, block: Node) -> Literal[True]: ...
    def addBracket(self, node: Node, index: int, image: bool | None) -> None: ...
    def removeBracket(self) -> None: ...
    def parseEntity(self, block: Node) -> bool: ...
    def parseString(self, block: Node) -> bool: ...
    def parseNewline(self, block: Node) -> Literal[True]: ...
    def parseReference(self, s: str, refmap: dict[str, Any]) -> int: ...
    def parseInline(self, block: Node) -> bool: ...
    def parseInlines(self, block: Node) -> None: ...
    parse = parseInlines
