exports.id=885,exports.ids=[885],exports.modules={27646:e=>{"use strict";e.exports={}},4397:e=>{"use strict";e.exports=JSON.parse('{"Diagnostic":{"annotatedParamCountMismatch":"Parameter annotation count mismatch: expected {expected} but received {received}","annotatedTypeArgMissing":"Expected one type argument and one or more annotations for \\"Annotated\\"","annotationFormatString":"Type annotations cannot use format string literals (f-strings)","annotationNotSupported":"Type annotation not supported for this type of expression","annotationSpansStrings":"Type annotations cannot span multiple string literals","annotationStringEscape":"Type annotations cannot contain escape characters","annotationTripleQuote":"Type annotations cannot use triple quotes","argAssignment":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","argAssignmentFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\" in function \\"{functionName}\\"","argAssignmentParam":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\"","argAssignmentParamFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\" in function \\"{functionName}\\"","argMissingForParam":"Argument missing for parameter {name}","argMissingForParams":"Arguments missing for parameters {names}","argMorePositionalExpectedCount":"Expected {expected} more positional arguments","argMorePositionalExpectedOne":"Expected 1 more positional argument","argPositional":"Expected positional argument","argPositionalExpectedCount":"Expected {expected} positional arguments","argPositionalExpectedOne":"Expected 1 positional argument","argTypePartiallyUnknown":"Argument type is partially unknown","argTypeUnknown":"Argument type is unknown","assertAlwaysTrue":"Assert expression always evaluates to true","assignmentExprContext":"Assignment expression must be within module, function or lambda","assignmentExprComprehension":"Assignment expression target \\"{name}\\" cannot use same name as comprehension for target","assignmentInProtocol":"Instance or class variables within a Protocol class must be explicitly declared within the class body","assignmentTargetExpr":"Expression cannot be assignment target","asyncNotInAsyncFunction":"Use of \\"async\\" not allowed outside of async function","awaitIllegal":"Use of \\"await\\" requires Python 3.5 or newer","awaitNotInAsync":"\\"await\\" allowed only within async function","backticksIllegal":"Expressions surrounded by backticks are not supported in Python 3.x; use repr instead","baseClassCircular":"Class cannot derive from itself","baseClassFinal":"Base class \\"{type}\\" is marked final and cannot be subclassed","baseClassInvalid":"Argument to class must be a base class","baseClassUnknown":"Base class type is unknown, obscuring type of derived class","bindTypeMismatch":"Could not bind method \\"{methodName}\\" because \\"{type}\\" is not assignable to parameter \\"{paramName}\\"","breakOutsideLoop":"\\"break\\" can be used only within a loop","callableExtraArgs":"Expected only two type arguments to \\"Callable\\"","callableFirstArg":"Expected parameter type list or \\"...\\"","callableSecondArg":"Expected return type as second type argument for \\"Callable\\"","casePatternIsIrrefutable":"Irrefutable pattern is allowed only for the last case statement","classDecoratorTypeUnknown":"Untyped class decorator obscures type of class; ignoring decorator","classDefinitionCycle":"Class definition for \\"{name}\\" depends on itself","classGetItemClsParam":"__class_getitem__ override should take a \\"cls\\" parameter","classMethodClsParam":"Class methods should take a \\"cls\\" parameter","classNotRuntimeSubscriptable":"Subscript for class \\"{name}\\" will generate runtime exception; enclose type annotation in quotes","classVarNotAllowed":"\\"ClassVar\\" is not allowed in this context","classVarFirstArgMissing":"Expected a type argument after \\"ClassVar\\"","classVarOverridesInstanceVar":"Class variable \\"{name}\\" overrides instance variable of same name in class \\"{className}\\"","classVarTooManyArgs":"Expected only one type argument after \\"ClassVar\\"","clsSelfParamTypeMismatch":"Type of parameter \\"{name}\\" must be a supertype of its class \\"{classType}\\"","comparisonAlwaysFalse":"Condition will always evaluate to False since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comparisonAlwaysTrue":"Condition will always evaluate to True since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comprehensionInDict":"Comprehension cannot be used with other dictionary entries","comprehensionInSet":"Comprehension cannot be used with other set entries","concatenateParamSpecMissing":"Last type argument for \\"Concatenate\\" must be a ParamSpec","concatenateTypeArgsMissing":"\\"Concatenate\\" requires at least two type arguments","constantRedefinition":"\\"{name}\\" is constant (because it is uppercase) and cannot be redefined","continueInFinally":"\\"continue\\" cannot be used within a finally clause","continueOutsideLoop":"\\"continue\\" can be used only within a loop","constructorNoArgs":"Expected no arguments to \\"{type}\\" constructor","dataClassBaseClassNotFrozen":"A frozen class cannot inherit from a class that is not frozen","dataClassFieldWithDefault":"Fields without default values cannot appear after fields with default values","declaredReturnTypePartiallyUnknown":"Declared return type, \\"{returnType}\\", is partially unknown","declaredReturnTypeUnknown":"Declared return type is unknown","defaultValueContainsCall":"Function calls within default value initializer are not permitted","defaultValueNotAllowed":"Parameter with \\"*\\" or \\"**\\" cannot have default value","defaultValueNotEllipsis":"Default values in stub files should be specified as \\"...\\"","delTargetExpr":"Expression cannot be deleted","dictExpandIllegalInComprehension":"Dictionary expansion not allowed in comprehension","dictInAnnotation":"Dictionary expression not allowed in type annotation","dictKeyValuePairs":"Dictionary entries must contain key/value pairs","dictUnpackIsNotMapping":"Expected mapping for dictionary unpack operator","dunderAllSymbolNotPresent":"\\"{name}\\" is specified in __all__ but is not present in module","duplicateArgsParam":"Only one \\"*\\" parameter allowed","duplicateBaseClass":"Duplicate base class not allowed","duplicateCatchAll":"Only one catch-all except clause allowed","duplicateImport":"\\"{importName}\\" is imported more than once","duplicateKwargsParam":"Only one \\"**\\" parameter allowed","duplicateKeywordOnly":"Only one \\"*\\" separator allowed","duplicateParam":"Duplicate parameter \\"{name}\\"","duplicateCapturePatternTarget":"Capture target \\"{name}\\" cannot appear more than once within the same pattern","duplicateStarPattern":"Only one \\"*\\" pattern allowed in a pattern sequence","duplicateStarStarPattern":"Only one \\"**\\" entry allowed","duplicatePositionOnly":"Only one \\"/\\" parameter allowed","duplicateUnpack":"Only one unpack operation allowed in list","ellipsisContext":"\\"...\\" not allowed in this context","ellipsisSecondArg":"\\"...\\" allowed only as the second of two arguments","exceptionTypeIncorrect":"\\"{type}\\" does not derive from BaseException","exceptionTypeNotClass":"\\"{type}\\" is not valid exception class","exceptionTypeNotInstantiable":"Constructor for exception type \\"{type}\\" requires one or more arguments","expectedAfterDecorator":"Expected function or class declaration after decorator","expectedArrow":"Expected \\"->\\" followed by return type annotation","expectedAsAfterException":"Expected \\"as\\" after exception type","expectedAssignRightHandExpr":"Expected expression to the right of \\"=\\"","expectedBinaryRightHandExpr":"Expected expression to the right of operator","expectedBoolLiteral":"Expected True or False","expectedCase":"Expected \\"case\\" statement","expectedClassName":"Expected class name","expectedCloseBrace":"Expected \\"}\\"","expectedCloseBracket":"Expected \\"]\\"","expectedCloseParen":"Expected \\")\\"","expectedColon":"Expected \\":\\"","expectedComplexNumberLiteral":"Expected complex number literal for pattern matching","expectedDecoratorExpr":"Expression form not supported for decorator prior to Python 3.9","expectedDecoratorName":"Expected decorator name","expectedDecoratorNewline":"Expected new line at end of decorator","expectedDelExpr":"Expected expression after \\"del\\"","expectedElse":"Expected \\"else\\"","expectedExceptionClass":"Invalid exception class or object","expectedExceptionObj":"Expected exception object or None","expectedExpr":"Expected expression","expectedIdentifier":"Expected identifier","expectedImport":"Expected \\"import\\"","expectedImportAlias":"Expected symbol after \\"as\\"","expectedImportSymbols":"Expected one or more symbol names after import","expectedIndentedBlock":"Expected indented block","expectedInExpr":"Expected expression after \\"in\\"","expectedIn":"Expected \\"in\\"","expectedFunctionAfterAsync":"Expected function definition after \\"async\\"","expectedFunctionName":"Expected function name after \\"def\\"","expectedMemberName":"Expected member name after \\".\\"","expectedModuleName":"Expected module name","expectedNameAfterAs":"Expected symbol name after \\"as\\"","expectedNamedParameter":"Keyword parameter must follow \\"*\\"","expectedNewline":"Expected newline","expectedNewlineOrSemicolon":"Statements must be separated by newlines or semicolons","expectedOpenParen":"Expected \\"(\\"","expectedParamName":"Expected parameter name","expectedPatternExpr":"Expected pattern expression","expectedPatternSubjectExpr":"Expected pattern subject expression","expectedPatternValue":"Expected pattern value expression of the form \\"a.b\\"","expectedReturnExpr":"Expected expression after \\"return\\"","expectedSliceIndex":"Expected index or slice expression","expectedTypeNotString":"Expected type but received a string literal","expectedYieldExpr":"Expected expression in yield statement","finalClassIsAbstract":"Class \\"{type}\\" is marked final and must implement all abstract methods","finalContext":"\\"Final\\" not allowed in this context","finalMethodOverride":"Method \\"{name}\\" cannot override final method defined in class \\"{className}\\"","finalReassigned":"\\"{name}\\" is declared as Final and cannot be reassigned","finalRedeclaration":"\\"{name}\\" was previously declared as Final","finalRedeclarationBySubclass":"\\"{name}\\" cannot be redeclared because parent class \\"{className}\\" declares it as Final","finalTooManyArgs":"Expected a single type argument after \\"Final\\"","finalUnassigned":"\\"{name}\\" is declared Final, but value is not assigned","formatStringBrace":"Single close brace not allowed within f-string literal; use double close brace","formatStringBytes":"Format string literals (f-strings) cannot be binary","formatStringEscape":"Escape sequence (backslash) not allowed in expression portion of f-string","formatStringInPattern":"Format string not allowed in pattern","formatStringUnicode":"Format string literals (f-strings) cannot be unicode","formatStringIllegal":"Format string literals (f-strings) require Python 3.6 or newer","formatStringUnterminated":"Unterminated expression in f-string; missing close brace","functionDecoratorTypeUnknown":"Untyped function decorator obscures type of function; ignoring decorator","generatorAsyncReturnType":"Return type of async generator function must be \\"AsyncGenerator\\" or \\"AsyncIterable\\"","generatorSyncReturnType":"Return type of generator function must be \\"Generator\\" or \\"Iterable\\"","genericClassAssigned":"Generic class type cannot be assigned","genericClassDeleted":"Generic class type cannot be deleted","genericNotAllowed":"\\"Generic\\" is not valid in this context","genericTypeArgMissing":"\\"Generic\\" requires at least one type argument","genericTypeArgTypeVar":"Type argument for \\"Generic\\" must be a type variable","genericTypeArgUnique":"Type arguments for \\"Generic\\" must be unique","globalReassignment":"\\"{name}\\" is assigned before global declaration","globalRedefinition":"\\"{name}\\" was already declared global","implicitStringConcat":"Implicit string concatenation not allowed","importCycleDetected":"Cycle detected in import chain","importDepthExceeded":"Import chain depth exceeded {depth}","importResolveFailure":"Import \\"{importName}\\" could not be resolved","importSourceResolveFailure":"Import \\"{importName}\\" could not be resolved from source","importSymbolUnknown":"\\"{name}\\" is unknown import symbol","incompatibleMethodOverride":"Method \\"{name}\\" overrides class \\"{className}\\" in an incompatible manner","inconsistentIndent":"Unindent amount does not match previous indent","initMustReturnNone":"Return type of \\"__init__\\" must be None","inconsistentTabs":"Inconsistent use of tabs and spaces in indentation","initSubclassClsParam":"__init_subclass__ override should take a \\"cls\\" parameter","instanceMethodSelfParam":"Instance methods should take a \\"self\\" parameter","instanceVarOverridesClassVar":"Instance variable \\"{name}\\" overrides class variable of same name in class \\"{className}\\"","instantiateAbstract":"Cannot instantiate abstract class \\"{type}\\"","instantiateProtocol":"Cannot instantiate protocol class \\"{type}\\"","internalBindError":"An internal error occurred while binding file \\"{file}\\": {message}","internalParseError":"An internal error occurred while parsing file \\"{file}\\": {message}","internalTypeCheckingError":"An internal error occurred while type checking file \\"{file}\\": {message}","invalidIdentifierChar":"Invalid character in identifier","invalidStubStatement":"Statement is meaningless within a type stub file","invalidTokenChars":"Invalid character \\"{text}\\" in token","isInstanceInvalidType":"Second argument to \\"isinstance\\" must be a class or tuple of classes","isSubclassInvalidType":"Second argument to \\"issubclass\\" must be a class or tuple of classes","keyValueInSet":"Key/value pairs are not allowed within a set","keywordArgInTypeArgument":"Keyword arguments cannot be used in type argument lists","keywordOnlyAfterArgs":"Keyword-only argument separator not allowed after \\"*\\" parameter","keywordSubscriptIllegal":"Keyword arguments within subscripts are not supported","lambdaReturnTypeUnknown":"Return type of lambda is unknown","lambdaReturnTypePartiallyUnknown":"Return type of lambda, \\"{returnType}\\", is partially unknown","listInAnnotation":"List expression not allowed in type annotation","literalUnsupportedType":"Type arguments for \\"Literal\\" must be None, a literal value (int, bool, str, or bytes), or an enum value","literalEmptyArgs":"Expected one or more type arguments after \\"Literal\\"","literalNotCallable":"Literal type cannot be instantiated","matchIncompatible":"Match statements require Python 3.10 or newer","memberAccess":"Cannot access member \\"{name}\\" for type \\"{type}\\"","memberDelete":"Cannot delete member \\"{name}\\" for type \\"{type}\\"","memberSet":"Cannot assign member \\"{name}\\" for type \\"{type}\\"","metaclassConflict":"The metaclass of a derived class must be a subclass of the metaclasses of all its base classes","metaclassDuplicate":"Only one metaclass can be provided","methodNotDefined":"\\"{name}\\" method not defined","methodNotDefinedOnType":"\\"{name}\\" method not defined on type \\"{type}\\"","methodOrdering":"Cannot create consistent method ordering","methodOverridden":"\\"{name}\\" overrides method of same name in class \\"{className}\\" with incompatible type \\"{type}\\"","methodReturnsNonObject":"\\"{name}\\" method does not return an object","moduleContext":"Module not allowed in this context","moduleUnknownMember":"\\"{name}\\" is not a known member of module","namedExceptAfterCatchAll":"A named except clause cannot appear after catch-all except clause","namedParamAfterParamSpecArgs":"Keyword parameter \\"{name}\\" cannot appear in signature after ParamSpec args parameter","namedTupleEmptyName":"Names within a named tuple cannot be empty","namedTupleMultipleInheritance":"Multiple inheritance with NamedTuple is not supported","namedTupleFirstArg":"Expected named tuple class name as first argument","namedTupleNameString":"Expected string literal for tuple entry name","namedTupleNameType":"Expected two-entry tuple specifying entry name and type","namedTupleNameUnique":"Names within a named tuple must be unique","namedTupleNoTypes":"\\"namedtuple\\" provides no types for tuple entries; use \\"NamedTuple\\" instead","namedTupleSecondArg":"Expected named tuple entry list as second argument","newClsParam":"__new__ override should take a \\"cls\\" parameter","newTypeLiteral":"NewType cannot be used with Literal type","newTypeNotAClass":"Expected class as second argument to NewType","newTypeProtocolClass":"NewType cannot be used with protocol class","nonDefaultAfterDefault":"Non-default argument follows default argument","noneNotCallable":"Object of type \\"None\\" cannot be called","noneNotIterable":"Object of type \\"None\\" cannot be used as iterable value","noneOperator":"Operator \\"{operator}\\" not supported for \\"None\\"","noneNotSubscriptable":"Object of type \\"None\\" is not subscriptable","noneNotUsableWith":"Object of type \\"None\\" cannot be used with \\"with\\"","noneUnknownMember":"\\"{name}\\" is not a known member of \\"None\\"","nonLocalNoBinding":"No binding for nonlocal \\"{name}\\" found","nonLocalReassignment":"\\"{name}\\" is assigned before nonlocal declaration","nonLocalRedefinition":"\\"{name}\\" was already declared nonlocal","nonLocalInModule":"Nonlocal declaration not allowed at module level","noOverload":"No overloads for \\"{name}\\" match the provided arguments","noReturnContainsReturn":"Function with declared return type \\"NoReturn\\" cannot include a return statement","noReturnContainsYield":"Function with declared return type \\"NoReturn\\" cannot include a yield statement","noReturnReturnsNone":"Function with declared type of \\"NoReturn\\" cannot return \\"None\\"","notRequiredArgCount":"Expected a single type argument after \\"NotRequired\\"","notRequiredNotInTypedDict":"\\"NotRequired\\" is allowed only within TypedDict","objectNotCallable":"Object of type \\"{type}\\" is not callable","obscuredClassDeclaration":"Class declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredFunctionDeclaration":"Function declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredMethodDeclaration":"Method declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredParameterDeclaration":"Parameter declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredVariableDeclaration":"Declaration \\"{name}\\" is obscured by a declaration of the same name","operatorLessOrGreaterDeprecated":"Operator \\"<>\\" is not supported in Python 3; use \\"!=\\" instead","optionalExtraArgs":"Expected one type argument after \\"Optional\\"","orPatternIrrefutable":"Irrefutable pattern allowed only as the last subpattern in an \\"or\\" pattern","orPatternMissingName":"All subpatterns within an \\"or\\" pattern must target the same names","overlappingOverload":"Overload {obscured} for \\"{name}\\" will never be used because its parameters overlap overload {obscuredBy}","overloadAbstractMismatch":"Overloaded methods must all be abstract or not","overloadImplementationMismatch":"Overloaded function implementation is not consistent with signature of overload {index}","overloadReturnTypeMismatch":"Overload {prevIndex} for \\"{name}\\" overlaps overload {newIndex} and returns an incompatible type","overloadWithImplementation":"\\"{name}\\" is marked as overload, but it includes an implementation","overloadWithoutImplementation":"\\"{name}\\" is marked as overload, but no implementation is provided","paramAfterKwargsParam":"Parameter cannot follow \\"**\\" parameter","paramAlreadyAssigned":"Parameter \\"{name}\\" is already assigned","paramNameMissing":"No parameter named \\"{name}\\"","paramSpecArgsKwargsUsage":"\\"args\\" and \\"kwargs\\" members of ParamSpec must both appear within a function signature","paramSpecArgsUsage":"\\"args\\" member of ParamSpec is valid only when used with *args parameter","paramSpecAssignedName":"ParamSpec must be assigned to a variable named \\"{name}\\"","paramSpecContext":"ParamSpec not allowed in this context","paramSpecFirstArg":"Expected name of ParamSpec as first argument","paramSpecKwargsUsage":"\\"kwargs\\" member of ParamSpec is valid only when used with **kwargs parameter","paramSpecNotBound":"Param spec \\"{type}\\" has no bound value","paramSpecNotUsedByOuterScope":"ParamSpec \\"{name}\\" has no meaning in this context","paramSpecUnknownArg":"ParamSpec does not support more than one argument","paramSpecUnknownMember":"\\"{name}\\" is not a known member of ParamSpec","paramSpecUnknownParam":"\\"{name}\\" is unknown parameter to ParamSpec","paramAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","paramTypeCovariant":"Covariant type variable cannot be used in parameter type","paramTypeUnknown":"Type of parameter \\"{paramName}\\" is unknown","paramTypePartiallyUnknown":"Type of parameter \\"{paramName}\\" is partially unknown","parenthesizedContextManagerIllegal":"Parentheses within \\"with\\" statement requires Python 3.9 or newer","positionArgAfterNamedArg":"Positional argument cannot appear after keyword arguments","positionOnlyAfterArgs":"Position-only argument separator not allowed after \\"*\\" parameter","positionOnlyAfterKeywordOnly":"\\"/\\" parameter must appear before \\"*\\" parameter","positionOnlyIncompatible":"Position-only argument separator requires Python 3.8 or newer","positionOnlyFirstParam":"Position-only argument separator not allowed as first parameter","privateUsedOutsideOfClass":"\\"{name}\\" is private and used outside of the class in which it is declared","privateUsedOutsideOfModule":"\\"{name}\\" is private and used outside of the module in which it is declared","propertyOverridden":"\\"{name}\\" incorrectly overrides property of same name in class \\"{className}\\"","propertyStaticMethod":"Static methods not allowed for property getter, setter or deleter","protectedUsedOutsideOfClass":"\\"{name}\\" is protected and used outside of the class in which it is declared","protocolBaseClass":"Protocol class \\"{classType}\\" cannot derive from non-protocol class \\"{baseType}\\"","protocolIllegal":"Use of \\"Protocol\\" requires Python 3.7 or newer","protocolNotAllowedInTypeArgument":"\\"Protocol\\" cannot be used as a type argument","protocolVarianceContravariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be contravariant","protocolVarianceCovariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be covariant","protocolVarianceInvariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be invariant","protocolUsedInCall":"Protocol class cannot be used in \\"{name}\\" call","relativeImportNotAllowed":"Relative imports cannot be used with \\"import .a\\" form; use \\"from . import a\\" instead","recursiveDefinition":"Type of \\"{name}\\" could not be determined because it refers to itself","requiredArgCount":"Expected a single type argument after \\"Required\\"","requiredNotInTypedDict":"\\"Required\\" is allowed only within TypedDict","returnOutsideFunction":"\\"return\\" can be used only within a function","returnMissing":"Function with declared type of \\"{returnType}\\" must return value","returnTypeContravariant":"Contravariant type variable cannot be used in return type","returnTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to return type \\"{returnType}\\"","returnTypeUnknown":"Return type is unknown","returnTypePartiallyUnknown":"Return type, \\"{returnType}\\", is partially unknown","revealLocalsArgs":"Expected no arguments for \\"reveal_locals\\" call","revealLocalsNone":"No locals in this scope","revealTypeArgs":"Expected a single positional argument for \\"reveal_type\\" call","setterGetterTypeMismatch":"Property setter value type is not assignable to the getter return type","singleOverload":"\\"{name}\\" is marked as overload, but additional overloads are missing","slotsAttributeError":"\\"{name}\\" is not specified in __slots__","slotsClassVarConflict":"\\"{name}\\" conflicts with instance variable declared in __slots__","starPatternInAsPattern":"Star pattern cannot be used with \\"as\\" target","starPatternInOrPattern":"Star pattern cannot be ORed within other patterns","starStarWildcardNotAllowed":"** cannot be used with wildcard \\"_\\"","staticClsSelfParam":"Static methods should not take a \\"self\\" or \\"cls\\" parameter","stringNonAsciiBytes":"Non-ASCII character not allowed in bytes string literal","stringNotSubscriptable":"String expression cannot be subscripted in type annotation; enclose entire annotation in quotes","stringUnsupportedEscape":"Unsupported escape sequence in string literal","stringUnterminated":"String literal is unterminated","stubFileMissing":"Stub file not found for \\"{importName}\\"","stubUsesGetAttr":"Type stub file is incomplete; \\"__getattr__\\" obscures type errors for module","sublistParamsIncompatible":"Sublist parameters are not supported in Python 3.x","superCallArgCount":"Expected no more than two arguments to \\"super\\" call","superCallFirstArg":"Expected class type as first argument to \\"super\\" call but received \\"{type}\\"","superCallSecondArg":"Second argument to \\"super\\" call must be object or class that derives from \\"{type}\\"","superCallZeroArgForm":"Zero-argument form of \\"super\\" call is valid only within a class","symbolIsUnbound":"\\"{name}\\" is unbound","symbolIsUndefined":"\\"{name}\\" is not defined","symbolIsPossiblyUnbound":"\\"{name}\\" is possibly unbound","symbolOverridden":"\\"{name}\\" overrides symbol of same name in class \\"{className}\\"","trailingCommaInFromImport":"Trailing comma not allowed without surrounding parentheses","tryWithoutExcept":"Try statement must have at least one except or finally clause","tupleInAnnotation":"Tuple expression not allowed in type annotation","tupleIndexOutOfRange":"Index {index} is out of range for tuple with length {length}","tupleSizeMismatch":"Tuple size mismatch: expected {expected} but received {received}","typeAliasIsRecursiveDirect":"Type alias \\"{name}\\" cannot use itself in its definition","typeAliasIsRecursiveIndirect":"Type alias \\"{name}\\" cannot refer to itself indirectly in its definition","typeAliasNotInModule":"A TypeAlias can be defined only within a module scope","typeAliasRedeclared":"\\"{name}\\" is declared as a TypeAlias and can be assigned only once","typeArgListNotAllowed":"List expression not allowed for this type argument","typeAnnotationCall":"Illegal type annotation: call expression not allowed","typeAnnotationVariable":"Illegal type annotation: variable not allowed unless it is a type alias","typeArgsExpectingNone":"Expected no type arguments","typeArgsMismatchOne":"Expected one type argument but received {received}","typeArgsMissingForAlias":"Expected type arguments for generic type alias \\"{name}\\"","typeArgsMissingForClass":"Expected type arguments for generic class \\"{name}\\"","typeArgsTooFew":"Too few type arguments provided for class \\"{name}\\"; expected {expected} but received {received}","typeArgsTooMany":"Too many type arguments provided for class \\"{name}\\"; expected {expected} but received {received}","typeAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to declared type \\"{destType}\\"","typeCallNotAllowed":"type() call should not be used in type annotation","typedDictAccess":"Could not access item in TypedDict","typedDictBadVar":"TypedDict classes can contain only type annotations","typedDictBaseClass":"All base classes for \\"TypedDict\\" classes must also be \\"TypedDict\\" classes","typedDictDelete":"Could not delete item in TypedDict","typedDictEmptyName":"Names within a TypedDict cannot be empty","typedDictEntryName":"Expected string literal for dictionary entry name","typedDictEntryUnique":"Names within a dictionary must be unique","typedDictExtraArgs":"Extra TypedDict arguments not supported","typedDictFieldRedefinition":"Type of TypedDict field \\"{name}\\" cannot be redefined","typedDictFirstArg":"Expected TypedDict class name as first argument","typedDictSecondArgDict":"Expected dict or keyword parameter as second parameter","typedDictSecondArgDictEntry":"Expected simple dictionary entry","typedDictSet":"Could not assign item in TypedDict","typedDictTotalParam":"Expected \\"total\\" parameter to have a value of True or False","typeExpectedClass":"Expected class type but received \\"{type}\\"","typeGuardArgCount":"Expected a single type argument after \\"TypeGuard\\"","typeNotAwaitable":"\\"{type}\\" is not awaitable","typeNotCallable":"\\"{expression}\\" has type \\"{type}\\" and is not callable","typeNotIntantiable":"\\"{type}\\" cannot be instantiated","typeNotIterable":"\\"{type}\\" is not iterable","typeNotSpecializable":"Could not specialize type \\"{type}\\"","typeNotSubscriptable":"Object of type \\"{type}\\" is not subscriptable","typeNotUsableWith":"Object of type \\"{type}\\" cannot be used with \\"with\\" because it does not implement {method}","typeNotSupportBinaryOperator":"Operator \\"{operator}\\" not supported for types \\"{leftType}\\" and \\"{rightType}\\"","typeNotSupportUnaryOperator":"Operator \\"{operator}\\" not supported for type \\"{type}\\"","typePartiallyUnknown":"Type of \\"{name}\\" is partially unknown","typeUnknown":"Type of \\"{name}\\" is unknown","typeVarAssignedName":"TypeVar must be assigned to a variable named \\"{name}\\"","typeVarAssignmentMismatch":"Type \\"{type}\\" cannot be assigned to type variable \\"{name}\\"","typeVarBoundAndConstrained":"TypeVar cannot be both bound and constrained","typeVarFirstArg":"Expected name of TypeVar as first argument","typeVarGeneric":"TypeVar bound type cannot be generic","typeVarNoMember":"TypeVar \\"{type}\\" has no member \\"{name}\\"","typeVarNotSubscriptable":"TypeVar \\"{type}\\" is not subscriptable","typeVarNotUsedByOuterScope":"Type variable \\"{name}\\" has no meaning in this context","typeVarSingleConstraint":"TypeVar cannot have only a single constraint","typeVarsNotInGeneric":"Generic[] must include all type variables","typeVarTupleContext":"TypeVarTuple not allowed in this context","typeVarUnknownParam":"\\"{name}\\" is unknown parameter to TypeVar","typeVarUsedByOuterScope":"TypeVar \\"{name}\\" is already in use by an outer scope","typeVarUsedOnlyOnce":"TypeVar \\"{name}\\" appears only once in generic function signature","typeVarVariance":"TypeVar cannot be both covariant and contravariant","unaccessedClass":"Class \\"{name}\\" is not accessed","unaccessedFunction":"Function \\"{name}\\" is not accessed","unaccessedImport":"Import \\"{name}\\" is not accessed","unaccessedSymbol":"\\"{name}\\" is not accessed","unaccessedVariable":"Variable \\"{name}\\" is not accessed","unexpectedAsyncToken":"Expected \\"def\\", \\"with\\" or \\"for\\" to follow \\"async\\"","unexpectedExprToken":"Unexpected token at end of expression","unexpectedIndent":"Unexpected indentation","unexpectedUnindent":"Unindent not expected","unionSyntaxIllegal":"Alternative syntax for unions requires Python 3.10 or newer","uninitializedInstanceVariable":"Instance variable \\"{name}\\" is not initialized in the class body or __init__ method","unnecessaryCast":"Unnecessary \\"cast\\" call; type is already \\"{type}\\"","unnecessaryIsInstanceAlways":"Unnecessary isinstance call; \\"{testType}\\" is always an instance of \\"{classType}\\"","unnecessaryIsSubclassAlways":"Unnecessary issubclass call; \\"{testType}\\" is always a subclass of \\"{classType}\\"","unpackArgCount":"Expected a single type argument after \\"Unpack\\"","unpackedArgInTypeArgument":"Unpacked arguments cannot be used in type argument lists","unpackedArgWithVariadicParam":"Unpacked argument cannot be used for TupleTypeVar parameter","unpackedDictArgumentNotMapping":"Argument expression after ** must be a mapping with a \\"str\\" key type","unpackedSubscriptIllegal":"Unpack operator in subscript is not supported","unpackedTypedDictArgument":"Unable to match unpacked TypedDict argument to parameters","unpackedTypeVarTupleExpected":"Expected unpacked TypeVarTuple; use Unpack[{name1}] or *{name2}","unpackExpectedTypeVarTuple":"Expected TypeVarTuple as type argument for Unpack","unpackIllegalInComprehension":"Unpack operation not allowed in comprehension","unpackInDict":"Unpack operation not allowed in dictionaries","unpackInSet":"Unpack operator not allowed within a set","unpackNotAllowed":"Unpack operation not allowed in this context","unpackTuplesIllegal":"Unpack operation not allowed in tuples prior to Python 3.8","unreachableCode":"Code is unreachable","unsupportedDunderAllOperation":"Operation on \\"__all__\\" is not supported, so exported symbol list may be incorrect","unusedCallResult":"Result of call expression is of type \\"{type}\\" and is not used; assign to variable \\"_\\" if this is intentional","unusedCoroutine":"Result of async function call is not used; use \\"await\\" or assign result to variable","varAnnotationIllegal":"Type annotations for variables requires Python 3.6 or newer; use type comment for compatibility with previous versions","variadicTypeArgsTooMany":"Type argument list can have at most one unpacked TypeVarTuple","variadicTypeParamTooManyAlias":"Type alias can have at most one TypeVarTuple type parameter but received multiple ({names})","variadicTypeParamTooManyClass":"Generic class can have at most one TypeVarTuple type parameter but received multiple ({names})","walrusIllegal":"Operator \\":=\\" requires Python 3.8 or newer","walrusNotAllowed":"Operator \\":=\\" not allowed in this context","wildcardInFunction":"Wildcard import not allowed within a class or function","wildcardLibraryImport":"Wildcard import from a library not allowed","yieldFromIllegal":"Use of \\"yield from\\" requires Python 3.3 or newer","yieldFromOutsideAsync":"\\"yield from\\" not allowed in an async function","yieldOutsideFunction":"\\"yield\\" not allowed outside of a function or lambda","yieldTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to yield type \\"{yieldType}\\"","yieldWithinListCompr":"\\"yield\\" not allowed inside a list comprehension","zeroCaseStatementsFound":"Match statement must include at least one case statement","zeroLengthTupleNotAllowed":"Zero-length tuple not allowed in this context"},"DiagnosticAddendum":{"argParam":"Argument corresponds to parameter \\"{paramName}\\"","argParamFunction":"Argument corresponds to parameter \\"{paramName}\\" in function \\"{functionName}\\"","argsParamMissing":"Parameter \\"*{paramName}\\" has no corresponding parameter","argsParamWithVariadic":"Parameter \\"*{paramName}\\" is incompatible with TypeVarTuple","argumentType":"Argument type is \\"{type}\\"","argumentTypes":"Argument types: ({types})","assignToNone":"Type cannot be assigned to type \\"None\\"","asyncHelp":"Did you mean \\"async with\\"?","dataclassFrozen":"\\"{name}\\" is frozen","finalMethod":"Final method","keyNotRequired":"\\"{name}\\" is not a required key in \\"{type}\\", so access may result in runtime exception","keyRequiredDeleted":"\\"{name}\\" is a required key and cannot be deleted","keyUndefined":"\\"{name}\\" is not a defined key in \\"{type}\\"","functionParamName":"Parameter name mismatch: \\"{destName}\\" versus \\"{srcName}\\"","functionReturnTypeMismatch":"Function return type \\"{sourceType}\\" is incompatible with type \\"{destType}\\"","functionTooFewParams":"Function accepts too few positional parameters; expected {expected} but received {received}","functionTooManyParams":"Function accepts too many positional parameters; expected {expected} but received {received}","incompatibleGetter":"Property getter method is incompatible","incompatibleSetter":"Property setter method is incompatible","incompatibleDeleter":"Property deleter method is incompatible","kwargsParamMissing":"Parameter \\"**{paramName}\\" has no corresponding parameter","literalAssignmentMismatch":"\\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","memberSetClassVar":"Member \\"{name}\\" cannot be assigned through a class instance because it is a ClassVar","memberAssignment":"Expression of type \\"{type}\\" cannot be assigned to member \\"{name}\\" of class \\"{classType}\\"","memberIsAbstract":"\\"{type}.{name}\\" is abstract","memberIsAbstractMore":"and {count} more...","memberIsFinalInProtocol":"\\"{name}\\" is marked Final in protocol","memberIsNotFinalInProtocol":"\\"{name}\\" is not marked Final in protocol","memberTypeMismatch":"\\"{name}\\" is an incompatible type","memberUnknown":"Member \\"{name}\\" is unknown","missingGetter":"Property getter method is missing","missingSetter":"Property setter method is missing","missingDeleter":"Property deleter method is missing","namedParamMissingInDest":"Keyword parameter \\"{name}\\" is missing in destination","namedParamMissingInSource":"Keyword parameter \\"{name}\\" is missing in source","namedParamTypeMismatch":"Keyword parameter \\"{name}\\" of type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","noOverloadAssignable":"No overloaded function matches type \\"{type}\\"","orPatternMissingName":"Missing names: {name}","overloadMethod":"Overload method is defined here","overloadNotAssignable":"One or more overloads of \\"{name}\\" is not assignable","overloadWithImplementation":"The body of a function overload should be \\"...\\"","overriddenMethod":"Overridden method","overloadTooManyUnions":"Argument union types have too many subtypes to evaluate overload","overriddenSymbol":"Overridden symbol","overrideParamCount":"Parameter count mismatch; base method has {baseCount}, but override has {overrideCount}","overrideParamName":"Parameter {index} name mismatch: base parameter is named \\"{baseName}\\", override parameter is named \\"{overrideName}\\"","overrideParamType":"Parameter {index} type mismatch: base parameter is type \\"{baseType}\\", override parameter is type \\"{overrideType}\\"","overrideReturnType":"Return type mismatch: base method returns type \\"{baseType}\\", override returns type \\"{overrideType}\\"","overrideType":"Base class defines type as \\"{type}\\"","paramAssignment":"Parameter {index}: type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","paramSpecOverload":"ParamSpec cannot be used with overloaded function","paramType":"Parameter type is \\"{paramType}\\"","propertyMethodIncompatible":"Property method \\"{name}\\" is incompatible","propertyMethodMissing":"Property method \\"{name}\\" is missing in override","propertyMissingDeleter":"Property \\"{name}\\" has no defined deleter","propertyMissingSetter":"Property \\"{name}\\" has no defined setter","protocolMemberMissing":"\\"{name}\\" is not present","protocolMemberClassVar":"\\"{name}\\" is not a class variable","seeDeclaration":"See declaration","seeClassDeclaration":"See class declaration","seeFunctionDeclaration":"See function declaration","seeMethodDeclaration":"See method declaration","seeParameterDeclaration":"See parameter declaration","seeVariableDeclaration":"See variable declaration","tupleEntryTypeMismatch":"Tuple entry {entry} is incorrect type","tupleSizeMismatch":"Tuple size mismatch; expected {expected} but received {received}","tupleSizeMismatchIndeterminate":"Tuple size mismatch; expected {expected} but received indeterminate number","typeAssignmentMismatch":"Type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","typeBound":"Type \\"{sourceType}\\" is incompatible with bound type \\"{destType}\\" for type variable \\"{name}\\"","typeConstrainedTypeVar":"Type \\"{type}\\" is incompatible with constrained type variable \\"{name}\\"","typedDictFieldMissing":"\\"{name}\\" is missing from \\"{type}\\"","typedDictFieldNotRequired":"\\"{name}\\" is not required in \\"{type}\\"","typedDictFieldRequired":"\\"{name}\\" is required in \\"{type}\\"","typedDictFieldTypeMismatch":"Type \\"{type}\\" is not assignable to field \\"{name}\\"","typedDictFieldRedefinition":"Type in parent class is \\"{parentType}\\" and type in child class is \\"{childType}\\"","typedDictFieldUndefined":"\\"{name}\\" is an undefined field in type \\"{type}\\"","typeIncompatible":"\\"{sourceType}\\" is incompatible with \\"{destType}\\"","typeNotCallable":"Type \\"{type}\\" is not callable","typeNotClass":"\\"{type}\\" is not a class","typeParamSpec":"Type \\"{type}\\" is incompatible with ParamSpec \\"{name}\\"","typeNotStringLiteral":"\\"{type}\\" is not a string literal","typeOfSymbol":"Type of \\"{name}\\" is \\"{type}\\"","typeUnsupported":"Type \\"{type}\\" is unsupported","typeVarIsContravariant":"TypeVar \\"{name}\\" is contravariant","typeVarIsCovariant":"TypeVar \\"{name}\\" is covariant","typeVarIsInvariant":"TypeVar \\"{name}\\" is invariant","typeVarNotAllowed":"TypeVar or generic type with type arguments not allowed","typeVarsMissing":"Missing type variables: {names}","typeVarTupleRequiresKnownLength":"TypeVarTuple cannot be bound to a tuple of unknown length","useDictInstead":"Use Dict[T1, T2] to indicate a dictionary type","useListInstead":"Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type","useTupleInstead":"Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type","useTypeInstead":"Use Type[T] instead"},"CodeAction":{"addOptionalToAnnotation":"Add \\"Optional\\" to Type Annotation","createTypeStub":"Create Type Stub","createTypeStubFor":"Create Type Stub For \\"{moduleName}\\"","executingCommand":"Executing command","filesToAnalyzeOne":"1 file to analyze","filesToAnalyzeCount":"{count} files to analyze","findingReferences":"Finding references","organizeImports":"Organize Imports"}}')},3608:e=>{"use strict";e.exports={}},36181:e=>{"use strict";e.exports={}},22811:e=>{"use strict";e.exports={}},66483:e=>{"use strict";e.exports={}},37568:e=>{"use strict";e.exports={}},61162:e=>{"use strict";e.exports={}},82048:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAliasDeclaration=void 0,t.resolveAliasDeclaration=function e(t,n,i){let s=n;const r=[];for(;;){if(6!==s.type)return s;if(!s.symbolName)return s;if(!i&&s.usesLocalName)return s;let a;s.path&&(a=t(s.path));const o=a?a.symbolTable.get(s.symbolName):void 0;if(!o)return s.submoduleFallback?e(t,s.submoduleFallback,i):void 0;let l=o.getTypedDeclarations();if(0===l.length&&(l=o.getDeclarations(),0===l.length))return;if(s=l[l.length-1],r.find((e=>e===s)))return s.path===n.path&&6===s.type&&s.submoduleFallback?e(t,s.submoduleFallback,i):n;r.push(s)}}},20166:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeProgram=t.nullCallback=void 0;const a=n(38213),o=r(n(20823)),l=n(76962);t.nullCallback=e=>{},t.analyzeProgram=function(e,n,i,s,r,c){let p=!1;s=null!=s?s:t.nullCallback;try{a.throwIfCancellationRequested(c);const t=new l.Duration;p=e.analyze(n,c);const r=e.getFilesToAnalyzeCount(),o=e.getDiagnostics(i),d=o.length,u=t.getDurationInSeconds();(d>0||!p)&&s({diagnostics:o,filesInProgram:e.getFileCount(),filesRequiringAnalysis:r,checkingOnlyOpenFiles:e.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:u})}catch(e){if(a.OperationCanceledException.is(e))return!1;const t=o.getErrorString(e);r.error("Error performing analysis: "+t),s({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!0,configParseErrorOccurred:!1,elapsedTime:0,error:o.getSerializableError(e)})}return p}},35696:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCodeUnreachable=t.setDunderAllInfo=t.getDunderAllInfo=t.setCodeFlowExpressions=t.getCodeFlowExpressions=t.setFileInfo=t.getFileInfo=t.setAfterFlowNode=t.getAfterFlowNode=t.setFlowNode=t.getFlowNode=t.setDeclaration=t.getDeclaration=t.setScope=t.getScope=t.setImportInfo=t.getImportInfo=t.cleanNodeAnalysisInfo=void 0;const i=n(24394);function s(e){return e.flowNode}t.cleanNodeAnalysisInfo=function(e){const t=e;delete t.scope,delete t.declaration,delete t.flowNode,delete t.afterFlowNode,delete t.fileInfo},t.getImportInfo=function(e){return e.importInfo},t.setImportInfo=function(e,t){e.importInfo=t},t.getScope=function(e){return e.scope},t.setScope=function(e,t){e.scope=t},t.getDeclaration=function(e){return e.declaration},t.setDeclaration=function(e,t){e.declaration=t},t.getFlowNode=s,t.setFlowNode=function(e,t){e.flowNode=t},t.getAfterFlowNode=function(e){return e.afterFlowNode},t.setAfterFlowNode=function(e,t){e.afterFlowNode=t},t.getFileInfo=function(e){return e.fileInfo},t.setFileInfo=function(e,t){e.fileInfo=t},t.getCodeFlowExpressions=function(e){return e.codeFlowExpressions},t.setCodeFlowExpressions=function(e,t){e.codeFlowExpressions=t},t.getDunderAllInfo=function(e){return e.dunderAllInfo},t.setDunderAllInfo=function(e,t){e.dunderAllInfo=t},t.isCodeUnreachable=function(e){let t=e;for(;t;){const e=s(t);if(e)return!!(e.flags&i.FlowFlags.Unreachable);t=t.parent}return!1}},47041:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisProgram=void 0;const i=n(20166),s=n(73054);t.BackgroundAnalysisProgram=class{constructor(e,t,n,i,r,a,o){this._console=e,this._configOptions=t,this._importResolver=n,this._backgroundAnalysis=r,this._maxAnalysisTime=a,this._disableChecker=o,this._program=new s.Program(this._importResolver,this._configOptions,this._console,i,void 0,this._disableChecker)}get configOptions(){return this._configOptions}get importResolver(){return this._importResolver}get program(){return this._program}get backgroundAnalysis(){return this._backgroundAnalysis}setConfigOptions(e){var t;this._configOptions=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setConfigOptions(e),this._program.setConfigOptions(e)}setImportResolver(e){this._importResolver=e,this._program.setImportResolver(e),this._configOptions.getExecutionEnvironments().forEach((e=>this._ensurePartialStubPackages(e)))}setTrackedFiles(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setTrackedFiles(e);const n=this._program.setTrackedFiles(e);this._reportDiagnosticsForRemovedFiles(n)}setAllowedThirdPartyImports(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setAllowedThirdPartyImports(e),this._program.setAllowedThirdPartyImports(e)}setFileOpened(e,t,n,i){var s;null===(s=this._backgroundAnalysis)||void 0===s||s.setFileOpened(e,t,[{text:n}],i),this._program.setFileOpened(e,t,[{text:n}],i)}updateOpenFileContents(e,t,n,i){var s;null===(s=this._backgroundAnalysis)||void 0===s||s.setFileOpened(e,t,n,i),this._program.setFileOpened(e,t,n,i),this.markFilesDirty([e],!0)}setFileClosed(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setFileClosed(e);const n=this._program.setFileClosed(e);this._reportDiagnosticsForRemovedFiles(n)}markAllFilesDirty(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.markAllFilesDirty(e),this._program.markAllFilesDirty(e)}markFilesDirty(e,t){var n;null===(n=this._backgroundAnalysis)||void 0===n||n.markFilesDirty(e,t),this._program.markFilesDirty(e,t)}setCompletionCallback(e){var t;this._onAnalysisCompletion=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setCompletionCallback(e)}startAnalysis(e){return this._backgroundAnalysis?(this._backgroundAnalysis.startAnalysis(this._indices,e),!1):i.analyzeProgram(this._program,this._maxAnalysisTime,this._configOptions,this._onAnalysisCompletion,this._console,e)}test_setIndexing(e,t){const n=this._getIndices();for(const[t,i]of e)n.setWorkspaceIndex(t,i);for(const[e,i]of t)for(const[t,s]of i)n.setIndex(e,t,s)}startIndexing(){var e;this._configOptions.indexing&&(null===(e=this._backgroundAnalysis)||void 0===e||e.startIndexing(this._configOptions,this._getIndices()))}refreshIndexing(){var e;this._configOptions.indexing&&(null===(e=this._backgroundAnalysis)||void 0===e||e.refreshIndexing(this._configOptions,this._indices))}cancelIndexing(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.cancelIndexing(this._configOptions)}getIndexing(e){var t;return null===(t=this._indices)||void 0===t?void 0:t.getIndex(this._configOptions.findExecEnvironment(e).root)}async getDiagnosticsForRange(e,t,n){return this._backgroundAnalysis?this._backgroundAnalysis.getDiagnosticsForRange(e,t,n):this._program.getDiagnosticsForRange(e,t)}async writeTypeStub(e,t,n,s){return this._backgroundAnalysis?this._backgroundAnalysis.writeTypeStub(e,t,n,s):(i.analyzeProgram(this._program,void 0,this._configOptions,this._onAnalysisCompletion,this._console,s),this._program.writeTypeStub(e,t,n,s))}invalidateAndForceReanalysis(e){var t;e&&this.refreshIndexing(),null===(t=this._backgroundAnalysis)||void 0===t||t.invalidateAndForceReanalysis(),this._importResolver.invalidateCache(),this._program.markAllFilesDirty(!0)}restart(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.restart()}_ensurePartialStubPackages(e){var t;return null===(t=this._backgroundAnalysis)||void 0===t||t.ensurePartialStubPackages(e.root),this._importResolver.ensurePartialStubPackages(e)}_getIndices(){if(!this._indices){const e=this._program,t=new Map;this._indices={setWorkspaceIndex(t,n){var i;null===(i=e.getSourceFile(t))||void 0===i||i.cacheIndexResults(n)},getIndex:e=>t.get(e),setIndex(e,n,i){let s=t.get(e);s||(s=new Map,t.set(e,s)),s.set(n,i)},reset(){t.clear()}}}return this._indices}_reportDiagnosticsForRemovedFiles(e){e.length>0&&!this._backgroundAnalysis&&this._onAnalysisCompletion&&this._onAnalysisCompletion({diagnostics:e,filesInProgram:this._program.getFileCount(),filesRequiringAnalysis:this._program.getFilesToAnalyzeCount(),checkingOnlyOpenFiles:this._program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0})}}},91242:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReturnFinder=t.YieldFinder=t.Binder=void 0;const a=n(20823),o=n(15741),l=n(94647),c=n(28348),p=n(80957),d=n(80957),u=n(74426),h=r(n(35696)),m=n(24394),y=r(n(23241)),g=n(22339),f=n(17640),T=r(n(67737)),_=n(97882),v=n(91197);class b extends g.ParseTreeWalker{constructor(e,t=!1){super(),this._moduleSymbolOnly=t,this._deferredBindingTasks=[],this._currentExceptTargets=[],this._finallyTargets=[],this._typingImportAliases=[],this._sysImportAliases=[],this._typingSymbolAliases=new Map,this._dunderAllStringNodes=[],this._potentialPrivateSymbols=new Map,this._fileInfo=e}bindModule(e){var t;const n=void 0===this._fileInfo.builtinsScope;this._createNewScope(n?4:3,this._fileInfo.builtinsScope,(()=>{h.setScope(e,this._currentScope),h.setFlowNode(e,this._currentFlowNode),this._addBuiltInSymbolToCurrentScope("__doc__",e,"str"),this._addBuiltInSymbolToCurrentScope("__name__",e,"str"),this._addBuiltInSymbolToCurrentScope("__loader__",e,"Any"),this._addBuiltInSymbolToCurrentScope("__package__",e,"str"),this._addBuiltInSymbolToCurrentScope("__spec__",e,"Any"),this._addBuiltInSymbolToCurrentScope("__path__",e,"Iterable[str]"),this._addBuiltInSymbolToCurrentScope("__file__",e,"str"),this._addBuiltInSymbolToCurrentScope("__cached__",e,"str"),this._addBuiltInSymbolToCurrentScope("__dict__",e,"Dict[str, Any]"),this._addBuiltInSymbolToCurrentScope("__annotations__",e,"Dict[str, Any]"),this._addBuiltInSymbolToCurrentScope("__builtins__",e,"Any"),this._currentFlowNode=this._createStartFlowNode(),this._walkStatementsAndReportUnreachable(e.statements),h.setCodeFlowExpressions(e,this._currentExecutionScopeReferenceMap),h.setAfterFlowNode(e,this._currentFlowNode)})),this._bindDeferred(),this._potentialPrivateSymbols.forEach(((e,t)=>{var n;(null===(n=this._dunderAllNames)||void 0===n?void 0:n.some((e=>e===t)))||e.setIsExternallyHidden()})),this._dunderAllNames?h.setDunderAllInfo(e,{names:this._dunderAllNames,stringNodes:this._dunderAllStringNodes}):h.setDunderAllInfo(e,void 0);const i=h.getScope(e);if(i&&this._dunderAllNames)for(const e of this._dunderAllNames)null===(t=i.symbolTable.get(e))||void 0===t||t.setIsInDunderAll()}visitModule(e){return a.fail("We should never get here"),!1}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitModuleName(e){const t=h.getImportInfo(e);if(a.assert(void 0!==t),!t||t.isNativeLib)return!0;if(!t.isImportFound)return this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingImports,o.DiagnosticRule.reportMissingImports,u.Localizer.Diagnostic.importResolveFailure().format({importName:t.importName}),e),!0;if(!t.isStubFile&&1===t.importType&&!t.pyTypedInfo){const n=this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingTypeStubs,o.DiagnosticRule.reportMissingTypeStubs,u.Localizer.Diagnostic.stubFileMissing().format({importName:t.importName}),e);if(n){const e={action:"pyright.createtypestub",moduleName:t.importName};n.addAction(e)}}return t.isStubFile&&0!==t.importType&&t.nonStubImportResult&&!t.nonStubImportResult.isImportFound&&(this._fileInfo.isStubFile||this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingModuleSource,o.DiagnosticRule.reportMissingModuleSource,u.Localizer.Diagnostic.importSourceResolveFailure().format({importName:t.importName}),e)),!0}visitClass(e){this.walkMultiple(e.decorators);const t={type:4,node:e,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName},n=this._bindNameToScope(this._currentScope,e.name.value);n&&n.addDeclaration(t),h.setDeclaration(e,t),this.walkMultiple(e.arguments);let i=this._currentScope;for(;2===i.type;)i=i.parent;return this._createNewScope(2,i,(()=>{h.setScope(e,this._currentScope),this._addBuiltInSymbolToCurrentScope("__doc__",e,"str",!1),this._addBuiltInSymbolToCurrentScope("__module__",e,"str",!1),this._addBuiltInSymbolToCurrentScope("__name__",e,"str",!0),this._addBuiltInSymbolToCurrentScope("__qualname__",e,"str",!0),this._moduleSymbolOnly||this.walk(e.suite)})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitFunction(e){const t=this._bindNameToScope(this._currentScope,e.name.value),n=y.getEnclosingClass(e,!0),i={type:3,node:e,isMethod:!!n,isGenerator:!1,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t&&t.addDeclaration(i),h.setDeclaration(e,i),this.walkMultiple(e.decorators),e.parameters.forEach((e=>{e.defaultValue&&this.walk(e.defaultValue),e.typeAnnotation&&this.walk(e.typeAnnotation),e.typeAnnotationComment&&this.walk(e.typeAnnotationComment)})),e.returnTypeAnnotation&&this.walk(e.returnTypeAnnotation),e.functionAnnotationComment&&this.walk(e.functionAnnotationComment);let s=e.parent;for(;s&&36!==s.nodeType&&28!==s.nodeType;)s=s.parent;a.assert(void 0!==s);const r=h.getScope(s);return a.assert(void 0!==r),this._createNewScope(1,r,(()=>{h.setScope(e,this._currentScope);y.getEnclosingClass(e)&&this._addBuiltInSymbolToCurrentScope("__class__",e,"class"),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),e.parameters.forEach((e=>{if(e.name){const t=this._bindNameToScope(this._currentScope,e.name.value);if(t){const n={type:2,node:e,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n),h.setDeclaration(e.name,n)}this._createFlowAssignment(e.name)}})),this._targetFunctionDeclaration=i,this._currentReturnTarget=this._createBranchLabel(),this.walk(e.suite),h.setAfterFlowNode(e.suite,this._currentFlowNode),this._addAntecedent(this._currentReturnTarget,this._currentFlowNode);const t=this._finishFlowLabel(this._currentReturnTarget);h.setAfterFlowNode(e,t)})),h.setCodeFlowExpressions(e,this._currentExecutionScopeReferenceMap)})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitLambda(e){return e.parameters.forEach((e=>{e.defaultValue&&this.walk(e.defaultValue)})),this._createNewScope(1,this._currentScope,(()=>{h.setScope(e,this._currentScope),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),e.parameters.forEach((e=>{if(e.name){const t=this._bindNameToScope(this._currentScope,e.name.value);if(t){const n={type:2,node:e,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n),h.setDeclaration(e.name,n)}this._createFlowAssignment(e.name),this.walk(e.name)}})),this.walk(e.expression),h.setCodeFlowExpressions(e,this._currentExecutionScopeReferenceMap)}))})),!1}visitCall(e){var t,n;if(this.walk(e.leftExpression),this.walkMultiple(e.arguments),this._createCallFlowNode(e),3===this._currentScope.type&&35===e.leftExpression.nodeType&&38===e.leftExpression.leftExpression.nodeType&&"__all__"===e.leftExpression.leftExpression.value){let i=!0;if("extend"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;if(31===t.nodeType)t.entries.forEach((e=>{var t,n;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(e.strings[0]),i=!1)}));else if(35===t.nodeType&&38===t.leftExpression.nodeType&&"__all__"===t.memberName.value){const e=this._getDunderAllNamesFromImport(t.leftExpression.value);e&&e.length>0&&(e.forEach((e=>{var t;null===(t=this._dunderAllNames)||void 0===t||t.push(e)})),i=!1)}}else if("remove"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;48===t.nodeType&&1===t.strings.length&&49===t.strings[0].nodeType&&this._dunderAllNames&&(this._dunderAllNames=this._dunderAllNames.filter((e=>e!==t.strings[0].value)),this._dunderAllStringNodes=this._dunderAllStringNodes.filter((e=>e.value!==t.strings[0].value)),i=!1)}else if("append"===e.leftExpression.memberName.value&&1===e.arguments.length){const s=e.arguments[0].valueExpression;48===s.nodeType&&1===s.strings.length&&49===s.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(s.strings[0].value),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(s.strings[0]),i=!1)}i&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}return!1}visitAssignment(e){if(this._handleTypingStubAssignmentOrAnnotation(e))return!1;this._bindPossibleTupleNamedTarget(e.leftExpression),e.typeAnnotationComment&&(this.walk(e.typeAnnotationComment),this._addTypeDeclarationForVariable(e.leftExpression,e.typeAnnotationComment)),this.walk(e.rightExpression);let t=!0;if((y.getEnclosingFunction(e)||9===e.rightExpression.nodeType&&this._fileInfo.isTypingStubFile||y.isWithinLoop(e))&&(t=!1),this._addInferredTypeAssignmentForVariable(e.leftExpression,e.rightExpression,t),this._createAssignmentTargetFlowNodes(e.leftExpression,!0,!1),3===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__all__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression;this._dunderAllNames=[];let n=!1;31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):n=!0,n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}if(2===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__slots__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__slots__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression,n=[];let i=!0;48===t.nodeType?n.push(t):31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):i=!1})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):i=!1})):i=!1,i&&this._addSlotsToCurrentScope(n)}return!1}visitAssignmentExpression(e){this._disableTrueFalseTargets((()=>{this.walk(e.rightExpression)}));const t=y.getEvaluationNodeForAssignmentExpression(e);if(t){const n=h.getScope(t);let i=this._currentScope;for(;i&&i!==n;){if(i.lookUpSymbol(e.name.value)){this._addError(u.Localizer.Diagnostic.assignmentExprComprehension().format({name:e.name.value}),e.name);break}i=i.parent}this._bindNameToScope(n,e.name.value),this._addInferredTypeAssignmentForVariable(e.name,e.rightExpression),this._createAssignmentTargetFlowNodes(e.name,!0,!1)}else this._addError(u.Localizer.Diagnostic.assignmentExprContext(),e),this.walk(e.name);return!1}visitAugmentedAssignment(e){if(this.walk(e.leftExpression),this.walk(e.rightExpression),this._addInferredTypeAssignmentForVariable(e.destExpression,e.rightExpression),this._bindPossibleTupleNamedTarget(e.destExpression),this._createAssignmentTargetFlowNodes(e.destExpression,!1,!1),1===e.operator&&3===this._currentScope.type&&38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value){const t=e.rightExpression;let n=!0;if(31===t.nodeType)t.entries.forEach((e=>{var t;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0]))})),n=!1;else if(35===t.nodeType&&38===t.leftExpression.nodeType&&"__all__"===t.memberName.value){const e=this._getDunderAllNamesFromImport(t.leftExpression.value);e&&(e.forEach((e=>{var t;null===(t=this._dunderAllNames)||void 0===t||t.push(e)})),n=!1)}n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}return!1}visitDel(e){return e.expressions.forEach((e=>{this._bindPossibleTupleNamedTarget(e),this.walk(e),this._createAssignmentTargetFlowNodes(e,!1,!0)})),!1}visitTypeAnnotation(e){if(this._handleTypingStubAssignmentOrAnnotation(e))return!1;this.walk(e.typeAnnotation),this._createVariableAnnotationFlowNode(),this._bindPossibleTupleNamedTarget(e.valueExpression),this._addTypeDeclarationForVariable(e.valueExpression,e.typeAnnotation);const t=[];return this._isNarrowingExpression(e.valueExpression,t)&&t.forEach((e=>{const t=m.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(t,t)})),this.walk(e.valueExpression),!1}visitFor(e){this._bindPossibleTupleNamedTarget(e.targetExpression),this._addInferredTypeAssignmentForVariable(e.targetExpression,e),this.walk(e.iterableExpression);const t=this._createLoopLabel(),n=this._createBranchLabel(),i=this._createBranchLabel();if(this._addAntecedent(t,this._currentFlowNode),this._currentFlowNode=t,this._addAntecedent(n,this._currentFlowNode),this._createAssignmentTargetFlowNodes(e.targetExpression,!0,!1),this._bindLoopStatement(t,i,(()=>{this.walk(e.forSuite),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),e.asyncToken){const t=y.getEnclosingFunction(e);t&&t.isAsync||this._addError(u.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}return!1}visitContinue(e){return this._currentContinueTarget&&this._addAntecedent(this._currentContinueTarget,this._currentFlowNode),this._currentFlowNode=b._unreachableFlowNode,!1}visitBreak(e){return this._currentBreakTarget&&this._addAntecedent(this._currentBreakTarget,this._currentFlowNode),this._currentFlowNode=b._unreachableFlowNode,!1}visitReturn(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.returnStatements||(this._targetFunctionDeclaration.returnStatements=[]),this._targetFunctionDeclaration.returnStatements.push(e)),e.returnExpression&&this.walk(e.returnExpression),h.setFlowNode(e,this._currentFlowNode),this._currentReturnTarget&&this._addAntecedent(this._currentReturnTarget,this._currentFlowNode),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=b._unreachableFlowNode,!1}visitYield(e){return this._isInListComprehension(e)&&this._addError(u.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitYieldFrom(e){return this._isInListComprehension(e)&&this._addError(u.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitMemberAccess(e){return h.setFlowNode(e,this._currentFlowNode),!0}visitName(e){return h.setFlowNode(e,this._currentFlowNode),!1}visitIndex(e){return h.setFlowNode(e,this._currentFlowNode),!0}visitIf(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),i=this._createBranchLabel(),s=T.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);return this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===s?b._unreachableFlowNode:this._finishFlowLabel(t),this.walk(e.ifSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=!0===s?b._unreachableFlowNode:this._finishFlowLabel(n),e.elseSuite?this.walk(e.elseSuite):this._bindNeverCondition(e.testExpression,i,!1),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitWhile(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),i=this._createBranchLabel(),s=T.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases),r=this._createLoopLabel();return this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=r,this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===s?b._unreachableFlowNode:this._finishFlowLabel(t),this._bindLoopStatement(r,i,(()=>{this.walk(e.whileSuite)})),this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=!0===s?b._unreachableFlowNode:this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitAssert(e){const t=this._createBranchLabel(),n=this._createBranchLabel();return this._bindConditional(e.testExpression,t,n),e.exceptionExpression&&(this._currentFlowNode=this._finishFlowLabel(n),this.walk(e.exceptionExpression)),this._currentFlowNode=this._finishFlowLabel(t),!1}visitExcept(e){if(e.typeExpression&&this.walk(e.typeExpression),e.name){this.walk(e.name);const t=this._bindNameToScope(this._currentScope,e.name.value);if(this._createAssignmentTargetFlowNodes(e.name,!0,!1),t){const n={type:1,node:e.name,isConstant:v.isConstantName(e.name.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}return this.walk(e.exceptSuite),e.name&&this._createFlowAssignment(e.name,!0),!1}visitRaise(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.raiseStatements||(this._targetFunctionDeclaration.raiseStatements=[]),this._targetFunctionDeclaration.raiseStatements.push(e)),e.typeExpression&&this.walk(e.typeExpression),e.valueExpression&&this.walk(e.valueExpression),e.tracebackExpression&&this.walk(e.tracebackExpression),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=b._unreachableFlowNode,!1}visitTry(e){const t=e.exceptClauses.map((()=>this._createBranchLabel())),n=this._createBranchLabel(),i=this._createBranchLabel();let s=!1;const r={flags:m.FlowFlags.PreFinallyGate,id:m.getUniqueFlowNodeId(),antecedent:i,isGateClosed:!1};e.finallySuite&&this._addAntecedent(n,r);if(e.exceptClauses.some((e=>!e.typeExpression))||t.push(i),t.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),e.finallySuite&&this._finallyTargets.push(i),this._useExceptTargets(t,(()=>{this.walk(e.trySuite)})),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(n,this._currentFlowNode),this._isCodeUnreachable()||(s=!0),e.exceptClauses.forEach(((e,i)=>{this._currentFlowNode=this._finishFlowLabel(t[i]),this.walk(e),this._addAntecedent(n,this._currentFlowNode),this._isCodeUnreachable()||(s=!0)})),e.finallySuite&&this._finallyTargets.pop(),this._currentFlowNode=this._finishFlowLabel(n),e.finallySuite){this.walk(e.finallySuite);const t={flags:m.FlowFlags.PostFinally,id:m.getUniqueFlowNodeId(),finallyNode:e.finallySuite,antecedent:this._currentFlowNode,preFinallyGate:r};this._currentFlowNode=s?t:b._unreachableFlowNode}return!1}visitAwait(e){var t;const n=y.getEnclosingFunction(e);return void 0!==n&&n.isAsync||32!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&this._addError(u.Localizer.Diagnostic.awaitNotInAsync(),e),!0}visitGlobal(e){const t=this._currentScope.getGlobalScope();return e.nameList.forEach((e=>{const n=e.value;0===this._currentScope.getBindingType(n)&&this._addError(u.Localizer.Diagnostic.nonLocalRedefinition().format({name:n}),e);const i=this._currentScope.lookUpSymbolRecursive(n);i&&i.scope===this._currentScope&&this._addError(u.Localizer.Diagnostic.globalReassignment().format({name:n}),e),this._bindNameToScope(t,n),this._currentScope!==t&&this._currentScope.setBindingType(n,1)})),!0}visitNonlocal(e){const t=this._currentScope.getGlobalScope();return this._currentScope===t?this._addError(u.Localizer.Diagnostic.nonLocalInModule(),e):e.nameList.forEach((e=>{const n=e.value;1===this._currentScope.getBindingType(n)&&this._addError(u.Localizer.Diagnostic.globalRedefinition().format({name:n}),e);const i=this._currentScope.lookUpSymbolRecursive(n);i&&i.scope===this._currentScope?this._addError(u.Localizer.Diagnostic.nonLocalReassignment().format({name:n}),e):i&&i.scope!==t||this._addError(u.Localizer.Diagnostic.nonLocalNoBinding().format({name:n}),e),i&&this._currentScope.setBindingType(n,0)})),!0}visitImportAs(e){var t,n;if(e.module.nameParts.length>0){const i=e.module.nameParts[0].value;let s;s=e.alias?e.alias.value:i;const r=this._bindNameToScope(this._currentScope,s);!r||e.alias&&1===e.module.nameParts.length&&e.module.nameParts[0].value===e.alias.value||(this._fileInfo.isStubFile?r.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(s,r));const o=h.getImportInfo(e.module);a.assert(void 0!==o),r&&this._createAliasDeclarationForMultipartImportName(e,e.alias,o,r),this._createFlowAssignment(e.alias?e.alias:e.module.nameParts[0]),1===e.module.nameParts.length&&("typing"===i||"typing_extensions"===i?this._typingImportAliases.push((null===(t=e.alias)||void 0===t?void 0:t.value)||i):"sys"===i&&this._sysImportAliases.push((null===(n=e.alias)||void 0===n?void 0:n.value)||i))}return!0}visitImportFrom(e){const t=["Final","TypeAlias","ClassVar","Required","NotRequired"],n=h.getImportInfo(e.module);let i="";n&&n.isImportFound&&!n.isNativeLib&&(i=n.resolvedPaths[n.resolvedPaths.length-1]);const s=l.stripFileExtension(l.getFileName(this._fileInfo.filePath)),r="__init__"===s&&1===e.module.leadingDots&&1===e.module.nameParts.length;let a=!1;if(1===e.module.nameParts.length){const t=e.module.nameParts[0].value;"typing"!==t&&"typing_extensions"!==t||(a=!0)}if(e.isWildcardImport){if((y.getEnclosingClass(e)||y.getEnclosingFunction(e))&&this._addError(u.Localizer.Diagnostic.wildcardInFunction(),e),n){const s=[],o=this._fileInfo.importLookup(i);if(o){const t=this._getWildcardImportNames(o);if(r){t.some((t=>t===e.module.nameParts[0].value))||this._addImplicitFromImport(e,n)}t.forEach((t=>{const r=this._bindNameToScope(this._currentScope,t);if(r){if(o.symbolTable.get(t)){const n={type:6,node:e,path:i,range:p.getEmptyRange(),usesLocalName:!1,symbolName:t,moduleName:this._fileInfo.moduleName};r.addDeclaration(n),s.push(t)}else if(n&&n.filteredImplicitImports){const s=n.filteredImplicitImports.find((e=>e.name===t));if(s){const n={type:6,node:e,path:s.path,range:p.getEmptyRange(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},a={type:6,node:e,path:i,usesLocalName:!1,symbolName:t,submoduleFallback:n,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName};r.addDeclaration(a)}}}}))}this._createFlowWildcardImport(e,s),a&&t.forEach((e=>{this._typingSymbolAliases.set(e,e)}))}}else r&&this._addImplicitFromImport(e,n),e.imports.forEach((r=>{const o=r.name.value,l=r.alias||r.name,c=this._bindNameToScope(this._currentScope,l.value);if(c){let d,u;e.module.nameParts.length>0&&(r.alias&&r.alias.value===r.name.value||(this._fileInfo.isStubFile?c.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(l.value,c))),n&&n.filteredImplicitImports&&(d=n.filteredImplicitImports.find((e=>e.name===o))),d&&(u={type:6,node:r,path:d.path,range:p.getEmptyRange(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},"__init__"===s&&1===e.module.leadingDots&&0===e.module.nameParts.length&&(i=""));const h={type:6,node:r,path:i,usesLocalName:!!r.alias,symbolName:o,submoduleFallback:u,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName};c.addDeclaration(h),this._createFlowAssignment(r.alias||r.name),a&&t.some((e=>e===r.name.value))&&this._typingSymbolAliases.set(l.value,r.name.value)}}));return!0}visitWith(e){e.withItems.forEach((e=>{this.walk(e.expression),e.target&&(this._bindPossibleTupleNamedTarget(e.target),this._addInferredTypeAssignmentForVariable(e.target,e),this._createAssignmentTargetFlowNodes(e.target,!0,!1))}));const t=this._createContextManagerLabel(e.withItems.map((e=>e.expression)),!!e.isAsync);this._addAntecedent(t,this._currentFlowNode);const n=this._createBranchLabel();if(this._addAntecedent(n,t),this._useExceptTargets([t],(()=>{this.walk(e.suite)})),this._addAntecedent(n,this._currentFlowNode),this._currentFlowNode=n,e.asyncToken){const t=y.getEnclosingFunction(e);t&&t.isAsync||this._addError(u.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}return!1}visitTernary(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),i=this._createBranchLabel();return this._bindConditional(e.testExpression,t,n),this._currentFlowNode=this._finishFlowLabel(t),this.walk(e.ifExpression),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(n),this.walk(e.elseExpression),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitUnaryOperation(e){return 38===e.operator&&this._currentFalseTarget&&this._currentTrueTarget?this._bindConditional(e.expression,this._currentFalseTarget,this._currentTrueTarget):this._disableTrueFalseTargets((()=>{this.walk(e.expression)})),!1}visitBinaryOperation(e){if(36===e.operator||37===e.operator){let t,n=this._currentTrueTarget,i=this._currentFalseTarget;n&&i||(t=this._createBranchLabel(),n=i=t);const s=this._createBranchLabel();36===e.operator?this._bindConditional(e.leftExpression,s,i):this._bindConditional(e.leftExpression,n,s),this._currentFlowNode=this._finishFlowLabel(s),this._bindConditional(e.rightExpression,n,i),t&&(this._currentFlowNode=this._finishFlowLabel(t))}else this._disableTrueFalseTargets((()=>{this.walk(e.leftExpression),this.walk(e.rightExpression)}));return!1}visitListComprehension(e){const t=y.getEnclosingFunction(e);return this._createNewScope(0,this._currentScope,(()=>{var n;h.setScope(e,this._currentScope);const i=this._createBranchLabel(),s=[];for(let i=0;i{const t=m.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(t,t)}));const i=this._createBranchLabel();let s=!1;return e.cases.forEach((t=>{const r=this._createBranchLabel(),a=this._createBranchLabel(),o=this._createBranchLabel();this._addAntecedent(a,this._currentFlowNode),t.isIrrefutable?t.guardExpression||(s=!0):this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(a),this.walk(t.pattern),n&&this._createFlowNarrowForPattern(e.subjectExpression,t),t.guardExpression?this._bindConditional(t.guardExpression,o,r):this._addAntecedent(o,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(o),this.walk(t.suite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(r)})),n&&(this._createFlowNarrowForPattern(e.subjectExpression,e),s||this._createFlowExhaustedMatch(e)),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitPatternAs(e){const t=this._createBranchLabel();if(e.orPatterns.forEach((e=>{this.walk(e),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(t),e.target){this.walk(e.target);const t=this._bindNameToScope(this._currentScope,e.target.value);if(this._createAssignmentTargetFlowNodes(e.target,!1,!1),t){const n={type:1,node:e.target,isConstant:v.isConstantName(e.target.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.target.start,d.TextRange.getEnd(e.target),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}return!1}visitPatternCapture(e){return e.isWildcard||this._addPatternCaptureTarget(e.target),!0}visitPatternMappingExpandEntry(e){return"_"!==e.target.value&&this._addPatternCaptureTarget(e.target),!0}_addSlotsToCurrentScope(e){a.assert(2===this._currentScope.type);let t=!1;for(const n of e){const e=n.strings[0].value;if("__dict__"===e){t=!0;continue}let i=this._currentScope.lookUpSymbol(e);if(!i){i=this._currentScope.addSymbol(e,13);const t="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;v.isPrivateOrProtectedName(e)&&t&&i.setIsPrivateMember()}const s={type:1,node:n,isConstant:v.isConstantName(e),isDefinedBySlots:!0,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(n.start,n.start+n.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName};i.addDeclaration(s)}t||this._currentScope.setSlotsNames(e.map((e=>e.strings[0].value)))}_isInListComprehension(e){let t=e;for(;t;){if(32===t.nodeType)return!0;t=t.parent}return!1}_addPatternCaptureTarget(e){const t=this._bindNameToScope(this._currentScope,e.value);if(this._createAssignmentTargetFlowNodes(e,!1,!1),t){const n={type:1,node:e,isConstant:v.isConstantName(e.value),inferredTypeSource:e.parent,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}_useExceptTargets(e,t){const n=this._currentExceptTargets;this._currentExceptTargets=e,t(),this._currentExceptTargets=n}_disableTrueFalseTargets(e){const t=this._currentTrueTarget,n=this._currentFalseTarget;this._currentTrueTarget=void 0,this._currentFalseTarget=void 0,e(),this._currentFalseTarget=n,this._currentTrueTarget=t}_getDunderAllNamesFromImport(e){var t;const n=this._currentScope.lookUpSymbol(e);if(!n)return;const i=n.getDeclarations().find((e=>6===e.type)),s=(null==i?void 0:i.path)||(null===(t=null==i?void 0:i.submoduleFallback)||void 0===t?void 0:t.path);if(!s)return;const r=this._fileInfo.importLookup(s);return r?r.dunderAllNames:void 0}_addImplicitFromImport(e,t){const n=e.module.nameParts[0].value,i=this._bindNameToScope(this._currentScope,n);i&&this._createAliasDeclarationForMultipartImportName(e,void 0,t,i),this._createFlowAssignment(e.module.nameParts[0])}_createAliasDeclarationForMultipartImportName(e,t,n,i){const s=e.module.nameParts[0].value;if(n&&n.isImportFound&&!n.isNativeLib&&n.resolvedPaths.length>0){const r=i.getDeclarations().find((e=>6===e.type&&e.firstNamePart===s));let a;if(a=r||{type:6,node:e,path:"",moduleName:n.importName,range:p.getEmptyRange(),firstNamePart:s,usesLocalName:!!t},t||1===e.module.nameParts.length)a.path=n.resolvedPaths[n.resolvedPaths.length-1],this._addImplicitImportsToLoaderActions(n,a);else{let t=a;for(let i=1;i=n.resolvedPaths.length);i++){const s=e.module.nameParts[i].value;let r=t.implicitImports?t.implicitImports.get(s):void 0;r||(r={path:"",implicitImports:new Map},t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(s,r)),i===e.module.nameParts.length-1&&(r.path=n.resolvedPaths[i],this._addImplicitImportsToLoaderActions(n,r)),t=r}}r||i.addDeclaration(a)}else{const n={type:6,node:e,path:"*** unresolved ***",range:p.getEmptyRange(),usesLocalName:!!t,moduleName:"",isUnresolved:!0};i.addDeclaration(n)}}_getWildcardImportNames(e){if(e.dunderAllNames)return e.dunderAllNames;const t=[];return e.symbolTable.forEach(((e,n)=>{e.isExternallyHidden()||t.push(n)})),t}_walkStatementsAndReportUnreachable(e){let t=!1;for(const n of e)if(h.setFlowNode(n,this._currentFlowNode),t||(t=this._isCodeUnreachable()),t){if(this._targetFunctionDeclaration&&!this._targetFunctionDeclaration.isGenerator){(new I).checkContainsYield(n)&&(this._targetFunctionDeclaration.isGenerator=!0)}}else this.walk(n);return!1}_createStartFlowNode(){return{flags:m.FlowFlags.Start,id:m.getUniqueFlowNodeId()}}_createBranchLabel(){return{flags:m.FlowFlags.BranchLabel,id:m.getUniqueFlowNodeId(),antecedents:[]}}_createFlowNarrowForPattern(e,t){const n={flags:m.FlowFlags.NarrowForPattern,id:m.getUniqueFlowNodeId(),subjectExpression:e,statement:t,antecedent:this._currentFlowNode};this._currentFlowNode=n}_createContextManagerLabel(e,t){return{flags:m.FlowFlags.PostContextManager|m.FlowFlags.BranchLabel,id:m.getUniqueFlowNodeId(),antecedents:[],expressions:e,isAsync:t}}_createLoopLabel(){return{flags:m.FlowFlags.LoopLabel,id:m.getUniqueFlowNodeId(),antecedents:[]}}_finishFlowLabel(e){return 0===e.antecedents.length?b._unreachableFlowNode:1===e.antecedents.length&&e.flags===m.FlowFlags.BranchLabel?e.antecedents[0]:e}_bindNeverCondition(e,t,n){const i=[];if(55===e.nodeType&&38===e.operator)this._bindNeverCondition(e.expression,t,!n);else if(7!==e.nodeType||36!==e.operator&&37!==e.operator){if(this._isNarrowingExpression(e,i,!0)){i.filter((e=>38===e.nodeType)).length>0&&(this._currentFlowNode=this._createFlowConditional(n?m.FlowFlags.TrueNeverCondition:m.FlowFlags.FalseNeverCondition,this._currentFlowNode,e))}this._addAntecedent(t,this._currentFlowNode)}else if(36===e.operator){const i=this._currentFlowNode;this._bindNeverCondition(e.leftExpression,t,n),this._currentFlowNode=i,this._bindNeverCondition(e.rightExpression,t,n)}else{const i=this._currentFlowNode,s=this._createBranchLabel();if(this._bindNeverCondition(e.leftExpression,s,n),i!==this._currentFlowNode){this._currentFlowNode=this._finishFlowLabel(s);const r=this._currentFlowNode;this._bindNeverCondition(e.rightExpression,t,n),r===this._currentFlowNode&&(this._currentFlowNode=i)}}}_bindConditional(e,t,n){const i=this._currentTrueTarget,s=this._currentFalseTarget;this._currentTrueTarget=t,this._currentFalseTarget=n,this.walk(e),this._currentTrueTarget=i,this._currentFalseTarget=s,this._isLogicalExpression(e)||(this._addAntecedent(t,this._createFlowConditional(m.FlowFlags.TrueCondition,this._currentFlowNode,e)),this._addAntecedent(n,this._createFlowConditional(m.FlowFlags.FalseCondition,this._currentFlowNode,e)))}_createFlowConditional(e,t,n){if(t.flags&m.FlowFlags.Unreachable)return t;const i=T.evaluateStaticBoolLikeExpression(n,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);if(!0===i&&e&m.FlowFlags.FalseCondition||!1===i&&e&m.FlowFlags.TrueCondition)return b._unreachableFlowNode;const s=[];if(!this._isNarrowingExpression(n,s))return t;s.forEach((e=>{const t=m.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(t,t)}));const r=s.filter((e=>38===e.nodeType)),a={flags:e,id:m.getUniqueFlowNodeId(),reference:r.length>0?r[0]:void 0,expression:n,antecedent:t};return this._addExceptTargets(a),a}_isLogicalExpression(e){switch(e.nodeType){case 55:return 38===e.operator;case 7:return 36===e.operator||37===e.operator}return!1}_isNarrowingExpression(e,t,n=!1,i=!1){switch(e.nodeType){case 38:case 35:case 24:if(n){if(38!==e.nodeType)return!1;if(!i)return!1}return!!m.isCodeFlowSupportedForReference(e)&&(t.push(e),!0);case 4:return t.push(e.name),!0;case 7:{const i=39===e.operator||40===e.operator,s=12===e.operator||28===e.operator;if(i||s){if(11===e.rightExpression.nodeType&&26===e.rightExpression.constType)return this._isNarrowingExpression(e.leftExpression,t,n,!0);if(i&&9===e.leftExpression.nodeType&&38===e.leftExpression.leftExpression.nodeType&&"type"===e.leftExpression.leftExpression.value&&1===e.leftExpression.arguments.length&&0===e.leftExpression.arguments[0].argumentCategory)return this._isNarrowingExpression(e.leftExpression.arguments[0].valueExpression,t,n,!0);const r=this._isNarrowingExpression(e.leftExpression,t,n,!0);if(i)return r;if(s){const i=this._isNarrowingExpression(e.rightExpression,t,n,!0);return r||i}}return!(41!==e.operator&&42!==e.operator||!this._isNarrowingExpression(e.rightExpression,t,n,!0))||41===e.operator&&this._isNarrowingExpression(e.leftExpression,t,n,!0)}case 55:return 38===e.operator&&this._isNarrowingExpression(e.expression,t,n,!1);case 5:return this._isNarrowingExpression(e.rightExpression,t,n,!0);case 9:if(38===e.leftExpression.nodeType&&("isinstance"===e.leftExpression.value||"issubclass"===e.leftExpression.value)&&2===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(38===e.leftExpression.nodeType&&"callable"===e.leftExpression.value&&1===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(e.arguments.length>=1)return!n&&this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0)}return!1}_createAssignmentTargetFlowNodes(e,t,n){switch(e.nodeType){case 38:case 35:case 24:this._createFlowAssignment(e,n),t&&this.walk(e);break;case 52:e.expressions.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;case 54:this._createAssignmentTargetFlowNodes(e.valueExpression,!1,n),t&&this.walk(e);break;case 56:this._createAssignmentTargetFlowNodes(e.expression,!1,n),t&&this.walk(e);break;case 31:e.entries.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;default:t&&this.walk(e)}}_createCallFlowNode(e){if(!this._isCodeUnreachable()){const t={flags:m.FlowFlags.Call,id:m.getUniqueFlowNodeId(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}h.setFlowNode(e,this._currentFlowNode),this._isCodeUnreachable()||this._addExceptTargets(this._currentFlowNode)}_createAssignmentAliasFlowNode(e,t){if(!this._isCodeUnreachable()){const n={flags:m.FlowFlags.AssignmentAlias,id:m.getUniqueFlowNodeId(),antecedent:this._currentFlowNode,targetSymbolId:e,aliasSymbolId:t};this._currentFlowNode=n}}_createVariableAnnotationFlowNode(){if(!this._isCodeUnreachable()){const e={flags:m.FlowFlags.VariableAnnotation,id:m.getUniqueFlowNodeId(),antecedent:this._currentFlowNode};this._currentFlowNode=e}}_createFlowAssignment(e,t=!1){let n=_.indeterminateSymbolId;if(38===e.nodeType){const t=this._currentScope.lookUpSymbolRecursive(e.value);a.assert(void 0!==t),n=t.symbol.id}const i=this._currentFlowNode;if(!this._isCodeUnreachable()&&m.isCodeFlowSupportedForReference(e)){const i={flags:m.FlowFlags.Assignment,id:m.getUniqueFlowNodeId(),node:e,antecedent:this._currentFlowNode,targetSymbolId:n},s=m.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(s,s),t&&(i.flags|=m.FlowFlags.Unbind),35===e.nodeType&&this._addExceptTargets(i),this._currentFlowNode=i}t&&void 0!==h.getFlowNode(e)||h.setFlowNode(e,t?i:this._currentFlowNode)}_createFlowWildcardImport(e,t){if(!this._isCodeUnreachable()){const n={flags:m.FlowFlags.WildcardImport,id:m.getUniqueFlowNodeId(),node:e,names:t,antecedent:this._currentFlowNode};this._addExceptTargets(n),this._currentFlowNode=n}h.setFlowNode(e,this._currentFlowNode)}_createFlowExhaustedMatch(e){if(!this._isCodeUnreachable()){const t={flags:m.FlowFlags.ExhaustedMatch,id:m.getUniqueFlowNodeId(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}h.setFlowNode(e,this._currentFlowNode)}_isCodeUnreachable(){return!!(this._currentFlowNode.flags&m.FlowFlags.Unreachable)}_addExceptTargets(e){this._currentExceptTargets&&this._currentExceptTargets.forEach((t=>{this._addAntecedent(t,e)}))}_bindLoopStatement(e,t,n){const i=this._currentContinueTarget,s=this._currentBreakTarget;this._currentContinueTarget=e,this._currentBreakTarget=t,n(),this._currentContinueTarget=i,this._currentBreakTarget=s}_addAntecedent(e,t){this._currentFlowNode.flags&m.FlowFlags.Unreachable||e.antecedents.some((e=>e.id===t.id))||e.antecedents.push(t)}_bindNameToScope(e,t,n){const i=this._currentScope.getBindingType(t);if(void 0===i){let i=e.lookUpSymbol(t);if(i)i.setIsNotExclusiveClassMember();else{if(i=e.addSymbol(t,5),2===e.type){const n=e.parent.lookUpSymbol(t);n&&this._createAssignmentAliasFlowNode(i.id,n.id)}v.isPrivateOrProtectedName(t)&&(this._fileInfo.isStubFile||v.isPrivateName(t)?i.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(t,i)),n&&n.set(t,i)}return i}{const e=(0===i?this._currentScope.parent:this._currentScope.getGlobalScope()).lookUpSymbolRecursive(t);if(e)return e.symbol}}_bindPossibleTupleNamedTarget(e,t){switch(e.nodeType){case 38:this._bindNameToScope(this._currentScope,e.value,t);break;case 52:e.expressions.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 31:e.entries.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 54:this._bindPossibleTupleNamedTarget(e.valueExpression,t);break;case 56:this._bindPossibleTupleNamedTarget(e.expression,t)}}_addBuiltInSymbolToCurrentScope(e,t,n,i=!1){const s=this._addSymbolToCurrentScope(e,!1);s&&(s.addDeclaration({type:0,node:t,intrinsicType:n,path:this._fileInfo.filePath,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName}),s.setIsIgnoredForProtocolMatch(),i&&s.setIsExclusiveClassMember())}_addSymbolToCurrentScope(e,t){let n=this._currentScope.lookUpSymbol(e);if(n)n.setIsNotExclusiveClassMember();else{let i=0;t&&(i|=1),2===this._currentScope.type&&(i|=4),this._fileInfo.isStubFile&&v.isPrivateOrProtectedName(e)&&(i|=2),n=this._currentScope.addSymbol(e,i)}return n}_createNewScope(e,t,n){const i=this._currentScope,s=new f.Scope(e,t);this._currentScope=s;const r=4===e||3===e||1===e,a=this._currentExecutionScopeReferenceMap;return r&&(this._currentExecutionScopeReferenceMap=new Map),n(),this._currentExecutionScopeReferenceMap=a,this._currentScope=i,s}_addInferredTypeAssignmentForVariable(e,t,n=!1){switch(e.nodeType){case 38:{const i=e,s=this._currentScope.lookUpSymbolRecursive(i.value);if(s&&s.symbol){const r={type:1,node:e,isConstant:v.isConstantName(e.value),inferredTypeSource:t,typeAliasName:n?e:void 0,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(i.start,d.TextRange.getEnd(i),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.symbol.addDeclaration(r)}break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const i=e.memberName;let s=n.classScope.lookUpSymbol(i.value);if(!s){s=n.classScope.addSymbol(i.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;v.isPrivateOrProtectedName(i.value)&&e&&s.setIsPrivateMember()}n.isInstanceMember?s.isClassMember()&&s.getDeclarations().some((e=>3===e.type&&e.isMethod))||s.setIsInstanceMember():s.setIsClassMember();const r={type:1,node:e.memberName,isConstant:v.isConstantName(i.value),inferredTypeSource:t,isDefinedByMemberAccess:!0,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.addDeclaration(r)}break}case 52:e.expressions.forEach((e=>{this._addInferredTypeAssignmentForVariable(e,t)}));break;case 54:this._addInferredTypeAssignmentForVariable(e.valueExpression,t);break;case 56:this._addInferredTypeAssignmentForVariable(e.expression,t);break;case 31:e.entries.forEach((e=>{this._addInferredTypeAssignmentForVariable(e,t)}))}}_addTypeDeclarationForVariable(e,t){var n,i,s;let r=!1;switch(e.nodeType){case 38:{const a=e,o=this._currentScope.lookUpSymbolRecursive(a.value);if(o&&o.symbol){const r=this._isAnnotationFinal(t),l=this._isAnnotationTypeAlias(t);let p=t;l?(p=void 0,3!==this._currentScope.type&&this._addError(u.Localizer.Diagnostic.typeAliasNotInModule(),t)):r.isFinal&&(p=r.finalTypeNode);const h={type:1,node:e,isConstant:v.isConstantName(a.value),isFinal:r.isFinal,isRequired:this._isRequiredAnnotation(p),isNotRequired:this._isNotRequiredAnnotation(p),typeAliasAnnotation:l?t:void 0,typeAliasName:l?e:void 0,path:this._fileInfo.filePath,typeAnnotationNode:p,range:c.convertOffsetsToRange(a.start,d.TextRange.getEnd(a),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};o.symbol.addDeclaration(h);let m=24===t.nodeType&&this._isTypingAnnotation(t.baseExpression,"ClassVar");if(r.isFinal){const t=y.getEnclosingClassOrFunction(e);t&&10===t.nodeType&&(3!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&3!==(null===(s=null===(i=e.parent)||void 0===i?void 0:i.parent)||void 0===s?void 0:s.nodeType)||(m=!0))}m?o.symbol.setIsClassVar():o.symbol.setIsInstanceMember()}r=!0;break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const i=e.memberName;let s=n.classScope.lookUpSymbol(i.value);if(!s){s=n.classScope.addSymbol(i.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;v.isPrivateOrProtectedName(i.value)&&e&&s.setIsPrivateMember()}n.isInstanceMember?s.setIsInstanceMember():s.setIsClassMember();const a=this._isAnnotationFinal(t),o={type:1,node:e.memberName,isConstant:v.isConstantName(i.value),isDefinedByMemberAccess:!0,isFinal:a.isFinal,path:this._fileInfo.filePath,typeAnnotationNode:a.isFinal?a.finalTypeNode:t,range:c.convertOffsetsToRange(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.addDeclaration(o),r=!0}break}}r||this._addError(u.Localizer.Diagnostic.annotationNotSupported(),t)}_isTypingAnnotation(e,t){if(38===e.nodeType){if(this._typingSymbolAliases.get(e.value)===t)return!0}else if(35===e.nodeType&&38===e.leftExpression.nodeType&&e.memberName.value===t){const t=e.leftExpression.value;return this._typingImportAliases.some((e=>e===t))}return!1}_getVariableDocString(e){var t,n,i,s;let r,a=e;for(;a&&3!==a.nodeType;)54!==a.nodeType||r||(r=a),a=a.parent;if(3!==(null==a?void 0:a.nodeType)){if(!r)return;a=r}const o=a.parent;if(47!==(null==o?void 0:o.nodeType))return;const l=o.parent;if(!l||36!==l.nodeType&&50!==l.nodeType)return;const c=l.statements.findIndex((e=>e===o));if(c<0||c===l.statements.length-1)return;const p=l.statements[c+1];if(47!==p.nodeType||0===p.statements.length||48!==p.statements[0].nodeType)return;const d=p.statements[0].strings;if(d.some((e=>0!=(64&e.token.flags))))return;let u=!1;if(36===(null===(t=null==o?void 0:o.parent)||void 0===t?void 0:t.nodeType))u=!0;else if(50===(null===(n=null==o?void 0:o.parent)||void 0===n?void 0:n.nodeType)&&10===(null===(s=null===(i=null==o?void 0:o.parent)||void 0===i?void 0:i.parent)||void 0===s?void 0:s.nodeType))u=!0;else{const e=y.getEnclosingFunction(o);e&&"__init__"===e.name.value&&y.getEnclosingClass(e,!0)&&(u=!0)}return u?1===d.length?d[0].value:d.map((e=>e.value)).join(""):void 0}_isAnnotationFinal(e){let t,n=!1;if(e)if(this._isTypingAnnotation(e,"Final"))n=!0;else if(24===e.nodeType&&1===e.items.length){!this._isAnnotationFinal(e.baseExpression).isFinal||0!==e.items[0].argumentCategory||e.items[0].name||e.trailingComma||(n=!0,t=e.items[0].valueExpression)}return{isFinal:n,finalTypeNode:t}}_isRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"Required"))}_isNotRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"NotRequired"))}_isAnnotationTypeAlias(e){return!!e&&this._isTypingAnnotation(e,"TypeAlias")}_getMemberAccessInfo(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value,n=y.getEnclosingFunction(e);if(!n)return;const i=y.getEnclosingClass(n);if(!i)return;let s=!1;if(n.parameters.length<1||!n.parameters[0].name)return;const r=i.name.value,o=n.parameters[0].name.value;if(t===r)s=!1;else{if(t!==o)return;if("__new__"===n.name.value)s=!1;else{s=!0;for(const e of n.decorators)if(38===e.expression.nodeType){const t=e.expression.value;if("staticmethod"===t)return;if("classmethod"===t){s=!1;break}}}}const l=h.getScope(i);return a.assert(void 0!==l),{classNode:i,methodNode:n,classScope:l,isInstanceMember:s}}_addImplicitImportsToLoaderActions(e,t){e.filteredImplicitImports.forEach((e=>{const n=t.implicitImports?t.implicitImports.get(e.name):void 0;n?n.path=e.path:(t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(e.name,{path:e.path,implicitImports:new Map}))}))}_handleTypingStubAssignmentOrAnnotation(e){if(!this._fileInfo.isTypingStubFile)return!1;let t;if(54===e.nodeType)t=e;else{if(54!==e.leftExpression.nodeType)return!1;t=e.leftExpression}if(38!==t.valueExpression.nodeType)return!1;const n=t.valueExpression,i=new Map([["Tuple",!0],["Generic",!0],["Protocol",!0],["Callable",!0],["Type",!0],["ClassVar",!0],["Final",!0],["Literal",!0],["TypedDict",!0],["Union",!0],["Optional",!0],["Annotated",!0],["TypeAlias",!0],["OrderedDict",!0],["Concatenate",!0],["TypeGuard",!0],["Unpack",!0]]),s=n.value;if(!i.has(s))return!1;const r=this._bindNameToScope(this._currentScope,s);return r&&r.addDeclaration({type:5,node:t,path:this._fileInfo.filePath,range:c.convertOffsetsToRange(t.start,d.TextRange.getEnd(t),this._fileInfo.lines),moduleName:this._fileInfo.moduleName}),!0}_deferBinding(e){this._moduleSymbolOnly||this._deferredBindingTasks.push({scope:this._currentScope,codeFlowExpressionMap:this._currentExecutionScopeReferenceMap,callback:e})}_bindDeferred(){for(;this._deferredBindingTasks.length>0;){const e=this._deferredBindingTasks.shift();this._currentScope=e.scope,this._currentExecutionScopeReferenceMap=e.codeFlowExpressionMap,e.callback()}}_bindYield(e){const t=y.getEnclosingFunction(e);t?t.isAsync&&61===e.nodeType&&this._addError(u.Localizer.Diagnostic.yieldFromOutsideAsync(),e):y.getEnclosingLambda(e)||this._addError(u.Localizer.Diagnostic.yieldOutsideFunction(),e),this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.yieldStatements||(this._targetFunctionDeclaration.yieldStatements=[]),this._targetFunctionDeclaration.yieldStatements.push(e),this._targetFunctionDeclaration.isGenerator=!0),e.expression&&this.walk(e.expression),h.setFlowNode(e,this._currentFlowNode)}_addDiagnostic(e,t,n,i){let s;switch(e){case"error":s=this._addError(n,i);break;case"warning":s=this._addWarning(n,i);break;case"information":s=this._addInformation(n,i);break;case"none":break;default:return a.assertNever(e,`${e} is not expected`)}return s&&s.setRule(t),s}_addError(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("error",e,t)}_addWarning(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("warning",e,t)}_addInformation(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("information",e,t)}}t.Binder=b,b._unreachableFlowNode={flags:m.FlowFlags.Unreachable,id:m.getUniqueFlowNodeId()};class I extends g.ParseTreeWalker{constructor(){super(...arguments),this._containsYield=!1}checkContainsYield(e){return this.walk(e),this._containsYield}visitYield(e){return this._containsYield=!0,!1}visitYieldFrom(e){return this._containsYield=!0,!1}}t.YieldFinder=I;class C extends g.ParseTreeWalker{constructor(){super(...arguments),this._containsReturn=!1}checkContainsReturn(e){return this.walk(e),this._containsReturn}visitReturn(e){return this._containsReturn=!0,!1}}t.ReturnFinder=C},51153:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Checker=void 0;const a=n(20823),o=n(24319),l=n(15741),c=n(80957),p=n(74426),d=n(55390),u=n(78722),h=r(n(35696)),m=n(88023),y=n(45214),g=r(n(23241)),f=n(22339),T=n(57203),_=n(67737),v=r(n(91197)),b=n(15020),I=n(59195),C=n(10425),S=n(20670);class D extends f.ParseTreeWalker{constructor(e,t){super(),this._scopedNodes=[],this._moduleNode=e,this._fileInfo=h.getFileInfo(e),this._evaluator=t}check(){this._scopedNodes.push(this._moduleNode),this._walkStatementsAndReportUnreachable(this._moduleNode.statements);const e=h.getDunderAllInfo(this._moduleNode);e&&(this._evaluator.markNamesAccessed(this._moduleNode,e.names),this._reportUnusedDunderAllSymbols(e.stringNodes)),this._validateSymbolTables(),this._reportDuplicateImports()}walk(e){h.isCodeUnreachable(e)?this._evaluator.suppressDiagnostics(e,(()=>{super.walk(e)})):super.walk(e)}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitStatementList(e){return e.statements.forEach((e=>{d.isExpressionNode(e)&&this._evaluator.getType(e)})),!0}visitClass(e){const t=this._evaluator.getTypeOfClass(e);return this.walk(e.suite),this.walkMultiple(e.decorators),this.walkMultiple(e.arguments),t&&(I.ClassType.isProtocolClass(t.classType)&&(e.arguments.forEach((e=>{if(!e.name){const n=this._evaluator.getType(e.valueExpression);n&&I.isInstantiableClass(n)&&!I.ClassType.isBuiltIn(n,"Protocol")&&(I.ClassType.isProtocolClass(n)||this._evaluator.addError(p.Localizer.Diagnostic.protocolBaseClass().format({classType:this._evaluator.printType(t.classType,!1),baseType:this._evaluator.printType(n,!1)}),e.valueExpression))}})),this._validateProtocolTypeParamVariance(e,t.classType)),this._fileInfo.isStubFile||(this._validateBaseClassOverrides(t.classType),this._validateSlotsClassVarConflict(t.classType)),this._validateFinalMemberOverrides(t.classType),this._validateInstanceVariableInitialization(t.classType),this._validateFinalClassNotAbstract(t.classType,e),I.ClassType.isTypedDictClass(t.classType)&&this._validateTypedDictClassSuite(e.suite)),this._scopedNodes.push(e),!1}visitFunction(e){var t;const n=this._evaluator.getTypeOfFunction(e),i=g.getEnclosingClass(e,!0);if(n){let s=!1;e.parameters.forEach(((e,t)=>{if(e.name)if(1===e.category){const t=e.typeAnnotation||e.typeAnnotationComment;if(t&&35===t.nodeType&&"args"===t.memberName.value){const e=this._evaluator.getType(t.leftExpression);e&&I.isTypeVar(e)&&e.details.isParamSpec&&(s=!0)}}else 2===e.category&&(s=!1);if(e.name&&0===e.category&&s&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.namedParamAfterParamSpecArgs().format({name:e.name.value}),e.name),e.name&&"_"!==e.name.value&&t{const i=n.functionType.details.parameters[t];if(i.typeAnnotation&&I.isTypeVar(i.type)&&I.isParamSpec(i.type)&&0!==i.category){const e=48===i.typeAnnotation.nodeType?i.typeAnnotation.typeAnnotation:i.typeAnnotation;if(35===(null==e?void 0:e.nodeType))return!0}return!1}));if(1===r.length&&this._evaluator.addError(p.Localizer.Diagnostic.paramSpecArgsKwargsUsage(),r[0].typeAnnotation||r[0].typeAnnotationComment),this._fileInfo.isStubFile){e.returnTypeAnnotation||(null===(t=e.functionAnnotationComment)||void 0===t?void 0:t.returnTypeAnnotation)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.returnTypeUnknown(),e.name)}i&&this._validateMethod(e,n.functionType,i)}if(e.parameters.forEach(((e,t)=>{if(e.defaultValue&&this.walk(e.defaultValue),e.typeAnnotation&&this.walk(e.typeAnnotation),e.typeAnnotationComment&&this.walk(e.typeAnnotationComment),n){const i=e.typeAnnotation||e.typeAnnotationComment;if(i){const e=n.functionType.details.parameters[t].type;I.isTypeVar(e)&&1===e.details.variance&&!e.details.isSynthesized&&"__init__"!==n.functionType.details.name&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.paramTypeCovariant(),i)}}})),e.returnTypeAnnotation&&this.walk(e.returnTypeAnnotation),e.functionAnnotationComment&&this.walk(e.functionAnnotationComment),this.walkMultiple(e.decorators),e.parameters.forEach((e=>{e.name&&this.walk(e.name)})),this.walk(e.suite),n&&(this._validateFunctionReturn(e,n.functionType),this._validateDunderSignatures(e,n.functionType,void 0!==i)),this._fileInfo.isStubFile&&"__getattr__"===e.name.value){const t=T.getScopeForNode(e);3===(null==t?void 0:t.type)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompleteStub,l.DiagnosticRule.reportIncompleteStub,p.Localizer.Diagnostic.stubUsesGetAttr(),e.name)}if(this._scopedNodes.push(e),this._validateFunctionTypeVarUsage(e),n&&I.isOverloadedFunction(n.decoratedType)){const t=n.decoratedType.overloads;if(t.length>1){const n=100;t.length{if(e.name){const t=this._evaluator.getType(e.name);t&&(I.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name):C.isPartlyUnknown(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value}),e.name))}}));const t=this._evaluator.getType(e.expression);return t&&(I.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.lambdaReturnTypeUnknown(),e.expression):C.isPartlyUnknown(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.lambdaReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!0)}),e.expression)),this._scopedNodes.push(e),!1}visitCall(e){var t;if(this._validateIsInstanceCall(e),g.isWithinDefaultParamInitializer(e)&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportCallInDefaultInitializer,l.DiagnosticRule.reportCallInDefaultInitializer,p.Localizer.Diagnostic.defaultValueContainsCall(),e),("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult||"none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine)&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=this._evaluator.getType(e);t&&this._isTypeValidForUnusedValueTest(t)&&(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,p.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(t,!1)}),e),I.isClassInstance(t)&&I.ClassType.isBuiltIn(t,"Coroutine")&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine,l.DiagnosticRule.reportUnusedCoroutine,p.Localizer.Diagnostic.unusedCoroutine(),e))}return!0}visitAwait(e){var t;if("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&9===e.expression.nodeType){const t=this._evaluator.getType(e);t&&this._isTypeValidForUnusedValueTest(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,p.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(t,!1)}),e)}return!0}visitFor(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitListComprehension(e){return this._scopedNodes.push(e),!0}visitIf(e){return this._evaluator.getType(e.testExpression),!0}visitWhile(e){return this._evaluator.getType(e.testExpression),!0}visitWith(e){return e.withItems.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)})),!0}visitReturn(e){let t;const n=g.getEnclosingFunction(e),i=n?this._evaluator.getFunctionDeclaredReturnType(n):void 0;if(t=e.returnExpression?this._evaluator.getType(e.returnExpression)||I.UnknownType.create():I.NoneType.createInstance(),this._evaluator.isNodeReachable(e)&&n){if(i)if(C.isNoReturnType(i))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnContainsReturn(),e);else{const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(i,t,n,void 0,64)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.returnTypeMismatch().format({exprType:this._evaluator.printType(t,!1),returnType:this._evaluator.printType(i,!1)})+n.getString(),e.returnExpression?e.returnExpression:e)}I.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.returnTypeUnknown(),e.returnExpression):C.isPartlyUnknown(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.returnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!0)}),e.returnExpression)}return!0}visitYield(e){const t=e.expression?this._evaluator.getType(e.expression):I.NoneType.createInstance();return this._validateYieldType(e,t||I.UnknownType.create()),!0}visitYieldFrom(e){const t=this._evaluator.getType(e.expression)||I.UnknownType.create();let n=this._evaluator.getTypeFromIterable(t,!1,e)||I.UnknownType.create();const i=C.getGeneratorTypeArgs(n);return n=i?i.length>=1?i[0]:I.UnknownType.create():this._evaluator.getTypeFromIterator(t,!1,e)||I.UnknownType.create(),this._validateYieldType(e,n),!0}visitRaise(e){if(this._evaluator.verifyRaiseExceptionType(e),e.valueExpression){const t=this._evaluator.getBuiltInType(e,"BaseException"),n=this._evaluator.getType(e.valueExpression);if(n&&t&&I.isInstantiableClass(t)){const i=new o.DiagnosticAddendum;C.doForEachSubtype(n,(e=>{e=this._evaluator.makeTopLevelTypeVarsConcrete(e),I.isAnyOrUnknown(e)||I.isNone(e)||I.isClassInstance(e)&&C.derivesFromClassRecursive(e,t,!1)||i.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)}))})),i.isEmpty()||this._evaluator.addError(p.Localizer.Diagnostic.expectedExceptionObj()+i.getString(),e.valueExpression)}}return!0}visitExcept(e){if(e.typeExpression){this._evaluator.evaluateTypesForStatement(e);const t=this._evaluator.getType(e.typeExpression);t&&this._validateExceptionType(t,e.typeExpression)}return!0}visitAssert(e){e.exceptionExpression&&this._evaluator.getType(e.exceptionExpression);const t=this._evaluator.getType(e.testExpression);return t&&I.isClassInstance(t)&&C.isTupleClass(t)&&t.tupleTypeArguments&&t.tupleTypeArguments.length>0&&(C.isOpenEndedTupleClass(t)||this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportAssertAlwaysTrue,l.DiagnosticRule.reportAssertAlwaysTrue,p.Localizer.Diagnostic.assertAlwaysTrue(),e.testExpression)),!0}visitAssignment(e){return this._evaluator.evaluateTypesForStatement(e),e.typeAnnotationComment&&this._evaluator.getType(e.typeAnnotationComment),!0}visitAssignmentExpression(e){return this._evaluator.getType(e),!0}visitAugmentedAssignment(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitIndex(e){this._evaluator.getType(e);const t=this._evaluator.getType(e.baseExpression);if(t&&I.isClassInstance(t)&&t.tupleTypeArguments&&!C.isOpenEndedTupleClass(t)){const n=t.tupleTypeArguments.length;if(1===e.items.length&&!e.trailingComma&&0===e.items[0].argumentCategory&&!e.items[0].name){const t=this._evaluator.getType(e.items[0].valueExpression);if(t&&I.isClassInstance(t)&&I.ClassType.isBuiltIn(t,"int")&&C.isLiteralType(t)){const i=t.literalValue;(i>=0&&i>=n||i<0&&i+n<0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.tupleIndexOutOfRange().format({length:n,index:i}),e)}}}return!0}visitBinaryOperation(e){return 12!==e.operator&&28!==e.operator||g.isWithinAssertExpression(e)||this._validateComparisonTypes(e),this._evaluator.getType(e),!0}visitSlice(e){return this._evaluator.getType(e),!0}visitUnpack(e){return this._evaluator.getType(e),!0}visitTuple(e){return this._evaluator.getType(e),!0}visitUnaryOperation(e){return this._evaluator.getType(e),!0}visitTernary(e){return this._evaluator.getType(e),!0}visitStringList(e){for(const t of e.strings)if(t.hasUnescapeErrors){u.getUnescapedString(t.token).unescapeErrors.forEach((e=>{const n={start:t.token.start+t.token.prefixLength+t.token.quoteMarkLength+e.offset,length:e.length};0===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportInvalidStringEscapeSequence,l.DiagnosticRule.reportInvalidStringEscapeSequence,p.Localizer.Diagnostic.stringUnsupportedEscape(),n):1===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",p.Localizer.Diagnostic.formatStringEscape(),n):2===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",p.Localizer.Diagnostic.formatStringBrace(),n):3===e.errorType&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",p.Localizer.Diagnostic.formatStringUnterminated(),n)}))}return e.typeAnnotation&&this._evaluator.getType(e),e.strings.length>1&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportImplicitStringConcatenation,l.DiagnosticRule.reportImplicitStringConcatenation,p.Localizer.Diagnostic.implicitStringConcat(),e),!0}visitFormatString(e){return e.expressions.forEach((e=>{this._evaluator.getType(e)})),!0}visitGlobal(e){return e.nameList.forEach((e=>{this._evaluator.getType(e)})),!0}visitNonlocal(e){return e.nameList.forEach((e=>{this._evaluator.getType(e)})),!0}visitName(e){return this._conditionallyReportPrivateUsage(e),!0}visitDel(e){return e.expressions.forEach((e=>{this._evaluator.verifyDeleteExpression(e)})),!0}visitMemberAccess(e){return this._evaluator.getType(e),this._conditionallyReportPrivateUsage(e.memberName),this.walk(e.leftExpression),!1}visitImportAs(e){return this._evaluator.evaluateTypesForStatement(e),!1}visitImportFrom(e){if(e.isWildcardImport){const t=h.getImportInfo(e.module);t&&t.isImportFound&&2!==t.importType&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportWildcardImportFromLibrary,l.DiagnosticRule.reportWildcardImportFromLibrary,p.Localizer.Diagnostic.wildcardLibraryImport(),e.wildcardToken||e)}else e.imports.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)}));return!1}visitTypeAnnotation(e){return this._evaluator.getType(e.typeAnnotation),!0}visitMatch(e){return this._evaluator.getType(e.subjectExpression),!0}visitCase(e){return e.guardExpression&&this._evaluator.getType(e.guardExpression),this._evaluator.evaluateTypesForStatement(e.pattern),!0}visitError(e){return e.child&&this._evaluator.getType(e.child),!1}_validateComparisonTypes(e){const t=this._evaluator.getType(e.leftExpression),n=this._evaluator.getType(e.rightExpression);if(t&&n)if(C.isLiteralTypeOrUnion(n)&&C.isLiteralTypeOrUnion(t)){if(void 0===_.evaluateStaticBoolExpression(e,this._fileInfo.executionEnvironment)){let i=!1;C.doForEachSubtype(t,(e=>{this._evaluator.canAssignType(n,e,new o.DiagnosticAddendum)&&(i=!0)})),i||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,p.Localizer.Diagnostic.comparisonAlwaysFalse().format({leftType:this._evaluator.printType(t,!0),rightType:this._evaluator.printType(n,!0)}),e)}}else{let i=!1;if(C.doForEachSubtype(t,(e=>{i||(e=this._evaluator.makeTopLevelTypeVarsConcrete(e),C.doForEachSubtype(n,(t=>{i||(t=this._evaluator.makeTopLevelTypeVarsConcrete(t),this._isTypeComparable(e,t)&&(i=!0))})))})),!i){const i=this._evaluator.printType(t,!0),s=this._evaluator.printType(n,!0),r=12===e.operator?p.Localizer.Diagnostic.comparisonAlwaysFalse():p.Localizer.Diagnostic.comparisonAlwaysTrue();this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,r.format({leftType:i,rightType:s}),e)}}}_isTypeComparable(e,t){if(I.isAnyOrUnknown(e)||I.isAnyOrUnknown(t))return!0;if(I.isNever(e)||I.isNever(t))return!1;if(I.isModule(e)||I.isModule(t))return!I.isTypeSame(e,t);if(I.isNone(e)||I.isNone(t))return!I.isTypeSame(e,t);if(I.isInstantiableClass(e)){if(I.isInstantiableClass(t)){const n=I.ClassType.cloneForSpecialization(e,void 0,!1),i=I.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,i,new o.DiagnosticAddendum)||this._evaluator.canAssignType(i,n,new o.DiagnosticAddendum))return!0}const n=e.details.effectiveMetaclass;return!!(n&&I.isClass(n)&&C.lookUpClassMember(n,"__eq__",4))}if(I.isClassInstance(e)){if(I.isClassInstance(t)){const n=I.ClassType.cloneForSpecialization(e,void 0,!1),i=I.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,i,new o.DiagnosticAddendum)||this._evaluator.canAssignType(i,n,new o.DiagnosticAddendum))return!0}return!!C.lookUpClassMember(I.ClassType.cloneAsInstantiable(e),"__eq__",4)}return!0}_isTypeValidForUnusedValueTest(e){return!(I.isNone(e)||C.isNoReturnType(e)||I.isNever(e)||I.isAnyOrUnknown(e))}_validateFunctionTypeVarUsage(e){if("none"===this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse)return;const t=new Map,n=new g.NameNodeWalker(((n,i,s)=>{const r=this._evaluator.getType(n);if(r&&I.isTypeVar(r)&&r.scopeId===this._evaluator.getScopeIdForNode(e)){let e=r.details.constraints.length>0||void 0!==r.details.boundType&&void 0!==i||I.isParamSpec(r);if(!e&&s&&void 0!==i){const t=this._evaluator.getType(s);(null==t?void 0:t.typeAliasInfo)&&t.typeAliasInfo.typeParameters&&i{const t=e.typeAnnotation||e.typeAnnotationComment;t&&n.walk(t)})),e.returnTypeAnnotation&&n.walk(e.returnTypeAnnotation),t.forEach((e=>{1!==e.nodes.length||e.isExempt||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,p.Localizer.Diagnostic.typeVarUsedOnlyOnce().format({name:e.nodes[0].value}),e.nodes[0])}))}_validateOverloadConsistency(e,t,n){for(let i=0;i!n||!I.isInstantiableClass(n)||C.derivesFromClassRecursive(e,n,!1),s=new o.DiagnosticAddendum;let r;if(I.isAnyOrUnknown(e))r=e;else if(I.isInstantiableClass(e))i(e)||s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),r=I.ClassType.cloneAsInstance(e);else if(I.isClassInstance(e)){const n=this._evaluator.getTypeFromIterator(e,!1,t)||I.UnknownType.create();r=C.mapSubtypes(n,(t=>I.isAnyOrUnknown(t)?t:I.isInstantiableClass(t)?(i(t)||s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),I.ClassType.cloneAsInstance(t)):(s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),I.UnknownType.create())))}return s.isEmpty()||this._evaluator.addError(p.Localizer.Diagnostic.exceptionTypeNotClass().format({type:this._evaluator.printType(e,!1)}),t),r||I.UnknownType.create()}_reportUnusedDunderAllSymbols(e){if("none"===this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll)return;const t=h.getScope(this._moduleNode);t&&e.forEach((e=>{t.symbolTable.has(e.value)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,p.Localizer.Diagnostic.dunderAllSymbolNotPresent().format({name:e.value}),e)}))}_validateSymbolTables(){for(const e of this._scopedNodes){const t=h.getScope(e);t&&t.symbolTable.forEach(((e,n)=>{this._conditionallyReportUnusedSymbol(n,e,t.type),this._reportIncompatibleDeclarations(n,e),this._reportMultipleFinalDeclarations(n,e,t.type),this._reportMultipleTypeAliasDeclarations(n,e),this._reportInvalidOverload(n,e)}))}}_reportInvalidOverload(e,t){const n=t.getTypedDeclarations();if(n.length>=1){const i=n[0];if(3===i.type){const n=this._evaluator.getEffectiveTypeOfSymbol(t),s=(I.isOverloadedFunction(n)?n.overloads:I.isFunction(n)?[n]:[]).filter((e=>I.FunctionType.isOverloaded(e)));if(1===s.length&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.singleOverload().format({name:e}),i.node.name),s.forEach((t=>{if(t.details.declaration&&!g.isFunctionSuiteEmpty(t.details.declaration.node)){const n=new o.DiagnosticAddendum;n.addMessage(p.Localizer.DiagnosticAddendum.overloadWithImplementation()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.overloadWithImplementation().format({name:e})+n.getString(),t.details.declaration.node.name)}})),!this._fileInfo.isStubFile&&s.length>0){let t;if(I.isOverloadedFunction(n)&&!I.FunctionType.isOverloaded(n.overloads[n.overloads.length-1])?t=n.overloads[n.overloads.length-1]:I.isFunction(n)&&!I.FunctionType.isOverloaded(n)&&(t=n),t)I.isOverloadedFunction(n)&&n.overloads.forEach(((n,s)=>{if(n===t||!I.FunctionType.isOverloaded(n))return;const r=new o.DiagnosticAddendum;if(!this._isLegalOverloadImplementation(n,t,r)&&t.details.declaration){const a=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.overloadImplementationMismatch().format({name:e,index:s+1})+r.getString(),t.details.declaration.node.name);a&&n.details.declaration&&a.addRelatedInfo(p.Localizer.DiagnosticAddendum.overloadMethod(),i.path,i.range)}}));else{let e=!1;const t=g.getEnclosingClassOrFunction(i.node);if(t&&10===t.nodeType){const n=this._evaluator.getTypeOfClass(t);n&&I.ClassType.isProtocolClass(n.classType)&&(e=!0)}e||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.overloadWithoutImplementation().format({name:i.node.name.value}),i.node.name)}}}}}_reportMultipleFinalDeclarations(e,t,n){if(!b.isFinalVariable(t))return;const i=t.getDeclarations();let s=!1,r=!1;if(i.forEach((t=>{m.isFinalVariableDeclaration(t)&&(s&&this._evaluator.addError(p.Localizer.Diagnostic.finalRedeclaration().format({name:e}),t.node),s=!0),1===t.type&&t.inferredTypeSource&&(r&&2!==n&&this._evaluator.addError(p.Localizer.Diagnostic.finalReassigned().format({name:e}),t.node),r=!0)})),!r&&!this._fileInfo.isStubFile){const t=i.find((e=>1===e.type&&e.isFinal));t&&this._evaluator.addError(p.Localizer.Diagnostic.finalUnassigned().format({name:e}),t.node)}}_reportMultipleTypeAliasDeclarations(e,t){const n=t.getDeclarations(),i=n.find((e=>m.isExplicitTypeAliasDeclaration(e)));i&&n.length>1&&n.forEach((t=>{t!==i&&this._evaluator.addError(p.Localizer.Diagnostic.typeAliasRedeclared().format({name:e}),t.node)}))}_reportIncompatibleDeclarations(e,t){const n=b.getLastTypedDeclaredForSymbol(t);if(!n)return;let i,s=t.getDeclarations().filter((e=>e!==n));if(3===n.type){const e=this._evaluator.getTypeOfFunction(n.node);s=s.filter((t=>{if(3!==t.type)return!0;const n=this._evaluator.getTypeOfFunction(t.node);return!n||(e&&I.isClassInstance(e.decoratedType)&&I.ClassType.isPropertyClass(e.decoratedType)&&I.isClassInstance(n.decoratedType)&&I.ClassType.isPropertyClass(n.decoratedType)?n.decoratedType.details.typeSourceId!==e.decoratedType.details.typeSourceId:!I.FunctionType.isOverloaded(n.functionType))}))}if(0===s.length)return;i=3===n.type?n.isMethod?p.Localizer.DiagnosticAddendum.seeMethodDeclaration():p.Localizer.DiagnosticAddendum.seeFunctionDeclaration():4===n.type?p.Localizer.DiagnosticAddendum.seeClassDeclaration():2===n.type?p.Localizer.DiagnosticAddendum.seeParameterDeclaration():1===n.type?p.Localizer.DiagnosticAddendum.seeVariableDeclaration():p.Localizer.DiagnosticAddendum.seeDeclaration();const r=e=>{if(e){let t;3===n.type||4===n.type?t=n.node.name:1===n.type?38===n.node.nodeType&&(t=n.node):2===n.type&&n.node.name&&(t=n.node.name),t&&e.addRelatedInfo(i,n.path,n.range)}};for(const t of s)if(4===t.type){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.obscuredClassDeclaration().format({name:e}),t.node.name))}else if(3===t.type){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,t.isMethod?p.Localizer.Diagnostic.obscuredMethodDeclaration().format({name:e}):p.Localizer.Diagnostic.obscuredFunctionDeclaration().format({name:e}),t.node.name))}else if(2===t.type){if(t.node.name){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.obscuredParameterDeclaration().format({name:e}),t.node.name))}}else if(1===t.type){const i=this._evaluator.getTypeForDeclaration(n);if(t.typeAnnotationNode){if(38===t.node.nodeType){let s=!1;if(1===n.type){const e=this._evaluator.getTypeForDeclaration(t);i&&e&&I.isTypeSame(i,e)&&(s=!0)}if(!s){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}}else if(i&&!C.isProperty(i)&&(3===n.type||4===n.type)){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}}_conditionallyReportUnusedSymbol(e,t,n){const i=this._fileInfo.accessedSymbolMap;if(t.isIgnoredForProtocolMatch()||i.has(t.id))return;if("_"===e)return;if(v.isDunderName(e))return;t.getDeclarations().forEach((t=>{this._conditionallyReportUnusedDeclaration(t,this._isSymbolPrivate(e,n))}))}_conditionallyReportUnusedDeclaration(e,t){let n,i,s,r;switch(e.type){case 6:if(n=this._fileInfo.diagnosticRuleSet.reportUnusedImport,r=l.DiagnosticRule.reportUnusedImport,21===e.node.nodeType)if(e.node.alias)this._fileInfo.isStubFile||(i=e.node.alias);else{const t=e.node.module.nameParts;if(t.length>0){const e=t.map((e=>e.value)).join("."),n={start:t[0].start,length:t[0].length};return c.TextRange.extend(n,t[t.length-1]),this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(p.Localizer.Diagnostic.unaccessedSymbol().format({name:e}),n,{action:"pyright.unusedImport"}),void this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportUnusedImport,l.DiagnosticRule.reportUnusedImport,p.Localizer.Diagnostic.unaccessedImport().format({name:e}),n)}}else if(23===e.node.nodeType){const t=e.node.parent,n=this._fileInfo.isStubFile&&void 0!==e.node.alias,s=1===t.module.nameParts.length&&"__future__"===t.module.nameParts[0].value;n||s||(i=e.node.alias||e.node.name)}i&&(s=p.Localizer.Diagnostic.unaccessedImport().format({name:i.value}));break;case 1:case 2:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedVariable,38===e.node.nodeType?i=e.node:41===e.node.nodeType&&(i=e.node.name,n="none"),i&&(r=l.DiagnosticRule.reportUnusedVariable,s=p.Localizer.Diagnostic.unaccessedVariable().format({name:i.value}));break;case 4:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedClass,i=e.node.name,r=l.DiagnosticRule.reportUnusedClass,s=p.Localizer.Diagnostic.unaccessedClass().format({name:i.value});break;case 3:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedFunction,i=e.node.name,r=l.DiagnosticRule.reportUnusedFunction,s=p.Localizer.Diagnostic.unaccessedFunction().format({name:i.value});break;default:return}if(i&&void 0!==r&&s){const e=r===l.DiagnosticRule.reportUnusedImport?{action:"pyright.unusedImport"}:void 0;this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(p.Localizer.Diagnostic.unaccessedSymbol().format({name:i.value}),i,e),this._evaluator.addDiagnostic(n,r,s,i)}}_validateIsInstanceCall(e){if(38!==e.leftExpression.nodeType||"isinstance"!==e.leftExpression.value&&"issubclass"!==e.leftExpression.value||2!==e.arguments.length)return;const t=e.leftExpression.value,n="isinstance"===t;let i=this._evaluator.getType(e.arguments[0].valueExpression);if(!i)return;if(i=C.mapSubtypes(i,(e=>C.transformPossibleRecursiveTypeAlias(e))),C.derivesFromAnyOrUnknown(i))return;const s=this._evaluator.getType(e.arguments[1].valueExpression);if(!s)return;const r=e=>{let t=!0;return C.doForEachSubtype(e,(e=>{switch((e=this._evaluator.makeTopLevelTypeVarsConcrete(e)).category){case 2:case 1:case 0:break;case 7:e.isTypeArgumentExplicit&&!e.includeSubclasses&&(t=!1);break;case 3:t=!!n&&I.TypeBase.isInstantiable(e);break;case 5:t=I.TypeBase.isInstantiable(e);break;default:t=!1}})),t};let a=!0;if(C.doForEachSubtype(s,(e=>{I.isClassInstance(e)&&I.ClassType.isTupleClass(e)&&e.tupleTypeArguments?e.tupleTypeArguments.some((e=>!r(e)))&&(a=!1):r(e)||(a=!1)})),!a){const t=new o.DiagnosticAddendum;t.addMessage(p.Localizer.DiagnosticAddendum.typeVarNotAllowed()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,n?p.Localizer.Diagnostic.isInstanceInvalidType().format({type:this._evaluator.printType(s,!1)})+t.getString():p.Localizer.Diagnostic.isSubclassInvalidType().format({type:this._evaluator.printType(s,!1)})+t.getString(),e.arguments[1])}let c=e;for(;c;){if(2===c.nodeType)return;c=c.parent}const d=["FunctionType","LambdaType","BuiltinFunctionType","BuiltinMethodType","type","Type"],u=[];if(C.doForEachSubtype(s,(e=>{I.isClass(e)?I.TypeBase.isInstantiable(e)?(u.push(e),I.ClassType.isBuiltIn(e)&&d.some((t=>t===e.details.name))&&(a=!1)):(C.isTupleClass(e)&&e.tupleTypeArguments&&e.tupleTypeArguments.forEach((e=>{I.isInstantiableClass(e)?u.push(e):a=!1})),I.ClassType.isBuiltIn(e)&&d.some((t=>t===e.details.name))&&(a=!1)):a=!1})),!a)return;u.some((e=>I.ClassType.isProtocolClass(e)&&!I.ClassType.isRuntimeCheckable(e)))&&this._evaluator.addError(p.Localizer.Diagnostic.protocolUsedInCall().format({name:t}),e.arguments[1].valueExpression);const h=e=>I.combineTypes(e),m=e=>{const t=[];for(const i of u){const s=I.ClassType.isDerivedFrom(e,i)||n&&I.ClassType.isProtocolClass(i)&&this._evaluator.canAssignType(i,e,new o.DiagnosticAddendum)||I.ClassType.isBuiltIn(i,"dict")&&I.ClassType.isTypedDictClass(e),r=I.ClassType.isDerivedFrom(i,e)||n&&I.ClassType.isProtocolClass(e)&&this._evaluator.canAssignType(e,i,new o.DiagnosticAddendum);r&&r&&!I.ClassType.isSameGenericClass(e,i)?t.push(I.UnknownType.create()):s?t.push(e):r&&t.push(i)}return n?t.map((e=>I.isInstantiableClass(e)?I.ClassType.cloneAsInstance(e):e)):t};let y;if(n&&I.isClassInstance(i)){y=h(m(I.ClassType.cloneAsInstantiable(i)))}else if(!n&&I.isInstantiableClass(i)){y=h(m(i))}else{if(!I.isUnion(i))return;{let e=[],t=!1;if(C.doForEachSubtype(i,(i=>{I.isAnyOrUnknown(i)&&(t=!0),n&&I.isClassInstance(i)?e=e.concat(m(I.ClassType.cloneAsInstantiable(i))):!n&&I.isInstantiableClass(i)&&(e=e.concat(m(i)))})),y=h(e),t)return}}const g=()=>{const e=u.map((e=>I.ClassType.cloneAsInstance(e)));return I.combineTypes(e)};I.isTypeSame(y,i,!0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryIsInstance,l.DiagnosticRule.reportUnnecessaryIsInstance,n?p.Localizer.Diagnostic.unnecessaryIsInstanceAlways().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(g(),!1)}):p.Localizer.Diagnostic.unnecessaryIsSubclassAlways().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(g(),!1)}),e)}_isSymbolPrivate(e,t){if(1===t||0===t)return!0;if(v.isPrivateName(e))return!0;if(v.isProtectedName(e)){return!(2===t)}return!1}_conditionallyReportPrivateUsage(e){var t;if("none"===this._fileInfo.diagnosticRuleSet.reportPrivateUsage)return;if(this._fileInfo.isStubFile)return;if(1===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.name===e)return;const n=e.value,i=v.isPrivateName(n),s=v.isProtectedName(n);if(!i&&!s)return;const r=this._evaluator.getDeclarationsForNameNode(e);let a,o=r&&r.length>0?r[r.length-1]:void 0;if(!o||o.node===e)return;if(6===o.type&&o.usesLocalName)return;if(o=this._evaluator.resolveAliasDeclaration(o,!0),!o||o.node===e)return;o.node&&(a=g.getEnclosingClassOrModule(o.node)),o.node&&o.node.parent&&o.node.parent===a&&10===a.nodeType&&(a=g.getEnclosingClassOrModule(a));let c=!1;if(a&&10===a.nodeType&&s){const t=this._evaluator.getTypeOfClass(a);if(t&&I.isInstantiableClass(t.decoratedType)){if(I.ClassType.isDefinedInStub(t.decoratedType))return;c=!0;const n=g.getEnclosingClass(e);if(n){const e=this._evaluator.getTypeOfClass(n);if(e&&I.isInstantiableClass(e.decoratedType)&&C.derivesFromClassRecursive(e.decoratedType,t.decoratedType,!0))return}}}a&&!g.isNodeContainedWithin(e,a)&&(c?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,p.Localizer.Diagnostic.protectedUsedOutsideOfClass().format({name:n}),e):this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,10===a.nodeType?p.Localizer.Diagnostic.privateUsedOutsideOfClass().format({name:n}):p.Localizer.Diagnostic.privateUsedOutsideOfModule().format({name:n}),e))}_validateTypedDictClassSuite(e){const t=e=>{this._evaluator.addError(p.Localizer.Diagnostic.typedDictBadVar(),e)};e.statements.forEach((e=>{if(!h.isCodeUnreachable(e))if(47===e.nodeType)for(const n of e.statements)54!==n.nodeType&&18!==n.nodeType&&48!==n.nodeType&&42!==n.nodeType&&t(n);else t(e)}))}_validateDunderSignatures(e,t,n){var i;const s=t.details.name;if(n&&"__init__"===s){const n=e.returnTypeAnnotation||(null===(i=e.functionAnnotationComment)||void 0===i?void 0:i.returnTypeAnnotation),s=t.details.declaredReturnType;if(n&&s)I.isNone(s)||C.isNoReturnType(s)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.initMustReturnNone(),n);else{const n=this._evaluator.getFunctionInferredReturnType(t);C.isNoReturnType(n)||I.isNone(n)||I.isAnyOrUnknown(n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.initMustReturnNone(),e.name)}}}_validateFunctionReturn(e,t){var n;if(this._fileInfo.isStubFile)return;const i=e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation);if(i){const n=!this._evaluator.isAfterNodeReachable(e),s=this._evaluator.isAfterNodeReachable(e.suite);let r=t.details.declaredReturnType;if(r){I.isUnknown(r)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.declaredReturnTypeUnknown(),i):C.isPartlyUnknown(r)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.declaredReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(r,!0)}),i);const e=new o.DiagnosticAddendum;I.isTypeVar(r)&&2===r.details.variance&&(e.addMessage(p.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:I.TypeVarType.getReadableName(r)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.returnTypeContravariant()+e.getString(),i))}if(I.FunctionType.isGenerator(t)&&(r=C.getDeclaredGeneratorReturnType(t)),r&&!n&&s)if(C.isNoReturnType(r))g.isSuiteEmpty(e.suite)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnReturnsNone(),i);else if(!I.FunctionType.isAbstractMethod(t)){const t=new o.DiagnosticAddendum;this._evaluator.canAssignType(r,I.NoneType.createInstance(),t)||g.isSuiteEmpty(e.suite)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.returnMissing().format({returnType:this._evaluator.printType(r,!1)})+t.getString(),i)}}else{const n=this._evaluator.getFunctionInferredReturnType(t);I.isUnknown(n)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.returnTypeUnknown(),e.name):C.isPartlyUnknown(n)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.returnTypePartiallyUnknown().format({returnType:this._evaluator.printType(n,!0)}),e.name)}}_validateFinalMemberOverrides(e){e.details.fields.forEach(((t,n)=>{const i=C.lookUpClassMember(e,n,1);if(i&&I.isInstantiableClass(i.classType)&&b.isFinalVariable(i.symbol)&&!v.isPrivateName(n)){const e=t.getDeclarations()[0];this._evaluator.addError(p.Localizer.Diagnostic.finalRedeclarationBySubclass().format({name:n,className:i.classType.details.name}),e.node)}}))}_validateFinalClassNotAbstract(e,t){if(!I.ClassType.isFinal(e))return;if(!I.ClassType.hasAbstractMethods(e))return;const n=this._evaluator.getAbstractMethods(e),i=new o.DiagnosticAddendum;n.forEach(((e,t)=>{if(2===t)i.addMessage(p.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:n.length-2}));else if(t<2&&I.isInstantiableClass(e.classType)){const t=e.classType.details.name;i.addMessage(p.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.finalClassIsAbstract().format({type:e.details.name})+i.getString(),t.name)}_validateInstanceVariableInitialization(e){"none"!==this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable&&e.details.fields.forEach(((t,n)=>{if(!t.isInstanceMember())return;const i=t.getDeclarations();if(i.find((e=>{const t=g.getEnclosingClassOrFunction(e.node);return!t||10===t.nodeType||"__init__"===t.name.value})))return;C.lookUpClassMember(e,n,1)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable,l.DiagnosticRule.reportUninitializedInstanceVariable,p.Localizer.Diagnostic.uninitializedInstanceVariable().format({name:n}),i[0].node)}))}_validateProtocolTypeParamVariance(e,t){const n=t.details.typeParameters;if(0===n.length)return;const i=this._evaluator.getBuiltInType(e,"object");if(!I.isInstantiableClass(i))return;const s=n.filter((e=>!I.isParamSpec(e)&&!I.isVariadicTypeVar(e))).map((e=>I.TypeVarType.cloneAsInvariant(e))),r=I.ClassType.cloneWithNewTypeParameters(t,s),a=I.ClassType.cloneAsInstance(i);s.forEach(((i,o)=>{const c=s.map(((e,t)=>t===o?a:I.AnyType.create())),d=s.map(((e,t)=>t===o?e:I.AnyType.create())),u=I.ClassType.cloneForSpecialization(r,c,!0),h=I.ClassType.cloneForSpecialization(r,d,!0);let m;if(this._evaluator.canAssignProtocolClassToSelf(u,h))m=1;else{m=this._evaluator.canAssignProtocolClassToSelf(h,u)?2:0}if(m!==n[o].details.variance){let n;n=1===m?p.Localizer.Diagnostic.protocolVarianceCovariant().format({variable:i.details.name,class:t.details.name}):2===m?p.Localizer.Diagnostic.protocolVarianceContravariant().format({variable:i.details.name,class:t.details.name}):p.Localizer.Diagnostic.protocolVarianceInvariant().format({variable:i.details.name,class:t.details.name}),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,n,e.name)}}))}_validateSlotsClassVarConflict(e){e.details.localSlotsNames&&e.details.fields.forEach(((e,t)=>{const n=e.getDeclarations();n.some((e=>1===e.type&&e.isDefinedBySlots))&&n.forEach((e=>{1!==e.type||e.isDefinedBySlots||e.isDefinedByMemberAccess||38===e.node.nodeType&&g.isWriteAccess(e.node)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.slotsClassVarConflict().format({name:t}),e.node)}))}))}_validateBaseClassOverrides(e){e.details.fields.forEach(((t,n)=>{if(v.isPrivateName(n))return;const i=this._evaluator.getEffectiveTypeOfSymbol(t);if(I.isAnyOrUnknown(i))return;const s=C.lookUpClassMember(e,n,1);if(!s||!I.isInstantiableClass(s.classType))return;if(!s.symbol.hasTypedDeclarations())return;const r=C.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(s.symbol),s.classType);if(I.isFunction(r)||I.isOverloadedFunction(r)){const e=new o.DiagnosticAddendum;let a;if(I.isFunction(i)?a=i:I.isOverloadedFunction(i)&&(a=i.overloads[i.overloads.length-1]),a){const i=["__init__","__new__","__init_subclass__"],o=!v.isDunderName(n);if(!i.some((e=>e===n))&&!v.isPrivateName(n)&&!this._evaluator.canOverrideMethod(r,a,e,o)){const t=a.details.declaration;if(t&&3===t.type){const i=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,p.Localizer.Diagnostic.incompatibleMethodOverride().format({name:n,className:s.classType.details.name})+e.getString(),t.node.name),r=b.getLastTypedDeclaredForSymbol(s.symbol);i&&r&&i.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),r.path,r.range)}}if(I.isFunction(r)&&!v.isPrivateName(n)&&I.FunctionType.isFinal(r)){const e=b.getLastTypedDeclaredForSymbol(t);if(e&&3===e.type){const t=this._evaluator.addError(p.Localizer.Diagnostic.finalMethodOverride().format({name:n,className:s.classType.details.name}),e.node.name),i=b.getLastTypedDeclaredForSymbol(s.symbol);t&&i&&t.addRelatedInfo(p.Localizer.DiagnosticAddendum.finalMethod(),i.path,i.range)}}}else if(!I.isAnyOrUnknown(i)){const e=t.getDeclarations();if(e.length>0){const t=e[e.length-1],r=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,p.Localizer.Diagnostic.methodOverridden().format({name:n,className:s.classType.details.name,type:this._evaluator.printType(i,!1)}),t.node),a=b.getLastTypedDeclaredForSymbol(s.symbol);r&&a&&r.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),a.path,a.range)}}}else if(C.isProperty(r))if(C.isProperty(i)){const a=r.details.fields,c=i.details.fields,d=s.classType;["fget","fset","fdel"].forEach((i=>{const s=new o.DiagnosticAddendum,r=a.get(i),u=c.get(i);if(r){const a=C.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(r),d);if(I.isFunction(a))if(u){const t=C.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(u),e);if(I.isFunction(t)&&!this._evaluator.canOverrideMethod(a,t,s.createAddendum())){s.addMessage(p.Localizer.DiagnosticAddendum.propertyMethodIncompatible().format({name:i}));const e=t.details.declaration;if(e&&3===e.type){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,p.Localizer.Diagnostic.propertyOverridden().format({name:n,className:d.details.name})+s.getString(),e.node.name),i=a.details.declaration;t&&i&&t.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),i.path,i.range)}}}else{s.addMessage(p.Localizer.DiagnosticAddendum.propertyMethodMissing().format({name:i}));const e=t.getDeclarations();if(e.length>0){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,p.Localizer.Diagnostic.propertyOverridden().format({name:n,className:d.details.name})+s.getString(),e[e.length-1].node),i=a.details.declaration;t&&i&&t.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),i.path,i.range)}}}}))}else{const e=t.getDeclarations();e.length>0&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,p.Localizer.Diagnostic.propertyOverridden().format({name:n,className:s.classType.details.name}),e[e.length-1].node)}else if("none"!==this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride){const e=t.getDeclarations();if(e.length>0){const a=e[e.length-1],c=new o.DiagnosticAddendum;if(!this._evaluator.canAssignType(r,i,c)){const e=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,p.Localizer.Diagnostic.symbolOverridden().format({name:n,className:s.classType.details.name})+c.getString(),a.node),t=b.getLastTypedDeclaredForSymbol(s.symbol);e&&t&&e.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenSymbol(),t.path,t.range)}const d=s.symbol.isClassVar();let u=t.isClassVar();if(d&&!u&&(t.hasTypedDeclarations()||(u=!0)),d!==u){const e=t.isClassVar()?p.Localizer.Diagnostic.classVarOverridesInstanceVar():p.Localizer.Diagnostic.instanceVarOverridesClassVar(),i=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,e.format({name:n,className:s.classType.details.name}),a.node),r=b.getLastTypedDeclaredForSymbol(s.symbol);i&&r&&i.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenSymbol(),r.path,r.range)}}}}))}_validateMethod(e,t,n){const i=this._evaluator.getTypeOfClass(n),s=null==i?void 0:i.classType;if(e.name&&"__new__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&["cls","_cls","__cls","__mcls"].some((t=>e.parameters[0].name.value===t))||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.newClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(e.name&&"__init_subclass__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.initSubclassClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(e.name&&"__class_getitem__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.classGetItemClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(I.FunctionType.isStaticMethod(t)){if(e.parameters.length>0&&e.parameters[0].name){const t=e.parameters[0].name.value;"self"!==t&&"cls"!==t||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.staticClsSelfParam(),e.parameters[0].name)}}else if(I.FunctionType.isClassMethod(t)){let n="";e.parameters.length>0&&e.parameters[0].name&&(n=e.parameters[0].name.value),"cls"!==n&&(this._fileInfo.isStubFile&&(n.startsWith("_")||"metacls"===n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.classMethodClsParam(),e.parameters.length>0?e.parameters[0]:e.name)),s&&this._validateClsSelfParameterType(t,s,!0)}else{if(0===e.decorators.length){let t="",i=!0;if(e.parameters.length>0&&(e.parameters[0].name&&(t=e.parameters[0].name.value),0!==e.parameters[0].category&&(i=!1)),i&&"self"!==t){let i=!1;if("cls"===t){const e=this._evaluator.getTypeOfClass(n),t=this._evaluator.getBuiltInType(n,"type");t&&I.isInstantiableClass(t)&&e&&I.isInstantiableClass(e.classType)&&C.derivesFromClassRecursive(e.classType,t,!0)&&(i=!0)}const s=v.isPrivateOrProtectedName(t);i||s||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.instanceMethodSelfParam(),e.parameters.length>0?e.parameters[0]:e.name)}}s&&this._validateClsSelfParameterType(t,s,!1)}}_validateClsSelfParameterType(e,t,n){if(e.details.parameters.length<1)return;const i=e.details.parameters[0];if(!i.typeAnnotation||!i.name)return;if(I.ClassType.isProtocolClass(t))return;const s=this._evaluator.makeTopLevelTypeVarsConcrete(i.type),r=n?t:C.convertToInstance(t),a=new o.DiagnosticAddendum;I.isInstantiableClass(s)&&I.ClassType.isProtocolClass(s)||I.isClassInstance(s)&&I.ClassType.isProtocolClass(s)||I.FunctionType.isOverloaded(e)||this._evaluator.canAssignType(s,r,a)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.clsSelfParamTypeMismatch().format({name:i.name,classType:this._evaluator.printType(r,!1)}),i.typeAnnotation)}_validateYieldType(e,t){let n,i;const s=g.getEnclosingFunction(e);if(s){const e=this._evaluator.getTypeOfFunction(s);e&&(a.assert(I.isFunction(e.functionType)),n=I.FunctionType.getSpecializedReturnType(e.functionType),n&&(i=this._evaluator.getTypeFromIterator(n,!!s.isAsync,void 0)),i&&!i&&s.returnTypeAnnotation&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,s.isAsync?p.Localizer.Diagnostic.generatorAsyncReturnType():p.Localizer.Diagnostic.generatorSyncReturnType(),s.returnTypeAnnotation))}if(this._evaluator.isNodeReachable(e))if(n&&C.isNoReturnType(n))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnContainsYield(),e);else if(i){const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(i,t,n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.yieldTypeMismatch().format({exprType:this._evaluator.printType(t,!1),yieldType:this._evaluator.printType(i,!1)})+n.getString(),e.expression||e)}}_reportDuplicateImports(){const e=y.getTopLevelImports(this._moduleNode),t=new Map;e.orderedImports.forEach((e=>{if(22===e.node.nodeType){const t=new Map;e.node.imports.forEach((e=>{if(!e.alias){t.get(e.name.value)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,p.Localizer.Diagnostic.duplicateImport().format({importName:e.name.value}),e.name):t.set(e.name.value,e)}}))}else if(e.subnode&&!e.subnode.alias){t.get(e.moduleName)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,p.Localizer.Diagnostic.duplicateImport().format({importName:e.moduleName}),e.subnode):t.set(e.moduleName,e.subnode)}}))}}t.Checker=D},41563:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CircularDependency=void 0;t.CircularDependency=class{constructor(){this._paths=[]}appendPath(e){this._paths.push(e)}getPaths(){return this._paths}normalizeOrder(){let e=0;this._paths.forEach(((t,n)=>{t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createKeyForReference=t.isCodeFlowSupportedForReference=t.getUniqueFlowNodeId=t.FlowFlags=void 0;const i=n(20823);!function(e){e[e.Unreachable=1]="Unreachable",e[e.Start=2]="Start",e[e.BranchLabel=4]="BranchLabel",e[e.LoopLabel=8]="LoopLabel",e[e.Assignment=16]="Assignment",e[e.Unbind=32]="Unbind",e[e.WildcardImport=64]="WildcardImport",e[e.TrueCondition=128]="TrueCondition",e[e.FalseCondition=512]="FalseCondition",e[e.Call=1024]="Call",e[e.PreFinallyGate=2048]="PreFinallyGate",e[e.PostFinally=4096]="PostFinally",e[e.AssignmentAlias=8192]="AssignmentAlias",e[e.VariableAnnotation=16384]="VariableAnnotation",e[e.PostContextManager=32768]="PostContextManager",e[e.TrueNeverCondition=65536]="TrueNeverCondition",e[e.FalseNeverCondition=131072]="FalseNeverCondition",e[e.NarrowForPattern=262144]="NarrowForPattern",e[e.ExhaustedMatch=524288]="ExhaustedMatch"}(t.FlowFlags||(t.FlowFlags={}));let s=1;t.getUniqueFlowNodeId=function(){return s++},t.isCodeFlowSupportedForReference=function e(t){if(38===t.nodeType)return!0;if(35===t.nodeType)return e(t.leftExpression);if(24===t.nodeType){if(1!==t.items.length||t.trailingComma||void 0!==t.items[0].name||0!==t.items[0].argumentCategory)return!1;const n=t.items[0].valueExpression,i=40===n.nodeType&&!n.isImaginary&&n.isInteger,s=48===n.nodeType&&1===n.strings.length&&49===n.strings[0].nodeType;return!(!i&&!s)&&e(t.baseExpression)}return!1},t.createKeyForReference=function e(t){let n;if(38===t.nodeType)n=t.value;else if(35===t.nodeType){n=`${e(t.leftExpression)}.${t.memberName.value}`}else if(24===t.nodeType){const s=e(t.baseExpression);if(i.assert(1===t.items.length),40===t.items[0].valueExpression.nodeType)n=`${s}[${t.items[0].valueExpression.value.toString()}]`;else if(48===t.items[0].valueExpression.nodeType){const e=t.items[0].valueExpression;i.assert(1===e.strings.length&&49===e.strings[0].nodeType),n=`${s}["${e.strings[0].value}"]`}else i.fail("createKeyForReference received unexpected index type")}else i.fail("createKeyForReference received unexpected expression type");return n}},81044:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFileLevelDirectives=void 0;const i=n(14943);function s(e){const t=i.getStrictDiagnosticRuleSet(),n=i.getBooleanDiagnosticRules(),s=i.getDiagLevelDiagnosticRules(),r=i.getStrictModeNotOverriddenRules();for(const i of n)r.find((e=>e===i))||t[i]&&(e[i]=!0);for(const n of s){if(r.find((e=>e===n)))continue;const i=t[n],s=e[n];("error"===i||"warning"===i&&"error"!==s||"information"===i&&"error"!==s&&"warning"!==s)&&(e[n]=i)}}function r(e,t){const n=["pyright:","mspython:"].find((t=>e.startsWith(t)));if(n){const i=e.substr(n.length).trim().split(",").map((e=>e.trim()));i.some((e=>"strict"===e))&&s(t);for(const e of i)t=a(e,t)}return t}function a(e,t){const n=e.split("=").map((e=>e.trim()));if(2!==n.length)return t;const s=n[0],r=i.getBooleanDiagnosticRules();if(i.getDiagLevelDiagnosticRules().find((e=>e===s))){const e=function(e){switch(e){case"false":case"none":return"none";case"true":case"error":return"error";case"warning":return"warning";case"information":return"information";default:return}}(n[1]);void 0!==e&&(t[s]=e)}else if(r.find((e=>e===s))){const e=function(e){if("false"===e)return!1;if("true"===e)return!0;return}(n[1]);void 0!==e&&(t[s]=e)}return t}t.getFileLevelDirectives=function(e,t,n){let a=i.cloneDiagnosticRuleSet(t);n&&s(a);for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSpecialBuiltInClassDeclarations=t.isAliasDeclaration=t.isVariableDeclaration=t.isParameterDeclaration=t.isClassDeclaration=t.isFunctionDeclaration=void 0,t.isFunctionDeclaration=function(e){return 3===e.type},t.isClassDeclaration=function(e){return 4===e.type},t.isParameterDeclaration=function(e){return 2===e.type},t.isVariableDeclaration=function(e){return 1===e.type},t.isAliasDeclaration=function(e){return 6===e.type},t.isSpecialBuiltInClassDeclarations=function(e){return 5===e.type}},88023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDefinedInFile=t.getNameFromDeclaration=t.isPossibleTypeAliasDeclaration=t.isExplicitTypeAliasDeclaration=t.isFinalVariableDeclaration=t.areDeclarationsSame=t.hasTypeForDeclaration=void 0;const i=n(16800),s=n(23241);t.hasTypeForDeclaration=function(e){switch(e.type){case 0:case 4:case 5:case 3:return!0;case 2:{if(e.node.typeAnnotation||e.node.typeAnnotationComment)return!0;const t=e.node.parent;if(28===(null==t?void 0:t.nodeType)&&t.functionAnnotationComment&&!t.functionAnnotationComment.isParamListEllipsis){const n=t.functionAnnotationComment.paramTypeAnnotations;return!(t.parameters.length>n.length&&e.node===t.parameters[0])}return!1}case 1:return!!e.typeAnnotationNode;case 6:return!1}},t.areDeclarationsSame=function(e,t){return e.type===t.type&&(e.path===t.path&&(e.range.start.line===t.range.start.line&&e.range.start.character===t.range.start.character&&(6!==e.type||6!==t.type||e.symbolName===t.symbolName&&e.firstNamePart===t.firstNamePart&&e.usesLocalName===t.usesLocalName)))},t.isFinalVariableDeclaration=function(e){return 1===e.type&&!!e.isFinal},t.isExplicitTypeAliasDeclaration=function(e){return 1===e.type&&!!e.typeAliasAnnotation},t.isPossibleTypeAliasDeclaration=function(e){var t;if(1!==e.type||!e.typeAliasName||e.typeAnnotationNode)return!1;if(3!==(null===(t=e.node.parent)||void 0===t?void 0:t.nodeType))return!1;switch(e.node.parent.rightExpression.nodeType){case 0:case 55:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 46:case 60:case 61:case 30:case 40:case 15:case 31:case 45:return!1}return!0},t.getNameFromDeclaration=function(e){var t;switch(e.type){case 6:return e.symbolName;case 4:case 3:return e.node.name.value;case 2:return null===(t=e.node.name)||void 0===t?void 0:t.value;case 1:return 38===e.node.nodeType?e.node.value:void 0;case 0:case 5:return}throw new Error("Shouldn't reach here")},t.isDefinedInFile=function(e,t){var n;return i.isAliasDeclaration(e)?(null===(n=s.getFileInfoFromNode(e.node))||void 0===n?void 0:n.filePath)===t:e.path===t}},21736:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertDocStringToPlainText=t.convertDocStringToMarkdown=void 0;const i=n(20822);t.convertDocStringToMarkdown=function(e){return new P(e).convert()},t.convertDocStringToPlainText=function(e){const t=i.cleanAndSplitDocString(e),n=[];for(const e of t){const t=n.length>0?n[n.length-1]:void 0;w(e)&&w(t)||n.push(e)}return n.join("\n").trimEnd()};const s=/\S|$/,r=/\S/,a=/^\s*~~~+$/,o=/^\s*\+\+\++$/,l=/^\s*===+\s+===+$/,c=/^\s*---+\s+---+$/,p=/^(\s*)-\s/,d=/^(\s*)\*\s/,u=/^(\s*)\d+\.\s/,h=/^(\s+\* )(.*)$/,m=/^\s*\.\. /,y=/^\s*\.\.\s+(\w+)::\s*(.*)$/,g=/ *>>> /,f=/^\s*:(param|arg|type|return|rtype|raise|except|var|ivar|cvar|copyright|license)/,T=/^[.\s\t]+(@\w+)/,_=/^(\.\s{3})|^(\.)/,v=[{exp:/^\s*=+(\s+=+)+$/,replacement:"="},{exp:/^\s*-+(\s+-+)+$/,replacement:"-"},{exp:/^\s*~+(\s+-+)+$/,replacement:"~"},{exp:/^\s*\++(\s+\++)+$/,replacement:"+"}],b=/\s/g,I=/``/g,C=/~/g,S=/\+/g,D=/(?/g,replacement:">"}],x=/^\s*::$/,k=[{exp:/\s+::$/g,replacement:""},{exp:/(\S)\s*::$/g,replacement:"$1:"},{exp:/:[\w_\-+:.]+:`/g,replacement:"`"},{exp:/`:[\w_\-+:.]+:/g,replacement:"`"}];class P{constructor(e){this._builder="",this._skipAppendEmptyLine=!0,this._insideInlineCode=!1,this._appendDirectiveBlock=!1,this._stateStack=[],this._lineNum=0,this._blockIndent=0,this._state=this._parseText,this._lines=i.cleanAndSplitDocString(e)}convert(){for(this._lines.some((e=>T.exec(e)))&&(this._lines=this._lines.map((e=>e.replace(_,""))));void 0!==this._currentLineOrUndefined();){const e=this._state,t=this._lineNum;if(this._state(),this._state===e&&this._lineNum===t)break}return this._state===this._parseBacktickBlock||this._state===this._parseDocTest||this._state===this._parseLiteralBlock?this._trimOutputAndAppendLine("```"):this._insideInlineCode&&this._trimOutputAndAppendLine("`",!0),this._builder.trim()}_eatLine(){this._lineNum++}_currentLineOrUndefined(){return this._lineNum!w(e)))||"")}_currentLineIsOutsideBlock(){return this._currentIndent()n)||w(t)||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(t)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n>i&&!w(t)&&!this._builder.endsWith("\\\n")&&!this._builder.endsWith("\n\n")&&(this._builder=this._builder.slice(0,-1)+"\\\n"),e=0===n||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")?this._convertIndent(e):e.trimStart()}_convertIndent(e){return e=e.replace(/^([ \t]+)(.+)$/g,((e,t,n)=>" ".repeat(t.length)+n))}_escapeHtml(e){return A.forEach((t=>{e=e.replace(t.exp,t.replacement)})),e}_appendTextLine(e){const t=(e=this._preprocessTextLine(e)).split("`");for(let e=0;e0&&(this._insideInlineCode=!this._insideInlineCode,this._append("`")),this._insideInlineCode){this._append(n);continue}if(n=this._escapeHtml(n),0===e){if(1===t.length){for(const e of v)if(e.exp.test(n)){n=n.replace(b,e.replacement);break}if(a.test(n)){this._append(n.replace(C,"-"));continue}if(o.test(n)){this._append(n.replace(S,"-"));continue}}const e=h.exec(n);null!==e&&3===e.length&&(this._append(e[1]),n=e[2])}n.split(F).forEach((e=>{F.test(e)?this._append(e):this._append(e.replace(D,"\\$1"))}))}this._builder+="\n"}_preprocessTextLine(e){return x.test(e)?"":(k.forEach((t=>e=e.replace(t.exp,t.replacement))),e=e.replace(I,"`"))}_parseEmpty(){if(w(this._currentLineOrUndefined()))return this._appendLine(),void this._eatLine();this._state=this._parseText}_beginMinIndentCodeBlock(e){this._appendLine("```"),this._pushAndSetState(e),this._blockIndent=this._currentIndent()}_beginBacktickBlock(){return!!this._currentLine().startsWith("```")&&(this._appendLine(this._currentLine()),this._pushAndSetState(this._parseBacktickBlock),this._eatLine(),!0)}_parseBacktickBlock(){this._currentLine().startsWith("```")?(this._appendLine("```"),this._appendLine(),this._popState()):this._appendLine(this._currentLine()),this._eatLine()}_beginDocTest(){return!!g.test(this._currentLine())&&(this._beginMinIndentCodeBlock(this._parseDocTest),this._appendLine(this._currentLineWithinBlock()),this._eatLine(),!0)}_parseDocTest(){if(this._currentLineIsOutsideBlock()||w(this._currentLine()))return this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState();this._appendLine(this._currentLineWithinBlock()),this._eatLine()}_beginLiteralBlock(){const e=this._lineAt(this._lineNum-1);if(void 0===e)return!1;if(!w(e))return!1;let t=this._lineNum-2;for(;t>=0;t--){const e=this._lineAt(t);if(!w(e)){if(e.endsWith("::"))break;return!1}}return!(t<0)&&(0===this._currentIndent()?(this._appendLine("```"),this._pushAndSetState(this._parseLiteralBlockSingleLine),!0):(this._beginMinIndentCodeBlock(this._parseLiteralBlock),!0))}_parseLiteralBlock(){return w(this._currentLineOrUndefined())?(this._appendLine(),void this._eatLine()):this._currentLineIsOutsideBlock()?(this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState()):(this._appendLine(this._currentLineWithinBlock()),void this._eatLine())}_parseLiteralBlockSingleLine(){this._appendLine(this._currentLine()),this._appendLine("```"),this._appendLine(),this._popState(),this._eatLine()}_beginDirective(){return!!m.test(this._currentLine())&&(this._pushAndSetState(this._parseDirective),this._blockIndent=this._nextBlockIndent(),this._appendDirectiveBlock=!1,!0)}_beginFieldList(){var e,t;if(this._insideInlineCode)return!1;let n=this._currentLine();if(n.startsWith("@"))return this._appendLine(),this._appendTextLine(n),this._eatLine(),!0;const i=!(null==n?void 0:n.endsWith(":"))&&!(null==n?void 0:n.endsWith("::"))&&(null!==(t=null===(e=n.match(/:/g))||void 0===e?void 0:e.length)&&void 0!==t?t:0)%2==1,s=f.test(n);if(i||s){const e=this._lineAt(this._lineNum-1);return this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(e)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n=this._convertIndent(n),this._appendTextLine(n),this._eatLine(),!0}return!1}_beginTableBlock(){if(this._insideInlineCode)return!1;const e=this._currentLine();return!!l.test(e)&&(this._tableState={header:e.trimStart(),inHeader:!0},this._eatLine(),this._pushAndSetState(this._parseTableBlock),!0)}_parseTableBlock(){if(w(this._currentLineOrUndefined())||!this._tableState)return this._tableState=void 0,void this._popState();let e=this._currentLine();if(l.test(e))return this._eatLine(),this._appendLine("\n
\n"),this._popState(),void(this._tableState=void 0);{let t="|";const n=this._tableState.header.split(" "),i=[];if(this._tableState.inHeader){do{let t=0;for(let s=0;s${a} `),t+=r}this._eatLine(),e=this._currentLine()}while(!w(this._currentLineOrUndefined())&&!c.test(e)&&!l.test(e));this._tableState.inHeader=!1,i.forEach((e=>{t+=`${e}|`})),this._appendLine(t);const s=e.trimStart().replace(/=/g,"-").replace(" ","|");this._appendLine(`|${s}|`),this._eatLine()}else{let i=0;n.forEach((n=>{const s=n.length+1,r=e.slice(i,i+s);t+=`${r}|`,i+=s})),this._appendLine(t),this._eatLine()}}}_beginList(){if(this._insideInlineCode)return!1;let e=this._currentLine();const t=p.exec(e);if(2===(null==t?void 0:t.length))return t[1].length>=4&&(e=" ".repeat(t[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const n=d.exec(e);if(2===(null==n?void 0:n.length))return 0===n[1].length?e=e=" "+e:n[1].length>=4&&(e=" ".repeat(n[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const i=u.exec(e);return 2===(null==i?void 0:i.length)&&(this._appendTextLine(e),this._eatLine(),!0)}_parseList(){if(w(this._currentLineOrUndefined())||this._currentLineIsOutsideBlock())return void this._popState();if(!this._beginList()){const e=this._currentLine().trimStart();this._appendTextLine(e),this._eatLine()}}_parseDirective(){const e=y.exec(this._currentLine());if(null!==e&&3===e.length){const t=e[1],n=e[2];"class"===t&&(this._appendDirectiveBlock=!0,this._appendLine(),this._appendLine("```"),this._appendLine(n),this._appendLine("```"),this._appendLine())}0===this._blockIndent?this._popState():this._state=this._parseDirectiveBlock,this._eatLine()}_parseDirectiveBlock(){w(this._currentLineOrUndefined())||!this._currentLineIsOutsideBlock()?(this._appendDirectiveBlock&&this._appendTextLine(this._currentLine().trimLeft()),this._eatLine()):this._popState()}_appendLine(e){w(e)?this._skipAppendEmptyLine||(this._builder+="\n",this._skipAppendEmptyLine=!0):(this._builder+=e+"\n",this._skipAppendEmptyLine=!1)}_append(e){this._builder+=e,this._skipAppendEmptyLine=!1}_trimOutputAndAppendLine(e,t=!1){this._builder=this._builder.trimRight(),this._skipAppendEmptyLine=!1,t||this._appendLine(),this._appendLine(e)}}function E(e){return e.search(s)}function w(e){return void 0===e||!r.test(e)}function N(e){var t,n;return void 0!==e&&(null!==(n=null===(t=e.match(/^\s*[#`~=-]{3,}/))||void 0===t?void 0:t.length)&&void 0!==n?n:0)>0}},20822:(e,t)=>{"use strict";function n(e){const t=e.replace(/\r/g,"").replace(/\t/g," ").split("\n");let n=Number.MAX_VALUE;t.forEach(((e,i)=>{if(t.length<=1||i>0){const t=e.trimLeft();t&&(n=Math.min(n,e.length-t.length))}})),n>=Number.MAX_VALUE&&(n=0);const i=[];for(t.forEach(((e,t)=>{0===t?i.push(e.trim()):i.push(e.substr(n).trimRight())}));i.length>0&&0===i[0].length;)i.shift();for(;i.length>0&&0===i[i.length-1].length;)i.pop();return i}Object.defineProperty(t,"__esModule",{value:!0}),t.extractParameterDocumentation=t.cleanAndSplitDocString=t.cleanDocString=void 0,t.cleanDocString=function(e){return n(e).join("\n")},t.cleanAndSplitDocString=n,t.extractParameterDocumentation=function(e,t){if(!e||!t)return;const i=n(e);for(const e of i){const n=e.trim();let i=n.indexOf("@param "+t);if(i>=0)return n.substr(i+7);if(i=n.indexOf(":param "+t),i>=0)return n.substr(i+7);if(i=n.indexOf(t+": "),i>=0)return n.substr(i);if(i=n.indexOf(t+" ("),i>=0)return n.substr(i)}}},67145:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportResolver=t.supportedFileExtensions=void 0;const a=n(9133),o=n(97956),l=n(94647),c=n(57485),p=n(14551),d=r(n(14551)),u=n(49900),h=n(37633),m=r(n(96453)),y=n(26477),g=n(91197),f=[".pyd",".so",".dylib"];t.supportedFileExtensions=[".py",".pyi",...f];t.ImportResolver=class{constructor(e,t){this._cachedPythonSearchPaths=new Map,this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this._cachedEntriesForPath=new Map,this.fileSystem=e,this._configOptions=t}invalidateCache(){this._cachedPythonSearchPaths=new Map,this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this._invalidateFileSystemCache(),this.fileSystem instanceof h.PyrightFileSystem&&this.fileSystem.clearPartialStubs()}resolveImport(e,t,n){const i=this.formatImportName(n),s=[],r={importName:i,isRelative:!1,isImportFound:!1,isPartlyResolved:!1,isNamespacePackage:!1,isStubPackage:!1,importFailureInfo:s,resolvedPaths:[],importType:2,isStubFile:!1,isNativeLib:!1,implicitImports:[],filteredImplicitImports:[],nonStubImportResult:void 0};if(this.ensurePartialStubPackages(t),n.leadingDots>0){const r=this._resolveRelativeImport(e,t,n,i,s);if(r)return r.isRelative=!0,r}else{const s=this._lookUpResultsInCache(t,i,n.importedSymbols);if(s){if(!(s.isImportFound&&s.isNamespacePackage&&!this._isNamespacePackageResolved(n,s.implicitImports)))return s}const a=this._resolveBestAbsoluteImport(e,t,n,!0);if(a)return a.isStubFile&&(a.nonStubImportResult=this._resolveBestAbsoluteImport(e,t,n,!1)||r),this.addResultsToCache(t,i,a,n.importedSymbols)}return this.addResultsToCache(t,i,r,void 0)}getCompletionSuggestions(e,t,n,i){const s=[],r=new Set;if(n.leadingDots>0)this._getCompletionSuggestionsRelative(e,n,r,i);else{n.nameParts.length>0&&this._getCompletionSuggestionsTypeshedPath(t,n,!0,r,i),this.getCompletionSuggestionsAbsolute(t.root,n,r,i);for(const e of t.extraPaths)this.getCompletionSuggestionsAbsolute(e,n,r,i);this._configOptions.stubPath&&this.getCompletionSuggestionsAbsolute(this._configOptions.stubPath,n,r,i),this._getCompletionSuggestionsTypeshedPath(t,n,!1,r,i);const e=this.getPythonSearchPaths(t,s);for(const t of e)this.getCompletionSuggestionsAbsolute(t,n,r,i)}return r}getSourceFilesFromStub(e,t,n){const i=[];if(this._cachedImportResults.forEach((t=>{t.forEach((t=>{if(t.isStubFile&&t.isImportFound&&t.nonStubImportResult&&t.resolvedPaths[t.resolvedPaths.length-1]===e&&t.nonStubImportResult.isImportFound){const e=t.nonStubImportResult.resolvedPaths[t.nonStubImportResult.resolvedPaths.length-1];e.endsWith(".py")&&i.push(e)}}))})),0===i.length){const t=l.changeAnyExtension(e,".py");this.dirExistsCached(t)&&i.push(t)}if(0===i.length){const n=this.getImportRoots(t),s=[];for(const t of n)if(l.containsPath(t,e,!0)){const n=l.getRelativePathComponentsFromDirectory(t,e,!0);if(n.length>1){n[1].endsWith(o.stubsSuffix)&&(n[1]=n[1].substr(0,n[1].length-o.stubsSuffix.length));const e=l.combinePathComponents(n);e&&s.push(e)}}for(const e of s)for(const t of n){const n=l.resolvePaths(t,e);let s=l.changeAnyExtension(n,".py");if(this.fileExistsCached(s))i.push(s);else{const e=l.stripFileExtension(s);e.endsWith("__init__")?(s=e.substr(0,e.length-9)+".py",this.fileExistsCached(s)&&i.push(s)):(s=l.combinePaths(e,"__init__.py"),this.fileExistsCached(s)&&i.push(s))}}}return i}getModuleNameForImport(e,t){const n=a.getOrAdd(this._cachedModuleNameResults,t.root,(()=>new Map));return a.getOrAdd(n,e,(()=>this._getModuleNameForImport(e,t)))}_getModuleNameForImport(e,t){let n,i=0,s=!1;const r=[],a=this._getStdlibTypeshedPath(t,r);if(a&&(n=this.getModuleNameFromPath(a,e),n)){const e={leadingDots:0,nameParts:n.split("."),importedSymbols:void 0};if(this._isStdlibTypeshedStubValidForVersion(e,t,[]))return{moduleName:n,importType:i,isLocalTypingsFile:s}}n=this.getModuleNameFromPath(t.root,e);for(const s of t.extraPaths){const t=this.getModuleNameFromPath(s,e);(!n||t&&t.length0&&i.push(...a),i}readdirEntriesCached(e){const t=this._cachedEntriesForPath.get(e);if(t)return t;let n;try{n=this.fileSystem.readdirEntriesSync(e)}catch{n=[]}return this._cachedEntriesForPath.set(e,n),n}fileExistsCached(e){var t,n;const i=this._splitPath(e);if(!i[0]||!i[1])return!!this.fileSystem.existsSync(e)&&(null!==(n=null===(t=l.tryStat(this.fileSystem,e))||void 0===t?void 0:t.isFile())&&void 0!==n&&n);const s=this.readdirEntriesCached(i[0]).find((e=>e.name===i[1]));if(null==s?void 0:s.isFile())return!0;if(null==s?void 0:s.isSymbolicLink()){const t=l.tryRealpath(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&l.isFile(this.fileSystem,t))return!0}return!1}dirExistsCached(e){var t,n;const i=this._splitPath(e);if(!i[0]||!i[1])return!!this.fileSystem.existsSync(e)&&(null!==(n=null===(t=l.tryStat(this.fileSystem,e))||void 0===t?void 0:t.isDirectory())&&void 0!==n&&n);const s=this.readdirEntriesCached(i[0]).find((e=>e.name===i[1]));if(null==s?void 0:s.isDirectory())return!0;if(null==s?void 0:s.isSymbolicLink()){const t=l.tryRealpath(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&l.isDirectory(this.fileSystem,t))return!0}return!1}ensurePartialStubPackages(e){if(!(this.fileSystem instanceof h.PyrightFileSystem))return!1;if(this.fileSystem.isPartialStubPackagesScanned(e))return!1;const t=this.fileSystem,n=[],i=[];return s(this._configOptions.stubPath),s(e.root),e.extraPaths.forEach((e=>s(e))),s(this.getTypeshedPathEx(e,n)),this.getPythonSearchPaths(e,n).forEach((e=>s(e))),this.fileSystem.processPartialStubPackages(i,this.getImportRoots(e)),this._invalidateFileSystemCache(),!0;function s(e){e&&!t.isPathScanned(e)&&i.push(e)}}addResultsToCache(e,t,n,i){return a.getOrAdd(this._cachedImportResults,e.root,(()=>new Map)).set(t,n),this.filterImplicitImports(n,i)}resolveAbsoluteImport(e,t,n,i,s,r=!1,a=!1,o=!1,l=!0,c=!1){if(l&&o){const a=this._resolveAbsoluteImport(e,t,n,i,s,r,!1,!0,!0,!0);if(a.packageDirectory)return a}return this._resolveAbsoluteImport(e,t,n,i,s,r,a,!1,l,c)}_invalidateFileSystemCache(){this._cachedEntriesForPath.clear()}_splitPath(e){const t=l.getPathComponents(e);if(t.length<=1)return[e,""];return[l.combinePathComponents(t.slice(0,-1)),t[t.length-1]]}_resolveAbsoluteImport(e,t,n,i,s,r,a,c,p,d){s.push(`Attempting to resolve using root path '${e}'`);const u=[];let h,m,g,f=e,T=!1,_=!1,v=!1,b=!1,I=[];if(0===n.nameParts.length){const e="__init__",t=l.combinePaths(f,e+".py"),n=l.combinePaths(f,e+".pyi");p&&this.fileExistsCached(n)?(s.push(`Resolved import with file '${n}'`),u.push(n),v=!0):this.fileExistsCached(t)?(s.push(`Resolved import with file '${t}'`),u.push(t)):(s.push(`Partially resolved import with directory '${f}'`),u.push(""),T=!0),I=this._findImplicitImports(i,f,[t,n])}else for(let e=0;ethis._isNativeModuleFileName(D,e)));if(e){const r=l.combinePaths(S,e);b=this._resolveNativeModuleStub(r,t,i,n,s,u)}}!b&&C?(s.push(`Partially resolved import with directory '${f}'`),u.push(""),g&&(I=this._findImplicitImports(i,f,[F,A]),T=!0)):b&&s.push(`Did not find file '${A}' or '${F}'`)}break}const C=u.length>0&&u.length0:u.length>=n.nameParts.length,{importName:i,isRelative:!1,isNamespacePackage:T,isStubPackage:_,isImportFound:g,isPartlyResolved:C,importFailureInfo:s,importType:2,resolvedPaths:u,searchPath:e,isStubFile:v,isNativeLib:b,implicitImports:I,pyTypedInfo:m,filteredImplicitImports:I,packageDirectory:h}}getTypeshedPathEx(e,t){}resolveImportEx(e,t,n,i,s=[],r=!0){}resolveNativeImportEx(e,t,n=[]){}getNativeModuleName(e){const t=l.getFileExtension(e,!1).toLowerCase();if(this._isNativeModuleFileExtension(t))return l.stripFileExtension(l.stripFileExtension(e))}_lookUpResultsInCache(e,t,n){const i=this._cachedImportResults.get(e.root);if(!i)return;const s=i.get(t);return s?this.filterImplicitImports(s,n):void 0}_isNamespacePackageResolved(e,t){if(e.importedSymbols){if(!e.importedSymbols.some((e=>t.some((t=>t.name===e)))))return!1}else if(0===t.length)return!1;return!0}getModuleNameFromPath(e,t,n=!1){e=l.ensureTrailingDirectorySeparator(e);let i=l.stripFileExtension(t);if(this._isNativeModuleFileExtension(l.getFileExtension(t))&&(i=l.stripFileExtension(i)),!i.startsWith(e))return;i.endsWith("__init__")&&(i=i.substr(0,i.length-9));const s=i.substr(e.length),r=l.getPathComponents(s);if(r.shift(),n){if(0===r.length)return;r.shift()}return 0===r.length||(r[0].endsWith(o.stubsSuffix)&&(r[0]=r[0].substr(0,r[0].length-o.stubsSuffix.length)),r.some((e=>!this._isIdentifier(e))))?void 0:r.join(".")}_resolveBestAbsoluteImport(e,t,n,i){const s=this.formatImportName(n),r=[];if(i&&n.nameParts.length>0){const e=this._findTypeshedPath(t,n,s,!0,r);if(e)return e.isTypeshedFile=!0,e}if(i&&this._configOptions.stubPath){r.push(`Looking in stubPath '${this._configOptions.stubPath}'`);const e=this.resolveAbsoluteImport(this._configOptions.stubPath,t,n,s,r,void 0,!1,!0,i,!1);if(e.isImportFound)return e.importType=2,e.isLocalTypingsFile=!0,e}let a;r.push(`Looking in root directory of execution environment '${t.root}'`);let o=this.resolveAbsoluteImport(t.root,t,n,s,r,void 0,!0,!0,i,!1);a=o;for(const e of t.extraPaths)r.push(`Looking in extraPath '${e}'`),o=this.resolveAbsoluteImport(e,t,n,s,r,void 0,!0,!0,i,!1),a=this._pickBestImport(a,o,n);const l=this.getPythonSearchPaths(t,r);if(l.length>0)for(const e of l){r.push(`Looking in python search path '${e}'`);const o=this.resolveAbsoluteImport(e,t,n,s,r,false,!0,!0,i,!0);if(o){if(o.importType=1,o.isImportFound&&o.isStubFile)return o;a=this._pickBestImport(a,o,n)}}else r.push("No python interpreter search path");if(t.root!==this._getTypeshedRoot(t,r)&&(null==a?void 0:a.pyTypedInfo)&&!a.isPartlyResolved)return a;const c=this.resolveImportEx(e,t,n,s,r,i);if(void 0!==c)return c;if(i){r.push("Looking for typeshed path");const e=this._findTypeshedPath(t,n,s,!1,r);if(e)return e.isTypeshedFile=!0,e}return a}_pickBestImport(e,t,n){if(!e)return t;if(!t)return e;if(t.isImportFound){if(!e.isImportFound)return t;if(e.isNamespacePackage&&!t.isNamespacePackage)return t;if(e.isNamespacePackage&&t.isNamespacePackage&&n.importedSymbols&&!this._isNamespacePackageResolved(n,e.implicitImports)&&this._isNamespacePackageResolved(n,t.implicitImports))return t;if(e.resolvedPaths.length>t.resolvedPaths.length)return t}else if(t.isPartlyResolved&&e.isNamespacePackage&&!t.isNamespacePackage)return t;return e}_isIdentifier(e){for(let t=0;tthis.fileSystem.realCasePath(e)));e=[...new Set(e)],this._cachedPythonSearchPaths.set(n,e)}return this._cachedPythonSearchPaths.get(n)}_findTypeshedPath(e,t,n,i,s){s.push(`Looking for typeshed ${i?m.stdLibFolderName:m.thirdPartyFolderName} path`);const r=i?this._getStdlibTypeshedPath(e,s,t):this._getThirdPartyTypeshedPackagePath(t,e,s);if(r&&this.dirExistsCached(r)){const a=this.resolveAbsoluteImport(r,e,t,n,s);if(a.isImportFound)return a.importType=i?0:1,a}s.push("Typeshed path not found")}_buildTypeshedThirdPartyPackageMap(e){this._cachedTypeshedThirdPartyPackagePaths=new Map,e&&this.readdirEntriesCached(e).forEach((t=>{if(t.isDirectory()){const n=l.combinePaths(e,t.name);this.readdirEntriesCached(n).forEach((e=>{"@python2"!==e.name&&(e.isDirectory()?this._cachedTypeshedThirdPartyPackagePaths.set(e.name,n):e.isFile()&&e.name.endsWith(".pyi")&&this._cachedTypeshedThirdPartyPackagePaths.set(l.stripFileExtension(e.name),n))}))}})),this._cachedTypeshedThirdPartyPackageRoots=[...new Set(this._cachedTypeshedThirdPartyPackagePaths.values())].sort()}_getCompletionSuggestionsTypeshedPath(e,t,n,i,s){const r=[],a=n?this._getStdlibTypeshedPath(e,r,t):this._getThirdPartyTypeshedPackagePath(t,e,r);a&&this.dirExistsCached(a)&&this.getCompletionSuggestionsAbsolute(a,t,i,s)}_getStdlibTypeshedPath(e,t,n){const i=this._getTypeshedSubdirectory(!0,e,t);if(!i||!n||this._isStdlibTypeshedStubValidForVersion(n,e,t))return i}_getThirdPartyTypeshedPath(e,t){return this._getTypeshedSubdirectory(!1,e,t)}_isStdlibTypeshedStubValidForVersion(e,t,n){this._cachedTypeshedStdLibModuleVersions||(this._cachedTypeshedStdLibModuleVersions=this._readTypeshedStdLibVersions(t,n));for(let n=1;n<=e.nameParts.length;n++){const i=e.nameParts.slice(0,n),s=this._cachedTypeshedStdLibModuleVersions.get(i.join("."));if(s){if(t.pythonVersions.max)return!1}}return!0}_readTypeshedStdLibVersions(e,t){const n=new Map,i=this._getTypeshedSubdirectory(!0,e,t);if(i){const e=l.combinePaths(i,"VERSIONS");try{const i=this.fileSystem.statSync(e);if(i.size>0&&i.size<262144){this.fileSystem.readFileSync(e,"utf8").split(/\r?\n/).forEach((e=>{const t=e.split("#")[0].split(":");if(2!==t.length)return;const i=t[1].split("-");if(i.length>2)return;const s=t[0].trim();if(!s)return;let r=i[0].trim();r.endsWith("+")&&(r=r.substr(0,r.length-1));let a,o=c.versionFromString(r);o||(o=c.PythonVersion.V3_0),i.length>1&&(a=c.versionFromString(i[1].trim())),n.set(s,{min:o,max:a})}))}else t.push("Typeshed stdlib VERSIONS file is unexpectedly large")}catch(e){t.push(`Could not read typeshed stdlib VERSIONS file: '${JSON.stringify(e)}'`)}}return n}_getThirdPartyTypeshedPackagePath(e,t,n){const i=this._getThirdPartyTypeshedPath(t,n);this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(i);const s=e.nameParts.length>0?e.nameParts[0]:"";return this._cachedTypeshedThirdPartyPackagePaths.get(s)}_getThirdPartyTypeshedPackagePaths(e,t){const n=this._getThirdPartyTypeshedPath(e,t);return this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(n),this._cachedTypeshedThirdPartyPackageRoots}_getTypeshedRoot(e,t){if(void 0!==this._cachedTypeshedRoot)return this._cachedTypeshedRoot;let n="";if(this._configOptions.typeshedPath){const e=this._configOptions.typeshedPath;this.dirExistsCached(e)&&(n=e)}else{const i=this.getPythonSearchPaths(e,t);for(const e of i){const t=l.combinePaths(e,"typeshed");if(this.dirExistsCached(t)){n=t;break}}}return n||(n=m.getTypeShedFallbackPath(this.fileSystem)||""),this._cachedTypeshedRoot=n,n}_getTypeshedSubdirectory(e,t,n){if(e){if(void 0!==this._cachedTypeshedStdLibPath)return this._cachedTypeshedStdLibPath}else if(void 0!==this._cachedTypeshedThirdPartyPath)return this._cachedTypeshedThirdPartyPath;let i=this._getTypeshedRoot(t,n);if(i=m.getTypeshedSubdirectory(i,e),this.dirExistsCached(i))return e?this._cachedTypeshedStdLibPath=i:this._cachedTypeshedThirdPartyPath=i,i}_resolveRelativeImport(e,t,n,i,s){s.push("Attempting to resolve relative import");let r=l.getDirectoryPath(e);for(let e=1;ee.isFile())).map((e=>e.name));return t.forEach((t=>{var i;const s=l.combinePaths(e,t.name);t.isSymbolicLink()&&(null===(i=l.tryStat(this.fileSystem,s))||void 0===i?void 0:i.isFile())&&n.push(t.name)})),n}getCompletionSuggestionsAbsolute(e,t,n,i){let s=e;const r=t.nameParts.map((e=>e));if(t.hasTrailingDot&&r.push(""),0===r.length)this._addFilteredSuggestions(s,"",n,i);else for(let e=0;e{const s=l.getFileExtension(e,!1).toLowerCase(),r=l.stripFileExtension(e,!0);t.supportedFileExtensions.some((e=>e===s))&&"__init__"!==r&&(n&&!d.isPatternInSymbol(n,r)||this._addUniqueSuggestion(r,i))})),r.directories.forEach((e=>{n&&!e.startsWith(n)||this._addUniqueSuggestion(e,i)}))}_addUniqueSuggestion(e,t){t.has(e)||/[.-]/.test(e)||g.isDunderName(e)&&"__future__"!==e||t.add(e)}filterImplicitImports(e,t){if(void 0===t){const t=Object.assign({},e);return t.filteredImplicitImports=[],t}if(0===t.length)return e;if(0===e.implicitImports.length)return e;const n=e.implicitImports.filter((e=>t.some((t=>t===e.name))));if(n.length===e.implicitImports.length)return e;const i=Object.assign({},e);return i.filteredImplicitImports=n,i}_findImplicitImports(e,t,n){const i=new Map,s=l.getFileSystemEntriesFromDirEntries(this.readdirEntriesCached(t),this.fileSystem,t);for(const r of s.files){const s=l.getFileExtension(r);let a,o=!1;if(".py"===s||".pyi"===s)a=l.stripFileExtension(r);else{if(!this._isNativeModuleFileExtension(s)||this.fileExistsCached(`${r}.py`)||this.fileExistsCached(`${r}.pyi`))continue;a=r.substr(0,r.indexOf(".")),o=!0}const c=l.combinePaths(t,r);if(!n.find((e=>e===c))){const n={isStubFile:r.endsWith(".pyi"),isNativeLib:o,name:a,path:c},s=i.get(n.name);if(!s||!s.isStubFile){if(o){const i=l.combinePaths(t,r),s=this.resolveNativeImportEx(i,`${e}.${a}`,[]);s&&(n.path=s,n.isNativeLib=!1)}i.set(n.name,n)}}}for(const e of s.directories){const s=l.combinePaths(t,e,"__init__.py"),r=s+"i";let a=!1,o="";if(this.fileExistsCached(r)?(a=!0,o=r):this.fileExistsCached(s)&&(o=s),o&&!n.find((e=>e===o))){const t={isStubFile:a,isNativeLib:!1,name:e,path:o};i.set(t.name,t)}}return[...i.values()]}formatImportName(e){return".".repeat(e.leadingDots)+e.nameParts.join(".")}_resolveNativeModuleStub(e,t,n,i,s,r){let a=n;if(i.leadingDots>0){const n=this.getModuleNameForImport(e,t);a=n.moduleName.length>0?n.moduleName:a}const o=this.resolveNativeImportEx(e,a,s);return o?(s.push(`Resolved native import ${n} with stub '${o}'`),r.push(o),!1):(s.push(`Resolved import with file '${e}'`),r.push(e),!0)}_isNativeModuleFileName(e,t){const n=l.getFileExtension(t,!1).toLowerCase(),i=l.stripFileExtension(t,!0);return this._isNativeModuleFileExtension(n)&&p.equateStringsCaseInsensitive(e,i)}_isNativeModuleFileExtension(e){return f.some((t=>t===e))}}},45214:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getAllImportNames=t.getContainingImportStatement=t.getTextEditsForAutoImportInsertion=t.getTextEditsForAutoImportSymbolAddition=t.getTopLevelImports=t.compareImportStatements=t.getImportGroup=void 0;const a=n(38213),o=n(28348),l=n(80957),c=r(n(35696)),p=r(n(91197));function d(e){return e.importResult?0===e.importResult.importType?0:1===e.importResult.importType||e.importResult.isLocalTypingsFile?1:e.importResult.isRelative?3:2:2}function u(e){let t="";for(let n=0;ne.value)).join("."),t}t.getImportGroup=d,t.compareImportStatements=function(e,t){const n=d(e),i=d(t);return ni?1:e.moduleName{47===e.nodeType?e.statements.forEach((e=>{20===e.nodeType?(s=!0,function(e,t,n){e.list.forEach((i=>{const s=c.getImportInfo(i.module);let r;s&&s.isImportFound&&(r=s.resolvedPaths[s.resolvedPaths.length-1]);const a={node:e,subnode:i,importResult:s,resolvedPath:r,moduleName:u(i.module),followsNonImportStatement:n};t.orderedImports.push(a),r&&(t.mapByFilePath.has(r)||t.mapByFilePath.set(r,a))}))}(e,n,i),i=!1):22===e.nodeType?(s=!0,function(e,t,n,i){var s;const r=c.getImportInfo(e.module);let a;r&&r.isImportFound&&(a=r.resolvedPaths[r.resolvedPaths.length-1]);if(i&&r){t.implicitImports=null!==(s=t.implicitImports)&&void 0!==s?s:new Map;for(const n of r.implicitImports){const i=e.imports.find((e=>e.name.value===n.name));i&&t.implicitImports.set(n.path,i)}}const o={node:e,importResult:r,resolvedPath:a,moduleName:u(e.module),followsNonImportStatement:n};if(t.orderedImports.push(o),a){const e=t.mapByFilePath.get(a);(!e||20===e.node.nodeType||e.moduleName.length>o.moduleName.length)&&t.mapByFilePath.set(a,o)}}(e,n,i,t),i=!1):i=s})):i=s})),n},t.getTextEditsForAutoImportSymbolAddition=function(e,t,n,i){const s=[];let r;if(t.node&&22===t.node.nodeType&&!t.node.imports.some((t=>t.name.value===e))){for(const n of t.node.imports){if(n.name.value>e)break;r=n}let a=!1,c="";if(t.node.imports.length>0){const e=o.convertOffsetToPosition(t.node.start,n.tokenizerOutput.lines),i=o.convertOffsetToPosition(t.node.imports[0].start,n.tokenizerOutput.lines),s=t.node.imports.length>1?o.convertOffsetToPosition(t.node.imports[1].start,n.tokenizerOutput.lines):void 0;if(i.line>e.line&&(void 0===s||s.line>i.line)){const e=n.tokenizerOutput.lines.getItemAt(i.line);c=n.text.substr(e.start,i.character),/^\s*$/.test(c)&&(a=!0)}}const p=r?l.TextRange.getEnd(r):t.node.imports.length>0?t.node.imports[0].start:t.node.start+t.node.length,d=o.convertOffsetToPosition(p,n.tokenizerOutput.lines),u=i?`${e} as ${i}`:`${e}`;let h;if(a){const e=n.tokenizerOutput.predominantEndOfLineSequence;h=r?`,${e}${c}${u}`:`${u},${e}${c}`}else h=r?`, ${u}`:`${u}, `;s.push({range:{start:d,end:d},replacementText:h})}return s},t.getTextEditsForAutoImportInsertion=function(e,t,n,i,s,r,a){const c=[],u=e||n,h=a?`${u} as ${a}`:u;let m,y=e?`from ${n} import ${h}`:`import ${h}`;const g=o.convertPositionToOffset(r,s.tokenizerOutput.lines);if(t.orderedImports.length>0&&g>=t.orderedImports[0].node.start){let e=!0,r=t.orderedImports[0],a=0;for(const o of t.orderedImports){const l=o.importResult?d(o):a;if(in)break;if(o.followsNonImportStatement){i>a&&(y=s.tokenizerOutput.predominantEndOfLineSequence+y);break}o===t.orderedImports[t.orderedImports.length-1]&&i>l&&(y=s.tokenizerOutput.predominantEndOfLineSequence+y),e=!e&&ic.TextRange.getEnd(e))return;const n=(new u.ParseTreeWalker).visitNode(e);for(const e of n)if(e){const n=h(e,t);if(n)return n}return e}function m(e,t){let n="";return 1===e.argumentCategory?n="*":2===e.argumentCategory&&(n="**"),e.name&&(n+=e.name.value+"="),n+=y(e.valueExpression,t),n}function y(e,t=0){switch(e.nodeType){case 38:return e.value;case 35:return y(e.leftExpression,t)+"."+e.memberName.value;case 9:return y(e.leftExpression,t)+"("+e.arguments.map((e=>m(e,t))).join(", ")+")";case 24:return y(e.baseExpression,t)+"["+e.items.map((e=>m(e,t))).join(", ")+"]"+(e.trailingComma?",":"");case 55:return g(e.operator)+" "+y(e.expression,t);case 7:{const n=y(e.leftExpression,t)+" "+g(e.operator)+" "+y(e.rightExpression,t);return e.parenthesized?`(${n})`:n}case 40:{let t=e.value.toString();return e.isImaginary&&(t+="j"),t}case 48:return 1&t&&e.typeAnnotation?y(e.typeAnnotation,t):e.strings.map((e=>y(e,t))).join(" ");case 49:{let t="";return 8&e.token.flags&&(t+="r"),16&e.token.flags&&(t+="u"),32&e.token.flags&&(t+="b"),64&e.token.flags&&(t+="f"),4&e.token.flags?1&e.token.flags?t+=`'''${e.token.escapedValue}'''`:t+=`"""${e.token.escapedValue}"""`:1&e.token.flags?t+=`'${e.token.escapedValue}'`:t+=`"${e.token.escapedValue}"`,t}case 3:return y(e.leftExpression,t)+" = "+y(e.rightExpression,t);case 4:return y(e.name,t)+" := "+y(e.rightExpression,t);case 54:return y(e.valueExpression,t)+": "+y(e.typeAnnotation,t);case 5:return y(e.leftExpression,t)+" "+g(e.operator)+" "+y(e.rightExpression,t);case 6:return"await "+y(e.expression,t);case 51:return y(e.ifExpression,t)+" if "+y(e.testExpression,t)+" else "+y(e.elseExpression,t);case 31:return`[${e.entries.map((e=>y(e,t))).join(", ")}]`;case 56:return"*"+y(e.expression,t);case 52:{const n=e.expressions.map((e=>y(e,t)));return 1===n.length?`(${n[0]}, )`:`(${n.join(", ")})`}case 60:return e.expression?"yield "+y(e.expression,t):"yield";case 61:return"yield from "+y(e.expression,t);case 18:return"...";case 32:{let n="";if(p.isExpressionNode(e.expression))n=y(e.expression,t);else if(17===e.expression.nodeType){n=`${y(e.expression.keyExpression,t)}: ${y(e.expression.valueExpression,t)}`}return n+" "+e.comprehensions.map((e=>33===e.nodeType?(e.isAsync?"async ":"")+"for "+y(e.targetExpression,t)+` in ${y(e.iterableExpression,t)}`:`if ${y(e.testExpression,t)}`)).join(" ")}case 46:{let n="";return e.startValue&&(n+=y(e.startValue,t)),e.endValue&&(n+=": "+y(e.endValue,t)),e.stepValue&&(n+=": "+y(e.stepValue,t)),n}case 30:return"lambda "+e.parameters.map((e=>{let n="";return 1===e.category?n+="*":2===e.category&&(n+="**"),e.name&&(n+=e.name.value),e.defaultValue&&(n+=" = "+y(e.defaultValue,t)),n})).join(", ")+": "+y(e.expression,t);case 11:if(33===e.constType)return"True";if(15===e.constType)return"False";if(9===e.constType)return"__debug__";if(26===e.constType)return"None";break;case 15:{const n=`${e.entries.map((e=>17===e.nodeType?`${y(e.keyExpression,t)}: ${y(e.valueExpression,t)}`:y(e,t)))}`;return n?`{ ${n} }`:"{}"}case 16:return`**${y(e.expandExpression,t)}`;case 45:return e.entries.map((e=>y(e,t))).join(", ")}return""}function g(e){const t={0:"+",1:"+=",2:"=",3:"&",4:"&=",5:"~",6:"|",7:"|=",8:"^",9:"^=",10:"/",11:"/=",12:"==",13:"//",14:"//=",15:">",16:">=",17:"<<",18:"<<=",19:"<>",20:"<",21:"<=",22:"@",23:"@=",24:"%",25:"%=",26:"*",27:"*=",28:"!=",29:"**",30:"**=",31:">>",32:">>=",33:"-",34:"-=",36:"and",37:"or",38:"not",39:"is",40:"is not",41:"in",42:"not in"};return t[e]?t[e]:"unknown"}function f(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return;if(28===n.nodeType&&t)return;n=n.parent}}function T(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return;t=t.parent}}function _(e){let t,n=e,i=!1;for(;n;){switch(41===n.nodeType&&t===n.name&&(i=!0),n.nodeType){case 28:if(n.parameters.some((e=>e===t))){if(i&&void 0!==d.getScope(n))return n}else if(t===n.suite&&void 0!==d.getScope(n))return n;break;case 30:if(n.parameters.some((e=>e===t))){if(i&&void 0!==d.getScope(n))return n}else if((!t||t===n.expression)&&void 0!==d.getScope(n))return n;break;case 10:if(t===n.suite&&void 0!==d.getScope(n))return n;break;case 32:case 36:if(void 0!==d.getScope(n))return n}t=n,n=n.parent}o.fail("Did not find evaluation scope")}function v(e,t){if(38===e.nodeType)return 38===t.nodeType?e.value===t.value:4===t.nodeType&&e.value===t.name.value;if(35===e.nodeType&&35===t.nodeType)return v(e.leftExpression,t.leftExpression)&&e.memberName.value===t.memberName.value;if(24===e.nodeType&&24===t.nodeType){if(!v(e.baseExpression,t.baseExpression))return!1;if(1!==t.items.length||t.trailingComma||t.items[0].name||0!==t.items[0].argumentCategory)return!1;if(40===e.items[0].valueExpression.nodeType){const n=e.items[0].valueExpression,i=t.items[0].valueExpression;return!(40!==i.nodeType||i.isImaginary||!i.isInteger)&&n.value===i.value}if(48===e.items[0].valueExpression.nodeType){const n=e.items[0].valueExpression,i=t.items[0].valueExpression;if(1===n.strings.length&&49===n.strings[0].nodeType&&48===i.nodeType&&1===i.strings.length&&49===i.strings[0].nodeType)return n.strings[0].value===i.strings[0].value}return!1}return!1}t.getNodeDepth=function(e){let t=0,n=e;for(;n;)t++,n=n.parent;return t},t.findNodeByPosition=function(e,t,n){const i=l.convertPositionToOffset(t,n);if(void 0!==i)return h(e,i)},t.findNodeByOffset=h,t.printArgument=m,t.printExpression=y,t.printOperator=g,t.getEnclosingClass=f,t.getEnclosingModule=function(e){let t=e.parent;for(;t;){if(36===t.nodeType)return t;t=t.parent}o.fail("Module node not found")},t.getEnclosingClassOrModule=function(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return n;if(28===n.nodeType&&t)return;n=n.parent}},t.getEnclosingFunction=T,t.getEnclosingLambda=function(e){let t=e.parent;for(;t;){if(30===t.nodeType)return t;if(50===t.nodeType)return;t=t.parent}},t.getEnclosingClassOrFunction=function(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return t;t=t.parent}},t.getEnclosingSuiteOrModule=function(e,t=!1,n=!0){let i=e.parent;for(;i;){if(50===i.nodeType)return i;if(36===i.nodeType)return i;if(30===i.nodeType&&n)return;if(28===i.nodeType&&t)return;i=i.parent}},t.getEvaluationNodeForAssignmentExpression=function(e){let t=!1,n=_(e);for(;void 0!==n;){switch(n.nodeType){case 28:case 30:case 36:return n;case 10:return t?void 0:n;case 32:t=!0}n=n.parent}},t.getEvaluationScopeNode=_,t.getTypeVarScopeNode=function(e,t=!1){let n,i=e;for(;i;){switch(i.nodeType){case 28:if((n===i.suite||t)&&!i.decorators.some((e=>e===n)))return i;break;case 10:if(n===i.suite&&!i.decorators.some((e=>e===n)))return i}n=i,i=i.parent}},t.getExecutionScopeNode=function(e){let t=_(e);for(;10===t.nodeType||32===t.nodeType;)t=_(t.parent);return t},t.getTypeAnnotationNode=function(e){let t=e,n=e.parent;for(;n;){if(54===n.nodeType){if(n.typeAnnotation===t)return n;break}t=n,n=n.parent}},t.isFinalAllowedForAssignmentTarget=function(e){if(38===e.nodeType)return!0;if(35===e.nodeType){if(38!==e.leftExpression.nodeType)return!1;if(!f(e))return!1;const t=T(e);return!!t&&"__init__"===t.name.value}return!1},t.isClassVarAllowedForAssignmentTarget=function(e){return!!f(e,!0)},t.isNodeContainedWithin=function(e,t){let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},t.isSuiteEmpty=function(e){for(const t of e.statements){if(47!==t.nodeType)return!1;for(const e of t.statements)if(18===e.nodeType);else if(48!==e.nodeType)return!1}return!0},t.isMatchingExpression=v,t.isPartialMatchingExpression=function e(t,n){return 35===t.nodeType?v(t.leftExpression,n)||e(t.leftExpression,n):24===t.nodeType&&(v(t.baseExpression,n)||e(t.baseExpression,n))},t.isWithinDefaultParamInitializer=function(e){let t,n=e;for(;n;){if(41===n.nodeType&&t===n.defaultValue)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinTypeAnnotation=function(e,t){let n,i=e,s=!1;for(;i;){if(41===i.nodeType&&(n===i.typeAnnotation||n===i.typeAnnotationComment))return s||!t;if(28===i.nodeType&&n===i.returnTypeAnnotation)return s||!t;if(28===i.nodeType&&n===i.functionAnnotationComment)return!0;if(54===i.nodeType&&n===i.typeAnnotation)return s||!t;if(3===i.nodeType&&n===i.typeAnnotationComment)return!0;if(48===i.nodeType&&n===i.typeAnnotation&&(s=!0),30===i.nodeType||28===i.nodeType||10===i.nodeType||36===i.nodeType)return!1;n=i,i=i.parent}return!1},t.isWithinAnnotationComment=function(e){let t,n=e;for(;n;){if(28===n.nodeType&&t===n.functionAnnotationComment)return!0;if(3===n.nodeType&&t===n.typeAnnotationComment)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinLoop=function(e){let t=e;for(;t;){switch(t.nodeType){case 26:case 57:return!0}t=t.parent}return!1},t.isWithinTryBlock=function(e){let t,n=e;for(;n;){switch(n.nodeType){case 53:return n.trySuite===t}t=n,n=n.parent}return!1},t.isWithinAssertExpression=function(e){let t,n=e;for(;n;){switch(n.nodeType){case 2:return n.testExpression===t}t=n,n=n.parent}return!1},t.getDocString=function(e){if(0===e.length)return;if(47!==e[0].nodeType)return;const t=e[0];if(0===t.statements.length||48!==t.statements[0].nodeType)return;const n=t.statements[0].strings;return 0===n.length||n.some((e=>0!=(64&e.token.flags)))?void 0:1===n.length?n[0].value:n.map((e=>e.value)).join("")},t.isAssignmentToDefaultsFollowingNamedTuple=function(e){var t,n;if(9!==e.nodeType||!e.parent||3!==e.parent.nodeType||38!==e.parent.leftExpression.nodeType||!e.parent.parent||47!==e.parent.parent.nodeType)return!1;const i=e.parent.leftExpression.value,s=e.parent.parent;if(s.statements[0]!==e.parent||!s.parent||36!==s.parent.nodeType&&50!==s.parent.nodeType)return!1;const r=s.parent;let a=r.statements.findIndex((e=>e===s));if(a<0)return!1;for(a++;a{this._subscriptIndex=t,this.walk(e)})),this._subscriptIndex=t,this._baseExpression=n,!1}}function I(e){let t=e;for(;t&&36!==t.nodeType;)t=t.parent;return t}t.NameNodeWalker=b,t.getEnclosingParameter=function(e){let t=e;for(;t;){if(41===t.nodeType)return t;t=t.parent}},t.getCallNodeAndActiveParameterIndex=function(e,t,n){let i,s=e;for(;void 0!==s;){if(9===s.nodeType){i=s;break}s=s.parent}if(!i||!i.arguments)return;const r=n.getItemAtPosition(i.leftExpression.start);if(r>=0&&r+1a)return;const o=function(e,t){const n=e.getItemAtPosition(t);if(n<0)return;return e.getItemAt(n)}(n,a-1);if(t===a&&14===(null==o?void 0:o.type))return;let l=!1,p=-1,d=!1;return i.arguments.forEach(((e,i)=>{if(l)return;let s=e.start;const r=n.getItemAtPosition(s);r>=0&&(s=c.TextRange.getEnd(n.getItemAt(r-1)));let a=c.TextRange.getEnd(e);const o=n.getItemAtPosition(a);if(o>=0)for(let e=o;e=s,l=!0)})),l||(p=i.arguments.length+1),{callNode:i,activeIndex:p,activeOrFake:d}},t.printParseNodeType=function(e){switch(e){case 0:return"Error";case 1:return"Argument";case 2:return"Assert";case 3:return"Assignment";case 4:return"AssignmentExpression";case 5:return"AugmentedAssignment";case 6:return"Await";case 7:return"BinaryOperation";case 8:return"Break";case 9:return"Call";case 10:return"Class";case 11:return"Constant";case 12:return"Continue";case 13:return"Decorator";case 14:return"Del";case 15:return"Dictionary";case 16:return"DictionaryExpandEntry";case 17:return"DictionaryKeyEntry";case 18:return"Ellipsis";case 19:return"If";case 20:return"Import";case 21:return"ImportAs";case 22:return"ImportFrom";case 23:return"ImportFromAs";case 24:return"Index";case 25:return"Except";case 26:return"For";case 27:return"FormatString";case 28:return"Function";case 29:return"Global";case 30:return"Lambda";case 31:return"List";case 32:return"ListComprehension";case 33:return"ListComprehensionFor";case 34:return"ListComprehensionIf";case 35:return"MemberAccess";case 36:return"Module";case 37:return"ModuleName";case 38:return"Name";case 39:return"Nonlocal";case 40:return"Number";case 41:return"Parameter";case 42:return"Pass";case 43:return"Raise";case 44:return"Return";case 45:return"Set";case 46:return"Slice";case 47:return"StatementList";case 48:return"StringList";case 49:return"String";case 50:return"Suite";case 51:return"Ternary";case 52:return"Tuple";case 53:return"Try";case 54:return"TypeAnnotation";case 55:return"UnaryOperation";case 56:return"Unpack";case 57:return"While";case 58:return"With";case 59:return"WithItem";case 60:return"Yield";case 61:return"YieldFrom";case 62:return"FunctionAnnotation";case 63:return"Match";case 64:return"Case";case 65:return"PatternSequence";case 66:return"PatternAs";case 67:return"PatternLiteral";case 68:return"PatternClass";case 69:return"PatternCapture";case 70:return"PatternMapping";case 71:return"PatternMappingKeyEntry";case 72:return"PatternMappingExpandEntry";case 73:return"PatternValue";case 74:return"PatternClassArgument"}o.assertNever(e)},t.isWriteAccess=function(e){let t=e,n=t.parent;for(;n;){switch(n.nodeType){case 3:case 5:return t===n.leftExpression;case 4:return t===n.name;case 14:return!0;case 26:return t===n.targetExpression;case 21:return t===n.alias||n.module.nameParts.length>0&&t===n.module.nameParts[0];case 23:return t===n.alias||!n.alias&&t===n.name;case 35:if(t!==n.memberName)return!1;break;case 25:return t===n.name;case 58:return n.withItems.some((e=>e===t));case 33:return t===n.targetExpression;case 54:if(t===n.typeAnnotation)return!1;break;case 28:case 10:case 36:return!1}t=n,n=n.parent}return!1},t.getModuleNode=I,t.getFileInfoFromNode=function(e){const t=I(e);return t?a.getFileInfo(t):void 0},t.isFunctionSuiteEmpty=function(e){let t=!0;return e.suite.statements.forEach((e=>{0!==e.nodeType&&(47===e.nodeType?e.statements.forEach((e=>{18!==e.nodeType&&48!==e.nodeType&&42!==e.nodeType&&(t=!1)})):t=!1)})),t}},22339:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeWalker=void 0;const i=n(20823);t.ParseTreeWalker=class{walk(e){const t=this.visitNode(e);t.length>0&&this.walkMultiple(t)}walkMultiple(e){e.forEach((e=>{e&&this.walk(e)}))}visitNode(e){var t;switch(e.nodeType){case 1:if(this.visitArgument(e))return[e.name,e.valueExpression];break;case 2:if(this.visitAssert(e))return[e.testExpression,e.exceptionExpression];break;case 3:if(this.visitAssignment(e))return[e.leftExpression,e.rightExpression,e.typeAnnotationComment];break;case 4:if(this.visitAssignmentExpression(e))return[e.name,e.rightExpression];break;case 5:if(this.visitAugmentedAssignment(e))return[e.leftExpression,e.rightExpression];break;case 6:if(this.visitAwait(e))return[e.expression];break;case 7:if(this.visitBinaryOperation(e))return[e.leftExpression,e.rightExpression];break;case 8:if(this.visitBreak(e))return[];break;case 9:if(this.visitCall(e))return[e.leftExpression,...e.arguments];break;case 64:if(this.visitCase(e))return[e.pattern,e.guardExpression,e.suite];break;case 10:if(this.visitClass(e))return[...e.decorators,e.name,...e.arguments,e.suite];break;case 51:if(this.visitTernary(e))return[e.ifExpression,e.testExpression,e.elseExpression];break;case 11:if(this.visitConstant(e))return[];break;case 12:if(this.visitContinue(e))return[];break;case 13:if(this.visitDecorator(e))return[e.expression];break;case 14:if(this.visitDel(e))return e.expressions;break;case 15:if(this.visitDictionary(e))return e.entries;break;case 17:if(this.visitDictionaryKeyEntry(e))return[e.keyExpression,e.valueExpression];break;case 16:if(this.visitDictionaryExpandEntry(e))return[e.expandExpression];break;case 0:if(this.visitError(e))return[e.child,...null!==(t=e.decorators)&&void 0!==t?t:[]];break;case 19:if(this.visitIf(e))return[e.testExpression,e.ifSuite,e.elseSuite];break;case 20:if(this.visitImport(e))return e.list;break;case 21:if(this.visitImportAs(e))return[e.module,e.alias];break;case 22:if(this.visitImportFrom(e))return[e.module,...e.imports];break;case 23:if(this.visitImportFromAs(e))return[e.name,e.alias];break;case 24:if(this.visitIndex(e))return[e.baseExpression,...e.items];break;case 18:if(this.visitEllipsis(e))return[];break;case 25:if(this.visitExcept(e))return[e.typeExpression,e.name,e.exceptSuite];break;case 26:if(this.visitFor(e))return[e.targetExpression,e.iterableExpression,e.forSuite,e.elseSuite];break;case 27:if(this.visitFormatString(e))return e.expressions;break;case 28:if(this.visitFunction(e))return[...e.decorators,e.name,...e.parameters,e.returnTypeAnnotation,e.functionAnnotationComment,e.suite];break;case 62:if(this.visitFunctionAnnotation(e))return[...e.paramTypeAnnotations,e.returnTypeAnnotation];break;case 29:if(this.visitGlobal(e))return e.nameList;break;case 30:if(this.visitLambda(e))return[...e.parameters,e.expression];break;case 31:if(this.visitList(e))return e.entries;break;case 32:if(this.visitListComprehension(e))return[e.expression,...e.comprehensions];break;case 33:if(this.visitListComprehensionFor(e))return[e.targetExpression,e.iterableExpression];break;case 34:if(this.visitListComprehensionIf(e))return[e.testExpression];break;case 63:if(this.visitMatch(e))return[e.subjectExpression,...e.cases];break;case 35:if(this.visitMemberAccess(e))return[e.leftExpression,e.memberName];break;case 36:if(this.visitModule(e))return[...e.statements];break;case 37:if(this.visitModuleName(e))return e.nameParts;break;case 38:if(this.visitName(e))return[];break;case 39:if(this.visitNonlocal(e))return e.nameList;break;case 40:if(this.visitNumber(e))return[];break;case 41:if(this.visitParameter(e))return[e.name,e.typeAnnotation,e.typeAnnotationComment,e.defaultValue];break;case 42:if(this.visitPass(e))return[];break;case 69:if(this.visitPatternCapture(e))return[e.target];break;case 68:if(this.visitPatternClass(e))return[e.className,...e.arguments];break;case 74:if(this.visitPatternClassArgument(e))return[e.name,e.pattern];break;case 66:if(this.visitPatternAs(e))return[...e.orPatterns,e.target];break;case 67:if(this.visitPatternLiteral(e))return[e.expression];break;case 70:if(this.visitPatternMapping(e))return[...e.entries];break;case 71:if(this.visitPatternMappingKeyEntry(e))return[e.keyPattern,e.valuePattern];break;case 72:if(this.visitPatternMappingExpandEntry(e))return[e.target];break;case 65:if(this.visitPatternSequence(e))return[...e.entries];break;case 73:if(this.visitPatternValue(e))return[e.expression];break;case 43:if(this.visitRaise(e))return[e.typeExpression,e.valueExpression,e.tracebackExpression];break;case 44:if(this.visitReturn(e))return[e.returnExpression];break;case 45:if(this.visitSet(e))return e.entries;break;case 46:if(this.visitSlice(e))return[e.startValue,e.endValue,e.stepValue];break;case 47:if(this.visitStatementList(e))return e.statements;break;case 49:if(this.visitString(e))return[];break;case 48:if(this.visitStringList(e))return[e.typeAnnotation,...e.strings];break;case 50:if(this.visitSuite(e))return[...e.statements];break;case 52:if(this.visitTuple(e))return e.expressions;break;case 53:if(this.visitTry(e))return[e.trySuite,...e.exceptClauses,e.elseSuite,e.finallySuite];break;case 54:if(this.visitTypeAnnotation(e))return[e.valueExpression,e.typeAnnotation];break;case 55:if(this.visitUnaryOperation(e))return[e.expression];break;case 56:if(this.visitUnpack(e))return[e.expression];break;case 57:if(this.visitWhile(e))return[e.testExpression,e.whileSuite,e.elseSuite];break;case 58:if(this.visitWith(e))return[...e.withItems,e.suite];break;case 59:if(this.visitWithItem(e))return[e.expression,e.target];break;case 60:if(this.visitYield(e))return[e.expression];break;case 61:if(this.visitYieldFrom(e))return[e.expression];break;default:i.fail("Unexpected node type")}return[]}visitArgument(e){return!0}visitAssert(e){return!0}visitAssignment(e){return!0}visitAssignmentExpression(e){return!0}visitAugmentedAssignment(e){return!0}visitAwait(e){return!0}visitBinaryOperation(e){return!0}visitBreak(e){return!0}visitCall(e){return!0}visitCase(e){return!0}visitClass(e){return!0}visitTernary(e){return!0}visitContinue(e){return!0}visitConstant(e){return!0}visitDecorator(e){return!0}visitDel(e){return!0}visitDictionary(e){return!0}visitDictionaryKeyEntry(e){return!0}visitDictionaryExpandEntry(e){return!0}visitError(e){return!0}visitEllipsis(e){return!0}visitIf(e){return!0}visitImport(e){return!0}visitImportAs(e){return!0}visitImportFrom(e){return!0}visitImportFromAs(e){return!0}visitIndex(e){return!0}visitExcept(e){return!0}visitFor(e){return!0}visitFormatString(e){return!0}visitFunction(e){return!0}visitFunctionAnnotation(e){return!0}visitGlobal(e){return!0}visitLambda(e){return!0}visitList(e){return!0}visitListComprehension(e){return!0}visitListComprehensionFor(e){return!0}visitListComprehensionIf(e){return!0}visitMatch(e){return!0}visitMemberAccess(e){return!0}visitModule(e){return!0}visitModuleName(e){return!0}visitName(e){return!0}visitNonlocal(e){return!0}visitNumber(e){return!0}visitParameter(e){return!0}visitPass(e){return!0}visitPatternCapture(e){return!0}visitPatternClass(e){return!0}visitPatternClassArgument(e){return!0}visitPatternAs(e){return!0}visitPatternLiteral(e){return!0}visitPatternMappingExpandEntry(e){return!0}visitPatternSequence(e){return!0}visitPatternValue(e){return!0}visitPatternMappingKeyEntry(e){return!0}visitPatternMapping(e){return!0}visitRaise(e){return!0}visitReturn(e){return!0}visitSet(e){return!0}visitSlice(e){return!0}visitStatementList(e){return!0}visitString(e){return!0}visitStringList(e){return!0}visitSuite(e){return!0}visitTuple(e){return!0}visitTry(e){return!0}visitTypeAnnotation(e){return!0}visitUnaryOperation(e){return!0}visitUnpack(e){return!0}visitWhile(e){return!0}visitWith(e){return!0}visitWithItem(e){return!0}visitYield(e){return!0}visitYieldFrom(e){return!0}}},73054:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Program=t.MaxWorkspaceIndexFileCount=void 0;const a=n(29335),o=n(38213),l=n(11043),c=n(98173),p=n(20823),d=n(77134),u=n(94647),h=n(28348),m=n(14551),y=n(80957),g=n(76962),f=n(82615),T=n(30424),_=n(5165),v=r(n(35696)),b=n(41563),I=n(23241),C=n(57203),S=n(54549),D=n(93989),F=n(91197),A=n(25997),x=n(96938),k=n(96786);t.MaxWorkspaceIndexFileCount=2e3;class P{constructor(e,t,n,i,s,r){this._extension=i,this._disableChecker=r,this._sourceFileList=[],this._sourceFileMap=new Map,this._parsedFileCount=0,this._lookUpImport=e=>{var t;const n=this._getSourceFileInfoFromPath(e);if(!n)return;n.sourceFile.isBindingRequired()&&g.timingStats.typeCheckerTime.subtractFromTime((()=>{this._bindFile(n)}));const i=n.sourceFile.getModuleSymbolTable();if(!i)return;const s=n.sourceFile.getParseResults(),r=s.parseTree;return{symbolTable:i,dunderAllNames:null===(t=v.getDunderAllInfo(s.parseTree))||void 0===t?void 0:t.names,get docString(){return I.getDocString(r.statements)}}},this._console=n||new l.StandardConsole,this._logTracker=null!=s?s:new d.LogTracker(n,"FG"),this._importResolver=e,this._configOptions=t,this._createNewEvaluator()}get evaluator(){return this._evaluator}setConfigOptions(e){this._configOptions=e,this._createNewEvaluator()}setImportResolver(e){this._importResolver=e,this._createNewEvaluator()}setTrackedFiles(e){if(this._sourceFileList.length>0){const t=new Map;e.forEach((e=>{t.set(u.normalizePathCase(this._fs,e),e)})),this._sourceFileList.forEach((e=>{const n=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.isTracked=!1)}))}return this.addTrackedFiles(e),this._removeUnneededFiles()}setPreCheckCallback(e){this._preCheckCallback=e}setAllowedThirdPartyImports(e){this._allowedThirdPartyImports=e}addTrackedFiles(e,t=!1,n=!1){e.forEach((e=>{this.addTrackedFile(e,t,n)}))}addTrackedFile(e,t=!1,n=!1){let i=this._getSourceFileInfoFromPath(e);if(i)return i.isTracked=!0,i.sourceFile;const s=this._getImportNameForFile(e),r=new S.SourceFile(this._fs,e,s,t,n,this._console,this._logTracker);return i={sourceFile:r,isTracked:!0,isOpenByClient:!1,isTypeshedFile:!1,isThirdPartyImport:t,isThirdPartyPyTypedPresent:n,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(i),r}setFileOpened(e,t,n,i=!1){let s=this._getSourceFileInfoFromPath(e);if(s)s.isOpenByClient=!0,s.diagnosticsVersion=0;else{const t=this._getImportNameForFile(e);s={sourceFile:new S.SourceFile(this._fs,e,t,!1,!1,this._console,this._logTracker),isTracked:i,isOpenByClient:!0,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(s)}s.sourceFile.setClientVersion(t,n)}setFileClosed(e){const t=this._getSourceFileInfoFromPath(e);return t&&(t.isOpenByClient=!1,t.sourceFile.setClientVersion(null,[])),this._removeUnneededFiles()}markAllFilesDirty(e){const t=new Map;this._sourceFileList.forEach((n=>{e?n.sourceFile.markDirty():n.sourceFile.didContentsChangeOnDisk()&&(n.sourceFile.markDirty(),this._markFileDirtyRecursive(n,t))})),t.size>0&&this._createNewEvaluator()}markFilesDirty(e,t){const n=new Map;e.forEach((e=>{const i=this._getSourceFileInfoFromPath(e);i&&(t||!i.isOpenByClient&&i.sourceFile.didContentsChangeOnDisk())&&(i.sourceFile.markDirty(),this._markFileDirtyRecursive(i,n))})),n.size>0&&this._createNewEvaluator()}getFileCount(){return this._sourceFileList.length}getTracked(){return this._sourceFileList.filter((e=>e.isTracked))}getFilesToAnalyzeCount(){let e=0;return this._disableChecker||this._sourceFileList.forEach((t=>{t.sourceFile.isCheckingRequired()&&this._shouldCheckFile(t)&&e++})),e}isCheckingOnlyOpenFiles(){return this._configOptions.checkOnlyOpenFiles||!1}getSourceFile(e){const t=this._getSourceFileInfoFromPath(e);if(t)return t.sourceFile}getBoundSourceFile(e){const t=this._getSourceFileInfoFromPath(e);if(t)return this._bindFile(t),this.getSourceFile(e)}analyze(e,t=a.CancellationToken.None){return this._runEvaluatorWithCancellationToken(t,(()=>{const t=new g.Duration,n=this._sourceFileList.filter((e=>e.isOpenByClient&&e.sourceFile.isCheckingRequired()));if(n.length>0){const i=e?e.openFilesTimeInMs:Number.MAX_VALUE;for(const e of n)if(this._checkTypes(e)&&t.getDurationInMilliseconds()>i)return!0;if(void 0!==e)return!0}if(!this._configOptions.checkOnlyOpenFiles){const n=e?e.noOpenFilesTimeInMs:Number.MAX_VALUE;for(const e of this._sourceFileList)if(this._isUserCode(e)&&this._checkTypes(e)&&t.getDurationInMilliseconds()>n)return!0}return!1}))}indexWorkspace(e,n){return this._configOptions.indexing?this._runEvaluatorWithCancellationToken(n,(()=>{const s=new Set;for(const e of this._sourceFileList)e.sourceFile.isParseRequired()||s.add(e);let r=0;for(const a of this._sourceFileList){if(!this._isUserCode(a)||!a.sourceFile.isIndexingRequired())continue;this._bindFile(a);const o=a.sourceFile.index({indexingForAutoImportMode:!1},n);if(o){if(++r>t.MaxWorkspaceIndexFileCount)return this._console.warn("Workspace indexing has hit its upper limit: 2000 files"),i(this._sourceFileList,s),r;e(a.sourceFile.getFilePath(),o)}this._handleMemoryHighUsage()}return i(this._sourceFileList,s),r})):0;function i(e,t){for(const n of e)n.sourceFile.isParseRequired()||t.has(n)||n.sourceFile.dropParseAndBindInfo()}}printDependencies(e,t){const n=this._sourceFileList.filter((e=>!e.isTypeshedFile)).sort(((e,t)=>e.sourceFile.getFilePath(){this._console.info("");let s=n.sourceFile.getFilePath();const r=u.getRelativePath(s,e);r&&(s=r),this._console.info(`${s}`),this._console.info(` Imports ${n.imports.length} file`+(1===n.imports.length?"":"s")),t&&n.imports.forEach((e=>{this._console.info(` ${e.sourceFile.getFilePath()}`)})),this._console.info(` Imported by ${n.importedBy.length} file`+(1===n.importedBy.length?"":"s")),t&&n.importedBy.forEach((e=>{this._console.info(` ${e.sourceFile.getFilePath()}`)})),0===n.importedBy.length&&i.push(n.sourceFile)})),i.length>0&&(this._console.info(""),this._console.info(`${i.length} file${1===i.length?"":"s"} not explicitly imported`),i.forEach((e=>{this._console.info(` ${e.getFilePath()}`)})))}writeTypeStub(e,t,n,i){for(const s of this._sourceFileList){o.throwIfCancellationRequested(i);const r=s.sourceFile.getFilePath(),a=u.getRelativePath(r,e);if(void 0!==a){let e=u.normalizePath(u.combinePaths(n,a));e=t?u.combinePaths(u.getDirectoryPath(e),"__init__.pyi"):u.stripFileExtension(e)+".pyi";const r=u.getDirectoryPath(e);try{u.makeDirectories(this._fs,r,n)}catch(e){throw new Error(`Could not create directory for '${r}'`)}this._bindFile(s),this._runEvaluatorWithCancellationToken(i,(()=>{new k.TypeStubWriter(e,s.sourceFile,this._evaluator).write()})),this._handleMemoryHighUsage()}}}getTypeForSymbol(e){this._handleMemoryHighUsage();return(this._evaluator||this._createNewEvaluator()).getEffectiveTypeOfSymbol(e)}printType(e,t){this._handleMemoryHighUsage();return(this._evaluator||this._createNewEvaluator()).printType(e,t)}static _getPrintTypeFlags(e){let t=0;return e.diagnosticRuleSet.printUnknownAsAny&&(t|=1),e.diagnosticRuleSet.omitConditionalConstraint&&(t|=64),e.diagnosticRuleSet.omitTypeArgsIfAny&&(t|=2),e.diagnosticRuleSet.omitUnannotatedParamType&&(t|=4),e.diagnosticRuleSet.pep604Printing&&(t|=8),t}get _fs(){return this._importResolver.fileSystem}_getImportNameForFile(e){return this._importResolver.getModuleNameForImport(e,this._configOptions.getDefaultExecEnvironment()).moduleName}_addShadowedFile(e,t){let n=this._getSourceFileInfoFromPath(t);if(!n){const e=this._getImportNameForFile(t);n={sourceFile:new S.SourceFile(this._fs,t,e,!1,!1,this._console,this._logTracker),isTracked:!1,isOpenByClient:!1,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(n)}return n.shadows.includes(e)||n.shadows.push(e),e.shadowedBy.includes(n)||e.shadowedBy.push(n),n.sourceFile}_createNewEvaluator(){return this._evaluator=x.createTypeEvaluatorWithTracker(this._lookUpImport,{disableInferenceForPyTypedSources:this._configOptions.disableInferenceForPyTypedSources,printTypeFlags:P._getPrintTypeFlags(this._configOptions),logCalls:this._configOptions.logTypeEvaluationTime,minimumLoggingThreshold:this._configOptions.typeEvaluationTimeThreshold},this._logTracker,this._configOptions.logTypeEvaluationTime?A.createTracePrinter(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot))):void 0),this._evaluator}_parseFile(e,t){if(this._isFileNeeded(e)&&e.sourceFile.isParseRequired()&&(e.sourceFile.parse(this._configOptions,this._importResolver,t)&&(this._parsedFileCount++,this._updateSourceFileImports(e,this._configOptions)),e.sourceFile.isFileDeleted())){e.isTracked=!1;const t=new Map;this._markFileDirtyRecursive(e,t),this._importResolver.invalidateCache()}}_bindFile(e,t){if(!this._isFileNeeded(e)||!e.sourceFile.isBindingRequired())return;let n;if(this._parseFile(e,t),e.builtinsImport&&e.builtinsImport!==e){this._bindFile(e.builtinsImport);const t=e.builtinsImport.sourceFile.getParseResults();t&&(n=v.getScope(t.parseTree),p.assert(void 0!==n))}e.sourceFile.bind(this._configOptions,this._lookUpImport,n)}_buildModuleSymbolsMap(e,t,n,i){return f.buildModuleSymbolsMap(this._sourceFileList.filter((n=>n!==e&&(!t||this._isUserCode(n)))),n,i)}_shouldCheckFile(e){return!!e.isOpenByClient||!(this._configOptions.checkOnlyOpenFiles||!e.isTracked)}_checkTypes(e){return this._logTracker.log(`analyzing: ${e.sourceFile.getFilePath()}`,(t=>{if(!this._isFileNeeded(e))return t.suppress(),!1;if(!e.sourceFile.isCheckingRequired())return t.suppress(),!1;if(!this._shouldCheckFile(e))return t.suppress(),!1;if(this._bindFile(e),this._preCheckCallback){const t=e.sourceFile.getParseResults();t&&this._preCheckCallback(t,this._evaluator)}if(this._disableChecker||e.sourceFile.check(this._evaluator),this._handleMemoryHighUsage(),"none"!==this._configOptions.diagnosticRuleSet.reportImportCycles&&!this._allowedThirdPartyImports){const t=new Map;this._getImportsRecursive(e,t,0),t.forEach((e=>{g.timingStats.cycleDetectionTime.timeOperation((()=>{this._detectAndReportImportCycles(e)}))}))}return!0}))}_getImportsRecursive(e,t,n){const i=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());if(!t.has(i))if(n>256)e.sourceFile.setHitMaxImportDepth(256);else{t.set(i,e);for(const i of e.imports)this._getImportsRecursive(i,t,n+1)}}_detectAndReportImportCycles(e,t=[],n=new Map){if(e.sourceFile.isStubFile()||e.isThirdPartyImport)return;const i=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());if(n.has(i))t.length>1&&e===t[0]&&this._logImportCycle(t);else{if(n.has(i))return;n.set(i,!0),t.push(e);for(const i of e.imports)this._detectAndReportImportCycles(i,t,n);n.set(i,!1),t.pop()}}_logImportCycle(e){const t=new b.CircularDependency;e.forEach((e=>{t.appendPath(e.sourceFile.getFilePath())})),t.normalizeOrder();const n=t.getPaths()[0],i=this._getSourceFileInfoFromPath(n);p.assert(void 0!==i),i.sourceFile.addCircularDependency(t)}_markFileDirtyRecursive(e,t){const n=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.sourceFile.markReanalysisRequired(),t.set(n,!0),e.importedBy.forEach((e=>{this._markFileDirtyRecursive(e,t)})))}getTextOnRange(e,t,n){const i=this._sourceFileMap.get(e);if(!i)return;const s=i.sourceFile,r=s.getFileContents();return void 0!==r?this._runEvaluatorWithCancellationToken(n,(()=>{this._parseFile(i);const e=s.getParseResults(),n=h.convertRangeToTextRange(t,e.tokenizerOutput.lines);if(n)return r.substr(n.start,n.length)})):void 0}getAutoImports(e,t,n,i,s,r,a,o){const l=this._getSourceFileInfoFromPath(e);if(!l)return[];const c=l.sourceFile,p=c.getFileContents();return void 0===p?[]:this._runEvaluatorWithCancellationToken(o,(()=>{this._bindFile(l);const d=c.getParseResults(),u=h.convertRangeToTextRange(t,d.tokenizerOutput.lines);if(!u)return[];const y=I.findNodeByOffset(d.parseTree,u.start);if(!y)return[];const g=p.substr(u.start,u.length),T=this._buildModuleSymbolsMap(l,!!s,!0,o),_=new f.AutoImporter(this._configOptions.findExecEnvironment(e),this._importResolver,d,t.start,new Set,T,{lazyEdit:r,allowVariableInAll:a,libraryMap:s,patternMatcher:(e,t)=>m.computeCompletionSimilarity(e,t)>n}),v=[],b=C.getScopeForNode(y);if(b){const e=null==i?void 0:i.get(g);e&&v.push(..._.getAutoImportCandidatesForAbbr(g,e,o)),v.push(..._.getAutoImportCandidates(g,n,void 0,o).filter((e=>!b.lookUpSymbolRecursive(e.name))))}return v}))}getDiagnostics(e){const t=this._removeUnneededFiles();return this._sourceFileList.forEach((n=>{if(this._shouldCheckFile(n)){const i=n.sourceFile.getDiagnostics(e,n.diagnosticsVersion);void 0!==i&&(t.push({filePath:n.sourceFile.getFilePath(),diagnostics:i}),n.diagnosticsVersion=n.sourceFile.getDiagnosticVersion())}else!n.isOpenByClient&&e.checkOnlyOpenFiles&&void 0!==n.diagnosticsVersion&&(t.push({filePath:n.sourceFile.getFilePath(),diagnostics:[]}),n.diagnosticsVersion=void 0)})),t}getDiagnosticsForRange(e,t){const n=this.getSourceFile(e);if(!n)return[];const i=n.getDiagnostics(this._configOptions);return i?i.filter((e=>y.doRangesIntersect(e.range,t))):[]}getDefinitionsForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getDefinitionsForPosition(this._createSourceMapper(r),t,n,this._evaluator,i)}))}reportReferencesForPosition(e,t,n,i,s){this._runEvaluatorWithCancellationToken(s,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;const a=this._isUserCode(r);this._bindFile(r);const l=this._configOptions.findExecEnvironment(e),c=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(l),t,this._evaluator,i,s);if(c)if(c.requiresGlobalSearch){for(const e of this._sourceFileList)o.throwIfCancellationRequested(s),(e.isOpenByClient||!a||this._isUserCode(e))&&(this._bindFile(e),e.sourceFile.addReferences(c,n,this._evaluator,s)),this._handleMemoryHighUsage();if(n)for(const e of c.declarations){if(o.throwIfCancellationRequested(s),c.locations.some((t=>t.path===e.path)))continue;const t=this._getSourceFileInfoFromPath(e.path);if(!t)continue;const i=new _.ReferencesResult(c.requiresGlobalSearch,c.nodeAtOffset,c.symbolName,c.declarations);t.sourceFile.addReferences(i,n,this._evaluator,s);for(const t of i.locations)t.path===e.path&&y.doesRangeContain(e.range,t.range)&&c.addLocations(t)}}else r.sourceFile.addReferences(c,n,this._evaluator,s)}))}getFileIndex(e,t,n){if(t.indexingForAutoImportMode){const t=u.stripFileExtension(u.getFileName(e));if(F.isPrivateOrProtectedName(t))return}return this._handleMemoryHighUsage(),this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;let s;if(t.indexingForAutoImportMode&&!i.sourceFile.isStubFile()&&!i.sourceFile.isThirdPartyPyTypedPresent()&&void 0===i.sourceFile.getClientVersion())try{if(s=this._fs.readFileSync(e,"utf8"),s.indexOf("__all__")<0)return}catch(e){s=void 0}return this._bindFile(i,s),i.sourceFile.index(t,n)}))}addSymbolsForDocument(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);i&&(i.sourceFile.getCachedIndexResults()||this._bindFile(i),i.sourceFile.addHierarchicalSymbolsForDocument(t,n))}))}reportSymbolsForWorkspace(e,t,n){this._runEvaluatorWithCancellationToken(n,(()=>{if(e)for(const i of this._sourceFileList){if(!this._isUserCode(i))continue;i.sourceFile.getCachedIndexResults()||this._bindFile(i);const s=i.sourceFile.getSymbolsForDocument(e,n);s.length>0&&t(s),this._handleMemoryHighUsage()}}))}getHoverForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getHoverForPosition(this._createSourceMapper(r,!0),t,n,this._evaluator,i)}))}getDocumentHighlight(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e);return i.sourceFile.getDocumentHighlight(this._createSourceMapper(s),t,this._evaluator,n)}))}getSignatureHelpForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getSignatureHelpForPosition(t,this._createSourceMapper(r,!0),this._evaluator,n,i)}))}async getCompletionsForPosition(e,t,n,i,s,r,a){var o;const l=this._getSourceFileInfoFromPath(e);if(!l)return;const c=this._logTracker.log(`completion at ${e}:${t.line}:${t.character}`,(o=>{var c,p;const d=this._runEvaluatorWithCancellationToken(a,(()=>{this._bindFile(l);const o=this._configOptions.findExecEnvironment(e);return l.sourceFile.getCompletionsForPosition(t,n,this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,i,this._createSourceMapper(o,!0),s,r,(()=>this._buildModuleSymbolsMap(l,!!r,!1,a)),a)}));return o.add(`found ${null!==(p=null===(c=null==d?void 0:d.completionList)||void 0===c?void 0:c.items.length)&&void 0!==p?p:"null"} items`),d}));if(!(null==c?void 0:c.completionList)||!(null===(o=this._extension)||void 0===o?void 0:o.completionListExtension))return c;const p=l.sourceFile.getParseResults();if((null==p?void 0:p.parseTree)&&(null==p?void 0:p.text)){const e=h.convertPositionToOffset(t,p.tokenizerOutput.lines);void 0!==e&&await this._extension.completionListExtension.updateCompletionResults(c,p,e,a)}return c}resolveCompletionItem(e,t,n,i,s,r){return this._runEvaluatorWithCancellationToken(r,(()=>{const a=this._getSourceFileInfoFromPath(e);if(!a)return;this._bindFile(a);const o=this._configOptions.findExecEnvironment(e);a.sourceFile.resolveCompletionItem(this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,n,this._createSourceMapper(o,!0),i,s,(()=>this._buildModuleSymbolsMap(a,!!s,!1,r)),t,r)}))}renameSymbolAtPosition(e,t,n,i,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;this._bindFile(r);const a=this._configOptions.findExecEnvironment(e),o=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(a),t,this._evaluator,void 0,s);if(!o)return;if(!i&&o.declarations.some((e=>!this._isUserCode(this._getSourceFileInfoFromPath(e.path)))))return;if(0===o.declarations.length)return;if(o.requiresGlobalSearch&&!i)for(const e of this._sourceFileList)this._isUserCode(e)&&(this._bindFile(e),e.sourceFile.addReferences(o,!0,this._evaluator,s)),this._handleMemoryHighUsage();else(i||this._isUserCode(r))&&r.sourceFile.addReferences(o,!0,this._evaluator,s);const l=[];return o.locations.forEach((e=>{l.push({filePath:e.path,range:e.range,replacementText:n})})),l}))}getCallForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getCallForDeclaration(r.symbolName,a,this._evaluator,n)}getIncomingCallsForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);let o=[];for(const e of this._sourceFileList)if(this._isUserCode(e)||e.isOpenByClient){this._bindFile(e);const t=T.CallHierarchyProvider.getIncomingCallsForDeclaration(e.sourceFile.getFilePath(),r.symbolName,a,e.sourceFile.getParseResults(),this._evaluator,n);t&&(o=o.concat(...t)),this._handleMemoryHighUsage()}return o}getOutgoingCallsForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getOutgoingCallsForDeclaration(a,i.sourceFile.getParseResults(),this._evaluator,n)}performQuickAction(e,t,n,i){const s=this._getSourceFileInfoFromPath(e);if(s)return this._bindFile(s),s.sourceFile.performQuickAction(t,n,i)}_handleMemoryHighUsage(){if(this._evaluator.getTypeCacheSize()>75e4||this._parsedFileCount>1e3){const e=Math.round(process.memoryUsage().heapUsed/1048576);e>1536&&(this._console.info(`Emptying type cache to avoid heap overflow. Heap size used: ${e}MB`),this._createNewEvaluator(),this._discardCachedParseResults(),this._parsedFileCount=0)}}_discardCachedParseResults(){for(const e of this._sourceFileList)e.sourceFile.dropParseAndBindInfo()}_isUserCode(e){return e&&e.isTracked&&!e.isThirdPartyImport&&!e.isTypeshedFile}_runEvaluatorWithCancellationToken(e,t){try{return e&&!c.isDebugMode()?this._evaluator.runWithCancellationToken(e,t):t()}catch(e){throw e instanceof o.OperationCanceledException||this._createNewEvaluator(),e}}_removeUnneededFiles(){const e=[];for(let t=0;t{const s=i.importedBy.findIndex((e=>e===n));if(p.assert(s>=0),i.importedBy.splice(s,1),!this._isFileNeeded(i)){const n=this._sourceFileList.findIndex((e=>e===i));n>=0&&n{e.shadows=e.shadows.filter((e=>e!==n))})),n.shadowedBy=[])}return e}_isFileNeeded(e){return!e.sourceFile.isFileDeleted()&&(!(!e.isTracked&&!e.isOpenByClient)||(e.shadows.length>0||0!==e.importedBy.length&&this._isImportNeededRecursive(e,new Map)))}_isImportNeededRecursive(e,t){if(e.isTracked||e.isOpenByClient||e.shadows.length>0)return!0;const n=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());if(t.has(n))return!1;t.set(n,!0);for(const n of e.importedBy)if(this._isImportNeededRecursive(n,t))return!0;return!1}_createSourceMapper(e,t){return new D.SourceMapper(this._importResolver,e,this._evaluator,((e,t)=>{const n=this._getSourceFileInfoFromPath(e);if(n)return this._addShadowedFile(n,t),this.getBoundSourceFile(t)}),(e=>this.getBoundSourceFile(e)),null!=t&&t)}_isImportAllowed(e,t,n){if(t.isNativeLib)return!1;let i=this._configOptions.useLibraryCodeForTypes||1===t.importType&&!!t.pyTypedInfo||2===t.importType&&e.isThirdPartyPyTypedPresent;return!((1===t.importType||e.isThirdPartyImport&&2===t.importType)&&(this._allowedThirdPartyImports&&(t.isRelative||this._allowedThirdPartyImports.some((e=>t.importName===e||!!t.importName.startsWith(e+"."))))&&(i=!0),!n))||i}_updateSourceFileImports(e,t){const n=[],i=e.sourceFile.getImports(),s=t=>{let n=!1,i=!1;return 1===t.importType?(n=!0,t.pyTypedInfo&&(i=!0)):e.isThirdPartyImport&&2===t.importType&&(n=!0,e.isThirdPartyPyTypedPresent&&(i=!0)),{isThirdPartyImport:n,isPyTypedPresent:i}},r=new Map;i.forEach((n=>{if(n.isImportFound){if(this._isImportAllowed(e,n,n.isStubFile)&&n.resolvedPaths.length>0){const e=n.resolvedPaths[n.resolvedPaths.length-1];if(e){const t=s(n);r.set(u.normalizePathCase(this._fs,e),{path:e,isTypeshedFile:!!n.isTypeshedFile,isThirdPartyImport:t.isThirdPartyImport,isPyTypedPresent:t.isPyTypedPresent})}}n.filteredImplicitImports.forEach((t=>{if(this._isImportAllowed(e,n,t.isStubFile)&&!t.isNativeLib){const e=s(n);r.set(u.normalizePathCase(this._fs,t.path),{path:t.path,isTypeshedFile:!!n.isTypeshedFile,isThirdPartyImport:e.isThirdPartyImport,isPyTypedPresent:e.isPyTypedPresent})}}))}else t.verboseOutput&&(this._console.info(`Could not import '${n.importName}' in file '${e.sourceFile.getFilePath()}'`),n.importFailureInfo&&n.importFailureInfo.forEach((e=>{this._console.info(` ${e}`)})))}));const a=new Map;e.imports.forEach((t=>{const n=u.normalizePathCase(this._fs,t.sourceFile.getFilePath());r.has(n)?a.set(n,t):t.importedBy=t.importedBy.filter((t=>u.normalizePathCase(this._fs,t.sourceFile.getFilePath())!==u.normalizePathCase(this._fs,e.sourceFile.getFilePath())))})),r.forEach(((t,i)=>{if(!a.has(i)){let s;if(this._getSourceFileInfoFromPath(t.path))s=this._getSourceFileInfoFromPath(t.path);else{const e=this._getImportNameForFile(t.path);s={sourceFile:new S.SourceFile(this._fs,t.path,e,t.isThirdPartyImport,t.isPyTypedPresent,this._console,this._logTracker),isTracked:!1,isOpenByClient:!1,isTypeshedFile:t.isTypeshedFile,isThirdPartyImport:t.isThirdPartyImport,isThirdPartyPyTypedPresent:t.isPyTypedPresent,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(s),n.push(s)}s.importedBy.push(e),a.set(i,s)}})),e.imports=[],r.forEach(((t,n)=>{this._getSourceFileInfoFromPath(n)&&e.imports.push(this._getSourceFileInfoFromPath(n))})),e.builtinsImport=void 0;const o=e.sourceFile.getBuiltinsImport();if(o&&o.isImportFound){const t=o.resolvedPaths[o.resolvedPaths.length-1];e.builtinsImport=this._getSourceFileInfoFromPath(t)}return n}_getSourceFileInfoFromPath(e){return this._sourceFileMap.get(u.normalizePathCase(this._fs,e))}_removeSourceFileFromListAndMap(e,t){this._sourceFileMap.delete(u.normalizePathCase(this._fs,e)),this._sourceFileList.splice(t,1)}_addToSourceFileListAndMap(e){const t=u.normalizePathCase(this._fs,e.sourceFile.getFilePath());p.assert(!this._sourceFileMap.has(t)),this._sourceFileList.push(e),this._sourceFileMap.set(t,e)}}t.Program=P},26477:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPyTypedInfo=void 0;const i=n(94647);t.getPyTypedInfo=function(e,t){if(!e.existsSync(t)||!i.isDirectory(e,t))return;let n=!1;const s=i.combinePaths(t,"py.typed");if(!e.existsSync(t)||!i.isFile(e,s))return;const r=e.statSync(s);if(r.size>0&&r.size<65536){const t=e.readFileSync(s,"utf8");(t.match(/partial\n/)||t.match(/partial\r\n/))&&(n=!0)}return{pyTypedPath:s,isPartiallyTyped:n}}},96453:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isPythonBinary=t.getPythonPathFromPythonInterpreter=t.findPythonSearchPaths=t.getTypeshedSubdirectory=t.getTypeShedFallbackPath=t.thirdPartyFolderName=t.stdLibFolderName=void 0;const a=r(n(63129)),o=n(98173),l=r(n(97956)),c=n(94647),p=["import os, os.path, sys","normalize = lambda p: os.path.normcase(os.path.normpath(p))","cwd = normalize(os.getcwd())",'sys.path[:] = [p for p in sys.path if p != "" and normalize(p) != cwd]',"import json","json.dump(dict(path=sys.path, prefix=sys.prefix), sys.stdout)"].join("; ");function d(e,t,n){let i;return t?i=u(e,t,n):("win32"!==process.platform&&(i=u(e,"python3",n)),i||(i=u(e,"python",n))),i||(i={paths:[],prefix:""}),n.push(`Received ${i.paths.length} paths from interpreter`),i.paths.forEach((e=>{n.push(` ${e}`)})),i}function u(e,t,n){const i={paths:[],prefix:""};try{const s=["-c",p];n.push(`Executing interpreter: '${t}'`);const r=a.execFileSync(t,s,{encoding:"utf8"});try{const t=JSON.parse(r);for(let s of t.path)if(s=s.trim(),s){const t=c.normalizePath(s);e.existsSync(t)&&c.isDirectory(e,t)?i.paths.push(t):n.push(`Skipping '${t}' because it is not a valid directory`)}i.prefix=t.prefix,0===i.paths.length&&n.push("Found no valid directories")}catch(e){throw n.push(`Could not parse output: '${r}'`),e}}catch{return}return i}function h(e,t){return!e.some((e=>e===t))&&(e.push(t),!0)}t.stdLibFolderName="stdlib",t.thirdPartyFolderName="stubs",t.getTypeShedFallbackPath=function(e){let t=e.getModulePath();if(!t)return;t=c.getDirectoryPath(c.ensureTrailingDirectorySeparator(c.normalizePath(t)));const n=c.combinePaths(t,l.typeshedFallback);if(e.existsSync(n))return n;const i=c.combinePaths(c.getDirectoryPath(t),l.typeshedFallback);return e.existsSync(i)?i:void 0},t.getTypeshedSubdirectory=function(e,n){return c.combinePaths(e,n?t.stdLibFolderName:t.thirdPartyFolderName)},t.findPythonSearchPaths=function(e,t,n,i,s){if(n.push("Finding python search paths"),void 0!==t.venvPath&&t.venv){const i=t.venv,s=c.combinePaths(t.venvPath,i),r=[],a=[];if([l.lib,l.lib64,l.libAlternate].forEach((t=>{const i=function(e,t,n){if(!e.existsSync(t))return void n.push(`Did not find '${t}'`);n.push(`Found path '${t}'; looking for ${l.sitePackages}`);const i=c.combinePaths(t,l.sitePackages);if(e.existsSync(i))return n.push(`Found path '${i}'`),i;n.push(`Did not find '${i}', so looking for python subdirectory`);const s=c.getFileSystemEntries(e,t);for(let i=0;i{(function(e,t){const n=[];return e.readdirEntriesSync(t).filter((e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(".pth"))).sort(((e,t)=>o.compareComparableValues(e.name,t.name))).forEach((i=>{const s=c.combinePaths(t,i.name),r=c.tryStat(e,s);if((null==r?void 0:r.isFile())&&r.size>0&&r.size<65536){e.readFileSync(s,"utf8").split(/\r?\n/).forEach((i=>{const s=i.trim();if(s.length>0&&!s.startsWith("#")&&!s.match(/^import\s/)){const i=c.combinePaths(t,s);e.existsSync(i)&&c.isDirectory(e,i)&&n.push(i)}}))}})),n})(e,t).forEach((e=>{h(r,e)}))})),r.length>0)return n.push(`Found the following '${l.sitePackages}' dirs`),r.forEach((e=>{n.push(` ${e}`)})),r;n.push(`Did not find any '${l.sitePackages}' dirs. Falling back on python interpreter.`)}const r=d(e,t.pythonPath,n);if(i&&s){return r.paths.filter((e=>!c.containsPath(s,e,!0)||c.containsPath(r.prefix,e,!0)))}return r.paths},t.getPythonPathFromPythonInterpreter=d,t.isPythonBinary=function(e){return"python"===(e=e.trim())||"python3"===e}},17640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scope=void 0;const i=n(20823),s=n(97882);t.Scope=class{constructor(e,t){this.symbolTable=new Map,this.notLocalBindings=new Map,this.type=e,this.parent=t}getGlobalScope(){let e=this;for(;e;){if(3===e.type||4===e.type)return e;e=e.parent}return i.fail("failed to find scope"),this}isIndependentlyExecutable(){return 3===this.type||1===this.type}lookUpSymbol(e){return this.symbolTable.get(e)}lookUpSymbolRecursive(e,t=!1,n=!1){const i=this.symbolTable.get(e);if(i){if(t&&i.isExternallyHidden())return;const e=i.getDeclarations();if(0===e.length||e.some((e=>1!==e.type||!e.isDefinedByMemberAccess)))return{symbol:i,isOutsideCallerModule:t,isBeyondExecutionScope:n,scope:this}}let s;if(s=1===this.notLocalBindings.get(e)?this.getGlobalScope():this.parent,s)return s.lookUpSymbolRecursive(e,t||3===this.type,n||this.isIndependentlyExecutable())}addSymbol(e,t){const n=new s.Symbol(t);return this.symbolTable.set(e,n),n}getBindingType(e){return this.notLocalBindings.get(e)}setBindingType(e,t){return this.notLocalBindings.set(e,t)}setSlotsNames(e){this.slotsNames=e}getSlotsNames(){return this.slotsNames}}},57203:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getScopeForNode=t.getBuiltInScope=void 0;const i=n(35696),s=n(23241);t.getBuiltInScope=function(e){let t=e;for(;4!==t.type;)t=t.parent;return t},t.getScopeForNode=function(e){const t=s.getEvaluationScopeNode(e);return i.getScope(t)}},44314:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerService=t.pyprojectTomlName=t.configFileNames=void 0;const a=r(n(11128)),o=r(n(83352)),l=n(38213),c=n(14943),p=n(11043),d=n(6021),u=n(94647),h=n(76962),m=n(47041),y=n(67145),g=n(96453);t.configFileNames=["pyrightconfig.json"],t.pyprojectTomlName="pyproject.toml";const f=u.normalizeSlashes("/.git/"),T=/\.pyi?$/;class _{constructor(e,t,n,i,s,r,a,o,d,u){this._typeStubTargetIsSingleFile=!1,this._requireTrackedFileUpdate=!0,this._lastUserInteractionTime=Date.now(),this._disposed=!1,this._instanceName=e,this._console=n||new p.StandardConsole,this._executionRootPath="",this._extension=r,this._importResolverFactory=i||_.createImportResolver,this._maxAnalysisTimeInForeground=o,this._backgroundAnalysisProgramFactory=d,this._cancellationProvider=null!=u?u:new l.DefaultCancellationProvider,s=null!=s?s:new c.ConfigOptions(process.cwd());const h=this._importResolverFactory(t,s);this._backgroundAnalysisProgram=void 0!==d?d(this._console,s,h,this._extension,a,this._maxAnalysisTimeInForeground):new m.BackgroundAnalysisProgram(this._console,s,h,this._extension,a,this._maxAnalysisTimeInForeground)}clone(e,t){return new _(e,this._fs,this._console,this._importResolverFactory,this._backgroundAnalysisProgram.configOptions,this._extension,t,this._maxAnalysisTimeInForeground,this._backgroundAnalysisProgramFactory,this._cancellationProvider)}dispose(){this._disposed=!0,this._removeSourceFileWatchers(),this._removeConfigFileWatcher(),this._removeLibraryFileWatcher(),this._clearReloadConfigTimer(),this._clearReanalysisTimer(),this._clearLibraryReanalysisTimer()}get backgroundAnalysisProgram(){return this._backgroundAnalysisProgram}static createImportResolver(e,t){return new y.ImportResolver(e,t)}setCompletionCallback(e){this._onCompletionCallback=e,this._backgroundAnalysisProgram.setCompletionCallback(e)}setOptions(e,t=!0){this._commandLineOptions=e;const n=this._getConfigOptions(e);n.pythonPath&&n.ensureDefaultPythonVersion(n.pythonPath,this._console),n.ensureDefaultPythonPlatform(this._console),this._backgroundAnalysisProgram.setConfigOptions(n),this._executionRootPath=u.normalizePath(u.combinePaths(e.executionRoot,n.projectRoot)),this._applyConfigOptions(t)}setFileOpened(e,t,n){this._backgroundAnalysisProgram.setFileOpened(e,t,n,this._isTracked(e)),this._scheduleReanalysis(!1)}updateOpenFileContents(e,t,n){this._backgroundAnalysisProgram.updateOpenFileContents(e,t,n,this._isTracked(e)),this._scheduleReanalysis(!1)}test_setIndexing(e,t){this._backgroundAnalysisProgram.test_setIndexing(e,t)}startIndexing(){this._backgroundAnalysisProgram.startIndexing()}setFileClosed(e){this._backgroundAnalysisProgram.setFileClosed(e),this._scheduleReanalysis(!1)}getParseResult(e){var t;return null===(t=this._program.getBoundSourceFile(e))||void 0===t?void 0:t.getParseResults()}getTextOnRange(e,t,n){return this._program.getTextOnRange(e,t,n)}getAutoImports(e,t,n,i,s,r,a){return this._program.getAutoImports(e,t,n,i,this._backgroundAnalysisProgram.getIndexing(e),s,r,a)}getDefinitionForPosition(e,t,n,i){return this._program.getDefinitionsForPosition(e,t,n,i)}reportReferencesForPosition(e,t,n,i,s){this._program.reportReferencesForPosition(e,t,n,i,s)}addSymbolsForDocument(e,t,n){this._program.addSymbolsForDocument(e,t,n)}reportSymbolsForWorkspace(e,t,n){this._program.reportSymbolsForWorkspace(e,t,n)}getHoverForPosition(e,t,n,i){return this._program.getHoverForPosition(e,t,n,i)}getDocumentHighlight(e,t,n){return this._program.getDocumentHighlight(e,t,n)}getSignatureHelpForPosition(e,t,n,i){return this._program.getSignatureHelpForPosition(e,t,n,i)}getCompletionsForPosition(e,t,n,i,s,r){return this._program.getCompletionsForPosition(e,t,n,i,s,this._backgroundAnalysisProgram.getIndexing(e),r)}getEvaluator(){return this._program.evaluator}resolveCompletionItem(e,t,n,i,s){this._program.resolveCompletionItem(e,t,n,i,this._backgroundAnalysisProgram.getIndexing(e),s)}performQuickAction(e,t,n,i){return this._program.performQuickAction(e,t,n,i)}renameSymbolAtPosition(e,t,n,i,s){return this._program.renameSymbolAtPosition(e,t,n,i,s)}getCallForPosition(e,t,n){return this._program.getCallForPosition(e,t,n)}getIncomingCallsForPosition(e,t,n){return this._program.getIncomingCallsForPosition(e,t,n)}getOutgoingCallsForPosition(e,t,n){return this._program.getOutgoingCallsForPosition(e,t,n)}printStats(){this._console.info(""),this._console.info("Analysis stats");const e=this._program.getFileCount();this._console.info("Total files analyzed: "+e.toString())}printDependencies(e){this._program.printDependencies(this._executionRootPath,e)}getDiagnosticsForRange(e,t,n){return this._backgroundAnalysisProgram.getDiagnosticsForRange(e,t,n)}getConfigOptions(){return this._configOptions}getImportResolver(){return this._backgroundAnalysisProgram.importResolver}recordUserInteractionTime(){this._lastUserInteractionTime=Date.now(),this._analyzeTimer&&this._scheduleReanalysis(!1)}get test_program(){return this._program}test_getConfigOptions(e){return this._getConfigOptions(e)}test_getFileNamesFromFileSpecs(){return this._getFileNamesFromFileSpecs()}_getConfigOptions(e){var t,n;let i,s,r=e.executionRoot;e.configFilePath?(i=u.combinePaths(e.executionRoot,u.normalizePath(e.configFilePath)),this._fs.existsSync(i)?i.toLowerCase().endsWith(".json")?r=u.getDirectoryPath(i):(r=i,i=this._findConfigFile(i),i||this._console.info(`Configuration file not found at ${r}.`)):(this._console.info(`Configuration file not found at ${i}.`),i=e.executionRoot)):r&&(i=this._findConfigFile(r),i||e.fromVsCodeExtension||(i=this._findConfigFileHereOrUp(r)),i?r=u.getDirectoryPath(i):(this._console.info("No configuration file found."),i=void 0)),i||(s=this._findPyprojectTomlFile(r),s||e.fromVsCodeExtension||(s=this._findPyprojectTomlFileHereOrUp(r)),s?(r=u.getDirectoryPath(s),this._console.info(`pyproject.toml file found at ${r}.`)):this._console.info("No pyproject.toml file found."));const a=new c.ConfigOptions(r,this._typeCheckingMode),o=["**/node_modules","**/__pycache__",".git"];let l;if(a.defaultPythonPlatform=e.pythonPlatform,a.defaultPythonVersion=e.pythonVersion,a.ensureDefaultExtraPaths(this._fs,e.autoSearchPaths||!1,e.extraPaths),e.fileSpecs.length>0?e.fileSpecs.forEach((e=>{a.include.push(u.getFileSpec(r,e))})):i||e.executionRoot&&(a.include.push(u.getFileSpec(e.executionRoot,".")),o.forEach((t=>{a.exclude.push(u.getFileSpec(e.executionRoot,t))}))),this._configFilePath=i||s,i?(this._console.info(`Loading configuration file at ${i}`),l=this._parseJsonConfigFile(i)):s&&(this._console.info(`Loading pyproject.toml file at ${s}`),l=this._parsePyprojectTomlFile(s)),l){a.initializeFromJson(l,this._typeCheckingMode,this._console,e.diagnosticSeverityOverrides,e.pythonPath,e.fileSpecs.length>0);const t=u.getDirectoryPath(this._configFilePath);0===a.include.length&&(this._console.info(`No include entries specified; assuming ${t}`),a.include.push(u.getFileSpec(t,"."))),0===a.exclude.length&&(o.forEach((e=>{this._console.info(`Auto-excluding ${e}`),a.exclude.push(u.getFileSpec(t,e))})),void 0===a.autoExcludeVenv&&(a.autoExcludeVenv=!0))}else a.autoExcludeVenv=!0,a.applyDiagnosticOverrides(e.diagnosticSeverityOverrides);const p=(t,n)=>{const i=e.fromVsCodeExtension?"the client settings":"a command-line option";this._console.warn(`The ${t} has been specified in both the config file and ${i}. The value in the config file (${n}) will take precedence`)};if(e.venvPath&&(a.venvPath?p("venvPath",a.venvPath):a.venvPath=e.venvPath),e.pythonPath&&(this._console.info(`Setting pythonPath for service "${this._instanceName}": "${e.pythonPath}"`),a.pythonPath=e.pythonPath),e.typeshedPath&&(a.typeshedPath?p("typeshedPath",a.typeshedPath):a.typeshedPath=e.typeshedPath),a.verboseOutput=null!==(t=e.verboseOutput)&&void 0!==t?t:a.verboseOutput,a.checkOnlyOpenFiles=!!e.checkOnlyOpenFiles,a.autoImportCompletions=!!e.autoImportCompletions,a.indexing=!!e.indexing,a.logTypeEvaluationTime=!!e.logTypeEvaluationTime,a.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold,void 0===a.useLibraryCodeForTypes?a.useLibraryCodeForTypes=!!e.useLibraryCodeForTypes:void 0!==e.useLibraryCodeForTypes&&p("useLibraryCodeForTypes",a.useLibraryCodeForTypes),e.stubPath?a.stubPath?p("stubPath",a.stubPath):a.stubPath=e.stubPath:a.stubPath||(a.stubPath=u.normalizePath(u.combinePaths(a.projectRoot,"typings"))),a.venvPath&&(this._fs.existsSync(a.venvPath)&&u.isDirectory(this._fs,a.venvPath)||this._console.error(`venvPath ${a.venvPath} is not a valid directory.`),a.venv=null!==(n=a.venv)&&void 0!==n?n:this._configOptions.venv,a.venv)){const e=u.combinePaths(a.venvPath,a.venv);if(this._fs.existsSync(e)&&u.isDirectory(this._fs,e)){const e=[];void 0===g.findPythonSearchPaths(this._fs,a,e)&&(this._console.error(`site-packages directory cannot be located for venvPath ${a.venvPath} and venv ${a.venv}.`),a.verboseOutput&&e.forEach((e=>{this._console.error(` ${e}`)})))}else this._console.error(`venv ${a.venv} subdirectory not found in venv path ${a.venvPath}.`)}return a.venv&&(a.venvPath||this._console.warn("venvPath not specified, so venv settings will be ignored.")),a.typeshedPath&&(this._fs.existsSync(a.typeshedPath)&&u.isDirectory(this._fs,a.typeshedPath)||this._console.error(`typeshedPath ${a.typeshedPath} is not a valid directory.`)),a.stubPath&&(this._fs.existsSync(a.stubPath)&&u.isDirectory(this._fs,a.stubPath)||this._console.warn(`stubPath ${a.stubPath} is not a valid directory.`)),a}writeTypeStub(e){const t=this._getTypeStubFolder();this._program.writeTypeStub(this._typeStubTargetPath,this._typeStubTargetIsSingleFile,t,e)}writeTypeStubInBackground(e){const t=this._getTypeStubFolder();return this._backgroundAnalysisProgram.writeTypeStub(this._typeStubTargetPath,this._typeStubTargetIsSingleFile,t,e)}invalidateAndForceReanalysis(e=!0){this._backgroundAnalysisProgram.invalidateAndForceReanalysis(e)}restart(){this._applyConfigOptions(),this._backgroundAnalysisProgram.restart()}get _fs(){return this._backgroundAnalysisProgram.importResolver.fileSystem}get _program(){return this._backgroundAnalysisProgram.program}get _configOptions(){return this._backgroundAnalysisProgram.configOptions}get _watchForSourceChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForSourceChanges)}get _watchForLibraryChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForLibraryChanges)}get _watchForConfigChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForConfigChanges)}get _typeCheckingMode(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeCheckingMode}get _verboseOutput(){return!!this._configOptions.verboseOutput}get _typeStubTargetImportName(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeStubTargetImportName}_getTypeStubFolder(){const e=this._configOptions.stubPath;if(!this._typeStubTargetPath||!this._typeStubTargetImportName){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}if(!e){const e="No typings path was specified";throw this._console.info(e),new Error(e)}const t=this._typeStubTargetImportName.split(".");if(0===t[0].length){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}try{this._fs.existsSync(e)||this._fs.mkdirSync(e)}catch(t){const n=`Could not create typings directory '${e}'`;throw this._console.error(n),new Error(n)}const n=u.combinePaths(e,t[0]);try{this._fs.existsSync(n)||this._fs.mkdirSync(n)}catch(e){const t=`Could not create typings subdirectory '${n}'`;throw this._console.error(t),new Error(t)}return n}_findConfigFileHereOrUp(e){return u.forEachAncestorDirectory(e,(e=>this._findConfigFile(e)))}_findConfigFile(e){for(const n of t.configFileNames){const t=u.combinePaths(e,n);if(this._fs.existsSync(t))return t}}_findPyprojectTomlFileHereOrUp(e){return u.forEachAncestorDirectory(e,(e=>this._findPyprojectTomlFile(e)))}_findPyprojectTomlFile(e){const n=u.combinePaths(e,t.pyprojectTomlName);if(this._fs.existsSync(n))return n}_parseJsonConfigFile(e){return this._attemptParseFile(e,(e=>o.parse(e)))}_parsePyprojectTomlFile(e){return this._attemptParseFile(e,((t,n)=>{try{const e=a.parse(t);if(e&&e.tool&&e.tool.pyright)return e.tool.pyright}catch(e){throw this._console.error(`Pyproject file parse attempt ${n} error: ${JSON.stringify(e)}`),e}this._console.error(`Pyproject file "${e}" is missing "[tool.pyright] section.`)}))}_attemptParseFile(e,t){let n="",i=0;for(;;){try{n=this._fs.readFileSync(e,"utf8")}catch{return this._console.error(`Config file "${e}" could not be read.`),void this._reportConfigParseError()}let s=!1;try{return t(n,i+1)}catch(e){s=!0}if(!s)break;if(i++>=5)return this._console.error(`Config file "${e}" could not be parsed. Verify that format is correct.`),void this._reportConfigParseError()}}_getFileNamesFromFileSpecs(){const e=new Map;return h.timingStats.findFilesTime.timeOperation((()=>{const t=this._matchFiles(this._configOptions.include,this._configOptions.exclude);for(const n of t)e.set(n,n)})),[...e.values()]}_updateTrackedFileList(e){if(this._typeStubTargetImportName){const e=this._configOptions.findExecEnvironment(this._executionRootPath),t={leadingDots:0,nameParts:this._typeStubTargetImportName.split("."),importedSymbols:[]},n=this._backgroundAnalysisProgram.importResolver.resolveImport("",e,t);if(n.isImportFound){const e=[],t=n.resolvedPaths[n.resolvedPaths.length-1];let i=u.getDirectoryPath(t),s=t;for(let e=n.resolvedPaths.length-2;e>=0;e--){const t=n.resolvedPaths[e];t?(i=u.getDirectoryPath(t),s=t):(i=u.getDirectoryPath(s),s=i)}u.isDirectory(this._fs,i)&&(this._typeStubTargetPath=i),t?(e.push(t),this._typeStubTargetIsSingleFile=1===n.resolvedPaths.length&&"__init__"!==u.stripFileExtension(u.getFileName(n.resolvedPaths[0]))):this._typeStubTargetIsSingleFile=!1,n.filteredImplicitImports.forEach((t=>{e.push(t.path)})),this._backgroundAnalysisProgram.setAllowedThirdPartyImports([this._typeStubTargetImportName]),this._backgroundAnalysisProgram.setTrackedFiles(e)}else this._console.error(`Import '${this._typeStubTargetImportName}' not found`)}else{let t=[];this._console.info("Searching for source files"),t=this._getFileNamesFromFileSpecs(),this._backgroundAnalysisProgram.setTrackedFiles(t),this._backgroundAnalysisProgram.markAllFilesDirty(e),0===t.length?this._console.info("No source files found."):this._console.info(`Found ${t.length} source `+(1===t.length?"file":"files"))}this._requireTrackedFileUpdate=!1}_matchFiles(e,t){const n=[["bin","activate"],["Scripts","activate"],["pyvenv.cfg"]],i=[],s=Date.now();let r=!1;const a=(e,a)=>{if(!r){.001*(Date.now()-s)>=10&&(this._console.error('Enumeration of workspace source files is taking longer than 10 seconds.\nThis may be because:\n* You have opened your home directory or entire hard drive as a workspace\n* Your workspace contains a very large number of directories and files\n* Your workspace contains a symlink to a directory with many files\n* Your workspace is remote, and file enumeration is slow\nTo reduce this time, open a workspace directory with fewer files or add a pyrightconfig.json configuration file with an "exclude" section to exclude subdirectories from your workspace. For more details, refer to https://github.com/microsoft/pyright/blob/main/docs/configuration.md.'),r=!0)}if(this._configOptions.autoExcludeVenv&&n.some((t=>this._fs.existsSync(u.combinePaths(e,...t)))))return void this._console.info(`Auto-excluding ${e}`);const{files:o,directories:c}=u.getFileSystemEntries(this._fs,e);for(const n of o){const s=u.combinePaths(e,n);this._matchIncludeFileSpec(a,t,s)&&i.push(s)}for(const n of c){const i=u.combinePaths(e,n);a.test(i)&&(this._isInExcludePath(i,t)||l(i,a))}},o=new Set,l=(e,t)=>{const n=u.tryRealpath(this._fs,e);if(n)if(o.has(n))this._console.warn(`Skipping recursive symlink "${e}" -> "${n}"`);else{o.add(n);try{a(e,t)}finally{o.delete(n)}}else this._console.warn(`Skipping broken link "${e}"`)};return e.forEach((e=>{if(!this._isInExcludePath(e.wildcardRoot,t)){let t=!1;const n=u.tryStat(this._fs,e.wildcardRoot);(null==n?void 0:n.isFile())?this._shouldIncludeFile(e.wildcardRoot)&&(i.push(e.wildcardRoot),t=!0):(null==n?void 0:n.isDirectory())&&(l(e.wildcardRoot,e.regExp),t=!0),t||this._console.error(`File or directory "${e.wildcardRoot}" does not exist.`)}})),i}_removeSourceFileWatchers(){this._sourceFileWatcher&&(this._sourceFileWatcher.close(),this._sourceFileWatcher=void 0)}_updateSourceFileWatchers(){if(this._removeSourceFileWatchers(),this._watchForSourceChanges&&this._configOptions.include.length>0){const e=this._configOptions.include.map((e=>u.combinePaths(this._executionRootPath,e.wildcardRoot)));try{this._verboseOutput&&this._console.info(`Adding fs watcher for directories:\n ${e.join("\n")}`);const t=d.ignoredWatchEventFunction(e);this._sourceFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{if(this._verboseOutput&&this._console.info(`SourceFile: Received fs event '${e}' for path '${n}'`),t(n))return;if(n.endsWith(".tmp")||n.endsWith(".git")||n.includes(f))return;const i=u.tryStat(this._fs,n);if(!i||!i.isFile()||n.endsWith(".py")||n.endsWith(".pyi"))if("change"===e&&i)this._backgroundAnalysisProgram.markFilesDirty([n],!1),this._scheduleReanalysis(!1);else{const e=u.getFileName(n).split(".");let t=!1;4===e.length&&e[3]===e[1]&&32===e[2].length&&(t=!0),t||(this.invalidateAndForceReanalysis(!1),this._scheduleReanalysis(!0))}}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}}_removeLibraryFileWatcher(){this._libraryFileWatcher&&(this._libraryFileWatcher.close(),this._libraryFileWatcher=void 0)}_updateLibraryFileWatcher(){if(this._removeLibraryFileWatcher(),!this._watchForLibraryChanges)return;const e=g.findPythonSearchPaths(this._fs,this._backgroundAnalysisProgram.configOptions,[],!0,this._executionRootPath);if(e&&e.length>0)try{this._verboseOutput&&this._console.info(`Adding fs watcher for library directories:\n ${e.join("\n")}`);const t=d.ignoredWatchEventFunction(e);this._libraryFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{this._verboseOutput&&this._console.info(`LibraryFile: Received fs event '${e}' for path '${n}'}'`),t(n)||this._scheduleLibraryAnalysis()}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}_clearLibraryReanalysisTimer(){var e;this._libraryReanalysisTimer&&(clearTimeout(this._libraryReanalysisTimer),this._libraryReanalysisTimer=void 0,null===(e=this._backgroundAnalysisProgram)||void 0===e||e.cancelIndexing())}_scheduleLibraryAnalysis(){this._disposed||(this._clearLibraryReanalysisTimer(),this._libraryReanalysisTimer=setTimeout((()=>{this._clearLibraryReanalysisTimer(),this.invalidateAndForceReanalysis(),this._scheduleReanalysis(!1)}),1e3))}_removeConfigFileWatcher(){this._configFileWatcher&&(this._configFileWatcher.close(),this._configFileWatcher=void 0)}_updateConfigFileWatcher(){this._removeConfigFileWatcher(),this._watchForConfigChanges&&(this._configFilePath?this._configFileWatcher=this._fs.createFileSystemWatcher([this._configFilePath],(e=>{this._verboseOutput&&this._console.info(`Received fs event '${e}' for config file`),this._scheduleReloadConfigFile()})):this._executionRootPath&&(this._configFileWatcher=this._fs.createFileSystemWatcher([this._executionRootPath],((e,n)=>{if("add"===e||"change"===e){const i=u.getFileName(n);i&&t.configFileNames.some((e=>e===i))&&(this._verboseOutput&&this._console.info(`Received fs event '${e}' for config file`),this._commandLineOptions&&this.setOptions(this._commandLineOptions))}}))))}_clearReloadConfigTimer(){this._reloadConfigTimer&&(clearTimeout(this._reloadConfigTimer),this._reloadConfigTimer=void 0)}_scheduleReloadConfigFile(){this._clearReloadConfigTimer(),this._reloadConfigTimer=setTimeout((()=>{this._clearReloadConfigTimer(),this._reloadConfigFile()}),100)}_reloadConfigFile(){if(this._updateConfigFileWatcher(),this._configFilePath){this._console.info(`Reloading configuration file at ${this._configFilePath}`);const e=this._getConfigOptions(this._commandLineOptions);this._backgroundAnalysisProgram.setConfigOptions(e),this._applyConfigOptions()}}_applyConfigOptions(e=!0){var t;const n=this._importResolverFactory(this._fs,this._backgroundAnalysisProgram.configOptions);if(this._backgroundAnalysisProgram.setImportResolver(n),(null===(t=this._commandLineOptions)||void 0===t?void 0:t.fromVsCodeExtension)||this._configOptions.verboseOutput){const e=this._configOptions.verboseOutput?p.LogLevel.Info:p.LogLevel.Log;for(const t of this._configOptions.getExecutionEnvironments()){p.log(this._console,e,`Search paths for ${t.root}`);n.getImportRoots(t,!0).forEach((t=>{p.log(this._console,e,` ${t}`)}))}}this._updateLibraryFileWatcher(),this._updateConfigFileWatcher(),this._updateSourceFileWatchers(),this._updateTrackedFileList(!0),e&&this._scheduleReanalysis(!1)}_clearReanalysisTimer(){this._analyzeTimer&&(clearTimeout(this._analyzeTimer),this._analyzeTimer=void 0)}_scheduleReanalysis(e){var t;if(this._disposed)return;e&&(this._requireTrackedFileUpdate=!0),null===(t=this._backgroundAnalysisCancellationSource)||void 0===t||t.cancel(),this._clearReanalysisTimer();const n=Date.now()-this._lastUserInteractionTime,i=Math.max(250-n,20);this._analyzeTimer=setTimeout((()=>{this._analyzeTimer=void 0,this._requireTrackedFileUpdate&&this._updateTrackedFileList(!1),this._backgroundAnalysisCancellationSource=this._cancellationProvider.createCancellationTokenSource();this._backgroundAnalysisProgram.startAnalysis(this._backgroundAnalysisCancellationSource.token)&&this._scheduleReanalysis(!1)}),i)}_reportConfigParseError(){this._onCompletionCallback&&this._onCompletionCallback({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!1,configParseErrorOccurred:!0,elapsedTime:0})}_shouldIncludeFile(e){return T.test(e)}_isInExcludePath(e,t){return!!t.find((t=>t.regExp.test(e)))}_matchIncludeFileSpec(e,t,n){return!(!e.test(n)||this._isInExcludePath(n,t)||!this._shouldIncludeFile(n))}_isTracked(e){for(const t of this._configOptions.include)if(this._matchIncludeFileSpec(t.regExp,this._configOptions.exclude,e))return!0;return!1}}t.AnalyzerService=_},54549:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SourceFile=void 0;const a=n(80327),o=n(65013),l=r(n(91197)),c=n(38213),p=n(14943),d=n(11043),u=n(20823),h=n(24319),m=n(85036),y=n(77134),g=n(94647),f=r(n(14551)),T=n(80957),_=n(979),v=n(76962),b=n(80088),I=n(27888),C=n(70234),S=n(54989),D=n(8871),F=n(47458),A=n(5165),x=n(75659),k=n(74426),P=n(55390),E=n(14014),w=r(n(35696)),N=n(91242),R=n(51153),M=r(n(81044)),O=n(15297),L=n(51660),U=33554432;t.SourceFile=class{constructor(e,t,n,i,s,r,a){this._isFileDeleted=!1,this._diagnosticVersion=0,this._fileContentsVersion=0,this._lastFileContentLength=void 0,this._lastFileContentHash=void 0,this._analyzedFileContentsVersion=-1,this._parseTreeNeedsCleaning=!1,this._isBindingInProgress=!1,this._parseDiagnostics=[],this._bindDiagnostics=[],this._checkerDiagnostics=[],this._diagnosticRuleSet=p.getBasicDiagnosticRuleSet(),this._circularDependencies=[],this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this.fileSystem=e,this._console=r||new d.StandardConsole,this._filePath=t,this._moduleName=n,this._isStubFile=t.endsWith(".pyi"),this._isThirdPartyImport=i,this._isThirdPartyPyTypedPresent=s;const l=g.getFileName(t);this._isTypingStubFile=this._isStubFile&&(this._filePath.endsWith(g.normalizeSlashes("stdlib/typing.pyi"))||"typing_extensions.pyi"===l),this._isTypingExtensionsStubFile=this._isStubFile&&"typing_extensions.pyi"===l,this._isBuiltInStubFile=!1,this._isStubFile&&(this._filePath.endsWith(g.normalizeSlashes("stdlib/collections/__init__.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/asyncio/futures.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/builtins.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/_importlib_modulespec.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/dataclasses.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/abc.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/enum.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/queue.pyi"))||this._filePath.endsWith(g.normalizeSlashes("stdlib/types.pyi")))&&(this._isBuiltInStubFile=!0),this._logTracker=null!=a?a:new y.LogTracker(r,o.isMainThread?"FG":"BG")}getFilePath(){return this._filePath}getDiagnosticVersion(){return this._diagnosticVersion}isStubFile(){return this._isStubFile}isThirdPartyPyTypedPresent(){return this._isThirdPartyPyTypedPresent}getDiagnostics(e,t){if(this._diagnosticVersion===t)return;let n=!0;this._isThirdPartyImport&&(n=!1);let i=[];if(i=i.concat(this._parseDiagnostics,this._bindDiagnostics,this._checkerDiagnostics),e.diagnosticRuleSet.enableTypeIgnoreComments){const e=this._parseResults?this._parseResults.tokenizerOutput.typeIgnoreLines:{};Object.keys(e).length>0&&(i=i.filter((t=>{if(3!==t.category)for(let n=t.range.start.line;n<=t.range.end.line;n++)if(e[n])return!1;return!0})))}if("none"!==e.diagnosticRuleSet.reportImportCycles&&this._circularDependencies.length>0){const t=h.convertLevelToCategory(e.diagnosticRuleSet.reportImportCycles);this._circularDependencies.forEach((e=>{i.push(new h.Diagnostic(t,k.Localizer.Diagnostic.importCycleDetected()+"\n"+e.getPaths().map((e=>" "+e)).join("\n"),T.getEmptyRange()))}))}return void 0!==this._hitMaxImportDepth&&i.push(new h.Diagnostic(0,k.Localizer.Diagnostic.importDepthExceeded().format({depth:this._hitMaxImportDepth}),T.getEmptyRange())),e.ignore.find((e=>e.regExp.test(this._filePath)))&&(i=[]),e.diagnosticRuleSet.enableTypeIgnoreComments&&this._parseResults&&this._parseResults.tokenizerOutput.typeIgnoreAll&&(i=[]),n||(i=i.filter((e=>3===e.category))),i}getImports(){return this._imports||[]}getBuiltinsImport(){return this._builtinsImport}getModuleSymbolTable(){return this._moduleSymbolTable}didContentsChangeOnDisk(){if(this._clientDocument)return!1;if(void 0===this._lastFileContentLength)return!1;try{const e=this.fileSystem.readFileSync(this._filePath,"utf8");if(e.length!==this._lastFileContentLength)return!0;if(f.hashString(e)!==this._lastFileContentHash)return!0}catch(e){return!0}return!1}dropParseAndBindInfo(){this._parseResults=void 0,this._moduleSymbolTable=void 0,this._isBindingNeeded=!0}markDirty(){this._fileContentsVersion++,this._isCheckingNeeded=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._cachedIndexResults=void 0}markReanalysisRequired(){this._isCheckingNeeded=!0,this._parseResults&&(this._parseResults.containsWildcardImport||void 0!==w.getDunderAllInfo(this._parseResults.parseTree))&&(this._parseTreeNeedsCleaning=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._cachedIndexResults=void 0)}getClientVersion(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.version}getFileContents(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.getText()}setClientVersion(e,t){if(null===e)this._clientDocument=void 0;else{this._clientDocument||(this._clientDocument=a.TextDocument.create(this._filePath,"python",e,"")),this._clientDocument=a.TextDocument.update(this._clientDocument,t,e);const n=this._clientDocument.getText(),i=f.hashString(n);n.length===this._lastFileContentLength&&i===this._lastFileContentHash||this.markDirty(),this._lastFileContentLength=n.length,this._lastFileContentHash=i}}prepareForClose(){}isFileDeleted(){return this._isFileDeleted}isParseRequired(){return!this._parseResults||this._analyzedFileContentsVersion!==this._fileContentsVersion}isBindingRequired(){return!this._isBindingInProgress&&(!!this.isParseRequired()||this._isBindingNeeded)}isIndexingRequired(){return this._indexingNeeded}isCheckingRequired(){return this._isCheckingNeeded}getParseResults(){if(!this.isParseRequired())return this._parseResults}getCachedIndexResults(){return this._cachedIndexResults}cacheIndexResults(e){this._cachedIndexResults=e}addCircularDependency(e){let t=!1;this._circularDependencies.length<4&&(this._circularDependencies.some((t=>t.isEqual(e)))||(this._circularDependencies.push(e),t=!0)),t&&this._diagnosticVersion++}setHitMaxImportDepth(e){this._hitMaxImportDepth=e}parse(e,t,n){return this._logTracker.log(`parsing: ${this._getPathForLogging(this._filePath)}`,(i=>{var s;if(!this.isParseRequired())return i.suppress(),!1;const r=new m.DiagnosticSink;let a=this.getFileContents();if(void 0===a)try{const e=v.timingStats.readFileTime.totalTime;v.timingStats.readFileTime.timeOperation((()=>{const e=this.fileSystem.statSync(this._filePath);if(e.size>U)throw this._console.error(`File length of "${this._filePath}" is ${e.size} which exceeds the maximum supported file size of 33554432`),new Error("File larger than max");a=null!=n?n:this.fileSystem.readFileSync(this._filePath,"utf8"),this._lastFileContentLength=a.length,this._lastFileContentHash=f.hashString(a)})),i.add(`fs read ${v.timingStats.readFileTime.totalTime-e}ms`)}catch(e){r.addError("Source file could not be read",T.getEmptyRange()),a="",this.fileSystem.existsSync(this._filePath)||(this._isFileDeleted=!0)}const o=e.findExecEnvironment(this._filePath),l=new E.ParseOptions;this._filePath.endsWith("pyi")&&(l.isStubFile=!0),l.pythonVersion=o.pythonVersion,l.skipFunctionAndClassBody=null!==(s=e.indexGenerationMode)&&void 0!==s&&s;try{const n=(new E.Parser).parseSourceFile(a,l,r);u.assert(void 0!==n&&void 0!==n.tokenizerOutput),this._parseResults=n,v.timingStats.resolveImportsTime.timeOperation((()=>{const e=this._resolveImports(t,n.importedModules,o);this._imports=e.imports,this._builtinsImport=e.builtinsImportResult,this._typingModulePath=e.typingModulePath,this._typeshedModulePath=e.typeshedModulePath,this._collectionsModulePath=e.collectionsModulePath,this._parseDiagnostics=r.fetchAndClear()}));const i=void 0!==e.strict.find((e=>e.regExp.test(this._filePath)));this._diagnosticRuleSet=M.getFileLevelDirectives(this._parseResults.tokenizerOutput.tokens,e.diagnosticRuleSet,i)}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t})),this._parseResults={text:"",parseTree:P.ModuleNode.create({start:0,length:0}),importedModules:[],futureImports:new Map,tokenizerOutput:{tokens:new _.TextRangeCollection([]),lines:new _.TextRangeCollection([]),typeIgnoreAll:!1,typeIgnoreLines:{},predominantEndOfLineSequence:"\n",predominantTabSequence:" ",predominantSingleQuoteCharacter:"'"},containsWildcardImport:!1},this._imports=void 0,this._builtinsImport=void 0;const n=new m.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t}),T.getEmptyRange()),this._parseDiagnostics=n.fetchAndClear()}return this._analyzedFileContentsVersion=this._fileContentsVersion,this._indexingNeeded=!0,this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._parseTreeNeedsCleaning=!1,this._hitMaxImportDepth=void 0,this._diagnosticVersion++,!0}))}index(e,t){return this._logTracker.log(`indexing: ${this._getPathForLogging(this._filePath)}`,(n=>{if(!this._parseResults||!this.isIndexingRequired())return void n.suppress();this._indexingNeeded=!1;const i=S.DocumentSymbolProvider.indexSymbols(w.getFileInfo(this._parseResults.parseTree),this._parseResults,e,t);n.add(`found ${i.length}`);const s=g.stripFileExtension(g.getFileName(this._filePath));return{privateOrProtected:l.isPrivateOrProtectedName(s),symbols:i}}))}getDefinitionsForPosition(e,t,n,i,s){if(this._parseResults)return I.DefinitionProvider.getDefinitionsForPosition(e,this._parseResults,t,n,i,s)}getDeclarationForPosition(e,t,n,i,s){if(this._parseResults)return A.ReferencesProvider.getDeclarationForPosition(e,this._parseResults,this._filePath,t,n,i,s)}addReferences(e,t,n,i){this._parseResults&&A.ReferencesProvider.addReferences(this._parseResults,this._filePath,e,t,n,i)}addHierarchicalSymbolsForDocument(e,t){(this._parseResults||this._cachedIndexResults)&&S.DocumentSymbolProvider.addHierarchicalSymbolsForDocument(this._parseResults?w.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,e,t)}getSymbolsForDocument(e,t){return this._parseResults||this._cachedIndexResults?S.DocumentSymbolProvider.getSymbolsForDocument(this._parseResults?w.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,this._filePath,e,t):[]}getHoverForPosition(e,t,n,i,s){if(!this._isBindingNeeded&&this._parseResults)return D.HoverProvider.getHoverForPosition(e,this._parseResults,t,n,i,s)}getDocumentHighlight(e,t,n,i){if(!this._isBindingNeeded&&this._parseResults)return C.DocumentHighlightProvider.getDocumentHighlight(this._parseResults,t,n,i)}getSignatureHelpForPosition(e,t,n,i,s){if(this._parseResults)return x.SignatureHelpProvider.getSignatureHelpForPosition(this._parseResults,e,t,n,i,s)}getCompletionsForPosition(e,t,n,i,s,r,a,o,l,c,p,d){if(!this._parseResults)return;const u=this.getFileContents();if(void 0===u)return;return new b.CompletionProvider(t,this._parseResults,u,i,e,this._filePath,n,s,r,a,o,{nameMap:l,libraryMap:c,getModuleSymbolsMap:p},d).getCompletionsForPosition()}resolveCompletionItem(e,t,n,i,s,r,a,o,l,c,p){const d=this.getFileContents();if(!this._parseResults||void 0===d)return;const u=c.data;new b.CompletionProvider(u.workspacePath,this._parseResults,d,t,u.position,this._filePath,e,n,i,s,r,{nameMap:a,libraryMap:o,getModuleSymbolsMap:l},p).resolveCompletionItem(c)}performQuickAction(e,t,n){if(this._parseResults&&void 0!==this.getClientVersion())return F.performQuickAction(e,t,this._parseResults,n)}bind(e,t,n){return u.assert(!this.isParseRequired()),u.assert(this.isBindingRequired()),u.assert(!this._isBindingInProgress),u.assert(void 0!==this._parseResults),this._logTracker.log(`binding: ${this._getPathForLogging(this._filePath)}`,(()=>{try{v.timingStats.bindTime.timeOperation((()=>{this._cleanParseTreeIfRequired();const i=this._buildFileInfo(e,this._parseResults.text,t,n);w.setFileInfo(this._parseResults.parseTree,i);const s=new N.Binder(i,e.indexGenerationMode);if(this._isBindingInProgress=!0,s.bindModule(this._parseResults.parseTree),e.internalTestMode){(new L.TestWalker).walk(this._parseResults.parseTree)}this._bindDiagnostics=i.diagnosticSink.fetchAndClear();const r=w.getScope(this._parseResults.parseTree);u.assert(void 0!==r),this._moduleSymbolTable=r.symbolTable}))}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}));const n=new m.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}),T.getEmptyRange()),this._bindDiagnostics=n.fetchAndClear()}finally{this._isBindingInProgress=!1}this._diagnosticVersion++,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this._isBindingNeeded=!1}))}check(e){return u.assert(!this.isParseRequired()),u.assert(!this.isBindingRequired()),u.assert(!this._isBindingInProgress),u.assert(this.isCheckingRequired()),u.assert(void 0!==this._parseResults),this._logTracker.log(`checking: ${this._getPathForLogging(this._filePath)}`,(()=>{try{v.timingStats.typeCheckerTime.timeOperation((()=>{new R.Checker(this._parseResults.parseTree,e).check(),this._isCheckingNeeded=!1;const t=w.getFileInfo(this._parseResults.parseTree);this._checkerDiagnostics=t.diagnosticSink.fetchAndClear()}))}catch(e){if(!c.OperationCanceledException.is(e)){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}));const n=new m.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}),T.getEmptyRange()),this._checkerDiagnostics=n.fetchAndClear(),this._isCheckingNeeded=!1}throw e}finally{this._circularDependencies=[],this._diagnosticVersion++}}))}_buildFileInfo(e,t,n,i){u.assert(void 0!==this._parseResults);const s=new m.TextRangeDiagnosticSink(this._parseResults.tokenizerOutput.lines);return{importLookup:n,futureImports:this._parseResults.futureImports,builtinsScope:i,typingModulePath:this._typingModulePath,typeshedModulePath:this._typeshedModulePath,collectionsModulePath:this._collectionsModulePath,diagnosticSink:s,executionEnvironment:e.findExecEnvironment(this._filePath),diagnosticRuleSet:this._diagnosticRuleSet,fileContents:t,lines:this._parseResults.tokenizerOutput.lines,filePath:this._filePath,moduleName:this._moduleName,isStubFile:this._isStubFile,isTypingStubFile:this._isTypingStubFile,isTypingExtensionsStubFile:this._isTypingExtensionsStubFile,isBuiltInStubFile:this._isBuiltInStubFile,isInPyTypedPackage:this._isThirdPartyPyTypedPresent,accessedSymbolMap:new Map}}_cleanParseTreeIfRequired(){if(this._parseResults&&this._parseTreeNeedsCleaning){new O.ParseTreeCleanerWalker(this._parseResults.parseTree).clean(),this._parseTreeNeedsCleaning=!1}}_resolveImports(e,t,n){const i=[];let s=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["builtins"],importedSymbols:void 0});0===s.resolvedPaths.length||s.resolvedPaths[0]!==this.getFilePath()?i.push(s):s=void 0;const r=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["typing"],importedSymbols:void 0});let a;0!==r.resolvedPaths.length&&r.resolvedPaths[0]===this.getFilePath()||(i.push(r),a=r.resolvedPaths[0]);const o=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["_typeshed"],importedSymbols:void 0});let l,c;0!==o.resolvedPaths.length&&o.resolvedPaths[0]===this.getFilePath()||(i.push(o),l=o.resolvedPaths[0]);for(const s of t){const t=e.resolveImport(this._filePath,n,{leadingDots:s.leadingDots,nameParts:s.nameParts,importedSymbols:s.importedSymbols});t.isImportFound&&t.isTypeshedFile&&s.nameParts.length>=1&&"collections"===s.nameParts[0]&&(c=t.resolvedPaths[t.resolvedPaths.length-1]),i.push(t),w.setImportInfo(s.nameNode,t)}return{imports:i,builtinsImportResult:s,typingModulePath:a,typeshedModulePath:l,collectionsModulePath:c}}_getPathForLogging(e){return this.fileSystem.isMappedFilePath(e)?"[virtual] "+e:e}}},93989:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isStubFile=t.SourceMapper=void 0;const a=r(n(35696)),o=r(n(23241)),l=n(98173),c=n(94647),p=n(16800),d=n(59195),u=n(10425);function h(e){return".pyi"===c.getAnyExtensionFromPath(e,[".pyi"],!1)}t.SourceMapper=class{constructor(e,t,n,i,s,r){this._importResolver=e,this._execEnv=t,this._evaluator=n,this._fileBinder=i,this._boundSourceGetter=s,this._mapCompiled=r}findModules(e){return this._getBoundSourceFilesFromStubFile(e).map((e=>{var t;return null===(t=e.getParseResults())||void 0===t?void 0:t.parseTree})).filter(l.isDefined)}findDeclarations(e){return p.isClassDeclaration(e)?this._findClassOrTypeAliasDeclarations(e):p.isFunctionDeclaration(e)?this._findFunctionOrTypeAliasDeclarations(e):p.isVariableDeclaration(e)?this._findVariableDeclarations(e):p.isParameterDeclaration(e)?this._findParameterDeclarations(e):p.isSpecialBuiltInClassDeclarations(e)?this._findSpecialBuiltInClassDeclarations(e):[]}findClassDeclarations(e){return this._findClassOrTypeAliasDeclarations(e).filter((e=>p.isClassDeclaration(e))).map((e=>e))}findClassDeclarationsByType(e,t){const n=[];return this._addClassTypeDeclarations(e,t,n,new Set),n.filter((e=>p.isClassDeclaration(e))).map((e=>e))}findFunctionDeclarations(e){return this._findFunctionOrTypeAliasDeclarations(e).filter((e=>p.isFunctionDeclaration(e))).map((e=>e))}_findSpecialBuiltInClassDeclarations(e,t=new Set){if(38===e.node.valueExpression.nodeType){const n=e.node.valueExpression.value;return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}return[]}_findClassOrTypeAliasDeclarations(e,t=new Set){const n=this._getFullClassName(e.node);return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}_findFunctionOrTypeAliasDeclarations(e,t=new Set){const n=e.node.name.value,i=this._getBoundSourceFilesFromStubFile(e.path);if(e.isMethod){const s=o.getEnclosingClass(e.node);if(void 0===s)return[];const r=this._getFullClassName(s);return i.flatMap((e=>this._findMethodDeclarationsByName(e,r,n,t)))}return i.flatMap((e=>this._findFunctionDeclarationsByName(e,n,t)))}_findVariableDeclarations(e,t=new Set){if(38!==e.node.nodeType)return[];const n=e.node.value,i=this._getBoundSourceFilesFromStubFile(e.path),s=o.getEnclosingClass(e.node);if(s){const e=this._getFullClassName(s);return i.flatMap((i=>this._findFieldDeclarationsByName(i,e,n,t)))}return i.flatMap((e=>this._findVariableDeclarationsByName(e,n,t)))}_findParameterDeclarations(e){const t=[];if(!e.node.name)return t;const n=o.getEnclosingFunction(e.node);if(!n)return t;const i=this._evaluator.getDeclarationsForNameNode(n.name);if(!i)return t;const s=new Set;for(const n of i)for(const i of this._findFunctionOrTypeAliasDeclarations(n,s))t.push(...this._lookUpSymbolDeclarations(i.node,e.node.name.value).filter((e=>p.isParameterDeclaration(e))).map((e=>e)));return t}_findMemberDeclarationsByName(e,t,n,i,s){const r=[],a=this._findClassDeclarationsByName(e,t,s);for(const e of a.filter((e=>p.isClassDeclaration(e))).map((e=>e))){const t=this._evaluator.getTypeOfClass(e.node);if(!t)continue;const a=u.lookUpClassMember(t.classType,n);if(a)for(const e of a.symbol.getDeclarations())i(e,s,r)}return r}_findFieldDeclarationsByName(e,t,n,i){let s=[];const r=`@${e.getFilePath()}/c/${t}/v/${n}`;return i.has(r)||(i.add(r),s=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{if(p.isVariableDeclaration(e))if(this._isStubFile(e.path))for(const i of this._findVariableDeclarations(e,t))p.isVariableDeclaration(i)&&n.push(i);else n.push(e)}),i),i.delete(r)),s}_findMethodDeclarationsByName(e,t,n,i){let s=[];const r=`@${e.getFilePath()}/c/${t}/f/${n}`;return i.has(r)||(i.add(r),s=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{p.isFunctionDeclaration(e)&&(this._isStubFile(e.path)?n.push(...this._findFunctionOrTypeAliasDeclarations(e,t)):n.push(e))}),i),i.delete(r)),s}_findVariableDeclarationsByName(e,t,n){var i;const s=[],r=`@${e.getFilePath()}/v/${t}`;if(n.has(r))return s;n.add(r);const a=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(!a)return s;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,s,n);else for(const e of o)this._addVariableDeclarations(e,s,n);return n.delete(r),s}_findFunctionDeclarationsByName(e,t,n){var i;const s=[],r=`@${e.getFilePath()}/f/${t}`;if(n.has(r))return s;n.add(r);const a=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(!a)return s;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,s,n);else for(const e of o)this._addClassOrFunctionDeclarations(e,s,n);return n.delete(r),s}_findClassDeclarationsByName(e,t,n){var i;let s=[];const r=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(r){let i=t.split(".");i.length>0&&(s=this._findClassDeclarations(e,i[0],r,n),i=i.slice(1));for(const t of i)s=s.flatMap((i=>this._findClassDeclarations(e,t,i.node,n)))}return s}_findClassDeclarations(e,t,n,i){const s=[],r=`@${e.getFilePath()}[${n.start}]${t}`;if(i.has(r))return s;i.add(r);const a=this._lookUpSymbolDeclarations(n,t);if(0===a.length&&36===n.nodeType)this._addDeclarationsFollowingWildcardImports(n,t,s,i);else for(const e of a)this._addClassOrFunctionDeclarations(e,s,i);return i.delete(r),s}_addVariableDeclarations(e,t,n){if(p.isVariableDeclaration(e))this._isStubFile(e.path)?t.push(...this._findVariableDeclarations(e,n)):t.push(e);else if(p.isAliasDeclaration(e)){const i=this._evaluator.resolveAliasDeclaration(e,!0);i&&(p.isVariableDeclaration(i)?this._addVariableDeclarations(i,t,n):(p.isClassDeclaration(i)||p.isFunctionDeclaration(i))&&this._addClassOrFunctionDeclarations(i,t,n))}}_addClassOrFunctionDeclarations(e,t,n){var i;if(p.isClassDeclaration(e))this._isStubFile(e.path)?t.push(...this._findClassOrTypeAliasDeclarations(e,n)):t.push(e);else if(p.isFunctionDeclaration(e))this._isStubFile(e.path)?t.push(...this._findFunctionOrTypeAliasDeclarations(e,n)):t.push(e);else if(p.isAliasDeclaration(e)){const i=this._evaluator.resolveAliasDeclaration(e,!0);i&&this._addClassOrFunctionDeclarations(i,t,n)}else if(p.isVariableDeclaration(e)){this._addVariableDeclarations(e,t,n);const s=null!==(i=e.typeAliasName)&&void 0!==i?i:e.node,r=this._evaluator.getType(s);if(!r)return;if(d.isFunction(r)&&r.details.declaration)this._addClassOrFunctionDeclarations(r.details.declaration,t,n);else if(d.isOverloadedFunction(r))for(const e of r.overloads.map((e=>e.details.declaration)).filter(l.isDefined))this._addClassOrFunctionDeclarations(e,t,n);else d.isInstantiableClass(r)&&this._addClassTypeDeclarations(e.path,r,t,n)}}_addClassTypeDeclarations(e,t,n,i){const s=this._importResolver.resolveImport(e,this._execEnv,{leadingDots:0,nameParts:t.details.moduleName.split("."),importedSymbols:[]});if(s.isImportFound&&s.resolvedPaths.length>0){const e=s.resolvedPaths[s.resolvedPaths.length-1],r=this._getSourceFiles(e),a=t.details.fullName.substring(t.details.moduleName.length+1);for(const e of r)n.push(...this._findClassDeclarationsByName(e,a,i))}}_getSourceFiles(e){const t=[];if(this._isStubFile(e))t.push(...this._getBoundSourceFilesFromStubFile(e));else{const n=this._boundSourceGetter(e);n&&t.push(n)}return t}_addDeclarationsFollowingWildcardImports(e,t,n,i){var s,r;const o=null===(s=a.getScope(e))||void 0===s?void 0:s.symbolTable;if(o)for(const e of o.values())for(const s of e.getDeclarations()){if(!p.isAliasDeclaration(s)||!s.path||22!==s.node.nodeType||!s.node.isWildcardImport)continue;const e=`@${s.path}/l/${t}`;if(i.has(e))continue;i.add(e);const a=this._getSourceFiles(s.path);for(const e of a){const s=null===(r=e.getParseResults())||void 0===r?void 0:r.parseTree;if(!s)continue;const a=this._lookUpSymbolDeclarations(s,t);if(0===a.length)this._addDeclarationsFollowingWildcardImports(s,t,n,i);else for(const e of a){const t=this._evaluator.resolveAliasDeclaration(e,!0);t&&(p.isFunctionDeclaration(t)||p.isClassDeclaration(t)?this._addClassOrFunctionDeclarations(t,n,i):p.isVariableDeclaration(t)&&this._addVariableDeclarations(t,n,i))}}}}_lookUpSymbolDeclarations(e,t){if(void 0===e)return[];const n=a.getScope(e),i=null==n?void 0:n.lookUpSymbol(t),s=null==i?void 0:i.getDeclarations();return null!=s?s:[]}_getFullClassName(e){const t=[];let n=e;for(;void 0!==n;)t.push(n.name.value),n=o.getEnclosingClass(n);return t.reverse().join(".")}_getBoundSourceFilesFromStubFile(e){return this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).map((t=>this._fileBinder(e,t))).filter(l.isDefined)}_isStubFile(e){return!!h(e)&&this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).every((t=>t!==e))}},t.isStubFile=h},67737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateStaticBoolLikeExpression=t.evaluateStaticBoolExpression=void 0;const i=n(14943);function s(e,t,n,c){if(55===e.nodeType){if(37===e.operator||36===e.operator){const i=r(e.expression,t,n,c);if(void 0!==i)return!i}}else if(7===e.nodeType){if(37===e.operator||36===e.operator){const i=s(e.leftExpression,t,n,c),r=s(e.rightExpression,t,n,c);if(void 0===i||void 0===r)return;return 37===e.operator?i||r:i&&r}if(l(e.leftExpression,c)&&52===e.rightExpression.nodeType){const n=function(e){let t;if(e.expressions.length>=2){if(40===e.expressions[0].nodeType&&!e.expressions[0].isImaginary&&40===e.expressions[1].nodeType&&!e.expressions[1].isImaginary){const n=e.expressions[0],i=e.expressions[1];t=256*n.value+i.value}}else if(1===e.expressions.length){t=256*e.expressions[0].value}return t}(e.rightExpression);return a(e.operator,t.pythonVersion,n)}if(24===e.leftExpression.nodeType&&l(e.leftExpression.baseExpression,c)&&1===e.leftExpression.items.length&&!e.leftExpression.trailingComma&&!e.leftExpression.items[0].name&&0===e.leftExpression.items[0].argumentCategory&&40===e.leftExpression.items[0].valueExpression.nodeType&&!e.leftExpression.items[0].valueExpression.isImaginary&&0===e.leftExpression.items[0].valueExpression.value&&40===e.rightExpression.nodeType)return a(e.operator,Math.floor(t.pythonVersion/256),e.rightExpression.value);if(function(e,t=["sys"]){if(35===e.nodeType&&38===e.leftExpression.nodeType&&"platform"===e.memberName.value&&t.some((t=>t===e.leftExpression.value)))return!0;return!1}(e.leftExpression,c)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){if(e.pythonPlatform===i.PythonPlatform.Darwin)return"darwin";if(e.pythonPlatform===i.PythonPlatform.Windows)return"win32";if(e.pythonPlatform===i.PythonPlatform.Linux)return"linux";return}(t);return o(e.operator,s,n)}if(function(e){if(35===e.nodeType&&38===e.leftExpression.nodeType&&"os"===e.leftExpression.value&&"name"===e.memberName.value)return!0;return!1}(e.leftExpression)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){if(e.pythonPlatform===i.PythonPlatform.Darwin)return"posix";if(e.pythonPlatform===i.PythonPlatform.Windows)return"nt";if(e.pythonPlatform===i.PythonPlatform.Linux)return"posix";return}(t);if(void 0!==s)return o(e.operator,s,n)}}else if(11===e.nodeType){if(33===e.constType)return!0;if(15===e.constType)return!1}else if(38===e.nodeType){if("TYPE_CHECKING"===e.value)return!0}else if(n&&35===e.nodeType&&"TYPE_CHECKING"===e.memberName.value&&38===e.leftExpression.nodeType&&n.some((t=>t===e.leftExpression.value)))return!0}function r(e,t,n,i){return(11!==e.nodeType||26!==e.constType)&&s(e,t,n,i)}function a(e,t,n){if(void 0!==t&&void 0!==n){if(20===e)return tn;if(16===e)return t>=n;if(12===e)return t===n;if(28===e)return t!==n}}function o(e,t,n){if(void 0!==t&&void 0!==n){if(12===e)return t===n;if(28===e)return t!==n}}function l(e,t=["sys"]){return!(35!==e.nodeType||38!==e.leftExpression.nodeType||"version_info"!==e.memberName.value||!t.some((t=>t===e.leftExpression.value)))}t.evaluateStaticBoolExpression=s,t.evaluateStaticBoolLikeExpression=r},97882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=t.indeterminateSymbolId=void 0;const i=n(88023);let s=1;t.indeterminateSymbolId=0;class r{constructor(e=4){this.id=s++,this._flags=e}static createWithType(e,t){const n=new r(e);return n._synthesizedType=t,n}isInitiallyUnbound(){return!!(1&this._flags)}setIsExternallyHidden(){this._flags|=2}isExternallyHidden(){return!!(2&this._flags)}setIsIgnoredForProtocolMatch(){this._flags|=64}isIgnoredForProtocolMatch(){return!!(64&this._flags)}setIsClassMember(){this._flags|=4}isClassMember(){return!!(4&this._flags)}setIsInstanceMember(){this._flags|=8}isInstanceMember(){return!!(8&this._flags)}setIsExclusiveClassMember(){this._flags|=512}setIsNotExclusiveClassMember(){this._flags&=-513}isExclusiveClassMember(){return!!(512&this._flags)}setIsClassVar(){this._flags|=128}isClassVar(){return!!(128&this._flags)}setIsInDunderAll(){this._flags|=256}isInDunderAll(){return!!(256&this._flags)}setIsPrivateMember(){this._flags|=32}isPrivateMember(){return!!(32&this._flags)}addDeclaration(e){if(this._declarations){const t=this._declarations.findIndex((t=>i.areDeclarationsSame(t,e)));if(t<0)this._declarations.push(e),this._declarations.forEach((e=>{1===e.type&&e.typeAliasName&&delete e.typeAliasName}));else{const n=this._declarations[t];i.hasTypeForDeclaration(e)?(this._declarations[t]=e,1===n.type&&1===e.type&&!e.inferredTypeSource&&n.inferredTypeSource&&(e.inferredTypeSource=n.inferredTypeSource)):1===e.type&&1===n.type&&(e.isFinal&&(n.isFinal=!0),e.typeAliasAnnotation&&(n.typeAliasAnnotation=e.typeAliasAnnotation),!n.inferredTypeSource&&e.inferredTypeSource&&(n.inferredTypeSource=e.inferredTypeSource))}}else this._declarations=[e]}hasDeclarations(){return!!this._declarations&&this._declarations.length>0}getDeclarations(){return this._declarations?this._declarations:[]}hasTypedDeclarations(){return!!this._synthesizedType||this.getDeclarations().some((e=>i.hasTypeForDeclaration(e)))}getTypedDeclarations(){return this.getDeclarations().filter((e=>i.hasTypeForDeclaration(e)))}getSynthesizedType(){return this._synthesizedType}}t.Symbol=r},91197:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicConstantOrTypeAlias=t.isTypeAliasName=t.isConstantName=t.isSingleDunderName=t.isDunderName=t.isPrivateOrProtectedName=t.isProtectedName=t.isPrivateName=void 0;const n=/^[A-Z0-9_]+$/,i=/^[_]+$/,s=/^_{0,2}[A-Z][A-Za-z0-9_]+$/;function r(e){return e.length>2&&e.startsWith("__")&&!e.endsWith("__")}function a(e){return e.length>1&&e.startsWith("_")&&!e.startsWith("__")}function o(e){return r(e)||a(e)}function l(e){return!!e.match(n)&&!e.match(i)}function c(e){return!!e.match(s)}t.isPrivateName=r,t.isProtectedName=a,t.isPrivateOrProtectedName=o,t.isDunderName=function(e){return e.length>4&&e.startsWith("__")&&e.endsWith("__")},t.isSingleDunderName=function(e){return e.length>2&&e.startsWith("_")&&e.endsWith("_")},t.isConstantName=l,t.isTypeAliasName=c,t.isPublicConstantOrTypeAlias=function(e){return!o(e)&&(l(e)||c(e))}},15020:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNotRequiredTypedDictVariable=t.isRequiredTypedDictVariable=t.isFinalVariable=t.isTypedDictMemberAccessedThroughIndex=t.getLastTypedDeclaredForSymbol=void 0;const i=n(88023);t.getLastTypedDeclaredForSymbol=function(e){const t=e.getTypedDeclarations();if(t.length>0)return t[t.length-1]},t.isTypedDictMemberAccessedThroughIndex=function(e){const t=e.getTypedDeclarations();if(t.length>0){if(1===t[t.length-1].type)return!0}return!1},t.isFinalVariable=function(e){return e.getDeclarations().some((e=>i.isFinalVariableDeclaration(e)))},t.isRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isRequired))},t.isNotRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isNotRequired))}},51660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NameTypeWalker=t.TestWalker=void 0;const i=n(22339),s=n(20823),r=n(80957);class a extends i.ParseTreeWalker{constructor(){super()}visitNode(e){const t=super.visitNode(e);return this._verifyParentChildLinks(e,t),this._verifyChildRanges(e,t),t}_verifyParentChildLinks(e,t){t.forEach((t=>{t&&t.parent!==e&&s.fail(`Child node ${t.nodeType} does not contain a reference to its parent ${e.nodeType}`)}))}_verifyChildRanges(e,t){let n;t.forEach((t=>{if(t){let i=!1;3===e.nodeType&&t===e.typeAnnotationComment&&(i=!0),48===e.nodeType&&t===e.typeAnnotation&&(i=!0),i||((t.startr.TextRange.getEnd(e))&&s.fail(`Child node ${t.nodeType} is not contained within its parent ${e.nodeType}`),n&&t.startl.ensureTrailingDirectorySeparator(e))).sort(((e,t)=>e.localeCompare(t))).reverse();const n=/[\\/]/g;function i(t){if(t){for(const i of e)if(t.startsWith(i)){const e=t.substring(i.length);return l.stripFileExtension(e).replace(n,".")}return t}return""}function s(e){var n,i,r,a,l,c;if(e)switch(e.category){case 2:return`Any ${t(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.fullName)}`;case 7:return h.TypeBase.isInstantiable(e)?`Class '${e.details.name}' (${e.details.moduleName})`:`Object '${e.details.name}' (${e.details.moduleName})`;case 5:return`Function '${e.details.name}' (${e.details.moduleName})`;case 8:return`Module '${e.moduleName}' (${e.moduleName})`;case 4:return`Never ${t(null===(i=e.typeAliasInfo)||void 0===i?void 0:i.fullName)}`;case 3:return`None ${t(null===(r=e.typeAliasInfo)||void 0===r?void 0:r.fullName)}`;case 6:return`OverloadedFunction [${e.overloads.map((e=>t(s(e),'"'))).join(",")}]`;case 10:return`TypeVar '${e.details.name}' ${t(null===(a=e.typeAliasInfo)||void 0===a?void 0:a.fullName)}`;case 0:return`Unbound ${t(null===(l=e.typeAliasInfo)||void 0===l?void 0:l.fullName)}`;case 9:return`Union [${e.subtypes.map((e=>t(s(e),'"'))).join(",")}]`;case 1:return`Unknown ${t(null===(c=e.typeAliasInfo)||void 0===c?void 0:c.fullName)}`;default:o.assertNever(e)}return""}function r(e){if(e)switch(e.type){case 6:return`Alias, ${m(e.node)} (${i(e.path)})`;case 4:return`Class, ${m(e.node)} (${i(e.path)})`;case 3:return`Function, ${m(e.node)} (${i(e.path)})`;case 0:return`Intrinsic, ${m(e.node)} ${e.intrinsicType} (${i(e.path)})`;case 2:return`Parameter, ${m(e.node)} (${i(e.path)})`;case 5:return`SpecialBuiltInClass, ${m(e.node)} (${i(e.path)})`;case 1:return`Variable, ${m(e.node)} (${i(e.path)})`;default:o.assertNever(e)}return""}function m(e,n=!1){var s;if(!e)return"";const r=n?`(${i(null===(s=function(e){for(;36!==e.nodeType&&e.parent;)e=e.parent;return 36===e.nodeType?p.getFileInfo(e):void 0}(e))||void 0===s?void 0:s.filePath)})`:"";if(c.isExpressionNode(e))return t(function(e,t=30){return e.length "}(d.printExpression(e)),'"')+` ${r}`;switch(e.nodeType){case 21:return`importAs '${m(e.module)}' ${t(e.alias?m(e.alias):"")} ${r}`;case 22:return`importFrom [${e.imports.map((e=>t(m(e),'"'))).join(",")}]`;case 23:return`ImportFromAs '${m(e.name)}' ${t(e.alias?m(e.alias):"")} ${r}`;case 36:return`module ${r}`;case 10:return`class '${m(e.name)}' ${r}`;case 28:return`function '${m(e.name)}' ${r}`;case 37:return`moduleName '${e.nameParts.map((e=>m(e))).join(".")}' ${r}`;case 1:return`argument '${e.name?m(e.name):"N/A"}' ${r}`;case 41:return`parameter '${e.name?m(e.name):"N/A"}' ${r}`;default:return`${d.printParseNodeType(e.nodeType)} ${r}`}}return{print:function(e){return e?function(e){const t=e;return t&&a.isNumber(t.nodeType)}(e)?m(e,!0):function(e){const t=e;return t&&a.isNumber(t.type)&&a.isString(t.path)&&a.isString(t.moduleName)}(e)?r(e):e instanceof u.Symbol?(t=e)?t.hasDeclarations()?`symbol ${r(t.getDeclarations()[0])}`:"":"":function(e){const t=e;return t&&a.isNumber(t.category)&&a.isNumber(t.flags)}(e)?s(e):void o.assertNever(e):"";var t},printFileOrModuleName:i}}},57065:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.IncompleteTypeTracker=t.SpeculativeTypeTracker=t.isIncompleteType=void 0;const a=n(20823),o=r(n(23241)),l=n(59195);t.isIncompleteType=function(e){return!!e.isIncompleteType};t.SpeculativeTypeTracker=class{constructor(){this._speculativeContextStack=[],this._speculativeTypeCache=new Map}enterSpeculativeContext(e,t){this._speculativeContextStack.push({speculativeRootNode:e,entriesToUndo:[],allowCacheRetention:t})}leaveSpeculativeContext(){a.assert(this._speculativeContextStack.length>0);this._speculativeContextStack.pop().entriesToUndo.forEach((e=>{e.cache.delete(e.id)}))}isSpeculative(e){if(0===this._speculativeContextStack.length)return!1;if(!e)return!0;for(let t=this._speculativeContextStack.length-1;t>=0;t--)if(o.isNodeContainedWithin(e,this._speculativeContextStack[t].speculativeRootNode))return!0;return!1}trackEntry(e,t){const n=this._speculativeContextStack.length;n>0&&this._speculativeContextStack[n-1].entriesToUndo.push({cache:e,id:t})}disableSpeculativeMode(){const e=this._speculativeContextStack;return this._speculativeContextStack=[],e}enableSpeculativeMode(e){a.assert(0===this._speculativeContextStack.length),this._speculativeContextStack=e}addSpeculativeType(e,t,n){if(a.assert(this._speculativeContextStack.length>0),this._speculativeContextStack.some((e=>!e.allowCacheRetention)))return;let i=this._speculativeTypeCache.get(e.id);i||(i=[],this._speculativeTypeCache.set(e.id,i)),i.push({type:t,expectedType:n})}getSpeculativeType(e,t){if(this._speculativeContextStack.some((t=>o.isNodeContainedWithin(e,t.speculativeRootNode)))){const n=this._speculativeTypeCache.get(e.id);if(n)for(const e of n)if(t){if(e.expectedType&&l.isTypeSame(t,e.expectedType))return e.type}else if(!e.expectedType)return e.type}}};t.IncompleteTypeTracker=class{constructor(){this._trackerStack=[],this._isUndoTrackingEnabled=!1}trackEntry(e,t){if(this._isUndoTrackingEnabled){this._trackerStack[this._trackerStack.length-1].push({cache:e,id:t})}}enterTrackingScope(){this._trackerStack.push([])}exitTrackingScope(){this._trackerStack.pop().forEach((e=>{e.cache.delete(e.id)})),0===this._trackerStack.length&&(this._isUndoTrackingEnabled=!1)}enableUndoTracking(){this._trackerStack.length>0&&(this._isUndoTrackingEnabled=!0)}isUndoTrackingEnabled(){return this._isUndoTrackingEnabled}}},58333:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getFunctionOrClassDeclDocString=t.getClassDocString=t.getModuleDocString=t.getVariableInStubFileDocStrings=t.getPropertyDocStringInherited=t.getOverloadedFunctionDocStringsInherited=t.getFunctionDocStringInherited=void 0;const a=n(16800),o=r(n(23241)),l=n(93989),c=n(59195),p=n(10425);function d(e){var t,n,i;return o.getDocString(null!==(i=null===(n=null===(t=e.node)||void 0===t?void 0:t.suite)||void 0===n?void 0:n.statements)&&void 0!==i?i:[])}function u(e,t,n){if(!c.isOverloadedFunction(e))return;const i=[];if(e.overloads.some((e=>e.details.docString)))e.overloads.forEach((e=>{e.details.docString&&i.push(e.details.docString)}));else if(t&&l.isStubFile(t.path)&&a.isFunctionDeclaration(t)){const e=m(n.findFunctionDeclarations(t));e&&i.push(e)}return i}function h(e,t){let n=m([e]);if(!n&&l.isStubFile(e.path)){n=m(t.findFunctionDeclarations(e))}return n}function m(e){for(const t of e){const e=d(t);if(e)return e}}t.getFunctionDocStringInherited=function(e,t,n,i){let s;if(t&&a.isFunctionDeclaration(t)&&(s=function(e,t,n){if(!c.isFunction(e))return;let i=e.details.docString;!i&&t&&(i=h(t,n));!i&&e.details.declaration&&(i=h(e.details.declaration,n));return i}(e,t,n)),!s&&i){const t=e.details.name,r=p.getClassMemberIterator(i,t,25);for(const e of r){if(e.symbol.getDeclarations().length>0){const t=e.symbol.getDeclarations().slice(-1)[0];if(a.isFunctionDeclaration(t)&&(s=h(t,n),s))break}}}return s},t.getOverloadedFunctionDocStringsInherited=function(e,t,n,i,s){let r=u(e,t,n);if(r&&r.length>0)return r;if(s&&e.overloads.length>0){const t=e.overloads[0].details.name,a=p.getClassMemberIterator(s,t,25);for(const e of a){const t=e.symbol.getDeclarations().slice(-1)[0],s=i.getTypeForDeclaration(t);if(s&&(r=u(s,t,n),r&&r.length>0))break}}return null!=r?r:[]},t.getPropertyDocStringInherited=function(e,t,n){const i=o.getEnclosingClass(e.node.name,!1),s=i?n.getTypeOfClass(i):void 0;if(s)return function(e,t,n,i){if(!e||!a.isFunctionDeclaration(e))return;const s=n.getTypeForDeclaration(e);if(!s||!p.isProperty(s))return;const r=28===e.node.nodeType?e.node.name.value:void 0;if(!r)return;const o=p.getClassIterator(i,0);for(const[e]of o){if(!c.isInstantiableClass(e))continue;const i=e.details.fields.get(r),s=null==i?void 0:i.getDeclarations();if(s)for(const e of s)if(a.isFunctionDeclaration(e)){const i=n.getTypeForDeclaration(e);if(i&&p.isProperty(i)){const n=h(e,t);if(n)return n}}}return}(e,t,n,s.classType)},t.getVariableInStubFileDocStrings=function(e,t){const n=[];if(!l.isStubFile(e.path))return n;for(const i of t.findDeclarations(e))if(a.isClassDeclaration(i)||a.isFunctionDeclaration(i)){const e=d(i);e&&n.push(e)}return n},t.getModuleDocString=function(e,t,n){let i=e.docString;if(!i&&t&&l.isStubFile(t.path)){i=function(e){for(const t of e)if(t.statements){const e=o.getDocString(t.statements);if(e)return e}return}(n.findModules(t.path))}return i},t.getClassDocString=function(e,t,n){let i=e.details.docString;if(!i&&t&&a.isClassDeclaration(t)&&(i=m([t]),!i&&t&&l.isStubFile(t.path)&&4===t.type)){i=m(n.findClassDeclarations(t))}if(!i&&t){const s=n.findClassDeclarationsByType(t.path,e);if(s){i=m(s.filter((e=>a.isClassDeclaration(e))).map((e=>e)))}}return i},t.getFunctionOrClassDeclDocString=d},68755:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluator=void 0;const a=n(38213),o=n(20823),l=n(24319),c=n(15741),p=n(28348),d=n(57485),u=n(80957),h=n(74426),m=n(55390),y=n(14014),g=r(n(82048)),f=r(n(35696)),T=n(24394),_=n(88023),v=r(n(23241)),b=r(n(57203)),I=n(67737),C=n(97882),S=n(91197),D=n(15020),F=n(57065),A=r(n(22105)),x=n(59195),k=n(10425),P=n(20670),E={0:["__add__","__radd__",!1],33:["__sub__","__rsub__",!1],26:["__mul__","__rmul__",!1],13:["__floordiv__","__rfloordiv__",!1],10:["__truediv__","__rtruediv__",!1],24:["__mod__","__rmod__",!1],29:["__pow__","__rpow__",!1],22:["__matmul__","__rmatmul__",!1],3:["__and__","__rand__",!1],6:["__or__","__ror__",!1],8:["__xor__","__rxor__",!1],17:["__lshift__","__rlshift__",!1],31:["__rshift__","__rrshift__",!1],12:["__eq__","__ne__",!0],28:["__ne__","__eq__",!0],20:["__lt__","__gt__",!0],21:["__le__","__ge__",!0],15:["__gt__","__lt__",!0],16:["__ge__","__le__",!0]},w={36:!1,37:!1,39:!0,40:!0,41:!0,42:!0},N=new Map([["asyncio.futures.Future",d.PythonVersion.V3_9],["builtins.dict",d.PythonVersion.V3_9],["builtins.frozenset",d.PythonVersion.V3_9],["builtins.list",d.PythonVersion.V3_9],["builtins._PathLike",d.PythonVersion.V3_9],["builtins.set",d.PythonVersion.V3_9],["builtins.tuple",d.PythonVersion.V3_9],["collections.ChainMap",d.PythonVersion.V3_9],["collections.Counter",d.PythonVersion.V3_9],["collections.defaultdict",d.PythonVersion.V3_9],["collections.DefaultDict",d.PythonVersion.V3_9],["collections.deque",d.PythonVersion.V3_9],["collections.OrderedDict",d.PythonVersion.V3_9],["queue.Queue",d.PythonVersion.V3_9]]),R=new Map([["builtins.float",["builtins.int"]],["builtins.complex",["builtins.float","builtins.int"]],["builtins.bytes",["builtins.bytearray","builtins.memoryview"]]]),M=["builtins.bool","builtins.bytearray","builtins.bytes","builtins.dict","builtins.float","builtins.frozenset","builtins.int","builtins.list","builtins.set","builtins.str","builtins.tuple"],O=64;t.createTypeEvaluator=function(e,t,n,i){const s=[],r=new Map,L=new Map,U=new Map,V=new Map,z=new Map,B=new Map,W=new F.SpeculativeTypeTracker,j=new Map,$=[],G=new F.IncompleteTypeTracker;let q,K,H,Y,Q,Z,J,X=1,ee=!1;const te=[];let ne;function ie(e,s,r){return n.log(e,(e=>(e.add(null==i?void 0:i.print(r)),s())),t.minimumLoggingThreshold)}function se(){q&&a.throwIfCancellationRequested(q)}function re(e){let t;if(t=ne&&le(e)?ne.get(e.id):B.get(e.id),void 0!==t)return o.assert(!F.isIncompleteType(t)),t}function ae(e,t,n,i,s=!1){if(n)return void(J&&J.set(e.id,t));const r=ne&&le(e)?ne:B;r.set(e.id,t),W.isSpeculative(e)&&(W.trackEntry(r,e.id),s&&W.addSpeculativeType(e,t,i)),G.trackEntry(r,e.id)}function oe(e){(ne&&le(e)?ne:B).delete(e.id)}function le(e){const t=te.length;if(0===t)return!1;const n=te[t-1];let i=e;for(;i;){if(i===n.functionNode)return!0;i=i.parent}return!1}function ce(e,t){return s.findIndex((n=>n.symbolId===e.id&&n.declaration===t))}function pe(e,t){const n=ce(e,t);if(n>=0){for(let e=n+1;e=0&&(s[i].partialType=n)}function he(e,t){const n=ce(e,t);if(n>=0)return s[n].partialType}function me(e){var t;return null===(t=On(e,(()=>{En(e)})))||void 0===t?void 0:t.type}function ye(e){ee||(ee=!0,H=Xn(e,"object"),Y=Jn(e,"type"),we(e,"Collection"),K=function(e,t){const n=ii(e);return Ne(t,n.typeshedModulePath)}(e,"NoneType")||x.AnyType.create(),Q=Jn(e,"tuple"),Z=Jn(e,"bool"))}const ge=t.logCalls?(e,t,n=0)=>ie("getTypeOfExpression",(()=>fe(e,t,n)),e):fe;function fe(e,t,n=0){var i;const s=re(e);if(s)return{type:s,node:e};{const n=W.getSpeculativeType(e,t);if(n)return{type:n,node:e}}se();const r=k.transformPossibleRecursiveTypeAlias(t);let a;ye(e);let p=0!=(64&n);switch(e.nodeType){case 38:a=function(e,t){var n;const i=ii(e),s=e.value;let r,a=!1;const o=0!=(4&t)||i.isStubFile,l=ei(e,s,!o);if(l){let p=!o;4===l.scope.type&&(p=!1);const d=l.symbol,u=ci(d,p?e:void 0),m=k.transformPossibleRecursiveTypeAlias(u.type);u.isIncomplete&&(a=!0),u.isRecursiveDefinition&&Re(e)&&Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.recursiveDefinition().format({name:s}),e);const y=!!m&&x.isInstantiableClass(m)&&x.ClassType.isSpecialBuiltIn(m);if(r=m,p&&!y){const t=l.isBeyondExecutionScope||!d.isInitiallyUnbound()?m:x.UnboundType.create(),o=zn(e,d.id,t,!1);if(o.type&&(r=o.type),o.isIncomplete&&(a=!0),o.usedOuterScopeAlias){const t=null===(n=l.scope.parent)||void 0===n?void 0:n.lookUpSymbolRecursive(s);t&&Ye(i,t.symbol,e)}}r=Xe(e,r,t),a||f.isCodeUnreachable(e)||0==(16384&t)&&(x.isUnbound(r)?Be(i.diagnosticRuleSet.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,h.Localizer.Diagnostic.symbolIsUnbound().format({name:s}),e):x.isPossiblyUnbound(r)&&Be(i.diagnosticRuleSet.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,h.Localizer.Diagnostic.symbolIsPossiblyUnbound().format({name:s}),e)),Ye(i,d,e),0!=(1024&t)&&u.includesVariableDecl&&!r.typeAliasInfo&&(k.isTypeAliasPlaceholder(r)||x.isTypeVar(r)||x.isUnknown(r)||i.isTypingStubFile||x.TypeBase.isInstantiable(r)||Be(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAnnotationVariable(),e))}else"reveal_type"!==s&&"reveal_locals"!==s&&Be(i.diagnosticRuleSet.reportUndefinedVariable,c.DiagnosticRule.reportUndefinedVariable,h.Localizer.Diagnostic.symbolIsUndefined().format({name:s}),e),r=x.UnknownType.create();x.isParamSpec(r)&&32&t&&(Ue(h.Localizer.Diagnostic.paramSpecContext(),e),r=x.UnknownType.create());if(x.isTypeVar(r)&&0==(64&t)&&r.details.name===s){const t=r.details.isVariadic?we(e,"TypeVarTuple"):we(e,"TypeVar");r=t&&x.isInstantiableClass(t)?x.ClassType.cloneAsInstance(t):x.UnknownType.create()}0!=(64&t)&&0==(512&t)&&x.isInstantiableClass(r)&&x.ClassType.isBuiltIn(r,"Generic")&&Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.genericNotAllowed(),e);x.isTypeVar(r)&&!r.details.isSynthesized&&(r=Je(e,r,t));return{type:r,node:e,isIncomplete:a}}(e,n);break;case 35:a=function(e,t){const n=2|48196&t,i=ge(e.leftExpression,void 0,n);if(k.isTypeAliasPlaceholder(i.type))return{node:e,type:x.UnknownType.create(),isIncomplete:!0};const s=nt(e,i,{method:"get"},t);if(T.isCodeFlowSupportedForReference(e)){ae(e,s.type,!1),ae(e.memberName,s.type,!1);let n=s.type,r=!!s.isIncomplete;if(x.isUnbound(n)){const t=Ge(i.type);let s;x.isInstantiableClass(t)?s=k.lookUpClassMember(t,e.memberName.value,1):x.isClassInstance(t)&&(s=k.lookUpObjectMember(t,e.memberName.value,1)),s&&(n=gi(s),r=!1)}const a=zn(e,C.indeterminateSymbolId,n,r);a.type&&(s.type=a.type),a.isIncomplete&&(s.isIncomplete=!0),s.type=Xe(e,s.type,t),oe(e),oe(e.memberName)}i.isIncomplete&&(s.isIncomplete=!0);return s}(e,n),k.isTypeAliasPlaceholder(a.type)||ae(e.memberName,a.type,!!a.isIncomplete);break;case 24:a=function(e,t=0){const n=ge(e.baseExpression,void 0,2|t);if(64&t&&48===e.baseExpression.nodeType){const t=ii(e);!t.isStubFile&&t.executionEnvironment.pythonVersion{x.isClassInstance(e)&&x.ClassType.isBuiltIn(e)||(t=!1)})),t){ae(e,i.type,!1);const t=zn(e,C.indeterminateSymbolId,i.type,!!n.isIncomplete||!!i.isIncomplete);t.type&&(i.type=t.type),t.isIncomplete&&(i.isIncomplete=!0),oe(e)}}n.isIncomplete&&(i.isIncomplete=!0);return i}(e,n);break;case 9:0!=(1024&n)?(yt(e,r),Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAnnotationCall(),e),a={node:e,type:x.UnknownType.create()}):a=yt(e,r);break;case 52:a=function(e,t,n){if(0!=(64&n)&&0===e.expressions.length&&!t)return{type:lt([]),node:e,isEmptyTupleShorthand:!0};let i=t;if(t&&x.isUnion(t)){let n;k.doForEachSubtype(t,(t=>{if(!n){ni(e,(()=>ut(e,t)))&&(n=t)}})),i=n}if(i){const t=ut(e,i);if(t)return t}return function(e,t){const n=e.expressions.map((e=>ge(e,t?x.AnyType.create():void 0)));if(!Q||!x.isInstantiableClass(Q))return{type:x.UnknownType.create(),node:e};return{type:k.convertToInstance(k.specializeTupleClass(Q,ht(n))),node:e}}(e,!!t)}(e,r,n);break;case 11:a=function(e,t){let n;26===e.constType?n=0!=(64&t)?x.NoneType.createType():x.NoneType.createInstance():33!==e.constType&&15!==e.constType&&9!==e.constType||(n=Xn(e,"bool"),n&&x.isClassInstance(n)&&(33===e.constType?n=x.ClassType.cloneWithLiteral(n,!0):15===e.constType&&(n=x.ClassType.cloneWithLiteral(n,!1))));if(!n)return;return{type:n,node:e}}(e,n);break;case 48:if(0!=(8&n)&&!function(e){if(e.parent&&24===e.parent.nodeType){const t=ge(e.parent.baseExpression).type;if(t&&x.isInstantiableClass(t)&&x.ClassType.isSpecialBuiltIn(t,"Literal"))return!0}return!1}(e)){if(e.typeAnnotation)a=ge(e.typeAnnotation,void 0,68|n);else if(!e.typeAnnotation&&1===e.strings.length){const t=function(e){const t=ii(e),n=new y.Parser,i=e.strings[0].value,s=e.strings[0].start+e.strings[0].token.prefixLength+e.strings[0].token.quoteMarkLength,r=new y.ParseOptions;r.isStubFile=t.isStubFile,r.pythonVersion=t.executionEnvironment.pythonVersion;const a=n.parseTextExpression(t.fileContents,s,i.length,r);if(a.parseTree)return a.diagnostics.forEach((t=>{Ue(t.message,e)})),a.parseTree.parent=e,a.parseTree;return}(e);t&&(a=ge(t,void 0,68|n))}if(!a){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.expectedTypeNotString(),e),a={node:e,type:x.UnknownType.create()}}p=!1}else{e.strings.forEach((e=>{27===e.nodeType&&e.expressions.forEach((e=>{ge(e)}))}));const t=0!=(32&e.strings[0].token.flags);a=e.strings.some((e=>27===e.nodeType))?{node:e,type:Xn(e,t?"bytes":"str")}:{node:e,type:$t(e,t?"bytes":"str",e.strings.map((e=>e.value)).join(""))}}break;case 40:a=e.isImaginary?{node:e,type:Xn(e,"complex")}:e.isInteger?{node:e,type:$t(e,"int",e.value)}:{node:e,type:Xn(e,"float")};break;case 18:if(0!=(1&n))a={type:x.AnyType.create(!0),node:e};else if(0!=(256&n))a={type:x.UnknownType.create(),node:e};else{a={type:Xn(e,"ellipsis")||x.AnyType.create(),node:e}}break;case 55:a=function(e,t){let n=Ge(ge(e.expression).type);const i={0:"__pos__",33:"__neg__",5:"__invert__"};let s;38!==e.operator&&k.isOptionalType(n)&&(Be(ii(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,h.Localizer.Diagnostic.noneOperator().format({operator:v.printOperator(e.operator)}),e.expression),n=x.removeNoneFromUnion(n));if(38===e.operator)s=Xn(e,"bool"),s||(s=x.UnknownType.create());else{if(x.isAnyOrUnknown(n))s=n;else{s=Mt(n,[],i[e.operator],e,t)}if(!s){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSupportUnaryOperator().format({operator:v.printOperator(e.operator),type:Oi(n)}),e),s=x.UnknownType.create()}}if((0===e.operator||33===e.operator)&&x.isClassInstance(s)&&x.ClassType.isBuiltIn(s,"int")&&x.isClassInstance(n)&&x.ClassType.isBuiltIn(n,"int")&&"number"==typeof n.literalValue){const t=0===e.operator?n.literalValue:-n.literalValue;s=x.ClassType.cloneWithLiteral(s,t)}return{type:s,node:e}}(e,r);break;case 7:a=Et(e,r,n);break;case 5:a=Nt(e,r),Ke(e.destExpression,a.type,!!a.isIncomplete,e.rightExpression);break;case 31:case 45:a=function(e,t){let n=t;if(t&&x.isUnion(t)){let i;k.doForEachSubtype(t,(t=>{if(!i){ni(e,(()=>Vt(e,t)))&&(i=t)}})),n=i}if(n){const t=Vt(e,n);if(t)return t}return function(e,t){const n=31===e.nodeType?"list":"set";let i,s=!1;t&&(x.isAny(t)?i=t:x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"object")&&(i=x.AnyType.create()));let r=[];e.entries.forEach(((e,t)=>{let n;n=32===e.nodeType?Wt(e,i):ge(e,i).type,tk.stripLiteralValue(e)));let a=t?x.AnyType.create():x.UnknownType.create();if(r.length>0){const i=ii(e);a="list"===n&&i.diagnosticRuleSet.strictListInference||"set"===n&&i.diagnosticRuleSet.strictSetInference||t?x.combineTypes(r,64):k.areTypesSame(r,!0)?r[0]:a}else s=!0;const o=Jn(e,n);return{type:x.isInstantiableClass(o)?x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(o,[a],!0,void 0,void 0,s)):x.UnknownType.create(),node:e}}(e,t)}(e,r);break;case 46:a=function(e){e.startValue&&ge(e.startValue);e.endValue&&ge(e.endValue);e.stepValue&&ge(e.stepValue);return{type:Xn(e,"slice"),node:e}}(e);break;case 6:a=ge(e.expression,void 0,n),a={type:Ae(a.type,e.expression),node:e};break;case 51:a=function(e,t,n){ge(e.testExpression);const i=ge(e.ifExpression,n,t),s=ge(e.elseExpression,n,t);return{type:x.combineTypes([i.type,s.type]),node:e}}(e,n,r);break;case 32:a=function(e,t){const n=Wt(e);let i=e.comprehensions.some((e=>33===e.nodeType&&e.isAsync)),s=x.UnknownType.create();!i&&t&&x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"AsyncGenerator")&&(i=!0);const r=we(e,i?"AsyncGenerator":"Generator");r&&x.isInstantiableClass(r)&&(s=x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(r,i?[n,x.NoneType.createInstance()]:[n,x.NoneType.createInstance(),x.NoneType.createInstance()],!0)));return{type:s,node:e}}(e,r);break;case 15:a=function(e,t){let n=t;if(t&&x.isUnion(t)){let i;k.doForEachSubtype(t,(t=>{if(!i){ni(e,(()=>Ot(e,t,new l.DiagnosticAddendum)))&&(i=t)}})),n=i}let i;if(n){i=new l.DiagnosticAddendum;const t=Ot(e,n,i);if(t)return t}return{...Lt(e,t),expectedTypeDiagAddendum:i}}(e,r);break;case 30:a=function(e,t){const n=x.FunctionType.createInstance("","","",0);let i;if(ae(e,n,!1),t)if(x.isFunction(t))i=t;else if(x.isUnion(t))i=x.findSubtype(t,(e=>x.isFunction(e)));else if(x.isClassInstance(t)){const e=k.lookUpObjectMember(t,"__call__");if(e){const n=gi(e);if(n&&x.isFunction(n)){const e=Ni(t,n);e&&(i=e)}}}e.parameters.forEach(((t,s)=>{let r=x.UnknownType.create();i&&s{n.inferredReturnType=ge(e.expression,s).type}),!1):n.inferredReturnType=ge(e.expression,s).type;return{type:n,node:e}}(e,r);break;case 3:a=ge(e.rightExpression),Ke(e.leftExpression,a.type,!1,e.rightExpression,!0);break;case 4:a=ge(e.rightExpression),Ke(e.name,a.type,!1,e.rightExpression,!0);break;case 60:a=function(e){let t;const n=v.getEnclosingFunction(e);if(n){const e=an(n);e&&(t=k.getDeclaredGeneratorSendType(e.functionType))}e.expression&&ge(e.expression).type;return{type:t||x.UnknownType.create(),node:e}}(e);break;case 61:a=function(e){const t=ge(e.expression).type;let n,i=k.getGeneratorTypeArgs(t);if(i)n=i.length>=2?i[2]:x.UnknownType.create();else{const s=ke(t,!1,e)||x.UnknownType.create();i=k.getGeneratorTypeArgs(s),n=i&&i.length>=2?i[2]:x.UnknownType.create()}return{type:n||x.UnknownType.create(),node:e}}(e);break;case 56:{let t;if(r){const n=Jn(e,"Iterable");n&&x.isInstantiableClass(n)&&(t=x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(n,[r],!0)))}const i=ge(e.expression,t,n).type;if(0==(128&n)&&x.isVariadicTypeVar(i)&&!i.isVariadicUnpacked)a={type:x.TypeVarType.cloneForUnpacked(i),node:e};else{a={type:xe(i,!1,e)||x.UnknownType.create(),unpackedType:i,node:e}}break}case 54:a=ge(e.typeAnnotation,void 0,34024);break;case 0:ti(e,(()=>{e.child&&ge(e.child)})),a={type:x.UnknownType.create(),node:e}}if(a||o.fail(`Unhandled expression type '${v.printExpression(e)}'`),p&&!a.isIncomplete&&(128&n&&x.isTypeVar(a.type)&&a.type.details.isVariadic&&!a.type.isVariadicInUnion&&(Ue(h.Localizer.Diagnostic.typeVarTupleContext(),e),a.type=x.UnknownType.create()),!x.TypeBase.isInstantiable(a.type))){x.isClassInstance(a.type)&&x.ClassType.isTupleClass(a.type)&&0===(null===(i=a.type.tupleTypeArguments)||void 0===i?void 0:i.length)||We(a.type,e)}return 65536&n&&k.isTypeAliasPlaceholder(a.type)&&(a.type.details.illegalRecursionDetected=!0),k.isTypeAliasPlaceholder(a.type)||ae(e,a.type,!!a.isIncomplete,t,!0),a}function Te(e){return void 0!==e.futureImports.get("annotations")||e.executionEnvironment.pythonVersion>=d.PythonVersion.V3_11||e.isStubFile}function _e(e,t){var n,i,s;const r=ii(e);if(r.isTypingStubFile||r.isTypingExtensionsStubFile){const t=function(e){if(!e.parent||54!==e.parent.nodeType)return;if(38!==e.parent.valueExpression.nodeType)return;const t=e.parent.valueExpression.value,n=new Map([["Tuple",{alias:"tuple",module:"builtins"}],["Generic",{alias:"",module:"builtins"}],["Protocol",{alias:"",module:"builtins"}],["Callable",{alias:"",module:"builtins"}],["Type",{alias:"type",module:"builtins"}],["ClassVar",{alias:"",module:"builtins"}],["Final",{alias:"",module:"builtins"}],["Literal",{alias:"",module:"builtins"}],["TypedDict",{alias:"_TypedDict",module:"self"}],["Union",{alias:"",module:"builtins"}],["Optional",{alias:"",module:"builtins"}],["Annotated",{alias:"",module:"builtins"}],["TypeAlias",{alias:"",module:"builtins"}],["Concatenate",{alias:"",module:"builtins"}],["TypeGuard",{alias:"",module:"builtins"}],["Unpack",{alias:"",module:"builtins"}],["Required",{alias:"",module:"builtins"}],["NotRequired",{alias:"",module:"builtins"}]]).get(t);if(n){const i=re(e);if(i)return o.assert(x.isInstantiableClass(i)),i;const s=Yt(e,t,n);return ae(e,s,!1),s}return}(e);if(t)return t}let a=1129;(null==t?void 0:t.isVariableAnnotation)&&(a|=32768),(null==t?void 0:t.allowFinal)||(a|=16),(null==t?void 0:t.allowClassVar)||(a|=131072),(null==t?void 0:t.allowTypeVarTuple)||(a|=128),(null==t?void 0:t.associateTypeVarsWithScope)?a|=8192:a|=4096,(null==t?void 0:t.disallowRecursiveTypeAlias)&&(a|=65536),Te(r)&&(a|=4),3===(null===(n=null==e?void 0:e.parent)||void 0===n?void 0:n.nodeType)&&e.parent.typeAnnotationComment===e?a|=4:62===(null===(i=null==e?void 0:e.parent)||void 0===i?void 0:i.nodeType)?(e.parent.returnTypeAnnotation===e||e.parent.paramTypeAnnotations.some((t=>t===e)))&&(a|=4):41===(null===(s=null==e?void 0:e.parent)||void 0===s?void 0:s.nodeType)&&e.parent.typeAnnotationComment===e&&(a|=4);const l=ge(e,void 0,a).type;return k.convertToInstance(l)}function ve(e,t){const n=ge(e.expression,void 0,9===e.expression.nodeType?0:2);if(x.isInstantiableClass(n.type)&&x.ClassType.isBuiltIn(n.type,"classmethod")&&k.isProperty(t))return t;const i=[{argumentCategory:0,type:t}],s=It(e.expression,i,n.type,void 0,!0).returnType||x.UnknownType.create();return!x.isFunction(s)||s.details.declaredReturnType||s.details.parameters.some(((e,t)=>!(e.name&&!e.hasDeclaredType)||0===e.category&&(0!==t||!e.isTypeInferred)))?k.isPartlyUnknown(s)&&x.isFunction(n.type)&&!n.type.details.parameters.find((e=>void 0!==e.typeAnnotation))&&void 0===n.type.details.declaredReturnType?t:s:t}function be(e,t,n,i={method:"get"},s=new l.DiagnosticAddendum,r=0,a){const o=it(e,x.ClassType.cloneAsInstantiable(t),n,i,s,8|r,a);if(o)return{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete}}function Ie(e,t,n,i={method:"get"},s=new l.DiagnosticAddendum,r=0,a){let o;if(x.ClassType.isPartiallyConstructed(t))return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.classDefinitionCycle().format({name:t.details.name}),e),{node:e,type:x.UnknownType.create()};if(0==(32&r)&&(o=it(e,t,n,i,s,1|r,a)),!o){const s=t.details.effectiveMetaclass;s&&x.isInstantiableClass(s)&&!x.ClassType.isSameGenericClass(s,t)&&(o=it(e,s,n,i,new l.DiagnosticAddendum,r,t))}return o?{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete}:void 0}function Ce(e,t,n=!1){const i=k.lookUpClassMember(e,t,12);if(i){const t=gi(i);if(x.isFunction(t)||x.isOverloadedFunction(t)){const i=Ni(x.ClassType.cloneAsInstance(e),t,void 0,void 0,void 0,n);if(i)return i}}}function Se(e,t){if(t>=e.parameters.length)return;const n=e.parameters[t];if(n.typeAnnotation)return n.typeAnnotation;if(n.typeAnnotationComment)return n.typeAnnotationComment;if(!e.functionAnnotationComment||e.functionAnnotationComment.isParamListEllipsis)return;let i=0;const s=e.functionAnnotationComment.paramTypeAnnotations;s.length=s.length?void 0:s[r]}function De(e){if(54===e.nodeType&&38===e.valueExpression.nodeType){const t=ei(e,e.valueExpression.value,!1);if(t){return void 0!==t.symbol.getDeclarations().find((e=>_.isExplicitTypeAliasDeclaration(e)))}}return!1}function Fe(e){let t,n,i;switch(e.nodeType){case 38:{const n=ei(e,e.value,!0);if(n&&(t=n.symbol,void 0===di(t)&&2===n.scope.type)){const n=v.getEnclosingClassOrFunction(e);if(n&&10===n.nodeType){const i=Jt(n);if(i){const n=k.lookUpClassMember(i.classType,e.value,24);n&&(t=n.symbol)}}}break}case 54:return Fe(e.valueExpression);case 35:{const s=Ge(ge(e.leftExpression).type);let r;x.isClassInstance(s)?(r=k.lookUpObjectMember(s,e.memberName.value,16),n=s,i=null==r?void 0:r.classType):x.isInstantiableClass(s)&&(r=k.lookUpClassMember(s,e.memberName.value,24),n=s,i=null==r?void 0:r.classType),r&&(t=r.symbol);break}case 24:{const t=Fe(e.baseExpression);if(t&&x.isClassInstance(t)){const n=k.lookUpClassMember(t,"__setitem__");if(n){const i=gi(n);if(x.isFunction(i)){const s=Ni(t,i,x.isInstantiableClass(n.classType)?n.classType:void 0,e,void 0,!1);if(s&&x.isFunction(s)&&2===s.details.parameters.length){const e=x.FunctionType.getEffectiveParameterType(s,1);if(!x.isAnyOrUnknown(e))return e}}}}break}}if(t){let s=di(t);if(s){if(k.isProperty(s)){const e=k.lookUpClassMember(s,"fset"),t=e?gi(e):void 0;if(!t||!x.isFunction(t)||t.details.parameters.length<2)return;s=t.details.parameters[1].type}return n&&(i&&x.isInstantiableClass(i)&&(s=k.partiallySpecializeType(s,i)),(x.isFunction(s)||x.isOverloadedFunction(s))&&(s=Ni(n,s,void 0,e))),s}}}function Ae(e,t){return k.mapSubtypes(e,(e=>{if(x.isAnyOrUnknown(e))return e;const n=Qe(e);if(n)return n;if(x.isClassInstance(e)){const n=Ze(e,"__await__",t);if(n){if(x.isAnyOrUnknown(n))return n;if(x.isClassInstance(n)){if(Ze(n,"__iter__",t)){const e=Qe(n);if(e)return e}}}}if(t){Be(ii(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotAwaitable().format({type:Oi(e)}),t)}return x.UnknownType.create()}))}function xe(e,t,n){const i=t?"__aiter__":"__iter__",s=t?"__anext__":"__next__";let r=!0;e=Ge(e),k.isOptionalType(e)&&(n&&Be(ii(n).diagnosticRuleSet.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,h.Localizer.Diagnostic.noneNotIterable(),n),e=x.removeNoneFromUnion(e));const a=k.mapSubtypes(e,(e=>{if(e=Ge(e),x.isAnyOrUnknown(e))return e;const a=new l.DiagnosticAddendum;if(x.isClass(e)){let r;if(x.TypeBase.isInstance(e)?r=Ze(e,i,n):x.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&x.isInstantiableClass(e.details.effectiveMetaclass)&&(r=Ze(x.ClassType.cloneAsInstance(e.details.effectiveMetaclass),i,n,e)),r){const e=Ge(r);if(x.isAnyOrUnknown(e))return e;if(x.isClassInstance(e)){const i=Ze(e,s,n);if(i)return t?Ae(i,n):i;a.addMessage(h.Localizer.Diagnostic.methodNotDefinedOnType().format({name:s,type:Oi(r)}))}else a.addMessage(h.Localizer.Diagnostic.methodReturnsNonObject().format({name:i}))}else{if(x.isClassInstance(e)){const t=Ze(e,"__getitem__",n);if(t)return t}a.addMessage(h.Localizer.Diagnostic.methodNotDefined().format({name:i}))}}n&&Be(ii(n).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotIterable().format({type:Oi(e)})+a.getString(),n),r=!1}));return r?a:void 0}function ke(e,t,n){const i=t?"__aiter__":"__iter__";let s=!0;e=Ge(e),k.isOptionalType(e)&&(n&&Be(ii(n).diagnosticRuleSet.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,h.Localizer.Diagnostic.noneNotIterable(),n),e=x.removeNoneFromUnion(e));const r=k.mapSubtypes(e,(e=>{if(x.isAnyOrUnknown(e))return e;if(x.isClass(e)){let t;if(x.TypeBase.isInstance(e)?t=Ze(e,i,n):x.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&x.isInstantiableClass(e.details.effectiveMetaclass)&&(t=Ze(x.ClassType.cloneAsInstance(e.details.effectiveMetaclass),i,n,e)),t)return Ge(t)}n&&Be(ii(n).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotIterable().format({type:Oi(e)}),n),s=!1}));return s?r:void 0}function Pe(e,t,n){o.assert(x.ClassType.isDataClass(t));const i=x.FunctionType.createInstance("__new__","","",65),s=x.FunctionType.createInstance("__init__","","",64);x.FunctionType.addParameter(i,{category:0,name:"cls",type:t,hasDeclaredType:!0}),x.FunctionType.addDefaultParameters(i),i.details.declaredReturnType=x.ClassType.cloneAsInstance(t);const r={category:0,name:"self",type:x.ClassType.cloneAsInstance(t),hasDeclaredType:!0};x.FunctionType.addParameter(s,r),s.details.declaredReturnType=x.NoneType.createInstance();const a=[],l=[],c=function(e,t){let n=!0;for(let i=e.details.mro.length-1;i>=0;i--){const s=e.details.mro[i];if(x.isInstantiableClass(s)){const e=k.buildTypeVarMapFromSpecializedClass(s,!1);x.ClassType.getDataClassEntries(s).forEach((n=>{const i=t.findIndex((e=>e.name===n.name)),s={...n};s.type=k.applySolvedTypeVars(s.type,e),n.isClassVar?i>=0&&t.splice(i,1):i>=0?t[i]=s:t.push(s)}))}else n=!1}return n}(t,l);c||x.FunctionType.addDefaultParameters(s);const p=[];e.suite.statements.forEach((i=>{47===i.nodeType&&i.statements.forEach((i=>{var s;let r,o,c,d,u=!1,m=!0;if(3===i.nodeType){if(54===i.leftExpression.nodeType&&38===i.leftExpression.valueExpression.nodeType&&(r=i.leftExpression.valueExpression,c=()=>_e(i.leftExpression.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0})),u=!0,d=i.rightExpression,9===i.rightExpression.nodeType){if(function(e,t){let n;x.isFunction(e)?n=e.details.fullName:x.isOverloadedFunction(e)?n=e.overloads[0].details.fullName:x.isInstantiableClass(e)&&(n=e.details.fullName);if(!n)return!1;return t.some((e=>e===n))}(ge(i.rightExpression.leftExpression).type,(null===(s=t.details.dataClassBehaviors)||void 0===s?void 0:s.fieldDescriptorNames)||[])){const t=i.rightExpression.arguments.find((e=>{var t;return"init"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(t&&t.valueExpression){!1===I.evaluateStaticBoolExpression(t.valueExpression,ii(e).executionEnvironment)&&(m=!1)}u=i.rightExpression.arguments.some((e=>{var t,n,i;return"default"===(null===(t=e.name)||void 0===t?void 0:t.value)||"default_factory"===(null===(n=e.name)||void 0===n?void 0:n.value)||"factory"===(null===(i=e.name)||void 0===i?void 0:i.value)}));const n=i.rightExpression.arguments.find((e=>{var t;return"alias"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(n){const e=ge(n.valueExpression).type;x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"str")&&k.isLiteralType(e)&&(o=e.literalValue)}}}}else 54===i.nodeType&&38===i.valueExpression.nodeType&&(r=i.valueExpression,c=()=>_e(i.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0}));if(r&&c){const e=r.value,i=t.details.fields.get(e),s=null==i?void 0:i.getDeclarations().some((e=>1===e.type&&e.isFinal));if((null==i?void 0:i.isClassVar())&&!s){const t=l.findIndex((t=>t.name===e));t>=0&&l.splice(t,1);const n={name:e,alias:o,hasDefault:u,defaultValueExpression:d,includeInInit:m,type:x.UnknownType.create(),isClassVar:!0};a.push(n)}else{const i={name:e,alias:o,hasDefault:u,defaultValueExpression:d,includeInInit:m,type:x.UnknownType.create(),isClassVar:!1};p.push({entry:i,evaluator:c});let s=a.findIndex((t=>t.name===e));if(s>=0?a[s]=i:a.push(i),s=l.findIndex((t=>t.name===e)),s>=0?l[s]=i:(l.push(i),s=l.length-1),!x.ClassType.isDataClassKeywordOnlyParams(t)&&m&&!n&&!u){const e=l.findIndex((e=>e.hasDefault&&e.includeInInit));e>=0&&e{e.entry.type=e.evaluator()}));const d=t.details.fields;!n&&c&&(x.ClassType.isDataClassKeywordOnlyParams(t)&&x.FunctionType.addParameter(s,{category:1,type:x.AnyType.create()}),l.forEach((e=>{if(e.includeInInit){const t={category:0,name:e.alias||e.name,hasDefault:e.hasDefault,defaultValueExpression:e.defaultValueExpression,type:e.type,hasDeclaredType:!0};x.FunctionType.addParameter(s,t)}})),d.set("__init__",C.Symbol.createWithType(4,s)),d.set("__new__",C.Symbol.createWithType(4,i)));const u=Jn(e,"str");if(Q&&x.isInstantiableClass(Q)&&u&&x.isInstantiableClass(u)&&!d.has("__match_args__")){const e=[];l.forEach((t=>{t.includeInInit&&e.push(t.name)}));const t=e.map((e=>x.ClassType.cloneAsInstance(x.ClassType.cloneWithLiteral(u,e)))),n=x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,t));d.set("__match_args__",C.Symbol.createWithType(4,n))}const m=(t,n)=>{const i=x.FunctionType.createInstance(t,"","",64);x.FunctionType.addParameter(i,r),x.FunctionType.addParameter(i,{category:0,name:"x",type:n,hasDeclaredType:!0}),i.details.declaredReturnType=Xn(e,"bool"),d.set(t,C.Symbol.createWithType(4,i))};if(x.ClassType.isSkipSynthesizedDataClassEq(t)||m("__eq__",Xn(e,"object")),x.ClassType.isSynthesizedDataclassOrder(t)){const e=x.ClassType.cloneAsInstance(t);["__lt__","__le__","__gt__","__ge__"].forEach((t=>{m(t,e)}))}let y=Jn(e,"dict");x.isInstantiableClass(y)&&(y=x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(y,[Xn(e,"str"),x.AnyType.create()],!0))),d.set("__dataclass_fields__",C.Symbol.createWithType(4,y)),mt(t,l.map((e=>e.type)),!0)}function Ee(e,t){o.assert(x.ClassType.isTypedDictClass(t));const n=x.FunctionType.createInstance("__new__","","",65);x.FunctionType.addParameter(n,{category:0,name:"cls",type:t,hasDeclaredType:!0}),x.FunctionType.addDefaultParameters(n),n.details.declaredReturnType=x.ClassType.cloneAsInstance(t);const i=x.FunctionType.createInstance("__init__","","",64);x.FunctionType.addParameter(i,{category:0,name:"self",type:x.ClassType.cloneAsInstance(t),hasDeclaredType:!0}),i.details.declaredReturnType=x.NoneType.createInstance(),x.FunctionType.addParameter(i,{category:1,type:x.AnyType.create(),hasDeclaredType:!0});const s=Ei(t);s.forEach(((e,t)=>{x.FunctionType.addParameter(i,{category:0,name:t,hasDefault:!e.isRequired,type:e.valueType,hasDeclaredType:!0})}));const r=t.details.fields;r.set("__init__",C.Symbol.createWithType(4,i)),r.set("__new__",C.Symbol.createWithType(4,n));const a=Jn(e,"str");if(x.isInstantiableClass(a)){const n={category:0,name:"self",type:x.ClassType.cloneAsInstance(t),hasDeclaredType:!0},i=et(e);let o=x.TypeVarType.createInstance(`__${t.details.name}_default`);o.details.isSynthesized=!0,o=x.TypeVarType.cloneForScopeId(o,i,t.details.name);const l=(e,t,i)=>{const s=x.FunctionType.createInstance("get","","",320);return x.FunctionType.addParameter(s,n),x.FunctionType.addParameter(s,{category:0,name:"k",type:e,hasDeclaredType:!0}),i?(x.FunctionType.addParameter(s,{category:0,name:"default",type:t,hasDeclaredType:!0,hasDefault:!0}),s.details.declaredReturnType=t):s.details.declaredReturnType=x.combineTypes([t,x.NoneType.createInstance()]),s},c=(e,t)=>{const s={category:0,name:"k",type:e,hasDeclaredType:!0},r=x.FunctionType.createInstance("pop","","",320);x.FunctionType.addParameter(r,n),x.FunctionType.addParameter(r,s),r.details.declaredReturnType=t;const a=x.FunctionType.createInstance("pop","","",320);return x.FunctionType.addParameter(a,n),x.FunctionType.addParameter(a,s),x.FunctionType.addParameter(a,{category:0,name:"default",hasDeclaredType:!0,type:o,hasDefault:!0}),a.details.declaredReturnType=x.combineTypes([t,o]),a.details.typeVarScopeId=i,[r,a]},p=(e,t,s=!1)=>{const r=x.FunctionType.createInstance("setdefault","","",320);return x.FunctionType.addParameter(r,n),x.FunctionType.addParameter(r,{category:0,name:"k",hasDeclaredType:!0,type:e}),x.FunctionType.addParameter(r,{category:0,name:"default",hasDeclaredType:!0,type:s?x.AnyType.create():o,hasDefault:!0}),r.details.declaredReturnType=s?t:x.combineTypes([t,o]),r.details.typeVarScopeId=i,r},d=e=>{const t=x.FunctionType.createInstance("delitem","","",320);return x.FunctionType.addParameter(t,n),x.FunctionType.addParameter(t,{category:0,name:"k",hasDeclaredType:!0,type:e}),t.details.declaredReturnType=x.NoneType.createInstance(),t},u=[],h=[],m=[];s.forEach(((e,t)=>{const n=x.ClassType.cloneAsInstance(x.ClassType.cloneWithLiteral(a,t));e.isRequired||u.push(l(n,e.valueType,!1)),u.push(l(n,e.valueType,!0)),h.push(...c(n,e.valueType)),m.push(p(n,e.valueType,e.isRequired))}));const y=x.ClassType.cloneAsInstance(a);u.push(l(y,x.AnyType.create(),!1)),u.push(l(y,x.AnyType.create(),!0)),h.push(...c(y,x.AnyType.create())),m.push(p(y,x.AnyType.create())),r.set("get",C.Symbol.createWithType(4,x.OverloadedFunctionType.create(u))),r.set("pop",C.Symbol.createWithType(4,x.OverloadedFunctionType.create(h))),r.set("setdefault",C.Symbol.createWithType(4,x.OverloadedFunctionType.create(m))),r.set("__delitem__",C.Symbol.createWithType(4,d(y)))}}function we(e,t){return Ne(t,ii(e).typingModulePath)}function Ne(t,n){if(!n)return;const i=e(n);if(!i)return;const s=i.symbolTable.get(t);return s?li(s):void 0}function Re(e){const t=f.getFlowNode(e);return!!t&&!!jn(t)}function Me(e){const t=f.getAfterFlowNode(e);return!!t&&(!!jn(t)&&!!function(e,t){const n=Vn(e.id);return void 0!==Bn(n,t,void 0,void 0,x.UnboundType.create(),!1).type}(e,t))}function Oe(e,t){const n=f.getFlowNode(e),i=f.getFlowNode(t);return!(!n||!i)&&(n===i||jn(i,n))}function Le(e,t,n){return Ve("information",e,t,n)}function Ue(e,t,n){return Ve("error",e,t,n)}function Ve(e,t,n,i){if(!ze(n)){return ii(n).diagnosticSink.addDiagnosticWithTextRange(e,t,i||n)}}function ze(e){return $.some((t=>v.isNodeContainedWithin(e,t)))||W.isSpeculative(e)||G.isUndoTrackingEnabled()}function Be(e,t,n,i){if("none"===e)return;const s=Ve(e,n,i);return s&&s.setRule(t),s}function We(e,t){const n=ii(t),i=new l.DiagnosticAddendum;x.isUnion(e)&&k.doForEachSubtype(e,(e=>{x.TypeBase.isInstantiable(e)||i.addMessage(h.Localizer.DiagnosticAddendum.typeNotClass().format({type:Oi(e)}))})),Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeExpectedClass().format({type:Oi(e)})+i.getString(),t)}function je(e,t,n,i,s){const r=e.value,a=ei(e,r,!1);if(!a)return;const o=a.symbol.getDeclarations(),p=di(a.symbol),d=ii(e);let u=t;if(p&&i){let n=new l.DiagnosticAddendum;Di(p,t,n)?u=ki(p,t):(s&&(n=s),Be(d.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(p)})+n.getString(),i||e),u=p)}else{const t=b.getScopeForNode(e);if(2===(null==t?void 0:t.type)){const t=S.isConstantName(r),n=S.isPrivateOrProtectedName(r);!x.TypeBase.isInstance(u)||t||n&&"none"!==ii(e).diagnosticRuleSet.reportPrivateUsage||(u=k.stripLiteralValue(u))}}const m=o.find((e=>1===e.type));m&&1===m.type&&i&&m.isConstant&&e!==o[0].node&&Be(d.diagnosticRuleSet.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,h.Localizer.Diagnostic.constantRedefinition().format({name:r}),e),ae(e,u,n,void 0,!1)}function $e(e,t,n,i,s){const r=e.memberName.value,a=ii(e),l=v.getEnclosingClass(e);if(!l)return;const p=Jt(l);if(p&&x.isInstantiableClass(p.classType)){let l=k.lookUpClassMember(p.classType,r,i?0:8);const d=p.classType.details.fields;if(l){const n=x.isInstantiableClass(l.classType)?l.classType:void 0,u=n&&x.ClassType.isSameGenericClass(p.classType,n);if(u&&i&&(null==n?void 0:n.details.inheritedSlotsNames)&&(null==n?void 0:n.details.localSlotsNames)&&n.details.localSlotsNames.length>0&&!n.details.inheritedSlotsNames.some((e=>e===r))){const t=di(l.symbol);t&&k.isProperty(t)||Be(a.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.slotsAttributeError().format({name:r}),e.memberName)}if(u&&l.isInstanceMember===i){const t=d.get(r);o.assert(void 0!==t);const n=t.getDeclarations();let i=D.isFinalVariable(t);if(n.length>0&&1===n[0].type&&s&&e.memberName!==n[0].node){n[0].isConstant&&Be(a.diagnosticRuleSet.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,h.Localizer.Diagnostic.constantRedefinition().format({name:e.memberName.value}),e.memberName);const t=v.getEnclosingFunction(e);t&&"__init__"===t.name.value&&(i=!1),i&&Ue(h.Localizer.Diagnostic.finalReassigned().format({name:e.memberName.value}),e.memberName)}}else{const n=di(l.symbol);if(n&&!k.isProperty(n)&&!l.isInstanceMember&&i){Ye(a,l.symbol,e.memberName);const n=gi(l);t=x.combineTypes([t,n])}}}l=k.lookUpClassMember(p.classType,r,16),l||!s||n||Bt(a.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,t,e,!0)}}function Ge(e,t){return k.mapSubtypes(e,(e=>{if(x.isTypeVar(e)&&!e.details.recursiveTypeAliasName){if(e.details.boundType){const t=x.TypeBase.isInstantiable(e)?k.convertToInstantiable(e.details.boundType):k.convertToInstance(e.details.boundType);return e.details.isSynthesized?t:k.addConditionToType(t,[{typeVarName:x.TypeVarType.getNameWithScope(e),constraintIndex:0}])}if(e.details.recursiveTypeAliasName)return e;if(e.details.constraints.length>0){const n=[];return e.details.constraints.forEach(((i,s)=>{if(t){const n=x.TypeVarType.getNameWithScope(e),i=t.find((e=>e.typeVarName===n));if(i&&i.constraintIndex!==s)return}x.TypeBase.isInstantiable(e)&&(i=k.convertToInstantiable(i)),n.push(k.addConditionToType(i,[{typeVarName:x.TypeVarType.getNameWithScope(e),constraintIndex:s}]))})),x.combineTypes(n)}if(x.TypeBase.isInstantiable(e)){if(Y&&x.isInstantiableClass(Y))return e.details.isSynthesized?Y:k.addConditionToType(x.ClassType.cloneAsInstance(Y),[{typeVarName:x.TypeVarType.getNameWithScope(e),constraintIndex:0}])}else if(H)return e.details.isSynthesized?H:k.addConditionToType(H,[{typeVarName:x.TypeVarType.getNameWithScope(e),constraintIndex:0}]);return x.AnyType.create()}return e}))}function qe(e,t,n){const i=[];let s=!1;const r=e=>{const r=x.isUnion(e)?e:Ge(e);k.doForEachSubtype(r,(r=>{if(t&&!x.TypeCondition.isCompatible(k.getTypeCondition(r),t))return;const a=n(r,e);a!==e&&(s=!0),a&&i.push(k.addConditionToType(a,k.getTypeCondition(r)))}))};return x.isUnion(e)?e.subtypes.forEach((e=>{r(e)})):r(e),s?x.combineTypes(i):e}function Ke(e,t,n,i,s=!1,r){if(x.isTypeVar(t)&&i&&9===i.nodeType){const n=ge(i.leftExpression).type;x.isInstantiableClass(n)&&(x.ClassType.isBuiltIn(n,"TypeVar")||x.ClassType.isBuiltIn(n,"TypeVarTuple")||x.ClassType.isBuiltIn(n,"ParamSpec"))&&(38===e.nodeType&&e.value===t.details.name||Ue(t.details.isParamSpec?h.Localizer.Diagnostic.paramSpecAssignedName().format({name:x.TypeVarType.getReadableName(t)}):h.Localizer.Diagnostic.typeVarAssignedName().format({name:x.TypeVarType.getReadableName(t)}),e))}switch(t=x.removeUnbound(t),e.nodeType){case 38:n||Bt(ii(e).diagnosticRuleSet.reportUnknownVariableType,c.DiagnosticRule.reportUnknownVariableType,e,t,e,s),je(e,t,n,i,r);break;case 35:!function(e,t,n,i,s){const r=ge(e.leftExpression),a=Ge(r.type);if(38===e.leftExpression.nodeType){const s=v.getEnclosingClass(e);if(s){const r=Jt(s);if(r&&x.isInstantiableClass(r.classType)&&(x.isClassInstance(a)?x.ClassType.isSameGenericClass(a,r.classType)&&$e(e,t,n,!0,i):x.isInstantiableClass(a)&&x.ClassType.isSameGenericClass(a,r.classType)&&$e(e,t,n,!1,i),x.ClassType.isProtocolClass(r.classType))){const t=r.classType.details.fields.get(e.memberName.value);t&&0===t.getDeclarations().filter((e=>!v.getEnclosingFunction(e.node))).length&&Ue(h.Localizer.Diagnostic.assignmentInProtocol(),e.memberName)}}}nt(e,r,{method:"set",setType:t,setErrorNode:i,setExpectedTypeDiag:s},0),ae(e.memberName,t,n,void 0,!1),ae(e,t,n,void 0,!1)}(e,t,n,i,r);break;case 24:{const s=ge(e.baseExpression,void 0,2);ot(e,s.type,{method:"set",setType:t,setErrorNode:i,setExpectedTypeDiag:r},0),ae(e,t,n);break}case 52:!function(e,t,n,i){const s=new Array(e.expressions.length);for(let t=0;t56===e.nodeType));k.doForEachSubtype(t,(t=>{const n=k.getSpecializedTupleType(t);if(n&&n.tupleTypeArguments){const i=n.tupleTypeArguments,a=i.length;if(k.isOpenEndedTupleClass(n))for(let n=0;n0;)s[o].push(k.addConditionToType(i[n],k.getTypeCondition(t))),n++,c--}else{if(n>=a)break;s[o].push(k.addConditionToType(i[n],k.getTypeCondition(t))),n++}if(o=0?e.expressions.length-1:e.expressions.length;Be(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.tupleSizeMismatch().format({expected:n,received:a}),e)}}}else{const n=xe(t,!1,i)||x.UnknownType.create();for(let i=0;i{const a=s[t];let o=0===a.length?x.UnknownType.create():x.combineTypes(a);if(o=k.removeNoReturnFromUnion(o),t===r){const t=Jn(e,"list");x.isInstantiableClass(t)&&(o=x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(t,[o],!0)))}Ke(e,o,n,i,!0)})),ae(e,t,n)}(e,t,n,i);break;case 54:{const n=_e(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:v.isFinalAllowedForAssignmentTarget(e.valueExpression)});if(!x.isClassInstance(n)||!x.ClassType.isBuiltIn(n,"Final")){x.isClassInstance(n)&&x.ClassType.isBuiltIn(n,"TypeAlias")||Di(n,t,new l.DiagnosticAddendum)&&(x.isClassInstance(t)&&x.ClassType.isEnumClass(t)||(t=ki(n,t)))}Ke(e.valueExpression,t,!1,i,s,r);break}case 56:38===e.expression.nodeType&&je(e.expression,t,!1,i);break;case 31:{const n=xe(t,!1,i)||x.UnknownType.create();e.entries.forEach((e=>{Ke(e,n,!1,i,s)}));break}case 0:e.child&&ti(e.child,(()=>{ge(e.child)}));break;default:Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.assignmentTargetExpr(),e);break}}function He(e){switch(e.nodeType){case 38:ge(e,void 0,16384);break;case 35:{const t=ge(e.leftExpression),n=nt(e,t,{method:"del"},16384);ae(e.memberName,n.type,!1),ae(e,n.type,!1);break}case 24:{const t=ge(e.baseExpression,void 0,2);ot(e,t.type,{method:"del"},16384),ae(e,x.UnboundType.create(),!1);break}case 52:e.expressions.forEach((e=>{He(e)}));break;case 0:e.child&&ti(e.child,(()=>{ge(e.child,void 0,16384)}));break;default:Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.delTargetExpr(),e);break}}function Ye(e,t,n){W.isSpeculative(n)||G.isUndoTrackingEnabled()||e.accessedSymbolMap.set(t.id,!0)}function Qe(e){if(x.isAnyOrUnknown(e))return e;if(x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"Generator")){const t=e.typeArguments;if(t&&t.length>=3)return t[2]}}function Ze(e,t,n,i){const s=k.lookUpObjectMember(e,t,8);if(!s)return;const r=gi(s);if(x.isAnyOrUnknown(r))return r;if(x.isFunction(r)){const t=Ni(i||e,r,s&&x.isInstantiableClass(s.classType)?s.classType:void 0,n,void 0,!1,i);if(t)return ui(t)}}function Je(e,t,n){var i;if(x.TypeBase.isInstantiable(t)&&!k.isTypeAliasPlaceholder(t)){const s=function(e,t){var n;let i=e,s=0;o.assert(x.TypeBase.isInstantiable(t));for(;i&&(i=v.getTypeVarScopeNode(i,35===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)),i);){let e;if(10===i.nodeType){const t=Jt(i);t&&(e=t.classType.details.typeParameters),s++}else if(28===i.nodeType){const t=an(i);t&&(e=[],t.functionType.details.parameters.forEach((t=>{t.hasDeclaredType&&k.addTypeVarsToListIfUnique(e,k.getTypeVarArgumentsRecursive(t.type))})),t.functionType.details.declaredReturnType&&k.addTypeVarsToListIfUnique(e,k.getTypeVarArgumentsRecursive(t.functionType.details.declaredReturnType)))}else if(36===i.nodeType)break;if(e){const n=e.find((e=>e.details.name===t.details.name));if(n&&n.scopeId)return{type:s>1?t:k.convertToInstantiable(n),foundInterveningClass:s>1}}i=i.parent}i=e;for(;i;){if(3===i.nodeType){const e=re(i.leftExpression);if(e&&x.isTypeVar(e)&&e.details.recursiveTypeAliasScopeId&&e.details.recursiveTypeAliasName)return{type:x.TypeVarType.cloneForScopeId(t,e.details.recursiveTypeAliasScopeId,e.details.recursiveTypeAliasName),foundInterveningClass:!1}}i=i.parent}return{type:t,foundInterveningClass:!1}}(e,t);if(t=s.type,0!=(2048&n)&&void 0!==t.scopeId)t.details.isSynthesized||t.details.isParamSpec||Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else if(0!=(8192&n)){if(void 0===t.scopeId)if(s.foundInterveningClass)Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else{let n=v.getEnclosingClassOrFunction(e);if(n&&35===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)&&e.parent.leftExpression===e){const i=e.parent.memberName.value;if("args"===i||"kwargs"===i){const i=v.getEnclosingClassOrFunction(n);28===(null==i?void 0:i.nodeType)?n=i:s.type.scopeId||Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramSpecNotUsedByOuterScope().format({name:t.details.name}),e)}}n?t=x.TypeVarType.cloneForScopeId(t,et(n),n.name.value):o.fail("AssociateTypeVarsWithCurrentScope flag was set but enclosing scope not found")}}else if(0!=(4096&n)&&(void 0===t.scopeId||s.foundInterveningClass)&&!t.details.isSynthesized){const n=x.isParamSpec(t)?h.Localizer.Diagnostic.paramSpecNotUsedByOuterScope():h.Localizer.Diagnostic.typeVarNotUsedByOuterScope();Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,n.format({name:t.details.name}),e)}}return t.isVariadicUnpacked&&(t=x.TypeVarType.cloneForPacked(t)),t}function Xe(e,t,n){return 0==(2&n)&&(x.isInstantiableClass(t)&&(0!=(64&n)&&k.requiresTypeArguments(t)&&!t.typeArguments&&Be(ii(e).diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,h.Localizer.Diagnostic.typeArgsMissingForClass().format({name:t.aliasName||t.details.name}),e),t.typeArguments||(t=Hn(t,void 0,n,e))),0!=(64&n)&&t.typeAliasInfo&&t.typeAliasInfo.typeParameters&&t.typeAliasInfo.typeParameters.length>0&&!t.typeAliasInfo.typeArguments&&(Be(ii(e).diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,h.Localizer.Diagnostic.typeArgsMissingForAlias().format({name:t.typeAliasInfo.name}),e),t=x.TypeBase.cloneForTypeAlias(t,t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,t.typeAliasInfo.typeParameters.map((e=>x.UnknownType.create()))))),t}function et(e){return`${ii(e).filePath}.${e.start.toString()}`}function tt(e){const t=[];let n=e;for(;n&&(n=v.getTypeVarScopeNode(n),n);)t.push(et(n)),n=n.parent;return t}function nt(e,t,n,i){var s;const r=t.type,a=e.memberName.value;let o=new l.DiagnosticAddendum;const p=ii(e);let u,m=!1;if(t.isIncomplete&&x.isUnbound(t.type))return{type:x.UnknownType.create(),node:e,isIncomplete:!0};const y=()=>{if(K&&x.isInstantiableClass(K)){return be(e.memberName,K,a,n,o,void 0,t.bindToType)}};switch(r.category){case 2:case 1:u=r;break;case 4:u=x.UnknownType.create();break;case 10:if(r.details.isParamSpec){if("args"===a){const t=v.getEnclosingParameter(e);return t&&1===t.category?{type:r,node:e}:(Ue(h.Localizer.Diagnostic.paramSpecArgsUsage(),e),{type:x.UnknownType.create(),node:e})}if("kwargs"===a){const t=v.getEnclosingParameter(e);return t&&2===t.category?{type:r,node:e}:(Ue(h.Localizer.Diagnostic.paramSpecKwargsUsage(),e),{type:x.UnknownType.create(),node:e})}return Be(p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramSpecUnknownMember().format({name:a}),e),{type:x.UnknownType.create(),node:e}}return 64&i?(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarNoMember().format({type:Oi(r),name:a}),e.leftExpression),{type:x.UnknownType.create(),node:e}):r.details.recursiveTypeAliasName?{type:x.UnknownType.create(),node:e,isIncomplete:!0}:nt(e,{type:Ge(r),node:e,bindToType:r},n,0);case 7:if(x.TypeBase.isInstantiable(r)){const i=Ie(e.memberName,r,a,n,o,0,t.bindToType);u=null==i?void 0:i.type,(null==i?void 0:i.isIncomplete)&&(m=!0)}else{if(x.ClassType.isEnumClass(r)){const t=r.literalValue;if(t instanceof x.EnumLiteral)if("name"===a||"_name_"===a){const n=Jn(e,"str");if(x.isInstantiableClass(n))return{node:e,type:x.ClassType.cloneAsInstance(x.ClassType.cloneWithLiteral(n,t.itemName))}}else if("value"===a||"_value_"===a)return{node:e,type:t.itemType}}const i=be(e.memberName,r,a,n,o,void 0,t.bindToType);i&&(u=k.addConditionToType(i.type,k.getTypeCondition(r))),(null==i?void 0:i.isIncomplete)&&(m=!0)}break;case 8:{const t=x.ModuleType.getField(r,a);if(t)"get"===n.method&&Ye(ii(e),t,e.memberName),u=ci(t,void 0,!0).type,x.isTypeVar(u)&&(u=Je(e,u,i)),x.isUnbound(u)&&(u=x.UnknownType.create());else{if("get"===n.method){const e=x.ModuleType.getField(r,"__getattr__");if(e){if(p.executionEnvironment.pythonVersion>=d.PythonVersion.V3_7||e.getDeclarations().some((e=>e.path.toLowerCase().endsWith(".pyi")))){const t=ci(e);x.isFunction(t.type)&&(u=ui(t.type),t.isIncomplete&&(m=!0))}}}u||(Be(p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.moduleUnknownMember().format({name:a}),e.memberName),u=x.UnknownType.create())}break}case 9:u=k.mapSubtypes(r,(t=>{if(x.isNone(t)){const t=y();return t?(u=k.addConditionToType(t.type,k.getTypeCondition(r)),t.isIncomplete&&(m=!0),u):void Be(ii(e).diagnosticRuleSet.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalMemberAccess,h.Localizer.Diagnostic.noneUnknownMember().format({name:a}),e.memberName)}if(!x.isUnbound(t)){const i=nt(e,{type:t,node:e},n,0);return i.isIncomplete&&(m=!0),i.type}}));break;case 5:case 6:{const t=Xn(e,"function");u=t&&"__defaults__"!==a?nt(e,{type:t,node:e},n,i).type:x.AnyType.create();break}case 3:{const e=y();e&&(u=k.addConditionToType(e.type,k.getTypeCondition(r)),e.isIncomplete&&(m=!0));break}default:o.addMessage(h.Localizer.DiagnosticAddendum.typeUnsupported().format({type:Oi(r)}))}if(!u){let t=h.Localizer.Diagnostic.memberAccess();"set"===n.method?t=h.Localizer.Diagnostic.memberSet():"del"===n.method&&(t=h.Localizer.Diagnostic.memberDelete()),n.setExpectedTypeDiag&&(o=n.setExpectedTypeDiag);const i=x.isFunction(r)||x.isOverloadedFunction(r)||x.isClassInstance(r)&&x.ClassType.isBuiltIn(r,"function"),[s,l]=i?[p.diagnosticRuleSet.reportFunctionMemberAccess,c.DiagnosticRule.reportFunctionMemberAccess]:[p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues];Be(s,l,t.format({name:a,type:Oi(r)})+o.getString(),e.memberName),u=i?x.AnyType.create():x.UnknownType.create()}return 0==(2&i)&&x.isInstantiableClass(u)&&!u.typeArguments&&(u=Hn(u,void 0,i,e)),"get"===n.method&&(1===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)&&x.isInstantiableClass(u)||m||Bt(p.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,u,e,!1)),{type:u,node:e,isIncomplete:m}}function it(e,t,n,i,s,r,a){var c;let p=0;1&r&&(p|=8),2&r&&(p|=2),4&r&&(p|=4),128&r&&(p|=1);let d=k.lookUpClassMember(t,n,16|p);if(d||(d=k.lookUpClassMember(t,n,p)),d&&d.symbol.isExclusiveClassMember()&&0!=(8&r)&&(d=void 0),d){let o,l=!1;if("get"===i.method){const t=fi(e,d);t?(o=t.type,t.isIncomplete&&(l=!0)):o=x.UnknownType.create()}else{const n=v.getEnclosingClass(e);if(n){const e=null===(c=Jt(n))||void 0===c?void 0:c.classType;e&&x.isInstantiableClass(e)&&x.ClassType.isSameGenericClass(e,t)&&(o=di(d.symbol)||x.UnknownType.create(),o&&x.isInstantiableClass(d.classType)&&(o=k.partiallySpecializeType(o,d.classType)))}if(!o){const t=fi(e,d);t?(o=t.type,t.isIncomplete&&(l=!0)):o=x.UnknownType.create()}}if(x.ClassType.isTypedDictClass(t)){const e=d.symbol.getTypedDeclarations();if(e.length>0&&1===e[0].type)return void s.addMessage(h.Localizer.DiagnosticAddendum.memberUnknown().format({name:n}))}"get"===i.method&&x.isInstantiableClass(d.classType)&&x.ClassType.isSameGenericClass(d.classType,t)&&Ye(ii(e),d.symbol,e);const p=st(o,d,t,a,0==(1&r),r,e,n,i,s);if(!p)return;if(o=p,"set"===i.method){if(!Di(o,i.setType,s.createAddendum()))return void s.addMessage(h.Localizer.DiagnosticAddendum.memberAssignment().format({type:Oi(i.setType),name:n,classType:Mi(t)}));if(x.isInstantiableClass(d.classType)&&x.ClassType.isFrozenDataClass(d.classType)&&0==(1&r))return void s.addMessage(h.Localizer.DiagnosticAddendum.dataclassFrozen().format({name:Oi(x.ClassType.cloneAsInstance(d.classType))}))}return{type:o,isTypeIncomplete:l,isClassMember:!d.isInstanceMember}}if(0==(65&r)){const c=function(e,t,n){var i,s,r,a;if("get"===n.method){const n=null===(i=Ie(t,e,"__getattribute__",{method:"get"},new l.DiagnosticAddendum,4))||void 0===i?void 0:i.type;if(n&&x.isFunction(n))return ui(n);const r=null===(s=Ie(t,e,"__getattr__",{method:"get"},new l.DiagnosticAddendum,4))||void 0===s?void 0:s.type;if(r&&x.isFunction(r))return ui(r)}else if("set"===n.method){if(null===(r=Ie(t,e,"__setattr__",{method:"get"},new l.DiagnosticAddendum,4))||void 0===r?void 0:r.type)return x.AnyType.create()}else{o.assert("del"===n.method);if(null===(a=Ie(t,e,"__detattr__",{method:"get"},new l.DiagnosticAddendum,4))||void 0===a?void 0:a.type)return x.AnyType.create()}return}(t,e,i);if(c){const o=st(c,d,t,a,!1,r,e,n,i,s);if(!o)return;return{type:o,isTypeIncomplete:!1,isClassMember:!1}}}s.addMessage(h.Localizer.DiagnosticAddendum.memberUnknown().format({name:n}))}function st(e,t,n,i,s,r,a,o,l,c){const p=0!=(16&r);let d=!0;return e=k.mapSubtypes(e,(e=>{if(x.isClassInstance(e)){let r;r="get"===l.method?"__get__":"set"===l.method?"__set__":"__delete__";const p=k.lookUpClassMember(e,r,8);if(x.ClassType.isPropertyClass(e))if("set"===l.method){if(!p)return c.addMessage(h.Localizer.DiagnosticAddendum.propertyMissingSetter().format({name:o})),void(d=!1)}else if("del"===l.method&&!p)return c.addMessage(h.Localizer.DiagnosticAddendum.propertyMissingDeleter().format({name:o})),void(d=!1);if(p){let r=gi(p);const o=[{argumentCategory:0,type:e},{argumentCategory:0,type:s?i||x.ClassType.cloneAsInstance(n):x.NoneType.createInstance()}];if("get"===l.method?o.push({argumentCategory:0,type:n}):"set"===l.method&&o.push({argumentCategory:0,type:l.setType||x.UnknownType.create()}),x.ClassType.isPropertyClass(e)&&t&&x.isInstantiableClass(t.classType)&&(x.isFunction(r)?ui(r):x.isOverloadedFunction(r)&&r.overloads.forEach((e=>{ui(e)})),r=k.partiallySpecializeType(r,t.classType)),r&&(x.isFunction(r)||x.isOverloadedFunction(r))){const n=r,i=ti(a,(()=>{const i=Ni(e,n,t&&x.isInstantiableClass(t.classType)?t.classType:void 0,a);if(i&&(x.isFunction(i)||x.isOverloadedFunction(i))){const e=It(a,o.slice(1),i,void 0,!0);return e.argumentErrors?(d=!1,x.AnyType.create()):"get"===l.method?e.returnType||x.UnknownType.create():x.AnyType.create()}}));if(i)return i}}}else if((x.isFunction(e)||x.isOverloadedFunction(e))&&(!s||!(null==t?void 0:t.isInstanceMember)))return Ni(s?x.ClassType.cloneAsInstance(n):n,e,t&&x.isInstantiableClass(t.classType)?t.classType:void 0,a,void 0,p,i);if("set"===l.method){if((null==t?void 0:t.symbol.isClassVar())&&8&r)return void c.addMessage(h.Localizer.DiagnosticAddendum.memberSetClassVar().format({name:o}));let n=!1;if((t&&t.symbol.hasTypedDeclarations()||t&&!t.symbol.getDeclarations().some((e=>e.node===a)))&&(n=!0),n){let n=e;return s&&!t.isInstanceMember&&x.isFunction(e)&&(x.FunctionType.isClassMethod(e)||x.FunctionType.isInstanceMethod(e))&&(n=x.FunctionType.clone(e,!0)),n}}return e})),d?e:void 0}function rt(e,t){const n=t.findIndex((e=>x.isVariadicTypeVar(e)));if(n>=0&&Q&&x.isInstantiableClass(Q)){const i=e.slice(n,n+1+e.length-t.length);if(1===i.length&&x.isVariadicTypeVar(i[0].type))at(i[0].type,i[0].node);else{i.forEach(((e,t)=>{jt(e,0===t)}));const s=1===i.length&&i[0].isEmptyTupleShorthand?[]:i.map((e=>k.convertToInstance(e.type))),r=k.convertToInstance(k.specializeTupleClass(Q,s,!0,!0,!0));e=[...e.slice(0,n),{node:e[n].node,type:r},...e.slice(n+1+e.length-t.length,e.length)]}}return e}function at(e,t){return!!e.isVariadicUnpacked||(Ue(h.Localizer.Diagnostic.unpackedTypeVarTupleExpected().format({name1:e.details.name,name2:e.details.name}),t),!1)}function ot(e,t,n,i){var s,r;if((null===(s=t.typeAliasInfo)||void 0===s?void 0:s.typeParameters)&&t.typeAliasInfo.typeParameters.length>0&&!t.typeAliasInfo.typeArguments){const n=t.typeAliasInfo.typeParameters,s=rt(dt(e,i),n);s.length>n.length&&!n.some((e=>e.details.isVariadic))&&Ue(h.Localizer.Diagnostic.typeArgsTooMany().format({name:Oi(t),expected:n.length,received:s.length}),s[n.length].node);const a=new P.TypeVarMap(t.typeAliasInfo.typeVarScopeId),o=new l.DiagnosticAddendum;n.forEach(((e,t)=>{Si(e,t{c.push(a.getTypeVarType(e)||x.UnknownType.create())}));return{type:x.TypeBase.cloneForTypeAlias(k.applySolvedTypeVars(t,a),t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,c),node:e}}if(k.isTypeAliasPlaceholder(t)){const n=dt(e,i).map((e=>k.convertToInstance(e.type)));return{type:x.TypeBase.cloneForTypeAlias(t,t.details.recursiveTypeAliasName,"",t.details.recursiveTypeAliasScopeId,void 0,n),node:e}}let a=!1;const o=qe(t,void 0,((t,s)=>{if(x.isAnyOrUnknown(t))return t;if(64&i&&x.isTypeVar(s))return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarNotSubscriptable().format({type:Oi(s)}),e.baseExpression),dt(e,i,!1,!1),x.UnknownType.create();if(x.isInstantiableClass(t)){if(t.details.effectiveMetaclass&&x.isInstantiableClass(t.details.effectiveMetaclass)&&!x.ClassType.isBuiltIn(t.details.effectiveMetaclass,"type")){if(Ie(e,t,ct(n),void 0,void 0,32))return pt(e,t,n).type}if("set"===n.method?Ue(h.Localizer.Diagnostic.genericClassAssigned(),e.baseExpression):"del"===n.method&&Ue(h.Localizer.Diagnostic.genericClassDeleted(),e.baseExpression),x.ClassType.isSpecialBuiltIn(t,"Literal"))return function(e,t){if(0===e.items.length)return Ue(h.Localizer.Diagnostic.literalEmptyArgs(),e.baseExpression),x.UnknownType.create();const n=[];for(const i of e.items){let s;const r=i.valueExpression;if(0!==i.argumentCategory)Ue(h.Localizer.Diagnostic.unpackedArgInTypeArgument(),r),s=x.UnknownType.create();else if(i.name)Ue(h.Localizer.Diagnostic.keywordArgInTypeArgument(),r),s=x.UnknownType.create();else if(48===r.nodeType){const t=0!=(32&r.strings[0].token.flags),n=r.strings.map((e=>e.value)).join("");s=Gt(e,t?"bytes":"str",n)}else 40===r.nodeType?!r.isImaginary&&r.isInteger&&(s=Gt(e,"int",r.value)):11===r.nodeType?33===r.constType?s=Gt(e,"bool",!0):15===r.constType?s=Gt(e,"bool",!1):26===r.constType&&(s=x.NoneType.createType()):55===r.nodeType&&33===r.operator&&40===r.expression.nodeType&&!r.expression.isImaginary&&r.expression.isInteger&&(s=Gt(e,"int",-r.expression.value));if(!s){const e=ge(r);if(x.isClassInstance(e.type)&&x.ClassType.isEnumClass(e.type)&&void 0!==e.type.literalValue)s=x.ClassType.cloneAsInstantiable(e.type);else{let t=!0;k.doForEachSubtype(e.type,(e=>{x.isInstantiableClass(e)&&void 0!==e.literalValue||(t=!1)})),t&&(s=e.type)}}s||(0!=(64&t)?(Ue(h.Localizer.Diagnostic.literalUnsupportedType(),i),s=x.UnknownType.create()):s=x.AnyType.create()),n.push(s)}return x.combineTypes(n)}(e,i);if(x.ClassType.isBuiltIn(t,"InitVar")){const t=dt(e,i);return 1===t.length?t[0].type:(Ue(h.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.length}),e.baseExpression),x.UnknownType.create())}if(x.ClassType.isEnumClass(t))return x.ClassType.cloneAsInstance(t);const s=x.isInstantiableClass(t)&&x.ClassType.isBuiltIn(t,"Annotated"),r=x.isInstantiableClass(t)&&x.ClassType.hasCustomClassGetItem(t);let a=dt(e,i,s,r);return s||(a=rt(a,t.details.typeParameters)),r?t:Hn(t,a,i,e)}if(x.isClassInstance(t)){const i=pt(e,t,n);return i.isIncomplete&&(a=!0),i.type}if(x.isNever(t))return x.UnknownType.create();if(x.isNone(t))return Be(ii(e).diagnosticRuleSet.reportOptionalSubscript,c.DiagnosticRule.reportOptionalSubscript,h.Localizer.Diagnostic.noneNotSubscriptable(),e.baseExpression),x.UnknownType.create();if(!x.isUnbound(t)){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSubscriptable().format({type:Oi(t)}),e.baseExpression)}return x.UnknownType.create()}));return e.items.forEach((e=>{ge(e.valueExpression,void 0,4&i)})),{type:o,node:e,isIncomplete:a}}function lt(e,t=!1){return Q&&x.isInstantiableClass(Q)?t?k.convertToInstance(k.specializeTupleClass(Q,[x.combineTypes(e),x.AnyType.create(!0)])):k.convertToInstance(k.specializeTupleClass(Q,e)):x.UnknownType.create()}function ct(e){return"get"===e.method?"__getitem__":"set"===e.method?"__setitem__":(o.assert("del"===e.method),"__delitem__")}function pt(e,t,n){var i,s;if(x.isClassInstance(t)&&x.ClassType.isTypedDictClass(t)){const i=function(e,t,n){if(1!==e.items.length)return Ue(h.Localizer.Diagnostic.typeArgsMismatchOne().format({received:e.items.length}),e),{node:e,type:x.UnknownType.create()};if(e.trailingComma||e.items[0].name||0!==e.items[0].argumentCategory)return;const i=Ei(t,!0),s=ge(e.items[0].valueExpression),r=s.type;let a=new l.DiagnosticAddendum,o=!0;const p=k.mapSubtypes(r,(s=>{if(x.isAnyOrUnknown(s))return s;if(x.isClassInstance(s)&&x.ClassType.isBuiltIn(s,"str")){if(void 0===s.literalValue)return x.UnknownType.create();const r=s.literalValue,l=i.get(r);return l?(l.isRequired||l.isProvided||"get"!==n.method||v.isWithinTryBlock(e)||a.addMessage(h.Localizer.DiagnosticAddendum.keyNotRequired().format({name:r,type:Oi(t)})),"set"===n.method?Di(l.valueType,n.setType,a):"del"===n.method&&l.isRequired&&(a.addMessage(h.Localizer.DiagnosticAddendum.keyRequiredDeleted().format({name:r})),o=!1),l.valueType):(a.addMessage(h.Localizer.DiagnosticAddendum.keyUndefined().format({name:r,type:Oi(t)})),o=!1,x.UnknownType.create())}return a.addMessage(h.Localizer.DiagnosticAddendum.typeNotStringLiteral().format({type:Oi(s)})),o=!1,x.UnknownType.create()}));n.setExpectedTypeDiag&&(a=n.setExpectedTypeDiag);if(!a.isEmpty()){let t;t="set"===n.method?h.Localizer.Diagnostic.typedDictSet():"del"===n.method?h.Localizer.Diagnostic.typedDictDelete():h.Localizer.Diagnostic.typedDictAccess();const i=ii(e);Be(o?i.diagnosticRuleSet.reportTypedDictNotRequiredAccess:i.diagnosticRuleSet.reportGeneralTypeIssues,o?c.DiagnosticRule.reportTypedDictNotRequiredAccess:c.DiagnosticRule.reportGeneralTypeIssues,t+a.getString(),e)}return{node:e,type:p,isIncomplete:!!s.isIncomplete}}(e,t,n);if(i)return i}const r=ct(n),a=x.isClassInstance(t)?null===(i=be(e,t,r))||void 0===i?void 0:i.type:null===(s=Ie(e,t,r,void 0,void 0,32))||void 0===s?void 0:s.type;if(!a){return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.methodNotDefinedOnType().format({name:r,type:Oi(t)}),e.baseExpression),{node:e,type:x.UnknownType.create()}}if(1===e.items.length&&!e.trailingComma&&!e.items[0].name&&0===e.items[0].argumentCategory&&x.isClassInstance(t)){const n=e.items[0].valueExpression,i=ge(n).type;if(x.isClassInstance(i)&&x.ClassType.isBuiltIn(i,"int")&&k.isLiteralType(i)){const n=i.literalValue,s=k.getSpecializedTupleType(t);if(s&&s.tupleTypeArguments){if(k.isOpenEndedTupleClass(s))return{node:e,type:s.tupleTypeArguments[0]};if(n>=0&&n=0)return{node:e,type:s.tupleTypeArguments[s.tupleTypeArguments.length+n]}}}else if(x.isClassInstance(i)&&x.ClassType.isBuiltIn(i,"slice")){const i=k.getSpecializedTupleType(t);if(i&&i.tupleTypeArguments&&!k.isOpenEndedTupleClass(i)&&46===n.nodeType&&!n.stepValue){const t=(e,t)=>{let n=t;if(e){const t=ge(e).type;x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"int")&&k.isLiteralType(t)?(n=t.literalValue,n<0&&(n=i.tupleTypeArguments.length+n)):n=-1}return n},s=t(n.startValue,0),r=t(n.endValue,i.tupleTypeArguments.length);if(s>=0&&r>0&&r<=i.tupleTypeArguments.length&&Q&&x.isInstantiableClass(Q))return{node:e,type:x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,i.tupleTypeArguments.slice(s,r)))}}}}const o=e.items.filter((e=>0===e.argumentCategory&&!e.name)),p=e.items.filter((e=>1===e.argumentCategory)),d=e.items.filter((e=>0===e.argumentCategory&&!!e.name)),u=e.items.filter((e=>2===e.argumentCategory));let m;if(1!==o.length||0!==p.length||e.trailingComma)if(0===o.length&&0===p.length)m=Q&&x.isInstantiableClass(Q)?k.convertToInstance(k.specializeTupleClass(Q,[])):x.UnknownType.create();else{const e=[];o.forEach((t=>{e.push(ge(t.valueExpression).type)})),p.forEach((t=>{const n=xe(ge(t.valueExpression).type,!1,t)||x.UnknownType.create();e.push(n)})),m=lt(e,p.length>0)}else m=ge(o[0].valueExpression).type;let y,g=[{argumentCategory:0,type:m}];if("set"===n.method){let e=n.setType||x.AnyType.create();if(x.isTypeVar(e)&&e.details.constraints.length>0){e=Ge(e,x.isClassInstance(t)?t.condition:void 0)}g.push({argumentCategory:0,type:e})}return d.forEach((e=>{g.push({argumentCategory:0,valueExpression:e.valueExpression,node:e,name:e.name})})),u.forEach((e=>{g.push({argumentCategory:2,valueExpression:e.valueExpression,node:e})})),ni(e,(()=>{if(y=It(e,g,a),y.argumentErrors&&x.isClassInstance(m)&&0===d.length&&0===u.length){const t=[...g];t[0]={...t[0]};if(be(e,m,"__index__")){const n=Xn(e,"int");x.isClassInstance(n)&&(t[0].type=n)}y=It(e,t,a),y.argumentErrors||(g=t)}})),y=It(e,g,a),{node:e,type:y.returnType||x.UnknownType.create(),isIncomplete:!!y.isTypeIncomplete}}function dt(e,t,n=!1,i=!1){const s=[];let r=-163&t;r|=131072;const a=(e,t)=>{let s;return s=i||n&&t>0?ge(e,void 0,131234):function(e,t){let n,i=132185|t;ii(e).isStubFile&&(i|=4);31===e.nodeType?n={type:x.UnknownType.create(),typeList:e.entries.map((e=>ge(e,void 0,i))),node:e}:(n=ge(e,void 0,i),x.isClass(n.type)&&x.ClassType.isBuiltIn(n.type,"Protocol")&&Ue(h.Localizer.Diagnostic.protocolNotAllowedInTypeArgument(),e),x.isClass(n.type)&&x.ClassType.isBuiltIn(n.type,"ClassVar")&&Ue(h.Localizer.Diagnostic.protocolNotAllowedInTypeArgument(),e));return n}(e,r),s};return 1===e.items.length&&!e.trailingComma&&!e.items[0].name&&52===e.items[0].valueExpression.nodeType&&e.items[0].valueExpression.expressions.length>0?e.items[0].valueExpression.expressions.forEach(((e,t)=>{s.push(a(e,t))})):e.items.forEach(((e,t)=>{const n=a(e.valueExpression,t);0!==e.argumentCategory&&(1===e.argumentCategory&&x.isVariadicTypeVar(n.type)&&!n.type.isVariadicUnpacked?n.type=x.TypeVarType.cloneForUnpacked(n.type):(Ue(h.Localizer.Diagnostic.unpackedArgInTypeArgument(),e.valueExpression),n.type=x.UnknownType.create())),e.name&&Ue(h.Localizer.Diagnostic.keywordArgInTypeArgument(),e.valueExpression),s.push(n)})),s}function ut(e,t){if(t=k.transformPossibleRecursiveTypeAlias(t),!x.isClassInstance(t))return;if(!Q||!x.isInstantiableClass(Q))return;const n=[];if(k.isTupleClass(t)&&t.tupleTypeArguments)if(k.isOpenEndedTupleClass(t)){const i=k.transformPossibleRecursiveTypeAlias(t.tupleTypeArguments[0]);for(let t=0;t{n.push(k.transformPossibleRecursiveTypeAlias(e))}));else{const i=new P.TypeVarMap(k.getTypeVarScopeId(Q));if(!bt(Q,t,i,tt(e)))return;const s=k.applySolvedTypeVars(Q,i);if(!s.typeArguments||1!==s.typeArguments.length)return;const r=k.transformPossibleRecursiveTypeAlias(s.typeArguments[0]);for(let t=0;tge(e,tk.isLiteralTypeOrUnion(e)));return{type:k.convertToInstance(k.specializeTupleClass(Q,ht(i),!0,!s)),node:e}}function ht(e){const t=[];let n=!1;for(const i of e)if(i.unpackedType)if(x.isClassInstance(i.unpackedType)&&k.isTupleClass(i.unpackedType)){const e=i.unpackedType.tupleTypeArguments;!e||k.isOpenEndedTupleClass(i.unpackedType)?(t.push(i.type),n=!0):t.push(...e)}else t.push(i.type),n=!0;else t.push(i.type);return n?[x.combineTypes(t),x.AnyType.create(!0)]:t}function mt(e,t,n){const i=e.details.mro.findIndex((e=>x.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"NamedTuple")));if(i<0||e.details.mro.lengthx.isInstantiableClass(e)&&k.isTupleClass(e)?a:e)),e.details.mro[i]=o,e.details.mro[i+1]=a,e.details.baseClasses=e.details.baseClasses.map((e=>x.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"NamedTuple")?o:e))}function yt(e,t){const n=ge(e.leftExpression,void 0,2),i=e.arguments.map((e=>({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,node:e,name:e.name})));let s={node:e,type:x.UnknownType.create()};if(k.isTypeAliasPlaceholder(n.type))s.isIncomplete=!0;else{if(38===e.leftExpression.nodeType&&"super"===e.leftExpression.value)s=function(e){e.arguments.length>2&&Ue(h.Localizer.Diagnostic.superCallArgCount(),e.arguments[2]);let t,n;if(e.arguments.length>0){t=ge(e.arguments[0].valueExpression).type;const n=Ge(t);x.isAnyOrUnknown(n)||x.isInstantiableClass(n)||Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.superCallFirstArg().format({type:Oi(t)}),e.arguments[0].valueExpression)}else{const n=v.getEnclosingClass(e);if(n){const e=Jt(n);t=e?e.classType:x.UnknownType.create()}else Ue(h.Localizer.Diagnostic.superCallZeroArgForm(),e.leftExpression),t=x.UnknownType.create()}if(e.arguments.length>1){const i=Ge(ge(e.arguments[1].valueExpression).type);let s=!1;if(x.isAnyOrUnknown(i)||(x.isClassInstance(i)?(x.isInstantiableClass(t)&&(k.derivesFromClassRecursive(x.ClassType.cloneAsInstantiable(i),t,!0)||(s=!0)),n=i):x.isInstantiableClass(i)?(x.isInstantiableClass(t)&&(k.derivesFromClassRecursive(i,t,!0)||(s=!0)),n=i):s=!0),s){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.superCallSecondArg().format({type:Oi(t)}),e.arguments[1].valueExpression)}}else x.isInstantiableClass(t)&&(n=t);let i=!0;const s=v.getEnclosingFunction(e);if(s){const e=an(s);e&&(x.FunctionType.isStaticMethod(e.functionType)||x.FunctionType.isConstructorMethod(e.functionType)||x.FunctionType.isClassMethod(e.functionType))&&(i=!1)}const r=e.parent;if(35===r.nodeType){const s=r.memberName.value,a=k.lookUpClassMember(t,s,1);if(a&&x.isInstantiableClass(a.classType))return{type:i?x.ClassType.cloneAsInstance(a.classType):a.classType,node:e,bindToType:i&&n&&x.isInstantiableClass(n)?x.ClassType.cloneAsInstance(n):n}}if(x.isInstantiableClass(t)){if(t.details.mro.some((e=>x.isAnyOrUnknown(e))))return{type:x.UnknownType.create(),node:e};const n=t.details.baseClasses;if(n.length>0){const t=n[0];if(x.isInstantiableClass(t))return{type:i?x.ClassType.cloneAsInstance(t):t,node:e}}}return{type:x.UnknownType.create(),node:e}}(e);else if(x.isAnyOrUnknown(n.type)&&38===e.leftExpression.nodeType&&"reveal_type"===e.leftExpression.value)1===e.arguments.length&&0===e.arguments[0].argumentCategory&&void 0===e.arguments[0].name?s.type=function(e){const t=ge(e.arguments[0].valueExpression).type,n=v.printExpression(e.arguments[0].valueExpression),i=Oi(t,!0);Le(h.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:n,type:i}),e.arguments[0]);const s=Jn(e,"str");if(x.isInstantiableClass(s))return x.ClassType.cloneAsInstance(x.ClassType.cloneWithLiteral(s,i));return x.AnyType.create()}(e):Ue(h.Localizer.Diagnostic.revealTypeArgs(),e);else if(x.isAnyOrUnknown(n.type)&&38===e.leftExpression.nodeType&&"reveal_locals"===e.leftExpression.value)0===e.arguments.length?s.type=function(e){let t,n=e;for(;n&&(t=b.getScopeForNode(n),!t||0===t.type);)n=n.parent;const i=[];t&&t.symbolTable.forEach(((e,t)=>{if(!e.isIgnoredForProtocolMatch()){const n=li(e);i.push(h.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:t,type:Oi(n,!0)}))}}));i.length>0?Le(i.join("\n"),e):Le(h.Localizer.Diagnostic.revealLocalsNone(),e);return x.NoneType.createInstance()}(e):Ue(h.Localizer.Diagnostic.revealLocalsArgs(),e);else{const r=It(e,i,n.type,void 0,!1,t);s.type=r.returnType||x.UnknownType.create(),x.isUnion(s.type)&&(s.type=k.removeNoReturnFromUnion(s.type)),r.argumentErrors&&(s.typeErrors=!0)}n.isIncomplete&&(s.isIncomplete=!0)}return x.isInstantiableClass(n.type)&&x.ClassType.isBuiltIn(n.type,"TypeVar")&&ii(e).isTypingStubFile||i.forEach(((e,t)=>{48!==e.node.valueExpression.nodeType&&Yn(e)})),s}function gt(e,t,n,i,s,r,a){const o=[],l=[];for(let r=0;rvoid 0!==e));for(let t=0;t{if(!p[t])return e;const n={...e};return n.argType=p[t],n})));const h=s?s.clone():new P.TypeVarMap(k.getTypeVarScopeId(r));h.addSolveForScope(k.getTypeVarScopeId(r));const m=ni(e,(()=>St(e,u,r,h,!0,a)));if(!m.argumentErrors&&m.returnType){c=r,l.push({overload:c,matchResults:u,typeVarMap:h}),o.push(m.returnType);break}}if(!c)return}if(s)for(let n=0;n(s.addSolveForScope(k.getTypeVarScopeId(t)),s.unlock(),St(e,i,t,s,!0,a))))}const c=l[0].overload;return l[0].typeVarMap.unlock(),St(e,l[0].matchResults,c,l[0].typeVarMap,r,a),{argumentErrors:!1,returnType:x.combineTypes(o)}}function ft(e,t){let n,i=e.length-1;for(;i>=0&&!t[0][i];)i--;if(i++,i>=e.length)return;for(;i{k.doForEachSubtype(n,(t=>{const n=[...e];n[i]=t,s.push(n)}))})),s}function Tt(e,t,n,i,s){var r;let a,o=!1,p=!1;const d=e=>x.isFunction(e)&&x.FunctionType.isSkipConstructorCheck(e),u=null===(r=be(e,x.ClassType.cloneAsInstance(n),"__init__",{method:"get"},new l.DiagnosticAddendum,68))||void 0===r?void 0:r.type;if(u&&!d(u)){if(s&&(a=k.mapSubtypes(s,(s=>{s=k.transformPossibleRecursiveTypeAlias(s);const r=new P.TypeVarMap(k.getTypeVarScopeId(n));if(bt(n,s,r,tt(e))){let a;if(ni(e,(()=>{a=It(e,t,u,r.clone(),i,x.NoneType.createInstance())})),!(null==a?void 0:a.argumentErrors))return It(e,t,u,r,i,x.NoneType.createInstance()),_t(n,s,r)}})),x.isNever(a)&&(a=void 0)),!a){const s=n.typeArguments?k.buildTypeVarMapFromSpecializedClass(n,!1):new P.TypeVarMap(k.getTypeVarScopeId(n));s.addSolveForScope(k.getTypeVarScopeId(u));It(e,t,u,s,i).argumentErrors?p=!0:a=vt(n,void 0,s)}o=!0,i=!0}if(!p){const r=n.details.effectiveMetaclass;let c;r&&x.isInstantiableClass(r)&&!x.ClassType.isBuiltIn(r,"type")&&(c=k.lookUpClassMember(r,"__call__",28),c&&x.isInstantiableClass(c.classType)&&x.ClassType.isBuiltIn(c.classType,"type")&&(c=void 0));const u=it(e,n,"__new__",{method:"get"},new l.DiagnosticAddendum,21,n);if(!c&&u&&!d(u.type)){const r=u.type,l=new P.TypeVarMap(k.getTypeVarScopeId(n));if(n.typeAliasInfo&&l.addSolveForScope(n.typeAliasInfo.typeVarScopeId),r){const c=It(e,t,r,l,i);if(c.argumentErrors)p=!0;else{let e=c.returnType;e&&(x.isClassInstance(e)&&x.ClassType.isSameGenericClass(e,n)?(k.isPartlyUnknown(e)||k.requiresSpecialization(e))&&void 0!==a||(x.isClassInstance(e)&&x.ClassType.isTupleClass(e)&&!e.tupleTypeArguments&&e.typeArguments&&1===e.typeArguments.length&&(e=k.specializeTupleClass(e,[e.typeArguments[0],x.AnyType.create(!0)])),a=e):a||x.isUnknown(e)||(a=e))}a?x.isClassInstance(a)&&k.isTupleClass(a)&&!a.tupleTypeArguments&&(a=function(e,t){let n=e;t&&x.isClassInstance(t)&&k.isTupleClass(t)&&t.tupleTypeArguments&&(n=k.specializeTupleClass(e,t.tupleTypeArguments));return n}(a,s)):a=vt(n,s,l),o=!0}}}if(o||t.forEach((e=>{e.valueExpression&&!W.isSpeculative(e.valueExpression)&&ge(e.valueExpression)})),!o&&t.length>0){if(!(!!n.details.effectiveMetaclass&&x.isInstantiableClass(n.details.effectiveMetaclass)&&!x.ClassType.isBuiltIn(n.details.effectiveMetaclass))){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.constructorNoArgs().format({type:n.aliasName||n.details.name}),e)}}if(!a){const t=new P.TypeVarMap(k.getTypeVarScopeId(n));s&&bt(n,s,t,tt(e)),a=vt(n,s,t)}return{argumentErrors:p,returnType:a}}function _t(e,t,n){const i=k.applySolvedTypeVars(x.ClassType.cloneAsInstance(e),n,!0);if(Di(t,i,new l.DiagnosticAddendum))return x.isAny(t)?t:i}function vt(e,t,n){if(t){const i=k.mapSubtypes(t,(t=>_t(e,t,n)));if(!x.isNever(i))return i}const i=k.applySolvedTypeVars(e,n,!0);return x.ClassType.cloneAsInstance(i)}function bt(e,t,n,i){if(x.isAny(t))return e.details.typeParameters.forEach((e=>{n.setTypeVarType(e,t)})),!0;if(!x.isClassInstance(t))return!1;const s=t.typeArguments;if(!s)return Di(e,x.ClassType.cloneAsInstantiable(t),new l.DiagnosticAddendum,n);if(x.ClassType.isSameGenericClass(t,e)){const e=k.buildTypeVarMapFromSpecializedClass(t);return e.getTypeVars().forEach((t=>{const i=e.getTypeVarType(t.typeVar);n.setTypeVarType(t.typeVar,1===t.typeVar.details.variance?void 0:i,2===t.typeVar.details.variance?void 0:i,t.retainLiteral)})),!0}const r=k.getTypeVarScopeId(t),a=x.ClassType.getTypeParameters(t).map(((e,t)=>{const n=x.TypeVarType.createInstance(`__dest${t}`);return n.details.isSynthesized=!0,n.details.variance=e.details.variance,n.scopeId=r,n})),o=x.ClassType.cloneForSpecialization(x.ClassType.cloneAsInstantiable(t),a,!0),c=x.ClassType.getTypeParameters(e).map(((e,t)=>{const n=x.TypeVarType.createInstance(`__source${t}`);return n.details.isSynthesized=!0,n.details.synthesizedIndex=t,n})),p=x.ClassType.cloneForSpecialization(e,c,!0),d=new P.TypeVarMap(r);return!!Di(o,p,new l.DiagnosticAddendum,d)&&(a.forEach(((e,t)=>{const r=d.getTypeVarType(e);if(r&&x.isTypeVar(r)&&r.details.isSynthesized&&void 0!==r.details.synthesizedIndex){const a=x.ClassType.getTypeParameters(p)[r.details.synthesizedIndex];if(tx.maxTypeRecursionCount)return{returnType:x.UnknownType.create(),argumentErrors:!0};if(x.TypeBase.isNonCallable(n)){const t=9===e.nodeType?e.leftExpression:e;return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotCallable().format({expression:v.printExpression(t),type:Oi(n,!0)}),t),{returnType:x.UnknownType.create(),argumentErrors:!0}}const y=qe(n,void 0,((n,y)=>{var g;switch(n.category){case 1:case 2:return t.forEach((e=>{e.valueExpression&&!W.isSpeculative(e.valueExpression)&&Yn(e)})),n;case 5:{if("namedtuple"===n.details.builtInName)return Be(ii(e).diagnosticRuleSet.reportUntypedNamedTuple,c.DiagnosticRule.reportUntypedNamedTuple,h.Localizer.Diagnostic.namedTupleNoTypes(),e),kt(e,t,!1);const a=Dt(e,t,n,i||new P.TypeVarMap(k.getTypeVarScopeId(n)),s,r);return a.argumentErrors&&(d=!0),a.isTypeIncomplete&&(m=!0),a.argumentErrors||"NewType"!==n.details.builtInName?"__import__"===n.details.builtInName?x.AnyType.create():a.returnType:function(e,t){const n=ii(e);let i="_";if(t.length>=1){const e=t[0];0===e.argumentCategory&&e.valueExpression&&48===e.valueExpression.nodeType&&(i=e.valueExpression.strings.map((e=>e.value)).join(""))}if(t.length>=2){const s=Qn(t[1]);if(x.isInstantiableClass(s)){x.ClassType.isProtocolClass(s)?Ue(h.Localizer.Diagnostic.newTypeProtocolClass(),t[1].node||e):void 0!==s.literalValue&&Ue(h.Localizer.Diagnostic.newTypeLiteral(),t[1].node||e);const r=-4&s.details.flags,a=x.ClassType.createInstantiable(i,xt(e,n.moduleName,i),n.moduleName,n.filePath,r,Li(e),void 0,s.details.effectiveMetaclass);a.details.baseClasses.push(s),k.computeMroLinearization(a);const o=x.FunctionType.createInstance("__init__","","",64);x.FunctionType.addParameter(o,{category:0,name:"self",type:x.ClassType.cloneAsInstance(a),hasDeclaredType:!0}),x.FunctionType.addParameter(o,{category:0,name:"_x",type:x.ClassType.cloneAsInstance(s),hasDeclaredType:!0}),o.details.declaredReturnType=x.NoneType.createInstance(),a.details.fields.set("__init__",C.Symbol.createWithType(4,o));const l=x.FunctionType.createInstance("__new__","","",65);return x.FunctionType.addParameter(l,{category:0,name:"cls",type:a,hasDeclaredType:!0}),x.FunctionType.addDefaultParameters(l),l.details.declaredReturnType=x.ClassType.cloneAsInstance(a),a.details.fields.set("__new__",C.Symbol.createWithType(4,l)),a}x.isAnyOrUnknown(s)||Ue(h.Localizer.Diagnostic.newTypeNotAClass(),t[1].node||e)}return}(e,t)}case 6:{const a="cast"===n.overloads[0].details.builtInName&&2===t.length;a&&Qn(t[0]);const o=function(e,t,n,i,s,r){const a=[],o=[];let p=[];ni(e,(()=>{n.overloads.forEach((n=>{if(x.FunctionType.isOverloaded(n)){const i=Ct(e,t,n);i.argumentErrors||(a.push(n),o.push(i))}})),p=t.map((e=>e.type?e.type:e.valueExpression?ge(e.valueExpression).type:x.AnyType.create()))}));let d=[t.map((e=>{}))];for(;;){const t=gt(e,d,a,o,i,s,r);if(t)return t;if(d=ft(p,d),!d||d.length>64)break}if(!ze(e)){const i=n.overloads[0].details.name||"",s=new l.DiagnosticAddendum,r=t.map((e=>Oi(Yn(e))));s.addMessage(h.Localizer.DiagnosticAddendum.argumentTypes().format({types:r.join(", ")})),d&&d.length>64&&s.addMessage(h.Localizer.DiagnosticAddendum.overloadTooManyUnions()),Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.noOverload().format({name:i})+s.getString(),e)}return{argumentErrors:!0}}(e,t,n,i,s,r);if(o.argumentErrors&&(d=!0),o.isTypeIncomplete&&(m=!0),a){const n=Qn(t[0]),i=Yn(t[1]);return x.isInstantiableClass(n)&&x.isClassInstance(i)&&x.isTypeSame(n,x.ClassType.cloneAsInstantiable(i),!0)&&Be(ii(e).diagnosticRuleSet.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryCast,h.Localizer.Diagnostic.unnecessaryCast().format({type:Oi(i)}),e),k.convertToInstance(n)}return o.returnType||x.UnknownType.create()}case 7:if(x.TypeBase.isInstantiable(n)){if(void 0!==n.literalValue)return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.literalNotCallable(),e),d=!0,x.UnknownType.create();if(x.ClassType.isBuiltIn(n)){const i=n.aliasName||n.details.name;if("type"===i){if(Tt(e,t,n,s,r),1===t.length){const e=Yn(t[0]);if(x.isClassInstance(e)||x.isTypeVar(e)&&x.TypeBase.isInstance(e)||x.isNone(e))return k.convertToInstantiable(k.stripLiteralValue(e))}else if(t.length>=2)return function(e,t){const n=ii(e),i=Yn(t[0]);if(!x.isClassInstance(i)||!x.ClassType.isBuiltIn(i,"str"))return;const s=i.literalValue||"_",r=Yn(t[1]);if(!x.isClassInstance(r)||!k.isTupleClass(r)||void 0===r.tupleTypeArguments)return;const a=x.ClassType.createInstantiable(s,xt(e,n.moduleName,s),n.moduleName,n.filePath,0,Li(e),void 0,r.details.effectiveMetaclass);r.tupleTypeArguments.forEach((n=>{x.isInstantiableClass(n)||x.isAnyOrUnknown(n)?a.details.baseClasses.push(n):We(n,t[1].valueExpression||e)})),k.computeMroLinearization(a)||Ue(h.Localizer.Diagnostic.methodOrdering(),e);return a}(e,t)||x.AnyType.create();return x.AnyType.create()}if("TypeVar"===i)return function(e,t){var n;let i,s="";if(0===t.length)return void Ue(h.Localizer.Diagnostic.typeVarFirstArg(),e);const r=t[0];r.valueExpression&&48===r.valueExpression.nodeType?s=r.valueExpression.strings.map((e=>e.value)).join(""):Ue(h.Localizer.Diagnostic.typeVarFirstArg(),r.valueExpression||e);const a=x.TypeVarType.createInstantiable(s,!1);for(let s=1;s0)Ue(h.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[s].valueExpression||e);else{const n=Qn(t[s]);k.requiresSpecialization(n)&&Ue(h.Localizer.Diagnostic.typeVarGeneric(),t[s].valueExpression||e),a.details.boundType=k.convertToInstance(n)}else"covariant"===o?t[s].valueExpression&&At(t[s].valueExpression)&&(2===a.details.variance?Ue(h.Localizer.Diagnostic.typeVarVariance(),t[s].valueExpression):a.details.variance=1):"contravariant"===o?t[s].valueExpression&&At(t[s].valueExpression)&&(1===a.details.variance?Ue(h.Localizer.Diagnostic.typeVarVariance(),t[s].valueExpression):a.details.variance=2):Ue(h.Localizer.Diagnostic.typeVarUnknownParam().format({name:o}),(null===(n=t[s].node)||void 0===n?void 0:n.name)||t[s].valueExpression||e);l.set(o,o)}else if(a.details.boundType)Ue(h.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[s].valueExpression||e);else{const n=Qn(t[s]);k.requiresSpecialization(n)&&Ue(h.Localizer.Diagnostic.typeVarGeneric(),t[s].valueExpression||e),x.TypeVarType.addConstraint(a,k.convertToInstance(n)),void 0===i&&(i=t[s])}}1===a.details.constraints.length&&i&&Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarSingleConstraint(),i.valueExpression||e);return a}(e,t);if("TypeVarTuple"===i)return function(e,t){var n,i;let s="";if(0===t.length)return void Ue(h.Localizer.Diagnostic.typeVarFirstArg(),e);const r=t[0];r.valueExpression&&48===r.valueExpression.nodeType?s=r.valueExpression.strings.map((e=>e.value)).join(""):Ue(h.Localizer.Diagnostic.typeVarFirstArg(),r.valueExpression||e);const a=x.TypeVarType.createInstantiable(s,!1);a.details.isVariadic=!0;for(let s=1;se.value)).join(""):Ue(h.Localizer.Diagnostic.paramSpecFirstArg(),s.valueExpression||e);const a=x.TypeVarType.createInstantiable(r,!0);for(let s=1;se.value)).join("")}const r=x.ClassType.createInstantiable(s,xt(e,i.moduleName,s),i.moduleName,i.filePath,1048576,Li(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),k.computeMroLinearization(r);const a=r.details.fields;if(a.set("__class__",C.Symbol.createWithType(68,r)),n.length<2)return;{const t=n[1];if(0!==t.argumentCategory||!t.valueExpression||48!==t.valueExpression.nodeType)return;t.valueExpression.strings.map((e=>e.value)).join("").split(" ").forEach((n=>{if(n=n.trim()){const i=x.UnknownType.create(),s=C.Symbol.createWithType(4,i),r=t.valueExpression;o.assert(48===r.nodeType);const l=ii(e),c={type:1,node:r,path:l.filePath,range:p.convertOffsetsToRange(r.start,u.TextRange.getEnd(r),l.lines),moduleName:l.moduleName};s.addDeclaration(c),a.set(n,s)}}))}return r}(e,n,t);if("TypedDict"===i)return function(e,t,n){const i=ii(e);let s="TypedDict";if(0===n.length)Ue(h.Localizer.Diagnostic.typedDictFirstArg(),e);else{const t=n[0];0===t.argumentCategory&&t.valueExpression&&48===t.valueExpression.nodeType?s=t.valueExpression.strings.map((e=>e.value)).join(""):Ue(h.Localizer.Diagnostic.typedDictFirstArg(),n[0].valueExpression||e)}const r=x.ClassType.createInstantiable(s,xt(e,i.moduleName,s),i.moduleName,i.filePath,128,Li(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),k.computeMroLinearization(r);const a=r.details.fields;a.set("__class__",C.Symbol.createWithType(68,r));let o=!1;if(n.length<2)Ue(h.Localizer.Diagnostic.typedDictSecondArgDict(),e);else{const t=n[1],s=new Map;if(0===t.argumentCategory&&t.valueExpression&&15===t.valueExpression.nodeType){o=!0;t.valueExpression.entries.forEach((e=>{if(17!==e.nodeType)return void Ue(h.Localizer.Diagnostic.typedDictSecondArgDictEntry(),e);if(48!==e.keyExpression.nodeType)return void Ue(h.Localizer.Diagnostic.typedDictEntryName(),e.keyExpression);const t=e.keyExpression.strings.map((e=>e.value)).join("");if(!t)return void Ue(h.Localizer.Diagnostic.typedDictEmptyName(),e.keyExpression);if(s.has(t))return void Ue(h.Localizer.Diagnostic.typedDictEntryUnique(),e.keyExpression);s.set(t,!0),Zn(e.valueExpression,!0);const n=new C.Symbol(8),r={type:1,node:e.keyExpression,path:i.filePath,typeAnnotationNode:e.valueExpression,range:p.convertOffsetsToRange(e.keyExpression.start,u.TextRange.getEnd(e.keyExpression),i.lines),moduleName:i.moduleName};n.addDeclaration(r),a.set(t,n)}))}else if(t.name)for(let t=1;t=3&&(!n[2].name||"total"!==n[2].name.value||!n[2].valueExpression||11!==n[2].valueExpression.nodeType||15!==n[2].valueExpression.constType&&33!==n[2].valueExpression.constType?Ue(h.Localizer.Diagnostic.typedDictTotalParam(),n[2].valueExpression||e):15===n[2].valueExpression.constType&&(r.details.flags|=256)),n.length>3&&Ue(h.Localizer.Diagnostic.typedDictExtraArgs(),n[3].valueExpression||e));return Ee(e,r),r}(e,n,t);if("auto"===i&&0===t.length)return Xn(e,"int")}if(x.ClassType.hasAbstractMethods(n)&&!n.includeSubclasses&&!x.isTypeVar(y)){const t=Pi(n),i=new l.DiagnosticAddendum,s=2;t.forEach(((e,n)=>{if(n===s)i.addMessage(h.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:t.length-s}));else if(nx.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"type")))){const t="__class_"+a.details.name,n=x.ClassType.createInstantiable(t,"","",ii(e).filePath,0,Li(e),x.ClassType.cloneAsInstantiable(a),x.ClassType.cloneAsInstantiable(a));return n.details.baseClasses.push(Jn(e,"object")),k.computeMroLinearization(n),n}return a}{const o=null===(g=be(e,n,"__call__"))||void 0===g?void 0:g.type;if(o&&(x.isFunction(o)||x.isOverloadedFunction(o))){const n=It(e,t,o,i,s,r,a+1);return n.argumentErrors&&(d=!0),n.returnType||x.UnknownType.create()}return o&&x.isAnyOrUnknown(o)||Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.objectNotCallable().format({type:Oi(n)}),e),x.UnknownType.create()}case 3:return void Be(ii(e).diagnosticRuleSet.reportOptionalCall,c.DiagnosticRule.reportOptionalCall,h.Localizer.Diagnostic.noneNotCallable(),e);case 10:{n=k.transformPossibleRecursiveTypeAlias(n);const o=It(e,t,n,i,s,r,a+1);return o.argumentErrors&&(d=!0),o.returnType||x.UnknownType.create()}}}));return{argumentErrors:d,returnType:x.isNever(y)?void 0:y,isTypeIncomplete:m}}function Ct(e,t,n){let i=0;const s=n.details.parameters,r=s.find((e=>2===e.category));let a=!1,p=s.findIndex((e=>0===e.category&&!e.name));const d=new Map;s.forEach(((e,t)=>{e.name&&0===e.category&&d.set(e.name,{argsNeeded:0!==e.category||e.hasDefault?0:1,argsReceived:0,isPositionalOnly:p>=0&&t1===e.category&&!e.name));const m=s.findIndex((e=>1===e.category)),y=s.findIndex((e=>2===e.category));let g,f;u<0&&(u=m,u>=0&&u++),u<0&&(u=y);let T=!1;if(m>=0&&y>=0){const e=s[m],t=s[y];if(e.name&&e.hasDeclaredType&&e.typeAnnotation&&35===e.typeAnnotation.nodeType&&"args"===e.typeAnnotation.memberName.value&&38===e.typeAnnotation.leftExpression.nodeType&&t.name&&t.hasDeclaredType&&t.typeAnnotation&&35===t.typeAnnotation.nodeType&&"kwargs"===t.typeAnnotation.memberName.value&&38===t.typeAnnotation.leftExpression.nodeType&&e.typeAnnotation.leftExpression.value===t.typeAnnotation.leftExpression.value){T=!0;const t=ge(e.typeAnnotation.leftExpression).type;x.isTypeVar(t)&&t.details.isParamSpec&&(t.scopeId===n.details.typeVarScopeId?(g=[],f=t):p=m)}}t.forEach((e=>{if(e.name){const t=s.findIndex((t=>t.name===e.name.value&&0===t.category));t>=0&&t>p&&(u<0||t2===e.argumentCategory||void 0!==e.name));_<0&&(_=t.length);let v,b=[];function I(e,t){e.active&&(v=t)}let C=void 0!==t.find((e=>1===e.argumentCategory)),S=0,D=0,F=0;for(;i<_;){if(S===p){S++;continue}if(i=u){C&&1===t[i].argumentCategory||(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===u?h.Localizer.Diagnostic.argPositionalExpectedOne():h.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:u}),t[i].valueExpression||e),a=!0);break}const r=x.FunctionType.getEffectiveParameterType(n,S);if(1===t[i].argumentCategory){if(!t[i].valueExpression)break;const o=1===s[S].category&&x.isVariadicTypeVar(r);let l=!1;const p=Yn(t[i]);let m,y=!1;n.details.paramSpec&&S0?(m=g.tupleTypeArguments[D],C=void 0!==t.find(((e,t)=>t>i&&1===e.argumentCategory)),D++,D>=g.tupleTypeArguments.length&&(D=0,y=!0)):o&&x.isVariadicTypeVar(p)?(m=p,l=!0):(m=xe(p,!1,t[i].valueExpression)||x.UnknownType.create(),x.isParamSpec(m)&&(m=x.AnyType.create()));const f={argumentCategory:0,type:m},T=s[S].name;o&&!l?(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.unpackedArgWithVariadicParam(),t[i].valueExpression||e),a=!0):b.push({paramCategory:s[S].category,paramType:r,requiresTypeVarMatching:k.requiresSpecialization(r),argument:f,errorNode:t[i].valueExpression||e,paramName:s[S].isNameSynthesized?void 0:T}),I(t[i],s[S]),T&&0===s[S].category&&d.has(T)&&d.get(T).argsReceived++,(y||1===s[S].category)&&i++,1!==s[S].category&&S++}else if(1===s[S].category){if(I(t[i],s[S]),g)g.push(t[i]);else{let n=s[S].category,o=r;const l=s[S].name;if(x.isVariadicTypeVar(s[S].type)&&x.isClassInstance(r)&&k.isTupleClass(r)&&r.tupleTypeArguments&&F=r.tupleTypeArguments.length?S++:l>0&&s<=0&&(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===l?h.Localizer.Diagnostic.argMorePositionalExpectedOne():h.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:l}),t[i].valueExpression||e),a=!0)}b.push({paramCategory:n,paramType:o,requiresTypeVarMatching:k.requiresSpecialization(r),argument:t[i],errorNode:t[i].valueExpression||e,paramName:l,mapsToVarArgList:!0})}i++}else{const n=s[S].name;b.push({paramCategory:s[S].category,paramType:r,requiresTypeVarMatching:k.requiresSpecialization(r),argument:t[i],errorNode:t[i].valueExpression||e,paramName:s[S].isNameSynthesized?void 0:n}),I(t[i],s[S]),n&&d.has(n)&&d.get(n).argsReceived++,i++,S++}}if(p>=0&&_e.hasDefault)),i=(n>=0&&n0&&(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===i?h.Localizer.Diagnostic.argMorePositionalExpectedOne():h.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:i}),t.length>_&&t[_].valueExpression||e),a=!0)}if(!a){let f;for(;i{const c=d.get(l);if(c&&!c.isPositionalOnly)if(c.argsReceived>0)m.addMessage(h.Localizer.Diagnostic.paramAlreadyAssigned().format({name:l}));else{c.argsReceived++;const r=s.findIndex((e=>e.name===l));o.assert(r>=0);const p=x.FunctionType.getEffectiveParameterType(n,r);b.push({paramCategory:0,paramType:p,requiresTypeVarMatching:k.requiresSpecialization(p),argument:{argumentCategory:0,type:a.valueType},errorNode:t[i].valueExpression||e,paramName:l})}else if(r){o.assert(y>=0);const s=x.FunctionType.getEffectiveParameterType(n,y);b.push({paramCategory:2,paramType:s,requiresTypeVarMatching:k.requiresSpecialization(r.type),argument:{argumentCategory:0,type:a.valueType},errorNode:t[i].valueExpression||e,paramName:l}),d.set(l,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}else m.addMessage(h.Localizer.Diagnostic.paramNameMissing().format({name:l}))})),m.isEmpty()||(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.unpackedTypedDictArgument()+m.getString(),t[i].valueExpression||e),a=!0)}else{const n=we(e,"Mapping"),s=Xn(e,"str");if(n&&x.isInstantiableClass(n)&&s&&x.isClassInstance(s)){const r=new P.TypeVarMap(k.getTypeVarScopeId(n));let o=!1;if(x.isTypeVar(p))o=!0;else if(Di(x.ClassType.cloneAsInstance(n),p,new l.DiagnosticAddendum,r)){const e=k.applySolvedTypeVars(n,r).typeArguments;e&&e.length>=2?(Di(s,e[0],new l.DiagnosticAddendum)&&(o=!0),f=e[1]):(o=!0,f=x.UnknownType.create())}o||(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.unpackedDictArgumentNotMapping(),t[i].valueExpression||e),a=!0)}}}else{const l=t[i].name;if(l){const p=l.value,u=d.get(p);if(u&&!u.isPositionalOnly)if(u.argsReceived>0)Be(ii(l).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramAlreadyAssigned().format({name:p}),l),a=!0;else{u.argsReceived++;const r=s.findIndex((e=>e.name===p));o.assert(r>=0);const a=x.FunctionType.getEffectiveParameterType(n,r);b.push({paramCategory:0,paramType:a,requiresTypeVarMatching:k.requiresSpecialization(a),argument:t[i],errorNode:t[i].valueExpression||e,paramName:p}),I(t[i],s[r])}else if(r){if(o.assert(y>=0),g)g.push(t[i]);else{const s=x.FunctionType.getEffectiveParameterType(n,y);b.push({paramCategory:2,paramType:s,requiresTypeVarMatching:k.requiresSpecialization(r.type),argument:t[i],errorNode:t[i].valueExpression||e,paramName:p}),d.set(p,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}I(t[i],r)}else Be(ii(l).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramNameMissing().format({name:l.value}),l),a=!0}else if(0===t[i].argumentCategory){const n=u;Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===n?h.Localizer.Diagnostic.argPositionalExpectedOne():h.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:n}),t[i].valueExpression||e),a=!0}}i++}if(f&&(!C||m>=0)){const t=C?m+1:p>=0?p+1:0;s.forEach(((i,s)=>{if(s>=t&&0===i.category&&i.name&&!i.hasDefault&&d.has(i.name)&&0===d.get(i.name).argsReceived){const t=x.FunctionType.getEffectiveParameterType(n,s);b.push({paramCategory:0,paramType:t,requiresTypeVarMatching:k.requiresSpecialization(t),argument:{argumentCategory:0,type:f},errorNode:e,paramName:i.isNameSynthesized?void 0:i.name}),d.get(i.name).argsReceived=1}}))}if(!f&&!x.FunctionType.isDefaultParameterCheckDisabled(n)){const t=[...d.keys()].filter((e=>{const t=d.get(e);return!t||t.argsReceived0){const n=t.map((e=>`"${e}"`)).join(", ");Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===t.length?h.Localizer.Diagnostic.argMissingForParam().format({name:n}):h.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),a=!0}s.forEach(((t,i)=>{if(0===t.category&&t.name){const s=d.get(t.name);if(0===s.argsNeeded&&0===s.argsReceived){const s=x.FunctionType.getEffectiveParameterType(n,i);t.defaultType&&!k.isEllipsisType(t.defaultType)&&k.requiresSpecialization(s)&&b.push({paramCategory:t.category,paramType:s,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:t.defaultType},errorNode:e,paramName:t.isNameSynthesized?void 0:t.name})}}}))}}if((!a||!W.isSpeculative(void 0))&&m>=0&&s[m].hasDeclaredType){const t=x.FunctionType.getEffectiveParameterType(n,m),i=b.filter((e=>e.mapsToVarArgList));if(x.isTypeVar(t)&&t.details.isVariadic&&Q&&x.isInstantiableClass(Q)){const n=i.map((e=>k.stripLiteralValue(Yn(e.argument)))),r={paramCategory:1,paramType:t,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,n,!0,!0,!0))},errorNode:e,paramName:s[m].name,mapsToVarArgList:!0};b=[...b.filter((e=>!e.mapsToVarArgList)),r]}}return{argumentErrors:a,argParams:b,paramSpecTarget:f,paramSpecArgList:g,activeParam:v}}function St(e,t,n,i,s=!1,r){let a=!1,o=!1;const p=k.getTypeCondition(n);if(n.boundTypeVarScopeId&&(i.addSolveForScope(n.boundTypeVarScopeId),"__init__"===n.details.name&&x.FunctionType.isOverloaded(n)&&n.strippedFirstParamType&&n.boundToType&&x.isClassInstance(n.strippedFirstParamType)&&x.isClassInstance(n.boundToType)&&x.ClassType.isSameGenericClass(n.strippedFirstParamType,n.boundToType)&&n.strippedFirstParamType.typeArguments)){const e=n.strippedFirstParamType.details.typeParameters;n.strippedFirstParamType.typeArguments.forEach(((t,n)=>{if(ne===n.details.builtInName))&&(s=!0);const d=t.argParams.filter((e=>e.requiresTypeVarMatching)).length;if(d>0){const r=Math.min(d,2);for(let o=0;o{t.argParams.forEach((e=>{if(e.requiresTypeVarMatching){Ft(e,i,n.details.name,s,p).isTypeIncomplete&&(a=!0)}}))}));i.lock()}t.argParams.forEach((e=>{const t=Ft(e,i,n.details.name,s,p);t.isCompatible?t.isTypeIncomplete&&(a=!0):o=!0})),t.paramSpecArgList&&t.paramSpecTarget&&(function(e,t,n,i,s){var r;const a=i.getParamSpec(n);if(!a||!a.concrete)return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramSpecNotBound().format({type:Oi(n)}),(null===(r=t[0])||void 0===r?void 0:r.valueExpression)||e),!1;let o=!1;const l=new Map,p=a.concrete.parameters;p.forEach((e=>{e.name&&l.set(e.name,e)}));let d=0;if(t.forEach((t=>{if(0===t.argumentCategory){let n;if(t.name){const i=l.get(t.name.value);i?(n=i.type,l.delete(t.name.value)):(Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramNameMissing().format({name:t.name.value}),t.valueExpression||e),o=!0)}else{if(d0){const n=t.map((e=>`"${e}"`)).join(", ");Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===t.length?h.Localizer.Diagnostic.argMissingForParam().format({name:n}):h.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),o=!0}}return!o}(e,t.paramSpecArgList,t.paramSpecTarget,i,p)||(o=!0));const u=ui(n,t.argParams);let m=!0,y=e;for(;;){const e=v.getTypeVarScopeNode(y);if(!e)break;const t=et(e);i.hasSolveForScope(t)&&(m=!1),y=e}let g=k.addConditionToType(k.applySolvedTypeVars(u,i,!1,!1,m),p);return x.isClassInstance(g)&&x.ClassType.isBuiltIn(g,"TypeGuard")&&g.typeArguments&&g.typeArguments.length>0&&Z&&x.isInstantiableClass(Z)&&(g=x.ClassType.cloneAsInstance(x.ClassType.cloneForTypeGuard(Z,g.typeArguments[0]))),x.isFunction(g)&&!g.details.name&&(g.details={...g.details,typeVarScopeId:x.WildcardTypeVarScopeId}),{argumentErrors:o,returnType:g,isTypeIncomplete:a,activeParam:t.activeParam}}function Dt(e,t,n,i,s=!1,r){const a=Ct(e,t,n);return a.argumentErrors?(G.isUndoTrackingEnabled()||t.forEach((e=>{e.valueExpression&&!W.isSpeculative(e.valueExpression)&&ge(e.valueExpression)})),{argumentErrors:!0,activeParam:a.activeParam}):St(e,a,n,i,s,r)}function Ft(e,t,n,i,s){let r,a,o=!1;if(e.argument.valueExpression){let n=x.isTypeVar(e.paramType)?void 0:k.applySolvedTypeVars(e.paramType,t,!1,!0);if(n&&x.isUnknown(n)&&(n=void 0),e.argType)r=e.argType;else{const t=ge(e.argument.valueExpression,n);if(r=t.type,t.isIncomplete&&(o=!0),t.typeErrors)return{isCompatible:!1};a=t.expectedTypeDiagAddendum}e.argument&&e.argument.name&&!W.isSpeculative(e.errorNode)&&ae(e.argument.name,n||r,o)}else r=e.argType?e.argType:Yn(e.argument);2===e.paramCategory&&x.isTypeVar(e.paramType)&&(r=k.stripLiteralValue(r)),s&&(r=qe(r,s,(e=>e)));let p=new l.DiagnosticAddendum;if(!Di(e.paramType,r,p.createAddendum(),t)){if("none"!==ii(e.errorNode).diagnosticRuleSet.reportGeneralTypeIssues&&!ze(e.errorNode)){const t=ii(e.errorNode),i=Oi(r),s=Oi(e.paramType);let o;o=e.paramName?n?h.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:i,paramType:s,functionName:n,paramName:e.paramName}):h.Localizer.Diagnostic.argAssignmentParam().format({argType:i,paramType:s,paramName:e.paramName}):n?h.Localizer.Diagnostic.argAssignmentFunction().format({argType:i,paramType:s,functionName:n}):h.Localizer.Diagnostic.argAssignment().format({argType:i,paramType:s}),a&&(p=a),Be(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,o+p.getString(),e.errorNode)}return{isCompatible:!1}}if(!i){const t=x.removeUnbound(r),i=ii(e.errorNode),s=()=>{const t=new l.DiagnosticAddendum;return e.paramName&&t.addMessage((n?h.Localizer.DiagnosticAddendum.argParamFunction().format({paramName:e.paramName,functionName:n}):h.Localizer.DiagnosticAddendum.argParam().format({paramName:e.paramName}))+t.getString()),t};if("none"!==i.diagnosticRuleSet.reportUnknownArgumentType&&!x.isAny(e.paramType))if(x.isUnknown(t)){const t=s();Be(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,h.Localizer.Diagnostic.argTypeUnknown()+t.getString(),e.errorNode)}else if(k.isPartlyUnknown(t,!0)&&!k.isPartlyUnknown(e.paramType)&&!x.isInstantiableClass(t)){const n=s();n.addMessage(h.Localizer.DiagnosticAddendum.argumentType().format({type:Oi(t,!0)})),Be(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,h.Localizer.Diagnostic.argTypePartiallyUnknown()+n.getString(),e.errorNode)}}return{isCompatible:!0,isTypeIncomplete:o}}function At(e){if(11===e.nodeType){if(15===e.constType)return!1;if(33===e.constType)return!0}return Ue(h.Localizer.Diagnostic.expectedBoolLiteral(),e),!1}function xt(e,t,n){const i=[n];let s=e;for(;s;)s=v.getEnclosingClass(s),s&&i.push(s.name.value);return i.push(t),i.reverse().join(".")}function kt(e,t,n){const i=ii(e);let s="namedtuple";if(0===t.length)Ue(h.Localizer.Diagnostic.namedTupleFirstArg(),e);else{const n=t[0];0!==n.argumentCategory?Ue(h.Localizer.Diagnostic.namedTupleFirstArg(),t[0].valueExpression||e):n.valueExpression&&48===n.valueExpression.nodeType&&(s=n.valueExpression.strings.map((e=>e.value)).join(""))}const r=t.find((e=>{var t;return"defaults"===(null===(t=e.name)||void 0===t?void 0:t.value)}));let a=0;if(r&&r.valueExpression){const e=ge(r.valueExpression).type;a=x.isClassInstance(e)&&k.isTupleClass(e)&&!k.isOpenEndedTupleClass(e)&&e.tupleTypeArguments?e.tupleTypeArguments.length:void 0}const o=we(e,"NamedTuple")||x.UnknownType.create(),l=x.ClassType.createInstantiable(s,xt(e,i.moduleName,s),i.moduleName,i.filePath,0,Li(e),void 0,x.isInstantiableClass(o)?o.details.effectiveMetaclass:x.UnknownType.create());l.details.baseClasses.push(o);const c=l.details.fields;c.set("__class__",C.Symbol.createWithType(68,l));const d=x.FunctionType.createInstance("__new__","","",65);d.details.declaredReturnType=x.ClassType.cloneAsInstance(l),v.isAssignmentToDefaultsFollowingNamedTuple(e)&&(d.details.flags|=32),x.FunctionType.addParameter(d,{category:0,name:"cls",type:l,hasDeclaredType:!0});const m=[],y={category:0,name:"self",type:x.ClassType.cloneAsInstance(l),hasDeclaredType:!0};let g=!1;const f=[];if(t.length<2)Ue(h.Localizer.Diagnostic.namedTupleSecondArg(),e),g=!0;else{const e=t[1];if(0!==e.argumentCategory)g=!0;else if(!n&&e.valueExpression&&48===e.valueExpression.nodeType){const t=e.valueExpression.strings.map((e=>e.value)).join("").split(/[,\s]+/),s=void 0===a?0:Math.max(0,t.length-a);t.forEach(((t,r)=>{if(t=t.trim()){const a=x.UnknownType.create(),o={category:0,name:t,type:a,hasDeclaredType:n,hasDefault:r>=s};x.FunctionType.addParameter(d,o);const l=C.Symbol.createWithType(8,a);m.push(t);const h=e.valueExpression,y={type:1,node:h,path:i.filePath,range:p.convertOffsetsToRange(h.start,u.TextRange.getEnd(h),i.lines),moduleName:i.moduleName};l.addDeclaration(y),c.set(t,l),f.push(a)}}))}else if(e.valueExpression&&31===e.valueExpression.nodeType){const t=e.valueExpression,s=new Map,r=void 0===a?0:Math.max(0,t.entries.length-a);t.entries.forEach(((e,t)=>{let a,o,l,y="";n?52===e.nodeType&&2===e.expressions.length?(l=e.expressions[0],a=e.expressions[1],o=k.convertToInstance(Zn(a))):Ue(h.Localizer.Diagnostic.namedTupleNameType(),e):(l=e,o=x.UnknownType.create()),l&&48===l.nodeType?(y=l.strings.map((e=>e.value)).join(""),y||Ue(h.Localizer.Diagnostic.namedTupleEmptyName(),l)):Ue(h.Localizer.Diagnostic.namedTupleNameString(),l||e),y||(y=`_${t.toString()}`),s.has(y)&&Ue(h.Localizer.Diagnostic.namedTupleNameUnique(),l||e),s.set(y,y),o||(o=x.UnknownType.create());const g={category:0,name:y,type:o,hasDeclaredType:n,hasDefault:t>=r};x.FunctionType.addParameter(d,g),f.push(o),m.push(y);const T=C.Symbol.createWithType(8,o);if(l&&48===l.nodeType){const e={type:1,node:l,path:i.filePath,typeAnnotationNode:a,range:p.convertOffsetsToRange(l.start,u.TextRange.getEnd(l),i.lines),moduleName:i.moduleName};T.addDeclaration(e)}c.set(y,T)}))}else g=!0}g&&(x.FunctionType.addDefaultParameters(d),f.push(x.AnyType.create(!1)),f.push(x.AnyType.create(!0)));const T=x.FunctionType.createInstance("__init__","","",192);x.FunctionType.addParameter(T,y),x.FunctionType.addDefaultParameters(T),T.details.declaredReturnType=x.NoneType.createInstance(),c.set("__new__",C.Symbol.createWithType(4,d)),c.set("__init__",C.Symbol.createWithType(4,T));const _=x.FunctionType.createInstance("keys","","",64),b=x.FunctionType.createInstance("items","","",64);_.details.declaredReturnType=Xn(e,"list",[Xn(e,"str")]),b.details.declaredReturnType=_.details.declaredReturnType,c.set("keys",C.Symbol.createWithType(8,_)),c.set("items",C.Symbol.createWithType(8,b));const I=x.FunctionType.createInstance("__len__","","",64);if(I.details.declaredReturnType=Xn(e,"int"),x.FunctionType.addParameter(I,y),c.set("__len__",C.Symbol.createWithType(4,I)),g){const t=x.FunctionType.createInstance("__getattribute__","","",64);t.details.declaredReturnType=x.AnyType.create(),x.FunctionType.addParameter(t,y),x.FunctionType.addParameter(t,{category:0,name:"name",type:Xn(e,"str")}),c.set("__getattribute__",C.Symbol.createWithType(4,t))}const S=Jn(e,"str");if(!g&&S&&x.isInstantiableClass(S)&&Q&&x.isInstantiableClass(Q)){const e=m.map((e=>x.ClassType.cloneAsInstance(x.ClassType.cloneWithLiteral(S,e)))),t=x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,e));c.set("__match_args__",C.Symbol.createWithType(4,t))}return k.computeMroLinearization(l),mt(l,f,!g),l}function Pt(e){return!(!E[e]||!E[e][2])||!!w[e]}function Et(e,t,n){const i=e.leftExpression;let s=e.rightExpression,r=!1;Pt(e.operator)&&7===s.nodeType&&!s.parenthesized&&Pt(s.operator)&&(Et(s,t,n),s=s.leftExpression);let a,o=37===e.operator||36===e.operator?t:void 0;26===e.operator&&t&&x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"list")&&t.typeArguments&&t.typeArguments.length>=1&&31===e.leftExpression.nodeType&&(a=t);const p=ge(i,o||a,n);let u=p.type;o||37!==e.operator&&36!==e.operator||(o=u);const m=ge(s,o,n);let y=m.type;if((p.isIncomplete||m.isIncomplete)&&(r=!0),6===e.operator&&!wt(u,"__or__")&&!wt(y,"__ror__")){let t=y;if(!x.isNone(u)&&x.isNone(y)&&x.TypeBase.isInstance(y)&&(t=x.NoneType.createType()),k.isUnionableType([u,t])){const i=ii(e);return i.isStubFile||0!=(4&n)||i.executionEnvironment.pythonVersion>=d.PythonVersion.V3_10||Ue(h.Localizer.Diagnostic.unionSyntaxIllegal(),e,e.operatorToken),{type:x.combineTypes([u,t]),node:e}}}void 0===w[e.operator]&&(k.isOptionalType(u)&&(12!==e.operator&&28!==e.operator&&Be(ii(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,h.Localizer.Diagnostic.noneOperator().format({operator:v.printOperator(e.operator)}),e.leftExpression),u=x.removeNoneFromUnion(u)),12!==e.operator&&28!==e.operator||(y=x.removeNoneFromUnion(y)));const g=new l.DiagnosticAddendum;let f=Rt(e.operator,u,y,e,t,g);if(!g.isEmpty()||!f||x.isNever(f)){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e.operator),leftType:Oi(u),rightType:Oi(y)})+g.getString(),e),f=x.UnknownType.create()}return{type:f,node:e,isIncomplete:r}}function wt(e,t){if(!x.isInstantiableClass(e))return!1;const n=e.details.effectiveMetaclass;if(!n||!x.isInstantiableClass(n))return!1;if(x.ClassType.isBuiltIn(n,"type"))return!1;const i=k.lookUpClassMember(n,t);return!!i&&(!x.isInstantiableClass(i.classType)||!x.ClassType.isBuiltIn(i.classType,"type"))}function Nt(e,t){const n={1:["__iadd__",0],34:["__isub__",33],27:["__imul__",26],14:["__ifloordiv__",13],11:["__itruediv__",10],25:["__imod__",24],30:["__ipow__",29],23:["__imatmul__",22],4:["__iand__",3],7:["__ior__",6],9:["__ixor__",8],18:["__ilshift__",17],32:["__irshift__",31]};let i;const s=new l.DiagnosticAddendum,r=ge(e.leftExpression),a=r.type,o=ge(e.rightExpression),p=o.type,d=!!o.isIncomplete||!!r.isIncomplete;if(i=qe(a,void 0,((i,r)=>qe(p,k.getTypeCondition(i),((a,o)=>{if(x.isAnyOrUnknown(r)||x.isAnyOrUnknown(o))return x.isUnknown(r)||x.isUnknown(o)?x.UnknownType.create():x.AnyType.create();const l=n[e.operator][0];let c=Mt(r,[o],l,e,t);if(c||r===i||(c=Mt(i,[o],l,e,t)),c||o===a||(c=Mt(i,[a],l,e,t)),!c){c=Rt(n[e.operator][1],r,o,e,t,s)}return c})))),!s.isEmpty()||!i||x.isNever(i)){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e.operator),leftType:Oi(a),rightType:Oi(p)})+s.getString(),e),i=x.UnknownType.create()}return{node:e,type:i,isIncomplete:d}}function Rt(e,t,n,i,s,r){let a,o=Ge(t);if(void 0!==w[e]){if(36===e){if(!k.canBeTruthy(o))return t;if(!k.canBeFalsy(o))return n;o=k.removeTruthinessFromType(o)}else if(37===e){if(!k.canBeFalsy(o))return t;if(!k.canBeTruthy(o))return n;o=k.removeFalsinessFromType(o)}41===e||42===e?(a=qe(n,void 0,((t,n)=>qe(o,k.getTypeCondition(t),(s=>{if(x.isAnyOrUnknown(s)||x.isAnyOrUnknown(n))return x.isUnknown(s)||x.isUnknown(n)?x.UnknownType.create():x.AnyType.create();let a=Mt(t,[s],"__contains__",i,void 0);if(!a){const e=xe(t,!1,void 0);e&&Di(e,s,new l.DiagnosticAddendum)&&(a=Xn(i,"bool"))}return a||r.addMessage(h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e),leftType:Oi(s),rightType:Oi(t)})),a})))),a&&!x.isNever(a)&&(a=Xn(i,"bool"))):a=qe(o,void 0,((t,s)=>qe(n,k.getTypeCondition(t),((t,n)=>36===e||37===e?x.combineTypes([s,n]):Xn(i,"bool")))))}else E[e]&&(a=qe(t,void 0,((t,a)=>qe(n,k.getTypeCondition(t),((n,o)=>{if(x.isAnyOrUnknown(a)||x.isAnyOrUnknown(o))return x.isUnknown(a)||x.isUnknown(o)?x.UnknownType.create():x.AnyType.create();if(0===e&&x.isClassInstance(t)&&k.isTupleClass(t)&&t.tupleTypeArguments&&!k.isOpenEndedTupleClass(t)&&x.isClassInstance(n)&&k.isTupleClass(n)&&n.tupleTypeArguments&&!k.isOpenEndedTupleClass(n)&&Q&&x.isInstantiableClass(Q))return x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,[...t.tupleTypeArguments,...n.tupleTypeArguments]));const l=E[e][0];let c=Mt(a,[o],l,i,s);if(c||a===t||(c=Mt(t,[o],l,i,s)),c||o===n||(c=Mt(t,[n],l,i,s)),!c){const r=E[e][1];c=Mt(o,[a],r,i,s),c||o===n||(c=Mt(n,[a],r,i,s)),c||a===t||(c=Mt(n,[t],r,i,s))}return c||r.addMessage(h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e),leftType:Oi(t),rightType:Oi(n)})),c})))));return a}function Mt(e,t,n,i,s){let r=!0;const a=e=>{var a,o;let l;const c=Ge(e);if(x.isClassInstance(c)?l=null===(a=be(i,c,n,void 0,void 0,64,e))||void 0===a?void 0:a.type:x.isInstantiableClass(c)&&(l=null===(o=Ie(i,c,n,void 0,void 0,96))||void 0===o?void 0:o.type),l){const e=t.map((e=>({argumentCategory:0,type:e})));let n;return ni(i,(()=>{n=It(i,e,l,void 0,!0,s)})),n.argumentErrors&&(r=!1),n.returnType}r=!1},o=k.mapSubtypes(e,(e=>{if(x.isAnyOrUnknown(e))return e;if(x.isClassInstance(e)||x.isInstantiableClass(e)||x.isTypeVar(e))return a(e);if(x.isNone(e)){const e=Xn(i,"object");if(x.isClassInstance(e))return a(e)}r=!1}));if(r)return o}function Ot(e,t,n){if(t=k.transformPossibleRecursiveTypeAlias(t),!x.isClassInstance(t))return;const i=[],s=[];if(x.ClassType.isTypedDictClass(t)){return Ut(e,i,s,!!t,void 0,void 0,Ei(t),n),x.ClassType.isTypedDictClass(t)&&function(e,t,n,i){o.assert(x.ClassType.isTypedDictClass(e)),o.assert(t.length===n.length);let s=!0;const r=Ei(e);if(t.forEach(((t,a)=>{if(x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"str")&&k.isLiteralType(t)){const o=t.literalValue,c=r.get(o);if(c){const e=new l.DiagnosticAddendum;Di(c.valueType,n[a],e)||(i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldTypeMismatch().format({name:t.literalValue,type:Oi(n[a])})),s=!1),c.isProvided=!0}else s=!1,i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldUndefined().format({name:t.literalValue,type:Oi(x.ClassType.cloneAsInstance(e))}))}else s=!1})),!s)return!1;return r.forEach(((t,n)=>{t.isRequired&&!t.isProvided&&(i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:n,type:Oi(x.ClassType.cloneAsInstance(e))})),s=!1)})),s}(t,i,s,n)?{type:t,node:e}:void 0}const r=Xn(e,"dict");if(!x.isClassInstance(r))return;const a=new P.TypeVarMap(k.getTypeVarScopeId(r));if(!bt(x.ClassType.cloneAsInstantiable(r),t,a,tt(e)))return;const c=k.applySolvedTypeVars(x.ClassType.cloneAsInstantiable(r),a);if(!c.typeArguments||2!==c.typeArguments.length)return;const p=c.typeArguments[0],d=c.typeArguments[1];Ut(e,i,s,!!t,p,d,void 0,n);const u=x.isClassInstance(t)&&(x.ClassType.isBuiltIn(t,"dict")||x.ClassType.isBuiltIn(t,"MutableMapping")),m=zt(p,i,!1),y=zt(d,s,!u);if(!m||!y)return;return{type:Xn(e,"dict",[m,y]),node:e}}function Lt(e,t){let n=t?x.AnyType.create():x.UnknownType.create(),i=t?x.AnyType.create():x.UnknownType.create(),s=[],r=[],a=!1;Ut(e,s,r,!t,t?x.AnyType.create():void 0,t?x.AnyType.create():void 0),s=s.map((e=>k.stripLiteralValue(e))),r=r.map((e=>k.stripLiteralValue(e))),n=s.length>0?x.combineTypes(s):t?x.AnyType.create():x.UnknownType.create(),r.length>0?i=ii(e).diagnosticRuleSet.strictDictionaryInference||t?x.combineTypes(r):k.areTypesSame(r,!0)?r[0]:t?x.AnyType.create():x.UnknownType.create():(i=t?x.AnyType.create():x.UnknownType.create(),a=!0);const o=Jn(e,"dict");return{type:x.isInstantiableClass(o)?x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(o,[n,i],!0,void 0,void 0,a)):x.UnknownType.create(),node:e}}function Ut(e,t,n,i,s,r,a,o){e.entries.forEach(((p,d)=>{let u=!0;if(17===p.nodeType){let e,c=ge(p.keyExpression,s).type;if(s){const e=Ge(s);x.isAnyOrUnknown(e)||Di(e,c,new l.DiagnosticAddendum,void 0)&&(c=e)}e=a&&x.isClassInstance(c)&&x.ClassType.isBuiltIn(c,"str")&&k.isLiteralType(c)&&a.has(c.literalValue)?ge(p.valueExpression,a.get(c.literalValue).valueType):ge(p.valueExpression,r),o&&e.expectedTypeDiagAddendum&&o.addAddendum(e.expectedTypeDiagAddendum);const h=e.type;(!i||d=2&&((!i||d{32===e.nodeType?o.push(Wt(e,a)):o.push(ge(e,a).type)}));const l=x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,n),c=zt(a,o,!l);if(!c)return;return{type:Xn(e,n,[c]),node:e}}function zt(e,t,n){const i=new l.DiagnosticAddendum,s=x.TypeVarType.createInstance("__typeArg");s.details.isSynthesized=!0,s.details.boundType=e,s.scopeId="__typeArgScopeId";let r=new P.TypeVarMap(x.WildcardTypeVarScopeId);if(r.setTypeVarType(s,n?void 0:e,e),!t.some((e=>!Di(s,k.stripLiteralValue(e),i,r)))||(r=new P.TypeVarMap(x.WildcardTypeVarScopeId),r.setTypeVarType(s,n?void 0:e,e,!0),!t.some((e=>!Di(s,e,i,r)))))return k.applySolvedTypeVars(s,r)}function Bt(e,t,n,i,s,r){if("none"===e)return;const a=n.value,o=x.removeUnbound(i);if(x.isUnknown(o))Be(e,t,h.Localizer.Diagnostic.typeUnknown().format({name:a}),s);else if(k.isPartlyUnknown(o)&&(!r||!x.isClassInstance(i)||!i.isEmptyContainer)){const n=new l.DiagnosticAddendum;n.addMessage(h.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:a,type:Oi(o,!0)})),Be(e,t,h.Localizer.Diagnostic.typePartiallyUnknown().format({name:a})+n.getString(),s)}}function Wt(e,t,n){for(const t of e.comprehensions)if(33===t.nodeType){const e=ge(t.iterableExpression),n=xe(k.stripLiteralValue(e.type),!!t.isAsync,t.iterableExpression)||x.UnknownType.create();Ke(t.targetExpression,n,!!e.isIncomplete,t.iterableExpression)}else o.assert(34===t.nodeType),W.isSpeculative(t.testExpression)||ge(t.testExpression);let i=x.UnknownType.create();if(17===e.expression.nodeType){let s=ge(e.expression.keyExpression,n).type;n&&k.containsLiteralType(n)||(s=k.stripLiteralValue(s));let r=ge(e.expression.valueExpression,t).type;t&&k.containsLiteralType(t)||(r=k.stripLiteralValue(r)),i=lt([s,r])}else 16===e.expression.nodeType?ge(e.expression.expandExpression,t):m.isExpressionNode(e)&&(i=ge(e.expression,t).type);return i}function jt(e,t=!1,n=!1,i=!1){if(e.typeList)return Ue(h.Localizer.Diagnostic.typeArgListNotAllowed(),e.node),!1;if(k.isEllipsisType(e.type))return Ue(h.Localizer.Diagnostic.ellipsisContext(),e.node),!1;if(x.isModule(e.type))return Ue(h.Localizer.Diagnostic.moduleContext(),e.node),!1;if(x.isParamSpec(e.type)&&!i)return Ue(h.Localizer.Diagnostic.paramSpecContext(),e.node),!1;if(x.isVariadicTypeVar(e.type)&&!e.type.isVariadicInUnion){if(!n)return Ue(h.Localizer.Diagnostic.typeVarTupleContext(),e.node),!1;at(e.type,e.node)}return!(!t&&e.isEmptyTupleShorthand)||(Ue(h.Localizer.Diagnostic.zeroLengthTupleNotAllowed(),e.node),!1)}function $t(e,t,n){const i=Xn(e,t);return x.isClassInstance(i)?x.ClassType.cloneWithLiteral(i,n):x.UnknownType.create()}function Gt(e,t,n){const i=Jn(e,t);return x.isInstantiableClass(i)?x.ClassType.cloneWithLiteral(i,n):x.UnknownType.create()}function qt(e,t,n,i=!1,s=!1){const r=x.ClassType.isTupleClass(e);if(t)if(r&&1===t.length&&t[0].isEmptyTupleShorthand)t=[];else{let e=!1,s=!1;t.forEach(((a,o)=>{k.isEllipsisType(a.type)?r?2!==t.length||1!==o?Ue(h.Localizer.Diagnostic.ellipsisSecondArg(),a.node):x.isTypeVar(t[0].type)&&x.isVariadicTypeVar(t[0].type)&&!t[0].type.isVariadicInUnion&&Ue(h.Localizer.Diagnostic.typeVarTupleContext(),t[0].node):Ue(h.Localizer.Diagnostic.ellipsisContext(),a.node):x.isParamSpec(a.type)&&i||(x.isVariadicTypeVar(a.type)&&void 0===n?(e&&(s||(Ue(h.Localizer.Diagnostic.variadicTypeArgsTooMany(),a.node),s=!0)),at(a.type,a.node),e=!0):jt(a))}))}let a,o=t?t.map((e=>k.convertToInstance(e.type))):[];if(void 0!==n)if(t&&o.length>n)Ue(h.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:n,received:o.length}),t[n].node),o=o.slice(0,n);else if(o.length{k.addTypeVarsToListIfUnique(i,k.getTypeVarArgumentsRecursive(e))})),i=i.filter((e=>!e.details.isSynthesized)),i=i.map((e=>x.TypeBase.isInstance(e)?e:k.convertToInstance(e)));const s=i.filter((e=>x.isVariadicTypeVar(e)));s.length>1&&Ue(h.Localizer.Diagnostic.variadicTypeParamTooManyAlias().format({names:s.map((e=>`"${e.details.name}"`)).join(", ")}),n);const r=ii(t);return x.TypeBase.cloneForTypeAlias(e,t.value,`${r.moduleName}.${t.value}`,et(t),i.length>0?i:void 0)}function Yt(t,n,i){const s=ii(t);let r=x.ClassType.createInstantiable(n,xt(t,s.moduleName,n),s.moduleName,s.filePath,3,0,void 0,void 0);s.isTypingExtensionsStubFile&&(r.details.flags|=65536);const a=i.alias||"object";let o;if("builtins"===i.module)o=Jn(t,a);else if("collections"===i.module){if(s.collectionsModulePath){const t=e(s.collectionsModulePath);if(t){const e=t.symbolTable.get(a);e&&(o=li(e))}}}else if("self"===i.module){const e=ei(t,a,!1);e&&(o=li(e.symbol),x.isInstantiableClass(o)&&x.ClassType.isBuiltIn(o,"_TypedDict")&&(o.details.flags&=-1537))}return o&&x.isInstantiableClass(o)?i.alias?r=x.ClassType.cloneForTypingAlias(o,n):(r.details.baseClasses.push(o),r.details.effectiveMetaclass=o.details.effectiveMetaclass,k.computeMroLinearization(r)):(r.details.baseClasses.push(x.UnknownType.create()),r.details.effectiveMetaclass=x.UnknownType.create(),k.computeMroLinearization(r)),r}function Qt(e){var t;const n=ii(e);if(re(e))return;let i,s=re(e.rightExpression),r=!1;if(!s&&((n.isTypingStubFile||n.isTypingExtensionsStubFile)&&(s=function(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value;if("Any"===t)return x.AnyType.create();const n=new Map([["overload",{alias:"",module:"builtins"}],["TypeVar",{alias:"",module:"builtins"}],["_promote",{alias:"",module:"builtins"}],["no_type_check",{alias:"",module:"builtins"}],["NoReturn",{alias:"",module:"builtins"}],["Counter",{alias:"Counter",module:"collections"}],["List",{alias:"list",module:"builtins"}],["Dict",{alias:"dict",module:"builtins"}],["DefaultDict",{alias:"defaultdict",module:"collections"}],["Set",{alias:"set",module:"builtins"}],["FrozenSet",{alias:"frozenset",module:"builtins"}],["Deque",{alias:"deque",module:"collections"}],["ChainMap",{alias:"ChainMap",module:"collections"}],["OrderedDict",{alias:"OrderedDict",module:"collections"}]]).get(t);return n?(ge(e.rightExpression),Yt(e,t,n)):void 0}(e),s&&ae(e.rightExpression,s,!1)),!s)){const a=Fe(e.leftExpression);let o,p=2;n.isStubFile&&(p|=256);let d,u=!1;if(De(e.leftExpression))p|=232,o=e.leftExpression.valueExpression;else if(38===e.leftExpression.nodeType){const t=ei(e.leftExpression,e.leftExpression.value,!1);if(t){const n=t.symbol.getDeclarations();1===n.length&&_.isPossibleTypeAliasDeclaration(n[0])&&(o=e.leftExpression,u=!0)}}if(o){d=x.TypeVarType.createInstantiable(`__type_alias_${o.value}`),d.details.isSynthesized=!0,d.details.recursiveTypeAliasName=o.value;const t=et(o);d.details.recursiveTypeAliasScopeId=t,d.scopeId=t,ae(e,d,!1),ae(e.leftExpression,d,!1)}const m=ge(e.rightExpression,a,p);let y=m.type;i=m.expectedTypeDiagAddendum,m.isIncomplete&&(r=!0);const g=I.evaluateStaticBoolExpression(e.rightExpression,n.executionEnvironment);if(void 0!==g){const t=Xn(e,"bool");x.isClassInstance(t)&&(y=x.ClassType.cloneWithLiteral(t,g))}if(a){Di(a,y,new l.DiagnosticAddendum)&&(y=ki(a,y))}s=y,38!==e.leftExpression.nodeType||e.typeAnnotationComment||(s=Kt(e.leftExpression,(()=>s))||s),o&&(oe(e),oe(e.leftExpression),(!u||x.TypeBase.isInstantiable(s)&&!x.isUnknown(s))&&(s=Ht(s,o,e.rightExpression),k.isTypeAliasRecursive(d,s)&&Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAliasIsRecursiveDirect().format({name:o.value}),e.rightExpression),d.details.boundType=s,d.details.recursiveTypeParameters=null===(t=s.typeAliasInfo)||void 0===t?void 0:t.typeParameters),d.details.illegalRecursionDetected&&Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAliasIsRecursiveIndirect().format({name:o.value}),e.leftExpression))}Ke(e.leftExpression,s,r,e.rightExpression,!0,i),ae(e,s,r)}function Zt(e){if(re(e))return;const t=Nt(e,void 0);Ke(e.destExpression,t.type,!!t.isIncomplete,e.rightExpression),ae(e,t.type,!!t.isIncomplete)}function Jt(e){const t=re(e.name);if(t){if(!x.isInstantiableClass(t))return;return{classType:t,decoratedType:re(e)||x.UnknownType.create()}}const n=b.getScopeForNode(e),i=ii(e);let s=0;(4===(null==n?void 0:n.type)||i.isTypingStubFile||i.isTypingExtensionsStubFile||i.isBuiltInStubFile)&&(s|=1,i.isTypingExtensionsStubFile&&(s|=65536),"property"===e.name.value&&(s|=2048),"tuple"===e.name.value&&(s|=524288)),i.isStubFile&&(s|=8388608);const r=x.ClassType.createInstantiable(e.name.value,xt(e,i.moduleName,e.name.value),i.moduleName,i.filePath,s,0,void 0,void 0,v.getDocString(e.suite.statements));r.details.typeVarScopeId=et(e);const a=null==n?void 0:n.lookUpSymbol(e.name.value);let o;const p=f.getDeclaration(e);p&&(o=p),o&&a&&ue(a,o,r),r.details.flags|=131072,ae(e,r,!1),ae(e.name,r,!1);const m=[];let y;const g=[];let T,_=10816;i.isStubFile&&(_|=4),e.arguments.forEach((e=>{if(e.name)if("metaclass"===e.name.value)T?Ue(h.Localizer.Diagnostic.metaclassDuplicate(),e):T=e.valueExpression;else if("total"===e.name.value&&x.ClassType.isTypedDictClass(r)){const t=I.evaluateStaticBoolExpression(e.valueExpression,i.executionEnvironment);void 0===t?Ue(h.Localizer.Diagnostic.typedDictTotalParam(),e.valueExpression):t||(r.details.flags|=256)}else g.push({argumentCategory:0,node:e,name:e.name,valueExpression:e.valueExpression});else{let t=ge(e.valueExpression,void 0,_).type;if(x.isUnion(t)&&(t=x.removeUnbound(t)),x.isAnyOrUnknown(t)||x.isUnbound(t)||(x.isInstantiableClass(t)?(x.ClassType.isBuiltIn(t,"Protocol")&&(!i.isStubFile&&!x.ClassType.isTypingExtensionClass(t)&&i.executionEnvironment.pythonVersion=d.PythonVersion.V3_6&&x.ClassType.isBuiltIn(t,"NamedTuple")&&(r.details.flags|=4),x.ClassType.isBuiltIn(t,"TypedDict")||x.ClassType.isTypedDictClass(t)?r.details.flags|=128:x.ClassType.isTypedDictClass(r)&&!x.ClassType.isTypedDictClass(t)&&Ue(h.Localizer.Diagnostic.typedDictBaseClass(),e),k.derivesFromClassRecursive(t,r,!0)&&(Ue(h.Localizer.Diagnostic.baseClassCircular(),e),t=x.UnknownType.create())):(Be(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.baseClassInvalid(),e),t=x.UnknownType.create())),x.isUnknown(t)&&Be(i.diagnosticRuleSet.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedBaseClass,h.Localizer.Diagnostic.baseClassUnknown(),e),r.details.baseClasses.some((e=>x.isInstantiableClass(e)&&x.isInstantiableClass(t)&&x.ClassType.isSameGenericClass(t,e)))&&Be(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.duplicateBaseClass(),e.name||e),r.details.baseClasses.push(t),x.isInstantiableClass(t)&&(x.ClassType.isEnumClass(t)&&(r.details.flags|=1048576),(x.ClassType.supportsAbstractMethods(t)||x.ClassType.isProtocolClass(t)&&!x.ClassType.isBuiltIn(t))&&(r.details.flags|=512),x.ClassType.isPropertyClass(t)&&(r.details.flags|=2048),x.ClassType.isFinal(t))){const n=Mi(t);Ue(h.Localizer.Diagnostic.baseClassFinal().format({type:n}),e.valueExpression)}k.addTypeVarsToListIfUnique(m,k.getTypeVarArgumentsRecursive(t)),x.isInstantiableClass(t)&&x.ClassType.isBuiltIn(t,"Generic")&&(y||(y=[],k.addTypeVarsToListIfUnique(y,k.getTypeVarArgumentsRecursive(t))))}})),r.details.baseClasses.length>1&&r.details.baseClasses.some((e=>x.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"NamedTuple")))&&Be(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.namedTupleMultipleInheritance(),e.name),x.ClassType.isBuiltIn(r,"object")||r.details.baseClasses.push(Jn(e,"object")),y&&function(e,t,n){const i=t.filter((e=>!n.some((t=>t.details.name===e.details.name))));if(i.length>0){const t=new l.DiagnosticAddendum;t.addMessage(h.Localizer.DiagnosticAddendum.typeVarsMissing().format({names:i.map((e=>`"${e.details.name}"`)).join(", ")})),Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarsNotInGeneric()+t.getString(),e)}}(e.name,m,y),r.details.typeParameters=y||m;const C=r.details.typeParameters.filter((e=>x.isVariadicTypeVar(e)));C.length>1&&Ue(h.Localizer.Diagnostic.variadicTypeParamTooManyClass().format({names:C.map((e=>`"${e.details.name}"`)).join(", ")}),e.name,u.TextRange.combine(e.arguments)||e.name),k.computeMroLinearization(r)||Ue(h.Localizer.Diagnostic.methodOrdering(),e.name);const S=b.getScopeForNode(e.suite);r.details.fields=(null==S?void 0:S.symbolTable)||new Map;const D=null==S?void 0:S.getSlotsNames();if(D){r.details.localSlotsNames=D;let e=!0;const t=[...D];r.details.baseClasses.forEach((n=>{x.isInstantiableClass(n)?x.ClassType.isBuiltIn(n,"object")||x.ClassType.isBuiltIn(n,"type")||x.ClassType.isBuiltIn(n,"Generic")||(void 0===n.details.inheritedSlotsNames?e=!1:t.push(...n.details.inheritedSlotsNames)):e=!1})),e&&(r.details.inheritedSlotsNames=t)}if(x.ClassType.isTypedDictClass(r)&&Ee(e,r),!i.isStubFile&&0===r.details.typeParameters.length){const t=r.details.fields.get("__init__");if(t){const n=t.getTypedDeclarations();if(1===n.length&&3===n[0].type){const t=n[0].node,i=t.parameters;if(i.length>1&&!i.some(((e,n)=>!!Se(t,n)))){const n=i.filter(((e,t)=>t>0&&e.name&&0===e.category));n.length>0&&(r.details.flags|=16384,r.details.typeParameters=n.map((n=>{const i=x.TypeVarType.createInstance(`__type_of_${n.name.value}`);return i.details.isSynthesized=!0,i.scopeId=et(t),i.details.boundType=x.UnknownType.create(),x.TypeVarType.cloneForScopeId(i,et(e),e.name.value)})))}}}}if(0===r.details.typeParameters.length&&(r.details.baseClasses.some((e=>x.isInstantiableClass(e)&&x.ClassType.hasCustomClassGetItem(e)))||r.details.fields.has("__class_getitem__"))&&(r.details.flags|=262144),T){const e=ge(T,void 0,_).type;(x.isInstantiableClass(e)||x.isUnknown(e))&&(r.details.declaredMetaclass=e,x.isInstantiableClass(e)&&(x.ClassType.isBuiltIn(e,"EnumMeta")?r.details.flags|=1048576:x.ClassType.isBuiltIn(e,"ABCMeta")&&(r.details.flags|=512)))}let F=r.details.declaredMetaclass,A=!1;if(!F||x.isInstantiableClass(F))for(const t of r.details.baseClasses){if(!x.isInstantiableClass(t)){F=x.UnknownType.create();break}{const n=t.details.effectiveMetaclass||Y;if(!n||!x.isInstantiableClass(n)){F=n?x.UnknownType.create():void 0;break}F?k.derivesFromClassRecursive(n,F,!1)?F=n:k.derivesFromClassRecursive(F,n,!1)||A||(Be(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.metaclassConflict(),e.name),A=!0):F=n}}if(!F){const t=Jn(e,"type");F=t&&x.isInstantiableClass(t)?t:x.UnknownType.create()}if(r.details.effectiveMetaclass=F,x.ClassType.supportsAbstractMethods(r)&&Pi(r).length>0&&(r.details.flags|=1024),x.ClassType.isProtocolClass(r)&&r.details.fields.get("__call__")&&!r.details.baseClasses.find((e=>x.isInstantiableClass(e)&&!x.ClassType.isBuiltIn(e,"object")&&!x.ClassType.isBuiltIn(e,"Protocol")))){let e=0;r.details.fields.forEach(((t,n)=>{t.isIgnoredForProtocolMatch()||e++})),1===e&&(r.details.flags|=4194304)}let P=r,E=!1;for(let t=e.decorators.length-1;t>=0;t--){const n=e.decorators[t],s=tn(P,r,n);k.containsUnknown(s)?E||(Be(i.diagnosticRuleSet.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedClassDecorator,h.Localizer.Diagnostic.classDecoratorTypeUnknown(),e.decorators[t].expression),E=!0):P=s}if(x.isInstantiableClass(F)&&F.details.metaclassDataClassTransform&&(sn(r,F.details.metaclassDataClassTransform),function(e,t,n){n.forEach((e=>{e.valueExpression&&e.name&&nn(e.name,t,e.name.value,e.valueExpression)}))}(0,r,g)),r.details.flags&=-131073,x.ClassType.isDataClass(r)){let t=x.ClassType.isSkipSynthesizedDataClassInit(r);if(!t){const e=k.lookUpClassMember(r,"__init__",2);if(e){const n=gi(e);x.isFunction(n)&&x.FunctionType.isSynthesizedMethod(n)||(t=!0)}}Pe(e,r,t)}return ae(e.name,r,!1),ae(e,P,!1),function(e,t,n){const i=n.length>0?n[0].node.name:e.name,s=it(i,t,"__init_subclass__",{method:"get"},new l.DiagnosticAddendum,133,t);if(s){const e=s.type;e&&It(i,n,e,void 0,!1,x.NoneType.createInstance())}n.forEach((e=>{e.valueExpression&&ge(e.valueExpression)}))}(e,r,g),{classType:r,decoratedType:P}}function Xt(e){if(9!==e.nodeType)return;const t={keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:[]},n=ii(e);return e.arguments.forEach((e=>{if(e.name&&0===e.argumentCategory)switch(e.name.value){case"kw_only_default":{const i=I.evaluateStaticBoolExpression(e.valueExpression,n.executionEnvironment);if(void 0===i)return;t.keywordOnlyParams=i;break}case"eq_default":{const i=I.evaluateStaticBoolExpression(e.valueExpression,n.executionEnvironment);if(void 0===i)return;t.generateEq=i;break}case"order_default":{const i=I.evaluateStaticBoolExpression(e.valueExpression,n.executionEnvironment);if(void 0===i)return;t.generateOrder=i;break}case"field_descriptors":{const n=ge(e.valueExpression).type;if(!x.isClassInstance(n)||!x.ClassType.isBuiltIn(n,"tuple")||!n.tupleTypeArguments||n.tupleTypeArguments.some((e=>!x.isInstantiableClass(e)&&!x.isFunction(e)&&!x.isOverloadedFunction(e))))return;t.fieldDescriptorNames||(t.fieldDescriptorNames=[]),n.tupleTypeArguments.forEach((e=>{x.isInstantiableClass(e)||x.isFunction(e)?t.fieldDescriptorNames.push(e.details.fullName):x.isOverloadedFunction(e)&&t.fieldDescriptorNames.push(e.overloads[0].details.fullName)}));break}}})),t}function en(e){let t;if(x.isFunction(e)?t=e:x.isOverloadedFunction(e)&&(t=e.overloads[0]),t)return t.details.decoratorDataClassBehaviors?t.details.decoratorDataClassBehaviors:"dataclasses.dataclass"===t.details.fullName?{keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:["dataclasses.field","dataclasses.Field"]}:void 0}function tn(e,t,n){const i=ge(n.expression).type;if(9===n.expression.nodeType){const e=ge(n.expression.leftExpression).type;x.isFunction(e)&&"__dataclass_transform__"===e.details.name&&(t.details.metaclassDataClassTransform=Xt(n.expression))}if(x.isOverloadedFunction(i)){const e=en(i);e&&rn(t,e,void 0)}else if(x.isFunction(i)){let s,r;if("final"===i.details.builtInName?t.details.flags|=4096:"runtime_checkable"===i.details.builtInName&&(t.details.flags|=32768),9===n.expression.nodeType){r=n.expression;s=en(ge(r.leftExpression).type)}else{s=en(ge(n.expression).type)}if(s)return rn(t,s,r),e}return ve(n,e)}function nn(e,t,n,i){const s=ii(e),r=I.evaluateStaticBoolExpression(i,s.executionEnvironment);switch(n){case"order":!0===r?t.details.flags|=64:!1===r&&(t.details.flags&=-65);break;case"kw_only":!1===r?t.details.flags&=-2097153:!0===r&&(t.details.flags|=2097152);break;case"frozen":{let n=!1,i=!1;t.details.baseClasses.forEach((e=>{x.isInstantiableClass(e)&&x.ClassType.isDataClass(e)&&(x.ClassType.isFrozenDataClass(e)?i=!0:e.details.declaredMetaclass&&x.isInstantiableClass(e.details.declaredMetaclass)&&e.details.declaredMetaclass.details.metaclassDataClassTransform||(n=!0))})),(!0===r||i)&&(t.details.flags|=8,n&&Be(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.dataClassBaseClassNotFrozen(),e));break}case"init":!1===r?t.details.flags|=16:!0===r&&(t.details.flags&=-17);break;case"eq":!1===r?t.details.flags|=32:!0===r&&(t.details.flags&=-33)}}function sn(e,t){e.details.dataClassBehaviors=t,e.details.flags|=4,t.keywordOnlyParams&&(e.details.flags|=2097152),t.generateEq||(e.details.flags|=32),t.generateOrder&&(e.details.flags|=64)}function rn(e,t,n){sn(e,t),(null==n?void 0:n.arguments)&&n.arguments.forEach((t=>{t.name&&t.valueExpression&&nn(t,e,t.name.value,t.valueExpression)}))}function an(e){const n=ii(e),i=re(e.name);if(i){if(!x.isFunction(i))return;return{functionType:i,decoratedType:re(e)||x.UnknownType.create()}}let s;const r=f.getDeclaration(e);r&&(s=r);const a=v.getEnclosingClass(e,!0);let o;if(a){const e=Jt(a);if(!e)return;o=e.classType}let p=cn(e,!!a);(null==s?void 0:s.isGenerator)&&(p|=16),a&&"__class_getitem__"===e.name.value&&(p|=2),n.isStubFile?p|=2048:n.isInPyTypedPackage&&t.disableInferenceForPyTypedSources&&(p|=4096),e.isAsync&&(p|=512);const d=x.FunctionType.createInstance(e.name.value,function(e,t,n){const i=[n];let s=e;for(;s;)s=v.getEnclosingClassOrFunction(s),s&&i.push(s.name.value);return i.push(t),i.reverse().join(".")}(e,n.moduleName,e.name.value),n.moduleName,p,v.getDocString(e.suite.statements));d.details.typeVarScopeId=et(e),(n.isBuiltInStubFile||n.isTypingStubFile||n.isTypingExtensionsStubFile)&&(d.details.builtInName=e.name.value),d.details.declaration=s;const u=b.getScopeForNode(e),m=null==u?void 0:u.lookUpSymbolRecursive(e.name.value);s&&m&&ue(m.symbol,s,d),ae(e,d,!1),ae(e.name,d,!1);const y=o&&x.ClassType.isPseudoGenericClass(o)&&"__init__"===e.name.value,g=[];let T=0,_=0;if(o&&0==(4&d.details.flags)&&(_=1),e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=e.parameters.length-_,n=e.functionAnnotationComment.paramTypeAnnotations.length;_>0&&n===e.parameters.length?_=0:n!==t&&Ue(h.Localizer.Diagnostic.annotatedParamCountMismatch().format({expected:t,received:n}),e.functionAnnotationComment)}const I=e=>{if(e.name){const t=ei(e.name,e.name.value,!1);t&&Ye(n,t.symbol,e.name)}};if(e.parameters.forEach(((t,i)=>{let s,r,a,p,u=!1;if(t.name&&(0===i&&o&&(x.FunctionType.isClassMethod(d)||x.FunctionType.isInstanceMethod(d)||x.FunctionType.isConstructorMethod(d))||x.FunctionType.isAbstractMethod(d)||o&&x.ClassType.isProtocolClass(o))&&I(t),t.typeAnnotation)a=t.typeAnnotation;else if(t.typeAnnotationComment)a=t.typeAnnotationComment;else if(e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=i-_;t>=0&&t0&&0===t.category&&t.name&&(r=o.details.typeParameters[T],T++),r&&t.defaultValue&&11===t.defaultValue.nodeType&&26===t.defaultValue.constType&&(u=!0,n.diagnosticRuleSet.strictParameterNoneValue||(r=x.combineTypes([r,x.NoneType.createInstance()]))),t.defaultValue&&(p=ge(t.defaultValue,r,1).type),r){if(t.defaultValue&&p){const i=new l.DiagnosticAddendum,s=new P.TypeVarMap(d.details.typeVarScopeId);if(o&&void 0!==o.details.typeVarScopeId&&("__init__"!==e.name.value&&"__new__"!==e.name.value||s.addSolveForScope(o.details.typeVarScopeId)),!Di(r,p,i,s)){const e=Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramAssignmentMismatch().format({sourceType:Oi(p),paramType:Oi(r)})+i.getString(),t.defaultValue);if(u&&a){const t={action:"pyright.addoptionalforparam",offsetOfTypeNode:a.start+1};e&&e.addAction(t)}}}s=r}const m={category:t.category,name:t.name?t.name.value:void 0,hasDefault:!!t.defaultValue,defaultValueExpression:t.defaultValue,defaultType:p,type:s||x.UnknownType.create(),typeAnnotation:a,hasDeclaredType:!!a};if(x.FunctionType.addParameter(d,m),t.name){const n=ln(e,t.category,m.type);g.push(n)}else g.push(m.type)})),o&&d.details.parameters.length>0){if(!Se(e,0)){const t=on(d.details.flags,o,e);t&&(d.details.parameters[0].type=t,x.isAnyOrUnknown(t)||(d.details.parameters[0].isTypeInferred=!0),g[0]=t)}}if(g.forEach(((t,n)=>{const i=e.parameters[n].name;i&&(x.isUnknown(t)&&(d.details.flags|=16384),ae(i,t,!1))})),e.returnTypeAnnotation){d.details.declaredReturnType=x.UnknownType.create();const t=_e(e.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else if(e.functionAnnotationComment){d.details.declaredReturnType=x.UnknownType.create();const t=_e(e.functionAnnotationComment.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else n.isStubFile&&("__init__"===e.name.value?d.details.declaredReturnType=x.NoneType.createInstance():d.details.declaredReturnType=x.UnknownType.create());let C=e.isAsync?function(e,t){var n;const i=x.FunctionType.clone(t);t.details.declaredReturnType&&(i.details.declaredReturnType=hn(e,t.details.declaredReturnType,!!(null===(n=t.details.declaration)||void 0===n?void 0:n.isGenerator)));return i.details.flags|=1024,i}(e,d):d,S=!1;for(let t=e.decorators.length-1;t>=0;t--){const i=e.decorators[t],s=pn(C,d,i,e);k.containsUnknown(s)?S||(Be(n.diagnosticRuleSet.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedFunctionDecorator,h.Localizer.Diagnostic.functionDecoratorTypeUnknown(),e.decorators[t].expression),S=!0):C=s}return x.isFunction(C)&&(x.FunctionType.isOverloaded(C)&&e.parameters.forEach((e=>{I(e)})),C=function(e,t){let n;const i=f.getDeclaration(e);i&&(n=i);const s=ei(e,e.name.value,!1);if(s){const i=s.symbol.getDeclarations(),r=i.findIndex((e=>e===n));if(r>0){for(let e=0;e{e.isIgnoredForProtocolMatch()||a.set(t,e)}));const o=ii(n);if("none"!==o.diagnosticRuleSet.reportPropertyTypeMismatch&&n.parameters.length>=2){const e=Se(n,1);if(e){const t=Ii(i,!1);if(t&&!x.isAnyOrUnknown(t)){const n=_e(e),i=new l.DiagnosticAddendum;Di(t,n,i)||Be(o.diagnosticRuleSet.reportPropertyTypeMismatch,c.DiagnosticRule.reportPropertyTypeMismatch,h.Localizer.Diagnostic.setterGetterTypeMismatch()+i.getString(),e)}}}const p=C.Symbol.createWithType(4,t);a.set("fset",p);const d=x.FunctionType.createInstance("__set__","","",64);d.details.parameters.push({category:0,name:"self",type:e,hasDeclaredType:!0});let u=t.details.parameters.length>0?t.details.parameters[0].type:x.AnyType.create();x.isTypeVar(u)&&u.details.isSynthesized&&u.details.boundType&&(u=Ge(u));d.details.parameters.push({category:0,name:"obj",type:x.combineTypes([u,x.NoneType.createInstance()]),hasDeclaredType:!0}),d.details.declaredReturnType=x.NoneType.createInstance();let m=x.UnknownType.create();t.details.parameters.length>=2&&0===t.details.parameters[1].category&&t.details.parameters[1].name&&(m=t.details.parameters[1].type);d.details.parameters.push({category:0,name:"value",type:m,hasDeclaredType:!0});const y=C.Symbol.createWithType(4,d);return a.set("__set__",y),r}(t,e,i)):e;if("deleter"===s)return x.isFunction(e)?(dn(e,n),function(e,t,n){if(!k.isProperty(e))return e;const i=e,s=x.ClassType.createInstantiable(i.details.name,i.details.fullName,i.details.moduleName,ii(n).filePath,i.details.flags,i.details.typeSourceId,i.details.declaredMetaclass,i.details.effectiveMetaclass);k.computeMroLinearization(s);const r=x.ClassType.cloneAsInstance(s),a=s.details.fields;i.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||a.set(t,e)}));const o=C.Symbol.createWithType(4,t);a.set("fdel",o);const l=x.FunctionType.createInstance("__delete__","","",64);l.details.parameters.push({category:0,name:"self",type:e,hasDeclaredType:!0});let c=t.details.parameters.length>0?t.details.parameters[0].type:x.AnyType.create();x.isTypeVar(c)&&c.details.isSynthesized&&c.details.boundType&&(c=Ge(c));l.details.parameters.push({category:0,name:"obj",type:x.combineTypes([c,x.NoneType.createInstance()]),hasDeclaredType:!0}),l.details.declaredReturnType=x.NoneType.createInstance();const p=C.Symbol.createWithType(4,l);return a.set("__delete__",p),r}(t,e,i)):e}}}else if(x.isInstantiableClass(r)){if(x.ClassType.isBuiltIn(r))switch(r.details.name){case"classmethod":case"staticmethod":return e}if(x.ClassType.isPropertyClass(r)){if(x.isFunction(e))return dn(e,n),un(n,r.details.name,e,Li(n));if(x.isClassInstance(e)){const t=k.lookUpObjectMember(e,"__call__");if(t){const i=gi(t);if(x.isFunction(i)||x.isOverloadedFunction(i)){const t=Ni(e,i);if(t&&x.isFunction(t))return un(n,r.details.name,t,Li(n))}}return x.UnknownType.create()}}}return x.isFunction(e)&&x.isFunction(a)&&(a=x.FunctionType.clone(a),x.FunctionType.isOverloaded(e)&&(a.details.flags|=256),a.details.docString||(a.details.docString=e.details.docString)),a}function dn(e,t){x.FunctionType.isStaticMethod(e)&&Be(ii(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.propertyStaticMethod(),t)}function un(e,t,n,i){const s=ii(e),r=Jn(e,"type"),a=x.ClassType.createInstantiable(t,xt(e,s.moduleName,`__property_${n.details.name}`),s.moduleName,s.filePath,2048,i,void 0,x.isInstantiableClass(r)?r:x.UnknownType.create());k.computeMroLinearization(a);const o=x.ClassType.cloneAsInstance(a),l=a.details.fields,c=C.Symbol.createWithType(4,n);l.set("fget",c);const p=x.FunctionType.createInstance("__get__","","",320);p.details.parameters.push({category:0,name:"self",type:o,hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"obj",type:x.NoneType.createInstance(),hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"type",type:x.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:x.AnyType.create()}),p.details.declaredReturnType=x.FunctionType.isClassMethod(n)?x.FunctionType.getSpecializedReturnType(n):o,p.details.declaration=n.details.declaration;const d=x.FunctionType.createInstance("__get__","","",320);d.details.parameters.push({category:0,name:"self",type:o,hasDeclaredType:!0});let u=n.details.parameters.length>0?n.details.parameters[0].type:x.AnyType.create();x.isTypeVar(u)&&u.details.isSynthesized&&u.details.boundType&&(u=Ge(u)),d.details.parameters.push({category:0,name:"obj",type:x.FunctionType.isClassMethod(n)?k.convertToInstance(u):u,hasDeclaredType:!0}),d.details.parameters.push({category:0,name:"type",type:x.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:x.AnyType.create()}),d.details.declaredReturnType=x.FunctionType.getSpecializedReturnType(n),d.details.declaration=n.details.declaration,d.details.typeVarScopeId=k.getTypeVarScopeId(n);const h=x.OverloadedFunctionType.create([p,d]),m=C.Symbol.createWithType(4,h);return l.set("__get__",m),["getter","setter","deleter"].forEach((e=>{const t=x.FunctionType.createInstance(e,"","",64);t.details.parameters.push({category:0,name:"self",type:x.AnyType.create(),hasDeclaredType:!0}),t.details.parameters.push({category:0,name:"accessor",type:x.AnyType.create(),hasDeclaredType:!0}),t.details.declaredReturnType=o;const n=C.Symbol.createWithType(4,t);l.set(e,n)})),o}function hn(e,t,n){let i;if(x.isClassInstance(t)&&x.ClassType.isBuiltIn(t))if("Generator"===t.details.name){const n=we(e,"AsyncGenerator");if(n&&x.isInstantiableClass(n)){const e=[],s=t.typeArguments;s&&s.length>0&&e.push(s[0]),s&&s.length>1&&e.push(s[1]),i=x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(n,e,!0))}}else["AsyncGenerator","AsyncIterator","AsyncIterable"].some((e=>e===t.details.name))&&(i=t);if(!i||!n){const n=we(e,"Coroutine");i=n&&x.isInstantiableClass(n)?x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(n,[x.AnyType.create(),x.AnyType.create(),t],!0)):x.UnknownType.create()}return i}function mn(e,t){var n;if(e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation))return;let i=re(e.suite);if(i)return i;if(!L.has(e.id)){L.set(e.id,!0);try{let n;const s=f.getDeclaration(e);s&&(n=s);const r=!Me(e),a=Me(e.suite);if(ii(e).isStubFile)i=x.UnknownType.create();else{if(r)if(t||function(e){if(!e||!e.isMethod||e.returnStatements||e.yieldStatements||!e.raiseStatements)return!1;for(const t of e.raiseStatements){if(!t.typeExpression||t.valueExpression)return!1;const e=ge(t.typeExpression).type,n=x.isInstantiableClass(e)||x.isClassInstance(e)?e:void 0;if(!n||!x.ClassType.isBuiltIn(n,"NotImplementedError"))return!1}return!0}(n))i=x.UnknownType.create();else{const t=we(e,"NoReturn");i=t&&x.isInstantiableClass(t)?x.ClassType.cloneAsInstance(t):x.UnknownType.create()}else{const e=[];(null==n?void 0:n.returnStatements)&&n.returnStatements.forEach((t=>{if(Re(t))if(t.returnExpression){const n=ge(t.returnExpression).type;e.push(n||x.UnknownType.create())}else e.push(x.NoneType.createInstance())})),!r&&a&&e.push(x.NoneType.createInstance()),i=x.combineTypes(e),i=x.removeUnbound(i),i=k.removeNoReturnFromUnion(i)}if(null==n?void 0:n.isGenerator){const t=[];n.yieldStatements&&n.yieldStatements.forEach((e=>{if(Re(e))if(61===e.nodeType){const n=xe(ge(e.expression).type,!1,e);t.push(n||x.UnknownType.create())}else if(e.expression){const n=ge(e.expression).type;t.push(n||x.UnknownType.create())}else t.push(x.NoneType.createInstance())})),0===t.length&&t.push(x.NoneType.createInstance());const s=x.combineTypes(t),r=we(e,"Generator");i=r&&x.isInstantiableClass(r)?x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(r,[s,x.NoneType.createInstance(),k.isNoReturnType(i)?x.NoneType.createInstance():i],!0)):x.UnknownType.create()}}ae(e.suite,i,!1)}finally{L.delete(e.id)}}return i}function yn(e){if(re(e))return;const t=ge(e.iterableExpression),n=xe(t.type,!!e.isAsync,e.iterableExpression)||x.UnknownType.create();Ke(e.targetExpression,n,!!t.isIncomplete,e.targetExpression),ae(e,n,!!t.isIncomplete)}function gn(e){if(o.assert(void 0!==e.typeExpression),re(e))return;const t=ge(e.typeExpression).type;function n(e,t){if(e=Ge(e),x.isAnyOrUnknown(e))return e;if(x.isInstantiableClass(e))return x.ClassType.cloneAsInstance(e);if(x.isClassInstance(e)){const n=xe(e,!1,t)||x.UnknownType.create();return k.mapSubtypes(n,(e=>x.isAnyOrUnknown(e)?e:x.UnknownType.create()))}return x.UnknownType.create()}const i=k.mapSubtypes(t,(t=>{const i=k.getSpecializedTupleType(t);if(i&&i.tupleTypeArguments){const t=i.tupleTypeArguments.map((t=>n(t,e.typeExpression)));return x.combineTypes(t)}return n(t,e.typeExpression)}));e.name&&Ke(e.name,i,!1,e.name),ae(e,i,!1)}function fn(e){if(re(e))return;const t=ge(e.expression);let n=t.type;const i=e.parent&&58===e.parent.nodeType&&!!e.parent.isAsync;if(k.isOptionalType(n)){Be(ii(e).diagnosticRuleSet.reportOptionalContextManager,c.DiagnosticRule.reportOptionalContextManager,h.Localizer.Diagnostic.noneNotUsableWith(),e.expression),n=x.removeNoneFromUnion(n)}const s=i?"__aenter__":"__enter__",r=k.mapSubtypes(n,(t=>{var n;if(t=Ge(t),x.isAnyOrUnknown(t))return t;const r=new l.DiagnosticAddendum,a=new l.DiagnosticAddendum;if(x.isClassInstance(t)){const o=null===(n=be(e.expression,t,s,{method:"get"},r))||void 0===n?void 0:n.type;if(o){let t;return t=x.isFunction(o)?ui(o):x.UnknownType.create(),i&&(t=Ae(t,e)),t}if(!i){be(e.expression,t,"__aenter__",{method:"get"},r)&&a.addMessage(h.Localizer.DiagnosticAddendum.asyncHelp())}}return Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotUsableWith().format({type:Oi(t),method:s})+a.getString(),e.expression),x.UnknownType.create()})),a=i?"__aexit__":"__exit__";k.doForEachSubtype(n,(t=>{if(t=Ge(t),x.isAnyOrUnknown(t))return;const n=new l.DiagnosticAddendum;if(x.isClassInstance(t)){if(be(e.expression,t,a,{method:"get"},n))return}Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotUsableWith().format({type:Oi(t),method:a}),e.expression)})),e.target&&Ke(e.target,r,!!t.isIncomplete,e.target),ae(e,r,!!t.isIncomplete)}function Tn(e){if(re(e))return;let t;if(t=e.alias?e.alias:e.module.nameParts[0],!t)return;let n=Pn(e,t.value)||x.UnknownType.create();const i=re(e);i&&x.isModule(i)&&n&&x.isTypeSame(n,i)&&(n=i),je(t,n,!1),ae(e,n,!1)}function _n(t){var n;if(re(t))return;const i=t.alias||t.name,s=ii(t);if((null===(n=t.alias)||void 0===n?void 0:n.value)===t.name.value){const e=ei(t,t.name.value,!0);e&&Ye(s,e.symbol,t)}let r=Pn(t,i.value);if(!r){const n=t.parent;o.assert(n&&22===n.nodeType),o.assert(!n.isWildcardImport);const i=f.getImportInfo(n.module);if(i&&i.isImportFound&&!i.isNativeLib){const n=i.resolvedPaths[i.resolvedPaths.length-1],a=e(n);let o=!1;if(a){if(o=!0,s.executionEnvironment.pythonVersion>=d.PythonVersion.V3_7||s.isStubFile){const e=a.symbolTable.get("__getattr__");if(e){const t=li(e);x.isFunction(t)&&(r=ui(t),o=!1)}}}else n||(o=!0);o&&Be(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.importSymbolUnknown().format({name:t.name.value}),t.name)}r||(r=x.UnknownType.create())}je(i,r,!1),ae(t,r,!1)}function vn(e){if(re(e))return;const t=ge(e.subjectExpression);let n=t.type;for(const t of e.cases)t.guardExpression||(n=In(n,t.pattern,!1));ae(e,n,!!t.isIncomplete)}function bn(e){if(re(e))return;if(!e.parent||63!==e.parent.nodeType)return void o.fail("Expected parent of case statement to be match statement");const t=ge(e.parent.subjectExpression);let n=t.type;for(const t of e.parent.cases){if(t===e)break;t.guardExpression||(n=In(n,t.pattern,!1))}n=In(n,e.pattern,!0),xn(n,!!t.isIncomplete,e.pattern),ae(e,n,!!t.isIncomplete)}function In(e,t,n){switch(t.nodeType){case 65:return function(e,t,n){if(!n)return e;let i=Fn(e,t.entries.length,t.starEntryIndex);return i=i.filter((e=>{let n=!0;const i=[];let s=e.isTuple;return t.entries.forEach(((r,a)=>{const o=In(An(e,a,t.entries.length,t.starEntryIndex),r,!0);a===t.starEntryIndex?x.isClassInstance(o)&&o.tupleTypeArguments&&!k.isOpenEndedTupleClass(o)&&o.tupleTypeArguments?i.push(...o.tupleTypeArguments):s=!1:i.push(o),x.isNever(o)&&(n=!1)})),n&&s&&Q&&x.isInstantiableClass(Q)&&(e.subtype=x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,i))),n})),x.combineTypes(i.map((e=>e.subtype)))}(e,t,n);case 67:return function(e,t,n){const i=ge(t.expression).type;if(!n)return k.mapSubtypes(e,(e=>{if(!(x.isClassInstance(i)&&k.isLiteralType(i)&&x.isClassInstance(e)&&k.isLiteralType(e)&&Di(i,e,new l.DiagnosticAddendum)))return x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"bool")&&void 0===e.literalValue&&x.isClassInstance(i)&&x.ClassType.isBuiltIn(i,"bool")&&void 0!==i.literalValue?x.ClassType.cloneWithLiteral(i,!i.literalValue):e}));return k.mapSubtypes(e,(e=>{if(Di(e,i,new l.DiagnosticAddendum))return i}))}(e,t,n);case 68:return function(e,t,n){const i=ge(t.className).type;if(!n){if(!x.isInstantiableClass(i))return e;let n=t.arguments.length>0;if(1===t.arguments.length&&!t.arguments[0].name&&M.some((e=>i.details.fullName===e))&&(n=!1),n)return e;if(i.details.typeParameters.length>0)return e;const s=new l.DiagnosticAddendum,r=k.convertToInstance(i);return k.mapSubtypes(e,(e=>{if(!Di(r,e,s))return e}))}if(!x.TypeBase.isInstantiable(i))return Be(ii(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.DiagnosticAddendum.typeNotClass().format({type:Oi(i)}),t.className),x.NeverType.create();return qe(i,void 0,((n,i)=>x.isAnyOrUnknown(n)?i:x.isInstantiableClass(n)?k.mapSubtypes(e,(e=>{const s=Ge(e);if(x.isAnyOrUnknown(s))return e;if(x.isClassInstance(s)){let r;if(Di(n,x.ClassType.cloneAsInstantiable(s),new l.DiagnosticAddendum))r=e;else{if(!Di(x.ClassType.cloneAsInstantiable(s),n,new l.DiagnosticAddendum))return;r=k.convertToInstance(i)}let a=[];t.arguments.some((e=>!e.name))&&(a=Cn(n));let o=!0;if(t.arguments.forEach(((e,t)=>{const i=Sn(e,t,a,n);x.isNever(i)&&(o=!1)})),o)return r}})):void 0))}(e,t,n);case 66:return function(e,t,n){let i=e;if(!n)return t.orPatterns.forEach((e=>{i=In(i,e,!1)})),i;const s=t.orPatterns.map((e=>{const t=In(i,e,!0);return i=In(i,e,!1),t}));return x.combineTypes(s)}(e,t,n);case 70:return function(e,t,n){if(!n)return e;let i=Dn(e);return i=i.filter((e=>{let i=!0;return t.entries.forEach((s=>{if(e.typedDict){if(71===s.nodeType){const r=In(Xn(t,"str"),s.keyPattern,n);x.isNever(r)&&(i=!1);const a=k.mapSubtypes(r,(t=>{if(x.isAnyOrUnknown(t))return t;if(x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"str")){if(!k.isLiteralType(t))return x.UnknownType.create();const n=Ei(e.typedDict).get(t.literalValue);if(n){const e=In(n.valueType,s.valuePattern,!0);if(!x.isNever(e))return e}}}));x.isNever(a)&&(i=!1)}}else if(e.dictTypeArgs&&71===s.nodeType){const t=In(e.dictTypeArgs.key,s.keyPattern,n),r=In(e.dictTypeArgs.value,s.valuePattern,n);(x.isNever(t)||x.isNever(r))&&(i=!1)}})),i})),x.combineTypes(i.map((e=>e.subtype)))}(e,t,n);case 73:return function(e,t,n){if(!n)return e;const i=ge(t.expression).type,s=[];return qe(i,void 0,((n,i)=>{s.push(qe(e,k.getTypeCondition(n),((e,s)=>{if(x.isNever(n)||x.isNever(s))return x.NeverType.create();if(x.isAnyOrUnknown(n)||x.isAnyOrUnknown(s))return x.isUnknown(n)||x.isUnknown(s)?x.UnknownType.create():x.AnyType.create();const r=E[12][0];return ni(t.expression,(()=>Mt(n,[s],r,t.expression,void 0)))?i:void 0})))})),x.combineTypes(s)}(e,t,n);case 69:return n?e:x.NeverType.create();case 0:return e}}function Cn(e){const t=k.lookUpClassMember(e,"__match_args__");if(t){const e=gi(t);if(x.isClassInstance(e)&&k.isTupleClass(e)&&!k.isOpenEndedTupleClass(e)&&e.tupleTypeArguments){const t=e.tupleTypeArguments;if(!t.some((e=>!x.isClassInstance(e)||!x.ClassType.isBuiltIn(e,"str")||!k.isLiteralType(e))))return t.map((e=>e.literalValue))}}return[]}function Sn(e,t,n,i){var s;let r;e.name?r=e.name.value:ti.details.fullName===e))&&0===t&&!e.name?a=x.ClassType.cloneAsInstance(i):(r&&(a=null===(s=ni(e,(()=>be(e,x.ClassType.cloneAsInstance(i),r))))||void 0===s?void 0:s.type),a||(a=x.UnknownType.create())),In(a,e.pattern,!0)}function Dn(e){const t=[];return k.doForEachSubtype(e,(e=>{const n=Ge(e);if(x.isAnyOrUnknown(n))t.push({subtype:e,dictTypeArgs:{key:n,value:n}});else if(x.isClassInstance(n))if(x.ClassType.isTypedDictClass(n))t.push({subtype:e,typedDict:n});else{let i;for(const e of n.details.mro)if(x.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"Mapping")){i=e;break}if(i){const s=k.partiallySpecializeType(i,n);s.typeArguments&&s.typeArguments.length>=2&&t.push({subtype:e,dictTypeArgs:{key:s.typeArguments[0],value:s.typeArguments[1]}})}}})),t}function Fn(e,t,n){const i=[],s=void 0===n?t:t-1;return k.doForEachSubtype(e,(e=>{const t=Ge(e);let r;if(x.isAnyOrUnknown(t))i.push({subtype:e,entryTypes:[t],isIndeterminateLength:!0,isTuple:!1});else if(x.isClassInstance(t)){for(const e of t.details.mro){if(!x.isInstantiableClass(e))break;if(x.ClassType.isBuiltIn(e,"str"))break;if(x.ClassType.isBuiltIn(e,"bytes"))break;if(x.ClassType.isBuiltIn(e,"Sequence")){r=e;break}if(k.isTupleClass(e)){r=e;break}}if(r){const a=k.partiallySpecializeType(r,t);k.isTupleClass(a)?a.tupleTypeArguments&&(k.isOpenEndedTupleClass(a)?i.push({subtype:e,entryTypes:[a.tupleTypeArguments[0]],isIndeterminateLength:!0,isTuple:!0}):a.tupleTypeArguments.length>=s&&(void 0!==n||a.tupleTypeArguments.length===s)&&i.push({subtype:e,entryTypes:a.tupleTypeArguments,isIndeterminateLength:!1,isTuple:!0})):i.push({subtype:e,entryTypes:[a.typeArguments&&a.typeArguments.length>0?a.typeArguments[0]:x.UnknownType.create()],isIndeterminateLength:!0,isTuple:!1})}}})),i}function An(e,t,n,i){if(e.isIndeterminateLength)return i===t?Q&&x.isInstantiableClass(Q)?x.ClassType.cloneAsInstance(k.specializeTupleClass(Q,[e.entryTypes[0],x.AnyType.create(!0)])):x.UnknownType.create():e.entryTypes[0];if(void 0===i||t=0&&i{xn(x.combineTypes(i.map((e=>An(e,s,n.entries.length,n.starEntryIndex)))),t,e)}));break}case 66:n.target&&Ke(n.target,e,t,n.target),n.orPatterns.forEach((n=>{xn(e,t,n),e=In(e,n,!1)}));break;case 69:Ke(n.target,n.isWildcard?x.AnyType.create():e,t,n.target);break;case 70:{const i=Dn(e);n.entries.forEach((e=>{const s=[],r=[];i.forEach((t=>{if(t.typedDict)if(71===e.nodeType){const i=In(Xn(n,"str"),e.keyPattern,!0);s.push(i),k.doForEachSubtype(i,(e=>{if(x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"str")&&k.isLiteralType(e)){const n=Ei(t.typedDict).get(e.literalValue);r.push(n?n.valueType:x.UnknownType.create())}else r.push(x.UnknownType.create())}))}else 72===e.nodeType&&(s.push(Xn(n,"str")),r.push(x.UnknownType.create()));else if(t.dictTypeArgs)if(71===e.nodeType){const n=In(t.dictTypeArgs.key,e.keyPattern,!0);s.push(n),r.push(In(t.dictTypeArgs.value,e.valuePattern,!0))}else 72===e.nodeType&&(s.push(t.dictTypeArgs.key),r.push(t.dictTypeArgs.value))}));const a=x.combineTypes(s),o=x.combineTypes(r);if(71===e.nodeType)xn(a,t,e.keyPattern),xn(o,t,e.valuePattern);else if(72===e.nodeType){const i=Jn(n,"dict"),s=Xn(n,"str"),r=i&&x.isInstantiableClass(i)&&x.isClassInstance(s)?x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(i,[a,o],!0)):x.UnknownType.create();Ke(e.target,r,t,e.target)}}));break}case 68:{const i=n.arguments.map((e=>[]));qe(e,void 0,(t=>{x.isClassInstance(t)?k.doForEachSubtype(e,(e=>{const s=Ge(e);if(x.isAnyOrUnknown(s))n.arguments.forEach(((e,t)=>{i[t].push(s)}));else if(x.isClassInstance(s)){let e=[];n.arguments.some((e=>!e.name))&&(e=Cn(x.ClassType.cloneAsInstantiable(t))),n.arguments.forEach(((n,s)=>{const r=Sn(n,s,e,x.ClassType.cloneAsInstantiable(t));i[s].push(r)}))}})):n.arguments.forEach(((e,t)=>{i[t].push(x.UnknownType.create())}))})),n.arguments.forEach(((e,n)=>{xn(x.combineTypes(i[n]),t,e.pattern)}));break}}}function kn(e){if(re(e))return;const t=e.module.nameParts[0];let n=Pn(e,t.value)||x.UnknownType.create();const i=re(e);i&&x.isModule(i)&&n&&x.isTypeSame(n,i)&&(n=i),je(t,n,!1),ae(e,n,!1)}function Pn(e,t){const n=ei(e,t,!0);if(!n)return;const i=n.symbol.getDeclarations().filter((t=>v.isNodeContainedWithin(e,t.node)&&6===t.type));let s=i.length>0?i[i.length-1]:void 0;if(s||(s=n.symbol.getDeclarations().find((e=>6===e.type))),!s)return;o.assert(6===s.type);const r=oi(s,!0);return r?ai(s):r}function En(e){var t,n;let i=e,s=e;function r(e){var t,n,i,s,r;return 41===e.nodeType&&30===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||(1===e.nodeType&&(9===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)||24===(null===(i=e.parent)||void 0===i?void 0:i.nodeType))||(54===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)||(41===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&(e===e.parent.typeAnnotation||e===e.parent.typeAnnotationComment)||(9===e.nodeType||24===e.nodeType||15===e.nodeType||27===e.nodeType||31===e.nodeType||30===e.nodeType||35===e.nodeType||45===e.nodeType||49===e.nodeType||52===e.nodeType||56===e.nodeType||17===e.nodeType||16===e.nodeType||32===e.nodeType||33===e.nodeType||34===e.nodeType||65===e.nodeType||67===e.nodeType||68===e.nodeType||74===e.nodeType||66===e.nodeType||69===e.nodeType||70===e.nodeType||73===e.nodeType||71===e.nodeType||72===e.nodeType))))}if(38===e.nodeType&&e.parent){if(28===e.parent.nodeType&&e.parent.name===e)return void an(e.parent);if(10===e.parent.nodeType&&e.parent.name===e)return void Jt(e.parent);if(29===e.parent.nodeType||39===e.parent.nodeType)return void ge(e,void 0,16388)}for(;s;){const e=r(s);if(!e&&!m.isExpressionNode(s))break;e&&(i=s),s=s.parent}const a=i.parent;if(3===a.nodeType)return void(i===a.typeAnnotationComment?_e(i,{isVariableAnnotation:!0,allowTypeVarTuple:v.isFinalAllowedForAssignmentTarget(a.leftExpression)}):Qt(a));if(14===a.nodeType)return void He(i);if(5===a.nodeType)return void Zt(a);if(13===a.nodeType)return void(10===(null===(t=a.parent)||void 0===t?void 0:t.nodeType)?Jt(a.parent):28===(null===(n=a.parent)||void 0===n?void 0:n.nodeType)&&an(a.parent));const o=e=>{const t=e.parent;if(3===(null==t?void 0:t.nodeType)&&t.leftExpression===a)Qt(t);else{const t=_e(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:v.isFinalAllowedForAssignmentTarget(e.valueExpression),allowClassVar:v.isClassVarAllowedForAssignmentTarget(e.valueExpression)});t&&ae(e.valueExpression,t,!1)}};if(64===a.nodeType&&i!==a.guardExpression)return void bn(a);if(54===a.nodeType)return void o(a);if(41===a.nodeType)return void wn(a);if(37===a.nodeType)return;if(1===a.nodeType&&i===a.name)return;if(44===a.nodeType&&a.returnExpression){const t=v.getEnclosingFunction(e),n=t?yi(t):void 0;return void ge(a.returnExpression,n,0)}const l=m.isExpressionNode(a)&&0!==a.nodeType?a:i;if(54===l.nodeType)o(l);else{const e=ii(l).isStubFile?4:0;ge(l,void 0,e)}}function wn(e){o.assert(void 0!==e.name);const t=e.parent;if(30===t.nodeType)return void En(t);o.assert(28===t.nodeType);const n=t,i=n.parameters.findIndex((t=>t===e)),s=Se(n,i);if(s)ae(e.name,ln(e,e.category,_e(s,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===n.parameters[i].category,disallowRecursiveTypeAlias:!0})),!1);else{if(0===i){const t=v.getEnclosingClass(n,!0);if(t){const i=Jt(t);if(i){const t=on(cn(n,!0),i.classType,n);return void ae(e.name,t||x.UnknownType.create(),!1)}}}ae(e.name,ln(e,e.category,x.UnknownType.create()),!1)}}function Nn(e){ye(e);let t=e;for(;t;){switch(t.nodeType){case 3:if(!(t.parent&&(3===t.parent.nodeType||4===t.parent.nodeType||5===t.parent.nodeType)&&t.parent.rightExpression===t))return void Qt(t);break;case 4:return void ge(t);case 5:return void Zt(t);case 10:return void Jt(t);case 41:return void wn(t);case 30:return void En(t);case 28:return void an(t);case 26:return void yn(t);case 25:return void gn(t);case 59:return void fn(t);case 33:{const e=t.parent;return o.assert(32===e.nodeType),void En(e)}case 21:return void Tn(t);case 23:return void _n(t);case 22:return void kn(t);case 64:return void bn(t)}t=t.parent}o.fail("Unexpected assignment target")}function Rn(e,t){const n=f.getImportInfo(e.node.module);o.assert(void 0!==n&&n.isImportFound),o.assert(e.node.isWildcardImport);const i=ei(e.node,t,!1);o.assert(void 0!==i);const s=i.symbol.getDeclarations().find((t=>t.node===e.node));return s&&ai(s)||x.UnknownType.create()}function Mn(e){var t;if(38===e.nodeType){const n=ei(e,e.value,!1);if(!n)return;const i=n.symbol,s=di(i);if(s)return s;const r=i.getDeclarations();if(0===r.length)return;const a=r[r.length-1];return 2===a.type?null===(t=On(a.node.name,(()=>{wn(a.node)})))||void 0===t?void 0:t.type:6===a.type?ai(a):void 0}if(35===e.nodeType){const t=e.memberName.value;let n=Mn(e.leftExpression);if(!n)return;n=Ge(n);const i=k.mapSubtypes(n,(e=>{let n;if(x.isModule(e))n=x.ModuleType.getField(e,t);else if(x.isInstantiableClass(e)){const i=k.lookUpClassMember(e,t);n=i?i.symbol:void 0}else if(x.isClassInstance(e)){const i=k.lookUpClassMember(e,t);n=i?i.symbol:void 0}return n?di(n):void 0}));if(!x.isNever(i))return i}}function On(e,t){let n=re(e);if(n)return{node:e,type:n};const i=J;try{if(J=new Map,t(),n=re(e),n)return{node:e,type:n};if(n=J.get(e.id),n)return{node:e,type:n,isIncomplete:!0}}finally{J=i}}function Ln(e,t){var n;if(V.has(e.id))return V.get(e.id);V.set(e.id,!1);let i=!1;if(9===e.nodeType){const s=Mn(e.leftExpression);if(s&&x.isInstantiableClass(s)){const r=t?"__aexit__":"__exit__",a=null===(n=be(e.leftExpression,x.ClassType.cloneAsInstance(s),r))||void 0===n?void 0:n.type;if(a&&x.isFunction(a)&&a.details.declaredReturnType){const e=a.details.declaredReturnType;i=x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"bool")}}}return V.set(e.id,i),i}function Un(e){if(U.has(e.id))return U.get(e.id);U.set(e.id,!1);let t=0,n=0;const i=Mn(e.leftExpression);i&&k.doForEachSubtype(i,(e=>{let i;if(n++,x.isFunction(e))i=e;else if(x.isOverloadedFunction(e)){const t=e;i=t.overloads[t.overloads.length-1]}if(i&&!x.FunctionType.isAsync(i))if(i.details.declaredReturnType)k.isNoReturnType(i.details.declaredReturnType)&&t++;else if(i.details.declaration&&!(i.details.declaration.yieldStatements||x.FunctionType.isAbstractMethod(i)||x.FunctionType.isStubDefinition(i)||x.FunctionType.isPyTypedDefinition(i))){const e=i.details.declaration.node.suite.statements;let n=!1;for(const t of e){if(47!==t.nodeType||1!==t.statements.length)break;const e=t.statements[0];if(48!==e.nodeType){if(43===e.nodeType&&e.typeExpression){const t=e=>38===(null==e?void 0:e.nodeType)&&"NotImplementedError"===e.value;(t(e.typeExpression)||9===e.typeExpression.nodeType&&t(e.typeExpression.leftExpression))&&(n=!0)}break}}n||Me(i.details.declaration.node)||t++}}));const s=n>0&&t===n;return U.set(e.id,s),s}function Vn(e){let t=z.get(e);return t||(t=Wn(),z.set(e,t)),t}function zn(e,t,n,i){const s=T.createKeyForReference(e),r=v.getExecutionScopeNode(e),a=f.getCodeFlowExpressions(r);if(!a||!a.has(s))return{type:void 0,usedOuterScopeAlias:!1,isIncomplete:!1};const l=v.getExecutionScopeNode(e);let c;c=le(l)?function(){const e=te.length;return o.assert(e>0),te[e-1].codeFlowAnalyzer}():Vn(l.id);const p=f.getFlowNode(e);return void 0===p?{type:void 0,usedOuterScopeAlias:!1,isIncomplete:!1}:Bn(c,p,e,t,n,i)}function Bn(e,t,n,i,s,r){let a;G.enterTrackingScope();try{a=e.getTypeFromCodeFlow(t,n,i,s,r)}finally{G.exitTrackingScope()}return a.isIncomplete&&G.enableUndoTracking(),a}function Wn(){const e=new Map;return{getTypeFromCodeFlow:function(t,n,i,s,r){const a=void 0!==n&&void 0!==i?T.createKeyForReference(n)+`.${i.toString()}`:".";let l=e.get(a);function c(e,t,n,i){if(i){const n=l.get(e.id);if(void 0===n)X++;else if(t&&n.isIncompleteType){const e=n;e.type&&!x.isTypeSame(e.type,t)&&X++}}else X++;const s=i?{isIncompleteType:!0,type:t,incompleteSubtypes:[],generationCount:X}:t;return l.set(e.id,s),W.trackEntry(l,e.id),{type:t,usedOuterScopeAlias:n,isIncomplete:i,generationCount:X,incompleteSubtypes:i?[]:void 0}}function p(e,t,n,i){const s=l.get(e.id);void 0!==s&&F.isIncompleteType(s)||o.fail("setIncompleteSubtype can be called only on a valid incomplete cache entry");const r=s.incompleteSubtypes;return t0){const e=[];n.incompleteSubtypes.forEach((t=>{t&&e.push(t)})),i=e.length>0?x.combineTypes(e):void 0}return{type:i,usedOuterScopeAlias:t,isIncomplete:!0,incompleteSubtypes:n.incompleteSubtypes,generationCount:n.generationCount}}function h(e){let t=e.node;const n=e.node.parent;return n&&(28!==n.nodeType&&10!==n.nodeType||(t=n)),On(t,(()=>{Nn(e.node)}))}return l||(l=new Map,e.set(a,l)),t?function e(t,n,i,s,r){let a=t,l=!1;for(se();;){const t=u(a,l);if(t&&(!t.isIncomplete||t.generationCount===X))return t;if(a.flags&T.FlowFlags.Unreachable)return c(a,void 0,l,!1);if(a.flags&T.FlowFlags.VariableAnnotation){a=a.antecedent}else if(a.flags&T.FlowFlags.Call){const e=a;if(Un(e.node))return c(a,void 0,l,!1);a=e.antecedent}else if(a.flags&T.FlowFlags.Assignment){const e=a;if(n){if(i===e.targetSymbolId&&v.isMatchingExpression(n,e.node)){if(a.flags&T.FlowFlags.Unbind)return c(a,x.UnboundType.create(),l,!1);if(t&&void 0===t.type)return{type:void 0,usedOuterScopeAlias:l,isIncomplete:!0};c(a,void 0,l,!0);let n=h(e);return n&&k.isTypeAliasPlaceholder(n.type)&&(n=void 0),c(a,null==n?void 0:n.type,l,!!(null==n?void 0:n.isIncomplete))}if(v.isPartialMatchingExpression(n,e.node))return{type:s,usedOuterScopeAlias:l,isIncomplete:r}}a=e.antecedent}else if(a.flags&T.FlowFlags.AssignmentAlias){const e=a;i===e.targetSymbolId&&(i=e.aliasSymbolId,l=!0),a=e.antecedent}else{if(a.flags&T.FlowFlags.BranchLabel){if(a.flags&T.FlowFlags.PostContextManager){const e=a;if(!e.expressions.some((t=>Ln(t,e.isAsync))))return c(a,void 0,l,!1)}const t=[];let o=l,p=!1;a.antecedents.forEach((a=>{const l=e(a,n,i,s,r);l.isIncomplete&&(p=!0),l.usedOuterScopeAlias&&(o=!0),l.type&&t.push(l.type)}));const d=x.combineTypes(t);return c(a,d,o,p)}if(a.flags&T.FlowFlags.LoopLabel){const t=a;let o=!1,h=!1,m=l,y=u(a,l);return void 0===y&&(h=!0,y=c(a,void 0,l,!0)),t.antecedents.forEach(((t,c)=>{if(c>=y.incompleteSubtypes.length){y=p(a,c,void 0,l);const d=e(t,n,i,s,r);d.isIncomplete&&0===c&&(o=!0),d.usedOuterScopeAlias&&(m=!0),y=p(a,c,d.type,m)}})),h?o?(d(a),{type:y.type,usedOuterScopeAlias:m,isIncomplete:!0}):c(a,y.type,m,!1):y}if(a.flags&(T.FlowFlags.TrueCondition|T.FlowFlags.FalseCondition)){const t=a;if(n){const o=$n(n,t);if(o){const l=e(t.antecedent,n,i,s,r);let p=l.type;return p&&(p=o(p)),c(a,p,l.usedOuterScopeAlias,l.isIncomplete)}}a=t.antecedent}else if(a.flags&(T.FlowFlags.TrueNeverCondition|T.FlowFlags.FalseNeverCondition)){const e=a;if(e.reference){const t=ei(e.reference,e.reference.value,!1);if(t&&t.symbol.getTypedDeclarations().length>0){const t=$n(e.reference,e);if(t){const n=ge(e.reference),i=t(n.type)||n.type;if(x.isNever(i))return c(a,void 0,l,!!n.isIncomplete)}}}a=e.antecedent}else if(a.flags&T.FlowFlags.ExhaustedMatch){const e=a,t=On(e.node,(()=>{vn(e.node)}));if(t&&x.isNever(t.type))return c(a,void 0,l,!!t.isIncomplete);a=e.antecedent}else if(a.flags&T.FlowFlags.NarrowForPattern){const e=a;if(n&&v.isMatchingExpression(n,e.subjectExpression)){const t=On(e.statement,(()=>{64===e.statement.nodeType?bn(e.statement):vn(e.statement)}));if(t)return c(a,t.type,l,!!t.isIncomplete)}a=e.antecedent}else if(a.flags&T.FlowFlags.PreFinallyGate){const e=a;if(e.isGateClosed)return{type:void 0,usedOuterScopeAlias:l,isIncomplete:!1};a=e.antecedent}else{if(a.flags&T.FlowFlags.PostFinally){const t=a,o=t.preFinallyGate.isGateClosed;try{let l;return t.preFinallyGate.isGateClosed=!0,ni(t.finallyNode,(()=>{l=e(t.antecedent,n,i,s,r)})),l.isIncomplete?l:c(a,l.type,l.usedOuterScopeAlias,!1)}finally{t.preFinallyGate.isGateClosed=o}}if(a.flags&T.FlowFlags.Start)return c(a,s,l,r);if(!(a.flags&T.FlowFlags.WildcardImport))return o.fail("Unexpected flow node flags"),c(a,void 0,l,!1);{const e=a;if(n&&38===n.nodeType){const t=n.value;if(e.names.some((e=>e===t))){const n=Rn(e,t);return c(a,n,l,!1)}}a=e.antecedent}}}}}(t,n,i,s,r):{type:s,usedOuterScopeAlias:!1,isIncomplete:r}}}}function jn(e,t){const n=new Map;if(r.has(e.id))return!0;r.set(e.id,!0);try{return function e(t,i){let s=t;for(;;){if(n.has(s.id))return!1;if(n.set(s.id,!0),s.flags&T.FlowFlags.Unreachable)return!1;if(s===i)return!0;if(s.flags&(T.FlowFlags.VariableAnnotation|T.FlowFlags.Assignment|T.FlowFlags.AssignmentAlias|T.FlowFlags.TrueCondition|T.FlowFlags.FalseCondition|T.FlowFlags.WildcardImport|T.FlowFlags.TrueNeverCondition|T.FlowFlags.FalseNeverCondition|T.FlowFlags.NarrowForPattern|T.FlowFlags.ExhaustedMatch))s=s.antecedent;else{if(!(s.flags&T.FlowFlags.Call)){if(s.flags&(T.FlowFlags.BranchLabel|T.FlowFlags.LoopLabel)){if(s.flags&T.FlowFlags.PostContextManager){const e=s;if(!e.expressions.some((t=>Ln(t,e.isAsync))))return!1}const t=s;for(const n of t.antecedents)if(e(n,i))return!0;return!1}if(s.flags&T.FlowFlags.Start)return!i;if(s.flags&T.FlowFlags.PreFinallyGate)return!s.isGateClosed;if(s.flags&T.FlowFlags.PostFinally){const t=s,n=t.preFinallyGate.isGateClosed;try{return t.preFinallyGate.isGateClosed=!0,e(t.antecedent,i)}finally{t.preFinallyGate.isGateClosed=n}}return o.fail("Unexpected flow node flags"),!1}{const e=s;if(void 0===i&&Un(e.node))return!1;s=e.antecedent}}}}(e,t)}finally{r.delete(e.id)}}function $n(e,t){let n=t.expression;const i=!!(t.flags&(T.FlowFlags.TrueCondition|T.FlowFlags.TrueNeverCondition));if(4===n.nodeType&&(v.isMatchingExpression(e,n.rightExpression)?n=n.rightExpression:v.isMatchingExpression(e,n.name)&&(n=n.name)),7===n.nodeType){const t=39===n.operator||40===n.operator,s=12===n.operator||28===n.operator;if(t||s){const r=39===n.operator||12===n.operator?i:!i;if(11===n.rightExpression.nodeType&&26===n.rightExpression.constType){let t=n.leftExpression;if(4===t.nodeType&&(t=t.name),v.isMatchingExpression(e,t))return e=>qe(k.mapSubtypes(e,(e=>k.transformPossibleRecursiveTypeAlias(e))),void 0,((e,t)=>{if(x.isAnyOrUnknown(e))return e;const n=x.isTypeVar(t)&&0===t.details.constraints.length?t:e;return x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"object")?r?x.NoneType.createInstance():n:x.isNone(e)===r?n:void 0}))}if(t&&9===n.leftExpression.nodeType){const t=ge(n.leftExpression.leftExpression).type;if(x.isInstantiableClass(t)&&x.ClassType.isBuiltIn(t,"type")&&1===n.leftExpression.arguments.length&&0===n.leftExpression.arguments[0].argumentCategory){const t=n.leftExpression.arguments[0].valueExpression;if(v.isMatchingExpression(e,t)){const e=ge(n.rightExpression).type;if(x.isInstantiableClass(e))return t=>function(e,t,n){return k.mapSubtypes(e,(e=>{if(x.isClassInstance(e)){const i=x.ClassType.isDerivedFrom(t,x.ClassType.cloneAsInstantiable(e));if(n)return i?x.ClassType.isSameGenericClass(e,t)?e:x.ClassType.cloneAsInstance(t):void 0;if(i&&x.ClassType.isFinal(e))return;return e}return x.isNone(e)&&n?void 0:e}))}(t,e,r)}}}if(t&&v.isMatchingExpression(e,n.leftExpression)){const e=ge(n.rightExpression).type;if(x.isClassInstance(e)&&(x.ClassType.isEnumClass(e)||x.ClassType.isBuiltIn(e,"bool"))&&void 0!==e.literalValue)return t=>qn(t,e,r,!0)}if(s){const t=12===n.operator?i:!i;if(v.isMatchingExpression(e,n.leftExpression)){const e=ge(n.rightExpression).type;if(x.isClassInstance(e)&&void 0!==e.literalValue)return n=>qn(n,e,t,!1)}if(v.isMatchingExpression(e,n.rightExpression)){const e=ge(n.leftExpression).type;if(x.isClassInstance(e)&&void 0!==e.literalValue)return n=>qn(n,e,t,!1)}if(35===n.leftExpression.nodeType&&v.isMatchingExpression(e,n.leftExpression.leftExpression)){const e=ge(n.rightExpression).type,i=n.leftExpression.memberName;if(x.isClassInstance(e)&&void 0!==e.literalValue)return n=>function(e,t,n,i){let s=!0;const r=k.mapSubtypes(e,(e=>{let r;if(x.isClassInstance(e)?r=k.lookUpObjectMember(e,t):x.isInstantiableClass(e)&&(r=k.lookUpClassMember(e,t)),r&&r.isTypeDeclared){const t=gi(r);if(k.isLiteralTypeOrUnion(t))return i?Di(t,n,new l.DiagnosticAddendum)?e:void 0:Di(n,t,new l.DiagnosticAddendum)?void 0:e}return s=!1,e}));return s?r:e}(n,i.value,e,t)}if(24===n.leftExpression.nodeType&&1===n.leftExpression.items.length&&!n.leftExpression.trailingComma&&0===n.leftExpression.items[0].argumentCategory&&v.isMatchingExpression(e,n.leftExpression.baseExpression)){const e=ge(n.leftExpression.items[0].valueExpression).type;if(x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"str")&&k.isLiteralType(e)){const i=ge(n.rightExpression).type;if(x.isClassInstance(i)&&void 0!==i.literalValue)return n=>function(e,t,n,i){let s=!0;const r=k.mapSubtypes(e,(e=>{if(x.isClassInstance(e)&&x.ClassType.isTypedDictClass(e)){const s=Ei(e).get(t.literalValue);if(s&&k.isLiteralTypeOrUnion(s.valueType))return i?Di(s.valueType,n,new l.DiagnosticAddendum)?e:void 0:Di(n,s.valueType,new l.DiagnosticAddendum)?void 0:e}return s=!1,e}));return s?r:e}(n,e,i,t)}}}}if(41===n.operator&&i&&v.isMatchingExpression(e,n.leftExpression)){const e=ge(n.rightExpression).type;return t=>function(e,t){if(!x.isClassInstance(t)||!x.ClassType.isBuiltIn(t))return e;const n=t.details.name;if(!["list","set","frozenset","deque"].some((e=>e===n)))return e;if(!t.typeArguments||1!==t.typeArguments.length)return e;const i=t.typeArguments[0];let s=!0;const r=k.mapSubtypes(e,(e=>x.isAnyOrUnknown(e)?(s=!1,e):Di(i,e,new l.DiagnosticAddendum)?e:void 0));return s?r:e}(t,e)}if((41===n.operator||42===n.operator)&&v.isMatchingExpression(e,n.rightExpression)){const e=ge(n.leftExpression).type;if(x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"str")&&k.isLiteralType(e)){const t=41===n.operator?i:!i;return n=>function(e,t,n){return k.mapSubtypes(e,(e=>{if(x.isClassInstance(e)&&x.ClassType.isTypedDictClass(e)){const i=Ei(e,!0).get(t.literalValue);if(n){if(!i)return x.ClassType.isFinal(e)?void 0:e;if(i.isRequired||i.isProvided)return e;const n=e.typedDictNarrowedEntries,s=new Map;return n&&n.forEach(((e,t)=>{s.set(t,e)})),s.set(t.literalValue,{valueType:i.valueType,isRequired:!1,isProvided:!0}),x.ClassType.cloneAsInstance(x.ClassType.cloneForNarrowedTypedDictEntries(x.ClassType.cloneAsInstantiable(e),s))}return void 0!==i&&(i.isRequired||i.isProvided)?void 0:e}return e}))}(n,x.ClassType.cloneAsInstantiable(e),t)}}}if(9===n.nodeType){if(38===n.leftExpression.nodeType)if("isinstance"!==n.leftExpression.value&&"issubclass"!==n.leftExpression.value||2!==n.arguments.length){if("callable"===n.leftExpression.value&&1===n.arguments.length){const t=n.arguments[0].valueExpression;if(v.isMatchingExpression(e,t))return e=>{let t=Kn(e,i,n,!1);return i&&x.isNever(t)&&(t=Kn(e,i,n,!0)),t}}}else{const t="isinstance"===n.leftExpression.value,s=n.arguments[0].valueExpression,r=n.arguments[1].valueExpression;if(v.isMatchingExpression(e,s)){const e=function(e){if(x.isClass(e)&&x.TypeBase.isInstantiable(e)||x.isTypeVar(e)&&x.TypeBase.isInstantiable(e))return[e];if(x.isClass(e)&&x.TypeBase.isInstance(e)&&k.isTupleClass(e)&&e.tupleTypeArguments){let t=!1;const n=[];if(e.tupleTypeArguments.forEach((e=>{x.isInstantiableClass(e)||x.isTypeVar(e)&&x.TypeBase.isInstantiable(e)||x.isNone(e)&&x.TypeBase.isInstantiable(e)?n.push(e):t=!0})),!t)return n}if(x.isUnion(e)){let t=!0;const n=[];if(k.doForEachSubtype(e,(e=>{x.isInstantiableClass(e)||x.isTypeVar(e)&&x.TypeBase.isInstantiable(e)?n.push(e):t=!1})),t&&n.length>0)return n}return}(ge(r,void 0,168).type);if(e)return s=>{const r=Gn(s,e,t,i,!1,n);return x.isNever(r)?Gn(s,e,t,i,!0,n):r}}}if(n.arguments.length>=1){const t=n.arguments[0].valueExpression;if(v.isMatchingExpression(e,t)){const e=ge(n.leftExpression).type;if(x.isFunction(e)&&e.details.declaredReturnType&&x.isClassInstance(e.details.declaredReturnType)&&x.ClassType.isBuiltIn(e.details.declaredReturnType,"TypeGuard")){const e=ge(n).type;if(x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"bool")&&e.typeGuardType)return t=>i?e.typeGuardType:t}}}}if(v.isMatchingExpression(e,n))return e=>k.mapSubtypes(e,(e=>{if(i){if(k.canBeTruthy(e))return k.removeFalsinessFromType(e)}else if(k.canBeFalsy(e))return k.removeTruthinessFromType(e)}))}function Gn(e,t,n,i,s,r){const a=k.mapSubtypes(e,(e=>k.transformPossibleRecursiveTypeAlias(e))),o=(e,a,o,c)=>{const p=[];let d=!1,u=!1;for(const c of t){const t=Ge(c);if(x.isInstantiableClass(t)){const a=!x.isTypeVar(c)&&(x.ClassType.isDerivedFrom(e,t)||n&&x.ClassType.isProtocolClass(t)&&Di(t,e,new l.DiagnosticAddendum)||x.ClassType.isBuiltIn(t,"dict")&&x.ClassType.isTypedDictClass(e)),h=x.ClassType.isDerivedFrom(t,e)||n&&x.ClassType.isProtocolClass(e)&&Di(e,t,new l.DiagnosticAddendum);if(a&&(d=!0),h&&a&&!x.ClassType.isSameGenericClass(e,t)&&(u=!0),i)if(a)p.push(k.addConditionToType(e,o));else if(h)p.push(k.addConditionToType(c,o));else if(s){const i=``,s=ii(r),a=x.ClassType.createInstantiable(i,xt(r,s.moduleName,i),s.moduleName,s.filePath,0,Li(r),void 0,e.details.effectiveMetaclass,e.details.docString);a.details.baseClasses=[x.ClassType.cloneAsInstantiable(e),t],k.computeMroLinearization(a),p.push(n?x.ClassType.cloneAsInstance(a):a)}}else x.isTypeVar(c)&&x.TypeBase.isInstantiable(c)&&(n&&x.TypeBase.isInstance(a)?x.isTypeVar(a)&&x.isTypeSame(k.convertToInstance(c),a)?i&&p.push(a):i?p.push(k.convertToInstance(c)):(p.push(a),u=!0):!n&&x.TypeBase.isInstantiable(a)&&(x.isTypeVar(a)&&x.isTypeSame(c,a)?i&&p.push(a):i?p.push(c):(p.push(a),u=!0)))}return i||d&&!u||p.push(c),n?p.map((e=>k.convertToInstance(e))):p},c=[],p=[],d=qe(a,void 0,((e,s)=>{const r=k.getTypeCondition(e)?e:s,a=x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"type");if(i&&x.isAnyOrUnknown(e))return n?c.push(x.combineTypes(t.map((e=>k.convertToInstance(e))))):c.push(x.combineTypes(t)),void p.push(e);if(n){if(x.isNone(e)){const n=t.some((e=>x.isNone(e)&&x.TypeBase.isInstantiable(e)));return i?n?e:void 0:n?void 0:e}if((x.isModule(e)||x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"ModuleType"))&&i){const e=t.filter((e=>{const t=Ge(e);return x.isInstantiableClass(t)&&x.ClassType.isProtocolClass(t)}));if(e.length>0)return k.convertToInstance(x.combineTypes(e))}if(x.isClassInstance(e)&&!a)return x.combineTypes(o(x.ClassType.cloneAsInstantiable(e),k.convertToInstance(s),k.getTypeCondition(e),r));if((x.isFunction(e)||x.isOverloadedFunction(e))&&n)return x.combineTypes(((e,n)=>{const s=[];if(i)for(const n of t){const t=Ge(n);Di(e,k.convertToInstance(t),new l.DiagnosticAddendum)&&s.push(k.convertToInstance(n))}else s.push(n);return s})(e,k.convertToInstance(s)));if(x.isInstantiableClass(e)||a){const e=t.some((e=>x.isInstantiableClass(e)&&x.ClassType.isBuiltIn(e,"type")));return i?e?r:void 0:e?void 0:r}}else{if(x.isInstantiableClass(e))return x.combineTypes(o(e,s,k.getTypeCondition(e),r));if(a&&H&&x.isClassInstance(H))return x.combineTypes(o(x.ClassType.cloneAsInstantiable(H),k.convertToInstantiable(s),k.getTypeCondition(e),r))}return i?void 0:r}));return x.isNever(d)&&c.length>0?x.combineTypes(c):p.length>0?x.combineTypes([d,...p]):d}function qn(e,t,n,i){return k.mapSubtypes(e,(e=>{if(x.isClassInstance(e)&&x.ClassType.isSameGenericClass(t,e)){if(void 0!==e.literalValue){const i=x.ClassType.isLiteralValueSame(e,t);if(i&&!n||!i&&n)return;return e}if(n)return t;{const n=function(e){if(x.ClassType.isBuiltIn(e,"bool"))return[x.ClassType.cloneWithLiteral(e,!0),x.ClassType.cloneWithLiteral(e,!1)];if(x.ClassType.isEnumClass(e)){const t=[];return e.details.fields.forEach(((n,i)=>{if(!n.isIgnoredForProtocolMatch()&&!n.isInstanceMember()){const i=li(n);x.isClassInstance(i)&&x.ClassType.isSameGenericClass(e,i)&&void 0!==i.literalValue&&t.push(i)}})),t}return}(e);if(n)return x.combineTypes(n.filter((e=>!x.ClassType.isLiteralValueSame(e,t))))}}else if(n&&(i||x.isNone(e)))return;return e}))}function Kn(e,t,n,i){return qe(e,void 0,(e=>{switch(e.category){case 5:case 6:return t?e:void 0;case 3:case 8:return t?void 0:e;case 7:if(x.TypeBase.isInstantiable(e))return t?e:void 0;if(be(n,e,"__call__"))return t?e:void 0;if(!t)return e;if(i){const t=``,i=ii(n),s=x.ClassType.createInstantiable(t,xt(n,i.moduleName,t),i.moduleName,i.filePath,0,Li(n),void 0,e.details.effectiveMetaclass,e.details.docString);s.details.baseClasses=[x.ClassType.cloneAsInstantiable(e)],k.computeMroLinearization(s);const r=x.FunctionType.createInstance("__call__","","",64),a={category:0,name:"self",type:x.ClassType.cloneAsInstance(s),hasDeclaredType:!0};return x.FunctionType.addParameter(r,a),x.FunctionType.addDefaultParameters(r),r.details.declaredReturnType=x.UnknownType.create(),s.details.fields.set("__call__",C.Symbol.createWithType(4,r)),x.ClassType.cloneAsInstance(s)}return;default:return e}}))}function Hn(e,t,n,i){if(x.ClassType.isSpecialBuiltIn(e)){const s=e.aliasName||e.details.name;switch(s){case"Callable":return function(e,t){const n=x.FunctionType.createInstantiable("","","",4);x.TypeBase.setNonCallable(n),n.details.declaredReturnType=x.UnknownType.create();const i=v.getEnclosingClassOrFunction(t);if(n.details.typeVarScopeId=i?et(i):x.WildcardTypeVarScopeId,e&&e.length>0){if(e[0].typeList){const t=e[0].typeList;let i=!1,s=!1;t.forEach(((e,t)=>{let r=e.type,a=0;const o=`_p${t.toString()}`;x.isVariadicTypeVar(r)?(i&&(s||(Ue(h.Localizer.Diagnostic.variadicTypeArgsTooMany(),e.node),s=!0)),i=!0,at(r,e.node),a=0):jt(e)||(r=x.UnknownType.create()),x.FunctionType.addParameter(n,{category:a,name:o,isNameSynthesized:!0,type:k.convertToInstance(r),hasDeclaredType:!0})}))}else if(k.isEllipsisType(e[0].type))x.FunctionType.addDefaultParameters(n),n.details.flags|=32768;else if(x.isParamSpec(e[0].type))n.details.paramSpec=e[0].type;else if(x.isInstantiableClass(e[0].type)&&x.ClassType.isBuiltIn(e[0].type,"Concatenate")){const t=e[0].type.typeArguments;t&&t.length>0&&t.forEach(((e,i)=>{i===t.length-1?x.isParamSpec(e)&&(n.details.paramSpec=e):x.FunctionType.addParameter(n,{category:0,name:`__p${i}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})}))}else Ue(h.Localizer.Diagnostic.callableFirstArg(),e[0].node);if(e.length>1){let t=e[1].type;jt(e[1])||(t=x.UnknownType.create()),n.details.declaredReturnType=k.convertToInstance(t)}else Be(ii(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.callableSecondArg(),t),n.details.declaredReturnType=x.UnknownType.create();e.length>2&&Ue(h.Localizer.Diagnostic.callableExtraArgs(),e[2].node)}else x.FunctionType.addDefaultParameters(n,!0),n.details.flags|=32768;return n}(t,i);case"Optional":return function(e,t){if(!t||1!==t.length)return Ue(h.Localizer.Diagnostic.optionalExtraArgs(),e),x.UnknownType.create();let n=t[0].type;jt(t[0])?x.TypeBase.isInstantiable(n)||We(n,t[0].node):n=x.UnknownType.create();const i=x.combineTypes([n,x.NoneType.createType()]);return x.isUnion(i)&&x.TypeBase.setNonCallable(i),i}(i,t);case"Type":{let n=qt(e,t,1);return x.isInstantiableClass(n)&&(n=k.explodeGenericClass(n)),n}case"ClassVar":return function(e,t,n){if(131072&n)return Ue(h.Localizer.Diagnostic.classVarNotAllowed(),e),x.AnyType.create();if(!t||0===t.length)return Ue(h.Localizer.Diagnostic.classVarFirstArgMissing(),e),x.UnknownType.create();if(t.length>1)return Ue(h.Localizer.Diagnostic.classVarTooManyArgs(),t[1].node),x.UnknownType.create();let i=t[0].type;return i=Ge(i),i}(i,t,n);case"Protocol":return qt(e,t,void 0,!0);case"Tuple":return qt(e,t,void 0);case"Union":return function(e){const t=[];if(e)for(const n of e){let e=n.type;jt(n,!1,!0)?x.TypeBase.isInstantiable(e)||We(e,n.node):e=x.UnknownType.create(),x.isTypeVar(e)&&x.isVariadicTypeVar(e)&&e.isVariadicUnpacked&&(e=x.TypeVarType.cloneForUnpacked(e,!0)),t.push(e)}if(t.length>0){const e=x.combineTypes(t);return x.isUnion(e)&&x.TypeBase.setNonCallable(e),e}return x.NeverType.create()}(t);case"Generic":return function(e,t,n){n&&0!==n.length||Ue(h.Localizer.Diagnostic.genericTypeArgMissing(),e);const i=[];return n&&n.forEach((e=>{if(x.isTypeVar(e.type)){for(const t of i)if(t===e.type){Ue(h.Localizer.Diagnostic.genericTypeArgUnique(),e.node);break}i.push(e.type)}else Ue(h.Localizer.Diagnostic.genericTypeArgTypeVar(),e.node)})),qt(t,n,void 0,!0)}(i,e,t);case"Final":return function(e,t,n,i){return 16&i?(Ue(h.Localizer.Diagnostic.finalContext(),t),x.AnyType.create()):n&&0!==n.length?(n.length>1&&Ue(h.Localizer.Diagnostic.finalTooManyArgs(),t),n[0].type):e}(e,i,t,n);case"Annotated":return function(e,t){if(t&&t.length<2&&Ue(h.Localizer.Diagnostic.annotatedTypeArgMissing(),e),!t||0===t.length)return x.AnyType.create();let n=t[0].type;return jt(t[0])||(n=x.UnknownType.create()),x.TypeBase.cloneForAnnotated(n)}(i,t);case"Concatenate":return function(e,t,n){return n&&0!==n.length?n.forEach(((e,t)=>{t===n.length-1?x.isParamSpec(e.type)||Ue(h.Localizer.Diagnostic.concatenateParamSpecMissing(),e.node):x.isParamSpec(e.type)&&Ue(h.Localizer.Diagnostic.paramSpecContext(),e.node)})):Ue(h.Localizer.Diagnostic.concatenateTypeArgsMissing(),e),qt(t,n,void 0,!0)}(i,e,t);case"TypeGuard":return function(e,t,n){let i;return n&&1===n.length||Ue(h.Localizer.Diagnostic.typeGuardArgCount(),e),n&&n.length>0?(i=n[0].type,jt(n[0])||(i=x.UnknownType.create())):i=x.UnknownType.create(),x.ClassType.cloneForSpecialization(t,[k.convertToInstance(i)],!!n)}(i,e,t);case"Unpack":return function(e,t){if(!t||1!==t.length)return Ue(h.Localizer.Diagnostic.unpackArgCount(),e),x.UnknownType.create();let n=t[0].type;return x.isUnion(n)&&1===n.subtypes.length&&(n=n.subtypes[0]),!x.isVariadicTypeVar(n)||n.isVariadicUnpacked?(Ue(h.Localizer.Diagnostic.unpackExpectedTypeVarTuple(),e),x.UnknownType.create()):x.TypeVarType.cloneForUnpacked(n)}(i,t);case"Required":case"NotRequired":return function(e,t,n,i){var s;if(!i||1!==i.length)return Ue(n?h.Localizer.Diagnostic.requiredArgCount():h.Localizer.Diagnostic.notRequiredArgCount(),t),e;const r=i[0].type,a=v.getEnclosingClass(t,!0),o=a?Jt(a):void 0;let l=!1;return o&&x.isInstantiableClass(o.classType)&&x.ClassType.isTypedDictClass(o.classType)&&54===(null===(s=t.parent)||void 0===s?void 0:s.nodeType)&&t.parent.typeAnnotation===t&&(l=!0),l?r:(Ue(n?h.Localizer.Diagnostic.requiredNotInTypedDict():h.Localizer.Diagnostic.notRequiredNotInTypedDict(),t),x.ClassType.cloneForSpecialization(e,[k.convertToInstance(r)],!!i))}(e,i,"Required"===s,t)}}const s=ii(i);if(s.isStubFile||s.executionEnvironment.pythonVersion>=d.PythonVersion.V3_9||Te(ii(i))||0!=(4&n)){if(x.ClassType.isBuiltIn(e,"type")&&t){const e=we(i,"Type");if(e&&x.isInstantiableClass(e)){let n=qt(e,t,1,void 0,!0);return x.isInstantiableClass(n)&&(n=k.explodeGenericClass(n)),n}}if(k.isTupleClass(e))return qt(e,t,void 0,void 0,!0)}let r=t?t.length:0;const a=x.ClassType.getTypeParameters(e);if(0===a.length&&0===r)return e;const o=a.findIndex((e=>x.isVariadicTypeVar(e)));if(t){if(r>a.length){if(!x.ClassType.isPartiallyConstructed(e)&&!x.ClassType.isTupleClass(e)){const n=ii(i);0===a.length?Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeArgsExpectingNone(),t[a.length].node):Be(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:a.length,received:r}),t[a.length].node)}r=a.length}else if(r0?t[0].node.parent:i)}t.forEach(((e,t)=>{if(t===o){if(x.isClassInstance(e.type)&&k.isTupleClass(e.type))return;if(x.isVariadicTypeVar(e.type))return void at(e.type,e.node)}jt(e,!1,!1,!0)}))}const p=t?t.map((e=>k.convertToInstance(e.type))):[],u=x.ClassType.getTypeParameters(e);for(let e=p.length;e{if(nx.maxTypeRecursionCount)return!0;if(x.isAnyOrUnknown(t))return!0;let r=t;if(x.isTypeVar(t)){if(x.isTypeSame(t,e))return!0;r=Ge(t)}const a=e.details.boundType;if(a&&!Di(a,r,n.createAddendum(),void 0,i,s+1))return e.details.isSynthesized||n.addMessage(h.Localizer.DiagnosticAddendum.typeBound().format({sourceType:Oi(r),destType:Oi(a),name:x.TypeVarType.getReadableName(e)})),!1;if(e.details.isParamSpec){if(x.isParamSpec(t))return!0}else{if(x.isParamSpec(t))return n.addMessage(h.Localizer.Diagnostic.paramSpecContext()),!1;{const t=e.details.constraints;if(0===t.length)return!0;for(const e of t){if(x.isAnyOrUnknown(e))return!0;if(x.isUnion(r)){if(x.findSubtype(r,(t=>Di(e,t,new l.DiagnosticAddendum))))return!0}else if(Di(e,r,new l.DiagnosticAddendum))return!0}}}return n.addMessage(h.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Oi(r),name:x.TypeVarType.getReadableName(e)})),!1}(a[n],e,i)||x.isClassInstance(e)&&x.ClassType.isPartiallyConstructed(e))){Be(ii(t[n].node).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarAssignmentMismatch().format({type:Oi(e),name:x.TypeVarType.getReadableName(a[n])})+i.getString(),t[n].node)}}}));return x.ClassType.cloneForSpecialization(e,p,void 0!==t)}function Yn(e){return e.type?e.type:e.valueExpression?ge(e.valueExpression).type:x.UnknownType.create()}function Qn(e){return e.type?e.type:Zn(e.valueExpression)}function Zn(e,t=!1){let n=131304;return ii(e).isStubFile&&(n|=4),t||(n|=16),ge(e,void 0,n).type}function Jn(e,t){const n=b.getScopeForNode(e);if(n){const e=b.getBuiltInScope(n).lookUpSymbol(t);if(e)return li(e)}return x.UnknownType.create()}function Xn(e,t,n){const i=Jn(e,t);if(x.isInstantiableClass(i)){let e=i;return n&&(e=x.ClassType.cloneForSpecialization(e,n,void 0!==n)),x.ClassType.cloneAsInstance(e)}return i}function ei(e,t,n){const i=b.getScopeForNode(e);let s=null==i?void 0:i.lookUpSymbolRecursive(t);if(s&&n){0===s.symbol.getDeclarations().filter((t=>{if(6!==t.type&&0!==t.type){const n=v.getExecutionScopeNode(e),i=4===t.type||3===t.type?t.node.name:t.node;if(n===v.getExecutionScopeNode(i)&&!Oe(i,e)){const t=f.getFlowNode(e);return!(t&&jn(t))}}return!0})).length&&(s=1!==s.scope.type&&s.scope.parent?s.scope.parent.lookUpSymbolRecursive(t,s.isOutsideCallerModule||3===s.scope.type,s.isBeyondExecutionScope||s.scope.isIndependentlyExecutable()):void 0)}return s}function ti(e,t){$.push(e);try{return t()}finally{$.pop()}}function ni(e,t,n=!0){W.enterSpeculativeContext(e,n);try{return t()}finally{W.leaveSpeculativeContext()}}function ii(e){for(;36!==e.nodeType;)e=e.parent;return f.getFileInfo(e)}function si(e,t){if(x.isFunction(e)&&e.details.declaration){const n=e.details.declaration;if(3===n.type){const e=n.node,i=f.getScope(e);if(i){const e=i.lookUpSymbol(t);if(e)return e.getDeclarations().find((e=>2===e.type))}}}}function ri(e){var t;switch(e.type){case 0:{if("Any"===e.intrinsicType)return x.AnyType.create();if("class"===e.intrinsicType){const t=Jt(v.getEnclosingClass(e.node));return t?t.classType:void 0}const t=Xn(e.node,"str"),n=Xn(e.node,"int");if(x.isClassInstance(n)&&x.isClassInstance(t)){if("str"===e.intrinsicType)return t;if("int"===e.intrinsicType)return n;if("Iterable[str]"===e.intrinsicType){const n=Jn(e.node,"Iterable");if(x.isInstantiableClass(n))return x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(n,[t],!0))}if("Dict[str, Any]"===e.intrinsicType){const n=Jn(e.node,"dict");if(x.isInstantiableClass(n))return x.ClassType.cloneAsInstance(x.ClassType.cloneForSpecialization(n,[t,x.AnyType.create()],!0))}}return x.UnknownType.create()}case 4:{const t=Jt(e.node);return t?t.decoratedType:void 0}case 5:return _e(e.node.typeAnnotation);case 3:{const t=an(e.node);return t?t.decoratedType:void 0}case 2:{let n=e.node.typeAnnotation||e.node.typeAnnotationComment;if(!n&&28===(null===(t=e.node.parent)||void 0===t?void 0:t.nodeType)){const t=e.node.parent;if(t.functionAnnotationComment&&!t.functionAnnotationComment.isParamListEllipsis){const i=t.parameters.findIndex((t=>t===e.node));n=Se(t,i)}}if(n){const t=_e(n,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===e.node.category,disallowRecursiveTypeAlias:!0});return ln(e.node,e.node.category,t)}return}case 1:{const t=e.typeAnnotationNode;if(t){const n=De(t)?v.getTypeAnnotationNode(t):void 0;let i=_e(t,{isVariableAnnotation:!0,allowClassVar:!e.isFinal&&v.isClassVarAllowedForAssignmentTarget(e.node)});if(i)return 38===e.node.nodeType&&(i=Kt(e.node,(()=>i))||i),n&&38===n.valueExpression.nodeType&&(i=Ht(i,n.valueExpression,e.node)),i}return}case 6:return}}function ai(n){var i,s;const r=oi(n,!0);if(!r)return x.UnknownType.create();function a(e,t,n){if(t.path){const i=n(t.path);if(!i)return x.UnknownType.create();e.fields=i.symbolTable,e.docString=i.docString}return t.implicitImports&&t.implicitImports.forEach(((t,i)=>{const s=e.moduleName?e.moduleName+"."+i:"",r=a(x.ModuleType.create(s,t.path),t,n),o=C.Symbol.createWithType(0,r);e.loaderFields.set(i,o)})),e}if(6===r.type){let t=r.moduleName;if(6===n.type&&(n.symbolName&&(t+="."+n.symbolName),t.startsWith("."))){const e=ii(n.node).moduleName.split(".");for(t=t.substr(1);t.startsWith(".")&&e.length>0;)t=t.substr(1),e.pop();t=e.join(".")+"."+t}const i=x.ModuleType.create(t,r.path);return r.symbolName&&r.submoduleFallback?a(i,r.submoduleFallback,e):a(i,r,e)}const o=ri(r);if(o)return o;const l=ii(r.node);let c=!1;if(l.isInPyTypedPackage&&!l.isStubFile&&t.disableInferenceForPyTypedSources){if(1!==r.type)return x.UnknownType.create();const e=v.getEnclosingClass(r.node,!0);let t=!1;if(e){const n=Jt(e);n&&x.ClassType.isEnumClass(n.classType)&&(t=!0)}if(!r.isFinal&&!r.isConstant&&!t){if(!r.typeAliasName)return x.UnknownType.create();r.typeAliasAnnotation||(c=!0)}}if(2===r.type)return null===(i=On(r.node.name,(()=>{wn(r.node)})))||void 0===i?void 0:i.type;if(1===r.type&&r.inferredTypeSource){const e=r.typeAliasName&&r.inferredTypeSource.parent?r.inferredTypeSource.parent:r.inferredTypeSource;let t=null===(s=On(r.node,(()=>{Nn(e)})))||void 0===s?void 0:s.type;if(t&&38===r.node.nodeType){const e=Kt(r.node,(()=>{var e;return(null===(e=On(r.inferredTypeSource,(()=>{Nn(r.inferredTypeSource)})))||void 0===e?void 0:e.type)||x.UnknownType.create()}));e&&(t=e)}if(t&&r.typeAliasName)if(x.TypeBase.isInstantiable(t)&&!x.isAnyOrUnknown(t))t=Ht(t,r.typeAliasName,r.node);else if(c)return x.UnknownType.create();return t}}function oi(t,n){return g.resolveAliasDeclaration(e,t,n)}function li(e){return ci(e).type}const ci=t.logCalls?(e,t,n=!1)=>ie("getEffectiveTypeOfSymbolForUsage",(()=>pi(e,t,n)),e):pi;function pi(e,t,n=!1){if(e.hasTypedDeclarations()){const t=di(e);return{type:t||x.UnknownType.create(),isIncomplete:!1,includesVariableDecl:e.getTypedDeclarations().some((e=>1===e.type)),isRecursiveDefinition:!t}}let i=j.get(e.id);const s=t?t.id:void 0;if(i)for(const e of i)if(e.usageNodeId===s&&e.useLastDecl===n)return e.result;const r=[],a=e.isPrivateMember(),o=e.getDeclarations(),l=D.isFinalVariable(e);let c=!1,p=!1;if(o.forEach(((i,s)=>{var d,u;let h=!n||s===o.length-1;if(void 0!==t&&6!==i.type){v.getExecutionScopeNode(t)===v.getExecutionScopeNode(i.node)&&(Oe(i.node,t)||(h=!1))}if(h){const t=_.isExplicitTypeAliasDeclaration(i)||_.isPossibleTypeAliasDeclaration(i);if(t&&1===i.type&&3===(null===(u=null===(d=i.inferredTypeSource)||void 0===d?void 0:d.parent)||void 0===u?void 0:u.nodeType)&&(Qt(i.inferredTypeSource.parent),i.typeAliasAnnotation&&ge(i.typeAliasAnnotation)),pe(e,i))try{let n=ai(i);if(de(e)||(c=!0),n){if(1===i.type){p=!0;let e=1===i.type&&!!i.isConstant;x.isClassInstance(n)&&x.ClassType.isEnumClass(n)&&function(e){const t=v.getEnclosingClass(e.node,!0);if(!t)return!1;const n=Jt(t);if(!n)return!1;return x.ClassType.isEnumClass(n.classType)}(i)&&(e=!0),!x.TypeBase.isInstance(n)||t||a||e||l||(n=k.stripLiteralValue(n))}r.push(n)}else c=!0}catch(t){throw de(e),t}else c=!0}})),r.length>0){const t={type:x.combineTypes(r),isIncomplete:!1,includesVariableDecl:p,isRecursiveDefinition:!1};return i||(i=[],j.set(e.id,i)),i.push({usageNodeId:s,useLastDecl:n,result:t}),t}return{type:x.UnboundType.create(),isIncomplete:c,includesVariableDecl:p,isRecursiveDefinition:!1}}function di(e){const t=e.getSynthesizedType();if(t)return t;const n=e.getTypedDeclarations();if(0===n.length)return;let i=n.length-1;for(;i>=0;){const t=n[i],s=he(e,t);if(s)return s;if(ce(e,t)<0&&pe(e,t))try{const n=ri(t);if(de(e)||4===t.type)return n}catch(t){throw de(e),t}i--}}function ui(e,t,n=!0){const i=x.FunctionType.getSpecializedReturnType(e);return i||(n?hi(e,t):x.UnknownType.create())}const hi=t.logCalls?(e,t)=>ie("getFunctionInferredReturnType",(()=>mi(e,t)),e):mi;function mi(e,t){var n;let i;if(x.FunctionType.isStubDefinition(e)||x.FunctionType.isPyTypedDefinition(e))return x.UnknownType.create();if(e.inferredReturnType)i=e.inferredReturnType;else{if(e.details.declaration){const t=e.details.declaration.node;!function(e){const t=W.disableSpeculativeMode();try{e()}finally{W.enableSpeculativeMode(t)}}((()=>{i=mn(t,x.FunctionType.isAbstractMethod(e))})),i&&x.FunctionType.isWrapReturnTypeInAwait(e)&&(i=hn(t,i,!!(null===(n=e.details.declaration)||void 0===n?void 0:n.isGenerator)))}i||(i=x.UnknownType.create()),e.inferredReturnType=i}if(k.isPartlyUnknown(i)&&x.FunctionType.hasUnannotatedParams(e)&&!x.FunctionType.isStubDefinition(e)&&!x.FunctionType.isPyTypedDefinition(e)&&t){const n=function(e,t){var n;let i;if(!e.details.declaration)return;const s=e.details.declaration.node;if(t.some((e=>!e.paramName)))return;if(te.some((e=>e.functionNode===s)))return;const r=an(s);if(!r)return;if(t.length>6)return;if(te.length>=3)return;if(ti(s,(()=>{const n=ne;te.push({functionNode:s,codeFlowAnalyzer:Wn()});try{ne=new Map;let a=!0;s.parameters.forEach(((e,n)=>{if(e.name){let i;const o=t.find((t=>e.name.value===t.paramName));o&&o.argument.valueExpression?(i=ge(o.argument.valueExpression).type,x.isUnknown(i)||(a=!1)):e.defaultValue?(i=ge(e.defaultValue).type,x.isUnknown(i)||(a=!1)):0===n&&(x.FunctionType.isInstanceMethod(r.functionType)||x.FunctionType.isClassMethod(r.functionType))&&r.functionType.details.parameters.length>0&&s.parameters[0].name&&(i=r.functionType.details.parameters[0].type),i||(i=x.UnknownType.create()),ae(e.name,i,!1)}})),a||(i=mn(s,x.FunctionType.isAbstractMethod(e)))}finally{te.pop(),ne=n}})),i)return i=x.removeUnbound(i),x.FunctionType.isWrapReturnTypeInAwait(e)&&!k.isNoReturnType(i)&&(i=hn(s,i,!!(null===(n=e.details.declaration)||void 0===n?void 0:n.isGenerator))),i;return}(e,t);n&&(i=k.removeNoReturnFromUnion(n))}return i}function yi(e){const t=an(e);return t?x.FunctionType.isAbstractMethod(t.functionType)?x.AnyType.create():x.FunctionType.isGenerator(t.functionType)?k.getDeclaredGeneratorReturnType(t.functionType):t.functionType.details.declaredReturnType:x.AnyType.create()}function gi(e){return x.isInstantiableClass(e.classType)?k.partiallySpecializeType(li(e.symbol),e.classType):x.UnknownType.create()}function fi(e,t){if(x.isInstantiableClass(t.classType)){const n=ci(t.symbol);if(n)return{node:e,type:k.partiallySpecializeType(n.type,t.classType),isIncomplete:!!n.isIncomplete}}}function Ti(e,t,n,i,s,r,a){if(a>x.maxTypeRecursionCount)return!0;const o=e.details.fields;if(x.ClassType.isSameGenericClass(t,e))return!!x.isTypeSame(t,e,!0)||Ci(e,t,n,i,s,a+1);const l=x.ClassType.cloneForSpecialization(e,void 0,!1),c=new P.TypeVarMap(k.getTypeVarScopeId(e));let p=!0;const d=k.buildTypeVarMapFromSpecializedClass(t);if(o.forEach(((e,i)=>{if(e.isClassMember()&&!e.isIgnoredForProtocolMatch()){let s,o=!1;if(r&&t.details.effectiveMetaclass&&x.isInstantiableClass(t.details.effectiveMetaclass)&&(s=k.lookUpClassMember(t.details.effectiveMetaclass,i),d.addSolveForScope(k.getTypeVarScopeId(t.details.effectiveMetaclass)),o=!0),s||(s=k.lookUpClassMember(t,i)),s){let r=di(e);if(r){let l=gi(s);if(x.isFunction(l)||x.isOverloadedFunction(l))if(o){const e=Ni(t,l,void 0,void 0,a+1,!1,t);if(e&&(l=e),x.isFunction(r)||x.isOverloadedFunction(r)){const e=Ni(t,r,void 0,void 0,a+1,!1,t);e&&(r=e)}}else if(x.isInstantiableClass(s.classType)){const e=Ni(x.ClassType.cloneAsInstance(t),l,s.classType,void 0,a+1);if(e&&(l=e),x.isFunction(r)||x.isOverloadedFunction(r)){const e=Ni(x.ClassType.cloneAsInstance(t),r,s.classType,void 0,a+1);e&&(r=e)}}const d=n.createAddendum();x.isClassInstance(r)&&x.ClassType.isPropertyClass(r)&&x.isClassInstance(l)&&x.ClassType.isPropertyClass(l)?vi(x.ClassType.cloneAsInstantiable(r),x.ClassType.cloneAsInstantiable(l),t,d.createAddendum(),c,a+1)||(d.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1):Di(r,l,d.createAddendum(),c,0,a+1)||(d.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1);const u=e.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal));u!==s.symbol.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal))&&(u?d.addMessage(h.Localizer.DiagnosticAddendum.memberIsFinalInProtocol().format({name:i})):d.addMessage(h.Localizer.DiagnosticAddendum.memberIsNotFinalInProtocol().format({name:i})),p=!1)}e.isClassVar()&&!s.symbol.isClassMember()&&(n.addMessage(h.Localizer.DiagnosticAddendum.protocolMemberClassVar().format({name:i})),p=!1)}else n.addMessage(h.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:i})),p=!1}})),e.details.baseClasses.forEach((o=>{if(x.isInstantiableClass(o)&&!x.ClassType.isBuiltIn(o,"object")&&!x.ClassType.isBuiltIn(o,"Protocol")){Ti(k.specializeForBaseClass(e,o),t,n.createAddendum(),i,s,r,a+1)||(p=!1)}})),p&&e.details.typeParameters.length>0&&e.typeArguments){const t=k.applySolvedTypeVars(l,c);Ci(e,t,n,i,s,a+1)||(p=!1)}return p}function _i(e,t,n,i,s,r){if(r>x.maxTypeRecursionCount)return!0;let a=!0;const o=e.details.fields,l=x.ClassType.cloneForSpecialization(e,void 0,!1),c=new P.TypeVarMap(k.getTypeVarScopeId(e));if(o.forEach(((i,s)=>{if(i.isClassMember()&&!i.isIgnoredForProtocolMatch()){const o=t.fields.get(s);if(o){let t=di(i);if(t){const i=li(o);if((x.isFunction(i)||x.isOverloadedFunction(i))&&(x.isFunction(t)||x.isOverloadedFunction(t))){const n=Ni(x.ClassType.cloneAsInstance(e),t,e,void 0,r+1);n&&(t=n)}const l=n.createAddendum();Di(t,i,l.createAddendum(),c,0,r+1)||(l.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:s})),a=!1)}}else n.addMessage(h.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:s})),a=!1}})),e.details.baseClasses.forEach((o=>{if(x.isInstantiableClass(o)&&!x.ClassType.isBuiltIn(o,"object")&&!x.ClassType.isBuiltIn(o,"Protocol")){_i(k.specializeForBaseClass(e,o),t,n.createAddendum(),i,s,r+1)||(a=!1)}})),a&&e.details.typeParameters.length>0&&e.typeArguments){const t=k.applySolvedTypeVars(l,c);Ci(e,t,n,i,s,r)||(a=!1)}return a}function vi(e,t,n,i,s,r=0){const a=x.ClassType.cloneAsInstance(n);let o=!0;return[{name:"fget",missingDiagMsg:h.Localizer.DiagnosticAddendum.missingGetter,incompatibleDiagMsg:h.Localizer.DiagnosticAddendum.incompatibleGetter},{name:"fset",missingDiagMsg:h.Localizer.DiagnosticAddendum.missingSetter,incompatibleDiagMsg:h.Localizer.DiagnosticAddendum.incompatibleSetter},{name:"fdel",missingDiagMsg:h.Localizer.DiagnosticAddendum.missingDeleter,incompatibleDiagMsg:h.Localizer.DiagnosticAddendum.incompatibleDeleter}].forEach((n=>{const l=e.details.fields.get(n.name),c=l?di(l):void 0;if(c&&x.isFunction(c)){const e=t.details.fields.get(n.name),l=e?di(e):void 0;if(!l||!x.isFunction(l))return i.addMessage(n.missingDiagMsg()),void(o=!1);const p=Ni(a,c),d=Ni(a,l);if(!p||!d||!Di(p,d,i.createAddendum(),s,0,r+1))return i.addMessage("getter type is incompatible"),void(o=!1)}})),o}function bi(e,t,n,i,s,r,a,l=!1){if(x.ClassType.isTypedDictClass(e)&&x.ClassType.isTypedDictClass(t))return function(e,t,n,i){let s=!0;const r=Ei(e),a=Ei(t,!0);return r.forEach(((r,o)=>{const l=a.get(o);l?(r.isRequired&&!l.isRequired?(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:o,type:Oi(e)})),s=!1):!r.isRequired&&l.isRequired&&(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldNotRequired().format({name:o,type:Oi(e)})),s=!1),x.isTypeSame(r.valueType,l.valueType,!0,i+1)||(n.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:o})),s=!1)):(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldMissing().format({name:o,type:Oi(t)})),s=!1)})),s}(e,t,n,r);const c=R.get(e.details.fullName);if(c&&c.some((e=>e===t.details.fullName))&&0==(1&s))return!0;const p=[],d=x.ClassType.isDerivedFrom(t,e,p);if(x.ClassType.isProtocolClass(e)&&(!d||l))return Ti(e,t,n,i,s,l,r+1);if((0==(1&s)||x.ClassType.isSameGenericClass(t,e))&&d)return o.assert(p.length>0),function(e,t,n,i,s,r,a){let o=t,l=s||new P.TypeVarMap(k.getTypeVarScopeId(e)),c=r;s||(c&=-9);for(let t=n.length-1;t>=0;t--){const s=n[t];if(x.isUnknown(s))return!0;if(x.ClassType.isBuiltIn(s,"object"))return!0;if(t0&&x.isVariadicTypeVar(t[n-1]),p=o.tupleTypeArguments;let d=p.length;const u=2===d&&k.isEllipsisType(p[1]);if(u&&(d=1),r&&u)return i.addMessage(h.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),!1;if(!(p.length===n&&!u||s||r))return u?i.addMessage(h.Localizer.DiagnosticAddendum.tupleSizeMismatchIndeterminate().format({expected:n})):i.addMessage(h.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:n,received:p.length})),!1;{const o=Math.max(n,d);for(let m=0;m=n-1){if(y=t[n-1],Q&&x.isInstantiableClass(Q)){const e=p.slice(m);o=k.convertToInstance(k.specializeTupleClass(Q,e.map((e=>k.stripLiteralValue(e))),!0,!0,!0)),f=!0}}else y=s?t[0]:m0&&o.typeArguments&&!s.isLocked()){const t=o.typeArguments;for(let n=0;n=1&&s.setVariadicTypeVar(e.details.typeParameters[0],o.tupleTypeArguments)}return!0}(e,t,p,n,i,s,r+1);if(x.ClassType.isBuiltIn(e,"object")&&0==(1&s))return!0;const u=a?x.ClassType.cloneAsInstance(e):e,m=a?x.ClassType.cloneAsInstance(t):t;let y=Oi(u),g=Oi(m);return y===g&&e.details.fullName&&t.details.fullName&&(y=e.details.fullName,g=t.details.fullName),n.addMessage(h.Localizer.DiagnosticAddendum.typeIncompatible().format({sourceType:g,destType:y})),!1}function Ii(e,t){if(!x.ClassType.isPropertyClass(e))return;const n=e.details.fields.get("fget");if(n){const e=di(n);if(e&&x.isFunction(e))return ui(e,void 0,t)}}function Ci(e,t,n,i,s,r){o.assert(x.ClassType.isSameGenericClass(e,t));const a=x.ClassType.getTypeParameters(e);let c,p;if(!e.typeArguments||!t.typeArguments)return!0;if(x.ClassType.isTupleClass(e)?(c=e.tupleTypeArguments||[],p=t.tupleTypeArguments):(c=e.typeArguments,p=t.typeArguments),p)for(let e=0;e=c.length?c.length-1:e,d=o>=0?c[o]:x.UnknownType.create(),u=o({category:e.category,name:e.name,hasDefault:!!e.hasDefault,type:x.FunctionType.getEffectiveParameterType(n,t)}))),r=i.getParamSpec(e);if(!r)return!i.isLocked()&&a&&i.setParamSpec(e,{concrete:{parameters:s,flags:t.details.flags}}),!0;if(r.concrete&&r.concrete.parameters.length===s.length&&!r.concrete.parameters.some(((e,t)=>{const n=s[t];return e.category!==n.category||e.name!==n.name||e.hasDefault!==n.hasDefault||!x.isTypeSame(e.type,n.type)})))return!0}return n.addMessage(h.Localizer.DiagnosticAddendum.typeParamSpec().format({type:Oi(t),name:e.details.name})),!1}if(e.details.isVariadic){const e=x.isClassInstance(t)&&k.isTupleClass(t)&&!!t.isTupleForUnpackedVariadicTypeVar;x.isVariadicTypeVar(t)||e||(t=Q&&x.isInstantiableClass(Q)?k.convertToInstance(k.specializeTupleClass(Q,[t],!0,!0,!0)):x.UnknownType.create())}const c=i.getTypeVar(e),p=null==c?void 0:c.narrowBound,d=null==c?void 0:c.wideBound;if(e.details.constraints.length>0){let s;const c=Ge(t);if(x.isTypeVar(t))Di(e,c,new l.DiagnosticAddendum,new P.TypeVarMap(e.scopeId),void 0,r+1)&&(s=t);else{let t,n=!0;s=k.mapSubtypes(c,(i=>{let s,a;return x.isAnyOrUnknown(i)?i:(e.details.constraints.forEach(((t,n)=>{const o=x.TypeBase.isInstantiable(e)?k.convertToInstantiable(t):t;Di(o,i,new l.DiagnosticAddendum,void 0,void 0,r+1)&&(s&&!Di(s,o,new l.DiagnosticAddendum,void 0,void 0,r+1)||(s=k.addConditionToType(t,k.getTypeCondition(i)),a=n))})),s||o||(n=!1),void 0===a||k.getTypeCondition(i)||(void 0!==t&&t!==a&&(n=!1),t=a),s)})),!x.isNever(s)&&n||(s=void 0)}if(!s)return n.addMessage(h.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Oi(t),name:e.details.name})),!1;if(p&&!x.isAnyOrUnknown(p)){if(!Di(p,s,new l.DiagnosticAddendum,void 0,void 0,r+1)){if(!Di(s,p,new l.DiagnosticAddendum,void 0,void 0,r+1))return n.addMessage(h.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Oi(s),name:Oi(p)})),!1;!i.isLocked()&&a&&i.setTypeVarType(e,s)}}else!i.isLocked()&&a&&i.setTypeVarType(e,s);return!0}let u=p,m=d;const y=new l.DiagnosticAddendum,g=0!=(128&s)||i.getRetainLiterals(e)||e.details.boundType&&k.containsLiteralType(e.details.boundType)||e.details.constraints.some((e=>k.containsLiteralType(e)));let f=g?t:k.stripLiteralValue(t);if(x.TypeBase.isInstantiable(e)){if(!x.TypeBase.isInstantiable(f))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(f),destType:Oi(e)})),!1;f=k.convertToInstance(f)}if(o||0!=(4&s)){if(d){if(!x.isTypeSame(d,f))if(Di(d,f,y,void 0,void 0,r+1))m=t;else if(!Di(f,d,y,void 0,void 0,r+1))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(f),destType:Oi(d)})),n.addAddendum(y),!1}else m=f;if(p&&!Di(m,p,new l.DiagnosticAddendum,void 0,void 0,r+1))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(f),destType:Oi(p)})),n.addAddendum(y),!1}else{if(p){if(!x.isTypeSame(p,f))if(Di(p,f,y,i,s,r+1))u=k.isPartlyUnknown(p)&&Di(f,p,new l.DiagnosticAddendum,i,s,r+1)?f:p;else{if(i.isLocked()||x.isTypeVar(f))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(p),destType:Oi(f)})),!1;if(x.isVariadicTypeVar(e))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(p),destType:Oi(f)})),!1;u=Di(f,p,new l.DiagnosticAddendum,i,s,r+1)?f:x.isUnion(p)&&p.subtypes.length>64&&void 0!==e.details.boundType&&H&&x.isClassInstance(H)?x.combineTypes([p,H]):x.combineTypes([p,f])}}else u=f;if(d&&!x.isTypeSame(d,u)&&!Di(Ge(d),u,new l.DiagnosticAddendum,i,s,r+1))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(d),destType:Oi(f)})),!1}if(e.details.boundType){const s=u||m;if(x.TypeBase.isInstantiable(e)&&!x.TypeBase.isInstantiable(t))return!1;if(!Di(e.details.boundType,s,n.createAddendum(),i,0,r+1))return e.details.isSynthesized||n.addMessage(h.Localizer.DiagnosticAddendum.typeBound().format({sourceType:Oi(s),destType:Oi(e.details.boundType),name:x.TypeVarType.getReadableName(e)})),!1}return!i.isLocked()&&a&&i.setTypeVarType(e,u,m,g),!0}function Di(e,t,n,i,s=0,r=0){if(e=k.transformPossibleRecursiveTypeAlias(e),t=k.transformPossibleRecursiveTypeAlias(t),x.isUnion(e)&&1===e.subtypes.length&&x.isVariadicTypeVar(e.subtypes[0])&&(e=e.subtypes[0]),x.isUnion(t)&&1===t.subtypes.length&&x.isVariadicTypeVar(t.subtypes[0])&&(t=t.subtypes[0]),r>x.maxTypeRecursionCount)return!0;if(e===t)return!0;if(x.isUnbound(e)||x.isUnbound(t))return!0;const a=s;if(s&=-69,x.isTypeVar(e)){if(x.isTypeSame(e,t))return!0;const o=e;if(void 0===x.findSubtype(t,(e=>{var t;return!x.isTypeSame(o,e,!0)&&(!(null===(t=k.getTypeCondition(e))||void 0===t?void 0:t.find((e=>e.typeVarName===x.TypeVarType.getNameWithScope(o))))||0!==o.details.constraints.length&&!o.details.constraints.some((t=>Di(t,e,new l.DiagnosticAddendum))))})))return!0;if(x.isVariadicTypeVar(o)&&x.isClassInstance(t)&&k.isTupleClass(t)&&t.tupleTypeArguments&&1===t.tupleTypeArguments.length&&x.isTypeSame(o,t.tupleTypeArguments[0]))return!0;if(0==(2&s))return 8&s?Di(Ge(e),Ge(t),n,void 0,s,r+1):Si(e,t,n,i||new P.TypeVarMap,a,r+1)}if(x.isTypeVar(t)){if(0!=(2&s))return 0!=(8&s)?Di(Ge(t),Ge(e),n,void 0,s,r+1):Si(t,e,n,i||new P.TypeVarMap(k.getTypeVarScopeId(t)),a,r+1);if(0!=(1&s)&&!x.isAnyOrUnknown(e))return n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1}if(x.isAnyOrUnknown(e))return!0;if(x.isAnyOrUnknown(t)){if(i){const n=k.isEllipsisType(t)?x.AnyType.create():t;k.setTypeArgumentsRecursive(e,n,i)}if(0==(16&s))return!0}if(x.isNever(t))return i&&k.setTypeArgumentsRecursive(e,x.UnknownType.create(),i),!0;const o=Ge(t);if(x.isUnion(o)){if(x.isTypeSame(o,e))return!0;if(1&s&&x.isUnion(e)){const t=[];let a=[...o.subtypes],l=!1;if(e.subtypes.forEach((e=>{if(k.requiresSpecialization(e))t.push(e);else{const t=a.findIndex((t=>x.isTypeSame(t,e)));t>=0?a.splice(t,1):l=!0}})),l||[...a].forEach((e=>{const o=t.findIndex((t=>x.isClass(e)&&x.isClass(t)&&x.TypeBase.isInstance(e)===x.TypeBase.isInstance(t)&&x.ClassType.isSameGenericClass(e,t)));o>=0&&(Di(t[o],e,n.createAddendum(),i,s,r+1)||(l=!0),t.splice(o,1),a=a.filter((t=>t!==e)))})),l||0===t.length&&0===a.length||1===t.length&&x.isTypeVar(t[0])&&Di(t[0],x.combineTypes(a),n.createAddendum(),i,s,r+1)||(l=!0),!l)return!0}let a=!1;return k.doForEachSubtype(o,(t=>{Di(e,t,new l.DiagnosticAddendum,i,s,r+1)||Di(e,Ge(t),n.createAddendum(),i,s,r+1)||(a=!0)})),!a||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1)}if(x.isUnion(e)){if(1&s){let a=!1;return k.doForEachSubtype(e,((o,c)=>{if(!a&&!Di(o,t,n.createAddendum(),i,s,r+1)){let t=!1;x.isAnyOrUnknown(o)||k.doForEachSubtype(e,((e,n)=>{c===n||t||Di(e,o,new l.DiagnosticAddendum,void 0,0,r+1)&&(t=!0)})),t||(a=!0)}})),!a||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1)}const a=new l.DiagnosticAddendum;let o=!1;if(x.isNone(t)&&k.isOptionalType(e))o=!0;else{let n,l;if(x.isClassInstance(t)&&k.isLiteralType(t)&&x.UnionType.containsType(e,t,void 0))return!0;k.doForEachSubtype(e,(e=>{const c=null==i?void 0:i.clone();if(Di(e,t,a,c,s,r+1)&&(o=!0,c)){const e=c.getScore();(void 0===l||l<=e)&&(l=e,n=c)}})),i&&n&&i.copyFromClone(n)}return o||x.isTypeVar(t)&&t.details.constraints.length>0&&(o=Di(e,Ge(t),a,i,s,r+1)),!!o||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),n.addAddendum(a),!1)}if(x.isNone(e)&&x.isNone(t))return x.TypeBase.isInstance(e)===x.TypeBase.isInstance(t);if(x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"type")){const a=t.typeArguments;if(a&&a.length>=1){if(x.isAnyOrUnknown(a[0]))return!(!x.isClassInstance(e)||!x.ClassType.isBuiltIn(t,"type"))||x.TypeBase.isInstantiable(e);if(x.isClassInstance(a[0])||x.isTypeVar(a[0]))return!!Di(e,k.convertToInstantiable(a[0]),n.createAddendum(),i,s,r+1)||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1)}}if(x.isInstantiableClass(e)){const a=Ge(t);if(x.isInstantiableClass(a))return!!bi(e,a,n,i,s,r+1,!1)||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1)}if(x.isClassInstance(e)){if(x.ClassType.isBuiltIn(e,"Type")){const a=e.typeArguments;if(a&&a.length>=1&&x.TypeBase.isInstance(a[0])&&x.TypeBase.isInstantiable(t))return Di(a[0],k.convertToInstance(t),n,i,s,r+1)}else if(x.ClassType.isBuiltIn(e,"type")){if(x.TypeBase.isInstantiable(t))return!0}else if(x.ClassType.isBuiltIn(e,"TypeGuard")&&0!=(64&a)&&x.isClassInstance(t)&&x.ClassType.isBuiltIn(t,"bool"))return!0;const o=Ge(t);if(x.isClass(o)&&x.TypeBase.isInstance(o)){if(void 0!==e.literalValue){if(void 0===o.literalValue||!x.ClassType.isLiteralValueSame(o,e))return n.addMessage(h.Localizer.DiagnosticAddendum.literalAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1}return!!bi(x.ClassType.cloneAsInstantiable(e),x.ClassType.cloneAsInstantiable(o),n,i,s,r+1,!0)}if(x.isFunction(o)||x.isOverloadedFunction(o)){const t=Fi(e);if(t)return Di(t,o,n,i,s,r+1);if(H&&x.isClassInstance(H))return Di(e,H,n,i,s,r+1)}else if(x.isModule(o)){if(x.ClassType.isBuiltIn(e,"ModuleType"))return!0;if(x.ClassType.isProtocolClass(e))return _i(x.ClassType.cloneAsInstantiable(e),o,n,i,s,r+1)}else if(x.isInstantiableClass(o)){const t=Fi(e);if(t)return Di(t,o,n,i,s,r+1);const a=o.details.effectiveMetaclass;if(a)return!!x.isAnyOrUnknown(a)||bi(x.ClassType.cloneAsInstantiable(e),x.ClassType.isProtocolClass(e)?o:a,n,i,s,r+1,!1,!0)}else{if(x.isAnyOrUnknown(o))return 0==(16&s);if(x.isUnion(o))return Di(e,o,n,i,s,r+1)}}if(x.isFunction(e)){let a,o=Ge(t);if(x.isClassInstance(o)){const e=k.lookUpObjectMember(o,"__call__");if(e){const t=gi(e);if(x.isFunction(t)||x.isOverloadedFunction(t)){const e=Ni(o,t,void 0,void 0,r+1);e&&(o=e)}}}if(x.isInstantiableClass(o)&&void 0===o.literalValue){const e=function(e){const t=k.lookUpClassMember(e,"__init__",12);if(t){const n=gi(t),i=x.ClassType.cloneAsInstance(e),s=e=>{let t=Ni(i,e);return t&&(t=x.FunctionType.clone(t),t.details.declaredReturnType=i,t.specializedTypes&&(t.specializedTypes.returnType=i)),t};if(x.isFunction(n))return s(n);if(x.isOverloadedFunction(n)){const e=[];if(n.overloads.forEach((t=>{const n=s(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:x.OverloadedFunctionType.create(e)}}const n=k.lookUpClassMember(e,"__new__",12);if(n){const t=gi(n),i=t=>Ni(e,t,void 0,void 0,void 0,!0);if(x.isFunction(t))return i(t);if(x.isOverloadedFunction(t)){const e=[];if(t.overloads.forEach((t=>{const n=i(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:x.OverloadedFunctionType.create(e)}}const i=x.FunctionType.createInstance("__new__","","",69);return i.details.declaredReturnType=x.ClassType.cloneAsInstance(e),x.FunctionType.addDefaultParameters(i),i}(o);e&&(o=e)}if(x.isOverloadedFunction(o)){if(e.details.paramSpec)return n.addMessage(h.Localizer.DiagnosticAddendum.paramSpecOverload()),!1;const t=o.overloads,l=t.findIndex((t=>{if(!x.FunctionType.isOverloaded(t))return!1;const a=i?i.clone():void 0;return Di(e,t,n.createAddendum(),a,s,r+1)}));if(l<0)return n.addMessage(h.Localizer.DiagnosticAddendum.noOverloadAssignable().format({type:Oi(e)})),!1;a=t[l]}else if(x.isFunction(o))a=o;else if(x.isAnyOrUnknown(o))return 0==(16&s);if(a&&function(e,t,n,i,s,r){let a=!0;const o=0==(32&s);s&=-33;const c=t.details.parameters,p=e.details.parameters;let d=c.findIndex(((e,t)=>2===e.category||1===e.category&&!e.name||t>0&&1===c[t-1].category)),u=d<0?c:c.slice(0,d);const m=u.findIndex((e=>1===e.category&&e.name));u=u.filter((e=>0===e.category&&e.name));const y=p.findIndex(((e,t)=>2===e.category||1===e.category&&!e.name||t>0&&1===p[t-1].category));let g=y<0?p:p.slice(0,y);const f=g.findIndex((e=>1===e.category&&e.name)),T=f>=0&&x.isVariadicTypeVar(g[f].type)?g[f]:void 0;g=g.filter((e=>0===e.category&&e.name));const _=g.findIndex((e=>0===e.category&&x.isVariadicTypeVar(e.type)));if(_>=0){const e=u.slice(_,_+1+u.length-g.length);if(m<0){const n=e.map((e=>{const n=c.findIndex((t=>t===e));return x.FunctionType.getEffectiveParameterType(t,n)}));if(1!==n.length||!x.isVariadicTypeVar(n[0])){let e;e=Q&&x.isInstantiableClass(Q)?k.convertToInstance(k.specializeTupleClass(Q,n,!0,!0,!0)):x.UnknownType.create(),u=[...u.slice(0,_),{category:0,name:"_arg_combined",isNameSynthesized:!0,hasDeclaredType:!0,type:e},...u.slice(_+1+u.length-g.length,u.length)]}}}const v=Math.min(u.length,g.length),b=new P.TypeVarMap(k.getTypeVarScopeId(t)),I=c.findIndex((e=>2===e.category&&e.name)),C=p.findIndex((e=>2===e.category&&e.name)),D=p.findIndex((e=>0===e.category&&!e.name)),F=0!=(2&s)?!!t.details.paramSpec:!!e.details.paramSpec;if(!x.FunctionType.shouldSkipParamCompatibilityCheck(e)){for(let o=0;oe===u[o])),d=l>=0?x.FunctionType.getEffectiveParameterType(t,l):u[o].type,m=p.findIndex((e=>e===g[o])),y=x.FunctionType.getEffectiveParameterType(e,m),f=g[o].name,T=u[o].name||"";if(f&&!S.isPrivateOrProtectedName(f)&&!S.isPrivateOrProtectedName(T)){D>=0&&oe.type));let l,p=!1;if(m>=0){const e=x.FunctionType.getEffectiveParameterType(t,m);x.isVariadicTypeVar(e)?o.push(e):p=!0}l=1===o.length&&x.isVariadicTypeVar(o[0])?o[0]:Q&&x.isInstantiableClass(Q)?k.convertToInstance(k.specializeTupleClass(Q,o,!0,!0,!0)):x.UnknownType.create(),p?(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.argsParamWithVariadic().format({paramName:c[m].name})),a=!1):Ai(x.FunctionType.getEffectiveParameterType(e,f),l,f,n.createAddendum(),i,b,s,r)||(a=!1)}else if(g.length!!e.name&&!e.hasDefault&&0===e.category)).length;if(f<0)g.length=0&&Dt===u[e]))),e,n.createAddendum(),i,b,s,r)||(a=!1)}}}}else if(u.length=0){const o=x.FunctionType.getEffectiveParameterType(t,m);for(let t=u.length;te===g[t])));x.isVariadicTypeVar(l)&&!x.isVariadicTypeVar(o)?(n.addMessage(h.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),a=!1):Ai(l,o,t,n.createAddendum(),i,b,s,r)||(a=!1)}}else n.addMessage(h.Localizer.DiagnosticAddendum.functionTooManyParams().format({expected:u.length,received:g.length})),a=!1;if(m>=0&&f>=0){const o=x.FunctionType.getEffectiveParameterType(t,m);Ai(x.FunctionType.getEffectiveParameterType(e,f),o,f,n.createAddendum(),i,b,s,r)||(a=!1)}if(m<0&&f>=0&&!T&&(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.argsParamMissing().format({paramName:p[f].name})),a=!1),!F){const o=new Map;let l=!1;if(y>=0&&p.forEach(((e,t)=>{t>=y&&(2===e.category?l=!0:e.name&&0===e.category&&o.set(e.name,e))})),g.length=0&&c.forEach(((t,c)=>{if(c>=d&&t.name&&0===t.category){const c=o.get(t.name),p=n.createAddendum();if(c){const e=i?k.applySolvedTypeVars(c.type,i):c.type;Di(t.type,e,p.createAddendum(),void 0,s,r+1)||(p.addMessage(h.Localizer.DiagnosticAddendum.namedParamTypeMismatch().format({name:t.name,sourceType:Oi(e),destType:Oi(t.type)})),a=!1),o.delete(t.name)}else if(l||t.hasDefault){if(l){Ai(x.FunctionType.getEffectiveParameterType(e,C),t.type,C,n.createAddendum(),i,b,s,r)||(a=!1)}}else p.addMessage(h.Localizer.DiagnosticAddendum.namedParamMissingInDest().format({name:t.name})),a=!1}})),o.forEach(((e,l)=>{if(I>=0&&e.name){const l=x.FunctionType.getEffectiveParameterType(t,I);Ai(e.type,l,C,n.createAddendum(),i,b,s,r)||(a=!1),o.delete(e.name)}else{n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.namedParamMissingInSource().format({name:l})),a=!1}})),I>=0&&C>=0){const o=x.FunctionType.getEffectiveParameterType(t,I);Ai(x.FunctionType.getEffectiveParameterType(e,C),o,C,n.createAddendum(),i,b,s,r)||(a=!1)}I<0&&C>=0&&(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.kwargsParamMissing().format({paramName:p[C].name})),a=!1)}}if(i&&!i.isLocked()&&(b.getTypeVars().forEach((e=>{Di(e.typeVar,b.getTypeVarType(e.typeVar),new l.DiagnosticAddendum,i)})),i.getTypeVars().forEach((e=>{if(e.narrowBound){const t=k.applySolvedTypeVars(e.narrowBound,i);t!==e.narrowBound&&i.setTypeVarType(e.typeVar,t,e.wideBound,e.retainLiteral)}})),F)){const n=0==(2&s)?e:t,r=0==(2&s)?t:e;n.details.paramSpec&&i.setParamSpec(n.details.paramSpec,{concrete:{parameters:r.details.parameters.map(((e,t)=>({category:e.category,name:e.name,hasDefault:!!e.hasDefault,type:x.FunctionType.getEffectiveParameterType(r,t)}))).slice(n.details.parameters.length,r.details.parameters.length),flags:r.details.flags}})}if(o){const o=ui(e);if(!x.isAnyOrUnknown(o)){const e=k.applySolvedTypeVars(ui(t),b),l=n.createAddendum();let c=!1;(k.isNoReturnType(e)||Di(o,e,l.createAddendum(),i,s,r+1)||x.isClassInstance(e)&&x.ClassType.isBuiltIn(e,"TypeGuard")&&Z&&x.isInstantiableClass(Z)&&Di(o,x.ClassType.cloneAsInstance(Z),l.createAddendum(),i,s,r+1))&&(c=!0),c||(l.addMessage(h.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:Oi(e),destType:Oi(o)})),a=!1)}}return a}(e,a,n.createAddendum(),i||new P.TypeVarMap,s,r+1))return!0}if(x.isOverloadedFunction(e)){const a=n.createAddendum();return!!!e.overloads.some((e=>!!x.FunctionType.isOverloaded(e)&&(i&&i.addSolveForScope(k.getTypeVarScopeId(e)),!Di(e,t,a.createAddendum(),i||new P.TypeVarMap(k.getTypeVarScopeId(e)),s,r+1))))||(a.addMessage(h.Localizer.DiagnosticAddendum.overloadNotAssignable().format({name:e.overloads[0].details.name})),!1)}return!(!x.isClassInstance(e)||!x.ClassType.isBuiltIn(e,"object")||0!=(1&s))||(x.isNone(t)&&x.isClassInstance(e)&&x.ClassType.isProtocolClass(e)&&K&&x.isInstantiableClass(K)?Ti(x.ClassType.cloneAsInstantiable(e),K,n,i,s,!1,r+1):x.isNone(e)?(n.addMessage(h.Localizer.DiagnosticAddendum.assignToNone()),!1):(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Oi(t),destType:Oi(e)})),!1))}function Fi(e){if(!x.ClassType.isCallbackProtocolClass(e))return;const t=k.lookUpObjectMember(e,"__call__");if(!t)return;const n=gi(t);if(x.isFunction(n)||x.isOverloadedFunction(n)){const t=Ni(e,n);if(t)return t}}function Ai(e,t,n,i,s,r,a,o){if(x.isTypeVar(e)&&e.details.isSynthesized&&e.details.boundType&&x.isClassInstance(e.details.boundType)&&x.ClassType.isProtocolClass(e.details.boundType))return!0;Di(t,e,new l.DiagnosticAddendum,s,2^a,o+1);return!!Di(t,k.applySolvedTypeVars(e,s),i.createAddendum(),r,a,o+1)||(i.addMessage(h.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:Oi(e),destType:Oi(t)})),!1)}function xi(e,t){if(t.details.typeParameters.length>0&&t.typeArguments&&t.typeArguments.length<=t.details.typeParameters.length){const n=new P.TypeVarMap(k.getTypeVarScopeId(t));bt(x.ClassType.cloneForSpecialization(t,void 0,!1),x.ClassType.cloneAsInstance(e),n,[]);let i=!1;const s=t.typeArguments.map(((e,s)=>{const r=t.details.typeParameters[s],a=n.getTypeVarType(r);return a&&(x.isAny(a)||x.isAnyOrUnknown(e))?(i=!0,a):e}));if(i)return x.ClassType.cloneForSpecialization(t,s,!0)}}function ki(e,t){const n=new l.DiagnosticAddendum,i=k.mapSubtypes(t,(t=>{const i=k.mapSubtypes(e,(i=>{if(x.isAnyOrUnknown(e))return e;if(Di(i,t,n)){if(x.isInstantiableClass(i)&&x.isInstantiableClass(t)){const e=xi(i,t);e&&(t=e)}else if(x.isClassInstance(i)&&x.isClassInstance(t)){const e=xi(x.ClassType.cloneAsInstantiable(i),x.ClassType.cloneAsInstantiable(t));e&&(t=x.ClassType.cloneAsInstance(e))}else if(x.isAnyOrUnknown(t))return e;return t}}));return x.isNever(i)?t:i}));return x.isAnyOrUnknown(t)?e:i}function Pi(e){const t=new Map;e.details.mro.forEach((e=>{x.isInstantiableClass(e)&&e.details.fields.forEach(((n,i)=>{if(n.isClassMember()){let s;const r=D.getLastTypedDeclaredForSymbol(n);if(r&&3===r.type){s=!!(8&cn(r.node,!0))}else s=!1;t.has(i)||t.set(i,{symbol:n,symbolName:i,isAbstract:s,classType:e})}}))}));const n=[];return t.forEach((e=>{e.isAbstract&&n.push(e)})),n}function Ei(e,t=!1){if(!e.details.typedDictEntries){const t=new Map;wi(e,t),e.details.typedDictEntries=t}const n=new Map;return e.details.typedDictEntries.forEach(((e,t)=>{n.set(t,{...e})})),t&&e.typedDictNarrowedEntries&&e.typedDictNarrowedEntries.forEach(((e,t)=>{n.set(t,{...e})})),n}function wi(e,t,n=0){o.assert(x.ClassType.isTypedDictClass(e)),n>x.maxTypeRecursionCount||(e.details.baseClasses.forEach((e=>{x.isInstantiableClass(e)&&x.ClassType.isTypedDictClass(e)&&wi(e,t,n+1)})),e.details.fields.forEach(((n,i)=>{if(!n.isIgnoredForProtocolMatch()){const s=D.getLastTypedDeclaredForSymbol(n);if(s&&1===s.type){const r=di(n)||x.UnknownType.create();let a=!x.ClassType.isCanOmitDictValues(e);D.isRequiredTypedDictVariable(n)?a=!0:D.isNotRequiredTypedDictVariable(n)&&(a=!1);const o=t.get(i);if(o&&!x.isTypeSame(o.valueType,r)){const e=new l.DiagnosticAddendum;e.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldRedefinition().format({parentType:Oi(o.valueType),childType:Oi(r)})),Be(ii(s.node).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typedDictFieldRedefinition().format({name:i})+e.getString(),s.node)}t.set(i,{valueType:r,isRequired:a,isProvided:!1})}}})))}function Ni(e,t,n,i,s=0,r=!1,a){if(x.isFunction(t)){if(!e)return x.FunctionType.clone(t,!0);if(x.FunctionType.isInstanceMethod(t)){const r=x.isClassInstance(e)?e:x.ClassType.cloneAsInstance(k.specializeClassType(e));return Ri(e,t,n||x.ClassType.cloneAsInstantiable(r),i,s+1,a||r,x.isClassInstance(e))}if(x.FunctionType.isClassMethod(t)||r&&x.FunctionType.isConstructorMethod(t)){const r=x.isInstantiableClass(e)?e:x.ClassType.cloneAsInstantiable(e),o=a?x.isInstantiableClass(e)?a:k.convertToInstantiable(a):r;return Ri(e,t,n||r,i,s+1,o,!0)}if(x.FunctionType.isStaticMethod(t)){const r=x.isInstantiableClass(e)?e:x.ClassType.cloneAsInstantiable(e);return Ri(e,t,n||r,i,s+1,void 0,!1)}}else if(x.isOverloadedFunction(t)){const o=x.OverloadedFunctionType.create();return t.overloads.forEach((t=>{const i=Ni(e,t,n,void 0,s+1,r,a);i&&x.OverloadedFunctionType.addOverload(o,i)})),1===o.overloads.length?o.overloads[0]:0===o.overloads.length?void(i&&t.overloads.forEach((t=>{Ni(e,t,n,i,s+1,r,a)}))):o}return t}function Ri(e,t,n,i,s,r,a=!0){const o=n.typeArguments?k.buildTypeVarMapFromSpecializedClass(n):new P.TypeVarMap(k.getTypeVarScopeId(n));if(r&&t.details.parameters.length>0){const n=t.details.parameters[0],a=x.FunctionType.getEffectiveParameterType(t,0),p=k.stripLiteralValue(r);o.addSolveForScope(k.getTypeVarScopeId(t));const d=new l.DiagnosticAddendum;if(x.isTypeVar(a)&&a.details.boundType&&x.isClassInstance(a.details.boundType)&&x.ClassType.isProtocolClass(a.details.boundType))o.isLocked()||o.setTypeVarType(a,p);else if(!Di(a,p,d,o,void 0,s+1)&&n.name&&!n.isNameSynthesized&&n.hasDeclaredType){if(!i)return;{const s=t.details.name||"(unnamed)";Be(ii(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.bindTypeMismatch().format({type:Oi(e),methodName:s,paramName:n.name})+d.getString(),i)}}}ui(t);const p=k.applySolvedTypeVars(t,o);return x.FunctionType.clone(p,a,e,k.getTypeVarScopeId(e))}function Mi(e){return A.printObjectTypeForClass(e,t.printTypeFlags,ui)}function Oi(e,n=!1){let i=t.printTypeFlags;return n&&(i|=32),A.printType(e,i,ui)}function Li(e){return e.start}return{runWithCancellationToken:function(e,t){try{return q=e,t()}finally{q=void 0}},getType:me,getTypeOfClass:Jt,getTypeOfFunction:an,evaluateTypesForStatement:Nn,getDeclaredTypeForExpression:Fe,verifyRaiseExceptionType:function(e){const t=Jn(e,"BaseException");if(e.typeExpression){const n=ge(e.typeExpression).type;if(n&&t&&x.isInstantiableClass(t)){const i=new l.DiagnosticAddendum;if(k.doForEachSubtype(n,(n=>{const s=Ge(n);if(!x.isAnyOrUnknown(s))if(x.isInstantiableClass(s)&&void 0===s.literalValue)if(k.derivesFromClassRecursive(s,t,!1)){let t;ti(e.typeExpression,(()=>{t=Tt(e.typeExpression,[],s,!1,void 0)})),t&&t.argumentErrors&&i.addMessage(h.Localizer.Diagnostic.exceptionTypeNotInstantiable().format({type:Oi(n,!1)}))}else i.addMessage(h.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:Oi(n,!1)}));else x.isClassInstance(s)&&k.derivesFromClassRecursive(x.ClassType.cloneAsInstantiable(s),t,!1)||i.addMessage(h.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:Oi(n,!1)}))})),!i.isEmpty()){Be(ii(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.expectedExceptionClass()+i.getString(),e.typeExpression)}}}},verifyDeleteExpression:He,isAfterNodeReachable:Me,isNodeReachable:Re,suppressDiagnostics:ti,getDeclarationsForNameNode:function(e){var t;if(f.isCodeUnreachable(e))return;const n=[];if(e.parent&&23===e.parent.nodeType&&e.parent.alias&&e===e.parent.name){const t=b.getScopeForNode(e);if(t){const i=t.lookUpSymbolRecursive(e.parent.alias.value);if(i){const t=i.symbol.getDeclarations().filter((t=>6===t.type&&t.node===e.parent)).map((e=>{if(6===e.type){const t={...e};return t.usesLocalName=!1,t}return e}));n.push(...t)}}}else if(e.parent&&35===e.parent.nodeType&&e===e.parent.memberName){let t=me(e.parent.leftExpression);if(t){t=Ge(t);const i=e.parent.memberName.value;k.doForEachSubtype(t,(e=>{let t;if(e=Ge(e),x.isInstantiableClass(e)){let n=k.lookUpClassMember(e,i,16);n||(n=k.lookUpClassMember(e,i)),n&&(t=n.symbol)}else if(x.isClassInstance(e)){let n=k.lookUpObjectMember(e,i,16);n||(n=k.lookUpObjectMember(e,i)),n&&(t=n.symbol)}else x.isModule(e)&&(t=x.ModuleType.getField(e,i));if(t){const e=t.getTypedDeclarations();e.length>0?n.push(...e):n.push(...t.getDeclarations())}}))}}else if(e.parent&&37===e.parent.nodeType){const t=e.parent.nameParts.findIndex((t=>t===e)),i=f.getImportInfo(e.parent);if(t>=0&&i&&!i.isNativeLib&&t{const t=si(e,s);t&&n.push(t)}));else if(x.isInstantiableClass(e)){const r=null===(t=be(i.parent.leftExpression,x.ClassType.cloneAsInstance(e),"__init__",{method:"get"},new l.DiagnosticAddendum,4))||void 0===t?void 0:t.type;if(r&&x.isFunction(r)){const t=si(r,s);if(t)n.push(t);else if(x.ClassType.isDataClass(e)){const t=k.lookUpClassMember(e,s);t&&n.push(...t.symbol.getDeclarations())}}}}}else{let t=ii(e).isStubFile;v.isWithinTypeAnnotation(e,!Te(ii(e)))&&(t=!0);const i=ei(e,e.value,!t);i&&n.push(...i.symbol.getDeclarations())}return n},getTypeForDeclaration:ri,resolveAliasDeclaration:oi,getTypeFromIterable:ke,getTypeFromIterator:xe,getTypedDictMembersForClass:Ei,getGetterTypeFromProperty:Ii,markNamesAccessed:function(e,t){const n=ii(e),i=b.getScopeForNode(e);i&&t.forEach((t=>{const s=i.lookUpSymbolRecursive(t);s&&Ye(n,s.symbol,e)}))},getScopeIdForNode:et,makeTopLevelTypeVarsConcrete:Ge,getEffectiveTypeOfSymbol:li,getFunctionDeclaredReturnType:yi,getFunctionInferredReturnType:hi,getBuiltInType:Jn,getTypeOfMember:gi,bindFunctionToClassOrObject:Ni,getCallSignatureInfo:function(e,t,n){const i=e.leftExpression,s=me(i);if(void 0===s)return;const r=[];let a=0;function o(){r.push({argumentCategory:a,type:x.UnknownType.create(),active:!0})}e.arguments.forEach(((e,i)=>{let s=!1;i===t&&(n?s=!0:o()),a=e.argumentCategory,r.push({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,name:e.name,active:s})})),e.arguments.length{n=Dt(i,r,t,new P.TypeVarMap(k.getTypeVarScopeId(t)),!0)})),l.push({type:t,activeParam:null==n?void 0:n.activeParam})}function p(e){x.isFunction(e)?c(e):e.overloads.forEach((e=>{x.FunctionType.isOverloaded(e)&&c(e)}))}return k.doForEachSubtype(s,(e=>{switch(e.category){case 5:case 6:p(e);break;case 7:if(x.TypeBase.isInstantiable(e)){let t;t=Ce(e,"__init__"),(!t||x.isFunction(t)&&x.FunctionType.isSkipConstructorCheck(t))&&(t=Ce(e,"__new__",!0)),t&&p(t)}else{const t=Ce(e,"__call__");t&&p(t)}}})),0!==l.length?{callNode:e,signatures:l}:void 0},getTypeAnnotationForParameter:Se,getAbstractMethods:Pi,canAssignType:Di,canOverrideMethod:function(e,t,n,i=!0){if(x.isOverloadedFunction(e)&&(e=e.overloads[e.overloads.length-1]),!x.isFunction(e))return n.addMessage(h.Localizer.DiagnosticAddendum.overrideType().format({type:Oi(e)})),!1;let s=!0;const r=e.details.parameters,a=t.details.parameters,o=a.find((e=>1===e.category&&!!e.name)),l=a.find((e=>2===e.category&&!!e.name));let c=!1;if(a.lengthr.length)for(let e=r.length;e!e.name&&0===e.category));for(let o=0;od&&!S.isPrivateOrProtectedName(l.name||"")&&0===l.category&&l.name!==c.name)0===c.category&&i&&(n.addMessage(h.Localizer.DiagnosticAddendum.overrideParamName().format({index:o+1,baseName:l.name||"*",overrideName:c.name||"*"})),s=!1);else{const i=x.FunctionType.getEffectiveParameterType(e,o),r=x.FunctionType.getEffectiveParameterType(t,o),a=x.isTypeVar(i)&&i.details.isSynthesized,p=x.isTypeVar(r)&&r.details.isSynthesized;a||p||l.category===c.category&&Di(r,i,n.createAddendum(),void 0,8)||(n.addMessage(h.Localizer.DiagnosticAddendum.overrideParamType().format({index:o+1,baseType:Oi(i),overrideType:Oi(r)})),s=!1)}}const u=ui(e),m=ui(t);return Di(u,m,n.createAddendum(),void 0,8)||(n.addMessage(h.Localizer.DiagnosticAddendum.overrideReturnType().format({baseType:Oi(u),overrideType:Oi(m)})),s=!1),s},canAssignProtocolClassToSelf:function e(t,n,i=0){o.assert(x.ClassType.isProtocolClass(t)),o.assert(x.ClassType.isProtocolClass(n)),o.assert(x.ClassType.isSameGenericClass(t,n)),o.assert(t.details.typeParameters.length>0);const s=new l.DiagnosticAddendum,r=new P.TypeVarMap;let a=!0;return t.details.fields.forEach(((e,l)=>{if(a&&e.isClassMember()&&!e.isIgnoredForProtocolMatch()){const c=k.lookUpClassMember(n,l);o.assert(void 0!==c);let p=di(e);if(p){const o=gi(c);if(p=k.partiallySpecializeType(p,t),x.isClassInstance(p)&&x.ClassType.isPropertyClass(p)&&x.isClassInstance(o)&&x.ClassType.isPropertyClass(o))vi(x.ClassType.cloneAsInstantiable(p),x.ClassType.cloneAsInstantiable(o),n,s,r,i+1)||(a=!1);else{const t=e.getDeclarations()[0],n=1!==(null==t?void 0:t.type)||t.isFinal?0:1;Di(p,o,s,r,n,i+1)||(a=!1)}}}})),t.details.baseClasses.forEach((s=>{if(x.isInstantiableClass(s)&&x.ClassType.isProtocolClass(s)&&!x.ClassType.isBuiltIn(s,"object")&&!x.ClassType.isBuiltIn(s,"Protocol")&&s.details.typeParameters.length>0){e(k.specializeForBaseClass(t,s),k.specializeForBaseClass(n,s),i+1)||(a=!1)}})),a},addError:Ue,addWarning:function(e,t,n){return Ve("warning",e,t,n)},addInformation:Le,addUnusedCode:function(e,t){if(!ze(e)){ii(e).diagnosticSink.addUnusedCodeWithTextRange(h.Localizer.Diagnostic.unreachableCode(),t)}},addDiagnostic:Be,addDiagnosticForTextRange:function(e,t,n,i,s){if("none"===t)return;const r=e.diagnosticSink.addDiagnosticWithTextRange(t,i,s);return n&&r.setRule(n),r},printType:Oi,printFunctionParts:function(e){return A.printFunctionParts(e,t.printTypeFlags,ui)},getTypeCacheSize:function(){return B.size}}}},96938:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluatorWithTracker=void 0;const i=n(98173),s=n(76962),r=n(68755);t.createTypeEvaluatorWithTracker=function(e,t,n,a){if(!t.logCalls&&i.isDebugMode())return r.createTypeEvaluator(e,t,n,void 0);function o(e,i,r){return t.logCalls?n.log(e,(e=>(e.add(null==a?void 0:a.print(r)),s.timingStats.typeEvaluationTime.timeOperation(i))),t.minimumLoggingThreshold,!0):s.timingStats.typeEvaluationTime.timeOperation(i)}const l=t.logCalls?i=>n.log("import lookup",(t=>(t.add(null==a?void 0:a.printFileOrModuleName(i)),e(i))),t.minimumLoggingThreshold,!0):e,c=r.createTypeEvaluator(l,t,n,a);return{runWithCancellationToken:c.runWithCancellationToken,getType:e=>o("getType",(()=>c.getType(e)),e),getTypeOfClass:e=>o("getTypeOfClass",(()=>c.getTypeOfClass(e)),e),getTypeOfFunction:e=>o("getTypeOfFunction",(()=>c.getTypeOfFunction(e)),e),evaluateTypesForStatement:e=>o("evaluateTypesForStatement",(()=>c.evaluateTypesForStatement(e)),e),getDeclaredTypeForExpression:e=>o("getDeclaredTypeForExpression",(()=>c.getDeclaredTypeForExpression(e)),e),verifyRaiseExceptionType:e=>o("verifyRaiseExceptionType",(()=>c.verifyRaiseExceptionType(e)),e),verifyDeleteExpression:e=>o("verifyDeleteExpression",(()=>c.verifyDeleteExpression(e)),e),isAfterNodeReachable:e=>o("isAfterNodeReachable",(()=>c.isAfterNodeReachable(e)),e),isNodeReachable:e=>o("isNodeReachable",(()=>c.isNodeReachable(e)),e),suppressDiagnostics:(e,t)=>o("suppressDiagnostics",(()=>c.suppressDiagnostics(e,t))),getDeclarationsForNameNode:e=>o("getDeclarationsForNameNode",(()=>c.getDeclarationsForNameNode(e)),e),getTypeForDeclaration:e=>o("getTypeForDeclaration",(()=>c.getTypeForDeclaration(e)),e),resolveAliasDeclaration:(e,t)=>o("resolveAliasDeclaration",(()=>c.resolveAliasDeclaration(e,t)),e),getTypeFromIterable:(e,t,n)=>o("getTypeFromIterable",(()=>c.getTypeFromIterable(e,t,n)),e),getTypeFromIterator:(e,t,n)=>o("getTypeFromIterator",(()=>c.getTypeFromIterator(e,t,n)),e),getTypedDictMembersForClass:(e,t)=>o("getTypedDictMembersForClass",(()=>c.getTypedDictMembersForClass(e,t)),e),getGetterTypeFromProperty:(e,t)=>o("getGetterTypeFromProperty",(()=>c.getGetterTypeFromProperty(e,t)),e),markNamesAccessed:(e,t)=>o("markNamesAccessed",(()=>c.markNamesAccessed(e,t)),e),getScopeIdForNode:e=>o("getScopeIdForNode",(()=>c.getScopeIdForNode(e)),e),makeTopLevelTypeVarsConcrete:e=>o("makeTopLevelTypeVarsConcrete",(()=>c.makeTopLevelTypeVarsConcrete(e)),e),getEffectiveTypeOfSymbol:e=>o("getEffectiveTypeOfSymbol",(()=>c.getEffectiveTypeOfSymbol(e)),e),getFunctionDeclaredReturnType:e=>o("getFunctionDeclaredReturnType",(()=>c.getFunctionDeclaredReturnType(e)),e),getFunctionInferredReturnType:e=>o("getFunctionInferredReturnType",(()=>c.getFunctionInferredReturnType(e)),e),getBuiltInType:(e,t)=>o("getBuiltInType",(()=>c.getBuiltInType(e,t)),e),getTypeOfMember:e=>o("getTypeOfMember",(()=>c.getTypeOfMember(e)),e.symbol),bindFunctionToClassOrObject:(e,t)=>o("bindFunctionToClassOrObject",(()=>c.bindFunctionToClassOrObject(e,t)),t),getCallSignatureInfo:(e,t,n)=>o("getCallSignatureInfo",(()=>c.getCallSignatureInfo(e,t,n)),e),getTypeAnnotationForParameter:(e,t)=>o("getTypeAnnotationForParameter",(()=>c.getTypeAnnotationForParameter(e,t)),e),getAbstractMethods:e=>o("getAbstractMethods",(()=>c.getAbstractMethods(e)),e),canAssignType:(e,t,n,i,s)=>o("canAssignType",(()=>c.canAssignType(e,t,n,i,s)),e),canOverrideMethod:(e,t,n,i)=>o("canOverrideMethod",(()=>c.canOverrideMethod(e,t,n,i)),t),canAssignProtocolClassToSelf:(e,t)=>o("canAssignProtocolClassToSelf",(()=>c.canAssignProtocolClassToSelf(e,t))),addError:(e,t)=>o("addError",(()=>c.addError(e,t)),t),addWarning:(e,t)=>o("addWarning",(()=>c.addWarning(e,t)),t),addInformation:(e,t)=>o("addInformation",(()=>c.addInformation(e,t)),t),addUnusedCode:(e,t)=>o("addUnusedCode",(()=>c.addUnusedCode(e,t)),e),addDiagnostic:(e,t,n,i)=>o("addDiagnostic",(()=>c.addDiagnostic(e,t,n,i)),i),addDiagnosticForTextRange:(e,t,n,i,s)=>o("addDiagnosticForTextRange",(()=>c.addDiagnosticForTextRange(e,t,n,i,s))),printType:(e,t)=>o("printType",(()=>c.printType(e,t)),e),printFunctionParts:e=>o("printFunctionParts",(()=>c.printFunctionParts(e)),e),getTypeCacheSize:c.getTypeCacheSize}}},22105:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.printFunctionParts=t.printObjectTypeForClass=t.printLiteralValue=t.printType=void 0;const a=r(n(23241)),o=n(59195),l=n(10425),c=/'/g;function p(e,t,n,i=[]){const s=0!=(16&t);if(t&=-17,e.typeAliasInfo){let s=!0;if((0==(32&t)||i.find((t=>t===e)))&&(s=!1),!s)try{i.push(e);let s=e.typeAliasInfo.name;const r=e.typeAliasInfo.typeParameters;if(r){let a;e.typeAliasInfo.typeArguments?(0==(2&t)||e.typeAliasInfo.typeArguments.some((e=>!o.isAnyOrUnknown(e))))&&(a=[],e.typeAliasInfo.typeArguments.forEach(((e,s)=>{const c=s{a.push(p(e,t,n,i))})):a.push(p(e,t,n,i))}))):(0==(2&t)||r.some((e=>!o.isAnyOrUnknown(e))))&&(a=[],r.forEach((e=>{a.push(p(e,t,n,i))}))),a&&(0===a.length?s+="[()]":s+=`[${a.join(", ")}]`)}if(10!==e.category)return s}finally{i.pop()}}if(i.find((t=>t===e))||i.length>o.maxTypeRecursionCount)return"...";try{i.push(e);const r=0==(64&t),a=e=>void 0!==e.condition&&r?"*":"";switch(e.category){case 0:return"Unbound";case 1:return 0!=(1&t)?"Any":"Unknown";case 8:return`Module("${e.moduleName}")`;case 7:return o.TypeBase.isInstance(e)?void 0!==e.literalValue?`Literal[${d(e)}]`:`${u(e,t,n,i)}${a(e)}`:void 0!==e.literalValue?`Type[Literal[${d(e)}]]${a(e)}`:`Type[${u(e,t,n,i)}]${a(e)}`;case 5:{const s=h(e,t,n,i);if(e.details.paramSpec){if(e.details.parameters.length>0){return`Callable[Concatenate[${e.details.parameters.map((e=>p(e.type,t,n,i))).join(", ")}, ${o.TypeVarType.getReadableName(e.details.paramSpec)}], ${s[1]}]`}return`Callable[${o.TypeVarType.getReadableName(e.details.paramSpec)}, ${s[1]}]`}const r=`(${s[0].join(", ")})`;return o.FunctionType.isParamSpecValue(e)?r:`${r} -> ${s[1]}`}case 6:return`Overload[${e.overloads.map((e=>p(e,t,n,i))).join(", ")}]`;case 9:{if(l.isOptionalType(e)){const s=o.removeNoneFromUnion(e);if(o.isNever(s))return"None";const r=p(s,t,n,i);return 8&t?r+" | None":"Optional["+r+"]"}const r=new Set,a=new Set,c=new Set;l.doForEachSubtype(e,(e=>{o.isClassInstance(e)&&void 0!==e.literalValue?a.add(d(e)):o.isInstantiableClass(e)&&void 0!==e.literalValue?c.add(d(e)):r.add(p(e,t,n,i))}));const u=[];if(r.forEach((e=>u.push(e))),a.size>0){const e=[];a.forEach((t=>e.push(t))),u.push(`Literal[${e.join(", ")}]`)}if(c.size>0){const e=[];c.forEach((t=>e.push(t))),u.push(`Type[Literal[${e.join(", ")}]]`)}if(1===u.length)return u[0];if(8&t){const e=u.join(" | ");return s?`(${e})`:e}return`Union[${u.join(", ")}]`}case 10:{if(e.details.isSynthesized){if(e.details.recursiveTypeAliasName)return 0!=(32&t)&&e.details.boundType?p(e.details.boundType,t,n,i):e.details.recursiveTypeAliasName;if(e.details.boundType){const s=p(e.details.boundType,-33&t,n,i);return o.TypeBase.isInstantiable(e)?`Type[${s}]`:s}return 0!=(1&t)?"Any":"Unknown"}if(e.details.isParamSpec)return`${o.TypeVarType.getReadableName(e)}`;let s=o.TypeVarType.getReadableName(e);return e.isVariadicUnpacked&&(s=`*${s}`),o.TypeBase.isInstantiable(e)?`Type[${s}]`:s}case 3:return`${o.TypeBase.isInstantiable(e)?"NoneType":"None"}${a(e)}`;case 4:return"Never";case 2:return e.isEllipsis?"...":"Any"}return""}finally{i.pop()}}function d(e){const t=e.literalValue;if(void 0===t)return"";let n;if("string"==typeof t){const i="bytes"===e.details.name?"b":"";n=JSON.stringify(t).toString(),n=`${i}'${n.substring(1,n.length-1).replace(c,"\\'")}'`}else n="boolean"==typeof t?t?"True":"False":t instanceof o.EnumLiteral?`${t.className}.${t.itemName}`:t.toString();return n}function u(e,t,n,i=[]){let s=e.aliasName||e.details.name;if(!o.ClassType.isPseudoGenericClass(e)){const r=o.ClassType.getTypeParameters(e),a=r.length>0?r[r.length-1]:void 0,l=!!a&&a.details.isVariadic,c=e.tupleTypeArguments||e.typeArguments;if(c)if(c.length>0){const e=[];let a=!0;c.forEach(((s,l)=>{const c=l(o.isAnyOrUnknown(e)||(a=!1),p(e,t,n,i))))):(o.isAnyOrUnknown(s)||(a=!1),e.push(p(s,t,n,i)))})),0!=(2&t)&&a||(s+="["+e.join(", ")+"]")}else(o.ClassType.isTupleClass(e)||l)&&(s+="[()]");else r.length>0&&(0==(2&t)||r.some((e=>!o.isAnyOrUnknown(e))))&&(s+="["+r.map((e=>p(e,t,n,i))).join(", ")+"]")}return s}function h(e,t,n,i=[]){const s=[];e.details.parameters.forEach(((r,l)=>{if(l===e.details.parameters.length-1&&1===r.category&&o.isVariadicTypeVar(r.type)){const r=o.FunctionType.getEffectiveParameterType(e,l);if(o.isClassInstance(r)&&o.ClassType.isBuiltIn(r,"tuple")&&r.tupleTypeArguments)return void r.tupleTypeArguments.forEach(((e,r)=>{const a=`_p${(l+r).toString()}: ${p(e,t,n,i)}`;s.push(a)}))}let c="";1===r.category?c+="*":2===r.category&&(c+="**"),r.name&&(c+=r.name);let d="=";if(r.name)if(r.hasDeclaredType||r.isTypeInferred){const s=o.FunctionType.getEffectiveParameterType(e,l);c+=": "+(i.lengthe.name===t))||this.symbols.push({symbol:e,name:t,alias:n,isAccessed:i})}}class y extends l.ParseTreeWalker{constructor(e,t){super(),this._accessedImportedSymbols=e,this._treatStringsAsSymbols=t}analyze(e){this.walk(e)}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitName(e){return this._accessedImportedSymbols.set(e.value,!0),!0}visitString(e){return this._treatStringsAsSymbols&&this._accessedImportedSymbols.set(e.value,!0),!0}}class g extends l.ParseTreeWalker{constructor(e,t,n){super(),this._stubPath=e,this._sourceFile=t,this._evaluator=n,this._indentAmount=0,this._includeAllImports=!1,this._typeStubText="",this._lineEnd="\n",this._tab=" ",this._classNestCount=0,this._functionNestCount=0,this._ifNestCount=0,this._emittedSuite=!1,this._emitDocString=!0,this._trackedImportAs=new Map,this._trackedImportFrom=new Map,this._accessedImportedSymbols=new Map,this._stubPath.endsWith("__init__.pyi")&&(this._includeAllImports=!0)}write(){const e=this._sourceFile.getParseResults();this._lineEnd=e.tokenizerOutput.predominantEndOfLineSequence,this._tab=e.tokenizerOutput.predominantTabSequence,this.walk(e.parseTree),this._writeFile()}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitClass(e){const t=e.name.value;this._emittedSuite=!0,this._emitDocString=!0,this._emitDecorators(e.decorators);let n=`class ${t}`;const i=e.arguments.filter((e=>void 0!==e.name||0!==e.argumentCategory||38!==e.valueExpression.nodeType||"object"!==e.valueExpression.value));return i.length>0&&(n+=`(${i.map((e=>{let t="";return e.name&&(t=e.name.value+"="),t+=this._printExpression(e.valueExpression),t})).join(", ")})`),n+=":",this._emitLine(n),this._emitSuite((()=>{this._classNestCount++,this.walk(e.suite),this._classNestCount--})),this._emitLine(""),this._emitLine(""),!1}visitFunction(e){const t=e.name.value;if(0===this._functionNestCount&&!p.isPrivateOrProtectedName(t)){this._emittedSuite=!0,this._emitDocString=!0,this._emitDecorators(e.decorators);let n,i=e.isAsync?"async ":"";if(i+=`def ${t}`,i+=`(${e.parameters.map(((t,n)=>this._printParameter(t,e,n))).join(", ")})`,e.returnTypeAnnotation?n=this._printExpression(e.returnTypeAnnotation,!0):e.functionAnnotationComment?n=this._printExpression(e.functionAnnotationComment.returnTypeAnnotation,!0):"__init__"===e.name.value?n="None":"__str__"===e.name.value?n="str":["__int__","__hash__"].some((t=>t===e.name.value))?n="int":["__eq__","__ne__","__gt__","__lt__","__ge__","__le__"].some((t=>t===e.name.value))&&(n="bool"),n&&(i+=" -> "+n),i+=":",!n){const t=this._evaluator.getTypeOfFunction(e);if(t&&d.isFunction(t.functionType)){let e=this._evaluator.getFunctionInferredReturnType(t.functionType);e=d.removeUnknownFromUnion(e),d.isNever(e)||d.isUnknown(e)||(i+=` # -> ${this._evaluator.printType(e,!1)}:`)}}this._emitLine(i),this._emitSuite((()=>{this._functionNestCount++,this.walk(e.suite),this._functionNestCount--})),this._emitLine("")}return!1}visitWhile(e){return this._emitDocString=!1,!1}visitFor(e){return this._emitDocString=!1,!1}visitTry(e){return this._emitDocString=!1,!1}visitWith(e){return this._emitDocString=!1,!1}visitIf(e){if(this._emitDocString=!1,0===this._functionNestCount&&0===this._ifNestCount){this._ifNestCount++,this._emittedSuite=!0,this._emitLine("if "+this._printExpression(e.testExpression)+":"),this._emitSuite((()=>{this.walkMultiple(e.ifSuite.statements)}));const t=e.elseSuite;t&&(this._emitLine("else:"),this._emitSuite((()=>{19===t.nodeType?this.walkMultiple([t.testExpression,t.ifSuite,t.elseSuite]):this.walkMultiple(t.statements)}))),this._ifNestCount--}return!1}visitAssignment(e){let t=!1,n="";if(38===e.leftExpression.nodeType){if("__all__"===e.leftExpression.value)return!1;0===this._functionNestCount&&(n=this._printExpression(e.leftExpression),e.typeAnnotationComment&&(n+=": "+this._printExpression(e.typeAnnotationComment,!0)));const i=this._evaluator.getType(e.leftExpression);(null==i?void 0:i.typeAliasInfo)&&(t=!0)}else if(54===e.leftExpression.nodeType){const t=e.leftExpression.valueExpression;38===t.nodeType&&0===this._functionNestCount&&(n=`${this._printExpression(t)}: ${this._printExpression(e.leftExpression.typeAnnotation,!0)}`)}return n&&(this._emittedSuite=!0,n+=" = ",n+=t?this._printExpression(e.rightExpression):"...",this._emitLine(n)),!1}visitAugmentedAssignment(e){return!1}visitTypeAnnotation(e){if(0===this._functionNestCount){let t="";if(38===e.valueExpression.nodeType)t=this._printExpression(e.valueExpression);else if(35===e.valueExpression.nodeType){const n=e.valueExpression.leftExpression;if(38===n.nodeType&&"self"===n.value){const n=e.valueExpression.memberName.value;p.isPrivateOrProtectedName(n)||(t=this._printExpression(e.valueExpression))}}t&&(t+=": "+this._printExpression(e.typeAnnotation,!0),this._emitLine(t))}return!1}visitImport(e){if(this._functionNestCount>0||this._classNestCount>0)return!1;const t=c.getScopeForNode(e);return t&&e.list.forEach((e=>{const n=this._printModuleName(e.module);if(!this._trackedImportAs.has(n)){const i=e.alias?e.alias.value:e.module.nameParts.length>0?e.module.nameParts[0].value:"",s=t.lookUpSymbolRecursive(i);if(s){const t=new h(n,e.alias?e.alias.value:void 0,s.symbol);this._trackedImportAs.set(n,t)}}})),!1}visitImportFrom(e){if(this._functionNestCount>0||this._classNestCount>0)return!1;const t=c.getScopeForNode(e);if(t){const n=this._printModuleName(e.module);let i=this._trackedImportFrom.get(n);i||(i=new m(n,e.isWildcardImport,e),this._trackedImportFrom.set(n,i)),e.imports.forEach((e=>{const n=e.alias?e.alias.value:e.name.value,s=t.lookUpSymbolRecursive(n);s&&i.addSymbol(s.symbol,e.name.value,e.alias?e.alias.value:void 0,!1)}))}return!1}visitStatementList(e){return e.statements.length>0&&48===e.statements[0].nodeType&&!this._emittedSuite&&this._emitDocString&&this._emitLine(this._printExpression(e.statements[0])),this._emitDocString=!1,this.walkMultiple(e.statements),!1}_emitSuite(e){this._increaseIndent((()=>{const t=this._emittedSuite;this._emittedSuite=!1,e(),this._emittedSuite||this._emitLine("..."),this._emittedSuite=t}))}_increaseIndent(e){this._indentAmount++,e(),this._indentAmount--}_emitDecorators(e){e.forEach((e=>{this._emitLine("@"+this._printExpression(e.expression))}))}_printHeaderDocString(){return'"""'+this._lineEnd+"This type stub file was generated by pyright."+this._lineEnd+'"""'+this._lineEnd+this._lineEnd}_emitLine(e){for(let e=0;ee.value)).join("."),t}_printParameter(e,t,n){let i="";1===e.category?i+="*":2===e.category&&(i+="**"),e.name&&(i+=e.name.value);const s=this._evaluator.getTypeAnnotationForParameter(t,n);let r="";return s&&(r=this._printExpression(s,!0)),r&&(i+=": "+r),e.defaultValue&&(i+=r?" = ...":"=..."),i}_printExpression(e,t=!1,n=!1){return new y(this._accessedImportedSymbols,n).analyze(e),o.printExpression(e,t?1:0)}_printTrackedImports(){let e="",t=!1;return this._trackedImportAs.forEach((n=>{this._accessedImportedSymbols.get(n.alias||n.importName)&&(n.isAccessed=!0),(n.isAccessed||this._includeAllImports)&&(e+=`import ${n.importName}`,n.alias&&(e+=` as ${n.alias}`),e+=this._lineEnd,t=!0)})),this._trackedImportFrom.forEach((n=>{n.symbols.forEach((e=>{this._accessedImportedSymbols.get(e.alias||e.name)&&(e.isAccessed=!0)})),n.isWildcardImport&&(e+=`from ${n.importName} import *`+this._lineEnd,t=!0);const i=n.symbols.filter((e=>e.isAccessed||this._includeAllImports)).sort(((e,t)=>e.namet.name?1:0));i.length>0&&(e+=`from ${n.importName} import `,e+=i.map((e=>{let t=e.name;return e.alias&&(t+=" as "+e.alias),t})).join(", "),e+=this._lineEnd,t=!0)})),t&&(e+=this._lineEnd),e}_writeFile(){let e=this._printHeaderDocString();e+=this._printTrackedImports(),e+=this._typeStubText,this._sourceFile.fileSystem.writeFileSync(this._stubPath,e,"utf8")}}t.TypeStubWriter=g},10425:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMembersForClass=t.convertToInstantiable=t.convertToInstance=t.getDeclaredGeneratorReturnType=t.getDeclaredGeneratorSendType=t.getDeclaredGeneratorYieldType=t.removeTruthinessFromType=t.removeFalsinessFromType=t.derivesFromClassRecursive=t.specializeForBaseClass=t.buildTypeVarMap=t.buildTypeVarMapFromSpecializedClass=t.setTypeArgumentsRecursive=t.specializeClassType=t.selfSpecializeClassType=t.getTypeVarArgumentsRecursive=t.addTypeVarsToListIfUnique=t.getClassIterator=t.getClassMemberIterator=t.lookUpClassMember=t.lookUpObjectMember=t.transformExpectedTypeForConstructor=t.applySolvedTypeVars=t.partiallySpecializeType=t.isOpenEndedTupleClass=t.isTupleClass=t.isProperty=t.removeNoReturnFromUnion=t.isNoReturnType=t.isEllipsisType=t.containsLiteralType=t.isLiteralTypeOrUnion=t.isLiteralType=t.getSpecializedTupleType=t.getTypeVarScopeId=t.canBeTruthy=t.canBeFalsy=t.transformPossibleRecursiveTypeAlias=t.isTypeAliasRecursive=t.isTypeAliasPlaceholder=t.getTypeCondition=t.addConditionToType=t.stripLiteralValue=t.getFullNameOfType=t.derivesFromAnyOrUnknown=t.isUnionableType=t.areTypesSame=t.doForEachSubtype=t.mapSubtypes=t.isOptionalType=void 0,t.getDeclaringModulesForType=t.computeMroLinearization=t.requiresSpecialization=t.requiresTypeArguments=t.getGeneratorTypeArgs=t._transformTypeVars=t.specializeTupleClass=t.combineSameSizedTuples=t.explodeGenericClass=t.isPartlyUnknown=t.containsUnknown=t.getMembersForModule=void 0;const i=n(20823),s=n(97882),r=n(15020),a=n(59195),o=n(20670);let l=1;function c(e,t){if(a.isUnion(e)){const n=[];let i=!1;return e.subtypes.forEach((s=>{const r=t(s);r?r!==s?(n.push(u(r,h(e))),i=!0):n.push(s):i=!0})),i?a.combineTypes(n):e}const n=t(e);return n||a.NeverType.create()}function p(e,t){a.isUnion(e)?e.subtypes.forEach(((e,n)=>{t(e,n)})):t(e,0)}function d(e){return a.isClass(e)?(void 0!==e.literalValue&&(e=a.ClassType.cloneWithLiteral(e,void 0)),e):a.isUnion(e)?c(e,(e=>d(e))):e}function u(e,t){if(!t)return e;switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:return e;case 3:case 5:return a.TypeBase.cloneForCondition(e,a.TypeCondition.combine(e.condition,t));case 6:return a.OverloadedFunctionType.create(e.overloads.map((e=>u(e,t))));case 7:return a.TypeBase.cloneForCondition(e,a.TypeCondition.combine(e.condition,t));case 9:return a.combineTypes(e.subtypes.map((e=>u(e,t))))}}function h(e){switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:case 6:case 9:return;case 3:case 7:case 5:return e.condition}}function m(e,t=0){if(t>a.maxTypeRecursionCount)return!0;switch(e.category){case 0:case 1:case 2:case 4:case 3:return!0;case 9:return void 0!==a.findSubtype(e,(e=>m(e,t+1)));case 5:case 6:case 8:case 10:return!1;case 7:if(a.TypeBase.isInstantiable(e))return!1;if(v(e)&&e.tupleTypeArguments)return b(e)||0===e.tupleTypeArguments.length;if(a.ClassType.isBuiltIn(e,"bool")&&void 0!==e.literalValue)return!1===e.literalValue;if(S(e,"__len__"))return!0;return!!S(e,"__bool__")}}function y(e,t=0){if(t>a.maxTypeRecursionCount)return!0;switch(e.category){case 1:case 5:case 6:case 8:case 10:case 4:case 2:return!0;case 9:return void 0!==a.findSubtype(e,(e=>y(e,t+1)));case 0:case 3:return!1;case 7:return!!a.TypeBase.isInstantiable(e)||(!v(e)||!e.tupleTypeArguments||0!==e.tupleTypeArguments.length)&&(!1!==e.literalValue&&0!==e.literalValue&&""!==e.literalValue)}}function g(e){return a.isClass(e)||a.isFunction(e)?e.details.typeVarScopeId:a.isTypeVar(e)?e.scopeId:void 0}function f(e){return a.TypeBase.isInstance(e)&&void 0!==e.literalValue}function T(e){return a.isAny(e)&&e.isEllipsis}function _(e){return a.isClassInstance(e)&&a.ClassType.isBuiltIn(e,"NoReturn")}function v(e){return a.ClassType.isBuiltIn(e,"tuple")}function b(e){return e.tupleTypeArguments&&2===e.tupleTypeArguments.length&&T(e.tupleTypeArguments[1])}function I(e,t){if(a.ClassType.isGeneric(t))return e;return C(e,k(t))}function C(e,t,n=!1,i=!1,s=!1){return!t.isEmpty()||n||s?R(e,{transformTypeVar:e=>{if(e.scopeId&&t.hasSolveForScope(e.scopeId)){let s=t.getTypeVarType(e,i);if(s)return a.TypeBase.isInstantiable(e)&&(s=w(s)),s;if(n)return a.UnknownType.create()}return e},transformUnion:e=>{if(s){const n=c(e,(e=>{if(!a.isTypeVar(e)||void 0===e.scopeId||!t.hasSolveForScope(e.scopeId))return e}));return a.isNever(n)?e:n}return e},transformVariadicTypeVar:e=>{if(e.scopeId&&t.hasSolveForScope(e.scopeId))return t.getVariadicTypeVar(e)},transformParamSpec:e=>{if(e.scopeId&&t.hasSolveForScope(e.scopeId))return t.getParamSpec(e)}}):e}function S(e,t,n=0){if(a.isClassInstance(e))return D(e,t,n)}function D(e,t,n=0){var i;return null===(i=F(e,t,n).next())||void 0===i?void 0:i.value}function*F(e,t,n=0){const i=0!=(16&n);if(a.isClass(e)){let r=0;1&n&&(r|=1),2&n&&(r|=2),4&n&&(r|=4);const o=A(e,r);for(const[e,r]of o){if(!a.isInstantiableClass(e)){if(!i){const e={symbol:s.Symbol.createWithType(0,a.UnknownType.create()),isInstanceMember:!1,classType:a.UnknownType.create(),isTypeDeclared:!1};yield e}continue}if(!a.isInstantiableClass(r))continue;const o=r.details.fields;if(0==(8&n)){const e=o.get(t);if(e&&e.isInstanceMember()){const t=e.hasTypedDeclarations();if(!i||t){const n={symbol:e,isInstanceMember:!0,classType:r,isTypeDeclared:t};yield n}}}const l=o.get(t);if(l&&l.isClassMember()){const e=l.hasTypedDeclarations();if(!i||e){let t=!1;if(a.ClassType.isDataClass(r)||a.ClassType.isTypedDictClass(r)){const e=l.getDeclarations();e.length>0&&1===e[0].type&&(t=!0)}const n={symbol:l,isInstanceMember:t,classType:r,isTypeDeclared:e};yield n}}}}else if(a.isAnyOrUnknown(e)){const e={symbol:s.Symbol.createWithType(0,a.UnknownType.create()),isInstanceMember:!1,classType:a.UnknownType.create(),isTypeDeclared:!1};yield e}}function*A(e,t=0){if(a.isClass(e)){let n=0!=(1&t);for(const i of e.details.mro){if(n){n=!1;continue}const s=I(i,e);if(!(4&t&&a.isInstantiableClass(s)&&a.ClassType.isBuiltIn(s,"object"))&&(yield[i,s],0!=(2&t)))break}}}function x(e,t){for(const n of t)e.find((e=>a.isTypeSame(E(e),E(n))))||e.push(n)}function k(e,t=!0){const n=a.ClassType.getTypeParameters(e);let i=e.typeArguments;i||t||(i=n);const s=P(n,i,g(e));return a.ClassType.isTupleClass(e)&&e.tupleTypeArguments&&n.length>=1&&s.setVariadicTypeVar(n[0],e.tupleTypeArguments),s}function P(e,t,n){const i=new o.TypeVarMap(n);return e.forEach(((e,n)=>{let s;if(t)if(a.isParamSpec(e)){if(n{t.push({category:e.category,name:e.name,hasDefault:!!e.hasDefault,type:e.type})})),i.setParamSpec(e,{concrete:{parameters:t,flags:s.details.flags}})}else a.isParamSpec(s)&&i.setParamSpec(e,{paramSpec:s})}else s=n>=t.length?a.AnyType.create():t[n],i.setTypeVarType(e,s,void 0,!0)})),i}function E(e){let t=c(e,(e=>{switch(e.category){case 7:return a.ClassType.isBuiltIn(e,"Type")?!e.typeArguments||e.typeArguments.length<1?a.UnknownType.create():w(e.typeArguments[0]):a.ClassType.cloneAsInstance(e);case 3:return a.NoneType.createInstance();case 5:if(a.TypeBase.isInstantiable(e))return a.FunctionType.cloneAsInstance(e);break;case 10:if(a.TypeBase.isInstantiable(e))return a.TypeVarType.cloneAsInstance(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=a.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function w(e){let t=c(e,(e=>{switch(e.category){case 7:if(a.TypeBase.isInstance(e))return a.ClassType.cloneAsInstantiable(e);break;case 3:return a.NoneType.createType();case 5:if(a.TypeBase.isInstance(e))return a.FunctionType.cloneAsInstantiable(e);break;case 10:if(a.TypeBase.isInstance(e))return a.TypeVarType.cloneAsInstantiable(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=a.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function N(e,t,n=!0,i=!0,s=!1){let r=a.AnyType.create(!1);r=2===t.length&&T(t[1])?t[0]:a.combineTypes(t),i&&(r=d(r)),a.isNever(r)&&(r=a.AnyType.create());const o=a.ClassType.cloneForSpecialization(e,[r],n,void 0,t);return s&&(o.isTupleForUnpackedVariadicTypeVar=!0),o}function R(e,t,n=new Map,i=0){var s;if(i>a.maxTypeRecursionCount)return e;if(!V(e))return e;if(a.isAnyOrUnknown(e))return e;if(a.isNone(e))return e;if(a.isTypeVar(e)){if(e.details.recursiveTypeAliasName){if(!(null===(s=e.typeAliasInfo)||void 0===s?void 0:s.typeArguments))return e;let r=!1;const o=e.typeAliasInfo.typeArguments.map((e=>{const s=R(e,t,n,i+1);return s!==e&&(r=!0),s}));return r?a.TypeBase.cloneForTypeAlias(e,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,o):e}let r=e;const o=a.TypeVarType.getNameWithScope(e);return n.has(o)||(r=t.transformTypeVar(e),n.set(o,e),r=R(r,t,n,i+1),a.isVariadicTypeVar(e)&&e.isVariadicInUnion&&(r=L(r)),n.delete(o)),r}if(a.isUnion(e)){const s=c(e,(e=>{let s=R(e,t,n,i+1);if(a.isVariadicTypeVar(e)&&!a.isVariadicTypeVar(s)){const e=[];p(s,(t=>{e.push(L(t))})),s=a.combineTypes(e)}return s}));return t.transformUnion&&a.isUnion(s)?t.transformUnion(s):s}if(a.isClassInstance(e)){const s=M(a.ClassType.cloneAsInstantiable(e),t,n,i+1);return a.ClassType.cloneAsInstance(s)}if(a.isInstantiableClass(e))return M(e,t,n,i+1);if(a.isFunction(e))return O(e,t,n,i+1);if(a.isOverloadedFunction(e)){let s=!1;const r=[];return e.overloads.forEach((e=>{const a=O(e,t,n,i);r.push(a),a!==e&&(s=!0)})),s?a.OverloadedFunctionType.create(r):e}return e}function M(e,t,n,i){if(0===a.ClassType.getTypeParameters(e).length&&!a.ClassType.isSpecialBuiltIn(e))return e;let s,r=[],o=!1;const l=a.ClassType.getTypeParameters(e),c=e=>{const n=t.transformParamSpec(e);if(n){if(n.concrete){const e=a.FunctionType.createInstance("","","",65536);return n.concrete.parameters.forEach((t=>{a.FunctionType.addParameter(e,{category:t.category,name:t.name,hasDefault:t.hasDefault,hasDeclaredType:!0,type:t.type})})),e}if(n.paramSpec)return n.paramSpec}return e};return e.typeArguments?r=e.typeArguments.map((e=>{if(a.isTypeVar(e)&&e.details.isParamSpec)return c(e);let s=R(e,t,n,i+1);return s!==e&&(o=!0,a.isTypeVar(e)&&a.isVariadicTypeVar(e)&&e.isVariadicInUnion&&(s=L(s))),s})):l.forEach((e=>{let s=e;if(e.details.isParamSpec)s=c(e),s!==e&&(o=!0);else{const r=a.TypeVarType.getNameWithScope(e);n.has(r)||(s=t.transformTypeVar(e),s!==e&&(n.set(r,e),s=R(s,t,n,i+1),n.delete(r),o=!0))}r.push(s)})),a.ClassType.isTupleClass(e)&&(e.tupleTypeArguments?(s=[],e.tupleTypeArguments.forEach((e=>{const r=R(e,t,n,i+1);r!==e&&(o=!0),a.isVariadicTypeVar(e)&&a.isClassInstance(r)&&v(r)&&r.tupleTypeArguments?s.push(...r.tupleTypeArguments):s.push(r)}))):l.length>0&&(s=t.transformVariadicTypeVar(l[0]),s&&(o=!0))),o?a.ClassType.cloneForSpecialization(e,r,!0,void 0,s):e}function O(e,t,n,i){let s=e;if(s.details.paramSpec){const e=t.transformParamSpec(s.details.paramSpec);e&&(s=a.FunctionType.cloneForParamSpec(s,e))}const r=s.specializedTypes&&s.specializedTypes.returnType?s.specializedTypes.returnType:s.details.declaredReturnType,o=r?R(r,t,n,i+1):void 0;let l=r!==o;const c={parameterTypes:[],returnType:o};if(s.details.parameters.length>=2){const e=s.details.parameters[s.details.parameters.length-2],n=s.details.parameters[s.details.parameters.length-1],i=a.FunctionType.getEffectiveParameterType(s,s.details.parameters.length-2),r=a.FunctionType.getEffectiveParameterType(s,s.details.parameters.length-1);if(1===e.category&&2===n.category&&a.isParamSpec(i)&&a.isParamSpec(r)&&a.isTypeSame(i,r)){const e=t.transformParamSpec(i);e&&(s=a.FunctionType.cloneForParamSpecApplication(s,e))}}let p,d,u;for(let e=0;e{if(t===p)d.forEach((e=>{a.FunctionType.addParameter(h,{category:0,name:`_p${h.details.parameters.length}`,isNameSynthesized:!0,type:e,hasDeclaredType:!0})}));else{const n={...s.details.parameters[t]};n.type=e,n.name&&n.isNameSynthesized&&(n.name=`_p${h.details.parameters.length}`),a.FunctionType.addParameter(h,n)}})),h.details.declaredReturnType=a.FunctionType.getSpecializedReturnType(s),h}function L(e){return a.isClassInstance(e)&&v(e)&&e.tupleTypeArguments&&e.isTupleForUnpackedVariadicTypeVar?a.combineTypes(e.tupleTypeArguments):e}function U(e){if(a.isClassInstance(e)&&a.ClassType.isBuiltIn(e)){const t=e.details.name;if("Generator"===t||"AsyncGenerator"===t)return e.typeArguments}}function V(e,t=0){var n;switch(e.category){case 7:return e.typeArguments?!(t>a.maxTypeRecursionCount)&&void 0!==e.typeArguments.find((e=>V(e,t+1))):a.ClassType.getTypeParameters(e).length>0;case 5:{if(t>a.maxTypeRecursionCount)return!1;if(e.details.paramSpec)return!0;for(let n=0;nV(e,t+1)));case 9:return void 0!==a.findSubtype(e,(e=>V(e,t+1)));case 10:if(!e.details.recursiveTypeAliasName)return!0;if(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.typeArguments)return e.typeAliasInfo.typeArguments.some((e=>V(e,t+1)))}return!1}function z(e,t,n=0){if(n>a.maxTypeRecursionCount)return;const i=e=>{e&&!t.some((t=>t===e))&&t.push(e)};switch(e.category){case 7:case 5:i(e.details.moduleName);break;case 6:e.overloads.forEach((e=>{z(e,t,n+1)}));break;case 9:p(e,(e=>{z(e,t,n+1)}));break;case 8:i(e.moduleName)}}t.isOptionalType=function(e){return!!a.isUnion(e)&&void 0!==a.findSubtype(e,(e=>a.isNone(e)))},t.mapSubtypes=c,t.doForEachSubtype=p,t.areTypesSame=function(e,t){if(e.length<2)return!0;for(let n=1;n{a.isAnyOrUnknown(e)?t=!0:a.isInstantiableClass(n)?a.ClassType.hasUnknownBaseClass(n)&&(t=!0):a.isClassInstance(n)&&a.ClassType.hasUnknownBaseClass(n)&&(t=!0)})),t},t.getFullNameOfType=function(e){var t;if(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.fullName)return e.typeAliasInfo.fullName;switch(e.category){case 2:case 1:return"typing.Any";case 3:return"builtins.None";case 7:case 5:return e.details.fullName;case 8:return e.moduleName;case 6:return e.overloads[0].details.fullName}},t.stripLiteralValue=d,t.addConditionToType=u,t.getTypeCondition=h,t.isTypeAliasPlaceholder=function(e){return!!a.isTypeVar(e)&&(!!e.details.recursiveTypeAliasName&&!e.details.boundType)},t.isTypeAliasRecursive=function(e,t){return 9!==t.category?a.isUnbound(t)&&t.typeAliasInfo&&t.typeAliasInfo.name===e.details.recursiveTypeAliasName:void 0!==a.findSubtype(t,(t=>a.isTypeSame(e,t)))},t.transformPossibleRecursiveTypeAlias=function(e){var t;if(e&&a.isTypeVar(e)&&e.details.recursiveTypeAliasName&&e.details.boundType){const n=a.TypeBase.isInstance(e)?E(e.details.boundType):e.details.boundType;if(!(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.typeArguments)||!e.details.recursiveTypeParameters)return n;return C(n,P(e.details.recursiveTypeParameters,e.typeAliasInfo.typeArguments,g(e)))}return e},t.canBeFalsy=m,t.canBeTruthy=y,t.getTypeVarScopeId=g,t.getSpecializedTupleType=function(e){let t;if(a.isInstantiableClass(e)?t=e:a.isClassInstance(e)&&(t=a.ClassType.cloneAsInstantiable(e)),!t)return;const n=t.details.mro.find((e=>a.isInstantiableClass(e)&&v(e)));if(!n||!a.isInstantiableClass(n))return;return a.ClassType.isSameGenericClass(t,n)?t:C(n,k(t))},t.isLiteralType=f,t.isLiteralTypeOrUnion=function(e){return a.isClassInstance(e)?void 0!==e.literalValue:!!a.isUnion(e)&&!a.findSubtype(e,(e=>!a.isClassInstance(e)||void 0===e.literalValue))},t.containsLiteralType=function(e){return!(!a.isClassInstance(e)||!f(e))||!!a.isUnion(e)&&e.subtypes.some((e=>a.isClassInstance(e)&&f(e)))},t.isEllipsisType=T,t.isNoReturnType=_,t.removeNoReturnFromUnion=function(e){return a.removeFromUnion(e,(e=>_(e)))},t.isProperty=function(e){return a.isClassInstance(e)&&a.ClassType.isPropertyClass(e)},t.isTupleClass=v,t.isOpenEndedTupleClass=b,t.partiallySpecializeType=I,t.applySolvedTypeVars=C,t.transformExpectedTypeForConstructor=function(e,t,n){const i=e=>n.some((t=>e.scopeId===t));if(a.isTypeVar(e))return i(e)?e:void 0;const s="__expected_type_scope_id",r="__expected_type_";return t.addSolveForScope(s),R(e,{transformTypeVar:e=>i(e)?e:(e=>{if(e.details.isSynthesized&&e.details.name.startsWith(r))return e;const t=a.TypeBase.isInstance(e);let n=a.TypeVarType.createInstance(`__expected_type_${l}`);return n.details.isSynthesized=!0,n.scopeId=s,n.nameWithScope=a.TypeVarType.makeNameWithScope(n.details.name,s),t||(n=w(n)),n.details.boundType=e.details.boundType,n.details.constraints=e.details.constraints,n.details.variance=e.details.variance,l++,n})(e),transformVariadicTypeVar:e=>{},transformParamSpec:e=>{}})},t.lookUpObjectMember=S,t.lookUpClassMember=D,t.getClassMemberIterator=F,t.getClassIterator=A,t.addTypeVarsToListIfUnique=x,t.getTypeVarArgumentsRecursive=function e(t,n=0){var i,s;if(n>a.maxTypeRecursionCount)return[];if(null===(i=t.typeAliasInfo)||void 0===i?void 0:i.typeArguments){const i=[];return null===(s=t.typeAliasInfo)||void 0===s||s.typeArguments.forEach((t=>{x(i,e(t,n+1))})),i}if(a.isTypeVar(t))return t.details.recursiveTypeAliasName?[]:[a.TypeBase.isInstantiable(t)?a.TypeVarType.cloneAsInstance(t):t];if(a.isClass(t))return(t=>{const i=[];return t.typeArguments&&t.typeArguments.forEach((t=>{x(i,e(t,n+1))})),i})(t);if(a.isUnion(t)){const i=[];return p(t,(t=>{x(i,e(t,n+1))})),i}if(a.isFunction(t)){const i=[];for(let s=0;s{t.setTypeVarType(e,a.UnknownType.create())})),C(e,t)},t.setTypeArgumentsRecursive=function e(t,n,i,s=0){if(!(s>a.maxTypeRecursionCount||i.isLocked()))switch(t.category){case 9:p(t,(t=>{e(t,n,i,s+1)}));break;case 7:t.typeArguments&&t.typeArguments.forEach((t=>{e(t,n,i,s+1)})),t.tupleTypeArguments&&t.tupleTypeArguments.forEach((t=>{e(t,n,i,s+1)}));break;case 5:t.specializedTypes?(t.specializedTypes.parameterTypes.forEach((t=>{e(t,n,i,s+1)})),t.specializedTypes.returnType&&e(t.specializedTypes.returnType,n,i,s+1)):(t.details.parameters.forEach((t=>{e(t.type,n,i,s+1)})),t.details.declaredReturnType&&e(t.details.declaredReturnType,n,i,s+1));break;case 6:t.overloads.forEach((t=>{e(t,n,i,s+1)}));break;case 10:i.hasTypeVar(t)||i.setTypeVarType(t,n)}},t.buildTypeVarMapFromSpecializedClass=k,t.buildTypeVarMap=P,t.specializeForBaseClass=function(e,t){if(0===a.ClassType.getTypeParameters(t).length)return t;const n=C(t,k(e));return i.assert(a.isInstantiableClass(n)),n},t.derivesFromClassRecursive=function e(t,n,i){if(a.ClassType.isSameGenericClass(t,n))return!0;for(const s of t.details.baseClasses)if(a.isInstantiableClass(s)){if(e(s,n,i))return!0}else if(!i&&a.isAnyOrUnknown(s))return!0;return!1},t.removeFalsinessFromType=function(e){return c(e,(e=>{if(a.isClassInstance(e)){if(void 0!==e.literalValue)return e.literalValue?e:void 0;if(a.ClassType.isBuiltIn(e,"bool"))return a.ClassType.cloneWithLiteral(e,!0)}if(y(e))return e}))},t.removeTruthinessFromType=function(e){return c(e,(e=>{if(a.isClassInstance(e)){if(void 0!==e.literalValue)return e.literalValue?void 0:e;if(a.ClassType.isBuiltIn(e,"bool"))return a.ClassType.cloneWithLiteral(e,!1)}if(m(e))return e}))},t.getDeclaredGeneratorYieldType=function(e){const t=a.FunctionType.getSpecializedReturnType(e);if(t){const e=U(t);if(e&&e.length>=1)return e[0]}},t.getDeclaredGeneratorSendType=function(e){const t=a.FunctionType.getSpecializedReturnType(e);if(t){const e=U(t);return e&&e.length>=2?e[1]:a.UnknownType.create()}},t.getDeclaredGeneratorReturnType=function(e){const t=a.FunctionType.getSpecializedReturnType(e);if(t){const e=U(t);return e&&e.length>=3?e[2]:a.UnknownType.create()}},t.convertToInstance=E,t.convertToInstantiable=w,t.getMembersForClass=function(e,t,n){for(let i=0;i{(i.isClassMember()||n&&i.isInstanceMember())&&(i.isExclusiveClassMember()&&n||e&&r.isTypedDictMemberAccessedThroughIndex(i)||t.get(s)||t.set(s,i))}))}}if(!n){const n=e.details.effectiveMetaclass;if(n&&a.isInstantiableClass(n))for(const e of n.details.mro){if(!a.isInstantiableClass(e))break;e.details.fields.forEach(((e,n)=>{t.get(n)||t.set(n,e)}))}}},t.getMembersForModule=function(e,t){e.loaderFields&&e.loaderFields.forEach(((e,n)=>{t.set(n,e)})),e.fields.forEach(((e,n)=>{t.set(n,e)}))},t.containsUnknown=function(e){let t=!1;return p(e,(e=>{a.isUnknown(e)&&(t=!0)})),t},t.isPartlyUnknown=function e(t,n=!1,i=0){if(i>a.maxTypeRecursionCount)return!1;if(a.isUnknown(t))return!0;if(a.isUnion(t))return void 0!==a.findSubtype(t,(t=>e(t,n,i+1)));if(a.isClass(t)){if(a.TypeBase.isInstance(t)&&(n=!1),!n&&!a.ClassType.isPseudoGenericClass(t)){const s=t.tupleTypeArguments||t.typeArguments;if(s)for(const t of s)if(e(t,n,i+1))return!0}return!1}if(a.isOverloadedFunction(t))return t.overloads.some((t=>e(t,!1,i+1)));if(a.isFunction(t)){for(let n=0;na.ClassType.cloneForSpecialization(e,[t],!0)))):e},t.combineSameSizedTuples=function(e,t){if(!t||!a.isInstantiableClass(t))return;let n,i=!0;return p(e,(e=>{a.isClassInstance(e)&&v(e)&&!b(e)&&e.tupleTypeArguments?n?n.length===e.tupleTypeArguments.length?e.tupleTypeArguments.forEach(((e,t)=>{n[t].push(e)})):i=!1:n=e.tupleTypeArguments.map((e=>[e])):i=!1})),i&&n?E(N(t,n.map((e=>a.combineTypes(e))))):void 0},t.specializeTupleClass=N,t._transformTypeVars=R,t.getGeneratorTypeArgs=U,t.requiresTypeArguments=function(e){if(e.details.typeParameters.length>0)return!e.details.typeParameters[0].details.isSynthesized;if(a.ClassType.isSpecialBuiltIn(e)){if(["Tuple","Callable","Generic","Type","Optional","Union","Literal","Annotated","TypeGuard"].some((t=>t===(e.aliasName||e.details.name))))return!0}return!1},t.requiresSpecialization=V,t.computeMroLinearization=function(e){let t=!0;const n=[],i=e.details.baseClasses.filter((e=>!a.isInstantiableClass(e)||!a.ClassType.isBuiltIn(e,"Generic")));i.forEach((e=>{if(a.isInstantiableClass(e)){const t=k(e,!1);n.push(e.details.mro.map((e=>C(e,t))))}else n.push([e])})),n.push(i.map((t=>C(t,k(e,!1)))));const s=k(e,!1);e.details.mro.push(C(e,s));const r=(e,t)=>t.some((t=>t.findIndex((t=>a.isInstantiableClass(t)&&a.ClassType.isSameGenericClass(t,e)))>0)),o=(e,t)=>{for(let n=0;n!a.isInstantiableClass(t)||!a.ClassType.isSameGenericClass(t,e)))};for(;;){let i,s=!1;for(let t=0;t0){if(void 0===i&&(i=l),!a.isInstantiableClass(l[0])){s=!0,e.details.mro.push(l[0]),l.shift();break}if(!r(l[0],n)){s=!0,e.details.mro.push(l[0]),o(l[0],n);break}}}if(!i)break;s||(t=!1,a.isInstantiableClass(i[0])?(e.details.mro.push(i[0]),o(i[0],n)):(e.details.mro.push(i[0]),i.shift()))}return t},t.getDeclaringModulesForType=function(e){const t=[];return z(e,t),t}},20670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeVarMap=void 0;const i=n(20823),s=n(59195),r=n(10425);class a{constructor(e){this._isLocked=!1,Array.isArray(e)?this._solveForScopes=e:this._solveForScopes=void 0!==e?[e]:void 0,this._typeVarMap=new Map,this._paramSpecMap=new Map}clone(){const e=new a;return this._solveForScopes&&(e._solveForScopes=[...this._solveForScopes]),this._typeVarMap.forEach((t=>{e.setTypeVarType(t.typeVar,t.narrowBound,t.wideBound,t.retainLiteral)})),this._paramSpecMap.forEach((t=>{e.setParamSpec(t.paramSpec,t.type)})),this._variadicTypeVarMap&&this._variadicTypeVarMap.forEach((t=>{e.setVariadicTypeVar(t.typeVar,t.types)})),e._isLocked=this._isLocked,e}copyFromClone(e){this._typeVarMap=e._typeVarMap,this._paramSpecMap=e._paramSpecMap,this._variadicTypeVarMap=e._variadicTypeVarMap,this._isLocked=e._isLocked}getSolveForScopes(){return this._solveForScopes}hasSolveForScope(e){return void 0!==e&&void 0!==this._solveForScopes&&this._solveForScopes.some((t=>t===e||t===s.WildcardTypeVarScopeId))}setSolveForScopes(e){this._solveForScopes=e}addSolveForScope(e){void 0===e||this.hasSolveForScope(e)||(this._solveForScopes||(this._solveForScopes=[]),this._solveForScopes.push(e))}isEmpty(){return 0===this._typeVarMap.size&&0===this._paramSpecMap.size}getScore(){let e=0;return this._typeVarMap.forEach((t=>{e+=1;const n=this.getTypeVarType(t.typeVar);e+=this._getComplexityScoreForType(n)})),e+=this._paramSpecMap.size,e}hasTypeVar(e){return this._typeVarMap.has(this._getKey(e))}getTypeVarType(e,t=!1){const n=this._typeVarMap.get(this._getKey(e));if(n)return n.narrowBound?n.narrowBound:t?void 0:n.wideBound}setTypeVarType(e,t,n,s){i.assert(!this._isLocked);const r=this._getKey(e);this._typeVarMap.set(r,{typeVar:e,narrowBound:t,wideBound:n,retainLiteral:s})}getVariadicTypeVar(e){var t,n;return null===(n=null===(t=this._variadicTypeVarMap)||void 0===t?void 0:t.get(this._getKey(e)))||void 0===n?void 0:n.types}setVariadicTypeVar(e,t){i.assert(!this._isLocked);const n=this._getKey(e);this._variadicTypeVarMap||(this._variadicTypeVarMap=new Map),this._variadicTypeVarMap.set(n,{typeVar:e,types:t})}getTypeVar(e){const t=this._getKey(e);return this._typeVarMap.get(t)}getTypeVars(){const e=[];return this._typeVarMap.forEach((t=>{e.push(t)})),e}hasParamSpec(e){return this._paramSpecMap.has(this._getKey(e))}getParamSpec(e){var t;return null===(t=this._paramSpecMap.get(this._getKey(e)))||void 0===t?void 0:t.type}setParamSpec(e,t){i.assert(!this._isLocked),this._paramSpecMap.set(this._getKey(e),{paramSpec:e,type:t})}typeVarCount(){return this._typeVarMap.size}getWideTypeBound(e){const t=this._typeVarMap.get(this._getKey(e));if(t)return t.wideBound}getRetainLiterals(e){const t=this._typeVarMap.get(this._getKey(e));return!!(null==t?void 0:t.retainLiteral)}lock(){i.assert(!this._isLocked),this._isLocked=!0}unlock(){this._isLocked=!1}isLocked(){return this._isLocked}_getKey(e){return s.TypeVarType.getNameWithScope(e)}_getComplexityScoreForType(e,t=0){if(t>s.maxTypeRecursionCount)return 0;switch(e.category){case 5:case 6:return.5;case 10:return 1;case 9:{let n=1;return e.subtypes.length<16&&r.doForEachSubtype(e,(e=>{const i=this._getComplexityScoreForType(e,t+1);i{n+=this._getComplexityScoreForType(e,t+1),i++})):e.typeArguments&&e.typeArguments.forEach((e=>{n+=this._getComplexityScoreForType(e,t+1),i++}));let s=.5;return i>0&&(s+=n/i*.5),s}}t.TypeVarMap=a},59195:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSameWithoutLiteralValue=t.combineTypes=t.findSubtype=t.removeFromUnion=t.removeNoneFromUnion=t.removeUnbound=t.removeUnknownFromUnion=t.removeAnyFromUnion=t.isTypeSame=t.getTypeAliasInfo=t.isOverloadedFunction=t.isFunction=t.isParamSpec=t.isUnpackedVariadicTypeVar=t.isVariadicTypeVar=t.isTypeVar=t.isModule=t.isClassInstance=t.isInstantiableClass=t.isClass=t.isPossiblyUnbound=t.isUnion=t.isUnbound=t.isAnyOrUnknown=t.isUnknown=t.isAny=t.isNone=t.isNever=t.TypeVarType=t.UnionType=t.TypeCondition=t.AnyType=t.NeverType=t.NoneType=t.OverloadedFunctionType=t.FunctionType=t.ClassType=t.ModuleType=t.UnknownType=t.UnboundType=t.TypeBase=t.maxTypeRecursionCount=t.EnumLiteral=t.WildcardTypeVarScopeId=void 0;const i=n(20823);t.WildcardTypeVarScopeId="*";class s{constructor(e,t,n){this.className=e,this.itemName=t,this.itemType=n}}var r,a,o,l,c,p,d,u;function h(e){return 4===e.category}function m(e){return 3===e.category}function y(e){return 1===e.category}function g(e){return 2===e.category||1===e.category||!!T(e)&&void 0===e.subtypes.find((e=>!g(e)))}function f(e){return 0===e.category}function T(e){return 9===e.category}function _(e){return 7===e.category&&r.isInstantiable(e)}function v(e){return 7===e.category&&r.isInstance(e)}function b(e){return 10===e.category}function I(e,n,i=!1,s=0){if(e===n)return!0;if(e.category!==n.category)return!1;if(s>t.maxTypeRecursionCount)return!0;if(e.flags!==n.flags)return!1;switch(e.category){case 7:{const t=n;if(!o.isSameGenericClass(e,t,s+1))return!1;if(!d.isSame(e.condition,n.condition))return!1;if(!i||!o.isPseudoGenericClass(e))if(e.tupleTypeArguments&&t.tupleTypeArguments){const n=e.tupleTypeArguments||[],r=t.tupleTypeArguments||[];if(n.length!==r.length)return!1;for(let e=0;e!u.containsType(t,e,s+1)))}case 10:{const t=n;if(e.scopeId!==t.scopeId)return!1;if(e.details===t.details)return!0;if(e.details.name!==t.details.name||e.details.isParamSpec!==t.details.isParamSpec||e.details.isVariadic!==t.details.isVariadic||e.details.isSynthesized!==t.details.isSynthesized||e.details.variance!==t.details.variance)return!1;const r=e.details.boundType,a=t.details.boundType;if(r){if(!a||!I(r,a,i,s+1))return!1}else if(a)return!1;const o=e.details.constraints,l=t.details.constraints;if(o.length!==l.length)return!1;for(let e=0;e!t(e)));if(n.lengtht(e))):t(e)?e:void 0}function D(e,t){if(0===(e=e.filter((e=>4!==e.category))).length)return c.create();let n=!0;for(let t=1;tv(e)&&void 0!==e.literalValue||_(e)&&void 0!==e.literalValue?1:v(t)&&void 0!==t.literalValue||_(t)&&void 0!==t.literalValue?-1:v(e)&&e.isEmptyContainer?1:v(t)&&t.isEmptyContainer?-1:0)),0===i.length)return a.create();const s=u.create();let r=!1;return i.forEach(((e,n)=>{0===n?u.addType(s,e):void 0===t||s.subtypes.lengtht.maxTypeRecursionCount)return!0;if(n.details===i.details)return!0;const r=n.details,a=i.details;if(r===a)return!0;if(r.fullName!==a.fullName||r.flags!==a.flags||r.typeSourceId!==a.typeSourceId||r.baseClasses.length!==a.baseClasses.length||r.typeParameters.length!==a.typeParameters.length)return!1;if(e.isBuiltIn(n,"NamedTuple")&&e.isBuiltIn(i,"NamedTuple"))return!0;if(e.isBuiltIn(n,"tuple")&&e.isBuiltIn(i,"tuple"))return!0;for(let e=0;eh(e)?a.create():e)):void 0,o.isTypeArgumentExplicit=n,i&&(o.includeSubclasses=!0),o.tupleTypeArguments=s?s.map((e=>h(e)?a.create():e)):void 0,void 0!==r&&(o.isEmptyContainer=r),o},e.cloneWithLiteral=function(e,t){const n={...e};return n.literalValue=t,n},e.cloneForTypingAlias=function(e,t){const n={...e};return n.aliasName=t,n},e.cloneForNarrowedTypedDictEntries=function(e,t){const n={...e};return n.typedDictNarrowedEntries=t,n},e.cloneWithNewTypeParameters=function(e,t){const n={...e};return n.details={...n.details},n.details.typeParameters=t,n},e.cloneForTypeGuard=function(e,t){const n={...e};return n.typeGuardType=t,n},e.isLiteralValueSame=function(e,t){return void 0===e.literalValue?void 0===t.literalValue:void 0!==t.literalValue&&(e.literalValue instanceof s?t.literalValue instanceof s&&e.literalValue.itemName===t.literalValue.itemName:e.literalValue===t.literalValue)},e.isGeneric=function(e){return e.details.typeParameters.length>0&&void 0===e.typeArguments},e.isSpecialBuiltIn=function(e,t){return!!(2&e.details.flags||e.aliasName)&&(void 0===t||e.details.name===t)},e.isBuiltIn=n,e.hasAbstractMethods=function(e){return!!(1024&e.details.flags)},e.supportsAbstractMethods=function(e){return!!(512&e.details.flags)},e.isDataClass=function(e){return!!(4&e.details.flags)},e.isSkipSynthesizedDataClassInit=function(e){return!!(16&e.details.flags)},e.isSkipSynthesizedDataClassEq=function(e){return!!(32&e.details.flags)},e.isFrozenDataClass=function(e){return!!(8&e.details.flags)},e.isSynthesizedDataclassOrder=function(e){return!!(64&e.details.flags)},e.isDataClassKeywordOnlyParams=function(e){return!!(2097152&e.details.flags)},e.isTypedDictClass=function(e){return!!(128&e.details.flags)},e.isCanOmitDictValues=function(e){return!!(256&e.details.flags)},e.isEnumClass=function(e){return!!(1048576&e.details.flags)},e.isPropertyClass=function(e){return!!(2048&e.details.flags)},e.isFinal=function(e){return!!(4096&e.details.flags)},e.isProtocolClass=function(e){return!!(8192&e.details.flags)},e.isCallbackProtocolClass=function(e){return!!(4194304&e.details.flags)},e.isDefinedInStub=function(e){return!!(8388608&e.details.flags)},e.isPseudoGenericClass=function(e){return!!(16384&e.details.flags)},e.getDataClassEntries=function(e){return e.details.dataClassEntries||[]},e.isRuntimeCheckable=function(e){return!!(32768&e.details.flags)},e.isTypingExtensionClass=function(e){return!!(65536&e.details.flags)},e.isPartiallyConstructed=function(e){return!!(131072&e.details.flags)},e.hasCustomClassGetItem=function(e){return!!(262144&e.details.flags)},e.isTupleClass=function(e){return!!(524288&e.details.flags)},e.getTypeParameters=function(e){return e.details.typeParameters},e.hasUnknownBaseClass=function(e){return e.details.mro.some((e=>g(e)))},e.isSameGenericClass=i,e.isDerivedFrom=function e(t,s,r){if(i(t,s))return r&&r.push(t),!0;if(n(t)&&n(s,"object"))return r&&r.push(s),!0;for(const n of t.details.baseClasses)if(_(n)){if(e(n,s,r))return r&&r.push(t),!0}else if(g(n))return r&&r.push(a.create()),!0;return!1}}(o=t.ClassType||(t.ClassType={})),function(e){function t(e,t,n,i,s,r){return{category:5,details:{name:e,fullName:t,moduleName:n,flags:i,parameters:[],docString:r},flags:s}}function n(e,t){return i.assert(t0&&0===e.details.parameters[0].category?(e.details.parameters.length>0&&!e.details.parameters[0].isTypeInferred&&(a.strippedFirstParamType=n(e,0)),a.details.parameters=e.details.parameters.slice(1)):i=!1,a.boundToType=s,a.details.flags&=-4,a.details.flags|=4),void 0!==e.typeAliasInfo&&(a.typeAliasInfo=e.typeAliasInfo),e.specializedTypes&&(a.specializedTypes={parameterTypes:i?e.specializedTypes.parameterTypes.slice(1):e.specializedTypes.parameterTypes,returnType:e.specializedTypes.returnType}),a.inferredReturnType=e.inferredReturnType,a.boundTypeVarScopeId=r,a},e.cloneAsInstance=function(e){i.assert(r.isInstantiable(e));const t={...e};return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){i.assert(r.isInstance(e));const t={...e};return t.flags&=-11,t.flags|=1,t},e.cloneForSpecialization=function(e,n,s){const r=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return r.details=e.details,i.assert(n.parameterTypes.length===e.details.parameters.length),r.specializedTypes=n,s&&(r.inferredReturnType=s),r},e.cloneForParamSpec=function(e,n){const i=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return i.specializedTypes=e.specializedTypes,i.details={...e.details},delete i.details.paramSpec,n&&(n.concrete?(i.details.parameters=[...e.details.parameters,...n.concrete.parameters.map((e=>({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:!1,hasDeclaredType:!0,type:e.type})))],i.details.flags=7&n.concrete.flags|64,i.specializedTypes&&n.concrete.parameters.forEach((e=>{i.specializedTypes.parameterTypes.push(e.type)}))):n.paramSpec&&(i.details.paramSpec=n.paramSpec)),i},e.cloneForParamSpecApplication=function(e,n){const i=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return i.details={...e.details},n.concrete?(i.details.parameters=i.details.parameters.slice(0,i.details.parameters.length-2),n.concrete.parameters.forEach((e=>{i.details.parameters.push({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:!1,hasDeclaredType:!0,type:e.type})}))):n.paramSpec&&(i.details.paramSpec=n.paramSpec),i},e.addDefaultParameters=function(t,n=!1){e.addParameter(t,{category:1,name:"args",type:n?a.create():p.create(),hasDeclaredType:!n}),e.addParameter(t,{category:2,name:"kwargs",type:n?a.create():p.create(),hasDeclaredType:!n})},e.isInstanceMethod=function(e){return 0==(7&e.details.flags)},e.isConstructorMethod=function(e){return 0!=(1&e.details.flags)},e.isStaticMethod=function(e){return 0!=(4&e.details.flags)},e.isClassMethod=function(e){return 0!=(2&e.details.flags)},e.isAbstractMethod=function(e){return 0!=(8&e.details.flags)},e.isGenerator=function(e){return 0!=(16&e.details.flags)},e.isSynthesizedMethod=function(e){return 0!=(64&e.details.flags)},e.isSkipConstructorCheck=function(e){return 0!=(128&e.details.flags)},e.isOverloaded=function(e){return 0!=(256&e.details.flags)},e.isDefaultParameterCheckDisabled=function(e){return 0!=(32&e.details.flags)},e.isAsync=function(e){return 0!=(512&e.details.flags)},e.isWrapReturnTypeInAwait=function(e){return 0!=(1024&e.details.flags)},e.isStubDefinition=function(e){return 0!=(2048&e.details.flags)},e.isPyTypedDefinition=function(e){return 0!=(4096&e.details.flags)},e.isFinal=function(e){return 0!=(8192&e.details.flags)},e.hasUnannotatedParams=function(e){return 0!=(16384&e.details.flags)},e.shouldSkipParamCompatibilityCheck=function(e){return 0!=(32768&e.details.flags)},e.isParamSpecValue=function(e){return 0!=(65536&e.details.flags)},e.getEffectiveParameterType=n,e.addParameter=function(e,t){e.details.parameters.push(t)},e.getSpecializedReturnType=function(e){return e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType}}(l=t.FunctionType||(t.FunctionType={})),function(e){e.create=function(e=[]){return{category:6,overloads:e,flags:2}},e.addOverload=function(e,t){e.overloads.push(t)}}(t.OverloadedFunctionType||(t.OverloadedFunctionType={})),function(e){const t={category:3,flags:2},n={category:3,flags:1};e.createInstance=function(){return t},e.createType=function(){return n}}(t.NoneType||(t.NoneType={})),function(e){const t={category:4,flags:3};e.create=function(){return t}}(c=t.NeverType||(t.NeverType={})),function(e){const t={category:2,isEllipsis:!1,flags:3},n={category:2,isEllipsis:!0,flags:3};e.create=function(e=!1){return e?n:t}}(p=t.AnyType||(t.AnyType={})),function(e){function t(e,t){return e.typeVarNamet.typeVarName?1:e.constraintIndext.constraintIndex?1:0}e.combine=function(e,n){if(!e)return n;if(!n)return e;const i=[...e];return n.forEach((e=>{i.some((n=>0===t(e,n)))||i.push(e)})),i.sort(t)},e.isSame=function(e,t){return e?!(!t||e.length!==t.length)&&void 0===e.find(((e,n)=>e.typeVarName!==t[n].typeVarName||e.constraintIndex!==t[n].constraintIndex)):!t},e.isCompatible=function(e,t){if(!e||!t)return!0;for(const n of e){let e=!1;const i=t.find((t=>n.typeVarName===t.typeVarName&&(e=!0,n.constraintIndex===t.constraintIndex)));if(e&&!i)return!1}return!0}}(d=t.TypeCondition||(t.TypeCondition={})),function(e){e.create=function(){return{category:9,subtypes:[],flags:3}},e.addType=function(e,t){v(t)&&o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0===t.condition?(void 0===e.literalStrMap&&(e.literalStrMap=new Map),e.literalStrMap.set(t.literalValue,t)):v(t)&&o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0===t.condition&&(void 0===e.literalIntMap&&(e.literalIntMap=new Map),e.literalIntMap.set(t.literalValue,t)),e.flags&=t.flags,e.subtypes.push(t)},e.containsType=function(e,t,n=0){if(v(t)&&void 0===t.condition){if(o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0!==e.literalStrMap)return e.literalStrMap.has(t.literalValue);if(o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0!==e.literalIntMap)return e.literalIntMap.has(t.literalValue)}return void 0!==e.subtypes.find((e=>I(e,t,!1,n+1)))}}(u=t.UnionType||(t.UnionType={})),function(e){function t(e,t){return`${e}.${t}`}function n(e,t,n){return{category:10,details:{name:e,constraints:[],variance:0,isParamSpec:t,isVariadic:!1,isSynthesized:!1},flags:n}}e.createInstance=function(e){return n(e,!1,2)},e.createInstantiable=function(e,t=!1){return n(e,t,1)},e.cloneAsInstance=function(e){i.assert(r.isInstantiable(e));const t={...e};return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){i.assert(r.isInstance(e));const t={...e};return t.flags&=-11,t.flags|=1,t},e.cloneForScopeId=function(e,n,i){const s={...e};return s.nameWithScope=t(e.details.name,n),s.scopeId=n,s.scopeName=i,s},e.cloneForUnpacked=function(e,t=!1){i.assert(e.details.isVariadic);const n={...e};return n.isVariadicUnpacked=!0,n.isVariadicInUnion=t,n},e.cloneForPacked=function(e){i.assert(e.details.isVariadic);const t={...e};return t.isVariadicUnpacked=!1,t.isVariadicInUnion=!1,t},e.cloneAsInvariant=function(e){if(e.details.isParamSpec||e.details.isVariadic)return e;if(0===e.details.variance&&void 0===e.details.boundType&&0===e.details.constraints.length)return e;const t={...e};return t.details={...t.details},t.details.variance=0,t.details.boundType=void 0,t.details.constraints=[],t},e.makeNameWithScope=t,e.addConstraint=function(e,t){e.details.constraints.push(t)},e.getNameWithScope=function(e){return e.nameWithScope||e.details.name},e.getReadableName=function(e){return e.scopeName?`${e.details.name}@${e.scopeName}`:e.details.name}}(t.TypeVarType||(t.TypeVarType={})),t.isNever=h,t.isNone=m,t.isAny=function(e){return 2===e.category},t.isUnknown=y,t.isAnyOrUnknown=g,t.isUnbound=f,t.isUnion=T,t.isPossiblyUnbound=function e(t){return!!f(t)||!!T(t)&&void 0!==t.subtypes.find((t=>e(t)))},t.isClass=function(e){return 7===e.category},t.isInstantiableClass=_,t.isClassInstance=v,t.isModule=function(e){return 8===e.category},t.isTypeVar=b,t.isVariadicTypeVar=function(e){return 10===e.category&&e.details.isVariadic},t.isUnpackedVariadicTypeVar=function(e){return T(e)&&1===e.subtypes.length&&(e=e.subtypes[0]),10===e.category&&e.details.isVariadic&&!!e.isVariadicUnpacked},t.isParamSpec=function(e){return 10===e.category&&e.details.isParamSpec},t.isFunction=function(e){return 5===e.category},t.isOverloadedFunction=function(e){return 6===e.category},t.getTypeAliasInfo=function(e){return e.typeAliasInfo?e.typeAliasInfo:b(e)&&e.details.recursiveTypeAliasName&&e.details.boundType&&e.details.boundType.typeAliasInfo?e.details.boundType.typeAliasInfo:void 0},t.isTypeSame=I,t.removeAnyFromUnion=function(e){return C(e,(e=>g(e)))},t.removeUnknownFromUnion=function(e){return C(e,(e=>y(e)))},t.removeUnbound=function(e){return T(e)?C(e,(e=>f(e))):f(e)?a.create():e},t.removeNoneFromUnion=function(e){return C(e,(e=>m(e)))},t.removeFromUnion=C,t.findSubtype=S,t.combineTypes=D,t.isSameWithoutLiteralValue=F},69546:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunnerBase=t.BackgroundAnalysisBase=void 0;const a=n(65013),o=n(20166),l=n(67145),c=n(73054),p=n(15179),d=n(38213),u=n(14943),h=n(11043),m=r(n(20823)),y=n(24319),g=n(68384),f=n(77134);t.BackgroundAnalysisBase=class{constructor(e){this.console=e,this._onAnalysisCompletion=o.nullCallback}setup(e){this._worker=e,e.on("message",(e=>this.onMessage(e))),e.on("error",(e=>{this.log(h.LogLevel.Error,`Error occurred on background thread: ${JSON.stringify(e)}`)}))}onMessage(e){switch(e.requestType){case"log":{const t=e.data;this.log(t.level,t.message);break}case"analysisResult":this._onAnalysisCompletion(_(e.data));break;default:m.fail(`${e.requestType} is not expected`)}}setCompletionCallback(e){this._onAnalysisCompletion=null!=e?e:o.nullCallback}setConfigOptions(e){this.enqueueRequest({requestType:"setConfigOptions",data:e})}setTrackedFiles(e){this.enqueueRequest({requestType:"setTrackedFiles",data:e})}setAllowedThirdPartyImports(e){this.enqueueRequest({requestType:"setAllowedThirdPartyImports",data:e})}ensurePartialStubPackages(e){this.enqueueRequest({requestType:"ensurePartialStubPackages",data:{executionRoot:e}})}setFileOpened(e,t,n,i){this.enqueueRequest({requestType:"setFileOpened",data:{filePath:e,version:t,contents:n,isTracked:i}})}setFileClosed(e){this.enqueueRequest({requestType:"setFileClosed",data:e})}markAllFilesDirty(e){this.enqueueRequest({requestType:"markAllFilesDirty",data:e})}markFilesDirty(e,t){this.enqueueRequest({requestType:"markFilesDirty",data:{filePaths:e,evenIfContentsAreSame:t}})}startAnalysis(e,t){this._startOrResumeAnalysis("analyze",e,t)}_startOrResumeAnalysis(e,t,n){const{port1:i,port2:s}=new a.MessageChannel;i.on("message",(e=>{switch(e.requestType){case"analysisResult":this._onAnalysisCompletion(_(e.data));break;case"analysisPaused":s.close(),i.close(),this._startOrResumeAnalysis("resumeAnalysis",t,n);break;case"indexResult":{const{path:n,indexResults:i}=e.data;null==t||t.setWorkspaceIndex(n,i);break}case"analysisDone":g.disposeCancellationToken(n),s.close(),i.close();break;default:m.fail(`${e.requestType} is not expected`)}}));const r=g.getCancellationTokenId(n);this.enqueueRequest({requestType:e,data:r,port:s})}startIndexing(e,t){}refreshIndexing(e,t){}cancelIndexing(e){}async getDiagnosticsForRange(e,t,n){d.throwIfCancellationRequested(n);const{port1:i,port2:s}=new a.MessageChannel,r=p.getBackgroundWaiter(i),o=g.getCancellationTokenId(n);this.enqueueRequest({requestType:"getDiagnosticsForRange",data:{filePath:e,range:t,cancellationId:o},port:s});const l=await r;return s.close(),i.close(),v(l)}async writeTypeStub(e,t,n,i){d.throwIfCancellationRequested(i);const{port1:s,port2:r}=new a.MessageChannel,o=p.getBackgroundWaiter(s),l=g.getCancellationTokenId(i);this.enqueueRequest({requestType:"writeTypeStub",data:{targetImportPath:e,targetIsSingleFile:t,stubPath:n,cancellationId:l},port:r}),await o,r.close(),s.close()}invalidateAndForceReanalysis(){this.enqueueRequest({requestType:"invalidateAndForceReanalysis",data:null})}restart(){this.enqueueRequest({requestType:"restart",data:null})}enqueueRequest(e){this._worker&&this._worker.postMessage(e,e.port?[e.port]:void 0)}log(e,t){h.log(this.console,e,t)}};class T extends p.BackgroundThreadBase{constructor(e){super(a.workerData),this._extension=e;const t=a.workerData;this.log(h.LogLevel.Info,`Background analysis(${a.threadId}) root directory: ${t.rootDirectory}`),this._configOptions=new u.ConfigOptions(t.rootDirectory),this._importResolver=this.createImportResolver(this.fs,this._configOptions);const n=this.getConsole();this._logTracker=new f.LogTracker(n,`BG(${a.threadId})`),this._program=new c.Program(this._importResolver,this._configOptions,n,this._extension,this._logTracker)}get program(){return this._program}start(){this.log(h.LogLevel.Info,`Background analysis(${a.threadId}) started`),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("message",(e=>this.onMessage(e))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("error",(e=>m.fail(`failed ${e}`))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("exit",(e=>{0!==e&&m.fail(`worker stopped with exit code ${e}`)}))}onMessage(e){switch(this.log(h.LogLevel.Log,`Background analysis message: ${e.requestType}`),e.requestType){case"analyze":{const t=e.port,n=g.getCancellationTokenFromId(e.data),i=this.program.getFilesToAnalyzeCount();this._onAnalysisCompletion(t,{diagnostics:[],filesInProgram:this.program.getFileCount(),filesRequiringAnalysis:i,checkingOnlyOpenFiles:this.program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0}),this._analyzeOneChunk(t,n,e);break}case"resumeAnalysis":{const t=e.port,n=g.getCancellationTokenFromId(e.data);this._analyzeOneChunk(t,n,e);break}case"getDiagnosticsForRange":p.run((()=>{const{filePath:t,range:n,cancellationId:i}=e.data,s=g.getCancellationTokenFromId(i);return d.throwIfCancellationRequested(s),this.program.getDiagnosticsForRange(t,n)}),e.port);break;case"writeTypeStub":p.run((()=>{const{targetImportPath:t,targetIsSingleFile:n,stubPath:i,cancellationId:s}=e.data,r=g.getCancellationTokenFromId(s);o.analyzeProgram(this.program,void 0,this._configOptions,o.nullCallback,this.getConsole(),r),this.program.writeTypeStub(t,n,i,r)}),e.port);break;case"setConfigOptions":this._configOptions=p.createConfigOptionsFrom(e.data),this._importResolver=this.createImportResolver(this.fs,this._configOptions),this.program.setConfigOptions(this._configOptions),this.program.setImportResolver(this._importResolver);break;case"setTrackedFiles":{const t=this.program.setTrackedFiles(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"setAllowedThirdPartyImports":this.program.setAllowedThirdPartyImports(e.data);break;case"ensurePartialStubPackages":{const{executionRoot:t}=e.data,n=this._configOptions.getExecutionEnvironments().find((e=>e.root===t));n&&this._importResolver.ensurePartialStubPackages(n);break}case"setFileOpened":{const{filePath:t,version:n,contents:i,isTracked:s}=e.data;this.program.setFileOpened(t,n,i,s);break}case"setFileClosed":{const t=this.program.setFileClosed(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"markAllFilesDirty":this.program.markAllFilesDirty(e.data);break;case"markFilesDirty":{const{filePaths:t,evenIfContentsAreSame:n}=e.data;this.program.markFilesDirty(t,n);break}case"invalidateAndForceReanalysis":this._importResolver.invalidateCache(),this.program.markAllFilesDirty(!0);break;case"restart":this._importResolver=this.createImportResolver(this.fs,this._configOptions),this.program.setImportResolver(this._importResolver);break;default:m.fail(`${e.requestType} is not expected`)}}_analyzeOneChunk(e,t,n){o.analyzeProgram(this.program,{openFilesTimeInMs:50,noOpenFilesTimeInMs:200},this._configOptions,(t=>this._onAnalysisCompletion(e,t)),this.getConsole(),t)?this._analysisPaused(e,n.data):(this.processIndexing(e,t),this.analysisDone(e,n.data))}createImportResolver(e,t){return new l.ImportResolver(e,t)}processIndexing(e,t){}reportIndex(e,t){e.postMessage({requestType:"indexResult",data:t})}_reportDiagnostics(e,t,n){a.parentPort&&this._onAnalysisCompletion(a.parentPort,{diagnostics:e,filesInProgram:this.program.getFileCount(),filesRequiringAnalysis:t,checkingOnlyOpenFiles:this.program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:n})}_onAnalysisCompletion(e,t){e.postMessage({requestType:"analysisResult",data:t})}_analysisPaused(e,t){e.postMessage({requestType:"analysisPaused",data:t})}analysisDone(e,t){e.postMessage({requestType:"analysisDone",data:t})}}function _(e){return e.diagnostics=e.diagnostics.map((e=>({filePath:e.filePath,diagnostics:v(e.diagnostics)}))),e}function v(e){return e.map((e=>{const t=new y.Diagnostic(e.category,e.message,e.range);if(e._actions)for(const n of e._actions)t.addAction(n);if(e._rule&&t.setRule(e._rule),e._relatedInfo)for(const n of e._relatedInfo)t.addRelatedInfo(n.message,n.filePath,n.range);return t}))}t.BackgroundAnalysisRunnerBase=T},15179:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getBackgroundWaiter=t.run=t.createConfigOptionsFrom=t.BackgroundThreadBase=void 0;const a=n(65013),o=n(38213),l=n(14943),c=n(11043),p=r(n(20823)),d=n(49085),u=n(37633);t.BackgroundThreadBase=class{constructor(e){o.setCancellationFolderName(e.cancellationFolderName),global.__rootDirectory=e.rootDirectory,this.fs=new u.PyrightFileSystem(d.createFromRealFileSystem(this.getConsole()))}log(e,t){null===a.parentPort||void 0===a.parentPort||a.parentPort.postMessage({requestType:"log",data:{level:e,message:t}})}getConsole(){return{log:e=>{this.log(c.LogLevel.Log,e)},info:e=>{this.log(c.LogLevel.Info,e)},warn:e=>{this.log(c.LogLevel.Warn,e)},error:e=>{this.log(c.LogLevel.Error,e)},level:c.LogLevel.Log}}},t.createConfigOptionsFrom=function(e){const t=new l.ConfigOptions(e.projectRoot),n=e=>({wildcardRoot:e.wildcardRoot,regExp:new RegExp(e.regExp.source)});return t.pythonPath=e.pythonPath,t.typeshedPath=e.typeshedPath,t.stubPath=e.stubPath,t.autoExcludeVenv=e.autoExcludeVenv,t.verboseOutput=e.verboseOutput,t.checkOnlyOpenFiles=e.checkOnlyOpenFiles,t.useLibraryCodeForTypes=e.useLibraryCodeForTypes,t.internalTestMode=e.internalTestMode,t.indexGenerationMode=e.indexGenerationMode,t.venvPath=e.venvPath,t.venv=e.venv,t.defaultPythonVersion=e.defaultPythonVersion,t.defaultPythonPlatform=e.defaultPythonPlatform,t.defaultExtraPaths=e.defaultExtraPaths,t.diagnosticRuleSet=e.diagnosticRuleSet,t.executionEnvironments=e.executionEnvironments,t.autoImportCompletions=e.autoImportCompletions,t.indexing=e.indexing,t.logTypeEvaluationTime=e.logTypeEvaluationTime,t.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold,t.include=e.include.map((e=>n(e))),t.exclude=e.exclude.map((e=>n(e))),t.ignore=e.ignore.map((e=>n(e))),t.strict=e.strict.map((e=>n(e))),t},t.run=function(e,t){try{const n=e();t.postMessage({kind:"ok",data:n})}catch(e){if(o.OperationCanceledException.is(e))return void t.postMessage({kind:"cancelled",data:e.message});t.postMessage({kind:"failed",data:`Exception: ${e.message} in ${e.stack}`})}},t.getBackgroundWaiter=function(e){return new Promise(((t,n)=>{e.on("message",(e=>{switch(e.kind){case"ok":t(e.data);break;case"cancelled":n(new o.OperationCanceledException);break;case"failed":n(e.data);break;default:p.fail(`unknown kind ${e.kind}`)}}))}))}},67284:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommandController=void 0;const i=n(29335),s=n(62105),r=n(58062),a=n(60675);t.CommandController=class{constructor(e){this._createStub=new s.CreateTypeStubCommand(e),this._restartServer=new a.RestartServerCommand(e),this._quickAction=new r.QuickActionCommand(e)}async execute(e,t){switch(e.command){case"pyright.organizeimports":case"pyright.addoptionalforparam":return this._quickAction.execute(e,t);case"pyright.createtypestub":return this._createStub.execute(e,t);case"pyright.restartserver":return this._restartServer.execute(e);default:return new i.ResponseError(1,"Unsupported command")}}isLongRunningCommand(e){switch(e){case"pyright.createtypestub":return!0;default:return!1}}}},9055:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommandResult=void 0;const i=n(30922);!function(e){e.is=function(e){return e&&e.edits&&i.WorkspaceEdit.is(e.edits)}}(t.CommandResult||(t.CommandResult={}))},62105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateTypeStubCommand=void 0;const i=n(44314),s=n(38213),r=n(10219),a=n(94647),o=n(22060);t.CreateTypeStubCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=2){const n=e.arguments[0],i=e.arguments[1],l=e.arguments[2],c=await this._createTypeStubService(l),p={workspaceName:`Create Type Stub ${i}`,rootPath:n,rootUri:a.convertPathToUri(this._ls.fs,n),serviceInstance:c,disableLanguageServices:!0,disableOrganizeImports:!0,isInitialized:r.createDeferred()},d=await this._ls.getSettings(p);o.AnalyzerServiceExecutor.runWithOptions(this._ls.rootPath,p,d,i,!1);try{await c.writeTypeStubInBackground(t),c.dispose();const e=`Type stub was successfully created for '${i}'.`;this._ls.window.showInformationMessage(e),this._handlePostCreateTypeStub()}catch(e){if(s.OperationCanceledException.is(e)){const e=`Type stub creation for '${i}' was canceled`;this._ls.console.error(e)}else{let t="";e instanceof Error&&(t=": "+e.message),t=`An error occurred when creating type stub for '${i}'`+t,this._ls.console.error(t),this._ls.window.showErrorMessage(t)}}}}async _createTypeStubService(e){if(e){return(await this._ls.getWorkspaceForFile(e)).serviceInstance.clone("Type stub",this._ls.createBackgroundAnalysis())}return new i.AnalyzerService("Type stub",this._ls.fs,this._ls.console)}_handlePostCreateTypeStub(){this._ls.reanalyze()}}},58062:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QuickActionCommand=void 0;const i=n(94647),s=n(34815);t.QuickActionCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=1){const n=e.arguments[0],r=e.arguments.slice(1),a=i.convertUriToPath(this._ls.fs,n),o=await this._ls.getWorkspaceForFile(a);if("pyright.organizeimports"===e.command&&o.disableOrganizeImports)return[];const l=o.serviceInstance.performQuickAction(a,e.command,r,t);return s.convertTextEdits(n,l)}}}},60675:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestartServerCommand=void 0;t.RestartServerCommand=class{constructor(e){this._ls=e}async execute(e){this._ls.restart()}}},38213:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCancellationProvider=t.CancelAfter=t.throwIfCancellationRequested=t.OperationCanceledException=t.setCancellationFolderName=t.getCancellationFolderName=void 0;const i=n(20947),s=n(29335);let r;t.getCancellationFolderName=function(){return r},t.setCancellationFolderName=function(e){r=e};class a extends s.ResponseError{constructor(){super(s.LSPErrorCodes.RequestCancelled,"request cancelled")}static is(e){return e.code===s.LSPErrorCodes.RequestCancelled}}t.OperationCanceledException=a,t.throwIfCancellationRequested=function(e){if(e.isCancellationRequested)throw new a},t.CancelAfter=function(...e){const t=new i.CancellationTokenSource,n=[];for(const i of e)n.push(i.onCancellationRequested((e=>{t.cancel()})));return n.push(t.token.onCancellationRequested((e=>{n.forEach((e=>e.dispose()))}))),t};t.DefaultCancellationProvider=class{createCancellationTokenSource(){return new i.CancellationTokenSource}}},9133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOrAdd=t.getNestedProperty=t.flatten=t.binarySearchKey=t.binarySearch=t.every=t.some=t.map=t.stableSort=t.cloneAndSort=t.insertAt=t.addRange=t.find=t.append=t.contains=t.emptyArray=void 0;const i=n(98173);function s(e,t){return t<0?e.length+t:t}function r(e,t,n,i){if(void 0===t||0===t.length)return e;if(void 0===e)return t.slice(n,i);n=void 0===n?0:s(t,n),i=void 0===i?t.length:s(t,i);for(let s=n;s0)}function l(e,t,n,i,s){if(!o(e))return-1;let r=s||0,a=e.length-1;for(;r<=a;){const s=r+(a-r>>1);switch(i(n(e[s]),t)){case-1:r=s+1;break;case 0:return s;case 1:a=s-1}}return~r}t.emptyArray=[],t.contains=function(e,t,n=i.equateValues){if(e)for(const i of e)if(n(i,t))return!0;return!1},t.append=function(e,t){return void 0===t?e:void 0===e?[t]:(e.push(t),e)},t.find=function(e,t){for(let n=0;nt;n--)e[n]=e[n-1];e[t]=n}return e},t.cloneAndSort=function(e,t){return 0===e.length?e:e.slice().sort(t)},t.stableSort=function(e,t){const n=function(e){return e.map(a)}(e);return function(e,t,n){t.sort(((t,s)=>n(e[t],e[s])||i.compareValues(t,s)))}(e,n,t),n.map((t=>e[t]))},t.map=function(e,t){if(e)return e.map(t)},t.some=o,t.every=function(e,t){return!e||e.every(t)},t.binarySearch=function(e,t,n,i,s){return l(e,n(t),n,i,s)},t.binarySearchKey=l,t.flatten=function(e){const t=[];for(const n of e)n&&(i.isArray(n)?r(t,n):t.push(n));return t},t.getNestedProperty=function(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)},t.getOrAdd=function(e,t,n){const i=e.get(t);if(void 0!==i)return i;const s=n();return e.set(t,s),s}},96795:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommandLineOptions=t.getDiagnosticSeverityOverrides=void 0,t.getDiagnosticSeverityOverrides=function(){return["error","warning","information","none"]};t.CommandLineOptions=class{constructor(e,t){this.fileSpecs=[],this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.executionRoot=e,this.fromVsCodeExtension=t}}},14943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigOptions=t.getStrictDiagnosticRuleSet=t.getBasicDiagnosticRuleSet=t.getOffDiagnosticRuleSet=t.getStrictModeNotOverriddenRules=t.getDiagLevelDiagnosticRules=t.getBooleanDiagnosticRules=t.cloneDiagnosticRuleSet=t.ExecutionEnvironment=t.PythonPlatform=void 0;const a=r(n(63129)),o=n(85622),l=r(n(97956)),c=n(15741),p=n(94647),d=n(57485);var u;!function(e){e.Darwin="Darwin",e.Windows="Windows",e.Linux="Linux"}(u=t.PythonPlatform||(t.PythonPlatform={}));class h{constructor(e,t,n,i){this.extraPaths=[],this.root=e,this.pythonVersion=t||d.latestStablePythonVersion,this.pythonPlatform=n,this.extraPaths=i||[]}}function m(){return{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none"}}function y(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"error",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}}function g(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"error",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportOverlappingOverload:"error",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}}t.ExecutionEnvironment=h,t.cloneDiagnosticRuleSet=function(e){return Object.assign({},e)},t.getBooleanDiagnosticRules=function(){return[c.DiagnosticRule.strictListInference,c.DiagnosticRule.strictSetInference,c.DiagnosticRule.strictDictionaryInference,c.DiagnosticRule.strictParameterNoneValue]},t.getDiagLevelDiagnosticRules=function(){return[c.DiagnosticRule.reportGeneralTypeIssues,c.DiagnosticRule.reportPropertyTypeMismatch,c.DiagnosticRule.reportFunctionMemberAccess,c.DiagnosticRule.reportMissingImports,c.DiagnosticRule.reportMissingModuleSource,c.DiagnosticRule.reportMissingTypeStubs,c.DiagnosticRule.reportImportCycles,c.DiagnosticRule.reportUnusedImport,c.DiagnosticRule.reportUnusedClass,c.DiagnosticRule.reportUnusedFunction,c.DiagnosticRule.reportUnusedVariable,c.DiagnosticRule.reportDuplicateImport,c.DiagnosticRule.reportWildcardImportFromLibrary,c.DiagnosticRule.reportOptionalSubscript,c.DiagnosticRule.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalCall,c.DiagnosticRule.reportOptionalIterable,c.DiagnosticRule.reportOptionalContextManager,c.DiagnosticRule.reportOptionalOperand,c.DiagnosticRule.reportTypedDictNotRequiredAccess,c.DiagnosticRule.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedNamedTuple,c.DiagnosticRule.reportPrivateUsage,c.DiagnosticRule.reportConstantRedefinition,c.DiagnosticRule.reportIncompatibleMethodOverride,c.DiagnosticRule.reportIncompatibleVariableOverride,c.DiagnosticRule.reportOverlappingOverload,c.DiagnosticRule.reportUninitializedInstanceVariable,c.DiagnosticRule.reportInvalidStringEscapeSequence,c.DiagnosticRule.reportUnknownParameterType,c.DiagnosticRule.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownLambdaType,c.DiagnosticRule.reportUnknownVariableType,c.DiagnosticRule.reportUnknownMemberType,c.DiagnosticRule.reportMissingTypeArgument,c.DiagnosticRule.reportInvalidTypeVarUse,c.DiagnosticRule.reportCallInDefaultInitializer,c.DiagnosticRule.reportUnnecessaryIsInstance,c.DiagnosticRule.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryComparison,c.DiagnosticRule.reportAssertAlwaysTrue,c.DiagnosticRule.reportSelfClsParameterName,c.DiagnosticRule.reportImplicitStringConcatenation,c.DiagnosticRule.reportUndefinedVariable,c.DiagnosticRule.reportUnboundVariable,c.DiagnosticRule.reportInvalidStubStatement,c.DiagnosticRule.reportIncompleteStub,c.DiagnosticRule.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnusedCallResult,c.DiagnosticRule.reportUnusedCoroutine]},t.getStrictModeNotOverriddenRules=function(){return[c.DiagnosticRule.reportMissingModuleSource]},t.getOffDiagnosticRuleSet=m,t.getBasicDiagnosticRuleSet=y,t.getStrictDiagnosticRuleSet=g;class f{constructor(e,t){this.include=[],this.exclude=[],this.ignore=[],this.strict=[],this.autoImportCompletions=!0,this.indexing=!1,this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.disableInferenceForPyTypedSources=!0,this.executionEnvironments=[],this.projectRoot=e,this.diagnosticRuleSet=f.getDiagnosticRuleSet(t),"off"===t&&(this.disableInferenceForPyTypedSources=!1)}static getDiagnosticRuleSet(e){return"strict"===e?{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"error",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportOverlappingOverload:"error",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}:"off"===e?{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none"}:{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"error",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}}getDefaultExecEnvironment(){return new h(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths)}findExecEnvironment(e){var t;return null!==(t=this.executionEnvironments.find((t=>{const n=p.ensureTrailingDirectorySeparator(p.normalizePath(p.combinePaths(this.projectRoot,t.root)));return e.startsWith(n)})))&&void 0!==t?t:this.getDefaultExecEnvironment()}getExecutionEnvironments(){return this.executionEnvironments.length>0?this.executionEnvironments:[this.getDefaultExecEnvironment()]}initializeFromJson(e,t,n,i,s,r=!1){if(!r&&(this.include=[],void 0!==e.include))if(Array.isArray(e.include)){e.include.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "include" array should be a string.`):o.isAbsolute(e)?n.error(`Ignoring path "${e}" in "include" array because it is not relative.`):this.include.push(p.getFileSpec(this.projectRoot,e))}))}else n.error('Config "include" entry must must contain an array.');if(this.exclude=[],void 0!==e.exclude)if(Array.isArray(e.exclude)){e.exclude.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "exclude" array should be a string.`):o.isAbsolute(e)?n.error(`Ignoring path "${e}" in "exclude" array because it is not relative.`):this.exclude.push(p.getFileSpec(this.projectRoot,e))}))}else n.error('Config "exclude" entry must contain an array.');if(this.ignore=[],void 0!==e.ignore)if(Array.isArray(e.ignore)){e.ignore.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "ignore" array should be a string.`):o.isAbsolute(e)?n.error(`Ignoring path "${e}" in "ignore" array because it is not relative.`):this.ignore.push(p.getFileSpec(this.projectRoot,e))}))}else n.error('Config "ignore" entry must contain an array.');if(this.strict=[],void 0!==e.strict)if(Array.isArray(e.strict)){e.strict.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "strict" array should be a string.`):o.isAbsolute(e)?n.error(`Ignoring path "${e}" in "strict" array because it is not relative.`):this.strict.push(p.getFileSpec(this.projectRoot,e))}))}else n.error('Config "strict" entry must contain an array.');let a;void 0!==e.typeCheckingMode&&("off"===e.typeCheckingMode||"basic"===e.typeCheckingMode||"strict"===e.typeCheckingMode?a=e.typeCheckingMode:n.error('Config "typeCheckingMode" entry must contain "off", "basic", or "strict".')),void 0!==e.useLibraryCodeForTypes&&("boolean"==typeof e.useLibraryCodeForTypes?this.useLibraryCodeForTypes=e.useLibraryCodeForTypes:n.error('Config "useLibraryCodeForTypes" entry must be true or false.'));const l=a||t,u=f.getDiagnosticRuleSet(l);if("off"===l&&(this.disableInferenceForPyTypedSources=!1),this.applyDiagnosticOverrides(i),this.diagnosticRuleSet={printUnknownAsAny:u.printUnknownAsAny,omitTypeArgsIfAny:u.omitTypeArgsIfAny,omitConditionalConstraint:u.omitConditionalConstraint,omitUnannotatedParamType:u.omitUnannotatedParamType,pep604Printing:u.pep604Printing,strictListInference:this._convertBoolean(e.strictListInference,c.DiagnosticRule.strictListInference,u.strictListInference),strictSetInference:this._convertBoolean(e.strictSetInference,c.DiagnosticRule.strictSetInference,u.strictSetInference),strictDictionaryInference:this._convertBoolean(e.strictDictionaryInference,c.DiagnosticRule.strictDictionaryInference,u.strictDictionaryInference),strictParameterNoneValue:this._convertBoolean(e.strictParameterNoneValue,c.DiagnosticRule.strictParameterNoneValue,u.strictParameterNoneValue),enableTypeIgnoreComments:this._convertBoolean(e.enableTypeIgnoreComments,c.DiagnosticRule.enableTypeIgnoreComments,u.enableTypeIgnoreComments),reportGeneralTypeIssues:this._convertDiagnosticLevel(e.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,u.reportGeneralTypeIssues),reportPropertyTypeMismatch:this._convertDiagnosticLevel(e.reportPropertyTypeMismatch,c.DiagnosticRule.reportPropertyTypeMismatch,u.reportPropertyTypeMismatch),reportFunctionMemberAccess:this._convertDiagnosticLevel(e.reportFunctionMemberAccess,c.DiagnosticRule.reportFunctionMemberAccess,u.reportFunctionMemberAccess),reportMissingImports:this._convertDiagnosticLevel(e.reportMissingImports,c.DiagnosticRule.reportMissingImports,u.reportMissingImports),reportUnusedImport:this._convertDiagnosticLevel(e.reportUnusedImport,c.DiagnosticRule.reportUnusedImport,u.reportUnusedImport),reportUnusedClass:this._convertDiagnosticLevel(e.reportUnusedClass,c.DiagnosticRule.reportUnusedClass,u.reportUnusedClass),reportUnusedFunction:this._convertDiagnosticLevel(e.reportUnusedFunction,c.DiagnosticRule.reportUnusedFunction,u.reportUnusedFunction),reportUnusedVariable:this._convertDiagnosticLevel(e.reportUnusedVariable,c.DiagnosticRule.reportUnusedVariable,u.reportUnusedVariable),reportDuplicateImport:this._convertDiagnosticLevel(e.reportDuplicateImport,c.DiagnosticRule.reportDuplicateImport,u.reportDuplicateImport),reportWildcardImportFromLibrary:this._convertDiagnosticLevel(e.reportWildcardImportFromLibrary,c.DiagnosticRule.reportWildcardImportFromLibrary,u.reportWildcardImportFromLibrary),reportMissingModuleSource:this._convertDiagnosticLevel(e.reportMissingModuleSource,c.DiagnosticRule.reportMissingModuleSource,u.reportMissingModuleSource),reportMissingTypeStubs:this._convertDiagnosticLevel(e.reportMissingTypeStubs,c.DiagnosticRule.reportMissingTypeStubs,u.reportMissingTypeStubs),reportImportCycles:this._convertDiagnosticLevel(e.reportImportCycles,c.DiagnosticRule.reportImportCycles,u.reportImportCycles),reportOptionalSubscript:this._convertDiagnosticLevel(e.reportOptionalSubscript,c.DiagnosticRule.reportOptionalSubscript,u.reportOptionalSubscript),reportOptionalMemberAccess:this._convertDiagnosticLevel(e.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalMemberAccess,u.reportOptionalMemberAccess),reportOptionalCall:this._convertDiagnosticLevel(e.reportOptionalCall,c.DiagnosticRule.reportOptionalCall,u.reportOptionalCall),reportOptionalIterable:this._convertDiagnosticLevel(e.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,u.reportOptionalIterable),reportOptionalContextManager:this._convertDiagnosticLevel(e.reportOptionalContextManager,c.DiagnosticRule.reportOptionalContextManager,u.reportOptionalContextManager),reportOptionalOperand:this._convertDiagnosticLevel(e.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,u.reportOptionalOperand),reportTypedDictNotRequiredAccess:this._convertDiagnosticLevel(e.reportTypedDictNotRequiredAccess,c.DiagnosticRule.reportTypedDictNotRequiredAccess,u.reportTypedDictNotRequiredAccess),reportUntypedFunctionDecorator:this._convertDiagnosticLevel(e.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedFunctionDecorator,u.reportUntypedFunctionDecorator),reportUntypedClassDecorator:this._convertDiagnosticLevel(e.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedClassDecorator,u.reportUntypedClassDecorator),reportUntypedBaseClass:this._convertDiagnosticLevel(e.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedBaseClass,u.reportUntypedBaseClass),reportUntypedNamedTuple:this._convertDiagnosticLevel(e.reportUntypedNamedTuple,c.DiagnosticRule.reportUntypedNamedTuple,u.reportUntypedNamedTuple),reportPrivateUsage:this._convertDiagnosticLevel(e.reportPrivateUsage,c.DiagnosticRule.reportPrivateUsage,u.reportPrivateUsage),reportConstantRedefinition:this._convertDiagnosticLevel(e.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,u.reportConstantRedefinition),reportIncompatibleMethodOverride:this._convertDiagnosticLevel(e.reportIncompatibleMethodOverride,c.DiagnosticRule.reportIncompatibleMethodOverride,u.reportIncompatibleMethodOverride),reportIncompatibleVariableOverride:this._convertDiagnosticLevel(e.reportIncompatibleVariableOverride,c.DiagnosticRule.reportIncompatibleVariableOverride,u.reportIncompatibleVariableOverride),reportOverlappingOverload:this._convertDiagnosticLevel(e.reportOverlappingOverload,c.DiagnosticRule.reportOverlappingOverload,u.reportOverlappingOverload),reportUninitializedInstanceVariable:this._convertDiagnosticLevel(e.reportUninitializedInstanceVariable,c.DiagnosticRule.reportUninitializedInstanceVariable,u.reportUninitializedInstanceVariable),reportInvalidStringEscapeSequence:this._convertDiagnosticLevel(e.reportInvalidStringEscapeSequence,c.DiagnosticRule.reportInvalidStringEscapeSequence,u.reportInvalidStringEscapeSequence),reportUnknownParameterType:this._convertDiagnosticLevel(e.reportUnknownParameterType,c.DiagnosticRule.reportUnknownParameterType,u.reportUnknownParameterType),reportUnknownArgumentType:this._convertDiagnosticLevel(e.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,u.reportUnknownArgumentType),reportUnknownLambdaType:this._convertDiagnosticLevel(e.reportUnknownLambdaType,c.DiagnosticRule.reportUnknownLambdaType,u.reportUnknownLambdaType),reportUnknownVariableType:this._convertDiagnosticLevel(e.reportUnknownVariableType,c.DiagnosticRule.reportUnknownVariableType,u.reportUnknownVariableType),reportUnknownMemberType:this._convertDiagnosticLevel(e.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,u.reportUnknownMemberType),reportMissingTypeArgument:this._convertDiagnosticLevel(e.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,u.reportMissingTypeArgument),reportInvalidTypeVarUse:this._convertDiagnosticLevel(e.reportInvalidTypeVarUse,c.DiagnosticRule.reportInvalidTypeVarUse,u.reportInvalidTypeVarUse),reportCallInDefaultInitializer:this._convertDiagnosticLevel(e.reportCallInDefaultInitializer,c.DiagnosticRule.reportCallInDefaultInitializer,u.reportCallInDefaultInitializer),reportUnnecessaryIsInstance:this._convertDiagnosticLevel(e.reportUnnecessaryIsInstance,c.DiagnosticRule.reportUnnecessaryIsInstance,u.reportUnnecessaryIsInstance),reportUnnecessaryCast:this._convertDiagnosticLevel(e.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryCast,u.reportUnnecessaryCast),reportUnnecessaryComparison:this._convertDiagnosticLevel(e.reportUnnecessaryComparison,c.DiagnosticRule.reportUnnecessaryComparison,u.reportUnnecessaryComparison),reportAssertAlwaysTrue:this._convertDiagnosticLevel(e.reportAssertAlwaysTrue,c.DiagnosticRule.reportAssertAlwaysTrue,u.reportAssertAlwaysTrue),reportSelfClsParameterName:this._convertDiagnosticLevel(e.reportSelfClsParameterName,c.DiagnosticRule.reportSelfClsParameterName,u.reportSelfClsParameterName),reportImplicitStringConcatenation:this._convertDiagnosticLevel(e.reportImplicitStringConcatenation,c.DiagnosticRule.reportImplicitStringConcatenation,u.reportImplicitStringConcatenation),reportUndefinedVariable:this._convertDiagnosticLevel(e.reportUndefinedVariable,c.DiagnosticRule.reportUndefinedVariable,u.reportUndefinedVariable),reportUnboundVariable:this._convertDiagnosticLevel(e.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,u.reportUnboundVariable),reportInvalidStubStatement:this._convertDiagnosticLevel(e.reportInvalidStubStatement,c.DiagnosticRule.reportInvalidStubStatement,u.reportInvalidStubStatement),reportIncompleteStub:this._convertDiagnosticLevel(e.reportIncompleteStub,c.DiagnosticRule.reportIncompleteStub,u.reportIncompleteStub),reportUnsupportedDunderAll:this._convertDiagnosticLevel(e.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnsupportedDunderAll,u.reportUnsupportedDunderAll),reportUnusedCallResult:this._convertDiagnosticLevel(e.reportUnusedCallResult,c.DiagnosticRule.reportUnusedCallResult,u.reportUnusedCallResult),reportUnusedCoroutine:this._convertDiagnosticLevel(e.reportUnusedCoroutine,c.DiagnosticRule.reportUnusedCoroutine,u.reportUnusedCoroutine)},this.venvPath=void 0,void 0!==e.venvPath&&("string"!=typeof e.venvPath?n.error('Config "venvPath" field must contain a string.'):this.venvPath=p.normalizePath(p.combinePaths(this.projectRoot,e.venvPath))),this.venv=void 0,void 0!==e.venv&&("string"!=typeof e.venv?n.error('Config "venv" field must contain a string.'):this.venv=e.venv),void 0!==e.extraPaths)if(this.defaultExtraPaths=[],Array.isArray(e.extraPaths)){e.extraPaths.forEach(((e,t)=>{"string"!=typeof e?n.error(`Config "extraPaths" field ${t} must be a string.`):this.defaultExtraPaths.push(p.normalizePath(p.combinePaths(this.projectRoot,e)))}))}else n.error('Config "extraPaths" field must contain an array.');if(void 0!==e.pythonVersion)if("string"==typeof e.pythonVersion){const t=d.versionFromString(e.pythonVersion);t?this.defaultPythonVersion=t:n.error('Config "pythonVersion" field contains unsupported version.')}else n.error('Config "pythonVersion" field must contain a string.');if(this.ensureDefaultPythonVersion(s,n),void 0!==e.pythonPlatform&&("string"!=typeof e.pythonPlatform?n.error('Config "pythonPlatform" field must contain a string.'):this.defaultPythonPlatform=e.pythonPlatform),this.ensureDefaultPythonPlatform(n),this.typeshedPath=void 0,void 0!==e.typeshedPath&&("string"!=typeof e.typeshedPath?n.error('Config "typeshedPath" field must contain a string.'):this.typeshedPath=e.typeshedPath?p.normalizePath(p.combinePaths(this.projectRoot,e.typeshedPath)):""),this.stubPath=void 0,void 0!==e.typingsPath&&("string"!=typeof e.typingsPath?n.error('Config "typingsPath" field must contain a string.'):(n.error('Config "typingsPath" is now deprecated. Please, use stubPath instead.'),this.stubPath=p.normalizePath(p.combinePaths(this.projectRoot,e.typingsPath)))),void 0!==e.stubPath&&("string"!=typeof e.stubPath?n.error('Config "stubPath" field must contain a string.'):this.stubPath=p.normalizePath(p.combinePaths(this.projectRoot,e.stubPath))),void 0!==e.verboseOutput&&("boolean"!=typeof e.verboseOutput?n.error('Config "verboseOutput" field must be true or false.'):this.verboseOutput=e.verboseOutput),void 0!==e.useLibraryCodeForTypes&&("boolean"!=typeof e.useLibraryCodeForTypes?n.error('Config "useLibraryCodeForTypes" field must be true or false.'):this.useLibraryCodeForTypes=e.useLibraryCodeForTypes),this.executionEnvironments=[],void 0!==e.executionEnvironments)if(Array.isArray(e.executionEnvironments)){e.executionEnvironments.forEach(((e,t)=>{const i=this._initExecutionEnvironmentFromJson(e,t,n);i&&this.executionEnvironments.push(i)}))}else n.error('Config "executionEnvironments" field must contain an array.');void 0!==e.autoImportCompletions&&("boolean"!=typeof e.autoImportCompletions?n.error('Config "autoImportCompletions" field must be true or false.'):this.autoImportCompletions=e.autoImportCompletions),void 0!==e.indexing&&("boolean"!=typeof e.indexing?n.error('Config "indexing" field must be true or false.'):this.indexing=e.indexing),void 0!==e.logTypeEvaluationTime&&("boolean"!=typeof e.logTypeEvaluationTime?n.error('Config "logTypeEvaluationTime" field must be true or false.'):this.logTypeEvaluationTime=e.logTypeEvaluationTime),void 0!==e.typeEvaluationTimeThreshold&&("number"!=typeof e.typeEvaluationTimeThreshold?n.error('Config "typeEvaluationTimeThreshold" field must be a number.'):this.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold)}ensureDefaultPythonPlatform(e){void 0===this.defaultPythonPlatform&&("darwin"===process.platform?this.defaultPythonPlatform=u.Darwin:"linux"===process.platform?this.defaultPythonPlatform=u.Linux:"win32"===process.platform&&(this.defaultPythonPlatform=u.Windows),void 0!==this.defaultPythonPlatform&&e.info(`Assuming Python platform ${this.defaultPythonPlatform}`))}ensureDefaultPythonVersion(e,t){void 0===this.defaultPythonVersion&&(this.defaultPythonVersion=this._getPythonVersionFromPythonInterpreter(e,t),void 0!==this.defaultPythonVersion&&t.info(`Assuming Python version ${d.versionToString(this.defaultPythonVersion)}`))}ensureDefaultExtraPaths(e,t,n){const i=[];if(t){const t=p.resolvePaths(this.projectRoot,l.src);e.existsSync(t)&&!e.existsSync(p.resolvePaths(t,"__init__.py"))&&i.push(t)}if(n&&n.length>0)for(const e of n)i.push(p.resolvePaths(this.projectRoot,e));i.length>0&&(this.defaultExtraPaths=i)}applyDiagnosticOverrides(e){if(e)for(const[t,n]of Object.entries(e))this.diagnosticRuleSet[t]=n}_convertBoolean(e,t,n){return void 0===e?n:"boolean"==typeof e?!!e:(console.log(`Config "${t}" entry must be true or false.`),n)}_convertDiagnosticLevel(e,t,n){return void 0===e?n:"boolean"==typeof e?e?"error":"none":"string"!=typeof e||"error"!==e&&"warning"!==e&&"information"!==e&&"none"!==e?(console.log(`Config "${t}" entry must be true, false, "error", "warning", "information" or "none".`),n):e}_initExecutionEnvironmentFromJson(e,t,n){try{const i=new h(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths);if(e.root&&"string"==typeof e.root?i.root=p.normalizePath(p.combinePaths(this.projectRoot,e.root)):n.error(`Config executionEnvironments index ${t}: missing root value.`),e.extraPaths)if(Array.isArray(e.extraPaths)){e.extraPaths.forEach(((e,s)=>{"string"!=typeof e?n.error(`Config executionEnvironments index ${t}: extraPaths field ${s} must be a string.`):i.extraPaths.push(p.normalizePath(p.combinePaths(this.projectRoot,e)))}))}else n.error(`Config executionEnvironments index ${t}: extraPaths field must contain an array.`);if(e.pythonVersion)if("string"==typeof e.pythonVersion){const s=d.versionFromString(e.pythonVersion);s?i.pythonVersion=s:n.warn(`Config executionEnvironments index ${t} contains unsupported pythonVersion.`)}else n.error(`Config executionEnvironments index ${t} pythonVersion must be a string.`);return e.pythonPlatform&&("string"==typeof e.pythonPlatform?i.pythonPlatform=e.pythonPlatform:n.error(`Config executionEnvironments index ${t} pythonPlatform must be a string.`)),i}catch{n.error(`Config executionEnvironments index ${t} is not accessible.`)}}_getPythonVersionFromPythonInterpreter(e,t){try{const n=["-c","import sys, json; json.dump(dict(major=sys.version_info[0], minor=sys.version_info[1]), sys.stdout)"];let i;i=e?a.execFileSync(e,n,{encoding:"utf8"}):a.execFileSync("python",n,{encoding:"utf8"});const s=JSON.parse(i),r=d.versionFromMajorMinor(s.major,s.minor);return void 0===r?void t.warn(`Python version ${s.major}.${s.minor} from interpreter is unsupported`):r}catch{return void t.info("Unable to get Python version from interpreter")}}}t.ConfigOptions=f},11043:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.ConsoleWithLogLevel=t.StderrConsole=t.StandardConsole=t.NullConsole=t.LogLevel=void 0;const a=r(n(20823));var o;!function(e){e.Error="error",e.Warn="warn",e.Info="info",e.Log="log"}(o=t.LogLevel||(t.LogLevel={}));t.NullConsole=class{constructor(){this.logCount=0,this.infoCount=0,this.warnCount=0,this.errorCount=0}log(e){this.logCount++}info(e){this.infoCount++}warn(e){this.warnCount++}error(e){this.errorCount++}};t.StandardConsole=class{log(e){console.info(e)}info(e){console.info(e)}warn(e){console.warn(e)}error(e){console.error(e)}};t.StderrConsole=class{log(e){console.error(e)}info(e){console.error(e)}warn(e){console.error(e)}error(e){console.error(e)}};function l(e,t,n){switch(t){case o.Log:e.log(n);break;case o.Info:e.info(n);break;case o.Warn:e.warn(n);break;case o.Error:e.error(n);break;default:a.fail(`${t} is not expected`)}}t.ConsoleWithLogLevel=class{constructor(e){this._console=e,this._levelMap=new Map([[o.Error,0],[o.Warn,1],[o.Info,2],[o.Log,3]]),this._maxLevel=2}get level(){switch(this._maxLevel){case 0:return o.Error;case 1:return o.Warn;case 2:return o.Info}return o.Log}set level(e){let t=this._levelMap.get(e);void 0===t&&(t=this._levelMap.get(o.Info)),this._maxLevel=t}error(e){this._log(o.Error,e)}warn(e){this._log(o.Warn,e)}info(e){this._log(o.Info,e)}log(e){this._log(o.Log,e)}_log(e,t){this._getNumericalLevel(e)>this._maxLevel||l(this._console,e,t)}_getNumericalLevel(e){const t=this._levelMap.get(e);return a.assert(void 0!==t,"Logger: unknown log level."),void 0!==t?t:2}},t.log=l},98173:(e,t)=>{"use strict";function n(e,t){return e===t?0:void 0===e?-1:void 0===t?1:e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytesHex=void 0;const i=n(20823);let s;try{s=n(76417),(null==s?void 0:s.randomBytes)||(s=void 0)}catch{}t.randomBytesHex=function(e){if(s)return s.randomBytes(e).toString("hex");if(crypto){const n=crypto.getRandomValues(new Uint8Array(e));return t=n,[...t].map((e=>e.toString(16).padStart(2,"0"))).join("")}var t;i.fail("crypto library not found")}},20823:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSerializableError=t.getErrorString=t.formatEnum=t.getFunctionName=t.assertNever=t.assertEachDefined=t.assertDefined=t.fail=t.assert=void 0;const i=n(9133),s=n(98173);function r(e,t){const n=new Error(e?`Debug Failure. ${e}`:"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(n,t||r),n}function a(e,t,n){null==e&&r(t,n||a)}t.assert=function e(t,n,i,s){t||(i&&(n+="\r\nVerbose Debug Information: "+("string"==typeof i?i:i())),r(n?"False expression: "+n:"False expression.",s||e))},t.fail=r,t.assertDefined=a,t.assertEachDefined=function e(t,n,i){for(const s of t)a(s,n,i||e)},t.assertNever=function e(t,n="Illegal value:",i){r(`${n} ${JSON.stringify(t)}`,i||e)},t.getFunctionName=function(e){if("function"!=typeof e)return"";if(s.hasProperty(e,"name"))return e.name;{const t=Function.prototype.toString.call(e),n=/^function\s+([\w$]+)\s*\(/.exec(t);return n?n[1]:""}},t.formatEnum=function(e=0,t,n){const r=function(e){const t=[];for(const n of Object.keys(e)){const i=e[n];"number"==typeof i&&t.push([i,n])}return i.stableSort(t,((e,t)=>s.compareValues(e[0],t[0])))}(t);if(0===e)return r.length>0&&0===r[0][0]?r[0][1]:"0";if(n){let t="",n=e;for(const[i,s]of r){if(i>e)break;0!==i&&i&e&&(t=`${t}${t?"|":""}${s}`,n&=~i)}if(0===n)return t}else for(const[t,n]of r)if(t===e)return n;return e.toString()},t.getErrorString=function(e){return(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e)},t.getSerializableError=function(e){if(!e)return;return JSON.stringify(e).length>2?e:{name:e.name&&s.isString(e.name)?e.name:"noname",message:e.message&&s.isString(e.message)?e.message:"nomessage",stack:e.stack&&s.isString(e.stack)?e.stack:void 0}}},10219:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredFromPromise=t.createDeferredFrom=t.createDeferred=void 0;class n{constructor(e=null){this.scope=e,this._resolved=!1,this._rejected=!1,this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){this._resolve.apply(this.scope?this.scope:this,arguments),this._resolved=!0}reject(e){this._reject.apply(this.scope?this.scope:this,arguments),this._rejected=!0}get promise(){return this._promise}get resolved(){return this._resolved}get rejected(){return this._rejected}get completed(){return this._rejected||this._resolved}}function i(e=null){return new n(e)}t.createDeferred=i,t.createDeferredFrom=function(...e){const t=i();return Promise.all(e).then(t.resolve.bind(t)).catch(t.reject.bind(t)),t},t.createDeferredFromPromise=function(e){const t=i();return e.then(t.resolve.bind(t)).catch(t.reject.bind(t)),t}},24319:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticAddendum=t.Diagnostic=t.convertLevelToCategory=void 0;t.convertLevelToCategory=function(e){switch(e){case"error":return 0;case"warning":return 1;case"information":return 2;default:throw new Error(`${e} is not expected`)}};t.Diagnostic=class{constructor(e,t,n){this.category=e,this.message=t,this.range=n,this._relatedInfo=[]}addAction(e){void 0===this._actions?this._actions=[e]:this._actions.push(e)}getActions(){return this._actions}setRule(e){this._rule=e}getRule(){return this._rule}addRelatedInfo(e,t,n){this._relatedInfo.push({filePath:t,message:e,range:n})}getRelatedInfo(){return this._relatedInfo}};class n{constructor(){this._messages=[],this._childAddenda=[]}addMessage(e){this._messages.push(e)}createAddendum(){const e=new n;return this.addAddendum(e),e}getString(e=5,t=8){let n=this._getLinesRecursive(e,t);n.length>t&&(n=n.slice(0,t),n.push(" ..."));const i=n.join("\n");return i.length>0?"\n"+i:""}isEmpty(){return 0===this._getMessageCount()}addAddendum(e){this._childAddenda.push(e)}getChildren(){return this._childAddenda}_getMessageCount(e=0){if(e>64)return 0;let t=this._messages.length;for(const n of this._childAddenda)t+=n._getMessageCount(e+1);return t}_getLinesRecursive(e,t,n=0){if(e<=0||n>64)return[];let i=[];for(const s of this._childAddenda){const r=this._messages.length>0?e-1:e;if(i.push(...s._getLinesRecursive(r,t,n+1)),i.length>=t){i=i.slice(0,t);break}}const s=this._messages.length>0?"  ":"";return this._messages.concat(i).map((e=>s+e))}}t.DiagnosticAddendum=n},15741:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticRule=void 0,function(e){e.strictListInference="strictListInference",e.strictSetInference="strictSetInference",e.strictDictionaryInference="strictDictionaryInference",e.strictParameterNoneValue="strictParameterNoneValue",e.enableTypeIgnoreComments="enableTypeIgnoreComments",e.reportGeneralTypeIssues="reportGeneralTypeIssues",e.reportPropertyTypeMismatch="reportPropertyTypeMismatch",e.reportFunctionMemberAccess="reportFunctionMemberAccess",e.reportMissingImports="reportMissingImports",e.reportMissingModuleSource="reportMissingModuleSource",e.reportMissingTypeStubs="reportMissingTypeStubs",e.reportImportCycles="reportImportCycles",e.reportUnusedImport="reportUnusedImport",e.reportUnusedClass="reportUnusedClass",e.reportUnusedFunction="reportUnusedFunction",e.reportUnusedVariable="reportUnusedVariable",e.reportDuplicateImport="reportDuplicateImport",e.reportWildcardImportFromLibrary="reportWildcardImportFromLibrary",e.reportOptionalSubscript="reportOptionalSubscript",e.reportOptionalMemberAccess="reportOptionalMemberAccess",e.reportOptionalCall="reportOptionalCall",e.reportOptionalIterable="reportOptionalIterable",e.reportOptionalContextManager="reportOptionalContextManager",e.reportOptionalOperand="reportOptionalOperand",e.reportTypedDictNotRequiredAccess="reportTypedDictNotRequiredAccess",e.reportUntypedFunctionDecorator="reportUntypedFunctionDecorator",e.reportUntypedClassDecorator="reportUntypedClassDecorator",e.reportUntypedBaseClass="reportUntypedBaseClass",e.reportUntypedNamedTuple="reportUntypedNamedTuple",e.reportPrivateUsage="reportPrivateUsage",e.reportConstantRedefinition="reportConstantRedefinition",e.reportIncompatibleMethodOverride="reportIncompatibleMethodOverride",e.reportIncompatibleVariableOverride="reportIncompatibleVariableOverride",e.reportOverlappingOverload="reportOverlappingOverload",e.reportUninitializedInstanceVariable="reportUninitializedInstanceVariable",e.reportInvalidStringEscapeSequence="reportInvalidStringEscapeSequence",e.reportUnknownParameterType="reportUnknownParameterType",e.reportUnknownArgumentType="reportUnknownArgumentType",e.reportUnknownLambdaType="reportUnknownLambdaType",e.reportUnknownVariableType="reportUnknownVariableType",e.reportUnknownMemberType="reportUnknownMemberType",e.reportMissingTypeArgument="reportMissingTypeArgument",e.reportInvalidTypeVarUse="reportInvalidTypeVarUse",e.reportCallInDefaultInitializer="reportCallInDefaultInitializer",e.reportUnnecessaryIsInstance="reportUnnecessaryIsInstance",e.reportUnnecessaryCast="reportUnnecessaryCast",e.reportUnnecessaryComparison="reportUnnecessaryComparison",e.reportAssertAlwaysTrue="reportAssertAlwaysTrue",e.reportSelfClsParameterName="reportSelfClsParameterName",e.reportImplicitStringConcatenation="reportImplicitStringConcatenation",e.reportUndefinedVariable="reportUndefinedVariable",e.reportUnboundVariable="reportUnboundVariable",e.reportInvalidStubStatement="reportInvalidStubStatement",e.reportIncompleteStub="reportIncompleteStub",e.reportUnsupportedDunderAll="reportUnsupportedDunderAll",e.reportUnusedCallResult="reportUnusedCallResult",e.reportUnusedCoroutine="reportUnusedCoroutine"}(t.DiagnosticRule||(t.DiagnosticRule={}))},85036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeDiagnosticSink=t.DiagnosticSink=void 0;const i=n(24319),s=n(28348);class r{constructor(e){this._diagnosticList=e||[],this._diagnosticMap=new Map}fetchAndClear(){const e=this._diagnosticList;return this._diagnosticList=[],this._diagnosticMap.clear(),e}addError(e,t){return this.addDiagnostic(new i.Diagnostic(0,e,t))}addWarning(e,t){return this.addDiagnostic(new i.Diagnostic(1,e,t))}addInformation(e,t){return this.addDiagnostic(new i.Diagnostic(2,e,t))}addUnusedCode(e,t,n){const s=new i.Diagnostic(3,e,t);return n&&s.addAction(n),this.addDiagnostic(s)}addDiagnostic(e){const t=`${e.range.start.line},${e.range.start.character}-${e.range.end.line}-${e.range.end.character}:${e.message.substr(0,25)}}`;return this._diagnosticMap.has(t)||(this._diagnosticList.push(e),this._diagnosticMap.set(t,e)),e}addDiagnostics(e){this._diagnosticList.push(...e)}getErrors(){return this._diagnosticList.filter((e=>0===e.category))}getWarnings(){return this._diagnosticList.filter((e=>1===e.category))}getInformation(){return this._diagnosticList.filter((e=>2===e.category))}getUnusedCode(){return this._diagnosticList.filter((e=>3===e.category))}}t.DiagnosticSink=r;t.TextRangeDiagnosticSink=class extends r{constructor(e,t){super(t),this._lines=e}addDiagnosticWithTextRange(e,t,n){const i=s.convertOffsetsToRange(n.start,n.start+n.length,this._lines);switch(e){case"error":return this.addError(t,i);case"warning":return this.addWarning(t,i);case"information":return this.addInformation(t,i);default:throw new Error(`${e} is not expected value`)}}addUnusedCodeWithTextRange(e,t,n){return this.addUnusedCode(e,s.convertOffsetsToRange(t.start,t.start+t.length,this._lines),n)}}},53117:()=>{"use strict";Promise.prototype.ignoreErrors=function(){this.catch((()=>{}))}},68384:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FileBasedCancellationProvider=t.getCancellationTokenId=t.getCancellationTokenFromId=t.disposeCancellationToken=t.getCancellationStrategyFromArgv=void 0;const a=r(n(35747)),o=r(n(12087)),l=r(n(85622)),c=n(20947),p=n(29335),d=n(38213);class u{static shouldCheck(){const e=Date.now().valueOf();return e-this._lastCheckTimestamp>=5&&(this._lastCheckTimestamp=e,!0)}}u._lastCheckTimestamp=0;class h{constructor(e){this.cancellationFilePath=e,this.isCancelled=!1}cancel(){this.isCancelled||(this.isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this._disposeEmitter()))}get isCancellationRequested(){return!!this.isCancelled||(u.shouldCheck()&&this._pipeExists()&&this.cancel(),this.isCancelled)}get onCancellationRequested(){return this._emitter||(this._emitter=new p.Emitter),this._emitter.event}dispose(){this._disposeEmitter()}_disposeEmitter(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}_pipeExists(){try{return a.statSync(this.cancellationFilePath),!0}catch(e){return!1}}}class m extends h{constructor(e){super(e),this._disposed=!1}cancel(){this._disposed||this.isCancelled||(this._createPipe(),super.cancel())}get isCancellationRequested(){return this.isCancelled}dispose(){this._disposed=!0,super.dispose(),this._removePipe()}_createPipe(){try{a.writeFileSync(this.cancellationFilePath,"",{flag:"w"})}catch{}}_removePipe(){try{a.unlinkSync(this.cancellationFilePath)}catch{}}}class y{constructor(e,t=!1){this._cancellationFilePath=e,this._ownFile=t}get token(){return this._token||(this._token=this._ownFile?new m(this._cancellationFilePath):new h(this._cancellationFilePath)),this._token}cancel(){this._token?this._token.cancel():this._token=p.CancellationToken.Cancelled}dispose(){this._token?this._token instanceof h&&this._token.dispose():this._token=p.CancellationToken.None}}function g(e,t){return l.join(function(e){return l.join(o.tmpdir(),"python-languageserver-cancellation",e)}(e),`cancellation-${String(t)}.tmp`)}class f{constructor(e){this.folderName=e}createCancellationTokenSource(e){return new y(g(this.folderName,e))}}t.getCancellationStrategyFromArgv=function(e){let t;for(let i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualDirent=t.nullFileWatcherProvider=t.isInZipOrEgg=t.ignoredWatchEventFunction=void 0,t.ignoredWatchEventFunction=function(e){const t=e.map((e=>e.toLowerCase()));return e=>{if(!e||e.indexOf("__pycache__")>=0)return!0;const n=e.toLowerCase();return t.every((e=>n.indexOf(e)<0))}},t.isInZipOrEgg=function(e){return/[^\\/]\.(?:egg|zip)[\\/]/.test(e)};const n={close(){}};t.nullFileWatcherProvider={createFileWatcher:(e,t)=>n,onFileChange(e,t){}};t.VirtualDirent=class{constructor(e,t){this.name=e,this._file=t}isFile(){return this._file}isDirectory(){return!this._file}isBlockDevice(){return!1}isCharacterDevice(){return!1}isSymbolicLink(){return!1}isFIFO(){return!1}isSocket(){return!1}}},77134:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogTracker=void 0;const i=n(11043),s=n(76962);t.LogTracker=class{constructor(e,t){this._console=e,this._prefix=t,this._dummyState=new r,this._indentation="",this._previousTitles=[]}log(e,t,n=-1,s=!1){if(void 0===this._console)return t(this._dummyState);const a=this._console.level;if(void 0===a||a!==i.LogLevel.Log&&a!==i.LogLevel.Info)return t(this._dummyState);const o=this._indentation;this._previousTitles.push(`${o}${e} ...`),this._indentation+=" ";const l=new r;try{return t(l)}finally{const t=l.duration;if(this._indentation=o,this._previousTitles.length>0&&(l.isSuppressed()||t<=n))this._previousTitles.pop();else{this._printPreviousTitles();let n=`[${this._prefix}] ${this._indentation}${e}${l.get()} (${t}ms)`;s&&l.fileReadTotal+l.tokenizeTotal+l.parsingTotal+l.resolveImportsTotal+l.bindingTotal>0&&(n+=` [f:${l.fileReadTotal}, t:${l.tokenizeTotal}, p:${l.parsingTotal}, i:${l.resolveImportsTotal}, b:${l.bindingTotal}]`),this._console.log(n),t>=2e3&&this._console.info(`[${this._prefix}] Long operation: ${e} (${t}ms)`)}}}_printPreviousTitles(){if(this._previousTitles.pop(),!(this._previousTitles.length<=0)){for(const e of this._previousTitles)this._console.log(`[${this._prefix}] ${e}`);this._previousTitles.length=0}}};class r{constructor(){this._start=new s.Duration,this._startFile=s.timingStats.readFileTime.totalTime,this._startToken=s.timingStats.tokenizeFileTime.totalTime,this._startParse=s.timingStats.parseFileTime.totalTime,this._startImport=s.timingStats.resolveImportsTime.totalTime,this._startBind=s.timingStats.bindTime.totalTime}get duration(){return this._start.getDurationInMilliseconds()}get fileReadTotal(){return s.timingStats.readFileTime.totalTime-this._startFile}get tokenizeTotal(){return s.timingStats.tokenizeFileTime.totalTime-this._startToken}get parsingTotal(){return s.timingStats.parseFileTime.totalTime-this._startParse}get resolveImportsTotal(){return s.timingStats.resolveImportsTime.totalTime-this._startImport}get bindingTotal(){return s.timingStats.bindTime.totalTime-this._startBind}add(e){e&&(this._addendum=e)}get(){return this._addendum?` [${this._addendum}]`:""}suppress(){this._suppress=!0}isSuppressed(){return!!this._suppress}}},97956:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stubsSuffix=t.src=t.sitePackages=t.lib64=t.libAlternate=t.lib=t.typeshedFallback=void 0,t.typeshedFallback="typeshed-fallback",t.lib="lib",t.libAlternate="Lib",t.lib64="lib64",t.sitePackages="site-packages",t.src="src",t.stubsSuffix="-stubs"},94647:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getLibraryPathWithoutExtension=t.isFileSystemCaseSensitiveInternal=t.isFileSystemCaseSensitive=t.normalizePathCase=t.convertPathToUri=t.extractPathFromUri=t.convertUriToPath=t.isDiskPathRoot=t.isRootedDiskPath=t.getRegexEscapedSeparator=t.getFileSpec=t.getWildcardRoot=t.getWildcardRegexPattern=t.getFileSystemEntriesFromDirEntries=t.getFileSystemEntries=t.tryRealpath=t.tryStat=t.isFile=t.isDirectory=t.normalizePath=t.stripFileExtension=t.getFileName=t.getFileExtension=t.stripTrailingDirectorySeparator=t.hasTrailingDirectorySeparator=t.ensureTrailingDirectorySeparator=t.comparePathsCaseInsensitive=t.comparePathsCaseSensitive=t.getRelativePathComponentsFromDirectory=t.getRelativePathFromDirectory=t.getBaseFileName=t.getAnyExtensionFromPath=t.changeAnyExtension=t.containsPath=t.comparePaths=t.combinePaths=t.resolvePaths=t.normalizeSlashes=t.directoryExists=t.fileExists=t.getFileSize=t.makeDirectories=t.getRelativePath=t.combinePathComponents=t.reducePathComponents=t.getPathComponents=t.getRootLength=t.getDirectoryPath=t.forEachAncestorDirectory=t.FileSpec=void 0;const a=r(n(85622)),o=n(15585),l=n(9133),c=n(98173),p=n(53316),d=r(n(20823)),u=n(14551);let h;function m(e){return e.substr(0,Math.max(y(e),e.lastIndexOf(a.sep)))}function y(e){if(e.charAt(0)===a.sep){if(e.charAt(1)!==a.sep)return 1;const t=e.indexOf(a.sep,2);if(t<0)return 2;const n=e.indexOf(a.sep,t+1);return n<0?t+1:n+1}return":"===e.charAt(1)&&e.charAt(2)===a.sep?3:0}function g(e){const t=v(e),n=y(t),i=t.substring(0,n),s=t.substring(n).split(a.sep);return s.length>0&&!s[s.length-1]&&s.pop(),f([i,...s])}function f(e){if(!l.some(e))return[];const t=[e[0]];for(let n=1;n1){if(".."!==t[t.length-1]){t.pop();continue}}else if(t[0])continue;t.push(i)}}return t}function T(e){if(0===e.length)return"";return v((e[0]&&D(e[0]))+e.slice(1).join(a.sep))}!function(e){e.is=function(e){const t=e;return t&&!!t.wildcardRoot&&!!t.regExp}}(t.FileSpec||(t.FileSpec={})),t.forEachAncestorDirectory=function(e,t){for(;;){const n=t(e);if(void 0!==n)return n;const i=m(e);if(i===e)return;e=i}},t.getDirectoryPath=m,t.getRootLength=y,t.getPathComponents=g,t.reducePathComponents=f,t.combinePathComponents=T,t.getRelativePath=function(e,t){if(!e.startsWith(D(t)))return;const n=g(e);let i=".";for(let e=g(t).length;e=0?i.substring(s):""}function C(e,t,n){if(y(e=v(e))===e.length)return"";const i=(e=A(e)).slice(Math.max(y(e),e.lastIndexOf(a.sep)+1)),s=void 0!==t&&void 0!==n?I(i,t,n):void 0;return s?i.slice(0,i.length-s.length):i}function S(e,t,n){d.assert(y(e)>0==y(t)>0,"Paths must either both be absolute or both be relative");const i="function"==typeof n?n:c.identity;return function(e,t,n,i){const s=g(e),r=g(t);let a;for(a=0;ae.namet.name?1:0)),s=[],r=[];for(const e of i)if("."!==e.name&&".."!==e.name)if(e.isFile())s.push(e.name);else if(e.isDirectory())r.push(e.name);else if(e.isSymbolicLink()){const i=w(t,b(n,e.name));(null==i?void 0:i.isFile())?s.push(e.name):(null==i?void 0:i.isDirectory())&&r.push(e.name)}return{files:s,directories:r}}function R(e,t){let n=E(b(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=D(n));const i=g(n),s=O(),r=`(${s}[^${s}.][^${s}]*)*?`,a=new RegExp(`[^\\w\\s${s}]`,"g");i.length>0&&(i[0]=A(i[0]));let o="",l=!0;for(let e of i)"**"===e?o+=r:(l||(e=s+e),o+=e.replace(a,(e=>"*"===e?`[^${s}]*`:"?"===e?`[^${s}]`:"\\"+e)),l=!1);return o}function M(e,t){let n=E(b(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=D(n));const i=g(n);i.length>0&&(i[0]=A(i[0]));let s="",r=!0;for(let e of i){if("**"===e)break;if(e.match(/[*?]/))break;r||(e=a.sep+e),s+=e,r=!1}return s}function O(){return"/"===a.sep?"/":"\\\\"}function L(e,t,n){if(e===t)return 0;if(void 0===e)return-1;if(void 0===t)return 1;const i=e.substring(0,y(e)),s=t.substring(0,y(t)),r=u.compareStringsCaseInsensitive(i,s);if(0!==r)return r;const a=O(),o=new RegExp(`(^|${a}).{0,2}($|${a})`),l=e.substring(i.length),p=t.substring(s.length);if(!o.test(l)&&!o.test(p))return n(l,p);const d=g(e),h=g(t),m=Math.min(d.length,h.length);for(let e=1;e=t.length&&46===e.charCodeAt(e.length-t.length)){const i=e.slice(e.length-t.length);if(n(i,t))return i}}function V(e,t,n){try{const i=e.statSync(t);switch(n){case 0:return i.isFile();case 1:return i.isDirectory();default:return!1}}catch(e){return!1}}function z(e){let t=E(o.URI.parse(e).path);return t.match(/^\\[a-zA-Z]:\\/)&&(t=t.substr(1)),t}function B(e){return void 0!==h||(h=W(e)),h}function W(e){let t;try{let n,i;do{n=`${p.randomBytesHex(21)}-a`,t=a.join(e.tmpdir(),n),i=a.join(e.tmpdir(),n.toUpperCase())}while(e.existsSync(t)||e.existsSync(i));return e.writeFileSync(t,"","utf8"),!e.existsSync(i)}catch(e){return!1}finally{t&&e.unlinkSync(t)}}t.normalizeSlashes=v,t.resolvePaths=function(e,...t){return E(l.some(t)?b(e,...t):v(e))},t.combinePaths=b,t.comparePaths=function(e,t,n,i){return e=E(e),t=E(t),"string"==typeof n?(e=b(n,e),t=b(n,t)):"boolean"==typeof n&&(i=n),L(e,t,u.getStringComparer(i))},t.containsPath=function(e,t,n,i){if("string"==typeof n?(e=b(n,e),t=b(n,t)):"boolean"==typeof n&&(i=n),void 0===e||void 0===t)return!1;if(e===t)return!0;const s=g(e),r=g(t);if(r.length0},t.isDiskPathRoot=function(e){const t=y(e);return t>0&&t===e.length},t.convertUriToPath=function(e,t){return e.getMappedFilePath(z(t))},t.extractPathFromUri=z,t.convertPathToUri=function(e,t){return e.getUri(e.getOriginalFilePath(t))},t.normalizePathCase=function(e,t){return B(e)?t:t.toLowerCase()},t.isFileSystemCaseSensitive=B,t.isFileSystemCaseSensitiveInternal=W,t.getLibraryPathWithoutExtension=function(e){let t=P(e);return t.endsWith("__init__")&&(t=t.substr(0,t.length-9)),t}},28348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextRangeToRange=t.convertRangeToTextRange=t.convertPositionToOffset=t.convertOffsetsToRange=t.convertOffsetToPosition=void 0;const i=n(20823),s=n(80957);function r(e,t){if(0===t.end)return{line:0,character:0};let n=0;e>=t.end&&(e=t.end-1,n=1);const s=t.getItemContaining(e);i.assert(s>=0&&s<=t.length);const r=t.getItemAt(s);return i.assert(void 0!==r),{line:s,character:e-r.start+n}}function a(e,t,n){return{start:r(e,n),end:r(t,n)}}function o(e,t){if(!(e.line>=t.count))return t.getItemAt(e.line).start+e.character}t.convertOffsetToPosition=r,t.convertOffsetsToRange=a,t.convertPositionToOffset=o,t.convertRangeToTextRange=function(e,t){const n=o(e.start,t);if(void 0===n)return;const i=o(e.end,t);return void 0!==i?s.TextRange.fromBounds(n,i):void 0},t.convertTextRangeToRange=function(e,t){return a(e.start,s.TextRange.getEnd(e),t)}},76913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressReportTracker=void 0;t.ProgressReportTracker=class{constructor(e){this._reporter=e,this._isDisplayingProgress=!1}isEnabled(e){var t;return!!this._isDisplayingProgress||null!==(t=this._reporter.isEnabled(e))&&void 0!==t&&t}begin(){this._isDisplayingProgress||(this._isDisplayingProgress=!0,this._reporter.begin())}report(e){this._isDisplayingProgress&&this._reporter.report(e)}end(){this._isDisplayingProgress&&(this._isDisplayingProgress=!1,this._reporter.end())}}},57485:(e,t)=>{"use strict";var n;function i(e,t){if(isNaN(e)||isNaN(t))return;if(e>255||t>255)return;const i=256*e+t;return void 0!==n[i]&&s(i)?i:void 0}function s(e){return e>>8==3}Object.defineProperty(t,"__esModule",{value:!0}),t.is3x=t.versionFromMajorMinor=t.versionFromString=t.versionToString=t.latestPythonVersion=t.latestStablePythonVersion=t.PythonVersion=void 0,function(e){e[e.V3_0=768]="V3_0",e[e.V3_1=769]="V3_1",e[e.V3_2=770]="V3_2",e[e.V3_3=771]="V3_3",e[e.V3_4=772]="V3_4",e[e.V3_5=773]="V3_5",e[e.V3_6=774]="V3_6",e[e.V3_7=775]="V3_7",e[e.V3_8=776]="V3_8",e[e.V3_9=777]="V3_9",e[e.V3_10=778]="V3_10",e[e.V3_11=779]="V3_11"}(n=t.PythonVersion||(t.PythonVersion={})),t.latestStablePythonVersion=n.V3_9,t.latestPythonVersion=n.V3_9,t.versionToString=function(e){return`${e>>8&255}.${255&e}`},t.versionFromString=function(e){const t=e.split(".");if(t.length<2)return;return i(parseInt(t[0],10),parseInt(t[1],10))},t.versionFromMajorMinor=i,t.is3x=s},49085:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceFileWatcherProvider=t.createFromRealFileSystem=void 0;const a=n(59480),o=n(41811),l=r(n(35747)),c=r(n(88554)),p=n(15585),d=n(11043),u=n(98173),h=n(6021),m=n(94647),y=n(94647);c.setGracefulCleanup(),t.createFromRealFileSystem=function(e,t){return e=null!=e?e:new d.NullConsole,new D(null!=t?t:h.nullFileWatcherProvider,e)};const g=".zip",f=".egg";function T(e){let t=e.indexOf(g);if(t<=0&&(t=e.indexOf(f),t<=0))return null;if(e[t-1]===a.ppath.sep)return null;const n=t+g.length;return e.length>n&&e[n]!==a.ppath.sep?null:e.slice(0,n)}function _(e){return e.endsWith(g)||e.endsWith(f)}const v=[Buffer.from([80,75,3,4]),Buffer.from([80,75,5,6]),Buffer.from([80,75,7,8])];function b(e,t){let n;try{n=e.openSync(t,"r");const i=Buffer.alloc(4);if(e.readSync(n,i,0,4,0)<4)return!1;for(const e of v)if(0===i.compare(e))return!0;return!1}catch{return!1}finally{void 0!==n&&e.closeSync(n)}}class I extends a.ZipOpenFS{findZip(e){if(this.filter&&!this.filter.test(e))return null;let t="";for(;;){const n=T(e.substr(t.length));if(!n)return null;if(t=this.pathUtils.join(t,n),!1===this.isZip.has(t)){if(this.notZip.has(t))continue;try{if(!this.baseFs.lstatSync(t).isFile()){this.notZip.add(t);continue}if(!b(this.baseFs,t)){this.notZip.add(t);continue}}catch{return null}this.isZip.add(t)}return{archivePath:t,subPath:this.pathUtils.join(a.PortablePath.root,e.substr(t.length))}}}}class C extends a.PosixFS{constructor(){const e=new I({libzip:()=>o.getLibzipSync(),useCache:!0,maxOpenFiles:80,readOnlyArchives:!0});super(new a.VirtualFS({baseFs:e})),this._eggZipOpenFS=e}isZip(e){return!!this._eggZipOpenFS.findZip(this.mapToBase(e))}}const S=new C;class D{constructor(e,t){this._fileWatcherProvider=e,this._console=t}existsSync(e){try{return S.existsSync(e)}catch{return!1}}mkdirSync(e,t){S.mkdirSync(e,t)}chdir(e){process.chdir(e)}readdirSync(e){return S.readdirSync(e)}readdirEntriesSync(e){return S.readdirSync(e,{withFileTypes:!0}).map((t=>_(t.name)&&t.isFile()&&S.isZip(e)?{name:t.name,isFile:()=>!1,isDirectory:()=>!0,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}:t))}readFileSync(e,t=null){return"utf8"===t||"utf-8"===t?S.readFileSync(e,"utf8"):S.readFileSync(e)}writeFileSync(e,t,n){S.writeFileSync(e,t,n||void 0)}statSync(e){const t=S.statSync(e);return _(e)&&t.isFile()&&S.isZip(e)?{...t,isFile:()=>!1,isDirectory:()=>!0}:t}unlinkSync(e){S.unlinkSync(e)}realpathSync(e){return S.realpathSync(e)}getModulePath(){return global.__rootDirectory}createFileSystemWatcher(e,t){return this._fileWatcherProvider.createFileWatcher(e,t)}createReadStream(e){return S.createReadStream(e)}createWriteStream(e){return S.createWriteStream(e)}copyFileSync(e,t){S.copyFileSync(e,t)}readFile(e){return S.readFilePromise(e)}async readFileText(e,t){if("utf8"===t||"utf-8"===t)return S.readFilePromise(e,"utf8");return(await S.readFilePromise(e)).toString(t)}tmpdir(){if(!this._tmpdir){const e=c.dirSync({prefix:"pyright"});this._tmpdir=e.name}return this._tmpdir}tmpfile(e){return c.fileSync({dir:this.tmpdir(),discardDescriptor:!0,...e}).name}realCasePath(e){try{if(!l.existsSync(e))return e;const t=l.realpathSync.native(e),n=y.getRootLength(t);return n<=0?t:t.substr(0,n).toLowerCase()+t.substr(n)}catch(t){return this._console.error(`Failed to get real file system casing for ${e}: ${t}`),e}}isMappedFilePath(e){return!1}getOriginalFilePath(e){return e}getMappedFilePath(e){return e}getUri(e){return p.URI.file(e).toString()}}t.WorkspaceFileWatcherProvider=class{constructor(e){this._workspaceMap=e,this._fileWatchers=[]}createFileWatcher(e,t){const n=[],i=[],s=this._workspaceMap.getNonDefaultWorkspaces();e.forEach((e=>{s.some((t=>m.containsPath(t.rootPath,e)))?n.push(e):i.push(e)}));const r=i.map((e=>{if(l.existsSync(e))try{return l.watch(e,{recursive:!0},((e,n)=>t(e,n)))}catch(e){return void console.warn(`Exception received when installing recursive file system watcher: ${e}`)}})).filter(u.isDefined),a=this,o={close(){a._fileWatchers=a._fileWatchers.filter((e=>e!==o)),r.forEach((e=>{e.close()}))},workspacePaths:n,eventHandler:t};return a._fileWatchers.push(o),o}onFileChange(e,t){this._fileWatchers.forEach((n=>{n.workspacePaths.some((e=>m.containsPath(e,t)))&&n.eventHandler(e,t)}))}}},14551:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCharacterCount=t.equateStringsCaseSensitive=t.equateStringsCaseInsensitive=t.getStringComparer=t.compareStringsCaseSensitive=t.compareStringsCaseInsensitive=t.hashString=t.isPatternInSymbol=t.computeCompletionSimilarity=void 0;const s=i(n(68505)),r=n(98173);function a(e,t){return e===t?0:void 0===e?-1:void 0===t?1:r.compareComparableValues(e.toUpperCase(),t.toUpperCase())}function o(e,t){return r.compareComparableValues(e,t)}t.computeCompletionSimilarity=function(e,t){if(t.startsWith(e))return 1;const n=t.toLocaleLowerCase(),i=e.toLocaleLowerCase();if(n.startsWith(i))return.75;let r=n.length,a=Number.MAX_VALUE;for(;r>0;){const e=s.default(n.substr(0,r),i);e=e.length?0:.5*((e.length-a)/e.length)},t.isPatternInSymbol=function(e,t){const n=e.toLocaleLowerCase(),i=t.toLocaleLowerCase(),s=n.length,r=i.length;let a=0,o=0;for(;a{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextEdits=void 0,t.convertTextEdits=function(e,t){if(!t)return{};const n=[];return t.forEach((e=>{n.push({range:e.range,newText:e.replacementText})})),{changes:{[e]:n}}}},80957:(e,t)=>{"use strict";var n,i;function s(e,t){return e.linet.line?1:e.charactert.character?1:0}function r(){return{line:0,character:0}}function a(e){return 0===e.character&&0===e.line}Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyRange=t.isEmptyPosition=t.getEmptyRange=t.rangesAreEqual=t.doesRangeContain=t.doRangesIntersect=t.doRangesOverlap=t.getEmptyPosition=t.comparePositions=t.TextRange=void 0,function(e){function t(e,t){if(e<0)throw new Error("start must be non-negative");if(t<0)throw new Error("length must be non-negative");return{start:e,length:t}}function n(e){return e.start+e.length}function i(e,t){t&&(Array.isArray(t)?t.forEach((t=>{i(e,t)})):(t.startn(e)&&(e.length+=n(t)-n(e))))}e.create=t,e.fromBounds=function(e,n){if(e<0)throw new Error("start must be non-negative");if(e>n)throw new Error("end must be greater than or equal to start");return t(e,n-e)},e.getEnd=n,e.contains=function(e,t){return t>=e.start&&t=e.start&&n(t)<=n(e)},e.overlaps=function(e,t){return t>=e.start&&t<=n(e)},e.extend=i,e.combine=function(e){if(0===e.length)return;const t=e[0];for(let n=1;n=0)&&!(s(e.start,t.end)>=0)},t.doRangesIntersect=function(e,t){return!(s(t.start,e.end)>0)&&!(s(e.start,t.end)>0)},t.doesRangeContain=function e(t,i){return n.is(i)?s(t.start,i)<=0&&s(t.end,i)>=0:e(t,i.start)&&e(t,i.end)},t.rangesAreEqual=function(e,t){return 0===s(e.start,t.start)&&0===s(e.end,t.end)},t.getEmptyRange=function(){return{start:{line:0,character:0},end:{line:0,character:0}}},t.isEmptyPosition=a,t.isEmptyRange=function(e){return a(e.start)&&a(e.end)}},979:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeCollection=void 0;const i=n(80957);t.TextRangeCollection=class{constructor(e){this._items=e}get start(){return this._items.length>0?this._items[0].start:0}get end(){const e=this._items[this._items.length-1];return this._items.length>0?e.start+e.length:0}get length(){return this.end-this.start}get count(){return this._items.length}contains(e){return e>=this.start&&e=this._items.length)throw new Error("index is out of range");return this._items[e]}getItemAtPosition(e){if(0===this.count)return-1;if(ethis.end)return-1;let t=0,n=this.count-1;for(;t=s.start&&(i>=this.count-1||ethis.end)return-1;let t=0,n=this.count-1;for(;t<=n;){const s=Math.floor(t+(n-t)/2),r=this._items[s];if(i.TextRange.contains(r,e))return s;if(s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timingStats=t.TimingStats=t.TimingStat=t.Duration=void 0;class n{constructor(){this._startTime=Date.now()}getDurationInMilliseconds(){return Date.now()-this._startTime}getDurationInSeconds(){return this.getDurationInMilliseconds()/1e3}}t.Duration=n;class i{constructor(){this.totalTime=0,this.callCount=0,this.isTiming=!1}timeOperation(e){if(this.callCount++,this.isTiming)return e();{this.isTiming=!0;const t=new n,i=e();return this.totalTime+=t.getDurationInMilliseconds(),this.isTiming=!1,i}}subtractFromTime(e){if(this.isTiming){this.isTiming=!1;const t=new n;e(),this.totalTime-=t.getDurationInMilliseconds(),this.isTiming=!0}else e()}printTime(){const e=this.totalTime/1e3;return(Math.round(100*e)/100).toString()+"sec"}}t.TimingStat=i;class s{constructor(){this.totalDuration=new n,this.findFilesTime=new i,this.readFileTime=new i,this.tokenizeFileTime=new i,this.parseFileTime=new i,this.resolveImportsTime=new i,this.cycleDetectionTime=new i,this.bindTime=new i,this.typeCheckerTime=new i,this.typeEvaluationTime=new i}printSummary(e){e.info(`Completed in ${this.totalDuration.getDurationInSeconds()}sec`)}printDetails(e){e.info(""),e.info("Timing stats"),e.info("Find Source Files: "+this.findFilesTime.printTime()),e.info("Read Source Files: "+this.readFileTime.printTime()),e.info("Tokenize: "+this.tokenizeFileTime.printTime()),e.info("Parse: "+this.parseFileTime.printTime()),e.info("Resolve Imports: "+this.resolveImportsTime.printTime()),e.info("Bind: "+this.bindTime.printTime()),e.info("Check: "+this.typeCheckerTime.printTime()),e.info("Detect Cycles: "+this.cycleDetectionTime.printTime())}getTotalDuration(){return this.totalDuration.getDurationInSeconds()}}t.TimingStats=s,t.timingStats=new s},19728:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertWorkspaceEdits=void 0;const i=n(94647);t.convertWorkspaceEdits=function(e,t){const n={changes:{}};return t.forEach((t=>{const s=i.convertPathToUri(e,t.filePath);n.changes[s]=n.changes[s]||[],n.changes[s].push({range:t.range,newText:t.replacementText})})),n}},52599:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageServerBase=void 0,n(53117);const i=n(29335),s=n(47041),r=n(67145),a=n(44314),o=n(9055),l=n(38213),c=n(9133),p=n(96795),d=n(14943),u=n(11043),h=n(10219),m=n(6021),y=n(94647),g=n(76913),f=n(19728),T=n(22060),_=n(27888),v=n(54989),b=n(8871),I=n(74426),C=n(37633);t.LanguageServerBase=class{constructor(e,t){var n,s;this._serverOptions=e,this._connection=t,this.client={hasConfigurationCapability:!1,hasVisualStudioExtensionsCapability:!1,hasWorkspaceFoldersCapability:!1,hasWatchFileCapability:!1,hasActiveParameterCapability:!1,hasSignatureLabelOffsetCapability:!1,hasHierarchicalDocumentSymbolCapability:!1,hasWindowProgressCapability:!1,hasGoToDeclarationCapability:!1,hoverContentFormat:i.MarkupKind.PlainText,completionDocFormat:i.MarkupKind.PlainText,completionSupportsSnippet:!1,signatureDocFormat:i.MarkupKind.PlainText,supportsUnnecessaryDiagnosticTag:!1,completionItemResolveSupportsAdditionalTextEdits:!1},this._lastTriggerKind=i.CompletionTriggerKind.Invoked,this.rootPath="",global.__rootDirectory=e.rootDirectory,this.console=new u.ConsoleWithLogLevel(this._connection.console),this.console.info(`${e.productName} language server ${e.version&&e.version+" "}starting`),this.console.info(`Server root directory: ${e.rootDirectory}`),this._workspaceMap=this._serverOptions.workspaceMap,this._fileWatcherProvider=this._serverOptions.fileWatcherProvider,this.fs=new C.PyrightFileSystem(this._serverOptions.fileSystem);const r=this.fs.getModulePath();r&&this.fs.chdir(r),this.setupConnection(null!==(n=e.supportedCommands)&&void 0!==n?n:[],null!==(s=e.supportedCodeActions)&&void 0!==s?s:[]),this._progressReporter=new g.ProgressReportTracker(this.createProgressReporter()),this._connection.listen()}isLongRunningCommand(e){return!0}async getConfiguration(e,t){if(this.client.hasConfigurationCapability){const n={};return void 0!==e&&(n.scopeUri=e),void 0!==t&&(n.section=t),this._connection.workspace.getConfiguration(n)}if(this._defaultClientConfig)return c.getNestedProperty(this._defaultClientConfig,t)}isOpenFilesOnly(e){return"workspace"!==e}getSeverityOverrides(e){const t=e;if(p.getDiagnosticSeverityOverrides().includes(t))return t}getDiagnosticRuleName(e){const t=e;if(d.getDiagLevelDiagnosticRules().includes(t))return t}createImportResolver(e,t){return new r.ImportResolver(e,t)}createBackgroundAnalysisProgram(e,t,n,i,r,a){return new s.BackgroundAnalysisProgram(e,t,n,i,r,a)}setExtension(e){this._serverOptions.extension=e}get window(){return this._connection.window}createAnalyzerService(e){this.console.log(`Starting service instance "${e}"`);const t=new a.AnalyzerService(e,this.fs,this.console,this.createImportResolver.bind(this),void 0,this._serverOptions.extension,this.createBackgroundAnalysis(),this._serverOptions.maxAnalysisTimeInForeground,this.createBackgroundAnalysisProgram.bind(this),this._serverOptions.cancellationProvider);return t.setCompletionCallback((e=>this.onAnalysisCompletedHandler(e))),t}async getWorkspaceForFile(e){const t=this._workspaceMap.getWorkspaceForFile(this,e);return await t.isInitialized.promise,t}reanalyze(){this._workspaceMap.forEach((e=>{e.serviceInstance.invalidateAndForceReanalysis()}))}restart(){this._workspaceMap.forEach((e=>{e.serviceInstance.restart()}))}setupConnection(e,t){this._connection.onInitialize((n=>this.initialize(n,e,t))),this._connection.onDidChangeConfiguration((e=>{this.console.log("Received updated settings"),(null==e?void 0:e.settings)&&(this._defaultClientConfig=null==e?void 0:e.settings),this.updateSettingsForAllWorkspaces()})),this._connection.onCodeAction(((e,t)=>this.executeCodeAction(e,t)));const n=async(e,t,n)=>{this.recordUserInteractionTime();const s=y.convertUriToPath(this.fs,e.textDocument.uri),r={line:e.position.line,character:e.position.character},a=await this.getWorkspaceForFile(s);if(a.disableLanguageServices)return;const o=a.serviceInstance.getDefinitionForPosition(s,r,n,t);return o?o.filter((e=>!m.isInZipOrEgg(e.path))).map((e=>i.Location.create(y.convertPathToUri(this.fs,e.path),e.range))):void 0};this._connection.onDefinition(((e,t)=>n(e,t,this.client.hasGoToDeclarationCapability?_.DefinitionFilter.PreferSource:_.DefinitionFilter.All))),this._connection.onDeclaration(((e,t)=>n(e,t,this.client.hasGoToDeclarationCapability?_.DefinitionFilter.PreferStubs:_.DefinitionFilter.All))),this._connection.onReferences((async(e,t,n,s)=>{this._pendingFindAllRefsCancellationSource&&(this._pendingFindAllRefsCancellationSource.cancel(),this._pendingFindAllRefsCancellationSource=void 0);const r=await this._getProgressReporter(e.workDoneToken,n,I.Localizer.CodeAction.findingReferences()),a=l.CancelAfter(t,r.token);this._pendingFindAllRefsCancellationSource=a;try{const t=y.convertUriToPath(this.fs,e.textDocument.uri),n={line:e.position.line,character:e.position.character},o=await this.getWorkspaceForFile(t);if(o.disableLanguageServices)return;const l=e=>e.filter((e=>!m.isInZipOrEgg(e.path))).map((e=>i.Location.create(y.convertPathToUri(this.fs,e.path),e.range))),c=[],p=s?e=>s.report(l(e)):e=>c.push(...l(e));return o.serviceInstance.reportReferencesForPosition(t,n,e.context.includeDeclaration,p,a.token),c}finally{r.reporter.done(),a.dispose()}})),this._connection.onDocumentSymbol((async(e,t)=>{this.recordUserInteractionTime();const n=y.convertUriToPath(this.fs,e.textDocument.uri),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return;const s=[];return i.serviceInstance.addSymbolsForDocument(n,s,t),this.client.hasHierarchicalDocumentSymbolCapability?s:v.convertToFlatSymbols(e.textDocument.uri,s)})),this._connection.onWorkspaceSymbol((async(e,t,n,i)=>{const s=[],r=i?e=>i.report(e):e=>s.push(...e);for(const n of this._workspaceMap.values())await n.isInitialized.promise,n.disableLanguageServices||n.serviceInstance.reportSymbolsForWorkspace(e.query,r,t);return s})),this._connection.onHover((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=(await this.getWorkspaceForFile(n)).serviceInstance.getHoverForPosition(n,i,this.client.hoverContentFormat,t);return b.convertHoverResults(this.client.hoverContentFormat,s)})),this._connection.onDocumentHighlight((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.textDocument.uri),i={line:e.position.line,character:e.position.character};return(await this.getWorkspaceForFile(n)).serviceInstance.getDocumentHighlight(n,i,t)})),this._connection.onSignatureHelp((async(e,t)=>{var n,s,r,a;const o=y.convertUriToPath(this.fs,e.textDocument.uri),l={line:e.position.line,character:e.position.character},c=await this.getWorkspaceForFile(o);if(c.disableLanguageServices)return;const p=c.serviceInstance.getSignatureHelpForPosition(o,l,this.client.signatureDocFormat,t);if(!p)return;const d=p.signatures.map((e=>{let t=[];e.parameters&&(t=e.parameters.map((e=>i.ParameterInformation.create(this.client.hasSignatureLabelOffsetCapability?[e.startOffset,e.endOffset]:e.text,e.documentation))));const n=i.SignatureInformation.create(e.label,void 0,...t);return void 0!==e.documentation&&(n.documentation=e.documentation),void 0!==e.activeParameter&&(n.activeParameter=e.activeParameter),n})),u=e=>{var t;return void 0!==e.activeParameter||!p.callHasParameters&&!(null===(t=e.parameters)||void 0===t?void 0:t.length)};let h=d.findIndex(u);-1===h&&(h=null);let m=null!==h?d[h].activeParameter:null;if((null===(n=e.context)||void 0===n?void 0:n.isRetrigger)&&e.context.triggerKind!==i.SignatureHelpTriggerKind.Invoked){const t=null!==(r=null===(s=e.context.activeSignatureHelp)||void 0===s?void 0:s.activeSignature)&&void 0!==r?r:null;if(null!==t&&t{var t,n;return null!==(n=null===(t=e.parameters)||void 0===t?void 0:t.length)&&void 0!==n?n:0})))),{signatures:d,activeSignature:h,activeParameter:m}})),this._connection.onCompletion(((e,t)=>this.onCompletion(e,t))),this._connection.onCompletionResolve((async(e,t)=>{const n=e.data;if(n&&n.filePath){const i=await this.getWorkspaceForFile(n.workspacePath);this.resolveWorkspaceCompletionItem(i,n.filePath,e,t)}return e})),this._connection.onRenameRequest((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return;const r=s.serviceInstance.renameSymbolAtPosition(n,i,e.newName,""===s.rootPath,t);return r?f.convertWorkspaceEdits(this.fs,r):void 0})),this._connection.languages.callHierarchy.onPrepare((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;const r=s.serviceInstance.getCallForPosition(n,i,t)||null;return r?m.isInZipOrEgg(r.uri)?null:(r.uri=y.convertPathToUri(this.fs,r.uri),[r]):null})),this._connection.languages.callHierarchy.onIncomingCalls((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.item.uri),i={line:e.item.range.start.line,character:e.item.range.start.character},s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;let r=s.serviceInstance.getIncomingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r=r.filter((e=>!m.isInZipOrEgg(e.from.uri))),r.forEach((e=>{e.from.uri=y.convertPathToUri(this.fs,e.from.uri)})),r):null})),this._connection.languages.callHierarchy.onOutgoingCalls((async(e,t)=>{const n=y.convertUriToPath(this.fs,e.item.uri),i={line:e.item.range.start.line,character:e.item.range.start.character},s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;let r=s.serviceInstance.getOutgoingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r=r.filter((e=>!m.isInZipOrEgg(e.to.uri))),r.forEach((e=>{e.to.uri=y.convertPathToUri(this.fs,e.to.uri)})),r):null})),this._connection.onDidOpenTextDocument((async e=>{const t=y.convertUriToPath(this.fs,e.textDocument.uri);(await this.getWorkspaceForFile(t)).serviceInstance.setFileOpened(t,e.textDocument.version,e.textDocument.text)})),this._connection.onDidChangeTextDocument((async e=>{this.recordUserInteractionTime();const t=y.convertUriToPath(this.fs,e.textDocument.uri);(await this.getWorkspaceForFile(t)).serviceInstance.updateOpenFileContents(t,e.textDocument.version,e.contentChanges)})),this._connection.onDidCloseTextDocument((async e=>{const t=y.convertUriToPath(this.fs,e.textDocument.uri);(await this.getWorkspaceForFile(t)).serviceInstance.setFileClosed(t)})),this._connection.onDidChangeWatchedFiles((e=>{e.changes.forEach((e=>{const t=y.convertUriToPath(this.fs,e.uri),n=1===e.type?"add":"change";this._fileWatcherProvider.onFileChange(n,t)}))})),this._connection.onInitialized((()=>{this.client.hasWorkspaceFoldersCapability&&this._connection.workspace.onDidChangeWorkspaceFolders((e=>{e.removed.forEach((e=>{const t=y.convertUriToPath(this.fs,e.uri);this._workspaceMap.delete(t)})),e.added.forEach((async e=>{const t=y.convertUriToPath(this.fs,e.uri),n=this.createWorkspaceServiceInstance(e,t);this._workspaceMap.set(t,n),await this.updateSettingsForWorkspace(n)}))})),this.client.hasWatchFileCapability&&this._connection.client.register(i.DidChangeWatchedFilesNotification.type,{watchers:[...a.configFileNames.map((e=>({globPattern:`**/${e}`,kind:i.WatchKind.Create|i.WatchKind.Change|i.WatchKind.Delete}))),{globPattern:"**",kind:i.WatchKind.Create|i.WatchKind.Change|i.WatchKind.Delete}]})})),this._connection.onExecuteCommand((async(e,t,n)=>{this._pendingCommandCancellationSource&&(this._pendingCommandCancellationSource.cancel(),this._pendingCommandCancellationSource=void 0);const s=async t=>{const n=await this.executeCommand(e,t);return i.WorkspaceEdit.is(n)&&await this._connection.workspace.applyEdit(n),o.CommandResult.is(n)&&await this._connection.workspace.applyEdit(n.edits),n};if(!this.isLongRunningCommand(e.command)){return await s(t)}{const i=await this._getProgressReporter(e.workDoneToken,n,I.Localizer.CodeAction.executingCommand()),r=l.CancelAfter(t,i.token);this._pendingCommandCancellationSource=r;try{return await s(r.token)}finally{i.reporter.done(),r.dispose()}}}))}resolveWorkspaceCompletionItem(e,t,n,i){e.serviceInstance.resolveCompletionItem(t,n,this.getCompletionOptions(),void 0,i)}getWorkspaceCompletionsForPosition(e,t,n,i,s){return e.serviceInstance.getCompletionsForPosition(t,n,i,this.getCompletionOptions(),void 0,s)}updateSettingsForAllWorkspaces(){this._workspaceMap.forEach((e=>{this.updateSettingsForWorkspace(e).ignoreErrors()}))}getCompletionOptions(){return{format:this.client.completionDocFormat,snippet:this.client.completionSupportsSnippet,lazyEdit:this.client.completionItemResolveSupportsAdditionalTextEdits}}initialize(e,t,n){var s,r,a,o,l,c,p,d,u,h,m,g,f,T,_,v,b,I,C,S,D,F,A,x,k,P,E,w,N,R,M,O,L;this.rootPath=e.rootPath||"";const U=e.capabilities;this.client.hasConfigurationCapability=!!(null===(s=U.workspace)||void 0===s?void 0:s.configuration),this.client.hasWatchFileCapability=!!(null===(a=null===(r=U.workspace)||void 0===r?void 0:r.didChangeWatchedFiles)||void 0===a?void 0:a.dynamicRegistration),this.client.hasWorkspaceFoldersCapability=!!(null===(o=U.workspace)||void 0===o?void 0:o.workspaceFolders),this.client.hasVisualStudioExtensionsCapability=!!U.supportsVisualStudioExtensions,this.client.hasActiveParameterCapability=!!(null===(p=null===(c=null===(l=U.textDocument)||void 0===l?void 0:l.signatureHelp)||void 0===c?void 0:c.signatureInformation)||void 0===p?void 0:p.activeParameterSupport),this.client.hasSignatureLabelOffsetCapability=!!(null===(m=null===(h=null===(u=null===(d=U.textDocument)||void 0===d?void 0:d.signatureHelp)||void 0===u?void 0:u.signatureInformation)||void 0===h?void 0:h.parameterInformation)||void 0===m?void 0:m.labelOffsetSupport),this.client.hasHierarchicalDocumentSymbolCapability=!!(null===(f=null===(g=U.textDocument)||void 0===g?void 0:g.documentSymbol)||void 0===f?void 0:f.hierarchicalDocumentSymbolSupport),this.client.hoverContentFormat=this._getCompatibleMarkupKind(null===(_=null===(T=U.textDocument)||void 0===T?void 0:T.hover)||void 0===_?void 0:_.contentFormat),this.client.completionDocFormat=this._getCompatibleMarkupKind(null===(I=null===(b=null===(v=U.textDocument)||void 0===v?void 0:v.completion)||void 0===b?void 0:b.completionItem)||void 0===I?void 0:I.documentationFormat),this.client.completionSupportsSnippet=!!(null===(D=null===(S=null===(C=U.textDocument)||void 0===C?void 0:C.completion)||void 0===S?void 0:S.completionItem)||void 0===D?void 0:D.snippetSupport),this.client.signatureDocFormat=this._getCompatibleMarkupKind(null===(x=null===(A=null===(F=U.textDocument)||void 0===F?void 0:F.signatureHelp)||void 0===A?void 0:A.signatureInformation)||void 0===x?void 0:x.documentationFormat);const V=(null===(E=null===(P=null===(k=U.textDocument)||void 0===k?void 0:k.publishDiagnostics)||void 0===P?void 0:P.tagSupport)||void 0===E?void 0:E.valueSet)||[];this.client.supportsUnnecessaryDiagnosticTag=V.some((e=>e===i.DiagnosticTag.Unnecessary)),this.client.hasWindowProgressCapability=!!(null===(w=U.window)||void 0===w?void 0:w.workDoneProgress),this.client.hasGoToDeclarationCapability=!!(null===(N=U.textDocument)||void 0===N?void 0:N.declaration),this.client.completionItemResolveSupportsAdditionalTextEdits=!!(null===(L=null===(O=null===(M=null===(R=U.textDocument)||void 0===R?void 0:R.completion)||void 0===M?void 0:M.completionItem)||void 0===O?void 0:O.resolveSupport)||void 0===L?void 0:L.properties.some((e=>"additionalTextEdits"===e))),e.workspaceFolders?e.workspaceFolders.forEach((e=>{const t=y.convertUriToPath(this.fs,e.uri);this._workspaceMap.set(t,this.createWorkspaceServiceInstance(e,t))})):e.rootPath&&this._workspaceMap.set(e.rootPath,this.createWorkspaceServiceInstance(void 0,e.rootPath));return{capabilities:{textDocumentSync:i.TextDocumentSyncKind.Incremental,definitionProvider:{workDoneProgress:!0},declarationProvider:{workDoneProgress:!0},referencesProvider:{workDoneProgress:!0},documentSymbolProvider:{workDoneProgress:!0},workspaceSymbolProvider:{workDoneProgress:!0},hoverProvider:{workDoneProgress:!0},documentHighlightProvider:{workDoneProgress:!0},renameProvider:{workDoneProgress:!0},completionProvider:{triggerCharacters:this.client.hasVisualStudioExtensionsCapability?[".","[","@"]:[".","["],resolveProvider:!0,workDoneProgress:!0},signatureHelpProvider:{triggerCharacters:["(",",",")"],workDoneProgress:!0},codeActionProvider:{codeActionKinds:n,workDoneProgress:!0},executeCommandProvider:{commands:t,workDoneProgress:!0},callHierarchyProvider:!0}}}createWorkspaceServiceInstance(e,t){var n,i,s;return{workspaceName:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:"",rootPath:t,rootUri:null!==(i=null==e?void 0:e.uri)&&void 0!==i?i:"",serviceInstance:this.createAnalyzerService(null!==(s=null==e?void 0:e.name)&&void 0!==s?s:t),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:h.createDeferred()}}onAnalysisCompletedHandler(e){if(e.diagnostics.forEach((e=>{m.isInZipOrEgg(e.filePath)||this._connection.sendDiagnostics({uri:y.convertPathToUri(this.fs,e.filePath),diagnostics:this._convertDiagnostics(e.diagnostics)})})),this._progressReporter.isEnabled(e))if(e.filesRequiringAnalysis>0){this._progressReporter.begin();const t=1===e.filesRequiringAnalysis?I.Localizer.CodeAction.filesToAnalyzeOne():I.Localizer.CodeAction.filesToAnalyzeCount().format({count:e.filesRequiringAnalysis});this._progressReporter.report(t)}else this._progressReporter.end();else this._progressReporter.end()}async updateSettingsForWorkspace(e,t){var n;t=null!=t?t:await this.getSettings(e),this.console.level=null!==(n=t.logLevel)&&void 0!==n?n:u.LogLevel.Info,this.updateOptionsAndRestartService(e,t),e.disableLanguageServices=!!t.disableLanguageServices,e.disableOrganizeImports=!!t.disableOrganizeImports,e.isInitialized.resolve(!0)}updateOptionsAndRestartService(e,t,n){T.AnalyzerServiceExecutor.runWithOptions(this.rootPath,e,t,n)}async onCompletion(e,t){var n,s;const r=this._lastTriggerKind!==i.CompletionTriggerKind.TriggerForIncompleteCompletions||(null===(n=e.context)||void 0===n?void 0:n.triggerKind)!==i.CompletionTriggerKind.TriggerForIncompleteCompletions;this._lastTriggerKind=null===(s=e.context)||void 0===s?void 0:s.triggerKind;const a=y.convertUriToPath(this.fs,e.textDocument.uri),o={line:e.position.line,character:e.position.character},l=await this.getWorkspaceForFile(a);if(l.disableLanguageServices)return;const c=await this.getWorkspaceCompletionsForPosition(l,a,o,l.rootPath,t);return c&&c.completionList&&(c.completionList.isIncomplete=r),null==c?void 0:c.completionList}convertLogLevel(e){if(!e)return u.LogLevel.Info;switch(e.toLowerCase()){case"error":return u.LogLevel.Error;case"warning":return u.LogLevel.Warn;case"information":return u.LogLevel.Info;case"trace":return u.LogLevel.Log;default:return u.LogLevel.Info}}_getCompatibleMarkupKind(e){const t=[i.MarkupKind.PlainText,i.MarkupKind.Markdown];for(const n of null!=e?e:[])if(t.includes(n))return n;return i.MarkupKind.PlainText}async _getProgressReporter(e,t,n){if(e)return{reporter:t,token:i.CancellationToken.None};const s=await this._connection.window.createWorkDoneProgress();return s.begin(n,void 0,void 0,!0),{reporter:s,token:s.token}}_convertDiagnostics(e){const t=[];return e.forEach((e=>{const n=function(e){switch(e){case 0:return i.DiagnosticSeverity.Error;case 1:return i.DiagnosticSeverity.Warning;case 2:return i.DiagnosticSeverity.Information;case 3:return i.DiagnosticSeverity.Hint}}(e.category),s=e.getRule(),r=i.Diagnostic.create(e.range,e.message,n,s,this._serverOptions.productName);if(3===e.category&&(r.tags=[i.DiagnosticTag.Unnecessary],r.severity=i.DiagnosticSeverity.Hint,!this.client.supportsUnnecessaryDiagnosticTag))return;if(s){const e=this.getDocumentationUrlForDiagnosticRule(s);e&&(r.codeDescription={href:e})}const a=e.getRelatedInfo();a.length>0&&(r.relatedInformation=a.filter((e=>!m.isInZipOrEgg(e.filePath))).map((e=>i.DiagnosticRelatedInformation.create(i.Location.create(y.convertPathToUri(this.fs,e.filePath),e.range),e.message)))),t.push(r)})),t}recordUserInteractionTime(){this._workspaceMap.forEach((e=>{e.serviceInstance.recordUserInteractionTime()}))}getDocumentationUrlForDiagnosticRule(e){return"https://github.com/microsoft/pyright/blob/main/docs/configuration.md"}expandPathVariables(e,t){return t.replace(/\$\{(.*?)\}/g,((t,n)=>{const i=n.trim();return"workspaceFolder"===i?e:"env:HOME"===i&&void 0!==process.env.HOME?process.env.HOME:t}))}}},22060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerServiceExecutor=void 0;const i=n(96453),s=n(96795),r=n(94647);t.AnalyzerServiceExecutor=class{static runWithOptions(e,t,n,a,o=!0){const l=function(e,t,n,a,o){var l,c;const p=new s.CommandLineOptions(t,!0);p.checkOnlyOpenFiles=n.openFilesOnly,p.useLibraryCodeForTypes=n.useLibraryCodeForTypes,p.typeCheckingMode=n.typeCheckingMode,p.autoImportCompletions=n.autoImportCompletions,p.indexing=n.indexing,p.logTypeEvaluationTime=null!==(l=n.logTypeEvaluationTime)&&void 0!==l&&l,p.typeEvaluationTimeThreshold=null!==(c=n.typeEvaluationTimeThreshold)&&void 0!==c?c:50,a?(p.watchForSourceChanges=n.watchForSourceChanges,p.watchForLibraryChanges=n.watchForLibraryChanges,p.watchForConfigChanges=n.watchForConfigChanges):(p.watchForSourceChanges=!1,p.watchForLibraryChanges=!1,p.watchForConfigChanges=!1);n.venvPath&&(p.venvPath=r.combinePaths(t||e,n.venvPath));n.pythonPath&&(i.isPythonBinary(n.pythonPath)||(p.pythonPath=r.combinePaths(t||e,n.pythonPath)));n.typeshedPath&&(p.typeshedPath=n.typeshedPath);n.stubPath&&(p.stubPath=n.stubPath);o&&(p.typeStubTargetImportName=o);return p.autoSearchPaths=n.autoSearchPaths,p.extraPaths=n.extraPaths,p.diagnosticSeverityOverrides=n.diagnosticSeverityOverrides,p}(e,t.rootPath,n,o,a);t.serviceInstance.setOptions(l,o)}}},82615:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertSymbolKindToCompletionItemKind=t.AutoImporter=t.buildModuleSymbolsMap=void 0;const a=n(29335),o=n(45214),l=r(n(91197)),c=n(38213),p=n(94647),d=r(n(14551)),u=n(76962);t.buildModuleSymbolsMap=function(e,t,n){const i=new Map;return c.throwIfCancellationRequested(n),e.forEach((e=>{if(e.shadows.length>0)return;const n=e.sourceFile.getFilePath(),s=e.sourceFile.getModuleSymbolTable();if(s){const e=p.stripFileExtension(p.getFileName(n));if(l.isPrivateOrProtectedName(e))return;return void i.set(n,{forEach(e){s.forEach(((t,n)=>{if(t.isExternallyHidden())return;const i=t.getDeclarations();if(!i||0===i.length)return;const s=i[0];if(!s)return;if(6===s.type)return;const r=1!==s.type||s.isConstant||s.isFinal?void 0:a.SymbolKind.Variable;e({symbol:t,kind:r},n,!1)}))}})}const r=e.sourceFile.getCachedIndexResults();r&&t&&!r.privateOrProtected&&i.set(n,h(r,!1))})),i};function h(e,t){return{forEach(n){e.symbols.forEach((e=>{e.externallyVisible&&n({importAlias:e.alias,kind:e.kind,itemKind:e.itemKind},e.name,t)}))}}}function m(e){switch(e){case a.SymbolKind.File:return a.CompletionItemKind.File;case a.SymbolKind.Module:case a.SymbolKind.Namespace:return a.CompletionItemKind.Module;case a.SymbolKind.Package:return a.CompletionItemKind.Folder;case a.SymbolKind.Class:return a.CompletionItemKind.Class;case a.SymbolKind.Method:return a.CompletionItemKind.Method;case a.SymbolKind.Property:return a.CompletionItemKind.Property;case a.SymbolKind.Field:return a.CompletionItemKind.Field;case a.SymbolKind.Constructor:return a.CompletionItemKind.Constructor;case a.SymbolKind.Enum:return a.CompletionItemKind.Enum;case a.SymbolKind.Interface:return a.CompletionItemKind.Interface;case a.SymbolKind.Function:return a.CompletionItemKind.Function;case a.SymbolKind.Variable:case a.SymbolKind.Array:return a.CompletionItemKind.Variable;case a.SymbolKind.String:return a.CompletionItemKind.Constant;case a.SymbolKind.Number:case a.SymbolKind.Boolean:return a.CompletionItemKind.Value;case a.SymbolKind.Constant:case a.SymbolKind.Null:return a.CompletionItemKind.Constant;case a.SymbolKind.Object:case a.SymbolKind.Key:return a.CompletionItemKind.Value;case a.SymbolKind.EnumMember:return a.CompletionItemKind.EnumMember;case a.SymbolKind.Struct:return a.CompletionItemKind.Struct;case a.SymbolKind.Event:return a.CompletionItemKind.Event;case a.SymbolKind.Operator:return a.CompletionItemKind.Operator;case a.SymbolKind.TypeParameter:return a.CompletionItemKind.TypeParameter;default:return}}t.AutoImporter=class{constructor(e,t,n,i,s,r,a){this._execEnvironment=e,this._importResolver=t,this._parseResults=n,this._invocationPosition=i,this._excludes=s,this._moduleSymbolMap=r,this._options=a,this._stopWatch=new u.Duration,this._perfInfo={indexUsed:!1,totalInMs:0,moduleTimeInMS:0,indexTimeInMS:0,importAliasTimeInMS:0,symbolCount:0,indexCount:0,importAliasCount:0},this._importStatements=o.getTopLevelImports(this._parseResults.parseTree,!0),this._perfInfo.indexUsed=!!this._options.libraryMap}getAutoImportCandidatesForAbbr(e,t,n){const i=this._getCandidates(t.importName,1,e,n).get(t.importName);return i?i.filter((e=>e.source===t.importFrom)):[]}getAutoImportCandidates(e,t,n,i){const s=[];return this._getCandidates(e,t,n,i).forEach((e=>s.push(...e))),s}getPerfInfo(){return this._perfInfo.totalInMs=this._stopWatch.getDurationInMilliseconds(),this._perfInfo}_getCandidates(e,t,n,i){const s=new Map,r=new Map;return this._addImportsFromModuleMap(e,t,n,r,s,i),this._addImportsFromLibraryMap(e,t,n,r,s,i),this._addImportsFromImportAliasMap(r,n,s,i),s}_addImportsFromLibraryMap(e,t,n,i,s,r){var a;const o=this._stopWatch.getDurationInMilliseconds();null===(a=this._options.libraryMap)||void 0===a||a.forEach(((a,o)=>{if(a.privateOrProtected)return;if(this._moduleSymbolMap.has(o))return;const l=this._isStubFileOrHasInit(this._options.libraryMap,o);this._processModuleSymbolTable(h(a,!0),o,e,t,l,n,i,s,r)})),this._perfInfo.indexTimeInMS=this._stopWatch.getDurationInMilliseconds()-o}_addImportsFromModuleMap(e,t,n,i,s,r){const a=this._stopWatch.getDurationInMilliseconds();this._moduleSymbolMap.forEach(((a,o)=>{const l=this._isStubFileOrHasInit(this._moduleSymbolMap,o);this._processModuleSymbolTable(a,o,e,t,l,n,i,s,r)})),this._perfInfo.moduleTimeInMS=this._stopWatch.getDurationInMilliseconds()-a}_isStubFileOrHasInit(e,t){const n=p.getDirectoryPath(t),i=p.combinePaths(n,"__init__.py"),s=i+"i";return{isStub:t.endsWith(".pyi"),hasInit:e.has(i)||e.has(s)}}_processModuleSymbolTable(e,t,n,i,s,r,o,l,p){c.throwIfCancellationRequested(p);const[u,h,y]=this._getImportPartsForSymbols(t);if(!u)return;const g=d.getCharacterCount(u,".");if(e.forEach(((e,a,c)=>{var p;if(this._perfIndexCount(e,c),!this._shouldIncludeVariable(e,a,s.isStub,c))return;if(!this._isSimilar(n,a,i))return;if(this._containsName(a,u,l))return;if(e.importAlias)return void this._addToImportAliasMap(e.importAlias,{importParts:{symbolName:a,importName:a,importFrom:u,filePath:t,dotCount:g,moduleNameAndType:y},importGroup:h,symbol:e.symbol,kind:e.importAlias.kind,itemKind:e.importAlias.itemKind},o);const d=this._getTextEditsForAutoImportByFilePath(u,a,r,a,h,t);this._addResult(l,{name:a,alias:r,symbol:e.symbol,source:u,kind:null!==(p=e.itemKind)&&void 0!==p?p:m(e.kind),insertionText:d.insertionText,edits:d.edits})})),!s.isStub&&!s.hasInit)return;const f=this._getImportParts(t);if(!f)return;if(!this._isSimilar(n,f.importName,i))return;this._containsName(f.importName,f.importFrom,l)||this._addToImportAliasMap({modulePath:t,originalName:f.importName,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},{importParts:f,importGroup:h,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},o)}_shouldIncludeVariable(e,t,n,i){var s;return!(!n&&e.kind===a.SymbolKind.Variable)||(!(!this._options.allowVariableInAll||i||!(null===(s=e.symbol)||void 0===s?void 0:s.isInDunderAll()))||l.isPublicConstantOrTypeAlias(t))}_addImportsFromImportAliasMap(e,t,n,i){c.throwIfCancellationRequested(i);const s=this._stopWatch.getDurationInMilliseconds();e.forEach((e=>{this._perfInfo.importAliasCount+=e.size,e.forEach((e=>{var i,s;if(t){if(this._importStatements.mapByFilePath.has(e.importParts.filePath))return;if(e.importParts.importFrom){const t=this._importStatements.orderedImports.find((t=>t.moduleName===e.importParts.importFrom));if(t&&22===t.node.nodeType&&t.node.imports.some((t=>t.name.value===e.importParts.symbolName)))return}}if(this._containsName(e.importParts.importName,e.importParts.importFrom,n))return;const r=this._getTextEditsForAutoImportByFilePath(null!==(i=e.importParts.importFrom)&&void 0!==i?i:e.importParts.importName,e.importParts.symbolName,t,e.importParts.importName,e.importGroup,e.importParts.filePath);this._addResult(n,{name:e.importParts.importName,alias:t,symbol:e.symbol,kind:null!==(s=e.itemKind)&&void 0!==s?s:m(e.kind),source:e.importParts.importFrom,insertionText:r.insertionText,edits:r.edits})}))})),this._perfInfo.importAliasTimeInMS=this._stopWatch.getDurationInMilliseconds()-s}_addToImportAliasMap(e,t,n){if(!n.has(e.modulePath)){const i=new Map;return i.set(e.originalName,t),void n.set(e.modulePath,i)}const i=n.get(e.modulePath);if(!i.has(e.originalName))return void i.set(e.originalName,t);const s=i.get(e.originalName);this._compareImportAliasData(s,t)<=0||i.set(e.originalName,t)}_compareImportAliasData(e,t){const n=e.importGroup-t.importGroup;if(0!==n)return n;const i=e.importParts.dotCount-t.importParts.dotCount;return 0!==i?i:e.symbol&&!t.symbol?-1:!e.symbol&&t.symbol?1:d.getStringComparer()(e.importParts.importName,t.importParts.importName)}_getImportPartsForSymbols(e){const t=this._importStatements.mapByFilePath.get(e);if(t)return[t.moduleName,o.getImportGroup(t),{importType:2,isLocalTypingsFile:!1,moduleName:t.moduleName}];{const t=this._getModuleNameAndTypeFromFilePath(e);return[t.moduleName,this._getImportGroupFromModuleNameAndType(t),t]}}_getImportParts(e){return t("__init__"===p.stripFileExtension(p.getFileName(e))?this._getModuleNameAndTypeFromFilePath(p.getDirectoryPath(e)):this._getModuleNameAndTypeFromFilePath(e));function t(t){const n=t.moduleName;if(!n)return;const i=n.lastIndexOf("."),s=i>0?n.substring(i+1):void 0,r=i>0?n.substring(0,i):void 0;return{symbolName:s,importName:null!=s?s:n,importFrom:r,filePath:e,dotCount:d.getCharacterCount(n,"."),moduleNameAndType:t}}}_isSimilar(e,t,n){if(1===n)return e===t;if(e.length<=0||t.length<=0)return!1;if(!this._options.patternMatcher){const n="_"!==e[0]&&"_"===t[0]&&t.length>1?1:0;return e[0].toLocaleLowerCase()===t[n].toLocaleLowerCase()&&d.isPatternInSymbol(e,t)}return this._options.patternMatcher(e,t)}_containsName(e,t,n){if(this._excludes.has(e))return!0;const i=n.get(e);return!!(null==i?void 0:i.some((e=>e.source===t)))}_getModuleNameAndTypeFromFilePath(e){return this._importResolver.getModuleNameForImport(e,this._execEnvironment)}_getImportGroupFromModuleNameAndType(e){let t=2;return e.isLocalTypingsFile||1===e.importType?t=1:0===e.importType&&(t=0),t}_getTextEditsForAutoImportByFilePath(e,t,n,i,s,r){var a,l,c,p,d,u;const h=this._importStatements.mapByFilePath.get(r);if(h){if(20===h.node.nodeType){const e=null===(l=null===(a=h.subnode)||void 0===a?void 0:a.alias)||void 0===l?void 0:l.value;if(t)return{insertionText:`${null!=e?e:h.moduleName}.${t}`,edits:[]};if(e)return{insertionText:`${e}`,edits:[]}}if(t&&22===h.node.nodeType){const s=h.node.imports.find((e=>e.name.value===t));if(s){const e=null===(c=s.alias)||void 0===c?void 0:c.value;return{insertionText:`${null!=e?e:t}`,edits:[]}}if(e===h.moduleName)return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:o.getTextEditsForAutoImportSymbolAddition(t,h,this._parseResults,n)}}}else if(t){const s=this._importStatements.orderedImports.find((t=>t.moduleName===e));if(s&&22===s.node.nodeType){const e=s.node.imports.find((e=>e.name.value===t));if(!e)return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:o.getTextEditsForAutoImportSymbolAddition(t,s,this._parseResults,n)};{const t=null===(p=e.alias)||void 0===p?void 0:p.value;if(t)return{insertionText:`${t}`,edits:[]}}}const a=null===(d=this._importStatements.implicitImports)||void 0===d?void 0:d.get(r);if(a){const e=null===(u=a.alias)||void 0===u?void 0:u.value;return{insertionText:`${null!=e?e:a.name.value}.${t}`,edits:[]}}}return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:o.getTextEditsForAutoImportInsertion(t,this._importStatements,e,s,this._parseResults,this._invocationPosition,n)}}_perfIndexCount(e,t){e.symbol?this._perfInfo.symbolCount++:t&&this._perfInfo.indexCount++}_addResult(e,t){let n=e.get(t.name);n||(n=[],e.set(t.name,n)),n.push(t)}},t.convertSymbolKindToCompletionItemKind=m},30424:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CallHierarchyProvider=void 0;const a=n(29335),o=r(n(88023)),l=r(n(23241)),c=n(22339),p=n(59195),d=n(10425),u=n(38213),h=n(94647),m=n(28348),y=n(80957);t.CallHierarchyProvider=class{static getCallForDeclaration(e,t,n,i){if(u.throwIfCancellationRequested(i),3===t.type||4===t.type){return{name:e,kind:T(t,n),uri:t.path,range:t.range,selectionRange:t.range}}}static getIncomingCallsForDeclaration(e,t,n,i,s,r){u.throwIfCancellationRequested(r);const a=new f(e,t,n,i,s,r).findCalls();return a.length>0?a:void 0}static getOutgoingCallsForDeclaration(e,t,n,i){let s;if(u.throwIfCancellationRequested(i),3===e.type)s=e.node;else if(4===e.type){const t=n.getTypeForDeclaration(e);if(t&&p.isInstantiableClass(t)){const e=d.lookUpClassMember(t,"__init__",14);if(e){const t=n.getTypeOfMember(e);if(t&&p.isFunction(t)){const t=e.symbol.getDeclarations();if(t&&t.length>0){const e=t[0];3===e.type&&(s=e.node)}}}}}if(!s)return;const r=new g(s,t,n,i).findCalls();return r.length>0?r:void 0}static getTargetDeclaration(e,t){let n=e[0];for(const i of e)if((o.hasTypeForDeclaration(i)||!o.hasTypeForDeclaration(n))&&(3===i.type||4===i.type)&&(n=i,i.node===t))break;return n}};class g extends c.ParseTreeWalker{constructor(e,t,n,i){super(),this._parseRoot=e,this._parseResults=t,this._evaluator=n,this._cancellationToken=i,this._outgoingCalls=[]}findCalls(){return this.walk(this._parseRoot),this._outgoingCalls}visitCall(e){let t;if(u.throwIfCancellationRequested(this._cancellationToken),38===e.leftExpression.nodeType?t=e.leftExpression:35===e.leftExpression.nodeType&&(t=e.leftExpression.memberName),t){const e=this._evaluator.getDeclarationsForNameNode(t);e&&e.forEach((e=>{this._addOutgoingCallForDeclaration(t,e)}))}return!0}visitMemberAccess(e){u.throwIfCancellationRequested(this._cancellationToken);const t=this._evaluator.getType(e.leftExpression);return t&&d.doForEachSubtype(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!p.isClassInstance(n))return;const i=d.lookUpObjectMember(n,e.memberName.value);if(!i)return;const s=this._evaluator.getTypeOfMember(i),r=i.symbol.getDeclarations();s&&p.isClassInstance(s)&&p.ClassType.isPropertyClass(s)&&r.forEach((t=>{this._addOutgoingCallForDeclaration(e.memberName,t)}))})),!0}_addOutgoingCallForDeclaration(e,t){const n=this._evaluator.resolveAliasDeclaration(t,!0);if(!n)return;if(3!==n.type&&4!==n.type)return;const i={name:e.value,kind:T(n,this._evaluator),uri:n.path,range:n.range,selectionRange:n.range};let s=this._outgoingCalls.find((e=>e.to.uri===i.uri&&y.rangesAreEqual(e.to.range,i.range)));s||(s={to:i,fromRanges:[]},this._outgoingCalls.push(s));const r=m.convertOffsetsToRange(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);s.fromRanges.push(r)}}class f extends c.ParseTreeWalker{constructor(e,t,n,i,s,r){super(),this._filePath=e,this._symbolName=t,this._declaration=n,this._parseResults=i,this._evaluator=s,this._cancellationToken=r,this._incomingCalls=[]}findCalls(){return this.walk(this._parseResults.parseTree),this._incomingCalls}visitCall(e){let t;if(u.throwIfCancellationRequested(this._cancellationToken),38===e.leftExpression.nodeType?t=e.leftExpression:35===e.leftExpression.nodeType&&(t=e.leftExpression.memberName),t&&t.value===this._symbolName){const e=this._evaluator.getDeclarationsForNameNode(t);if(e){e.map((e=>this._evaluator.resolveAliasDeclaration(e,!0))).filter((e=>void 0!==e)).some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(t)}}return!0}visitMemberAccess(e){if(u.throwIfCancellationRequested(this._cancellationToken),e.memberName.value===this._symbolName){const t=this._evaluator.getType(e.leftExpression);t&&d.doForEachSubtype(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!p.isClassInstance(n))return;const i=d.lookUpObjectMember(n,e.memberName.value);if(!i)return;const s=this._evaluator.getTypeOfMember(i),r=i.symbol.getDeclarations();s&&r.some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(e.memberName)}))}return!0}_addIncomingCallForDeclaration(e){const t=l.getExecutionScopeNode(e);if(!t)return;let n;if(36===t.nodeType){const e=m.convertOffsetsToRange(0,0,this._parseResults.tokenizerOutput.lines),t=h.getFileName(this._filePath);n={name:`(module) ${t}`,kind:a.SymbolKind.Module,uri:this._filePath,range:e,selectionRange:e}}else if(30===t.nodeType){const e=m.convertOffsetsToRange(t.start,t.start+t.length,this._parseResults.tokenizerOutput.lines);n={name:"(lambda)",kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}else{const e=m.convertOffsetsToRange(t.name.start,t.name.start+t.name.length,this._parseResults.tokenizerOutput.lines);n={name:t.name.value,kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}let i=this._incomingCalls.find((e=>e.from.uri===n.uri&&y.rangesAreEqual(e.from.range,n.range)));i||(i={from:n,fromRanges:[]},this._incomingCalls.push(i));const s=m.convertOffsetsToRange(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);i.fromRanges.push(s)}}function T(e,t){let n;switch(e.type){case 4:case 5:n=a.SymbolKind.Class;break;case 3:if(e.isMethod){const i=t.getTypeForDeclaration(e);n=i&&d.isProperty(i)?a.SymbolKind.Property:a.SymbolKind.Method}else n=a.SymbolKind.Function;break;default:n=a.SymbolKind.Function}return n}},70926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionProvider=void 0;const i=n(29335),s=n(38213),r=n(74426);t.CodeActionProvider=class{static async getCodeActionsForPosition(e,t,n,a){s.throwIfCancellationRequested(a);const o=[];if(!e.disableLanguageServices){const s=await e.serviceInstance.getDiagnosticsForRange(t,n,a),l=s.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.createtypestub"===e.action))}));if(l){const n=l.getActions().find((e=>"pyright.createtypestub"===e.action));if(n){const s=i.CodeAction.create(r.Localizer.CodeAction.createTypeStubFor().format({moduleName:n.moduleName}),i.Command.create(r.Localizer.CodeAction.createTypeStub(),"pyright.createtypestub",e.rootPath,n.moduleName,t),i.CodeActionKind.QuickFix);o.push(s)}}const c=s.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.addoptionalforparam"===e.action))}));if(c){const e=c.getActions().find((e=>"pyright.addoptionalforparam"===e.action));if(e){const t=i.CodeAction.create(r.Localizer.CodeAction.addOptionalToAnnotation(),i.Command.create(r.Localizer.CodeAction.addOptionalToAnnotation(),"pyright.addoptionalforparam",e.offsetOfTypeNode),i.CodeActionKind.QuickFix);o.push(t)}}}return o}}},80088:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CompletionProvider=t.dictionaryKeyDetail=t.autoImportDetail=void 0;const a=n(29335),o=r(n(35696)),l=n(16800),c=n(88023),p=n(21736),d=r(n(23241)),u=n(23241),h=n(93989),m=r(n(91197)),y=n(15020),g=n(58333),f=n(59195),T=n(10425),_=n(38213),v=r(n(20823)),b=n(20823),I=n(28348),C=r(n(14551)),S=n(80957),D=n(80957),F=n(76962),A=n(55390),x=n(82615),k=n(9272),P=n(31807),E=["True","False","None","and","or","await","not","is","lambda","yield","assert","async","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","match","nonlocal","pass","raise","return","try","while"];var w;!function(e){e[e.LikelyKeyword=0]="LikelyKeyword",e[e.RecentImportModuleName=1]="RecentImportModuleName",e[e.ImportModuleName=2]="ImportModuleName",e[e.LiteralValue=3]="LiteralValue",e[e.NamedParameter=4]="NamedParameter",e[e.RecentKeywordOrSymbol=5]="RecentKeywordOrSymbol",e[e.RecentAutoImport=6]="RecentAutoImport",e[e.Keyword=7]="Keyword",e[e.NormalSymbol=8]="NormalSymbol",e[e.PrivateSymbol=9]="PrivateSymbol",e[e.DunderSymbol=10]="DunderSymbol",e[e.AutoImport=11]="AutoImport"}(w||(w={})),t.autoImportDetail="Auto-import",t.dictionaryKeyDetail="Dictionary key";class N{constructor(e,t,n,i,s,r,a,o,l,c,p,d,u){this._workspacePath=e,this._parseResults=t,this._fileContents=n,this._importResolver=i,this._position=s,this._filePath=r,this._configOptions=a,this._importLookup=o,this._evaluator=l,this._options=c,this._sourceMapper=p,this._autoImportMaps=d,this._cancellationToken=u}getCompletionsForPosition(){var e;const t=I.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines);if(void 0===t)return;let n=d.findNodeByOffset(this._parseResults.parseTree,t);const i=n,s=n?d.getNodeDepth(n):0;if(!i||38!==i.nodeType){let r=t,a=!1;for(;r>=0;){r--;const t=this._fileContents.substr(r,1);if("("===t||"\n"===t||"}"===t)break;","===t&&(a=!0);const o=d.findNodeByOffset(this._parseResults.parseTree,r);if(o&&o!==i){d.getNodeDepth(o)>s&&(n=o,a&&23===(null===(e=n.parent)||void 0===e?void 0:e.nodeType)&&(n=n.parent));break}}}if(void 0===n)return;const r=this._parseResults.tokenizerOutput.lines.getItemAt(this._position.line),a=this._fileContents.substr(r.start,r.length),o=a.substr(0,this._position.character),l=a.substr(this._position.character),c=o.search(/\w+$/),p=c>=0?o.substr(c):"";if(this._isWithinComment(t))return;let u=n;for(;u&&0!==u.nodeType;)u=u.parent;let h=u||n;for(;;){if(_.throwIfCancellationRequested(this._cancellationToken),49===h.nodeType)return this._getLiteralCompletions(h,p,o,l);if(48===h.nodeType||27===h.nodeType)return;if(37===h.nodeType)return this._getImportModuleCompletions(h);if(0===h.nodeType)return this._getExpressionErrorCompletions(h,p,o,l);if(35===h.nodeType)return this._getMemberAccessCompletions(h.leftExpression,p);if(38===h.nodeType){const e=this._tryGetNameCompletions(h,t,p);if(e||void 0===e)return e}if(22===h.nodeType)return this._getImportFromCompletions(h,p);if(A.isExpressionNode(h))return this._getExpressionCompletions(h,p,o,l);if(50===h.nodeType){if(h.parent&&25===h.parent.nodeType&&!h.parent.name&&h.parent.typeExpression&&D.TextRange.getEnd(h.parent.typeExpression)e.label===n&&e.autoImportText===i));if(s>0&&(N._mostRecentCompletions=N._mostRecentCompletions.splice(s,1)),0!==s&&N._mostRecentCompletions.unshift({label:n,autoImportText:i}),N._mostRecentCompletions.length>128&&N._mostRecentCompletions.pop(),t.symbolLabel)if(this._itemToResolve=e,t.autoImportText){if(!e.additionalTextEdits){const e={completionList:a.CompletionList.create()};this._addAutoImportCompletions(t.symbolLabel,1,!1,e)}}else this.getCompletionsForPosition()}_tryGetNameCompletions(e,t,n){var i;if(!e.parent)return!1;if(21!==e.parent.nodeType||e.parent.alias!==e){if(37===e.parent.nodeType){if(e.parent.parent&&21===e.parent.parent.nodeType&&!e.parent.parent.alias&&D.TextRange.getEnd(e.parent.parent)this._isOverload(e))))?this._getMethodOverloadsCompletions(n,e):void 0;if(!(41===e.parent.nodeType&&e===e.parent.name||10===e.parent.nodeType&&e===e.parent.name||26===e.parent.nodeType&&D.TextRange.contains(e.parent.targetExpression,e.start)||33===e.parent.nodeType&&D.TextRange.contains(e.parent.targetExpression,e.start)))return!1}}}_isWithinComment(e){var t,n;const i=function(e,t){const n=t.getItemAtPosition(e);if(n<0)return;let i=t.getItemAt(n);if(e>i.start&&e=0;e--){const n=t.getItemAt(e);if(i.start!==n.start)break;i=n}if(e<=i.start)return i;return v.assert(n+1D.TextRange.overlaps(t,e))))&&void 0!==n&&n)}_getExpressionErrorCompletions(e,t,n,i){var s;switch(e.category){case 0:return this._createSingleKeywordCompletionList("in");case 1:return this._createSingleKeywordCompletionList("else");case 2:case 4:return this._getExpressionCompletions(e,t,n,i);case 3:{let s=this._getLiteralCompletions(e,t,n,i);return s&&s.completionList||(s=this._getExpressionCompletions(e,t,n,i)),s}case 7:if(e.child&&A.isExpressionNode(e.child))return this._getMemberAccessCompletions(e.child,t);break;case 10:if(e.child&&38===e.child.nodeType)return(null===(s=e.decorators)||void 0===s?void 0:s.some((e=>this._isOverload(e))))?this._getMethodOverloadsCompletions(t,e.child):this._getMethodOverrideCompletions(t,e.child,e.decorators)}}_isOverload(e){return this._checkDecorator(e,"overload")}_checkDecorator(e,t){return 38===e.expression.nodeType&&e.expression.value===t}_createSingleKeywordCompletionList(e){const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,t.sortText=this._makeSortText(w.LikelyKeyword,e);return{completionList:a.CompletionList.create([t])}}_getMethodOverloadsCompletions(e,t){var n;const i=function(e,t){const n=d.getEnclosingClass(t,!1);if(n){const t=e.getTypeOfClass(n);if(!t)return;const i=new Map;for(const e of t.classType.details.mro)f.isInstantiableClass(e)&&T.getMembersForClass(e,i,!1);return i}const i=d.getEnclosingModule(t);if(i){const e=o.getScope(i);return null==e?void 0:e.symbolTable}return}(this._evaluator,t);if(!i)return;const s=28===(null===(n=t.parent)||void 0===n?void 0:n.nodeType)||void 0,r=a.CompletionList.create(),l=d.getEnclosingFunction(t);return i.forEach(((n,i)=>{const a=y.getLastTypedDeclaredForSymbol(n);if(!a||3!==a.type)return;if(!a.node.decorators.some((e=>this._isOverload(e))))return;const o=n.getDeclarations();if((1!==o.length||!o.some((e=>e.node===l)))&&C.isPatternInSymbol(t.value,i)){const o=this._createReplaceEdits(e,t,a.node.name.value);this._addSymbol(i,n,t.value,r,{funcParensDisabled:s,edits:{textEdit:o}})}})),{completionList:r}}_getMethodOverrideCompletions(e,t,n){var i,s;const r=d.getEnclosingClass(t,!0);if(!r)return;const o=this._evaluator.getTypeOfClass(r);if(!o)return;const l=new Map;for(let e=1;ethis._checkDecorator(e,"staticmethod"))))&&void 0!==i&&i,p=null!==(s=null==n?void 0:n.some((e=>this._checkDecorator(e,"classmethod"))))&&void 0!==s&&s,u=a.CompletionList.create();return l.forEach(((n,i)=>{let s=y.getLastTypedDeclaredForSymbol(n);if(s&&3===s.type&&C.isPatternInSymbol(t.value,i)){const r=this._evaluator.getTypeForDeclaration(s);if(!r)return;let l=f.isClassInstance(r)&&f.ClassType.isPropertyClass(r);if(m.isDunderName(i)&&(l=!1),!f.isFunction(r)&&!l)return;if(l){const e=n.getTypedDeclarations();e.length>0&&3===e[0].type&&(s=e[0])}const d=f.isFunction(r)&&f.FunctionType.isStaticMethod(r),y=f.isFunction(r)&&f.FunctionType.isClassMethod(r)&&"__init_subclass__"!==i;if(c!==d||p!==y)return;const g=this._printMethodSignature(s.node);let T;if(h.isStubFile(this._filePath))T=`${g}: ...`;else{T=`${g}:\n${this._printOverriddenMethodBody(o.classType,d,l,s)}`}const _=this._createReplaceEdits(e,t,T);this._addSymbol(i,n,t.value,u,{funcParensDisabled:!0,edits:{format:this._options.snippet?a.InsertTextFormat.Snippet:void 0,textEdit:_}})}})),{completionList:u}}_createReplaceEdits(e,t,n){const i=38===(null==t?void 0:t.nodeType)?this._position.character-e.length+t.value.length:this._position.character,s={start:{line:this._position.line,character:this._position.character-e.length},end:{line:this._position.line,character:i}};return a.TextEdit.replace(s,n)}_printMethodSignature(e){const t=e.parameters.map(((t,n)=>{let i="";1===t.category?i+="*":2===t.category&&(i+="**"),t.name&&(i+=t.name.value);const s=this._evaluator.getTypeAnnotationForParameter(e,n);return s&&(i+=": "+d.printExpression(s)),i||t.name||0!==t.category?i:"/"})).join(", ");let n=e.name.value+"("+t+")";return e.returnTypeAnnotation?n+=" -> "+d.printExpression(e.returnTypeAnnotation):e.functionAnnotationComment&&(n+=" -> "+d.printExpression(e.functionAnnotationComment.returnTypeAnnotation)),n}_printOverriddenMethodBody(e,t,n,i){let s=" ";if(1===e.details.baseClasses.length&&f.isClass(e.details.baseClasses[0])&&"builtins.object"===e.details.baseClasses[0].details.fullName)return s+=this._options.snippet?"${0:pass}":"pass",s;if(0===i.node.parameters.length)return s+=this._options.snippet?"${0:pass}":"pass",s;const r=function(){if(t)return i.node.parameters.filter((e=>e.name));return i.node.parameters.slice(1).filter((e=>e.name))}();return"__init__"!==i.node.name.value&&(s+="return "),i.node.isAsync&&(s+="await "),n?s+`super().${i.node.name.value}`:s+`super().${i.node.name.value}(${r.map((function(e){var t;const n=null===(t=e.name)||void 0===t?void 0:t.value;if(1===e.category)return`*${n}`;if(2===e.category)return`**${n}`;return e.defaultValue?`${n}=${n}`:n})).join(", ")})`}_getMemberAccessCompletions(e,t){const n=new Map,i=a.CompletionList.create();let s={},r=this._evaluator.getType(e);return r&&(r=this._evaluator.makeTopLevelTypeVarsConcrete(r),T.doForEachSubtype(r,(s=>{if(s=this._evaluator.makeTopLevelTypeVarsConcrete(s),f.isClass(s))T.getMembersForClass(s,n,f.TypeBase.isInstance(s));else if(f.isModule(s))T.getMembersForModule(s,n);else if(f.isFunction(s)||f.isOverloadedFunction(s)){const t=this._evaluator.getBuiltInType(e,"function");t&&f.isInstantiableClass(t)&&T.getMembersForClass(t,n,!0)}else if(f.isNone(s)){const t=this._evaluator.getBuiltInType(e,"object");t&&f.isInstantiableClass(t)&&T.getMembersForClass(t,n,f.TypeBase.isInstance(s))}const r=f.isClassInstance(s)?s:void 0;this._addSymbolsForSymbolTable(n,(e=>!0),t,!1,r,i)}))),(!r||f.isUnknown(r)||f.isUnbound(r))&&(s=this._getLastKnownModule(e,r)),{completionList:i,memberAccessInfo:s}}_getLastKnownModule(e,t){var n;let i=e,s=t,r=35===e.nodeType?null==e?void 0:e.memberName.value:void 0;for(;i&&(9===i.nodeType||35===i.nodeType?(i=i.leftExpression,void 0===r&&(r=35===i.nodeType&&null!==(n=null==i?void 0:i.memberName.value)&&void 0!==n?n:"")):i=void 0,!i||(s=this._evaluator.getType(i),void 0===s||f.isUnknown(s)||f.isUnbound(s))););const a={};if(s&&!f.isUnknown(s)&&!f.isUnbound(s)&&i){const e=T.getDeclaringModulesForType(s);a.lastKnownModule=e.find((e=>"typing"!==e)),35===i.nodeType?a.lastKnownMemberName=i.memberName.value:(38===i.nodeType&&f.isInstantiableClass(s)||38===i.nodeType&&f.isClassInstance(s))&&(a.lastKnownMemberName=s.details.name),a.unknownMemberName=r}return a}_getStatementCompletions(e,t,n,i){return this._getExpressionCompletions(e,t,n,i)}_getExpressionCompletions(e,n,i,s){var r,o,l;const c=this._isIndexArgument(e);if(!c&&40===e.nodeType)return;if(59===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&e.parent===(null===(o=e.parent.target)||void 0===o?void 0:o.parent))return;const p=a.CompletionList.create(),d={completionList:p};if(".."===i.slice(-2))return d;if(this._addCallArgumentCompletions(e,n,i,s,p),this._addSymbols(e,n,p),this._findMatchingKeywords(E,n).map((e=>{const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,p.items.push(t),t.sortText=this._makeSortText(w.Keyword,e)})),!this._configOptions.autoImportCompletions||n.startsWith("_")||this._itemToResolve||this._addAutoImportCompletions(n,.25,this._options.lazyEdit,d),0===e.nodeType)if(3===e.category&&24===(null===(l=e.parent)||void 0===l?void 0:l.nodeType))this._tryAddTypedDictStringLiteral(e.parent,void 0,void 0,p);else if(2===e.category&&e.parent&&3===e.parent.nodeType){const t=this._evaluator.getDeclaredTypeForExpression(e.parent.leftExpression);t&&this._addLiteralValuesForTargetType(t,i,s,p)}if(c){const i=e.parent.parent,s=new Set(p.items.map((e=>e.label)));this._getDictionaryKeys(i,e).forEach((e=>{s.has(e)||this._addNameToCompletionList(e,a.CompletionItemKind.Constant,n,p,{sortText:this._makeSortText(w.LiteralValue,e),itemDetail:t.dictionaryKeyDetail})}))}return d}_isIndexArgument(e){const t=e.parent;return t&&1===t.nodeType&&0===t.argumentCategory&&t.parent&&24===t.parent.nodeType&&t.parent.baseExpression&&38===t.parent.baseExpression.nodeType}_addCallArgumentCompletions(e,t,n,i,s){const r=I.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines),a=u.getCallNodeAndActiveParameterIndex(e,r,this._parseResults.tokenizerOutput.tokens);if(!a)return;const o=this._evaluator.getCallSignatureInfo(a.callNode,a.activeIndex,a.activeOrFake);if(o){const e=I.convertOffsetToPosition(o.callNode.leftExpression.start+o.callNode.leftExpression.length,this._parseResults.tokenizerOutput.lines);S.comparePositions(this._position,e)>0&&(this._addNamedParameters(o,t,s),this._addLiteralValuesForArgument(o,n,i,s))}}_addLiteralValuesForArgument(e,t,n,i){e.signatures.forEach((e=>{if(!e.activeParam)return;const s=e.type,r=s.details.parameters.indexOf(e.activeParam);if(r<0)return;const a=s.details.parameters[r].type;this._addLiteralValuesForTargetType(a,t,n,i)}))}_addLiteralValuesForTargetType(e,t,n,i){const s=this._getQuoteValueFromPriorText(t);T.doForEachSubtype(e,(e=>{f.isClassInstance(e)&&f.ClassType.isBuiltIn(e,"str")&&void 0!==e.literalValue&&this._addStringLiteralToCompletionList(e.literalValue,s.stringValue,n,s.quoteCharacter,i)}))}_getDictionaryKeys(e,t){var n,i,s,r,a,o,l,c,p;if(38!==e.baseExpression.nodeType)return[];const u=this._evaluator.getType(e.baseExpression);if(!u||!f.isClassInstance(u))return[];if(!f.ClassType.isBuiltIn(u,"dict"))return[];const h=null!==(n=this._evaluator.getDeclarationsForNameNode(e.baseExpression))&&void 0!==n?n:[],m=h.length>0?h[0]:void 0;if(!m||1!==m.type&&2!==m.type)return[];if(m.path!==this._filePath)return[];let y=e.baseExpression;if(m.node){const e=d.getEvaluationScopeNode(m.node);(null===(i=d.getFileInfoFromNode(y))||void 0===i?void 0:i.filePath)===(null===(s=d.getFileInfoFromNode(e))||void 0===s?void 0:s.filePath)&&(y=e)}const g=[];new k.DocumentSymbolCollector(e.baseExpression,this._evaluator,g,this._cancellationToken,y).collect();const T=new Set;for(const e of g){const n=54===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)?e.parent:e;if(3===(null===(a=n.parent)||void 0===a?void 0:a.nodeType)||4===(null===(o=n.parent)||void 0===o?void 0:o.nodeType)){if(15===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression;for(const t of e.entries.filter((e=>17===e.nodeType))){const e=this._parseResults.text.substr(t.keyExpression.start,t.keyExpression.length).trim();e.length>0&&T.add(e)}}if(9===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression,t=this._evaluator.getType(e.leftExpression);if(!t||!f.isInstantiableClass(t)||!f.ClassType.isBuiltIn(t,"dict"))continue;for(const t of e.arguments){const e=null!==(c=null===(l=t.name)||void 0===l?void 0:l.value.trim())&&void 0!==c?c:"",n=this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter;e.length>0&&T.add(`${n}${e}${n}`)}}}if(24===(null===(p=n.parent)||void 0===p?void 0:p.nodeType)&&1===n.parent.items.length&&0!==n.parent.items[0].valueExpression.nodeType&&!D.TextRange.containsRange(n.parent,t)){const e=n.parent.items[0],t=this._parseResults.text.substr(e.valueExpression.start,e.valueExpression.length).trim();t.length>0&&T.add(t)}}return[...T]}_getLiteralCompletions(e,n,i,s){var r;let o=e.parent;if(!o)return;if(1!==o.nodeType){if(48!==o.nodeType||o.strings.length>1)return;if(o=o.parent,!o)return}const l=a.CompletionList.create();if(1===o.nodeType&&24===(null===(r=o.parent)||void 0===r?void 0:r.nodeType)){if(!this._tryAddTypedDictStringLiteral(o.parent,49===e.nodeType?i:"",s,l)){const r=this._getDictionaryKeys(o.parent,e),c=this._getQuoteValueFromPriorText(i);for(const i of r){const r=/^["|'].*["|']$/.test(i);if(49!==e.nodeType||r)if(r){const e=i.substr(1,i.length-2);this._addStringLiteralToCompletionList(e,c.stringValue,s,c.quoteCharacter,l,t.dictionaryKeyDetail)}else this._addNameToCompletionList(i,a.CompletionItemKind.Constant,n,l,{sortText:this._makeSortText(w.LiteralValue,i),itemDetail:t.dictionaryKeyDetail})}if(0===l.items.length)return}}else if(3===o.nodeType){const e=this._evaluator.getDeclaredTypeForExpression(o.leftExpression);e&&this._addLiteralValuesForTargetType(e,i,s,l)}else{v.assert(49===e.nodeType);const t=I.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines);(t<=o.start||D.TextRange.getEnd(e)<=t)&&this._addCallArgumentCompletions(e,n,i,s,l)}return{completionList:l}}_getQuoteValueFromPriorText(e){const t=e.lastIndexOf("'"),n=e.lastIndexOf('"');let i,s=this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter;return t>n?(s="'",i=e.substr(t+1)):n>t&&(s='"',i=e.substr(n+1)),{stringValue:i,quoteCharacter:s}}_tryAddTypedDictStringLiteral(e,t,n,i){if(!e)return!1;const s=this._evaluator.getType(e.baseExpression);if(!s||!f.isClassInstance(s))return!1;if(!f.ClassType.isTypedDictClass(s))return!1;const r=this._evaluator.getTypedDictMembersForClass(s,!0),a=t?this._getQuoteValueFromPriorText(t):void 0;return r.forEach(((e,t)=>{this._addStringLiteralToCompletionList(t,a?a.stringValue:void 0,n,a?a.quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,i)})),!0}_addStringLiteralToCompletionList(e,t,n,i,s,r){if(C.isPatternInSymbol(t||"",e)){const o=`${i}${e}${i}`,l=a.CompletionItem.create(o);l.kind=a.CompletionItemKind.Constant,l.sortText=this._makeSortText(w.LiteralValue,o);let c=this._position.character;void 0!==t&&(c-=t.length+1);let p=this._position.character;void 0!==n&&n.startsWith(i)&&p++;const d={start:{line:this._position.line,character:c},end:{line:this._position.line,character:p}};l.textEdit=a.TextEdit.replace(d,o),l.detail=r,s.items.push(l)}}_addAutoImportCompletions(e,t,n,i){var s,r,o;if(!this._autoImportMaps)return;const l=i.completionList;if(!l)return;const c=this._autoImportMaps.getModuleSymbolsMap(),p=new Set(l.items.filter((e=>{var t;return!(null===(t=e.data)||void 0===t?void 0:t.autoImport)})).map((e=>e.label))),d=new x.AutoImporter(this._configOptions.findExecEnvironment(this._filePath),this._importResolver,this._parseResults,this._position,p,c,{libraryMap:this._autoImportMaps.libraryMap,lazyEdit:n}),u=[],h=null===(s=this._autoImportMaps.nameMap)||void 0===s?void 0:s.get(e);h&&e.length>1&&!p.has(e)&&u.push(...d.getAutoImportCandidatesForAbbr(e,h,this._cancellationToken)),u.push(...d.getAutoImportCandidates(e,t,void 0,this._cancellationToken));const m=d.getPerfInfo(),y=new F.Duration;for(const t of u)t.symbol?this._addSymbol(t.name,t.symbol,e,l,{autoImportSource:t.source,autoImportAlias:t.alias,edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}}):this._addNameToCompletionList(null!==(r=t.alias)&&void 0!==r?r:t.name,null!==(o=t.kind)&&void 0!==o?o:a.CompletionItemKind.Module,e,l,{autoImportText:this._getAutoImportText(t.name,t.source,t.alias),edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}});i.autoImportInfo={indexUsed:m.indexUsed,totalTimeInMS:m.totalInMs,moduleTimeInMS:m.moduleTimeInMS,indexTimeInMS:m.indexTimeInMS,importAliasTimeInMS:m.importAliasTimeInMS,itemCount:u.length,symbolCount:m.symbolCount,indexCount:m.indexCount,importAliasCount:m.importAliasCount,additionTimeInMS:y.getDurationInMilliseconds()}}_getImportFromCompletions(e,t){if(e.isWildcardImport)return;const n=o.getImportInfo(e.module);if(!n)return;const i=a.CompletionList.create(),s=n.resolvedPaths.length>0?n.resolvedPaths[n.resolvedPaths.length-1]:"",r=this._importLookup(s);return r&&this._addSymbolsForSymbolTable(r.symbolTable,(t=>!e.imports.find((e=>e.name.value===t))),t,!0,void 0,i),n.implicitImports.forEach((n=>{e.imports.find((e=>e.name.value===n.name))||this._addNameToCompletionList(n.name,a.CompletionItemKind.Module,t,i)})),{completionList:i}}_findMatchingKeywords(e,t){return e.filter((e=>!t||C.isPatternInSymbol(t,e)))}_addNamedParameters(e,t,n){const i=new Map;e.signatures.forEach((e=>{this._addNamedParametersToMap(e.type,i)})),e.callNode.arguments.forEach((e=>{e.name&&i.delete(e.name.value)})),i.forEach((e=>{if(C.isPatternInSymbol(t,e)){const t=a.CompletionItem.create(e+"=");t.kind=a.CompletionItemKind.Variable;const i={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};t.data=i,t.sortText=this._makeSortText(w.NamedParameter,e),n.items.push(t)}}))}_addNamedParametersToMap(e,t){e.details.parameters.forEach((e=>{e.name&&!e.isNameSynthesized&&(m.isPrivateOrProtectedName(e.name)||t.set(e.name,e.name))}))}_addSymbols(e,t,n){let i=e;for(;i;){let e=o.getScope(i);if(e){for(;e;)this._addSymbolsForSymbolTable(e.symbolTable,(()=>!0),t,!1,void 0,n),e=e.parent;if(10===i.nodeType){const e=this._evaluator.getTypeOfClass(i);e&&f.isInstantiableClass(e.classType)&&e.classType.details.mro.forEach(((e,i)=>{f.isInstantiableClass(e)&&this._addSymbolsForSymbolTable(e.details.fields,(t=>{const n=e.details.fields.get(t);return!(!n||!n.isClassMember())&&n.getDeclarations().some((e=>1===e.type))}),t,!1,void 0,n)}))}break}i=i.parent}}_addSymbolsForSymbolTable(e,t,n,i,s,r){e.forEach(((e,a)=>{!(e.isExternallyHidden()&&!e.getDeclarations().some((e=>c.isDefinedInFile(e,this._filePath))))&&t(a)&&(r.items.some((e=>e.label===a))||this._addSymbol(a,e,n,r,{boundObject:s,funcParensDisabled:i}))}))}_addSymbol(e,t,n,i,s){var r;let o=y.getLastTypedDeclaredForSymbol(t);if(!o){const e=t.getDeclarations();e.length>0&&(o=e[e.length-1])}if(o){let c=a.CompletionItemKind.Variable;if(o=this._evaluator.resolveAliasDeclaration(o,!0),o&&(c=this._convertDeclarationTypeToItemKind(o),this._itemToResolve)){const n=this._itemToResolve.data;if(n.symbolLabel===e&&!n.autoImportText){const n=this._evaluator.getEffectiveTypeOfSymbol(t);if(n){let i,r;switch(o.type){case 0:case 1:case 2:{let s=!1;if(n&&f.TypeBase.isInstantiable(n)){const t=f.getTypeAliasInfo(n);t&&t.name===e&&(s=!0)}i=e+": "+this._evaluator.printType(n,s);const a=t.getDeclarations().find((e=>1===e.type&&!!e.docString));1===(null==a?void 0:a.type)&&(r=a.docString);break}case 3:{const t=s.boundObject&&(f.isFunction(n)||f.isOverloadedFunction(n))?this._evaluator.bindFunctionToClassOrObject(s.boundObject,n):n;if(t)if(T.isProperty(t)&&s.boundObject){const n=this._evaluator.getGetterTypeFromProperty(t,!0)||f.UnknownType.create();i=e+": "+this._evaluator.printType(n,!1)+" (property)"}else i=f.isOverloadedFunction(t)?P.getOverloadedFunctionTooltip(t,this._evaluator,35):e+": "+this._evaluator.printType(t,!1);break}case 4:case 5:i="class "+e+"()";break;case 6:if(i=e,o.path){const e=this._importLookup(o.path);e&&(r=e.docString)}break;default:i=e}if(f.isModule(n))r=g.getModuleDocString(n,o,this._sourceMapper);else if(f.isInstantiableClass(n))r=g.getClassDocString(n,o,this._sourceMapper);else if(f.isFunction(n))r=P.getFunctionDocStringFromType(n,this._sourceMapper,this._evaluator);else if(f.isOverloadedFunction(n)){const e=l.isFunctionDeclaration(o)?d.getEnclosingClass(o.node.name,!1):void 0,t=e?this._evaluator.getTypeOfClass(e):void 0;r=g.getOverloadedFunctionDocStringsInherited(n,o,this._sourceMapper,this._evaluator,null==t?void 0:t.classType).find((e=>e))}else if(3===(null==o?void 0:o.type))r=g.getPropertyDocStringInherited(o,this._sourceMapper,this._evaluator);else if(1===(null==o?void 0:o.type)){const e=t.getDeclarations().find((e=>1===e.type&&!!e.docString));r=1===(null==e?void 0:e.type)?e.docString:g.getVariableInStubFileDocStrings(o,this._sourceMapper).find((e=>e))}if(this._options.format===a.MarkupKind.Markdown){let e="```python\n"+i+"\n```\n";r&&(e+="---\n",e+=p.convertDocStringToMarkdown(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.Markdown,value:e}}else if(this._options.format===a.MarkupKind.PlainText){let e=i+"\n";r&&(e+="\n",e+=p.convertDocStringToPlainText(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.PlainText,value:e}}else b.fail(`Unsupported markup type: ${this._options.format}`)}}}const u=s.autoImportSource?this._getAutoImportText(e,s.autoImportSource,s.autoImportAlias):void 0;this._addNameToCompletionList(null!==(r=s.autoImportAlias)&&void 0!==r?r:e,c,n,i,{autoImportText:u,funcParensDisabled:s.funcParensDisabled,edits:s.edits})}else{if(t.getSynthesizedType()){const t=a.CompletionItemKind.Variable;this._addNameToCompletionList(e,t,n,i,{funcParensDisabled:s.funcParensDisabled,edits:s.edits})}}}_getAutoImportText(e,t,n){const i=P.getAutoImportText(e,t,n);return this._options.format===a.MarkupKind.Markdown?`\`\`\`\n${i}\n\`\`\``:this._options.format===a.MarkupKind.PlainText?i:void b.fail(`Unsupported markup type: ${this._options.format}`)}_addNameToCompletionList(e,n,i,s,r){var o,l,c;if(!(!!(null==r?void 0:r.autoImportText)||C.isPatternInSymbol(i,e)))return;const d=a.CompletionItem.create(e);d.kind=n;const u={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};if((null==r?void 0:r.funcParensDisabled)&&(u.funcParensDisabled=!0),d.data=u,(null==r?void 0:r.sortText)||(null==r?void 0:r.itemDetail)?(d.sortText=r.sortText,d.detail=r.itemDetail):(null==r?void 0:r.autoImportText)?(d.sortText=this._makeSortText(w.AutoImport,e,r.autoImportText),u.autoImportText=r.autoImportText,d.detail=t.autoImportDetail):m.isDunderName(e)?d.sortText=this._makeSortText(w.DunderSymbol,e):""===i&&m.isPrivateOrProtectedName(e)?d.sortText=this._makeSortText(w.PrivateSymbol,e):d.sortText=this._makeSortText(w.NormalSymbol,e),u.symbolLabel=e,this._options.format===a.MarkupKind.Markdown){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+="```python\n"+r.typeDetail+"\n```\n"),(null==r?void 0:r.documentation)&&(e+="---\n",e+=p.convertDocStringToMarkdown(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.Markdown,value:e})}else if(this._options.format===a.MarkupKind.PlainText){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+=r.typeDetail+"\n"),(null==r?void 0:r.documentation)&&(e+="\n"+p.convertDocStringToPlainText(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.PlainText,value:e})}else b.fail(`Unsupported markup type: ${this._options.format}`);if((null===(o=null==r?void 0:r.edits)||void 0===o?void 0:o.format)&&(d.insertTextFormat=r.edits.format),(null===(l=null==r?void 0:r.edits)||void 0===l?void 0:l.textEdit)&&(d.textEdit=r.edits.textEdit),(null===(c=null==r?void 0:r.edits)||void 0===c?void 0:c.additionalTextEdits)&&(d.additionalTextEdits=r.edits.additionalTextEdits.map((e=>({range:{start:{line:e.range.start.line,character:e.range.start.character},end:{line:e.range.end.line,character:e.range.end.character}},newText:e.replacementText}))),this._itemToResolve)){this._itemToResolve.data.autoImportText===u.autoImportText&&(this._itemToResolve.additionalTextEdits=d.additionalTextEdits)}s.items.push(d)}_getRecentListIndex(e,t){return N._mostRecentCompletions.findIndex((n=>n.label===e&&n.autoImportText===t))}_makeSortText(e,t,n=""){const i=this._getRecentListIndex(t,n);return i>=0&&(e===w.AutoImport?e=w.RecentAutoImport:e===w.ImportModuleName?e=w.RecentImportModuleName:e!==w.Keyword&&e!==w.NormalSymbol&&e!==w.PrivateSymbol&&e!==w.DunderSymbol||(e=w.RecentKeywordOrSymbol)),this._formatInteger(e,2)+"."+this._formatInteger(i,4)+"."+t}_formatInteger(e,t){const n="0".charCodeAt(0);let i="";for(let s=0;se.value)),importedSymbols:[]},i=this._importResolver.getCompletionSuggestions(this._filePath,t,n,.25),s=a.CompletionList.create();if(!e.hasTrailingDot&&e.parent&&22===e.parent.nodeType&&e.parent.missingImportKeyword){const e="import",t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,s.items.push(t),t.sortText=this._makeSortText(w.Keyword,e)}return i.forEach((e=>{const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Module,s.items.push(t),t.sortText=this._makeSortText(w.ImportModuleName,e)})),{completionList:s}}_isPossiblePropertyDeclaration(e){return e.isMethod&&e.node.decorators.length>0}}t.CompletionProvider=N,N._mostRecentCompletions=[]},27888:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionProvider=t.DefinitionFilter=void 0;const a=n(35696),o=n(16800),l=r(n(23241)),c=n(93989),p=n(59195),d=n(38213),u=n(98173),h=n(28348),m=n(80957);var y;!function(e){e.All="all",e.PreferSource="preferSource",e.PreferStubs="preferStubs"}(y=t.DefinitionFilter||(t.DefinitionFilter={}));t.DefinitionProvider=class{static getDefinitionsForPosition(e,t,n,i,s,r){d.throwIfCancellationRequested(r);const m=h.convertPositionToOffset(n,t.tokenizerOutput.lines);if(void 0===m)return;const g=l.findNodeByOffset(t.parseTree,m);if(void 0===g)return;const f=[];if(38===g.nodeType){const t=s.getDeclarationsForNameNode(g);t&&t.forEach((t=>{let n=s.resolveAliasDeclaration(t,!0);if(n&&n.path){if(6===n.type&&n.isUnresolved)return;if(6===n.type&&n.symbolName&&n.submoduleFallback&&n.submoduleFallback.path&&(n=n.submoduleFallback),this._addIfUnique(f,{path:n.path,range:n.range}),o.isFunctionDeclaration(n)){const e=s.getTypeForDeclaration(n);if(e&&p.isOverloadedFunction(e))for(const t of e.overloads.map((e=>e.details.declaration)).filter(u.isDefined))this._addIfUnique(f,{path:t.path,range:t.range})}if(c.isStubFile(n.path))if(6===n.type)e.findModules(n.path).map((e=>{var t;return null===(t=a.getFileInfo(e))||void 0===t?void 0:t.filePath})).filter(u.isDefined).forEach((e=>this._addIfUnique(f,this._createModuleEntry(e))));else{const t=e.findDeclarations(n);for(const e of t)e&&e.path&&this._addIfUnique(f,{path:e.path,range:e.range})}}}))}if(0===f.length)return;if(i===y.All)return f;const T=i===y.PreferStubs,_=e=>T===c.isStubFile(e.path);return f.find(_)?f.filter(_):f}static _createModuleEntry(e){return{path:e,range:{start:{line:0,character:0},end:{line:0,character:0}}}}static _addIfUnique(e,t){for(const n of e)if(n.path===t.path&&m.rangesAreEqual(n.range,t.range))return;e.push(t)}}},70234:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentHighlightProvider=void 0;const a=n(29335),o=r(n(23241)),l=n(38213),c=n(28348),p=n(80957),d=n(9272);t.DocumentHighlightProvider=class{static getDocumentHighlight(e,t,n,i){l.throwIfCancellationRequested(i);const s=c.convertPositionToOffset(t,e.tokenizerOutput.lines);if(void 0===s)return;const r=o.findNodeByOffset(e.parseTree,s);if(void 0===r)return;if(38!==r.nodeType)return;const u=[];return new d.DocumentSymbolCollector(r,n,u,i).collect(),u.map((t=>({kind:o.isWriteAccess(t)?a.DocumentHighlightKind.Write:a.DocumentHighlightKind.Read,range:c.convertOffsetsToRange(t.start,p.TextRange.getEnd(t),e.tokenizerOutput.lines)})))}}},9272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolCollector=void 0;const i=n(35696),s=n(88023),r=n(23241),a=n(22339),o=n(38213);class l extends a.ParseTreeWalker{constructor(e,t,n,i,s){super(),this._evaluator=t,this._results=n,this._cancellationToken=i,this._declarations=[],this._symbolName=e.value;(this._evaluator.getDeclarationsForNameNode(e)||[]).forEach((e=>{const t=this._evaluator.resolveAliasDeclaration(e,!0);t&&this._declarations.push(t)})),this._startingNode=null!=s?s:r.getModuleNode(e)}collect(){this._startingNode&&this.walk(this._startingNode)}walk(e){i.isCodeUnreachable(e)||super.walk(e)}visitModuleName(e){return!1}visitName(e){if(o.throwIfCancellationRequested(this._cancellationToken),e.value!==this._symbolName)return!1;if(this._declarations.length>0){const t=this._evaluator.getDeclarationsForNameNode(e);t&&t.length>0&&t.some((e=>this._resultsContainsDeclaration(e)))&&this._addResult(e)}else this._addResult(e);return!0}_addResult(e){this._results.push(e)}_resultsContainsDeclaration(e){const t=this._evaluator.resolveAliasDeclaration(e,!1);if(!t)return!1;if(this._declarations.some((e=>s.areDeclarationsSame(e,t))))return!0;const n=this._evaluator.resolveAliasDeclaration(t,!0);return!(!n||n===t)&&this._declarations.some((e=>s.areDeclarationsSame(e,n)))}}t.DocumentSymbolCollector=l},54989:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolProvider=t.convertToFlatSymbols=t.getIndexAliasData=void 0;const a=n(29335),o=n(15585),l=n(82048),c=r(n(35696)),p=n(88023),d=n(15020),u=n(10425),h=n(38213),m=n(28348),y=r(n(14551)),g=n(82615);function f(e,t){var n;if(!t.symbolName)return;const i=l.resolveAliasDeclaration(e,t,!0),s=i?p.getNameFromDeclaration(i):void 0;if(!s||i.path.length<=0)return;const r=null!==(n=_(s,i))&&void 0!==n?n:a.SymbolKind.Module;return{originalName:s,modulePath:i.path,kind:r,itemKind:g.convertSymbolKindToCompletionItemKind(r)}}t.getIndexAliasData=f,t.convertToFlatSymbols=function(e,t){const n=[];for(const i of t)C(n,e,i);return n};class T{static getSymbolsForDocument(e,t,n,i,s,r){var a;const o=[];if(!t&&!n)return o;return v(null!==(a=null==t?void 0:t.symbols)&&void 0!==a?a:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},r),i,s,"",o,r),o}static addHierarchicalSymbolsForDocument(e,t,n,i,s){var r;if(!t&&!n)return;b(null!==(r=null==t?void 0:t.symbols)&&void 0!==r?r:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},s),i,s)}static indexSymbols(e,t,n,i){const s=[];return I(e,t,t.parseTree,n,s,i),s}}function _(e,t,n){let i;switch(t.type){case 4:case 5:i=a.SymbolKind.Class;break;case 3:if(t.isMethod){const e=null==n?void 0:n.getTypeForDeclaration(t);i=e&&u.isProperty(e)?a.SymbolKind.Property:a.SymbolKind.Method}else i=a.SymbolKind.Function;break;case 6:i=a.SymbolKind.Module;break;case 2:if("self"===e||"cls"===e||"_"===e)return;i=a.SymbolKind.Variable;break;case 1:if("_"===e)return;i=t.isConstant||t.isFinal?a.SymbolKind.Constant:a.SymbolKind.Variable;break;default:i=a.SymbolKind.Variable}return i}function v(e,t,n,i,s,r){if(h.throwIfCancellationRequested(r),e)for(const l of e)if(!l.alias){if(y.isPatternInSymbol(n,l.name)){const e={uri:o.URI.file(t).toString(),range:l.selectionRange},n={name:l.name,kind:l.kind,location:e};i.length&&(n.containerName=i),s.push(n)}v(l.children,t,n,a(i,l.name),s,r)}function a(e,t){return e.length>0?`${e}.${t}`:t}}function b(e,t,n){if(h.throwIfCancellationRequested(n),e)for(const i of e){if(i.alias)continue;const e=[];b(i.children,e,n);const s={name:i.name,kind:i.kind,range:i.range,selectionRange:i.selectionRange,children:e};t.push(s)}}function I(e,t,n,i,s,r){h.throwIfCancellationRequested(r);const a=c.getScope(n);if(!a)return;a.symbolTable.forEach(((n,a)=>{if(n.isIgnoredForProtocolMatch())return;if(i.indexingForAutoImportMode&&!e.isStubFile&&!e.isInPyTypedPackage&&!n.isInDunderAll())return;let o=d.getLastTypedDeclaredForSymbol(n);if(!o&&n.hasDeclarations()&&(o=n.getDeclarations()[0]),o){if(6===o.type){if(!i.indexingForAutoImportMode)return;if(o.path.length<=0)return}!function(e,t,n,i,s,r,a,o){if(i.indexingForAutoImportMode&&!s)return;const l=_(r,n);if(void 0===l)return;const p=n.range;let d=p;const u=[];4!==n.type&&3!==n.type||(i.indexingForAutoImportMode||I(e,t,n.node,i,u,o),d=m.convertOffsetsToRange(n.node.start,n.node.start+n.node.length,t.tokenizerOutput.lines));const h={name:r,externallyVisible:s,kind:l,itemKind:g.convertSymbolKindToCompletionItemKind(l),alias:6===n.type?f(c.getFileInfo(t.parseTree).importLookup,n):void 0,range:i.indexingForAutoImportMode?void 0:d,selectionRange:i.indexingForAutoImportMode?void 0:p,children:i.indexingForAutoImportMode?void 0:u};a.push(h)}(e,t,o,i,!n.isExternallyHidden(),a,s,r)}}))}function C(e,t,n,i){const s={name:n.name,kind:n.kind,location:a.Location.create(t,n.range)};if(n.tags&&(s.tags=n.tags),i&&(s.containerName=i.name),e.push(s),n.children)for(const i of n.children)C(e,t,i,n)}t.DocumentSymbolProvider=T},8871:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertHoverResults=t.HoverProvider=void 0;const a=n(29335),o=n(21736),l=r(n(23241)),c=n(59195),p=n(10425),d=n(38213),u=n(20823),h=n(28348),m=n(80957),y=n(31807);t.HoverProvider=class{static getHoverForPosition(e,t,n,i,s,r){d.throwIfCancellationRequested(r);const a=h.convertPositionToOffset(n,t.tokenizerOutput.lines);if(void 0===a)return;const o=l.findNodeByOffset(t.parseTree,a);if(void 0===o)return;const p={parts:[],range:{start:h.convertOffsetToPosition(o.start,t.tokenizerOutput.lines),end:h.convertOffsetToPosition(m.TextRange.getEnd(o),t.tokenizerOutput.lines)}};if(38===o.nodeType){const t=s.getDeclarationsForNameNode(o);if(t&&t.length>0){let n=t[0];6===n.type&&t.length>1&&(n=t[1]),this._addResultsForDeclaration(i,e,p.parts,n,o,s)}else if((!o.parent||37!==o.parent.nodeType)&&0===p.parts.length){const t=s.getType(o)||c.UnknownType.create();let n="";n=c.isModule(t)?"(module) "+o.value:o.value+": "+s.printType(t,!1),this._addResultsPart(p.parts,n,!0),this._addDocumentationPart(i,e,p.parts,o,s,void 0)}}return p.parts.length>0?p:void 0}static _addResultsForDeclaration(e,t,n,i,s,r){var a;const o=r.resolveAliasDeclaration(i,!0);if(o)switch(o.type){case 0:this._addResultsPart(n,s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 1:{let l=o.isConstant||o.isFinal?"constant":"variable",p=s;21===i.node.nodeType||23===i.node.nodeType?i.node.alias&&s!==i.node.alias&&38===o.node.nodeType&&(p=o.node):1===(null===(a=s.parent)||void 0===a?void 0:a.nodeType)&&s.parent.name===s&&38===i.node.nodeType&&(p=i.node);const d=r.getType(p);let u,h=!1;if(null==d?void 0:d.typeAliasInfo){const e=c.getTypeAliasInfo(d);(null==e?void 0:e.name)===p.value&&(c.isTypeVar(d)?(l=d.details.isParamSpec?"param spec":"type variable",u=d.details.name):(h=!0,l="type alias"))}const m=u||s.value+this._getTypeText(p,r,h);this._addResultsPart(n,`(${l}) ${m}`,!0),this._addDocumentationPart(e,t,n,s,r,o);break}case 2:this._addResultsPart(n,"(parameter) "+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 4:case 5:if(this._addInitMethodInsteadIfCallNode(e,s,r,n,t,o))return;this._addResultsPart(n,"(class) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 3:{let i="function";if(o.isMethod){const e=r.getTypeForDeclaration(o);i=e&&p.isProperty(e)?"property":"method"}const a=r.getType(s);a&&c.isOverloadedFunction(a)?this._addResultsPart(n,`(${i})\n${y.getOverloadedFunctionTooltip(a,r)}`,!0):this._addResultsPart(n,`(${i}) `+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break}case 6:this._addResultsPart(n,"(module) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,o)}else this._addResultsPart(n,"(import) "+s.value+this._getTypeText(s,r),!0)}static _addInitMethodInsteadIfCallNode(e,t,n,i,s,r){let a=t;if(a.parent&&35===a.parent.nodeType&&t===a.parent.memberName&&(a=t.parent),!a||!a.parent||9!==a.parent.nodeType||a.parent.leftExpression!==a)return!1;const o=n.getType(t);if(!o||!c.isInstantiableClass(o))return!1;const l=p.lookUpClassMember(o,"__init__",12);if(!l)return!1;const d=n.getType(a.parent),u=n.getTypeOfMember(l);if(!(d&&u&&c.isClassInstance(d)&&c.isFunction(u)))return!1;const h=n.bindFunctionToClassOrObject(d,u);if(!h||!c.isFunction(h))return!1;const m=n.printFunctionParts(h),y=`${t.value}(${m[0].join(", ")})`;this._addResultsPart(i,"(class) "+y,!0);return this._addDocumentationPartForType(e,s,i,h,r,n)||this._addDocumentationPartForType(e,s,i,o,r,n),!0}static _getTypeText(e,t,n=!1){const i=t.getType(e)||c.UnknownType.create();return": "+t.printType(i,n)}static _addDocumentationPart(e,t,n,i,s,r){const a=s.getType(i);a&&this._addDocumentationPartForType(e,t,n,a,r,s)}static _addDocumentationPartForType(e,t,n,i,s,r){const a=y.getDocumentationPartsForTypeAndDecl(t,i,s,r);let o=!1;for(const t of a)t&&(o=!0,this._addDocumentationResultsPart(e,n,t));return o}static _addDocumentationResultsPart(e,t,n){if(n)if(e===a.MarkupKind.Markdown){const e=o.convertDocStringToMarkdown(n);t.length>0&&e.length>0&&t.push({text:"---\n"}),this._addResultsPart(t,e)}else e===a.MarkupKind.PlainText?this._addResultsPart(t,o.convertDocStringToPlainText(n)):u.fail(`Unsupported markup type: ${e}`)}static _addResultsPart(e,t,n=!1){e.push({python:n,text:t})}},t.convertHoverResults=function(e,t){if(!t)return;const n=t.parts.map((t=>{if(t.python){if(e===a.MarkupKind.Markdown)return"```python\n"+t.text+"\n```\n";if(e===a.MarkupKind.PlainText)return t.text+"\n\n";u.fail(`Unsupported markup type: ${e}`)}return t.text})).join("").trimEnd();return{contents:{kind:e,value:n},range:t.range}}},64677:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportSorter=void 0;const i=n(45214),s=n(38213),r=n(28348),a=n(80957);t.ImportSorter=class{constructor(e,t){this._parseResults=e,this._cancellationToken=t}sort(){s.throwIfCancellationRequested(this._cancellationToken);const e=[],t=i.getTopLevelImports(this._parseResults.parseTree),n=t.orderedImports.map((e=>e)).sort(((e,t)=>i.compareImportStatements(e,t)));if(0===n.length)return[];const r=this._getPrimaryReplacementRange(t.orderedImports);return e.push({range:r,replacementText:this._generateSortedImportText(n)}),this._addSecondaryReplacementRanges(t.orderedImports,e),e}_getPrimaryReplacementRange(e){let t=e.findIndex((e=>e.followsNonImportStatement));t<0&&(t=e.length);const n=e[t-1].node;return{start:r.convertOffsetToPosition(e[0].node.start,this._parseResults.tokenizerOutput.lines),end:r.convertOffsetToPosition(a.TextRange.getEnd(n),this._parseResults.tokenizerOutput.lines)}}_addSecondaryReplacementRanges(e,t){let n=e.findIndex((e=>e.followsNonImportStatement));if(!(n<0))for(;;){let i=e.findIndex(((e,t)=>t>n&&e.followsNonImportStatement));if(i<0&&(i=e.length),t.push({range:{start:r.convertOffsetToPosition(e[n].node.start,this._parseResults.tokenizerOutput.lines),end:r.convertOffsetToPosition(a.TextRange.getEnd(e[i-1].node),this._parseResults.tokenizerOutput.lines)},replacementText:""}),n=i,n>=e.length)break}}_generateSortedImportText(e){let t="",n=i.getImportGroup(e[0]);for(const s of e){const r=i.getImportGroup(s);let a;n!==r&&(t+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence,n=r),a=20===s.node.nodeType?this._formatImportNode(s.subnode,s.moduleName):this._formatImportFromNode(s.node,s.moduleName),s!==e[e.length-1]&&(a+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence),t+=a}return t}_formatImportNode(e,t){let n=`import ${t}`;return e.alias&&(n+=` as ${e.alias.value}`),n}_formatImportFromNode(e,t){const n=e.imports.sort(((e,t)=>this._compareSymbols(e,t))).map((e=>{let t=e.name.value;return e.alias&&(t+=` as ${e.alias.value}`),t}));let i=`from ${t} import `;if(e.isWildcardImport)return i+"*";const s=n.join(", ");if(i.length+s.length<=88)return i+s;i+="("+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;for(const e of n)i+=this._parseResults.tokenizerOutput.predominantTabSequence+e+","+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;return i+=")",i}_compareSymbols(e,t){return e.name.value=1){return function(e,t,n){l.throwIfCancellationRequested(n);let i=o.findNodeByOffset(e.parseTree,t);for(;i&&41!==i.nodeType;)i=i.parent;if(!i)return[];const s=i.typeAnnotation||i.typeAnnotationComment;if(!s)return[];const r=[],d=c.convertOffsetToPosition(s.start,e.tokenizerOutput.lines),u=c.convertOffsetToPosition(p.TextRange.getEnd(s),e.tokenizerOutput.lines);r.push({range:{start:d,end:d},replacementText:"Optional["}),r.push({range:{start:u,end:u},replacementText:"]"});const h=a.getTopLevelImports(e.parseTree),m=h.orderedImports.find((e=>"typing"===e.moduleName));if(m&&22===m.node.nodeType){const t=a.getTextEditsForAutoImportSymbolAddition("Optional",m,e);r.push(...t)}else{const t=a.getTextEditsForAutoImportInsertion("Optional",h,"typing",0,e,d);r.push(...t)}return r}(n,parseInt(t[0],10),i)}return[]}},5165:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReferencesProvider=t.FindReferencesTreeWalker=t.ReferencesResult=void 0;const a=r(n(35696)),o=r(n(88023)),l=r(n(23241)),c=n(22339),p=n(93989),d=n(38213),u=n(28348),h=n(80957);class m{constructor(e,t,n,i,s){this.requiresGlobalSearch=e,this.nodeAtOffset=t,this.symbolName=n,this.declarations=i,this._reporter=s,this._locations=[]}get locations(){return this._locations}addLocations(...e){0!==e.length&&(this._reporter&&this._reporter(e),this._locations.push(...e))}}t.ReferencesResult=m;class y extends c.ParseTreeWalker{constructor(e,t,n,i,s,r){super(),this._parseResults=e,this._filePath=t,this._referencesResult=n,this._includeDeclaration=i,this._evaluator=s,this._cancellationToken=r,this._locationsFound=[]}findReferences(e=this._parseResults.parseTree){return this.walk(e),this._locationsFound}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitModuleName(e){return!1}visitName(e){if(d.throwIfCancellationRequested(this._cancellationToken),e.value!==this._referencesResult.symbolName)return!1;const t=this._evaluator.getDeclarationsForNameNode(e);return t&&t.length>0&&t.some((e=>this._resultsContainsDeclaration(e)))&&(this._includeDeclaration||e!==this._referencesResult.nodeAtOffset)&&this._locationsFound.push({path:this._filePath,range:{start:u.convertOffsetToPosition(e.start,this._parseResults.tokenizerOutput.lines),end:u.convertOffsetToPosition(h.TextRange.getEnd(e),this._parseResults.tokenizerOutput.lines)}}),!0}_resultsContainsDeclaration(e){const t=this._evaluator.resolveAliasDeclaration(e,!1);if(!t)return!1;if(this._referencesResult.declarations.some((e=>o.areDeclarationsSame(e,t))))return!0;const n=this._evaluator.resolveAliasDeclaration(t,!0);return!(!n||n===t)&&this._referencesResult.declarations.some((e=>o.areDeclarationsSame(e,n)))}}t.FindReferencesTreeWalker=y;t.ReferencesProvider=class{static getDeclarationForPosition(e,t,n,i,s,r,a){var o;d.throwIfCancellationRequested(a);const c=u.convertPositionToOffset(i,t.tokenizerOutput.lines);if(void 0===c)return;const h=l.findNodeByOffset(t.parseTree,c);if(void 0===h)return;if(38!==h.nodeType)return;if(37===(null===(o=h.parent)||void 0===o?void 0:o.nodeType))return;const y=s.getDeclarationsForNameNode(h);if(!y)return;const g=[];if(y.forEach((t=>{const n=s.resolveAliasDeclaration(t,!1);if(n&&(g.push(n),p.isStubFile(n.path))){const t=e.findDeclarations(n);for(const e of t)e&&e.path&&this._addIfUnique(g,e)}})),0===g.length)return;const f=g.some((e=>{var t,i;if(e.path!==n)return!0;const s=l.getEvaluationScopeNode(e.node);return 36===s.nodeType||10===s.nodeType||35===(null===(i=null===(t=e.node)||void 0===t?void 0:t.parent)||void 0===i?void 0:i.nodeType)&&e.node===e.node.parent.memberName}));return new m(f,h,h.value,g,r)}static _addIfUnique(e,t){for(const n of e)if(o.areDeclarationsSame(n,t))return;e.push(t)}static addReferences(e,t,n,i,s,r){const a=new y(e,t,n,i,s,r);n.addLocations(...a.findReferences())}}},75659:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SignatureHelpProvider=void 0;const a=n(29335),o=n(21736),l=n(20822),c=r(n(23241)),p=n(23241),d=n(38213),u=n(28348),h=n(31807);t.SignatureHelpProvider=class{static getSignatureHelpForPosition(e,t,n,i,s,r){var a;d.throwIfCancellationRequested(r);const o=u.convertPositionToOffset(t,e.tokenizerOutput.lines);if(void 0===o)return;let l=c.findNodeByOffset(e.parseTree,o);const h=l,m=l?c.getNodeDepth(l):0;let y=o-1;for(;y>=0&&","!==e.text.substr(y,1);){const t=c.findNodeByOffset(e.parseTree,y);if(t&&t!==h){c.getNodeDepth(t)>m&&(l=t);break}y--}if(void 0===l)return;const g=p.getCallNodeAndActiveParameterIndex(l,o,e.tokenizerOutput.tokens);if(!g)return;const f=i.getCallSignatureInfo(g.callNode,g.activeIndex,g.activeOrFake);if(!f)return;return{signatures:f.signatures.map((e=>this._makeSignature(f.callNode,e,n,i,s))),callHasParameters:!!(null===(a=f.callNode.arguments)||void 0===a?void 0:a.length)}}static _makeSignature(e,t,n,i,s){var r;const c=t.type,p=i.printFunctionParts(c),d=[],u=null!==(r=h.getFunctionDocStringFromType(c,n,i))&&void 0!==r?r:this._getDocStringFromCallNode(e,n,i);let m="(";const y=c.details.parameters;let g;p[0].forEach(((e,t)=>{let n="";t0&&(n=y[y.length-1].name||""),d.push({startOffset:m.length,endOffset:m.length+e.length,text:e,documentation:l.extractParameterDocumentation(u||"",n)}),m+=e,t0)return a.join("\n\n")}}}},31807:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getAutoImportText=t.getDocumentationPartsForTypeAndDecl=t.getFunctionDocStringFromType=t.getOverloadedFunctionTooltip=void 0;const a=r(n(23241)),o=n(58333),l=n(59195);function c(e,t,n){const i=e.details.declaration,s=i?a.getEnclosingClass(i.node):void 0,r=s?n.getTypeOfClass(s):void 0;return o.getFunctionDocStringInherited(e,i,t,null==r?void 0:r.classType)}t.getOverloadedFunctionTooltip=function(e,t,n=70){let i="";const s=e.overloads.filter((e=>l.FunctionType.isOverloaded(e))).map((e=>e.details.name+t.printType(e,!1)));for(let e=0;en&&s[e-1].length<=n&&(i+="\n"),i+=s[e],en&&(i+="\n"));return i},t.getFunctionDocStringFromType=c,t.getDocumentationPartsForTypeAndDecl=function(e,t,n,i){if(l.isModule(t)){const i=o.getModuleDocString(t,n,e);if(i)return[i]}else if(l.isInstantiableClass(t)){const i=o.getClassDocString(t,n,e);if(i)return[i]}else if(l.isFunction(t)){if(3===(null==n?void 0:n.type)||4===(null==n?void 0:n.type)){const n=c(t,e,i);if(n)return[n]}}else{if(l.isOverloadedFunction(t)){const s=n?a.getEnclosingClass(n.node):void 0,r=s?i.getTypeOfClass(s):void 0;return o.getOverloadedFunctionDocStringsInherited(t,n,e,i,null==r?void 0:r.classType)}if(1===(null==n?void 0:n.type))return o.getVariableInStubFileDocStrings(n,e);if(3===(null==n?void 0:n.type)){const t=o.getPropertyDocStringInherited(n,e,i);if(t)return[t]}}return[]},t.getAutoImportText=function(e,t,n){let i;return i=t?`from ${t} import ${e}`:`import ${e}`,n&&(i=`${i} as ${n}`),i}},74426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Localizer=t.ParameterizedString=void 0;const i=n(20823),s=n(4397),r=n(27646),a=n(3608),o=n(36181),l=n(22811),c=n(66483),p=n(37568),d=n(61162);class u{constructor(e){this._formatString=e}format(e){let t=this._formatString;return Object.keys(e).forEach((n=>{t=t.replace(`{${n}}`,e[n].toString())})),t}getFormatString(){return this._formatString}}t.ParameterizedString=u;const h="en-us",m=new Map([["de",r],["en-us",s],["es",a],["fr",o],["ja",l],["ru",c],["zh-cn",p],["zh-tw",d]]);let y,g={};function f(e){void 0===y&&(y=function(){g=function(){const e=_(h);if(e)return e;return console.error("Could not load default strings"),{}}();return function(e){if(e===h)return{};let t=_(e);if(void 0!==t)return t;const n=e.split("-");if(n.length>0&&n[0]&&(t=_(n[0]),void 0!==t))return t;return{}}(function(){try{if(null===navigator||void 0===navigator?void 0:navigator.language)return navigator.language.toLowerCase()}catch{}const e=process.env,t=e.VSCODE_NLS_CONFIG;if(t)try{return JSON.parse(t).locale}catch{}const n=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE;if(n){const e=n.split(".");if(e.length>0&&e[0])return e[0]}return h}())}());const t=e.split("."),n=T(y,t)||T(g,t);if(n)return n;i.fail(`Missing localized string for key "${e}"`)}function T(e,t){let n=e;for(const e of t){if(!n[e])return;n=n[e]}return n}function _(e){return m.get(e)}!function(e){let t,n,i;!function(e){e.annotatedParamCountMismatch=()=>new u(f("Diagnostic.annotatedParamCountMismatch")),e.annotatedTypeArgMissing=()=>f("Diagnostic.annotatedTypeArgMissing"),e.annotationFormatString=()=>f("Diagnostic.annotationFormatString"),e.annotationNotSupported=()=>f("Diagnostic.annotationNotSupported"),e.annotationSpansStrings=()=>f("Diagnostic.annotationSpansStrings"),e.annotationStringEscape=()=>f("Diagnostic.annotationStringEscape"),e.annotationTripleQuote=()=>f("Diagnostic.annotationTripleQuote"),e.argAssignment=()=>new u(f("Diagnostic.argAssignment")),e.argAssignmentFunction=()=>new u(f("Diagnostic.argAssignmentFunction")),e.argAssignmentParam=()=>new u(f("Diagnostic.argAssignmentParam")),e.argAssignmentParamFunction=()=>new u(f("Diagnostic.argAssignmentParamFunction")),e.argMissingForParam=()=>new u(f("Diagnostic.argMissingForParam")),e.argMissingForParams=()=>new u(f("Diagnostic.argMissingForParams")),e.argMorePositionalExpectedCount=()=>new u(f("Diagnostic.argMorePositionalExpectedCount")),e.argMorePositionalExpectedOne=()=>f("Diagnostic.argMorePositionalExpectedOne"),e.argPositional=()=>f("Diagnostic.argPositional"),e.argPositionalExpectedCount=()=>new u(f("Diagnostic.argPositionalExpectedCount")),e.argPositionalExpectedOne=()=>f("Diagnostic.argPositionalExpectedOne"),e.argTypePartiallyUnknown=()=>f("Diagnostic.argTypePartiallyUnknown"),e.argTypeUnknown=()=>f("Diagnostic.argTypeUnknown"),e.assertAlwaysTrue=()=>f("Diagnostic.assertAlwaysTrue"),e.assignmentExprContext=()=>f("Diagnostic.assignmentExprContext"),e.assignmentExprComprehension=()=>new u(f("Diagnostic.assignmentExprComprehension")),e.assignmentInProtocol=()=>f("Diagnostic.assignmentInProtocol"),e.assignmentTargetExpr=()=>f("Diagnostic.assignmentTargetExpr"),e.asyncNotInAsyncFunction=()=>f("Diagnostic.asyncNotInAsyncFunction"),e.awaitIllegal=()=>f("Diagnostic.awaitIllegal"),e.awaitNotInAsync=()=>f("Diagnostic.awaitNotInAsync"),e.backticksIllegal=()=>f("Diagnostic.backticksIllegal"),e.baseClassCircular=()=>f("Diagnostic.baseClassCircular"),e.baseClassInvalid=()=>f("Diagnostic.baseClassInvalid"),e.baseClassFinal=()=>new u(f("Diagnostic.baseClassFinal")),e.baseClassUnknown=()=>f("Diagnostic.baseClassUnknown"),e.bindTypeMismatch=()=>new u(f("Diagnostic.bindTypeMismatch")),e.breakOutsideLoop=()=>f("Diagnostic.breakOutsideLoop"),e.callableExtraArgs=()=>f("Diagnostic.callableExtraArgs"),e.callableFirstArg=()=>f("Diagnostic.callableFirstArg"),e.callableSecondArg=()=>f("Diagnostic.callableSecondArg"),e.casePatternIsIrrefutable=()=>f("Diagnostic.casePatternIsIrrefutable"),e.classDecoratorTypeUnknown=()=>f("Diagnostic.classDecoratorTypeUnknown"),e.classDefinitionCycle=()=>new u(f("Diagnostic.classDefinitionCycle")),e.classGetItemClsParam=()=>f("Diagnostic.classGetItemClsParam"),e.classMethodClsParam=()=>f("Diagnostic.classMethodClsParam"),e.classNotRuntimeSubscriptable=()=>new u(f("Diagnostic.classNotRuntimeSubscriptable")),e.classVarNotAllowed=()=>f("Diagnostic.classVarNotAllowed"),e.classVarFirstArgMissing=()=>f("Diagnostic.classVarFirstArgMissing"),e.classVarOverridesInstanceVar=()=>new u(f("Diagnostic.classVarOverridesInstanceVar")),e.classVarTooManyArgs=()=>f("Diagnostic.classVarTooManyArgs"),e.clsSelfParamTypeMismatch=()=>new u(f("Diagnostic.clsSelfParamTypeMismatch")),e.comparisonAlwaysFalse=()=>new u(f("Diagnostic.comparisonAlwaysFalse")),e.comparisonAlwaysTrue=()=>new u(f("Diagnostic.comparisonAlwaysTrue")),e.comprehensionInDict=()=>f("Diagnostic.comprehensionInDict"),e.comprehensionInSet=()=>f("Diagnostic.comprehensionInSet"),e.concatenateParamSpecMissing=()=>f("Diagnostic.concatenateParamSpecMissing"),e.concatenateTypeArgsMissing=()=>f("Diagnostic.concatenateTypeArgsMissing"),e.constantRedefinition=()=>new u(f("Diagnostic.constantRedefinition")),e.constructorNoArgs=()=>new u(f("Diagnostic.constructorNoArgs")),e.continueInFinally=()=>f("Diagnostic.continueInFinally"),e.continueOutsideLoop=()=>f("Diagnostic.continueOutsideLoop"),e.dataClassBaseClassNotFrozen=()=>f("Diagnostic.dataClassBaseClassNotFrozen"),e.dataClassFieldWithDefault=()=>f("Diagnostic.dataClassFieldWithDefault"),e.declaredReturnTypePartiallyUnknown=()=>new u(f("Diagnostic.declaredReturnTypePartiallyUnknown")),e.declaredReturnTypeUnknown=()=>f("Diagnostic.declaredReturnTypeUnknown"),e.defaultValueContainsCall=()=>f("Diagnostic.defaultValueContainsCall"),e.defaultValueNotAllowed=()=>f("Diagnostic.defaultValueNotAllowed"),e.defaultValueNotEllipsis=()=>f("Diagnostic.defaultValueNotEllipsis"),e.dictExpandIllegalInComprehension=()=>f("Diagnostic.dictExpandIllegalInComprehension"),e.dictInAnnotation=()=>f("Diagnostic.dictInAnnotation"),e.dictKeyValuePairs=()=>f("Diagnostic.dictKeyValuePairs"),e.dictUnpackIsNotMapping=()=>f("Diagnostic.dictUnpackIsNotMapping"),e.delTargetExpr=()=>f("Diagnostic.delTargetExpr"),e.dunderAllSymbolNotPresent=()=>new u(f("Diagnostic.dunderAllSymbolNotPresent")),e.duplicateArgsParam=()=>f("Diagnostic.duplicateArgsParam"),e.duplicateBaseClass=()=>f("Diagnostic.duplicateBaseClass"),e.duplicateCatchAll=()=>f("Diagnostic.duplicateCatchAll"),e.duplicateImport=()=>new u(f("Diagnostic.duplicateImport")),e.duplicateKwargsParam=()=>f("Diagnostic.duplicateKwargsParam"),e.duplicateKeywordOnly=()=>f("Diagnostic.duplicateKeywordOnly"),e.duplicateParam=()=>new u(f("Diagnostic.duplicateParam")),e.duplicateCapturePatternTarget=()=>new u(f("Diagnostic.duplicateCapturePatternTarget")),e.duplicateStarPattern=()=>f("Diagnostic.duplicateStarPattern"),e.duplicateStarStarPattern=()=>f("Diagnostic.duplicateStarStarPattern"),e.duplicatePositionOnly=()=>f("Diagnostic.duplicatePositionOnly"),e.duplicateUnpack=()=>f("Diagnostic.duplicateUnpack"),e.ellipsisContext=()=>f("Diagnostic.ellipsisContext"),e.ellipsisSecondArg=()=>f("Diagnostic.ellipsisSecondArg"),e.exceptionTypeIncorrect=()=>new u(f("Diagnostic.exceptionTypeIncorrect")),e.exceptionTypeNotClass=()=>new u(f("Diagnostic.exceptionTypeNotClass")),e.exceptionTypeNotInstantiable=()=>new u(f("Diagnostic.exceptionTypeNotInstantiable")),e.expectedAfterDecorator=()=>f("Diagnostic.expectedAfterDecorator"),e.expectedArrow=()=>f("Diagnostic.expectedArrow"),e.expectedAsAfterException=()=>f("Diagnostic.expectedAsAfterException"),e.expectedAssignRightHandExpr=()=>f("Diagnostic.expectedAssignRightHandExpr"),e.expectedBinaryRightHandExpr=()=>f("Diagnostic.expectedBinaryRightHandExpr"),e.expectedBoolLiteral=()=>f("Diagnostic.expectedBoolLiteral"),e.expectedCase=()=>f("Diagnostic.expectedCase"),e.expectedClassName=()=>f("Diagnostic.expectedClassName"),e.expectedCloseBracket=()=>f("Diagnostic.expectedCloseBracket"),e.expectedCloseBrace=()=>f("Diagnostic.expectedCloseBrace"),e.expectedCloseParen=()=>f("Diagnostic.expectedCloseParen"),e.expectedColon=()=>f("Diagnostic.expectedColon"),e.expectedComplexNumberLiteral=()=>f("Diagnostic.expectedComplexNumberLiteral"),e.expectedDecoratorExpr=()=>f("Diagnostic.expectedDecoratorExpr"),e.expectedDecoratorName=()=>f("Diagnostic.expectedDecoratorName"),e.expectedDecoratorNewline=()=>f("Diagnostic.expectedDecoratorNewline"),e.expectedDelExpr=()=>f("Diagnostic.expectedDelExpr"),e.expectedElse=()=>f("Diagnostic.expectedElse"),e.expectedExceptionClass=()=>f("Diagnostic.expectedExceptionClass"),e.expectedExceptionObj=()=>f("Diagnostic.expectedExceptionObj"),e.expectedExpr=()=>f("Diagnostic.expectedExpr"),e.expectedImport=()=>f("Diagnostic.expectedImport"),e.expectedImportAlias=()=>f("Diagnostic.expectedImportAlias"),e.expectedImportSymbols=()=>f("Diagnostic.expectedImportSymbols"),e.expectedIdentifier=()=>f("Diagnostic.expectedIdentifier"),e.expectedIndentedBlock=()=>f("Diagnostic.expectedIndentedBlock"),e.expectedIn=()=>f("Diagnostic.expectedIn"),e.expectedInExpr=()=>f("Diagnostic.expectedInExpr"),e.expectedFunctionAfterAsync=()=>f("Diagnostic.expectedFunctionAfterAsync"),e.expectedFunctionName=()=>f("Diagnostic.expectedFunctionName"),e.expectedMemberName=()=>f("Diagnostic.expectedMemberName"),e.expectedModuleName=()=>f("Diagnostic.expectedModuleName"),e.expectedNameAfterAs=()=>f("Diagnostic.expectedNameAfterAs"),e.expectedNamedParameter=()=>f("Diagnostic.expectedNamedParameter"),e.expectedNewline=()=>f("Diagnostic.expectedNewline"),e.expectedNewlineOrSemicolon=()=>f("Diagnostic.expectedNewlineOrSemicolon"),e.expectedOpenParen=()=>f("Diagnostic.expectedOpenParen"),e.expectedParamName=()=>f("Diagnostic.expectedParamName"),e.expectedPatternExpr=()=>f("Diagnostic.expectedPatternExpr"),e.expectedPatternSubjectExpr=()=>f("Diagnostic.expectedPatternSubjectExpr"),e.expectedPatternValue=()=>f("Diagnostic.expectedPatternValue"),e.expectedReturnExpr=()=>f("Diagnostic.expectedReturnExpr"),e.expectedSliceIndex=()=>f("Diagnostic.expectedSliceIndex"),e.expectedTypeNotString=()=>f("Diagnostic.expectedTypeNotString"),e.expectedYieldExpr=()=>f("Diagnostic.expectedYieldExpr"),e.finalClassIsAbstract=()=>new u(f("Diagnostic.finalClassIsAbstract")),e.finalContext=()=>f("Diagnostic.finalContext"),e.finalMethodOverride=()=>new u(f("Diagnostic.finalMethodOverride")),e.finalReassigned=()=>new u(f("Diagnostic.finalReassigned")),e.finalRedeclaration=()=>new u(f("Diagnostic.finalRedeclaration")),e.finalRedeclarationBySubclass=()=>new u(f("Diagnostic.finalRedeclarationBySubclass")),e.finalTooManyArgs=()=>f("Diagnostic.finalTooManyArgs"),e.finalUnassigned=()=>new u(f("Diagnostic.finalUnassigned")),e.formatStringBrace=()=>f("Diagnostic.formatStringBrace"),e.formatStringBytes=()=>f("Diagnostic.formatStringBytes"),e.formatStringEscape=()=>f("Diagnostic.formatStringEscape"),e.formatStringInPattern=()=>f("Diagnostic.formatStringInPattern"),e.formatStringIllegal=()=>f("Diagnostic.formatStringIllegal"),e.formatStringUnicode=()=>f("Diagnostic.formatStringUnicode"),e.formatStringUnterminated=()=>f("Diagnostic.formatStringUnterminated"),e.functionDecoratorTypeUnknown=()=>f("Diagnostic.functionDecoratorTypeUnknown"),e.generatorAsyncReturnType=()=>f("Diagnostic.generatorAsyncReturnType"),e.generatorSyncReturnType=()=>f("Diagnostic.generatorSyncReturnType"),e.genericClassAssigned=()=>f("Diagnostic.genericClassAssigned"),e.genericClassDeleted=()=>f("Diagnostic.genericClassDeleted"),e.genericNotAllowed=()=>f("Diagnostic.genericNotAllowed"),e.genericTypeArgMissing=()=>f("Diagnostic.genericTypeArgMissing"),e.genericTypeArgTypeVar=()=>f("Diagnostic.genericTypeArgTypeVar"),e.genericTypeArgUnique=()=>f("Diagnostic.genericTypeArgUnique"),e.globalReassignment=()=>new u(f("Diagnostic.globalReassignment")),e.globalRedefinition=()=>new u(f("Diagnostic.globalRedefinition")),e.implicitStringConcat=()=>f("Diagnostic.implicitStringConcat"),e.importCycleDetected=()=>f("Diagnostic.importCycleDetected"),e.importDepthExceeded=()=>new u(f("Diagnostic.importDepthExceeded")),e.importResolveFailure=()=>new u(f("Diagnostic.importResolveFailure")),e.importSourceResolveFailure=()=>new u(f("Diagnostic.importSourceResolveFailure")),e.importSymbolUnknown=()=>new u(f("Diagnostic.importSymbolUnknown")),e.incompatibleMethodOverride=()=>new u(f("Diagnostic.incompatibleMethodOverride")),e.inconsistentIndent=()=>f("Diagnostic.inconsistentIndent"),e.inconsistentTabs=()=>f("Diagnostic.inconsistentTabs"),e.initMustReturnNone=()=>f("Diagnostic.initMustReturnNone"),e.initSubclassClsParam=()=>f("Diagnostic.initSubclassClsParam"),e.instanceMethodSelfParam=()=>f("Diagnostic.instanceMethodSelfParam"),e.instanceVarOverridesClassVar=()=>new u(f("Diagnostic.instanceVarOverridesClassVar")),e.instantiateAbstract=()=>new u(f("Diagnostic.instantiateAbstract")),e.instantiateProtocol=()=>new u(f("Diagnostic.instantiateProtocol")),e.internalBindError=()=>new u(f("Diagnostic.internalBindError")),e.internalParseError=()=>new u(f("Diagnostic.internalParseError")),e.internalTypeCheckingError=()=>new u(f("Diagnostic.internalTypeCheckingError")),e.invalidIdentifierChar=()=>f("Diagnostic.invalidIdentifierChar"),e.invalidStubStatement=()=>f("Diagnostic.invalidStubStatement"),e.invalidTokenChars=()=>new u(f("Diagnostic.invalidTokenChars")),e.isInstanceInvalidType=()=>new u(f("Diagnostic.isInstanceInvalidType")),e.isSubclassInvalidType=()=>new u(f("Diagnostic.isSubclassInvalidType")),e.keyValueInSet=()=>f("Diagnostic.keyValueInSet"),e.keywordArgInTypeArgument=()=>f("Diagnostic.keywordArgInTypeArgument"),e.keywordOnlyAfterArgs=()=>f("Diagnostic.keywordOnlyAfterArgs"),e.keywordSubscriptIllegal=()=>f("Diagnostic.keywordSubscriptIllegal"),e.lambdaReturnTypeUnknown=()=>f("Diagnostic.lambdaReturnTypeUnknown"),e.lambdaReturnTypePartiallyUnknown=()=>new u(f("Diagnostic.lambdaReturnTypePartiallyUnknown")),e.listInAnnotation=()=>f("Diagnostic.listInAnnotation"),e.literalUnsupportedType=()=>f("Diagnostic.literalUnsupportedType"),e.literalEmptyArgs=()=>f("Diagnostic.literalEmptyArgs"),e.literalNotCallable=()=>f("Diagnostic.literalNotCallable"),e.matchIncompatible=()=>f("Diagnostic.matchIncompatible"),e.memberAccess=()=>new u(f("Diagnostic.memberAccess")),e.memberDelete=()=>new u(f("Diagnostic.memberDelete")),e.memberSet=()=>new u(f("Diagnostic.memberSet")),e.metaclassConflict=()=>f("Diagnostic.metaclassConflict"),e.metaclassDuplicate=()=>f("Diagnostic.metaclassDuplicate"),e.methodNotDefined=()=>new u(f("Diagnostic.methodNotDefined")),e.methodNotDefinedOnType=()=>new u(f("Diagnostic.methodNotDefinedOnType")),e.methodOrdering=()=>f("Diagnostic.methodOrdering"),e.methodOverridden=()=>new u(f("Diagnostic.methodOverridden")),e.methodReturnsNonObject=()=>new u(f("Diagnostic.methodReturnsNonObject")),e.moduleContext=()=>f("Diagnostic.moduleContext"),e.moduleUnknownMember=()=>new u(f("Diagnostic.moduleUnknownMember")),e.namedExceptAfterCatchAll=()=>f("Diagnostic.namedExceptAfterCatchAll"),e.namedParamAfterParamSpecArgs=()=>new u(f("Diagnostic.namedParamAfterParamSpecArgs")),e.namedTupleEmptyName=()=>f("Diagnostic.namedTupleEmptyName"),e.namedTupleFirstArg=()=>f("Diagnostic.namedTupleFirstArg"),e.namedTupleMultipleInheritance=()=>f("Diagnostic.namedTupleMultipleInheritance"),e.namedTupleNameString=()=>f("Diagnostic.namedTupleNameString"),e.namedTupleNameType=()=>f("Diagnostic.namedTupleNameType"),e.namedTupleNameUnique=()=>f("Diagnostic.namedTupleNameUnique"),e.namedTupleNoTypes=()=>f("Diagnostic.namedTupleNoTypes"),e.namedTupleSecondArg=()=>f("Diagnostic.namedTupleSecondArg"),e.newClsParam=()=>f("Diagnostic.newClsParam"),e.newTypeLiteral=()=>f("Diagnostic.newTypeLiteral"),e.newTypeNotAClass=()=>f("Diagnostic.newTypeNotAClass"),e.newTypeProtocolClass=()=>f("Diagnostic.newTypeProtocolClass"),e.nonDefaultAfterDefault=()=>f("Diagnostic.nonDefaultAfterDefault"),e.noneNotCallable=()=>f("Diagnostic.noneNotCallable"),e.noneNotIterable=()=>f("Diagnostic.noneNotIterable"),e.noneNotSubscriptable=()=>f("Diagnostic.noneNotSubscriptable"),e.noneNotUsableWith=()=>f("Diagnostic.noneNotUsableWith"),e.noneOperator=()=>new u(f("Diagnostic.noneOperator")),e.noneUnknownMember=()=>new u(f("Diagnostic.noneUnknownMember")),e.nonLocalNoBinding=()=>new u(f("Diagnostic.nonLocalNoBinding")),e.nonLocalReassignment=()=>new u(f("Diagnostic.nonLocalReassignment")),e.nonLocalRedefinition=()=>new u(f("Diagnostic.nonLocalRedefinition")),e.nonLocalInModule=()=>f("Diagnostic.nonLocalInModule"),e.noOverload=()=>new u(f("Diagnostic.noOverload")),e.noReturnContainsReturn=()=>f("Diagnostic.noReturnContainsReturn"),e.noReturnContainsYield=()=>f("Diagnostic.noReturnContainsYield"),e.noReturnReturnsNone=()=>f("Diagnostic.noReturnReturnsNone"),e.notRequiredArgCount=()=>f("Diagnostic.notRequiredArgCount"),e.notRequiredNotInTypedDict=()=>f("Diagnostic.notRequiredNotInTypedDict"),e.objectNotCallable=()=>new u(f("Diagnostic.objectNotCallable")),e.obscuredClassDeclaration=()=>new u(f("Diagnostic.obscuredClassDeclaration")),e.obscuredFunctionDeclaration=()=>new u(f("Diagnostic.obscuredFunctionDeclaration")),e.obscuredMethodDeclaration=()=>new u(f("Diagnostic.obscuredMethodDeclaration")),e.obscuredParameterDeclaration=()=>new u(f("Diagnostic.obscuredParameterDeclaration")),e.obscuredVariableDeclaration=()=>new u(f("Diagnostic.obscuredVariableDeclaration")),e.operatorLessOrGreaterDeprecated=()=>f("Diagnostic.operatorLessOrGreaterDeprecated"),e.optionalExtraArgs=()=>f("Diagnostic.optionalExtraArgs"),e.orPatternIrrefutable=()=>f("Diagnostic.orPatternIrrefutable"),e.orPatternMissingName=()=>f("Diagnostic.orPatternMissingName"),e.overlappingOverload=()=>new u(f("Diagnostic.overlappingOverload")),e.overloadAbstractMismatch=()=>new u(f("Diagnostic.overloadAbstractMismatch")),e.overloadImplementationMismatch=()=>new u(f("Diagnostic.overloadImplementationMismatch")),e.overloadReturnTypeMismatch=()=>new u(f("Diagnostic.overloadReturnTypeMismatch")),e.overloadWithImplementation=()=>new u(f("Diagnostic.overloadWithImplementation")),e.overloadWithoutImplementation=()=>new u(f("Diagnostic.overloadWithoutImplementation")),e.paramAfterKwargsParam=()=>f("Diagnostic.paramAfterKwargsParam"),e.paramAlreadyAssigned=()=>new u(f("Diagnostic.paramAlreadyAssigned")),e.paramNameMissing=()=>new u(f("Diagnostic.paramNameMissing")),e.paramSpecArgsKwargsUsage=()=>f("Diagnostic.paramSpecArgsKwargsUsage"),e.paramSpecArgsUsage=()=>f("Diagnostic.paramSpecArgsUsage"),e.paramSpecAssignedName=()=>new u(f("Diagnostic.paramSpecAssignedName")),e.paramSpecContext=()=>f("Diagnostic.paramSpecContext"),e.paramSpecFirstArg=()=>f("Diagnostic.paramSpecFirstArg"),e.paramSpecKwargsUsage=()=>f("Diagnostic.paramSpecKwargsUsage"),e.paramSpecNotBound=()=>new u(f("Diagnostic.paramSpecNotBound")),e.paramSpecNotUsedByOuterScope=()=>new u(f("Diagnostic.paramSpecNotUsedByOuterScope")),e.paramSpecUnknownArg=()=>f("Diagnostic.paramSpecUnknownArg"),e.paramSpecUnknownMember=()=>new u(f("Diagnostic.paramSpecUnknownMember")),e.paramSpecUnknownParam=()=>new u(f("Diagnostic.paramSpecUnknownParam")),e.paramTypeCovariant=()=>f("Diagnostic.paramTypeCovariant"),e.paramTypeUnknown=()=>new u(f("Diagnostic.paramTypeUnknown")),e.paramAssignmentMismatch=()=>new u(f("Diagnostic.paramAssignmentMismatch")),e.paramTypePartiallyUnknown=()=>new u(f("Diagnostic.paramTypePartiallyUnknown")),e.parenthesizedContextManagerIllegal=()=>f("Diagnostic.parenthesizedContextManagerIllegal"),e.positionArgAfterNamedArg=()=>f("Diagnostic.positionArgAfterNamedArg"),e.positionOnlyAfterArgs=()=>f("Diagnostic.positionOnlyAfterArgs"),e.positionOnlyAfterKeywordOnly=()=>f("Diagnostic.positionOnlyAfterKeywordOnly"),e.positionOnlyIncompatible=()=>f("Diagnostic.positionOnlyIncompatible"),e.positionOnlyFirstParam=()=>f("Diagnostic.positionOnlyFirstParam"),e.privateUsedOutsideOfClass=()=>new u(f("Diagnostic.privateUsedOutsideOfClass")),e.privateUsedOutsideOfModule=()=>new u(f("Diagnostic.privateUsedOutsideOfModule")),e.propertyOverridden=()=>new u(f("Diagnostic.propertyOverridden")),e.propertyStaticMethod=()=>f("Diagnostic.propertyStaticMethod"),e.protectedUsedOutsideOfClass=()=>new u(f("Diagnostic.protectedUsedOutsideOfClass")),e.protocolBaseClass=()=>new u(f("Diagnostic.protocolBaseClass")),e.protocolIllegal=()=>f("Diagnostic.protocolIllegal"),e.protocolNotAllowedInTypeArgument=()=>f("Diagnostic.protocolNotAllowedInTypeArgument"),e.protocolUsedInCall=()=>new u(f("Diagnostic.protocolUsedInCall")),e.protocolVarianceContravariant=()=>new u(f("Diagnostic.protocolVarianceContravariant")),e.protocolVarianceCovariant=()=>new u(f("Diagnostic.protocolVarianceCovariant")),e.protocolVarianceInvariant=()=>new u(f("Diagnostic.protocolVarianceInvariant")),e.recursiveDefinition=()=>new u(f("Diagnostic.recursiveDefinition")),e.relativeImportNotAllowed=()=>f("Diagnostic.relativeImportNotAllowed"),e.requiredArgCount=()=>f("Diagnostic.requiredArgCount"),e.requiredNotInTypedDict=()=>f("Diagnostic.requiredNotInTypedDict"),e.returnMissing=()=>new u(f("Diagnostic.returnMissing")),e.returnOutsideFunction=()=>f("Diagnostic.returnOutsideFunction"),e.returnTypeContravariant=()=>f("Diagnostic.returnTypeContravariant"),e.returnTypeMismatch=()=>new u(f("Diagnostic.returnTypeMismatch")),e.returnTypeUnknown=()=>f("Diagnostic.returnTypeUnknown"),e.returnTypePartiallyUnknown=()=>new u(f("Diagnostic.returnTypePartiallyUnknown")),e.revealLocalsArgs=()=>f("Diagnostic.revealLocalsArgs"),e.revealLocalsNone=()=>f("Diagnostic.revealLocalsNone"),e.revealTypeArgs=()=>f("Diagnostic.revealTypeArgs"),e.setterGetterTypeMismatch=()=>f("Diagnostic.setterGetterTypeMismatch"),e.starPatternInAsPattern=()=>f("Diagnostic.starPatternInAsPattern"),e.starPatternInOrPattern=()=>f("Diagnostic.starPatternInOrPattern"),e.singleOverload=()=>new u(f("Diagnostic.singleOverload")),e.slotsAttributeError=()=>new u(f("Diagnostic.slotsAttributeError")),e.slotsClassVarConflict=()=>new u(f("Diagnostic.slotsClassVarConflict")),e.starStarWildcardNotAllowed=()=>f("Diagnostic.starStarWildcardNotAllowed"),e.staticClsSelfParam=()=>f("Diagnostic.staticClsSelfParam"),e.stringNonAsciiBytes=()=>f("Diagnostic.stringNonAsciiBytes"),e.stringNotSubscriptable=()=>f("Diagnostic.stringNotSubscriptable"),e.stringUnsupportedEscape=()=>f("Diagnostic.stringUnsupportedEscape"),e.stringUnterminated=()=>f("Diagnostic.stringUnterminated"),e.stubFileMissing=()=>new u(f("Diagnostic.stubFileMissing")),e.stubUsesGetAttr=()=>f("Diagnostic.stubUsesGetAttr"),e.sublistParamsIncompatible=()=>f("Diagnostic.sublistParamsIncompatible"),e.superCallArgCount=()=>f("Diagnostic.superCallArgCount"),e.superCallFirstArg=()=>new u(f("Diagnostic.superCallFirstArg")),e.superCallSecondArg=()=>new u(f("Diagnostic.superCallSecondArg")),e.superCallZeroArgForm=()=>f("Diagnostic.superCallZeroArgForm"),e.symbolIsUnbound=()=>new u(f("Diagnostic.symbolIsUnbound")),e.symbolIsUndefined=()=>new u(f("Diagnostic.symbolIsUndefined")),e.symbolIsPossiblyUnbound=()=>new u(f("Diagnostic.symbolIsPossiblyUnbound")),e.symbolOverridden=()=>new u(f("Diagnostic.symbolOverridden")),e.trailingCommaInFromImport=()=>f("Diagnostic.trailingCommaInFromImport"),e.tryWithoutExcept=()=>f("Diagnostic.tryWithoutExcept"),e.tupleInAnnotation=()=>f("Diagnostic.tupleInAnnotation"),e.tupleIndexOutOfRange=()=>new u(f("Diagnostic.tupleIndexOutOfRange")),e.tupleSizeMismatch=()=>new u(f("Diagnostic.tupleSizeMismatch")),e.typeAliasIsRecursiveDirect=()=>new u(f("Diagnostic.typeAliasIsRecursiveDirect")),e.typeAliasIsRecursiveIndirect=()=>new u(f("Diagnostic.typeAliasIsRecursiveIndirect")),e.typeAliasNotInModule=()=>f("Diagnostic.typeAliasNotInModule"),e.typeAliasRedeclared=()=>new u(f("Diagnostic.typeAliasRedeclared")),e.typeAnnotationCall=()=>f("Diagnostic.typeAnnotationCall"),e.typeAnnotationVariable=()=>f("Diagnostic.typeAnnotationVariable"),e.typeArgListNotAllowed=()=>f("Diagnostic.typeArgListNotAllowed"),e.typeArgsExpectingNone=()=>f("Diagnostic.typeArgsExpectingNone"),e.typeArgsMismatchOne=()=>new u(f("Diagnostic.typeArgsMismatchOne")),e.typeArgsMissingForAlias=()=>new u(f("Diagnostic.typeArgsMissingForAlias")),e.typeArgsMissingForClass=()=>new u(f("Diagnostic.typeArgsMissingForClass")),e.typeArgsTooFew=()=>new u(f("Diagnostic.typeArgsTooFew")),e.typeArgsTooMany=()=>new u(f("Diagnostic.typeArgsTooMany")),e.typeAssignmentMismatch=()=>new u(f("Diagnostic.typeAssignmentMismatch")),e.typeCallNotAllowed=()=>f("Diagnostic.typeCallNotAllowed"),e.typedDictAccess=()=>f("Diagnostic.typedDictAccess"),e.typedDictBadVar=()=>f("Diagnostic.typedDictBadVar"),e.typedDictBaseClass=()=>f("Diagnostic.typedDictBaseClass"),e.typedDictDelete=()=>f("Diagnostic.typedDictDelete"),e.typedDictEmptyName=()=>f("Diagnostic.typedDictEmptyName"),e.typedDictEntryName=()=>f("Diagnostic.typedDictEntryName"),e.typedDictEntryUnique=()=>f("Diagnostic.typedDictEntryUnique"),e.typedDictExtraArgs=()=>f("Diagnostic.typedDictExtraArgs"),e.typedDictFieldRedefinition=()=>new u(f("Diagnostic.typedDictFieldRedefinition")),e.typedDictFirstArg=()=>f("Diagnostic.typedDictFirstArg"),e.typedDictSecondArgDict=()=>f("Diagnostic.typedDictSecondArgDict"),e.typedDictSecondArgDictEntry=()=>f("Diagnostic.typedDictSecondArgDictEntry"),e.typedDictSet=()=>f("Diagnostic.typedDictSet"),e.typedDictTotalParam=()=>f("Diagnostic.typedDictTotalParam"),e.typeExpectedClass=()=>new u(f("Diagnostic.typeExpectedClass")),e.typeGuardArgCount=()=>f("Diagnostic.typeGuardArgCount"),e.typeNotAwaitable=()=>new u(f("Diagnostic.typeNotAwaitable")),e.typeNotCallable=()=>new u(f("Diagnostic.typeNotCallable")),e.typeNotIntantiable=()=>new u(f("Diagnostic.typeNotIntantiable")),e.typeNotIterable=()=>new u(f("Diagnostic.typeNotIterable")),e.typeNotSpecializable=()=>new u(f("Diagnostic.typeNotSpecializable")),e.typeNotSubscriptable=()=>new u(f("Diagnostic.typeNotSubscriptable")),e.typeNotUsableWith=()=>new u(f("Diagnostic.typeNotUsableWith")),e.typeNotSupportBinaryOperator=()=>new u(f("Diagnostic.typeNotSupportBinaryOperator")),e.typeNotSupportUnaryOperator=()=>new u(f("Diagnostic.typeNotSupportUnaryOperator")),e.typePartiallyUnknown=()=>new u(f("Diagnostic.typePartiallyUnknown")),e.typeUnknown=()=>new u(f("Diagnostic.typeUnknown")),e.typeVarAssignedName=()=>new u(f("Diagnostic.typeVarAssignedName")),e.typeVarAssignmentMismatch=()=>new u(f("Diagnostic.typeVarAssignmentMismatch")),e.typeVarBoundAndConstrained=()=>f("Diagnostic.typeVarBoundAndConstrained"),e.typeVarFirstArg=()=>f("Diagnostic.typeVarFirstArg"),e.typeVarGeneric=()=>f("Diagnostic.typeVarGeneric"),e.typeVarNoMember=()=>new u(f("Diagnostic.typeVarNoMember")),e.typeVarNotSubscriptable=()=>new u(f("Diagnostic.typeVarNotSubscriptable")),e.typeVarNotUsedByOuterScope=()=>new u(f("Diagnostic.typeVarNotUsedByOuterScope")),e.typeVarSingleConstraint=()=>f("Diagnostic.typeVarSingleConstraint"),e.typeVarsNotInGeneric=()=>f("Diagnostic.typeVarsNotInGeneric"),e.typeVarTupleContext=()=>f("Diagnostic.typeVarTupleContext"),e.typeVarUnknownParam=()=>new u(f("Diagnostic.typeVarUnknownParam")),e.typeVarUsedByOuterScope=()=>new u(f("Diagnostic.typeVarUsedByOuterScope")),e.typeVarUsedOnlyOnce=()=>new u(f("Diagnostic.typeVarUsedOnlyOnce")),e.typeVarVariance=()=>f("Diagnostic.typeVarVariance"),e.unaccessedClass=()=>new u(f("Diagnostic.unaccessedClass")),e.unaccessedFunction=()=>new u(f("Diagnostic.unaccessedFunction")),e.unaccessedImport=()=>new u(f("Diagnostic.unaccessedImport")),e.unaccessedSymbol=()=>new u(f("Diagnostic.unaccessedSymbol")),e.unaccessedVariable=()=>new u(f("Diagnostic.unaccessedVariable")),e.unexpectedAsyncToken=()=>f("Diagnostic.unexpectedAsyncToken"),e.unexpectedExprToken=()=>f("Diagnostic.unexpectedExprToken"),e.unexpectedIndent=()=>f("Diagnostic.unexpectedIndent"),e.unexpectedUnindent=()=>f("Diagnostic.unexpectedUnindent"),e.unionSyntaxIllegal=()=>f("Diagnostic.unionSyntaxIllegal"),e.uninitializedInstanceVariable=()=>new u(f("Diagnostic.uninitializedInstanceVariable")),e.unnecessaryCast=()=>new u(f("Diagnostic.unnecessaryCast")),e.unnecessaryIsInstanceAlways=()=>new u(f("Diagnostic.unnecessaryIsInstanceAlways")),e.unnecessaryIsSubclassAlways=()=>new u(f("Diagnostic.unnecessaryIsSubclassAlways")),e.unpackArgCount=()=>f("Diagnostic.unpackArgCount"),e.unpackedArgInTypeArgument=()=>f("Diagnostic.unpackedArgInTypeArgument"),e.unpackedArgWithVariadicParam=()=>f("Diagnostic.unpackedArgWithVariadicParam"),e.unpackedDictArgumentNotMapping=()=>f("Diagnostic.unpackedDictArgumentNotMapping"),e.unpackedSubscriptIllegal=()=>f("Diagnostic.unpackedSubscriptIllegal"),e.unpackedTypedDictArgument=()=>f("Diagnostic.unpackedTypedDictArgument"),e.unpackedTypeVarTupleExpected=()=>new u(f("Diagnostic.unpackedTypeVarTupleExpected")),e.unpackExpectedTypeVarTuple=()=>f("Diagnostic.unpackExpectedTypeVarTuple"),e.unpackIllegalInComprehension=()=>f("Diagnostic.unpackIllegalInComprehension"),e.unpackInDict=()=>f("Diagnostic.unpackInDict"),e.unpackInSet=()=>f("Diagnostic.unpackInSet"),e.unpackNotAllowed=()=>f("Diagnostic.unpackNotAllowed"),e.unpackTuplesIllegal=()=>f("Diagnostic.unpackTuplesIllegal"),e.unreachableCode=()=>f("Diagnostic.unreachableCode"),e.unsupportedDunderAllOperation=()=>f("Diagnostic.unsupportedDunderAllOperation"),e.unusedCallResult=()=>new u(f("Diagnostic.unusedCallResult")),e.unusedCoroutine=()=>f("Diagnostic.unusedCoroutine"),e.varAnnotationIllegal=()=>f("Diagnostic.varAnnotationIllegal"),e.variadicTypeArgsTooMany=()=>f("Diagnostic.variadicTypeArgsTooMany"),e.variadicTypeParamTooManyAlias=()=>new u(f("Diagnostic.variadicTypeParamTooManyAlias")),e.variadicTypeParamTooManyClass=()=>new u(f("Diagnostic.variadicTypeParamTooManyClass")),e.walrusIllegal=()=>f("Diagnostic.walrusIllegal"),e.walrusNotAllowed=()=>f("Diagnostic.walrusNotAllowed"),e.wildcardInFunction=()=>f("Diagnostic.wildcardInFunction"),e.wildcardLibraryImport=()=>f("Diagnostic.wildcardLibraryImport"),e.yieldFromIllegal=()=>f("Diagnostic.yieldFromIllegal"),e.yieldFromOutsideAsync=()=>f("Diagnostic.yieldFromOutsideAsync"),e.yieldOutsideFunction=()=>f("Diagnostic.yieldOutsideFunction"),e.yieldTypeMismatch=()=>new u(f("Diagnostic.yieldTypeMismatch")),e.yieldWithinListCompr=()=>f("Diagnostic.yieldWithinListCompr"),e.zeroCaseStatementsFound=()=>f("Diagnostic.zeroCaseStatementsFound"),e.zeroLengthTupleNotAllowed=()=>f("Diagnostic.zeroLengthTupleNotAllowed")}(t=e.Diagnostic||(e.Diagnostic={})),function(e){e.argParam=()=>new u(f("DiagnosticAddendum.argParam")),e.argParamFunction=()=>new u(f("DiagnosticAddendum.argParamFunction")),e.argsParamMissing=()=>new u(f("DiagnosticAddendum.argsParamMissing")),e.argsParamWithVariadic=()=>new u(f("DiagnosticAddendum.argsParamWithVariadic")),e.argumentType=()=>new u(f("DiagnosticAddendum.argumentType")),e.argumentTypes=()=>new u(f("DiagnosticAddendum.argumentTypes")),e.assignToNone=()=>f("DiagnosticAddendum.assignToNone"),e.asyncHelp=()=>f("DiagnosticAddendum.asyncHelp"),e.dataclassFrozen=()=>new u(f("DiagnosticAddendum.dataclassFrozen")),e.finalMethod=()=>f("DiagnosticAddendum.finalMethod"),e.functionParamName=()=>new u(f("DiagnosticAddendum.functionParamName")),e.functionReturnTypeMismatch=()=>new u(f("DiagnosticAddendum.functionReturnTypeMismatch")),e.functionTooFewParams=()=>new u(f("DiagnosticAddendum.functionTooFewParams")),e.incompatibleGetter=()=>f("DiagnosticAddendum.incompatibleGetter"),e.incompatibleSetter=()=>f("DiagnosticAddendum.incompatibleSetter"),e.incompatibleDeleter=()=>f("DiagnosticAddendum.incompatibleDeleter"),e.functionTooManyParams=()=>new u(f("DiagnosticAddendum.functionTooManyParams")),e.keyNotRequired=()=>new u(f("DiagnosticAddendum.keyNotRequired")),e.keyRequiredDeleted=()=>new u(f("DiagnosticAddendum.keyRequiredDeleted")),e.keyUndefined=()=>new u(f("DiagnosticAddendum.keyUndefined")),e.kwargsParamMissing=()=>new u(f("DiagnosticAddendum.kwargsParamMissing")),e.literalAssignmentMismatch=()=>new u(f("DiagnosticAddendum.literalAssignmentMismatch")),e.memberAssignment=()=>new u(f("DiagnosticAddendum.memberAssignment")),e.memberIsAbstract=()=>new u(f("DiagnosticAddendum.memberIsAbstract")),e.memberIsAbstractMore=()=>new u(f("DiagnosticAddendum.memberIsAbstractMore")),e.memberIsFinalInProtocol=()=>new u(f("DiagnosticAddendum.memberIsFinalInProtocol")),e.memberIsNotFinalInProtocol=()=>new u(f("DiagnosticAddendum.memberIsNotFinalInProtocol")),e.memberSetClassVar=()=>new u(f("DiagnosticAddendum.memberSetClassVar")),e.memberTypeMismatch=()=>new u(f("DiagnosticAddendum.memberTypeMismatch")),e.memberUnknown=()=>new u(f("DiagnosticAddendum.memberUnknown")),e.missingGetter=()=>f("DiagnosticAddendum.missingGetter"),e.missingSetter=()=>f("DiagnosticAddendum.missingSetter"),e.missingDeleter=()=>f("DiagnosticAddendum.missingDeleter"),e.namedParamMissingInDest=()=>new u(f("DiagnosticAddendum.namedParamMissingInDest")),e.namedParamMissingInSource=()=>new u(f("DiagnosticAddendum.namedParamMissingInSource")),e.namedParamTypeMismatch=()=>new u(f("DiagnosticAddendum.namedParamTypeMismatch")),e.noOverloadAssignable=()=>new u(f("DiagnosticAddendum.noOverloadAssignable")),e.orPatternMissingName=()=>new u(f("DiagnosticAddendum.orPatternMissingName")),e.overloadMethod=()=>f("DiagnosticAddendum.overloadMethod"),e.overloadNotAssignable=()=>new u(f("DiagnosticAddendum.overloadNotAssignable")),e.overloadTooManyUnions=()=>f("DiagnosticAddendum.overloadTooManyUnions"),e.overloadWithImplementation=()=>f("DiagnosticAddendum.overloadWithImplementation"),e.overriddenMethod=()=>f("DiagnosticAddendum.overriddenMethod"),e.overriddenSymbol=()=>f("DiagnosticAddendum.overriddenSymbol"),e.overrideParamCount=()=>new u(f("DiagnosticAddendum.overrideParamCount")),e.overrideParamName=()=>new u(f("DiagnosticAddendum.overrideParamName")),e.overrideParamType=()=>new u(f("DiagnosticAddendum.overrideParamType")),e.overrideReturnType=()=>new u(f("DiagnosticAddendum.overrideReturnType")),e.overrideType=()=>new u(f("DiagnosticAddendum.overrideType")),e.paramAssignment=()=>new u(f("DiagnosticAddendum.paramAssignment")),e.paramSpecOverload=()=>f("DiagnosticAddendum.paramSpecOverload"),e.paramType=()=>new u(f("DiagnosticAddendum.paramType")),e.propertyMethodIncompatible=()=>new u(f("DiagnosticAddendum.propertyMethodIncompatible")),e.propertyMethodMissing=()=>new u(f("DiagnosticAddendum.propertyMethodMissing")),e.propertyMissingDeleter=()=>new u(f("DiagnosticAddendum.propertyMissingDeleter")),e.propertyMissingSetter=()=>new u(f("DiagnosticAddendum.propertyMissingSetter")),e.protocolMemberClassVar=()=>new u(f("DiagnosticAddendum.protocolMemberClassVar")),e.protocolMemberMissing=()=>new u(f("DiagnosticAddendum.protocolMemberMissing")),e.seeDeclaration=()=>f("DiagnosticAddendum.seeDeclaration"),e.seeClassDeclaration=()=>f("DiagnosticAddendum.seeClassDeclaration"),e.seeFunctionDeclaration=()=>f("DiagnosticAddendum.seeFunctionDeclaration"),e.seeMethodDeclaration=()=>f("DiagnosticAddendum.seeMethodDeclaration"),e.seeParameterDeclaration=()=>f("DiagnosticAddendum.seeParameterDeclaration"),e.seeVariableDeclaration=()=>f("DiagnosticAddendum.seeVariableDeclaration"),e.tupleEntryTypeMismatch=()=>new u(f("DiagnosticAddendum.tupleEntryTypeMismatch")),e.tupleSizeMismatch=()=>new u(f("DiagnosticAddendum.tupleSizeMismatch")),e.tupleSizeMismatchIndeterminate=()=>new u(f("DiagnosticAddendum.tupleSizeMismatchIndeterminate")),e.typeAssignmentMismatch=()=>new u(f("DiagnosticAddendum.typeAssignmentMismatch")),e.typeBound=()=>new u(f("DiagnosticAddendum.typeBound")),e.typeConstrainedTypeVar=()=>new u(f("DiagnosticAddendum.typeConstrainedTypeVar")),e.typedDictFieldMissing=()=>new u(f("DiagnosticAddendum.typedDictFieldMissing")),e.typedDictFieldNotRequired=()=>new u(f("DiagnosticAddendum.typedDictFieldNotRequired")),e.typedDictFieldRedefinition=()=>new u(f("DiagnosticAddendum.typedDictFieldRedefinition")),e.typedDictFieldRequired=()=>new u(f("DiagnosticAddendum.typedDictFieldRequired")),e.typedDictFieldTypeMismatch=()=>new u(f("DiagnosticAddendum.typedDictFieldTypeMismatch")),e.typedDictFieldUndefined=()=>new u(f("DiagnosticAddendum.typedDictFieldUndefined")),e.typeIncompatible=()=>new u(f("DiagnosticAddendum.typeIncompatible")),e.typeNotCallable=()=>new u(f("DiagnosticAddendum.typeNotCallable")),e.typeNotClass=()=>new u(f("DiagnosticAddendum.typeNotClass")),e.typeParamSpec=()=>new u(f("DiagnosticAddendum.typeParamSpec")),e.typeNotStringLiteral=()=>new u(f("DiagnosticAddendum.typeNotStringLiteral")),e.typeOfSymbol=()=>new u(f("DiagnosticAddendum.typeOfSymbol")),e.typeUnsupported=()=>new u(f("DiagnosticAddendum.typeUnsupported")),e.typeVarIsContravariant=()=>new u(f("DiagnosticAddendum.typeVarIsContravariant")),e.typeVarIsCovariant=()=>new u(f("DiagnosticAddendum.typeVarIsCovariant")),e.typeVarIsInvariant=()=>new u(f("DiagnosticAddendum.typeVarIsInvariant")),e.typeVarTupleRequiresKnownLength=()=>f("DiagnosticAddendum.typeVarTupleRequiresKnownLength"),e.typeVarNotAllowed=()=>f("DiagnosticAddendum.typeVarNotAllowed"),e.typeVarsMissing=()=>new u(f("DiagnosticAddendum.typeVarsMissing")),e.useDictInstead=()=>f("DiagnosticAddendum.useDictInstead"),e.useListInstead=()=>f("DiagnosticAddendum.useListInstead"),e.useTupleInstead=()=>f("DiagnosticAddendum.useTupleInstead"),e.useTypeInstead=()=>f("DiagnosticAddendum.useTypeInstead")}(n=e.DiagnosticAddendum||(e.DiagnosticAddendum={})),function(e){e.addOptionalToAnnotation=()=>f("CodeAction.addOptionalToAnnotation"),e.createTypeStub=()=>f("CodeAction.createTypeStub"),e.createTypeStubFor=()=>new u(f("CodeAction.createTypeStubFor")),e.executingCommand=()=>f("CodeAction.executingCommand"),e.filesToAnalyzeOne=()=>f("CodeAction.filesToAnalyzeOne"),e.filesToAnalyzeCount=()=>new u(f("CodeAction.filesToAnalyzeCount")),e.findingReferences=()=>f("CodeAction.findingReferences"),e.organizeImports=()=>f("CodeAction.organizeImports")}(i=e.CodeAction||(e.CodeAction={}))}(t.Localizer||(t.Localizer={}))},83108:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getConnectionOptions=t.run=void 0;const i=n(9283),s=n(65013),r=n(68384);function a(){return{cancellationStrategy:r.getCancellationStrategyFromArgv(process.argv)}}t.run=function(e,t){n(6553).install(),s.isMainThread?e(i.createConnection(a())):t()},t.getConnectionOptions=a},19794:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterStream=void 0;const i=n(49900);t.CharacterStream=class{constructor(e){this._text=e,this._position=0,this._currentChar=e.length>0?e.charCodeAt(0):0,this._isEndOfStream=0===e.length}getText(){return this._text}get position(){return this._position}set position(e){this._position=e,this._checkBounds()}get currentChar(){return this._currentChar}getCurrentChar(){return this._currentChar}get nextChar(){return this.position+1=0?this._text.charCodeAt(this.position-1):0}isEndOfStream(){return this._isEndOfStream}lookAhead(e){const t=this._position+e;return t<0||t>=this._text.length?0:this._text.charCodeAt(t)}advance(e){this.position+=e}moveNext(){return this._position=this._text.length,this._isEndOfStream&&(this._position=this._text.length),this._currentChar=this._isEndOfStream?0:this._text.charCodeAt(this._position)}}},49900:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isBinary=t.isOctal=t.isHex=t.isDecimal=t.isNumber=t.isLineBreak=t.isWhiteSpace=t.isSurrogateChar=t.isIdentifierChar=t.isIdentifierStartChar=void 0;const a=r(n(52846));var o;!function(e){e[e.NotIdentifierChar=0]="NotIdentifierChar",e[e.StartIdentifierChar=1]="StartIdentifierChar",e[e.IdentifierChar=2]="IdentifierChar",e[e.SurrogateChar=3]="SurrogateChar"}(o||(o={}));const l=256,c=new Array(l),p={},d={};let u=!1;function h(e){return e>=48&&e<=57||95===e}function m(e,t){if(p[e]!==o.SurrogateChar)return o.NotIdentifierChar;const n=d[e];return n?n[t]:o.NotIdentifierChar}t.isIdentifierStartChar=function(e,t){if(e=48&&e<=57||95===e},t.isDecimal=h,t.isHex=function(e){return h(e)||e>=97&&e<=102||e>=65&&e<=70||95===e},t.isOctal=function(e){return e>=48&&e<=55||95===e},t.isBinary=function(e){return 48===e||49===e||95===e};const y=[[95,6277,6278,8472,8494,12443,12444],a.unicodeLu,a.unicodeLl,a.unicodeLt,a.unicodeLo,a.unicodeLm,a.unicodeNl],g=[a.unicodeLuSurrogate,a.unicodeLlSurrogate,a.unicodeLoSurrogate,a.unicodeLmSurrogate,a.unicodeNlSurrogate],f=[[183,903,4969,4970,4971,4972,4973,4974,4975,4976,4977,6618],a.unicodeMn,a.unicodeMc,a.unicodeNd,a.unicodePc],T=[a.unicodeMnSurrogate,a.unicodeMcSurrogate,a.unicodeNdSurrogate];function _(e,t,n,i,s){for(let r=0;r=l)break}}function v(e,t){for(const n in e)d[n]||(d[n]={},p[n]=o.SurrogateChar),_(e[n],t,!1,d[n],d[n])}function b(e){if(c.fill(o.NotIdentifierChar),f.forEach((t=>{_(t,o.IdentifierChar,e,c,p)})),y.forEach((t=>{_(t,o.StartIdentifierChar,e,c,p)})),!e){for(const e of T)v(e,o.IdentifierChar);for(const e of g)v(e,o.StartIdentifierChar)}}b(!0)},55390:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SetNode=t.DictionaryExpandEntryNode=t.DictionaryKeyEntryNode=t.DictionaryNode=t.StringListNode=t.FormatStringNode=t.StringNode=t.NumberNode=t.EllipsisNode=t.ConstantNode=t.NameNode=t.LambdaNode=t.MemberAccessNode=t.YieldFromNode=t.YieldNode=t.SliceNode=t.IndexNode=t.ListComprehensionNode=t.CallNode=t.TupleNode=t.UnpackNode=t.TernaryNode=t.AwaitNode=t.AugmentedAssignmentNode=t.FunctionAnnotationNode=t.TypeAnnotationNode=t.AssignmentNode=t.AssignmentExpressionNode=t.BinaryOperationNode=t.UnaryOperationNode=t.ErrorNode=t.isExpressionNode=t.StatementListNode=t.DecoratorNode=t.WithItemNode=t.WithNode=t.ClassNode=t.ParameterNode=t.FunctionNode=t.ExceptNode=t.TryNode=t.ListComprehensionIfNode=t.ListComprehensionForNode=t.ForNode=t.WhileNode=t.IfNode=t.SuiteNode=t.ModuleNode=t.extendRange=t.getNextNodeId=void 0,t.PatternValueNode=t.PatternMappingExpandEntryNode=t.PatternMappingKeyEntryNode=t.PatternMappingNode=t.PatternCaptureNode=t.PatternClassArgumentNode=t.PatternClassNode=t.PatternLiteralNode=t.PatternAsNode=t.PatternSequenceNode=t.CaseNode=t.MatchNode=t.RaiseNode=t.ReturnNode=t.ContinueNode=t.BreakNode=t.AssertNode=t.NonlocalNode=t.GlobalNode=t.ImportFromAsNode=t.ImportFromNode=t.ImportAsNode=t.ModuleNameNode=t.ImportNode=t.PassNode=t.DelNode=t.ArgumentNode=t.ListNode=void 0;const i=n(80957);let s=1;function r(e,t){t.starti.TextRange.getEnd(e)&&(e.length=i.TextRange.getEnd(t)-e.start)}t.getNextNodeId=function(){return s++},t.extendRange=r,function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:36,id:s++,statements:[]}}}(t.ModuleNode||(t.ModuleNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:50,id:s++,statements:[]}}}(t.SuiteNode||(t.SuiteNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:19,id:s++,testExpression:t,ifSuite:n,elseSuite:i};return t.parent=a,n.parent=a,r(a,t),r(a,n),i&&(r(a,i),i.parent=a),a}}(t.IfNode||(t.IfNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:57,id:s++,testExpression:t,whileSuite:n};return t.parent=i,n.parent=i,r(i,n),i}}(t.WhileNode||(t.WhileNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:26,id:s++,targetExpression:t,iterableExpression:n,forSuite:i};return t.parent=a,n.parent=a,i.parent=a,r(a,i),a}}(t.ForNode||(t.ForNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:33,id:s++,targetExpression:t,iterableExpression:n};return t.parent=i,n.parent=i,r(i,t),r(i,n),i}}(t.ListComprehensionForNode||(t.ListComprehensionForNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:34,id:s++,testExpression:t};return t.parent=n,r(n,t),n}}(t.ListComprehensionIfNode||(t.ListComprehensionIfNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:53,id:s++,trySuite:t,exceptClauses:[]};return t.parent=n,r(n,t),n}}(t.TryNode||(t.TryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:25,id:s++,exceptSuite:t};return t.parent=n,r(n,t),n}}(t.ExceptNode||(t.ExceptNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:28,id:s++,decorators:[],name:t,parameters:[],suite:n};return t.parent=i,n.parent=i,r(i,n),i}}(t.FunctionNode||(t.FunctionNode={})),function(e){e.create=function(e,t){return{start:e.start,length:e.length,nodeType:41,id:s++,category:t}}}(t.ParameterNode||(t.ParameterNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:10,id:s++,decorators:[],name:t,arguments:[],suite:n};return t.parent=i,n.parent=i,r(i,n),i},e.createDummyForDecorators=function(e){const t={start:0,length:0,nodeType:10,id:s++,decorators:e,name:{start:0,length:0,id:0,nodeType:38,token:{type:7,start:0,length:0,comments:[],value:""},value:""},arguments:[],suite:{start:0,length:0,id:0,nodeType:50,statements:[]}};return e.forEach((e=>{e.parent=t,r(t,e)})),t.name.parent=t,t.suite.parent=t,t}}(t.ClassNode||(t.ClassNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:58,id:s++,withItems:[],suite:t};return t.parent=n,r(n,t),n}}(t.WithNode||(t.WithNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:59,id:s++,expression:e};return e.parent=t,t}}(t.WithItemNode||(t.WithItemNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:13,id:s++,expression:t};return t.parent=n,r(n,t),n}}(t.DecoratorNode||(t.DecoratorNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:47,id:s++,statements:[]}}}(t.StatementListNode||(t.StatementListNode={})),t.isExpressionNode=function(e){switch(e.nodeType){case 0:case 55:case 7:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 24:case 46:case 60:case 61:case 35:case 30:case 38:case 11:case 18:case 40:case 49:case 27:case 48:case 15:case 16:case 31:case 45:return!0;default:return!1}},function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:0,id:s++,category:t,child:n,decorators:i};return n&&(n.parent=a,r(a,n)),i&&(i.forEach((e=>{e.parent=a})),i.length>0&&r(a,i[0])),a}}(t.ErrorNode||(t.ErrorNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:55,id:s++,operator:n,operatorToken:e,expression:t};return t.parent=i,r(i,t),i}}(t.UnaryOperationNode||(t.UnaryOperationNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:7,id:s++,leftExpression:e,operatorToken:n,operator:i,rightExpression:t};return e.parent=a,t.parent=a,r(a,t),a}}(t.BinaryOperationNode||(t.BinaryOperationNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:4,id:s++,name:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.AssignmentExpressionNode||(t.AssignmentExpressionNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:3,id:s++,leftExpression:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.AssignmentNode||(t.AssignmentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:54,id:s++,valueExpression:e,typeAnnotation:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.TypeAnnotationNode||(t.TypeAnnotationNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:62,id:s++,isParamListEllipsis:t,paramTypeAnnotations:n,returnTypeAnnotation:i};return n.forEach((e=>{e.parent=a})),i.parent=a,r(a,i),a}}(t.FunctionAnnotationNode||(t.FunctionAnnotationNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:5,id:s++,leftExpression:e,operator:n,rightExpression:t,destExpression:i};return e.parent=a,t.parent=a,i.parent=a,r(a,t),a}}(t.AugmentedAssignmentNode||(t.AugmentedAssignmentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:6,id:s++,expression:t};return t.parent=n,r(n,t),n}}(t.AwaitNode||(t.AwaitNode={})),function(e){e.create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:51,id:s++,ifExpression:e,testExpression:t,elseExpression:n};return e.parent=i,t.parent=i,n.parent=i,r(i,n),i}}(t.TernaryNode||(t.TernaryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:56,id:s++,expression:t};return t.parent=n,r(n,t),n}}(t.UnpackNode||(t.UnpackNode={})),function(e){e.create=function(e,t){return{start:e.start,length:e.length,nodeType:52,id:s++,expressions:[],enclosedInParens:t}}}(t.TupleNode||(t.TupleNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:9,id:s++,leftExpression:e,arguments:[]};return e.parent=t,t}}(t.CallNode||(t.CallNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:32,id:s++,expression:e,comprehensions:[]};return e.parent=t,t}}(t.ListComprehensionNode||(t.ListComprehensionNode={})),function(e){e.create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:24,id:s++,baseExpression:e,items:t,trailingComma:n};return e.parent=a,t.forEach((e=>{e.parent=a})),r(a,i),a}}(t.IndexNode||(t.IndexNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:46,id:s++}}}(t.SliceNode||(t.SliceNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:60,id:s++,expression:t};return t&&(t.parent=n,r(n,t)),n}}(t.YieldNode||(t.YieldNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:61,id:s++,expression:t};return t.parent=n,r(n,t),n}}(t.YieldFromNode||(t.YieldFromNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:35,id:s++,leftExpression:e,memberName:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.MemberAccessNode||(t.MemberAccessNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:30,id:s++,parameters:[],expression:t};return t.parent=n,r(n,t),n}}(t.LambdaNode||(t.LambdaNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:38,id:s++,token:e,value:e.value}}}(t.NameNode||(t.NameNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:11,id:s++,constType:e.keywordType}}}(t.ConstantNode||(t.ConstantNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:18,id:s++}}}(t.EllipsisNode||(t.EllipsisNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:40,id:s++,value:e.value,isInteger:e.isInteger,isImaginary:e.isImaginary}}}(t.NumberNode||(t.NumberNode={})),function(e){e.create=function(e,t,n){return{start:e.start,length:e.length,nodeType:49,id:s++,token:e,value:t,hasUnescapeErrors:n}}}(t.StringNode||(t.StringNode={})),function(e){e.create=function(e,t,n,i){const r={start:e.start,length:e.length,nodeType:27,id:s++,token:e,value:t,hasUnescapeErrors:n,expressions:i};return i.forEach((e=>{e.parent=r})),r}}(t.FormatStringNode||(t.FormatStringNode={})),function(e){e.create=function(e){const t={start:e[0].start,length:e[0].length,nodeType:48,id:s++,strings:e};return e.length>0&&(e.forEach((e=>{e.parent=t})),r(t,e[e.length-1])),t}}(t.StringListNode||(t.StringListNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:15,id:s++,entries:[]}}}(t.DictionaryNode||(t.DictionaryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:17,id:s++,keyExpression:e,valueExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.DictionaryKeyEntryNode||(t.DictionaryKeyEntryNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:16,id:s++,expandExpression:e};return e.parent=t,t}}(t.DictionaryExpandEntryNode||(t.DictionaryExpandEntryNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:45,id:s++,entries:[]}}}(t.SetNode||(t.SetNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:31,id:s++,entries:[]}}}(t.ListNode||(t.ListNode={})),function(e){e.create=function(e,t,n){const i={start:e?e.start:t.start,length:e?e.length:t.length,nodeType:1,id:s++,valueExpression:t,argumentCategory:n};return t.parent=i,r(i,t),i}}(t.ArgumentNode||(t.ArgumentNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:14,id:s++,expressions:[]}}}(t.DelNode||(t.DelNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:42,id:s++}}}(t.PassNode||(t.PassNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:20,id:s++,list:[]}}}(t.ImportNode||(t.ImportNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:37,id:s++,leadingDots:0,nameParts:[]}}}(t.ModuleNameNode||(t.ModuleNameNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:21,id:s++,module:e};return e.parent=t,t}}(t.ImportAsNode||(t.ImportAsNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:22,id:s++,module:t,imports:[],isWildcardImport:!1,usesParens:!1};return t.parent=n,r(n,t),n}}(t.ImportFromNode||(t.ImportFromNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:23,id:s++,name:e};return e.parent=t,t}}(t.ImportFromAsNode||(t.ImportFromAsNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:29,id:s++,nameList:[]}}}(t.GlobalNode||(t.GlobalNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:39,id:s++,nameList:[]}}}(t.NonlocalNode||(t.NonlocalNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:2,id:s++,testExpression:t};return t.parent=n,r(n,t),n}}(t.AssertNode||(t.AssertNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:8,id:s++}}}(t.BreakNode||(t.BreakNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:12,id:s++}}}(t.ContinueNode||(t.ContinueNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:44,id:s++}}}(t.ReturnNode||(t.ReturnNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:43,id:s++}}}(t.RaiseNode||(t.RaiseNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:63,id:s++,subjectExpression:t,cases:[]};return t.parent=n,r(n,t),n}}(t.MatchNode||(t.MatchNode={})),function(e){e.create=function(e,t,n,i,a){const o={start:e.start,length:e.length,nodeType:64,id:s++,pattern:t,isIrrefutable:n,guardExpression:i,suite:a};return r(o,a),t.parent=o,a.parent=o,i&&(i.parent=o),o}}(t.CaseNode||(t.CaseNode={})),function(e){e.create=function(e,t){const n=t.findIndex((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar)),i={start:e.start,length:e.length,nodeType:65,id:s++,entries:t,starEntryIndex:n>=0?n:void 0};return t.length>0&&r(i,t[t.length-1]),t.forEach((e=>{e.parent=i})),i}}(t.PatternSequenceNode||(t.PatternSequenceNode={})),function(e){e.create=function(e,t){const n={start:e[0].start,length:e[0].length,nodeType:66,id:s++,orPatterns:e,target:t};return e.length>1&&r(n,e[e.length-1]),e.forEach((e=>{e.parent=n})),t&&(r(n,t),t.parent=n),n}}(t.PatternAsNode||(t.PatternAsNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:67,id:s++,expression:e};return e.parent=t,t}}(t.PatternLiteralNode||(t.PatternLiteralNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:68,id:s++,className:e,arguments:t};return e.parent=n,t.forEach((e=>{e.parent=n})),t.length>0&&r(n,t[t.length-1]),n}}(t.PatternClassNode||(t.PatternClassNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:74,id:s++,pattern:e,name:t};return e.parent=n,t&&(r(n,t),t.parent=n),n}}(t.PatternClassArgumentNode||(t.PatternClassArgumentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:69,id:s++,target:e,isStar:void 0!==t,isWildcard:"_"===e.value};return e.parent=n,t&&r(n,t),n}}(t.PatternCaptureNode||(t.PatternCaptureNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:70,id:s++,entries:t};return t.length>0&&r(n,t[t.length-1]),t.forEach((e=>{e.parent=n})),n}}(t.PatternMappingNode||(t.PatternMappingNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:71,id:s++,keyPattern:e,valuePattern:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.PatternMappingKeyEntryNode||(t.PatternMappingKeyEntryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:72,id:s++,target:t};return t.parent=n,r(n,t),n}}(t.PatternMappingExpandEntryNode||(t.PatternMappingExpandEntryNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:73,id:s++,expression:e};return e.parent=t,t}}(t.PatternValueNode||(t.PatternValueNode={}))},14014:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=t.ParseOptions=void 0;const a=n(20823),o=n(24319),l=n(85036),c=n(28348),p=n(57485),d=n(76962),u=n(74426),h=n(55390),m=r(n(78722)),y=n(7280),g=n(66945);class f{constructor(){this.isStubFile=!1,this.pythonVersion=p.latestStablePythonVersion,this.reportInvalidStringEscapeSequence=!1,this.skipFunctionAndClassBody=!1}}t.ParseOptions=f;class T{constructor(){this._tokenIndex=0,this._areErrorsSuppressed=!1,this._parseOptions=new f,this._diagSink=new l.DiagnosticSink,this._isInLoop=!1,this._isInFunction=!1,this._isInFinally=!1,this._isParsingTypeAnnotation=!1,this._isParsingIndexTrailer=!1,this._futureImportMap=new Map,this._importedModules=[],this._containsWildcardImport=!1,this._assignmentExpressionsAllowed=!0,this._typingImportAliases=[],this._typingSymbolAliases=new Map}parseSourceFile(e,t,n){d.timingStats.tokenizeFileTime.timeOperation((()=>{this._startNewParse(e,0,e.length,t,n)}));const i=h.ModuleNode.create({start:0,length:e.length});return d.timingStats.parseFileTime.timeOperation((()=>{for(;!this._atEof();)if(!this._consumeTokenIfType(2)){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseStatement();t?(t.parent=i,i.statements.push(t)):this._consumeTokensUntilType([2])}})),a.assert(void 0!==this._tokenizerOutput),{text:e,parseTree:i,importedModules:this._importedModules,futureImports:this._futureImportMap,tokenizerOutput:this._tokenizerOutput,containsWildcardImport:this._containsWildcardImport}}parseTextExpression(e,t,n,i,s=0,r=0){const a=new l.DiagnosticSink;let o;if(this._startNewParse(e,t,n,i,a,r),1===s)o=this._parseTypeAnnotation();else if(2===s)o=this._parseFunctionTypeAnnotation();else{const e=this._parseTestOrStarExpressionList(!1);e.parseError?o=e.parseError:(0===e.list.length&&this._addError(u.Localizer.Diagnostic.expectedExpr(),this._peekToken()),o=this._makeExpressionOrTuple(e,!1))}return 2===this._peekTokenType()&&this._getNextToken(),this._atEof()||this._addError(u.Localizer.Diagnostic.unexpectedExprToken(),this._peekToken()),{parseTree:o,lines:this._tokenizerOutput.lines,diagnostics:a.fetchAndClear()}}_startNewParse(e,t,n,i,s,r=0){this._fileContents=e,this._parseOptions=i,this._diagSink=s;const a=new y.Tokenizer;this._tokenizerOutput=a.tokenize(e,t,n,r),this._tokenIndex=0}_parseStatement(){switch(this._consumeTokenIfType(4)&&this._addError(u.Localizer.Diagnostic.unexpectedUnindent(),this._peekToken()),this._peekKeywordType()){case 20:return this._parseIfStatement();case 35:return this._parseWhileStatement();case 17:return this._parseForStatement();case 34:return this._parseTryStatement();case 36:return this._parseWithStatement();case 10:return this._parseFunctionDef();case 7:return this._parseClassDef();case 3:return this._parseAsyncStatement();case 25:{const e=this._peekToken(1);let t=!1;if(10===e.type||11===e.type||12===e.type||20===e.type||2===e.type||1===e.type)t=!0;else if(9===e.type){const n=e;26!==n.operatorType&&33!==n.operatorType&&(t=!0)}if(!t){const e=this._parseMatchStatement();if(e)return e}}}return 22===this._peekOperatorType()?this._parseDecorated():this._parseSimpleStatement()}_parseAsyncStatement(){const e=this._getKeywordToken(3);switch(this._peekKeywordType()){case 10:return this._parseFunctionDef(e);case 36:return this._parseWithStatement(e);case 17:return this._parseForStatement(e)}this._addError(u.Localizer.Diagnostic.unexpectedAsyncToken(),e)}_parseMatchStatement(){const e=this._getKeywordToken(25);let t=!1;if(this._suppressErrors((()=>{const e=this._tokenIndex;this._parseTestOrStarListAsExpression(!0,12,u.Localizer.Diagnostic.expectedReturnExpr()),t=10===this._peekToken().type,this._tokenIndex=e})),!t)return;const n=this._parseTestOrStarListAsExpression(!0,12,u.Localizer.Diagnostic.expectedReturnExpr()),i=h.MatchNode.create(e,n),s=this._peekToken();if(this._consumeTokenIfType(10))if(this._consumeTokenIfType(2)){const t=this._peekToken();if(this._consumeTokenIfType(3)){const e=t;e.isIndentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),e)}else this._addError(u.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseCaseStatement();t?(t.parent=i,i.cases.push(t)):this._consumeTokensUntilType([2,10])&&this._getNextToken();const n=this._peekToken();if(this._consumeTokenIfType(4)){n.matchesIndent||this._addError(u.Localizer.Diagnostic.inconsistentIndent(),n);break}if(1===this._peekTokenType())break}i.cases.length>0?h.extendRange(i,i.cases[i.cases.length-1]):this._addError(u.Localizer.Diagnostic.zeroCaseStatementsFound(),e)}else this._addError(u.Localizer.Diagnostic.expectedNewline(),s);else this._addError(u.Localizer.Diagnostic.expectedColon(),s),this._consumeTokensUntilType([2,10])&&this._getNextToken();this._getLanguageVersion()this._isPatternIrrefutable(e)))}_getPatternTargetNames(e,t){switch(e.nodeType){case 65:e.entries.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 68:e.arguments.forEach((e=>{this._getPatternTargetNames(e.pattern,t)}));break;case 66:e.target&&t.set(e.target.value,!0),e.orPatterns.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 69:e.isWildcard||t.set(e.target.value,!0);break;case 70:e.entries.forEach((e=>{72===e.nodeType?t.set(e.target.value,!0):(this._getPatternTargetNames(e.keyPattern,t),this._getPatternTargetNames(e.valuePattern,t))}))}}_parsePatternSequence(){const e=this._parseExpressionListGeneric((()=>this._parsePatternAs())),t=e.list.filter((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar));t.length>1&&this._addError(u.Localizer.Diagnostic.duplicateStarPattern(),t[1].orPatterns[0]);const n=new Map;return e.list.forEach((e=>{e.orPatterns.forEach((e=>{69!==e.nodeType||e.isStar||e.isWildcard||(n.has(e.target.value)?this._addError(u.Localizer.Diagnostic.duplicateCapturePatternTarget().format({name:e.target.value}),e):n.set(e.target.value,e))}))})),e}_parsePatternAs(){const e=[];for(;;){const t=this._parsePatternAtom();if(e.push(t),!this._consumeTokenIfOperator(6))break}let t;if(e.length>1&&e.forEach((e=>{69===e.nodeType&&e.isStar&&this._addError(u.Localizer.Diagnostic.starPatternInOrPattern(),e)})),this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?t=h.NameNode.create(e):this._addError(u.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken())}t&&1===e.length&&69===e[0].nodeType&&e[0].isStar&&this._addError(u.Localizer.Diagnostic.starPatternInAsPattern(),e[0]),e.forEach(((t,n)=>{n{this._getPatternTargetNames(e,n)})),e.forEach((e=>{const t=new Map;if(this._getPatternTargetNames(e,t),t.size!t.has(e))),s=new o.DiagnosticAddendum;s.addMessage(u.Localizer.DiagnosticAddendum.orPatternMissingName().format({name:i.map((e=>`"${e}"`)).join(", ")})),this._addError(u.Localizer.Diagnostic.orPatternMissingName()+s.getString(),e)}})),h.PatternAsNode.create(e,t)}_parsePatternAtom(){const e=this._parsePatternLiteral();if(e)return e;const t=this._parsePatternCaptureOrValue();if(t){if(0===t.nodeType||!this._consumeTokenIfType(13))return t;const e=this._parseClassPatternArgList(),n=69===t.nodeType?t.target:t.expression,i=h.PatternClassNode.create(n,e);return this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()),this._consumeTokensUntilType([2]),h.extendRange(i,this._peekToken())),i}const n=this._peekToken();if(26===this._peekOperatorType()){const e=this._getNextToken(),t=this._getTokenIfIdentifier();return t?h.PatternCaptureNode.create(h.NameNode.create(t),e):(this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),h.ErrorNode.create(e,2))}if(13===n.type||15===n.type){const e=this._getNextToken(),t=this._parsePatternSequence();let i;if(t.parseError)i=t.parseError;else if(1!==t.list.length||t.trailingComma||13!==e.type)i=h.PatternSequenceNode.create(e,t.list);else{const s=t.list[0].orPatterns[0];i=69===s.nodeType&&s.isStar?h.PatternSequenceNode.create(e,t.list):t.list[0],h.extendRange(i,n)}const s=this._peekToken();return this._consumeTokenIfType(13===n.type?14:16)?h.extendRange(i,s):(this._addError(13===n.type?u.Localizer.Diagnostic.expectedCloseParen():u.Localizer.Diagnostic.expectedCloseBracket(),this._peekToken()),this._consumeTokensUntilType([10,13===n.type?14:16])),i}if(17===n.type){const e=this._getNextToken(),t=this._parsePatternMapping(e),n=this._peekToken();return this._consumeTokenIfType(18)?h.extendRange(t,n):(this._addError(u.Localizer.Diagnostic.expectedCloseBrace(),this._peekToken()),this._consumeTokensUntilType([10,18])),t}return this._handleExpressionParseError(11,u.Localizer.Diagnostic.expectedPatternExpr())}_parseClassPatternArgList(){const e=[];let t=!1;for(;;){const n=this._peekTokenType();if(14===n||2===n||1===n)break;const i=this._parseClassPatternArgument();if(i.name?t=!0:t&&!i.name&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),i),e.push(i),!this._consumeTokenIfType(12))break}return e}_parseClassPatternArgument(){const e=this._peekToken(),t=this._peekToken(1);let n;7!==e.type&&8!==e.type||9!==t.type||2!==t.operatorType||(this._getNextToken(),n=h.NameNode.create(e),this._getNextToken());const i=this._parsePatternAs();return h.PatternClassArgumentNode.create(i,n)}_parsePatternLiteral(){const e=this._peekToken(),t=this._peekOperatorType();if(6===e.type||33===t)return this._parsePatternLiteralNumber();if(5===e.type){const e=this._parseAtom();return a.assert(48===e.nodeType),e.strings.forEach((e=>{64&e.token.flags&&this._addError(u.Localizer.Diagnostic.formatStringInPattern(),e)})),h.PatternLiteralNode.create(e)}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||26===t.keywordType)return h.PatternLiteralNode.create(this._parseAtom())}}_parsePatternLiteralNumber(){const e=this._parseArithmeticExpression();let t,n;return 7===e.nodeType?33!==e.operator&&0!==e.operator||(t=e.leftExpression,n=e.rightExpression):t=e,t&&(55===t.nodeType&&33===t.operator&&(t=t.expression),(40!==t.nodeType||void 0!==n&&t.isImaginary)&&(this._addError(u.Localizer.Diagnostic.expectedComplexNumberLiteral(),e),n=void 0)),n&&(55===n.nodeType&&33===n.operator&&(n=n.expression),40===n.nodeType&&n.isImaginary||this._addError(u.Localizer.Diagnostic.expectedComplexNumberLiteral(),e)),h.PatternLiteralNode.create(e)}_parsePatternMapping(e){const t=this._parseExpressionListGeneric((()=>this._parsePatternMappingItem()));if(t.list.length>0){const n=t.list.filter((e=>72===e.nodeType));return n.length>1&&this._addError(u.Localizer.Diagnostic.duplicateStarStarPattern(),n[1]),h.PatternMappingNode.create(e,t.list)}return t.parseError||h.ErrorNode.create(this._peekToken(),11)}_parsePatternMappingItem(){let e;const t=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._getTokenIfIdentifier();if(!e)return this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),h.ErrorNode.create(this._peekToken(),11);const n=h.NameNode.create(e);return"_"===e.value&&this._addError(u.Localizer.Diagnostic.starStarWildcardNotAllowed(),n),h.PatternMappingExpandEntryNode.create(t,n)}const n=this._parsePatternLiteral();if(n)e=n;else{const t=this._parsePatternCaptureOrValue();t&&(73===t.nodeType?e=t:(this._addError(u.Localizer.Diagnostic.expectedPatternValue(),t),e=h.ErrorNode.create(this._peekToken(),11)))}let i;return e||(this._addError(u.Localizer.Diagnostic.expectedPatternExpr(),this._peekToken()),e=h.ErrorNode.create(this._peekToken(),11)),this._consumeTokenIfType(10)?i=this._parsePatternAs():(this._addError(u.Localizer.Diagnostic.expectedColon(),this._peekToken()),i=h.ErrorNode.create(this._peekToken(),11)),h.PatternMappingKeyEntryNode.create(e,i)}_parsePatternCaptureOrValue(){const e=this._peekToken();if(7===e.type||8===e.type){let e;for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}{const n=h.NameNode.create(t);e=e?h.MemberAccessNode.create(e,n):n}if(!this._consumeTokenIfType(20))break}return e?35===e.nodeType?h.PatternValueNode.create(e):h.PatternCaptureNode.create(e):(this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),h.ErrorNode.create(this._peekToken(),11))}}_parseIfStatement(e=20){const t=this._getKeywordToken(e),n=this._parseTestExpression(!0),i=this._parseSuite(this._isInFunction),s=h.IfNode.create(t,n,i);return this._consumeTokenIfKeyword(13)?(s.elseSuite=this._parseSuite(this._isInFunction),s.elseSuite.parent=s,h.extendRange(s,s.elseSuite)):12===this._peekKeywordType()&&(s.elseSuite=this._parseIfStatement(12),s.elseSuite.parent=s,h.extendRange(s,s.elseSuite)),s}_parseLoopSuite(){const e=this._isInLoop,t=this._isInFinally;this._isInLoop=!0,this._isInFinally=!1;const n=this._parseSuite(this._isInFunction);return this._isInLoop=e,this._isInFinally=t,n}_parseSuite(e=!1,t=!1,n){const i=this._peekToken(),s=h.SuiteNode.create(i);if(this._consumeTokenIfType(10)||(this._addError(u.Localizer.Diagnostic.expectedColon(),i),this._consumeTokensUntilType([2,10])&&this._getNextToken()),t){if(this._consumeTokenIfType(2)){let e=0;for(;;){const t=this._getNextToken();if(3===t.type&&e++,4===t.type&&(e--,0===e))break;if(1===t.type)break}}else this._parseSimpleStatement();return this._tokenIndex>0&&h.extendRange(s,this._tokenizerOutput.tokens.getItemAt(this._tokenIndex-1)),s}n&&n();const r=this._isInFunction;if(this._isInFunction=e,this._consumeTokenIfType(2)){n&&n();const e=this._peekToken();if(this._consumeTokenIfType(3)){const t=e;t.isIndentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t)}else this._addError(u.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseStatement();t?(t.parent=s,s.statements.push(t)):this._consumeTokensUntilType([2]);const n=this._peekToken();if(this._consumeTokenIfType(4)){n.matchesIndent||this._addError(u.Localizer.Diagnostic.inconsistentIndent(),n);break}if(1===this._peekTokenType())break}}else{const e=this._parseSimpleStatement();s.statements.push(e),e.parent=s}return s.statements.length>0&&h.extendRange(s,s.statements[s.statements.length-1]),this._isInFunction=r,s}_parseForStatement(e){const t=this._getKeywordToken(17),n=this._parseExpressionList(!0),i=this._makeExpressionOrTuple(n,!1);let s,r,a;this._consumeTokenIfKeyword(22)?(s=this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedInExpr()),r=this._parseLoopSuite(),this._consumeTokenIfKeyword(13)&&(a=this._parseSuite(this._isInFunction))):(s=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn()),r=h.SuiteNode.create(this._peekToken()));const o=h.ForNode.create(t,i,s,r);return o.elseSuite=a,a&&(h.extendRange(o,a),a.parent=o),e&&(o.isAsync=!0,o.asyncToken=e,h.extendRange(o,e)),o}_tryParseListComprehension(e){const t=this._tryParseCompForStatement();if(!t)return;56===e.nodeType?this._addError(u.Localizer.Diagnostic.unpackIllegalInComprehension(),e):16===e.nodeType&&this._addError(u.Localizer.Diagnostic.dictExpandIllegalInComprehension(),e);const n=h.ListComprehensionNode.create(e),i=[t];for(;;){const e=this._tryParseCompForStatement()||this._tryParseCompIfStatement();if(!e)break;e.parent=n,i.push(e)}return n.comprehensions=i,i.length>0&&(i.forEach((e=>{e.parent=n})),h.extendRange(n,i[i.length-1])),n}_tryParseCompForStatement(){const e=this._peekKeywordType();if(3===e){const e=this._peekToken(1);if(8!==e.type||17!==e.keywordType)return}else if(17!==e)return;let t;3===this._peekKeywordType()&&(t=this._getKeywordToken(3));const n=this._getKeywordToken(17),i=this._parseExpressionList(!0),s=this._makeExpressionOrTuple(i,!1);let r;this._consumeTokenIfKeyword(22)?this._disallowAssignmentExpression((()=>{r=this._parseOrTest()})):r=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn());const a=h.ListComprehensionForNode.create(t||n,s,r);return t&&(a.isAsync=!0,a.asyncToken=t),a}_tryParseCompIfStatement(){if(20!==this._peekKeywordType())return;const e=this._getKeywordToken(20),t=this._tryParseLambdaExpression()||this._parseAssignmentExpression();return h.ListComprehensionIfNode.create(e,t)}_parseWhileStatement(){const e=this._getKeywordToken(35),t=h.WhileNode.create(e,this._parseTestExpression(!0),this._parseLoopSuite());return this._consumeTokenIfKeyword(13)&&(t.elseSuite=this._parseSuite(this._isInFunction),t.elseSuite.parent=t,h.extendRange(t,t.elseSuite)),t}_parseTryStatement(){const e=this._getKeywordToken(34),t=this._parseSuite(this._isInFunction),n=h.TryNode.create(e,t);let i=!1;for(;;){const e=this._peekToken();if(!this._consumeTokenIfKeyword(14))break;let t,s;if(10!==this._peekTokenType())if(t=this._parseTestExpression(!0),this._consumeTokenIfKeyword(1))s=this._getTokenIfIdentifier(),s||this._addError(u.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken());else{const e=this._peekToken();this._consumeTokenIfType(12)&&(this._addError(u.Localizer.Diagnostic.expectedAsAfterException(),e),this._parseTestExpression(!1))}t?i&&this._addError(u.Localizer.Diagnostic.namedExceptAfterCatchAll(),t):(i&&this._addError(u.Localizer.Diagnostic.duplicateCatchAll(),e),i=!0);const r=this._parseSuite(this._isInFunction),a=h.ExceptNode.create(e,r);t&&(a.typeExpression=t,a.typeExpression.parent=a),s&&(a.name=h.NameNode.create(s),a.name.parent=a),n.exceptClauses.push(a),a.parent=n}return n.exceptClauses.length>0&&(h.extendRange(n,n.exceptClauses[n.exceptClauses.length-1]),this._consumeTokenIfKeyword(13)&&(n.elseSuite=this._parseSuite(this._isInFunction),n.elseSuite.parent=n,h.extendRange(n,n.elseSuite))),this._consumeTokenIfKeyword(16)&&(n.finallySuite=this._parseSuite(this._isInFunction),n.finallySuite.parent=n,h.extendRange(n,n.finallySuite)),n.finallySuite||0!==n.exceptClauses.length||this._addError(u.Localizer.Diagnostic.tryWithoutExcept(),e),n}_parseFunctionDef(e,t){const n=this._getKeywordToken(10),i=this._getTokenIfIdentifier();if(!i)return this._addError(u.Localizer.Diagnostic.expectedFunctionName(),n),h.ErrorNode.create(n,10,void 0,t);if(!this._consumeTokenIfType(13))return this._addError(u.Localizer.Diagnostic.expectedOpenParen(),this._peekToken()),h.ErrorNode.create(i,10,h.NameNode.create(i),t);const s=this._parseVarArgsList(14,!0);let r,a;this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()),this._consumeTokensUntilType([10])),this._consumeTokenIfType(21)&&(r=this._parseTypeAnnotation());const o=this._parseSuite(!0,this._parseOptions.skipFunctionAndClassBody,(()=>{a||(a=this._getTypeAnnotationCommentText())})),l=h.FunctionNode.create(n,h.NameNode.create(i),o);return e&&(l.isAsync=!0,h.extendRange(l,e)),l.parameters=s,s.forEach((e=>{e.parent=l})),t&&(l.decorators=t,t.forEach((e=>{e.parent=l})),t.length>0&&h.extendRange(l,t[0])),r&&(l.returnTypeAnnotation=r,l.returnTypeAnnotation.parent=l,h.extendRange(l,r)),a&&this._parseFunctionTypeAnnotationComment(a,l),l}_parseVarArgsList(e,t){const n=new Map,i=[];let s=!1,r=!1,a=!1,o=!1,l=!1,c=!1;for(;this._peekTokenType()!==e;){const p=this._parseParameter(t);if(!p){this._consumeTokensUntilType([e]);break}if(p.name){const e=p.name.value;n.has(e)?this._addError(u.Localizer.Diagnostic.duplicateParam().format({name:e}),p.name):n.set(e,e)}else 0===p.category&&0===i.length&&this._addError(u.Localizer.Diagnostic.positionOnlyFirstParam(),p);0===p.category&&(p.name?p.defaultValue?s=!0:!s||a||l||r||(this._addError(u.Localizer.Diagnostic.nonDefaultAfterDefault(),p),r=!0):(o?this._addError(u.Localizer.Diagnostic.duplicatePositionOnly(),p):a?this._addError(u.Localizer.Diagnostic.positionOnlyAfterKeywordOnly(),p):l&&this._addError(u.Localizer.Diagnostic.positionOnlyAfterArgs(),p),o=!0)),i.push(p),1===p.category&&(p.name?(l&&this._addError(u.Localizer.Diagnostic.duplicateArgsParam(),p),l=!0):(a?this._addError(u.Localizer.Diagnostic.duplicateKeywordOnly(),p):l&&this._addError(u.Localizer.Diagnostic.keywordOnlyAfterArgs(),p),a=!0)),2===p.category?(c&&this._addError(u.Localizer.Diagnostic.duplicateKwargsParam(),p),c=!0):c&&this._addError(u.Localizer.Diagnostic.paramAfterKwargsParam(),p);const d=this._consumeTokenIfType(12);if(t&&!p.typeAnnotation){const e=this._parseVariableTypeAnnotationComment();e&&(p.typeAnnotationComment=e,p.typeAnnotationComment.parent=p,h.extendRange(p,p.typeAnnotationComment))}if(!d)break}if(i.length>0){const e=i[i.length-1];1!==e.category||e.name||this._addError(u.Localizer.Diagnostic.expectedNamedParameter(),e)}return i}_parseParameter(e){let t=0,n=0;const i=this._peekToken();this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)?t=2:this._consumeTokenIfOperator(10)&&(this._getLanguageVersion()0&&this._addError(u.Localizer.Diagnostic.defaultValueNotAllowed(),a.defaultValue)),a}_parseWithStatement(e){const t=this._getKeywordToken(36),n=[],i=this._peekToken();let s=!1;if(13===i.type){const e=this._tokenIndex;this._suppressErrors((()=>{for(this._getNextToken();this._parseWithItem(),this._consumeTokenIfType(12)&&14!==this._peekToken().type;);14===this._peekToken().type&&10===this._peekToken(1).type&&(s=!0),this._tokenIndex=e}))}for(s&&(this._consumeTokenIfType(13),this._getLanguageVersion(){e.parent=a})),a}_parseWithItem(){const e=this._parseTestExpression(!0),t=h.WithItemNode.create(e);return this._consumeTokenIfKeyword(1)&&(t.target=this._parseExpression(!1),t.target.parent=t,h.extendRange(t,t.target)),t}_parseDecorated(){const e=[];for(;22===this._peekOperatorType();)e.push(this._parseDecorator());const t=this._peekToken();if(8===t.type)if(3===t.keywordType){if(this._getNextToken(),10===this._peekKeywordType())return this._parseFunctionDef(t,e);this._addError(u.Localizer.Diagnostic.expectedFunctionAfterAsync(),this._peekToken())}else{if(10===t.keywordType)return this._parseFunctionDef(void 0,e);if(7===t.keywordType)return this._parseClassDef(e)}return this._addError(u.Localizer.Diagnostic.expectedAfterDecorator(),this._peekToken()),h.ClassNode.createDummyForDecorators(e)}_parseDecorator(){const e=this._getNextToken();a.assert(22===e.operatorType);const t=this._parseTestExpression(!0);if(this._getLanguageVersion(){e.parent=r})),e&&(r.decorators=e,e.length>0&&(e.forEach((e=>{e.parent=r})),h.extendRange(r,e[0]))),r}_parsePassStatement(){return h.PassNode.create(this._getKeywordToken(30))}_parseBreakStatement(){const e=this._getKeywordToken(5);return this._isInLoop||this._addError(u.Localizer.Diagnostic.breakOutsideLoop(),e),h.BreakNode.create(e)}_parseContinueStatement(){const e=this._getKeywordToken(8);return this._isInLoop?this._isInFinally&&this._addError(u.Localizer.Diagnostic.continueInFinally(),e):this._addError(u.Localizer.Diagnostic.continueOutsideLoop(),e),h.ContinueNode.create(e)}_parseReturnStatement(){const e=this._getKeywordToken(32),t=h.ReturnNode.create(e);if(this._isInFunction||this._addError(u.Localizer.Diagnostic.returnOutsideFunction(),e),!this._isNextTokenNeverExpression()){const e=this._parseTestOrStarListAsExpression(!0,2,u.Localizer.Diagnostic.expectedReturnExpr());this._reportConditionalErrorForStarTupleElement(e),t.returnExpression=e,t.returnExpression.parent=t,h.extendRange(t,e)}return t}_parseFromStatement(){const e=this._getKeywordToken(18),t=this._parseDottedModuleName(!0),n=h.ImportFromNode.create(e,t),i=0===t.leadingDots&&1===t.nameParts.length&&"__future__"===t.nameParts[0].value,s=this._peekToken();if(this._consumeTokenIfKeyword(21)){h.extendRange(n,s);const e=this._peekToken();if(this._consumeTokenIfOperator(26))h.extendRange(n,e),n.isWildcardImport=!0,n.wildcardToken=e,this._containsWildcardImport=!0;else{const e=this._consumeTokenIfType(13);let t;for(;;){const e=this._getTokenIfIdentifier();if(!e)break;t=void 0;const s=h.ImportFromAsNode.create(h.NameNode.create(e));if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(s.alias=h.NameNode.create(e),s.alias.parent=s,h.extendRange(s,e)):this._addError(u.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}n.imports.push(s),s.parent=n,h.extendRange(n,s),i&&this._futureImportMap.set(e.value,!0);const r=this._peekToken();if(!this._consumeTokenIfType(12))break;t=r}if(0===n.imports.length&&this._addError(u.Localizer.Diagnostic.expectedImportSymbols(),this._peekToken()),e){n.usesParens=!0;const e=this._peekToken();this._consumeTokenIfType(14)?h.extendRange(n,e):this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken())}else t&&this._addError(u.Localizer.Diagnostic.trailingCommaInFromImport(),t)}}else this._addError(u.Localizer.Diagnostic.expectedImport(),this._peekToken()),t.hasTrailingDot||(n.missingImportKeyword=!0);this._importedModules.push({nameNode:n.module,leadingDots:n.module.leadingDots,nameParts:n.module.nameParts.map((e=>e.value)),importedSymbols:n.imports.map((e=>e.name.value))});let r=!1;if(1===n.module.nameParts.length){const e=n.module.nameParts[0].value;"typing"!==e&&"typing_extensions"!==e||(r=!0)}if(r){const e=["Literal","TypeAlias","Annotated"];n.isWildcardImport?e.forEach((e=>{this._typingSymbolAliases.set(e,e)})):n.imports.forEach((t=>{var n;e.some((e=>e===t.name.value))&&this._typingSymbolAliases.set((null===(n=t.alias)||void 0===n?void 0:n.value)||t.name.value,t.name.value)}))}return n}_parseImportStatement(){var e;const t=this._getKeywordToken(21),n=h.ImportNode.create(t);for(;;){const t=this._parseDottedModuleName(),i=h.ImportAsNode.create(t);if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(i.alias=h.NameNode.create(e),i.alias.parent=i,h.extendRange(i,i.alias)):this._addError(u.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}if(i.module.leadingDots>0&&this._addError(u.Localizer.Diagnostic.relativeImportNotAllowed(),i.module),n.list.push(i),i.parent=n,this._importedModules.push({nameNode:i.module,leadingDots:i.module.leadingDots,nameParts:i.module.nameParts.map((e=>e.value)),importedSymbols:void 0}),1===t.nameParts.length){const n=t.nameParts[0].value;"typing"!==n&&"typing_extensions"!==n||this._typingImportAliases.push((null===(e=i.alias)||void 0===e?void 0:e.value)||n)}if(!this._consumeTokenIfType(12))break}return n.list.length>0&&h.extendRange(n,n.list[n.list.length-1]),n}_parseDottedModuleName(e=!1){const t=h.ModuleNameNode.create(this._peekToken());for(;;)if(this._consumeTokenIfType(19))t.leadingDots+=3;else{if(!this._consumeTokenIfType(20))break;t.leadingDots++}for(;;){const n=this._getTokenIfIdentifier();if(!n){(!e||0===t.leadingDots||t.nameParts.length>0)&&(this._addError(u.Localizer.Diagnostic.expectedModuleName(),this._peekToken()),t.hasTrailingDot=!0);break}const i=h.NameNode.create(n);t.nameParts.push(i),i.parent=t,h.extendRange(t,i);const s=this._peekToken();if(!this._consumeTokenIfType(20))break;h.extendRange(t,s)}return t}_parseGlobalStatement(){const e=this._getKeywordToken(19),t=h.GlobalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),h.extendRange(t,t.nameList[t.nameList.length-1])),t}_parseNonlocalStatement(){const e=this._getKeywordToken(27),t=h.NonlocalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),h.extendRange(t,t.nameList[t.nameList.length-1])),t}_parseNameList(){const e=[];for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}if(e.push(h.NameNode.create(t)),!this._consumeTokenIfType(12))break}return e}_parseRaiseStatement(){const e=this._getKeywordToken(31),t=h.RaiseNode.create(e);return this._isNextTokenNeverExpression()||(t.typeExpression=this._parseTestExpression(!0),t.typeExpression.parent=t,h.extendRange(t,t.typeExpression),this._consumeTokenIfKeyword(18)?(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,h.extendRange(t,t.valueExpression)):this._consumeTokenIfType(12)&&(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,h.extendRange(t,t.valueExpression),this._consumeTokenIfType(12)&&(t.tracebackExpression=this._parseTestExpression(!0),t.tracebackExpression.parent=t,h.extendRange(t,t.tracebackExpression)))),t}_parseAssertStatement(){const e=this._getKeywordToken(2),t=this._parseTestExpression(!0),n=h.AssertNode.create(e,t);if(this._consumeTokenIfType(12)){const e=this._parseTestExpression(!0);n.exceptionExpression=e,n.exceptionExpression.parent=n,h.extendRange(n,e)}return n}_parseDelStatement(){const e=this._getKeywordToken(11),t=this._parseExpressionList(!0);t.parseError||0!==t.list.length||this._addError(u.Localizer.Diagnostic.expectedDelExpr(),this._peekToken());const n=h.DelNode.create(e);return n.expressions=t.list,n.expressions.length>0&&(n.expressions.forEach((e=>{e.parent=n})),h.extendRange(n,n.expressions[n.expressions.length-1])),n}_parseYieldExpression(){const e=this._getKeywordToken(37),t=this._peekToken();if(this._consumeTokenIfKeyword(18))return this._getLanguageVersion()0?e.list[0]:this._peekToken(-1),i=h.TupleNode.create(n,t);return i.expressions=e.list,e.list.length>0&&(e.list.forEach((e=>{e.parent=i})),h.extendRange(i,e.list[e.list.length-1])),i}_parseTestListAsExpression(e,t){if(this._isNextTokenNeverExpression())return this._handleExpressionParseError(e,t);const n=this._parseTestExpressionList();return n.parseError?n.parseError:this._makeExpressionOrTuple(n,!1)}_parseTestOrStarListAsExpression(e,t,n){if(this._isNextTokenNeverExpression())return this._handleExpressionParseError(t,n);const i=this._parseTestOrStarExpressionList(e);return i.parseError?i.parseError:this._makeExpressionOrTuple(i,!1)}_parseExpressionList(e){return this._parseExpressionListGeneric((()=>this._parseExpression(e)))}_parseTestExpressionList(){return this._parseExpressionListGeneric((()=>this._parseTestExpression(!1)))}_parseTestOrStarExpressionList(e){const t=this._parseExpressionListGeneric((()=>this._parseTestOrStarExpression(e)));if(!t.parseError){let e=!1;for(const n of t.list)if(56===n.nodeType){if(e){this._addError(u.Localizer.Diagnostic.duplicateUnpack(),n);break}e=!0}}return t}_parseExpression(e){const t=this._peekToken();return e&&this._consumeTokenIfOperator(26)?h.UnpackNode.create(t,this._parseExpression(!1)):this._parseBitwiseOrExpression()}_parseTestOrStarExpression(e){return 26===this._peekOperatorType()?this._parseExpression(!0):this._parseTestExpression(e)}_parseTestExpression(e){if(24===this._peekKeywordType())return this._parseLambdaExpression();const t=e?this._parseAssignmentExpression():this._parseOrTest();if(0===t.nodeType)return t;if(!this._consumeTokenIfKeyword(20))return t;const n=this._parseAssignmentExpression();if(0===n.nodeType)return n;if(!this._consumeTokenIfKeyword(13))return this._handleExpressionParseError(1,u.Localizer.Diagnostic.expectedElse());const i=this._parseTestExpression(!0);return 0===i.nodeType?i:h.TernaryNode.create(t,n,i)}_parseAssignmentExpression(){const e=this._parseOrTest();if(0===e.nodeType)return e;if(38!==e.nodeType)return e;const t=this._peekToken();if(!this._consumeTokenIfOperator(35))return e;this._assignmentExpressionsAllowed||this._addError(u.Localizer.Diagnostic.walrusNotAllowed(),t),this._getLanguageVersion()e===t))}return!1}_parseAtomExpression(){let e;4!==this._peekKeywordType()||this._isParsingTypeAnnotation||(e=this._getKeywordToken(4),this._getLanguageVersion()0&&(n.forEach((e=>{e.parent=i})),h.extendRange(i,n[n.length-1]));const s=this._peekToken();let r=!1;if(this._consumeTokenIfType(14)?(h.extendRange(i,s),r=!0):(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()),this._consumeTokensUntilType([2]),h.extendRange(i,this._peekToken())),this._isParsingTypeAnnotation=e,this._isParsingTypeAnnotation){const e=new o.DiagnosticAddendum;38===t.nodeType&&"type"===t.value&&(e.addMessage(u.Localizer.DiagnosticAddendum.useTypeInstead()),this._addError(u.Localizer.Diagnostic.typeCallNotAllowed()+e.getString(),i))}if(t=i,!r)break}else if(this._consumeTokenIfType(15)){const e=this._isParsingIndexTrailer,n=this._isParsingTypeAnnotation;(this._isTypingAnnotation(t,"Literal")||this._isTypingAnnotation(t,"Annotated"))&&(this._isParsingTypeAnnotation=!1),this._isParsingIndexTrailer=!0;const i=this._parseSubscriptList();this._isParsingTypeAnnotation=n,this._isParsingIndexTrailer=e;const s=this._peekToken(),r=h.IndexNode.create(t,i.list,i.trailingComma,s);h.extendRange(r,r),this._consumeTokenIfType(16)||this._handleExpressionParseError(6,u.Localizer.Diagnostic.expectedCloseBracket(),r),t=r}else{if(!this._consumeTokenIfType(20))break;{const e=this._getTokenIfIdentifier();if(!e)return this._handleExpressionParseError(7,u.Localizer.Diagnostic.expectedMemberName(),t);t=h.MemberAccessNode.create(t,h.NameNode.create(e))}}return e?h.AwaitNode.create(e,t):t}_parseSubscriptList(){const e=[];let t=!1,n=!1;for(;;){const i=this._peekToken();if(10!==i.type&&this._isNextTokenNeverExpression())break;let s=0;this._consumeTokenIfOperator(26)?s=1:this._consumeTokenIfOperator(29)&&(s=2);let r,a=this._parsePossibleSlice();if(0===s&&this._consumeTokenIfOperator(2)){const e=a;a=this._parsePossibleSlice(),38===e.nodeType?r=e.token:this._addError(u.Localizer.Diagnostic.expectedParamName(),e)}const o=h.ArgumentNode.create(i,a,s);if(r&&(o.name=h.NameNode.create(r),o.name.parent=o),o.name?t=!0:t&&0===o.argumentCategory&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),o),e.push(o),o.name&&this._addError(u.Localizer.Diagnostic.keywordSubscriptIllegal(),o.name),0!==s&&this._addError(u.Localizer.Diagnostic.unpackedSubscriptIllegal(),o),!this._consumeTokenIfType(12)){n=!1;break}n=!0}if(0===e.length){const t=this._handleExpressionParseError(3,u.Localizer.Diagnostic.expectedSliceIndex(),void 0,[16]);e.push(h.ArgumentNode.create(this._peekToken(),t,0))}return{list:e,trailingComma:n}}_parsePossibleSlice(){const e=this._peekToken(),t=[void 0,void 0,void 0];let n=0,i=!1;for(;;){const e=this._peekTokenType();if(16===e||12===e)break;if(10!==e&&(t[n]=this._parseTestExpression(!1)),n++,n>=3||!this._consumeTokenIfType(10))break;i=!0}if(!i)return t[0]?t[0]:h.ErrorNode.create(this._peekToken(),3);const s=h.SliceNode.create(e);s.startValue=t[0],s.startValue&&(s.startValue.parent=s),s.endValue=t[1],s.endValue&&(s.endValue.parent=s),s.stepValue=t[2],s.stepValue&&(s.stepValue.parent=s);const r=t[2]||t[1]||t[0];return r&&h.extendRange(s,r),s}_parseArgList(){const e=[];let t=!1;for(;;){const n=this._peekTokenType();if(14===n||2===n||1===n)break;const i=this._parseArgument();if(i.name?t=!0:t&&0===i.argumentCategory&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),i),e.push(i),!this._consumeTokenIfType(12))break}return e}_parseArgument(){const e=this._peekToken();let t=0;this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)&&(t=2);let n,i=this._parseTestExpression(!0);if(0===t)if(this._consumeTokenIfOperator(2)){const e=i;i=this._parseTestExpression(!1),38===e.nodeType?n=e.token:this._addError(u.Localizer.Diagnostic.expectedParamName(),e)}else{const e=this._tryParseListComprehension(i);e&&(i=e)}const s=h.ArgumentNode.create(e,i,t);return n&&(s.name=h.NameNode.create(n),s.name.parent=s),s}_parseAtom(){const e=this._peekToken();if(19===e.type)return h.EllipsisNode.create(this._getNextToken());if(6===e.type)return h.NumberNode.create(this._getNextToken());if(7===e.type)return h.NameNode.create(this._getNextToken());if(5===e.type)return this._parseStringList();if(22===e.type){this._getNextToken(),this._addError(u.Localizer.Diagnostic.backticksIllegal(),e);const t=this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedExpr());return this._consumeTokenIfType(22),t}if(13===e.type){const e=this._parseTupleAtom();if(52===e.nodeType&&this._isParsingTypeAnnotation&&!this._isParsingIndexTrailer){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useTupleInstead()),this._addError(u.Localizer.Diagnostic.tupleInAnnotation()+t.getString(),e)}return 7===e.nodeType&&(e.parenthesized=!0),e}if(15===e.type){const e=this._parseListAtom();if(this._isParsingTypeAnnotation&&!this._isParsingIndexTrailer){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useListInstead()),this._addError(u.Localizer.Diagnostic.listInAnnotation()+t.getString(),e)}return e}if(17===e.type){const e=this._parseDictionaryOrSetAtom();if(this._isParsingTypeAnnotation){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useDictInstead()),this._addError(u.Localizer.Diagnostic.dictInAnnotation()+t.getString(),e)}return e}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||9===t.keywordType||26===t.keywordType)return h.ConstantNode.create(this._getNextToken());const n=this._getTokenIfIdentifier();if(n)return h.NameNode.create(n)}return this._handleExpressionParseError(2,u.Localizer.Diagnostic.expectedExpr())}_handleExpressionParseError(e,t,n,i){this._addError(t,this._peekToken());const s=h.ErrorNode.create(this._peekToken(),e,n),r=[2];return i&&r.push(...i),this._consumeTokensUntilType(r),s}_parseLambdaExpression(e=!0){const t=this._getKeywordToken(24),n=this._parseVarArgsList(10,!1);let i;this._consumeTokenIfType(10)||this._addError(u.Localizer.Diagnostic.expectedColon(),this._peekToken()),i=e?this._parseTestExpression(!1):this._tryParseLambdaExpression(!1)||this._parseOrTest();const s=h.LambdaNode.create(t,i);return s.parameters=n,n.forEach((e=>{e.parent=s})),s}_tryParseLambdaExpression(e=!0){if(24===this._peekKeywordType())return this._parseLambdaExpression(e)}_parseTupleAtom(){const e=this._getNextToken();a.assert(13===e.type);const t=this._tryParseYieldExpression();if(t)return 14!==this._peekTokenType()?this._handleExpressionParseError(8,u.Localizer.Diagnostic.expectedCloseParen()):(h.extendRange(t,this._getNextToken()),t);const n=this._parseTestListWithComprehension(),i=this._makeExpressionOrTuple(n,!0);return h.extendRange(i,e),14!==this._peekTokenType()?this._handleExpressionParseError(8,u.Localizer.Diagnostic.expectedCloseParen()):(h.extendRange(i,this._getNextToken()),i)}_parseListAtom(){const e=this._getNextToken();a.assert(15===e.type);const t=this._parseTestListWithComprehension(),n=this._peekToken();if(!this._consumeTokenIfType(16))return this._handleExpressionParseError(9,u.Localizer.Diagnostic.expectedCloseBracket());const i=h.ListNode.create(e);return h.extendRange(i,n),t.list.length>0&&(t.list.forEach((e=>{e.parent=i})),h.extendRange(i,t.list[t.list.length-1])),i.entries=t.list,i}_parseTestListWithComprehension(){let e=!1;return this._parseExpressionListGeneric((()=>{let t=this._parseTestOrStarExpression(!0);const n=this._tryParseListComprehension(t);return n&&(t=n,e=!0),t}),(()=>this._isNextTokenNeverExpression()),(()=>e))}_parseDictionaryOrSetAtom(){const e=this._getNextToken();a.assert(17===e.type);const t=[],n=[];let i=!1,s=!1,r=!1,o=!0;for(;18!==this._peekTokenType();){let e,l,c;const p=this._peekToken();if(this._consumeTokenIfOperator(29)?e=this._parseExpression(!1):(l=this._parseTestOrStarExpression(!0),this._consumeTokenIfType(10)&&(c=this._parseTestExpression(!1))),l&&c)if(56===l.nodeType&&this._addError(u.Localizer.Diagnostic.unpackInDict(),l),s)this._addError(u.Localizer.Diagnostic.keyValueInSet(),c);else{const e=h.DictionaryKeyEntryNode.create(l,c);let n=e;const s=this._tryParseListComprehension(e);s&&(n=s,r=!0,o||this._addError(u.Localizer.Diagnostic.comprehensionInDict(),n)),t.push(n),i=!0}else if(e)if(s)this._addError(u.Localizer.Diagnostic.unpackInSet(),e);else{const n=h.DictionaryExpandEntryNode.create(e);h.extendRange(n,p);let s=n;const a=this._tryParseListComprehension(n);a&&(s=a,r=!0,o||this._addError(u.Localizer.Diagnostic.comprehensionInDict(),e)),t.push(s),i=!0}else if(a.assert(void 0!==l),l)if(i)this._addError(u.Localizer.Diagnostic.dictKeyValuePairs(),l);else{const e=this._tryParseListComprehension(l);e&&(l=e,r=!0,o||this._addError(u.Localizer.Diagnostic.comprehensionInSet(),l)),n.push(l),s=!0}if(r)break;if(!this._consumeTokenIfType(12))break;o=!1}let l=this._peekToken();if(this._consumeTokenIfType(18)||(this._addError(u.Localizer.Diagnostic.expectedCloseBrace(),this._peekToken()),l=void 0),s){const t=h.SetNode.create(e);return l&&h.extendRange(t,l),n.length>0&&h.extendRange(t,n[n.length-1]),n.forEach((e=>{e.parent=t})),t.entries=n,t}const c=h.DictionaryNode.create(e);return l&&h.extendRange(c,l),t.length>0&&(t.forEach((e=>{e.parent=c})),h.extendRange(c,t[t.length-1])),c.entries=t,c}_parseExpressionListGeneric(e,t=(()=>this._isNextTokenNeverExpression()),n=(()=>!1)){let i=!1;const s=[];let r;for(;!t();){const t=e();if(0===t.nodeType){r=t;break}if(s.push(t),n())break;if(!this._consumeTokenIfType(12)){i=!1;break}i=!0}return{trailingComma:i,list:s,parseError:r}}_parseExpressionStatement(){let e,t=this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedExpr());if(0===t.nodeType)return t;if(this._consumeTokenIfType(10)){if(e=this._parseTypeAnnotation(),t=h.TypeAnnotationNode.create(t,e),!this._parseOptions.isStubFile&&this._getLanguageVersion()0)}_getTypeAnnotationCommentText(){if(0===this._tokenIndex)return;const e=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex-1),t=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex);if(e.start+e.length===t.start)return;const n=this._fileContents.substring(e.start+e.length,t.start).match(/^(\s*#\s*type:\s*)([^\r\n]*)/);if(!n)return;const i=n[2];if(i.trim().match(/^ignore(\s|\[|$)/))return;const s=e.start+e.length+n[1].length;return g.StringToken.create(s,i.length,0,i,0,void 0)}_parseVariableTypeAnnotationComment(){const e=this._getTypeAnnotationCommentText();if(!e)return;const t=this._makeStringNode(e),n=h.StringListNode.create([t]),i=(new T).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,1);return i.diagnostics.forEach((e=>{this._addError(e.message,n)})),i.parseTree?i.parseTree:void 0}_parseFunctionTypeAnnotationComment(e,t){const n=this._makeStringNode(e),i=h.StringListNode.create([n]),s=(new T).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,2);if(s.diagnostics.forEach((e=>{this._addError(e.message,i)})),!s.parseTree||62!==s.parseTree.nodeType)return;const r=s.parseTree;t.functionAnnotationComment=r,r.parent=t,h.extendRange(t,r)}_parseFormatStringSegment(e,t,n,i){a.assert(t.isExpression);const s=(new T).parseTextExpression(this._fileContents,e.start+e.prefixLength+e.quoteMarkLength+t.offset+n,i,this._parseOptions,0,1);return s.diagnostics.forEach((t=>{const n=(t.range?c.convertPositionToOffset(t.range.start,s.lines):e.start)||e.start,i={start:n,length:((t.range?(c.convertPositionToOffset(t.range.end,s.lines)||0)+1:e.start+e.length)||e.start+e.length)-n};this._addError(t.message,i)})),s.parseTree}_parseFormatString(e){const t=m.getUnescapedString(e);this._reportStringTokenErrors(e,t);const n=[];for(const i of t.formatStringSegments)if(i.isExpression){const t=this._getFormatStringExpressionLength(i.value.trimEnd()),s=this._parseFormatStringSegment(e,i,0,t);s&&n.push(s);const r=i.value.substr(t);let a=0,o=0;for(let s=0;s0&&(a--,0===a)){const r=this._getFormatStringExpressionLength(i.value.substr(t+o,s-o)),a=this._parseFormatStringSegment(e,i,t+o,r);a&&n.push(a)}}return h.FormatStringNode.create(e,t.value,t.unescapeErrors.length>0,n)}_getFormatStringExpressionLength(e){let t=0;const n=[];let i,s=0,r=0,a=0;for(;t0||s>0||r>0||a>0,c=n.length>0;if("="===o)i=t;else{if(":"===o){if(!l)break}else if("!"===o){if(!l&&(t===e.length-1||"="!==e[t+1]))break}else if("'"===o||'"'===o){let i=o;t+20&&n[n.length-1]===i?n.pop():0===n.length&&n.push(i)}else"("===o?c||r++:")"===o?!c&&r>0&&r--:"{"===o?c||s++:"}"===o?!c&&s>0&&s--:"["===o?c||a++:"]"===o&&!c&&a>0&&a--;" "!==o&&(i=void 0)}t++}return this._parseOptions.pythonVersion>=p.PythonVersion.V3_8&&void 0!==i&&(t=i),t}_parseStringList(){const e=[];for(;5===this._peekTokenType();){const t=this._getNextToken();64&t.flags?e.push(this._parseFormatString(t)):e.push(this._makeStringNode(t))}const t=h.StringListNode.create(e);if(this._isParsingTypeAnnotation)if(t.strings.length>1)this._addError(u.Localizer.Diagnostic.annotationSpansStrings(),t);else if(4&t.strings[0].token.flags)this._addError(u.Localizer.Diagnostic.annotationTripleQuote(),t);else if(64&t.strings[0].token.flags)this._addError(u.Localizer.Diagnostic.annotationFormatString(),t);else{const e=t.strings[0].token,n=m.getUnescapedString(t.strings[0].token).value,i=e.start,s=e.prefixLength+e.quoteMarkLength;if(n.length!==e.length-s-e.quoteMarkLength)this._addError(u.Localizer.Diagnostic.annotationStringEscape(),t);else{const e=(new T).parseTextExpression(this._fileContents,i+s,n.length,this._parseOptions,1);e.diagnostics.forEach((e=>{this._addError(e.message,t)})),e.parseTree&&(t.typeAnnotation=e.parseTree,t.typeAnnotation.parent=t)}}return t}_reportConditionalErrorForStarTupleElement(e){if(52===e.nodeType&&!(e.enclosedInParens||this._parseOptions.pythonVersion>=p.PythonVersion.V3_8))for(const t of e.expressions)if(56===t.nodeType)return void this._addError(u.Localizer.Diagnostic.unpackTuplesIllegal(),t)}_isNextTokenNeverExpression(){switch(this._peekToken().type){case 8:switch(this._peekKeywordType()){case 17:case 22:case 20:return!0}break;case 9:switch(this._peekOperatorType()){case 1:case 34:case 27:case 11:case 25:case 4:case 7:case 9:case 18:case 32:case 30:case 14:case 2:return!0}break;case 3:case 4:case 2:case 1:case 11:case 14:case 16:case 18:case 12:case 10:return!0}return!1}_disallowAssignmentExpression(e){const t=this._assignmentExpressionsAllowed;this._assignmentExpressionsAllowed=!1,e(),this._assignmentExpressionsAllowed=t}_getNextToken(){const e=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex);return this._atEof()||this._tokenIndex++,e}_atEof(){return this._tokenIndex>=this._tokenizerOutput.tokens.count-1}_peekToken(e=0){return this._tokenIndex+e<0?this._tokenizerOutput.tokens.getItemAt(0):this._tokenIndex+e>=this._tokenizerOutput.tokens.count?this._tokenizerOutput.tokens.getItemAt(this._tokenizerOutput.tokens.count-1):this._tokenizerOutput.tokens.getItemAt(this._tokenIndex+e)}_peekTokenType(){return this._peekToken().type}_peekKeywordType(){const e=this._peekToken();if(8===e.type)return e.keywordType}_peekOperatorType(){const e=this._peekToken();if(9===e.type)return e.operatorType}_getTokenIfIdentifier(){const e=this._peekToken();if(7===e.type)return this._getNextToken();if(0===e.type)return this._getNextToken(),this._addError(u.Localizer.Diagnostic.invalidIdentifierChar(),e),g.IdentifierToken.create(e.start,e.length,"",e.comments);if(8===e.type){const t=this._peekKeywordType();if([9,25,6].find((e=>e===t))){const t=this._fileContents.substr(e.start,e.length);return this._getNextToken(),g.IdentifierToken.create(e.start,e.length,t,e.comments)}}}_consumeTokensUntilType(e){for(;;){const t=this._peekToken();if(e.some((e=>e===t.type)))return!0;if(1===t.type)return!1;this._getNextToken()}}_consumeTokenIfType(e){return this._peekTokenType()===e&&(this._getNextToken(),!0)}_consumeTokenIfKeyword(e){return this._peekKeywordType()===e&&(this._getNextToken(),!0)}_consumeTokenIfOperator(e){return this._peekOperatorType()===e&&(this._getNextToken(),!0)}_getKeywordToken(e){const t=this._getNextToken();return a.assert(8===t.type),a.assert(t.keywordType===e),t}_getLanguageVersion(){return this._parseOptions.pythonVersion}_suppressErrors(e){try{this._areErrorsSuppressed=!0,e()}finally{this._areErrorsSuppressed=!1}}_addError(e,t){a.assert(void 0!==t),this._areErrorsSuppressed||this._diagSink.addError(e,c.convertOffsetsToRange(t.start,t.start+t.length,this._tokenizerOutput.lines))}}t.Parser=T},78722:(e,t)=>{"use strict";function n(e){return e>=48&&e<=57||(e>=97&&e<=122||e>=65&&e<=90)}function i(e){return e>=48&&e<=55}function s(e){return e>=48&&e<=57||(e>=97&&e<=102||e>=65&&e<=70)}function r(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:0}Object.defineProperty(t,"__esModule",{value:!0}),t.getUnescapedString=void 0,t.getUnescapedString=function(e){const t=e.escapedValue,a=0!=(8&e.flags),o=0!=(64&e.flags);if(a&&!o)return{value:t,unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]};const l=[];for(let e=0;e13===e||10===e||92===e)))return{value:t,unescapeErrors:[],nonAsciiInBytes:c&&l.some((e=>e>=128)),formatStringSegments:[]};let p=0,d={offset:0,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1},u=0;const h={valueParts:[],unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]},m=()=>{a||h.unescapeErrors.push({offset:u-1,length:2,errorType:0})},y=(e=0)=>u+e>=l.length?3:l[u+e],g=e=>{let t=!1,n=0,i="";for(let i=0;i{const t=String.fromCharCode(e);h.valueParts.push(t),d.valueParts.push(t)};for(;;){let e=y();if(3===e)return o&&(d.isExpression&&h.unescapeErrors.push({offset:d.offset,length:u-d.offset,errorType:3}),u!==d.offset&&(d.length=u-d.offset,h.formatStringSegments.push(d))),_=h,{..._,value:_.valueParts.join(""),formatStringSegments:_.formatStringSegments.map((e=>({...e,value:e.valueParts.join("")})))};if(92===e){if(o&&d.isExpression&&!d.hasFormatSpecifier&&h.unescapeErrors.push({offset:u,length:1,errorType:1}),u++,a){f(e);continue}e=y();let t="";if(13===e||10===e)13===e&&10===y(1)&&(a&&(t+=String.fromCharCode(e)),u++,e=y()),a&&(t="\\"+t+String.fromCharCode(e)),u++;else if(a)t="\\"+String.fromCharCode(e),u++;else switch(e){case 92:case 39:case 34:t=String.fromCharCode(e),u++;break;case 97:t="",u++;break;case 98:t="\b",u++;break;case 102:t="\f",u++;break;case 110:t="\n",u++;break;case 114:t="\r",u++;break;case 116:t="\t",u++;break;case 118:t="\v",u++;break;case 120:t=g(2);break;case 78:{let i=!1,s=1;if(123!==y(s))i=!0;else for(s++;;){const e=y(s);if(125===e)break;if(!n(e)&&45!==e&&32!==(T=e)&&9!==T){i=!0;break}s++}i?(m(),t="\\"+String.fromCharCode(e),u++):(t="-",u+=1+s);break}case 117:t=g(4);break;case 85:t=g(8);break;default:if(i(e)){let n=e-48;u++,e=y(),i(e)&&(n=8*n+e-48,u++,e=y(),i(e)&&(n=8*n+e-48,u++)),t=String.fromCharCode(n)}else t="\\",m()}h.valueParts.push(t),d.valueParts.push(t)}else if(10===e||13===e)13===e&&10===y(1)&&(f(e),u++,e=y()),f(e),u++;else if(o&&123===e)d.isExpression||123!==y(1)?(0===p?(d.length=u-d.offset,d.length>0&&h.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!0,hasFormatSpecifier:!1}):(f(e),u++),p++):(f(e),u+=2);else if(o&&125===e)d.isExpression||125!==y(1)?0===p?(h.unescapeErrors.push({offset:u,length:1,errorType:2}),u++):(p--,0===p?(d.length=u-d.offset,h.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1}):(f(e),u++)):(f(e),u+=2);else if(!d.isExpression||39!==e&&34!==e)d.isExpression&&58===e&&(d.hasFormatSpecifier=!0),c&&e>=128&&(h.nonAsciiInBytes=!0),f(e),u++;else{const t=e;f(e);const n=y(1)===t&&y(2)===t;for(n&&(u+=2,f(e),f(e),h.valueParts.push(String.fromCharCode(e)),h.valueParts.push(String.fromCharCode(e)));;){u++;let e=y();if(3===e)break;if(92!==e){if((10===e||13===e)&&!n)break;if(e===t){if(!n){u++,f(e);break}if(y(1)===t&&y(2)===t){u+=3,f(e),f(e),f(e);break}}f(e)}else f(e),u++,e=y(),f(e)}}}var T,_}},7280:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=void 0;const i=n(979),s=n(49900),r=n(19794),a=n(66945),o=new Map([["and",0],["as",1],["assert",2],["async",3],["await",4],["break",5],["case",6],["class",7],["continue",8],["__debug__",9],["def",10],["del",11],["elif",12],["else",13],["except",14],["finally",16],["for",17],["from",18],["global",19],["if",20],["import",21],["in",22],["is",23],["lambda",24],["match",25],["nonlocal",27],["not",28],["or",29],["pass",30],["raise",31],["return",32],["try",34],["while",35],["with",36],["yield",37],["False",15],["None",26],["True",33]]),l={0:3,1:4,2:4,3:2,4:4,5:1,6:2,7:4,8:2,9:4,10:2,11:4,12:10,13:2,14:4,15:10,16:10,17:2,18:4,19:26,20:10,21:10,22:2,23:4,24:2,25:4,26:2,27:4,28:10,29:2,30:4,31:2,32:4,33:2,34:4,36:2,37:2,38:1,39:2,40:2,41:2,42:2};t.Tokenizer=class{constructor(){this._cs=new r.CharacterStream(""),this._tokens=[],this._prevLineStart=0,this._parenDepth=0,this._lineRanges=[],this._indentAmounts=[],this._typeIgnoreAll=!1,this._typeIgnoreLines={},this._crCount=0,this._crLfCount=0,this._lfCount=0,this._indentCount=0,this._indentTabCount=0,this._indentSpacesTotal=0,this._singleQuoteCount=0,this._doubleQuoteCount=0}tokenize(e,t,n,s=0){if(void 0===t)t=0;else if(t<0||t>e.length)throw new Error("Invalid range start");if(void 0===n)n=e.length;else{if(n<0||t+n>e.length)throw new Error("Invalid range length");t+n=o)););0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,0,3,this._getComments())),this._setIndent(0,0,!0,!1),this._tokens.push(a.Token.create(1,this._cs.position,0,this._getComments())),this._addLineRange();let l="\n";this._crCount>this._crLfCount&&this._crCount>this._lfCount?l="\r":this._crLfCount>this._crCount&&this._crLfCount>this._lfCount&&(l="\r\n");let c=" ";if(this._indentTabCount>this._indentCount/2)c="\t";else if(this._indentCount>0){let e=Math.round(this._indentSpacesTotal/this._indentCount);e<1?e=1:e>8&&(e=8),c="";for(let t=0;t=this._doubleQuoteCount?"'":'"'}}static getOperatorInfo(e){return l[e]}static isOperatorAssignment(e){return void 0!==e&&void 0!==l[e]&&0!=(4&l[e])}static isOperatorComparison(e){return void 0!==e&&void 0!==l[e]&&0!=(8&l[e])}_addNextToken(){this._cs.skipWhitespace(),this._cs.isEndOfStream()||this._handleCharacter()||this._cs.moveNext()}_handleCharacter(){const e=this._getStringPrefixLength();if(e>=0){let t="";e>0&&(t=this._cs.getText().substr(this._cs.position,e),this._cs.advance(e));const n=this._getQuoteTypeFlags(t);if(0!==n)return this._handleString(n,e),!0}if(35===this._cs.currentChar)return this._handleComment(),!0;switch(this._cs.currentChar){case 65279:return 0!==this._cs.position&&this._handleInvalid();case 13:{const e=10===this._cs.nextChar?2:1,t=2===e?2:0;return this._handleNewLine(e,t),!0}case 10:return this._handleNewLine(1,1),!0;case 92:return 13===this._cs.nextChar?(10===this._cs.lookAhead(2)?this._cs.advance(3):this._cs.advance(2),this._addLineRange(),!0):10===this._cs.nextChar?(this._cs.advance(2),this._addLineRange(),!0):this._handleInvalid();case 40:this._parenDepth++,this._tokens.push(a.Token.create(13,this._cs.position,1,this._getComments()));break;case 41:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(14,this._cs.position,1,this._getComments()));break;case 91:this._parenDepth++,this._tokens.push(a.Token.create(15,this._cs.position,1,this._getComments()));break;case 93:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(16,this._cs.position,1,this._getComments()));break;case 123:this._parenDepth++,this._tokens.push(a.Token.create(17,this._cs.position,1,this._getComments()));break;case 125:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(18,this._cs.position,1,this._getComments()));break;case 44:this._tokens.push(a.Token.create(12,this._cs.position,1,this._getComments()));break;case 96:this._tokens.push(a.Token.create(22,this._cs.position,1,this._getComments()));break;case 59:this._tokens.push(a.Token.create(11,this._cs.position,1,this._getComments()));break;case 58:if(61===this._cs.nextChar){this._tokens.push(a.OperatorToken.create(this._cs.position,2,35,this._getComments())),this._cs.advance(1);break}this._tokens.push(a.Token.create(10,this._cs.position,1,this._getComments()));break;default:if(this._isPossibleNumber()&&this._tryNumber())return!0;if(46===this._cs.currentChar){if(46===this._cs.nextChar&&46===this._cs.lookAhead(2))return this._tokens.push(a.Token.create(19,this._cs.position,3,this._getComments())),this._cs.advance(3),!0;this._tokens.push(a.Token.create(20,this._cs.position,1,this._getComments()));break}return!(!this._tryIdentifier()&&!this._tryOperator())||this._handleInvalid()}return!1}_addLineRange(){const e=this._cs.position-this._prevLineStart;e>0&&this._lineRanges.push({start:this._prevLineStart,length:e}),this._prevLineStart=this._cs.position}_handleNewLine(e,t){0===this._parenDepth&&3!==t&&(0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,e,t,this._getComments()))),0===t?this._crCount++:2===t?this._crLfCount++:this._lfCount++,this._cs.advance(e),this._addLineRange(),this._readIndentationAfterNewLine()}_readIndentationAfterNewLine(){let e=0,t=0,n=!1,i=!1;for(;!this._cs.isEndOfStream();)switch(this._cs.currentChar){case 32:e++,t++,i=!0,this._cs.moveNext();break;case 9:e++,t+=8-t%8,n=!0,this._cs.moveNext();break;case 12:e=0,t=0,n=!1,i=!1,this._cs.moveNext();break;default:return void this._setIndent(e,t,i,n);case 35:case 10:case 13:return}}_setIndent(e,t,n,i){if(!(this._parenDepth>0))if(0===this._indentAmounts.length)t>0&&(this._indentCount++,i&&this._indentTabCount++,this._indentSpacesTotal+=t,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:i}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,!1,this._getComments())));else{const s=this._indentAmounts[this._indentAmounts.length-1];if(s.tab8Spaces=e;this._indentCount++,i&&this._indentTabCount++,this._indentSpacesTotal+=t-this._indentAmounts[this._indentAmounts.length-1].tab8Spaces,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:i}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,r,this._getComments()))}else{const e=[];for(;this._indentAmounts.length>0&&this._indentAmounts[this._indentAmounts.length-1].tab8Spaces>t;)e.push(this._indentAmounts.length>1?this._indentAmounts[this._indentAmounts.length-2].tab8Spaces:0),this._indentAmounts.pop();e.forEach(((n,i)=>{const s=i{for(;;)if(s.isIdentifierChar(this._cs.currentChar))this._cs.moveNext();else{if(!s.isIdentifierChar(this._cs.currentChar,this._cs.nextChar))break;this._cs.moveNext(),this._cs.moveNext()}},t=this._cs.position;if(s.isIdentifierStartChar(this._cs.currentChar)?(this._cs.moveNext(),e()):s.isIdentifierStartChar(this._cs.currentChar,this._cs.nextChar)&&(this._cs.moveNext(),this._cs.moveNext(),e()),this._cs.position>t){const e=this._cs.getText().substr(t,this._cs.position-t);return o.has(e)?this._tokens.push(a.KeywordToken.create(t,this._cs.position-t,o.get(e),this._getComments())):this._tokens.push(a.IdentifierToken.create(t,this._cs.position-t,e,this._getComments())),!0}return!1}_isPossibleNumber(){return!!s.isDecimal(this._cs.currentChar)||!(46!==this._cs.currentChar||!s.isDecimal(this._cs.nextChar))}_tryNumber(){const e=this._cs.position;if(48===this._cs.currentChar){let t=0,n=0;if((120===this._cs.nextChar||88===this._cs.nextChar)&&s.isHex(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;s.isHex(this._cs.currentChar);)this._cs.moveNext();t=16}if((98===this._cs.nextChar||66===this._cs.nextChar)&&s.isBinary(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;s.isBinary(this._cs.currentChar);)this._cs.moveNext();t=2}if((111===this._cs.nextChar||79===this._cs.nextChar)&&s.isOctal(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;s.isOctal(this._cs.currentChar);)this._cs.moveNext();t=8}if(t>0){const i=this._cs.getText().substr(e,this._cs.position-e),s=parseInt(i.substr(n).replace(/_/g,""),t);if(!isNaN(s))return this._tokens.push(a.NumberToken.create(e,i.length,s,!0,!1,this._getComments())),!0}}let t=!1,n=!1;if(this._cs.currentChar>=49&&this._cs.currentChar<=57){for(;s.isDecimal(this._cs.currentChar);)n=!0,this._cs.moveNext();t=46!==this._cs.currentChar&&101!==this._cs.currentChar&&69!==this._cs.currentChar}if(48===this._cs.currentChar){for(n=!0;48===this._cs.currentChar||95===this._cs.currentChar;)this._cs.moveNext();t=46!==this._cs.currentChar&&101!==this._cs.currentChar&&69!==this._cs.currentChar}if(t){let t=this._cs.getText().substr(e,this._cs.position-e);const n=parseInt(t.replace(/_/g,""),10);if(!isNaN(n)){let i=!1;return 106!==this._cs.currentChar&&74!==this._cs.currentChar||(i=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,t.length,n,!0,i,this._getComments())),!0}}if(this._cs.position=e,(n||46===this._cs.currentChar&&this._cs.nextChar>=48&&this._cs.nextChar<=57)&&this._skipFloatingPointCandidate()){let t=this._cs.getText().substr(e,this._cs.position-e);const n=parseFloat(t);if(!isNaN(n)){let i=!1;return 106!==this._cs.currentChar&&74!==this._cs.currentChar||(i=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,this._cs.position-e,n,!1,i,this._getComments())),!0}}return this._cs.position=e,!1}_tryOperator(){let e=0;const t=this._cs.nextChar;let n;switch(this._cs.currentChar){case 43:e=61===t?2:1,n=2===e?1:0;break;case 38:e=61===t?2:1,n=2===e?4:3;break;case 124:e=61===t?2:1,n=2===e?7:6;break;case 94:e=61===t?2:1,n=2===e?9:8;break;case 61:e=61===t?2:1,n=2===e?12:2;break;case 33:if(61!==t)return!1;e=2,n=28;break;case 37:e=61===t?2:1,n=2===e?25:24;break;case 126:e=1,n=5;break;case 45:if(62===t)return this._tokens.push(a.Token.create(21,this._cs.position,2,this._getComments())),this._cs.advance(2),!0;e=61===t?2:1,n=2===e?34:33;break;case 42:42===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?30:29):(e=61===t?2:1,n=2===e?27:26);break;case 47:47===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?14:13):(e=61===t?2:1,n=2===e?11:10);break;case 60:60===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?18:17):62===t?(e=2,n=19):(e=61===t?2:1,n=2===e?21:20);break;case 62:62===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?32:31):(e=61===t?2:1,n=2===e?16:15);break;case 64:e=61===t?2:1,n=2===e?23:22;break;default:return!1}return this._tokens.push(a.OperatorToken.create(this._cs.position,e,n,this._getComments())),this._cs.advance(e),e>0}_handleInvalid(){const e=this._cs.position;for(;10!==this._cs.currentChar&&13!==this._cs.currentChar&&!this._cs.isAtWhiteSpace()&&!this._cs.isEndOfStream();)s.isSurrogateChar(this._cs.currentChar)?(this._cs.moveNext(),this._cs.moveNext()):this._cs.moveNext();const t=this._cs.position-e;return t>0&&(this._tokens.push(a.Token.create(0,e,t,this._getComments())),!0)}_getComments(){const e=this._comments;return this._comments=void 0,e}_handleComment(){const e=this._cs.position+1;this._cs.skipToEol();const t=this._cs.position-e,n=this._cs.getText().substr(e,t),i=a.Comment.create(e,t,n);n.match(/^\s*type:\s*ignore(\s|\[|$)/)&&(this._tokens.findIndex((e=>2!==e.type&&e&&3!==e.type))<0?this._typeIgnoreAll=!0:this._typeIgnoreLines[this._lineRanges.length]=!0),this._comments?this._comments.push(i):this._comments=[i]}_getStringPrefixLength(){if(39===this._cs.currentChar||34===this._cs.currentChar)return 0;if(39===this._cs.nextChar||34===this._cs.nextChar)switch(this._cs.currentChar){case 102:case 70:case 114:case 82:case 98:case 66:case 117:case 85:return 1}if(39===this._cs.lookAhead(2)||34===this._cs.lookAhead(2)){switch(this._cs.getText().substr(this._cs.position,2).toLowerCase()){case"rf":case"fr":case"ur":case"ru":case"br":case"rb":return 2}}return-1}_getQuoteTypeFlags(e){let t=0;e=e.toLowerCase();for(let n=0;n32768&&(i=i.slice(0,32768),e|=131072),{escapedValue:String.fromCharCode.apply(void 0,i),flags:e}}_skipFloatingPointCandidate(){const e=this._cs.position;return this._skipFractionalNumber(),this._cs.position>e&&(101!==this._cs.currentChar&&69!==this._cs.currentChar||(this._cs.moveNext(),this._skipDecimalNumber(!0))),this._cs.position>e}_skipFractionalNumber(){this._skipDecimalNumber(!1),46===this._cs.currentChar&&this._cs.moveNext(),this._skipDecimalNumber(!1)}_skipDecimalNumber(e){for(!e||45!==this._cs.currentChar&&43!==this._cs.currentChar||this._cs.moveNext();s.isDecimal(this._cs.currentChar);)this._cs.moveNext()}}},66945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierToken=t.OperatorToken=t.NumberToken=t.StringToken=t.KeywordToken=t.NewLineToken=t.DedentToken=t.IndentToken=t.Token=t.Comment=void 0,function(e){e.create=function(e,t,n){return{start:e,length:t,value:n}}}(t.Comment||(t.Comment={})),function(e){e.create=function(e,t,n,i){return{start:t,length:n,type:e,comments:i}}}(t.Token||(t.Token={})),function(e){e.create=function(e,t,n,i,s){return{start:e,length:t,type:3,isIndentAmbiguous:i,comments:s,indentAmount:n}}}(t.IndentToken||(t.IndentToken={})),function(e){e.create=function(e,t,n,i,s){return{start:e,length:t,type:4,comments:s,indentAmount:n,matchesIndent:i}}}(t.DedentToken||(t.DedentToken={})),function(e){e.create=function(e,t,n,i){return{start:e,length:t,type:2,comments:i,newLineType:n}}}(t.NewLineToken||(t.NewLineToken={})),function(e){e.create=function(e,t,n,i){return{start:e,length:t,type:8,comments:i,keywordType:n}}}(t.KeywordToken||(t.KeywordToken={})),function(e){e.create=function(e,t,n,i,s,r){return{start:e,length:t,type:5,flags:n,escapedValue:i,prefixLength:s,quoteMarkLength:4&n?3:1,comments:r}}}(t.StringToken||(t.StringToken={})),function(e){e.create=function(e,t,n,i,s,r){return{start:e,length:t,type:6,isInteger:i,isImaginary:s,value:n,comments:r}}}(t.NumberToken||(t.NumberToken={})),function(e){e.create=function(e,t,n,i){return{start:e,length:t,type:9,operatorType:n,comments:i}}}(t.OperatorToken||(t.OperatorToken={})),function(e){e.create=function(e,t,n,i){return{start:e,length:t,type:7,value:n,comments:i}}}(t.IdentifierToken||(t.IdentifierToken={}))},52846:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unicodePc=t.unicodeNdSurrogate=t.unicodeNd=t.unicodeMcSurrogate=t.unicodeMc=t.unicodeMnSurrogate=t.unicodeMn=t.unicodeNlSurrogate=t.unicodeNl=t.unicodeLmSurrogate=t.unicodeLm=t.unicodeLoSurrogate=t.unicodeLo=t.unicodeLt=t.unicodeLlSurrogate=t.unicodeLl=t.unicodeLuSurrogate=t.unicodeLu=void 0,t.unicodeLu=[[65,90],[192,214],[216,222],256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,313,315,317,319,321,323,325,327,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,[376,377],379,381,[385,386],388,[390,391],[393,395],[398,401],[403,404],[406,408],[412,413],[415,416],418,420,[422,423],425,428,[430,431],[433,435],437,[439,440],444,452,455,458,461,463,465,467,469,471,473,475,478,480,482,484,486,488,490,492,494,497,500,[502,504],506,508,510,512,514,516,518,520,522,524,526,528,530,532,534,536,538,540,542,544,546,548,550,552,554,556,558,560,562,[570,571],[573,574],577,[579,582],584,586,588,590,880,882,886,895,902,[904,906],908,[910,911],[913,929],[931,939],975,[978,980],984,986,988,990,992,994,996,998,1e3,1002,1004,1006,1012,1015,[1017,1018],[1021,1071],1120,1122,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146,1148,1150,1152,1162,1164,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188,1190,1192,1194,1196,1198,1200,1202,1204,1206,1208,1210,1212,1214,[1216,1217],1219,1221,1223,1225,1227,1229,1232,1234,1236,1238,1240,1242,1244,1246,1248,1250,1252,1254,1256,1258,1260,1262,1264,1266,1268,1270,1272,1274,1276,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298,1300,1302,1304,1306,1308,1310,1312,1314,1316,1318,1320,1322,1324,1326,[1329,1366],[4256,4293],4295,4301,[5024,5109],7680,7682,7684,7686,7688,7690,7692,7694,7696,7698,7700,7702,7704,7706,7708,7710,7712,7714,7716,7718,7720,7722,7724,7726,7728,7730,7732,7734,7736,7738,7740,7742,7744,7746,7748,7750,7752,7754,7756,7758,7760,7762,7764,7766,7768,7770,7772,7774,7776,7778,7780,7782,7784,7786,7788,7790,7792,7794,7796,7798,7800,7802,7804,7806,7808,7810,7812,7814,7816,7818,7820,7822,7824,7826,7828,7838,7840,7842,7844,7846,7848,7850,7852,7854,7856,7858,7860,7862,7864,7866,7868,7870,7872,7874,7876,7878,7880,7882,7884,7886,7888,7890,7892,7894,7896,7898,7900,7902,7904,7906,7908,7910,7912,7914,7916,7918,7920,7922,7924,7926,7928,7930,7932,7934,[7944,7951],[7960,7965],[7976,7983],[7992,7999],[8008,8013],8025,8027,8029,8031,[8040,8047],[8120,8123],[8136,8139],[8152,8155],[8168,8172],[8184,8187],8450,8455,[8459,8461],[8464,8466],8469,[8473,8477],8484,8486,8488,[8490,8493],[8496,8499],[8510,8511],8517,8579,[11264,11310],11360,[11362,11364],11367,11369,11371,[11373,11376],11378,11381,[11390,11392],11394,11396,11398,11400,11402,11404,11406,11408,11410,11412,11414,11416,11418,11420,11422,11424,11426,11428,11430,11432,11434,11436,11438,11440,11442,11444,11446,11448,11450,11452,11454,11456,11458,11460,11462,11464,11466,11468,11470,11472,11474,11476,11478,11480,11482,11484,11486,11488,11490,11499,11501,11506,42560,42562,42564,42566,42568,42570,42572,42574,42576,42578,42580,42582,42584,42586,42588,42590,42592,42594,42596,42598,42600,42602,42604,42624,42626,42628,42630,42632,42634,42636,42638,42640,42642,42644,42646,42648,42650,42786,42788,42790,42792,42794,42796,42798,42802,42804,42806,42808,42810,42812,42814,42816,42818,42820,42822,42824,42826,42828,42830,42832,42834,42836,42838,42840,42842,42844,42846,42848,42850,42852,42854,42856,42858,42860,42862,42873,42875,[42877,42878],42880,42882,42884,42886,42891,42893,42896,42898,42902,42904,42906,42908,42910,42912,42914,42916,42918,42920,[42922,42926],[42928,42932],42934,[65313,65338],[66560,66599],[66736,66771],[68736,68786],[71840,71871],[119808,119833],[119860,119885],[119912,119937],119964,[119966,119967],119970,[119973,119974],[119977,119980],[119982,119989],[120016,120041],[120068,120069],[120071,120074],[120077,120084],[120086,120092],[120120,120121],[120123,120126],[120128,120132],120134,[120138,120144],[120172,120197],[120224,120249],[120276,120301],[120328,120353],[120380,120405],[120432,120457],[120488,120512],[120546,120570],[120604,120628],[120662,120686],[120720,120744],120778,[125184,125217]],t.unicodeLuSurrogate={55297:[[56320,56359],[56496,56531]],55299:[[56448,56498]],55302:[[56480,56511]],55323:[[56896,56927]],55349:[[56320,56345],[56372,56397],[56424,56449],56476,[56478,56479],56482,[56485,56486],[56489,56492],[56494,56501],[56528,56553],[56580,56581],[56583,56586],[56589,56596],[56598,56604],[56632,56633],[56635,56638],[56640,56644],56646,[56650,56656],[56684,56709],[56736,56761],[56788,56813],[56840,56865],[56892,56917],[56944,56969],[57e3,57024],[57058,57082],[57116,57140],[57174,57198],[57232,57256],[57290,57290]],55354:[[56576,56609]]},t.unicodeLl=[[97,122],181,[223,246],[248,255],257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,[311,312],314,316,318,320,322,324,326,[328,329],331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,361,363,365,367,369,371,373,375,378,380,[382,384],387,389,392,[396,397],402,405,[409,411],414,417,419,421,424,[426,427],429,432,436,438,[441,442],[445,447],454,457,460,462,464,466,468,470,472,474,[476,477],479,481,483,485,487,489,491,493,[495,496],499,501,505,507,509,511,513,515,517,519,521,523,525,527,529,531,533,535,537,539,541,543,545,547,549,551,553,555,557,559,561,[563,569],572,[575,576],578,583,585,587,589,[591,659],[661,687],881,883,887,[891,893],912,[940,974],[976,977],[981,983],985,987,989,991,993,995,997,999,1001,1003,1005,[1007,1011],1013,1016,[1019,1020],[1072,1119],1121,1123,1125,1127,1129,1131,1133,1135,1137,1139,1141,1143,1145,1147,1149,1151,1153,1163,1165,1167,1169,1171,1173,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211,1213,1215,1218,1220,1222,1224,1226,1228,[1230,1231],1233,1235,1237,1239,1241,1243,1245,1247,1249,1251,1253,1255,1257,1259,1261,1263,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319,1321,1323,1325,1327,[1377,1415],[5112,5117],[7296,7304],[7424,7467],[7531,7543],[7545,7578],7681,7683,7685,7687,7689,7691,7693,7695,7697,7699,7701,7703,7705,7707,7709,7711,7713,7715,7717,7719,7721,7723,7725,7727,7729,7731,7733,7735,7737,7739,7741,7743,7745,7747,7749,7751,7753,7755,7757,7759,7761,7763,7765,7767,7769,7771,7773,7775,7777,7779,7781,7783,7785,7787,7789,7791,7793,7795,7797,7799,7801,7803,7805,7807,7809,7811,7813,7815,7817,7819,7821,7823,7825,7827,[7829,7837],7839,7841,7843,7845,7847,7849,7851,7853,7855,7857,7859,7861,7863,7865,7867,7869,7871,7873,7875,7877,7879,7881,7883,7885,7887,7889,7891,7893,7895,7897,7899,7901,7903,7905,7907,7909,7911,7913,7915,7917,7919,7921,7923,7925,7927,7929,7931,7933,[7935,7943],[7952,7957],[7968,7975],[7984,7991],[8e3,8005],[8016,8023],[8032,8039],[8048,8061],[8064,8071],[8080,8087],[8096,8103],[8112,8116],[8118,8119],8126,[8130,8132],[8134,8135],[8144,8147],[8150,8151],[8160,8167],[8178,8180],[8182,8183],8458,[8462,8463],8467,8495,8500,8505,[8508,8509],[8518,8521],8526,8580,[11312,11358],11361,[11365,11366],11368,11370,11372,11377,[11379,11380],[11382,11387],11393,11395,11397,11399,11401,11403,11405,11407,11409,11411,11413,11415,11417,11419,11421,11423,11425,11427,11429,11431,11433,11435,11437,11439,11441,11443,11445,11447,11449,11451,11453,11455,11457,11459,11461,11463,11465,11467,11469,11471,11473,11475,11477,11479,11481,11483,11485,11487,11489,[11491,11492],11500,11502,11507,[11520,11557],11559,11565,42561,42563,42565,42567,42569,42571,42573,42575,42577,42579,2581,42583,42585,42587,42589,42591,42593,42595,42597,42599,42601,42603,42605,42625,42627,42629,42631,42633,42635,42637,42639,42641,42643,42645,42647,42649,42651,42787,42789,42791,42793,42795,42797,[42799,42801],42803,42805,42807,42809,42811,42813,42815,42817,42819,42821,42823,42825,42827,42829,42831,42833,42835,42837,42839,42841,42843,42845,42847,42849,42851,42853,42855,42857,42859,42861,42863,[42865,42872],42874,42876,42879,42881,42883,42885,42887,42892,42894,42897,[42899,42901],42903,42905,42907,42909,42911,42913,42915,42917,42919,42921,42933,42935,43002,[43824,43866],[43872,43877],[43888,43967],[64256,64262],[64275,64279],[65345,65370],[66600,66639],[66776,66811],[68800,68850],[71872,71903],[119834,119859],[119886,119892],[119894,119911],[119938,119963],[119990,119993],119995,[119997,120003],[120005,120015],[120042,120067],[120094,120119],[120146,120171],[120198,120223],[120250,120275],[120302,120327],[120354,120379],[120406,120431],[120458,120485],[120514,120538],[120540,120545],[120572,120596],[120598,120603],[120630,120654],[120656,120661],[120688,120712],[120714,120719],[120746,120770],[120772,120777],120779,[125218,125251]],t.unicodeLlSurrogate={55297:[[56360,56399],[56536,56571]],55299:[[56512,56562]],55302:[[56512,56543]],55323:[[56928,56959]],55349:[[56346,56371],[56398,56404],[56406,56423],[56450,56475],[56502,56505],56507,[56509,56515],[56517,56527],[56554,56579],[56606,56631],[56658,56683],[56710,56735],[56762,56787],[56814,56839],[56866,56891],[56918,56943],[56970,56997],[57026,57050],[57052,57057],[57084,57108],[57110,57115],[57142,57166],[57168,57173],[57200,57224],[57226,57231],[57258,57282],[57284,57289],[57291,57291]],55354:[[56610,56643]]},t.unicodeLt=[453,456,459,498,[8072,8079],[8088,8095],[8104,8111],8124,8140,8188],t.unicodeLo=[170,186,443,[448,451],660,[1488,1514],[1520,1522],[1568,1599],[1601,1610],[1646,1647],[1649,1747],1749,[1774,1775],[1786,1788],1791,1808,[1810,1839],[1869,1957],1969,[1994,2026],[2048,2069],[2112,2136],[2144,2154],[2208,2228],[2230,2237],[2308,2361],2365,2384,[2392,2401],[2418,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],2482,[2486,2489],2493,2510,[2524,2525],[2527,2529],[2544,2545],2556,[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],2654,[2674,2676],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],2749,2768,[2784,2785],2809,[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],2877,[2908,2909],[2911,2913],2929,2947,[2949,2954],[2958,2960],[2962,2965],[2969,2970],2972,[2974,2975],[2979,2980],[2984,2986],[2990,3001],3024,[3077,3084],[3086,3088],[3090,3112],[3114,3129],3133,[3160,3162],[3168,3169],3200,[3205,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],3261,3294,[3296,3297],[3313,3314],[3333,3340],[3342,3344],[3346,3386],3389,3406,[3412,3414],[3423,3425],[3450,3455],[3461,3478],[3482,3505],[3507,3515],3517,[3520,3526],[3585,3632],[3634,3635],[3648,3653],[3713,3714],3716,[3719,3720],3722,3725,[3732,3735],[3737,3743],[3745,3747],3749,3751,[3754,3755],[3757,3760],[3762,3763],3773,[3776,3780],[3804,3807],3840,[3904,3911],[3913,3948],[3976,3980],[4096,4138],4159,[4176,4181],[4186,4189],4193,[4197,4198],[4206,4208],[4213,4225],4238,[4304,4346],[4349,4680],[4682,4685],[4688,4694],4696,[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],4800,[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4992,5007],[5121,5740],[5743,5759],[5761,5786],[5792,5866],[5873,5880],[5888,5900],[5902,5905],[5920,5937],[5952,5969],[5984,5996],[5998,6e3],[6016,6067],6108,[6176,6210],[6212,6263],[6272,6276],[6279,6312],6314,[6320,6389],[6400,6430],[6480,6509],[6512,6516],[6528,6571],[6576,6601],[6656,6678],[6688,6740],[6917,6963],[6981,6987],[7043,7072],[7086,7087],[7098,7141],[7168,7203],[7245,7247],[7258,7287],[7401,7404],[7406,7409],[7413,7414],[8501,8504],[11568,11623],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],12294,12348,[12353,12438],12447,[12449,12538],12543,[12549,12590],[12593,12686],[12704,12730],[12784,12799],[13312,19893],[19968,40938],[40960,40980],[40982,42124],[42192,42231],[42240,42507],[42512,42527],[42538,42539],42606,[42656,42725],42895,42999,[43003,43009],[43011,43013],[43015,43018],[43020,43042],[43072,43123],[43138,43187],[43250,43255],43259,43261,[43274,43301],[43312,43334],[43360,43388],[43396,43442],[43488,43492],[43495,43503],[43514,43518],[43520,43560],[43584,43586],[43588,43595],[43616,43631],[43633,43638],43642,[43646,43695],43697,[43701,43702],[43705,43709],43712,43714,[43739,43740],[43744,43754],43762,[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43968,44002],[44032,55203],[55216,55238],[55243,55291],[63744,64109],[64112,64217],64285,[64287,64296],[64298,64310],[64312,64316],64318,[64320,64321],[64323,64324],[64326,64433],[64467,64829],[64848,64911],[64914,64967],[65008,65019],[65136,65140],[65142,65276],[65382,65391],[65393,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[66176,66204],[66208,66256],[66304,66335],[66349,66368],[66370,66377],[66384,66421],[66432,66461],[66464,66499],[66504,66511],[66640,66717],[66816,66855],[66864,66915],[67072,67382],[67392,67413],[67424,67431],[67584,67589],67592,[67594,67637],[67639,67640],67644,[67647,67669],[67680,67702],[67712,67742],[67808,67826],[67828,67829],[67840,67861],[67872,67897],[67968,68023],[68030,68031],68096,[68112,68115],[68117,68119],[68121,68147],[68192,68220],[68224,68252],[68288,68295],[68297,68324],[68352,68405],[68416,68437],[68448,68466],[68480,68497],[68608,68680],[69635,69687],[69763,69807],[69840,69864],[69891,69926],[69968,70002],70006,[70019,70066],[70081,70084],70106,70108,[70144,70161],[70163,70187],[70272,70278],70280,[70282,70285],[70287,70301],[70303,70312],[70320,70366],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],70461,70480,[70493,70497],[70656,70708],[70727,70730],[70784,70831],[70852,70853],70855,[71040,71086],[71128,71131],[71168,71215],71236,[71296,71338],[71424,71449],71935,72192,[72203,72242],72250,72272,[72284,72323],[72326,72329],[72384,72440],[72704,72712],[72714,72750],72768,[72818,72847],[72960,72966],[72968,72969],[72971,73008],73030,[73728,74649],[74880,75075],[77824,78894],[82944,83526],[92160,92728],[92736,92766],[92880,92909],[92928,92975],[93027,93047],[93053,93071],[93952,94020],94032,[94208,100332],[100352,101106],[110592,110878],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[124928,125124],[126464,126467],[126469,126495],[126497,126498],126500,126503,[126505,126514],[126516,126519],126521,126523,126530,126535,126537,126539,[126541,126543],[126545,126546],126548,126551,126553,126555,126557,126559,[126561,126562],126564,[126567,126570],[126572,126578],[126580,126583],[126585,126588],126590,[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[131072,173782],[173824,177972],[177984,178205],[178208,183969],[183984,191456],[194560,195101]],t.unicodeLoSurrogate={55296:[[56320,56331],[56333,56358],[56360,56378],[56380,56381],[56383,56397],[56400,56413],[56448,56570],[56960,56988],[56992,57040],[57088,57119],[57133,57152],[57154,57161],[57168,57205],[57216,57245],[57248,57283],[57288,57295]],55297:[[56400,56477],[56576,56615],[56624,56675],[56832,57142],[57152,57173],[57184,57191]],55298:[[56320,56325],[56328,56328],[56330,56373],[56375,56376],[56380,56380],[56383,56405],[56416,56438],[56448,56478],[56544,56562],[56564,56565],[56576,56597],[56608,56633],[56704,56759],[56766,56767],[56832,56832],[56848,56851],[56853,56855],[56857,56885],[56928,56956],[56960,56988],[57024,57031],[57033,57060],[57088,57141],[57152,57173],[57184,57202],[57216,57233]],55299:[[56320,56392],[56576,56611],[56960,57001],[57008,57009],[57088,57116],57127,[57136,57157],[57264,57284],[57312,57334]],55300:[[56323,56375],[56451,56495],[56528,56552],[56579,56614],56644,56647,[56656,56690],56694,[56707,56754],[56769,56772],56794,56796,[56832,56849],[56851,56875],[56960,56966],56968,[56970,56973],[56975,56989],[56991,57e3],[57008,57054],[57093,57100],[57103,57104],[57107,57128],[57130,57136],[57138,57139],[57141,57145],57149,57168,[57181,57185]],55301:[[56320,56372],[56391,56394],[56415,56417],[56448,56495],[56516,56517],56519,[56704,56750],[56792,56795],[56832,56879],56900,[56960,57002],57016,[57088,57114]],55302:[[56320,56363],[56575,56582],56585,[56588,56595],[56597,56598],[56600,56623],56639,56641,[56736,56743],[56746,56784],56801,56803,56832,[56843,56882],56890,56912,[56924,56969],56989,[57024,57080]],55303:[[56320,56328],[56330,56366],56384,56434,[56576,56582],[56584,56585],[56587,56624],56646,[56672,56677],[56679,56680],[56682,56713],56728,[57056,57074],57264],55304:[[56320,57241]],55305:[[56448,56643]],55308:[[56320,57343]],55309:[[56320,56366]],55313:[[56320,56902]],55322:[[56320,56888],[56896,56926],[57040,57069],[57088,57135],[57187,57207],[57213,57231]],55323:[[57088,57162],57168],55324:[56320],55329:[57335],55330:[[56320,57343]],55331:[[56320,56533],[56576,56576],[56584,56584]],55340:[[56320,56606],[56656,56658],[56676,56679],[56688,57083]],55343:[[56320,56426],[56432,56444],[56448,56456],[56464,56473]],55352:[[56576,56620],56654,[57024,57067]],55354:[[56320,56516]],55355:[[56832,56835],[56837,56863],[56865,56866],56868,56871,[56873,56882],[56884,56887],56889,56891,56898,56903,56905,56907,[56909,56911],[56913,56914],56916,56919,56921,56923,56925,56927,[56929,56930],56932,[56935,56938],[56940,56946],[56948,56951],[56953,56956],56958,[56960,56969],[56971,56987],[56993,56995],[56997,57001],[57003,57019]],55360:[56320],55401:[57053,57088],55405:[57140,57152],55406:[56349,56352],55411:[56993,57008],55418:[57312],55422:[[56320,56861]],55424:[56320],55428:[57162]},t.unicodeLm=[[688,705],[710,721],[736,740],748,750,884,890,1369,1600,[1765,1766],[2036,2037],2042,2074,2084,2088,2417,3654,3782,4348,6103,6211,6823,[7288,7293],[7468,7530],7544,[7579,7615],8305,8319,[8336,8348],[11388,11389],11631,11823,12293,[12337,12341],12347,[12445,12446],[12540,12542],40981,[42232,42237],42508,42623,[42652,42653],[42775,42783],42864,42888,[43e3,43001],43471,43494,43632,43741,[43763,43764],[43868,43871],65392,[65438,65439],[92992,92995],[94099,94111],[94176,94177]],t.unicodeLmSurrogate={55322:[[57152,57155]],55323:[[57235,57247],[57312,57313],57315],55352:[[56631,56637]],55354:[56651]},t.unicodeNl=[[5870,5872],[8544,8578],[8581,8584],12295,[12321,12329],[12344,12346],[42726,42735],[65856,65908],66369,66378,[66513,66517],[74752,74862]],t.unicodeNlSurrogate={55296:[[56640,56692],57153,57162,[57297,57301]],55305:[[56320,56430]]},t.unicodeMn=[[768,879],[1155,1159],[1425,1469],1471,[1473,1474],[1476,1477],1479,[1552,1562],[1611,1631],1648,[1750,1756],[1759,1764],[1767,1768],[1770,1773],1809,[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],2362,2364,[2369,2376],2381,[2385,2391],[2402,2403],2433,2492,[2497,2500],2509,[2530,2531],[2561,2562],2620,[2625,2626],[2631,2632],[2635,2637],2641,[2672,2673],2677,[2689,2690],2748,[2753,2757],[2759,2760],2765,[2786,2787],[2810,2815],2817,2876,2879,[2881,2884],2893,2902,[2914,2915],2946,3008,3021,3072,[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],3201,3260,3263,3270,[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],3405,[3426,3427],3530,[3538,3540],3542,3633,[3636,3642],[3655,3662],3761,[3764,3769],[3771,3772],[3784,3789],[3864,3865],3893,3895,3897,[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],4038,[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],4226,[4229,4230],4237,4253,[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],6086,[6089,6099],6109,[6155,6157],[6277,6278],6313,[6432,6434],[6439,6440],6450,[6457,6459],[6679,6680],6683,6742,[6744,6750],6752,6754,[6757,6764],[6771,6780],6783,[6832,6845],[6912,6915],6964,[6966,6970],6972,6978,[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],7142,[7144,7145],7149,[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],7405,7412,[7416,7417],[7616,7673],[7675,7679],[8400,8412],8417,[8421,8432],[11503,11505],11647,[11744,11775],[12330,12333],[12441,12442],42607,[42612,42621],[42654,42655],[42736,42737],43010,43014,43019,[43045,43046],[43204,43205],[43232,43249],[43302,43309],[43335,43345],[43392,43394],43443,[43446,43449],43452,43493,[43561,43566],[43569,43570],[43573,43574],43587,43596,43644,43696,[43698,43700],[43703,43704],[43710,43711],43713,[43756,43757],43766,44005,44008,44013,64286,[65024,65039],[65056,65071],66045,66272,[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],68159,[68325,68326],69633,[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],70003,[70016,70017],[70070,70078],[70090,70092],[70191,70193],70196,[70198,70199],70206,70367,[70371,70378],[70400,70401],70460,70464,[70502,70508],[70512,70516],[70712,70719],[70722,70724],70726,[70835,70840],70842,[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],71229,[71231,71232],71339,71341,[71344,71349],71351,[71453,71455],[71458,71461],[71463,71467],[72193,72198],[72201,72202],[72243,72248],[72251,72254],72263,[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],72767,[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],73018,[73020,73021],[73023,73029],73031,[92912,92916],[92976,92982],[94095,94098],[113821,113822],[119143,119145],[119163,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],121461,121476,[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[125136,125142],[125252,125258],[917760,917999]],t.unicodeMnSurrogate={55296:[56829,57056,[57206,57210]],55298:[[56833,56835],[56837,56838],[56844,56847],[56888,56890],56895,[57061,57062]],55299:[[56612,56615],[57003,57004],[57158,57168]],55300:[56321,[56376,56390],[56447,56449],[56499,56502],[56505,56506],[56576,56578],[56615,56619],[56621,56628],56691,[56704,56705],[56758,56766],[56777,56780],56783,[56879,56881],56884,[56886,56887],56894,57055,[57059,57066],[57088,57089],[57147,57148],57152,[57190,57196],[57200,57204]],55301:[[56376,56383],[56386,56388],56390,56414,[56499,56504],56506,[56511,56512],[56514,56515],[56754,56757],[56764,56765],[56767,56768],[56796,56797],[56883,56890],56893,[56895,56896],57003,57005,[57008,57013],57015,[57117,57119],[57122,57125],[57127,57131]],55302:[[56367,56375],[56377,56378],[56635,56636],56638,56643,[56788,56791],[56794,56795],56800,[56833,56842],[56883,56888],[56891,56894],56903,[56913,56918],[56921,56923],[56970,56982],[56984,56985]],55303:[[56368,56374],[56376,56381],56383,[56466,56487],[56490,56496],[56498,56499],[56501,56502],[56625,56630],56634,[56636,56637],[56639,56645],56647,[56720,56721],56725,56727,[57075,57076]],55322:[[57072,57076],[57136,57142]],55323:[57167,[57231,57234],57316],55343:[[56477,56478]],55348:[[56679,56681],[56699,56706],[56709,56715],[56746,56749],[56898,56900]],55350:[[56832,56886],[56891,56940],56949,56964,[56987,56991],[56993,57007]],55352:[[56320,56326],[56328,56344],[56347,56353],[56355,56356],[56358,56362],[56624,56630],[57068,57071]],55354:[[56528,56534],[56644,56650]],56128:[[56576,56815]]},t.unicodeMc=[2307,2363,[2366,2368],[2377,2380],[2382,2383],[2434,2435],[2494,2496],[2503,2504],[2507,2508],2519,2563,[2622,2624],2691,[2750,2752],2761,[2763,2764],[2818,2819],2878,2880,[2887,2888],[2891,2892],2903,[3006,3007],[3009,3010],[3014,3016],[3018,3020],3031,[3073,3075],[3137,3140],[3202,3203],3262,[3264,3268],[3271,3272],[3274,3275],[3285,3286],[3330,3331],[3390,3392],[3398,3400],[3402,3404],3415,[3458,3459],[3535,3537],[3544,3551],[3570,3571],[3902,3903],3967,[4139,4140],4145,4152,[4155,4156],[4182,4183],[4194,4196],[4199,4205],[4227,4228],[4231,4236],4239,[4250,4252],6070,[6078,6085],[6087,6088],[6435,6438],[6441,6443],[6448,6449],[6451,6456],[6681,6682],6741,6743,6753,[6755,6756],[6765,6770],6916,6965,6971,[6973,6977],[6979,6980],7042,7073,[7078,7079],7082,7143,[7146,7148],7150,[7154,7155],[7204,7211],[7220,7221],7393,[7410,7411],7415,[12334,12335],[43043,43044],43047,[43136,43137],[43188,43203],[43346,43347],43395,[43444,43445],[43450,43451],[43453,43456],[43567,43568],[43571,43572],43597,43643,43645,43755,[43758,43759],43765,[44003,44004],[44006,44007],[44009,44010],44012,69632,69634,69762,[69808,69810],[69815,69816],69932,70018,[70067,70069],[70079,70080],[70188,70190],[70194,70195],70197,[70368,70370],[70402,70403],[70462,70463],[70465,70468],[70471,70472],[70475,70477],70487,[70498,70499],[70709,70711],[70720,70721],70725,[70832,70834],70841,[70843,70846],70849,[71087,71089],[71096,71099],71102,[71216,71218],[71227,71228],71230,71340,[71342,71343],71350,[71456,71457],71462,[72199,72200],72249,[72279,72280],72343,72751,72766,72873,72881,72884,[94033,94078],[119141,119142],[119149,119154]],t.unicodeMcSurrogate={55300:[56320,56322,56450,[56496,56498],[56503,56504],56620,[56645,56646],56706,[56755,56757],[56767,56768],56782,[56876,56878],[56882,56883],56885,[57056,57058],[57090,57091],[57150,57151],[57153,57156],[57159,57160],[57163,57165],57175,[57186,57187]],55301:[[56373,56375],[56384,56385],56389,[56496,56498],56505,[56507,56510],56513,[56751,56753],[56760,56763],56766,[56880,56882],[56891,56892],56894,57004,[57006,57007],57014,[57120,57121],57126],55302:[[56364,56366],56376,[56624,56629],[56631,56632],56637,56640,56642,[56785,56787],[56796,56799],56804,56889,[56919,56920],56983],55303:[56367,56382,56489,56497,56500,[56714,56718],[56723,56724],56726,[57077,57078]],55323:[[57169,57223],[57328,57329]],55348:[[56677,56678],[56685,56690]]},t.unicodeNd=[[48,57],[1632,1641],[1776,1785],[1984,1993],[2406,2415],[2534,2543],[2662,2671],[2790,2799],[2918,2927],[3046,3055],[3174,3183],[3302,3311],[3430,3439],[3558,3567],[3664,3673],[3792,3801],[3872,3881],[4160,4169],[4240,4249],[6112,6121],[6160,6169],[6470,6479],[6608,6617],[6784,6793],[6800,6809],[6992,7001],[7088,7097],[7232,7241],[7248,7257],[42528,42537],[43216,43225],[43264,43273],[43472,43481],[43504,43513],[43600,43609],[44016,44025],[65296,65305],[66720,66729],[69734,69743],[69872,69881],[69942,69951],[70096,70105],[70384,70393],[70736,70745],[70864,70873],[71248,71257],[71360,71369],[71472,71481],[71904,71913],[72784,72793],[73040,73049],[92768,92777],[93008,93017],[120782,120831],[125264,125273]],t.unicodeNdSurrogate={55297:[[56480,56489]],55299:[[56624,56633]],55300:[[56422,56431],[56560,56569],[56630,56639],[56784,56793],[57072,57081]],55301:[[56400,56409],[56528,56537],[56912,56921],[57024,57033],[57136,57145]],55302:[[56544,56553],56656],55303:[[56400,56409],[56656,56665],[56736,56745]],55322:[[56928,56937],[57168,57177]],55349:[[57294,57343]],55352:[[56640,56649],[57072,57081]],55354:[[56656,56665]],55358:[[57328,57337]]},t.unicodePc=[95,[8255,8256],8276,[65075,65076],[65101,65103],65343]},37633:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PyrightFileSystem=void 0;const i=n(26477),s=n(6021),r=n(97956),a=n(94647);t.PyrightFileSystem=class{constructor(e){this._realFS=e,this._fileMap=new Map,this._reverseFileMap=new Map,this._folderMap=new Map,this._rootSearched=new Set,this._partialStubPackagePaths=new Set,this._conflictMap=new Map}existsSync(e){return!this._isVirtualEntry(e)&&this._realFS.existsSync(this._getPartialStubOriginalPath(e))}mkdirSync(e,t){this._realFS.mkdirSync(e,t)}chdir(e){this._realFS.chdir(e)}readdirEntriesSync(e){const t=this._realFS.readdirEntriesSync(e).filter((t=>!this._isVirtualEntry(a.combinePaths(e,t.name)))),n=this._folderMap.get(a.ensureTrailingDirectorySeparator(e));return n?t.concat(n.map((e=>new s.VirtualDirent(e,!0)))):t}readdirSync(e){const t=this._realFS.readdirSync(e).filter((t=>!this._isVirtualEntry(a.combinePaths(e,t)))),n=this._folderMap.get(a.ensureTrailingDirectorySeparator(e));return n?t.concat(n):t}readFileSync(e,t){return this._realFS.readFileSync(this._getPartialStubOriginalPath(e),t)}writeFileSync(e,t,n){this._realFS.writeFileSync(this._getPartialStubOriginalPath(e),t,n)}statSync(e){return this._realFS.statSync(this._getPartialStubOriginalPath(e))}unlinkSync(e){this._realFS.unlinkSync(this._getPartialStubOriginalPath(e))}realpathSync(e){return this._realFS.realpathSync(e)}getModulePath(){return this._realFS.getModulePath()}createFileSystemWatcher(e,t){return this._realFS.createFileSystemWatcher(e,t)}createReadStream(e){return this._realFS.createReadStream(this._getPartialStubOriginalPath(e))}createWriteStream(e){return this._realFS.createWriteStream(this._getPartialStubOriginalPath(e))}copyFileSync(e,t){this._realFS.copyFileSync(this._getPartialStubOriginalPath(e),this._getPartialStubOriginalPath(t))}readFile(e){return this._realFS.readFile(this._getPartialStubOriginalPath(e))}readFileText(e,t){return this._realFS.readFileText(this._getPartialStubOriginalPath(e),t)}tmpdir(){return this._realFS.tmpdir()}tmpfile(e){return this._realFS.tmpfile(e)}realCasePath(e){return this._realFS.realCasePath(e)}getUri(e){return this._realFS.getUri(e)}isPartialStubPackagesScanned(e){return this.isPathScanned(e.root)}isPathScanned(e){return this._rootSearched.has(e)}processPartialStubPackages(e,t){var n;for(const s of e)if(this._rootSearched.add(s),this._realFS.existsSync(s)&&a.isDirectory(this._realFS,s))for(const e of this._realFS.readdirEntriesSync(s)){const o=a.combinePaths(s,e.name);if(!(e.isSymbolicLink()?!!(null===(n=a.tryStat(this._realFS,o))||void 0===n?void 0:n.isDirectory()):e.isDirectory())||!e.name.endsWith(r.stubsSuffix))continue;const l=i.getPyTypedInfo(this._realFS,o);if(!l||!l.isPartiallyTyped)continue;let c;this._partialStubPackagePaths.add(o);const p=e.name.substr(0,e.name.length-r.stubsSuffix.length);for(const e of t){const t=a.combinePaths(e,p);try{const e=a.tryStat(this._realFS,t);if(!(null==e?void 0:e.isDirectory()))continue;const n=i.getPyTypedInfo(this._realFS,t);if(n&&!n.isPartiallyTyped)continue;c=null!=c?c:this._getRelativePathPartialStubs(o);for(const e of c){const n=a.combinePaths(o,e),i=a.combinePaths(t,e);if(this.existsSync(i)){const t=a.changeAnyExtension(i,"py"),s=a.changeAnyExtension(a.combinePaths(this.tmpdir(),"conflictFiles",p,e),"py");this._conflictMap.has(i)||this.existsSync(t)||this.existsSync(s)||(this._recordVirtualFile(s,n,!1),this._conflictMap.set(i,s))}else this._recordVirtualFile(i,n)}}catch{}}}}clearPartialStubs(){this._fileMap.clear(),this._folderMap.clear(),this._rootSearched.clear(),this._partialStubPackagePaths.clear(),this._conflictMap.clear()}isMappedFilePath(e){return this._fileMap.has(e)||this._realFS.isMappedFilePath(e)}getOriginalFilePath(e){return this._realFS.getOriginalFilePath(this._getPartialStubOriginalPath(e))}getMappedFilePath(e){var t;const n=this._realFS.getMappedFilePath(e);return null!==(t=this._reverseFileMap.get(n))&&void 0!==t?t:n}getConflictedFile(e){return this._conflictMap.get(e)}_recordVirtualFile(e,t,n=!0){this._fileMap.set(e,t),n&&this._reverseFileMap.set(t,e);const i=a.ensureTrailingDirectorySeparator(a.getDirectoryPath(e));let s=this._folderMap.get(i);s||(s=[],this._folderMap.set(i,s));const r=a.getFileName(e);s.some((e=>e===r))||s.push(r)}_getPartialStubOriginalPath(e){var t;return null!==(t=this._fileMap.get(e))&&void 0!==t?t:e}_getRelativePathPartialStubs(e){const t=[],n=a.ensureTrailingDirectorySeparator(e).length,i=e=>{for(const s of this._realFS.readdirEntriesSync(e)){const r=a.combinePaths(e,s.name);let o=s.isDirectory(),l=s.isFile();if(s.isSymbolicLink()){const e=a.tryStat(this._realFS,r);e&&(o=e.isDirectory(),l=e.isFile())}if(o&&i(r),l&&s.name.endsWith(".pyi")){const e=r.substring(n);e&&t.push(e)}}};return i(e),t}_isVirtualEntry(e){return this._partialStubPackagePaths.has(e)||this._reverseFileMap.has(e)}}},64553:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceMap=void 0;const i=n(10219);class s extends Map{constructor(){super(...arguments),this._defaultWorkspacePath=""}getNonDefaultWorkspaces(){const e=[];return this.forEach((t=>{t.rootPath&&e.push(t)})),e}getWorkspaceForFile(e,t){let n,s;if(this.forEach((e=>{e.rootPath&&t.startsWith(e.rootPath)&&(void 0===n||e.rootPath.startsWith(n))&&(n=e.rootPath,s=e)})),void 0===s){let t=this.get(this._defaultWorkspacePath);if(!t){const n=[...this.keys()];if(1===n.length)return this.get(n[0]);t={workspaceName:"",rootPath:"",rootUri:"",serviceInstance:e.createAnalyzerService(this._defaultWorkspacePath),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:i.createDeferred()},this.set(this._defaultWorkspacePath,t),e.updateSettingsForWorkspace(t).ignoreErrors()}return t}return s}}t.WorkspaceMap=s}}; //# sourceMappingURL=pyright.bundle.js.map