text: exports.id=194,exports.ids=[194],exports.modules={9890:e=>{"use strict";e.exports={}},6395:e=>{"use strict";e.exports=JSON.parse('{"Diagnostic":{"annotatedParamCountMismatch":"Parameter annotation count mismatch: expected {expected} but received {received}","annotatedTypeArgMissing":"Expected at least one type argument after \\"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}","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":"Assignment to instance or class variables not allowed within a Protocol class","assignmentTargetExpr":"Expression cannot be assignment target","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 \\"...\\"","classDecoratorTypeUnknown":"Untyped class decorator obscures type of class; ignoring decorator","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","classVarFirstArgMissing":"Expected a type argument after \\"ClassVar\\"","classVarTooManyArgs":"Expected only one type argument after \\"ClassVar\\"","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 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 dataclass cannot inherit from a dataclass that is not frozen","dataClassFieldWithDefault":"Dataclass fields without default value cannot appear after data 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","duplicateArgsParam":"Only one \\"*\\" parameter is allowed","duplicateBaseClass":"Duplicate base class is not allowed","duplicateCatchAll":"Only one catch-all except clause is allowed","duplicateImport":"\\"{importName}\\" is imported more than once","duplicateKwargsParam":"Only one \\"**\\" parameter is allowed","duplicateNameOnly":"Only one \\"*\\" separator is allowed","duplicateParam":"Duplicate parameter \\"{name}\\"","duplicatePositionOnly":"Only one \\"/\\" parameter is 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","expectedClassName":"Expected class name","expectedCloseBrace":"Expected \\"}\\"","expectedCloseBracket":"Expected \\"]\\"","expectedCloseParen":"Expected \\")\\"","expectedColon":"Expected \\":\\"","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\\"","expectedNamedArgument":"Named argument must follow \\"*\\"","expectedNewlineOrSemicolon":"Statements must be separated by newlines or semicolons","expectedOpenParen":"Expected \\"(\\"","expectedParamName":"Expected parameter name","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","finalContext":"\\"Final\\" is 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","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","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","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","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 in token \\"{text}\\"","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","keyRequiredDeleted":"\\"{name}\\" is a required key and cannot be deleted","keyValueInSet":"Key/value pairs are not allowed within a set","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\\"","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","namedTupleEmptyName":"Names within a named tuple cannot be empty","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","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\\" cannot be subscripted","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 \\"{expression}\\" match parameters","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\\"","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","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\\"","overlappingOverload":"Overload {obscured} for \\"{name}\\" will never be used because its parameters overlap overload {obscuredBy}","overloadAbstractMismatch":"Overloaded methods must all be abstract or not","overloadReturnTypeMismatch":"Overload {prevIndex} for \\"{name}\\" overlaps overload {newIndex} and returns an incompatible type","paramAfterKwargsParam":"Parameter cannot follow \\"**\\" parameter","paramAlreadyAssigned":"Parameter \\"{name}\\" is already assigned","paramNameMissing":"No parameter named \\"{name}\\"","paramSpecAssignedName":"ParamSpec must be assigned to a variable named \\"{name}\\"","paramSpecContext":"ParamSpec not allowed in this context","paramSpecIllegal":"ParamSpec requires Python 3.10 or newer","paramSpecFirstArg":"Expected name of ParamSpec as first argument","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","positionArgAfterNamedArg":"Positional argument cannot appear after named arguments","positionOnlyAfterNameOnly":"\\"/\\" parameter must appear before \\"*\\" parameter","positionOnlyIncompatible":"Position-only argument separator requires Python 3.8 or greater","positionOnlyFirstParam":"Position-only argument separator is 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}\\"","propertyStaticOrClassMethod":"Static and class 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","protocolUsedInCall":"Protocol class cannot be used in \\"{name}\\" call","raiseParams":"\\"raise\\" requires one or more parameters when used outside of except clause","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","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","setterGetterTypeMismatch":"Property setter value type is not assignable to the getter return type","singleOverload":"\\"{name}\\" is marked as overload, but additional overloads are missing","staticClsSelfParam":"Static methods should not take a \\"self\\" or \\"cls\\" parameter","stringNonAsciiBytes":"Non-ASCII character not allowed in bytes string literal","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}\\"","tupleInAnnotation":"Tuple expression not allowed in type annotation","tupleSizeMismatch":"Tuple size mismatch: expected {expected} but received {received}","typeAbstract":"Cannot instantiate abstract class \\"{type}\\"","typeAliasIsRecursive":"Type alias \\"{name}\\" cannot use itself 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","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","typedDictFirstArg":"Expected TypedDict class name as first argument","typedDictSecondArgDict":"Expected dict or named 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}\\" cannot be subscripted","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 TypeVar \\"{name}\\"","typeVarBoundAndConstrained":"TypeVar cannot be both bound and constrained","typeVarFirstArg":"Expected name of TypeVar as first argument","typeVarGeneric":"TypeVar bound type cannot be generic","typeVarNotUsedByOuterScope":"TypeVar \\"{name}\\" has no meaning in this context","typeVarSingleConstraint":"TypeVar cannot have only a single constraint","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","unnecessaryCast":"Unnecessary \\"cast\\" call; type is already \\"{type}\\"","unnecessaryIsInstanceAlways":"Unnecessary isinstance call; \\"{testType}\\" is always an instance of \\"{classType}\\"","unnecessaryIsInstanceNever":"Unnecessary isinstance call; \\"{testType}\\" is never an instance of \\"{classType}\\"","unnecessaryIsSubclassAlways":"Unnecessary issubclass call; \\"{testType}\\" is always a subclass of \\"{classType}\\"","unnecessaryIsSubclassNever":"Unnecessary issubclass call; \\"{testType}\\" is never a subclass of \\"{classType}\\"","unpackIllegalInComprehension":"Unpack operation not allowed in comprehension","unpackInDict":"Unpack operation not allowed in dictionaries","unpackInSet":"Unpack operator not allowed within a set","unpackTuplesIllegal":"Unpack operation not allowed in tuples prior to Python 3.8","unreachableCode":"Code is unreachable","unsupportedDunderAllAssignment":"Expression assigned to \\"__all__\\" is not supported, so exported symbol list may be incorrect; use list or tuple of string literal values in assignment","unsupportedDunderAllOperation":"Operation on \\"__all__\\" is not supported, so exported symbol list may not be incorrect","unusedCallResult":"Result of call expression is of type \\"{type}\\" and is not used; assign to variable \\"_\\" if this is intentional","varAnnotationIllegal":"Type annotations for variables requires Python 3.6 or newer; use type comment for compatibility with previous versions","walrusIllegal":"Operator \\":=\\" requires Python 3.8 or newer","walrusNotAllowed":"Operator \\":=\\" not allowed in this context","wildcardInFunction":"Wildcard import is not allowed within a class or function","wildcardLibraryImport":"Wildcard import from a library is 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}\\""},"DiagnosticAddendum":{"argParam":"Argument corresponds to parameter \\"{paramName}\\"","argParamFunction":"Argument corresponds to parameter \\"{paramName}\\" in function \\"{functionName}\\"","argsParamMissing":"Parameter *{paramName} has no corresponding parameter","argumentType":"Argument type is \\"{type}\\"","argumentTypes":"Argument types: ({types})","assignToNone":"Cannot assign to \\"None\\"","asyncHelp":"Did you mean \\"async with\\"?","dataclassFrozen":"Dataclass \\"{name}\\" is frozen","finalMethod":"Final method","keyUndefined":"\\"{name}\\" is not a defined key in \\"{type}\\"","functionReturnTypeMismatch":"Function return type \\"{sourceType}\\" is not compatible 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}","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...","memberTypeMismatch":"\\"{name}\\" is an incompatible type","memberUnknown":"Member \\"{name}\\" is unknown","namedParamMissingInDest":"Named parameter \\"{name}\\" is missing in destination","namedParamMissingInSource":"Named parameter \\"{name}\\" is missing in source","namedParamTypeMismatch":"Named parameter \\"{name}\\" of type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","noOverloadAssignable":"No overloaded function matches type \\"{type}\\"","overloadCallName":"Calling function \\"{name}\\"","overloadNotAssignable":"One or more overloads of \\"{name}\\" is not assignable","overriddenMethod":"Overridden method","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 not compatible with bound type \\"{destType}\\" for TypeVar \\"{name}\\"","typeConstrainedTypeVar":"Type \\"{type}\\" is not compatible with constrained TypeVar \\"{name}\\"","typeConstraint":"Type \\"{type}\\" is not compatible with constrained type \\"{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}\\"","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 not compatible 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 is not allowed","useDictInstead":"Use Dict[T1, T2] instead","useListInstead":"Use List[T] instead","useTupleInstead":"Use Tuple[T1, ..., Tn] instead","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"}}')},6961:e=>{"use strict";e.exports={}},9356:e=>{"use strict";e.exports={}},886:e=>{"use strict";e.exports={}},7523:e=>{"use strict";e.exports={}},6853:e=>{"use strict";e.exports={}},3019:e=>{"use strict";e.exports={}},6673:(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 o;if(s.path&&(o=t(s.path),!o))return;const a=o?o.symbolTable.get(s.symbolName):void 0;if(!a)return s.submoduleFallback?e(t,s.submoduleFallback,i):void 0;let l=a.getTypedDeclarations();if(0===l.length&&(l=a.getDeclarations(),0===l.length))return;if(s=l[l.length-1],r.find((e=>e===s)))return n;r.push(s)}}},1241: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 o=n(3213),a=r(n(5839)),l=n(8718);t.nullCallback=e=>{},t.analyzeProgram=function(e,n,i,s,r,c){let p=!1;s=null!=s?s:t.nullCallback;try{o.throwIfCancellationRequested(c);const t=new l.Duration;p=e.analyze(n,c);const r=e.getFilesToAnalyzeCount();a.assert(0===r||p);const d=e.getDiagnostics(i),u=d.length,h=t.getDurationInSeconds();(u>0||!p)&&s({diagnostics:d,filesInProgram:e.getFileCount(),filesRequiringAnalysis:r,checkingOnlyOpenFiles:e.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:h})}catch(e){if(o.OperationCanceledException.is(e))return!1;const t=a.getErrorString(e);r.error("Error performing analysis: "+t),s({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!0,configParseErrorOccurred:!1,elapsedTime:0,error:a.getSerializableError(e)})}return p}},563:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCodeUnreachable=t.setDunderAllNames=t.getDunderAllNames=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(6610);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.getDunderAllNames=function(e){return e.dunderAllNames},t.setDunderAllNames=function(e,t){e.dunderAllNames=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}},5674:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisProgram=void 0;const s=n(1241),r=n(8408);t.BackgroundAnalysisProgram=class{constructor(e,t,n,i,s,o){this._console=e,this._configOptions=t,this._importResolver=n,this._program=new r.Program(this._importResolver,this._configOptions,this._console,i),this._backgroundAnalysis=s,this._maxAnalysisTime=o}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)}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){var i;null===(i=this._backgroundAnalysis)||void 0===i||i.setFileOpened(e,t,[{text:n}]),this._program.setFileOpened(e,t,[{text:n}])}updateOpenFileContents(e,t,n){var i;null===(i=this._backgroundAnalysis)||void 0===i||i.setFileOpened(e,t,n),this._program.setFileOpened(e,t,n),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):s.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)}getDiagnosticsForRange(e,t,n){return i(this,void 0,void 0,(function*(){return this._backgroundAnalysis?this._backgroundAnalysis.getDiagnosticsForRange(e,t,n):this._program.getDiagnosticsForRange(e,t)}))}writeTypeStub(e,t,n,r){return i(this,void 0,void 0,(function*(){return this._backgroundAnalysis?this._backgroundAnalysis.writeTypeStub(e,t,n,r):(s.analyzeProgram(this._program,void 0,this._configOptions,this._onAnalysisCompletion,this._console,r),this._program.writeTypeStub(e,t,n,r))}))}invalidateAndForceReanalysis(){var e;this.refreshIndexing(),null===(e=this._backgroundAnalysis)||void 0===e||e.invalidateAndForceReanalysis(),this._importResolver.invalidateCache(),this._program.markAllFilesDirty(!0)}invalidateCache(){this._importResolver.invalidateCache()}restart(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.restart()}_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})}}},6052: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 o=n(5839),a=n(9744),l=n(6657),c=n(1464),p=n(3550),d=n(3550),u=n(2122),h=r(n(5136)),m=r(n(563)),y=n(6610),g=r(n(8494)),f=n(427),_=n(1561),T=r(n(8235)),v=n(817),b=n(1766);class S extends f.ParseTreeWalker{constructor(e){super(),this._deferredBindingTasks=[],this._nestedExceptDepth=0,this._finallyTargets=[],this._typingImportAliases=[],this._typingSymbolAliases=new Map,this._potentialPrivateSymbols=new Map,this._fileInfo=e}bindModule(e){const t=void 0===this._fileInfo.builtinsScope;return this._createNewScope(t?4:3,this._fileInfo.builtinsScope,(()=>{m.setScope(e,this._currentScope),m.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,"List[str]"),this._addBuiltInSymbolToCurrentScope("__file__",e,"str"),this._addBuiltInSymbolToCurrentScope("__cached__",e,"str"),this._addBuiltInSymbolToCurrentScope("__dict__",e,"Dict[str, Any]"),this._currentFlowNode=this._createStartFlowNode(),this._walkStatementsAndReportUnreachable(e.statements),m.setCodeFlowExpressions(e,this._currentExecutionScopeReferenceMap),m.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()})),m.setDunderAllNames(e,this._dunderAllNames),{moduleDocString:g.getDocString(e.statements)}}visitModule(e){return o.fail("We should never get here"),!1}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitModuleName(e){const t=m.getImportInfo(e);if(o.assert(void 0!==t),!t||t.isNativeLib)return!0;if(!t.isImportFound)return this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingImports,a.DiagnosticRule.reportMissingImports,u.Localizer.Diagnostic.importResolveFailure().format({importName:t.importName}),e),!0;if(!t.isStubFile&&1===t.importType&&!t.isPyTypedPresent){const n=this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingTypeStubs,a.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,a.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),m.setDeclaration(e,t),this.walkMultiple(e.arguments);let i=this._currentScope;for(;2===i.type;)i=i.parent;return this._createNewScope(2,i,(()=>{m.setScope(e,this._currentScope),this.walk(e.suite)})),this._addSymbolToCurrentScope(e.name.value,!0),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitFunction(e){const t=this._bindNameToScope(this._currentScope,e.name.value),n=g.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),m.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;o.assert(void 0!==s);const r=m.getScope(s);return o.assert(void 0!==r),this._createNewScope(1,r,(()=>{m.setScope(e,this._currentScope),g.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),m.setDeclaration(e.name,n)}this._createFlowAssignment(e.name)}})),this._targetFunctionDeclaration=i,this._currentReturnTarget=this._createBranchLabel(),this.walk(e.suite),m.setAfterFlowNode(e.suite,this._currentFlowNode),this._addAntecedent(this._currentReturnTarget,this._currentFlowNode);const t=this._finishFlowLabel(this._currentReturnTarget);m.setAfterFlowNode(e,t)})),m.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,(()=>{m.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),m.setDeclaration(e.name,n)}this._createFlowAssignment(e.name),this.walk(e.name)}})),this.walk(e.expression),m.setCodeFlowExpressions(e,this._currentExecutionScopeReferenceMap)}))})),!1}visitCall(e){var t;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 n=!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;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),n=!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)})),n=!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)),n=!1)}else if("append"===e.leftExpression.memberName.value&&1===e.arguments.length){const i=e.arguments[0].valueExpression;48===i.nodeType&&1===i.strings.length&&49===i.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(i.strings[0].value),n=!1)}n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,a.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((g.getEnclosingClass(e)||g.getEnclosingFunction(e)||9===e.rightExpression.nodeType&&this._fileInfo.isTypingStubFile)&&(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):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):n=!0})):n=!0,n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,a.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}return!1}visitAssignmentExpression(e){this._disableTrueFalseTargets((()=>{this.walk(e.rightExpression)}));const t=g.getEvaluationNodeForAssignmentExpression(e);if(t){const n=m.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)}else this._addError(u.Localizer.Diagnostic.assignmentExprContext(),e);return this._createAssignmentTargetFlowNodes(e.name,!0,!1),!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))})),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,a.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=y.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();return 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),!1}visitContinue(e){return this._currentContinueTarget&&this._addAntecedent(this._currentContinueTarget,this._currentFlowNode),this._currentFlowNode=S._unreachableFlowNode,!1}visitBreak(e){return this._currentBreakTarget&&this._addAntecedent(this._currentBreakTarget,this._currentFlowNode),this._currentFlowNode=S._unreachableFlowNode,!1}visitReturn(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.returnStatements||(this._targetFunctionDeclaration.returnStatements=[]),this._targetFunctionDeclaration.returnStatements.push(e)),e.returnExpression&&this.walk(e.returnExpression),m.setFlowNode(e,this._currentFlowNode),this._currentReturnTarget&&this._addAntecedent(this._currentReturnTarget,this._currentFlowNode),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=S._unreachableFlowNode,!1}visitYield(e){return this._bindYield(e),!1}visitYieldFrom(e){return this._bindYield(e),!1}visitMemberAccess(e){return m.setFlowNode(e,this._currentFlowNode),!0}visitName(e){return m.setFlowNode(e,this._currentFlowNode),!1}visitIf(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),i=this._createBranchLabel(),s=T.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases);return this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===s?S._unreachableFlowNode:this._finishFlowLabel(t),this.walk(e.ifSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=!0===s?S._unreachableFlowNode:this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),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),r=this._createLoopLabel();return this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=r,this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===s?S._unreachableFlowNode:this._finishFlowLabel(t),this._bindLoopStatement(r,i,(()=>{this.walk(e.whileSuite)})),this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=!0===s?S._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:b.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||0!==this._nestedExceptDepth||this._addError(u.Localizer.Diagnostic.raiseParams(),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=S._unreachableFlowNode,!1}visitTry(e){const t=e.exceptClauses.map((()=>this._createBranchLabel())),n=this._createBranchLabel(),i=this._createBranchLabel();let s=!1;const r={flags:y.FlowFlags.PreFinallyGate,id:y.getUniqueFlowNodeId(),antecedent:i,isGateClosed:!1};if(e.finallySuite&&this._addAntecedent(n,r),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),this._nestedExceptDepth++,e.exceptClauses.forEach(((e,i)=>{this._currentFlowNode=this._finishFlowLabel(t[i]),this.walk(e),this._addAntecedent(n,this._currentFlowNode),this._isCodeUnreachable()||(s=!0)})),this._nestedExceptDepth--,e.finallySuite&&this._finallyTargets.pop(),this._currentFlowNode=this._finishFlowLabel(n),e.finallySuite){this.walk(e.finallySuite);const t={flags:y.FlowFlags.PostFinally,id:y.getUniqueFlowNodeId(),antecedent:this._currentFlowNode,preFinallyGate:r};this._currentFlowNode=s?t:S._unreachableFlowNode}return!1}visitAwait(e){const t=g.getEnclosingFunction(e);return void 0!==t&&t.isAsync||this._addError(u.Localizer.Diagnostic.awaitNotInAsync(),e),!0}visitStringList(e){for(const t of e.strings)t.hasUnescapeErrors&&h.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._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStringEscapeSequence,a.DiagnosticRule.reportInvalidStringEscapeSequence,u.Localizer.Diagnostic.stringUnsupportedEscape(),n):1===e.errorType?this._addError(u.Localizer.Diagnostic.formatStringEscape(),n):2===e.errorType?this._addError(u.Localizer.Diagnostic.formatStringBrace(),n):3===e.errorType&&this._addError(u.Localizer.Diagnostic.formatStringUnterminated(),n)}));return!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;if(e.module.nameParts.length>0){const n=e.module.nameParts[0].value;let i;i=e.alias?e.alias.value:n;const s=this._bindNameToScope(this._currentScope,i);!s||e.alias&&1===e.module.nameParts.length&&e.module.nameParts[0].value===e.alias.value||(this._fileInfo.isStubFile?s.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(i,s));const r=m.getImportInfo(e.module);o.assert(void 0!==r),s&&this._createAliasDeclarationForMultipartImportName(e,e.alias,r,s),this._createFlowAssignment(e.alias?e.alias:e.module.nameParts[0]),1===e.module.nameParts.length&&("typing"!==n&&"typing_extensions"!==n||this._typingImportAliases.push((null===(t=e.alias)||void 0===t?void 0:t.value)||n))}return!0}visitImportFrom(e){const t=["Final","TypeAlias"],n=m.getImportInfo(e.module);let i="";n&&n.isImportFound&&!n.isNativeLib&&(i=n.resolvedPaths[n.resolvedPaths.length-1]);const s="__init__"===l.stripFileExtension(l.getFileName(this._fileInfo.filePath))&&1===e.module.leadingDots&&e.module.nameParts.length>0;let r=!1;if(1===e.module.nameParts.length){const t=e.module.nameParts[0].value;"typing"!==t&&"typing_extensions"!==t||(r=!0)}if(e.isWildcardImport){if((g.getEnclosingClass(e)||g.getEnclosingFunction(e))&&this._addError(u.Localizer.Diagnostic.wildcardInFunction(),e),n){const o=[],a=this._fileInfo.importLookup(i);if(a){const t=this._getWildcardImportNames(a);s&&(t.some((t=>t===e.module.nameParts[0].value))||this._addImplicitFromImport(e,n)),t.forEach((t=>{const s=this._bindNameToScope(this._currentScope,t);if(s)if(a.symbolTable.get(t)){const n={type:6,node:e,path:i,range:p.getEmptyRange(),usesLocalName:!1,symbolName:t,moduleName:this._fileInfo.moduleName};s.addDeclaration(n),o.push(t)}else if(n&&n.filteredImplicitImports){const r=n.filteredImplicitImports.find((e=>e.name===t));if(r){const n={type:6,node:e,path:r.path,range:p.getEmptyRange(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},o={type:6,node:e,path:i,usesLocalName:!1,symbolName:t,submoduleFallback:n,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName};s.addDeclaration(o)}}}))}this._createFlowWildcardImport(e,o),r&&t.forEach((e=>{this._typingSymbolAliases.set(e,e)}))}}else s&&this._addImplicitFromImport(e,n),e.imports.forEach((s=>{const o=s.name.value,a=s.alias||s.name,l=this._bindNameToScope(this._currentScope,a.value);if(l){let c,d;s.alias&&s.alias.value===s.name.value||(this._fileInfo.isStubFile?l.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(a.value,l)),n&&n.filteredImplicitImports&&(c=n.filteredImplicitImports.find((e=>e.name===o))),c&&(d={type:6,node:s,path:c.path,range:p.getEmptyRange(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},0===e.module.nameParts.length&&(i=""));const u={type:6,node:s,path:i,usesLocalName:!!s.alias,symbolName:o,submoduleFallback:d,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName};l.addDeclaration(u),this._createFlowAssignment(s.alias||s.name),r&&t.some((e=>e===s.name.value))&&this._typingSymbolAliases.set(a.value,s.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();return this._addAntecedent(n,t),this._useExceptTargets([t],(()=>{this.walk(e.suite)})),this._addAntecedent(n,this._currentFlowNode),this._currentFlowNode=n,!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){return this._createNewScope(0,this._currentScope,(()=>{m.setScope(e,this._currentScope);const t=this._createBranchLabel(),n=[];for(let t=0;t<e.comprehensions.length;t++){const i=e.comprehensions[t],s=new Map;33===i.nodeType&&(this._bindPossibleTupleNamedTarget(i.targetExpression,s),this._addInferredTypeAssignmentForVariable(i.targetExpression,i)),n.push(s)}for(let i=0;i<e.comprehensions.length;i++){const s=e.comprehensions[i];if(33===s.nodeType){const e=n[i];for(const t of e){const e=this._currentScope.parent.lookUpSymbol(t[0]);e&&this._createAssignmentAliasFlowNode(t[1].id,e.id)}this.walk(s.iterableExpression),this._createAssignmentTargetFlowNodes(s.targetExpression,!0,!1)}else{const e=this._createBranchLabel();this._bindConditional(s.testExpression,e,t),this._currentFlowNode=this._finishFlowLabel(e)}}this.walk(e.expression),this._addAntecedent(t,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(t)})),!1}_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 o;if(o=r||{type:6,node:e,path:"",moduleName:n.importName,range:p.getEmptyRange(),firstNamePart:s,usesLocalName:!!t},t||1===e.module.nameParts.length)o.path=n.resolvedPaths[n.resolvedPaths.length-1],this._addImplicitImportsToLoaderActions(n,o);else{let t=o;for(let i=1;i<e.module.nameParts.length&&!(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(o)}else{const n={type:6,node:e,path:"*** unresolved ***",range:p.getEmptyRange(),usesLocalName:!!t,moduleName:""};i.addDeclaration(n)}}_getWildcardImportNames(e){if(e.dunderAllNames)return e.dunderAllNames;const t=[];return e.symbolTable.forEach(((e,n)=>{n.startsWith("_")||e.isIgnoredForProtocolMatch()||t.push(n)})),t}_walkStatementsAndReportUnreachable(e){let t=!1;for(const n of e)m.setFlowNode(n,this._currentFlowNode),t||(t=this._isCodeUnreachable()),t?this._targetFunctionDeclaration&&!this._targetFunctionDeclaration.isGenerator&&(new C).checkContainsYield(n)&&(this._targetFunctionDeclaration.isGenerator=!0):this.walk(n);return!1}_createStartFlowNode(){return{flags:y.FlowFlags.Start,id:y.getUniqueFlowNodeId()}}_createBranchLabel(){return{flags:y.FlowFlags.BranchLabel,id:y.getUniqueFlowNodeId(),antecedents:[]}}_createContextManagerLabel(e,t){return{flags:y.FlowFlags.PostContextManager|y.FlowFlags.BranchLabel,id:y.getUniqueFlowNodeId(),antecedents:[],expressions:e,isAsync:t}}_createLoopLabel(){return{flags:y.FlowFlags.LoopLabel,id:y.getUniqueFlowNodeId(),antecedents:[]}}_finishFlowLabel(e){return 0===e.antecedents.length?S._unreachableFlowNode:1===e.antecedents.length?e.antecedents[0]:e}_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(y.FlowFlags.TrueCondition,this._currentFlowNode,e)),this._addAntecedent(n,this._createFlowConditional(y.FlowFlags.FalseCondition,this._currentFlowNode,e)))}_createFlowConditional(e,t,n){if(t.flags&y.FlowFlags.Unreachable)return t;const i=T.evaluateStaticBoolLikeExpression(n,this._fileInfo.executionEnvironment,this._typingImportAliases);if(!0===i&&e&y.FlowFlags.FalseCondition||!1===i&&e&y.FlowFlags.TrueCondition)return S._unreachableFlowNode;const s=[];if(!this._isNarrowingExpression(n,s))return t;s.forEach((e=>{const t=y.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(t,t)}));const r={flags:e,id:y.getUniqueFlowNodeId(),expression:n,antecedent:t};return this._addExceptTargets(r),r}_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){switch(e.nodeType){case 38:case 35:return!!y.isCodeFlowSupportedForReference(e)&&(t.push(e),!0);case 4:return t.push(e.name),!0;case 7:{const n=39===e.operator||40===e.operator,i=12===e.operator||28===e.operator;if(n||i){if(11===e.rightExpression.nodeType&&24===e.rightExpression.constType)return this._isNarrowingExpression(e.leftExpression,t);if(n&&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);const s=this._isNarrowingExpression(e.leftExpression,t);if(n)return s;if(i){const n=this._isNarrowingExpression(e.rightExpression,t);return s||n}}return!(41!==e.operator&&42!==e.operator||!this._isNarrowingExpression(e.rightExpression,t))||41===e.operator&&this._isNarrowingExpression(e.leftExpression,t)}case 55:return 38===e.operator&&this._isNarrowingExpression(e.expression,t);case 5:return this._isNarrowingExpression(e.rightExpression,t);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);if(38===e.leftExpression.nodeType&&"callable"===e.leftExpression.value&&1===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t);if(e.arguments.length>=1)return this._isNarrowingExpression(e.arguments[0].valueExpression,t)}return!1}_createAssignmentTargetFlowNodes(e,t,n){switch(e.nodeType){case 38:case 35: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:y.FlowFlags.Call,id:y.getUniqueFlowNodeId(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}m.setFlowNode(e,this._currentFlowNode)}_createAssignmentAliasFlowNode(e,t){if(!this._isCodeUnreachable()){const n={flags:y.FlowFlags.AssignmentAlias,id:y.getUniqueFlowNodeId(),antecedent:this._currentFlowNode,targetSymbolId:e,aliasSymbolId:t};this._currentFlowNode=n}}_createVariableAnnotationFlowNode(){if(!this._isCodeUnreachable()){const e={flags:y.FlowFlags.VariableAnnotation,id:y.getUniqueFlowNodeId(),antecedent:this._currentFlowNode};this._currentFlowNode=e}}_createFlowAssignment(e,t=!1){let n=v.indeterminateSymbolId;if(38===e.nodeType){const t=this._currentScope.lookUpSymbolRecursive(e.value);o.assert(void 0!==t),n=t.symbol.id}const i=this._currentFlowNode;if(!this._isCodeUnreachable()&&y.isCodeFlowSupportedForReference(e)){const i={flags:y.FlowFlags.Assignment,id:y.getUniqueFlowNodeId(),node:e,antecedent:this._currentFlowNode,targetSymbolId:n},s=y.createKeyForReference(e);this._currentExecutionScopeReferenceMap.set(s,s),t&&(i.flags|=y.FlowFlags.Unbind),this._addExceptTargets(i),this._currentFlowNode=i}t&&void 0!==m.getFlowNode(e)||m.setFlowNode(e,t?i:this._currentFlowNode)}_createFlowWildcardImport(e,t){if(!this._isCodeUnreachable()){const n={flags:y.FlowFlags.WildcardImport,id:y.getUniqueFlowNodeId(),node:e,names:t,antecedent:this._currentFlowNode};this._addExceptTargets(n),this._currentFlowNode=n}m.setFlowNode(e,this._currentFlowNode)}_isCodeUnreachable(){return!!(this._currentFlowNode.flags&y.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&y.FlowFlags.Unreachable||e.antecedents.some((e=>e.id===t.id))||e.antecedents.push(t)}_bindNameToScope(e,t,n){if(void 0===this._currentScope.getBindingType(t)){let i=e.lookUpSymbol(t);if(!i){if(i=e.addSymbol(t,5),2===e.type){const n=e.parent.lookUpSymbol(t);n&&this._createAssignmentAliasFlowNode(i.id,n.id)}b.isPrivateOrProtectedName(t)&&(this._fileInfo.isStubFile?i.setIsExternallyHidden():this._fileInfo.isInPyTypedPackage&&3===this._currentScope.type&&this._potentialPrivateSymbols.set(t,i)),n&&n.set(t,i)}return i}}_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){const i=this._addSymbolToCurrentScope(e,!1);i&&(i.addDeclaration({type:0,node:t,intrinsicType:n,path:this._fileInfo.filePath,range:p.getEmptyRange(),moduleName:this._fileInfo.moduleName}),i.setIsIgnoredForProtocolMatch())}_addSymbolToCurrentScope(e,t){let n=this._currentScope.lookUpSymbol(e);if(!n){let i=0;t&&(i|=1),2===this._currentScope.type&&(i|=4),this._fileInfo.isStubFile&&b.isPrivateOrProtectedName(e)&&(i|=2),n=this._currentScope.addSymbol(e,i)}return n}_createNewScope(e,t,n){const i=this._currentScope,s=new _.Scope(e,t);this._currentScope=s;const r=4===e||3===e||1===e,o=this._currentExecutionScopeReferenceMap;return r&&(this._currentExecutionScopeReferenceMap=new Map),n(),this._currentExecutionScopeReferenceMap=o,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:b.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};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;b.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:b.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};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){let n=!1;switch(e.nodeType){case 38:{const i=e,s=this._currentScope.lookUpSymbolRecursive(i.value);if(s&&s.symbol){const n=this._isAnnotationFinal(t),r=this._isAnnotationTypeAlias(t);let o=t;r?(o=void 0,3!==this._currentScope.type&&this._addError(u.Localizer.Diagnostic.typeAliasNotInModule(),t)):n.isFinal&&(o=n.finalTypeNode);const a={type:1,node:e,isConstant:b.isConstantName(i.value),isFinal:n.isFinal,typeAliasAnnotation:r?t:void 0,typeAliasName:r?e:void 0,path:this._fileInfo.filePath,typeAnnotationNode:o,range:c.convertOffsetsToRange(i.start,d.TextRange.getEnd(i),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};s.symbol.addDeclaration(a),24===t.nodeType&&38===t.baseExpression.nodeType&&"ClassVar"===t.baseExpression.value?s.symbol.setIsClassVar():s.symbol.setIsInstanceMember()}n=!0;break}case 35:{const i=this._getMemberAccessInfo(e);if(i){const s=e.memberName;let r=i.classScope.lookUpSymbol(s.value);if(!r){r=i.classScope.addSymbol(s.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;b.isPrivateOrProtectedName(s.value)&&e&&r.setIsPrivateMember()}i.isInstanceMember?r.setIsInstanceMember():r.setIsClassMember();const o=this._isAnnotationFinal(t),a={type:1,node:e.memberName,isConstant:b.isConstantName(s.value),isDefinedByMemberAccess:!0,isFinal:o.isFinal,path:this._fileInfo.filePath,typeAnnotationNode:o.isFinal?o.finalTypeNode:t,range:c.convertOffsetsToRange(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName};r.addDeclaration(a),n=!0}break}}n||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}_isAnnotationFinal(e){let t,n=!1;return e&&(this._isTypingAnnotation(e,"Final")?n=!0:24===e.nodeType&&1===e.items.length&&this._isAnnotationFinal(e.baseExpression).isFinal&&(n=!0,t=e.items[0])),{isFinal:n,finalTypeNode:t}}_isAnnotationTypeAlias(e){return!!e&&this._isTypingAnnotation(e,"TypeAlias")}_getMemberAccessInfo(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value,n=g.getEnclosingFunction(e);if(!n)return;const i=g.getEnclosingClass(n);if(!i)return;let s=!1;if(n.parameters.length<1||!n.parameters[0].name)return;const r=i.name.value,a=n.parameters[0].name.value;if(t===r)s=!1;else{if(t!==a)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=m.getScope(i);return o.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.value;if(!{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}[n])return!1;const i=this._bindNameToScope(this._currentScope,n);return i&&i.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._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._nestedExceptDepth=0,this._currentExecutionScopeReferenceMap=e.codeFlowExpressionMap,e.callback()}}_bindYield(e){const t=g.getEnclosingFunction(e);t?t.isAsync&&61===e.nodeType&&this._addError(u.Localizer.Diagnostic.yieldFromOutsideAsync(),e):g.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),m.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 o.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=S,S._unreachableFlowNode={flags:y.FlowFlags.Unreachable,id:y.getUniqueFlowNodeId()};class C extends f.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=C;class I extends f.ParseTreeWalker{constructor(){super(...arguments),this._containsReturn=!1}checkContainsReturn(e){return this.walk(e),this._containsReturn}visitReturn(e){return this._containsReturn=!0,!1}}t.ReturnFinder=I},6329: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 o=n(5839),a=n(1290),l=n(9744),c=n(3550),p=n(2122),d=n(5275),u=r(n(563)),h=n(5523),m=n(7012),y=r(n(8494)),g=n(427),f=n(5083),_=r(n(1766)),T=n(2917),v=n(1133),b=n(5168);class S extends g.ParseTreeWalker{constructor(e,t){super(),this._scopedNodes=[],this._moduleNode=e,this._fileInfo=u.getFileInfo(e),this._evaluator=t}check(){this._scopedNodes.push(this._moduleNode),this._walkStatementsAndReportUnreachable(this._moduleNode.statements);const e=u.getDunderAllNames(this._moduleNode);e&&this._evaluator.markNamesAccessed(this._moduleNode,e),this._validateSymbolTables(),this._reportDuplicateImports()}walk(e){u.isCodeUnreachable(e)?this._evaluator.suppressDiagnostics((()=>{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&&(v.ClassType.isProtocolClass(t.classType)&&e.arguments.forEach((e=>{if(!e.name){const n=this._evaluator.getType(e.valueExpression);n&&v.isClass(n)&&!v.ClassType.isBuiltIn(n,"Protocol")&&(v.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._validateClassMethods(t.classType),this._validateFinalMemberOverrides(t.classType),v.ClassType.isTypedDictClass(t.classType)&&this._validateTypedDictClassSuite(e.suite)),this._scopedNodes.push(e),!1}visitFunction(e){var t;const n=this._evaluator.getTypeOfFunction(e),i=y.getEnclosingClass(e,!0);if(n&&(e.parameters.forEach(((e,t)=>{if(e.name&&"_"!==e.name.value){const i=n.functionType.details.parameters[t].type;if(v.isUnknown(i)||v.isTypeVar(i)&&i.details.isSynthesized&&!i.details.boundType)this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name);else if(b.isPartlyUnknown(i)){const t=new a.DiagnosticAddendum;t.addMessage(p.Localizer.DiagnosticAddendum.paramType().format({paramType:this._evaluator.printType(i,!0)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value})+t.getString(),e.name)}}if(e.defaultValue&&this._fileInfo.isStubFile){const t=this._evaluator.getType(e.defaultValue);t&&b.isEllipsisType(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,p.Localizer.Diagnostic.defaultValueNotEllipsis(),e.defaultValue)}})),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)),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;v.isTypeVar(e)&&1===e.details.variance&&!e.details.isSynthesized&&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._fileInfo.isStubFile&&"__getattr__"===e.name.value){const t=f.getScopeForNode(e);3===(null==t?void 0:t.type)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownMemberType,l.DiagnosticRule.reportUnknownMemberType,p.Localizer.Diagnostic.stubUsesGetAttr(),e.name)}if(this._scopedNodes.push(e),this._validateFunctionTypeVarUsage(e),n&&6===n.decoratedType.category){const t=n.decoratedType.overloads;t.length>1&&this._validateOverloadConsistency(e,t[t.length-1],t.slice(0,t.length-1))}return!1}visitLambda(e){this._evaluator.getType(e),this.walkMultiple([...e.parameters,e.expression]),e.parameters.forEach((e=>{if(e.name){const t=this._evaluator.getType(e.name);t&&(v.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name):b.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&&(v.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.lambdaReturnTypeUnknown(),e.expression):b.isPartlyUnknown(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,p.Localizer.Diagnostic.lambdaReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!1)}),e.expression)),this._scopedNodes.push(e),!1}visitCall(e){var t;if(this._validateIsInstanceCall(e),y.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&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=this._evaluator.getType(e);!t||v.isNone(t)||b.isNoReturnType(t)||v.isNever(t)||v.isAnyOrUnknown(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=y.getEnclosingFunction(e),i=n?this._evaluator.getFunctionDeclaredReturnType(n):void 0;if(t=e.returnExpression?this._evaluator.getType(e.returnExpression)||v.UnknownType.create():v.NoneType.createInstance(),this._evaluator.isNodeReachable(e)&&n){if(i)if(b.isNoReturnType(i))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnContainsReturn(),e);else{const n=new a.DiagnosticAddendum;this._evaluator.canAssignType(i,t,n)||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)}v.isUnknown(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.returnTypeUnknown(),e.returnExpression):b.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):v.NoneType.createInstance();let n=t;const i=this._evaluator.getBuiltInType(e,"Iterator");return n=t&&v.isClass(i)?v.ObjectType.create(v.ClassType.cloneForSpecialization(i,[t],!0)):v.UnknownType.create(),this._validateYieldType(e,n),!0}visitYieldFrom(e){const t=this._evaluator.getType(e.expression);return t&&this._validateYieldType(e,t),!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&&v.isClass(t)){const i=new a.DiagnosticAddendum;b.doForEachSubtype(n,(e=>{v.isAnyOrUnknown(e)||v.isNone(e)||v.isObject(e)&&b.derivesFromClassRecursive(e.classType,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);if(t&&v.isObject(t)&&b.isTupleClass(t.classType)&&t.classType.variadicTypeArguments&&t.classType.variadicTypeArguments.length>0){const n=t.classType.variadicTypeArguments[t.classType.variadicTypeArguments.length-1];b.isEllipsisType(n)||this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportAssertAlwaysTrue,l.DiagnosticRule.reportAssertAlwaysTrue,p.Localizer.Diagnostic.assertAlwaysTrue(),e.testExpression)}return!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){return this._evaluator.getType(e),!0}visitBinaryOperation(e){return 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){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}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=u.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}visitError(e){return e.child&&this._evaluator.getType(e.child),!1}_validateFunctionTypeVarUsage(e){if("none"===this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse)return;const t=new Map,n=new y.NameNodeWalker((n=>{const i=this._evaluator.getType(n);i&&v.isTypeVar(i)&&i.scopeId===this._evaluator.getScopeIdForNode(e)&&(t.has(i.details.name)?t.get(i.details.name).push(n):t.set(i.details.name,[n]))}));e.parameters.forEach((e=>{const t=e.typeAnnotation||e.typeAnnotationComment;t&&n.walk(t)})),e.returnTypeAnnotation&&n.walk(e.returnTypeAnnotation),t.forEach((e=>{1===e.length&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,p.Localizer.Diagnostic.typeVarUsedOnlyOnce().format({name:e[0].value}),e[0])}))}_validateOverloadConsistency(e,t,n){for(let i=0;i<n.length;i++){const s=n[i];if(this._isOverlappingOverload(t,s)){this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.overlappingOverload().format({name:e.name.value,obscured:n.length+1,obscuredBy:i+1}),e.name);break}}for(let i=0;i<n.length;i++){const s=n[i];if(this._isOverlappingOverload(s,t)){const r=v.FunctionType.getSpecializedReturnType(s),o=v.FunctionType.getSpecializedReturnType(t);if(r&&o&&!this._evaluator.canAssignType(o,r,new a.DiagnosticAddendum,void 0,8)){const t=this._findNodeForOverload(e,s);this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.overloadReturnTypeMismatch().format({name:e.name.value,newIndex:n.length+1,prevIndex:i+1}),(t||e).name);break}}}}_findNodeForOverload(e,t){const n=this._evaluator.getDeclarationsForNameNode(e.name);if(n)for(const e of n)if(3===e.type){const n=this._evaluator.getTypeOfFunction(e.node);if((null==n?void 0:n.functionType)===t)return e.node}}_isOverlappingOverload(e,t){return this._evaluator.canAssignType(e,t,new a.DiagnosticAddendum,void 0,56)}_walkStatementsAndReportUnreachable(e){let t=!1;for(const n of e){if(!t&&!this._evaluator.isNodeReachable(n)){const i=n.start,s=e[e.length-1],r=c.TextRange.getEnd(s);this._evaluator.addUnusedCode(n,{start:i,length:r-i}),t=!0}!t&&this._fileInfo.isStubFile&&this._validateStubStatement(n),this.walk(n)}}_validateStubStatement(e){switch(e.nodeType){case 19:case 28:case 10:case 0:break;case 57:case 26:case 53:case 58:this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,p.Localizer.Diagnostic.invalidStubStatement(),e);break;case 47:for(const t of e.statements)switch(t.nodeType){case 2:case 4:case 5:case 6:case 7:case 9:case 11:case 14:case 15:case 24:case 26:case 27:case 29:case 30:case 31:case 35:case 38:case 39:case 40:case 43:case 44:case 45:case 46:case 51:case 52:case 53:case 55:case 56:case 57:case 58:case 59:case 60:case 61:this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,p.Localizer.Diagnostic.invalidStubStatement(),t)}}}_validateExceptionType(e,t){const n=this._evaluator.getBuiltInType(t,"BaseException"),i=e=>!n||!v.isClass(n)||b.derivesFromClassRecursive(e,n,!1),s=new a.DiagnosticAddendum;let r;if(v.isAnyOrUnknown(e))r=e;else if(v.isObject(e)&&(e=b.transformTypeObjectToClass(e)),v.isClass(e))i(e)||s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),r=v.ObjectType.create(e);else if(v.isObject(e)){const n=this._evaluator.getTypeFromIterable(e,!1,t);r=b.mapSubtypes(n,(t=>{if(v.isAnyOrUnknown(t))return t;const n=b.transformTypeObjectToClass(t);return v.isClass(n)?(i(n)||s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),v.ObjectType.create(n)):(s.addMessage(p.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),v.UnknownType.create())}))}return s.isEmpty()||this._evaluator.addError(p.Localizer.Diagnostic.exceptionTypeNotClass().format({type:this._evaluator.printType(e,!1)}),t),r||v.UnknownType.create()}_validateSymbolTables(){for(const e of this._scopedNodes){const t=u.getScope(e);t&&t.symbolTable.forEach(((e,n)=>{this._conditionallyReportUnusedSymbol(n,e,t.type),this._reportIncompatibleDeclarations(n,e),this._reportMultipleFinalDeclarations(n,e),this._reportMultipleTypeAliasDeclarations(n,e),this._reportInvalidOverload(n,e)}))}}_reportInvalidOverload(e,t){const n=t.getTypedDeclarations();if(1===n.length){const i=n[0];if(3===i.type){const n=this._evaluator.getEffectiveTypeOfSymbol(t);5===n.category&&v.FunctionType.isOverloaded(n)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.singleOverload().format({name:e}),i.node.name)}}}_reportMultipleFinalDeclarations(e,t){if(!T.isFinalVariable(t))return;const n=t.getDeclarations();let i=!1,s=!1;if(n.forEach((t=>{h.isFinalVariableDeclaration(t)&&(i&&this._evaluator.addError(p.Localizer.Diagnostic.finalRedeclaration().format({name:e}),t.node),i=!0),1===t.type&&t.inferredTypeSource&&(s&&this._evaluator.addError(p.Localizer.Diagnostic.finalReassigned().format({name:e}),t.node),s=!0)})),!s&&!this._fileInfo.isStubFile){const t=n.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=>h.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=T.getLastTypedDeclaredForSymbol(t);if(!n)return;let i,s=t.getDeclarations().filter((e=>e!==n));if(3===n.type&&(s=s.filter((e=>3!==e.type))),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,p.Localizer.Diagnostic.obscuredFunctionDeclaration().format({name:e}),t.node.name));else if(2===t.type)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&&v.isTypeSame(i,e)&&(s=!0)}s||r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}else!i||b.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;t.isIgnoredForProtocolMatch()||i.has(t.id)||"_"!==e&&(_.isDunderName(e)||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=b.mapSubtypes(i,(e=>b.transformPossibleRecursiveTypeAlias(b.transformTypeObjectToClass(e)))),b.derivesFromAnyOrUnknown(i))return;const s=this._evaluator.getType(e.arguments[1].valueExpression);if(!s)return;const r=e=>{let t=!0;return b.doForEachSubtype(e,(e=>{switch((e=this._evaluator.makeTopLevelTypeVarsConcrete(e)).category){case 2:case 1:case 0:break;case 8:t=v.ClassType.isBuiltIn(e.classType,"type");break;case 7:e.isTypeArgumentExplicit&&(t=!1);break;case 5:t=v.TypeBase.isInstantiable(e);break;default:t=!1}})),t};let o=!0;if(o=v.isObject(s)&&v.ClassType.isVariadicTypeParam(s.classType)&&s.classType.variadicTypeArguments?!s.classType.variadicTypeArguments.some((e=>!r(e))):r(s),!o){const t=new a.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(v.isClass(s)){if(u.push(s),v.ClassType.isBuiltIn(s)&&d.some((e=>e===s.details.name)))return}else{if(!v.isObject(s))return;{const e=s.classType;if(b.isTupleClass(e)&&e.variadicTypeArguments&&e.variadicTypeArguments.forEach((e=>{v.isClass(e)&&u.push(e)})),v.ClassType.isBuiltIn(e)&&d.some((t=>t===e.details.name)))return}}u.some((e=>v.ClassType.isProtocolClass(e)&&!v.ClassType.isRuntimeCheckable(e)))&&this._evaluator.addError(p.Localizer.Diagnostic.protocolUsedInCall().format({name:t}),e.arguments[1].valueExpression);const h=e=>v.combineTypes(e),m=e=>{const t=[];for(const n of u){const i=v.ClassType.isDerivedFrom(e,n)||v.ClassType.isBuiltIn(n,"dict")&&v.ClassType.isTypedDictClass(e),s=v.ClassType.isDerivedFrom(n,e);s&&s&&!v.ClassType.isSameGenericClass(e,n)?t.push(v.UnknownType.create()):i?t.push(e):s&&t.push(n)}return n?t.map((e=>v.isClass(e)?v.ObjectType.create(e):e)):t};let y;if(n&&v.isObject(i))y=h(m(i.classType));else if(!n&&v.isClass(i))y=h(m(i));else{if(10!==i.category)return;{let e=[],t=!1;if(b.doForEachSubtype(i,(i=>{v.isAnyOrUnknown(i)&&(t=!0),n&&v.isObject(i)?e=e.concat(m(i.classType)):!n&&v.isClass(i)&&(e=e.concat(m(i)))})),y=h(e),t)return}}const g=()=>{const e=u.map((e=>v.ObjectType.create(e)));return v.combineTypes(e)};v.isNever(y)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryIsInstance,l.DiagnosticRule.reportUnnecessaryIsInstance,n?p.Localizer.Diagnostic.unnecessaryIsInstanceNever().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(g(),!1)}):p.Localizer.Diagnostic.unnecessaryIsSubclassNever().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(g(),!1)}),e):v.isTypeSame(y,i)&&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){return 1===t||0===t||(!!_.isPrivateName(e)||!!_.isProtectedName(e)&&!(2===t))}_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=_.isPrivateName(n),s=_.isProtectedName(n);if(!i&&!s)return;const r=this._evaluator.getDeclarationsForNameNode(e);let o,a=r&&r.length>0?r[r.length-1]:void 0;if(!a||a.node===e)return;if(6===a.type&&a.usesLocalName)return;if(a=this._evaluator.resolveAliasDeclaration(a,!0),!a||a.node===e)return;a.node&&(o=y.getEnclosingClassOrModule(a.node)),a.node&&a.node.parent&&a.node.parent===o&&10===o.nodeType&&(o=y.getEnclosingClassOrModule(o));let c=!1;if(o&&10===o.nodeType&&s){const t=this._evaluator.getTypeOfClass(o);if(t&&v.isClass(t.decoratedType)){c=!0;const n=y.getEnclosingClass(e);if(n){c=!0;const e=this._evaluator.getTypeOfClass(n);if(e&&v.isClass(e.decoratedType)&&b.derivesFromClassRecursive(e.decoratedType,t.decoratedType,!0))return}}}o&&!y.isNodeContainedWithin(e,o)&&(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===o.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(!u.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)}))}_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){v.isUnknown(r)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,p.Localizer.Diagnostic.declaredReturnTypeUnknown(),i):b.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 t=new a.DiagnosticAddendum,n=this._evaluator.getScopeIdForNode(e);this._containsContravariantTypeVar(r,n,t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.returnTypeContravariant()+t.getString(),i)}if(v.FunctionType.isGenerator(t)&&(r=b.getDeclaredGeneratorReturnType(t)),r&&!n&&s)if(b.isNoReturnType(r))y.isSuiteEmpty(e.suite)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnReturnsNone(),i);else if(!v.FunctionType.isAbstractMethod(t)){const t=new a.DiagnosticAddendum;this._evaluator.canAssignType(r,v.NoneType.createInstance(),t)||y.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);v.isUnknown(n)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,p.Localizer.Diagnostic.returnTypeUnknown(),e.name):b.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)}}_containsContravariantTypeVar(e,t,n){let i=!0;return b.doForEachSubtype(e,(e=>{v.isTypeVar(e)&&2===e.details.variance&&e.scopeId!==t&&(n.addMessage(p.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:v.TypeVarType.getReadableName(e)})),i=!1)})),!i}_validateFinalMemberOverrides(e){e.details.fields.forEach(((t,n)=>{const i=b.lookUpClassMember(e,n,1);if(i&&v.isClass(i.classType)&&T.isFinalVariable(i.symbol)){const e=t.getDeclarations()[0];this._evaluator.addError(p.Localizer.Diagnostic.finalRedeclarationBySubclass().format({name:n,className:i.classType.details.name}),e.node)}}))}_validateClassMethods(e){this._fileInfo.isStubFile||this._validateBaseClassOverrides(e)}_validateBaseClassOverrides(e){e.details.fields.forEach(((t,n)=>{if(!t.isClassMember()||_.isDunderName(n)||_.isPrivateOrProtectedName(n))return;const i=this._evaluator.getEffectiveTypeOfSymbol(t);if(v.isAnyOrUnknown(i))return;const s=b.lookUpClassMember(e,n,1);if(!s||!v.isClass(s.classType))return;if(!s.symbol.hasTypedDeclarations())return;const r=b.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(s.symbol),s.classType);if(v.isFunction(r)||v.isOverloadedFunction(r)){const e=new a.DiagnosticAddendum;let o;if(v.isFunction(i)?o=i:v.isOverloadedFunction(i)&&(o=i.overloads[i.overloads.length-1]),o){if(!this._evaluator.canOverrideMethod(r,o,e)){const t=o.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=T.getLastTypedDeclaredForSymbol(s.symbol);i&&r&&i.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),r.path,r.range)}}if(5===r.category&&v.FunctionType.isFinal(r)){const e=T.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=T.getLastTypedDeclaredForSymbol(s.symbol);t&&i&&t.addRelatedInfo(p.Localizer.DiagnosticAddendum.finalMethod(),i.path,i.range)}}}else if(!v.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),o=T.getLastTypedDeclaredForSymbol(s.symbol);r&&o&&r.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenMethod(),o.path,o.range)}}}else if(b.isProperty(r))if(b.isProperty(i)){const o=r.classType.details.fields,c=i.classType.details.fields,d=s.classType;["fget","fset","fdel"].forEach((i=>{const s=new a.DiagnosticAddendum,r=o.get(i),u=c.get(i);if(r){const o=b.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(r),d);if(v.isFunction(o))if(u){const t=b.partiallySpecializeType(this._evaluator.getEffectiveTypeOfSymbol(u),e);if(v.isFunction(t)&&!this._evaluator.canOverrideMethod(o,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=o.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=o.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=new a.DiagnosticAddendum;if(!this._evaluator.canAssignType(r,i,e)){const i=t.getDeclarations();if(i.length>0){const t=i[i.length-1];if(t){const i=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,p.Localizer.Diagnostic.symbolOverridden().format({name:n,className:s.classType.details.name})+e.getString(),t.node),r=T.getLastTypedDeclaredForSymbol(s.symbol);i&&r&&i.addRelatedInfo(p.Localizer.DiagnosticAddendum.overriddenSymbol(),r.path,r.range)}}}}}))}_validateMethod(e,t,n){if(e.name&&"__new__"===e.name.value)(0===e.parameters.length||!e.parameters[0].name||"cls"!==e.parameters[0].name.value&&"mcs"!==e.parameters[0].name.value)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.newClsParam(),e.parameters.length>0?e.parameters[0]:e.name);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);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);else if(v.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(v.FunctionType.isClassMethod(t)){let t="";e.parameters.length>0&&e.parameters[0].name&&(t=e.parameters[0].name.value),"cls"!==t&&(this._fileInfo.isStubFile&&(t.startsWith("_")||"metacls"===t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,p.Localizer.Diagnostic.classMethodClsParam(),e.parameters.length>0?e.parameters[0]:e.name))}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&&v.isClass(t)&&e&&v.isClass(e.classType)&&b.derivesFromClassRecursive(e.classType,t,!0)&&(i=!0)}const s=_.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)}}}_validateYieldType(e,t){let n,i;const s=y.getEnclosingFunction(e);if(s){const t=this._evaluator.getTypeOfFunction(s);if(t){o.assert(5===t.functionType.category);const s=this._evaluator.getBuiltInType(e,"Iterable");n=v.FunctionType.getSpecializedReturnType(t.functionType),i=b.getDeclaredGeneratorYieldType(t.functionType,s)}}if(this._evaluator.isNodeReachable(e)&&i&&n)if(b.isNoReturnType(i))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,p.Localizer.Diagnostic.noReturnContainsYield(),e);else{const s=new a.DiagnosticAddendum;this._evaluator.canAssignType(i,t,s)||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(n,!1)})+s.getString(),e.expression||e)}}_reportDuplicateImports(){const e=m.getTopLevelImports(this._moduleNode),t=new Map;e.orderedImports.forEach((e=>{if(22===e.node.nodeType){const t=new Map;e.node.imports.forEach((e=>{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 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=S},2835:(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<this._paths[e]&&(e=n)})),0!==e&&(this._paths=this._paths.slice(e).concat(this._paths.slice(0,e)))}isEqual(e){if(e._paths.length!==this._paths.length)return!1;for(let t=0;t<this._paths.length;t++)if(this._paths[t]!==e._paths[t])return!1;return!0}}},6610:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createKeyForReference=t.isCodeFlowSupportedForReference=t.getUniqueFlowNodeId=t.FlowFlags=void 0;const i=n(5839);var s;(s=t.FlowFlags||(t.FlowFlags={}))[s.Unreachable=1]="Unreachable",s[s.Start=2]="Start",s[s.BranchLabel=4]="BranchLabel",s[s.LoopLabel=8]="LoopLabel",s[s.Assignment=16]="Assignment",s[s.Unbind=32]="Unbind",s[s.WildcardImport=64]="WildcardImport",s[s.TrueCondition=128]="TrueCondition",s[s.FalseCondition=512]="FalseCondition",s[s.Call=1024]="Call",s[s.PreFinallyGate=2048]="PreFinallyGate",s[s.PostFinally=4096]="PostFinally",s[s.AssignmentAlias=8192]="AssignmentAlias",s[s.VariableAnnotation=16384]="VariableAnnotation",s[s.PostContextManager=32768]="PostContextManager";let r=1;t.getUniqueFlowNodeId=function(){return r++},t.isCodeFlowSupportedForReference=function e(t){return 38===t.nodeType||35===t.nodeType&&e(t.leftExpression)},t.createKeyForReference=function(e){let t;if(38===e.nodeType)t=e.value;else{t=e.memberName.value;let n=e.leftExpression;for(;35===n.nodeType;)t=n.memberName.value+`.${t}`,n=n.leftExpression;i.assert(38===n.nodeType),t=n.value+`.${t}`}return t}},2272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFileLevelDirectives=void 0;const i=n(2930);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=o(e,t)}return t}function o(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="false"!==(o=n[1])&&("true"===o||void 0);void 0!==e&&(t[s]=e)}var o;return t}t.getFileLevelDirectives=function(e,t,n){let o=i.cloneDiagnosticRuleSet(t);n&&s(o);for(let t=0;t<e.count;t++){const n=e.getItemAt(t);if(n.comments)for(const e of n.comments)o=r(e.value.trim(),o)}return o}},5523:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNameFromDeclaration=t.isPossibleTypeAliasDeclaration=t.isExplicitTypeAliasDeclaration=t.isFinalVariableDeclaration=t.areDeclarationsSame=t.hasTypeForDeclaration=void 0,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){return 1===e.type&&!!e.typeAliasName},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")}},1272:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertDocStringToPlainText=t.convertDocStringToMarkdown=void 0,t.convertDocStringToMarkdown=function(e){return new S(e).convert()},t.convertDocStringToPlainText=function(e){const t=C(e),n=[];for(const e of t){const t=n.length>0?n[n.length-1]:void 0;D(e)&&D(t)||n.push(e)}return n.join("\n").trimEnd()};const n=/\S|$/,i=/\r?\n/,s=/\S/,r=/^\s*~~~+$/,o=/^\s*\+\+\++$/,a=/^(\s+\* )(.*)$/,l=/^\s*\.\. /,c=/^\s*\.\.\s+(\w+)::\s*(.*)$/,p=/ *>>> /,d=/^\s*:(param|arg|type|return|rtype|raise|except|var|ivar|cvar|copyright|license)/,u=[{exp:/^\s*=+(\s+=+)+$/,replacement:"="},{exp:/^\s*-+(\s+-+)+$/,replacement:"-"},{exp:/^\s*~+(\s+-+)+$/,replacement:"~"},{exp:/^\s*\++(\s+\++)+$/,replacement:"+"}],h=/\s/g,m=/``/g,y=/\t/g,g=/~/g,f=/\+/g,_=/(?<!\\)([_*~[\]])/g,T=[{exp:/</g,replacement:"&lt;"},{exp:/>/g,replacement:"&gt;"}],v=/^\s*::$/,b=[{exp:/\s+::$/g,replacement:""},{exp:/(\S)\s*::$/g,replacement:"$1:"},{exp:/:[\w_\-+:.]+:`/g,replacement:"`"},{exp:/`:[\w_\-+:.]+:/g,replacement:"`"}];class S{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=C(e)}convert(){for(;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<this._lines.length?this._lines[this._lineNum]:void 0}_currentLine(){return this._currentLineOrUndefined()||""}_currentIndent(){return I(this._currentLine())}_lineAt(e){return e<this._lines.length?this._lines[e]:void 0}_nextBlockIndent(){return I(this._lines.slice(this._lineNum+1).find((e=>!D(e)))||"")}_currentLineIsOutsideBlock(){return this._currentIndent()<this._blockIndent}_currentLineWithinBlock(){return this._currentLine().substr(this._blockIndent)}_pushAndSetState(e){this._state===this._parseText&&(this._insideInlineCode=!1),this._stateStack.push(this._state),this._state=e}_popState(){this._state=this._stateStack.splice(0,1)[0],this._state===this._parseText&&(this._insideInlineCode=!1)}_parseText(){D(this._currentLineOrUndefined())?this._state=this._parseEmpty:this._beginBacktickBlock()||this._beginLiteralBlock()||this._beginDocTest()||this._beginDirective()||(this._appendTextLine(this._escapeHtml(this._currentLine())),this._eatLine())}_escapeHtml(e){return T.forEach((t=>{e=e.replace(t.exp,t.replacement)})),e}_appendTextLine(e){e=this._preprocessTextLine(e),!this._insideInlineCode&&d.test(e)&&this._appendLine();const t=e.split("`");for(let e=0;e<t.length;e++){let n=t[e];if(e>0&&(this._insideInlineCode=!this._insideInlineCode,this._append("`")),this._insideInlineCode)this._append(n);else{if(0===e){if(1===t.length){for(const e of u)if(e.exp.test(n)){n=n.replace(h,e.replacement);break}if(r.test(n)){this._append(n.replace(g,"-"));continue}if(o.test(n)){this._append(n.replace(f,"-"));continue}}const e=a.exec(n);null!==e&&3===e.length&&(this._append(e[1]),n=e[2])}n=n.replace(_,"\\$1"),this._append(n)}}this._builder+="\n"}_preprocessTextLine(e){return v.test(e)?"":(b.forEach((t=>e=e.replace(t.exp,t.replacement))),e=e.replace(m,"`"))}_parseEmpty(){if(D(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!!p.test(this._currentLine())&&(this._beginMinIndentCodeBlock(this._parseDocTest),this._appendLine(this._currentLineWithinBlock()),this._eatLine(),!0)}_parseDocTest(){if(this._currentLineIsOutsideBlock()||D(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(!D(e))return!1;let t=this._lineNum-2;for(;t>=0;t--){const e=this._lineAt(t);if(!D(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 D(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!!l.test(this._currentLine())&&(this._pushAndSetState(this._parseDirective),this._blockIndent=this._nextBlockIndent(),this._appendDirectiveBlock=!1,!0)}_parseDirective(){const e=c.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(){D(this._currentLineOrUndefined())||!this._currentLineIsOutsideBlock()?(this._appendDirectiveBlock&&this._appendTextLine(this._currentLine().trimLeft()),this._eatLine()):this._popState()}_appendLine(e){D(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 C(e){let t=(e=e.replace(y," ".repeat(8))).split(i).map((e=>e.trimRight()));if(t.length>0){let e=t[0].trimLeft();""===e?e=void 0:t.splice(0,1),t=function(e,t){const n=function(e){const t=e.filter((e=>!D(e))).map(I);return t.length>0?Math.min(...t):0}(e);return e.map((e=>n>e.length?"":e.substr(n)))}(t),void 0!==e&&t.splice(0,0,e)}return t}function I(e){return e.search(n)}function D(e){return void 0===e||!s.test(e)}},5678:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractParameterDocumentation=t.decodeDocString=void 0,t.decodeDocString=function(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.trimRight()):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.join("\n")},t.extractParameterDocumentation=function(e,t){if(!e||!t)return;const n=e.split("\n");for(const e of n){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)}}},2374: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=void 0;const o=n(6657),a=n(6886),l=n(7559),c=r(n(7559)),p=n(6956),d=r(n(1887)),u=n(1277),h=n(1766),m=[".pyd",".so",".dylib"],y=[".py",".pyi",...m],g="-stubs";t.ImportResolver=class{constructor(e,t){this._cachedPythonSearchPaths=new Map,this._cachedImportResults=new Map,this.fileSystem=e,this._configOptions=t}invalidateCache(){this._cachedPythonSearchPaths=new Map,this._cachedImportResults=new Map}resolveImport(e,t,n){const i=this._formatImportName(n),s=[],r={importName:i,isRelative:!1,isImportFound:!1,isNamespacePackage:!1,isStubPackage:!1,importFailureInfo:s,resolvedPaths:[],importType:2,isStubFile:!1,isNativeLib:!1,implicitImports:[],filteredImplicitImports:[],nonStubImportResult:void 0};if(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&&(!s.isImportFound||!s.isNamespacePackage||this._isNamespacePackageResolved(n,s.implicitImports)))return s;const o=this._resolveBestAbsoluteImport(e,t,n,!0);if(o)return o.isStubFile&&(o.nonStubImportResult=this._resolveBestAbsoluteImport(e,t,n,!1)||r),this.addResultsToCache(t,i,o,n.importedSymbols)}return this.addResultsToCache(t,i,r,void 0)}getCompletionSuggestions(e,t,n,i){const s=[],r=[];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,n)=>{t.forEach((t=>{if(t.isStubFile&&t.isImportFound&&t.nonStubImportResult&&t.resolvedPaths.some((t=>t===e))&&t.nonStubImportResult.isImportFound){const e=t.nonStubImportResult.resolvedPaths.filter((e=>e.endsWith(".py")));i.push(...e)}}))})),0===i.length){const t=o.changeAnyExtension(e,".py");this.fileSystem.existsSync(t)&&i.push(t)}if(0===i.length){const n=this.getImportRoots(t,!0),s=[];for(const t of n)if(o.containsPath(t,e,!0)){const n=o.getRelativePathComponentsFromDirectory(t,e,!0);if(n.length>1){n[1].endsWith(g)&&(n[1]=n[1].substr(0,n[1].length-g.length));const e=o.combinePathComponents(n);e&&s.push(e)}}for(const e of s)for(const t of n){const n=o.resolvePaths(t,e);let s=o.changeAnyExtension(n,".py");if(this.fileSystem.existsSync(s))i.push(s);else{const e=o.stripFileExtension(s);e.endsWith("__init__")?(s=e.substr(0,e.length-9)+".py",this.fileSystem.existsSync(s)&&i.push(s)):(s=o.combinePaths(e,"__init__.py"),this.fileSystem.existsSync(s)&&i.push(s))}}}return i}getModuleNameForImport(e,t){let n,i=0,s=!1;const r=[],o=this._getTypeshedPath(!0,t,r);if(o&&(n=this._getModuleNameFromPath(o,e,!0),n))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.length<n.length)&&(n=t,i=2)}if(this._configOptions.stubPath){const t=this._getModuleNameFromPath(this._configOptions.stubPath,e);(!n||t&&t.length<n.length)&&(n=t,i=2,s=!0)}const a=this._getTypeshedPath(!1,t,r);if(a){const t=this._getModuleNameFromPath(a,e,!0);(!n||t&&t.length<n.length)&&(n=t,i=1)}const l=this.getTypeshedPathEx(t,r);if(l){const t=this._getModuleNameFromPath(l,e);(!n||t&&t.length<n.length)&&(n=t,i=1)}const c=this._getPythonSearchPaths(t,r);for(const t of c){const s=this._getModuleNameFromPath(t,e);(!n||s&&s.length<n.length)&&(n=s,i=1)}return n?{moduleName:n,importType:i,isLocalTypingsFile:s}:{moduleName:"",importType:2,isLocalTypingsFile:s}}getTypeshedStdLibPath(e){return this._getTypeshedPath(!0,e,[])}getImportRoots(e,t){const n=[],i=[],s=a.getPythonVersionStrings(e.pythonVersion),r=this._getTypeshedPath(!0,e,n);if(r)if(t)for(const e of s){const t=o.combinePaths(r,e);this.fileSystem.existsSync(t)&&i.push(t)}else i.push(r);i.push(e.root),i.push(...e.extraPaths),this._configOptions.stubPath&&i.push(this._configOptions.stubPath);const l=this._getTypeshedPath(!1,e,n);if(l)if(t)for(const e of s){const t=o.combinePaths(l,e);this.fileSystem.existsSync(t)&&i.push(t)}else i.push(l);const c=this.getTypeshedPathEx(e,n);c&&i.push(c);const p=this._getPythonSearchPaths(e,n);return p.length>0&&i.push(...p),i}addResultsToCache(e,t,n,i){let s=this._cachedImportResults.get(e.root);return s||(s=new Map,this._cachedImportResults.set(e.root,s)),s.set(t,n),this._filterImplicitImports(n,i)}resolveAbsoluteImport(e,t,n,i,s,r=!1,a=!1,l=!1,c=!0){s.push(`Attempting to resolve using root path '${e}'`);const p=[];let d,u,h=e,m=!1,y=!1,f=!1,_=!1,T=[];if(0===n.nameParts.length){const e="__init__",t=o.combinePaths(h,e+".py"),n=o.combinePaths(h,e+".pyi");c&&this.fileSystem.existsSync(n)&&o.isFile(this.fileSystem,n)?(s.push(`Resolved import with file '${n}'`),p.push(n),f=!0):this.fileSystem.existsSync(t)&&o.isFile(this.fileSystem,t)?(s.push(`Resolved import with file '${t}'`),p.push(t)):(s.push(`Partially resolved import with directory '${h}'`),p.push(""),m=!0),T=this._findImplicitImports(i,h,[t,n])}else for(let e=0;e<n.nameParts.length;e++){const r=0===e,u=e===n.nameParts.length-1;h=o.combinePaths(h,n.nameParts[e]),l&&r&&(h+=g,y=!0);const v=this.fileSystem.existsSync(h)&&o.isDirectory(this.fileSystem,h);if(v){if(r&&(d=h),!u){p.push("");continue}const e="__init__",t=o.combinePaths(h,e+".py"),i=o.combinePaths(h,e+".pyi");let a=!1;if(c&&this.fileSystem.existsSync(i)&&o.isFile(this.fileSystem,i)?(s.push(`Resolved import with file '${i}'`),p.push(i),u&&(f=!0),a=!0):this.fileSystem.existsSync(t)&&o.isFile(this.fileSystem,t)&&(s.push(`Resolved import with file '${t}'`),p.push(t),a=!0),a){T=this._findImplicitImports(n.nameParts.join("."),h,[t,i]);break}}let b=o.stripTrailingDirectorySeparator(h);const S=o.getFileName(b);b=o.getDirectoryPath(b);const C=o.combinePaths(b,S+".py"),I=o.combinePaths(b,S+".pyi");if(c&&this.fileSystem.existsSync(I)&&o.isFile(this.fileSystem,I))s.push(`Resolved import with file '${I}'`),p.push(I),u&&(f=!0);else if(this.fileSystem.existsSync(C)&&o.isFile(this.fileSystem,C))s.push(`Resolved import with file '${C}'`),p.push(C);else{if(a&&this.fileSystem.existsSync(b)&&o.isDirectory(this.fileSystem,b)){const e=this._getFilesInDirectory(b).find((e=>this._isNativeModuleFileName(S,e)));if(e){const r=o.combinePaths(b,e);_=this._resolveNativeModuleStub(r,t,i,n,s,p)}}!_&&v?(s.push(`Partially resolved import with directory '${h}'`),p.push(""),u&&(T=this._findImplicitImports(i,h,[C,I]),m=!0)):_&&s.push(`Did not find file '${I}' or '${C}'`)}break}return u=r?p.length>0:p.length>=n.nameParts.length,{importName:i,isRelative:!1,isNamespacePackage:m,isStubPackage:y,isImportFound:u,importFailureInfo:s,importType:2,resolvedPaths:p,searchPath:e,isStubFile:f,isNativeLib:_,implicitImports:T,filteredImplicitImports:T,packageDirectory:d}}getTypeshedPathEx(e,t){}resolveImportEx(e,t,n,i,s=[],r=!0){}resolveNativeImportEx(e,t,n=[]){}getNativeModuleName(e){const t=o.getFileExtension(e,!1).toLowerCase();if(this._isNativeModuleFileExtension(t))return o.stripFileExtension(o.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=o.ensureTrailingDirectorySeparator(e);let i=o.stripFileExtension(t);if(this._isNativeModuleFileExtension(o.getFileExtension(t))&&(i=o.stripFileExtension(i)),!i.startsWith(e))return;i.endsWith("__init__")&&(i=i.substr(0,i.length-9));const s=i.substr(e.length),r=o.getPathComponents(s);if(r.shift(),n){if(0===r.length)return;r.shift()}return 0===r.length||(r[0].endsWith(g)&&(r[0]=r[0].substr(0,r[0].length-g.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);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 l=this.resolveAbsoluteImport(t.root,t,n,s,r,void 0,!0,void 0,i);a=l;for(const e of t.extraPaths)r.push(`Looking in extraPath '${e}'`),l=this.resolveAbsoluteImport(e,t,n,s,r,void 0,!0,void 0,i),a=this._pickBestImport(a,l);if(null==a?void 0:a.isImportFound)return a;const c=this._getPythonSearchPaths(t,r);if(c.length>0)for(const e of c){r.push(`Looking in python search path '${e}'`);const l=o.combinePaths(e,n.nameParts[0]);let c,p;if(i&&(c=u.getPyTypedInfo(this.fileSystem,l+g),p=this.resolveAbsoluteImport(e,t,n,s,r,!1,!1,!0,i)),(null==p?void 0:p.isImportFound)||(null==p?void 0:p.packageDirectory)&&!(null==c?void 0:c.isPartiallyTyped)||(c=u.getPyTypedInfo(this.fileSystem,l),p=this.resolveAbsoluteImport(e,t,n,s,r,!1,!0,!1,i)),p){if(p.importType=1,p.isPyTypedPresent=null==c?void 0:c.isPyTypedPresent,p.isImportFound&&p.isStubFile)return p;a=this._pickBestImport(a,p)}}else r.push("No python interpreter search path");const p=this.resolveImportEx(e,t,n,s,r,i);if(void 0!==p)return p;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){if(!e)return t;if(!t)return e;if(t.isImportFound){if(!e.isImportFound)return t;if(e.resolvedPaths.length>t.resolvedPaths.length)return t}return e}_isIdentifier(e){for(let t=0;t<e.length;t++)if(0===t?!p.isIdentifierStartChar(e.charCodeAt(t)):!p.isIdentifierChar(e.charCodeAt(t)))return!1;return!0}_getPythonSearchPaths(e,t){const n=e.venv?e.venv:"<default>";return this._cachedPythonSearchPaths.has(n)||this._cachedPythonSearchPaths.set(n,d.findPythonSearchPaths(this.fileSystem,this._configOptions,e.venv,t)||[]),this._cachedPythonSearchPaths.get(n)}_findTypeshedPath(e,t,n,i,s){s.push(`Looking for typeshed ${i?d.stdLibFolderName:d.thirdPartyFolderName} path`);const r=this._getTypeshedPath(i,e,s);if(r){for(const l of a.getPythonVersionStrings(e.pythonVersion)){const a=o.combinePaths(r,l);if(this.fileSystem.existsSync(a)){const r=this.resolveAbsoluteImport(a,e,t,n,s);if(r.isImportFound)return r.importType=i?0:1,r}}s.push("Typeshed path not found")}}_getCompletionSuggestionsTypeshedPath(e,t,n,i,s){const r=this._getTypeshedPath(n,e,[]);if(r)for(const n of a.getPythonVersionStrings(e.pythonVersion)){const e=o.combinePaths(r,n);this.fileSystem.existsSync(e)&&this._getCompletionSuggestionsAbsolute(e,t,i,s)}}_getTypeshedPath(e,t,n){if(e){if(void 0!==this._cachedTypeshedStdLibPath)return this._cachedTypeshedStdLibPath}else if(void 0!==this._cachedTypeshedThirdPartyPath)return this._cachedTypeshedThirdPartyPath;let i="";if(this._configOptions.typeshedPath){const e=this._configOptions.typeshedPath;this.fileSystem.existsSync(e)&&o.isDirectory(this.fileSystem,e)&&(i=e)}else{const e=this._getPythonSearchPaths(t,n);for(const t of e){const e=o.combinePaths(t,"typeshed");if(this.fileSystem.existsSync(e)&&o.isDirectory(this.fileSystem,e)){i=e;break}}}if(i||(i=d.getTypeShedFallbackPath(this.fileSystem)||""),i=d.getTypeshedSubdirectory(i,e),this.fileSystem.existsSync(i)&&o.isDirectory(this.fileSystem,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=o.getDirectoryPath(e);for(let e=1;e<n.leadingDots;e++){if(""===r)return void s.push(`Invalid relative path '${i}'`);r=o.getDirectoryPath(r)}const a=this.resolveAbsoluteImport(r,t,n,i,s,!1,!0);return this._filterImplicitImports(a,n.importedSymbols)}_getCompletionSuggestionsRelative(e,t,n,i){let s=o.getDirectoryPath(e);for(let e=1;e<t.leadingDots;e++){if(""===s)return;s=o.getDirectoryPath(s)}this._getCompletionSuggestionsAbsolute(s,t,n,i)}_getFilesInDirectory(e){return this.fileSystem.readdirEntriesSync(e).filter((e=>e.isFile())).map((e=>e.name))}_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<r.length&&(e===r.length-1&&this._addFilteredSuggestions(s,r[e],n,i),s=o.combinePaths(s,r[e]),this.fileSystem.existsSync(s)&&o.isDirectory(this.fileSystem,s));e++);}_addFilteredSuggestions(e,t,n,i){const s=o.getFileSystemEntries(this.fileSystem,e);s.files.forEach((e=>{const i=o.getFileExtension(e,!1).toLowerCase(),s=o.stripFileExtension(e,!0);y.some((e=>e===i))&&"__init__"!==s&&(t&&!c.isPatternInSymbol(t,s)||this._addUniqueSuggestion(s,n))})),s.directories.forEach((e=>{t&&!e.startsWith(t)||this._addUniqueSuggestion(e,n)}))}_addUniqueSuggestion(e,t){t.some((t=>t===e))||/[.-]/.test(e)||h.isDunderName(e)&&"__future__"!==e||t.push(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=o.getFileSystemEntries(this.fileSystem,t);for(const r of s.files){const s=o.getFileExtension(r);let a,l=!1;if(".py"===s||".pyi"===s)a=o.stripFileExtension(r);else{if(!this._isNativeModuleFileExtension(s)||this.fileSystem.existsSync(`${r}.py`)||this.fileSystem.existsSync(`${r}.pyi`))continue;a=r.substr(0,r.indexOf(".")),l=!0}const c=o.combinePaths(t,r);if(!n.find((e=>e===c))){const n={isStubFile:r.endsWith(".pyi"),isNativeLib:l,name:a,path:c},s=i.get(n.name);if(!s||!s.isStubFile){if(l){const i=o.combinePaths(t,r),s=this.resolveNativeImportEx(i,`${e}.${a}`,[]);s&&(n.path=s)}i.set(n.name,n)}}}for(const e of s.directories){const s=o.combinePaths(t,e,"__init__.py"),r=s+"i";let a=!1,l="";if(this.fileSystem.existsSync(r)&&o.isFile(this.fileSystem,r)?(a=!0,l=r):this.fileSystem.existsSync(s)&&o.isFile(this.fileSystem,s)&&(l=s),l&&!n.find((e=>e===l))){const t={isStubFile:a,isNativeLib:!1,name:e,path:l};i.set(t.name,t)}}return[...i.values()]}_formatImportName(e){let t="";for(let n=0;n<e.leadingDots;n++)t+=".";return t+e.nameParts.map((e=>e)).join(".")}_resolveNativeModuleStub(e,t,n,i,s,r){let o=n;if(i.leadingDots>0){const n=this.getModuleNameForImport(e,t);o=n.moduleName.length>0?n.moduleName:o}const a=this.resolveNativeImportEx(e,o,s);return a?(s.push(`Resolved native import ${n} with stub '${a}'`),r.push(a),!1):(s.push(`Resolved import with file '${e}'`),r.push(e),!0)}_isNativeModuleFileName(e,t){const n=o.getFileExtension(t,!1).toLowerCase(),i=o.stripFileExtension(t,!0);return this._isNativeModuleFileExtension(n)&&l.equateStringsCaseInsensitive(e,i)}_isNativeModuleFileExtension(e){return m.some((t=>t===e))}}},7012: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 o=n(3213),a=n(1464),l=n(3550),c=r(n(563)),p=r(n(1766));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;n<e.leadingDots;n++)t+=".";return t+=e.nameParts.map((e=>e.value)).join("."),t}t.getImportGroup=d,t.compareImportStatements=function(e,t){const n=d(e),i=d(t);return n<i?-1:n>i?1:e.moduleName<t.moduleName?-1:1},t.getTopLevelImports=function(e,t=!1){const n={orderedImports:[],mapByFilePath:new Map};let i=!1,s=!1;return e.statements.forEach((e=>{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 o={node:e,subnode:i,importResult:s,resolvedPath:r,moduleName:u(i.module),followsNonImportStatement:n};t.orderedImports.push(o),r&&(t.mapByFilePath.has(r)||t.mapByFilePath.set(r,o))}))}(e,n,i),i=!1):22===e.nodeType?(s=!0,function(e,t,n,i){var s;const r=c.getImportInfo(e.module);let o;if(r&&r.isImportFound&&(o=r.resolvedPaths[r.resolvedPaths.length-1]),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 a={node:e,importResult:r,resolvedPath:o,moduleName:u(e.module),followsNonImportStatement:n};if(t.orderedImports.push(a),o){const e=t.mapByFilePath.get(o);(!e||20===e.node.nodeType||e.moduleName.length>a.moduleName.length)&&t.mapByFilePath.set(o,a)}}(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}const o=r?l.TextRange.getEnd(r):t.node.imports.length>0?t.node.imports[0].start:t.node.start+t.node.length,c=a.convertOffsetToPosition(o,n.tokenizerOutput.lines),p=i?`${e} as ${i}`:e;s.push({range:{start:c,end:c},replacementText:r?", "+p:p+", "})}return s},t.getTextEditsForAutoImportInsertion=function(e,t,n,i,s,r,o){const c=[],u=e||n,h=o?`${u} as ${o}`:u;let m,y=e?`from ${n} import ${h}`:`import ${h}`;const g=a.convertPositionToOffset(r,s.tokenizerOutput.lines);if(t.orderedImports.length>0&&g>=t.orderedImports[0].node.start){let e=!0,r=t.orderedImports[0],o=0;for(const a of t.orderedImports){const l=a.importResult?d(a):o;if(i<l){!e&&o<i&&(y=s.tokenizerOutput.predominantEndOfLineSequence+y);break}if(i===l&&a.moduleName>n)break;if(a.followsNonImportStatement){i>o&&(y=s.tokenizerOutput.predominantEndOfLineSequence+y);break}a===t.orderedImports[t.orderedImports.length-1]&&i>l&&(y=s.tokenizerOutput.predominantEndOfLineSequence+y),e=!e&&i<o&&i===l,o=l,r=a}r?(e?y+=s.tokenizerOutput.predominantEndOfLineSequence:y=s.tokenizerOutput.predominantEndOfLineSequence+y,m=a.convertOffsetToPosition(e?r.node.start:l.TextRange.getEnd(r.node),s.tokenizerOutput.lines)):m={line:0,character:0}}else{m={line:0,character:0};let e=!1;for(const t of s.parseTree.statements){let n=!0;if(47===t.nodeType&&1===t.statements.length){const e=t.statements[0];(48===e.nodeType||3===e.nodeType&&38===e.leftExpression.nodeType&&p.isDunderName(e.leftExpression.value))&&(n=!1)}if(n){m=a.convertOffsetToPosition(t.start,s.tokenizerOutput.lines),e=!1;break}m=a.convertOffsetToPosition(t.start+t.length,s.tokenizerOutput.lines),e=!0}y+=s.tokenizerOutput.predominantEndOfLineSequence+s.tokenizerOutput.predominantEndOfLineSequence,e?y=s.tokenizerOutput.predominantEndOfLineSequence+y:y+=s.tokenizerOutput.predominantEndOfLineSequence}return c.push({range:{start:m,end:m},replacementText:y}),c},t.getContainingImportStatement=function(e,t){for(;e&&(o.throwIfCancellationRequested(t),20!==e.nodeType&&22!==e.nodeType);)e=e.parent;return e},t.getAllImportNames=function(e){return 20===e.nodeType?e.list:e.imports}},2559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PackageTypeVerifier=t.PackageSymbolType=void 0;const i=n(2930),s=n(1290),r=n(6657),o=n(3550),a=n(2374),l=n(8408),c=n(1277),p=n(5083),d=n(1766),u=n(1133),h=n(5168);var m;!function(e){e[e.Indeterminate=0]="Indeterminate",e[e.Module=1]="Module",e[e.Class=2]="Class",e[e.Variable=3]="Variable",e[e.Constant=4]="Constant",e[e.Function=5]="Function",e[e.Method=6]="Method",e[e.TypeVar=7]="TypeVar",e[e.TypeAlias=8]="TypeAlias"}(m=t.PackageSymbolType||(t.PackageSymbolType={}));class y{constructor(e){this._fileSystem=e,this._typeCache=new Map,this._configOptions=new i.ConfigOptions(""),this._execEnv=this._configOptions.findExecEnvironment("."),this._importResolver=new a.ImportResolver(this._fileSystem,this._configOptions),this._program=new l.Program(this._importResolver,this._configOptions)}verify(e){const t=e.trim(),n={packageName:t,rootDirectory:this._getDirectoryForPackage(t),pyTypedPath:void 0,symbolCount:0,unknownTypeCount:0,missingFunctionDocStringCount:0,missingClassDocStringCount:0,missingDefaultParamCount:0,modules:[],diagnostics:[]};try{if(!t||t.includes("."))n.diagnostics.push(new s.Diagnostic(0,`Package name "${t}" is invalid`,o.getEmptyRange()));else if(n.rootDirectory){const e=c.getPyTypedInfo(this._fileSystem,n.rootDirectory);if(e.isPyTypedPresent){n.pyTypedPath=e.pyTypedPath;const i=this._getListOfPublicModules(n.rootDirectory,t),s=new Map;i.forEach((e=>{this._getPublicSymbolsForModule(e,s)})),i.forEach((e=>{this._verifyTypesForModule(e,s,n)}))}else n.diagnostics.push(new s.Diagnostic(0,"No py.typed file found",o.getEmptyRange()))}else n.diagnostics.push(new s.Diagnostic(0,`Package "${t}" cannot be resolved`,o.getEmptyRange()))}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);n.diagnostics.push(new s.Diagnostic(0,`An internal error occurred while verifying types: "${t}"`,o.getEmptyRange()))}return n}static getSymbolTypeString(e){switch(e){case m.Class:return"class";case m.Function:return"function";case m.Method:return"method";case m.Constant:return"constant";case m.Variable:return"variable";case m.Module:return"module";case m.TypeAlias:return"type alias";case m.TypeVar:return"type variable";case m.Indeterminate:return"symbol"}}_resolveImport(e){const t={leadingDots:0,nameParts:e.split("."),importedSymbols:[]};return this._importResolver.resolveImport("",this._execEnv,t)}_getPublicSymbolsForModule(e,t){const n=this._resolveImport(e);if(n.isImportFound){const i=n.resolvedPaths[n.resolvedPaths.length-1];this._program.addTrackedFiles([i],!0,!0);const s=this._program.getBoundSourceFile(i);if(s){const n={name:e,symbols:[]},i=s.getParseResults().parseTree,r=p.getScopeForNode(i);this._getPublicSymbolsInSymbolTable(t,n,n.name,r.symbolTable,3)}}}_getPublicSymbolsInSymbolTable(e,t,n,i,s){i.forEach(((i,r)=>{if(!(d.isPrivateOrProtectedName(r)||i.isExternallyHidden()||i.isIgnoredForProtocolMatch()||this._isSymbolTypeImplied(s,r))){const s=`${n}.${r}`,o=this._program.getTypeForSymbol(i);e.set(s,s);const a=i.getTypedDeclarations();a.length>0&&a.find((e=>4===e.type))&&u.isClass(o)&&this._getPublicSymbolsInSymbolTable(e,t,s,o.details.fields,2)}}))}_verifyTypesForModule(e,t,n){const i={name:e,symbols:[]};n.modules.push(i);const r=this._resolveImport(e);if(r.isImportFound)if(r.isStubPackage)n.diagnostics.push(new s.Diagnostic(0,`No inlined types found for module "${e}" because stub package was present`,o.getEmptyRange()));else{const e=r.resolvedPaths[r.resolvedPaths.length-1];this._program.addTrackedFiles([e],!0,!0);const a=this._program.getBoundSourceFile(e);if(a){const e=a.getParseResults().parseTree,s=p.getScopeForNode(e);this._verifySymbolsInSymbolTable(n,i,i.name,s.symbolTable,3,t,"")}else n.diagnostics.push(new s.Diagnostic(0,`Could not bind file "${e}"`,o.getEmptyRange()))}else n.diagnostics.push(new s.Diagnostic(0,`Could not resolve module "${e}"`,o.getEmptyRange()))}_getListOfPublicModules(e,t){const n=[];this._addPublicModulesRecursive(e,t,n);const i=[],s=new Map;return n.forEach((e=>{s.has(e)||(i.push(e),s.set(e,e))})),i}_addPublicModulesRecursive(e,t,n){this._fileSystem.readdirEntriesSync(e).forEach((i=>{if(i.isFile()){const e=r.getFileExtension(i.name);if(".py"===e||".pyi"===e){const e=r.stripFileExtension(i.name);"__init__"===e?n.push(t):!d.isPrivateOrProtectedName(e)&&this._isLegalModulePartName(e)&&n.push(`${t}.${e}`)}}else i.isDirectory()&&!d.isPrivateOrProtectedName(i.name)&&this._isLegalModulePartName(i.name)&&this._addPublicModulesRecursive(r.combinePaths(e,i.name),`${t}.${i.name}`,n)}))}_isLegalModulePartName(e){return!!e.match(/[a-z_]+/)}_verifySymbolsInSymbolTable(e,t,n,i,r,a,l){i.forEach(((i,c)=>{if(!(d.isPrivateOrProtectedName(c)||i.isExternallyHidden()||i.isIgnoredForProtocolMatch()||this._isSymbolTypeImplied(r,c))){const p=`${n}.${c}`,m=this._program.getTypeForSymbol(i);let g="";const f=this._getPackageSymbolType(i,m),_=y.getSymbolTypeString(f),T={name:c,fullName:p,symbolType:f};t.symbols.push(T),e.symbolCount++;const v=i.getTypedDeclarations();if(!this._isSymbolTypeImplied(r,c))if(u.isUnknown(m))g=0===v.length?`Type not declared for ${_} "${p}"`:`Type unknown for ${_} "${p}"`;else{const e=new s.DiagnosticAddendum;this._validateTypeIsCompletelyKnown(m,e,a,p,[])||(g=`Type partially unknown for ${_} "${p}"`+e.getString(16,32))}if(g&&(e.diagnostics.push(new s.Diagnostic(0,g,o.getEmptyRange())),e.unknownTypeCount++),v.length>0&&(v.find((e=>4===e.type))&&u.isClass(m)&&(m.details.docString||(e.diagnostics.push(new s.Diagnostic(1,`No docstring found for class "${p}"`,o.getEmptyRange())),e.missingClassDocStringCount++),this._verifySymbolsInSymbolTable(e,t,p,m.details.fields,2,a,l)),v.filter((e=>3===e.type)).length>0)){let t=!1,n=!1;u.isFunction(m)?(m.details.docString||(t=!0),m.details.parameters.find((e=>e.hasDefault&&h.isEllipsisType(e.defaultType)))&&(n=!0)):u.isOverloadedFunction(m)&&(m.overloads.find((e=>e.details.docString))||(t=!0),m.overloads.forEach((e=>{e.details.parameters.find((e=>e.hasDefault&&h.isEllipsisType(e.defaultType)))&&(n=!0)}))),t&&(d.isDunderName(c)||(e.diagnostics.push(new s.Diagnostic(1,`No docstring found for function "${p}"`,o.getEmptyRange())),e.missingFunctionDocStringCount++)),n&&(e.diagnostics.push(new s.Diagnostic(1,`One or more default values in function "${p}" is specified as "..."`,o.getEmptyRange())),e.missingDefaultParamCount++)}}}))}_pushType(e,t,n){e.push(t);const i=n();return e.pop(),i}_validateTypeIsCompletelyKnown(e,t,n,i,s){if(s.length>16)return!0;switch((e=h.transformTypeObjectToClass(e)).category){case 0:case 2:case 3:case 4:case 11:return!0;case 1:return!1;case 8:return this._validateTypeIsCompletelyKnown(e.classType,t,n,i,s);case 6:{let r=!0;for(const o of e.overloads)this._validateTypeIsCompletelyKnown(o,t.createAddendum(),n,i,s)||(r=!1);return r}case 10:{let r=!0;return h.doForEachSubtype(e,(e=>{this._validateTypeIsCompletelyKnown(e,t.createAddendum(),n,i,s)||(r=!1)})),r}case 5:{let r=!0;if(e.details.parameters.forEach((e=>{if(e.name){const o=t.createAddendum();e.hasDeclaredType?u.isUnknown(e.type)?(o.addMessage(`Type unknown for parameter "${e.name}"`),r=!1):this._validateTypeIsCompletelyKnown(e.type,o.createAddendum(),n,i,s)||(o.addMessage(`Type partially unknown for parameter "${e.name}"`),r=!1):u.isTypeVar(e.type)&&e.type.details.isSynthesized||(o.addMessage(`Parameter "${e.name}" is missing a type annotation`),r=!1)}})),e.details.declaredReturnType){const o=t.createAddendum();u.isUnknown(e.details.declaredReturnType)?(o.addMessage("Return type unknown"),r=!1):this._validateTypeIsCompletelyKnown(e.details.declaredReturnType,o.createAddendum(),n,i,s)||(o.addMessage("Return type partially unknown"),r=!1)}else"__init__"!==e.details.name&&(t.createAddendum().addMessage("Return type annotation is missing"),r=!1);return r}case 7:{const r=this._validateClassTypeIsCompletelyKnown(e,n,i,s);let o=r.isFullyKnown;if(i===e.details.fullName||!n.has(e.details.fullName)){const n=t.createAddendum();o||n.addAddendum(r.diag),r.classFields&&r.classFields.forEach((e=>{e.isFullyKnown||(n.addAddendum(e.diag),o=!1)})),o||n.addMessage(`Type partially unknown for class "${this._program.printType(h.convertToInstance(e),!1)}"`)}return o}case 9:{const i=this._validateModuleTypeIsCompletelyKnown(e,n,s);return i.isFullyKnown||t.addAddendum(i.diag),i.isFullyKnown}}}_validateClassTypeIsCompletelyKnown(e,t,n,i){let r;const o=new s.DiagnosticAddendum;if(n!==e.details.fullName&&t.has(e.details.fullName))r={isFullyKnown:!0,diag:o,classFields:void 0};else{if(i.some((t=>t===e.details.fullName)))return{isFullyKnown:!0,diag:o,classFields:void 0};this._pushType(i,e.details.fullName,(()=>{var a;const l=this._typeCache.get(e.details.fullName);if(l)r=l;else if(u.ClassType.isBuiltIn(e))r={isFullyKnown:!0,diag:o,classFields:void 0};else{this._typeCache.set(e.details.fullName,{isFullyKnown:!0,diag:o,classFields:void 0});const l=new Map;let c=!0;if(e.details.fields.forEach(((e,r)=>{if(!d.isPrivateOrProtectedName(r)&&!e.isExternallyHidden()&&!e.isIgnoredForProtocolMatch()){const a=this._program.getTypeForSymbol(e),c=this._getPackageSymbolType(e,a),p=y.getSymbolTypeString(c),d=new s.DiagnosticAddendum;this._isSymbolTypeImplied(2,r)||(u.isUnknown(a)?(d.addMessage(`Type unknown for ${p} "${r}"`),o.addAddendum(d)):this._validateTypeIsCompletelyKnown(a,d.createAddendum(),t,n,i)||(d.addMessage(`Type partially unknown for ${p} "${r}"`),o.addAddendum(d))),l.set(r,{isFullyKnown:d.isEmpty(),diag:d,classFields:void 0})}})),e.details.mro.forEach(((e,r)=>{if(0!==r&&u.isClass(e)){const r=this._validateClassTypeIsCompletelyKnown(e,t,n,i);if(r.classFields){const n=e.details.baseClasses.find((t=>u.isClass(t)&&t.details.mro.some((t=>u.isClass(t)&&u.ClassType.isSameGenericClass(t,e))))),i=n&&t.has(n.details.fullName);r.classFields.forEach(((t,n)=>{if(!l.has(n)){const r=!t.isFullyKnown&&!i,o=new s.DiagnosticAddendum;r&&(o.addAddendum(t.diag),o.addMessage(`Type partially unknown for symbol "${n}" defined in base class "${this._program.printType(h.convertToInstance(e),!1)}"`)),l.set(n,{isFullyKnown:!r,diag:o,classFields:void 0})}}))}}})),e.details.effectiveMetaclass)if(u.isClass(e.details.effectiveMetaclass)){if(!u.ClassType.isBuiltIn(e.details.effectiveMetaclass)){const r=this._validateClassTypeIsCompletelyKnown(e.details.effectiveMetaclass,t,n,i),l=new s.DiagnosticAddendum;let p=!0;r.isFullyKnown||(l.addAddendum(r.diag),p=!1),null===(a=r.classFields)||void 0===a||a.forEach((e=>{e.isFullyKnown||(l.addAddendum(e.diag),p=!1)})),p||(l.addMessage(`Type of metaclass "${e.details.effectiveMetaclass.details.fullName}" is partially unknown`),o.addAddendum(l),c=!1)}}else o.addMessage("Type for metaclass is unknown"),c=!1;e.details.baseClasses.forEach(((e,r)=>{const a=new s.DiagnosticAddendum;if(u.isClass(e)){if(!u.ClassType.isBuiltIn(e)){const s=this._validateClassTypeIsCompletelyKnown(e,t,n,i);s.isFullyKnown||(a.addMessage(`Type partially unknown for base class "${this._program.printType(h.convertToInstance(e),!1)}"`),o.addAddendum(s.diag),c=!1)}}else a.addMessage(`Type unknown for base class ${r+1}`),c=!1})),r={isFullyKnown:c,diag:o,classFields:l},this._typeCache.set(e.details.fullName,r)}}))}return e.typeArguments&&this._pushType(i,e.details.fullName,(()=>{const o=new s.DiagnosticAddendum;r.diag.getChildren().forEach((e=>{o.addAddendum(e)})),r={isFullyKnown:r.isFullyKnown,diag:o,classFields:r.classFields},e.typeArguments.forEach(((a,l)=>{const c=new s.DiagnosticAddendum,p=l<e.details.typeParameters.length?` which corresponds to TypeVar ${e.details.typeParameters[l].details.name}`:"";u.isUnknown(a)?(c.addMessage(`Type unknown for type argument ${l+1}${p}`),o.addAddendum(c),r.isFullyKnown=!1):this._validateTypeIsCompletelyKnown(a,c,t,n,i)||(c.addMessage(`Type partially unknown for type argument ${l+1}${p}`),o.addAddendum(c),r.isFullyKnown=!1)}))})),r}_validateModuleTypeIsCompletelyKnown(e,t,n){let i=this._typeCache.get(e.moduleName);if(i)return i;const r=new s.DiagnosticAddendum;if(n.length>16)return{isFullyKnown:!0,diag:r,classFields:void 0};let o=!0;return e.fields.forEach(((e,i)=>{if(!(d.isPrivateOrProtectedName(i)||e.isExternallyHidden()||e.isIgnoredForProtocolMatch()||this._isSymbolTypeImplied(3,i))){const a=this._program.getTypeForSymbol(e),l=this._getPackageSymbolType(e,a),c=y.getSymbolTypeString(l),p=new s.DiagnosticAddendum;u.isUnknown(a)?(p.addMessage(`Type unknown for ${c} "${i}"`),r.addAddendum(p),o=!1):this._validateTypeIsCompletelyKnown(a,p.createAddendum(),t,"",n)||(p.addMessage(`Type partially unknown for ${c} "${i}"`),r.addAddendum(p),o=!1)}})),i={isFullyKnown:o,diag:r,classFields:void 0},this._typeCache.set(e.moduleName,i),i}_getPackageSymbolType(e,t){if(t.typeAliasInfo)return m.TypeAlias;switch(t.category){case 7:return m.Class;case 5:case 6:{const t=e.getDeclarations().find((e=>3===e.type));return t&&t.isMethod?m.Method:m.Function}case 8:{const t=e.getDeclarations().find((e=>1===e.type));return t&&(t.isConstant||t.isFinal)?m.Constant:m.Variable}case 9:return m.Module;case 11:return m.TypeVar;default:{const t=e.getDeclarations().find((e=>1===e.type));return t?t.isConstant||t.isFinal?m.Constant:m.Variable:m.Indeterminate}}}_getDirectoryForPackage(e){const t={leadingDots:0,nameParts:[e],importedSymbols:[]},n=this._importResolver.resolveImport("",this._execEnv,t);if(n.isImportFound){const e=n.resolvedPaths[n.resolvedPaths.length-1];return r.getDirectoryPath(e)}}_isSymbolTypeImplied(e,t){return 2===e?["__class__","__dict__","__doc__","__module__","__slots__"].some((e=>e===t)):3===e&&["__all__","__author__","__copyright__","__email__","__license__","__title__","__uri__","__version__"].some((e=>e===t))}}t.PackageTypeVerifier=y},4482: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.ParseTreeCleanerWalker=void 0;const o=r(n(563)),a=n(427);class l extends a.ParseTreeWalker{constructor(e){super(),this._parseTree=e}clean(){this.walk(this._parseTree)}visitNode(e){return o.cleanNodeAnalysisInfo(e),super.visitNode(e)}}t.ParseTreeCleanerWalker=l},8494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NameNodeWalker=t.isAssignmentToDefaultsFollowingNamedTuple=t.getDocString=t.isWithinLoop=t.isWithinAnnotationComment=t.isWithinTypeAnnotation=t.isWithinDefaultParamInitializer=t.isPartialMatchingExpression=t.isMatchingExpression=t.isSuiteEmpty=t.isNodeContainedWithin=t.isFinalAllowedForAssignmentTarget=t.getTypeAnnotationNode=t.getExecutionScopeNode=t.getTypeVarScopeNode=t.getEvaluationScopeNode=t.getEvaluationNodeForAssignmentExpression=t.getEnclosingSuiteOrModule=t.getEnclosingClassOrFunction=t.getEnclosingLambda=t.getEnclosingFunction=t.getEnclosingClassOrModule=t.getEnclosingModule=t.getEnclosingClass=t.printOperator=t.printExpression=t.findNodeByOffset=t.findNodeByPosition=t.getNodeDepth=void 0;const i=n(5839),s=n(1464),r=n(3550),o=n(5275),a=n(563),l=n(5678),c=n(427);function p(e,t){if(t<e.start||t>r.TextRange.getEnd(e))return;const n=(new c.ParseTreeWalker).visitNode(e);for(const e of n)if(e){const n=p(e,t);if(n)return n}return e}function d(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 u(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 h(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return;t=t.parent}}function m(e){let t,n=e,s=!1;for(;n;){switch(41===n.nodeType&&t===n.name&&(s=!0),n.nodeType){case 28:if(n.parameters.some((e=>e===t))){if(s&&void 0!==a.getScope(n))return n}else if(t===n.suite&&void 0!==a.getScope(n))return n;break;case 30:if(n.parameters.some((e=>e===t))){if(s&&void 0!==a.getScope(n))return n}else if((!t||t===n.expression)&&void 0!==a.getScope(n))return n;break;case 10:if(t===n.suite&&void 0!==a.getScope(n))return n;break;case 32:case 36:if(void 0!==a.getScope(n))return n}t=n,n=n.parent}i.fail("Did not find evaluation scope")}function y(e,t){return 38===e.nodeType&&38===t.nodeType?e.value===t.value:35===e.nodeType&&35===t.nodeType&&y(e.leftExpression,t.leftExpression)&&e.memberName.value===t.memberName.value}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=s.convertPositionToOffset(t,n);if(void 0!==i)return p(e,i)},t.findNodeByOffset=p,t.printExpression=function e(t,n=0){switch(t.nodeType){case 38:return t.value;case 35:return e(t.leftExpression,n)+"."+t.memberName.value;case 9:return e(t.leftExpression,n)+"("+t.arguments.map((t=>{let i="";return 1===t.argumentCategory?i="*":2===t.argumentCategory&&(i="**"),t.name&&(i+=t.name.value+"="),i+=e(t.valueExpression,n),i})).join(", ")+")";case 24:return e(t.baseExpression,n)+"["+t.items.map((t=>e(t,n))).join(", ")+"]";case 55:return d(t.operator)+" "+e(t.expression,n);case 7:return e(t.leftExpression,n)+" "+d(t.operator)+" "+e(t.rightExpression,n);case 40:{let e=t.value.toString();return t.isImaginary&&(e+="j"),e}case 48:return 1&n&&t.typeAnnotation?e(t.typeAnnotation,n):t.strings.map((t=>e(t,n))).join(" ");case 49:{let e="";return 8&t.token.flags&&(e+="r"),16&t.token.flags&&(e+="u"),32&t.token.flags&&(e+="b"),64&t.token.flags&&(e+="f"),4&t.token.flags?1&t.token.flags?e+=`'''${t.token.escapedValue}'''`:e+=`"""${t.token.escapedValue}"""`:1&t.token.flags?e+=`'${t.token.escapedValue}'`:e+=`"${t.token.escapedValue}"`,e}case 3:return e(t.leftExpression,n)+" = "+e(t.rightExpression,n);case 4:return e(t.name,n)+" := "+e(t.rightExpression,n);case 54:return e(t.valueExpression,n)+": "+e(t.typeAnnotation,n);case 5:return e(t.leftExpression,n)+" "+d(t.operator)+" "+e(t.rightExpression,n);case 6:return"await "+e(t.expression,n);case 51:return e(t.ifExpression,n)+" if "+e(t.testExpression,n)+" else "+e(t.elseExpression,n);case 31:return`[${t.entries.map((t=>e(t,n))).join(", ")}]`;case 56:return"*"+e(t.expression,n);case 52:{const i=t.expressions.map((t=>e(t,n)));return 1===i.length?`(${i[0]}, )`:`(${i.join(", ")})`}case 60:return t.expression?"yield "+e(t.expression,n):"yield";case 61:return"yield from "+e(t.expression,n);case 18:return"...";case 32:{let i="<ListExpression>";return o.isExpressionNode(t.expression)?i=e(t.expression,n):17===t.expression.nodeType&&(i=`${e(t.expression.keyExpression,n)}: ${e(t.expression.valueExpression,n)}`),i+" "+t.comprehensions.map((t=>33===t.nodeType?(t.isAsync?"async ":"")+"for "+e(t.targetExpression,n)+` in ${e(t.iterableExpression,n)}`:`if ${e(t.testExpression,n)}`)).join(" ")}case 46:{let i="";return t.startValue&&(i+=e(t.startValue,n)),t.endValue&&(i+=": "+e(t.endValue,n)),t.stepValue&&(i+=": "+e(t.stepValue,n)),i}case 30:return"lambda "+t.parameters.map((t=>{let i="";return 1===t.category?i+="*":2===t.category&&(i+="**"),t.name&&(i+=t.name.value),t.defaultValue&&(i+=" = "+e(t.defaultValue,n)),i})).join(", ")+": "+e(t.expression,n);case 11:if(31===t.constType)return"True";if(14===t.constType)return"False";if(8===t.constType)return"__debug__";if(24===t.constType)return"None";break;case 15:return`{ ${t.entries.map((t=>17===t.nodeType?`${e(t.keyExpression,n)}: ${e(t.valueExpression,n)}`:e(t,n)))} }`;case 16:return`**${e(t.expandExpression,n)}`;case 45:return t.entries.map((t=>e(t,n))).join(", ")}return"<Expression>"},t.printOperator=d,t.getEnclosingClass=u,t.getEnclosingModule=function(e){let t=e.parent;for(;t;){if(36===t.nodeType)return t;t=t.parent}i.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=h,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=m(e);for(;void 0!==t;){switch(t.nodeType){case 28:case 30:case 36:return t;case 10:return}t=t.parent}},t.getEvaluationScopeNode=m,t.getTypeVarScopeNode=function(e){let t,n=e;for(;n;){switch(n.nodeType){case 28:case 10:if(t===n.suite)return n}t=n,n=n.parent}},t.getExecutionScopeNode=function(e){let t=m(e);for(;10===t.nodeType||32===t.nodeType;)t=m(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(!u(e))return!1;const t=h(e);return!!t&&"__init__"===t.name.value}return!1},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=y,t.isPartialMatchingExpression=function e(t,n){return 35===t.nodeType&&(y(t.leftExpression,n)||e(t.leftExpression,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.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];return 0==(64&n.strings[0].token.flags)?l.decodeDocString(n.strings[0].value):void 0},t.isAssignmentToDefaultsFollowingNamedTuple=function(e){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 t=e.parent.leftExpression.value,n=e.parent.parent;if(n.statements[0]!==e.parent||!n.parent||36!==n.parent.nodeType&&50!==n.parent.nodeType)return!1;const i=n.parent;let s=i.statements.findIndex((e=>e===n));if(s<0)return!1;for(s++;s<i.statements.length;){const e=i.statements[s];if(47!==e.nodeType)break;if(48!==e.statements[0].nodeType){if(3===e.statements[0].nodeType){const n=e.statements[0];if(35===n.leftExpression.nodeType&&"__defaults__"===n.leftExpression.memberName.value){const e=n.leftExpression.leftExpression;if(35===e.nodeType&&"__new__"===e.memberName.value&&38===e.leftExpression.nodeType&&e.leftExpression.value===t)return!0}}break}s++}return!1};class g extends c.ParseTreeWalker{constructor(e){super(),this._callback=e}visitName(e){return this._callback(e),!0}}t.NameNodeWalker=g},427:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeWalker=void 0;const i=n(5839);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){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 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];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 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 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}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}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}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}}},8408: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},o=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Program=void 0;const a=n(4494),l=n(3213),c=n(2211),p=n(2489),d=n(5839),u=n(7345),h=n(6657),m=n(1464),y=n(7559),g=n(3550),f=n(8718),_=n(8566),T=n(7087),v=n(4952),b=r(n(563)),S=n(2835),C=n(8494),I=n(5083),D=n(4221),x=n(8816),F=n(1766),k=n(7887),P=n(2590);class A{constructor(e,t,n,i,s){this._extension=i,this._sourceFileList=[],this._sourceFileMap=new Map,this._parsedFileCount=0,this._lookUpImport=e=>{const t=this._getSourceFileInfoFromPath(e);if(!t)return;t.sourceFile.isBindingRequired()&&f.timingStats.typeCheckerTime.subtractFromTime((()=>{this._bindFile(t)}));const n=t.sourceFile.getModuleSymbolTable();if(!n)return;const i=t.sourceFile.getModuleDocString(),s=t.sourceFile.getParseResults();return{symbolTable:n,dunderAllNames:b.getDunderAllNames(s.parseTree),docString:i}},this._console=n||new c.StandardConsole,this._logTracker=null!=s?s:new u.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}setTrackedFiles(e){if(this._sourceFileList.length>0){const t=new Map;e.forEach((e=>{t.set(h.normalizePathCase(this._fs,e),e)})),this._sourceFileList.forEach((e=>{const n=h.normalizePathCase(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.isTracked=!1)}))}return this.addTrackedFiles(e),this._removeUnneededFiles()}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 D.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){let i=this._getSourceFileInfoFromPath(e);if(i)i.isOpenByClient=!0,i.diagnosticsVersion=void 0;else{const t=this._getImportNameForFile(e);i={sourceFile:new D.SourceFile(this._fs,e,t,!1,!1,this._console,this._logTracker),isTracked:!1,isOpenByClient:!0,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(i)}i.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}getFilesToAnalyzeCount(){let e=0;return 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 f.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,t){return this._configOptions.indexing?this._runEvaluatorWithCancellationToken(t,(()=>{let n=0;for(const i of this._sourceFileList){if(!this._isUserCode(i))continue;this._bindFile(i);const s=i.sourceFile.index({indexingForAutoImportMode:!1},t);if(s){if(++n>2e3)return this._console.warn("Workspace indexing has hit its upper limit: 2000 files"),n;e(i.sourceFile.getFilePath(),s)}this._handleMemoryHighUsage()}return n})):0}printDependencies(e,t){const n=this._sourceFileList.filter((e=>!e.isTypeshedFile)).sort(((e,t)=>e.sourceFile.getFilePath()<t.sourceFile.getFilePath()?1:-1)),i=[];n.forEach((n=>{this._console.info("");let s=n.sourceFile.getFilePath();const r=h.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){l.throwIfCancellationRequested(i);const r=s.sourceFile.getFilePath(),o=h.getRelativePath(r,e);if(void 0!==o){let e=h.normalizePath(h.combinePaths(n,o));e=t?h.combinePaths(h.getDirectoryPath(e),"__init__.pyi"):h.stripFileExtension(e)+".pyi";const r=h.getDirectoryPath(e);try{h.makeDirectories(this._fs,r,n)}catch(e){throw new Error(`Could not create directory for '${r}'`)}this._bindFile(s),this._runEvaluatorWithCancellationToken(i,(()=>{new P.TypeStubWriter(e,s.sourceFile,this._evaluator).write()})),this._handleMemoryHighUsage()}}}getTypeForSymbol(e){return this._handleMemoryHighUsage(),(this._evaluator||this._createNewEvaluator()).getEffectiveTypeOfSymbol(e)}printType(e,t){return this._handleMemoryHighUsage(),(this._evaluator||this._createNewEvaluator()).printType(e,t)}static _getPrintTypeFlags(e){let t=0;return e.diagnosticRuleSet.printUnknownAsAny&&(t|=1),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 D.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=k.createTypeEvaluator(this._lookUpImport,{disableInferenceForPyTypedSources:this._configOptions.disableInferenceForPyTypedSources,printTypeFlags:A._getPrintTypeFlags(this._configOptions)}),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){this._bindFile(e.builtinsImport);const t=e.builtinsImport.sourceFile.getParseResults();t&&(n=b.getScope(t.parseTree),d.assert(void 0!==n))}e.sourceFile.bind(this._configOptions,this._lookUpImport,n)}_buildModuleSymbolsMap(e,t,n){return _.buildModuleSymbolsMap(this._sourceFileList.filter((n=>n!==e&&(!t||this._isUserCode(n)))),n)}_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),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=>{f.timingStats.cycleDetectionTime.timeOperation((()=>{this._detectAndReportImportCycles(e)}))}))}return!0}))}_getImportsRecursive(e,t,n){const i=h.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=h.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 S.CircularDependency;e.forEach((e=>{t.appendPath(e.sourceFile.getFilePath())})),t.normalizeOrder();const n=t.getPaths()[0],i=this._getSourceFileInfoFromPath(n);d.assert(void 0!==i),i.sourceFile.addCircularDependency(t)}_markFileDirtyRecursive(e,t){const n=h.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=m.convertRangeToTextRange(t,e.tokenizerOutput.lines);if(n)return r.substr(n.start,n.length)})):void 0}getAutoImports(e,t,n,i,s,r){const o=this._getSourceFileInfoFromPath(e);if(!o)return[];const a=o.sourceFile,l=a.getFileContents();return void 0===l?[]:this._runEvaluatorWithCancellationToken(r,(()=>{this._bindFile(o);const c=a.getParseResults(),p=m.convertRangeToTextRange(t,c.tokenizerOutput.lines);if(!p)return[];const d=C.findNodeByOffset(c.parseTree,p.start);if(!d)return[];const u=l.substr(p.start,p.length),h=this._buildModuleSymbolsMap(o,!!s,r),g=new _.AutoImporter(this._configOptions.findExecEnvironment(e),this._importResolver,c,t.start,[],h,s,((e,t)=>y.computeCompletionSimilarity(e,t)>n)),f=[],T=I.getScopeForNode(d);if(T){const e=null==i?void 0:i.get(u);e&&f.push(..._.getAutoImportCandidatesForAbbr(g,u,e,r)),f.push(...g.getAutoImportCandidates(u,n,void 0,r).filter((e=>!T.lookUpSymbolRecursive(e.name))))}return f}))}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=>g.doRangesIntersect(e.range,t))):[]}getDefinitionsForPosition(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.getDefinitionsForPosition(this._createSourceMapper(s),t,this._evaluator,n)}))}reportReferencesForPosition(e,t,n,i,s){this._runEvaluatorWithCancellationToken(s,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;const o=this._isUserCode(r);this._bindFile(r);const a=this._configOptions.findExecEnvironment(e),c=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(a),t,this._evaluator,i,s);if(c)if(c.requiresGlobalSearch){for(const e of this._sourceFileList)l.throwIfCancellationRequested(s),(e.isOpenByClient||!o||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(l.throwIfCancellationRequested(s),c.locations.some((t=>t.path===e.path)))continue;const t=this._getSourceFileInfoFromPath(e.path);if(!t)continue;const i=new v.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&&g.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=h.stripFileExtension(h.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()&&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),s.sourceFile.getSignatureHelpForPosition(t,this._lookUpImport,this._evaluator,n,i)}))}getCompletionsForPosition(e,t,n,i,s,r,a){var l;return o(this,void 0,void 0,(function*(){const o=this._getSourceFileInfoFromPath(e);if(!o)return;const c=this._logTracker.log(`completion at ${e}:${t.line}:${t.character}`,(l=>{var c,p;const d=this._runEvaluatorWithCancellationToken(a,(()=>{this._bindFile(o);const l=this._configOptions.findExecEnvironment(e);return o.sourceFile.getCompletionsForPosition(t,n,this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,i,this._createSourceMapper(l,!0),s,r,(()=>this._buildModuleSymbolsMap(o,!!r,a)),a)}));return l.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===(l=this._extension)||void 0===l?void 0:l.completionListExtension))return c;const p=o.sourceFile.getParseResults(),d=o.sourceFile.getFileContents();if((null==p?void 0:p.parseTree)&&void 0!==d){const e=m.convertPositionToOffset(t,p.tokenizerOutput.lines);void 0!==e&&(c.completionList=yield this._extension.completionListExtension.updateCompletionList(c.completionList,p.parseTree,d,e,this._configOptions,a))}return c}))}resolveCompletionItem(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);s.sourceFile.resolveCompletionItem(this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,n,this._createSourceMapper(r,!0),t,i)}))}renameSymbolAtPosition(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),o=s.sourceFile.getDeclarationForPosition(this._createSourceMapper(r),t,this._evaluator,void 0,i);if(!o)return;if(o.declarations.some((e=>!this._isUserCode(this._getSourceFileInfoFromPath(e.path)))))return;if(0===o.declarations.length)return;if(o.requiresGlobalSearch)for(const e of this._sourceFileList)this._isUserCode(e)&&(this._bindFile(e),e.sourceFile.addReferences(o,!0,this._evaluator,i)),this._handleMemoryHighUsage();else this._isUserCode(s)&&s.sourceFile.addReferences(o,!0,this._evaluator,i);const a=[];return o.locations.forEach((e=>{a.push({filePath:e.path,range:e.range,replacementText:n})})),a}))}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 o=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getCallForDeclaration(r.symbolName,o,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 o=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);let a=[];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,o,e.sourceFile.getParseResults(),this._evaluator,n);t&&(a=a.concat(...t)),this._handleMemoryHighUsage()}return a}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 o=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getOutgoingCallsForDeclaration(o,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&&!p.isDebugMode()?this._evaluator.runWithCancellationToken(e,t):t()}catch(e){throw e instanceof l.OperationCanceledException||this._createNewEvaluator(),e}}_removeUnneededFiles(){const e=[];for(let t=0;t<this._sourceFileList.length;){const n=this._sourceFileList[t];this._isFileNeeded(n)?(this._shouldCheckFile(n)||void 0===n.diagnosticsVersion||(e.push({filePath:n.sourceFile.getFilePath(),diagnostics:[]}),n.diagnosticsVersion=void 0),t++):(e.push({filePath:n.sourceFile.getFilePath(),diagnostics:[]}),n.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(n.sourceFile.getFilePath(),t),n.imports.forEach((i=>{const s=i.importedBy.findIndex((e=>e===n));if(d.assert(s>=0),i.importedBy.splice(s,1),!this._isFileNeeded(i)){const n=this._sourceFileList.findIndex((e=>e===i));n>=0&&n<t&&(e.push({filePath:i.sourceFile.getFilePath(),diagnostics:[]}),i.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(i.sourceFile.getFilePath(),n),t--)}})),n.shadowedBy.forEach((e=>{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=h.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 x.SourceMapper(this._importResolver,e,this._evaluator,((e,t)=>{const n=this._getSourceFileInfoFromPath(e);if(n)return this._addShadowedFile(n,t),this.getBoundSourceFile(t)}),null!=t&&t)}_isImportAllowed(e,t,n){if(t.isNativeLib)return!1;let i=this._configOptions.useLibraryCodeForTypes||1===t.importType&&!!t.isPyTypedPresent||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.isPyTypedPresent&&(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(h.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(h.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 o=new Map;e.imports.forEach((t=>{const n=h.normalizePathCase(this._fs,t.sourceFile.getFilePath());r.has(n)?o.set(n,t):t.importedBy=t.importedBy.filter((t=>h.normalizePathCase(this._fs,t.sourceFile.getFilePath())!==h.normalizePathCase(this._fs,e.sourceFile.getFilePath())))})),r.forEach(((t,i)=>{if(!o.has(i)){let s;if(this._getSourceFileInfoFromPath(t.path))s=this._getSourceFileInfoFromPath(t.path);else{const e=this._getImportNameForFile(t.path);s={sourceFile:new D.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),o.set(i,s)}})),e.imports=[],r.forEach(((t,n)=>{this._getSourceFileInfoFromPath(n)&&e.imports.push(this._getSourceFileInfoFromPath(n))})),e.builtinsImport=void 0;const a=e.sourceFile.getBuiltinsImport();if(a&&a.isImportFound){const t=a.resolvedPaths[a.resolvedPaths.length-1];e.builtinsImport=this._getSourceFileInfoFromPath(t)}return n}_getSourceFileInfoFromPath(e){return this._sourceFileMap.get(h.normalizePathCase(this._fs,e))}_removeSourceFileFromListAndMap(e,t){this._sourceFileMap.delete(h.normalizePathCase(this._fs,e)),this._sourceFileList.splice(t,1)}_addToSourceFileListAndMap(e){const t=h.normalizePathCase(this._fs,e.sourceFile.getFilePath()),n=h.getFileExtension(t).toLowerCase();".py"!==n&&".pyi"!==n&&d.fail(`${t} is not a source file`),d.assert(!this._sourceFileMap.has(t)),this._sourceFileList.push(e),this._sourceFileMap.set(t,e)}}t.Program=A},1277:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPyTypedInfo=void 0;const i=n(6657);t.getPyTypedInfo=function(e,t){let n,s=!1,r=!1;if(e.existsSync(t)&&i.isDirectory(e,t)&&(n=i.combinePaths(t,"py.typed"),e.existsSync(t)&&i.isFile(e,n))){s=!0;const t=e.statSync(n);if(t.size>0&&t.size<65536){const t=e.readFileSync(n,"utf8");(t.match(/partial\n/)||t.match(/partial\r\n/))&&(r=!0)}}return{isPyTypedPresent:s,pyTypedPath:s?n:void 0,isPartiallyTyped:r}}},1887: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 o=r(n(3129)),a=r(n(3188)),l=n(6657),c=new Map;function p(e,t,n){const i={paths:[],prefix:""};try{const s=["-c","import sys, json; json.dump(dict(path=sys.path, prefix=sys.prefix), sys.stdout)"];n.push(`Executing interpreter: '${t}'`);const r=o.execFileSync(t,s,{encoding:"utf8"});try{const t=JSON.parse(r);for(let s of t.path)if(s=s.trim(),s){const t=l.normalizePath(s);e.existsSync(t)&&l.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(e){return}return i}function d(e,t,n){const i=t||"",s=c.get(i);if(s)return s;let r;return t?r=p(e,t,n):("win32"!==process.platform&&(r=p(e,"python3",n)),r||(r=p(e,"python",n))),r||(r={paths:[],prefix:""}),c.set(i,r),n.push(`Received ${r.paths.length} paths from interpreter`),r.paths.forEach((e=>{n.push(`  ${e}`)})),r}t.stdLibFolderName="stdlib",t.thirdPartyFolderName="third_party",t.getTypeShedFallbackPath=function(e){let t=e.getModulePath();if(!t)return;t=l.getDirectoryPath(l.ensureTrailingDirectorySeparator(l.normalizePath(t)));const n=l.combinePaths(t,a.typeshedFallback);if(e.existsSync(n))return n;const i=l.combinePaths(l.getDirectoryPath(t),a.typeshedFallback);return e.existsSync(i)?i:void 0},t.getTypeshedSubdirectory=function(e,n){return l.combinePaths(e,n?t.stdLibFolderName:t.thirdPartyFolderName)},t.findPythonSearchPaths=function(e,t,n,i,s,r){if(i.push("Finding python search paths"),void 0!==t.venvPath&&(void 0!==n||t.defaultVenv)){const s=void 0!==n?n:t.defaultVenv,r=l.combinePaths(t.venvPath,s),o=[];if([a.lib,a.lib64,a.libAlternate].forEach((t=>{const n=function(e,t,n){if(!e.existsSync(t))return void n.push(`Did not find '${t}'`);n.push(`Found path '${t}'; looking for ${a.sitePackages}`);const i=l.combinePaths(t,a.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=l.getFileSystemEntries(e,t);for(let i=0;i<s.directories.length;i++){const r=s.directories[i];if(r.startsWith("python")){const i=l.combinePaths(t,r,a.sitePackages);if(e.existsSync(i))return n.push(`Found path '${i}'`),i;n.push(`Path '${i}' is not a valid directory`)}}}(e,l.combinePaths(r,t),i);n&&o.push(n)})),o.length>0)return i.push(`Found the following '${a.sitePackages}' dirs`),o.forEach((e=>{i.push(`  ${e}`)})),o;i.push(`Did not find any '${a.sitePackages}' dirs. Falling back on python interpreter.`)}const o=d(e,t.pythonPath,i);return s&&r?o.paths.filter((e=>!l.containsPath(r,e,!0)||l.containsPath(o.prefix,e,!0))):o.paths},t.getPythonPathFromPythonInterpreter=d,t.isPythonBinary=function(e){return"python"===(e=e.trim())||"python3"===e}},1561:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scope=void 0;const i=n(5839),s=n(817);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){return this._lookUpSymbolRecursiveInternal(e,!1,!1)}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)}_lookUpSymbolRecursiveInternal(e,t,n){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._lookUpSymbolRecursiveInternal(e,t||3===this.type,n||this.isIndependentlyExecutable())}}},5083:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getScopeForNode=t.getBuiltInScope=void 0;const i=n(563),s=n(8494);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)}},6708:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerService=t.configFileNames=void 0;const i=n(3213),s=n(2930),r=n(2211),o=n(7830),a=n(6657),l=n(8718),c=n(5674),p=n(2374),d=n(1887);t.configFileNames=["pyrightconfig.json","mspythonconfig.json"];class u{constructor(e,t,n,i,o,a,l,p,d){this._typeStubTargetIsSingleFile=!1,this._requireTrackedFileUpdate=!0,this._lastUserInteractionTime=Date.now(),this._disposed=!1,this._instanceName=e,this._console=n||new r.StandardConsole,this._executionRootPath="",this._extension=a,this._importResolverFactory=i||u.createImportResolver,this._maxAnalysisTimeInForeground=p,this._backgroundAnalysisProgramFactory=d,o=null!=o?o:new s.ConfigOptions(process.cwd());const h=this._importResolverFactory(t,o);this._backgroundAnalysisProgram=void 0!==d?d(this._console,o,h,this._extension,l,this._maxAnalysisTimeInForeground):new c.BackgroundAnalysisProgram(this._console,o,h,this._extension,l,this._maxAnalysisTimeInForeground)}clone(e,t){return new u(e,this._fs,this._console,this._importResolverFactory,this._backgroundAnalysisProgram.configOptions,this._extension,t,this._maxAnalysisTimeInForeground,this._backgroundAnalysisProgramFactory)}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 p.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=a.normalizePath(a.combinePaths(e.executionRoot,n.projectRoot)),this._applyConfigOptions(t)}setFileOpened(e,t,n){this._backgroundAnalysisProgram.setFileOpened(e,t,n),this._scheduleReanalysis(!1)}updateOpenFileContents(e,t,n){this._backgroundAnalysisProgram.updateOpenFileContents(e,t,n),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){return this._program.getAutoImports(e,t,n,i,this._backgroundAnalysisProgram.getIndexing(e),s)}getDefinitionForPosition(e,t,n){return this._program.getDefinitionsForPosition(e,t,n)}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){this._program.resolveCompletionItem(e,t,n,i)}performQuickAction(e,t,n,i){return this._program.performQuickAction(e,t,n,i)}renameSymbolAtPosition(e,t,n,i){return this._program.renameSymbolAtPosition(e,t,n,i)}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,o=e.executionRoot;e.configFilePath?(i=a.combinePaths(e.executionRoot,a.normalizePath(e.configFilePath)),this._fs.existsSync(i)?i.toLowerCase().endsWith(".json")?o=a.getDirectoryPath(i):(o=i,i=this._findConfigFile(i),i||this._console.info(`Configuration file not found at ${o}.`)):(this._console.info(`Configuration file not found at ${i}.`),i=e.executionRoot)):o&&(i=this._findConfigFileHereOrUp(o),i?o=a.getDirectoryPath(i):(this._console.info("No configuration file found."),i=void 0));const l=new s.ConfigOptions(o,this._typeCheckingMode),c=["**/node_modules","**/__pycache__",".git"];if(e.fileSpecs.length>0?e.fileSpecs.forEach((e=>{l.include.push(a.getFileSpec(o,e))})):i||e.executionRoot&&(l.include.push(a.getFileSpec(e.executionRoot,".")),c.forEach((t=>{l.exclude.push(a.getFileSpec(e.executionRoot,t))}))),this._configFilePath=i,i){this._console.info(`Loading configuration file at ${i}`);const t=this._parseConfigFile(i);if(t){l.initializeFromJson(t,this._typeCheckingMode,this._console,e.diagnosticSeverityOverrides,e.pythonPath,e.fileSpecs.length>0);const n=a.getDirectoryPath(i);0===l.include.length&&(this._console.info(`No include entries specified; assuming ${n}`),l.include.push(a.getFileSpec(n,"."))),0===l.exclude.length&&(c.forEach((e=>{this._console.info(`Auto-excluding ${e}`),l.exclude.push(a.getFileSpec(n,e))})),void 0===l.autoExcludeVenv&&(l.autoExcludeVenv=!0)),0===l.executionEnvironments.length&&l.addExecEnvironmentForExtraPaths(this._fs,e.autoSearchPaths||!1,e.extraPaths||[])}}else l.addExecEnvironmentForExtraPaths(this._fs,e.autoSearchPaths||!1,e.extraPaths||[]),l.autoExcludeVenv=!0,l.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&&(l.venvPath?p("venvPath",l.venvPath):l.venvPath=e.venvPath),e.pythonPath&&(this._console.info(`Setting pythonPath for service "${this._instanceName}": "${e.pythonPath}"`),l.pythonPath=e.pythonPath),e.typeshedPath&&(l.typeshedPath?p("typeshedPath",l.typeshedPath):l.typeshedPath=e.typeshedPath),l.verboseOutput=null!==(t=e.verboseOutput)&&void 0!==t?t:l.verboseOutput,l.checkOnlyOpenFiles=!!e.checkOnlyOpenFiles,l.autoImportCompletions=!!e.autoImportCompletions,l.indexing=!!e.indexing,void 0===l.useLibraryCodeForTypes?l.useLibraryCodeForTypes=!!e.useLibraryCodeForTypes:void 0!==e.useLibraryCodeForTypes&&p("useLibraryCodeForTypes",l.useLibraryCodeForTypes),e.stubPath?l.stubPath?p("stubPath",l.stubPath):l.stubPath=e.stubPath:l.stubPath||(l.stubPath=a.normalizePath(a.combinePaths(l.projectRoot,"typings"))),l.venvPath){if(this._fs.existsSync(l.venvPath)&&a.isDirectory(this._fs,l.venvPath)||this._console.error(`venvPath ${l.venvPath} is not a valid directory.`),l.defaultVenv=null!==(n=l.defaultVenv)&&void 0!==n?n:this._configOptions.defaultVenv,l.defaultVenv){const e=a.combinePaths(l.venvPath,l.defaultVenv);if(this._fs.existsSync(e)&&a.isDirectory(this._fs,e)){const e=[];void 0===d.findPythonSearchPaths(this._fs,l,void 0,e)&&(this._console.error(`site-packages directory cannot be located for venvPath ${l.venvPath} and venv ${l.defaultVenv}.`),l.verboseOutput&&e.forEach((e=>{this._console.error(`  ${e}`)})))}else this._console.error(`venv ${l.defaultVenv} subdirectory not found in venv path ${l.venvPath}.`)}}else{const t=[],n=d.getPythonPathFromPythonInterpreter(this._fs,l.pythonPath,t).paths;if(0===n.length){const t=l.verboseOutput?r.LogLevel.Error:r.LogLevel.Log;(e.fromVsCodeExtension||l.verboseOutput)&&r.log(this._console,t,"No search paths found for configured python interpreter.")}else if(e.fromVsCodeExtension||l.verboseOutput){const e=l.verboseOutput?r.LogLevel.Info:r.LogLevel.Log;r.log(this._console,e,"Search paths found for configured python interpreter:"),n.forEach((t=>{r.log(this._console,e,`  ${t}`)}))}l.verboseOutput&&t.length>0&&(this._console.info("When attempting to get search paths from python interpreter:"),t.forEach((e=>{this._console.info(`  ${e}`)})))}return(l.defaultVenv||l.executionEnvironments.find((e=>!!e.venv)))&&(l.venvPath||this._console.warn("venvPath not specified, so venv settings will be ignored.")),l.typeshedPath&&(this._fs.existsSync(l.typeshedPath)&&a.isDirectory(this._fs,l.typeshedPath)||this._console.error(`typeshedPath ${l.typeshedPath} is not a valid directory.`)),l.stubPath&&(this._fs.existsSync(l.stubPath)&&a.isDirectory(this._fs,l.stubPath)||this._console.error(`stubPath ${l.stubPath} is not a valid directory.`)),l}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(){this._backgroundAnalysisProgram.invalidateAndForceReanalysis()}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 _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=a.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 a.forEachAncestorDirectory(e,(e=>this._findConfigFile(e)))}_findConfigFile(e){for(const n of t.configFileNames){const t=a.combinePaths(e,n);if(this._fs.existsSync(t))return t}}_parseConfigFile(e){let t="",n=0;for(;;){try{t=this._fs.readFileSync(e,"utf8")}catch(t){return this._console.error(`Config file "${e}" could not be read.`),void this._reportConfigParseError()}let i,s=!1;try{return i=JSON.parse(t),i}catch(e){s=!0}if(!s)break;if(n++>=5)return this._console.error(`Config file "${e}" could not be parsed. Verify that JSON is correct.`),void this._reportConfigParseError()}}_getFileNamesFromFileSpecs(){const e=new Map;return l.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=a.getDirectoryPath(t),s=t;for(let e=n.resolvedPaths.length-2;e>=0;e--){const t=n.resolvedPaths[e];t?(i=a.getDirectoryPath(t),s=t):(i=a.getDirectoryPath(s),s=i)}a.isDirectory(this._fs,i)&&(this._typeStubTargetPath=i),t?(e.push(t),this._typeStubTargetIsSingleFile=1===n.resolvedPaths.length&&"__init__"!==a.stripFileExtension(a.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}_isInExcludePath(e,t){return!!t.find((t=>t.regExp.test(e)))}_matchFiles(e,t){const n=/\.pyi?$/,i=[["bin","activate"],["Scripts","activate"],["pyvenv.cfg"]],s=[],r=(e,o)=>{if(this._configOptions.autoExcludeVenv&&i.some((t=>this._fs.existsSync(a.combinePaths(e,...t)))))return void this._console.info(`Auto-excluding ${e}`);const{files:l,directories:c}=a.getFileSystemEntries(this._fs,e);for(const i of l){const r=a.combinePaths(e,i);o.test(r)&&!this._isInExcludePath(r,t)&&n.test(r)&&s.push(r)}for(const n of c){const i=a.combinePaths(e,n);o.test(i)&&(this._isInExcludePath(i,t)||r(i,o))}};return e.forEach((e=>{let i=!1;if(!this._isInExcludePath(e.wildcardRoot,t))try{const t=this._fs.statSync(e.wildcardRoot);t.isFile()?n.test(e.wildcardRoot)&&(s.push(e.wildcardRoot),i=!0):t.isDirectory()&&(r(e.wildcardRoot,e.regExp),i=!0)}catch(e){}i||this._console.error(`File or directory "${e.wildcardRoot}" does not exist.`)})),s}_removeSourceFileWatchers(){this._sourceFileWatcher&&(this._sourceFileWatcher.close(),this._sourceFileWatcher=void 0)}_updateSourceFileWatchers(){if(this._removeSourceFileWatchers(),this._backgroundAnalysisProgram.invalidateCache(),this._watchForSourceChanges&&this._configOptions.include.length>0){const e=this._configOptions.include.map((e=>a.combinePaths(this._executionRootPath,e.wildcardRoot)));try{this._verboseOutput&&this._console.info(`Adding fs watcher for directories:\n ${e.join("\n")}`);const t=o.ignoredWatchEventFunction(e);this._sourceFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{if(!t(n))if(this._verboseOutput&&this._console.info(`SourceFile: Received fs event '${e}' for path '${n}'`),"change"===e&&this._fs.existsSync(n))this._backgroundAnalysisProgram.markFilesDirty([n],!1),this._scheduleReanalysis(!1);else{const e=a.getFileName(n).split(".");let t=!1;4===e.length&&e[3]===e[1]&&32===e[2].length&&(t=!0),t||(this.invalidateAndForceReanalysis(),this._scheduleReanalysis(!0))}}))}catch(t){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._backgroundAnalysisProgram.invalidateCache(),!this._watchForLibraryChanges)return;const e=d.findPythonSearchPaths(this._fs,this._backgroundAnalysisProgram.configOptions,void 0,[],!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=o.ignoredWatchEventFunction(e);this._libraryFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{t(n)||(this._verboseOutput&&this._console.info(`LibraryFile: Received fs event '${e}' for path '${n}'}'`),this._scheduleLibraryAnalysis())}))}catch(t){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._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=a.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){const t=this._importResolverFactory(this._fs,this._backgroundAnalysisProgram.configOptions);this._backgroundAnalysisProgram.setImportResolver(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,s=Math.max(250-n,20);this._analyzeTimer=setTimeout((()=>{this._analyzeTimer=void 0,this._requireTrackedFileUpdate&&this._updateTrackedFileList(!1),this._backgroundAnalysisCancellationSource=i.createBackgroundThreadCancellationTokenSource(),this._backgroundAnalysisProgram.startAnalysis(this._backgroundAnalysisCancellationSource.token)&&this._scheduleReanalysis(!1)}),s)}_reportConfigParseError(){this._onCompletionCallback&&this._onCompletionCallback({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!1,configParseErrorOccurred:!0,elapsedTime:0})}}t.AnalyzerService=u},4221: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 o=n(2714),a=n(5013),l=r(n(1766)),c=n(3213),p=n(2930),d=n(2211),u=n(5839),h=n(1290),m=n(3980),y=n(7345),g=n(6657),f=r(n(7559)),_=n(3550),T=n(3420),v=n(8718),b=n(9209),S=n(3778),C=n(8221),I=n(2816),D=n(3334),x=n(2858),F=n(4952),k=n(9437),P=n(2122),A=n(5275),E=n(5303),w=r(n(563)),N=n(6052),O=n(6329),R=r(n(2272)),M=n(4482),L=n(2041);t.SourceFile=class{constructor(e,t,n,i,s,r,o){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&&("typing.pyi"===l||"typing_extensions.pyi"===l),this._isTypingExtensionsStubFile=this._isStubFile&&"typing_extensions.pyi"===l,this._isBuiltInStubFile=!1,this._isStubFile&&(this._filePath.endsWith(g.normalizeSlashes("/collections/__init__.pyi"))||this._filePath.endsWith(g.normalizeSlashes("/asyncio/futures.pyi"))||"builtins.pyi"===l||"_importlib_modulespec.pyi"===l||"dataclasses.pyi"===l||"abc.pyi"===l||"enum.pyi"===l||"queue.pyi"===l||"types.pyi"===l)&&(this._isBuiltInStubFile=!0),this._logTracker=null!=o?o:new y.LogTracker(r,a.isMainThread?"FG":"BG")}getFilePath(){return this._filePath}getDiagnosticVersion(){return this._diagnosticVersion}isStubFile(){return this._isStubFile}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,P.Localizer.Diagnostic.importCycleDetected()+"\n"+e.getPaths().map((e=>"  "+e)).join("\n"),_.getEmptyRange()))}))}return void 0!==this._hitMaxImportDepth&&i.push(new h.Diagnostic(0,P.Localizer.Diagnostic.importDepthExceeded().format({depth:this._hitMaxImportDepth}),_.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}getModuleDocString(){return this._binderResults?this._binderResults.moduleDocString:void 0}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,this._binderResults=void 0}markDirty(){this._fileContentsVersion++,this._isCheckingNeeded=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._binderResults=void 0,this._cachedIndexResults=void 0}markReanalysisRequired(){this._isCheckingNeeded=!0,this._parseResults&&(this._parseResults.containsWildcardImport||w.getDunderAllNames(this._parseResults.parseTree))&&(this._parseTreeNeedsCleaning=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._binderResults=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){null===e?this._clientDocument=void 0:(this._clientDocument||(this._clientDocument=o.TextDocument.create(this._filePath,"python",e,"")),this._clientDocument=o.TextDocument.update(this._clientDocument,t,e),this.markDirty())}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._filePath}`,(i=>{if(!this.isParseRequired())return i.suppress(),!1;const s=new m.DiagnosticSink;let r=this.getFileContents();if(void 0===r)try{const e=v.timingStats.readFileTime.timeOperation((()=>{r=null!=n?n:this.fileSystem.readFileSync(this._filePath,"utf8"),this._lastFileContentLength=r.length,this._lastFileContentHash=f.hashString(r)}));i.add(`fs read ${e}ms`)}catch(e){s.addError("Source file could not be read",_.getEmptyRange()),r="",this.fileSystem.existsSync(this._filePath)||(this._isFileDeleted=!0)}const o=e.findExecEnvironment(this._filePath),a=new E.ParseOptions;this._filePath.endsWith("pyi")&&(a.isStubFile=!0),a.pythonVersion=o.pythonVersion;try{const n=(new E.Parser).parseSourceFile(r,a,s);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=s.fetchAndClear()}));const i=void 0!==e.strict.find((e=>e.regExp.test(this._filePath)));this._diagnosticRuleSet=R.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(P.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t})),this._parseResults={text:"",parseTree:A.ModuleNode.create({start:0,length:0}),importedModules:[],futureImports:new Map,tokenizerOutput:{tokens:new T.TextRangeCollection([]),lines:new T.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(P.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message: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._filePath}`,(n=>{if(!this._parseResults||!this.isIndexingRequired())return void n.suppress();this._indexingNeeded=!1;const i=I.DocumentSymbolProvider.indexSymbols(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){if(this._parseResults)return S.DefinitionProvider.getDefinitionsForPosition(e,this._parseResults,t,n,i)}getDeclarationForPosition(e,t,n,i,s){if(this._parseResults)return F.ReferencesProvider.getDeclarationForPosition(e,this._parseResults,this._filePath,t,n,i,s)}addReferences(e,t,n,i){this._parseResults&&F.ReferencesProvider.addReferences(this._parseResults,this._filePath,e,t,n,i)}addHierarchicalSymbolsForDocument(e,t){(this._parseResults||this._cachedIndexResults)&&I.DocumentSymbolProvider.addHierarchicalSymbolsForDocument(this.getCachedIndexResults(),this._parseResults,e,t)}getSymbolsForDocument(e,t){return this._parseResults||this._cachedIndexResults?I.DocumentSymbolProvider.getSymbolsForDocument(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 k.SignatureHelpProvider.getSignatureHelpForPosition(this._parseResults,e,n,i,s)}getCompletionsForPosition(e,t,n,i,s,r,o,a,l,c,p,d){if(!this._parseResults)return;const u=this.getFileContents();return void 0!==u?new b.CompletionProvider(t,this._parseResults,u,i,e,this._filePath,n,s,r,o,a,{nameMap:l,libraryMap:c,getModuleSymbolsMap:p},d).getCompletionsForPosition():void 0}resolveCompletionItem(e,t,n,i,s,r,o,a){const l=this.getFileContents();if(!this._parseResults||void 0===l)return;const c=o.data;new b.CompletionProvider(c.workspacePath,this._parseResults,l,t,c.position,this._filePath,e,n,i,s,r,void 0,a).resolveCompletionItem(o)}performQuickAction(e,t,n){if(this._parseResults&&void 0!==this.getClientVersion())return x.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._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);this._isBindingInProgress=!0,this._binderResults=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(P.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}));const n=new m.DiagnosticSink;n.addError(P.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message: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._filePath}`,(()=>{try{v.timingStats.typeCheckerTime.timeOperation((()=>{new O.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(P.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}));const n=new m.DiagnosticSink;n.addError(P.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message: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(){this._parseResults&&this._parseTreeNeedsCleaning&&(new M.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 o;0!==r.resolvedPaths.length&&r.resolvedPaths[0]===this.getFilePath()||(i.push(r),o=r.resolvedPaths[0]);const a=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["_typeshed"],importedSymbols:void 0});let l,c;0!==a.resolvedPaths.length&&a.resolvedPaths[0]===this.getFilePath()||(i.push(a),l=a.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:o,typeshedModulePath:l,collectionsModulePath:c}}}},8816: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 o=r(n(563)),a=r(n(8494)),l=n(6657);function c(e){return".pyi"===l.getAnyExtensionFromPath(e,[".pyi"],!1)}function p(e){return void 0!==e}t.SourceMapper=class{constructor(e,t,n,i,s){this._importResolver=e,this._execEnv=t,this._evaluator=n,this._fileBinder=i,this._mapCompiled=s}findModules(e){return this._getBoundSourceFiles(e).map((e=>{var t;return null===(t=e.getParseResults())||void 0===t?void 0:t.parseTree})).filter(p)}findDeclarations(e){return 4===e.type?this.findClassDeclarations(e):3===e.type?this.findFunctionDeclarations(e):[]}findClassDeclarations(e){const t=this._getFullClassName(e.node);return this._getBoundSourceFiles(e.path).flatMap((e=>this._findClassDeclarations(e,t)))}findFunctionDeclarations(e,t=new Set){const n=e.node.name.value,i=this._getBoundSourceFiles(e.path);if(e.isMethod){const t=a.getEnclosingClass(e.node);if(void 0===t)return[];const s=this._getFullClassName(t);return i.flatMap((e=>this._findMethodDeclarations(e,s,n)))}return i.flatMap((e=>this._findFunctionDeclarations(e,n,t)))}_findMethodDeclarations(e,t,n){const i=[],s=this._findClassDeclarations(e,t);for(const e of s){const t=this._lookUpSymbolDeclarations(e.node,n);for(const e of t)3===e.type&&e.isMethod&&i.push(e)}return i}_findFunctionDeclarations(e,t,n){var i;const s=[],r=e.getFilePath()+t;if(n.has(r))return s;n.add(r);const o=this._lookUpSymbolDeclarations(null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree,t);for(const e of o)if(3===e.type)s.push(e);else if(6===e.type){const t=this._evaluator.resolveAliasDeclaration(e,!0);t&&3===t.type&&(c(t.path)?s.push(...this.findFunctionDeclarations(t,n)):s.push(t))}return n.delete(r),s}_findClassDeclarations(e,t){var n;let i=[];const s=null===(n=e.getParseResults())||void 0===n?void 0:n.parseTree;if(s){let n=t.split(".");n.length>0&&(i=this._findClassDeclarationsUnderNode(e,n[0],s),n=n.slice(1));for(const t of n)i=this._findClassDeclarationsUnderClass(e,t,i)}return i}_findClassDeclarationsUnderClass(e,t,n){return n.flatMap((n=>this._findClassDeclarationsUnderNode(e,t,n.node)))}_findClassDeclarationsUnderNode(e,t,n){const i=[];for(const e of this._lookUpSymbolDeclarations(n,t))4===e.type&&i.push(e);return i}_lookUpSymbolDeclarations(e,t){if(void 0===e)return[];const n=o.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=a.getEnclosingClass(n);return t.reverse().join(".")}_getBoundSourceFiles(e){return this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).map((t=>this._fileBinder(e,t))).filter(p)}},t.isStubFile=c},8235:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateStaticBoolLikeExpression=t.evaluateStaticBoolExpression=void 0;const i=n(2930);function s(e,t,n){if(55===e.nodeType){if(37===e.operator||36===e.operator){const n=r(e.expression,t);if(void 0!==n)return!n}}else if(7===e.nodeType){if(37===e.operator||36===e.operator){const n=s(e.leftExpression,t),i=s(e.rightExpression,t);if(void 0===n||void 0===i)return;return 37===e.operator?n||i:n&&i}if(l(e.leftExpression)&&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 1===e.expressions.length&&(t=256*e.expressions[0].value);return t}(e.rightExpression);return o(e.operator,t.pythonVersion,n)}if(24===e.leftExpression.nodeType&&l(e.leftExpression.baseExpression)&&1===e.leftExpression.items.length&&40===e.leftExpression.items[0].nodeType&&!e.leftExpression.items[0].isImaginary&&0===e.leftExpression.items[0].value&&40===e.rightExpression.nodeType)return o(e.operator,Math.floor(t.pythonVersion/256),e.rightExpression.value);if(function(e){return 35===e.nodeType&&38===e.leftExpression.nodeType&&"sys"===e.leftExpression.value&&"platform"===e.memberName.value}(e.leftExpression)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){return e.pythonPlatform===i.PythonPlatform.Darwin?"darwin":e.pythonPlatform===i.PythonPlatform.Windows?"win32":e.pythonPlatform===i.PythonPlatform.Linux?"linux":void 0}(t);return a(e.operator,s||"",n)}if(function(e){return 35===e.nodeType&&38===e.leftExpression.nodeType&&"os"===e.leftExpression.value&&"name"===e.memberName.value}(e.leftExpression)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){return e.pythonPlatform===i.PythonPlatform.Darwin?"posix":e.pythonPlatform===i.PythonPlatform.Windows?"nt":e.pythonPlatform===i.PythonPlatform.Linux?"posix":void 0}(t);if(void 0!==s)return a(e.operator,s,n)}}else if(11===e.nodeType){if(31===e.constType)return!0;if(14===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){return(11!==e.nodeType||24!==e.constType)&&s(e,t,n)}function o(e,t,n){if(void 0!==t&&void 0!==n){if(20===e)return t<n;if(21===e)return t<=n;if(15===e)return t>n;if(16===e)return t>=n;if(12===e)return t===n;if(28===e)return t!==n}}function a(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){return 35===e.nodeType&&38===e.leftExpression.nodeType&&"sys"===e.leftExpression.value&&"version_info"===e.memberName.value}t.evaluateStaticBoolExpression=s,t.evaluateStaticBoolLikeExpression=r},817:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=t.indeterminateSymbolId=void 0;const i=n(5523);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)}setIsClassVar(){this._flags|=128}isClassVar(){return!!(128&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},1766:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicConstantOrTypeAlias=t.isTypeAliasName=t.isConstantName=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 o(e){return e.length>1&&e.startsWith("_")&&!e.startsWith("__")}function a(e){return r(e)||o(e)}function l(e){return!!e.match(n)&&!e.match(i)}function c(e){return!!e.match(s)}t.isPrivateName=r,t.isProtectedName=o,t.isPrivateOrProtectedName=a,t.isDunderName=function(e){return e.length>4&&e.startsWith("__")&&e.endsWith("__")},t.isConstantName=l,t.isTypeAliasName=c,t.isPublicConstantOrTypeAlias=function(e){return!a(e)&&(l(e)||c(e))}},2917:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFinalVariable=t.isTypedDictMemberAccessedThroughIndex=t.getLastTypedDeclaredForSymbol=void 0;const i=n(5523);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();return t.length>0&&1===t[t.length-1].type},t.isFinalVariable=function(e){return e.getDeclarations().some((e=>i.isFinalVariableDeclaration(e)))}},2041:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestWalker=void 0;const i=n(427),s=n(5839),r=n(3550);class o 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.start<e.start||r.TextRange.getEnd(t)>r.TextRange.getEnd(e))&&s.fail(`Child node ${t.nodeType} is not contained within its parent ${e.nodeType}`),n&&t.start<r.TextRange.getEnd(n)&&62!==n.nodeType&&s.fail("Child node is not after previous child node"),n=t)}}))}}t.TestWalker=o},3090: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 o=n(5839),a=r(n(8494)),l=n(1133);t.isIncompleteType=function(e){return!!e.isIncompleteType},t.SpeculativeTypeTracker=class{constructor(){this._speculativeContextStack=[]}enterSpeculativeContext(e){this._speculativeContextStack.push({speculativeRootNode:e,entriesToUndo:[],speculativeTypeCache:new Map})}leaveSpeculativeContext(){o.assert(this._speculativeContextStack.length>0);const e=this._speculativeContextStack.pop();let t;e.entriesToUndo.forEach((e=>{e.cache.delete(e.id)}));for(let n=this._speculativeContextStack.length-1;n>=0;n--){const i=this._speculativeContextStack[n];if(a.isNodeContainedWithin(e.speculativeRootNode,i.speculativeRootNode)){t=i;break}}t&&e.speculativeTypeCache.forEach(((e,n)=>{t.speculativeTypeCache.set(n,e)}))}isSpeculative(){return this._speculativeContextStack.length>0}getSpeculativeRootNode(){const e=this._speculativeContextStack.length;if(e>0)return this._speculativeContextStack[e-1].speculativeRootNode}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){o.assert(0===this._speculativeContextStack.length),this._speculativeContextStack=e}addSpeculativeType(e,t,n){o.assert(this._speculativeContextStack.length>0),this._speculativeContextStack[this._speculativeContextStack.length-1].speculativeTypeCache.set(e.id,{type:t,expectedType:n})}getSpeculativeType(e,t){let n;for(let t=this._speculativeContextStack.length-1;t>=0&&(n=this._speculativeContextStack[t].speculativeTypeCache.get(e.id),!n);t--);if(n&&l.isTypeSame(t,n.expectedType))return n.type}},t.IncompleteTypeTracker=class{constructor(){this._trackerStack=[],this._isUndoTrackingEnabled=!1}trackEntry(e,t){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}}},3371: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.getFunctionDocStringFromDeclaration=t.getFunctionDocStringFromType=t.getClassDocString=t.getModuleDocString=t.getOverloadedFunctionDocStrings=void 0;const o=r(n(8494)),a=n(8816);function l(e,t){let n=c([e]);return!n&&a.isStubFile(e.path)&&(n=c(t.findFunctionDeclarations(e))),n}function c(e){var t,n;for(const i of e){const e=o.getDocString(null===(n=null===(t=i.node)||void 0===t?void 0:t.suite)||void 0===n?void 0:n.statements);if(e)return e}}t.getOverloadedFunctionDocStrings=function(e,t,n){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&&a.isStubFile(t.path)&&3===t.type){const e=c(n.findFunctionDeclarations(t));e&&i.push(e)}return i},t.getModuleDocString=function(e,t,n){let i=e.docString;return!i&&t&&a.isStubFile(t.path)&&(i=function(e){for(const t of e)if(t.statements){const e=o.getDocString(t.statements);if(e)return e}}(n.findModules(t.path))),i},t.getClassDocString=function(e,t,n){let i=e.details.docString;return!i&&t&&a.isStubFile(t.path)&&4===t.type&&(i=c(n.findClassDeclarations(t))),i},t.getFunctionDocStringFromType=function(e,t){let n=e.details.docString;return!n&&e.details.declaration&&(n=l(e.details.declaration,t)),n},t.getFunctionDocStringFromDeclaration=l},7887: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 o=n(3213),a=n(5839),l=n(1290),c=n(9744),p=n(1464),d=n(6886),u=n(3550),h=n(2122),m=n(5275),y=n(5303),g=r(n(6673)),f=r(n(563)),_=n(6610),T=n(5523),v=r(n(8494)),b=r(n(5083)),S=n(8235),C=n(817),I=n(1766),D=n(2917),x=n(3090),F=r(n(3843)),k=n(1133),P=n(5168),A=n(1659),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:!0,37:!0,39:!0,40:!0,41:!0,42:!0},N={"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.deque":d.PythonVersion.V3_9,"collections.OrderedDict":d.PythonVersion.V3_9,"queue.Queue":d.PythonVersion.V3_9},O={"builtins.float":["builtins.int"],"builtins.complex":["builtins.float","builtins.int"],"builtins.bytes":["builtins.bytearray","builtins.memoryview"]},R=64;t.createTypeEvaluator=function(e,t){const n=[],i=new Map,s=new Map,r=new Map,M=new Map,L=new Map,U=new x.SpeculativeTypeTracker,V=new x.IncompleteTypeTracker;let z,j,B,W=!1,$=1,G=!1;const q=[];let K;function H(){z&&o.throwIfCancellationRequested(z)}function Y(e){let t;if(t=K&&Z(e)?K.get(e.id):L.get(e.id),void 0!==t)return a.assert(!x.isIncompleteType(t)),t}function Q(e,t,n){const i=K&&Z(e)?K:L;i.set(e.id,t);const s=U.getSpeculativeRootNode();s&&v.isNodeContainedWithin(e,s)&&(U.trackEntry(i,e.id),n&&U.addSpeculativeType(e,t,n)),V.trackEntry(i,e.id)}function J(e){(K&&Z(e)?K:L).delete(e.id)}function Z(e){const t=q.length;if(0===t)return!1;const n=q[t-1];let i=e;for(;i;){if(i===n.functionNode)return!0;i=i.parent}return!1}function X(e,t){return n.findIndex((n=>n.symbolId===e.id&&n.declaration===t))}function ee(e,t){const i=X(e,t);if(i>=0){for(let e=i+1;e<n.length;e++)n[e].isResultValid=!1;return!1}return n.push({symbolId:e.id,declaration:t,isResultValid:!0}),!0}function te(e){const t=n.pop();return a.assert(t.symbolId===e.id),t.isResultValid}function ne(e,t,i){const s=X(e,t);s>=0&&(n[s].partialType=i)}function ie(e,t){const i=X(e,t);if(i>=0)return n[i].partialType}function se(e){return Ht(e,(()=>{Wt(e)}))}function re(e,t,n=0){var i;const s=Y(e);if(s)return{type:s,node:e};if(t){const n=U.getSpeculativeType(e,t);if(n)return{type:n,node:e}}let r;H(),t=P.transformPossibleRecursiveTypeAlias(t),G||(j=function(e,t){return Te("NoneType",un(e).typeshedModulePath)}(e)||k.AnyType.create(),B=an(e,"object")||k.AnyType.create(),G=!0);let o=0!=(64&n);switch(e.nodeType){case 38:r=function(e,t){const n=un(e),i=e.value;let s,r=!1;const o=0!=(4&t),l=ln(e,i,!o);if(l){let a=!o;if(4===l.scope.type&&(a=!1),n.isStubFile){const e=D.getLastTypedDeclaredForSymbol(l.symbol);e&&4===e.type&&(a=!1)}const p=l.symbol,d=_n(p,a?e:void 0),u=d.type;d.isIncomplete&&(r=!0),d.isRecursiveDefinition&&ve(e)&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.recursiveDefinition().format({name:i}),e);const m=!!u&&k.isClass(u)&&k.ClassType.isSpecialBuiltIn(u);if(s=u,a&&!m){const t=l.isBeyondExecutionScope||!p.isInitiallyUnbound()?u:k.UnboundType.create(),n=Jt(e,p.id,t);n&&(s=n)}0==(2&t)&&(k.isClass(s)?(0!=(64&t)&&P.requiresTypeArguments(s)&&!s.typeArguments&&Fe(n.diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,h.Localizer.Diagnostic.typeArgsMissingForClass().format({name:s.details.name}),e),s.typeArguments||(s=nn(s,void 0,t,e))):k.isObject(s)?s=ze(s):0!=(64&t)&&s.typeAliasInfo&&s.typeAliasInfo.typeParameters&&s.typeAliasInfo.typeParameters.length>0&&!s.typeAliasInfo.typeArguments&&Fe(n.diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,h.Localizer.Diagnostic.typeArgsMissingForAlias().format({name:s.typeAliasInfo.aliasName}),e)),r||f.isCodeUnreachable(e)||(k.isUnbound(s)?Fe(n.diagnosticRuleSet.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,h.Localizer.Diagnostic.symbolIsUnbound().format({name:i}),e):k.isPossiblyUnbound(s)&&Fe(n.diagnosticRuleSet.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,h.Localizer.Diagnostic.symbolIsPossiblyUnbound().format({name:i}),e)),Oe(n,p,e)}else"reveal_type"!==i&&Fe(n.diagnosticRuleSet.reportUndefinedVariable,c.DiagnosticRule.reportUndefinedVariable,h.Localizer.Diagnostic.symbolIsUndefined().format({name:i}),e),s=k.UnknownType.create();if(k.isTypeVar(s)&&s.details.isParamSpec&&32&t&&(Ie(h.Localizer.Diagnostic.paramSpecContext(),e),s=k.UnknownType.create()),k.isTypeVar(s)&&0==(64&t)&&s.details.name===i){const t=_e(e,"TypeVar");s=t&&k.isClass(t)?k.ObjectType.create(t):k.UnknownType.create()}if(0!=(64&t)&&0==(512&t)&&k.isClass(s)&&k.ClassType.isBuiltIn(s,"Generic")&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.genericNotAllowed(),e),k.isTypeVar(s)&&k.TypeBase.isInstantiable(s)&&!P.isTypeAliasPlaceholder(s))if(s=function(e,t){let n=e;for(a.assert(k.TypeBase.isInstantiable(t));n&&(n=v.getTypeVarScopeNode(n),n);){let e;if(10===n.nodeType){const t=xt(n);t&&(e=t.classType.details.typeParameters)}else if(28===n.nodeType){const t=kt(n);t&&(e=[],t.functionType.details.parameters.forEach((t=>{t.hasDeclaredType&&P.addTypeVarsToListIfUnique(e,P.getTypeVarArgumentsRecursive(t.type))})))}else if(36===n.nodeType)break;if(e){const n=e.find((e=>e.details.name===t.details.name));if(n&&n.scopeId)return P.convertToInstantiable(n)}n=n.parent}for(n=e;n;){if(3===n.nodeType){const e=Y(n.leftExpression);if(e&&k.isTypeVar(e)&&e.details.recursiveTypeAliasScopeId&&e.details.recursiveTypeAliasName)return k.TypeVarType.cloneForScopeId(t,e.details.recursiveTypeAliasScopeId,e.details.recursiveTypeAliasName)}n=n.parent}return t}(e,s),0!=(2048&t)&&void 0!==s.scopeId)s.details.isSynthesized||s.details.isParamSpec||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:s.details.name}),e);else if(0!=(8192&t)){if(void 0===s.scopeId){const t=v.getEnclosingClassOrFunction(e);t?s=k.TypeVarType.cloneForScopeId(s,Le(t),t.name.value):a.fail("AssociateTypeVarsWithCurrentScope flag was set but enclosing scope not found")}}else 0!=(4096&t)&&(void 0!==s.scopeId||s.details.isSynthesized||s.details.isParamSpec||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarNotUsedByOuterScope().format({name:s.details.name}),e));return{type:s,node:e,isIncomplete:r}}(e,n);break;case 35:r=function(e,t){const n=2|68&t,i=re(e.leftExpression,void 0,n);if(i.isIncomplete||P.isTypeAliasPlaceholder(i.type))return{node:e,type:k.UnknownType.create(),isIncomplete:!0};const s=Ve(e,i,{method:"get"},t);if(_.isCodeFlowSupportedForReference(e)){Q(e,s.type),Q(e.memberName,s.type);let t=s.type;if(k.isUnbound(t)){const n=Ee(i.type);let s;k.isClass(n)?s=P.lookUpClassMember(n,e.memberName.value,1):k.isObject(n)&&(s=P.lookUpObjectMember(n,e.memberName.value,1)),s&&(t=Cn(s))}const n=Jt(e,C.indeterminateSymbolId,t);n&&(s.type=n)}return Q(e.memberName,s.type),s}(e,n);break;case 24:r=function(e,t=0){const n=re(e.baseExpression,void 0,2|t);if(n.isIncomplete)return{node:e,type:k.UnknownType.create(),isIncomplete:!0};if(0==(4&t)){const t=un(e);if(k.isClass(n.type)&&k.ClassType.isBuiltIn(n.type)&&!n.type.aliasName){const i=N[n.type.details.fullName];void 0!==i&&t.executionEnvironment.pythonVersion<i&&Fe(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.classNotRuntimeSubscriptable().format({name:n.type.details.name}),e.baseExpression)}}return We(e,n.type,{method:"get"},t)}(e,n);break;case 9:r=function(e,t){const n=re(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:k.UnknownType.create()};if(n.isIncomplete||P.isTypeAliasPlaceholder(n.type))s.isIncomplete=!0;else if(38===e.leftExpression.nodeType&&"super"===e.leftExpression.value)s=function(e){let t,n;if(e.arguments.length>2&&Ie(h.Localizer.Diagnostic.superCallArgCount(),e.arguments[2]),e.arguments.length>0)t=re(e.arguments[0].valueExpression).type,k.isAnyOrUnknown(t)||k.isClass(t)||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.superCallFirstArg().format({type:jn(t)}),e.arguments[0].valueExpression);else{const n=v.getEnclosingClass(e);if(n){const e=xt(n);t=e?e.classType:k.UnknownType.create()}else Ie(h.Localizer.Diagnostic.superCallZeroArgForm(),e.leftExpression),t=k.UnknownType.create()}if(e.arguments.length>1){const i=Ee(re(e.arguments[1].valueExpression).type);let s=!1;k.isAnyOrUnknown(i)||(k.isObject(i)?(k.isClass(t)&&(P.derivesFromClassRecursive(i.classType,t,!0)||(s=!0)),n=i):k.isClass(i)?(k.isClass(t)&&(P.derivesFromClassRecursive(i,t,!0)||(s=!0)),n=i):s=!0),s&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.superCallSecondArg().format({type:jn(t)}),e.arguments[1].valueExpression)}const i=e.parent;if(35===i.nodeType){const s=i.memberName.value,r=P.lookUpClassMember(t,s,1);if(r&&k.isClass(r.classType))return{type:k.ObjectType.create(r.classType),node:e,bindToType:n}}if(k.isClass(t)){if(t.details.mro.some((e=>k.isAnyOrUnknown(e))))return{type:k.UnknownType.create(),node:e};const n=t.details.baseClasses;if(n.length>0){const t=n[0];if(k.isClass(t))return{type:k.ObjectType.create(t),node:e}}}return{type:k.UnknownType.create(),node:e}}(e);else if(k.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){const t=re(e.arguments[0].valueExpression).type,n=v.printExpression(e.arguments[0].valueExpression),i=jn(t);Ce(`Type of "${n}" is "${i}"`,e.arguments[0]);const r=on(e,"str");k.isClass(r)?s.type=k.ObjectType.create(k.ClassType.cloneWithLiteral(r,i)):s.type=k.AnyType.create()}else s.type=et(e,i,n.type,void 0,!1,t).returnType||k.UnknownType.create();return i.forEach((e=>{e.valueExpression&&!dn(e.valueExpression)&&sn(e)})),s}(e,t);break;case 52:r=function(e,t){let n=t;if(t&&10===t.category){let i;P.doForEachSubtype(t,(t=>{i||pn(e,(()=>Ge(e,t)))&&(i=t)})),n=i}if(n){const t=Ge(e,n);if(t)return t}return function(e){const t=e.expressions.map((e=>re(e))),n=on(e,"tuple");return k.isClass(n)?{type:P.convertToInstance(Ke(n,qe(t))),node:e}:{type:k.UnknownType.create(),node:e}}(e)}(e,t);break;case 11:r=function(e,t){let n;if(24===e.constType?n=0!=(64&t)?k.NoneType.createType():k.NoneType.createInstance():31!==e.constType&&14!==e.constType&&8!==e.constType||(n=an(e,"bool"),n&&k.isObject(n)&&(31===e.constType?n=k.ObjectType.create(k.ClassType.cloneWithLiteral(n.classType,!0)):14===e.constType&&(n=k.ObjectType.create(k.ClassType.cloneWithLiteral(n.classType,!1))))),n)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=re(e.parent.baseExpression).type;if(t&&k.isClass(t)&&k.ClassType.isSpecialBuiltIn(t,"Literal"))return!0}return!1}(e)){e.strings.forEach((e=>{27===e.nodeType&&e.expressions.forEach((e=>{re(e)}))}));const t=0!=(32&e.strings[0].token.flags);r=e.strings.some((e=>27===e.nodeType))?{node:e,type:an(e,t?"bytes":"str")}:{node:e,type:_t(e,t?"bytes":"str",e.strings.map((e=>e.value)).join(""))}}else{if(e.typeAnnotation)r=re(e.typeAnnotation,void 0,68|n);else if(!e.typeAnnotation&&1===e.strings.length){const t=function(e){const t=un(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 o=n.parseTextExpression(t.fileContents,s,i.length,r);if(o.parseTree)return o.diagnostics.forEach((t=>{Ie(t.message,e)})),o.parseTree.parent=e,o.parseTree}(e);t&&(r=re(t,void 0,68|n))}r||(Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.expectedTypeNotString(),e),r={node:e,type:k.UnknownType.create()}),o=!1}break;case 40:r=e.isImaginary?{node:e,type:an(e,"complex")}:e.isInteger?{node:e,type:_t(e,"int",e.value)}:{node:e,type:an(e,"float")};break;case 18:r=0!=(1&n)?{type:k.AnyType.create(!0),node:e}:0!=(256&n)?{type:k.UnknownType.create(),node:e}:{type:an(e,"ellipsis")||k.AnyType.create(),node:e};break;case 55:r=function(e,t){let n=Ee(re(e.expression).type);const i={0:"__pos__",33:"__neg__",5:"__invert__"};let s;if(38!==e.operator&&P.isOptionalType(n)&&(Fe(un(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,h.Localizer.Diagnostic.noneOperator().format({operator:v.printOperator(e.operator)}),e.expression),n=k.removeNoneFromUnion(n)),38===e.operator?(s=an(e,"bool"),s||(s=k.UnknownType.create())):(s=k.isAnyOrUnknown(n)?n:dt(n,[],i[e.operator],e,t),s||(Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSupportUnaryOperator().format({operator:v.printOperator(e.operator),type:jn(n)}),e),s=k.UnknownType.create())),(0===e.operator||33===e.operator)&&k.isObject(s)&&k.ClassType.isBuiltIn(s.classType,"int")&&k.isObject(n)&&k.ClassType.isBuiltIn(n.classType,"int")&&"number"==typeof n.classType.literalValue){const t=0===e.operator?n.classType.literalValue:-n.classType.literalValue;s=k.ObjectType.create(k.ClassType.cloneWithLiteral(s.classType,t))}return{type:s,node:e}}(e,t);break;case 7:r=at(e,t,n);break;case 5:{const n=ct(e,t);Ne(e.destExpression,n,e.rightExpression),r={type:n,node:e};break}case 31:r=function(e,t){let n=t;if(t&&10===t.category){let i;P.doForEachSubtype(t,(t=>{i||pn(e,(()=>mt(e,t)))&&(i=t)})),n=i}if(n){const t=mt(e,n);if(t)return t}return function(e,t){let n=[];e.entries.forEach(((e,t)=>{let i;i=32===e.nodeType?ft(e):re(e).type,t<R&&n.push(i)})),n=n.map((e=>P.stripLiteralValue(e)));let i=k.AnyType.create();return n.length>0&&(i=un(e).diagnosticRuleSet.strictListInference||t?k.combineTypes(n,64):P.areTypesSame(n)?n[0]:k.UnknownType.create()),{type:an(e,"list",[i]),node:e}}(e,!!t)}(e,t);break;case 46:r=function(e){return e.startValue&&re(e.startValue),e.endValue&&re(e.endValue),e.stepValue&&re(e.stepValue),{type:an(e,"slice"),node:e}}(e);break;case 6:r=re(e.expression,void 0,n),r={type:ye(r.type,e.expression),node:e};break;case 51:r=function(e,t,n){re(e.testExpression);const i=re(e.ifExpression,n,t),s=re(e.elseExpression,n,t);return{type:k.combineTypes([i.type,s.type]),node:e}}(e,n,t);break;case 32:r=function(e){const t=ft(e),n=e.comprehensions.some((e=>33===e.nodeType&&e.isAsync));let i=k.UnknownType.create();const s=_e(e,n?"AsyncGenerator":"Generator");return s&&k.isClass(s)&&(i=k.ObjectType.create(k.ClassType.cloneForSpecialization(s,n?[t,k.NoneType.createInstance()]:[t,k.NoneType.createInstance(),k.NoneType.createInstance()],!0))),{type:i,node:e}}(e);break;case 15:r=function(e,t){if(t&&10===t.category){let n;P.doForEachSubtype(t,(t=>{n||pn(e,(()=>ut(e,t,new l.DiagnosticAddendum)))&&(n=t)})),t=n}const n=new l.DiagnosticAddendum;if(t){const i=ut(e,t,n);if(i)return i}return function(e,t){let n=k.AnyType.create(),i=k.AnyType.create(),s=[],r=[];return ht(e,s,r,!t),s=s.map((e=>P.stripLiteralValue(e))),r=r.map((e=>P.stripLiteralValue(e))),n=s.length>0?k.combineTypes(s):k.AnyType.create(),i=r.length>0?un(e).diagnosticRuleSet.strictDictionaryInference||t?k.combineTypes(r):P.areTypesSame(r)?r[0]:k.UnknownType.create():k.AnyType.create(),{type:an(e,"dict",[n,i]),node:e}}(e,!!t)}(e,t);break;case 30:r=function(e,t){const n=k.FunctionType.createInstance("","",0);let i;if(Q(e,n),t)if(k.isFunction(t))i=t;else if(10===t.category)i=k.findSubtype(t,(e=>k.isFunction(e)));else if(k.isObject(t)){const e=P.lookUpObjectMember(t,"__call__");if(e){const n=Cn(e);if(n&&k.isFunction(n)){const e=Un(t,n);e&&(i=e)}}}e.parameters.forEach(((e,t)=>{let s=k.UnknownType.create();i&&t<i.details.parameters.length&&(s=k.FunctionType.getEffectiveParameterType(i,t)),e.name&&Q(e.name,s),e.defaultValue&&re(e.defaultValue,void 0,1);const r={category:e.category,name:e.name?e.name.value:void 0,hasDefault:!!e.defaultValue,defaultValueExpression:e.defaultValue,hasDeclaredType:!0,type:s};k.FunctionType.addParameter(n,r)}));const s=i?vn(i):void 0;return n.inferredReturnType=re(e.expression,s).type,{type:n,node:e}}(e,t);break;case 45:r=function(e,t){const n=[];if(e.entries.forEach(((e,i)=>{let s;s=32===e.nodeType?ft(e):re(e).type,(i<R||void 0!==t)&&n.push(s)})),t&&n.length>0){const i=P.mapSubtypes(t,(e=>{if(k.isObject(e)&&k.ClassType.isBuiltIn(e.classType,"set")&&e.classType.typeArguments){const t=e.classType.typeArguments[0],i=new A.TypeVarMap(P.getTypeVarScopeId(e));for(const e of n)if(!Pn(t,e,new l.DiagnosticAddendum,i))return;return P.applySolvedTypeVars(e,i)}}));if(!k.isNever(i))return{type:i,node:e}}let i=n.length>0?k.combineTypes(n.map((e=>P.stripLiteralValue(e)))):k.AnyType.create();return t||(i=P.stripLiteralValue(i)),{type:an(e,"set",[i]),node:e}}(e,t);break;case 3:r=re(e.rightExpression),Ne(e.leftExpression,r.type,e.rightExpression);break;case 4:r=re(e.rightExpression),Ne(e.name,r.type,e.rightExpression);break;case 60:r=function(e){let t;const n=v.getEnclosingFunction(e);if(n){const e=kt(n);e&&(t=P.getDeclaredGeneratorSendType(e.functionType))}return t||(t=k.UnknownType.create()),e.expression&&re(e.expression,t),{type:t,node:e}}(e);break;case 61:r=function(e){let t;const n=v.getEnclosingFunction(e);if(n){const e=kt(n);e&&(t=P.getDeclaredGeneratorSendType(e.functionType))}return t||(t=k.UnknownType.create()),e.expression&&re(e.expression,t),{type:t,node:e}}(e);break;case 56:{const n=re(e.expression,t).type;r={type:ge(n,!1,e),unpackedType:n,node:e};break}case 54:r=re(e.typeAnnotation,void 0,104);break;case 0:cn((()=>{e.child&&re(e.child)})),r={type:k.UnknownType.create(),node:e}}if(r||a.fail(`Unhandled expression type '${v.printExpression(e)}'`),o){const t=P.transformTypeObjectToClass(r.type);if(!k.TypeBase.isInstantiable(t)){const s=k.isObject(t)&&k.ClassType.isVariadicTypeParam(t.classType)&&0===(null===(i=t.classType.variadicTypeArguments)||void 0===i?void 0:i.length);0!=(128&n)&&s||ke(r.type,e)}}return r.isIncomplete||P.isTypeAliasPlaceholder(r.type)||Q(e,r.type,t),r}function oe(e){return void 0!==e.futureImports.get("annotations")||e.isStubFile}function ae(e,t=!1,n=!1){var i,s,r;const o=un(e);if(o.isTypingStubFile||o.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={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:"bool",module:"builtins"}}[t];return n?Ct(e,t,n):void 0}(e);if(t)return Q(e,t),t}let a=105;oe(o)&&(a|=4),a|=n?8192:4096,3===(null===(i=null==e?void 0:e.parent)||void 0===i?void 0:i.nodeType)&&e.parent.typeAnnotationComment===e?a|=4:62===(null===(s=null==e?void 0:e.parent)||void 0===s?void 0:s.nodeType)?(e.parent.returnTypeAnnotation===e||e.parent.paramTypeAnnotations.some((t=>t===e)))&&(a|=4):41===(null===(r=null==e?void 0:e.parent)||void 0===r?void 0:r.nodeType)&&e.parent.typeAnnotationComment===e&&(a|=4),t||(a|=16);const l=re(e,void 0,a).type;return P.convertToInstance(l)}function le(e,t){const n=re(e.expression),i=[{argumentCategory:0,type:t}];return et(e.expression,i,n.type,void 0,!0,void 0).returnType||k.UnknownType.create()}function ce(e,t,n,i,s,r=0,o){const a=je(e,t.classType,n,i,s,8|r,o);return null==a?void 0:a.type}function pe(e,t,n,i,s,r=0){let o;if(0==(32&r)&&(o=je(e,t,n,i,s,1|r)),!o){const s=t.details.effectiveMetaclass;s&&k.isClass(s)&&!k.ClassType.isSameGenericClass(s,t)&&(o=je(e,s,n,i,new l.DiagnosticAddendum,r,t))}return null==o?void 0:o.type}function de(e,t,n=!1){const i=P.lookUpClassMember(e,t,12);if(i){const t=Cn(i);if(k.isFunction(t)||k.isOverloadedFunction(t)){const i=Un(k.ObjectType.create(e),t,void 0,void 0,n);if(i)return i}}}function ue(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<e.parameters.length&&(i=1);const r=t-i;return r<0||r>=s.length?void 0:s[r]}function he(e){if(54===e.nodeType&&38===e.valueExpression.nodeType){const t=ln(e,e.valueExpression.value,!1);if(t)return void 0!==t.symbol.getDeclarations().find((e=>T.isExplicitTypeAliasDeclaration(e)))}return!1}function me(e){let t,n,i;switch(e.nodeType){case 38:{const n=ln(e,e.value,!0);n&&(t=n.symbol);break}case 54:return me(e.valueExpression);case 35:{const s=Ee(re(e.leftExpression).type);let r;k.isObject(s)?(r=P.lookUpObjectMember(s,e.memberName.value,16),n=s,i=null==r?void 0:r.classType):k.isClass(s)&&(r=P.lookUpClassMember(s,e.memberName.value,24),n=s,i=null==r?void 0:r.classType),r&&(t=r.symbol);break}case 24:{const t=me(e.baseExpression);if(t&&k.isObject(t)){const n=P.lookUpClassMember(t.classType,"__setitem__");if(n){const i=Cn(n);if(k.isFunction(i)){const s=Un(t,i,k.isClass(n.classType)?n.classType:void 0,e,!1);if(s&&k.isFunction(s)&&2===s.details.parameters.length){const e=k.FunctionType.getEffectiveParameterType(s,1);if(!k.isAnyOrUnknown(e))return e}}}}break}}if(t){let s=Tn(t);if(s){if(P.isProperty(s)){const e=P.lookUpClassMember(s.classType,"fset"),t=e?Cn(e):void 0;if(!t||!k.isFunction(t)||t.details.parameters.length<2)return;s=t.details.parameters[1].type}return n&&(i&&k.isClass(i)&&(s=P.partiallySpecializeType(s,i)),(k.isFunction(s)||k.isOverloadedFunction(s))&&(s=Un(n,s,void 0,e))),s}}}function ye(e,t){return P.mapSubtypes(e,(e=>{if(k.isAnyOrUnknown(e))return e;const n=Re(e);if(n)return n;if(k.isObject(e)){const n=Me(e,"__await__",t);if(n){if(k.isAnyOrUnknown(n))return n;if(k.isObject(n)&&Me(n,"__iter__",t)){const e=Re(n);if(e)return e}}}return t&&Fe(un(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotAwaitable().format({type:jn(e)}),t),k.UnknownType.create()}))}function ge(e,t,n){const i=t?"__aiter__":"__iter__",s=t?"__anext__":"__next__";return e=Ee(e),P.isOptionalType(e)&&(n&&Fe(un(n).diagnosticRuleSet.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,h.Localizer.Diagnostic.noneNotIterable(),n),e=k.removeNoneFromUnion(e)),P.mapSubtypes(e,(e=>{if(e=ze(e),k.isAnyOrUnknown(e))return e;const r=new l.DiagnosticAddendum;if(k.isObject(e)||k.isClass(e)){const o=((e,r)=>{let o;if(k.isObject(e)?o=Me(e,i,n):k.isClass(e)&&e.details.effectiveMetaclass&&k.isClass(e.details.effectiveMetaclass)&&(o=Me(k.ObjectType.create(e.details.effectiveMetaclass),i,n,e)),o){const e=Ee(o);if(k.isAnyOrUnknown(e))return e;if(k.isObject(e)){const i=Me(e,s,n);if(i)return t?ye(i,n):i;r.addMessage(h.Localizer.Diagnostic.methodNotDefinedOnType().format({name:s,type:jn(o)}))}else r.addMessage(h.Localizer.Diagnostic.methodReturnsNonObject().format({name:i}))}else{if(k.isObject(e)){const t=Me(e,"__getitem__",n);if(t)return t}r.addMessage(h.Localizer.Diagnostic.methodNotDefined().format({name:i}))}})(e,r);if(o)return o}return n&&Fe(un(n).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotIterable().format({type:jn(e)})+r.getString(),n),k.UnknownType.create()}))}function fe(e,t){a.assert(k.ClassType.isTypedDictClass(t));const n=k.FunctionType.createInstance("__new__","",65);k.FunctionType.addParameter(n,{category:0,name:"cls",type:t,hasDeclaredType:!0}),k.FunctionType.addDefaultParameters(n),n.details.declaredReturnType=k.ObjectType.create(t);const i=k.FunctionType.createInstance("__init__","",64);k.FunctionType.addParameter(i,{category:0,name:"self",type:k.ObjectType.create(t),hasDeclaredType:!0}),i.details.declaredReturnType=k.NoneType.createInstance(),k.FunctionType.addParameter(i,{category:1,type:k.AnyType.create(),hasDeclaredType:!0});const s=Mn(t);s.forEach(((e,t)=>{k.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 o=on(e,"str");if(k.isClass(o)){const n={category:0,name:"self",type:k.ObjectType.create(t),hasDeclaredType:!0},i=Le(e);let a=k.TypeVarType.createInstance(`__${t.details.name}_default`,!1,!0);a=k.TypeVarType.cloneForScopeId(a,i,t.details.name);const l=(e,t)=>{const i=k.FunctionType.createInstance("get","",320);return k.FunctionType.addParameter(i,n),k.FunctionType.addParameter(i,{category:0,name:"k",type:e,hasDeclaredType:!0}),k.FunctionType.addParameter(i,{category:0,name:"default",type:t,hasDeclaredType:!0,hasDefault:!0}),i.details.declaredReturnType=t,i},c=(e,t)=>{const s={category:0,name:"k",type:e,hasDeclaredType:!0},r=k.FunctionType.createInstance("pop","",320);k.FunctionType.addParameter(r,n),k.FunctionType.addParameter(r,s),r.details.declaredReturnType=t;const o=k.FunctionType.createInstance("pop","",320);return k.FunctionType.addParameter(o,n),k.FunctionType.addParameter(o,s),k.FunctionType.addParameter(o,{category:0,name:"default",hasDeclaredType:!0,type:a,hasDefault:!0}),o.details.declaredReturnType=k.combineTypes([t,a]),o.details.typeVarScopeId=i,[r,o]},p=(e,t,s=!1)=>{const r=k.FunctionType.createInstance("setdefault","",320);return k.FunctionType.addParameter(r,n),k.FunctionType.addParameter(r,{category:0,name:"k",hasDeclaredType:!0,type:e}),k.FunctionType.addParameter(r,{category:0,name:"default",hasDeclaredType:!0,type:s?k.AnyType.create():a,hasDefault:!0}),r.details.declaredReturnType=s?t:k.combineTypes([t,a]),r.details.typeVarScopeId=i,r},d=e=>{const t=k.FunctionType.createInstance("delitem","",320);return k.FunctionType.addParameter(t,n),k.FunctionType.addParameter(t,{category:0,name:"k",hasDeclaredType:!0,type:e}),t.details.declaredReturnType=k.NoneType.createInstance(),t},u=[],h=[],m=[];s.forEach(((e,t)=>{const n=k.ObjectType.create(k.ClassType.cloneWithLiteral(o,t));u.push(l(n,e.valueType)),h.push(...c(n,e.valueType)),m.push(p(n,e.valueType,e.isRequired))}));const y=k.ObjectType.create(o);u.push(l(y,k.AnyType.create())),h.push(...c(y,k.AnyType.create())),m.push(p(y,k.AnyType.create())),r.set("get",C.Symbol.createWithType(4,k.OverloadedFunctionType.create(u))),r.set("pop",C.Symbol.createWithType(4,k.OverloadedFunctionType.create(h))),r.set("setdefault",C.Symbol.createWithType(4,k.OverloadedFunctionType.create(m))),r.set("__delitem__",C.Symbol.createWithType(4,d(y)))}}function _e(e,t){return Te(t,un(e).typingModulePath)}function Te(t,n){if(!n)return;const i=e(n);if(!i)return;const s=i.symbolTable.get(t);return s?fn(s):void 0}function ve(e){const t=f.getFlowNode(e);return!!t&&Xt(t)}function be(e){const t=f.getAfterFlowNode(e);return!!t&&Xt(t)}function Se(e,t){const n=f.getFlowNode(e),i=f.getFlowNode(t);return!(!n||!i)&&(n===i||Xt(i,n))}function Ce(e,t,n){return De("information",e,t,n)}function Ie(e,t,n){return De("error",e,t,n)}function De(e,t,n,i){if(!xe(n))return un(n).diagnosticSink.addDiagnosticWithTextRange(e,t,i||n)}function xe(e){return W||dn(e)||V.isUndoTrackingEnabled()}function Fe(e,t,n,i){if("none"===e)return;const s=De(e,n,i);return s&&s.setRule(t),s}function ke(e,t){const n=un(t),i=new l.DiagnosticAddendum;10===e.category&&P.doForEachSubtype(e,(e=>{k.TypeBase.isInstantiable(e)||i.addMessage(h.Localizer.DiagnosticAddendum.typeNotClass().format({type:jn(e)}))})),Fe(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeExpectedClass().format({type:jn(e)})+i.getString(),t)}function Pe(e,t,n,i){const s=e.value,r=ln(e,s,!1);if(!r)return;const o=r.symbol.getDeclarations(),a=Tn(r.symbol),p=un(e);let d=t;if(a&&n){let s=new l.DiagnosticAddendum;Pn(a,t,s)?d=On(a,t):(i&&(s=i),Fe(p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(a)})+s.getString(),n||e),"none"!==p.diagnosticRuleSet.reportGeneralTypeIssues&&(d=a))}else{const t=b.getScopeForNode(e);if(2===(null==t?void 0:t.type)){const t=I.isConstantName(s),n=I.isPrivateOrProtectedName(s);!k.TypeBase.isInstance(d)||t||n&&"none"!==un(e).diagnosticRuleSet.reportPrivateUsage||(d=P.stripLiteralValue(d))}}const u=o.find((e=>1===e.type));u&&1===u.type&&n&&u.isConstant&&e!==o[0].node&&Fe(p.diagnosticRuleSet.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,h.Localizer.Diagnostic.constantRedefinition().format({name:s}),e),Q(e,d)}function Ae(e,t,n,i){const s=e.memberName.value,r=un(e),o=v.getEnclosingClass(e);if(!o)return;const l=xt(o);if(l&&k.isClass(l.classType)){let o=P.lookUpClassMember(l.classType,s,n?0:8);const p=l.classType.details.fields;if(o)if(k.isClass(o.classType)&&k.ClassType.isSameGenericClass(l.classType,o.classType)&&o.isInstanceMember===n){const t=p.get(s);a.assert(void 0!==t);const n=t.getDeclarations();let o=D.isFinalVariable(t);if(n.length>0&&1===n[0].type&&i&&e.memberName!==n[0].node){n[0].isConstant&&Fe(r.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&&(o=!1),o&&Ie(h.Localizer.Diagnostic.finalReassigned().format({name:e.memberName.value}),e.memberName)}}else{const i=Tn(o.symbol);if(i&&!P.isProperty(i)&&!o.isInstanceMember&&n){Oe(r,o.symbol,e.memberName);const n=Cn(o);t=k.combineTypes([t,n])}}o=P.lookUpClassMember(l.classType,s,16),!o&&i&&gt(r.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,t,e)}}function Ee(e){return P.mapSubtypes(e,(e=>{if(k.isTypeVar(e)&&!e.details.recursiveTypeAliasName){if(e.details.boundType)return k.TypeBase.isInstantiable(e)?P.convertToInstantiable(e.details.boundType):P.convertToInstance(e.details.boundType);if(e.details.recursiveTypeAliasName)return e;if(e.details.constraints.length>0){const t=e.details.constraints.map(((t,n)=>({type:t,constraints:[{typeVarName:k.TypeVarType.getNameWithScope(e),constraintIndex:n}]})));return k.combineConstrainedTypes(t)}const t=B||k.AnyType.create();return k.TypeBase.isInstantiable(e)?P.convertToInstantiable(t):t}return e}))}function we(e,t,n){const i=[];let s=!1;const r=e=>{const r=Ee(e);if(10===r.category)r.subtypes.forEach(((o,a)=>{const l=r.constraints?r.constraints[a]:void 0;if(t&&!k.SubtypeConstraint.isCompatible(l,t))return;const c=n(o,e,l);c!==e&&(s=!0),c&&i.push({type:c,constraints:l})}));else{const t=n(r,e,void 0);t!==e&&(s=!0),t&&i.push({type:t,constraints:void 0})}};return 10===e.category?e.subtypes.forEach((e=>{r(e)})):r(e),s?k.combineConstrainedTypes(i):e}function Ne(e,t,n,i){if(k.isTypeVar(t)&&n&&9===n.nodeType){const i=re(n.leftExpression).type;k.isClass(i)&&(k.ClassType.isBuiltIn(i,"TypeVar")||k.ClassType.isBuiltIn(i,"ParamSpec"))&&(38===e.nodeType&&e.value===t.details.name||Ie(t.details.isParamSpec?h.Localizer.Diagnostic.paramSpecAssignedName().format({name:k.TypeVarType.getReadableName(t)}):h.Localizer.Diagnostic.typeVarAssignedName().format({name:k.TypeVarType.getReadableName(t)}),e))}switch(t=k.removeUnbound(t),e.nodeType){case 38:gt(un(e).diagnosticRuleSet.reportUnknownVariableType,c.DiagnosticRule.reportUnknownVariableType,e,t,e),Pe(e,t,n,i);break;case 35:!function(e,t,n,i){const s=re(e.leftExpression),r=Ee(s.type);if(38===e.leftExpression.nodeType){const i=v.getEnclosingClass(e);if(i){const s=xt(i);s&&k.isClass(s.classType)&&(k.isObject(r)?k.ClassType.isSameGenericClass(r.classType,s.classType)&&Ae(e,t,!0,n):k.isClass(r)&&k.ClassType.isSameGenericClass(r,s.classType)&&Ae(e,t,!1,n),k.ClassType.isProtocolClass(s.classType)&&Ie(h.Localizer.Diagnostic.assignmentInProtocol(),e.memberName))}}Ve(e,s,{method:"set",setType:t,setErrorNode:n,setExpectedTypeDiag:i},0),Q(e.memberName,t),Q(e,t)}(e,t,n,i);break;case 24:{const s=re(e.baseExpression,void 0,2),r=We(e,s.type,{method:"set",setType:t,setErrorNode:n,setExpectedTypeDiag:i},0);Q(e,r.type);break}case 52:!function(e,t,n){const i=new Array(e.expressions.length);for(let t=0;t<e.expressions.length;t++)i[t]=[];const s=e.expressions.findIndex((e=>56===e.nodeType));P.doForEachSubtype(t,((t,r,o)=>{const a=P.getSpecializedTupleType(t);if(a&&a.variadicTypeArguments){const t=a.variadicTypeArguments,n=t.length;if(2===n&&P.isEllipsisType(t[1]))for(let n=0;n<e.expressions.length;n++)i[n].push({type:t[0],constraints:o});else{let r=0,a=0;for(a=0;a<e.expressions.length;a++)if(a===s){const s=e.expressions.length-a-1,l=n-r;let c=Math.max(l-s,0);for(;c>0;)i[a].push({type:t[r],constraints:o}),r++,c--}else{if(r>=n)break;i[a].push({type:t[r],constraints:o}),r++}if(a<e.expressions.length||r<n){const t=un(e),i=s>=0?e.expressions.length-1:e.expressions.length;Fe(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.tupleSizeMismatch().format({expected:i,received:n}),e)}}}else{const s=ge(t,!1,n);for(let t=0;t<e.expressions.length;t++)i[t].push({type:s,constraints:o})}})),e.expressions.forEach(((e,t)=>{const r=i[t];let o=0===r.length?k.UnknownType.create():k.combineConstrainedTypes(r);if(o=P.removeNoReturnFromUnion(o),t===s){const t=on(e,"list");k.isClass(t)&&(o=k.ObjectType.create(k.ClassType.cloneForSpecialization(t,[o],!0)))}Ne(e,o,n)})),Q(e,t)}(e,t,n);break;case 54:{const s=ae(e.typeAnnotation,v.isFinalAllowedForAssignmentTarget(e.valueExpression));Pn(s,t,new l.DiagnosticAddendum)&&(k.isObject(t)&&k.ClassType.isEnumClass(t.classType)||(t=On(s,t))),Ne(e.valueExpression,t,n,i);break}case 56:38===e.expression.nodeType&&Pe(e.expression,t,n);break;case 31:{const i=ge(t,!1,n);e.entries.forEach((e=>{Ne(e,i,n)}));break}case 0:cn((()=>{e.child&&re(e.child)}));break;default:Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.assignmentTargetExpr(),e)}}function Oe(e,t,n){dn(n)||V.isUndoTrackingEnabled()||e.accessedSymbolMap.set(t.id,!0)}function Re(e){if(k.isAnyOrUnknown(e))return e;if(k.isObject(e)){const t=e.classType;if(k.ClassType.isBuiltIn(t,"Generator")){const e=t.typeArguments;if(e&&e.length>=3)return e[2]}}}function Me(e,t,n,i){const s=P.lookUpObjectMember(e,t,8);if(!s)return;const r=Cn(s);if(k.isAnyOrUnknown(r))return r;if(k.isFunction(r)){const t=Un(i||e,r,s&&k.isClass(s.classType)?s.classType:void 0,n,!1,i);if(t)return vn(t)}}function Le(e){return`${un(e).filePath}.${e.start.toString()}`}function Ue(e){const t=[];let n=e;for(;n&&(n=v.getTypeVarScopeNode(n),n);)t.push(Le(n)),n=n.parent;return t}function Ve(e,t,n,i){const s=t.type,r=e.memberName.value;let o=new l.DiagnosticAddendum;const a=un(e);let p;switch(s.category){case 2:case 1:p=s;break;case 7:p=pe(e.memberName,s,r,n,o);break;case 11:return s.details.isParamSpec?"args"===r||"kwargs"===r?{type:k.AnyType.create(),node:e}:(Fe(a.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramSpecUnknownMember().format({name:r}),e.memberName),{type:k.UnknownType.create(),node:e}):s.details.recursiveTypeAliasName?{type:k.UnknownType.create(),node:e,isIncomplete:!0}:Ve(e,{type:Ee(s),node:e,bindToType:s},n,0);case 8:{const a=ze(s);if(k.TypeBase.isInstantiable(a))return Ve(e,{type:a,node:t.node,bindToType:t.bindToType},n,i);p=ce(e.memberName,s,r,n,o,void 0,t.bindToType);break}case 9:{const t=k.ModuleType.getField(s,r);if(t)"get"===n.method&&Oe(un(e),t,e.memberName),p=_n(t,void 0,!0).type,k.isUnbound(p)&&(p=k.UnknownType.create());else{if("get"===n.method){const e=k.ModuleType.getField(s,"__getattr__");if(e&&e.getDeclarations().some((e=>e.path.toLowerCase().endsWith(".pyi")))){const t=fn(e);k.isFunction(t)&&(p=vn(t))}}p||(Fe(a.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.moduleUnknownMember().format({name:r}),e.memberName),p=k.UnknownType.create())}break}case 10:p=P.mapSubtypes(s,(t=>{if(k.isNone(t))Fe(un(e).diagnosticRuleSet.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalMemberAccess,h.Localizer.Diagnostic.noneUnknownMember().format({name:r}),e.memberName);else if(!k.isUnbound(t))return Ve(e,{type:t,node:e},n,0).type}));break;case 5:case 6:{const t=an(e,"function");p=t&&"__defaults__"!==r?Ve(e,{type:t,node:e},n,i).type:k.AnyType.create();break}default:o.addMessage(h.Localizer.DiagnosticAddendum.typeUnsupported().format({type:jn(s)}))}if(!p){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=k.isFunction(s)||k.isOverloadedFunction(s)||k.isObject(s)&&k.ClassType.isBuiltIn(s.classType,"function"),[l,d]=i?[a.diagnosticRuleSet.reportFunctionMemberAccess,c.DiagnosticRule.reportFunctionMemberAccess]:[a.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues];Fe(l,d,t.format({name:r,type:jn(s)})+o.getString(),e.memberName),p=i?k.AnyType.create():k.UnknownType.create()}return 0==(2&i)&&k.isClass(p)&&!p.typeArguments&&(p=nn(p,void 0,i,e)),"get"===n.method&&gt(a.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,p,e),{type:p,node:e}}function ze(e){if(k.isObject(e)&&k.ClassType.isBuiltIn(e.classType,"Type")){const t=e.classType.typeArguments;if(t&&t.length>0)return P.convertToInstantiable(t[0])}return e}function je(e,t,n,i,s,r,o){var c;let p=0;1&r&&(p|=8),2&r&&(p|=2),4&r&&(p|=4);let d=P.lookUpClassMember(t,n,16|p);if(d||(d=P.lookUpClassMember(t,n,p)),d){let a;if("get"===i.method)a=Cn(d);else{const n=v.getEnclosingClass(e);if(n){const e=null===(c=xt(n))||void 0===c?void 0:c.classType;e&&k.isClass(e)&&k.ClassType.isSameGenericClass(e,t)&&(a=Tn(d.symbol)||k.UnknownType.create())}a||(a=Cn(d))}if("set"===i.method&&d.symbol.isClassVar()&&8&r)return void s.addMessage(h.Localizer.DiagnosticAddendum.memberSetClassVar().format({name:n}));if(k.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&&k.isClass(d.classType)&&k.ClassType.isSameGenericClass(d.classType,t)&&Oe(un(e),d.symbol,e);const l=Be(a,d,t,o,0==(1&r),0!=(16&r),e,n,i,s);if(!l)return;if(a=l,"set"===i.method){if(!Pn(a,i.setType,s.createAddendum()))return void s.addMessage(h.Localizer.DiagnosticAddendum.memberAssignment().format({type:jn(i.setType),name:n,classType:zn(t)}));if(k.isClass(d.classType)&&k.ClassType.isFrozenDataClass(d.classType))return void s.addMessage(h.Localizer.DiagnosticAddendum.dataclassFrozen().format({name:jn(k.ObjectType.create(d.classType))}))}return{type:a,isClassMember:!d.isInstanceMember}}if(0==(1&r)){const c=function(e,t,n){if("get"===n.method){const n=pe(t,e,"__getattribute__",{method:"get"},new l.DiagnosticAddendum,4);if(n&&k.isFunction(n))return vn(n);const i=pe(t,e,"__getattr__",{method:"get"},new l.DiagnosticAddendum,4);if(i&&k.isFunction(i))return vn(i)}else if("set"===n.method){if(pe(t,e,"__setattr__",{method:"get"},new l.DiagnosticAddendum,4))return k.AnyType.create()}else if(a.assert("del"===n.method),pe(t,e,"__detattr__",{method:"get"},new l.DiagnosticAddendum,4))return k.AnyType.create()}(t,e,i);if(c){const a=Be(c,d,t,o,!1,0!=(16&r),e,n,i,s);if(!a)return;return{type:a,isClassMember:!1}}}s.addMessage(h.Localizer.DiagnosticAddendum.memberUnknown().format({name:n}))}function Be(e,t,n,i,s,r,o,a,l,c){let p=!0;return e=P.mapSubtypes(e,(e=>{if(k.isObject(e)){let r;r="get"===l.method?"__get__":"set"===l.method?"__set__":"__delete__";const d=e.classType,u=P.lookUpClassMember(d,r,8);if(k.ClassType.isPropertyClass(e.classType))if("set"===l.method){if(!u)return c.addMessage(h.Localizer.DiagnosticAddendum.propertyMissingSetter().format({name:a})),void(p=!1)}else if("del"===l.method&&!u)return c.addMessage(h.Localizer.DiagnosticAddendum.propertyMissingDeleter().format({name:a})),void(p=!1);if(u){let r=Cn(u);const a=[{argumentCategory:0,type:e},{argumentCategory:0,type:i||(s?k.ObjectType.create(n):k.NoneType.createInstance())}];if("get"===l.method?a.push({argumentCategory:0,type:k.AnyType.create()}):"set"===l.method&&a.push({argumentCategory:0,type:l.setType}),k.ClassType.isPropertyClass(e.classType)&&t&&k.isClass(t.classType)&&(k.isFunction(r)?vn(r):k.isOverloadedFunction(r)&&r.overloads.forEach((e=>{vn(e)})),r=P.partiallySpecializeType(r,t.classType)),k.isOverloadedFunction(r)){const e=Ye(o,a,r,void 0,new A.TypeVarMap(P.getTypeVarScopeId(u.classType)));e&&(r=e)}if(r&&k.isFunction(r)){const n=cn((()=>{const n=Un(e,r,t&&k.isClass(t.classType)?t.classType:void 0,o);if(n&&k.isFunction(n)){const e=tt(o,a.slice(1),n,new A.TypeVarMap(P.getTypeVarScopeId(n)),!0);return e.argumentErrors?(p=!1,k.AnyType.create()):"get"===l.method?e.returnType||k.UnknownType.create():k.AnyType.create()}}));if(n)return n}}}else if((k.isFunction(e)||k.isOverloadedFunction(e))&&(!s||!(null==t?void 0:t.isInstanceMember)))return Un(s?k.ObjectType.create(n):n,e,t&&k.isClass(t.classType)?t.classType:void 0,o,r,i);if("set"===l.method){let n=!1;if((t&&t.symbol.hasTypedDeclarations()||t&&!t.symbol.getDeclarations().some((e=>e.node===o)))&&(n=!0),n){let n=e;return s&&!t.isInstanceMember&&k.isFunction(e)&&(k.FunctionType.isClassMethod(e)||k.FunctionType.isInstanceMethod(e))&&(n=k.FunctionType.clone(e,!0)),n}}return e})),p?e:void 0}function We(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=$e(e,i);s.length>n.length&&Ie(h.Localizer.Diagnostic.typeArgsTooMany().format({name:jn(t),expected:n.length,received:s.length}),s[n.length].node);const o=new A.TypeVarMap(t.typeAliasInfo.typeVarScopeId),a=new l.DiagnosticAddendum;n.forEach(((e,t)=>{kn(e,t<s.length?P.convertToInstance(s[t].type):k.UnknownType.create(),!1,a,o)})),a.isEmpty()||Ie(h.Localizer.Diagnostic.typeNotSpecializable().format({type:jn(t)})+a.getString(),e);let c=P.applySolvedTypeVars(t,o);if(t.typeAliasInfo&&c!==t){const e=[];null===(r=t.typeAliasInfo.typeParameters)||void 0===r||r.forEach((t=>{e.push(o.getTypeVar(t)||k.UnknownType.create())})),c=k.TypeBase.cloneForTypeAlias(c,t.typeAliasInfo.aliasName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,e)}return{type:c,node:e}}if(P.isTypeAliasPlaceholder(t)){const n=$e(e,i).map((e=>P.convertToInstance(e.type)));return{type:k.TypeBase.cloneForTypeAlias(t,t.details.recursiveTypeAliasName,t.details.recursiveTypeAliasScopeId,void 0,n),node:e}}const o=P.mapSubtypes(t,(t=>{if(t=Ee(t=ze(t)),k.isAnyOrUnknown(t))return t;if(k.isClass(t)){if("set"===n.method?Ie(h.Localizer.Diagnostic.genericClassAssigned(),e.baseExpression):"del"===n.method&&Ie(h.Localizer.Diagnostic.genericClassDeleted(),e.baseExpression),k.ClassType.isSpecialBuiltIn(t,"Literal"))return function(e,t){if(0===e.items.length)return Ie(h.Localizer.Diagnostic.literalEmptyArgs(),e.baseExpression),k.UnknownType.create();const n=[];for(const i of e.items){let s;if(48===i.nodeType){s=Tt(e,0!=(32&i.strings[0].token.flags)?"bytes":"str",i.strings.map((e=>e.value)).join(""))}else 40===i.nodeType?!i.isImaginary&&i.isInteger&&(s=Tt(e,"int",i.value)):11===i.nodeType?31===i.constType?s=Tt(e,"bool",!0):14===i.constType?s=Tt(e,"bool",!1):24===i.constType&&(s=k.NoneType.createType()):55===i.nodeType&&33===i.operator&&40===i.expression.nodeType&&!i.expression.isImaginary&&i.expression.isInteger&&(s=Tt(e,"int",-i.expression.value));if(!s){const e=re(i);if(k.isObject(e.type)&&k.ClassType.isEnumClass(e.type.classType)&&void 0!==e.type.classType.literalValue)s=e.type.classType;else{let t=!0;P.doForEachSubtype(e.type,(e=>{k.isClass(e)&&void 0!==e.literalValue||(t=!1)})),t&&(s=e.type)}}s||(0!=(64&t)?(Ie(h.Localizer.Diagnostic.literalUnsupportedType(),i),s=k.UnknownType.create()):s=k.AnyType.create()),n.push(s)}return k.combineTypes(n)}(e,i);if(k.ClassType.isBuiltIn(t,"InitVar")){const t=$e(e,i);return 1===t.length?t[0].type:(Ie(h.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.length}),e.baseExpression),k.UnknownType.create())}if(k.ClassType.isEnumClass(t))return k.ObjectType.create(t);let s=i;k.isClass(t)&&k.ClassType.isVariadicTypeParam(t)&&(s|=128);const r=k.isClass(t)&&k.ClassType.isBuiltIn(t,"Annotated"),o=k.isClass(t)&&k.ClassType.hasCustomClassGetItem(t),a=$e(e,s,r,o);return o?t:nn(t,a,i,e)}return k.isObject(t)?function(e,t,n){if(k.ClassType.isTypedDictClass(t.classType)){if(1!==e.items.length)return Ie(h.Localizer.Diagnostic.typeArgsMismatchOne().format({received:e.items.length}),e),k.UnknownType.create();const i=Mn(t.classType),s=re(e.items[0]).type;let r=new l.DiagnosticAddendum;const o=P.mapSubtypes(s,(s=>{if(k.isAnyOrUnknown(s))return s;if(k.isObject(s)&&k.ClassType.isBuiltIn(s.classType,"str")){if(void 0===s.classType.literalValue)return k.UnknownType.create();const o=s.classType.literalValue,a=i.get(o);return a?("set"===n.method?Pn(a.valueType,n.setType,r):"del"===n.method&&a.isRequired&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.keyRequiredDeleted().format({name:o}),e),a.valueType):(r.addMessage(h.Localizer.DiagnosticAddendum.keyUndefined().format({name:o,type:jn(t)})),k.UnknownType.create())}return r.addMessage(h.Localizer.DiagnosticAddendum.typeNotStringLiteral().format({type:jn(s)})),k.UnknownType.create()}));if(n.setExpectedTypeDiag&&(r=n.setExpectedTypeDiag),!r.isEmpty()){let t;t="set"===n.method?h.Localizer.Diagnostic.typedDictSet():"del"===n.method?h.Localizer.Diagnostic.typedDictDelete():h.Localizer.Diagnostic.typedDictAccess(),Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,t+r.getString(),e)}return o}let i;"get"===n.method?i="__getitem__":"set"===n.method?i="__setitem__":(a.assert("del"===n.method),i="__delitem__");const s=ce(e,t,i,{method:"get"},new l.DiagnosticAddendum,0);if(!s)return Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.methodNotDefinedOnType().format({name:i,type:jn(t)}),e.baseExpression),k.UnknownType.create();const r=e.items.map((e=>re(e).type));let o;if(1===r.length){o=r[0];const n=t.classType;if(40===e.items[0].nodeType&&e.items[0].isInteger&&!e.items[0].isImaginary){const t=P.getSpecializedTupleType(n);if(t&&t.variadicTypeArguments&&t.variadicTypeArguments.length>0){const n=e.items[0];if(n.isInteger&&n.value>=0){if(2===t.variadicTypeArguments.length&&P.isEllipsisType(t.variadicTypeArguments[1]))return t.variadicTypeArguments[0];if(n.value<t.variadicTypeArguments.length)return t.variadicTypeArguments[n.value]}}}}else{const t=on(e,"tuple");o=k.isClass(t)?P.convertToInstance(Ke(t,r)):k.UnknownType.create()}const p=[{argumentCategory:0,type:o}];return"set"===n.method&&p.push({argumentCategory:0,type:n.setType||k.AnyType.create()}),et(e,p,s,new A.TypeVarMap(P.getTypeVarScopeId(s)),!1,void 0).returnType||k.UnknownType.create()}(e,t,n):k.isNever(t)?k.UnknownType.create():k.isNone(t)?(Fe(un(e).diagnosticRuleSet.reportOptionalSubscript,c.DiagnosticRule.reportOptionalSubscript,h.Localizer.Diagnostic.noneNotSubscriptable(),e.baseExpression),k.UnknownType.create()):(k.isUnbound(t)||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSubscriptable().format({type:jn(t)}),e.baseExpression),k.UnknownType.create())}));return e.items.forEach((e=>{re(e,void 0,4&i)})),{type:o,node:e}}function $e(e,t,n=!1,i=!1){const s=[],r=-33&t;let o=e.items;return 1===o.length&&52===o[0].nodeType&&(o=o[0].expressions),o.forEach(((e,t)=>{i||n&&t>0?s.push(re(e,void 0,34)):s.push(function(e,t){let n,i=89|t;return oe(un(e))&&(i|=4),n=31===e.nodeType?{type:k.UnknownType.create(),typeList:e.entries.map((e=>re(e,void 0,i))),node:e}:re(e,void 0,i),n}(e,r))})),s}function Ge(e,t){if(t=P.transformPossibleRecursiveTypeAlias(t),!k.isObject(t))return;const n=an(e,"tuple");if(!k.isObject(n))return;const i=[];if(P.isTupleClass(t.classType)&&t.classType.variadicTypeArguments)if(2===t.classType.variadicTypeArguments.length&&P.isEllipsisType(t.classType.variadicTypeArguments[1])){const n=P.transformPossibleRecursiveTypeAlias(t.classType.variadicTypeArguments[0]);for(let t=0;t<e.expressions.length;t++)i.push(n)}else t.classType.variadicTypeArguments.forEach((e=>{i.push(P.transformPossibleRecursiveTypeAlias(e))}));else{const s=new A.TypeVarMap(P.getTypeVarScopeId(n.classType));if(!Xe(n.classType,t,s,Ue(e)))return;const r=P.applySolvedTypeVars(n.classType,s);if(!r.typeArguments||1!==r.typeArguments.length)return;const o=P.transformPossibleRecursiveTypeAlias(r.typeArguments[0]);for(let t=0;t<e.expressions.length;t++)i.push(o)}const s=e.expressions.map(((e,t)=>re(e,t<i.length?i[t]:void 0))),r=i.some((e=>P.isLiteralType(e)));return{type:P.convertToInstance(Ke(n.classType,qe(s),!0,!r)),node:e}}function qe(e){let t=[];for(const n of e)if(n.unpackedType){if(!k.isObject(n.unpackedType)||!P.isTupleClass(n.unpackedType.classType)){t=[k.AnyType.create(!1),k.AnyType.create(!0)];break}{const e=n.unpackedType.classType.variadicTypeArguments;if(!e||e.some((e=>P.isEllipsisType(e)))){t=[k.AnyType.create(!1),k.AnyType.create(!0)];break}for(const n of e)t.push(n)}}else t.push(n.type);return t}function Ke(e,t,n=!0,i=!0){let s=k.AnyType.create(!1);return s=2===t.length&&P.isEllipsisType(t[1])?t[0]:k.combineTypes(t),i&&(s=P.stripLiteralValue(s)),k.isNever(s)&&(s=k.AnyType.create()),k.ClassType.cloneForSpecialization(e,[s],n,void 0,t)}function He(e,t,n){const i=e.details.mro.findIndex((e=>k.isClass(e)&&k.ClassType.isBuiltIn(e,"NamedTuple")));if(i<0||e.details.mro.length<i+2)return;const s=e.details.mro[i],r=e.details.mro[i+1];if(!k.isClass(r)||!P.isTupleClass(r))return;const o=Ke(r,t,n),a=k.ClassType.cloneForSpecialization(s,[],n);a.details=Object.assign({},a.details),a.details.mro=[...a.details.mro],a.details.mro[1]=o.details.mro[0],a.details.baseClasses=a.details.baseClasses.map((e=>k.isClass(e)&&P.isTupleClass(e)?o:e)),e.details.mro[i]=a,e.details.mro[i+1]=o,e.details.baseClasses=e.details.baseClasses.map((e=>k.isClass(e)&&k.ClassType.isBuiltIn(e,"NamedTuple")?a:e))}function Ye(e,t,n,i,s){let r;for(const o of n.overloads)if(k.FunctionType.isOverloaded(o)){const n=s?s.clone():new A.TypeVarMap(P.getTypeVarScopeId(o));if(n.addSolveForScope(P.getTypeVarScopeId(o)),pn(e,(()=>{tt(e,t,o,n,!0,i).argumentErrors||(r=o)})),r)break}return r}function Qe(e,t,n,i,s){let r,o=!1,a=!1;const p=e=>k.isFunction(e)&&k.FunctionType.isSkipConstructorCheck(e),d=ce(e,k.ObjectType.create(n),"__init__",{method:"get"},new l.DiagnosticAddendum,4);if(d&&!p(d)){if(s&&(r=P.mapSubtypes(s,(s=>{const r=new A.TypeVarMap(P.getTypeVarScopeId(n));if(Xe(n,s,r,Ue(e))&&!et(e,t,d,r,i,k.NoneType.createInstance()).argumentErrors)return Je(n,s,r)})),k.isNever(r)&&(r=void 0)),!r){const s=n.typeArguments?P.buildTypeVarMapFromSpecializedClass(n,!1):new A.TypeVarMap(P.getTypeVarScopeId(n));s.addSolveForScope(P.getTypeVarScopeId(d));const o=et(e,t,d,s,i);o.argumentErrors?a=!0:(o.overloadUsed&&o.overloadUsed.strippedFirstParamType&&k.isObject(o.overloadUsed.strippedFirstParamType)&&k.ClassType.isSameGenericClass(o.overloadUsed.strippedFirstParamType.classType,n)&&Pn(n,o.overloadUsed.strippedFirstParamType.classType,new l.DiagnosticAddendum,s),r=Ze(n,void 0,s))}o=!0,i=!0}if(!a){const c=je(e,n,"__new__",{method:"get"},new l.DiagnosticAddendum,21,n);if(c&&!p(c.type)){const l=c.type,p=new A.TypeVarMap(P.getTypeVarScopeId(n));if(l){const c=et(e,t,l,p,i);if(c.argumentErrors)a=!0;else{let e=c.returnType;e&&k.isObject(e)&&k.ClassType.isSameGenericClass(e.classType,n)&&((P.isPartlyUnknown(e)||P.requiresSpecialization(e))&&void 0!==r||(k.isObject(e)&&k.ClassType.isVariadicTypeParam(e.classType)&&e.classType.variadicTypeArguments&&1===e.classType.variadicTypeArguments.length&&(e=k.ObjectType.create(Ke(e.classType,[e.classType.variadicTypeArguments[0],k.AnyType.create(!0)]))),r=e))}r||(r=Ze(n,s,p)),o=!0}}}if(o||t.forEach((e=>{e.valueExpression&&!dn(e.valueExpression)&&re(e.valueExpression)})),!o&&t.length>0&&(n.details.effectiveMetaclass&&k.isClass(n.details.effectiveMetaclass)&&!k.ClassType.isBuiltIn(n.details.effectiveMetaclass)||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.constructorNoArgs().format({type:n.details.name}),e)),!r){const t=new A.TypeVarMap(P.getTypeVarScopeId(n));s&&Xe(n,s,t,Ue(e)),r=Ze(n,s,t)}return{argumentErrors:a,returnType:r}}function Je(e,t,n){const i=P.applySolvedTypeVars(k.ObjectType.create(e),n,!0);if(Pn(t,i,new l.DiagnosticAddendum))return 2===t.category?t:i}function Ze(e,t,n){if(t){const i=P.mapSubtypes(t,(t=>Je(e,t,n)));if(!k.isNever(i))return i}const i=P.applySolvedTypeVars(e,n,!0);return k.ObjectType.create(i)}function Xe(e,t,n,i){if(2===t.category)return e.details.typeParameters.forEach((e=>{n.setTypeVar(e,t,!1)})),!0;if(!k.isObject(t))return!1;const s=t.classType.typeArguments;if(!s)return Pn(e,t.classType,new l.DiagnosticAddendum,n);if(k.ClassType.isSameGenericClass(t.classType,e)){const e=P.buildTypeVarMapFromSpecializedClass(t.classType);return e.getTypeVars().forEach((t=>{n.setTypeVar(t.typeVar,t.type,e.isNarrowable(t.typeVar))})),!0}const r=P.getTypeVarScopeId(t.classType),o=k.ClassType.getTypeParameters(t.classType).map(((e,t)=>{const n=k.TypeVarType.createInstance(`__dest${t}`,!1,!0);return n.scopeId=r,n})),a=k.ClassType.cloneForSpecialization(t.classType,o,!0),c=k.ClassType.getTypeParameters(e).map(((e,t)=>{const n=k.TypeVarType.createInstance(`__source${t}`,!1,!0);return n.details.synthesizedIndex=t,n})),p=k.ClassType.cloneForSpecialization(e,c,!0),d=new A.TypeVarMap(r);return!!Pn(a,p,new l.DiagnosticAddendum,d)&&(o.forEach(((e,t)=>{const r=d.getTypeVar(e);if(r&&k.isTypeVar(r)&&r.details.isSynthesized&&void 0!==r.details.synthesizedIndex){const e=k.ClassType.getTypeParameters(p)[r.details.synthesizedIndex];if(t<s.length){const r=P.transformExpectedTypeForConstructor(s[t],n,i);r&&n.setTypeVar(e,r,!1)}}})),!0)}function et(e,t,n,i,s=!1,r){let o,d=!1;const m=P.mapSubtypes(n,(n=>{let m=!1;k.isObject(n)&&k.ClassType.isBuiltIn(n.classType,"Type")&&(n=ze(n),m=!0);const y=Ee(n);switch(y.category){case 1:case 2:return t.forEach((e=>{e.valueExpression&&!dn(e.valueExpression)&&sn(e)})),y;case 10:{const n=et(e,t,y,i,s,r);return n.argumentErrors&&(d=!0),n.overloadUsed&&(o=n.overloadUsed),n.returnType}case 5:{if("namedtuple"===y.details.builtInName)return Fe(un(e).diagnosticRuleSet.reportUntypedNamedTuple,c.DiagnosticRule.reportUntypedNamedTuple,h.Localizer.Diagnostic.namedTupleNoTypes(),e),ot(e,t,!1);if("NewType"===y.details.builtInName){const n=tt(e,t,y,new A.TypeVarMap(P.getTypeVarScopeId(y)),s,r);return n.argumentErrors?n.returnType:function(e,t){const n=un(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=rn(t[1],un(e));if(k.isClass(s)){const t=-4&s.details.flags,r=k.ClassType.create(i,rt(e,n.moduleName,i),n.moduleName,t,Bn(e),void 0,s.details.effectiveMetaclass);r.details.baseClasses.push(s),P.computeMroLinearization(r);const o=k.FunctionType.createInstance("__init__","",64);k.FunctionType.addParameter(o,{category:0,name:"self",type:k.ObjectType.create(r),hasDeclaredType:!0}),k.FunctionType.addParameter(o,{category:0,name:"_x",type:k.ObjectType.create(s),hasDeclaredType:!0}),o.details.declaredReturnType=k.NoneType.createInstance(),r.details.fields.set("__init__",C.Symbol.createWithType(4,o));const a=k.FunctionType.createInstance("__new__","",65);return k.FunctionType.addParameter(a,{category:0,name:"cls",type:r,hasDeclaredType:!0}),k.FunctionType.addDefaultParameters(a),a.details.declaredReturnType=k.ObjectType.create(r),r.details.fields.set("__new__",C.Symbol.createWithType(4,a)),r}}}(e,t)}const n=tt(e,t,y,i||new A.TypeVarMap(P.getTypeVarScopeId(y)),s,r);return n.argumentErrors&&(d=!0),"__import__"===y.details.builtInName?k.AnyType.create():n.returnType}case 6:{const n=Ye(e,t,y,r,i);if(n){if("cast"===n.details.builtInName&&2===t.length){const n=rn(t[0],un(e)),i=sn(t[1]);return k.isClass(n)&&k.isObject(i)&&k.isTypeSame(n,i.classType)&&Fe(un(e).diagnosticRuleSet.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryCast,h.Localizer.Diagnostic.unnecessaryCast().format({type:jn(i)}),e),P.convertToInstance(n)}const a=i||new A.TypeVarMap(P.getTypeVarScopeId(y));a.addSolveForScope(P.getTypeVarScopeId(n));const l=tt(e,t,n,a,s,r);return o=n,l.argumentErrors&&(d=!0),l.returnType||k.UnknownType.create()}if(!xe(e)){const n=v.printExpression(e),i=new l.DiagnosticAddendum,s=t.map((e=>jn(sn(e))));9!==e.nodeType&&y.overloads[0].details.name&&i.addMessage(h.Localizer.DiagnosticAddendum.overloadCallName().format({name:y.overloads[0].details.name})),i.addMessage(h.Localizer.DiagnosticAddendum.argumentTypes().format({types:s.join(", ")})),Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.noOverload().format({expression:n})+i.getString(),e)}return d=!0,k.UnknownType.create()}case 7:{if(k.ClassType.isBuiltIn(y)){const n=y.aliasName||y.details.name;if("type"===n){if(Qe(e,t,y,s,r),1===t.length){const n=sn(t[0]);if(k.isObject(n)||k.isTypeVar(n)&&k.TypeBase.isInstance(n)){const t=_e(e,"Type");return t&&k.isClass(t)?k.ObjectType.create(k.ClassType.cloneForSpecialization(t,[P.stripLiteralValue(n)],!0)):k.ObjectType.create(y)}}else if(t.length>=2)return function(e,t){const n=un(e),i=sn(t[0]);if(!k.isObject(i)||!k.ClassType.isBuiltIn(i.classType,"str"))return;const s=i.classType.literalValue||"_",r=sn(t[1]);if(!k.isObject(r)||!P.isTupleClass(r.classType)||void 0===r.classType.variadicTypeArguments)return;const o=k.ClassType.create(s,rt(e,n.moduleName,s),n.moduleName,0,Bn(e),void 0,r.classType.details.effectiveMetaclass);return r.classType.variadicTypeArguments.forEach((n=>{k.isClass(n)||k.isAnyOrUnknown(n)?o.details.baseClasses.push(n):ke(n,t[1].valueExpression||e)})),P.computeMroLinearization(o)||Ie(h.Localizer.Diagnostic.methodOrdering(),e),o}(e,t)||k.AnyType.create();return k.AnyType.create()}if("TypeVar"===n)return it(e,t,!1);if("ParamSpec"===n)return it(e,t,!0);if("NamedTuple"===n)return ot(e,t,!0);if("Protocol"===n||"Generic"===n||"Callable"===n||"Concatenate"===n||"Type"===n)return Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotIntantiable().format({type:n}),e),k.AnyType.create();if("Enum"===n||"IntEnum"===n||"Flag"===n||"IntFlag"===n)return function(e,t,n){const i=un(e);let s="enum";if(0===n.length)return;{const e=n[0];if(0!==e.argumentCategory||!e.valueExpression||48!==e.valueExpression.nodeType)return;s=e.valueExpression.strings.map((e=>e.value)).join("")}const r=k.ClassType.create(s,rt(e,i.moduleName,s),i.moduleName,1048576,Bn(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),P.computeMroLinearization(r);const o=r.details.fields;if(o.set("__class__",C.Symbol.createWithType(68,r)),!(n.length<2)){{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=k.UnknownType.create(),s=C.Symbol.createWithType(4,i),r=t.valueExpression;a.assert(48===r.nodeType);const l=un(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),o.set(n,s)}}))}return r}}(e,y,t);if("TypedDict"===n)return function(e,t,n){const i=un(e);let s="TypedDict";if(0===n.length)Ie(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(""):Ie(h.Localizer.Diagnostic.typedDictFirstArg(),n[0].valueExpression||e)}const r=k.ClassType.create(s,rt(e,i.moduleName,s),i.moduleName,128,Bn(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),P.computeMroLinearization(r);const o=r.details.fields;o.set("__class__",C.Symbol.createWithType(68,r));let a=!1;if(n.length<2)Ie(h.Localizer.Diagnostic.typedDictSecondArgDict(),e);else{const t=n[1],s=new Map;if(0===t.argumentCategory&&t.valueExpression&&15===t.valueExpression.nodeType)a=!0,t.valueExpression.entries.forEach((e=>{if(17!==e.nodeType)return void Ie(h.Localizer.Diagnostic.typedDictSecondArgDictEntry(),e);if(48!==e.keyExpression.nodeType)return void Ie(h.Localizer.Diagnostic.typedDictEntryName(),e.keyExpression);const t=e.keyExpression.strings.map((e=>e.value)).join("");if(!t)return void Ie(h.Localizer.Diagnostic.typedDictEmptyName(),e.keyExpression);if(s.has(t))return void Ie(h.Localizer.Diagnostic.typedDictEntryUnique(),e.keyExpression);s.set(t,!0),ae(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),o.set(t,n)}));else if(t.name)for(let t=1;t<n.length;t++){const i=n[t];if(!i.name||!i.valueExpression)continue;if(s.has(i.name.value)){Ie(h.Localizer.Diagnostic.typedDictEntryUnique(),i.valueExpression);continue}s.set(i.name.value,!0),ae(i.valueExpression,!0);const r=new C.Symbol(8),a=un(e),l={type:1,node:i.name,path:a.filePath,typeAnnotationNode:i.valueExpression,range:p.convertOffsetsToRange(i.name.start,u.TextRange.getEnd(i.valueExpression),a.lines),moduleName:a.moduleName};r.addDeclaration(l),o.set(i.name.value,r)}else Ie(h.Localizer.Diagnostic.typedDictSecondArgDict(),e)}return a&&(n.length>=3&&(!n[2].name||"total"!==n[2].name.value||!n[2].valueExpression||11!==n[2].valueExpression.nodeType||14!==n[2].valueExpression.constType&&31!==n[2].valueExpression.constType?Ie(h.Localizer.Diagnostic.typedDictTotalParam(),n[2].valueExpression||e):14===n[2].valueExpression.constType&&(r.details.flags|=256)),n.length>3&&Ie(h.Localizer.Diagnostic.typedDictExtraArgs(),n[3].valueExpression||e)),fe(e,r),r}(e,y,t);if("auto"===n&&0===t.length)return an(e,"int")}if(!m&&k.ClassType.hasAbstractMethods(y)){const t=Rn(y),n=new l.DiagnosticAddendum,i=2;t.forEach(((e,s)=>{if(s===i)n.addMessage(h.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:t.length-i}));else if(s<i&&k.isClass(e.classType)){const t=e.classType.details.name;n.addMessage(h.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAbstract().format({type:y.details.name})+n.getString(),e)}if(!m&&k.ClassType.hasAbstractMethods(y)){const t=Rn(y),n=new l.DiagnosticAddendum,i=2;t.forEach(((e,s)=>{if(s===i)n.addMessage(h.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:t.length-i}));else if(s<i&&k.isClass(e.classType)){const t=e.classType.details.name;n.addMessage(h.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAbstract().format({type:y.details.name})+n.getString(),e)}const i=Qe(e,t,y,s,r);i.argumentErrors&&(d=!0);let o=i.returnType;if(k.isTypeVar(n)&&!n.details.isSynthesized&&(o=P.convertToInstance(n)),o&&k.isObject(o)&&o.classType.details.mro.some((e=>k.isClass(e)&&k.ClassType.isBuiltIn(e,"type")))){const t="__class_"+o.classType.details.name,n=k.ClassType.create(t,"","",0,Bn(e),o.classType,o.classType);return n.details.baseClasses.push(on(e,"object")),P.computeMroLinearization(n),n}return o}case 8:{const o=ce(e,y,"__call__",{method:"get"},new l.DiagnosticAddendum,0);if(o&&(k.isFunction(o)||k.isOverloadedFunction(o))){const n=et(e,t,o,i,s,r);return n.argumentErrors&&(d=!0),n.returnType||k.UnknownType.create()}return Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.objectNotCallable().format({type:jn(n)}),e),k.UnknownType.create()}case 3:return void Fe(un(e).diagnosticRuleSet.reportOptionalCall,c.DiagnosticRule.reportOptionalCall,h.Localizer.Diagnostic.noneNotCallable(),e)}}));return{argumentErrors:d,returnType:k.isNever(m)?void 0:m,overloadUsed:o}}function tt(e,t,n,i,s=!1,r){let o=0;const p=n.details.parameters;n.boundTypeVarScopeId&&i.addSolveForScope(n.boundTypeVarScopeId),r&&!P.requiresSpecialization(r)&&n.details.declaredReturnType&&10!==r.category&&Pn(vn(n),r,new l.DiagnosticAddendum,i,4);const d=p.find((e=>2===e.category));let u=!1;const m=new Map;p.forEach((e=>{e.name&&m.set(e.name,{argsNeeded:0!==e.category||e.hasDefault?0:1,argsReceived:0})}));let y=p.findIndex((e=>1===e.category&&!e.name));const g=p.findIndex((e=>0===e.category&&!e.name));y<0&&(y=p.findIndex((e=>1===e.category)),y>=0&&y++),y<0&&(y=p.findIndex((e=>2===e.category))),y<0&&(y=p.length);let f=t.findIndex((e=>2===e.argumentCategory||void 0!==e.name));if(f<0&&(f=t.length),g>=0&&f<g){const e=p.findIndex((e=>e.hasDefault)),n=e>=0&&e<g?e:g;f=Math.min(n,t.length)}const _=[];let T;function v(e,t){e.active&&(T=t)}let b=void 0!==t.find((e=>1===e.argumentCategory)),S=0,C=0;for(;o<f;){if(S===g){S++;continue}if(o<g&&t[o].name&&(Fe(un(t[o].name).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.argPositional(),t[o].name),u=!0),S>=y){if(!b||1!==t[o].argumentCategory){const n=y;Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===n?h.Localizer.Diagnostic.argPositionalExpectedOne():h.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:n}),t[o].valueExpression||e),u=!0}break}const i=k.FunctionType.getEffectiveParameterType(n,S);if(1===t[o].argumentCategory){if(!t[o].valueExpression)break;const n=sn(t[o]);let s,r=!1;k.isObject(n)&&P.isTupleClass(n.classType)&&n.classType.variadicTypeArguments&&n.classType.variadicTypeArguments.length>0&&!P.isEllipsisType(n.classType.variadicTypeArguments[n.classType.variadicTypeArguments.length-1])?(s=n.classType.variadicTypeArguments[C],b=void 0!==t.find(((e,t)=>t>o&&1===e.argumentCategory)),C++,C>=n.classType.variadicTypeArguments.length&&(C=0,r=!0)):s=ge(n,!1,t[o].valueExpression);const a={argumentCategory:0,type:s},l=p[S].name;_.push({paramType:i,requiresTypeVarMatching:P.requiresSpecialization(i),argument:a,errorNode:t[o].valueExpression||e,paramName:p[S].isNameSynthesized?void 0:l}),v(t[o],p[S]),l&&m.get(l).argsReceived++,(r||1===p[S].category)&&o++,1!==p[S].category&&S++}else if(1===p[S].category)_.push({paramType:i,requiresTypeVarMatching:P.requiresSpecialization(i),argument:t[o],errorNode:t[o].valueExpression||e,paramName:p[S].name}),v(t[o],p[S]),o++;else{const n=p[S].name;_.push({paramType:i,requiresTypeVarMatching:P.requiresSpecialization(i),argument:t[o],errorNode:t[o].valueExpression||e,paramName:p[S].isNameSynthesized?void 0:n}),v(t[o],p[S]),n&&m.get(n).argsReceived++,o++,S++}}if(!u){let i=!1;for(;o<t.length;){if(2===t[o].argumentCategory)sn(t[o]),i=!0;else{const i=t[o].name;if(i){const s=i.value,r=m.get(s);if(r)if(r.argsReceived>0)Fe(un(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramAlreadyAssigned().format({name:s}),i),u=!0;else{m.get(i.value).argsReceived++;const r=p.findIndex((e=>e.name===s));a.assert(r>=0);const l=k.FunctionType.getEffectiveParameterType(n,r);_.push({paramType:l,requiresTypeVarMatching:P.requiresSpecialization(l),argument:t[o],errorNode:t[o].valueExpression||e,paramName:s}),v(t[o],p[r])}else if(d){const i=p.findIndex((e=>2===e.category));a.assert(i>=0);const r=k.FunctionType.getEffectiveParameterType(n,i);_.push({paramType:r,requiresTypeVarMatching:P.requiresSpecialization(d.type),argument:t[o],errorNode:t[o].valueExpression||e,paramName:s}),v(t[o],d)}else Fe(un(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramNameMissing().format({name:i.value}),i),u=!0}}o++}if(!i&&!b&&!k.FunctionType.isDefaultParameterCheckDisabled(n)){const t=[...m.keys()].filter((e=>{const t=m.get(e);return t.argsReceived<t.argsNeeded}));if(t.length>0){const n=t.map((e=>`"${e}"`)).join(", ");Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===t.length?h.Localizer.Diagnostic.argMissingForParam().format({name:n}):h.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),u=!0}p.forEach(((t,i)=>{if(0===t.category&&t.name){const s=m.get(t.name);if(0===s.argsNeeded&&0===s.argsReceived){const s=k.FunctionType.getEffectiveParameterType(n,i);t.defaultType&&P.requiresSpecialization(s)&&_.push({paramType:s,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:t.defaultType},errorNode:e,paramName:t.isNameSynthesized?void 0:t.name})}}}))}}if(["cast","isinstance","issubclass"].some((e=>e===n.details.builtInName))&&(s=!0),!u||!dn(void 0)){const r=_.filter((e=>e.requiresTypeVarMatching)).length;if(r>0){const t=Math.min(r,2);for(let r=0;r<t;r++)pn(e,(()=>{_.forEach((e=>{e.requiresTypeVarMatching&&nt(e,i,n.details.name,s)}))}));i.lock()}_.forEach((e=>{nt(e,i,n.details.name,s)||(u=!0)})),V.isUndoTrackingEnabled()||t.forEach((e=>{e.valueExpression&&!dn(e.valueExpression)&&(_.some((t=>t.argument===e))||re(e.valueExpression))}))}const I=vn(n,_,!u),D=P.applySolvedTypeVars(I,i);return{argumentErrors:u,returnType:D,activeParam:T}}function nt(e,t,n,i){let s,r;if(e.argument.valueExpression){let n=P.applySolvedTypeVars(e.paramType,t);k.isUnknown(n)&&(n=void 0);const i=re(e.argument.valueExpression,n);s=i.type,r=i.expectedTypeDiagAddendum,e.argument&&e.argument.name&&!dn(e.errorNode)&&Q(e.argument.name,n||s)}else s=sn(e.argument);let o=new l.DiagnosticAddendum;if(!Pn(e.paramType,s,o.createAddendum(),t)){if(!xe(e.errorNode)){const t=un(e.errorNode),i=jn(s),a=jn(e.paramType);let l;l=e.paramName?n?h.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:i,paramType:a,functionName:n,paramName:e.paramName}):h.Localizer.Diagnostic.argAssignmentParam().format({argType:i,paramType:a,paramName:e.paramName}):n?h.Localizer.Diagnostic.argAssignmentFunction().format({argType:i,paramType:a,functionName:n}):h.Localizer.Diagnostic.argAssignment().format({argType:i,paramType:a}),r&&(o=r),Fe(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,l+o.getString(),e.errorNode)}return!1}if(!i){const t=k.removeUnbound(s),i=un(e.errorNode),r=new l.DiagnosticAddendum;e.paramName&&r.addMessage((n?h.Localizer.DiagnosticAddendum.argParamFunction().format({paramName:e.paramName,functionName:n}):h.Localizer.DiagnosticAddendum.argParam().format({paramName:e.paramName}))+r.getString()),k.isUnknown(t)?Fe(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,h.Localizer.Diagnostic.argTypeUnknown()+r.getString(),e.errorNode):P.isPartlyUnknown(t,!0)&&(P.isPartlyUnknown(e.paramType)||k.isClass(t)||(r.addMessage(h.Localizer.DiagnosticAddendum.argumentType().format({type:jn(t,!0)})),Fe(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,h.Localizer.Diagnostic.argTypePartiallyUnknown()+r.getString(),e.errorNode)))}return!0}function it(e,t,n){var i;let s,r="";if(n){const t=un(e);!t.isStubFile&&t.executionEnvironment.pythonVersion<d.PythonVersion.V3_9&&Ie(h.Localizer.Diagnostic.paramSpecIllegal(),e)}if(0===t.length)return void Ie(n?h.Localizer.Diagnostic.paramSpecFirstArg():h.Localizer.Diagnostic.typeVarFirstArg(),e);const o=t[0];o.valueExpression&&48===o.valueExpression.nodeType?r=o.valueExpression.strings.map((e=>e.value)).join(""):Ie(n?h.Localizer.Diagnostic.paramSpecFirstArg():h.Localizer.Diagnostic.typeVarFirstArg(),o.valueExpression||e);const a=k.TypeVarType.createInstantiable(r,n);for(let r=1;r<t.length;r++){const o=t[r].name,l=o?o.value:void 0,c=new Map;if(l){if(c.get(l)&&Ie(h.Localizer.Diagnostic.duplicateParam().format({name:l}),t[r].valueExpression||e),"bound"!==l||n)"covariant"!==l||n?"contravariant"!==l||n?Ie(n?h.Localizer.Diagnostic.paramSpecUnknownParam().format({name:l}):h.Localizer.Diagnostic.typeVarUnknownParam().format({name:l}),(null===(i=t[r].node)||void 0===i?void 0:i.name)||t[r].valueExpression||e):t[r].valueExpression&&st(t[r].valueExpression)&&(1===a.details.variance?Ie(h.Localizer.Diagnostic.typeVarVariance(),t[r].valueExpression):a.details.variance=2):t[r].valueExpression&&st(t[r].valueExpression)&&(2===a.details.variance?Ie(h.Localizer.Diagnostic.typeVarVariance(),t[r].valueExpression):a.details.variance=1);else if(a.details.constraints.length>0)Ie(h.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[r].valueExpression||e);else{const n=rn(t[r],un(e));P.requiresSpecialization(n)&&Ie(h.Localizer.Diagnostic.typeVarGeneric(),t[r].valueExpression||e),a.details.boundType=P.convertToInstance(n)}c.set(l,l)}else{if(n){Ie(h.Localizer.Diagnostic.paramSpecUnknownArg(),t[r].valueExpression||e);break}if(a.details.boundType)Ie(h.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[r].valueExpression||e);else{const n=rn(t[r],un(e));P.requiresSpecialization(n)&&Ie(h.Localizer.Diagnostic.typeVarGeneric(),t[r].valueExpression||e),k.TypeVarType.addConstraint(a,P.convertToInstance(n)),void 0===s&&(s=t[r])}}}return!n&&1===a.details.constraints.length&&s&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarSingleConstraint(),s.valueExpression||e),a}function st(e){if(11===e.nodeType){if(14===e.constType)return!1;if(31===e.constType)return!0}return Ie(h.Localizer.Diagnostic.expectedBoolLiteral(),e),!1}function rt(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 ot(e,t,n){const i=un(e);let s="namedtuple";if(0===t.length)Ie(h.Localizer.Diagnostic.namedTupleFirstArg(),e);else{const n=t[0];0!==n.argumentCategory?Ie(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=_e(e,"NamedTuple")||k.UnknownType.create(),o=k.ClassType.create(s,rt(e,i.moduleName,s),i.moduleName,0,Bn(e),void 0,k.isClass(r)?r.details.effectiveMetaclass:k.UnknownType.create());o.details.baseClasses.push(r);const a=o.details.fields;a.set("__class__",C.Symbol.createWithType(68,o));const l=k.FunctionType.createInstance("__new__","",65);l.details.declaredReturnType=k.ObjectType.create(o),v.isAssignmentToDefaultsFollowingNamedTuple(e)&&(l.details.flags|=32),k.FunctionType.addParameter(l,{category:0,name:"cls",type:o,hasDeclaredType:!0});const c={category:0,name:"self",type:k.ObjectType.create(o),hasDeclaredType:!0};let d=!1;const m=[];if(t.length<2)Ie(h.Localizer.Diagnostic.namedTupleSecondArg(),e),d=!0;else{const e=t[1];if(0!==e.argumentCategory)d=!0;else if(!n&&e.valueExpression&&48===e.valueExpression.nodeType)e.valueExpression.strings.map((e=>e.value)).join("").split(/[,\s]+/).forEach((t=>{if(t=t.trim()){const s=k.UnknownType.create(),r={category:0,name:t,type:s,hasDeclaredType:n};k.FunctionType.addParameter(l,r);const o=C.Symbol.createWithType(8,s),c=e.valueExpression,d={type:1,node:c,path:i.filePath,range:p.convertOffsetsToRange(c.start,u.TextRange.getEnd(c),i.lines),moduleName:i.moduleName};o.addDeclaration(d),a.set(t,o),m.push(s)}}));else if(e.valueExpression&&31===e.valueExpression.nodeType){const t=e.valueExpression,s=new Map;t.entries.forEach(((e,t)=>{let r,o,c,d="";if(n)if(52===e.nodeType&&2===e.expressions.length){c=e.expressions[0],r=e.expressions[1];const t=re(r,void 0,104);t&&(o=P.convertToInstance(t.type))}else Ie(h.Localizer.Diagnostic.namedTupleNameType(),e);else c=e,o=k.UnknownType.create();c&&48===c.nodeType?(d=c.strings.map((e=>e.value)).join(""),d||Ie(h.Localizer.Diagnostic.namedTupleEmptyName(),c)):Ie(h.Localizer.Diagnostic.namedTupleNameString(),c||e),d||(d=`_${t.toString()}`),s.has(d)&&Ie(h.Localizer.Diagnostic.namedTupleNameUnique(),c||e),s.set(d,d),o||(o=k.UnknownType.create());const y={category:0,name:d,type:o,hasDeclaredType:n};k.FunctionType.addParameter(l,y),m.push(o);const g=C.Symbol.createWithType(8,o);if(c&&48===c.nodeType){const e={type:1,node:c,path:i.filePath,typeAnnotationNode:r,range:p.convertOffsetsToRange(c.start,u.TextRange.getEnd(c),i.lines),moduleName:i.moduleName};g.addDeclaration(e)}a.set(d,g)}))}else d=!0}d&&(k.FunctionType.addDefaultParameters(l),m.push(k.AnyType.create(!1)),m.push(k.AnyType.create(!0)));const y=k.FunctionType.createInstance("__init__","",192);k.FunctionType.addParameter(y,c),k.FunctionType.addDefaultParameters(y),y.details.declaredReturnType=k.NoneType.createInstance(),a.set("__new__",C.Symbol.createWithType(4,l)),a.set("__init__",C.Symbol.createWithType(4,y));const g=k.FunctionType.createInstance("keys","",64),f=k.FunctionType.createInstance("items","",64);g.details.declaredReturnType=an(e,"list",[an(e,"str")]),f.details.declaredReturnType=g.details.declaredReturnType,a.set("keys",C.Symbol.createWithType(8,g)),a.set("items",C.Symbol.createWithType(8,f));const _=k.FunctionType.createInstance("__len__","",64);if(_.details.declaredReturnType=an(e,"int"),k.FunctionType.addParameter(_,c),a.set("__len__",C.Symbol.createWithType(4,_)),d){const t=k.FunctionType.createInstance("__getattribute__","",64);t.details.declaredReturnType=k.AnyType.create(),k.FunctionType.addParameter(t,c),k.FunctionType.addParameter(t,{category:0,name:"name",type:an(e,"str")}),a.set("__getattribute__",C.Symbol.createWithType(4,t))}return P.computeMroLinearization(o),He(o,m,!d),o}function at(e,t,n){const i=e.leftExpression;let s=e.rightExpression;E[e.operator]&&E[e.operator][2]&&7===s.nodeType&&!s.parenthesized&&E[s.operator]&&E[s.operator][2]&&(at(s,t,n),s=s.leftExpression);const r=37===e.operator||36===e.operator?t:void 0;let o=re(i,r,n).type,a=re(s,r,n).type;if(6===e.operator&&!lt(o,"__or__")&&!lt(a,"__ror__")){let t=a;if(!k.isNone(o)&&k.isNone(a)&&k.TypeBase.isInstance(a)&&(t=k.NoneType.createType()),k.isUnionableType([o,t])){const i=un(e);return i.isStubFile||0!=(4&n)||i.executionEnvironment.pythonVersion>=d.PythonVersion.V3_10||Ie(h.Localizer.Diagnostic.unionSyntaxIllegal(),e,e.operatorToken),{type:k.combineTypes([o,t]),node:e}}}return void 0===w[e.operator]&&(P.isOptionalType(o)&&(12!==e.operator&&28!==e.operator&&Fe(un(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,h.Localizer.Diagnostic.noneOperator().format({operator:v.printOperator(e.operator)}),e.leftExpression),o=k.removeNoneFromUnion(o)),12!==e.operator&&28!==e.operator||(a=k.removeNoneFromUnion(a))),{type:pt(e.operator,o,a,e,t),node:e}}function lt(e,t){if(!k.isClass(e))return!1;const n=e.details.effectiveMetaclass;return!(!n||!k.isClass(n))&&(!k.ClassType.isBuiltIn(n,"type")&&!!P.lookUpClassMember(n,t))}function ct(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=re(e.leftExpression).type,r=re(e.rightExpression).type;return i=we(s,void 0,((i,s,o)=>we(r,o,((r,o)=>{if(k.isAnyOrUnknown(s)||k.isAnyOrUnknown(o))return k.isUnknown(s)||k.isUnknown(o)?k.UnknownType.create():k.AnyType.create();const a=n[e.operator][0];let l=dt(i,[o],a,e,t);return l||o===r||(l=dt(i,[r],a,e,t)),l})))),(!i||k.isNever(i))&&(i=pt(n[e.operator][1],s,r,e,t)),i}function pt(e,t,n,i,s){let r;const o=new l.DiagnosticAddendum;let a=Ee(t);if(w[e]){if(36===e){if(!P.canBeTruthy(a))return t;if(!P.canBeFalsy(a))return n;a=P.removeTruthinessFromType(a)}else if(37===e){if(!P.canBeFalsy(a))return t;if(!P.canBeTruthy(a))return n;a=P.removeFalsinessFromType(a)}41===e||42===e?(r=we(n,void 0,((s,r,c)=>we(a,c,(a=>{if(k.isAnyOrUnknown(a)||k.isAnyOrUnknown(r))return k.isUnknown(a)||k.isUnknown(r)?k.UnknownType.create():k.AnyType.create();let c=dt(s,[a],"__contains__",i,void 0);if(!c){const e=ge(s,!1,void 0);e&&Pn(e,a,new l.DiagnosticAddendum)&&(c=an(i,"bool"))}return c||o.addMessage(h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e),leftType:jn(t),rightType:jn(n)})),c})))),r&&!k.isNever(r)&&(r=an(i,"bool"))):r=we(a,void 0,((t,s,r)=>we(n,r,((t,n)=>36===e||37===e?k.combineTypes([s,n]):an(i,"bool")))))}else E[e]&&(r=we(t,void 0,((r,a,l)=>we(n,l,((l,c)=>{if(k.isAnyOrUnknown(a)||k.isAnyOrUnknown(c))return k.isUnknown(a)||k.isUnknown(c)?k.UnknownType.create():k.AnyType.create();const p=E[e][0];let d=dt(r,[c],p,i,s);if(d||c===l||(d=dt(r,[l],p,i,s)),!d){const t=E[e][1];d=dt(l,[a],t,i,s),d||a===r||(d=dt(l,[r],t,i,s))}return d||o.addMessage(h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e),leftType:jn(t),rightType:jn(n)})),d})))));return o.isEmpty()&&r&&!k.isNever(r)||(Fe(un(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:v.printOperator(e),leftType:jn(t),rightType:jn(n)})+o.getString(),i),r=k.UnknownType.create()),r}function dt(e,t,n,i,s){let r=!0;const o=e=>{let o;if(o=k.isObject(e)?ce(i,e,n,{method:"get"},new l.DiagnosticAddendum):pe(i,e,n,{method:"get"},new l.DiagnosticAddendum,32),o){const e=t.map((e=>({argumentCategory:0,type:e})));let n;return cn((()=>{n=et(i,e,o,new A.TypeVarMap(P.getTypeVarScopeId(o)),!0,s)})),n.argumentErrors&&(r=!1),n.returnType}r=!1},a=P.mapSubtypes(e,(e=>{if(k.isAnyOrUnknown(e))return e;if(k.isObject(e)||k.isClass(e))return o(e);if(k.isNone(e)){const e=an(i,"object");if(k.isObject(e))return o(e)}r=!1}));if(r)return a}function ut(e,t,n){const i=[],s=[];if(!k.isObject(t))return;if(k.ClassType.isTypedDictClass(t.classType))return ht(e,i,s,!!t,void 0,void 0,Mn(t.classType)),k.ClassType.isTypedDictClass(t.classType)&&function(e,t,n,i){a.assert(k.ClassType.isTypedDictClass(e)),a.assert(t.length===n.length);let s=!0;const r=Mn(e);return t.forEach(((t,o)=>{if(k.isObject(t)&&k.ClassType.isBuiltIn(t.classType,"str")&&void 0!==t.classType.literalValue){const a=t.classType.literalValue,c=r.get(a);if(c){const e=new l.DiagnosticAddendum;Pn(c.valueType,n[o],e)||(i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldTypeMismatch().format({name:t.classType.literalValue,type:jn(n[o])})),s=!1),c.isProvided=!0}else s=!1,i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldUndefined().format({name:t.classType.literalValue,type:jn(k.ObjectType.create(e))}))}else s=!1})),!!s&&(r.forEach(((t,n)=>{t.isRequired&&!t.isProvided&&(i.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:n,type:jn(k.ObjectType.create(e))})),s=!1)})),s)}(t.classType,i,s,n)?{type:t,node:e}:void 0;const r=an(e,"dict");if(!k.isObject(r))return;const o=new A.TypeVarMap(P.getTypeVarScopeId(r.classType));if(!Xe(r.classType,t,o,Ue(e)))return;const c=P.applySolvedTypeVars(r.classType,o);if(!c.typeArguments||2!==c.typeArguments.length)return;const p=c.typeArguments[0],d=c.typeArguments[1];ht(e,i,s,!!t,p,d);const u=k.isObject(t)&&k.ClassType.isBuiltIn(t.classType,"dict"),m=yt(p,i,!1),y=yt(d,s,!u);return m&&y?{type:an(e,"dict",[m,y]),node:e}:void 0}function ht(e,t,n,i,s,r,o){e.entries.forEach(((a,p)=>{let d=!0;if(17===a.nodeType){let e,c=re(a.keyExpression,s).type;if(s){const e=Ee(s);k.isAnyOrUnknown(e)||Pn(e,c,new l.DiagnosticAddendum,void 0)&&(c=e)}e=o&&k.isObject(c)&&k.ClassType.isBuiltIn(c.classType,"str")&&c.classType.literalValue&&o.has(c.classType.literalValue)?re(a.valueExpression,o.get(c.classType.literalValue).valueType).type:re(a.valueExpression,r).type,(!i||p<R)&&(t.push(c),n.push(e)),d=!1}else if(16===a.nodeType){const s=re(a.expandExpression).type;if(k.isAnyOrUnknown(s))d=!1;else{const r=_e(e,"Mapping");if(r&&k.isClass(r)){const o=new A.TypeVarMap(P.getTypeVarScopeId(r));if(Pn(k.ObjectType.create(r),s,new l.DiagnosticAddendum,o)){const e=P.applySolvedTypeVars(r,o).typeArguments;e&&e.length>=2&&((!i||p<R)&&(t.push(e[0]),n.push(e[1])),d=!1)}else Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.dictUnpackIsNotMapping(),a)}}}else if(32===a.nodeType){const e=ft(a);if(k.isObject(e)){const s=e.classType;if(P.isTupleClass(s)){const e=s.variadicTypeArguments;e&&2===e.length&&((!i||p<R)&&(t.push(e[0]),n.push(e[1])),d=!1)}}}d&&(!i||p<R)&&(t.push(k.UnknownType.create()),n.push(k.UnknownType.create()))}))}function mt(e,t){if(t=P.transformPossibleRecursiveTypeAlias(t),!k.isObject(t))return;const n=an(e,"list");if(!k.isObject(n))return;const i=new A.TypeVarMap(P.getTypeVarScopeId(n.classType));if(!Xe(n.classType,t,i,Ue(e)))return;const s=P.applySolvedTypeVars(n.classType,i);if(!s.typeArguments||1!==s.typeArguments.length)return;const r=s.typeArguments[0],o=[];e.entries.forEach((e=>{32===e.nodeType?o.push(ft(e,r)):o.push(re(e,r).type)}));const a=k.isObject(t)&&k.ClassType.isBuiltIn(t.classType,"list"),l=yt(r,o,!a);return l?{type:an(e,"list",[l]),node:e}:void 0}function yt(e,t,n){const i=new l.DiagnosticAddendum,s=k.TypeVarType.createInstance("__typeArg",!1,!0);s.details.boundType=e;const r="__typeArgScopeId";s.scopeId=r;let o=new A.TypeVarMap(r);if(o.setTypeVar(s,e,n),!t.some((e=>!Pn(s,P.stripLiteralValue(e),i,o)))||(o=new A.TypeVarMap(r),o.setTypeVar(s,e,n),!t.some((e=>!Pn(s,e,i,o)))))return P.applySolvedTypeVars(s,o)}function gt(e,t,n,i,s){if("none"===e)return;const r=n.value,o=k.removeUnbound(i);if(k.isUnknown(o))Fe(e,t,h.Localizer.Diagnostic.typeUnknown().format({name:r}),s);else if(P.isPartlyUnknown(o)){const n=new l.DiagnosticAddendum;n.addMessage(h.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:r,type:jn(o,!0)})),Fe(e,t,h.Localizer.Diagnostic.typePartiallyUnknown().format({name:r})+n.getString(),s)}}function ft(e,t){for(const t of e.comprehensions)if(33===t.nodeType){const e=ge(P.stripLiteralValue(re(t.iterableExpression).type),!!t.isAsync,t.iterableExpression);Ne(t.targetExpression,e,t.iterableExpression)}else a.assert(34===t.nodeType),dn(t.testExpression)||re(t.testExpression);let n=k.UnknownType.create();if(17===e.expression.nodeType){const t=P.stripLiteralValue(re(e.expression.keyExpression).type),i=P.stripLiteralValue(re(e.expression.valueExpression).type);n=on(e,"tuple"),k.isClass(n)&&(n=P.convertToInstance(Ke(n,[t,i])))}else 16===e.expression.nodeType?re(e.expression.expandExpression):m.isExpressionNode(e)&&(n=P.stripLiteralValue(re(e.expression,t).type));return n}function _t(e,t,n){const i=an(e,t);return k.isObject(i)?k.ObjectType.create(k.ClassType.cloneWithLiteral(i.classType,n)):k.UnknownType.create()}function Tt(e,t,n){const i=an(e,t);return k.isObject(i)?k.ClassType.cloneWithLiteral(i.classType,n):k.UnknownType.create()}function vt(e,t,n,i=!1){const s=k.ClassType.isVariadicTypeParam(e);t&&(t.forEach(((e,n)=>{P.isEllipsisType(e.type)?s?2===t.length&&1===n||Ie(h.Localizer.Diagnostic.ellipsisSecondArg(),e.node):Ie(h.Localizer.Diagnostic.ellipsisContext(),e.node):k.isModule(e.type)?Ie(h.Localizer.Diagnostic.moduleContext(),e.node):!i&&P.isParamSpecType(e.type)&&Ie(h.Localizer.Diagnostic.paramSpecContext(),e.node)})),s&&1===t.length&&k.isObject(t[0].type)&&P.isTupleClass(t[0].type.classType)&&t[0].type.classType.variadicTypeArguments&&0===t[0].type.classType.variadicTypeArguments.length&&(t=[]));let r=t?t.map((e=>P.convertToInstance(e.type))):[];if(void 0!==n)if(t&&r.length>n)Ie(h.Localizer.Diagnostic.typeArgsTooMany().format({name:e.details.name,expected:n,received:r.length}),t[n].node),r=r.slice(0,n);else if(r.length<n)for(;r.length<n;)r.push(k.UnknownType.create());return s?(t||(r.push(k.AnyType.create(!1)),r.push(k.AnyType.create(!0))),Ke(e,r,void 0!==t)):k.ClassType.cloneForSpecialization(e,r,void 0!==t)}function bt(e,t){const n=v.getEnclosingClass(e,!0);if(n){const i=xt(n);if(i&&k.ClassType.isEnumClass(i.classType)){if(k.ClassType.isBuiltIn(i.classType)){const e=i.classType.details.name;if(["Enum","IntEnum","Flag","IntFlag"].find((t=>t===e)))return t}return k.ObjectType.create(k.ClassType.cloneWithLiteral(i.classType,new k.EnumLiteral(i.classType.details.name,e.value)))}}return t}function St(e,t){if(!k.TypeBase.isInstantiable(e))return e;if(P.isTypeAliasPlaceholder(e))return e;let n=[];return k.isTypeVar(e)||P.doForEachSubtype(e,(e=>{P.addTypeVarsToListIfUnique(n,P.getTypeVarArgumentsRecursive(e))})),n=n.filter((e=>!e.details.isSynthesized)),k.TypeBase.cloneForTypeAlias(e,t.value,Le(t),n.length>0?n:void 0)}function Ct(t,n,i){const s=un(t);let r=k.ClassType.create(n,rt(t,s.moduleName,n),s.moduleName,3,Bn(t),void 0,void 0);s.isTypingExtensionsStubFile&&(r.details.flags|=65536);const o=i.alias||"object";let a;if("builtins"===i.module)a=on(t,o);else if("collections"===i.module){if(s.collectionsModulePath){const t=e(s.collectionsModulePath);if(t){const e=t.symbolTable.get(o);e&&(a=fn(e))}}}else if("self"===i.module){const e=ln(t,o,!1);e&&(a=fn(e.symbol),k.isClass(a)&&k.ClassType.isBuiltIn(a,"_TypedDict")&&(a.details.flags&=-1537))}return a&&k.isClass(a)?i.alias?r=k.ClassType.cloneForTypingAlias(a,n):(r.details.baseClasses.push(a),r.details.effectiveMetaclass=a.details.effectiveMetaclass,P.computeMroLinearization(r)):(r.details.baseClasses.push(k.UnknownType.create()),r.details.effectiveMetaclass=k.UnknownType.create(),P.computeMroLinearization(r)),r}function It(e){var t;const n=un(e);if(Y(e))return;let i,s=Y(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 k.AnyType.create();const n={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"}}[t];return n?Ct(e,t,n):void 0}(e),s&&Q(e.rightExpression,s)),!s)){const o=me(e.leftExpression);let a,p=2;n.isStubFile&&(p|=256);let d,u=!1;if(he(e.leftExpression)?(p|=104,a=e.leftExpression.valueExpression):function(e){if(38===e.nodeType){const t=ln(e,e.value,!1);if(t){const e=t.symbol.getDeclarations();if(1===e.length&&T.isPossibleTypeAliasDeclaration(e[0])&&!v.isWithinLoop(e[0].node))return!0}}return!1}(e.leftExpression)&&38===e.leftExpression.nodeType&&(a=e.leftExpression,u=!0),a){d=k.TypeVarType.createInstantiable(`__type_alias_${a.value}`,!1,!0),d.details.recursiveTypeAliasName=a.value;const t=Le(a);d.details.recursiveTypeAliasScopeId=t,d.scopeId=t,Q(e,d),Q(e.leftExpression,d)}const m=re(e.rightExpression,o,p);let y=m.type;i=m.expectedTypeDiagAddendum,m.isIncomplete&&(r=!0);const g=S.evaluateStaticBoolExpression(e.rightExpression,n.executionEnvironment);if(void 0!==g){const t=an(e,"bool");k.isObject(t)&&(y=k.ObjectType.create(k.ClassType.cloneWithLiteral(t.classType,g)))}o&&Pn(o,y,new l.DiagnosticAddendum)&&(y=On(o,y)),s=y,38!==e.leftExpression.nodeType||e.typeAnnotationComment||(s=bt(e.leftExpression,s)),a&&(J(e),J(e.leftExpression),(!u||k.TypeBase.isInstantiable(s)&&!k.isAnyOrUnknown(s))&&(s=St(s,a),P.isTypeAliasRecursive(d,s)&&Fe(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeAliasIsRecursive().format({name:a.value}),e.rightExpression),d.details.boundType=s,d.details.recursiveTypeParameters=null===(t=s.typeAliasInfo)||void 0===t?void 0:t.typeParameters))}r||(Ne(e.leftExpression,s,e.rightExpression,i),Q(e,s))}function Dt(e){if(Y(e))return;const t=ct(e,void 0);Ne(e.destExpression,t,e.rightExpression),Q(e,t)}function xt(e){const t=Y(e.name);if(t){if(!k.isClass(t))return;return{classType:t,decoratedType:Y(e)||k.UnknownType.create()}}const n=b.getScopeForNode(e),i=un(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));const r=k.ClassType.create(e.name.value,rt(e,i.moduleName,e.name.value),i.moduleName,s,Bn(e),void 0,void 0,v.getDocString(e.suite.statements));r.details.typeVarScopeId=Le(e);const o=null==n?void 0:n.lookUpSymbol(e.name.value);let p;const u=f.getDeclaration(e);u&&(p=u),p&&ne(o,p,r),r.details.flags|=131072,Q(e,r),Q(e.name,r);const m=[];let y,g=!1;const _=[];e.arguments.forEach((e=>{if(e.name&&"metaclass"!==e.name.value)if("total"===e.name.value&&k.ClassType.isTypedDictClass(r)){const t=S.evaluateStaticBoolExpression(e.valueExpression,i.executionEnvironment);void 0===t?Ie(h.Localizer.Diagnostic.typedDictTotalParam(),e.valueExpression):t||(r.details.flags|=256)}else _.push({argumentCategory:0,node:e,name:e.name,valueExpression:e.valueExpression});else{let t=10816;i.isStubFile&&(t|=4);let n=re(e.valueExpression,void 0,t).type;const s=!!e.name;if(s&&(g&&Ie(h.Localizer.Diagnostic.metaclassDuplicate(),e),g=!0),10===n.category&&(n=k.removeUnbound(n)),k.isAnyOrUnknown(n)||k.isUnbound(n)||(n=P.transformTypeObjectToClass(n),k.isClass(n)?(k.ClassType.isBuiltIn(n,"Protocol")&&(!i.isStubFile&&!k.ClassType.isTypingExtensionClass(n)&&i.executionEnvironment.pythonVersion<d.PythonVersion.V3_7&&Ie(h.Localizer.Diagnostic.protocolIllegal(),e.valueExpression),r.details.flags|=8192),k.ClassType.isBuiltIn(n,"property")&&(r.details.flags|=2048),i.executionEnvironment.pythonVersion>=d.PythonVersion.V3_6&&k.ClassType.isBuiltIn(n,"NamedTuple")&&(r.details.flags|=4),k.ClassType.isBuiltIn(n,"TypedDict")||k.ClassType.isTypedDictClass(n)?r.details.flags|=128:k.ClassType.isTypedDictClass(r)&&!k.ClassType.isTypedDictClass(n)&&Ie(h.Localizer.Diagnostic.typedDictBaseClass(),e),P.derivesFromClassRecursive(n,r,!0)&&(Ie(h.Localizer.Diagnostic.baseClassCircular(),e),n=k.UnknownType.create())):(Fe(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.baseClassInvalid(),e),n=k.UnknownType.create())),k.isUnknown(n)&&Fe(i.diagnosticRuleSet.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedBaseClass,h.Localizer.Diagnostic.baseClassUnknown(),e),s)(k.isClass(n)||k.isUnknown(n))&&(r.details.declaredMetaclass=n,k.isClass(n)&&(k.ClassType.isBuiltIn(n,"EnumMeta")?r.details.flags|=1048576:k.ClassType.isBuiltIn(n,"ABCMeta")&&(r.details.flags|=512)));else if(r.details.baseClasses.some((e=>k.isClass(e)&&k.isClass(n)&&k.ClassType.isSameGenericClass(n,e)))&&Fe(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.duplicateBaseClass(),e.name||e),r.details.baseClasses.push(n),k.isClass(n)&&(k.ClassType.isEnumClass(n)&&(r.details.flags|=1048576),k.ClassType.supportsAbstractMethods(n)&&(r.details.flags|=512),k.ClassType.isPropertyClass(n)&&(r.details.flags|=2048),k.ClassType.isFinal(n))){const t=zn(n);Ie(h.Localizer.Diagnostic.baseClassFinal().format({type:t}),e.valueExpression)}P.addTypeVarsToListIfUnique(m,P.getTypeVarArgumentsRecursive(n)),k.isClass(n)&&k.ClassType.isBuiltIn(n,"Generic")&&(y||(y=[],P.addTypeVarsToListIfUnique(y,P.getTypeVarArgumentsRecursive(n))))}})),k.ClassType.isBuiltIn(r,"object")||r.details.baseClasses.push(on(e,"object")),r.details.typeParameters=y||m,P.computeMroLinearization(r)||Ie(h.Localizer.Diagnostic.methodOrdering(),e.name);let T=r.details.declaredMetaclass,I=!1;if(!T||k.isClass(T))for(const t of r.details.baseClasses){if(!k.isClass(t)){T=k.UnknownType.create();break}{const n=t.details.effectiveMetaclass;if(!n||!k.isClass(n)){T=n?k.UnknownType.create():void 0;break}T?P.derivesFromClassRecursive(n,T,!0)?T=n:P.derivesFromClassRecursive(T,n,!0)||I||(Fe(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.metaclassConflict(),e.name),I=!0):T=n}}if(!T){const t=on(e,"type");T=t&&k.isClass(t)?t:k.UnknownType.create()}r.details.effectiveMetaclass=T;const D=b.getScopeForNode(e.suite);if(r.details.fields=(null==D?void 0:D.symbolTable)||new Map,k.ClassType.isTypedDictClass(r)&&fe(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)=>!!ue(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=k.TypeVarType.createInstance(`__type_of_${n.name.value}`,!1,!0);return i.scopeId=Le(t),i.details.boundType=k.UnknownType.create(),k.TypeVarType.cloneForScopeId(i,Le(e),e.name.value)})))}}}}0===r.details.typeParameters.length&&(r.details.baseClasses.some((e=>k.isClass(e)&&k.ClassType.hasCustomClassGetItem(e)))||r.details.fields.has("__class_getitem__"))&&(r.details.flags|=262144),k.ClassType.supportsAbstractMethods(r)&&Rn(r).length>0&&(r.details.flags|=1024);let x=r,F=!1;for(let t=e.decorators.length-1;t>=0;t--){const n=e.decorators[t],s=Ft(x,r,n);P.containsUnknown(s)?F||(Fe(i.diagnosticRuleSet.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedClassDecorator,h.Localizer.Diagnostic.classDecoratorTypeUnknown(),e.decorators[t].expression),F=!0):x=s}if(k.ClassType.isDataClass(r)){let t=k.ClassType.isSkipSynthesizedDataClassInit(r);if(!t){const e=P.lookUpClassMember(r,"__init__",2);if(e){const n=Cn(e);k.isFunction(n)&&k.FunctionType.isSynthesizedMethod(n)||(t=!0)}}!function(e,t,n){a.assert(k.ClassType.isDataClass(t));const i=k.FunctionType.createInstance("__new__","",65),s=k.FunctionType.createInstance("__init__","",64);k.FunctionType.addParameter(i,{category:0,name:"cls",type:t,hasDeclaredType:!0}),k.FunctionType.addDefaultParameters(i),i.details.declaredReturnType=k.ObjectType.create(t);const r={category:0,name:"self",type:k.ObjectType.create(t),hasDeclaredType:!0};k.FunctionType.addParameter(s,r),s.details.declaredReturnType=k.NoneType.createInstance();const o=[],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(k.isClass(s)){const e=P.buildTypeVarMapFromSpecializedClass(s,!1);k.ClassType.getDataClassEntries(s).forEach((n=>{const i=t.findIndex((e=>e.name===n.name)),s=Object.assign({},n);s.type=P.applySolvedTypeVars(s.type,e),i>=0?t[i]=s:t.push(s)}))}else n=!1}return n}(t,l);c||k.FunctionType.addDefaultParameters(s);const p=[];e.suite.statements.forEach((n=>{47===n.nodeType&&n.statements.forEach((n=>{let i,s,r,a=!1,c=!0;if(3===n.nodeType){if(54===n.leftExpression.nodeType&&38===n.leftExpression.valueExpression.nodeType&&(i=n.leftExpression.valueExpression,s=()=>ae(n.leftExpression.typeAnnotation,!0)),a=!0,r=n.rightExpression,9===n.rightExpression.nodeType){const t=re(n.rightExpression.leftExpression).type;if(k.isOverloadedFunction(t)&&"field"===t.overloads[0].details.builtInName){const t=n.rightExpression.arguments.find((e=>{var t;return"init"===(null===(t=e.name)||void 0===t?void 0:t.value)}));t&&t.valueExpression&&!1===S.evaluateStaticBoolExpression(t.valueExpression,un(e).executionEnvironment)&&(c=!1),a=n.rightExpression.arguments.some((e=>{var t,n;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)}))}}}else 54===n.nodeType&&38===n.valueExpression.nodeType&&(i=n.valueExpression,s=()=>ae(n.typeAnnotation,!0));if(i&&s){const e=i.value,n=t.details.fields.get(e);if(!(null==n?void 0:n.isClassVar())){const t={name:e,hasDefault:a,defaultValueExpression:r,includeInInit:c,type:k.UnknownType.create()};p.push({entry:t,evaluator:s});let n=o.findIndex((t=>t.name===e));n>=0?o[n]=t:o.push(t),n=l.findIndex((t=>t.name===e)),n>=0?l[n]=t:(l.push(t),n=l.length-1);const d=l.findIndex((e=>e.hasDefault&&e.includeInInit));c&&!a&&d>=0&&d<n&&Ie(h.Localizer.Diagnostic.dataClassFieldWithDefault(),i)}}}))})),t.details.dataClassEntries=o,p.forEach((e=>{e.entry.type=e.evaluator()}));const d=t.details.fields;!n&&c&&(l.forEach((e=>{if(e.includeInInit){const t={category:0,name:e.name,hasDefault:e.hasDefault,defaultValueExpression:e.defaultValueExpression,type:e.type,hasDeclaredType:!0};k.FunctionType.addParameter(s,t)}})),d.set("__init__",C.Symbol.createWithType(4,s)),d.set("__new__",C.Symbol.createWithType(4,i)));const u=(t,n)=>{const i=k.FunctionType.createInstance(t,"",64);k.FunctionType.addParameter(i,r),k.FunctionType.addParameter(i,{category:0,name:"x",type:n,hasDeclaredType:!0}),i.details.declaredReturnType=an(e,"bool"),d.set(t,C.Symbol.createWithType(4,i))};if(k.ClassType.isSkipSynthesizedDataClassEq(t)||u("__eq__",an(e,"object")),k.ClassType.isSynthesizedDataclassOrder(t)){const e=k.ObjectType.create(t);["__lt__","__le__","__gt__","__ge__"].forEach((t=>{u(t,e)}))}let m=on(e,"dict");k.isClass(m)&&(m=k.ObjectType.create(k.ClassType.cloneForSpecialization(m,[an(e,"str"),k.AnyType.create()],!0))),d.set("__dataclass_fields__",C.Symbol.createWithType(4,m)),He(t,l.map((e=>e.type)),!0)}(e,r,t)}return r.details.flags&=-131073,Q(e.name,r),Q(e,x),_.length>0&&function(e,t,n){const i=n[0].node.name,s=je(i,t,"__init_subclass__",{method:"get"},new l.DiagnosticAddendum,5,t);if(s){const e=s.type;e&&et(i,n,e,new A.TypeVarMap(P.getTypeVarScopeId(e)),!1,k.NoneType.createInstance())}}(0,r,_),{classType:r,decoratedType:x}}function Ft(e,t,n){const i=re(n.expression).type;if(k.isOverloadedFunction(i))"dataclass"===i.overloads[0].details.builtInName&&(t.details.flags|=4);else if(k.isFunction(i)){if(9===n.expression.nodeType){const i=re(n.expression.leftExpression).type;if(k.isOverloadedFunction(i)&&"dataclass"===i.overloads[0].details.builtInName)return t.details.flags|=4,n.expression.arguments&&n.expression.arguments.forEach((e=>{if(e.name&&e.valueExpression){const i=un(n),s=S.evaluateStaticBoolExpression(e.valueExpression,i.executionEnvironment);!0===s?"order"===e.name.value?t.details.flags|=64:"frozen"===e.name.value&&(t.details.flags|=8,t.details.baseClasses.some((e=>k.isClass(e)&&k.ClassType.isDataClass(e)&&!k.ClassType.isFrozenDataClass(e)))&&Fe(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.dataClassBaseClassNotFrozen(),e)):!1===s&&("init"===e.name.value?t.details.flags|=16:"eq"===e.name.value&&(t.details.flags|=32))}})),e}"final"===i.details.builtInName?t.details.flags|=4096:"runtime_checkable"===i.details.builtInName&&(t.details.flags|=32768)}return le(n,e)}function kt(e){const n=un(e),i=Y(e.name);if(i){if(!k.isFunction(i))return;return{functionType:i,decoratedType:Y(e)||k.UnknownType.create()}}let s;const r=f.getDeclaration(e);r&&(s=r);const o=v.getEnclosingClass(e,!0);let a;if(o){const e=xt(o);if(!e)return;a=e.classType}let p=Et(e,!!o);(null==s?void 0:s.isGenerator)&&(p|=16),o&&"__class_getitem__"===e.name.value&&(p|=2),n.isStubFile?p|=2048:n.isInPyTypedPackage&&t.disableInferenceForPyTypedSources&&(p|=4096),e.isAsync&&(p|=512);const d=k.FunctionType.createInstance(e.name.value,n.moduleName,p,v.getDocString(e.suite.statements));d.details.typeVarScopeId=Le(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.lookUpSymbol(e.name.value);s&&ne(m,s,d),Q(e,d),Q(e.name,d);const y=a&&k.ClassType.isPseudoGenericClass(a)&&"__init__"===e.name.value,g=[];let _=0,T=0;if(a&&0==(4&d.details.flags)&&(T=1),e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=e.parameters.length-T,n=e.functionAnnotationComment.paramTypeAnnotations.length;T>0&&n===e.parameters.length?T=0:n!==t&&Ie(h.Localizer.Diagnostic.annotatedParamCountMismatch().format({expected:t,received:n}),e.functionAnnotationComment)}if(e.parameters.forEach(((t,i)=>{let s,r,o,p,u=!1;if(t.typeAnnotation)o=t.typeAnnotation;else if(t.typeAnnotationComment)o=t.typeAnnotationComment;else if(e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=i-T;t>=0&&t<e.functionAnnotationComment.paramTypeAnnotations.length&&(o=e.functionAnnotationComment.paramTypeAnnotations[t])}if(o&&(r=ae(o,!1,!0)),!r&&y&&i>0&&0===t.category&&t.name&&(r=a.details.typeParameters[_],_++),r&&t.defaultValue&&11===t.defaultValue.nodeType&&24===t.defaultValue.constType&&(u=!0,n.diagnosticRuleSet.strictParameterNoneValue||(r=k.combineTypes([r,k.NoneType.createInstance()]))),t.defaultValue&&(p=re(t.defaultValue,r,1).type),r){if(t.defaultValue&&p){const e=new l.DiagnosticAddendum;if(!Pn(r,p,e,new A.TypeVarMap(d.details.typeVarScopeId))){const i=Fe(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.paramAssignmentMismatch().format({sourceType:jn(p),paramType:jn(r)})+e.getString(),t.defaultValue);if(u&&o){const e={action:"pyright.addoptionalforparam",offsetOfTypeNode:o.start+1};i&&i.addAction(e)}}}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||k.UnknownType.create(),hasDeclaredType:!!o};if(k.FunctionType.addParameter(d,m),t.name){const n=At(e,t.category,m.type);g.push(n)}else g.push(m.type)})),a&&d.details.parameters.length>0&&!ue(e,0)){const t=Pt(d.details.flags,a,e);t&&(d.details.parameters[0].type=t,k.isAnyOrUnknown(t)||(d.details.parameters[0].isTypeInferred=!0),g[0]=t)}if(g.forEach(((t,n)=>{const i=e.parameters[n].name;i&&(k.isUnknown(t)&&(d.details.flags|=16384),Q(i,t))})),e.returnTypeAnnotation){d.details.declaredReturnType=k.UnknownType.create();const t=ae(e.returnTypeAnnotation,!1,!0);d.details.declaredReturnType=t}else if(e.functionAnnotationComment){d.details.declaredReturnType=k.UnknownType.create();const t=ae(e.functionAnnotationComment.returnTypeAnnotation,!1,!0);d.details.declaredReturnType=t}else n.isStubFile&&("__init__"===e.name.value?d.details.declaredReturnType=k.NoneType.createInstance():d.details.declaredReturnType=k.UnknownType.create());let S=e.isAsync?function(e,t){const n=k.FunctionType.clone(t);return t.details.declaredReturnType&&(n.details.declaredReturnType=Ot(e,t.details.declaredReturnType)),n.details.flags|=1024,n}(e,d):d,C=!1;for(let t=e.decorators.length-1;t>=0;t--){const i=wt(S,e.decorators[t],e);P.containsUnknown(i)?C||(Fe(n.diagnosticRuleSet.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedFunctionDecorator,h.Localizer.Diagnostic.functionDecoratorTypeUnknown(),e.decorators[t].expression),C=!0):S=i}return k.isFunction(S)&&(S=function(e,t){let n;const i=f.getDeclaration(e);i&&(n=i);const s=ln(e,e.name.value,!1);if(s){const i=s.symbol.getDeclarations(),r=i.findIndex((e=>e===n));if(r>0){const n=[],s=i[r-1];if(3===s.type){const e=kt(s.node);e&&(k.isFunction(e.decoratedType)?k.FunctionType.isOverloaded(e.decoratedType)&&n.push(e.decoratedType):k.isOverloadedFunction(e.decoratedType)&&n.push(...e.decoratedType.overloads))}if(k.FunctionType.isOverloaded(t)&&n.push(t),1===n.length)return n[0];if(n.length>1){const i=k.OverloadedFunctionType.create(n),s=n[n.length-2];return k.FunctionType.isAbstractMethod(s)!==k.FunctionType.isAbstractMethod(t)&&Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.overloadAbstractMismatch().format({name:e.name.value}),e.name),i}}}return t}(e,S)),Q(e.name,d),Q(e,S),{functionType:d,decoratedType:S}}function Pt(e,t,n){if(0==(4&e)&&t){if(3&e){const e=k.TypeVarType.createInstantiable(`__type_of_cls_${t.details.name}`,!1,!0),i=Le(n);return e.nameWithScope=k.TypeVarType.makeNameWithScope(e.details.name,i),e.scopeId=i,e.details.boundType=P.selfSpecializeClassType(t,!0),e}if(0==(4&e)){const e=k.TypeVarType.createInstance(`__type_of_self_${t.details.name}`,!1,!0),i=Le(n);return e.nameWithScope=k.TypeVarType.makeNameWithScope(e.details.name,i),e.scopeId=i,e.details.boundType=k.ObjectType.create(P.selfSpecializeClassType(t,!0)),e}}}function At(e,t,n){switch(t){case 0:return n;case 1:{const t=on(e,"tuple");return t&&k.isClass(t)?k.ObjectType.create(k.ClassType.cloneForSpecialization(t,[n,k.AnyType.create(!0)],!1)):k.UnknownType.create()}case 2:{const t=on(e,"dict"),i=an(e,"str");return k.isClass(t)&&k.isObject(i)?k.ObjectType.create(k.ClassType.cloneForSpecialization(t,[i,n],!0)):k.UnknownType.create()}}}function Et(e,t){const n=un(e);let i=0;"__new__"===e.name.value&&t&&(i|=1),"__init_subclass__"===e.name.value&&t&&(i|=2);for(const s of e.decorators){let e=2;n.isStubFile&&(e|=4);const r=re(s.expression,void 0,e).type;k.isFunction(r)?"abstractmethod"===r.details.builtInName?t&&(i|=8):"final"===r.details.builtInName&&(i|=8192):k.isClass(r)&&(k.ClassType.isBuiltIn(r,"staticmethod")?t&&(i|=4):k.ClassType.isBuiltIn(r,"classmethod")&&t&&(i|=2))}return i}function wt(e,t,n){let i=2;un(t).isStubFile&&(i|=4);const s=re(t.expression,void 0,i).type;if(k.isClass(s)&&k.ClassType.isSpecialBuiltIn(s,"overload")&&k.isFunction(e))return e.details.flags|=256,e;const r=le(t,e);if(k.isFunction(s)){if("abstractmethod"===s.details.builtInName)return e;if(35===t.expression.nodeType){const i=re(t.expression.leftExpression).type;if(P.isProperty(i)){const s=t.expression.memberName.value;if("setter"===s)return k.isFunction(e)?(Nt(e,t),function(e,t,n){if(!P.isProperty(e))return e;const i=e.classType,s=k.ClassType.create(i.details.name,i.details.fullName,i.details.moduleName,i.details.flags,i.details.typeSourceId,i.details.declaredMetaclass,i.details.effectiveMetaclass);P.computeMroLinearization(s);const r=k.ObjectType.create(s),o=s.details.fields;i.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||o.set(t,e)}));const a=un(n);if("none"!==a.diagnosticRuleSet.reportPropertyTypeMismatch&&n.parameters.length>=2){const e=ue(n,1);if(e){const t=xn(i,!1);if(t&&!k.isAnyOrUnknown(t)){const n=ae(e),i=new l.DiagnosticAddendum;Pn(t,n,i)||Fe(a.diagnosticRuleSet.reportPropertyTypeMismatch,c.DiagnosticRule.reportPropertyTypeMismatch,h.Localizer.Diagnostic.setterGetterTypeMismatch()+i.getString(),e)}}}const p=C.Symbol.createWithType(4,t);o.set("fset",p);const d=k.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:k.AnyType.create();k.isTypeVar(u)&&u.details.isSynthesized&&u.details.boundType&&(u=Ee(u)),d.details.parameters.push({category:0,name:"obj",type:k.combineTypes([u,k.NoneType.createInstance()]),hasDeclaredType:!0}),d.details.declaredReturnType=k.NoneType.createInstance();let m=k.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 o.set("__set__",y),r}(i,e,n)):e;if("deleter"===s)return k.isFunction(e)?(Nt(e,t),function(e,t){if(!P.isProperty(e))return e;const n=e.classType,i=k.ClassType.create(n.details.name,n.details.fullName,n.details.moduleName,n.details.flags,n.details.typeSourceId,n.details.declaredMetaclass,n.details.effectiveMetaclass);P.computeMroLinearization(i);const s=k.ObjectType.create(i),r=i.details.fields;n.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||r.set(t,e)}));const o=C.Symbol.createWithType(4,t);r.set("fdel",o);const a=k.FunctionType.createInstance("__delete__","",64);a.details.parameters.push({category:0,name:"self",type:e,hasDeclaredType:!0});let l=t.details.parameters.length>0?t.details.parameters[0].type:k.AnyType.create();k.isTypeVar(l)&&l.details.isSynthesized&&l.details.boundType&&(l=Ee(l)),a.details.parameters.push({category:0,name:"obj",type:k.combineTypes([l,k.NoneType.createInstance()]),hasDeclaredType:!0}),a.details.declaredReturnType=k.NoneType.createInstance();const c=C.Symbol.createWithType(4,a);return r.set("__delete__",c),s}(i,e)):e}}}else if(k.isClass(s)){if(k.ClassType.isBuiltIn(s))switch(s.details.name){case"classmethod":case"staticmethod":return e}if(k.ClassType.isPropertyClass(s))return k.isFunction(e)?(Nt(e,t),function(e,t,n,i){const s=un(e),r=on(e,"type"),o=k.ClassType.create(t,rt(e,s.moduleName,t),s.moduleName,2048,i,void 0,k.isClass(r)?r:k.UnknownType.create());P.computeMroLinearization(o);const a=k.ObjectType.create(o),l=o.details.fields,c=C.Symbol.createWithType(4,n);l.set("fget",c);const p=k.FunctionType.createInstance("__get__","",320);p.details.parameters.push({category:0,name:"self",type:a,hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"obj",type:k.NoneType.createInstance(),hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"type",type:k.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:k.AnyType.create()}),p.details.declaredReturnType=a,p.details.declaration=n.details.declaration;const d=k.FunctionType.createInstance("__get__","",320);d.details.parameters.push({category:0,name:"self",type:a,hasDeclaredType:!0});let u=n.details.parameters.length>0?n.details.parameters[0].type:k.AnyType.create();k.isTypeVar(u)&&u.details.isSynthesized&&u.details.boundType&&(u=Ee(u)),d.details.parameters.push({category:0,name:"obj",type:u,hasDeclaredType:!0}),d.details.parameters.push({category:0,name:"type",type:k.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:k.AnyType.create()}),d.details.declaredReturnType=n.details.declaredReturnType,d.details.declaration=n.details.declaration,d.details.typeVarScopeId=P.getTypeVarScopeId(n);const h=k.OverloadedFunctionType.create([p,d]),m=C.Symbol.createWithType(4,h);return l.set("__get__",m),["getter","setter","deleter"].forEach((e=>{const t=k.FunctionType.createInstance(e,"",64);t.details.parameters.push({category:0,name:"self",type:k.AnyType.create(),hasDeclaredType:!0}),t.details.parameters.push({category:0,name:"accessor",type:k.AnyType.create(),hasDeclaredType:!0}),t.details.declaredReturnType=a;const n=C.Symbol.createWithType(4,t);l.set(e,n)})),a}(t,s.details.name,e,Bn(t))):k.UnknownType.create()}return k.isFunction(e)&&k.isFunction(r)&&k.FunctionType.isOverloaded(e)&&(r.details.flags|=256),r}function Nt(e,t){(k.FunctionType.isStaticMethod(e)||k.FunctionType.isClassMethod(e))&&Fe(un(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.propertyStaticOrClassMethod(),t)}function Ot(e,t){let n;if(k.isObject(t)){const i=t.classType;if(k.ClassType.isBuiltIn(i))if("Generator"===i.details.name){const t=_e(e,"AsyncGenerator");if(t&&k.isClass(t)){const e=[],s=i.typeArguments;s&&s.length>0&&e.push(s[0]),s&&s.length>1&&e.push(s[1]),n=k.ObjectType.create(k.ClassType.cloneForSpecialization(t,e,!0))}}else["AsyncGenerator","AsyncIterator","AsyncIterable"].some((e=>e===i.details.name))&&(n=t)}if(!n){const i=_e(e,"Coroutine");n=i&&k.isClass(i)?k.ObjectType.create(k.ClassType.cloneForSpecialization(i,[k.AnyType.create(),k.AnyType.create(),t],!0)):k.UnknownType.create()}return n}function Rt(e,t){var n;if(e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation))return;let i=Y(e.suite);if(i)return i;if(!s.has(e.id)){s.set(e.id,!0);try{let n;const r=f.getDeclaration(e);r&&(n=r);const o=!be(e),a=be(e.suite);if(un(e).isStubFile)i=k.UnknownType.create();else{if(o)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=re(t.typeExpression).type,n=k.isClass(e)?e:k.isObject(e)?e.classType:void 0;if(!n||!k.ClassType.isBuiltIn(n,"NotImplementedError"))return!1}return!0}(n))i=k.UnknownType.create();else{const t=_e(e,"NoReturn");i=t&&k.isClass(t)?k.ObjectType.create(t):k.UnknownType.create()}else{const e=[];(null==n?void 0:n.returnStatements)&&n.returnStatements.forEach((t=>{if(ve(t))if(t.returnExpression){const n=re(t.returnExpression).type;e.push(n||k.UnknownType.create())}else e.push(k.NoneType.createInstance())})),!o&&a&&e.push(k.NoneType.createInstance()),i=k.combineTypes(e),i=k.removeUnbound(i),i=P.removeNoReturnFromUnion(i)}if(null==n?void 0:n.yieldStatements){const t=[];n.yieldStatements.forEach((e=>{if(ve(e))if(61===e.nodeType){const n=ge(re(e.expression).type,!1,e);t.push(n||k.UnknownType.create())}else if(e.expression){const n=re(e.expression).type;t.push(n||k.UnknownType.create())}else t.push(k.NoneType.createInstance())})),0===t.length&&t.push(k.NoneType.createInstance());const s=k.combineTypes(t),r=_e(e,"Generator");i=r&&k.isClass(r)?k.ObjectType.create(k.ClassType.cloneForSpecialization(r,[s,k.NoneType.createInstance(),P.isNoReturnType(i)?k.NoneType.createInstance():i],!0)):k.UnknownType.create()}}Q(e.suite,i)}finally{s.delete(e.id)}}return i}function Mt(e){if(Y(e))return;const t=ge(re(e.iterableExpression).type,!!e.isAsync,e.iterableExpression);Ne(e.targetExpression,t,e.targetExpression),Q(e,t)}function Lt(e){if(a.assert(void 0!==e.typeExpression),Y(e))return;const t=re(e.typeExpression).type;function n(e,t){if(k.isAnyOrUnknown(e))return e;if(k.isObject(e)&&(e=P.transformTypeObjectToClass(e)),k.isClass(e))return k.ObjectType.create(e);if(k.isObject(e)){const n=ge(e,!1,t);return P.mapSubtypes(n,(e=>{if(k.isAnyOrUnknown(e))return e;const t=P.transformTypeObjectToClass(e);return k.isClass(t)?k.ObjectType.create(t):k.UnknownType.create()}))}return k.UnknownType.create()}const i=P.mapSubtypes(t,(t=>{const i=P.getSpecializedTupleType(t);if(i&&i.variadicTypeArguments){const t=i.variadicTypeArguments.map((t=>n(t,e.typeExpression)));return k.combineTypes(t)}return n(t,e.typeExpression)}));e.name&&Ne(e.name,i,e.name),Q(e,i)}function Ut(e){if(Y(e))return;let t=re(e.expression).type;const n=e.parent&&58===e.parent.nodeType&&!!e.parent.isAsync;P.isOptionalType(t)&&(Fe(un(e).diagnosticRuleSet.reportOptionalContextManager,c.DiagnosticRule.reportOptionalContextManager,h.Localizer.Diagnostic.noneNotUsableWith(),e.expression),t=k.removeNoneFromUnion(t));const i=n?"__aenter__":"__enter__",s=P.mapSubtypes(t,(t=>{if(t=Ee(t),k.isAnyOrUnknown(t))return t;const s=new l.DiagnosticAddendum,r=new l.DiagnosticAddendum;if(k.isObject(t)){const o=ce(e.expression,t,i,{method:"get"},s,0);if(o){let t;return t=k.isFunction(o)?vn(o):k.UnknownType.create(),n&&(t=ye(t,e)),t}n||ce(e.expression,t,"__aenter__",{method:"get"},s,0)&&r.addMessage(h.Localizer.DiagnosticAddendum.asyncHelp())}return Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotUsableWith().format({type:jn(t),method:i})+r.getString(),e.expression),k.UnknownType.create()})),r=n?"__aexit__":"__exit__";P.doForEachSubtype(t,(t=>{if(t=Ee(t),k.isAnyOrUnknown(t))return;const n=new l.DiagnosticAddendum;k.isObject(t)&&ce(e.expression,t,r,{method:"get"},n,0)||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeNotUsableWith().format({type:jn(t),method:r}),e.expression)})),e.target&&Ne(e.target,s,e.target),Q(e,s)}function Vt(e){if(Y(e))return;let t;if(t=e.alias?e.alias:e.module.nameParts[0],!t)return;let n=Bt(e,t.value)||k.UnknownType.create();const i=Y(e);i&&k.isModule(i)&&n&&k.isTypeSame(n,i)&&(n=i),Pe(t,n),Q(e,n)}function zt(t){if(Y(t))return;const n=t.alias||t.name;let i=Bt(t,n.value);if(!i){const n=t.parent;a.assert(n&&22===n.nodeType),a.assert(!n.isWildcardImport);const s=f.getImportInfo(n.module);if(s&&s.isImportFound&&!s.isNativeLib){const n=s.resolvedPaths[s.resolvedPaths.length-1],i=e(n),r=un(t);let o=!1;i?(r.executionEnvironment.pythonVersion<d.PythonVersion.V3_7||!i.symbolTable.get("__getattr__"))&&(o=!0):n||(o=!0),o&&Fe(r.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.importSymbolUnknown().format({name:t.name.value}),t.name)}i=k.UnknownType.create()}Pe(n,i),Q(t,i)}function jt(e){if(Y(e))return;const t=e.module.nameParts[0];let n=Bt(e,t.value)||k.UnknownType.create();const i=Y(e);i&&k.isModule(i)&&n&&k.isTypeSame(n,i)&&(n=i),Pe(t,n),Q(e,n)}function Bt(e,t){const n=ln(e,t,!0);if(!n)return;let i=n.symbol.getDeclarations().find((t=>t.node===e));if(i||(i=n.symbol.getDeclarations().find((e=>6===e.type))),!i)return;a.assert(6===i.type);const s=gn(i,!0);return s?yn(i):s}function Wt(e){let t=e,n=e;function i(e){var t,n,i;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)||54===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)||9===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}if(38===e.nodeType&&e.parent){if(28===e.parent.nodeType&&e.parent.name===e)return void kt(e.parent);if(10===e.parent.nodeType&&e.parent.name===e)return void xt(e.parent);if(29===e.parent.nodeType||39===e.parent.nodeType)return void re(e,void 0,4)}for(;n;){const e=i(n);if(!e&&!m.isExpressionNode(n))break;e&&(t=n),n=n.parent}const s=t.parent;if(3===s.nodeType)return void(t===s.typeAnnotationComment?ae(t,v.isFinalAllowedForAssignmentTarget(s.leftExpression)):It(s));if(5===s.nodeType)return void Dt(s);const r=e=>{const t=e.parent;if(3===(null==t?void 0:t.nodeType)&&t.leftExpression===s)It(t);else{const t=ae(e.typeAnnotation,v.isFinalAllowedForAssignmentTarget(e.valueExpression));t&&Q(e.valueExpression,t)}};if(54===s.nodeType)return void r(s);if(37===s.nodeType)return;if(1===s.nodeType&&t===s.name)return;if(44===s.nodeType&&s.returnExpression){const t=v.getEnclosingFunction(e),n=t?Sn(t):void 0;return void re(s.returnExpression,n,0)}const o=m.isExpressionNode(s)&&0!==s.nodeType?s:t;54===o.nodeType?r(o):re(o)}function $t(e){a.assert(void 0!==e.name);const t=e.parent;if(30===t.nodeType)return void Wt(t);a.assert(28===t.nodeType);const n=t,i=n.parameters.findIndex((t=>t===e)),s=ue(n,i);if(s)Q(e.name,At(e,e.category,ae(s,!1,!0)));else{if(0===i){const t=v.getEnclosingClass(n,!0);if(t){const i=xt(t);if(i){const t=Pt(Et(n,!0),i.classType,n);return void Q(e.name,t||k.UnknownType.create())}}}Q(e.name,At(e,e.category,k.UnknownType.create()))}}function Gt(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 It(t);break;case 4:return void re(t);case 5:return void Dt(t);case 10:return void xt(t);case 41:return void $t(t);case 30:return void Wt(t);case 28:return void kt(t);case 26:return void Mt(t);case 25:return void Lt(t);case 59:return void Ut(t);case 33:{const e=t.parent;return a.assert(32===e.nodeType),void Wt(e)}case 21:return void Vt(t);case 23:return void zt(t);case 22:return void jt(t)}t=t.parent}a.fail("Unexpected assignment target")}function qt(e,t){const n=f.getImportInfo(e.node.module);a.assert(void 0!==n&&n.isImportFound),a.assert(e.node.isWildcardImport);const i=ln(e.node,t,!1);a.assert(void 0!==i);const s=i.symbol.getDeclarations().find((t=>t.node===e.node));return s&&yn(s)||k.UnknownType.create()}function Kt(e){if(38===e.nodeType){const t=ln(e,e.value,!1);if(!t)return;const n=t.symbol,i=Tn(n);if(i)return i;const s=n.getDeclarations();if(0===s.length)return;const r=s[s.length-1];return 2===r.type?Ht(r.node.name,(()=>{$t(r.node)})):6===r.type?yn(r):void 0}if(35===e.nodeType){const t=e.memberName.value;let n,i=Kt(e.leftExpression);if(!i)return;if(i=Ee(i),k.isModule(i))n=k.ModuleType.getField(i,t);else if(k.isClass(i)){const e=P.lookUpClassMember(i,t);n=e?e.symbol:void 0}else if(k.isObject(i)){const e=P.lookUpClassMember(i.classType,t);n=e?e.symbol:void 0}if(!n)return;return Tn(n)}}function Ht(e,t){let n=Y(e);return n||(t(),n=Y(e)),n}function Yt(e,t){if(9!==e.nodeType)return!1;const n=Kt(e.leftExpression);if(!n||!k.isClass(n))return!1;const i=t?"__aexit__":"__exit__",s=ce(e.leftExpression,k.ObjectType.create(n),i,{method:"get"},new l.DiagnosticAddendum,0);if(!s||!k.isFunction(s)||!s.details.declaredReturnType)return!1;const r=s.details.declaredReturnType;return k.isObject(r)&&k.ClassType.isBuiltIn(r.classType,"bool")}function Qt(e){if(r.has(e.id))return r.get(e.id);r.set(e.id,!1);let t=!1;const n=Kt(e.leftExpression);if(n){let e;if(k.isFunction(n))e=n;else if(k.isOverloadedFunction(n)){const t=n;e=t.overloads[t.overloads.length-1]}e&&!k.FunctionType.isAsync(e)&&(e.details.declaredReturnType?t=P.isNoReturnType(e.details.declaredReturnType):e.inferredReturnType?t=P.isNoReturnType(e.inferredReturnType):e.details.declaration&&(e.details.declaration.yieldStatements||k.FunctionType.isAbstractMethod(e)||k.FunctionType.isStubDefinition(e)||k.FunctionType.isPyTypedDefinition(e)||(t=!be(e.details.declaration.node))))}return r.set(e.id,t),t}function Jt(e,t,n){const i=_.createKeyForReference(e),s=v.getExecutionScopeNode(e),r=f.getCodeFlowExpressions(s);if(a.assert(void 0!==r),!r.has(i))return;const o=v.getExecutionScopeNode(e);let l,c;Z(o)?l=function(){const e=q.length;return a.assert(e>0),q[e-1].codeFlowAnalyzer}():(l=M.get(o.id),l||(l=Zt(),M.set(o.id,l))),V.enterTrackingScope();try{c=l.getTypeFromCodeFlow(e,t,n)}finally{V.exitTrackingScope()}return c.isIncomplete&&V.enableUndoTracking(),c.type}function Zt(){const e=new Map;return{getTypeFromCodeFlow:function(t,n,i){const s=f.getFlowNode(t),r=_.createKeyForReference(t)+`.${n.toString()}`;let o=e.get(r);function l(e,t,n){if(n){const n=o.get(e.id);if(void 0===n)$++;else if(t&&n.isIncompleteType){const e=n;e.type&&!k.isTypeSame(e.type,t)&&$++}}else $++;const i=n?{isIncompleteType:!0,type:t,incompleteSubtypes:[],generationCount:$}:t;return o.set(e.id,i),U.trackEntry(o,e.id),{type:t,isIncomplete:n,generationCount:$,incompleteSubtypes:n?[]:void 0}}function c(e,t,n){const i=o.get(e.id);void 0!==i&&x.isIncompleteType(i)||a.fail("setIncompleteSubtype can be called only on a valid incomplete cache entry");const s=i.incompleteSubtypes;return t<s.length?s[t]=n:(a.assert(s.length===t),s.push(n)),$++,d(e)}function p(e){o.delete(e.id)}function d(e){if(!o.has(e.id))return;const t=o.get(e.id);if(void 0===t)return{type:t,isIncomplete:!1};if(!x.isIncompleteType(t))return{type:t,isIncomplete:!1};let n=t.type;if(t.incompleteSubtypes.length>0){const e=[];t.incompleteSubtypes.forEach((t=>{t&&e.push(t)})),n=e.length>0?k.combineTypes(e):void 0}return{type:n,isIncomplete:!0,incompleteSubtypes:t.incompleteSubtypes,generationCount:t.generationCount}}function u(e){let t=e.node;const n=e.node.parent;return n&&(28!==n.nodeType&&10!==n.nodeType||(t=n)),Ht(t,(()=>{Gt(e.node)}))}return o||(o=new Map,e.set(r,o)),s?function e(t,n,i,s){let r=t;for(H();;){const t=d(r);if(t&&(!t.isIncomplete||t.generationCount===$))return t;if(r.flags&_.FlowFlags.Unreachable)return l(r,void 0,!1);if(r.flags&_.FlowFlags.VariableAnnotation)r=r.antecedent;else if(r.flags&_.FlowFlags.Call){const e=r;if(Qt(e.node))return l(r,void 0,!1);r=e.antecedent}else if(r.flags&_.FlowFlags.Assignment){const e=r;if(i===e.targetSymbolId&&v.isMatchingExpression(n,e.node)){if(r.flags&_.FlowFlags.Unbind)return l(r,k.UnboundType.create(),!1);if(t)return{type:void 0,isIncomplete:!0};l(r,void 0,!0);let n=u(e);return n&&P.isTypeAliasPlaceholder(n)&&(n=void 0),l(r,n,!1)}if(v.isPartialMatchingExpression(n,e.node))return l(r,s,!1);r=e.antecedent}else if(r.flags&_.FlowFlags.AssignmentAlias){const e=r;i===e.targetSymbolId&&(i=e.aliasSymbolId),r=e.antecedent}else{if(r.flags&_.FlowFlags.BranchLabel){if(r.flags&_.FlowFlags.PostContextManager){const e=r;if(!e.expressions.some((t=>Yt(t,e.isAsync))))return l(r,void 0,!1)}const t=[];let o=!1;r.antecedents.forEach((r=>{const a=e(r,n,i,s);a.isIncomplete&&(o=!0),a.type&&t.push(a.type)}));const a=k.combineTypes(t);return l(r,a,o)}if(r.flags&_.FlowFlags.LoopLabel){const t=r;let o=!1,a=!1,u=d(r);return void 0===u&&(a=!0,u=l(r,void 0,!0)),t.antecedents.forEach(((t,a)=>{if(a>=u.incompleteSubtypes.length){u=c(r,a,void 0);const l=e(t,n,i,s);l.isIncomplete&&0===a&&(o=!0),u=c(r,a,l.type)}})),a?o?(p(r),{type:u.type,isIncomplete:!0}):l(r,u.type,!1):u}if(r.flags&(_.FlowFlags.TrueCondition|_.FlowFlags.FalseCondition)){const t=r,o=en(n,t);if(o){const a=e(t.antecedent,n,i,s);let c=a.type;return c&&(c=o(c)),l(r,c,a.isIncomplete)}r=t.antecedent}else if(r.flags&_.FlowFlags.PreFinallyGate){const e=r;if(e.isGateClosed)return{type:void 0,isIncomplete:!1};r=e.antecedent}else{if(r.flags&_.FlowFlags.PostFinally){const t=r,o=t.preFinallyGate.isGateClosed;try{t.preFinallyGate.isGateClosed=!0;const a=e(t.antecedent,n,i,s);return a.isIncomplete?a:l(r,a.type,!1)}finally{t.preFinallyGate.isGateClosed=o}}if(r.flags&_.FlowFlags.Start)return l(r,s,!1);if(!(r.flags&_.FlowFlags.WildcardImport))return a.fail("Unexpected flow node flags"),l(r,void 0,!1);{const e=r;if(38===n.nodeType){const t=n.value;if(e.names.some((e=>e===t))){const n=qt(e,t);return l(r,n,!1)}}r=e.antecedent}}}}}(s,t,n,i):{type:i,isIncomplete:!1}}}}function Xt(e,t){const n=new Map;if(i.has(e.id))return!0;i.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&_.FlowFlags.Unreachable)return!1;if(s===i)return!0;if(s.flags&(_.FlowFlags.VariableAnnotation|_.FlowFlags.Assignment|_.FlowFlags.AssignmentAlias|_.FlowFlags.TrueCondition|_.FlowFlags.FalseCondition|_.FlowFlags.WildcardImport))s=s.antecedent;else{if(!(s.flags&_.FlowFlags.Call)){if(s.flags&(_.FlowFlags.BranchLabel|_.FlowFlags.LoopLabel)){if(s.flags&_.FlowFlags.PostContextManager){const e=s;if(!e.expressions.some((t=>Yt(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&_.FlowFlags.Start)return!i;if(s.flags&_.FlowFlags.PreFinallyGate)return!s.isGateClosed;if(s.flags&_.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 a.fail("Unexpected flow node flags"),!1}{const e=s;if(void 0===i&&Qt(e.node))return!1;s=e.antecedent}}}}(e,t)}finally{i.delete(e.id)}}function en(e,t){let n=t.expression;const i=!!(t.flags&_.FlowFlags.TrueCondition);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&&24===n.rightExpression.constType){let t=n.leftExpression;if(4===t.nodeType&&(t=t.name),v.isMatchingExpression(e,t))return e=>{const t=P.mapSubtypes(e,(e=>P.transformPossibleRecursiveTypeAlias(e)));return P.mapSubtypes(t,(e=>k.isAnyOrUnknown(e)||k.isNone(e)===r?e:void 0))}}if(t&&9===n.leftExpression.nodeType){const t=re(n.leftExpression.leftExpression).type;if(k.isClass(t)&&k.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=re(n.rightExpression).type;if(k.isClass(e))return t=>P.mapSubtypes(t,(t=>{if(k.isObject(t)){const n=k.ClassType.isDerivedFrom(e,t.classType);return r?n?k.ObjectType.create(e):void 0:t}return k.isNone(t)&&r?void 0:t}))}}}if(t&&v.isMatchingExpression(e,n.leftExpression)){const e=re(n.rightExpression).type;if(k.isObject(e)&&k.ClassType.isEnumClass(e.classType)&&void 0!==e.classType.literalValue)return t=>tn(t,e,r,!0)}if(s){const t=12===n.operator?i:!i;if(v.isMatchingExpression(e,n.leftExpression)){const e=re(n.rightExpression).type;if(k.isObject(e)&&void 0!==e.classType.literalValue)return n=>tn(n,e,t,!1)}if(v.isMatchingExpression(e,n.rightExpression)){const e=re(n.leftExpression).type;if(k.isObject(e)&&void 0!==e.classType.literalValue)return n=>tn(n,e,t,!1)}if(35===n.leftExpression.nodeType&&v.isMatchingExpression(e,n.leftExpression.leftExpression)){const e=re(n.rightExpression).type,i=n.leftExpression.memberName;if(k.isObject(e)&&void 0!==e.classType.literalValue)return n=>function(e,t,n,i){let s=!0;const r=P.mapSubtypes(e,(e=>{let r;if(e=P.transformTypeObjectToClass(e),k.isObject(e)?r=P.lookUpObjectMember(e,t):k.isClass(e)&&(r=P.lookUpClassMember(e,t)),r&&r.isTypeDeclared){const t=Cn(r);if(P.isLiteralType(t,!1))return Pn(t,n,new l.DiagnosticAddendum)===i?e:void 0}return s=!1,e}));return s?r:e}(n,i.value,e,t)}}}if(41===n.operator&&i&&v.isMatchingExpression(e,n.leftExpression)){const e=re(n.rightExpression).type;return t=>function(e,t){if(!k.isObject(t)||!k.ClassType.isBuiltIn(t.classType))return e;const n=t.classType,i=n.details.name;if(!["list","set","frozenset","deque"].some((e=>e===i)))return e;if(!n.typeArguments||1!==n.typeArguments.length)return e;const s=n.typeArguments[0];let r=!0;const o=P.mapSubtypes(e,(e=>k.isAnyOrUnknown(e)?(r=!1,e):Pn(s,e,new l.DiagnosticAddendum)?e:void 0));return r?o:e}(t,e)}if((41===n.operator||42===n.operator)&&v.isMatchingExpression(e,n.rightExpression)){const e=re(n.leftExpression).type;if(k.isObject(e)&&k.ClassType.isBuiltIn(e.classType,"str")&&void 0!==e.classType.literalValue){const t=41===n.operator?i:!i;return n=>function(e,t,n){return P.mapSubtypes(e,(e=>{if(k.isObject(e)&&k.ClassType.isTypedDictClass(e.classType)){const i=Mn(e.classType).get(t.literalValue);return n?void 0===i?void 0:e:void 0!==i&&i.isRequired?void 0:e}return e}))}(n,e.classType,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=>function(e,t,n){return P.mapSubtypes(e,(e=>{switch(e.category){case 5:case 6:case 7:return t?e:void 0;case 3:case 9:return t?void 0:e;case 8:{const i=ze(e);return k.TypeBase.isInstantiable(i)||ce(n,e,"__call__",{method:"get"},new l.DiagnosticAddendum,0)?t?e:void 0:t?void 0:e}default:return e}}))}(e,i,n)}}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(e=Ee(P.transformTypeObjectToClass(e)),k.isClass(e))return[e];if(k.isObject(e)){const t=e.classType;if(P.isTupleClass(t)&&t.variadicTypeArguments){let e=!1;const n=[];if(t.variadicTypeArguments.forEach((t=>{t=Ee(P.transformTypeObjectToClass(t)),k.isClass(t)?n.push(t):e=!0})),!e)return n}}if(10===e.category){let t=!0;const n=[];if(P.doForEachSubtype(e,(e=>{k.isClass(e)?n.push(e):t=!1})),t&&n.length>0)return n}}(re(r,void 0,40).type);if(e)return n=>function(e,t,n,i){const s=P.mapSubtypes(e,(e=>P.transformPossibleRecursiveTypeAlias(e))),r=P.mapSubtypes(s,(e=>P.transformTypeObjectToClass(e))),o=(e,s)=>{const r=[];let o=!1,a=!1;for(const n of t){const t=k.ClassType.isDerivedFrom(e,n)||k.ClassType.isBuiltIn(n,"dict")&&k.ClassType.isTypedDictClass(e),s=k.ClassType.isDerivedFrom(n,e);t&&(o=!0),s&&t&&!k.ClassType.isSameGenericClass(e,n)&&(a=!0),i&&(t?r.push(e):s&&r.push(n))}return i||o&&!a||r.push(s),n?r.map((e=>P.convertToInstance(e))):r},a=[],l=[],c=we(r,void 0,((e,s,r)=>{const c=r?e:s;return n&&k.isObject(e)?k.combineTypes(o(e.classType,c)):!n&&k.isClass(e)?k.combineTypes(o(e,c)):!n&&k.isObject(e)&&k.ClassType.isBuiltIn(e.classType,"type")&&B&&k.isObject(B)?k.combineTypes(o(B.classType,c)):i&&k.isAnyOrUnknown(e)?(n?a.push(k.combineTypes(t.map((e=>k.ObjectType.create(e))))):a.push(k.combineTypes(t)),void l.push(e)):i?void 0:c}));return k.isNever(c)&&a.length>0?k.combineTypes(a):l.length>0?k.combineTypes([c,...l]):c}(n,e,t,i)}}if(n.arguments.length>=1){const t=n.arguments[0].valueExpression;if(v.isMatchingExpression(e,t)){const e=re(n.leftExpression).type;if(k.isFunction(e)&&e.details.declaredReturnType&&k.isObject(e.details.declaredReturnType)&&k.ClassType.isBuiltIn(e.details.declaredReturnType.classType,"TypeGuard")){const e=re(n).type;if(k.isObject(e)&&k.ClassType.isBuiltIn(e.classType,"TypeGuard")){const t=e.classType.typeArguments,n=t&&t.length>0?t[0]:k.UnknownType.create();return e=>i?n:e}}}}}if(v.isMatchingExpression(e,n))return e=>P.mapSubtypes(e,(e=>{if(i){if(P.canBeTruthy(e))return P.removeFalsinessFromType(e)}else if(P.canBeFalsy(e))return P.removeTruthinessFromType(e)}))}function tn(e,t,n,i){return P.mapSubtypes(e,(e=>{if(k.isObject(e)&&k.ClassType.isSameGenericClass(t.classType,e.classType)){if(void 0!==e.classType.literalValue){const i=k.ClassType.isLiteralValueSame(e.classType,t.classType);if(i&&!n||!i&&n)return;return e}if(n)return t;{const n=P.enumerateLiteralsForType(e);if(n)return k.combineTypes(n.filter((e=>!k.ClassType.isLiteralValueSame(e.classType,t.classType))))}}else if(i&&n)return;return e}))}function nn(e,t,n,i){if(k.ClassType.isSpecialBuiltIn(e))switch(e.aliasName||e.details.name){case"Callable":return function(e,t){const n=k.FunctionType.createInstantiable("","",0);n.details.declaredReturnType=k.AnyType.create();const i=v.getEnclosingClassOrFunction(t);if(i&&(n.details.typeVarScopeId=Le(i)),e&&e.length>0)if(e[0].typeList)e[0].typeList.forEach(((e,t)=>{let i=e.type;P.isEllipsisType(e.type)?Ie(h.Localizer.Diagnostic.ellipsisContext(),e.node):k.isModule(e.type)?(Ie(h.Localizer.Diagnostic.moduleContext(),e.node),i=k.UnknownType.create()):P.isParamSpecType(e.type)&&(Ie(h.Localizer.Diagnostic.paramSpecContext(),e.node),i=k.UnknownType.create()),k.FunctionType.addParameter(n,{category:0,name:`p${t.toString()}`,isNameSynthesized:!0,type:P.convertToInstance(i),hasDeclaredType:!0})}));else if(P.isEllipsisType(e[0].type))k.FunctionType.addDefaultParameters(n),n.details.flags|=32768;else if(P.isParamSpecType(e[0].type))n.details.paramSpec=e[0].type;else if(k.isClass(e[0].type)&&k.ClassType.isBuiltIn(e[0].type,"Concatenate")){const t=e[0].type.typeArguments;t&&t.length>0&&t.forEach(((e,i)=>{i===t.length-1?P.isParamSpecType(e)&&(n.details.paramSpec=e):k.FunctionType.addParameter(n,{category:0,name:`__p${i}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})}))}else Ie(h.Localizer.Diagnostic.callableFirstArg(),e[0].node);else k.FunctionType.addDefaultParameters(n,!0),n.details.flags|=32768;if(e&&e.length>1){let t=e[1].type;P.isEllipsisType(t)?Ie(h.Localizer.Diagnostic.ellipsisContext(),e[1].node):k.isModule(t)?(Ie(h.Localizer.Diagnostic.moduleContext(),e[1].node),t=k.UnknownType.create()):P.isParamSpecType(t)&&(Ie(h.Localizer.Diagnostic.paramSpecContext(),e[1].node),t=k.UnknownType.create()),n.details.declaredReturnType=P.convertToInstance(t)}else n.details.declaredReturnType=k.UnknownType.create();return e&&e.length>2&&Ie(h.Localizer.Diagnostic.callableExtraArgs(),e[2].node),n}(t,i);case"Optional":return function(e,t){if(!t||1!==t.length)return Ie(h.Localizer.Diagnostic.optionalExtraArgs(),e),k.UnknownType.create();let n=t[0].type;return P.isEllipsisType(n)?Ie(h.Localizer.Diagnostic.ellipsisContext(),t[0].node):k.isModule(n)?(Ie(h.Localizer.Diagnostic.moduleContext(),t[0].node),n=k.UnknownType.create()):P.isParamSpecType(n)?(Ie(h.Localizer.Diagnostic.paramSpecContext(),t[0].node),n=k.UnknownType.create()):k.TypeBase.isInstantiable(n)||ke(n,t[0].node),k.combineTypes([n,k.NoneType.createType()])}(i,t);case"Type":return vt(e,t,1);case"ClassVar":return function(e,t){if(!t||0===t.length)return Ie(h.Localizer.Diagnostic.classVarFirstArgMissing(),e),k.UnknownType.create();if(t.length>1)return Ie(h.Localizer.Diagnostic.classVarTooManyArgs(),t[1].node),k.UnknownType.create();let n=t[0].type;return n=Ee(n),n}(i,t);case"Protocol":case"Tuple":return vt(e,t,void 0);case"Union":return function(e){const t=[];if(e)for(const n of e){let e=n.type;P.isEllipsisType(e)?Ie(h.Localizer.Diagnostic.ellipsisContext(),n.node):k.isModule(e)?(Ie(h.Localizer.Diagnostic.moduleContext(),n.node),e=k.UnknownType.create()):P.isParamSpecType(e)?(Ie(h.Localizer.Diagnostic.paramSpecContext(),n.node),e=k.UnknownType.create()):k.TypeBase.isInstantiable(e)||ke(e,n.node),t.push(e)}return t.length>0?k.combineTypes(t):k.NeverType.create()}(t);case"Generic":return function(e,t,n){n&&0!==n.length||Ie(h.Localizer.Diagnostic.genericTypeArgMissing(),e);const i=[];return n&&n.forEach((e=>{if(k.isTypeVar(e.type)){for(const t of i)if(t===e.type){Ie(h.Localizer.Diagnostic.genericTypeArgUnique(),e.node);break}i.push(e.type)}else Ie(h.Localizer.Diagnostic.genericTypeArgTypeVar(),e.node)})),vt(t,n,void 0,!0)}(i,e,t);case"Final":return function(e,t,n){return 16&n?(Ie(h.Localizer.Diagnostic.finalContext(),e),k.AnyType.create()):t&&0!==t.length?(t.length>1&&Ie(h.Localizer.Diagnostic.finalTooManyArgs(),e),t[0].type):k.AnyType.create()}(i,t,n);case"Annotated":return function(e,t){if(!t||t.length<1)return Ie(h.Localizer.Diagnostic.annotatedTypeArgMissing(),e),k.AnyType.create();let n=t[0].type;return P.isEllipsisType(n)?Ie(h.Localizer.Diagnostic.ellipsisContext(),t[0].node):k.isModule(n)?(Ie(h.Localizer.Diagnostic.moduleContext(),t[0].node),n=k.UnknownType.create()):P.isParamSpecType(n)&&(Ie(h.Localizer.Diagnostic.paramSpecContext(),t[1].node),n=k.UnknownType.create()),n}(i,t);case"Concatenate":return function(e,t,n){return n&&0!==n.length?n.forEach(((e,t)=>{t===n.length-1?P.isParamSpecType(e.type)||Ie(h.Localizer.Diagnostic.concatenateParamSpecMissing(),e.node):P.isParamSpecType(e.type)&&Ie(h.Localizer.Diagnostic.paramSpecContext(),e.node)})):Ie(h.Localizer.Diagnostic.concatenateTypeArgsMissing(),e),vt(t,n,void 0,!0)}(i,e,t);case"TypeGuard":return function(e,t,n){let i;return n&&1===n.length||Ie(h.Localizer.Diagnostic.typeGuardArgCount(),e),n&&n.length>0?(i=n[0].type,P.isEllipsisType(i)?Ie(h.Localizer.Diagnostic.ellipsisContext(),n[0].node):k.isModule(i)?(Ie(h.Localizer.Diagnostic.moduleContext(),n[0].node),i=k.UnknownType.create()):P.isParamSpecType(i)&&(Ie(h.Localizer.Diagnostic.paramSpecContext(),n[0].node),i=k.UnknownType.create())):i=k.UnknownType.create(),k.ClassType.cloneForSpecialization(t,[P.convertToInstance(i)],!!n)}(i,e,t)}const s=un(i);if(s.isStubFile||s.executionEnvironment.pythonVersion>=d.PythonVersion.V3_9||oe(un(i))){if(k.ClassType.isBuiltIn(e,"type")&&t){const e=_e(i,"Type");if(e&&k.isClass(e))return vt(e,t,1)}if(P.isTupleClass(e))return vt(e,t,void 0)}let r=t?t.length:0;const o=k.ClassType.getTypeParameters(e);if(0===o.length&&0===r)return e;if(t&&r>o.length){if(!k.ClassType.isPartiallyConstructed(e)){const n=un(i);0===o.length?Fe(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeArgsExpectingNone(),t[o.length].node):Fe(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeArgsTooMany().format({name:e.details.name,expected:o.length,received:r}),t[o.length].node)}r=o.length}else t&&r<o.length&&Fe(un(i).diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,h.Localizer.Diagnostic.typeArgsTooFew().format({name:e.details.name,expected:o.length,received:r}),t[0].node.parent);t&&t.forEach((e=>{P.isEllipsisType(e.type)?Ie(h.Localizer.Diagnostic.ellipsisContext(),e.node):k.isModule(e.type)?Ie(h.Localizer.Diagnostic.moduleContext(),e.node):P.isParamSpecType(e.type)&&Ie(h.Localizer.Diagnostic.paramSpecContext(),e.node)}));const a=t?t.map((e=>P.convertToInstance(e.type))):[],p=k.ClassType.getTypeParameters(e);for(let e=a.length;e<p.length;e++)a.push(k.UnknownType.create());return a.forEach(((e,n)=>{if(n<r){const i=new l.DiagnosticAddendum;(function(e,t,n,i=0,s=0){if(s>k.maxTypeRecursionCount)return!0;if(k.isAnyOrUnknown(t))return!0;let r=t;if(k.isTypeVar(t)){if(k.isTypeSame(t,e))return!0;r=Ee(t)}const o=e.details.boundType;if(o&&!Pn(o,r,n.createAddendum(),void 0,i,s+1))return e.details.isSynthesized||n.addMessage(h.Localizer.DiagnosticAddendum.typeBound().format({sourceType:jn(r),destType:jn(o),name:k.TypeVarType.getReadableName(e)})),!1;const a=e.details.constraints;if(0===a.length)return!0;for(const e of a){if(k.isAnyOrUnknown(e))return!0;if(10===r.category){if(k.findSubtype(r,(t=>k.isSameWithoutLiteralValue(e,t))))return!0}else if(k.isSameWithoutLiteralValue(e,r))return!0}return n.addMessage(h.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:jn(r),name:k.TypeVarType.getReadableName(e)})),!1})(o[n],e,i)||Fe(un(t[n].node).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.typeVarAssignmentMismatch().format({type:jn(e),name:k.TypeVarType.getReadableName(o[n])})+i.getString(),t[n].node)}})),k.ClassType.cloneForSpecialization(e,a,void 0!==t)}function sn(e){return e.type?e.type:re(e.valueExpression).type}function rn(e,t){if(e.type)return e.type;let n=104;return t.isStubFile&&(n|=4),re(e.valueExpression,void 0,n).type}function on(e,t){const n=b.getScopeForNode(e);if(n){const e=b.getBuiltInScope(n).lookUpSymbol(t);if(e)return fn(e)}return k.UnknownType.create()}function an(e,t,n){const i=on(e,t);if(k.isClass(i)){let e=i;return n&&(e=k.ClassType.cloneForSpecialization(e,n,void 0!==n)),k.ObjectType.create(e)}return i}function ln(e,t,n){const i=b.getScopeForNode(e);let s=null==i?void 0:i.lookUpSymbolRecursive(t);return s&&n&&0===s.symbol.getDeclarations().filter((t=>{if(6!==t.type){const n=v.getExecutionScopeNode(e),i=4===t.type||3===t.type?t.node.name:t.node;if(n===v.getExecutionScopeNode(i)&&!Se(i,e)){const t=f.getFlowNode(e);return!(t&&Xt(t))}}return!0})).length&&(s=s.scope.parent?s.scope.parent.lookUpSymbolRecursive(t):void 0),s}function cn(e){const t=W;W=!0;try{return e()}finally{W=t}}function pn(e,t){U.enterSpeculativeContext(e);try{return t()}finally{U.leaveSpeculativeContext()}}function dn(e){const t=U.getSpeculativeRootNode();return!!t&&(void 0===e||v.isNodeContainedWithin(e,t))}function un(e){for(;36!==e.nodeType;)e=e.parent;return f.getFileInfo(e)}function hn(e,t){if(k.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 mn(e){var t;switch(e.type){case 0:{if("Any"===e.intrinsicType)return k.AnyType.create();if("class"===e.intrinsicType){const t=xt(v.getEnclosingClass(e.node));return t?t.classType:void 0}const t=an(e.node,"str"),n=an(e.node,"int");if(k.isObject(n)&&k.isObject(t)){if("str"===e.intrinsicType)return t;if("int"===e.intrinsicType)return n;if("List[str]"===e.intrinsicType){const n=on(e.node,"list");if(k.isClass(n))return k.ObjectType.create(k.ClassType.cloneForSpecialization(n,[t],!0))}if("Dict[str, Any]"===e.intrinsicType){const n=on(e.node,"dict");if(k.isClass(n))return k.ObjectType.create(k.ClassType.cloneForSpecialization(n,[t,k.AnyType.create()],!0))}}return k.UnknownType.create()}case 4:{const t=xt(e.node);return t?t.decoratedType:void 0}case 5:return ae(e.node.typeAnnotation);case 3:{const t=kt(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=ue(t,i)}}if(n){const t=ae(n,!1,!0);return At(e.node,e.node.category,t)}return}case 1:{const t=e.typeAnnotationNode;if(t){const n=he(t)?v.getTypeAnnotationNode(t):void 0;let i=ae(t);if(i)return 38===e.node.nodeType&&(i=bt(e.node,i)),n&&38===n.valueExpression.nodeType&&(i=St(i,n.valueExpression)),i}return}case 6:return}}function yn(n){const i=gn(n,!0);if(!i)return k.UnknownType.create();function s(e,t,n){if(t.path){const i=n(t.path);if(!i)return k.UnknownType.create();e.fields=i.symbolTable,e.docString=i.docString}return t.implicitImports&&t.implicitImports.forEach(((t,i)=>{const r=e.moduleName?e.moduleName+"."+i:"",o=s(k.ModuleType.create(r),t,n),a=C.Symbol.createWithType(0,o);e.loaderFields.set(i,a)})),e}if(6===i.type){const t=k.ModuleType.create(i.moduleName);if(!i.symbolName)return s(t,i,e);if(i.submoduleFallback)return s(t,i.symbolName&&i.submoduleFallback?i.submoduleFallback:i,e)}const r=mn(i);if(r)return r;const o=un(i.node);let a=!1;if(o.isInPyTypedPackage&&!o.isStubFile&&t.disableInferenceForPyTypedSources){if(1!==i.type)return k.UnknownType.create();const e=v.getEnclosingClass(i.node,!0);let t=!1;if(e){const n=xt(e);n&&k.ClassType.isEnumClass(n.classType)&&(t=!0)}if(!i.isFinal&&!i.isConstant&&!t){if(!i.typeAliasName)return k.UnknownType.create();i.typeAliasAnnotation||(a=!0)}}if(2===i.type)return Ht(i.node.name,(()=>{$t(i.node)}));if(1===i.type&&i.inferredTypeSource){const e=i.typeAliasName&&i.inferredTypeSource.parent?i.inferredTypeSource.parent:i.inferredTypeSource;let t=Ht(i.node,(()=>{Gt(e)}));if(t&&38===i.node.nodeType&&(t=bt(i.node,t)),t&&i.typeAliasName)if(k.TypeBase.isInstantiable(t)&&!k.isAnyOrUnknown(t))t=St(t,i.typeAliasName);else if(a)return k.UnknownType.create();return t}}function gn(t,n){return g.resolveAliasDeclaration(e,t,n)}function fn(e){return _n(e).type}function _n(e,t,n=!1){if(e.hasTypedDeclarations()){const t=Tn(e);return{type:t||k.UnknownType.create(),isIncomplete:!1,isRecursiveDefinition:!t}}const i=[],s=e.isPrivateMember(),r=e.getDeclarations(),o=D.isFinalVariable(e);let a=!1;return r.forEach(((l,c)=>{var p,d;let u=!n||c===r.length-1;if(void 0!==t&&6!==l.type&&v.getExecutionScopeNode(t)===v.getExecutionScopeNode(l.node)&&(Se(l.node,t)||(u=!1)),u){const t=T.isExplicitTypeAliasDeclaration(l)||T.isPossibleTypeAliasDeclaration(l);if(t&&1===l.type&&3===(null===(d=null===(p=l.inferredTypeSource)||void 0===p?void 0:p.parent)||void 0===d?void 0:d.nodeType)&&(It(l.inferredTypeSource.parent),l.typeAliasAnnotation&&re(l.typeAliasAnnotation)),ee(e,l))try{let n=yn(l);if(te(e)&&(a=!0),n){if(1===l.type){let e=1===l.type&&!!l.isConstant;k.isObject(n)&&k.ClassType.isEnumClass(n.classType)&&function(e){const t=v.getEnclosingClass(e.node,!0);if(!t)return!1;const n=xt(t);return!!n&&k.ClassType.isEnumClass(n.classType)}(l)&&(e=!0),!k.TypeBase.isInstance(n)||t||s||e||o||(n=P.stripLiteralValue(n))}i.push(n)}}catch(t){throw te(e),t}else a=!0}})),i.length>0?{type:k.combineTypes(i),isIncomplete:!1,isRecursiveDefinition:!1}:{type:k.UnboundType.create(),isIncomplete:a,isRecursiveDefinition:!1}}function Tn(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=ie(e,t);if(s)return s;if(X(e,t)<0&&ee(e,t))try{const n=mn(t);if(te(e))return n}catch(t){throw te(e),t}i--}}function vn(e,t,n=!0){return k.FunctionType.getSpecializedReturnType(e)||(n?bn(e,t):k.UnknownType.create())}function bn(e,t){let n;if(k.FunctionType.isStubDefinition(e)||k.FunctionType.isPyTypedDefinition(e))return k.UnknownType.create();if(e.inferredReturnType)n=e.inferredReturnType;else{if(e.details.declaration){const t=e.details.declaration.node;!function(i){const s=U.disableSpeculativeMode();try{n=Rt(t,k.FunctionType.isAbstractMethod(e))}finally{U.enableSpeculativeMode(s)}}(),n&&k.FunctionType.isWrapReturnTypeInAwait(e)&&(n=Ot(t,n))}n||(n=k.UnknownType.create()),e.inferredReturnType=n}if(P.isPartlyUnknown(n)&&k.FunctionType.hasUnannotatedParams(e)&&!k.FunctionType.isStubDefinition(e)&&!k.FunctionType.isPyTypedDefinition(e)&&t){const i=function(e,t){let n;if(!e.details.declaration)return;const i=e.details.declaration.node;if(t.some((e=>!e.paramName)))return;if(q.some((e=>e.functionNode===i)))return;const s=kt(i);return s&&!(t.length>6||q.length>=3)?(cn((()=>{const r=K;q.push({functionNode:i,codeFlowAnalyzer:Zt()});try{K=new Map;let o=!0;i.parameters.forEach(((e,n)=>{if(e.name){let r;const a=t.find((t=>e.name.value===t.paramName));a&&a.argument.valueExpression?(r=re(a.argument.valueExpression).type,k.isUnknown(r)||(o=!1)):e.defaultValue?(r=re(e.defaultValue).type,k.isUnknown(r)||(o=!1)):0===n&&(k.FunctionType.isInstanceMethod(s.functionType)||k.FunctionType.isClassMethod(s.functionType))&&s.functionType.details.parameters.length>0&&i.parameters[0].name&&(r=s.functionType.details.parameters[0].type),r||(r=k.UnknownType.create()),Q(e.name,r)}})),o||(n=Rt(i,k.FunctionType.isAbstractMethod(e)))}finally{q.pop(),K=r}})),n?(n=k.removeUnbound(n),k.FunctionType.isWrapReturnTypeInAwait(e)&&!P.isNoReturnType(n)&&(n=Ot(i,n)),n):void 0):void 0}(e,t);i&&(n=P.removeNoReturnFromUnion(i))}return n}function Sn(e){const t=kt(e);return t?k.FunctionType.isAbstractMethod(t.functionType)?k.AnyType.create():k.FunctionType.isGenerator(t.functionType)?P.getDeclaredGeneratorReturnType(t.functionType):t.functionType.details.declaredReturnType:k.AnyType.create()}function Cn(e){return k.isClass(e.classType)?P.partiallySpecializeType(fn(e.symbol),e.classType):k.UnknownType.create()}function In(e,t,n,i,s,r,o){const a=e.details.fields;if(k.ClassType.isSameGenericClass(t,e))return!!k.isTypeSame(t,e)||Fn(e,t,n,i,s,o+1);const l=k.ClassType.cloneForSpecialization(e,void 0,!1),c=new A.TypeVarMap(P.getTypeVarScopeId(e));let p=!0;const d=P.buildTypeVarMapFromSpecializedClass(t);if(a.forEach(((e,i)=>{if(e.isClassMember()&&!e.isIgnoredForProtocolMatch()){let s=!1,a=P.lookUpClassMember(t,i);if(!a&&r&&t.details.effectiveMetaclass&&k.isClass(t.details.effectiveMetaclass)&&(a=P.lookUpClassMember(t.details.effectiveMetaclass,i),d.addSolveForScope(P.getTypeVarScopeId(t.details.effectiveMetaclass)),s=!0),a){const r=Tn(e);if(r){let e=Cn(a);if(k.isFunction(e)||k.isOverloadedFunction(e))if(s){const n=Un(t,e,void 0,void 0,!1,t);n&&(e=n)}else if(k.isClass(a.classType)){const n=Un(k.ObjectType.create(t),e,a.classType,void 0,!1,void 0,!0);n&&(e=n)}const l=n.createAddendum();Pn(r,e,l.createAddendum(),c,0,o+1)||(l.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1)}e.isClassVar()&&!a.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((a=>{!k.isClass(a)||k.ClassType.isBuiltIn(a,"object")||k.ClassType.isBuiltIn(a,"Protocol")||In(P.specializeForBaseClass(e,a),t,n.createAddendum(),i,s,r,o+1)||(p=!1)})),p&&e.details.typeParameters.length>0&&e.typeArguments){const t=P.applySolvedTypeVars(l,c);Fn(e,t,n,i,s,o)||(p=!1)}return p}function Dn(e,t,n,i,s,r,o,l=!1){if(k.ClassType.isProtocolClass(e))return In(e,t,n,i,s,l,r);if(k.ClassType.isTypedDictClass(e)&&k.ClassType.isTypedDictClass(t))return function(e,t,n,i){let s=!0;const r=Mn(e),o=Mn(t);return r.forEach(((r,a)=>{const l=o.get(a);l?(r.isRequired&&!l.isRequired?(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:a,type:jn(e)})),s=!1):!r.isRequired&&l.isRequired&&(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldNotRequired().format({name:a,type:jn(e)})),s=!1),k.isTypeSame(r.valueType,l.valueType,i+1)||(n.addMessage(h.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:a})),s=!1)):(n.addMessage(h.Localizer.DiagnosticAddendum.typedDictFieldMissing().format({name:a,type:jn(t)})),s=!1)})),s}(e,t,n,r);if(k.ClassType.isPropertyClass(e)&&k.ClassType.isPropertyClass(t)){let i=!0;const s=xn(e,!0),o=xn(t,!0);return s&&o&&(Pn(s,o,n,void 0,0,r+1)||(i=!1)),i}const c=O[e.details.fullName];if(c&&c.some((e=>e===t.details.fullName))&&0==(1&s))return!0;if(0==(1&s)||k.ClassType.isSameGenericClass(t,e)){const o=[];if(k.ClassType.isDerivedFrom(t,e,o))return a.assert(o.length>0),function(e,t,n,i,s,r,o){let a=t,l=s||new A.TypeVarMap(P.getTypeVarScopeId(e)),c=r;s||(c&=-9);for(let t=n.length-1;t>=0;t--){const s=n[t];if(k.isUnknown(s))return!0;if(k.ClassType.isBuiltIn(s,"object"))return!0;if(t<n.length-1&&(a=P.specializeForBaseClass(a,s)),0===t&&k.ClassType.isBuiltIn(e)&&k.ClassType.isVariadicTypeParam(e)){if(e.variadicTypeArguments&&a.variadicTypeArguments){const t=e.variadicTypeArguments;let n=t.length;const s=2===n&&P.isEllipsisType(t[1]);s&&(n=1);const r=a.variadicTypeArguments;let p=r.length;const d=2===p&&P.isEllipsisType(r[1]);if(d&&(p=1),(r.length!==n||d)&&!s)return d?i.addMessage(h.Localizer.DiagnosticAddendum.tupleSizeMismatchIndeterminate().format({expected:n})):i.addMessage(h.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:n,received:r.length})),!1;for(let e=0;e<Math.max(n,p);e++){const n=(s?t[0]:t[e])||k.AnyType.create(),a=(d?r[0]:r[e])||k.AnyType.create(),p=i.createAddendum();if(!Pn(n,a,p.createAddendum(),l,c,o+1))return p.addMessage(h.Localizer.DiagnosticAddendum.tupleEntryTypeMismatch().format({entry:e+1})),!1}}return!0}if(0!==k.ClassType.getTypeParameters(s).length){if(!s.typeArguments)return!0;if(!Fn(s,a,i,l,c,o))return!1;l=new A.TypeVarMap(P.getTypeVarScopeId(s)),c&=-9}}if(e.typeArguments){if(!Fn(e,a,i,s,r,o))return!1}else if(s&&e.details.typeParameters.length>0&&a.typeArguments&&!s.isLocked()){const t=a.typeArguments;for(let n=0;n<e.details.typeParameters.length;n++){const i=n<t.length?t[n]:k.UnknownType.create();s.setTypeVar(e.details.typeParameters[n],i,!0)}k.ClassType.isVariadicTypeParam(a)&&a.variadicTypeArguments&&e.details.typeParameters.length>=1&&s.setVariadicTypeVar(e.details.typeParameters[0],a.variadicTypeArguments)}return!0}(e,t,o,n,i,s,r+1)}if(k.ClassType.isBuiltIn(e,"object")&&0==(1&s))return!0;const p=o?k.ObjectType.create(e):e,d=o?k.ObjectType.create(t):t;return n.addMessage(h.Localizer.DiagnosticAddendum.typeIncompatible().format({sourceType:jn(d),destType:jn(p)})),!1}function xn(e,t){if(!k.ClassType.isPropertyClass(e))return;const n=e.details.fields.get("fget");if(n){const e=Tn(n);if(e&&k.isFunction(e))return vn(e,void 0,t)}}function Fn(e,t,n,i,s,r){a.assert(k.ClassType.isSameGenericClass(e,t));const o=k.ClassType.getTypeParameters(e);let c,p;if(!e.typeArguments||!t.typeArguments)return!0;if(k.ClassType.isVariadicTypeParam(e)?(c=e.variadicTypeArguments||[],p=t.variadicTypeArguments):(c=e.typeArguments,p=t.typeArguments),p&&t.isTypeArgumentExplicit&&(k.ClassType.isSpecialBuiltIn(t)||p.length===o.length))for(let e=0;e<p.length;e++){const t=p[e],a=e>=c.length?c.length-1:e,d=a>=0?c[a]:k.UnknownType.create(),u=a<o.length?o[a]:void 0,m=new l.DiagnosticAddendum;if(u&&1!==u.details.variance){if(2===u.details.variance){if(!Pn(t,d,m,i,2^s,r+1)){const e=n.createAddendum();return e.addMessage(h.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:k.TypeVarType.getReadableName(u)})),e.addAddendum(m),!1}}else if(!Pn(d,t,m,i,1|s,r+1)){const e=n.createAddendum();return e.addMessage(h.Localizer.DiagnosticAddendum.typeVarIsInvariant().format({name:k.TypeVarType.getReadableName(u)})),e.addAddendum(m),!1}}else if(!Pn(d,t,m,i,s,r+1)){if(u){const e=n.createAddendum();e.addMessage(h.Localizer.DiagnosticAddendum.typeVarIsCovariant().format({name:k.TypeVarType.getReadableName(u)})),e.addAddendum(m)}return!1}}return!0}function kn(e,t,n,i,s,r=0,o=0){let a=!0;if(!e.scopeId)return!0;if(!s.hasSolveForScope(e.scopeId)){if(k.isAnyOrUnknown(t))return!0;if(a=!1,!e.details.isSynthesized)return i.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1}if(e.details.isParamSpec)return i.addMessage(h.Localizer.DiagnosticAddendum.typeParamSpec().format({type:jn(t),name:e.details.name})),!1;const c=s.getTypeVar(e);if(e.details.constraints.length>0){let n;const r=Ee(t);if(k.isTypeVar(t)?Pn(e,r,new l.DiagnosticAddendum,new A.TypeVarMap(e.scopeId))&&(n=t):(n=P.mapSubtypes(r,(t=>{let n;return e.details.constraints.forEach((e=>{Pn(e,t,new l.DiagnosticAddendum)&&(n&&!Pn(n,e,new l.DiagnosticAddendum)||(n=e))})),n})),k.isNever(n)&&(n=void 0)),!n)return i.addMessage(h.Localizer.DiagnosticAddendum.typeConstraint().format({type:jn(t),name:e.details.name})),!1;if(c&&!k.isAnyOrUnknown(c)){if(!Pn(c,n,new l.DiagnosticAddendum)){if(!Pn(n,c,new l.DiagnosticAddendum))return i.addMessage(h.Localizer.DiagnosticAddendum.typeConstraint().format({type:jn(n),name:jn(c)})),!1;!s.isLocked()&&a&&s.setTypeVar(e,n,!1)}}else!s.isLocked()&&a&&s.setTypeVar(e,n,!1);return!0}let p=t;const d=s.isNarrowable(e)&&!s.isLocked(),u=n&&d;if(c){const e=new l.DiagnosticAddendum;if(n){if(d&&Pn(t,c,e,s,r,o+1))k.isAnyOrUnknown(c)||k.isUnknown(t)||(p=c);else if(!Pn(c,t,new l.DiagnosticAddendum,s,r,o+1))return i.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(c)})),!1}else if(Pn(c,t,e,s,r,o+1))d||k.isUnknown(c)||(p=c);else{if(s.isLocked())return i.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(c),destType:jn(t)})),!1;Pn(t,c,new l.DiagnosticAddendum,s,r,o+1)||(p=k.combineTypes([c,t]))}}return e.details.boundType&&!Pn(e.details.boundType,p,i.createAddendum(),s,0,o+1)?(e.details.isSynthesized||i.addMessage(h.Localizer.DiagnosticAddendum.typeBound().format({sourceType:jn(p),destType:jn(e.details.boundType),name:k.TypeVarType.getNameWithScope(e)})),!1):(!s.isLocked()&&a&&s.setTypeVar(e,p,u),!0)}function Pn(e,t,n,i,s=0,r=0){if(e=P.transformPossibleRecursiveTypeAlias(e),t=P.transformPossibleRecursiveTypeAlias(t),r>k.maxTypeRecursionCount)return!0;if(e===t)return!0;if(k.isUnbound(e)||k.isUnbound(t))return!0;const o=0!=(4&s);if(s&=-5,k.isTypeVar(e)){if(k.isTypeSame(e,t))return!0;const a=e;if(a.details.constraints.length>0&&void 0===k.findSubtype(t,((e,t)=>!(k.isTypeSame(a,e)||(null==t?void 0:t.find((e=>e.typeVarName===k.TypeVarType.getNameWithScope(a))))&&a.details.constraints.some((t=>Pn(t,e,new l.DiagnosticAddendum)))))))return!0;if(8&s){if(k.isTypeVar(t))return!0}else if(0==(2&s))return kn(e,t,o,n,i||new A.TypeVarMap,s,r+1)}if(k.isAnyOrUnknown(e))return!0;if(k.isAnyOrUnknown(t)){if(i){const n=P.isEllipsisType(t)?k.AnyType.create():t;P.setTypeArgumentsRecursive(e,n,i)}if(0==(16&s))return!0}if(k.isNever(t))return i&&P.setTypeArgumentsRecursive(e,k.UnknownType.create(),i),!0;if(k.isTypeVar(t))if(8&s){if(10!==e.category)return!!k.isTypeVar(e)||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1)}else if(0!=(2&s))return kn(t,e,!0,n,i||new A.TypeVarMap(P.getTypeVarScopeId(t)),s,r+1);if(10===t.category){if(k.isTypeSame(t,e))return!0;let o=!1;return P.doForEachSubtype(t,(t=>{Pn(e,t,n.createAddendum(),i,s,r+1)||(o=!0)})),!o||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1)}if(10===e.category){if(1&s){let o=!1;return P.doForEachSubtype(e,((a,c)=>{let p=!1;k.isAnyOrUnknown(a)||P.doForEachSubtype(e,((e,t)=>{c===t||p||Pn(e,a,new l.DiagnosticAddendum,void 0,0,r+1)&&(p=!0)})),p||Pn(a,t,n.createAddendum(),i,s,r+1)||(o=!0)})),!o||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1)}const o=new l.DiagnosticAddendum;let a=!1;if(k.isNone(t)&&P.isOptionalType(e))a=!0;else{let n,l;P.doForEachSubtype(e,(e=>{const c=null==i?void 0:i.clone();if(Pn(e,t,o,c,s,r+1)&&(a=!0,c)){const e=c.getScore();(void 0===l||l<=e)&&(l=e,n=c)}})),i&&n&&i.copyFromClone(n)}return a||k.isTypeVar(t)&&t.details.constraints.length>0&&(a=Pn(e,Ee(t),o,i,s,r+1)),!!a||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),n.addAddendum(o),!1)}if(k.isNone(e)&&k.isNone(t))return!0;if(k.isObject(t)&&k.ClassType.isBuiltIn(t.classType,"type")){const o=t.classType.typeArguments;if(o&&o.length>=1){if(k.isAnyOrUnknown(o[0]))return!0;if(k.isObject(o[0]))return!!Pn(e,o[0].classType,n.createAddendum(),i,s,r+1)||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1)}}if(k.isClass(e)){const o=Ee(t);if(k.isClass(o))return!!Dn(e,o,n,i,s,r+1,!1)||(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1)}if(k.isObject(e)){const o=e.classType;if(k.ClassType.isBuiltIn(o,"Type")){const e=o.typeArguments;if(e&&e.length>=1&&k.TypeBase.isInstance(e[0])&&k.TypeBase.isInstantiable(t))return Pn(e[0],P.convertToInstance(t),n,i,s,r+1)}else if(k.ClassType.isBuiltIn(o,"type")&&k.TypeBase.isInstantiable(t))return!0;const a=Ee(t);if(k.isObject(a))return void 0===e.classType.literalValue||void 0!==a.classType.literalValue&&k.ClassType.isLiteralValueSame(a.classType,e.classType)?!!Dn(o,a.classType,n,i,s,r+1,!0):(n.addMessage(h.Localizer.DiagnosticAddendum.literalAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1);if(k.isFunction(a)){const t=An(e);if(t)return wn(t,a,n,i||new A.TypeVarMap,s,r+1);if(k.ClassType.isBuiltIn(e.classType,"object")&&0==(1&s))return!0}else if(k.isModule(a)){if(k.ClassType.isBuiltIn(o,"ModuleType"))return!0}else if(k.isClass(a)){const e=a.details.effectiveMetaclass;if(e){if(k.isAnyOrUnknown(e))return!0;if(k.isClass(e)&&!k.ClassType.isBuiltIn(e,"type"))return Dn(o,a,n,i,s,r+1,!1,!0)}}else if(k.isAnyOrUnknown(a))return 0==(16&s);const l=An(e);l&&(e=l)}if(k.isFunction(e)){let o;const a=Ee(t);if(k.isOverloadedFunction(a)){if(e.details.paramSpec)return n.addMessage(h.Localizer.DiagnosticAddendum.paramSpecOverload()),!1;const t=a.overloads,l=t.findIndex((t=>{const o=i?i.clone():void 0;return Pn(e,t,n.createAddendum(),o,s,r+1)}));if(l<0)return n.addMessage(h.Localizer.DiagnosticAddendum.noOverloadAssignable().format({type:jn(e)})),!1;o=t[l]}else if(k.isFunction(a))o=a;else if(k.isObject(a)){const e=P.lookUpObjectMember(a,"__call__");if(e){const t=Cn(e);if(k.isFunction(t)){const e=Un(a,t);e&&(o=e)}}}else if(k.isClass(a)){const e=k.FunctionType.createInstance("__init__","",69);e.details.declaredReturnType=k.ObjectType.create(a);let t=P.lookUpClassMember(a,"__init__",12);t||(t=P.lookUpClassMember(a,"__new__",12));const n=t?Cn(t):void 0;n&&k.isFunction(n)?n.details.parameters.forEach(((t,n)=>{n>0&&k.FunctionType.addParameter(e,t)})):k.FunctionType.addDefaultParameters(e),o=e}else if(k.isAnyOrUnknown(a))return 0==(16&s);if(o&&wn(e,o,n.createAddendum(),i||new A.TypeVarMap,s,r+1))return!0}if(k.isOverloadedFunction(e)){const o=n.createAddendum();return!e.overloads.some((e=>(i&&i.addSolveForScope(P.getTypeVarScopeId(e)),!Pn(e,t,o.createAddendum(),i||new A.TypeVarMap(P.getTypeVarScopeId(e)),s,r+1))))||(o.addMessage(h.Localizer.DiagnosticAddendum.overloadNotAssignable().format({name:e.overloads[0].details.name})),!1)}return!(!k.isObject(e)||!k.ClassType.isBuiltIn(e.classType,"object")||0!=(1&s))||(k.isNone(t)&&k.isObject(e)&&k.ClassType.isProtocolClass(e.classType)&&j&&k.isClass(j)?In(e.classType,j,n,i,s,!1,r):k.isNone(e)?(n.addMessage(h.Localizer.DiagnosticAddendum.assignToNone()),!1):(n.addMessage(h.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:jn(t),destType:jn(e)})),!1))}function An(e){if(!k.ClassType.isProtocolClass(e.classType))return;const t=P.lookUpObjectMember(e,"__call__");if(!t)return;const n=Cn(t);if(k.isFunction(n)){const t=Un(e,n);if(t)return t}}function En(e,t,n,i,s,r,o,a){return!!(k.isTypeVar(e)&&e.details.isSynthesized&&e.details.boundType&&k.isObject(e.details.boundType)&&k.ClassType.isProtocolClass(e.details.boundType.classType))||(Pn(t,e,new l.DiagnosticAddendum,s,2^o,a+1),!!Pn(t,P.applySolvedTypeVars(e,s),i.createAddendum(),r,o,a+1)||(i.addMessage(h.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:jn(e),destType:jn(t)})),!1))}function wn(e,t,n,i,s,r){let o=!0;const a=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));g=g.filter((e=>0===e.category&&e.name));const _=Math.min(u.length,g.length),T=new A.TypeVarMap(P.getTypeVarScopeId(t));if(!k.FunctionType.shouldSkipParamCompatibilityCheck(e)){for(let a=0;a<_;a++){const l=k.FunctionType.getEffectiveParameterType(t,c.findIndex((e=>e===u[a])));En(k.FunctionType.getEffectiveParameterType(e,p.findIndex((e=>e===g[a]))),l,a+1,n.createAddendum(),i,T,s,r)||(o=!1)}if(g.length<u.length){if(!e.details.paramSpec){const a=c.filter((e=>!!e.name&&!e.hasDefault)).length;if(f<0)g.length<a&&(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.functionTooFewParams().format({expected:a,received:g.length})),o=!1);else{const a=k.FunctionType.getEffectiveParameterType(e,f);if(!k.isAnyOrUnknown(a))for(let e=g.length;e<u.length;e++)En(a,k.FunctionType.getEffectiveParameterType(t,c.findIndex((t=>t===u[e]))),e+1,n.createAddendum(),i,T,s,r)||(o=!1)}}}else if(u.length<g.length)if(m>=0){const a=k.FunctionType.getEffectiveParameterType(t,m);if(!k.isAnyOrUnknown(a))for(let t=u.length;t<g.length;t++)En(k.FunctionType.getEffectiveParameterType(e,p.findIndex((e=>e===g[t]))),a,t+1,n.createAddendum(),i,T,s,r)||(o=!1)}else n.addMessage(h.Localizer.DiagnosticAddendum.functionTooManyParams().format({expected:u.length,received:g.length})),o=!1;if(m>=0&&f>=0){const a=k.FunctionType.getEffectiveParameterType(t,m);En(k.FunctionType.getEffectiveParameterType(e,f),a,f+1,n.createAddendum(),i,T,s,r)||(o=!1)}if(m<0&&f>=0&&(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.argsParamMissing().format({paramName:p[f].name})),o=!1),!e.details.paramSpec){const a=new Map;let l=!1;y>=0&&p.forEach(((e,t)=>{t>=y&&(2===e.category?l=!0:e.name&&0===e.category&&a.set(e.name,e))})),g.length<u.length&&f<0&&(d=g.length),d>=0&&c.forEach(((e,t)=>{if(t>=d&&e.name&&0===e.category){const t=a.get(e.name),c=n.createAddendum();if(t){const n=i?P.applySolvedTypeVars(t.type,i):t.type;Pn(e.type,n,c.createAddendum(),void 0,s,r+1)||(c.addMessage(h.Localizer.DiagnosticAddendum.namedParamTypeMismatch().format({name:e.name,sourceType:jn(n),destType:jn(e.type)})),o=!1),a.delete(e.name)}else l||e.hasDefault||(c.addMessage(h.Localizer.DiagnosticAddendum.namedParamMissingInDest().format({name:e.name})),o=!1)}})),a.forEach(((e,t)=>{n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.namedParamMissingInSource().format({name:t})),o=!1}));const m=c.findIndex((e=>2===e.category&&e.name)),_=p.findIndex((e=>2===e.category&&e.name));if(m>=0&&_>=0){const a=k.FunctionType.getEffectiveParameterType(t,m);En(k.FunctionType.getEffectiveParameterType(e,_),a,_,n.createAddendum(),i,T,s,r)||(o=!1)}m<0&&_>=0&&(n.createAddendum().addMessage(h.Localizer.DiagnosticAddendum.argsParamMissing().format({paramName:p[_].name})),o=!1)}}if(i&&!i.isLocked()&&(T.getTypeVars().forEach((e=>{Pn(e.typeVar,e.type,new l.DiagnosticAddendum,i)})),i.getTypeVars().forEach((e=>{const t=P.applySolvedTypeVars(e.type,i);t!==e.type&&i.setTypeVar(e.typeVar,t,i.isNarrowable(e.typeVar))})),e.details.paramSpec&&i.setParamSpec(e.details.paramSpec,t.details.parameters.map(((e,n)=>({category:e.category,name:e.name,hasDefault:!!e.hasDefault,type:k.FunctionType.getEffectiveParameterType(t,n)}))).slice(e.details.parameters.length,t.details.parameters.length))),a){const a=vn(e);if(!k.isAnyOrUnknown(a)){const e=P.applySolvedTypeVars(vn(t),T),l=n.createAddendum();Pn(a,e,l.createAddendum(),i,s,r+1)||(l.addMessage(h.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:jn(e),destType:jn(a)})),o=!1)}}return o}function Nn(e,t){if(t.details.typeParameters.length>0&&t.typeArguments&&t.typeArguments.length<=t.details.typeParameters.length){const n=new A.TypeVarMap(P.getTypeVarScopeId(t));Xe(k.ClassType.cloneForSpecialization(t,void 0,!1),k.ObjectType.create(e),n,[]);let i=!1;const s=t.typeArguments.map(((e,s)=>{const r=t.details.typeParameters[s],o=n.getTypeVar(r);return o&&(2===o.category||k.isAnyOrUnknown(e))?(i=!0,o):e}));if(i)return k.ClassType.cloneForSpecialization(t,s,!0)}}function On(e,t){const n=new l.DiagnosticAddendum,i=P.mapSubtypes(t,(t=>{const i=P.mapSubtypes(e,(i=>{if(k.isAnyOrUnknown(e))return e;if(Pn(i,t,n)){if(k.isClass(i)&&k.isClass(t)){const e=Nn(i,t);e&&(t=e)}else if(k.isObject(i)&&k.isObject(t)){const e=Nn(i.classType,t.classType);e&&(t=k.ObjectType.create(e))}return t}}));return k.isNever(i)?t:i}));return k.isAnyOrUnknown(t)?e:i}function Rn(e){const t=new Map;e.details.mro.forEach((e=>{k.isClass(e)&&e.details.fields.forEach(((n,i)=>{if(n.isClassMember()){let s;const r=D.getLastTypedDeclaredForSymbol(n);s=!(!r||3!==r.type)&&!!(8&Et(r.node,!0)),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 Mn(e){if(!e.details.typedDictEntries){const t=new Map;Ln(e,t),e.details.typedDictEntries=t}const t=new Map;return e.details.typedDictEntries.forEach(((e,n)=>{t.set(n,Object.assign({},e))})),t}function Ln(e,t,n=0){a.assert(k.ClassType.isTypedDictClass(e)),n>k.maxTypeRecursionCount||(e.details.baseClasses.forEach((e=>{k.isClass(e)&&k.ClassType.isTypedDictClass(e)&&Ln(e,t,n+1)})),e.details.fields.forEach(((n,i)=>{if(!n.isIgnoredForProtocolMatch()){const s=D.getLastTypedDeclaredForSymbol(n);s&&1===s.type&&t.set(i,{valueType:Tn(n)||k.UnknownType.create(),isRequired:!k.ClassType.isCanOmitDictValues(e),isProvided:!1})}})))}function Un(e,t,n,i,s=!1,r,o=!1){if(k.isFunction(t)){if(!e)return k.FunctionType.clone(t,!0);if(k.FunctionType.isInstanceMethod(t)){const s=k.isObject(e)?e:k.ObjectType.create(P.specializeClassType(e));return Vn(e,t,n||s.classType,i,r||s,k.isObject(e)&&!o)}if(k.FunctionType.isClassMethod(t)||s&&k.FunctionType.isConstructorMethod(t)){const s=k.isClass(e)?e:e.classType,a=r?k.isClass(e)?r:P.convertToInstantiable(r):s;return Vn(e,t,n||s,i,a,!o)}if(k.FunctionType.isStaticMethod(t)){const s=k.isClass(e)?e:e.classType;return Vn(e,t,n||s,i,void 0,!1)}}else if(k.isOverloadedFunction(t)){const a=k.OverloadedFunctionType.create();return t.overloads.forEach((t=>{const i=Un(e,t,n,void 0,s,r,o);i&&k.OverloadedFunctionType.addOverload(a,i)})),1===a.overloads.length?a.overloads[0]:0===a.overloads.length?void(i&&t.overloads.forEach((t=>{Un(e,t,n,i,s,r,o)}))):a}return t}function Vn(e,t,n,i,s,r=!0){const o=n.typeArguments?P.buildTypeVarMapFromSpecializedClass(n):new A.TypeVarMap(P.getTypeVarScopeId(n));if(s&&t.details.parameters.length>0){const r=t.details.parameters[0],a=P.stripLiteralValue(s);o.addSolveForScope(P.getTypeVarScopeId(t));const p=new l.DiagnosticAddendum;if(k.isTypeVar(r.type)&&r.type.details.boundType&&k.ClassType.isProtocolClass(n))o.isLocked()||o.setTypeVar(r.type,a,!1);else if(!Pn(r.type,a,p,o)&&r.name&&!r.isNameSynthesized&&r.hasDeclaredType){if(!i)return;Fe(un(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.bindTypeMismatch().format({type:jn(e),methodName:t.details.name,paramName:r.name})+p.getString(),i)}}vn(t);const a=P.applySolvedTypeVars(t,o);return k.FunctionType.clone(a,r,P.getTypeVarScopeId(e))}function zn(e){return F.printObjectTypeForClass(e,t.printTypeFlags,vn)}function jn(e,n=!1){return F.printType(e,t.printTypeFlags,vn,n)}function Bn(e){return e.start}return{runWithCancellationToken:function(e,t){try{return z=e,t()}finally{z=void 0}},getType:se,getTypeOfClass:xt,getTypeOfFunction:kt,evaluateTypesForStatement:Gt,getDeclaredTypeForExpression:me,verifyRaiseExceptionType:function(e){const t=on(e,"BaseException");if(e.typeExpression){const n=se(e.typeExpression);if(n&&t&&k.isClass(t)){const i=new l.DiagnosticAddendum;P.doForEachSubtype(n,(n=>{if(!k.isAnyOrUnknown(n))if(k.isClass(n))if(P.derivesFromClassRecursive(n,t,!1)){let t;cn((()=>{t=Qe(e.typeExpression,[],n,!1,void 0)})),t&&t.argumentErrors&&i.addMessage(h.Localizer.Diagnostic.exceptionTypeNotInstantiable().format({type:jn(n,!1)}))}else i.addMessage(h.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:jn(n,!1)}));else k.isObject(n)&&P.derivesFromClassRecursive(n.classType,t,!1)||i.addMessage(h.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:jn(n,!1)}))})),i.isEmpty()||Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.expectedExceptionClass()+i.getString(),e.typeExpression)}}},verifyDeleteExpression:function(e){switch(e.nodeType){case 38:re(e);break;case 35:{const t=re(e.leftExpression),n=Ve(e,t,{method:"del"},0);Q(e.memberName,n.type),Q(e,n.type);break}case 24:{const t=re(e.baseExpression,void 0,2);We(e,t.type,{method:"del"},0),Q(e,k.UnboundType.create());break}case 0:cn((()=>{e.child&&re(e.child)}));break;default:Fe(un(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,h.Localizer.Diagnostic.delTargetExpr(),e)}},isAfterNodeReachable:be,isNodeReachable:ve,suppressDiagnostics:cn,getDeclarationsForNameNode:function(e){if(f.isCodeUnreachable(e))return;const t=[];if(e.parent&&23===e.parent.nodeType&&e.parent.alias&&e===e.parent.name){const n=b.getScopeForNode(e);if(n){const i=n.lookUpSymbolRecursive(e.parent.alias.value);if(i){const n=i.symbol.getDeclarations().filter((t=>6===t.type&&t.node===e.parent)).map((e=>{if(6===e.type){const t=Object.assign({},e);return t.usesLocalName=!1,t}return e}));t.push(...n)}}}else if(e.parent&&35===e.parent.nodeType&&e===e.parent.memberName){let n=se(e.parent.leftExpression);if(n){n=Ee(n);const i=e.parent.memberName.value;P.doForEachSubtype(n,(e=>{let n;if(k.isClass(e)){let t=P.lookUpClassMember(e,i,16);t||(t=P.lookUpClassMember(e,i)),t&&(n=t.symbol)}else if(k.isObject(e)){let t=P.lookUpObjectMember(e,i,16);t||(t=P.lookUpObjectMember(e,i)),t&&(n=t.symbol)}else k.isModule(e)&&(n=k.ModuleType.getField(e,i));if(n){const e=n.getTypedDeclarations();e.length>0?t.push(...e):t.push(...n.getDeclarations())}}))}}else if(e.parent&&37===e.parent.nodeType){const n=e.parent.nameParts.findIndex((t=>t===e)),i=f.getImportInfo(e.parent);if(n>=0&&i&&!i.isNativeLib&&n<i.resolvedPaths.length&&i.resolvedPaths[n]){Gt(e);const s={type:6,node:void 0,path:i.resolvedPaths[n],range:u.getEmptyRange(),implicitImports:new Map,usesLocalName:!1,moduleName:""};t.push(s)}}else if(e.parent&&1===e.parent.nodeType&&e===e.parent.name){const n=e.parent,i=e.value;if(n.parent&&9===n.parent.nodeType){const e=se(n.parent.leftExpression);if(e)if(k.isFunction(e)&&e.details.declaration){const n=hn(e,i);n&&t.push(n)}else if(k.isClass(e)){const s=ce(n.parent.leftExpression,k.ObjectType.create(e),"__init__",{method:"get"},new l.DiagnosticAddendum,4);if(s&&k.isFunction(s)){const n=hn(s,i);if(n)t.push(n);else if(k.ClassType.isDataClass(e)){const n=P.lookUpClassMember(e,i);n&&t.push(...n.symbol.getDeclarations())}}}}}else{let n=!1;v.isWithinTypeAnnotation(e,!oe(un(e)))&&(n=!0);const i=ln(e,e.value,!n);i&&t.push(...i.symbol.getDeclarations())}return t},getTypeForDeclaration:mn,resolveAliasDeclaration:gn,getTypeFromIterable:ge,getTypedDictMembersForClass:Mn,getGetterTypeFromProperty:xn,markNamesAccessed:function(e,t){const n=un(e),i=b.getScopeForNode(e);i&&t.forEach((t=>{const s=i.lookUpSymbolRecursive(t);s&&Oe(n,s.symbol,e)}))},getScopeIdForNode:Le,makeTopLevelTypeVarsConcrete:Ee,getEffectiveTypeOfSymbol:fn,getFunctionDeclaredReturnType:Sn,getFunctionInferredReturnType:bn,getBuiltInType:on,getTypeOfMember:Cn,bindFunctionToClassOrObject:Un,getCallSignatureInfo: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+1<n.count){const e=n.getItemAt(r+1);if(13===e.type&&t<u.TextRange.getEnd(e))return}if(t>=u.TextRange.getEnd(i))return;const o=i.leftExpression,a=se(o);if(void 0===a)return;const l=[];let c=!1,p=0;function d(){l.push({argumentCategory:p,type:k.UnknownType.create(),active:!0})}i.arguments.forEach((e=>{let i=!1;if(!c){let s=e.start;const r=n.getItemAtPosition(s);r>=0&&(s=u.TextRange.getEnd(n.getItemAt(r-1)));let o=u.TextRange.getEnd(e);const a=n.getItemAtPosition(o);if(a>=0)for(let e=a;e<n.count;e++){const t=n.getItemAt(e);switch(t.type){case 12:case 14:break;default:continue}o=u.TextRange.getEnd(t);break}t<o&&(t>=s?i=!0:d(),c=!0)}p=e.argumentCategory,l.push({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,name:e.name,active:i})})),c||d();const h=[];function m(e){let t;pn(i,(()=>{t=tt(o,l,e,new A.TypeVarMap(P.getTypeVarScopeId(e)),!0)})),h.push({type:e,activeParam:null==t?void 0:t.activeParam})}function y(e){k.isFunction(e)?m(e):e.overloads.forEach(m)}return P.doForEachSubtype(a,(e=>{switch(e.category){case 5:case 6:y(e);break;case 7:{let t;t=de(e,"__init__"),(!t||k.isFunction(t)&&k.FunctionType.isSkipConstructorCheck(t))&&(t=de(e,"__new__",!0)),t&&y(t);break}case 8:{const t=de(e.classType,"__call__");t&&y(t);break}}})),0!==h.length?{callNode:i,signatures:h}:void 0},getTypeAnnotationForParameter:ue,canAssignType:Pn,canOverrideMethod:function(e,t,n){if(k.isOverloadedFunction(e)&&(e=e.overloads[e.overloads.length-1]),!k.isFunction(e))return n.addMessage(h.Localizer.DiagnosticAddendum.overrideType().format({type:jn(e)})),!1;let i=!0;const s=e.details.parameters,r=t.details.parameters;let o=!1;if(r.length<s.length)o=!0;else if(r.length>s.length)for(let e=s.length;e<r.length;e++){const t=r[e];0===t.category&&t.name&&!t.hasDefault&&(o=!0)}o&&(n.addMessage(h.Localizer.DiagnosticAddendum.overrideParamCount().format({baseCount:s.length,overrideCount:r.length})),i=!1);const a=Math.min(s.length,r.length),l=s.findIndex((e=>!e.name&&0===e.category));for(let o=0;o<a;o++){const a=s[o],c=r[o];if(o>l&&!I.isPrivateOrProtectedName(a.name||"")&&0===a.category&&a.name!==c.name)n.addMessage(h.Localizer.DiagnosticAddendum.overrideParamName().format({index:o+1,baseName:a.name||"*",overrideName:c.name||"*"})),i=!1;else{const s=k.FunctionType.getEffectiveParameterType(e,o),r=k.FunctionType.getEffectiveParameterType(t,o),l=k.isTypeVar(s)&&s.details.isSynthesized,p=k.isTypeVar(r)&&r.details.isSynthesized;l||p||a.category===c.category&&Pn(r,s,n.createAddendum(),void 0,8)||(n.addMessage(h.Localizer.DiagnosticAddendum.overrideParamType().format({index:o+1,baseType:jn(s),overrideType:jn(r)})),i=!1)}}const c=vn(e),p=vn(t);return Pn(c,p,n.createAddendum(),void 0,8)||(n.addMessage(h.Localizer.DiagnosticAddendum.overrideReturnType().format({baseType:jn(c),overrideType:jn(p)})),i=!1),i},addError:Ie,addWarning:function(e,t,n){return De("warning",e,t,n)},addInformation:Ce,addUnusedCode:function(e,t){xe(e)||un(e).diagnosticSink.addUnusedCodeWithTextRange(h.Localizer.Diagnostic.unreachableCode(),t)},addDiagnostic:Fe,addDiagnosticForTextRange:function(e,t,n,i,s){if("none"===t)return;const r=e.diagnosticSink.addDiagnosticWithTextRange(t,i,s);return r.setRule(n),r},printType:jn,printFunctionParts:function(e){return F.printFunctionParts(e,t.printTypeFlags,vn)},getTypeCacheSize:function(){return L.size}}}},3843: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 o=r(n(8494)),a=n(1133),l=n(5168),c=/'/g,p=/'''/g;function d(e,t,n,i=!1,s=0){if(s>=a.maxTypeRecursionCount)return"...";if(e.typeAliasInfo&&!i){let i=e.typeAliasInfo.aliasName;if(e.typeAliasInfo.typeArguments?(0==(2&t)||e.typeAliasInfo.typeArguments.some((e=>!a.isAnyOrUnknown(e))))&&(i+="["+e.typeAliasInfo.typeArguments.map((e=>d(e,t,n,!1,s+1))).join(", ")+"]"):e.typeAliasInfo.typeParameters&&(0==(2&t)||e.typeAliasInfo.typeParameters.some((e=>!a.isAnyOrUnknown(e))))&&(i+="["+e.typeAliasInfo.typeParameters.map((e=>d(e,t,n,!1,s+1))).join(", ")+"]"),11!==e.category)return i}switch(e.category){case 0:return"Unbound";case 1:return 0!=(1&t)?"Any":"Unknown";case 9:return`Module("${e.moduleName}")`;case 7:return void 0!==e.literalValue?`Type[Literal[${u(e)}]]`:`Type[${h(e,t,n,s+1)}]`;case 8:return void 0!==e.classType.literalValue?`Literal[${u(e.classType)}]`:h(e.classType,t,n,s+1);case 5:{const i=m(e,t,n,s);return e.details.paramSpec?e.details.parameters.length>0?`Callable[Concatenate[${e.details.parameters.map((e=>d(e.type,t,n))).join(", ")}, ${e.details.paramSpec.details.name}], ${i[1]}]`:`Callable[${e.details.paramSpec.details.name}, ${i[1]}]`:`(${i[0].join(", ")}) -> ${i[1]}`}case 6:return`Overload[${e.overloads.map((e=>d(e,t,n,!1,s+1))).join(", ")}]`;case 10:{if(e.constraints&&(e=a.combineTypes(e.subtypes)),l.isOptionalType(e)){const i=d(a.removeNoneFromUnion(e),t,n,!1,s+1);return 8&t?i+" | None":"Optional["+i+"]"}let i=[];l.doForEachSubtype(e,(e=>{i.push(e)})),0!=(1&t)&&i.some((e=>2===e.category))&&(i=i.filter((e=>!a.isUnknown(e))));const r=e=>a.isClass(e)&&a.ClassType.isPseudoGenericClass(e)||a.isObject(e)&&a.ClassType.isPseudoGenericClass(e.classType);if(i.some((e=>r(e)))){const e=[];i.forEach((t=>{r(t)?a.isClass(t)?e.some((e=>a.isClass(e)&&a.ClassType.isSameGenericClass(e,t)))||e.push(t):a.isObject(t)&&(e.some((e=>a.isObject(e)&&a.ClassType.isSameGenericClass(e.classType,t.classType)))||e.push(t)):e.push(t)})),i=e}const o=e=>a.isObject(e)&&void 0!==e.classType.literalValue,c=e=>a.isClass(e)&&void 0!==e.literalValue,p=[];for(;i.length>0;){const e=i.shift();if(o(e)){const t=i.filter((e=>o(e)));t.unshift(e);const n=t.map((e=>u(e.classType)));p.push(`Literal[${n.join(", ")}]`),t.length>1&&(i=i.filter((e=>!o(e))))}else if(c(e)){const t=i.filter((e=>c(e)));t.unshift(e);const n=t.map((e=>u(e)));p.push(`Type[Literal[${n.join(", ")}]]`),t.length>1&&(i=i.filter((e=>!c(e))))}else p.push(d(e,t,n,!1,s+1))}return 1===p.length?p[0]:8&t?p.join(" | "):`Union[${p.join(", ")}]`}case 11:return e.details.isSynthesized?e.details.recursiveTypeAliasName?i&&e.details.boundType?d(e.details.boundType,t,n,i,s+1):e.details.recursiveTypeAliasName:e.details.boundType?d(e.details.boundType,t,n,!1,s+1):0!=(1&t)?"Any":"Unknown":(e.details.isParamSpec,`${a.TypeVarType.getReadableName(e)}`);case 3:return a.TypeBase.isInstantiable(e)?"NoneType":"None";case 4:return"Never";case 2:return e.isEllipsis?"...":"Any"}return""}function u(e){const t=e.literalValue;if(void 0===t)return"";let n;if("string"==typeof t){const i="bytes"===e.details.name?"b":"";n=t.toString(),n=n.indexOf("\n")>=0?`${i}'''${n.replace(p,"\\'\\'\\'")}'''`:`${i}'${n.replace(c,"\\'")}'`}else n="boolean"==typeof t?t?"True":"False":t instanceof a.EnumLiteral?`${t.className}.${t.itemName}`:t.toString();return n}function h(e,t,n,i=0){let s=e.aliasName||e.details.name;if(!a.ClassType.isPseudoGenericClass(e)){const r=e.variadicTypeArguments||e.typeArguments;if(r)r.length>0?(0==(2&t)||r.some((e=>!a.isAnyOrUnknown(e))))&&(s+="["+r.map((e=>d(e,t,n,!1,i+1))).join(", ")+"]"):a.ClassType.isVariadicTypeParam(e)&&(s+="[()]");else{const r=a.ClassType.getTypeParameters(e);r.length>0&&(0==(2&t)||r.some((e=>!a.isAnyOrUnknown(e))))&&(s+="["+r.map((e=>d(e,t,n,!1,i+1))).join(", ")+"]")}}return s}function m(e,t,n,i=0){const s=e.details.parameters.map(((s,r)=>{let l="";1===s.category?l+="*":2===s.category&&(l+="**"),s.name&&(l+=s.name);let c="=";if(s.name)if(s.hasDeclaredType||s.isTypeInferred){const s=a.FunctionType.getEffectiveParameterType(e,r);l+=": "+(i<a.maxTypeRecursionCount?d(s,t,n,!1,i+1):""),c=" = "}else 0==(2&t)&&(l+=": Unknown",c=" = ");else 0===s.category&&(l+="/");return s.hasDefault&&(s.defaultValueExpression?l+=c+o.printExpression(s.defaultValueExpression):l+=c+"..."),l})),r=n(e);let l=i<a.maxTypeRecursionCount?d(r,t,n,!1,i+1):"";return 8&t&&10===r.category&&i>0&&(l=`(${l})`),[s,l]}t.printType=d,t.printLiteralValue=u,t.printObjectTypeForClass=h,t.printFunctionParts=m},2590: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.TypeStubWriter=void 0;const o=r(n(563)),a=r(n(8494)),l=n(427),c=n(5083),p=r(n(1766));class d{constructor(e){this.importName=e,this.isAccessed=!1}}class u extends d{constructor(e,t,n){super(e),this.alias=t,this.symbol=n}}class h extends d{constructor(e,t,n){super(e),this.isWildcardImport=t,this.node=n,this.symbols=[]}addSymbol(e,t,n,i=!1){this.symbols.find((e=>e.name===t))||this.symbols.push({symbol:e,name:t,alias:n,isAccessed:i})}}class m extends l.ParseTreeWalker{constructor(e,t){super(),this._accessedImportedSymbols=e,this._treatStringsAsSymbols=t}analyze(e){this.walk(e)}walk(e){o.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 y 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){o.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}`;return e.arguments.length>0&&(n+=`(${e.arguments.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 ":"";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+=":",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="";if(38===e.leftExpression.nodeType){if("__all__"===e.leftExpression.value)return!1;0===this._functionNestCount&&(t=this._printExpression(e.leftExpression),e.typeAnnotationComment&&(t+=": "+this._printExpression(e.typeAnnotationComment,!0)))}else if(54===e.leftExpression.nodeType){const n=e.leftExpression.valueExpression;38===n.nodeType&&0===this._functionNestCount&&(t=`${this._printExpression(n)}: ${this._printExpression(e.leftExpression.typeAnnotation,!0)}`)}if(t){const n=0===this._functionNestCount&&0===this._classNestCount;this._emittedSuite=!0,t+=" = ",t+=n?this._printExpression(e.rightExpression):"...",this._emitLine(t)}return!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 u(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 h(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;e<this._indentAmount;e++)this._typeStubText+=this._tab;this._typeStubText+=e+this._lineEnd}_printModuleName(e){let t="";for(let n=0;n<e.leadingDots;n++)t+=".";return t+=e.nameParts.map((e=>e.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 m(this._accessedImportedSymbols,n).analyze(e),a.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.name<t.name?-1:e.name>t.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=y},5168:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requiresSpecialization=t.requiresTypeArguments=t._transformTypeVars=t.isPartlyUnknown=t.containsUnknown=t.getMembersForModule=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.lookUpClassMember=t.lookUpObjectMember=t.transformExpectedTypeForConstructor=t.applySolvedTypeVars=t.partiallySpecializeType=t.isTupleClass=t.isProperty=t.isParamSpecType=t.removeNoReturnFromUnion=t.isNoReturnType=t.isEllipsisType=t.isLiteralType=t.getSpecializedTupleType=t.getTypeVarScopeId=t.canBeTruthy=t.canBeFalsy=t.transformPossibleRecursiveTypeAlias=t.isTypeAliasRecursive=t.isTypeAliasPlaceholder=t.transformTypeObjectToClass=t.enumerateLiteralsForType=t.stripLiteralValue=t.derivesFromAnyOrUnknown=t.areTypesSame=t.doForEachSubtype=t.mapSubtypes=t.isOptionalType=void 0,t.getDeclaringModulesForType=t.computeMroLinearization=void 0;const i=n(7082),s=n(817),r=n(2917),o=n(1133),a=n(1659);let l=1;function c(e,t){if(10===e.category){const n=[];let i=!1;return e.subtypes.forEach(((s,r)=>{const o=e.constraints?e.constraints[r]:void 0,a=t(s);a?(n.push({type:a,constraints:o}),a!==s&&(i=!0)):i=!0})),i?o.combineConstrainedTypes(n):e}return t(e)||o.NeverType.create()}function p(e,t){10===e.category?e.constraints?e.subtypes.forEach(((n,i)=>{t(n,i,e.constraints[i])})):e.subtypes.forEach(((e,n)=>{t(e,n,void 0)})):t(e,0,void 0)}function d(e){if(!o.isObject(e))return e;const t=e.classType;return o.ClassType.isBuiltIn(t,"Type")?!t.typeArguments||t.typeArguments.length<1||!t.isTypeArgumentExplicit?e:x(t.typeArguments[0]):e}function u(e,t=0){if(t>o.maxTypeRecursionCount)return!0;switch(e.category){case 0:case 1:case 2:case 4:case 3:return!0;case 10:return void 0!==o.findSubtype(e,(e=>u(e,t+1)));case 5:case 6:case 7:case 9:case 11:return!1;case 8:return f(e.classType)&&e.classType.variadicTypeArguments?0===e.classType.variadicTypeArguments.length||!!y(e.classType.variadicTypeArguments[e.classType.variadicTypeArguments.length-1]):o.ClassType.isBuiltIn(e.classType,"bool")&&void 0!==e.classType.literalValue?!1===e.classType.literalValue:!!v(e,"__len__")||!!v(e,"__bool__")}}function h(e,t=0){if(t>o.maxTypeRecursionCount)return!0;switch(e.category){case 1:case 5:case 6:case 7:case 9:case 11:case 4:case 2:return!0;case 10:return void 0!==o.findSubtype(e,(e=>h(e,t+1)));case 0:case 3:return!1;case 8:return!(f(e.classType)&&e.classType.variadicTypeArguments&&0===e.classType.variadicTypeArguments.length||!1===e.classType.literalValue||0===e.classType.literalValue||""===e.classType.literalValue)}}function m(e){return 7===e.category?e.details.typeVarScopeId:8===e.category?e.classType.details.typeVarScopeId:5===e.category?e.details.typeVarScopeId:11===e.category?e.scopeId:void 0}function y(e){return!(2!==e.category||!e.isEllipsis)||o.isClass(e)&&o.ClassType.isBuiltIn(e,"ellipsis")}function g(e){return o.isObject(e)&&o.ClassType.isBuiltIn(e.classType,"NoReturn")}function f(e){return o.ClassType.isBuiltIn(e,"tuple")}function _(e,t){return o.ClassType.isGeneric(t)?e:T(e,C(t))}function T(e,t,n=!1){return t.isEmpty()&&!n?e:F(e,{transformTypeVar:e=>{if(e.scopeId&&t.hasSolveForScope(e.scopeId)){const i=t.getTypeVar(e);if(i)return i;if(n)return o.UnknownType.create()}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)}})}function v(e,t,n=0){if(o.isObject(e))return b(e.classType,t,n)}function b(e,t,n=0){const i=0!=(16&n);if(o.isClass(e)){let r=!1,a=0!=(1&n);for(const s of e.details.mro){if(a){a=!1;continue}if(!o.isClass(s)){r=!0;continue}const l=_(s,e);if(!o.isClass(l))continue;if(4&n&&o.ClassType.isBuiltIn(l,"object"))continue;const c=l.details.fields;if(0==(8&n)){const e=c.get(t);if(e&&e.isInstanceMember()){const t=e.hasTypedDeclarations();if(!i||t)return{symbol:e,isInstanceMember:!0,classType:l,isTypeDeclared:t}}}const p=c.get(t);if(p&&p.isClassMember()){const e=p.hasTypedDeclarations();if(!i||e){let t=!1;if(o.ClassType.isDataClass(l)||o.ClassType.isTypedDictClass(l)){const e=p.getDeclarations();e.length>0&&1===e[0].type&&(t=!0)}return{symbol:p,isInstanceMember:t,classType:l,isTypeDeclared:e}}}if(0!=(2&n))break}if(r&&!i)return{symbol:s.Symbol.createWithType(0,o.UnknownType.create()),isInstanceMember:!1,classType:o.UnknownType.create(),isTypeDeclared:!1}}else if(o.isAnyOrUnknown(e))return{symbol:s.Symbol.createWithType(0,o.UnknownType.create()),isInstanceMember:!1,classType:o.UnknownType.create(),isTypeDeclared:!1}}function S(e,t){for(const n of t)e.find((e=>o.isTypeSame(e,n)))||e.push(n)}function C(e,t=!0){const n=o.ClassType.getTypeParameters(e);let i=e.typeArguments;i||t||(i=n);const s=I(n,i,m(e));return o.ClassType.isVariadicTypeParam(e)&&e.variadicTypeArguments&&n.length>=1&&s.setVariadicTypeVar(n[0],e.variadicTypeArguments),s}function I(e,t,n){const i=new a.TypeVarMap(n);return e.forEach(((e,n)=>{let s;t&&(s=n>=t.length?o.AnyType.create():t[n],i.setTypeVar(e,s,!1))})),i}function D(e){let t=c(e,(e=>{switch((e=d(e)).category){case 7:return o.ObjectType.create(e);case 3:return o.NoneType.createInstance();case 5:if(o.TypeBase.isInstantiable(e))return o.FunctionType.cloneAsInstance(e);break;case 11:if(o.TypeBase.isInstantiable(e))return o.TypeVarType.cloneAsInstance(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=o.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.aliasName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function x(e){let t=c(e,(e=>{switch(e.category){case 8:return e.classType;case 3:return o.NoneType.createType();case 5:if(o.TypeBase.isInstance(e))return o.FunctionType.cloneAsInstantiable(e);break;case 11:if(o.TypeBase.isInstance(e))return o.TypeVarType.cloneAsInstantiable(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=o.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.aliasName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function F(e,t,n=new Map,i=0){var s;if(i>o.maxTypeRecursionCount)return e;if(!E(e))return e;if(o.isAnyOrUnknown(e))return e;if(o.isNone(e))return e;if(o.isTypeVar(e)){if(e.details.recursiveTypeAliasName){if(!(null===(s=e.typeAliasInfo)||void 0===s?void 0:s.typeArguments))return e;let r=!1;const a=e.typeAliasInfo.typeArguments.map((e=>{const s=F(e,t,n,i+1);return s!==e&&(r=!0),s}));return r?o.TypeBase.cloneForTypeAlias(e,e.typeAliasInfo.aliasName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,a):e}let r=e;const a=o.TypeVarType.getNameWithScope(e);return n.has(a)||(r=t.transformTypeVar(e),o.TypeBase.isInstantiable(e)&&!o.TypeBase.isInstantiable(r)&&(r=x(r)),n.set(a,e),r=F(r,t,n,i+1),n.delete(a)),r}if(10===e.category)return c(e,(e=>F(e,t,n,i+1)));if(o.isObject(e)){const s=k(e.classType,t,n,i+1);if(o.ClassType.isBuiltIn(s,"Type")){const e=s.typeArguments;if(e&&e.length>=1){if(o.isObject(e[0]))return F(e[0].classType,t,n,i+1);if(o.isTypeVar(e[0])){const n=t.transformTypeVar(e[0]);if(n&&o.isObject(n))return n.classType}}}return s===e.classType?e:o.ObjectType.create(s)}if(o.isClass(e))return k(e,t,n,i+1);if(5===e.category)return P(e,t,n,i+1);if(6===e.category){let s=!1;const r=[];return e.overloads.forEach((e=>{const o=P(e,t,n,i);r.push(o),o!==e&&(s=!0)})),s?o.OverloadedFunctionType.create(r):e}return e}function k(e,t,n,i){if(0===o.ClassType.getTypeParameters(e).length&&!o.ClassType.isSpecialBuiltIn(e))return e;let s,r=[],a=!1;const l=o.ClassType.getTypeParameters(e);return e.typeArguments?r=e.typeArguments.map((e=>{const s=F(e,t,n,i+1);return s!==e&&(a=!0),s})):l.forEach((e=>{let s=e;const l=o.TypeVarType.getNameWithScope(e);n.has(l)||(s=t.transformTypeVar(e),s!==e&&(n.set(l,e),s=F(s,t,n,i+1),n.delete(l),a=!0)),r.push(s)})),o.ClassType.isVariadicTypeParam(e)&&(e.variadicTypeArguments?s=e.variadicTypeArguments.map((e=>{const s=F(e,t,n,i+1);return s!==e&&(a=!0),s})):l.length>0&&(s=t.transformVariadicTypeVar(l[0]),s&&(a=!0))),a?o.ClassType.cloneForSpecialization(e,r,!0,void 0,s):e}function P(e,t,n,i){let s=e;if(s.details.paramSpec){const e=t.transformParamSpec(s.details.paramSpec);e&&(s=o.FunctionType.cloneForParamSpec(s,e))}const r=s.specializedTypes&&s.specializedTypes.returnType?s.specializedTypes.returnType:s.details.declaredReturnType,a=r?F(r,t,n,i+1):void 0;let l=r!==a;const c={parameterTypes:[],returnType:a};for(let e=0;e<s.details.parameters.length;e++){const r=o.FunctionType.getEffectiveParameterType(s,e),a=F(r,t,n,i+1);c.parameterTypes.push(a),r!==a&&(l=!0)}if(!l)return s;let p;return s.inferredReturnType&&(p=F(s.inferredReturnType,t,n,i+1)),o.FunctionType.cloneForSpecialization(s,c,p)}function A(e){if(o.isObject(e)){const t=e.classType;if(o.ClassType.isBuiltIn(t)){const e=t.details.name;if("Generator"===e||"AsyncGenerator"===e)return t.typeArguments;if("Iterator"===e||"Iterable"===e||"AsyncIterator"===e||"AsyncIterable"===e)return t.typeArguments}}}function E(e,t=0){var n;switch(e.category){case 7:return e.typeArguments?!(t>o.maxTypeRecursionCount)&&void 0!==e.typeArguments.find((e=>E(e,t+1))):o.ClassType.getTypeParameters(e).length>0;case 8:return!(t>o.maxTypeRecursionCount)&&E(e.classType,t+1);case 5:{if(t>o.maxTypeRecursionCount)return!1;for(let n=0;n<e.details.parameters.length;n++)if(E(o.FunctionType.getEffectiveParameterType(e,n),t+1))return!0;const n=e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType;if(n){if(E(n,t+1))return!0}else if(e.inferredReturnType&&E(e.inferredReturnType,t+1))return!0;return!1}case 6:return void 0!==e.overloads.find((e=>E(e,t+1)));case 10:return void 0!==o.findSubtype(e,(e=>E(e,t+1)));case 11:if(!e.details.recursiveTypeAliasName)return!0;if(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.typeArguments)return e.typeAliasInfo.typeArguments.some((e=>E(e,t+1)))}return!1}function w(e,t,n=0){if(n>o.maxTypeRecursionCount)return;const i=e=>{e&&!t.some((t=>t===e))&&t.push(e)};switch(e.category){case 7:i(e.details.moduleName);break;case 8:i(e.classType.details.moduleName);break;case 5:i(e.details.moduleName);break;case 6:e.overloads.forEach((e=>{w(e,t,n+1)}));break;case 10:p(e,(e=>{w(e,t,n+1)}));break;case 9:i(e.moduleName)}}t.isOptionalType=function(e){return 10===e.category&&void 0!==o.findSubtype(e,(e=>o.isNone(e)))},t.mapSubtypes=c,t.doForEachSubtype=p,t.areTypesSame=function(e){if(e.length<2)return!0;for(let t=1;t<e.length;t++)if(!o.isTypeSame(e[0],e[t]))return!1;return!0},t.derivesFromAnyOrUnknown=function(e){let t=!1;return p(e,(n=>{o.isAnyOrUnknown(e)?t=!0:o.isClass(n)?o.ClassType.hasUnknownBaseClass(n)&&(t=!0):o.isObject(n)&&o.ClassType.hasUnknownBaseClass(n.classType)&&(t=!0)})),t},t.stripLiteralValue=function e(t){return o.isObject(t)?(void 0!==t.classType.literalValue&&(t=o.ObjectType.create(o.ClassType.cloneWithLiteral(t.classType,void 0))),t):o.isClass(t)?(void 0!==t.literalValue&&(t=o.ClassType.cloneWithLiteral(t,void 0)),t):10===t.category?c(t,(t=>e(t))):t},t.enumerateLiteralsForType=function(e){if(o.ClassType.isBuiltIn(e.classType,"bool"))return[o.ObjectType.create(o.ClassType.cloneWithLiteral(e.classType,!0)),o.ObjectType.create(o.ClassType.cloneWithLiteral(e.classType,!1))];if(o.ClassType.isEnumClass(e.classType)){const t=[];return e.classType.details.fields.forEach(((n,i)=>{n.isIgnoredForProtocolMatch()||n.isInstanceMember()||t.push(o.ObjectType.create(o.ClassType.cloneWithLiteral(e.classType,new o.EnumLiteral(e.classType.details.name,i))))})),t}},t.transformTypeObjectToClass=d,t.isTypeAliasPlaceholder=function(e){return!!o.isTypeVar(e)&&!!e.details.recursiveTypeAliasName&&!e.details.boundType},t.isTypeAliasRecursive=function(e,t){return 10!==t.category?0===t.category&&t.typeAliasInfo&&t.typeAliasInfo.aliasName===e.details.recursiveTypeAliasName:void 0!==o.findSubtype(t,(t=>o.isTypeSame(e,t)))},t.transformPossibleRecursiveTypeAlias=function(e){var t;if(e&&o.isTypeVar(e)&&e.details.recursiveTypeAliasName&&e.details.boundType){const n=o.TypeBase.isInstance(e)?D(e.details.boundType):e.details.boundType;return(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.typeArguments)&&e.details.recursiveTypeParameters?T(n,I(e.details.recursiveTypeParameters,e.typeAliasInfo.typeArguments,m(e))):n}return e},t.canBeFalsy=u,t.canBeTruthy=h,t.getTypeVarScopeId=m,t.getSpecializedTupleType=function(e){let t;if(o.isClass(e)?t=e:o.isObject(e)&&(t=e.classType),!t)return;const n=t.details.mro.find((e=>o.isClass(e)&&f(e)));return n&&o.isClass(n)?o.ClassType.isSameGenericClass(t,n)?t:T(n,C(t)):void 0},t.isLiteralType=function(e,t=!0){return o.isObject(e)?void 0!==e.classType.literalValue:!(!t||10!==e.category||o.findSubtype(e,(e=>!o.isObject(e)||void 0===e.classType.literalValue)))},t.isEllipsisType=y,t.isNoReturnType=g,t.removeNoReturnFromUnion=function(e){return o.removeFromUnion(e,(e=>g(e)))},t.isParamSpecType=function(e){return!!o.isTypeVar(e)&&e.details.isParamSpec},t.isProperty=function(e){return o.isObject(e)&&o.ClassType.isPropertyClass(e.classType)},t.isTupleClass=f,t.partiallySpecializeType=_,t.applySolvedTypeVars=T,t.transformExpectedTypeForConstructor=function(e,t,n){const i=e=>n.some((t=>e.scopeId===t));if(o.isTypeVar(e))return i(e)?e:void 0;const s="__expected_type_scope_id";return t.addSolveForScope(s),F(e,{transformTypeVar:e=>i(e)?e:(e=>{if(e.details.isSynthesized&&e.details.name.startsWith("__expected_type_"))return e;const t=o.TypeBase.isInstance(e);let n=o.TypeVarType.createInstance(`__expected_type_${l}`,!1,!0);return n.scopeId=s,n.nameWithScope=o.TypeVarType.makeNameWithScope(n.details.name,s),t||(n=x(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=v,t.lookUpClassMember=b,t.addTypeVarsToListIfUnique=S,t.getTypeVarArgumentsRecursive=function e(t,n=0){var i,s;if(n>o.maxTypeRecursionCount)return[];const r=t=>{const i=[];return t.typeArguments&&t.typeArguments.forEach((t=>{S(i,e(t,n+1))})),i};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=>{S(i,e(t,n+1))})),i}if(o.isTypeVar(t))return t.details.recursiveTypeAliasName?[]:[t];if(o.isClass(t))return r(t);if(o.isObject(t))return r(t.classType);if(10===t.category){const i=[];return p(t,(t=>{S(i,e(t,n+1))})),i}if(5===t.category){const i=[];for(let s=0;s<t.details.parameters.length;s++)S(i,e(o.FunctionType.getEffectiveParameterType(t,s),n+1));const s=o.FunctionType.getSpecializedReturnType(t);return s&&S(i,e(s,n+1)),i}return[]},t.selfSpecializeClassType=function(e,t=!1){if(!o.ClassType.isGeneric(e)&&!t)return e;const n=o.ClassType.getTypeParameters(e);return o.ClassType.cloneForSpecialization(e,n,!1,t)},t.specializeClassType=function(e){const t=new a.TypeVarMap(m(e));return o.ClassType.getTypeParameters(e).forEach((e=>{t.setTypeVar(e,o.UnknownType.create(),!1)})),T(e,t)},t.setTypeArgumentsRecursive=function e(t,n,i,s=0){if(!(s>o.maxTypeRecursionCount||i.isLocked()))switch(t.category){case 10: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.variadicTypeArguments&&t.variadicTypeArguments.forEach((t=>{e(t,n,i,s+1)}));break;case 8:e(t.classType,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 11:i.hasTypeVar(t)||i.setTypeVar(t,n,i.isNarrowable(t))}},t.buildTypeVarMapFromSpecializedClass=C,t.buildTypeVarMap=I,t.specializeForBaseClass=function(e,t){if(0===o.ClassType.getTypeParameters(t).length)return t;const n=T(t,C(e));return i.assert(o.isClass(n)),n},t.derivesFromClassRecursive=function e(t,n,i){if(o.ClassType.isSameGenericClass(t,n))return!0;for(const s of t.details.baseClasses)if(o.isClass(s)){if(e(s,n,i))return!0}else if(!i&&o.isAnyOrUnknown(s))return!0;return!1},t.removeFalsinessFromType=function(e){return c(e,(e=>{if(o.isObject(e)){if(void 0!==e.classType.literalValue)return e.classType.literalValue?e:void 0;if(o.ClassType.isBuiltIn(e.classType,"bool"))return o.ObjectType.create(o.ClassType.cloneWithLiteral(e.classType,!0))}if(h(e))return e}))},t.removeTruthinessFromType=function(e){return c(e,(e=>{if(o.isObject(e)){if(void 0!==e.classType.literalValue)return e.classType.literalValue?void 0:e;if(o.ClassType.isBuiltIn(e.classType,"bool"))return o.ObjectType.create(o.ClassType.cloneWithLiteral(e.classType,!1))}if(u(e))return e}))},t.getDeclaredGeneratorYieldType=function(e,t){const n=o.FunctionType.getSpecializedReturnType(e);if(n){const e=A(n);return e&&e.length>=1&&o.isClass(t)?o.ObjectType.create(o.ClassType.cloneForSpecialization(t,[e[0]],!0)):n}},t.getDeclaredGeneratorSendType=function(e){const t=o.FunctionType.getSpecializedReturnType(e);if(t){const e=A(t);return e&&e.length>=2?e[1]:o.UnknownType.create()}},t.getDeclaredGeneratorReturnType=function(e){const t=o.FunctionType.getSpecializedReturnType(e);if(t){const e=A(t);return e&&e.length>=3?e[2]:o.UnknownType.create()}},t.convertToInstance=D,t.convertToInstantiable=x,t.getMembersForClass=function(e,t,n){for(let i=0;i<e.details.mro.length;i++){const s=e.details.mro[i];if(o.isClass(s)){const e=o.ClassType.isTypedDictClass(s);s.details.fields.forEach(((i,s)=>{(i.isClassMember()||n&&i.isInstanceMember())&&(e&&r.isTypedDictMemberAccessedThroughIndex(i)||t.get(s)||t.set(s,i))}))}}if(!n){const n=e.details.effectiveMetaclass;if(n&&o.isClass(n))for(const e of n.details.mro){if(!o.isClass(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=>{o.isUnknown(e)&&(t=!0)})),t},t.isPartlyUnknown=function e(t,n=!1,i=0){if(i>o.maxTypeRecursionCount)return!1;if(o.isUnknown(t))return!0;if(10===t.category)return void 0!==o.findSubtype(t,(t=>e(t,n,i+1)));if(o.isObject(t))return e(t.classType,!1,i+1);if(o.isClass(t)){if(t.typeArguments&&!n&&!o.ClassType.isPseudoGenericClass(t))for(const s of t.typeArguments)if(e(s,n,i+1))return!0;return!1}if(6===t.category)return t.overloads.some((t=>e(t,!1,i+1)));if(5===t.category){for(let n=0;n<t.details.parameters.length;n++)if(t.details.parameters[n].name&&e(o.FunctionType.getEffectiveParameterType(t,n),!1,i+1))return!0;return!(!t.details.declaredReturnType||!e(t.details.declaredReturnType,!1,i+1))}return!1},t._transformTypeVars=F,t.requiresTypeArguments=function(e){return e.details.typeParameters.length>0?!e.details.typeParameters[0].details.isSynthesized:!(!o.ClassType.isBuiltIn(e)||!["Tuple","Callable","Generic","Type","Optional","Union","Final","Literal","Annotated","TypeGuard"].some((t=>t===e.details.name)))},t.requiresSpecialization=E,t.computeMroLinearization=function(e){let t=!0;const n=[],i=e.details.baseClasses.filter((e=>!o.isClass(e)||!o.ClassType.isBuiltIn(e,"Generic")));i.forEach((e=>{if(o.isClass(e)){const t=C(e,!1);n.push(e.details.mro.map((e=>T(e,t))))}else n.push([e])})),n.push(i.map((t=>T(t,C(e,!1)))));const s=C(e,!1);e.details.mro.push(T(e,s));const r=(e,t)=>t.some((t=>t.findIndex((t=>o.isClass(t)&&o.ClassType.isSameGenericClass(t,e)))>0)),a=(e,t)=>{for(let n=0;n<t.length;n++)t[n]=t[n].filter((t=>!o.isClass(t)||!o.ClassType.isSameGenericClass(t,e)))};for(;;){let i,s=!1;for(let t=0;t<n.length;t++){const l=n[t];if(l.length>0){if(void 0===i&&(i=l),!o.isClass(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]),a(l[0],n);break}}}if(!i)break;s||(t=!1,o.isClass(i[0])?(e.details.mro.push(i[0]),a(i[0],n)):(e.details.mro.push(i[0]),i.shift()))}return t},t.getDeclaringModulesForType=function(e){const t=[];return w(e,t),t}},1659:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeVarMap=void 0;const i=n(5839),s=n(1133),r=n(5168);class o{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 o;return this._solveForScopes&&(e._solveForScopes=[...this._solveForScopes]),this._typeVarMap.forEach((t=>{e.setTypeVar(t.typeVar,t.type,this.isNarrowable(t.typeVar))})),this._paramSpecMap.forEach((t=>{e.setParamSpec(t.paramSpec,t.type)})),e._isLocked=this._isLocked,e}copyFromClone(e){this._typeVarMap=e._typeVarMap,this._paramSpecMap=e._paramSpecMap,this._isLocked=e._isLocked}getSolveForScopes(){return this._solveForScopes}hasSolveForScope(e){return void 0!==e&&void 0!==this._solveForScopes&&this._solveForScopes.some((t=>t===e))}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,e+=this._getComplexityScoreForType(t.type)})),e+=this._paramSpecMap.size,e}hasTypeVar(e){return this._typeVarMap.has(this._getKey(e))}getTypeVar(e){var t;return null===(t=this._typeVarMap.get(this._getKey(e)))||void 0===t?void 0:t.type}setTypeVar(e,t,n){i.assert(!this._isLocked);const s=this._getKey(e);this._typeVarMap.set(s,{typeVar:e,type:t,isNarrowable:n})}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})}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}isNarrowable(e){const t=this._typeVarMap.get(this._getKey(e));return!t||t.isNarrowable}lock(){i.assert(!this._isLocked),this._isLocked=!0}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:{let n=1;return r.doForEachSubtype(e,(e=>{const i=this._getComplexityScoreForType(e,t+1);i<n&&(n=i)})),n/2}case 7:return this._getComplexityScoreForClass(e,t+1);case 8:return this._getComplexityScoreForClass(e.classType,t+1)}return 0}_getComplexityScoreForClass(e,t){let n=0,i=0;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=o},1133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSameWithoutLiteralValue=t.combineConstrainedTypes=t.combineTypes=t.isUnionableType=t.findSubtype=t.removeFromUnion=t.removeNoneFromUnion=t.removeUnbound=t.removeUnknownFromUnion=t.removeAnyFromUnion=t.isTypeSame=t.getTypeAliasInfo=t.isOverloadedFunction=t.isFunction=t.isTypeVar=t.isModule=t.isObject=t.isClass=t.isPossiblyUnbound=t.isUnbound=t.isAnyOrUnknown=t.isUnknown=t.isNone=t.isNever=t.TypeVarType=t.UnionType=t.SubtypeConstraint=t.AnyType=t.NeverType=t.NoneType=t.OverloadedFunctionType=t.FunctionType=t.ObjectType=t.ClassType=t.ModuleType=t.UnknownType=t.UnboundType=t.TypeBase=t.maxTypeRecursionCount=t.EnumLiteral=void 0;const i=n(5839);class s{constructor(e,t){this.className=e,this.itemName=t}}var r,o,a,l,c,p,d,u,h,m,y;function g(e){return 4===e.category}function f(e){return 2===e.category||1===e.category||10===e.category&&void 0===e.subtypes.find((e=>!f(e)))}function _(e){return 0===e.category}function T(e){return 7===e.category}function v(e){return 8===e.category}function b(e){return 11===e.category}function S(e,n,i=0){if(e.category!==n.category)return!1;if(i>t.maxTypeRecursionCount)return!0;switch(e.category){case 7:{const t=n;if(!a.isSameGenericClass(e,t,i+1))return!1;const s=e.typeArguments||[],r=t.typeArguments||[],o=Math.max(s.length,r.length);for(let e=0;e<o;e++)if(!S(e<s.length?s[e]:d.create(),e<r.length?r[e]:d.create(),i+1))return!1;const l=e.variadicTypeArguments||[],c=t.variadicTypeArguments||[];if(l.length!==c.length)return!1;for(let e=0;e<l.length;e++)if(!S(l[e],c[e],i+1))return!1;return!!a.isLiteralValueSame(e,t)}case 8:{const t=n;return S(e.classType,t.classType,i+1)}case 5:{const t=n,s=e.details.parameters,r=t.details.parameters;if(s.length!==r.length)return!1;for(let n=0;n<s.length;n++){const o=s[n],a=r[n];if(o.category!==a.category)return!1;if(o.name!==a.name)return!1;if(!S(c.getEffectiveParameterType(e,n),c.getEffectiveParameterType(t,n),i+1))return!1}let o=e.details.declaredReturnType;e.specializedTypes&&e.specializedTypes.returnType&&(o=e.specializedTypes.returnType);let a=t.details.declaredReturnType;return t.specializedTypes&&t.specializedTypes.returnType&&(a=t.specializedTypes.returnType),!!(!o&&!a||o&&a&&S(o,a,i+1))&&e.details.declaration===t.details.declaration}case 6:{const t=n;if(e.overloads.length!==t.overloads.length)return!1;for(let n=0;n<e.overloads.length;n++)if(!S(e.overloads[n],t.overloads[n],i+1))return!1;return!0}case 10:{const t=n,s=e.subtypes,r=t.subtypes;return s.length===r.length&&void 0===I(e,((e,n)=>!h.containsType(t,e,n,i+1)))}case 11:{const t=n;if(e.scopeId!==t.scopeId)return!1;if(e.details===t.details)return!0;if(e.details.name!==t.details.name)return!1;const s=e.details.boundType,r=t.details.boundType;if(s){if(!r||!S(s,r,i+1))return!1}else if(r)return!1;if(e.details.variance!==t.details.variance)return!1;const o=e.details.constraints,a=t.details.constraints;if(o.length!==a.length)return!1;for(let e=0;e<o.length;e++)if(!S(o[e],a[e],i+1))return!1;return!0}case 9:{const t=n;return e.fields===t.fields||0===e.fields.size&&0===t.fields.size}}return!0}function C(e,t){if(10===e.category){const n=[];if(e.subtypes.forEach(((i,s)=>{const r=e.constraints?e.constraints[s]:void 0;t(i,r)||n.push({type:i,constraints:r})})),n.length<e.subtypes.length)return D(n)}return e}function I(e,t){return 10===e.category?e.subtypes.find(((n,i)=>t(n,e.constraints?e.constraints[i]:void 0))):t(e,void 0)?e:void 0}function D(e,t){if(0===(e=e.filter((e=>4!==e.type.category))).length)return p.create();if(1===e.length&&!e[0].constraints)return e[0].type;let n=[];for(const t of e)if(10===t.type.category){const e=t.type;e.subtypes.forEach(((i,s)=>{n.push({type:i,constraints:u.combine(e.constraints?e.constraints[s]:void 0,t.constraints)})}))}else n.push({type:t.type,constraints:t.constraints});if(n=n.sort(((e,t)=>{const n=e.type,i=t.type;return v(n)&&void 0!==n.classType.literalValue||T(n)&&void 0!==n.literalValue?1:v(i)&&void 0!==i.classType.literalValue||T(i)&&void 0!==i.literalValue?-1:0})),0===n.length)return o.create();const i=h.create();let s=!1;return n.forEach(((e,n)=>{0===n?h.addType(i,e.type,e.constraints):void 0===t||i.subtypes.length<t?function(e,t,n){if(!n&&v(t)){if(a.isBuiltIn(t.classType,"str")&&void 0!==t.classType.literalValue&&void 0!==e.literalStrMap)return void(e.literalStrMap.has(t.classType.literalValue)||h.addType(e,t,n));if(a.isBuiltIn(t.classType,"int")&&void 0!==t.classType.literalValue&&void 0!==e.literalIntMap)return void(e.literalIntMap.has(t.classType.literalValue)||h.addType(e,t,n))}for(let i=0;i<e.subtypes.length;i++){const s=e.subtypes[i],r=e.constraints?e.constraints[i]:void 0;if(u.isSame(r,n)){if(S(s,t))return;if(v(s)&&v(t)){if(x(s,t)&&void 0===s.classType.literalValue)return;if(a.isBuiltIn(s.classType,"bool")&&void 0!==t.classType.literalValue&&!t.classType.literalValue===s.classType.literalValue)return void(e.subtypes[i]=l.create(a.cloneWithLiteral(s.classType,void 0)))}}}h.addType(e,t,n)}(i,e.type,e.constraints):s=!0})),s?d.create():1!==i.subtypes.length||i.constraints?i:i.subtypes[0]}function x(e,t){return!!S(e,t)||(T(t)&&void 0!==t.literalValue?S(e,t=a.cloneWithLiteral(t,void 0)):!(!v(t)||void 0===t.classType.literalValue)&&S(e,t=l.create(a.cloneWithLiteral(t.classType,void 0))))}t.EnumLiteral=s,t.maxTypeRecursionCount=16,function(e){e.isInstantiable=function(e){return 0!=(1&e.flags)},e.isInstance=function(e){return 0!=(2&e.flags)},e.cloneForTypeAlias=function(e,t,n,i,s){const r=Object.assign({},e);return r.typeAliasInfo={aliasName:t,typeParameters:i,typeArguments:s,typeVarScopeId:n},r}}(r=t.TypeBase||(t.TypeBase={})),function(e){const t={category:0,flags:3};e.create=function(){return t}}(t.UnboundType||(t.UnboundType={})),function(e){const t={category:1,flags:3};e.create=function(){return t}}(o=t.UnknownType||(t.UnknownType={})),(y=t.ModuleType||(t.ModuleType={})).create=function(e,t){return{category:9,fields:t||new Map,loaderFields:new Map,flags:1,moduleName:e}},y.getField=function(e,t){let n=e.fields.get(t);return!n&&e.loaderFields&&(n=e.loaderFields.get(t)),n},function(e){function n(e,t){return!!(1&e.details.flags)&&(void 0===t||e.details.name===t||e.aliasName===t)}function i(n,i,s=0){if(s>t.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;e<r.baseClasses.length;e++)if(!S(r.baseClasses[e],a.baseClasses[e],s+1))return!1;if((r.declaredMetaclass||a.declaredMetaclass)&&(!r.declaredMetaclass||!a.declaredMetaclass||!S(r.declaredMetaclass,a.declaredMetaclass,s+1)))return!1;for(let e=0;e<r.typeParameters.length;e++)if(!S(r.typeParameters[e],a.typeParameters[e],s+1))return!1;if(r.fields!==a.fields){if(r.fields.size!==a.fields.size)return!1;let e=!0;if(r.fields.forEach(((t,n)=>{const i=a.fields.get(n);i&&S(t.getSynthesizedType()||o.create(),i.getSynthesizedType()||o.create(),s+1)||(e=!1)})),!e)return!1}return!0}e.create=function(e,t,n,i,s,r,o,a){return{category:7,details:{name:e,fullName:t,moduleName:n,flags:i,typeSourceId:s,baseClasses:[],declaredMetaclass:r,effectiveMetaclass:o,mro:[],fields:new Map,typeParameters:[],docString:a},skipAbstractClassTest:!1,flags:1}},e.cloneForSpecialization=function(e,t,n,i=!1,s){const r=Object.assign({},e);return r.typeArguments=t?t.map((e=>g(e)?o.create():e)):void 0,r.isTypeArgumentExplicit=n,r.skipAbstractClassTest=i,r.variadicTypeArguments=s?s.map((e=>g(e)?o.create():e)):void 0,r},e.cloneWithLiteral=function(e,t){const n=Object.assign({},e);return n.literalValue=t,n},e.cloneForTypingAlias=function(e,t){const n=Object.assign({},e);return n.aliasName=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.skipAbstractClassTest},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.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.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.isVariadicTypeParam=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=>f(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(T(n)){if(e(n,s,r))return r&&r.push(t),!0}else if(f(n))return r&&r.push(o.create()),!0;return!1}}(a=t.ClassType||(t.ClassType={})),function(e){e.create=function(e){return{category:8,classType:e,flags:2}}}(l=t.ObjectType||(t.ObjectType={})),function(e){function t(e,t,n,i,s){return{category:5,details:{name:e,moduleName:t,flags:n,parameters:[],docString:s},flags:i}}function n(e,t){return i.assert(t<e.details.parameters.length),e.specializedTypes?(i.assert(t<e.specializedTypes.parameterTypes.length),e.specializedTypes.parameterTypes[t]):e.details.parameters[t].type}e.createInstance=function(e,n,i,s){return t(e,n,i,2,s)},e.createInstantiable=function(e,n,i,s){return t(e,n,i,1,s)},e.clone=function(e,i=!1,s){const r=t(e.details.name,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return r.details=Object.assign({},e.details),i&&(e.details.parameters.length>0&&0===e.details.parameters[0].category?(r.strippedFirstParamType=n(e,0),r.details.parameters=e.details.parameters.slice(1)):i=!1,r.details.flags&=-4,r.details.flags|=4),void 0!==e.typeAliasInfo&&(r.typeAliasInfo=e.typeAliasInfo),e.specializedTypes&&(r.specializedTypes={parameterTypes:i?e.specializedTypes.parameterTypes.slice(1):e.specializedTypes.parameterTypes,returnType:e.specializedTypes.returnType}),r.inferredReturnType=e.inferredReturnType,r.boundTypeVarScopeId=s,r},e.cloneAsInstance=function(e){i.assert(r.isInstantiable(e));const t=Object.assign({},e);return t.flags&=-2,t.flags|=2,t},e.cloneAsInstantiable=function(e){i.assert(r.isInstance(e));const t=Object.assign({},e);return t.flags&=-3,t.flags|=1,t},e.cloneForSpecialization=function(e,n,s){const r=t(e.details.name,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.moduleName,e.details.flags,e.flags,e.details.docString);return i.details=Object.assign({},e.details),delete i.details.paramSpec,n&&(i.details.parameters=n.map(((e,t)=>({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:!1,hasDeclaredType:!0,type:e.type})))),i},e.addDefaultParameters=function(t,n=!1){e.addParameter(t,{category:1,name:"args",type:n?o.create():d.create(),hasDeclaredType:!n}),e.addParameter(t,{category:2,name:"kwargs",type:n?o.create():d.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.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}}(c=t.FunctionType||(t.FunctionType={})),(m=t.OverloadedFunctionType||(t.OverloadedFunctionType={})).create=function(e=[]){return{category:6,overloads:e,flags:2}},m.addOverload=function(e,t){e.overloads.push(t)},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}}(p=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}}(d=t.AnyType||(t.AnyType={})),function(e){function t(e,t){return e.typeVarName<t.typeVarName?-1:e.typeVarName>t.typeVarName?1:e.constraintIndex<t.constraintIndex?-1:e.constraintIndex>t.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}}(u=t.SubtypeConstraint||(t.SubtypeConstraint={})),function(e){e.create=function(){return{category:10,subtypes:[],flags:3}},e.addType=function(e,t,n){v(t)&&a.isBuiltIn(t.classType,"str")&&void 0!==t.classType.literalValue&&!n?(void 0===e.literalStrMap&&(e.literalStrMap=new Map),e.literalStrMap.set(t.classType.literalValue,t)):v(t)&&a.isBuiltIn(t.classType,"int")&&void 0!==t.classType.literalValue&&!n&&(void 0===e.literalIntMap&&(e.literalIntMap=new Map),e.literalIntMap.set(t.classType.literalValue,t)),n&&(e.constraints||(e.constraints=Array.from({length:e.subtypes.length})),e.constraints.push(n)),e.flags&=t.flags,e.subtypes.push(t)},e.containsType=function(e,t,n,i=0){if(v(t)){if(a.isBuiltIn(t.classType,"str")&&void 0!==t.classType.literalValue&&void 0!==e.literalStrMap)return e.literalStrMap.has(t.classType.literalValue);if(a.isBuiltIn(t.classType,"int")&&void 0!==t.classType.literalValue&&void 0!==e.literalIntMap)return e.literalIntMap.has(t.classType.literalValue)}return void 0!==e.subtypes.find((e=>S(e,t,i+1)))}}(h=t.UnionType||(t.UnionType={})),function(e){function t(e,t){return`${e}.${t}`}function n(e,t,n,i){return{category:11,details:{name:e,constraints:[],variance:0,isParamSpec:t,isSynthesized:n},flags:i}}e.createInstance=function(e,t,i=!1){return n(e,t,i,2)},e.createInstantiable=function(e,t,i=!1){return n(e,t,i,1)},e.cloneAsInstance=function(e){i.assert(r.isInstantiable(e));const t=Object.assign({},e);return t.flags&=-2,t.flags|=2,t},e.cloneAsInstantiable=function(e){i.assert(r.isInstance(e));const t=Object.assign({},e);return t.flags&=-3,t.flags|=1,t},e.cloneForScopeId=function(e,n,i){const s=Object.assign({},e);return s.nameWithScope=t(e.details.name,n),s.scopeId=n,s.scopeName=i,s},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=g,t.isNone=function(e){return 3===e.category},t.isUnknown=function(e){return 1===e.category},t.isAnyOrUnknown=f,t.isUnbound=_,t.isPossiblyUnbound=function e(t){return 0===t.category||10===t.category&&void 0!==t.subtypes.find((t=>e(t)))},t.isClass=T,t.isObject=v,t.isModule=function(e){return 9===e.category},t.isTypeVar=b,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=S,t.removeAnyFromUnion=function(e){return C(e,(e=>f(e)))},t.removeUnknownFromUnion=function(e){return C(e,(e=>1===e.category))},t.removeUnbound=function(e){return 10===e.category?C(e,(e=>_(e))):_(e)?o.create():e},t.removeNoneFromUnion=function(e){return C(e,(e=>3===e.category))},t.removeFromUnion=C,t.findSubtype=I,t.isUnionableType=function(e){let t=3;for(const n of e)t&=n.flags;return 0!=(1&t)&&0==(2&t)},t.combineTypes=function(e,t){return D(e.map((e=>({type:e,constraints:void 0}))),t)},t.combineConstrainedTypes=D,t.isSameWithoutLiteralValue=x},9560:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunner=t.BackgroundAnalysis=void 0;const i=n(5013),s=n(4795),r=n(3213);class o extends s.BackgroundAnalysisBase{constructor(e){super(e);const t={rootDirectory:global.__rootDirectory,cancellationFolderName:r.getCancellationFolderName()},n=new i.Worker(__filename,{workerData:t});this.setup(n)}}t.BackgroundAnalysis=o;class a extends s.BackgroundAnalysisRunnerBase{constructor(){super()}}t.BackgroundAnalysisRunner=a},4795: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},o=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunnerBase=t.BackgroundAnalysisBase=void 0;const a=n(5013),l=n(1241),c=n(2374),p=n(8408),d=n(5055),u=n(3213),h=n(2930),m=n(2211),y=r(n(5839)),g=n(1290),f=n(7345);t.BackgroundAnalysisBase=class{constructor(e){this.console=e,this._onAnalysisCompletion=l.nullCallback}setup(e){this._worker=e,e.on("message",(e=>this.onMessage(e))),e.on("error",(e=>{this.log(m.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(T(e.data));break;default:y.fail(`${e.requestType} is not expected`)}}setCompletionCallback(e){this._onAnalysisCompletion=null!=e?e:l.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})}setFileOpened(e,t,n){this.enqueueRequest({requestType:"setFileOpened",data:{filePath:e,version:t,contents:n}})}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(T(e.data));break;case"analysisPaused":u.disposeCancellationToken(n),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":u.disposeCancellationToken(n),s.close(),i.close();break;default:y.fail(`${e.requestType} is not expected`)}}));const r=u.getCancellationTokenId(n);this.enqueueRequest({requestType:e,data:r,port:s})}startIndexing(e,t){}refreshIndexing(e,t){}cancelIndexing(e){}getDiagnosticsForRange(e,t,n){return o(this,void 0,void 0,(function*(){u.throwIfCancellationRequested(n);const{port1:i,port2:s}=new a.MessageChannel,r=d.getBackgroundWaiter(i),o=u.getCancellationTokenId(n);this.enqueueRequest({requestType:"getDiagnosticsForRange",data:{filePath:e,range:t,cancellationId:o},port:s});const l=yield r;return s.close(),i.close(),v(l)}))}writeTypeStub(e,t,n,i){return o(this,void 0,void 0,(function*(){u.throwIfCancellationRequested(i);const{port1:s,port2:r}=new a.MessageChannel,o=d.getBackgroundWaiter(s),l=u.getCancellationTokenId(i);this.enqueueRequest({requestType:"writeTypeStub",data:{targetImportPath:e,targetIsSingleFile:t,stubPath:n,cancellationId:l},port:r}),yield 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){m.log(this.console,e,t)}};class _ extends d.BackgroundThreadBase{constructor(e){super(a.workerData),this._extension=e;const t=a.workerData;this.log(m.LogLevel.Info,`Background analysis(${a.threadId}) root directory: ${t.rootDirectory}`),this._configOptions=new h.ConfigOptions(t.rootDirectory),this._importResolver=this.createImportResolver(this.fs,this._configOptions);const n=this.getConsole();this._program=new p.Program(this._importResolver,this._configOptions,n,this._extension,new f.LogTracker(n,`BG(${a.threadId})`))}get program(){return this._program}start(){this.log(m.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=>y.fail(`failed ${e}`))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("exit",(e=>{0!==e&&y.fail(`worker stopped with exit code ${e}`)}))}onMessage(e){switch(this.log(m.LogLevel.Log,`Background analysis message: ${e.requestType}`),e.requestType){case"analyze":{const t=e.port,n=u.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=u.getCancellationTokenFromId(e.data);this._analyzeOneChunk(t,n,e);break}case"getDiagnosticsForRange":d.run((()=>{const{filePath:t,range:n,cancellationId:i}=e.data,s=u.getCancellationTokenFromId(i);return u.throwIfCancellationRequested(s),this.program.getDiagnosticsForRange(t,n)}),e.port);break;case"writeTypeStub":d.run((()=>{const{targetImportPath:t,targetIsSingleFile:n,stubPath:i,cancellationId:s}=e.data,r=u.getCancellationTokenFromId(s);l.analyzeProgram(this.program,void 0,this._configOptions,l.nullCallback,this.getConsole(),r),this.program.writeTypeStub(t,n,i,r)}),e.port);break;case"setConfigOptions":this._configOptions=d.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"setFileOpened":{const{filePath:t,version:n,contents:i}=e.data;this.program.setFileOpened(t,n,i);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:y.fail(`${e.requestType} is not expected`)}}_analyzeOneChunk(e,t,n){l.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 c.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 T(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 g.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=_},5055: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 o=n(5013),a=n(3213),l=n(2930),c=n(2211),p=r(n(5839)),d=n(7830);t.BackgroundThreadBase=class{constructor(e){a.setCancellationFolderName(e.cancellationFolderName),global.__rootDirectory=e.rootDirectory,this.fs=d.createFromRealFileSystem(this.getConsole())}log(e,t){null===o.parentPort||void 0===o.parentPort||o.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.venvPath=e.venvPath,t.defaultVenv=e.defaultVenv,t.defaultPythonVersion=e.defaultPythonVersion,t.defaultPythonPlatform=e.defaultPythonPlatform,t.diagnosticRuleSet=e.diagnosticRuleSet,t.executionEnvironments=e.executionEnvironments,t.autoImportCompletions=e.autoImportCompletions,t.indexing=e.indexing,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(a.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 a.OperationCanceledException);break;case"failed":n(e.data);break;default:p.fail(`unknown kind ${e.kind}`)}}))}))}},9926:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CommandController=void 0;const s=n(4494),r=n(739),o=n(7601),a=n(2719);t.CommandController=class{constructor(e){this._createStub=new r.CreateTypeStubCommand(e),this._restartServer=new a.RestartServerCommand(e),this._quickAction=new o.QuickActionCommand(e)}execute(e,t){return i(this,void 0,void 0,(function*(){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 s.ResponseError(1,"Unsupported command")}}))}isLongRunningCommand(e){switch(e){case"pyright.createtypestub":return!0;default:return!1}}}},739:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CreateTypeStubCommand=void 0;const s=n(6708),r=n(3213),o=n(8304),a=n(6657),l=n(31);t.CreateTypeStubCommand=class{constructor(e){this._ls=e}execute(e,t){return i(this,void 0,void 0,(function*(){if(e.arguments&&e.arguments.length>=2){const n=e.arguments[0],i=e.arguments[1],s=e.arguments[2],c=yield this._createTypeStubService(s),p={workspaceName:`Create Type Stub ${i}`,rootPath:n,rootUri:a.convertPathToUri(n),serviceInstance:c,disableLanguageServices:!0,disableOrganizeImports:!0,isInitialized:o.createDeferred()},d=yield this._ls.getSettings(p);l.AnalyzerServiceExecutor.runWithOptions(this._ls.rootPath,p,d,i,!1);try{yield c.writeTypeStubInBackground(t),c.dispose();const e=`Type stub was successfully created for '${i}'.`;this._ls.window.showInformationMessage(e),this._handlePostCreateTypeStub()}catch(e){if(r.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)}}}}))}_createTypeStubService(e){return i(this,void 0,void 0,(function*(){return e?(yield this._ls.getWorkspaceForFile(e)).serviceInstance.clone("Type stub",this._ls.createBackgroundAnalysis()):new s.AnalyzerService("Type stub",this._ls.fs,this._ls.console)}))}_handlePostCreateTypeStub(){this._ls.reanalyze()}}},7601:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.QuickActionCommand=void 0;const s=n(6657),r=n(743);t.QuickActionCommand=class{constructor(e){this._ls=e}execute(e,t){return i(this,void 0,void 0,(function*(){if(e.arguments&&e.arguments.length>=1){const n=e.arguments[0],i=e.arguments.slice(1),o=s.convertUriToPath(n),a=yield this._ls.getWorkspaceForFile(o);if("pyright.organizeimports"===e.command&&a.disableOrganizeImports)return[];const l=a.serviceInstance.performQuickAction(o,e.command,i,t);return r.convertTextEdits(n,l)}}))}}},2719:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RestartServerCommand=void 0,t.RestartServerCommand=class{constructor(e){this._ls=e}execute(e){return n(this,void 0,void 0,(function*(){this._ls.restart()}))}}},3213: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.CancelAfter=t.getCancellationTokenId=t.getCancellationTokenFromId=t.disposeCancellationToken=t.createBackgroundThreadCancellationTokenSource=t.getCancellationStrategyFromArgv=t.setCancellationFolderName=t.getCancellationFolderName=t.throwIfCancellationRequested=t.OperationCanceledException=void 0;const o=r(n(5747)),a=r(n(2087)),l=r(n(5622)),c=n(6744),p=n(4494);class d{static shouldCheck(){const e=Date.now().valueOf();return e-this._lastCheckTimestamp>=5&&(this._lastCheckTimestamp=e,!0)}}d._lastCheckTimestamp=0;class u{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||(d.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 o.statSync(this.cancellationFilePath),!0}catch(e){return!1}}}class h extends u{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{o.writeFileSync(this.cancellationFilePath,"",{flag:"w"})}catch(e){}}_removePipe(){try{o.unlinkSync(this.cancellationFilePath)}catch(e){}}}class m{constructor(e,t=!1){this._cancellationFilePath=e,this._ownFile=t}get token(){return this._token||(this._token=this._ownFile?new h(this._cancellationFilePath):new u(this._cancellationFilePath)),this._token}cancel(){this._token?this._token.cancel():this._token=p.CancellationToken.Cancelled}dispose(){this._token?this._token instanceof u&&this._token.dispose():this._token=p.CancellationToken.None}}function y(e,t){return l.join(function(e){return l.join(a.tmpdir(),"python-languageserver-cancellation",e)}(e),`cancellation-${String(t)}.tmp`)}class g{constructor(e){this.folderName=e}createCancellationTokenSource(e){return new m(y(this.folderName,e))}}class f extends p.ResponseError{constructor(){super(p.LSPErrorCodes.RequestCancelled,"request cancelled")}static is(e){return e.code===p.LSPErrorCodes.RequestCancelled}}let _;function T(e){_=e}t.OperationCanceledException=f,t.throwIfCancellationRequested=function(e){if(e.isCancellationRequested)throw new f},t.getCancellationFolderName=function(){return _},t.setCancellationFolderName=T,t.getCancellationStrategyFromArgv=function(e){let t;for(let i=0;i<e.length;i++){const s=e[i];if("--cancellationReceive"===s)t=n(e[i+1]);else{const e=s.split("=");"--cancellationReceive"===e[0]&&(t=n(e[1]))}}return t&&!_&&T(t.folderName),t=t||p.CancellationReceiverStrategy.Message,{receiver:t,sender:p.CancellationSenderStrategy.Message};function n(e){const t=function(e){const t=e.match(/^file:(.+)$/);return t?t[1]:void 0}(e);return t?new g(t):void 0}};let v=0;t.createBackgroundThreadCancellationTokenSource=function(){return _?new m(y(_,`source-${String(v++)}`),!0):new c.CancellationTokenSource},t.disposeCancellationToken=function(e){e instanceof u&&e.dispose()},t.getCancellationTokenFromId=function(e){return e?new u(e):p.CancellationToken.None},t.getCancellationTokenId=function(e){return e instanceof u?e.cancellationFilePath:void 0},t.CancelAfter=function(...e){const t=new c.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}},9489:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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(2489);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;s<i&&s<t.length;s++)void 0!==t[s]&&e.push(t[s]);return e}function o(e,t){return t}function a(e,t){return!!e&&(t?e.some(t):e.length>0)}function l(e,t,n,i,s){if(!a(e))return-1;let r=s||0,o=e.length-1;for(;r<=o;){const s=r+(o-r>>1);switch(i(n(e[s]),t)){case-1:r=s+1;break;case 0:return s;case 1:o=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;n<e.length;n++){const i=e[n];if(t(i,n))return i}},t.addRange=r,t.insertAt=function(e,t,n){if(0===t)e.unshift(n);else if(t===e.length)e.push(n);else{for(let n=e.length;n>t;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(o)}(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=a,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)}},1775:(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.executionRoot=e,this.fromVsCodeExtension=t}}},2930: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 o=r(n(3129)),a=n(5622),l=r(n(3188)),c=n(9744),p=n(6657),d=n(6886);var u;!function(e){e.Darwin="Darwin",e.Windows="Windows",e.Linux="Linux"}(u=t.PythonPlatform||(t.PythonPlatform={}));class h{constructor(e,t,n){this.extraPaths=[],this.root=e,this.pythonVersion=t||d.latestStablePythonVersion,this.pythonPlatform=n}}t.ExecutionEnvironment=h,t.cloneDiagnosticRuleSet=function(e){return Object.assign({},e)},t.getBooleanDiagnosticRules=function(){return[c.DiagnosticRule.strictListInference,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.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedNamedTuple,c.DiagnosticRule.reportPrivateUsage,c.DiagnosticRule.reportConstantRedefinition,c.DiagnosticRule.reportIncompatibleMethodOverride,c.DiagnosticRule.reportIncompatibleVariableOverride,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.reportAssertAlwaysTrue,c.DiagnosticRule.reportSelfClsParameterName,c.DiagnosticRule.reportImplicitStringConcatenation,c.DiagnosticRule.reportUndefinedVariable,c.DiagnosticRule.reportUnboundVariable,c.DiagnosticRule.reportInvalidStubStatement,c.DiagnosticRule.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnusedCallResult]},t.getStrictModeNotOverriddenRules=function(){return[c.DiagnosticRule.reportMissingModuleSource]},t.getOffDiagnosticRuleSet=function(){return{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,pep604Printing:!0,strictListInference:!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",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"warning",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none"}},t.getBasicDiagnosticRuleSet=function(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,pep604Printing:!0,strictListInference:!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:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none"}},t.getStrictDiagnosticRuleSet=function(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,pep604Printing:!0,strictListInference:!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",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none"}};class m{constructor(e,t){this.include=[],this.exclude=[],this.ignore=[],this.strict=[],this.autoImportCompletions=!0,this.indexing=!1,this.disableInferenceForPyTypedSources=!0,this.executionEnvironments=[],this.projectRoot=e,this.diagnosticRuleSet=m.getDiagnosticRuleSet(t),"off"===t&&(this.disableInferenceForPyTypedSources=!1)}static getDiagnosticRuleSet(e){return"strict"===e?{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,pep604Printing:!0,strictListInference:!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",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none"}:"off"===e?{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,pep604Printing:!0,strictListInference:!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",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"warning",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none"}:{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,pep604Printing:!0,strictListInference:!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:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none"}}findExecEnvironment(e){let t=this.executionEnvironments.find((t=>{const n=p.ensureTrailingDirectorySeparator(p.normalizePath(p.combinePaths(this.projectRoot,t.root)));return e.startsWith(n)}));return t||(t=new h(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform)),t}getDefaultExecEnvironment(){return new h(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform)}addExecEnvironmentForExtraPaths(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.length>0)for(const e of n)i.push(p.resolvePaths(this.projectRoot,e));if(i.length>0){const e=new h(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform);e.extraPaths.push(...i),this.executionEnvironments.push(e)}}initializeFromJson(e,t,n,i,s,r=!1){let o;r||(this.include=[],void 0===e.include)||(Array.isArray(e.include)?e.include.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "include" array should be a string.`):a.isAbsolute(e)?n.error(`Ignoring path "${e}" in "include" array because it is not relative.`):this.include.push(p.getFileSpec(this.projectRoot,e))})):n.error('Config "include" entry must must contain an array.')),this.exclude=[],void 0!==e.exclude&&(Array.isArray(e.exclude)?e.exclude.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "exclude" array should be a string.`):a.isAbsolute(e)?n.error(`Ignoring path "${e}" in "exclude" array because it is not relative.`):this.exclude.push(p.getFileSpec(this.projectRoot,e))})):n.error('Config "exclude" entry must contain an array.')),this.ignore=[],void 0!==e.ignore&&(Array.isArray(e.ignore)?e.ignore.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "ignore" array should be a string.`):a.isAbsolute(e)?n.error(`Ignoring path "${e}" in "ignore" array because it is not relative.`):this.ignore.push(p.getFileSpec(this.projectRoot,e))})):n.error('Config "ignore" entry must contain an array.')),this.strict=[],void 0!==e.strict&&(Array.isArray(e.strict)?e.strict.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "strict" array should be a string.`):a.isAbsolute(e)?n.error(`Ignoring path "${e}" in "strict" array because it is not relative.`):this.strict.push(p.getFileSpec(this.projectRoot,e))})):n.error('Config "strict" entry must contain an array.')),void 0!==e.typeCheckingMode&&("off"===e.typeCheckingMode||"basic"===e.typeCheckingMode||"strict"===e.typeCheckingMode?o=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=o||t,u=m.getDiagnosticRuleSet(l);if("off"===l&&(this.disableInferenceForPyTypedSources=!1),this.applyDiagnosticOverrides(i),this.diagnosticRuleSet={printUnknownAsAny:u.printUnknownAsAny,omitTypeArgsIfAny:u.omitTypeArgsIfAny,omitUnannotatedParamType:u.omitUnannotatedParamType,pep604Printing:u.pep604Printing,strictListInference:this._convertBoolean(e.strictListInference,c.DiagnosticRule.strictListInference,u.strictListInference),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),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),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),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),reportUnsupportedDunderAll:this._convertDiagnosticLevel(e.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnsupportedDunderAll,u.reportUnsupportedDunderAll),reportUnusedCallResult:this._convertDiagnosticLevel(e.reportUnusedCallResult,c.DiagnosticRule.reportUnusedCallResult,u.reportUnusedCallResult)},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.defaultVenv=void 0,void 0!==e.venv&&("string"!=typeof e.venv?n.error('Config "venv" field must contain a string.'):this.defaultVenv=e.venv),this.defaultPythonVersion=void 0,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.');this.ensureDefaultPythonVersion(s,n),this.defaultPythonPlatform=void 0,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&&(Array.isArray(e.executionEnvironments)?e.executionEnvironments.forEach(((e,t)=>{const i=this._initExecutionEnvironmentFromJson(e,t,n);i&&this.executionEnvironments.push(i)})):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)}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)}`))}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);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&&(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)))})):n.error(`Config executionEnvironments index ${t}: extraPaths field must contain an array.`)),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.`)),e.venv&&("string"==typeof e.venv?i.venv=e.venv:n.error(`Config executionEnvironments index ${t} venv must be a string.`)),i}catch(e){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?o.execFileSync(e,n,{encoding:"utf8"}):o.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(e){return void t.info("Unable to get Python version from interpreter")}}}t.ConfigOptions=m},2211: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.StandardConsole=t.NullConsole=t.LogLevel=void 0;const o=r(n(5839));var a;function l(e,t,n){switch(t){case a.Log:e.log(n);break;case a.Info:e.info(n);break;case a.Warn:e.warn(n);break;case a.Error:e.error(n);break;default:o.fail(`${t} is not expected`)}}!function(e){e.Error="error",e.Warn="warn",e.Info="info",e.Log="log"}(a=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.ConsoleWithLogLevel=class{constructor(e){this._console=e,this._levelMap=new Map([[a.Error,0],[a.Warn,1],[a.Info,2],[a.Log,3]]),this._maxLevel=2}get level(){switch(this._maxLevel){case 0:return a.Error;case 1:return a.Warn;case 2:return a.Info}return a.Log}set level(e){let t=this._levelMap.get(e);void 0===t&&(t=this._levelMap.get(a.Info)),this._maxLevel=t}error(e){this._log(a.Error,e)}warn(e){this._log(a.Warn,e)}info(e){this._log(a.Info,e)}log(e){this._log(a.Log,e)}_log(e,t){this._getNumericalLevel(e)>this._maxLevel||l(this._console,e,t)}_getNumericalLevel(e){const t=this._levelMap.get(e);return o.assert(void 0!==t,"Logger: unknown log level."),void 0!==t?t:2}},t.log=l},2489:(e,t)=>{"use strict";function n(e,t){return e===t?0:void 0===e?-1:void 0===t?1:e<t?-1:1}Object.defineProperty(t,"__esModule",{value:!0}),t.isThenable=t.isDebugMode=t.toBoolean=t.hasProperty=t.isNumber=t.isString=t.isArray=t.compareValues=t.compareComparableValues=t.equateValues=t.toLowerCase=t.identity=t.returnUndefined=t.returnTrue=t.returnFalse=void 0,t.returnFalse=function(){return!1},t.returnTrue=function(){return!0},t.returnUndefined=function(){},t.identity=function(e){return e},t.toLowerCase=function(e){return e.toLowerCase()},t.equateValues=function(e,t){return e===t},t.compareComparableValues=n,t.compareValues=function(e,t){return n(e,t)},t.isArray=function(e){return Array.isArray?Array.isArray(e):e instanceof Array},t.isString=function(e){return"string"==typeof e},t.isNumber=function(e){return"number"==typeof e};const i=Object.prototype.hasOwnProperty;t.hasProperty=function(e,t){return i.call(e,t)},t.toBoolean=function(e){return"TRUE"===(null==e?void 0:e.trim().toUpperCase())},t.isDebugMode=function(){const e=process.execArgv.join();return e.includes("inspect")||e.includes("debug")},t.isThenable=function(e){return"function"==typeof(null==e?void 0:e.then)}},5839:(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(9489),s=n(2489);function r(e,t){const n=new Error(e?`Debug Failure. ${e}`:"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(n,t||r),n}function o(e,t){return null==e?r(t):e}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=o,t.assertEachDefined=function(e,t){for(const n of e)o(n,t);return e},t.assertNever=function e(t,n="Illegal value:",i){return 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 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}}},8304:(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}},1290:(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);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=0){if(e<=0||t>64)return[];const n=[];for(const i of this._childAddenda){const s=this._messages.length>0?e-1:e;n.push(...i._getLinesRecursive(s,t+1))}const i=this._messages.length>0?"  ":"";return this._messages.concat(n).map((e=>i+e))}}t.DiagnosticAddendum=n},9744:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticRule=void 0,(n=t.DiagnosticRule||(t.DiagnosticRule={})).strictListInference="strictListInference",n.strictDictionaryInference="strictDictionaryInference",n.strictParameterNoneValue="strictParameterNoneValue",n.enableTypeIgnoreComments="enableTypeIgnoreComments",n.reportGeneralTypeIssues="reportGeneralTypeIssues",n.reportPropertyTypeMismatch="reportPropertyTypeMismatch",n.reportFunctionMemberAccess="reportFunctionMemberAccess",n.reportMissingImports="reportMissingImports",n.reportMissingModuleSource="reportMissingModuleSource",n.reportMissingTypeStubs="reportMissingTypeStubs",n.reportImportCycles="reportImportCycles",n.reportUnusedImport="reportUnusedImport",n.reportUnusedClass="reportUnusedClass",n.reportUnusedFunction="reportUnusedFunction",n.reportUnusedVariable="reportUnusedVariable",n.reportDuplicateImport="reportDuplicateImport",n.reportWildcardImportFromLibrary="reportWildcardImportFromLibrary",n.reportOptionalSubscript="reportOptionalSubscript",n.reportOptionalMemberAccess="reportOptionalMemberAccess",n.reportOptionalCall="reportOptionalCall",n.reportOptionalIterable="reportOptionalIterable",n.reportOptionalContextManager="reportOptionalContextManager",n.reportOptionalOperand="reportOptionalOperand",n.reportUntypedFunctionDecorator="reportUntypedFunctionDecorator",n.reportUntypedClassDecorator="reportUntypedClassDecorator",n.reportUntypedBaseClass="reportUntypedBaseClass",n.reportUntypedNamedTuple="reportUntypedNamedTuple",n.reportPrivateUsage="reportPrivateUsage",n.reportConstantRedefinition="reportConstantRedefinition",n.reportIncompatibleMethodOverride="reportIncompatibleMethodOverride",n.reportIncompatibleVariableOverride="reportIncompatibleVariableOverride",n.reportInvalidStringEscapeSequence="reportInvalidStringEscapeSequence",n.reportUnknownParameterType="reportUnknownParameterType",n.reportUnknownArgumentType="reportUnknownArgumentType",n.reportUnknownLambdaType="reportUnknownLambdaType",n.reportUnknownVariableType="reportUnknownVariableType",n.reportUnknownMemberType="reportUnknownMemberType",n.reportMissingTypeArgument="reportMissingTypeArgument",n.reportInvalidTypeVarUse="reportInvalidTypeVarUse",n.reportCallInDefaultInitializer="reportCallInDefaultInitializer",n.reportUnnecessaryIsInstance="reportUnnecessaryIsInstance",n.reportUnnecessaryCast="reportUnnecessaryCast",n.reportAssertAlwaysTrue="reportAssertAlwaysTrue",n.reportSelfClsParameterName="reportSelfClsParameterName",n.reportImplicitStringConcatenation="reportImplicitStringConcatenation",n.reportUndefinedVariable="reportUndefinedVariable",n.reportUnboundVariable="reportUnboundVariable",n.reportInvalidStubStatement="reportInvalidStubStatement",n.reportUnsupportedDunderAll="reportUnsupportedDunderAll",n.reportUnusedCallResult="reportUnusedCallResult"},3980:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeDiagnosticSink=t.DiagnosticSink=void 0;const i=n(1290),s=n(1464);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)}}},6755:()=>{"use strict";Promise.prototype.ignoreErrors=function(){this.catch((()=>{}))}},7830: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.ignoredWatchEventFunction=t.createFromRealFileSystem=void 0;const o=r(n(778)),a=r(n(5747)),l=r(n(1195));l.setGracefulCleanup();const c=n(2211),p=n(8304);t.createFromRealFileSystem=function(e,t){return new h(null!=t?t:new m(null!=e?e:new c.NullConsole))},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))}};const d="darwin"===process.platform,u="linux"===process.platform;class h{constructor(e){this._fileWatcherProvider=e}existsSync(e){return a.existsSync(e)}mkdirSync(e,t){a.mkdirSync(e,t)}chdir(e){process.chdir(e)}readdirSync(e){return a.readdirSync(e)}readdirEntriesSync(e){return a.readdirSync(e,{withFileTypes:!0})}readFileSync(e,t=null){return a.readFileSync(e,{encoding:t})}writeFileSync(e,t,n){a.writeFileSync(e,t,{encoding:n})}statSync(e){return a.statSync(e)}unlinkSync(e){a.unlinkSync(e)}realpathSync(e){return a.realpathSync(e)}getModulePath(){return global.__rootDirectory}createFileSystemWatcher(e,t){return this._fileWatcherProvider.createFileWatcher(e,t)}createReadStream(e){return a.createReadStream(e)}createWriteStream(e){return a.createWriteStream(e)}copyFileSync(e,t){a.copyFileSync(e,t)}readFile(e){const t=p.createDeferred();return a.readFile(e,((e,n)=>{e?t.reject(e):t.resolve(n)})),t.promise}readFileText(e,t){const n=p.createDeferred();return a.readFile(e,{encoding:t},((e,t)=>{e?n.reject(e):n.resolve(t)})),n.promise}tmpdir(){if(!this._tmpdir){const e=l.dirSync({prefix:"pyright"});this._tmpdir=e.name}return this._tmpdir}tmpfile(e){return l.fileSync(Object.assign({dir:this.tmpdir(),discardDescriptor:!0},e)).name}}class m{constructor(e){this._console=e}createFileWatcher(e,t){return this._createFileSystemWatcher(e).on("all",t)}createReadStream(e){return a.createReadStream(e)}createWriteStream(e){return a.createWriteStream(e)}_createFileSystemWatcher(e){const t={ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0,interval:1e3,binaryInterval:1e3,disableGlobbing:!0,awaitWriteFinish:{stabilityThreshold:1e3,pollInterval:1e3}};d&&(t.usePolling=!1);const n=["**/__pycache__/**"];(d||u)&&e.some((e=>""===e||"/"===e))&&(n.push("/dev/**"),u&&n.push("/proc/**","/sys/**")),t.ignored=n;const i=o.watch(e,t);return i.on("error",(e=>{this._console.error("Error returned from file system watcher.")})),d&&!i.options.useFsEvents&&this._console.info("Watcher could not use native fsevents library. File system watcher disabled."),i}readFile(e){const t=p.createDeferred();return a.readFile(e,((e,n)=>{e?t.reject(e):t.resolve(n)})),t.promise}readFileText(e,t){const n=p.createDeferred();return a.readFile(e,{encoding:t},((e,t)=>{e?n.reject(e):n.resolve(t)})),n.promise}}},7345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogTracker=void 0;const i=n(2211),s=n(8718);t.LogTracker=class{constructor(e,t){this._console=e,this._prefix=t,this._dummyState=new r,this._indentation="",this._previousTitles=[]}log(e,t){if(void 0===this._console)return t(this._dummyState);const n=this._console.level;if(void 0===n||n!==i.LogLevel.Log&&n!==i.LogLevel.Info)return t(this._dummyState);const o=new s.Duration,a=this._indentation;this._previousTitles.push(`${a}${e} ...`),this._indentation+="  ";const l=new r;try{return t(l)}finally{this._printPreviousTitles(),this._indentation=a;const t=o.getDurationInMilliseconds();l.isSuppressed()||(this._console.log(`[${this._prefix}] ${this._indentation}${e}${l.get()} (${t}ms)`),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{add(e){this._addendum=e}get(){return this._addendum?` [${this._addendum}]`:""}suppress(){this._suppress=!0}isSuppressed(){return!!this._suppress}}},3188:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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"},6657: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.convertUriToPath=t.isDiskPathRoot=t.isRootedDiskPath=t.getRegexEscapedSeparator=t.getFileSpec=t.getWildcardRoot=t.getWildcardRegexPattern=t.getFileSystemEntries=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 o=n(6417),a=r(n(5622)),l=n(472),c=n(9489),p=n(2489),d=r(n(5839)),u=n(7559);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=T(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(!c.some(e))return[];const t=[e[0]];for(let n=1;n<e.length;n++){const i=e[n];if(i&&"."!==i){if(".."===i)if(t.length>1){if(".."!==t[t.length-1]){t.pop();continue}}else if(t[0])continue;t.push(i)}}return t}function _(e){return 0===e.length?"":T((e[0]&&I(e[0]))+e.slice(1).join(a.sep))}function T(e){return e.replace(/[\\/]/g,a.sep)}function v(e,...t){e&&(e=T(e));for(let n of t)n&&(n=T(n),e=e&&0===y(n)?I(e)+n:n);return e}function b(e,t,n){if(t)return function(e,t,n){if("string"==typeof t)return R(e,t,n)||"";for(const i of t){const t=R(e,i,n);if(t)return t}return""}(x(e),t,n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive);const i=S(e),s=i.lastIndexOf(".");return s>=0?i.substring(s):""}function S(e,t,n){if(y(e=T(e))===e.length)return"";const i=(e=x(e)).slice(Math.max(y(e),e.lastIndexOf(a.sep)+1)),s=void 0!==t&&void 0!==n?b(i,t,n):void 0;return s?i.slice(0,i.length-s.length):i}function C(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:p.identity;return function(e,t,n,i){const s=g(e),r=g(t);let o;for(o=0;o<s.length&&o<r.length;o++){const e=i(s[o]),t=i(r[o]);if(!(0===o?u.equateStringsCaseInsensitive:n)(e,t))break}if(0===o)return r;const a=r.slice(o),l=[];for(;o<s.length;o++)l.push("..");return["",...l,...a]}(e,t,"boolean"==typeof n&&n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive,i)}function I(e){return D(e)?e:e+a.sep}function D(e){if(0===e.length)return!1;const t=e.charCodeAt(e.length-1);return 47===t||92===t}function x(e){return D(e)?e.substr(0,e.length-1):e}function F(e,t=!1){if(!t)return a.extname(e);const n=(e=k(e)).indexOf(".");return e.substr(n)}function k(e){return a.basename(e)}function P(e,t=!1){const n=F(e,t);return e.substr(0,e.length-n.length)}function A(e){return T(a.normalize(e))}function E(e,t){let n=A(v(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=I(n));const i=g(n),s=N(),r=`(${s}[^${s}.][^${s}]*)*?`,o=new RegExp(`[^\\w\\s${s}]`,"g");i.length>0&&(i[0]=x(i[0]));let a="",l=!0;for(let e of i)"**"===e?a+=r:(l||(e=s+e),a+=e.replace(o,(e=>"*"===e?`[^${s}]*`:"?"===e?`[^${s}]`:"\\"+e)),l=!1);return a}function w(e,t){let n=A(v(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=I(n));const i=g(n);i.length>0&&(i[0]=x(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 N(){return"/"===a.sep?"/":"\\\\"}function O(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 o=N(),a=new RegExp(`(^|${o}).{0,2}($|${o})`),l=e.substring(i.length),c=t.substring(s.length);if(!a.test(l)&&!a.test(c))return n(l,c);const d=g(e),h=g(t),m=Math.min(d.length,h.length);for(let e=1;e<m;e++){const t=n(d[e],h[e]);if(0!==t)return t}return p.compareValues(d.length,h.length)}function R(e,t,n){if(t.startsWith(".")||(t="."+t),e.length>=t.length&&46===e.charCodeAt(e.length-t.length)){const i=e.slice(e.length-t.length);if(n(i,t))return i}}function M(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 L(e){return void 0!==h||(h=U(e)),h}function U(e){let t;try{let n,i;do{n=`${o.randomBytes(21).toString("hex")}-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.FileSpec||(t.FileSpec={})).is=function(e){const t=e;return t&&!!t.wildcardRoot&&!!t.regExp},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.getRelativePath=function(e,t){if(!e.startsWith(I(t)))return;const n=g(e);let i=".";for(let e=g(t).length;e<n.length;e++)i+=a.sep+n[e];return i},t.makeDirectories=function(e,t,n){if(!t.startsWith(n))return;const i=g(t);let s=n;for(let t=g(n).length;t<i.length;t++)s=v(s,i[t]),e.existsSync(s)||e.mkdirSync(s)},t.getFileSize=function(e,t){try{const n=e.statSync(t);if(n.isFile())return n.size}catch(e){}return 0},t.fileExists=function(e,t){return M(e,t,0)},t.directoryExists=function(e,t){return M(e,t,1)},t.normalizeSlashes=T,t.resolvePaths=function(e,...t){return A(c.some(t)?v(e,...t):T(e))},t.combinePaths=v,t.comparePaths=function(e,t,n,i){return e=A(e),t=A(t),"string"==typeof n?(e=v(n,e),t=v(n,t)):"boolean"==typeof n&&(i=n),O(e,t,u.getStringComparer(i))},t.containsPath=function(e,t,n,i){if("string"==typeof n?(e=v(n,e),t=v(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.length<s.length)return!1;const o=i?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive;for(let e=0;e<s.length;e++)if(!(0===e?u.equateStringsCaseInsensitive:o)(s[e],r[e]))return!1;return!0},t.changeAnyExtension=function(e,t,n,i){const s=void 0!==n&&void 0!==i?b(e,n,i):b(e);return s?e.slice(0,e.length-s.length)+(t.startsWith(".")?t:"."+t):e},t.getAnyExtensionFromPath=b,t.getBaseFileName=S,t.getRelativePathFromDirectory=function(e,t,n){return _(C(e,t,n))},t.getRelativePathComponentsFromDirectory=C,t.comparePathsCaseSensitive=function(e,t){return O(e,t,u.compareStringsCaseSensitive)},t.comparePathsCaseInsensitive=function(e,t){return O(e,t,u.compareStringsCaseInsensitive)},t.ensureTrailingDirectorySeparator=I,t.hasTrailingDirectorySeparator=D,t.stripTrailingDirectorySeparator=x,t.getFileExtension=F,t.getFileName=k,t.stripFileExtension=P,t.normalizePath=A,t.isDirectory=function(e,t){let n;try{n=e.statSync(t)}catch(e){return!1}return n.isDirectory()},t.isFile=function(e,t){let n;try{n=e.statSync(t)}catch(e){return!1}return n.isFile()},t.getFileSystemEntries=function(e,t){try{const n=e.readdirEntriesSync(t||".").sort(((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)),i=[],s=[];for(const e of n)"."!==e.name&&".."!==e.name&&(e.isFile()?i.push(e.name):e.isDirectory()&&(e.isSymbolicLink()||s.push(e.name)));return{files:i,directories:s}}catch(e){return{files:[],directories:[]}}},t.getWildcardRegexPattern=E,t.getWildcardRoot=w,t.getFileSpec=function(e,t){let n=E(e,t);n=`^(${n})($|${N()})`;const i=new RegExp(n);return{wildcardRoot:w(e,t),regExp:i}},t.getRegexEscapedSeparator=N,t.isRootedDiskPath=function(e){return y(e)>0},t.isDiskPathRoot=function(e){const t=y(e);return t>0&&t===e.length},t.convertUriToPath=function(e){let t=A(l.URI.parse(e).path);return t.match(/^\\[a-zA-Z]:\\/)&&(t=t.substr(1)),t},t.convertPathToUri=function(e){return l.URI.file(e).toString()},t.normalizePathCase=function(e,t){return L(e)?t:t.toLowerCase()},t.isFileSystemCaseSensitive=L,t.isFileSystemCaseSensitiveInternal=U,t.getLibraryPathWithoutExtension=function(e){let t=P(e);return t.endsWith("__init__")&&(t=t.substr(0,t.length-9)),t}},1464:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRangeToTextRange=t.convertPositionToOffset=t.convertOffsetsToRange=t.convertOffsetToPosition=void 0;const i=n(5839),s=n(3550);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 o(e,t){if(!(e.line>=t.count))return t.getItemAt(e.line).start+e.character}t.convertOffsetToPosition=r,t.convertOffsetsToRange=function(e,t,n){return{start:r(e,n),end:r(t,n)}},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}},2150:(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())}}},6886:(e,t)=>{"use strict";var n;function i(e){return`${e>>8&255}.${255&e}`}function s(e,t){if(isNaN(e)||isNaN(t))return;if(e>255||t>255)return;const i=256*e+t;return void 0!==n[i]&&r(i)?i:void 0}function r(e){return e>>8==3}Object.defineProperty(t,"__esModule",{value:!0}),t.getPythonVersionStrings=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"}(n=t.PythonVersion||(t.PythonVersion={})),t.latestStablePythonVersion=n.V3_9,t.latestPythonVersion=n.V3_9,t.versionToString=i,t.versionFromString=function(e){const t=e.split(".");if(!(t.length<2))return s(parseInt(t[0],10),parseInt(t[1],10))},t.versionFromMajorMinor=s,t.is3x=r,t.getPythonVersionStrings=function(e){const t=[];let n=255&e;for(;;){const e=n>0?i(768+n):0===n?"3":"2and3";if(t.push(e),-1===n)break;n--}return t}},7559: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(7588)),r=n(2489);function o(e,t){return e===t?0:void 0===e?-1:void 0===t?1:r.compareComparableValues(e.toUpperCase(),t.toUpperCase())}function a(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,o=Number.MAX_VALUE;for(;r>0;){const e=s.default(n.substr(0,r),i);e<o&&(o=e),r--}return o>=e.length?0:(e.length-o)/e.length*.5},t.isPatternInSymbol=function(e,t){const n=e.toLocaleLowerCase(),i=t.toLocaleLowerCase(),s=n.length,r=i.length;let o=0,a=0;for(;o<s&&a<r;)n[o]===i[a]&&(o+=1),a+=1;return o===s},t.hashString=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t},t.compareStringsCaseInsensitive=o,t.compareStringsCaseSensitive=a,t.getStringComparer=function(e){return e?o:a},t.equateStringsCaseInsensitive=function(e,t){return 0===o(e,t)},t.equateStringsCaseSensitive=function(e,t){return 0===a(e,t)},t.getCharacterCount=function(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&n++;return n}},743:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertWorkspaceEdits=t.convertTextEdits=void 0;const i=n(6657);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}}},t.convertWorkspaceEdits=function(e){const t={changes:{}};return e.forEach((e=>{const n=i.convertPathToUri(e.filePath);t.changes[n]=t.changes[n]||[],t.changes[n].push({range:e.range,newText:e.replacementText})})),t}},3550:(e,t)=>{"use strict";var n,i;function s(e,t){return e.line<t.line?-1:e.line>t.line?1:e.character<t.character?-1:e.character>t.character?1:0}function r(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}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<n(e)},e.overlaps=function(e,t){return t>=e.start&&t<=n(e)},e.extend=function e(t,i){i&&(Array.isArray(i)?i.forEach((n=>{e(t,n)})):(i.start<t.start&&(t.length+=t.start-i.start,t.start=i.start),n(i)>n(t)&&(t.length+=n(i)-n(t))))}}(t.TextRange||(t.TextRange={})),function(e){e.is=function(e){const t=e;return t&&void 0!==t.line&&void 0!==t.character}}(n||(n={})),function(e){e.is=function(e){const t=e;return t&&void 0!==t.start&&void 0!==t.end}}(i||(i={})),t.comparePositions=s,t.getEmptyPosition=function(){return{line:0,character:0}},t.doRangesOverlap=function(e,t){return!(s(t.start,e.end)>=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=r,t.isEmptyRange=function(e){return r(e.start)&&r(e.end)}},3420:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeCollection=void 0;const i=n(3550);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.end}getItemAt(e){if(e<0||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(e<this.start)return-1;if(e>this.end)return-1;let t=0,n=this.count-1;for(;t<n;){const i=Math.floor(t+(n-t)/2),s=this._items[i];if(e>=s.start&&(i>=this.count-1||e<this._items[i+1].start))return i;e<s.start?n=i-1:t=i+1}return t}getItemContaining(e){if(0===this.count)return-1;if(e<this.start)return-1;if(e>this.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<this.count-1&&i.TextRange.getEnd(r)<=e&&e<this._items[s+1].start)return-1;e<r.start?n=s-1:t=s+1}return-1}}},8718:(e,t)=>{"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){this.isTiming=!0;const t=new n;e();const i=t.getDurationInMilliseconds();return this.totalTime+=i,this.isTiming=!1,i}e()}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}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},8992: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},o=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageServerBase=void 0,n(6755);const a=r(n(5747)),l=n(4714),c=n(5674),p=n(2374),d=n(6708),u=n(3213),h=n(9489),m=n(1775),y=n(2930),g=n(2211),f=n(8304),_=n(7830),T=n(6657),v=n(2150),b=n(743),S=n(31),C=n(2816),I=n(3334),D=n(2122),x=n(214);t.LanguageServerBase=class{constructor(e){var t,n;this._serverOptions=e,this._connection=l.createConnection(this._GetConnectionOptions()),this._hasConfigurationCapability=!1,this._hasVisualStudioExtensionsCapability=!1,this._hasWorkspaceFoldersCapability=!1,this._hasWatchFileCapability=!1,this._hasActiveParameterCapability=!1,this._hasSignatureLabelOffsetCapability=!1,this._hasHierarchicalDocumentSymbolCapability=!1,this._hasWindowProgressCapability=!1,this._hoverContentFormat=l.MarkupKind.PlainText,this._completionDocFormat=l.MarkupKind.PlainText,this._signatureDocFormat=l.MarkupKind.PlainText,this._supportsUnnecessaryDiagnosticTag=!1,this._fileWatchers=[],this._lastTriggerKind=l.CompletionTriggerKind.Invoked,this.rootPath="",this.console=new g.ConsoleWithLogLevel(this._connection.console),this.console.info(`${e.productName} language server ${e.version&&e.version+" "}starting`),this.fs=_.createFromRealFileSystem(this.console,this);const i=this.fs.getModulePath();i&&this.fs.chdir(i),global.__rootDirectory=e.rootDirectory,this.console.info(`Server root directory: ${e.rootDirectory}`),this._workspaceMap=new x.WorkspaceMap(this),this.setupConnection(null!==(t=e.supportedCommands)&&void 0!==t?t:[],null!==(n=e.supportedCodeActions)&&void 0!==n?n:[]),this._progressReporter=new v.ProgressReportTracker(this.createProgressReporter()),this._connection.listen()}isLongRunningCommand(e){return!0}getConfiguration(e,t){return o(this,void 0,void 0,(function*(){if(this._hasConfigurationCapability){const n={scopeUri:e,section:t};return this._connection.workspace.getConfiguration(n)}if(this._defaultClientConfig)return h.getNestedProperty(this._defaultClientConfig,t)}))}isOpenFilesOnly(e){return"workspace"!==e}getSeverityOverrides(e){const t=e;if(m.getDiagnosticSeverityOverrides().includes(t))return t}getDiagnosticRuleName(e){const t=e;if(y.getDiagLevelDiagnosticRules().includes(t))return t}createImportResolver(e,t){return new p.ImportResolver(e,t)}createBackgroundAnalysisProgram(e,t,n,i,s,r){return new c.BackgroundAnalysisProgram(e,t,n,i,s,r)}setExtension(e){this._serverOptions.extension=e}get window(){return this._connection.window}createAnalyzerService(e){this.console.log(`Starting service instance "${e}"`);const t=new d.AnalyzerService(e,this.fs,this.console,this.createImportResolver.bind(this),void 0,this._serverOptions.extension,this.createBackgroundAnalysis(),this._serverOptions.maxAnalysisTimeInForeground,this.createBackgroundAnalysisProgram.bind(this));return t.setCompletionCallback((e=>this.onAnalysisCompletedHandler(e))),t}getWorkspaceForFile(e){return o(this,void 0,void 0,(function*(){const t=this._workspaceMap.getWorkspaceForFile(e);return yield t.isInitialized.promise,t}))}reanalyze(){this._workspaceMap.forEach((e=>{e.serviceInstance.invalidateAndForceReanalysis()}))}restart(){this._workspaceMap.forEach((e=>{e.serviceInstance.restart()}))}createFileWatcher(e,t){const n=this,i=[],s=[],r=this._workspaceMap.getNonDefaultWorkspaces();let o;e.forEach((e=>{r.some((t=>T.containsPath(t.rootPath,e)))?i.push(e):s.push(e)}));try{o=s.map((e=>a.watch(e,{recursive:!0},((e,n)=>t(e,n)))))}catch(e){this.console.error("Exception received when installing recursive file system watcher"),o=[]}const l={close(){n._fileWatchers=n._fileWatchers.filter((e=>e!==l)),o.forEach((e=>{e.close()}))},workspacePaths:i,eventHandler:t};return this._fileWatchers.push(l),l}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))),this._connection.onDefinition(((e,t)=>o(this,void 0,void 0,(function*(){this.recordUserInteractionTime();const n=T.convertUriToPath(e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=yield this.getWorkspaceForFile(n);if(s.disableLanguageServices)return;const r=s.serviceInstance.getDefinitionForPosition(n,i,t);return r?r.map((e=>l.Location.create(T.convertPathToUri(e.path),e.range))):void 0})))),this._connection.onReferences(((e,t,n,i)=>o(this,void 0,void 0,(function*(){this._pendingFindAllRefsCancellationSource&&(this._pendingFindAllRefsCancellationSource.cancel(),this._pendingFindAllRefsCancellationSource=void 0);const s=yield this._getProgressReporter(e.workDoneToken,n,D.Localizer.CodeAction.findingReferences()),r=u.CancelAfter(t,s.token);this._pendingFindAllRefsCancellationSource=r;try{const t=T.convertUriToPath(e.textDocument.uri),n={line:e.position.line,character:e.position.character},o=yield this.getWorkspaceForFile(t);if(o.disableLanguageServices)return;const a=e=>e.map((e=>l.Location.create(T.convertPathToUri(e.path),e.range))),c=[],p=i?e=>i.report(a(e)):e=>c.push(...a(e));return o.serviceInstance.reportReferencesForPosition(t,n,e.context.includeDeclaration,p,r.token),c}finally{s.reporter.done(),r.dispose()}})))),this._connection.onDocumentSymbol(((e,t)=>o(this,void 0,void 0,(function*(){this.recordUserInteractionTime();const n=T.convertUriToPath(e.textDocument.uri),i=yield this.getWorkspaceForFile(n);if(i.disableLanguageServices)return;const s=[];return i.serviceInstance.addSymbolsForDocument(n,s,t),this._hasHierarchicalDocumentSymbolCapability?s:C.convertToFlatSymbols(e.textDocument.uri,s)})))),this._connection.onWorkspaceSymbol(((e,t,n,i)=>o(this,void 0,void 0,(function*(){const n=[],s=i?e=>i.report(e):e=>n.push(...e);for(const n of this._workspaceMap.values())yield n.isInitialized.promise,n.disableLanguageServices||n.serviceInstance.reportSymbolsForWorkspace(e.query,s,t);return n})))),this._connection.onHover(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=(yield this.getWorkspaceForFile(n)).serviceInstance.getHoverForPosition(n,i,this._hoverContentFormat,t);return I.convertHoverResults(this._hoverContentFormat,s)})))),this._connection.onDocumentHighlight(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.textDocument.uri),i={line:e.position.line,character:e.position.character};return(yield this.getWorkspaceForFile(n)).serviceInstance.getDocumentHighlight(n,i,t)})))),this._connection.onSignatureHelp(((e,t)=>o(this,void 0,void 0,(function*(){var n,i,s,r;const o=T.convertUriToPath(e.textDocument.uri),a={line:e.position.line,character:e.position.character},c=yield this.getWorkspaceForFile(o);if(c.disableLanguageServices)return;const p=c.serviceInstance.getSignatureHelpForPosition(o,a,this._signatureDocFormat,t);if(!p)return;const d=p.signatures.map((e=>{let t=[];e.parameters&&(t=e.parameters.map((e=>l.ParameterInformation.create(this._hasSignatureLabelOffsetCapability?[e.startOffset,e.endOffset]:e.text,e.documentation))));const n=l.SignatureInformation.create(e.label,void 0,...t);return n.documentation=e.documentation,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!==l.SignatureHelpTriggerKind.Invoked){const t=null!==(s=null===(i=e.context.activeSignatureHelp)||void 0===i?void 0:i.activeSignature)&&void 0!==s?s:null;if(null!==t&&t<d.length){const e=d[t];u(e)&&(h=t,m=null!==(r=e.activeParameter)&&void 0!==r?r:null)}}return(this._hasActiveParameterCapability||null===h)&&(m=-1),{signatures:d,activeSignature:h,activeParameter:m}})))),this._connection.onCompletion(((e,t)=>this.onCompletion(e,t))),this._connection.onCompletionResolve(((e,t)=>o(this,void 0,void 0,(function*(){const n=e.data;return n&&n.filePath&&(yield this.getWorkspaceForFile(n.workspacePath)).serviceInstance.resolveCompletionItem(n.filePath,e,this._completionDocFormat,t),e})))),this._connection.onRenameRequest(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=yield this.getWorkspaceForFile(n);if(s.disableLanguageServices)return;const r=s.serviceInstance.renameSymbolAtPosition(n,i,e.newName,t);return r?b.convertWorkspaceEdits(r):void 0})))),this._connection.languages.callHierarchy.onPrepare(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.textDocument.uri),i={line:e.position.line,character:e.position.character},s=yield this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;const r=s.serviceInstance.getCallForPosition(n,i,t)||null;return r?(r.uri=T.convertPathToUri(r.uri),[r]):null})))),this._connection.languages.callHierarchy.onIncomingCalls(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.item.uri),i={line:e.item.range.start.line,character:e.item.range.start.character},s=yield this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;const r=s.serviceInstance.getIncomingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r.forEach((e=>{e.from.uri=T.convertPathToUri(e.from.uri)})),r):null})))),this._connection.languages.callHierarchy.onOutgoingCalls(((e,t)=>o(this,void 0,void 0,(function*(){const n=T.convertUriToPath(e.item.uri),i={line:e.item.range.start.line,character:e.item.range.start.character},s=yield this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;const r=s.serviceInstance.getOutgoingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r.forEach((e=>{e.to.uri=T.convertPathToUri(e.to.uri)})),r):null})))),this._connection.onDidOpenTextDocument((e=>o(this,void 0,void 0,(function*(){const t=T.convertUriToPath(e.textDocument.uri),n=yield this.getWorkspaceForFile(t);this._isSupportedSourceFileType(t)&&n.serviceInstance.setFileOpened(t,e.textDocument.version,e.textDocument.text)})))),this._connection.onDidChangeTextDocument((e=>o(this,void 0,void 0,(function*(){this.recordUserInteractionTime();const t=T.convertUriToPath(e.textDocument.uri),n=yield this.getWorkspaceForFile(t);this._isSupportedSourceFileType(t)&&n.serviceInstance.updateOpenFileContents(t,e.textDocument.version,e.contentChanges)})))),this._connection.onDidCloseTextDocument((e=>o(this,void 0,void 0,(function*(){const t=T.convertUriToPath(e.textDocument.uri),n=yield this.getWorkspaceForFile(t);this._isSupportedSourceFileType(t)&&n.serviceInstance.setFileClosed(t)})))),this._connection.onDidChangeWatchedFiles((e=>{e.changes.forEach((e=>{const t=T.convertUriToPath(e.uri),n=1===e.type?"add":"change";this._fileWatchers.forEach((e=>{e.workspacePaths.some((e=>T.containsPath(e,t)))&&e.eventHandler(n,t)}))}))})),this._connection.onInitialized((()=>{this._hasWorkspaceFoldersCapability&&this._connection.workspace.onDidChangeWorkspaceFolders((e=>{e.removed.forEach((e=>{const t=T.convertUriToPath(e.uri);this._workspaceMap.delete(t)})),e.added.forEach((e=>o(this,void 0,void 0,(function*(){const t=T.convertUriToPath(e.uri),n=this.createWorkspaceServiceInstance(e,t);this._workspaceMap.set(t,n),yield this.updateSettingsForWorkspace(n)}))))})),this._hasWatchFileCapability&&this._connection.client.register(l.DidChangeWatchedFilesNotification.type,{watchers:[...d.configFileNames.map((e=>({globPattern:`**/${e}`,kind:l.WatchKind.Create|l.WatchKind.Change|l.WatchKind.Delete}))),{globPattern:"**/*.{py,pyi}",kind:l.WatchKind.Create|l.WatchKind.Change|l.WatchKind.Delete}]})})),this._connection.onExecuteCommand(((e,t,n)=>o(this,void 0,void 0,(function*(){this._pendingCommandCancellationSource&&(this._pendingCommandCancellationSource.cancel(),this._pendingCommandCancellationSource=void 0);const i=t=>o(this,void 0,void 0,(function*(){const n=yield this.executeCommand(e,t);l.WorkspaceEdit.is(n)&&this._connection.workspace.applyEdit(n)}));if(this.isLongRunningCommand(e.command)){const s=yield this._getProgressReporter(e.workDoneToken,n,D.Localizer.CodeAction.executingCommand()),r=u.CancelAfter(t,s.token);this._pendingCommandCancellationSource=r;try{yield i(r.token)}finally{s.reporter.done(),r.dispose()}}else i(t)}))))}getWorkspaceCompletionsForPosition(e,t,n,i,s){return e.serviceInstance.getCompletionsForPosition(t,n,i,this._completionDocFormat,void 0,s)}updateSettingsForAllWorkspaces(){this._workspaceMap.forEach((e=>{this.updateSettingsForWorkspace(e).ignoreErrors()}))}initialize(e,t,n){var i,s,r,o,a,c,p,d,u,h,m,y,g,f,_,v,b,S,C,I,D,x,F,k,P;this.rootPath=e.rootPath||"";const A=e.capabilities;this._hasConfigurationCapability=!!(null===(i=A.workspace)||void 0===i?void 0:i.configuration),this._hasWatchFileCapability=!!(null===(r=null===(s=A.workspace)||void 0===s?void 0:s.didChangeWatchedFiles)||void 0===r?void 0:r.dynamicRegistration),this._hasWorkspaceFoldersCapability=!!(null===(o=A.workspace)||void 0===o?void 0:o.workspaceFolders),this._hasVisualStudioExtensionsCapability=!!A.supportsVisualStudioExtensions,this._hasActiveParameterCapability=!!(null===(p=null===(c=null===(a=A.textDocument)||void 0===a?void 0:a.signatureHelp)||void 0===c?void 0:c.signatureInformation)||void 0===p?void 0:p.activeParameterSupport),this._hasSignatureLabelOffsetCapability=!!(null===(m=null===(h=null===(u=null===(d=A.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._hasHierarchicalDocumentSymbolCapability=!!(null===(g=null===(y=A.textDocument)||void 0===y?void 0:y.documentSymbol)||void 0===g?void 0:g.hierarchicalDocumentSymbolSupport),this._hoverContentFormat=this._getCompatibleMarkupKind(null===(_=null===(f=A.textDocument)||void 0===f?void 0:f.hover)||void 0===_?void 0:_.contentFormat),this._completionDocFormat=this._getCompatibleMarkupKind(null===(S=null===(b=null===(v=A.textDocument)||void 0===v?void 0:v.completion)||void 0===b?void 0:b.completionItem)||void 0===S?void 0:S.documentationFormat),this._signatureDocFormat=this._getCompatibleMarkupKind(null===(D=null===(I=null===(C=A.textDocument)||void 0===C?void 0:C.signatureHelp)||void 0===I?void 0:I.signatureInformation)||void 0===D?void 0:D.documentationFormat);const E=(null===(k=null===(F=null===(x=A.textDocument)||void 0===x?void 0:x.publishDiagnostics)||void 0===F?void 0:F.tagSupport)||void 0===k?void 0:k.valueSet)||[];return this._supportsUnnecessaryDiagnosticTag=E.some((e=>e===l.DiagnosticTag.Unnecessary)),this._hasWindowProgressCapability=!!(null===(P=A.window)||void 0===P?void 0:P.workDoneProgress),e.workspaceFolders?e.workspaceFolders.forEach((e=>{const t=T.convertUriToPath(e.uri);this._workspaceMap.set(t,this.createWorkspaceServiceInstance(e,t))})):e.rootPath&&this._workspaceMap.set(e.rootPath,this.createWorkspaceServiceInstance(void 0,e.rootPath)),{capabilities:{textDocumentSync:l.TextDocumentSyncKind.Incremental,definitionProvider:{workDoneProgress:!0},referencesProvider:{workDoneProgress:!0},documentSymbolProvider:{workDoneProgress:!0},workspaceSymbolProvider:{workDoneProgress:!0},hoverProvider:{workDoneProgress:!0},documentHighlightProvider:{workDoneProgress:!0},renameProvider:{workDoneProgress:!0},completionProvider:{triggerCharacters:[".","["],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:f.createDeferred()}}onAnalysisCompletedHandler(e){if(e.diagnostics.forEach((e=>{this._connection.sendDiagnostics({uri:T.convertPathToUri(e.filePath),diagnostics:this._convertDiagnostics(e.diagnostics)})})),this._progressReporter.isEnabled(e))if(e.filesRequiringAnalysis>0){this._progressReporter.begin();const t=1===e.filesRequiringAnalysis?D.Localizer.CodeAction.filesToAnalyzeOne():D.Localizer.CodeAction.filesToAnalyzeCount().format({count:e.filesRequiringAnalysis});this._progressReporter.report(t)}else this._progressReporter.end();else this._progressReporter.end()}updateSettingsForWorkspace(e,t){var n;return o(this,void 0,void 0,(function*(){t=null!=t?t:yield this.getSettings(e),this.console.level=null!==(n=t.logLevel)&&void 0!==n?n:g.LogLevel.Info,this.updateOptionsAndRestartService(e,t),e.disableLanguageServices=!!t.disableLanguageServices,e.disableOrganizeImports=!!t.disableOrganizeImports,e.isInitialized.resolve(!0)}))}updateOptionsAndRestartService(e,t,n){S.AnalyzerServiceExecutor.runWithOptions(this.rootPath,e,t,n)}onCompletion(e,t){var n,i;return o(this,void 0,void 0,(function*(){const s=this._lastTriggerKind!==l.CompletionTriggerKind.TriggerForIncompleteCompletions||(null===(n=e.context)||void 0===n?void 0:n.triggerKind)!==l.CompletionTriggerKind.TriggerForIncompleteCompletions;this._lastTriggerKind=null===(i=e.context)||void 0===i?void 0:i.triggerKind;const r=T.convertUriToPath(e.textDocument.uri),o={line:e.position.line,character:e.position.character},a=yield this.getWorkspaceForFile(r);if(a.disableLanguageServices)return;const c=yield this.getWorkspaceCompletionsForPosition(a,r,o,a.rootPath,t);return c&&c.completionList&&(c.completionList.isIncomplete=s),null==c?void 0:c.completionList}))}convertLogLevel(e){if(!e)return g.LogLevel.Info;switch(e.toLowerCase()){case"error":return g.LogLevel.Error;case"warning":return g.LogLevel.Warn;case"information":return g.LogLevel.Info;case"trace":return g.LogLevel.Log;default:return g.LogLevel.Info}}_isSupportedSourceFileType(e){const t=T.getFileExtension(e).toLowerCase();return".py"===t||".pyi"===t}_getCompatibleMarkupKind(e){const t=[l.MarkupKind.PlainText,l.MarkupKind.Markdown];for(const n of null!=e?e:[])if(t.includes(n))return n;return l.MarkupKind.PlainText}_getProgressReporter(e,t,n){return o(this,void 0,void 0,(function*(){if(e)return{reporter:t,token:l.CancellationToken.None};const i=yield this._connection.window.createWorkDoneProgress();return i.begin(n,void 0,void 0,!0),{reporter:i,token:i.token}}))}_GetConnectionOptions(){return{cancellationStrategy:u.getCancellationStrategyFromArgv(process.argv)}}_convertDiagnostics(e){const t=[];return e.forEach((e=>{const n=function(e){switch(e){case 0:return l.DiagnosticSeverity.Error;case 1:return l.DiagnosticSeverity.Warning;case 2:return l.DiagnosticSeverity.Information;case 3:return l.DiagnosticSeverity.Hint}}(e.category),i=e.getRule(),s=l.Diagnostic.create(e.range,e.message,n,i,this._serverOptions.productName);if(3===e.category&&(s.tags=[l.DiagnosticTag.Unnecessary],s.severity=l.DiagnosticSeverity.Hint,!this._supportsUnnecessaryDiagnosticTag))return;if(i){const e=this.getDocumentationUrlForDiagnosticRule(i);e&&(s.codeDescription={href:e})}const r=e.getRelatedInfo();r.length>0&&(s.relatedInformation=r.map((e=>l.DiagnosticRelatedInformation.create(l.Location.create(T.convertPathToUri(e.filePath),e.range),e.message)))),t.push(s)})),t}recordUserInteractionTime(){this._workspaceMap.forEach((e=>{e.serviceInstance.recordUserInteractionTime()}))}getDocumentationUrlForDiagnosticRule(e){return"https://github.com/microsoft/pyright/blob/master/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}))}}},31:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerServiceExecutor=void 0;const i=n(1887),s=n(1775),r=n(6657);t.AnalyzerServiceExecutor=class{static runWithOptions(e,t,n,o,a=!0){const l=function(e,t,n,o,a){const l=new s.CommandLineOptions(t,!0);return l.checkOnlyOpenFiles=n.openFilesOnly,l.useLibraryCodeForTypes=n.useLibraryCodeForTypes,l.typeCheckingMode=n.typeCheckingMode,l.autoImportCompletions=n.autoImportCompletions,l.indexing=n.indexing,o?(l.watchForSourceChanges=n.watchForSourceChanges,l.watchForLibraryChanges=n.watchForLibraryChanges):(l.watchForSourceChanges=!1,l.watchForLibraryChanges=!1),n.venvPath&&(l.venvPath=r.combinePaths(t||e,n.venvPath)),n.pythonPath&&(i.isPythonBinary(n.pythonPath)||(l.pythonPath=r.combinePaths(t||e,n.pythonPath))),n.typeshedPath&&(l.typeshedPath=n.typeshedPath),n.stubPath&&(l.stubPath=n.stubPath),a&&(l.typeStubTargetImportName=a),l.autoSearchPaths=n.autoSearchPaths,l.extraPaths=n.extraPaths,l.diagnosticSeverityOverrides=n.diagnosticSeverityOverrides,l}(e,t.rootPath,n,a,o);t.serviceInstance.setOptions(l,a)}}},8566: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.AutoImporter=t.getAutoImportCandidatesForAbbr=t.buildModuleSymbolsMap=void 0;const o=n(4494),a=n(7012),l=r(n(1766)),c=n(3213),p=n(6657),d=r(n(7559));function u(e){return{forEach(t){e.symbols.forEach((e=>{e.externallyVisible&&t({importAlias:e.alias,kind:h(e.kind)},e.name)}))}}}function h(e){switch(e){case o.SymbolKind.File:return o.CompletionItemKind.File;case o.SymbolKind.Module:case o.SymbolKind.Namespace:return o.CompletionItemKind.Module;case o.SymbolKind.Package:return o.CompletionItemKind.Folder;case o.SymbolKind.Class:return o.CompletionItemKind.Class;case o.SymbolKind.Method:return o.CompletionItemKind.Method;case o.SymbolKind.Property:return o.CompletionItemKind.Property;case o.SymbolKind.Field:return o.CompletionItemKind.Field;case o.SymbolKind.Constructor:return o.CompletionItemKind.Constructor;case o.SymbolKind.Enum:return o.CompletionItemKind.Enum;case o.SymbolKind.Interface:return o.CompletionItemKind.Interface;case o.SymbolKind.Function:return o.CompletionItemKind.Function;case o.SymbolKind.Variable:case o.SymbolKind.Array:return o.CompletionItemKind.Variable;case o.SymbolKind.String:return o.CompletionItemKind.Text;case o.SymbolKind.Number:case o.SymbolKind.Boolean:return o.CompletionItemKind.Value;case o.SymbolKind.Constant:case o.SymbolKind.Null:return o.CompletionItemKind.Constant;case o.SymbolKind.Object:case o.SymbolKind.Key:return o.CompletionItemKind.Value;case o.SymbolKind.EnumMember:return o.CompletionItemKind.EnumMember;case o.SymbolKind.Struct:return o.CompletionItemKind.Struct;case o.SymbolKind.Event:return o.CompletionItemKind.Event;case o.SymbolKind.Operator:return o.CompletionItemKind.Operator;case o.SymbolKind.TypeParameter:return o.CompletionItemKind.TypeParameter;default:return}}t.buildModuleSymbolsMap=function(e,t){const n=new Map;return e.forEach((e=>{if(c.throwIfCancellationRequested(t),e.shadows.length>0)return;const i=e.sourceFile.getFilePath(),s=e.sourceFile.getModuleSymbolTable();if(s){const e=p.stripFileExtension(p.getFileName(i));if(l.isPrivateOrProtectedName(e))return;return void n.set(i,{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:o.CompletionItemKind.Variable;e({symbol:t,kind:r},n)}))}})}const r=e.sourceFile.getCachedIndexResults();!r||r.privateOrProtected||n.set(i,u(r))})),n},t.getAutoImportCandidatesForAbbr=function(e,t,n,i){return e.getAutoImportCandidates(n.importName,1,t,i).filter((e=>e.source===n.importFrom&&e.name===n.importName))},t.AutoImporter=class{constructor(e,t,n,i,s,r,o,l){this._execEnvironment=e,this._importResolver=t,this._parseResults=n,this._invocationPosition=i,this._excludes=s,this._moduleSymbolMap=r,this._libraryMap=o,this._patternMatcher=null!=l?l:d.isPatternInSymbol,this._importStatements=a.getTopLevelImports(this._parseResults.parseTree,!0)}getAutoImportCandidates(e,t,n,i){const s=[],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 o;null===(o=this._libraryMap)||void 0===o||o.forEach(((o,a)=>{if(o.privateOrProtected)return;if(this._moduleSymbolMap.has(a))return;const l=this._isStubFileOrHasInit(this._libraryMap,a);this._processModuleSymbolTable(u(o),a,e,t,l,n,i,s,r)}))}_addImportsFromModuleMap(e,t,n,i,s,r){this._moduleSymbolMap.forEach(((o,a)=>{const l=this._isStubFileOrHasInit(this._moduleSymbolMap,a);this._processModuleSymbolTable(o,a,e,t,l,n,i,s,r)}))}_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,a,p,u){c.throwIfCancellationRequested(u);const[m,y,g]=this._getImportPartsForSymbols(t);if(!m)return;const f=d.getCharacterCount(m,".");if(e.forEach(((e,d)=>{if(c.throwIfCancellationRequested(u),!s.isStub&&e.kind===o.CompletionItemKind.Variable&&!l.isPublicConstantOrTypeAlias(d))return;if(!this._isSimilar(n,d,i))return;if(this._containsName(d,void 0,p))return;if(e.importAlias)return void this._addToImportAliasMap(e.importAlias,{importParts:{symbolName:d,importName:d,importFrom:m,filePath:t,dotCount:f,moduleNameAndType:g},importGroup:y,symbol:e.symbol,kind:h(e.importAlias.kind)},a);const _=this._getTextEditsForAutoImportByFilePath(m,d,r,d,y,t);p.push({name:d,alias:r,symbol:e.symbol,source:m,kind:e.kind,insertionText:_.insertionText,edits:_.edits})})),!s.isStub&&!s.hasInit)return;const _=this._getImportParts(t);_&&this._isSimilar(n,_.importName,i)&&(this._containsName(_.importName,_.importFrom,p)||this._addToImportAliasMap({modulePath:t,originalName:_.importName,kind:o.SymbolKind.Module},{importParts:_,importGroup:y},a))}_addImportsFromImportAliasMap(e,t,n,i){c.throwIfCancellationRequested(i),e.forEach((e=>{e.forEach((e=>{var s;if(c.throwIfCancellationRequested(i),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}}const r=this._getTextEditsForAutoImportByFilePath(null!==(s=e.importParts.importFrom)&&void 0!==s?s:e.importParts.importName,e.importParts.symbolName,t,e.importParts.importName,e.importGroup,e.importParts.filePath);n.push({name:e.importParts.importName,alias:t,symbol:e.symbol,kind:e.kind,source:e.importParts.importFrom,insertionText:r.insertionText,edits:r.edits})}))}))}_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,a.getImportGroup(t),{importType:2,isLocalTypingsFile:!1,moduleName:t.moduleName}];{const t=this._getModuleNameAndTypeFromFilePath(e);return[t.moduleName,this._getImportGroupFromModuleNameAndType(t),t]}}_getImportParts(e){return function(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}}("__init__"===p.stripFileExtension(p.getFileName(e))?this._getModuleNameAndTypeFromFilePath(p.getDirectoryPath(e)):this._getModuleNameAndTypeFromFilePath(e))}_isSimilar(e,t,n){return 1===n?e===t:e.length>0&&this._patternMatcher(e,t)}_containsName(e,t,n){return!!this._excludes.find((t=>t===e))||!!n.find((n=>n.name===e&&n.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 o,l,c,p,d,u;const h=this._importStatements.mapByFilePath.get(r);if(h){if(20===h.node.nodeType){const e=null===(l=null===(o=h.subnode)||void 0===o?void 0:o.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:a.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:a.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 o=null===(d=this._importStatements.implicitImports)||void 0===d?void 0:d.get(r);if(o){const e=null===(u=o.alias)||void 0===u?void 0:u.value;return{insertionText:`${null!=e?e:o.name.value}.${t}`,edits:[]}}}return{insertionText:null!=n?n:i,edits:a.getTextEditsForAutoImportInsertion(t,this._importStatements,e,s,this._parseResults,this._invocationPosition,n)}}}},7087: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 o=n(4494),a=r(n(5523)),l=r(n(8494)),c=n(427),p=n(1133),d=n(5168),u=n(3213),h=n(6657),m=n(1464),y=n(3550);t.CallHierarchyProvider=class{static getCallForDeclaration(e,t,n,i){if(u.throwIfCancellationRequested(i),3===t.type||4===t.type)return{name:e,kind:_(t,n),uri:t.path,range:t.range,selectionRange:t.range}}static getIncomingCallsForDeclaration(e,t,n,i,s,r){u.throwIfCancellationRequested(r);const o=new f(e,t,n,i,s,r).findCalls();return o.length>0?o: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.isClass(t)){const e=d.lookUpClassMember(t,"__init__",14);if(e){const t=n.getTypeOfMember(e);if(t&&5===t.category){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((a.hasTypeForDeclaration(i)||!a.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.isObject(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.isObject(s)&&p.ClassType.isPropertyClass(s.classType)&&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:_(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);e&&e.map((e=>this._evaluator.resolveAliasDeclaration(e,!0))).filter((e=>void 0!==e)).some((e=>a.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.isObject(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=>a.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:o.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:o.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:o.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 _(e,t){let n;switch(e.type){case 4:case 5:n=o.SymbolKind.Class;break;case 3:if(e.isMethod){const i=t.getTypeForDeclaration(e);n=i&&d.isProperty(i)?o.SymbolKind.Property:o.SymbolKind.Method}else n=o.SymbolKind.Function;break;default:n=o.SymbolKind.Function}return n}},8590:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionProvider=void 0;const s=n(4494),r=n(3213),o=n(2122);t.CodeActionProvider=class{static getCodeActionsForPosition(e,t,n,a){return i(this,void 0,void 0,(function*(){r.throwIfCancellationRequested(a);const i=[];if(!e.disableLanguageServices){const r=yield e.serviceInstance.getDiagnosticsForRange(t,n,a),l=r.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 r=s.CodeAction.create(o.Localizer.CodeAction.createTypeStubFor().format({moduleName:n.moduleName}),s.Command.create(o.Localizer.CodeAction.createTypeStub(),"pyright.createtypestub",e.rootPath,n.moduleName,t),s.CodeActionKind.QuickFix);i.push(r)}}const c=r.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=s.CodeAction.create(o.Localizer.CodeAction.addOptionalToAnnotation(),s.Command.create(o.Localizer.CodeAction.addOptionalToAnnotation(),"pyright.addoptionalforparam",e.offsetOfTypeNode),s.CodeActionKind.QuickFix);i.push(t)}}}return i}))}}},9209: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=void 0;const o=n(4494),a=r(n(563)),l=n(1272),c=r(n(8494)),p=r(n(1766)),d=n(2917),u=n(3371),h=n(1133),m=n(5168),y=n(3213),g=r(n(5839)),f=n(5839),_=n(1464),T=r(n(7559)),v=n(3550),b=n(3550),S=n(5275),C=n(8566),I=["True","False","None","and","or","await","not","is","lambda","yield","assert","async","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","nonlocal","pass","raise","return","try","while","yield"];var D;!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"}(D||(D={}));class x{constructor(e,t,n,i,s,r,o,a,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=o,this._importLookup=a,this._evaluator=l,this._format=c,this._sourceMapper=p,this._autoImportMaps=d,this._cancellationToken=u}getCompletionsForPosition(){const e=_.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines);if(void 0===e)return;let t=c.findNodeByOffset(this._parseResults.parseTree,e);const n=t,i=t?c.getNodeDepth(t):0;if(!n||38!==n.nodeType){let s=e;for(;s>=0;){s--;const e=this._fileContents.substr(s,1);if("("===e||"\n"===e)break;const r=c.findNodeByOffset(this._parseResults.parseTree,s);if(r&&r!==n){c.getNodeDepth(r)>i&&(t=r);break}}}if(void 0===t)return;const s=this._parseResults.tokenizerOutput.lines.getItemAt(this._position.line),r=this._fileContents.substr(s.start,s.length),o=r.substr(0,this._position.character),a=r.substr(this._position.character),l=o.search(/\w+$/),p=l>=0?o.substr(l):"";if(this._isWithinComment(e))return;let d=t;for(;d&&0!==d.nodeType;)d=d.parent;let u=d||t;for(;;){if(y.throwIfCancellationRequested(this._cancellationToken),49===u.nodeType)return this._getStringLiteralCompletions(u,p,o,a);if(48===u.nodeType)return;if(37===u.nodeType)return this._getImportModuleCompletions(u);if(0===u.nodeType)return this._getExpressionErrorCompletions(u,p,o,a);if(35===u.nodeType)return this._getMemberAccessCompletions(u.leftExpression,p);if(38===u.nodeType){const t=this._tryGetNameCompletions(u,e,p);if(t||void 0===t)return t}if(22===u.nodeType)return this._getImportFromCompletions(u,p);if(S.isExpressionNode(u))return this._getExpressionCompletions(u,p,o,a);if(50===u.nodeType){if(u.parent&&25===u.parent.nodeType&&!u.parent.name&&u.parent.typeExpression&&b.TextRange.getEnd(u.parent.typeExpression)<e&&e<=u.parent.exceptSuite.start)return;if(u.parent&&10===u.parent.nodeType&&(!u.parent.name||!u.parent.name.value)&&0===u.parent.arguments.length&&e<=u.parent.suite.start)return;return this._getStatementCompletions(u,p,o,a)}if(36===u.nodeType)return this._getStatementCompletions(u,p,o,a);if(41===u.nodeType&&0===u.length&&u.parent&&30===u.parent.nodeType)return;if(!u.parent)break;u=u.parent}}resolveCompletionItem(e){y.throwIfCancellationRequested(this._cancellationToken);const t=e.data,n=e.label;let i="";t.autoImportText&&(i=t.autoImportText);const s=x._mostRecentCompletions.findIndex((e=>e.label===n&&e.autoImportText===i));s>0&&(x._mostRecentCompletions=x._mostRecentCompletions.splice(s,1)),0!==s&&x._mostRecentCompletions.unshift({label:n,autoImportText:i}),x._mostRecentCompletions.length>128&&x._mostRecentCompletions.pop(),t.symbolLabel&&(this._itemToResolve=e,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&&b.TextRange.getEnd(e.parent.parent)<t)return;return this._getImportModuleCompletions(e.parent)}if(23===e.parent.nodeType){if(e.parent.alias===e)return;const i=e.parent.parent;if(i&&22===i.nodeType){if(!e.parent.alias&&b.TextRange.getEnd(e.parent)<t)return;return e.parent.name===e?this._getImportFromCompletions(i,n):this._getImportFromCompletions(i,"")}return!1}if(35===e.parent.nodeType&&e===e.parent.memberName)return this._getMemberAccessCompletions(e.parent.leftExpression,n);if(25!==e.parent.nodeType||e!==e.parent.name){if(28===e.parent.nodeType&&e===e.parent.name)return(null===(i=e.parent.decorators)||void 0===i?void 0:i.some((e=>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&&b.TextRange.contains(e.parent.targetExpression,e.start)||33===e.parent.nodeType&&b.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<i.start+i.length)){for(let e=n-1;e>=0;e--){const n=t.getItemAt(e);if(i.start!==n.start)break;i=n}return e<=i.start?i:(g.assert(n+1<t.length),t.getItemAt(n+1))}}(e,this._parseResults.tokenizerOutput.tokens);return!!i&&null!==(n=null===(t=i.comments)||void 0===t?void 0:t.some((t=>b.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 3:case 4:return this._getExpressionCompletions(e,t,n,i);case 7:if(e.child&&S.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=o.CompletionItem.create(e);return t.kind=o.CompletionItemKind.Keyword,t.sortText=this._makeSortText(D.LikelyKeyword,e),{completionList:o.CompletionList.create([t])}}_getMethodOverloadsCompletions(e,t){var n;const i=function(e,t){const n=c.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)h.isClass(e)&&m.getMembersForClass(e,i,!1);return i}const i=c.getEnclosingModule(t);if(i){const e=a.getScope(i);return null==e?void 0:e.symbolTable}}(this._evaluator,t);if(!i)return;const s=28===(null===(n=t.parent)||void 0===n?void 0:n.nodeType)||void 0,r=o.CompletionList.create(),l=c.getEnclosingFunction(t);return i.forEach(((n,i)=>{const o=d.getLastTypedDeclaredForSymbol(n);if(!o||3!==o.type)return;if(!o.node.decorators.some((e=>this._isOverload(e))))return;const a=n.getDeclarations();if((1!==a.length||!a.some((e=>e.node===l)))&&T.isPatternInSymbol(t.value,i)){const a=this._createReplaceEdits(e,t,o.node.name.value);this._addSymbol(i,n,t.value,r,{funcParensDisabled:s,edits:{textEdit:a}})}})),{completionList:r}}_getMethodOverrideCompletions(e,t,n){var i,s;const r=c.getEnclosingClass(t,!0);if(!r)return;const a=this._evaluator.getTypeOfClass(r);if(!a)return;const l=new Map;for(let e=1;e<a.classType.details.mro.length;e++){const t=a.classType.details.mro[e];h.isClass(t)&&m.getMembersForClass(t,l,!1)}const p=null!==(i=null==n?void 0:n.some((e=>this._checkDecorator(e,"staticmethod"))))&&void 0!==i&&i,u=null!==(s=null==n?void 0:n.some((e=>this._checkDecorator(e,"classmethod"))))&&void 0!==s&&s,y=o.CompletionList.create();return l.forEach(((n,i)=>{const s=d.getLastTypedDeclaredForSymbol(n);if(s&&3===s.type&&T.isPatternInSymbol(t.value,i)){const r=this._evaluator.getTypeForDeclaration(s);if(!r||5!==r.category)return;if(p!==h.FunctionType.isStaticMethod(r)||u!==h.FunctionType.isClassMethod(r))return;const o=this._printMethodSignature(s.node)+":",a=this._printOverriddenMethodBody(r,s),l=this._createReplaceEdits(e,t,`${o}\n${a}`);this._addSymbol(i,n,t.value,y,{funcParensDisabled:!0,edits:{textEdit:l}})}})),{completionList:y}}_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 o.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+=": "+c.printExpression(s)),i||t.name||0!==t.category?i:"/"})).join(", ");let n=e.name.value+"("+t+")";return e.returnTypeAnnotation?n+=" -> "+c.printExpression(e.returnTypeAnnotation):e.functionAnnotationComment&&(n+=" -> "+c.printExpression(e.functionAnnotationComment.returnTypeAnnotation)),n}_printOverriddenMethodBody(e,t){let n="    ";if(0===t.node.parameters.length)return n+="pass",n;const i=function(e,t){return h.FunctionType.isStaticMethod(e)?t.node.parameters.filter((e=>e.name)):t.node.parameters.slice(1).filter((e=>e.name))}(e,t);return"__init__"!==t.node.name.value&&(n+="return "),n+`super().${t.node.name.value}(${i.map((function(e){var t;const n=null===(t=e.name)||void 0===t?void 0:t.value;return 1===e.category?`*${n}`:2===e.category?`**${n}`:e.defaultValue?`${n}=${n}`:n})).join(", ")})`}_getMemberAccessCompletions(e,t){const n=new Map,i=o.CompletionList.create();let s={},r=this._evaluator.getType(e);return r&&(r=this._evaluator.makeTopLevelTypeVarsConcrete(r),m.doForEachSubtype(r,(s=>{if(s=m.transformTypeObjectToClass(s),h.isObject(s))m.getMembersForClass(s.classType,n,!0);else if(h.isClass(s))m.getMembersForClass(s,n,!1);else if(h.isModule(s))m.getMembersForModule(s,n);else if(5===s.category||6===s.category){const t=this._evaluator.getBuiltInType(e,"function");t&&h.isClass(t)&&m.getMembersForClass(t,n,!0)}else if(h.isNone(s)){const t=this._evaluator.getBuiltInType(e,"object");t&&h.isClass(t)&&m.getMembersForClass(t,n,h.TypeBase.isInstance(s))}const r=h.isObject(s)?s:void 0;this._addSymbolsForSymbolTable(n,(e=>!0),t,!1,r,i)}))),(!r||h.isUnknown(r)||h.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||h.isUnknown(s)||h.isUnbound(s))););const o={};if(s&&!h.isUnknown(s)&&!h.isUnbound(s)&&i){const e=m.getDeclaringModulesForType(s);o.lastKnownModule=e.find((e=>"typing"!==e)),35===i.nodeType?o.lastKnownMemberName=i.memberName.value:38===i.nodeType&&h.isClass(s)?o.lastKnownMemberName=s.details.name:38===i.nodeType&&h.isObject(s)&&(o.lastKnownMemberName=s.classType.details.name),o.unknownMemberName=r}return o}_getStatementCompletions(e,t,n,i){return this._getExpressionCompletions(e,t,n,i)}_getExpressionCompletions(e,t,n,i){var s,r;if(40===e.nodeType)return;if(59===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)&&e.parent===(null===(r=e.parent.target)||void 0===r?void 0:r.parent))return;const a=o.CompletionList.create();if(this._addCallArgumentCompletions(e,t,n,i,a),this._addSymbols(e,t,a),this._findMatchingKeywords(I,t).map((e=>{const t=o.CompletionItem.create(e);t.kind=o.CompletionItemKind.Keyword,a.items.push(t),t.sortText=this._makeSortText(D.Keyword,e)})),!this._configOptions.autoImportCompletions||t.startsWith("_")||this._itemToResolve||this._getAutoImportCompletions(t,e,a),0===e.nodeType)if(3===e.category)this._getIndexStringLiteral(e,a);else if(2===e.category&&e.parent&&3===e.parent.nodeType){const t=this._evaluator.getDeclaredTypeForExpression(e.parent.leftExpression);t&&this._addLiteralValuesForTargetType(t,n,i,a)}return{completionList:a}}_addCallArgumentCompletions(e,t,n,i,s){const r=_.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines),o=this._evaluator.getCallSignatureInfo(e,r,this._parseResults.tokenizerOutput.tokens);if(o){const e=_.convertOffsetToPosition(o.callNode.leftExpression.start+o.callNode.leftExpression.length,this._parseResults.tokenizerOutput.lines);v.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 o=s.details.parameters[r].type;this._addLiteralValuesForTargetType(o,t,n,i)}))}_addLiteralValuesForTargetType(e,t,n,i){const s=this._getQuoteValueFromPriorText(t);m.doForEachSubtype(e,(e=>{h.isObject(e)&&h.ClassType.isBuiltIn(e.classType,"str")&&void 0!==e.classType.literalValue&&this._addStringLiteralToCompletionList(e.classType.literalValue,s.stringValue,n,s.quoteCharacter,i)}))}_getStringLiteralCompletions(e,t,n,i){let s=e.parent;if(!s||48!==s.nodeType||s.strings.length>1)return;if(s=s.parent,!s)return;const r=o.CompletionList.create();if(24===s.nodeType){const e=this._evaluator.getType(s.baseExpression);if(!e||!h.isObject(e))return;const t=e.classType;if(!h.ClassType.isTypedDictClass(t))return;const o=this._evaluator.getTypedDictMembersForClass(t),a=this._getQuoteValueFromPriorText(n);o.forEach(((e,t)=>{this._addStringLiteralToCompletionList(t,a.stringValue,i,a.quoteCharacter,r)}))}else if(3===s.nodeType){const e=this._evaluator.getDeclaredTypeForExpression(s.leftExpression);e&&this._addLiteralValuesForTargetType(e,n,i,r)}else{g.assert(49===e.nodeType);const o=_.convertPositionToOffset(this._position,this._parseResults.tokenizerOutput.lines);(o<=s.start||b.TextRange.getEnd(e)<=o)&&this._addCallArgumentCompletions(e,t,n,i,r)}return{completionList:r}}_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}}_getIndexStringLiteral(e,t){if(!e.parent||24!==e.parent.nodeType)return;const n=this._evaluator.getType(e.parent.baseExpression);if(!n||!h.isObject(n))return;const i=n.classType;h.ClassType.isTypedDictClass(i)&&this._evaluator.getTypedDictMembersForClass(i).forEach(((e,n)=>{this._addStringLiteralToCompletionList(n,void 0,void 0,this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,t)}))}_addStringLiteralToCompletionList(e,t,n,i,s){if(T.isPatternInSymbol(t||"",e)){const r=`${i}${e}${i}`,a=o.CompletionItem.create(r);a.kind=o.CompletionItemKind.Text,a.sortText=this._makeSortText(D.LiteralValue,r);let l=this._position.character;void 0!==t&&(l-=t.length+1);let c=this._position.character;void 0!==n&&n.startsWith(i)&&c++;const p={start:{line:this._position.line,character:l},end:{line:this._position.line,character:c}};a.textEdit=o.TextEdit.replace(p,r),s.items.push(a)}}_getAutoImportCompletions(e,t,n){var i,s,r;if(!this._autoImportMaps)return;const a=this._autoImportMaps.getModuleSymbolsMap(),l=n.items.filter((e=>{var t;return!(null===(t=e.data)||void 0===t?void 0:t.autoImport)})).map((e=>e.label)),c=new C.AutoImporter(this._configOptions.findExecEnvironment(this._filePath),this._importResolver,this._parseResults,this._position,l,a,this._autoImportMaps.libraryMap),p=[],d=null===(i=this._autoImportMaps.nameMap)||void 0===i?void 0:i.get(e);d&&e.length>1&&!l.some((t=>t===e))&&p.push(...C.getAutoImportCandidatesForAbbr(c,e,d,this._cancellationToken)),p.push(...c.getAutoImportCandidates(e,.25,void 0,this._cancellationToken));for(const t of p)t.symbol?this._addSymbol(t.name,t.symbol,e,n,{autoImportSource:t.source,autoImportAlias:t.alias,edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}}):this._addNameToCompletionList(null!==(s=t.alias)&&void 0!==s?s:t.name,null!==(r=t.kind)&&void 0!==r?r:o.CompletionItemKind.Module,e,n,{autoImportText:this._getAutoImportText(t.name,t.source,t.alias),edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}})}_getImportFromCompletions(e,t){if(e.isWildcardImport)return;const n=a.getImportInfo(e.module);if(!n)return;const i=o.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,o.CompletionItemKind.Module,t,i)})),{completionList:i}}_findMatchingKeywords(e,t){return e.filter((e=>!t||T.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(T.isPatternInSymbol(t,e)){const t=o.CompletionItem.create(e+"=");t.kind=o.CompletionItemKind.Variable;const i={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};t.data=i,t.sortText=this._makeSortText(D.NamedParameter,e),n.items.push(t)}}))}_addNamedParametersToMap(e,t){e.details.parameters.forEach((e=>{e.name&&!e.isNameSynthesized&&(p.isPrivateOrProtectedName(e.name)||t.set(e.name,e.name))}))}_addSymbols(e,t,n){let i=e;for(;i;){let e=a.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&&h.isClass(e.classType)&&e.classType.details.mro.forEach(((e,i)=>{h.isClass(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,o)=>{!e.isExternallyHidden()&&t(o)&&(r.items.some((e=>e.label===o))||this._addSymbol(o,e,n,r,{boundObject:s,funcParensDisabled:i}))}))}_addSymbol(e,t,n,i,s){var r;let a=d.getLastTypedDeclaredForSymbol(t);if(!a){const e=t.getDeclarations();e.length>0&&(a=e[e.length-1])}if(a){let c=o.CompletionItemKind.Variable;if(a=this._evaluator.resolveAliasDeclaration(a,!0),a&&(c=this._convertDeclarationTypeToItemKind(a),this._itemToResolve)&&this._itemToResolve.data.symbolLabel===e){const n=this._evaluator.getEffectiveTypeOfSymbol(t);if(n){let t,i;switch(a.type){case 0:case 1:case 2:{let i=!1;if(n&&h.TypeBase.isInstantiable(n)){const t=h.getTypeAliasInfo(n);t&&t.aliasName===e&&(i=!0)}t=e+": "+this._evaluator.printType(n,i);break}case 3:{const i=s.boundObject&&h.isFunction(n)?this._evaluator.bindFunctionToClassOrObject(s.boundObject,n):n;if(i)if(m.isProperty(i)&&s.boundObject){const n=this._evaluator.getGetterTypeFromProperty(i.classType,!0)||h.UnknownType.create();t=e+": "+this._evaluator.printType(n,!1)+" (property)"}else t=6===i.category?i.overloads.map((t=>e+this._evaluator.printType(t,!1))).join("\n"):e+": "+this._evaluator.printType(i,!1);break}case 4:case 5:t="class "+e+"()";break;case 6:if(t=e,a.path){const e=this._importLookup(a.path);e&&(i=e.docString)}break;default:t=e}if(h.isModule(n)?i=u.getModuleDocString(n,a,this._sourceMapper):h.isClass(n)?i=u.getClassDocString(n,a,this._sourceMapper):5===n.category?i=u.getFunctionDocStringFromType(n,this._sourceMapper):6===n.category?i=u.getOverloadedFunctionDocStrings(n,a,this._sourceMapper).find((e=>e)):3===a.type&&(i=u.getFunctionDocStringFromDeclaration(a,this._sourceMapper)),this._format===o.MarkupKind.Markdown){let e="```python\n"+t+"\n```\n";i&&(e+="---\n",e+=l.convertDocStringToMarkdown(i)),this._itemToResolve.documentation={kind:o.MarkupKind.Markdown,value:e}}else if(this._format===o.MarkupKind.PlainText){let e=t+"\n";i&&(e+="\n",e+=l.convertDocStringToPlainText(i)),this._itemToResolve.documentation={kind:o.MarkupKind.PlainText,value:e}}else f.fail(`Unsupported markup type: ${this._format}`)}}const p=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:p,funcParensDisabled:s.funcParensDisabled,edits:s.edits})}else if(t.getSynthesizedType()){const t=o.CompletionItemKind.Variable;this._addNameToCompletionList(e,t,n,i,{funcParensDisabled:s.funcParensDisabled,edits:s.edits})}}_getAutoImportText(e,t,n){let i;return i=t?`from ${t} import ${e}`:`import ${e}`,n&&(i=`${i} as ${n}`),this._format===o.MarkupKind.Markdown?`\`\`\`\n${i}\n\`\`\``:this._format===o.MarkupKind.PlainText?i:void f.fail(`Unsupported markup type: ${this._format}`)}_addNameToCompletionList(e,t,n,i,s){var r,a;if(!(null==s?void 0:s.autoImportText)&&!T.isPatternInSymbol(n,e))return;const c=o.CompletionItem.create(e);c.kind=t;const d={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};if((null==s?void 0:s.funcParensDisabled)&&(d.funcParensDisabled=!0),c.data=d,(null==s?void 0:s.autoImportText)?(c.sortText=this._makeSortText(D.AutoImport,e,s.autoImportText),d.autoImportText=s.autoImportText,c.detail="Auto-import"):p.isDunderName(e)?c.sortText=this._makeSortText(D.DunderSymbol,e):""===n&&p.isPrivateOrProtectedName(e)?c.sortText=this._makeSortText(D.PrivateSymbol,e):c.sortText=this._makeSortText(D.NormalSymbol,e),d.symbolLabel=e,this._format===o.MarkupKind.Markdown){let e="";(null==s?void 0:s.autoImportText)&&(e+=s.autoImportText+"\n\n"),(null==s?void 0:s.typeDetail)&&(e+="```python\n"+s.typeDetail+"\n```\n"),(null==s?void 0:s.documentation)&&(e+="---\n",e+=l.convertDocStringToMarkdown(s.documentation)),e=e.trimEnd(),e&&(c.documentation={kind:o.MarkupKind.Markdown,value:e})}else if(this._format===o.MarkupKind.PlainText){let e="";(null==s?void 0:s.autoImportText)&&(e+=s.autoImportText+"\n\n"),(null==s?void 0:s.typeDetail)&&(e+=s.typeDetail+"\n"),(null==s?void 0:s.documentation)&&(e+="\n"+l.convertDocStringToPlainText(s.documentation)),e=e.trimEnd(),e&&(c.documentation={kind:o.MarkupKind.PlainText,value:e})}else f.fail(`Unsupported markup type: ${this._format}`);(null===(r=null==s?void 0:s.edits)||void 0===r?void 0:r.textEdit)&&(c.textEdit=s.edits.textEdit),(null===(a=null==s?void 0:s.edits)||void 0===a?void 0:a.additionalTextEdits)&&(c.additionalTextEdits=s.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})))),i.items.push(c)}_getRecentListIndex(e,t){return x._mostRecentCompletions.findIndex((n=>n.label===e&&n.autoImportText===t))}_makeSortText(e,t,n=""){const i=this._getRecentListIndex(t,n);return i>=0&&(e===D.AutoImport?e=D.RecentAutoImport:e===D.ImportModuleName?e=D.RecentImportModuleName:e!==D.Keyword&&e!==D.NormalSymbol&&e!==D.PrivateSymbol&&e!==D.DunderSymbol||(e=D.RecentKeywordOrSymbol)),this._formatInteger(e,2)+"."+this._formatInteger(i,4)+"."+t}_formatInteger(e,t){const n="0".charCodeAt(0);let i="";for(let s=0;s<t;s++){let t=Math.floor(e%10);t<0&&(t=9),i=String.fromCharCode(t+n)+i,e=Math.floor(e/10)}return i}_convertDeclarationTypeToItemKind(e){const t=this._evaluator.resolveAliasDeclaration(e,!0);if(!t)return o.CompletionItemKind.Variable;switch(t.type){case 0:return"class"===t.intrinsicType?o.CompletionItemKind.Class:o.CompletionItemKind.Variable;case 2:return o.CompletionItemKind.Variable;case 1:return t.isConstant||t.isFinal?o.CompletionItemKind.Constant:o.CompletionItemKind.Variable;case 3:if(this._isPossiblePropertyDeclaration(t)){const e=this._evaluator.getTypeOfFunction(t.node);if(e&&m.isProperty(e.decoratedType))return o.CompletionItemKind.Property}return t.isMethod?o.CompletionItemKind.Method:o.CompletionItemKind.Function;case 4:case 5:return o.CompletionItemKind.Class;case 6:return o.CompletionItemKind.Module}}_getImportModuleCompletions(e){const t=this._configOptions.findExecEnvironment(this._filePath),n={leadingDots:e.leadingDots,hasTrailingDot:e.hasTrailingDot,nameParts:e.nameParts.map((e=>e.value)),importedSymbols:[]},i=this._importResolver.getCompletionSuggestions(this._filePath,t,n,.25),s=o.CompletionList.create();if(!e.hasTrailingDot&&e.parent&&22===e.parent.nodeType&&e.parent.missingImportKeyword){const e="import",t=o.CompletionItem.create(e);t.kind=o.CompletionItemKind.Keyword,s.items.push(t),t.sortText=this._makeSortText(D.Keyword,e)}return i.forEach((e=>{const t=o.CompletionItem.create(e);t.kind=o.CompletionItemKind.Module,s.items.push(t),t.sortText=this._makeSortText(D.ImportModuleName,e)})),{completionList:s}}_isPossiblePropertyDeclaration(e){return e.isMethod&&e.node.decorators.length>0}}t.CompletionProvider=x,x._mostRecentCompletions=[]},3778: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=void 0;const o=r(n(8494)),a=n(8816),l=n(3213),c=n(1464),p=n(3550);t.DefinitionProvider=class{static getDefinitionsForPosition(e,t,n,i,s){l.throwIfCancellationRequested(s);const r=c.convertPositionToOffset(n,t.tokenizerOutput.lines);if(void 0===r)return;const p=o.findNodeByOffset(t.parseTree,r);if(void 0===p)return;const d=[];if(38===p.nodeType){const t=i.getDeclarationsForNameNode(p);t&&t.forEach((t=>{const n=i.resolveAliasDeclaration(t,!0);if(n&&n.path&&(this._addIfUnique(d,{path:n.path,range:n.range}),a.isStubFile(n.path))){const t=e.findDeclarations(n);for(const e of t)e&&e.path&&this._addIfUnique(d,{path:e.path,range:e.range})}}))}return d.length>0?d:void 0}static _addIfUnique(e,t){for(const n of e)if(n.path===t.path&&p.rangesAreEqual(n.range,t.range))return;e.push(t)}}},8221: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 o=n(4494),a=n(563),l=n(5523),c=r(n(8494)),p=n(427),d=n(3213),u=n(1464),h=n(3550);class m extends p.ParseTreeWalker{constructor(e,t,n,i,s,r){super(),this._symbolName=e,this._declarations=t,this._parseResults=n,this._highlightResults=i,this._evaluator=s,this._cancellationToken=r}findHighlights(){this.walk(this._parseResults.parseTree)}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitModuleName(e){return!1}visitName(e){if(d.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._highlightResults.push({kind:this._isWriteAccess(e)?o.DocumentHighlightKind.Write:o.DocumentHighlightKind.Read,range:{start:u.convertOffsetToPosition(e.start,this._parseResults.tokenizerOutput.lines),end:u.convertOffsetToPosition(h.TextRange.getEnd(e),this._parseResults.tokenizerOutput.lines)}})}_isWriteAccess(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}_resultsContainsDeclaration(e){const t=this._evaluator.resolveAliasDeclaration(e,!1);if(!t)return!1;if(this._declarations.some((e=>l.areDeclarationsSame(e,t))))return!0;const n=this._evaluator.resolveAliasDeclaration(t,!0);return!(!n||n===t)&&this._declarations.some((e=>l.areDeclarationsSame(e,n)))}}t.DocumentHighlightProvider=class{static getDocumentHighlight(e,t,n,i){d.throwIfCancellationRequested(i);const s=u.convertPositionToOffset(t,e.tokenizerOutput.lines);if(void 0===s)return;const r=c.findNodeByOffset(e.parseTree,s);if(void 0===r)return;const o=[];if(38===r.nodeType){const t=n.getDeclarationsForNameNode(r)||[],s=[];t.forEach((e=>{const t=n.resolveAliasDeclaration(e,!0);t&&s.push(t)})),new m(r.value,s,e,o,n,i).findHighlights()}return o.length>0?o:void 0}}},2816: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=t.includeAliasDeclarationInIndex=void 0;const o=n(4494),a=n(472),l=n(6673),c=r(n(563)),p=n(5523),d=n(2917),u=n(5168),h=n(3213),m=n(6657),y=n(1464),g=r(n(7559));function f(e,t,n){const i=n.usesLocalName&&!!n.symbolName&&n.path.length>0,s=22===n.node.nodeType&&n.node.isWildcardImport;if(!i&&!s)return!1;if(!m.getLibraryPathWithoutExtension(n.path).startsWith(t))return!1;if(s){const i=l.resolveAliasDeclaration(e,n,!0);if(!i)return!1;if(!m.getLibraryPathWithoutExtension(i.path).startsWith(t))return!1}return!0}function _(e,t){var n;if(!t.symbolName)return;const i=l.resolveAliasDeclaration(e,t,!0),s=i?p.getNameFromDeclaration(i):void 0;return!s||i.path.length<=0?void 0:{originalName:s,modulePath:i.path,kind:null!==(n=v(s,i))&&void 0!==n?n:o.SymbolKind.Module}}t.includeAliasDeclarationInIndex=f,t.getIndexAliasData=_,t.convertToFlatSymbols=function(e,t){const n=[];for(const i of t)I(n,e,i);return n};class T{static getSymbolsForDocument(e,t,n,i,s){var r;const o=[];return e||t?(b(null!==(r=null==e?void 0:e.symbols)&&void 0!==r?r:T.indexSymbols(t,{indexingForAutoImportMode:!1},s),n,i,"",o,s),o):o}static addHierarchicalSymbolsForDocument(e,t,n,i){var s;(e||t)&&S(null!==(s=null==e?void 0:e.symbols)&&void 0!==s?s:T.indexSymbols(t,{indexingForAutoImportMode:!1},i),n,i)}static indexSymbols(e,t,n){const i=[];return C(e,e.parseTree,t,i,n),i}}function v(e,t,n){let i;switch(t.type){case 4:case 5:i=o.SymbolKind.Class;break;case 3:if(t.isMethod){const e=null==n?void 0:n.getTypeForDeclaration(t);i=e&&u.isProperty(e)?o.SymbolKind.Property:o.SymbolKind.Method}else i=o.SymbolKind.Function;break;case 6:i=o.SymbolKind.Module;break;case 2:if("self"===e||"cls"===e||"_"===e)return;i=o.SymbolKind.Variable;break;case 1:if("_"===e)return;i=t.isConstant||t.isFinal?o.SymbolKind.Constant:o.SymbolKind.Variable;break;default:i=o.SymbolKind.Variable}return i}function b(e,t,n,i,s,r){if(h.throwIfCancellationRequested(r),e)for(const l of e)if(!l.alias){if(g.isPatternInSymbol(n,l.name)){const e={uri:a.URI.file(t).toString(),range:l.selectionRange},n={name:l.name,kind:l.kind,containerName:i.length>0?i:void 0,location:e};s.push(n)}b(l.children,t,n,o(i,l.name),s,r)}function o(e,t){return e.length>0?`${e}.${t}`:t}}function S(e,t,n){if(h.throwIfCancellationRequested(n),e)for(const i of e){if(i.alias)continue;const e=[];S(i.children,e,n);const s={name:i.name,kind:i.kind,range:i.range,selectionRange:i.selectionRange,children:e};t.push(s)}}function C(e,t,n,i,s){h.throwIfCancellationRequested(s);const r=c.getScope(t);if(!r)return;const o=function(e,t){if(!e)return;const n=c.getDunderAllNames(t);if(n)return new Set(n);const i=c.getFileInfo(t);return i&&i.isStubFile?void 0:new Set}(n.indexingForAutoImportMode,e.parseTree);let a;r.symbolTable.forEach(((t,r)=>{if(t.isIgnoredForProtocolMatch())return;if(o&&!o.has(r))return;let l=d.getLastTypedDeclaredForSymbol(t);if(!l&&t.hasDeclarations()&&(l=t.getDeclarations()[0]),l){if(6===l.type){if(!n.indexingForAutoImportMode)return;if(l.path.length<=0)return;const t=c.getFileInfo(e.parseTree).importLookup;if(a=null!=a?a:m.getLibraryPathWithoutExtension(c.getFileInfo(e.parseTree).filePath),!o&&!f(t,a,l))return}!function(e,t,n,i,s,r,o){if(n.indexingForAutoImportMode&&!i)return;const a=v(s,t);if(void 0===a)return;const l=t.range;let p=l;const d=[];4!==t.type&&3!==t.type||(n.indexingForAutoImportMode||C(e,t.node,n,d,o),p=y.convertOffsetsToRange(t.node.start,t.node.name.start+t.node.length,e.tokenizerOutput.lines));const u={name:s,externallyVisible:i,kind:a,alias:6===t.type?_(c.getFileInfo(e.parseTree).importLookup,t):void 0,range:n.indexingForAutoImportMode?void 0:p,selectionRange:n.indexingForAutoImportMode?void 0:l,children:n.indexingForAutoImportMode?void 0:d};r.push(u)}(e,l,n,!t.isExternallyHidden(),r,i,s)}}))}function I(e,t,n,i){const s={name:n.name,kind:n.kind,location:o.Location.create(t,n.range),tags:n.tags,containerName:null==i?void 0:i.name};if(e.push(s),n.children)for(const i of n.children)I(e,t,i,n)}t.DocumentSymbolProvider=T},3334: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 o=n(4494),a=n(1272),l=r(n(8494)),c=n(3371),p=n(1133),d=n(5168),u=n(3213),h=n(5839),m=n(1464),y=n(3550);t.HoverProvider=class{static getHoverForPosition(e,t,n,i,s,r){u.throwIfCancellationRequested(r);const o=m.convertPositionToOffset(n,t.tokenizerOutput.lines);if(void 0===o)return;const a=l.findNodeByOffset(t.parseTree,o);if(void 0===a)return;const c={parts:[],range:{start:m.convertOffsetToPosition(a.start,t.tokenizerOutput.lines),end:m.convertOffsetToPosition(y.TextRange.getEnd(a),t.tokenizerOutput.lines)}};if(38===a.nodeType){const t=s.getDeclarationsForNameNode(a);if(t&&t.length>0)this._addResultsForDeclaration(i,e,c.parts,t[0],a,s);else if((!a.parent||37!==a.parent.nodeType)&&0===c.parts.length){const t=s.getType(a)||p.UnknownType.create();let n="";n=p.isModule(t)?"(module) "+a.value:a.value+": "+s.printType(t,!1),this._addResultsPart(c.parts,n,!0),this._addDocumentationPart(i,e,c.parts,a,s,void 0)}}return c.parts.length>0?c:void 0}static _addResultsForDeclaration(e,t,n,i,s,r){var o;const a=r.resolveAliasDeclaration(i,!0);if(a)switch(a.type){case 0:this._addResultsPart(n,s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,a);break;case 1:{let l=a.isConstant||a.isFinal?"constant":"variable",c=s;21===i.node.nodeType||23===i.node.nodeType?i.node.alias&&s!==i.node.alias&&38===a.node.nodeType&&(c=a.node):1===(null===(o=s.parent)||void 0===o?void 0:o.nodeType)&&s.parent.name===s&&38===i.node.nodeType&&(c=i.node);const d=r.getType(c);let u=!1;if(d&&p.TypeBase.isInstantiable(d)){const e=p.getTypeAliasInfo(d);e&&(e.aliasName===c.value&&(u=!0),l="type alias")}this._addResultsPart(n,`(${l}) `+s.value+this._getTypeText(c,r,u),!0),this._addDocumentationPart(e,t,n,s,r,a);break}case 2:this._addResultsPart(n,"(parameter) "+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,a);break;case 4:case 5:if(this._addInitMethodInsteadIfCallNode(e,s,r,n,t,a))return;this._addResultsPart(n,"(class) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,a);break;case 3:{let i="function";if(a.isMethod){const e=r.getTypeForDeclaration(a);i=e&&d.isProperty(e)?"property":"method"}this._addResultsPart(n,`(${i}) `+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,a);break}case 6:this._addResultsPart(n,"(module) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,a)}else this._addResultsPart(n,"(import) "+s.value+this._getTypeText(s,r),!0)}static _addInitMethodInsteadIfCallNode(e,t,n,i,s,r){let o=t;if(o.parent&&35===o.parent.nodeType&&t===o.parent.memberName&&(o=t.parent),!o||!o.parent||9!==o.parent.nodeType||o.parent.leftExpression!==o)return!1;const a=n.getType(t);if(!a||!p.isClass(a))return!1;const l=d.lookUpClassMember(a,"__init__",12);if(!l)return!1;const c=n.getType(o.parent),u=n.getTypeOfMember(l);if(!(c&&u&&p.isObject(c)&&p.isFunction(u)))return!1;const h=n.bindFunctionToClassOrObject(c,u);if(!h||!p.isFunction(h))return!1;const m=n.printFunctionParts(h),y=`${t.value}(${m[0].join(", ")})`;return this._addResultsPart(i,"(class) "+y,!0),this._addDocumentationPartForType(e,s,i,h,r)||this._addDocumentationPartForType(e,s,i,a,r),!0}static _getTypeText(e,t,n=!1){const i=t.getType(e)||p.UnknownType.create();return": "+t.printType(i,n)}static _addDocumentationPart(e,t,n,i,s,r){const o=s.getType(i);o&&this._addDocumentationPartForType(e,t,n,o,r)}static _addDocumentationPartForType(e,t,n,i,s){const r=[];p.isModule(i)?r.push(c.getModuleDocString(i,s,t)):p.isClass(i)?r.push(c.getClassDocString(i,s,t)):5===i.category?r.push(c.getFunctionDocStringFromType(i,t)):6===i.category?r.push(...c.getOverloadedFunctionDocStrings(i,s,t)):3===(null==s?void 0:s.type)&&r.push(c.getFunctionDocStringFromDeclaration(s,t));let o=!1;for(const t of r)t&&(o=!0,this._addDocumentationResultsPart(e,n,t));return o}static _addDocumentationResultsPart(e,t,n){n&&(e===o.MarkupKind.Markdown?this._addResultsPart(t,a.convertDocStringToMarkdown(n)):e===o.MarkupKind.PlainText?this._addResultsPart(t,a.convertDocStringToPlainText(n)):h.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===o.MarkupKind.Markdown)return"```python\n"+t.text+"\n```\n";if(e===o.MarkupKind.PlainText)return t.text+"\n\n";h.fail(`Unsupported markup type: ${e}`)}return t.text})).join("");return{contents:{kind:e,value:n},range:t.range}}},4969:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportSorter=void 0;const i=n(7012),s=n(3213),r=n(1464),o=n(3550);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(o.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(o.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 o;n!==r&&(t+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence,n=r),o=20===s.node.nodeType?this._formatImportNode(s.subnode,s.moduleName):this._formatImportFromNode(s.node,s.moduleName),s!==e[e.length-1]&&(o+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence),t+=o}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<t.name.value?-1:1}}},2858: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.performQuickAction=void 0;const o=n(7012),a=r(n(8494)),l=n(3213),c=n(1464),p=n(3550),d=n(4969);t.performQuickAction=function(e,t,n,i){return"pyright.organizeimports"===e?new d.ImportSorter(n,i).sort():"pyright.addoptionalforparam"===e&&t.length>=1?function(e,t,n){l.throwIfCancellationRequested(n);let i=a.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=o.getTopLevelImports(e.parseTree),m=h.orderedImports.find((e=>"typing"===e.moduleName));if(m&&22===m.node.nodeType){const t=o.getTextEditsForAutoImportSymbolAddition("Optional",m,e);r.push(...t)}else{const t=o.getTextEditsForAutoImportInsertion("Optional",h,"typing",0,e,d);r.push(...t)}return r}(n,parseInt(t[0],10),i):[]}},4952: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 o=r(n(563)),a=r(n(5523)),l=r(n(8494)),c=n(427),p=n(8816),d=n(3213),u=n(1464),h=n(3550);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){o.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=>a.areDeclarationsSame(e,t))))return!0;const n=this._evaluator.resolveAliasDeclaration(t,!0);return!(!n||n===t)&&this._referencesResult.declarations.some((e=>a.areDeclarationsSame(e,n)))}}t.FindReferencesTreeWalker=y,t.ReferencesProvider=class{static getDeclarationForPosition(e,t,n,i,s,r,o){var a;d.throwIfCancellationRequested(o);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===(a=h.parent)||void 0===a?void 0:a.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(a.areDeclarationsSame(n,t))return;e.push(t)}static addReferences(e,t,n,i,s,r){const o=new y(e,t,n,i,s,r);n.addLocations(...o.findReferences())}}},9437: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 o=n(4494),a=n(1272),l=n(5678),c=r(n(8494)),p=n(3213),d=n(1464);t.SignatureHelpProvider=class{static getSignatureHelpForPosition(e,t,n,i,s){var r;p.throwIfCancellationRequested(s);const o=d.convertPositionToOffset(t,e.tokenizerOutput.lines);if(void 0===o)return;let a=c.findNodeByOffset(e.parseTree,o);const l=a,u=a?c.getNodeDepth(a):0;let h=o;for(;h>=0;){h--;const t=c.findNodeByOffset(e.parseTree,h);if(t&&t!==l){c.getNodeDepth(t)>u&&(a=t);break}}if(void 0===a)return;const m=n.getCallSignatureInfo(a,o,e.tokenizerOutput.tokens);return m?{signatures:m.signatures.map((e=>this._makeSignature(e,n,i))),callHasParameters:!!(null===(r=m.callNode.arguments)||void 0===r?void 0:r.length)}:void 0}static _makeSignature(e,t,n){const i=e.type,s=t.printFunctionParts(i),r=[],c=i.details.docString;let p,d="(";s[0].forEach(((e,t)=>{const n=i.details.parameters[t].name||"";r.push({startOffset:d.length,endOffset:d.length+e.length,text:e,documentation:l.extractParameterDocumentation(c||"",n)}),d+=e,t<s[0].length-1&&(d+=", ")})),d+=") -> "+s[1],e.activeParam&&(p=i.details.parameters.indexOf(e.activeParam),-1===p&&(p=void 0));const u={label:d,parameters:r,activeParameter:p};return c&&(n===o.MarkupKind.Markdown?u.documentation={kind:o.MarkupKind.Markdown,value:a.convertDocStringToMarkdown(c)}:u.documentation={kind:o.MarkupKind.PlainText,value:a.convertDocStringToPlainText(c)}),u}}},2122:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Localizer=t.ParameterizedString=void 0;const i=n(5839),s=n(6395),r=n(9890),o=n(6961),a=n(9356),l=n(886),c=n(7523),p=n(6853),d=n(3019);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={de:r,"en-us":s,es:o,fr:a,ja:l,ru:c,"zh-cn":p,"zh-tw":d};let y,g={};function f(e){void 0===y&&(g=function(){const e=T(h);return e||(console.error("Could not load default strings"),{})}(),y=function(e){if(e===h)return{};let t=T(e);if(void 0!==t)return t;const n=e.split("-");return n.length>0&&n[0]&&(t=T(n[0]),void 0!==t)?t:{}}(function(){const e=process.env,t=e.VSCODE_NLS_CONFIG;if(t)try{return JSON.parse(t).locale}catch(e){}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=_(y,t)||_(g,t);if(n)return n;i.fail(`Missing localized string for key "${e}"`)}function _(e,t){let n=e;for(const e of t){if(!n[e])return;n=n[e]}return n}function T(e){return m[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.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.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.classMethodClsParam=()=>f("Diagnostic.classMethodClsParam"),e.classNotRuntimeSubscriptable=()=>new u(f("Diagnostic.classNotRuntimeSubscriptable")),e.classDecoratorTypeUnknown=()=>f("Diagnostic.classDecoratorTypeUnknown"),e.classGetItemClsParam=()=>f("Diagnostic.classGetItemClsParam"),e.classVarFirstArgMissing=()=>f("Diagnostic.classVarFirstArgMissing"),e.classVarTooManyArgs=()=>f("Diagnostic.classVarTooManyArgs"),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.dictInAnnotation=()=>f("Diagnostic.dictInAnnotation"),e.dictKeyValuePairs=()=>f("Diagnostic.dictKeyValuePairs"),e.dictUnpackIsNotMapping=()=>f("Diagnostic.dictUnpackIsNotMapping"),e.delTargetExpr=()=>f("Diagnostic.delTargetExpr"),e.dictExpandIllegalInComprehension=()=>f("Diagnostic.dictExpandIllegalInComprehension"),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.duplicateNameOnly=()=>f("Diagnostic.duplicateNameOnly"),e.duplicateParam=()=>new u(f("Diagnostic.duplicateParam")),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.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.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.expectedNamedArgument=()=>f("Diagnostic.expectedNamedArgument"),e.expectedNewlineOrSemicolon=()=>f("Diagnostic.expectedNewlineOrSemicolon"),e.expectedOpenParen=()=>f("Diagnostic.expectedOpenParen"),e.expectedParamName=()=>f("Diagnostic.expectedParamName"),e.expectedReturnExpr=()=>f("Diagnostic.expectedReturnExpr"),e.expectedSliceIndex=()=>f("Diagnostic.expectedSliceIndex"),e.expectedTypeNotString=()=>f("Diagnostic.expectedTypeNotString"),e.expectedYieldExpr=()=>f("Diagnostic.expectedYieldExpr"),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.formatStringIllegal=()=>f("Diagnostic.formatStringIllegal"),e.formatStringUnicode=()=>f("Diagnostic.formatStringUnicode"),e.formatStringUnterminated=()=>f("Diagnostic.formatStringUnterminated"),e.functionDecoratorTypeUnknown=()=>f("Diagnostic.functionDecoratorTypeUnknown"),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.initSubclassClsParam=()=>f("Diagnostic.initSubclassClsParam"),e.instanceMethodSelfParam=()=>f("Diagnostic.instanceMethodSelfParam"),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.keyRequiredDeleted=()=>new u(f("Diagnostic.keyRequiredDeleted")),e.keyValueInSet=()=>f("Diagnostic.keyValueInSet"),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.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.namedTupleEmptyName=()=>f("Diagnostic.namedTupleEmptyName"),e.namedTupleFirstArg=()=>f("Diagnostic.namedTupleFirstArg"),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.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.objectNotCallable=()=>new u(f("Diagnostic.objectNotCallable")),e.obscuredClassDeclaration=()=>new u(f("Diagnostic.obscuredClassDeclaration")),e.obscuredFunctionDeclaration=()=>new u(f("Diagnostic.obscuredFunctionDeclaration")),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.overlappingOverload=()=>new u(f("Diagnostic.overlappingOverload")),e.overloadAbstractMismatch=()=>new u(f("Diagnostic.overloadAbstractMismatch")),e.overloadReturnTypeMismatch=()=>new u(f("Diagnostic.overloadReturnTypeMismatch")),e.paramAfterKwargsParam=()=>f("Diagnostic.paramAfterKwargsParam"),e.paramAlreadyAssigned=()=>new u(f("Diagnostic.paramAlreadyAssigned")),e.paramNameMissing=()=>new u(f("Diagnostic.paramNameMissing")),e.paramSpecAssignedName=()=>new u(f("Diagnostic.paramSpecAssignedName")),e.paramSpecContext=()=>f("Diagnostic.paramSpecContext"),e.paramSpecIllegal=()=>f("Diagnostic.paramSpecIllegal"),e.paramSpecFirstArg=()=>f("Diagnostic.paramSpecFirstArg"),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.positionArgAfterNamedArg=()=>f("Diagnostic.positionArgAfterNamedArg"),e.positionOnlyAfterNameOnly=()=>f("Diagnostic.positionOnlyAfterNameOnly"),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.propertyStaticOrClassMethod=()=>f("Diagnostic.propertyStaticOrClassMethod"),e.protectedUsedOutsideOfClass=()=>new u(f("Diagnostic.protectedUsedOutsideOfClass")),e.protocolBaseClass=()=>new u(f("Diagnostic.protocolBaseClass")),e.protocolIllegal=()=>f("Diagnostic.protocolIllegal"),e.protocolUsedInCall=()=>new u(f("Diagnostic.protocolUsedInCall")),e.raiseParams=()=>f("Diagnostic.raiseParams"),e.recursiveDefinition=()=>new u(f("Diagnostic.recursiveDefinition")),e.relativeImportNotAllowed=()=>f("Diagnostic.relativeImportNotAllowed"),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.setterGetterTypeMismatch=()=>f("Diagnostic.setterGetterTypeMismatch"),e.singleOverload=()=>new u(f("Diagnostic.singleOverload")),e.staticClsSelfParam=()=>f("Diagnostic.staticClsSelfParam"),e.stringNonAsciiBytes=()=>f("Diagnostic.stringNonAsciiBytes"),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.tupleInAnnotation=()=>f("Diagnostic.tupleInAnnotation"),e.tupleSizeMismatch=()=>new u(f("Diagnostic.tupleSizeMismatch")),e.typeAbstract=()=>new u(f("Diagnostic.typeAbstract")),e.typeAliasIsRecursive=()=>new u(f("Diagnostic.typeAliasIsRecursive")),e.typeAliasNotInModule=()=>f("Diagnostic.typeAliasNotInModule"),e.typeAliasRedeclared=()=>new u(f("Diagnostic.typeAliasRedeclared")),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.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.typeVarNotUsedByOuterScope=()=>new u(f("Diagnostic.typeVarNotUsedByOuterScope")),e.typeVarSingleConstraint=()=>f("Diagnostic.typeVarSingleConstraint"),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.unnecessaryCast=()=>new u(f("Diagnostic.unnecessaryCast")),e.unnecessaryIsInstanceNever=()=>new u(f("Diagnostic.unnecessaryIsInstanceNever")),e.unnecessaryIsInstanceAlways=()=>new u(f("Diagnostic.unnecessaryIsInstanceAlways")),e.unnecessaryIsSubclassAlways=()=>new u(f("Diagnostic.unnecessaryIsSubclassAlways")),e.unnecessaryIsSubclassNever=()=>new u(f("Diagnostic.unnecessaryIsSubclassNever")),e.unpackIllegalInComprehension=()=>f("Diagnostic.unpackIllegalInComprehension"),e.unpackInDict=()=>f("Diagnostic.unpackInDict"),e.unpackInSet=()=>f("Diagnostic.unpackInSet"),e.unpackTuplesIllegal=()=>f("Diagnostic.unpackTuplesIllegal"),e.unreachableCode=()=>f("Diagnostic.unreachableCode"),e.unsupportedDunderAllAssignment=()=>f("Diagnostic.unsupportedDunderAllAssignment"),e.unsupportedDunderAllOperation=()=>f("Diagnostic.unsupportedDunderAllOperation"),e.unusedCallResult=()=>new u(f("Diagnostic.unusedCallResult")),e.varAnnotationIllegal=()=>f("Diagnostic.varAnnotationIllegal"),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"))}(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.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.functionReturnTypeMismatch=()=>new u(f("DiagnosticAddendum.functionReturnTypeMismatch")),e.functionTooFewParams=()=>new u(f("DiagnosticAddendum.functionTooFewParams")),e.functionTooManyParams=()=>new u(f("DiagnosticAddendum.functionTooManyParams")),e.keyUndefined=()=>new u(f("DiagnosticAddendum.keyUndefined")),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.memberSetClassVar=()=>new u(f("DiagnosticAddendum.memberSetClassVar")),e.memberTypeMismatch=()=>new u(f("DiagnosticAddendum.memberTypeMismatch")),e.memberUnknown=()=>new u(f("DiagnosticAddendum.memberUnknown")),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.overloadCallName=()=>new u(f("DiagnosticAddendum.overloadCallName")),e.overloadNotAssignable=()=>new u(f("DiagnosticAddendum.overloadNotAssignable")),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.typeConstraint=()=>new u(f("DiagnosticAddendum.typeConstraint")),e.typedDictFieldMissing=()=>new u(f("DiagnosticAddendum.typedDictFieldMissing")),e.typedDictFieldNotRequired=()=>new u(f("DiagnosticAddendum.typedDictFieldNotRequired")),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.typeVarNotAllowed=()=>f("DiagnosticAddendum.typeVarNotAllowed"),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={}))},9671:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterStream=void 0;const i=n(6956);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<this._text.length?this._text.charCodeAt(this.position+1):0}get prevChar(){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-1?(this._position+=1,this._currentChar=this._text.charCodeAt(this._position),!0):(this.advance(1),!this.isEndOfStream())}isAtWhiteSpace(){return i.isWhiteSpace(this.currentChar)}isAtLineBreak(){return i.isLineBreak(this.currentChar)}skipLineBreak(){13===this._currentChar?(this.moveNext(),10===this.currentChar&&this.moveNext()):10===this._currentChar&&this.moveNext()}skipWhitespace(){for(;!this.isEndOfStream()&&this.isAtWhiteSpace();)this.moveNext()}skipToEol(){for(;!this.isEndOfStream()&&!this.isAtLineBreak();)this.moveNext()}skipToWhitespace(){for(;!this.isEndOfStream()&&!this.isAtWhiteSpace();)this.moveNext()}charCodeAt(e){return this._text.charCodeAt(e)}get length(){return this._text.length}_checkBounds(){this._position<0&&(this._position=0),this._isEndOfStream=this._position>=this._text.length,this._isEndOfStream&&(this._position=this._text.length),this._currentChar=this._isEndOfStream?0:this._text.charCodeAt(this._position)}}},6956: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.isIdentifierChar=t.isIdentifierStartChar=void 0;const o=r(n(7770));var a;!function(e){e[e.NotIdentifierChar=0]="NotIdentifierChar",e[e.StartIdentifierChar=1]="StartIdentifierChar",e[e.IdentifierChar=2]="IdentifierChar"}(a||(a={}));const l=256,c=new Array(l),p={};let d=!1;function u(e){return e>=48&&e<=57||95===e}t.isIdentifierStartChar=function(e){return e<l?c[e]===a.StartIdentifierChar:(d||(g(!1),d=!0),p[e]===a.StartIdentifierChar)},t.isIdentifierChar=function(e){return e<l?c[e]===a.StartIdentifierChar||c[e]===a.IdentifierChar:(d||(g(!1),d=!0),p[e]===a.StartIdentifierChar||p[e]===a.IdentifierChar)},t.isWhiteSpace=function(e){return 32===e||9===e||12===e},t.isLineBreak=function(e){return 13===e||10===e},t.isNumber=function(e){return e>=48&&e<=57||95===e},t.isDecimal=u,t.isHex=function(e){return u(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 h=[[95,6277,6278,8472,8494,12443,12444],o.unicodeLu,o.unicodeLl,o.unicodeLt,o.unicodeLo,o.unicodeLm,o.unicodeNl],m=[[183,903,4969,4970,4971,4972,4973,4974,4975,4976,4977,6618],o.unicodeMn,o.unicodeMc,o.unicodeNd,o.unicodePc];function y(e,t,n){for(let i=0;i<e.length;i++){const s=e[i];let r,o;Array.isArray(s)?(r=s[0],o=s[1]):r=o=s;for(let e=r;e<=o;e++)e<l?c[e]=t:p[e]=t;if(n&&r>=l)break}}function g(e){c.fill(a.NotIdentifierChar),m.forEach((t=>{y(t,a.IdentifierChar,e)})),h.forEach((t=>{y(t,a.StartIdentifierChar,e)}))}g(!0)},5275:(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.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(3550);let s=1;function r(e,t){t.start<e.start&&(e.length+=e.start-t.start,e.start=t.start),i.TextRange.getEnd(t)>i.TextRange.getEnd(e)&&(e.length=i.TextRange.getEnd(t)-e.start)}var o;t.getNextNodeId=function(){return s++},t.extendRange=r,(t.ModuleNode||(t.ModuleNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:36,id:s++,statements:[]}},(t.SuiteNode||(t.SuiteNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:50,id:s++,statements:[]}},(t.IfNode||(t.IfNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:19,id:s++,testExpression:t,ifSuite:n,elseSuite:i};return t.parent=o,n.parent=o,r(o,t),r(o,n),i&&(r(o,i),i.parent=o),o},(t.WhileNode||(t.WhileNode={})).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.ForNode||(t.ForNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:26,id:s++,targetExpression:t,iterableExpression:n,forSuite:i};return t.parent=o,n.parent=o,i.parent=o,r(o,i),o},(t.ListComprehensionForNode||(t.ListComprehensionForNode={})).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.ListComprehensionIfNode||(t.ListComprehensionIfNode={})).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.TryNode||(t.TryNode={})).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.ExceptNode||(t.ExceptNode={})).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.FunctionNode||(t.FunctionNode={})).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.ParameterNode||(t.ParameterNode={})).create=function(e,t){return{start:e.start,length:e.length,nodeType:41,id:s++,category:t}},(o=t.ClassNode||(t.ClassNode={})).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},o.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.WithNode||(t.WithNode={})).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.WithItemNode||(t.WithItemNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:59,id:s++,expression:e};return e.parent=t,t},(t.DecoratorNode||(t.DecoratorNode={})).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.StatementListNode||(t.StatementListNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:47,id:s++,statements:[]}},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}},(t.ErrorNode||(t.ErrorNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:0,id:s++,category:t,child:n,decorators:i};return n&&(n.parent=o,r(o,n)),i&&(i.forEach((e=>{e.parent=o})),i.length>0&&r(o,i[0])),o},(t.UnaryOperationNode||(t.UnaryOperationNode={})).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.BinaryOperationNode||(t.BinaryOperationNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:7,id:s++,leftExpression:e,operatorToken:n,operator:i,rightExpression:t};return e.parent=o,t.parent=o,r(o,t),o},(t.AssignmentExpressionNode||(t.AssignmentExpressionNode={})).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.AssignmentNode||(t.AssignmentNode={})).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.TypeAnnotationNode||(t.TypeAnnotationNode={})).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.FunctionAnnotationNode||(t.FunctionAnnotationNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:62,id:s++,isParamListEllipsis:t,paramTypeAnnotations:n,returnTypeAnnotation:i};return n.forEach((e=>{e.parent=o})),i.parent=o,r(o,i),o},(t.AugmentedAssignmentNode||(t.AugmentedAssignmentNode={})).create=function(e,t,n,i){const o={start:e.start,length:e.length,nodeType:5,id:s++,leftExpression:e,operator:n,rightExpression:t,destExpression:i};return e.parent=o,t.parent=o,i.parent=o,r(o,t),o},(t.AwaitNode||(t.AwaitNode={})).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.TernaryNode||(t.TernaryNode={})).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.UnpackNode||(t.UnpackNode={})).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.TupleNode||(t.TupleNode={})).create=function(e,t){return{start:e.start,length:e.length,nodeType:52,id:s++,expressions:[],enclosedInParens:t}},(t.CallNode||(t.CallNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:9,id:s++,leftExpression:e,arguments:[]};return e.parent=t,t},(t.ListComprehensionNode||(t.ListComprehensionNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:32,id:s++,expression:e,comprehensions:[]};return e.parent=t,t},(t.IndexNode||(t.IndexNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:24,id:s++,baseExpression:e,items:t};return e.parent=i,t.forEach((e=>{e.parent=i})),r(i,n),i},(t.SliceNode||(t.SliceNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:46,id:s++}},(t.YieldNode||(t.YieldNode={})).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.YieldFromNode||(t.YieldFromNode={})).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.MemberAccessNode||(t.MemberAccessNode={})).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.LambdaNode||(t.LambdaNode={})).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.NameNode||(t.NameNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:38,id:s++,token:e,value:e.value}},(t.ConstantNode||(t.ConstantNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:11,id:s++,constType:e.keywordType}},(t.EllipsisNode||(t.EllipsisNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:18,id:s++}},(t.NumberNode||(t.NumberNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:40,id:s++,value:e.value,isInteger:e.isInteger,isImaginary:e.isImaginary}},(t.StringNode||(t.StringNode={})).create=function(e,t,n){return{start:e.start,length:e.length,nodeType:49,id:s++,token:e,value:t,hasUnescapeErrors:n}},(t.FormatStringNode||(t.FormatStringNode={})).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.StringListNode||(t.StringListNode={})).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.DictionaryNode||(t.DictionaryNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:15,id:s++,entries:[]}},(t.DictionaryKeyEntryNode||(t.DictionaryKeyEntryNode={})).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.DictionaryExpandEntryNode||(t.DictionaryExpandEntryNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:16,id:s++,expandExpression:e};return e.parent=t,t},(t.SetNode||(t.SetNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:45,id:s++,entries:[]}},(t.ListNode||(t.ListNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:31,id:s++,entries:[]}},(t.ArgumentNode||(t.ArgumentNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:1,id:s++,valueExpression:t,argumentCategory:n};return t.parent=i,r(i,t),i},(t.DelNode||(t.DelNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:14,id:s++,expressions:[]}},(t.PassNode||(t.PassNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:42,id:s++}},(t.ImportNode||(t.ImportNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:20,id:s++,list:[]}},(t.ModuleNameNode||(t.ModuleNameNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:37,id:s++,leadingDots:0,nameParts:[]}},(t.ImportAsNode||(t.ImportAsNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:21,id:s++,module:e};return e.parent=t,t},(t.ImportFromNode||(t.ImportFromNode={})).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.ImportFromAsNode||(t.ImportFromAsNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:23,id:s++,name:e};return e.parent=t,t},(t.GlobalNode||(t.GlobalNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:29,id:s++,nameList:[]}},(t.NonlocalNode||(t.NonlocalNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:39,id:s++,nameList:[]}},(t.AssertNode||(t.AssertNode={})).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.BreakNode||(t.BreakNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:8,id:s++}},(t.ContinueNode||(t.ContinueNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:12,id:s++}},(t.ReturnNode||(t.ReturnNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:44,id:s++}},(t.RaiseNode||(t.RaiseNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:43,id:s++}}},5303: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 o=n(5839),a=n(1290),l=n(3980),c=n(1464),p=n(6886),d=n(8718),u=n(2122),h=n(5275),m=r(n(5136)),y=n(7093),g=n(6180);class f{constructor(){this.isStubFile=!1,this.pythonVersion=p.latestStablePythonVersion,this.reportInvalidStringEscapeSequence=!1}}t.ParseOptions=f;class _{constructor(){this._tokenIndex=0,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])}})),o.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 o=new l.DiagnosticSink;let a;if(this._startNewParse(e,t,n,i,o,r),1===s)a=this._parseTypeAnnotation(!1);else if(2===s)a=this._parseFunctionTypeAnnotation();else{const e=this._parseTestOrStarExpressionList(!1);a=e.parseError?e.parseError:this._makeExpressionOrTuple(e,!1)}return 2===this._peekTokenType()&&this._getNextToken(),this._atEof()||this._addError(u.Localizer.Diagnostic.unexpectedExprToken(),this._peekToken()),{parseTree:a,lines:this._tokenizerOutput.lines,diagnostics:o.fetchAndClear()}}_startNewParse(e,t,n,i,s,r=0){this._fileContents=e,this._parseOptions=i,this._diagSink=s;const o=new y.Tokenizer;this._tokenizerOutput=o.tokenize(e,t,n,r),this._tokenIndex=0}_parseStatement(){switch(this._consumeTokenIfType(4)&&this._addError(u.Localizer.Diagnostic.unexpectedUnindent(),this._peekToken()),this._peekKeywordType()){case 19:return this._parseIfStatement();case 33:return this._parseWhileStatement();case 16:return this._parseForStatement();case 32:return this._parseTryStatement();case 34:return this._parseWithStatement();case 9:return this._parseFunctionDef();case 6:return this._parseClassDef();case 3:return this._parseAsyncStatement()}return 22===this._peekOperatorType()?this._parseDecorated():this._parseSimpleStatement()}_parseAsyncStatement(){const e=this._getKeywordToken(3);switch(this._peekKeywordType()){case 9:return this._parseFunctionDef(e);case 34:return this._parseWithStatement(e);case 16:return this._parseForStatement(e)}this._addError(u.Localizer.Diagnostic.unexpectedAsyncToken(),e)}_parseIfStatement(e=19){const t=this._getKeywordToken(e),n=this._parseTestExpression(!0),i=this._parseSuite(this._isInFunction),s=h.IfNode.create(t,n,i);return this._consumeTokenIfKeyword(12)?(s.elseSuite=this._parseSuite(this._isInFunction),s.elseSuite.parent=s,h.extendRange(s,s.elseSuite)):11===this._peekKeywordType()&&(s.elseSuite=this._parseIfStatement(11),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){const n=this._peekToken(),i=h.SuiteNode.create(n);this._consumeTokenIfType(10)||(this._addError(u.Localizer.Diagnostic.expectedColon(),n),this._consumeTokensUntilType([2,10])&&this._getNextToken()),t&&t();const s=this._isInFunction;if(this._isInFunction=e,this._consumeTokenIfType(2)){t&&t();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=i,i.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();i.statements.push(e),e.parent=i}return i.statements.length>0&&h.extendRange(i,i.statements[i.statements.length-1]),this._isInFunction=s,i}_parseForStatement(e){const t=this._getKeywordToken(16),n=this._parseExpressionList(!0),i=this._makeExpressionOrTuple(n,!1);let s,r,o;this._consumeTokenIfKeyword(21)?(s=this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedInExpr()),r=this._parseLoopSuite(),this._consumeTokenIfKeyword(12)&&(o=this._parseSuite(this._isInFunction))):(s=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn()),r=h.SuiteNode.create(this._peekToken()));const a=h.ForNode.create(t,i,s,r);return a.elseSuite=o,o&&(h.extendRange(a,o),o.parent=a),e&&(a.isAsync=!0,h.extendRange(a,e)),a}_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||16!==e.keywordType)return}else if(16!==e)return;let t;3===this._peekKeywordType()&&(t=this._getKeywordToken(3));const n=this._getKeywordToken(16),i=this._parseExpressionList(!0),s=this._makeExpressionOrTuple(i,!1);let r;this._consumeTokenIfKeyword(21)?this._disallowAssignmentExpression((()=>{r=this._parseOrTest()})):r=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn());const o=h.ListComprehensionForNode.create(t||n,s,r);return t&&(o.isAsync=!0),o}_tryParseCompIfStatement(){if(19!==this._peekKeywordType())return;const e=this._getKeywordToken(19),t=this._tryParseLambdaExpression()||this._parseAssignmentExpression();return h.ListComprehensionIfNode.create(e,t)}_parseWhileStatement(){const e=this._getKeywordToken(33),t=h.WhileNode.create(e,this._parseTestExpression(!0),this._parseLoopSuite());return this._consumeTokenIfKeyword(12)&&(t.elseSuite=this._parseSuite(this._isInFunction),t.elseSuite.parent=t,h.extendRange(t,t.elseSuite)),t}_parseTryStatement(){const e=this._getKeywordToken(32),t=this._parseSuite(this._isInFunction),n=h.TryNode.create(e,t);let i=!1;for(;;){const e=this._peekToken();if(!this._consumeTokenIfKeyword(13))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),o=h.ExceptNode.create(e,r);t&&(o.typeExpression=t,o.typeExpression.parent=o),s&&(o.name=h.NameNode.create(s),o.name.parent=o),n.exceptClauses.push(o),o.parent=n}return n.exceptClauses.length>0&&(h.extendRange(n,n.exceptClauses[n.exceptClauses.length-1]),this._consumeTokenIfKeyword(12)&&(n.elseSuite=this._parseSuite(this._isInFunction),n.elseSuite.parent=n,h.extendRange(n,n.elseSuite))),this._consumeTokenIfKeyword(15)&&(n.finallySuite=this._parseSuite(this._isInFunction),n.finallySuite.parent=n,h.extendRange(n,n.finallySuite)),n}_parseFunctionDef(e,t){const n=this._getKeywordToken(9),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,o;this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()),this._consumeTokensUntilType([10])),this._consumeTokenIfType(21)&&(r=this._parseTypeAnnotation());const a=this._parseSuite(!0,(()=>{o||(o=this._getTypeAnnotationCommentText())})),l=h.FunctionNode.create(n,h.NameNode.create(i),a);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)),o&&this._parseFunctionTypeAnnotationComment(o,l),l}_parseVarArgsList(e,t){const n=new Map,i=[];let s=!1,r=!1,o=!1,a=!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||o||l||r||(this._addError(u.Localizer.Diagnostic.nonDefaultAfterDefault(),p),r=!0):(a?this._addError(u.Localizer.Diagnostic.duplicatePositionOnly(),p):o&&this._addError(u.Localizer.Diagnostic.positionOnlyAfterNameOnly(),p),a=!0)),i.push(p),1===p.category&&(p.name?(l&&this._addError(u.Localizer.Diagnostic.duplicateArgsParam(),p),l=!0):(o&&this._addError(u.Localizer.Diagnostic.duplicateNameOnly(),p),o=!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.expectedNamedArgument(),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()<p.PythonVersion.V3_8&&this._addError(u.Localizer.Diagnostic.positionOnlyIncompatible(),i),n=1);const s=this._getTokenIfIdentifier();if(!s){if(1===t)return h.ParameterNode.create(i,1);if(1===n)return h.ParameterNode.create(i,0);if(13===this._peekTokenType()){const e=this._getNextToken();this._consumeTokensUntilType([14])&&this._getNextToken(),this._addError(u.Localizer.Diagnostic.sublistParamsIncompatible(),e)}else this._addError(u.Localizer.Diagnostic.expectedParamName(),this._peekToken())}let r=0;1===t?r=1:2===t&&(r=2);const o=h.ParameterNode.create(i,r);return s&&(o.name=h.NameNode.create(s),o.name.parent=o,h.extendRange(o,s)),e&&this._consumeTokenIfType(10)&&(o.typeAnnotation=this._parseTypeAnnotation(),o.typeAnnotation.parent=o,h.extendRange(o,o.typeAnnotation)),this._consumeTokenIfOperator(2)&&(o.defaultValue=this._parseTestExpression(!1),o.defaultValue.parent=o,h.extendRange(o,o.defaultValue),t>0&&this._addError(u.Localizer.Diagnostic.defaultValueNotAllowed(),o.defaultValue)),o}_parseWithStatement(e){const t=this._getKeywordToken(34),n=[];for(;n.push(this._parseWithItem()),this._consumeTokenIfType(12););const i=this._parseSuite(this._isInFunction),s=h.WithNode.create(t,i);return e&&(s.isAsync=!0,h.extendRange(s,e)),s.withItems=n,n.forEach((e=>{e.parent=s})),s}_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(),9===this._peekKeywordType())return this._parseFunctionDef(t,e);this._addError(u.Localizer.Diagnostic.expectedFunctionAfterAsync(),this._peekToken())}else{if(9===t.keywordType)return this._parseFunctionDef(void 0,e);if(6===t.keywordType)return this._parseClassDef(e)}return this._addError(u.Localizer.Diagnostic.expectedAfterDecorator(),this._peekToken()),h.ClassNode.createDummyForDecorators(e)}_parseDecorator(){const e=this._getNextToken();o.assert(22===e.operatorType);const t=this._parseTestExpression(!0);if(this._getLanguageVersion()<p.PythonVersion.V3_9){let e=!1;(this._isNameOrMemberAccessExpression(t)||9===t.nodeType&&this._isNameOrMemberAccessExpression(t.leftExpression))&&(e=!0),e||this._addError(u.Localizer.Diagnostic.expectedDecoratorExpr(),t)}const n=h.DecoratorNode.create(e,t);return this._consumeTokenIfType(2)||(this._addError(u.Localizer.Diagnostic.expectedDecoratorNewline(),this._peekToken()),this._consumeTokensUntilType([2])),n}_isNameOrMemberAccessExpression(e){return 38===e.nodeType||35===e.nodeType&&this._isNameOrMemberAccessExpression(e.leftExpression)}_parseClassDef(e){const t=this._getKeywordToken(6);let n=this._getTokenIfIdentifier();n||(this._addError(u.Localizer.Diagnostic.expectedClassName(),this._peekToken()),n=g.IdentifierToken.create(0,0,"",void 0));let i=[];this._consumeTokenIfType(13)&&(i=this._parseArgList(),this._consumeTokenIfType(14)||this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()));const s=this._parseSuite(!1),r=h.ClassNode.create(t,h.NameNode.create(n),s);return r.arguments=i,i.forEach((e=>{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(28))}_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(7);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(30),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(17),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(20)){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);for(;;){const e=this._getTokenIfIdentifier();if(!e)break;const t=h.ImportFromAsNode.create(h.NameNode.create(e));if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(t.alias=h.NameNode.create(e),t.alias.parent=t,h.extendRange(t,e)):this._addError(u.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}if(n.imports.push(t),t.parent=n,h.extendRange(n,t),i&&this._futureImportMap.set(e.value,!0),!this._consumeTokenIfType(12))break}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 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(20),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([20]);if(!n){e&&0!==t.leadingDots||(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(18),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(25),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(29),t=h.RaiseNode.create(e);return this._isNextTokenNeverExpression()||(t.typeExpression=this._parseTestExpression(!0),t.typeExpression.parent=t,h.extendRange(t,t.typeExpression),this._consumeTokenIfKeyword(17)?(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(10),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(35),t=this._peekToken();if(this._consumeTokenIfKeyword(17))return this._getLanguageVersion()<p.PythonVersion.V3_3&&this._addError(u.Localizer.Diagnostic.yieldFromIllegal(),t),h.YieldFromNode.create(e,this._parseTestExpression(!0));let n;return this._isNextTokenNeverExpression()||(n=this._parseTestOrStarListAsExpression(!0,2,u.Localizer.Diagnostic.expectedYieldExpr()),this._reportConditionalErrorForStarTupleElement(n)),h.YieldNode.create(e,n)}_tryParseYieldExpression(){if(35===this._peekKeywordType())return this._parseYieldExpression()}_parseSimpleStatement(){const e=h.StatementListNode.create(this._peekToken());for(;;){if(0===this._peekTokenType()){const e=this._getNextToken(),t=this._fileContents.substr(e.start,e.length).replace(/[\S\W]/g,"");this._addError(u.Localizer.Diagnostic.invalidTokenChars().format({text:t}),e),this._consumeTokensUntilType([2]);break}const t=this._parseSmallStatement();if(e.statements.push(t),t.parent=e,h.extendRange(e,t),0===t.nodeType)break;if(!this._consumeTokenIfType(11))break;const n=this._peekTokenType();if(2===n||1===n)break}return this._consumeTokenIfType(2)||this._addError(u.Localizer.Diagnostic.expectedNewlineOrSemicolon(),this._peekToken()),e}_parseSmallStatement(){switch(this._peekKeywordType()){case 28:return this._parsePassStatement();case 5:return this._parseBreakStatement();case 7:return this._parseContinueStatement();case 30:return this._parseReturnStatement();case 17:return this._parseFromStatement();case 20:return this._parseImportStatement();case 18:return this._parseGlobalStatement();case 25:return this._parseNonlocalStatement();case 29:return this._parseRaiseStatement();case 2:return this._parseAssertStatement();case 10:return this._parseDelStatement();case 35:return this._parseYieldExpression()}return this._parseExpressionStatement()}_makeExpressionOrTuple(e,t){if(1===e.list.length&&!e.trailingComma)return e.list[0];const n=e.list.length>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(23===this._peekKeywordType())return this._parseLambdaExpression();const t=e?this._parseAssignmentExpression():this._parseOrTest();if(0===t.nodeType)return t;if(!this._consumeTokenIfKeyword(19))return t;const n=this._parseAssignmentExpression();if(0===n.nodeType)return n;if(!this._consumeTokenIfKeyword(12))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()<p.PythonVersion.V3_8&&this._addError(u.Localizer.Diagnostic.walrusIllegal(),t);const n=this._parseTestExpression(!1);return h.AssignmentExpressionNode.create(e,n)}_parseOrTest(){let e=this._parseAndTest();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfKeyword(27))break;const n=this._parseAndTest();e=h.BinaryOperationNode.create(e,n,t,37)}return e}_parseAndTest(){let e=this._parseNotTest();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfKeyword(0))break;const n=this._parseNotTest();e=h.BinaryOperationNode.create(e,n,t,36)}return e}_parseNotTest(){const e=this._peekToken();if(this._consumeTokenIfKeyword(26)){const t=this._parseNotTest();return h.UnaryOperationNode.create(e,t,38)}return this._parseComparison()}_parseComparison(){let e=this._parseBitwiseOrExpression();if(0===e.nodeType)return e;for(;;){let t;const n=this._peekToken();if(y.Tokenizer.isOperatorComparison(this._peekOperatorType()))t=this._peekOperatorType(),19===t&&(this._addError(u.Localizer.Diagnostic.operatorLessOrGreaterDeprecated(),n),t=28),this._getNextToken();else if(this._consumeTokenIfKeyword(21))t=41;else if(this._consumeTokenIfKeyword(22))t=this._consumeTokenIfKeyword(26)?40:39;else if(26===this._peekKeywordType()){const e=this._peekToken(1);8===e.type&&21===e.keywordType&&(this._getNextToken(),this._getNextToken(),t=42)}if(void 0===t)break;const i=this._parseComparison();e=h.BinaryOperationNode.create(e,i,n,t)}return e}_parseBitwiseOrExpression(){let e=this._parseBitwiseXorExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(6))break;const n=this._parseBitwiseXorExpression();e=h.BinaryOperationNode.create(e,n,t,6)}return e}_parseBitwiseXorExpression(){let e=this._parseBitwiseAndExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(8))break;const n=this._parseBitwiseAndExpression();e=h.BinaryOperationNode.create(e,n,t,8)}return e}_parseBitwiseAndExpression(){let e=this._parseShiftExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(3))break;const n=this._parseShiftExpression();e=h.BinaryOperationNode.create(e,n,t,3)}return e}_parseShiftExpression(){let e=this._parseArithmeticExpression();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;17===n||31===n;){this._getNextToken();const i=this._parseArithmeticExpression();e=h.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticExpression(){let e=this._parseArithmeticTerm();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;0===n||33===n;){this._getNextToken();const i=this._parseArithmeticTerm();if(0===i.nodeType)return i;e=h.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticTerm(){let e=this._parseArithmeticFactor();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;26===n||22===n||10===n||24===n||13===n;){this._getNextToken();const i=this._parseArithmeticFactor();e=h.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticFactor(){const e=this._peekToken(),t=this._peekOperatorType();if(0===t||33===t||5===t){this._getNextToken();const n=this._parseArithmeticFactor();return h.UnaryOperationNode.create(e,n,t)}const n=this._parseAtomExpression();if(0===n.nodeType)return n;const i=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._parseArithmeticFactor();return h.BinaryOperationNode.create(n,e,i,29)}return n}_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}_parseAtomExpression(){let e;4!==this._peekKeywordType()||this._isParsingTypeAnnotation||(e=this._getKeywordToken(4),this._getLanguageVersion()<p.PythonVersion.V3_5&&this._addError(u.Localizer.Diagnostic.awaitIllegal(),e));let t=this._parseAtom();if(0===t.nodeType)return t;for(;;)if(this._consumeTokenIfType(13)){const e=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!1;const n=this._parseArgList(),i=h.CallNode.create(t);i.arguments=n,n.length>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 a.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,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=this._parseExpressionListGeneric((()=>this._parseSubscript()),(()=>10!==this._peekTokenType()&&this._isNextTokenNeverExpression()));return e.parseError?[e.parseError]:0===e.list.length?[this._handleExpressionParseError(3,u.Localizer.Diagnostic.expectedSliceIndex())]:e.list}_parseSubscript(){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];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 a.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 a.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 a.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(14===t.keywordType||31===t.keywordType||8===t.keywordType||24===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){this._addError(t,this._peekToken());const i=h.ErrorNode.create(this._peekToken(),e,n);return this._consumeTokensUntilType([2]),i}_parseLambdaExpression(e=!0){const t=this._getKeywordToken(23),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(23===this._peekKeywordType())return this._parseLambdaExpression(e)}_parseTupleAtom(){const e=this._getNextToken();o.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();o.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();o.assert(17===e.type);const t=[],n=[];let i=!1,s=!1,r=!1,a=!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,a||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 o=this._tryParseListComprehension(n);o&&(s=o,r=!0,a||this._addError(u.Localizer.Diagnostic.comprehensionInDict(),e)),t.push(s),i=!0}else if(o.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,a||this._addError(u.Localizer.Diagnostic.comprehensionInSet(),l)),n.push(l),s=!0}if(r)break;if(!this._consumeTokenIfType(12))break;a=!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()<p.PythonVersion.V3_6&&this._addError(u.Localizer.Diagnostic.varAnnotationIllegal(),e),!this._consumeTokenIfOperator(2))return t;const n=this._isTypingAnnotation(e,"TypeAlias"),i=this._isParsingTypeAnnotation;n&&(this._isParsingTypeAnnotation=!0);const s=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedAssignRightHandExpr());return this._isParsingTypeAnnotation=i,h.AssignmentNode.create(t,s)}if(this._consumeTokenIfOperator(2))return this._parseChainAssignments(t);if(y.Tokenizer.isOperatorAssignment(this._peekOperatorType())){const e=this._getNextToken(),n=this._tryParseYieldExpression()||this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedBinaryRightHandExpr()),i=Object.assign({},t);return i.id=h.getNextNodeId(),h.AugmentedAssignmentNode.create(t,n,e.operatorType,i)}return t}_parseChainAssignments(e){let t=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedAssignRightHandExpr());if(0===t.nodeType)return h.AssignmentNode.create(e,t);if(this._consumeTokenIfOperator(2)&&(t=this._parseChainAssignments(t),0===t.nodeType))return t;const n=h.AssignmentNode.create(e,t),i=this._parseVariableTypeAnnotationComment();return i&&(n.typeAnnotationComment=i,n.typeAnnotationComment.parent=n,h.extendRange(n,n.typeAnnotationComment)),n}_parseFunctionTypeAnnotation(){const e=this._peekToken();if(!this._consumeTokenIfType(13))return void this._addError(u.Localizer.Diagnostic.expectedOpenParen(),this._peekToken());let t=[];for(;;){const e=this._peekTokenType();if(14===e||2===e||1===e)break;const n=this._parseTypeAnnotation();if(t.push(n),!this._consumeTokenIfType(12))break}if(this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),this._peekToken()),this._consumeTokensUntilType([10])),!this._consumeTokenIfType(21))return void this._addError(u.Localizer.Diagnostic.expectedArrow(),this._peekToken());const n=this._parseTypeAnnotation();let i=!1;return 1===t.length&&18===t[0].nodeType&&(t=[],i=!0),h.FunctionAnnotationNode.create(e,i,t,n)}_parseTypeAnnotation(e=!0){const t=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!0;const n=this._parseTestExpression(!1);return this._isParsingTypeAnnotation=t,n}_reportStringTokenErrors(e,t){65536&e.flags&&this._addError(u.Localizer.Diagnostic.stringUnterminated(),e),t.nonAsciiInBytes&&this._addError(u.Localizer.Diagnostic.stringNonAsciiBytes(),e),64&e.flags&&(this._getLanguageVersion()<p.PythonVersion.V3_6&&this._addError(u.Localizer.Diagnostic.formatStringIllegal(),e),32&e.flags&&this._addError(u.Localizer.Diagnostic.formatStringBytes(),e),16&e.flags&&this._addError(u.Localizer.Diagnostic.formatStringUnicode(),e))}_makeStringNode(e){const t=m.getUnescapedString(e);return this._reportStringTokenErrors(e,t),h.StringNode.create(e,t.value,t.unescapeErrors.length>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 _).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 _).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){o.assert(t.isExpression);const s=(new _).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 o=0,a=0;for(let s=0;s<r.length;s++)if(123===r.charCodeAt(s))0===o&&(a=s+1),o++;else if(125===r.charCodeAt(s)&&o>0&&(o--,0===o)){const r=this._parseFormatStringSegment(e,i,t+a,s-a);r&&n.push(r)}}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,o=0;for(;t<e.length;){const a=e[t],l=n.length>0||s>0||r>0||o>0,c=n.length>0;if("="===a)i=t;else{if(":"===a){if(!l)break}else if("!"===a){if(!l&&(t===e.length-1||"="!==e[t+1]))break}else if("'"===a||'"'===a){let i=a;t+2<e.length&&e[t+1]===a&&e[t+2]===a&&(i=a+a+a,t+=2),n.length>0&&n[n.length-1]===i?n.pop():n.push(i)}else"("===a?c||r++:")"===a?!c&&r>0&&r--:"{"===a?c||s++:"}"===a?!c&&s>0&&s--:"["===a?c||o++:"]"===a&&!c&&o>0&&o--;" "!==a&&(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 _).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 16:case 21:case 19: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(e=[]){const t=this._peekToken();if(7===t.type)return this._getNextToken();if(0===t.type)return this._getNextToken(),this._addError(u.Localizer.Diagnostic.invalidIdentifierChar(),t),g.IdentifierToken.create(t.start,t.length,"",t.comments);if(8===t.type){const n=this._peekKeywordType();if(!e.find((e=>e===n))){const e=this._fileContents.substr(t.start,t.length);return this._getNextToken(),g.IdentifierToken.create(t.start,t.length,e,t.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 o.assert(8===t.type),o.assert(t.keywordType===e),t}_getLanguageVersion(){return this._parseOptions.pythonVersion}_addError(e,t){o.assert(void 0!==t),this._diagSink.addError(e,c.convertOffsetsToRange(t.start,t.start+t.length,this._tokenizerOutput.lines))}}t.Parser=_},5136:(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,o=0!=(8&e.flags),a=0!=(32&e.flags),l=0!=(64&e.flags);let c=0,p={offset:0,length:0,value:"",isExpression:!1},d=0;const u={value:"",unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]},h=()=>{o||u.unescapeErrors.push({offset:d-1,length:2,errorType:0})},m=(e=0)=>d+e>=t.length?3:t.charCodeAt(d+e),y=e=>{let t=!1,n=0,i="";for(let i=0;i<e;i++){const e=m(1+i);if(!s(e)){t=!0;break}n=16*n+r(e)}return t?(h(),i="\\"+String.fromCharCode(m()),d++):(i=String.fromCharCode(n),d+=1+e),i},g=e=>{const t=String.fromCharCode(e);u.value+=t,p.value+=t};for(;;){let e=m();if(3===e)return l&&(p.isExpression&&u.unescapeErrors.push({offset:p.offset,length:d-p.offset,errorType:3}),d!==p.offset&&(p.length=d-p.offset,u.formatStringSegments.push(p))),u;if(92===e){if(l&&p.isExpression&&u.unescapeErrors.push({offset:d,length:1,errorType:1}),d++,o){g(e);continue}e=m();let t="";if(13===e||10===e)13===e&&10===m(1)&&(o&&(t+=String.fromCharCode(e)),d++,e=m()),o&&(t="\\"+t+String.fromCharCode(e)),d++;else if(o)t="\\"+String.fromCharCode(e),d++;else switch(e){case 92:case 39:case 34:t=String.fromCharCode(e),d++;break;case 97:t="",d++;break;case 98:t="\b",d++;break;case 102:t="\f",d++;break;case 110:t="\n",d++;break;case 114:t="\r",d++;break;case 116:t="\t",d++;break;case 118:t="\v",d++;break;case 120:t=y(2);break;case 78:{let i=!1,s=1;if(123!==m(s))i=!0;else for(s++;;){const e=m(s);if(125===e)break;if(!n(e)&&45!==e&&32!==(f=e)&&9!==f){i=!0;break}s++}i?(h(),t="\\"+String.fromCharCode(e),d++):(t="-",d+=1+s);break}case 117:t=y(4);break;case 85:t=y(8);break;default:if(i(e)){let n=e-48;d++,e=m(),i(e)&&(n=8*n+e-48,d++,e=m(),i(e)&&(n=8*n+e-48,d++)),t=String.fromCharCode(n)}else t="\\",h()}u.value+=t,p.value+=t}else if(10===e||13===e)13===e&&10===m(1)&&(g(e),d++,e=m()),g(e),d++;else if(l&&123===e)p.isExpression||123!==m(1)?(0===c?(p.length=d-p.offset,p.length>0&&u.formatStringSegments.push(p),d++,p={offset:d,length:0,value:"",isExpression:!0}):(g(e),d++),c++):(g(e),d+=2);else if(l&&125===e)p.isExpression||125!==m(1)?0===c?(u.unescapeErrors.push({offset:d,length:1,errorType:2}),d++):(c--,0===c?(p.length=d-p.offset,u.formatStringSegments.push(p),d++,p={offset:d,length:0,value:"",isExpression:!1}):(g(e),d++)):(g(e),d+=2);else if(!p.isExpression||39!==e&&34!==e)a&&e>=128&&(u.nonAsciiInBytes=!0),g(e),d++;else{const t=e;g(e);const n=m(1)===t&&m(2)===t;for(n&&(d+=2,g(e),g(e),u.value+=String.fromCharCode(e),u.value+=String.fromCharCode(e));;){d++;let e=m();if(3===e)break;if(92!==e){if(10===e||13===e)break;if(e===t){if(!n){d++,g(e);break}if(m(1)===t&&m(2)===t){d+=3,g(e),g(e),g(e);break}}g(e)}else g(e),d++,e=m(),g(e)}}}var f}},7093:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=void 0;const i=n(3420),s=n(6956),r=n(9671),o=n(6180),a={and:0,as:1,assert:2,async:3,await:4,break:5,class:6,continue:7,__debug__:8,def:9,del:10,elif:11,else:12,except:13,finally:15,for:16,from:17,global:18,if:19,import:20,in:21,is:22,lambda:23,nonlocal:25,not:26,or:27,pass:28,raise:29,return:30,try:32,while:33,with:34,yield:35,False:14,None:24,True:31},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<e.length&&(e=e.substr(0,t+n))}this._cs=new r.CharacterStream(e),this._cs.position=t,this._tokens=[],this._prevLineStart=0,this._parenDepth=s,this._lineRanges=[],this._indentAmounts=[];const a=t+n;for(;!(this._cs.isEndOfStream()||(this._addNextToken(),this._cs.position>=a)););0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(o.NewLineToken.create(this._cs.position,0,3,this._getComments())),this._setIndent(0,0,!0,!1),this._tokens.push(o.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<e;t++)c+=" "}return{tokens:new i.TextRangeCollection(this._tokens),lines:new i.TextRangeCollection(this._lineRanges),typeIgnoreLines:this._typeIgnoreLines,typeIgnoreAll:this._typeIgnoreAll,predominantEndOfLineSequence:l,predominantTabSequence:c,predominantSingleQuoteCharacter:this._singleQuoteCount>=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(o.Token.create(13,this._cs.position,1,this._getComments()));break;case 41:this._parenDepth>0&&this._parenDepth--,this._tokens.push(o.Token.create(14,this._cs.position,1,this._getComments()));break;case 91:this._parenDepth++,this._tokens.push(o.Token.create(15,this._cs.position,1,this._getComments()));break;case 93:this._parenDepth>0&&this._parenDepth--,this._tokens.push(o.Token.create(16,this._cs.position,1,this._getComments()));break;case 123:this._parenDepth++,this._tokens.push(o.Token.create(17,this._cs.position,1,this._getComments()));break;case 125:this._parenDepth>0&&this._parenDepth--,this._tokens.push(o.Token.create(18,this._cs.position,1,this._getComments()));break;case 44:this._tokens.push(o.Token.create(12,this._cs.position,1,this._getComments()));break;case 96:this._tokens.push(o.Token.create(22,this._cs.position,1,this._getComments()));break;case 59:this._tokens.push(o.Token.create(11,this._cs.position,1,this._getComments()));break;case 58:if(61===this._cs.nextChar){this._tokens.push(o.OperatorToken.create(this._cs.position,2,35,this._getComments())),this._cs.advance(1);break}this._tokens.push(o.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(o.Token.create(19,this._cs.position,3,this._getComments())),this._cs.advance(3),!0;this._tokens.push(o.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(o.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(o.IndentToken.create(this._cs.position,0,t,!1,this._getComments())));else{const s=this._indentAmounts[this._indentAmounts.length-1];if(s.tab8Spaces<t){const r=(s.isSpacePresent&&i||s.isTabPresent&&n)&&s.tab1Spaces>=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(o.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<e.length-1||n===t,r=i<e.length-1?n:t;this._tokens.push(o.DedentToken.create(this._cs.position,0,r,s,this._getComments()))}))}}}_tryIdentifier(){const e=this._cs.position;if(s.isIdentifierStartChar(this._cs.currentChar))for(this._cs.moveNext();s.isIdentifierChar(this._cs.currentChar);)this._cs.moveNext();if(this._cs.position>e){const t=this._cs.getText().substr(e,this._cs.position-e);return void 0!==a[t]?this._tokens.push(o.KeywordToken.create(e,this._cs.position-e,a[t],this._getComments())):this._tokens.push(o.IdentifierToken.create(e,this._cs.position-e,t,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(o.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(o.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(o.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(o.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(o.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();)this._cs.moveNext();const t=this._cs.position-e;return t>0&&(this._tokens.push(o.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=o.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;n<e.length;n++)switch(e[n]){case"u":t|=16;break;case"b":t|=32;break;case"r":t|=8;break;case"f":t|=64}return 39===this._cs.currentChar?(t|=1,39===this._cs.nextChar&&39===this._cs.lookAhead(2)&&(t|=4)):34===this._cs.currentChar&&(t|=2,34===this._cs.nextChar&&34===this._cs.lookAhead(2)&&(t|=4)),t}_handleString(e,t){const n=this._cs.position-t;4&e?this._cs.advance(3):(this._cs.moveNext(),1&e?this._singleQuoteCount++:this._doubleQuoteCount++);const i=this._skipToEndOfStringLiteral(e),s=this._cs.position;this._tokens.push(o.StringToken.create(n,s-n,i.flags,i.escapedValue,t,this._getComments()))}_skipToEndOfStringLiteral(e){const t=1&e?39:34,n=0!=(4&e);let i="";for(;;){if(this._cs.isEndOfStream())return{escapedValue:i,flags:e|=65536};if(92===this._cs.currentChar)i+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext(),13===this._cs.getCurrentChar()||10===this._cs.getCurrentChar()?(13===this._cs.getCurrentChar()&&10===this._cs.nextChar&&(i+=String.fromCharCode(this._cs.getCurrentChar()),this._cs.moveNext()),i+=String.fromCharCode(this._cs.getCurrentChar()),this._cs.moveNext(),this._addLineRange()):(i+=String.fromCharCode(this._cs.getCurrentChar()),this._cs.moveNext());else if(10===this._cs.currentChar||13===this._cs.currentChar){if(!n)return{escapedValue:i,flags:e|=65536};13===this._cs.currentChar&&10===this._cs.nextChar&&(i+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),i+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext(),this._addLineRange()}else{if(!n&&this._cs.currentChar===t){this._cs.moveNext();break}if(n&&this._cs.currentChar===t&&this._cs.nextChar===t&&this._cs.lookAhead(2)===t){this._cs.advance(3);break}i+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()}}return{escapedValue: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()}}},6180:(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,(t.Comment||(t.Comment={})).create=function(e,t,n){return{start:e,length:t,value:n}},(t.Token||(t.Token={})).create=function(e,t,n,i){return{start:t,length:n,type:e,comments:i}},(t.IndentToken||(t.IndentToken={})).create=function(e,t,n,i,s){return{start:e,length:t,type:3,isIndentAmbiguous:i,comments:s,indentAmount:n}},(t.DedentToken||(t.DedentToken={})).create=function(e,t,n,i,s){return{start:e,length:t,type:4,comments:s,indentAmount:n,matchesIndent:i}},(t.NewLineToken||(t.NewLineToken={})).create=function(e,t,n,i){return{start:e,length:t,type:2,comments:i,newLineType:n}},(t.KeywordToken||(t.KeywordToken={})).create=function(e,t,n,i){return{start:e,length:t,type:8,comments:i,keywordType:n}},(t.StringToken||(t.StringToken={})).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.NumberToken||(t.NumberToken={})).create=function(e,t,n,i,s,r){return{start:e,length:t,type:6,isInteger:i,isImaginary:s,value:n,comments:r}},(t.OperatorToken||(t.OperatorToken={})).create=function(e,t,n,i){return{start:e,length:t,type:9,operatorType:n,comments:i}},(t.IdentifierToken||(t.IdentifierToken={})).create=function(e,t,n,i){return{start:e,length:t,type:7,value:n,comments:i}}},7770:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unicodePc=t.unicodeNd=t.unicodeMc=t.unicodeMn=t.unicodeNl=t.unicodeLm=t.unicodeLo=t.unicodeLt=t.unicodeLl=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.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.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.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.unicodeNl=[[5870,5872],[8544,8578],[8581,8584],12295,[12321,12329],[12344,12346],[42726,42735],[65856,65908],66369,66378,[66513,66517],[74752,74862]],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.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.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.unicodePc=[95,[8255,8256],8276,[65075,65076],[65101,65103],65343]},6249: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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.main=void 0;const a=n(8718),l=o(n(3893)),c=o(n(2110)),p=r(n(1765)),d=n(2559),u=n(6708),h=n(1775),m=n(2211),y=n(6657),g=n(7830),f=n(3550);var _;!function(e){e[e.NoErrors=0]="NoErrors",e[e.ErrorsReported=1]="ErrorsReported",e[e.FatalError=2]="FatalError",e[e.ConfigFileParseError=3]="ConfigFileParseError"}(_||(_={}));const T=Object.freeze({isCancellationRequested:!1,onCancellationRequested:function(){return{dispose(){}}}});function v(){return n(306).i8.toString()}function b(e,t){return{file:e,severity:0===t.category?"error":1===t.category?"warning":"information",message:t.message,range:f.isEmptyRange(t.range)?void 0:t.range,rule:t.getRule()}}function S(e,t="  "){let n=t;e.range&&!f.isEmptyRange(e.range)&&(n+=l.default.yellow(`${e.range.start.line+1}`)+":"+l.default.yellow(`${e.range.start.character+1}`)+" - ");const[i,...s]=e.message.split("\n");n+="error"===e.severity?l.default.red("error"):"warning"===e.severity?l.default.cyan("warning"):l.default.blue("info"),n+=`: ${i}`,s.length>0&&(n+="\n"+t+s.join("\n"+t)),e.rule&&(n+=l.default.gray(` (${e.rule})`)),console.log(n)}t.main=function(){"production"===p.env.NODE_ENV&&n(5330).install(),function(){const e=[{name:"createstub",type:String},{name:"dependencies",type:Boolean},{name:"files",type:String,multiple:!0,defaultOption:!0},{name:"help",alias:"h",type:Boolean},{name:"lib",type:Boolean},{name:"outputjson",type:Boolean},{name:"project",alias:"p",type:String},{name:"stats"},{name:"typeshed-path",alias:"t",type:String},{name:"venv-path",alias:"v",type:String},{name:"verifytypes",type:String},{name:"verbose",type:Boolean},{name:"version",type:Boolean},{name:"watch",alias:"w",type:Boolean}];let t;try{t=c.default(e)}catch(e){const t=e;return t&&t.optionName?void console.error(`Unexpected option ${t.optionName}.\npyright --help for usage`):void console.error("Unexpected error\npyright --help for usage")}if(void 0!==t.help)return void console.log("Usage: pyright [options] files...\n  Options:\n  --createstub IMPORT              Create type stub file(s) for import\n  --dependencies                   Emit import dependency information\n  -h,--help                        Show this help message\n  --lib                            Use library code to infer types when stubs are missing\n  --outputjson                     Output results in JSON format\n  -p,--project FILE OR DIRECTORY   Use the configuration file at this location\n  --stats                          Print detailed performance stats\n  -t,--typeshed-path DIRECTORY     Use typeshed type stubs at this location\n  -v,--venv-path DIRECTORY         Directory that contains virtual environments\n  --verbose                        Emit verbose diagnostics\n  --verifytypes PACKAGE            Verify type completeness of a py.typed package  --version                        Print Pyright version\n  -w,--watch                       Continue to run and watch for changes\n");if(void 0!==t.version)return void console.log(`pyright ${v()}`);if(t.outputjson){const e=["watch","stats","verbose","createstub","dependencies"];for(const n of e)if(void 0!==t[n])return void console.error(`'outputjson' option cannot be used with '${n}' option`)}if(void 0!==t.verifytypes){const e=["watch","stats","createstub","dependencies"];for(const n of e)if(void 0!==t[n])return void console.error(`'verifytypes' option cannot be used with '${n}' option`)}if(t.createstub){const e=["watch","stats","verifytypes","dependencies"];for(const n of e)if(void 0!==t[n])return void console.error(`'createstub' option cannot be used with '${n}' option`)}const n=new h.CommandLineOptions(p.cwd(),!1);t.files&&Array.isArray(t.files)?(n.fileSpecs=t.files,n.fileSpecs=n.fileSpecs.map((e=>y.combinePaths(p.cwd(),e)))):n.fileSpecs=[],t.project&&(n.configFilePath=y.combinePaths(p.cwd(),y.normalizePath(t.project))),t["venv-path"]&&(n.venvPath=y.combinePaths(p.cwd(),y.normalizePath(t["venv-path"]))),t["typeshed-path"]&&(n.typeshedPath=y.combinePaths(p.cwd(),y.normalizePath(t["typeshed-path"]))),t.createstub&&(n.typeStubTargetImportName=t.createstub),t.verbose&&(n.verboseOutput=!0),t.lib&&(n.useLibraryCodeForTypes=!0),n.checkOnlyOpenFiles=!1;const i=t.outputjson?new m.NullConsole:void 0,s=g.createFromRealFileSystem(i);void 0!==t.verifytypes&&function(e,t,n,i){try{const s=function(e,t){const n={version:v(),time:Date.now().toString(),diagnostics:[],summary:{filesAnalyzed:t.modules.length,errorCount:0,warningCount:0,informationCount:0,timeInSec:a.timingStats.getTotalDuration()}};return t.diagnostics.forEach((e=>{const t=b("",e);n.diagnostics.push(t),"error"===t.severity?n.summary.errorCount++:"warning"===t.severity?n.summary.warningCount++:"information"===t.severity&&n.summary.informationCount++})),n.typeCompleteness={packageName:e,packageRootDirectory:t.rootDirectory,pyTypedPath:t.pyTypedPath,symbolCount:t.symbolCount,unknownTypeCount:t.unknownTypeCount,missingFunctionDocStringCount:t.missingFunctionDocStringCount,missingClassDocStringCount:t.missingClassDocStringCount,missingDefaultParamCount:t.missingDefaultParamCount,completenessScore:0,modules:[]},t.modules.forEach((e=>{const t={name:e.name,symbols:[]};e.symbols.forEach((e=>{const n={name:e.name,fullName:e.fullName,symbolType:d.PackageTypeVerifier.getSymbolTypeString(e.symbolType)};t.symbols.push(n)})),n.typeCompleteness.modules.push(t)})),t.symbolCount>0&&(n.typeCompleteness.completenessScore=(t.symbolCount-t.unknownTypeCount)/t.symbolCount),n}(t,new d.PackageTypeVerifier(e).verify(t));i?console.log(JSON.stringify(s,void 0,4)):function(e,t){const n=e.typeCompleteness;console.log(`Package name: "${n.packageName}"`),void 0!==n.packageRootDirectory&&console.log(`Package directory: "${n.packageRootDirectory}"`),void 0!==n.pyTypedPath&&console.log(`Path of py.typed file: "${n.pyTypedPath}"`),e.diagnostics.forEach((e=>{"error"===e.severity&&S(e)})),e.diagnostics.forEach((e=>{"error"!==e.severity&&S(e)})),n.modules.length>0&&(console.log(""),console.log(`Public modules: ${n.modules.length}`),n.modules.forEach((e=>{if(console.log(`   ${e.name} (${e.symbols.length} ${1===e.symbols.length?"symbol":"symbols"})`),t)for(const t of e.symbols)console.log(`      ${t.fullName} (${t.symbolType})`)}))),console.log(""),console.log(`Public symbols: ${n.symbolCount}`),console.log(`  Symbols with unknown type: ${n.unknownTypeCount}`),console.log(`  Functions with missing docstring: ${n.missingFunctionDocStringCount}`),console.log(`  Functions with missing default param: ${n.missingDefaultParamCount}`),console.log(`  Classes with missing docstring: ${n.missingClassDocStringCount}`),console.log(`Type completeness score: ${Math.round(1e3*n.completenessScore)/10}%`),console.log(""),console.info(`Completed in ${e.summary.timeInSec}sec`)}(s,n),p.exit(s.typeCompleteness.completenessScore<1?_.ErrorsReported:_.NoErrors)}catch(e){let t="";e instanceof Error&&(t=": "+e.message),console.error("Error occurred when verifying types: "+t),p.exit(_.FatalError)}}(s,t.verifytypes||"",!!t.verbose,!!t.outputjson);const r=void 0!==t.watch;n.watchForSourceChanges=r;const o=new u.AnalyzerService("<default>",s,i);o.setCompletionCallback((e=>{e.fatalErrorOccurred&&p.exit(_.FatalError),e.configParseErrorOccurred&&p.exit(_.ConfigFileParseError);let n=0;if(e.diagnostics.length>0&&!t.createstub&&!t.verifytypes)if(t.outputjson){const t=function(e,t,n){const i={version:v(),time:Date.now().toString(),diagnostics:[],summary:{filesAnalyzed:t,errorCount:0,warningCount:0,informationCount:0,timeInSec:n}};let s=0,r=0,o=0;return e.forEach((e=>{e.diagnostics.forEach((t=>{0!==t.category&&1!==t.category&&2!==t.category||(i.diagnostics.push(b(e.filePath,t)),0===t.category?s++:1===t.category?r++:2===t.category&&o++)}))})),i.summary.errorCount=s,i.summary.warningCount=r,i.summary.informationCount=o,console.log(JSON.stringify(i,void 0,4)),{errorCount:s,warningCount:r,informationCount:o,diagnosticCount:s+r+o}}(e.diagnostics,e.filesInProgram,e.elapsedTime);n+=t.errorCount}else{const t=function(e){let t=0,n=0,i=0;return e.forEach((e=>{const s=e.diagnostics.filter((e=>3!==e.category));s.length>0&&(console.log(`${e.filePath}`),s.forEach((s=>{S(b(e.filePath,s)),0===s.category?t++:1===s.category?n++:2===s.category&&i++})))})),console.log(`${t.toString()} ${1===t?"error":"errors"}, ${n.toString()} ${1===n?"warning":"warnings"}, ${i.toString()} ${1===i?"info":"infos"} `),{errorCount:t,warningCount:n,informationCount:i,diagnosticCount:t+n+i}}(e.diagnostics);n+=t.errorCount}if(t.createstub&&0===e.filesRequiringAnalysis){try{o.writeTypeStub(T),o.dispose(),console.log(`Type stub was created for '${t.createstub}'`)}catch(e){let t="";e instanceof Error&&(t=": "+e.message),console.error("Error occurred when creating type stub: "+t),p.exit(_.FatalError)}p.exit(_.NoErrors)}t.outputjson||(r||a.timingStats.printSummary(console),void 0!==t.stats&&(o.printStats(),a.timingStats.printDetails(console)),t.dependencies&&o.printDependencies(!!t.verbose)),r?t.outputjson||console.log("Watching for file changes..."):p.exit(n>0?_.ErrorsReported:_.NoErrors)})),o.setOptions(n),new Promise((()=>{})).then().catch()}()}},8863:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.main=void 0;const s=n(4714),r=n(5013),o=n(1887),a=n(9560),l=n(9926),c=n(3213),p=n(2211),d=n(2489),u=n(6657),h=n(8992),m=n(8590),y={openFilesTimeInMs:50,noOpenFilesTimeInMs:200};class g extends h.LanguageServerBase{constructor(){const e=n(306).i8||"";super({productName:"Pyright",rootDirectory:global.__rootDirectory||__dirname,version:e,maxAnalysisTimeInForeground:y,supportedCodeActions:[s.CodeActionKind.QuickFix,s.CodeActionKind.SourceOrganizeImports]}),this._controller=new l.CommandController(this)}getSettings(e){return i(this,void 0,void 0,(function*(){const t={watchForSourceChanges:!0,watchForLibraryChanges:!0,openFilesOnly:!0,useLibraryCodeForTypes:!1,disableLanguageServices:!1,disableOrganizeImports:!1,typeCheckingMode:"basic",diagnosticSeverityOverrides:{},logLevel:p.LogLevel.Info,autoImportCompletions:!0};try{const n=yield this.getConfiguration(e.rootUri,"python");if(n){const i=n.pythonPath;i&&d.isString(i)&&!o.isPythonBinary(i)&&(t.pythonPath=u.resolvePaths(e.rootPath,this.expandPathVariables(e.rootPath,i)));const s=n.venvPath;s&&d.isString(s)&&(t.venvPath=u.resolvePaths(e.rootPath,this.expandPathVariables(e.rootPath,s)))}const i=yield this.getConfiguration(e.rootUri,"python.analysis");if(i){const n=i.typeshedPaths;if(n&&Array.isArray(n)&&n.length>0){const i=n[0];i&&d.isString(i)&&(t.typeshedPath=u.resolvePaths(e.rootPath,this.expandPathVariables(e.rootPath,i)))}const s=i.stubPath;s&&d.isString(s)&&(t.stubPath=u.resolvePaths(e.rootPath,this.expandPathVariables(e.rootPath,s)));const r=i.diagnosticSeverityOverrides;if(r)for(const[e,n]of Object.entries(r)){const i=this.getDiagnosticRuleName(e),s=this.getSeverityOverrides(n);i&&s&&(t.diagnosticSeverityOverrides[i]=s)}void 0!==i.diagnosticMode?t.openFilesOnly=this.isOpenFilesOnly(i.diagnosticMode):void 0!==i.openFilesOnly&&(t.openFilesOnly=!!i.openFilesOnly),void 0!==i.useLibraryCodeForTypes&&(t.useLibraryCodeForTypes=!!i.useLibraryCodeForTypes),t.logLevel=this.convertLogLevel(i.logLevel),t.autoSearchPaths=!!i.autoSearchPaths;const o=i.extraPaths;o&&Array.isArray(o)&&o.length>0&&(t.extraPaths=o.filter((e=>e&&d.isString(e))).map((t=>u.resolvePaths(e.rootPath,this.expandPathVariables(e.rootPath,t))))),void 0!==i.typeCheckingMode&&(t.typeCheckingMode=i.typeCheckingMode),void 0!==i.autoImportCompletions&&(t.autoImportCompletions=i.autoImportCompletions)}else t.autoSearchPaths=!0;const s=yield this.getConfiguration(e.rootUri,"pyright");if(s){void 0!==s.openFilesOnly&&(t.openFilesOnly=!!s.openFilesOnly),void 0!==s.useLibraryCodeForTypes&&(t.useLibraryCodeForTypes=!!s.useLibraryCodeForTypes),t.disableLanguageServices=!!s.disableLanguageServices,t.disableOrganizeImports=!!s.disableOrganizeImports;const e=s.typeCheckingMode;e&&d.isString(e)&&(t.typeCheckingMode=e)}}catch(e){this.console.error(`Error reading settings: ${e}`)}return t}))}createBackgroundAnalysis(){if(!d.isDebugMode()&&c.getCancellationFolderName())return new a.BackgroundAnalysis(this.console)}executeCommand(e,t){return this._controller.execute(e,t)}isLongRunningCommand(e){return this._controller.isLongRunningCommand(e)}executeCodeAction(e,t){return i(this,void 0,void 0,(function*(){this.recordUserInteractionTime();const n=u.convertUriToPath(e.textDocument.uri),i=yield this.getWorkspaceForFile(n);return m.CodeActionProvider.getCodeActionsForPosition(i,n,e.range,t)}))}createProgressReporter(){let e;return{isEnabled:e=>!0,begin:()=>{this._hasWindowProgressCapability?(e=this._connection.window.createWorkDoneProgress(),e.then((e=>{e.begin("")})).ignoreErrors()):this._connection.sendNotification("pyright/beginProgress")},report:t=>{e?e.then((e=>{e.report(t)})).ignoreErrors():this._connection.sendNotification("pyright/reportProgress",t)},end:()=>{e?(e.then((e=>{e.done()})).ignoreErrors(),e=void 0):this._connection.sendNotification("pyright/endProgress")}}}}t.main=function(){n(5330).install(),r.isMainThread?new g:(new a.BackgroundAnalysisRunner).start()}},214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceMap=void 0;const i=n(8304);class s extends Map{constructor(e){super(),this._ls=e,this._defaultWorkspacePath="<default>"}getNonDefaultWorkspaces(){const e=[];return this.forEach((t=>{t.rootPath&&e.push(t)})),e}getWorkspaceForFile(e){let t,n;if(this.forEach((i=>{i.rootPath&&e.startsWith(i.rootPath)&&(void 0===t||i.rootPath.startsWith(t))&&(t=i.rootPath,n=i)})),void 0===n){let e=this.get(this._defaultWorkspacePath);if(!e){const t=[...this.keys()];if(1===t.length)return this.get(t[0]);e={workspaceName:"",rootPath:"",rootUri:"",serviceInstance:this._ls.createAnalyzerService(this._defaultWorkspacePath),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:i.createDeferred()},this.set(this._defaultWorkspacePath,e),this._ls.updateSettingsForWorkspace(e).ignoreErrors()}return e}return n}}t.WorkspaceMap=s}};
  //# sourceMappingURL=pyright-internal.js.map